diff --git a/README.md b/README.md index 4134adc..7a1ff60 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,8 @@ language, description, and tags to help you find what you need quickly. | [python/ai-wallet-reputation-nft](./python/ai-wallet-reputation-nft) | Python | AI-generated, soulbound reputation NFTs on BNB Chain | AI, NFT, Reputation | | [typescript/bnbchain-mcp](./typescript/bnbchain-mcp) | TypeScript | AI-powered blockchain assistant using Claude | AI, BSC, MCP | | [typescript/eliza-chatbot](./typescript/eliza-chatbot) | TypeScript | A chatbot example using Eliza plugin-bnb | AI, BSC, opBNB | - +| [solidity/course-contracts](./solidity/course-contracts) | Solidity | This Project Demonstrates an EduFi contract implementation powered by Web3 domain name ownership | BSC | +| [solidity/ens-contracts](./solidity/ens-contracts) | Solidity | This project demonstrates a DNS on BNB Chain with dynamic pricing, lifetime registrations and a referral system | BSC | More examples are coming soon—stay tuned for updates! ## How to Add a New Example diff --git a/solidity/README.md b/solidity/README.md new file mode 100644 index 0000000..2bc757f --- /dev/null +++ b/solidity/README.md @@ -0,0 +1,7 @@ +# Solidity Examples + +This directory contains all Solidity-based examples + +## Structure + +- Each example is organized into its own folder. diff --git a/solidity/dns-contracts/LICENSE.txt b/solidity/dns-contracts/LICENSE.txt new file mode 100644 index 0000000..05514cf --- /dev/null +++ b/solidity/dns-contracts/LICENSE.txt @@ -0,0 +1,7 @@ +Copyright (c) 2018, True Names Limited + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/solidity/dns-contracts/README.md b/solidity/dns-contracts/README.md new file mode 100644 index 0000000..4664b2b --- /dev/null +++ b/solidity/dns-contracts/README.md @@ -0,0 +1,247 @@ +# dns-contracts + +A decentralized naming system on BNB Chain, inspired by ENS, with dynamic token pricing in native currency, CAKE, and USD1, plus a built-in referral system that rewards users for successful mints. + +# Live Link +- [dns.level3labs.fun](https://dns.level3labs.fun) + +# ENS + +For documentation of the ENS system, see [docs.ens.domains](https://docs.ens.domains/). + +## Pre-Deployment + +Before deploying these contracts to setup your own domain name service, You must configure a few details tailored to the TLD you want to deploy. + +First of all, ALL instances of '.creator' in the contracts and deploy scripts must be replaced with your own TLD. For example: + +```solidity +function _setReverseRecord( + string memory name, + address resolver, + address owner + ) internal { + reverseRegistrar.setNameForAddr( + msg.sender, + owner, + resolver, + string.concat(name, ".creator") + ); + } +``` +in ETHRegistrarController.sol should be replaced with: + +```solidity +function _setReverseRecord( + string memory name, + address resolver, + address owner + ) internal { + reverseRegistrar.setNameForAddr( + msg.sender, + owner, + resolver, + string.concat(name, ".") + ); + } +``` + +AND + +```solidity + bytes32 private constant CRE8OR_NODE = + 0x4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454; + + bytes32 private constant CRE8OR_LABELHASH = + 0x0d1f301a4d55e328cfe2f78743e489a98cedaf66d744b3ab1bb877ff82930b0b; + + names[CRE8OR_NODE] = "\x07creator\x00"; +``` + +in Your NameWrapper Contract should be replaced with: + +```solidity + bytes32 private constant CRE8OR_NODE = + Namehash(YourTLD); + + bytes32 private constant CRE8OR_LABELHASH = + Keccak256(YourTLD); + + names[CRE8OR_NODE] = "\xN\x00"; +``` + +Note: In +```solidity + +names[CRE8OR_NODE] = "\xN\x00"; + +``` +'xN' is the number of characters your TLD has. For example, "\x03bnb\x00". + +## Testing + +After deployment of all contracts, to test if the minting process works run: + +```bash +npx hardhat run scripts/ens-test.ts --network +``` + + +## Contracts + +## Registry + +The ENS registry is the core contract that lies at the heart of ENS resolution. All ENS lookups start by querying the registry. The registry maintains a list of domains, recording the owner, resolver, and TTL for each, and allows the owner of a domain to make changes to that data. It also includes some generic registrars. + +### ENS.sol + +Interface of the ENS Registry. + +### ENSRegistry + +Implementation of the ENS Registry, the central contract used to look up resolvers and owners for domains. + +### ENSRegistryWithFallback + +The new implementation of the ENS Registry after [the 2020 ENS Registry Migration](https://docs.ens.domains/ens-migration-february-2020/technical-description#new-ens-deployment). + +### FIFSRegistrar + +Implementation of a simple first-in-first-served registrar, which issues (sub-)domains to the first account to request them. + +### ReverseRegistrar + +Implementation of the reverse registrar responsible for managing reverse resolution via the .addr.reverse special-purpose TLD. + +### TestRegistrar + +Implementation of the `.test` registrar facilitates easy testing of ENS on the Ethereum test networks. Currently deployed on Ropsten network, it provides functionality to instantly claim a domain for test purposes, which expires 28 days after it was claimed. + +### BaseRegistrar + +BaseRegistrar is the contract that owns the TLD in the ENS registry. This contract implements a minimal set of functionality: + +- The owner of the registrar may add and remove controllers. +- Controllers may register new domains and extend the expiry of (renew) existing domains. They can not change the ownership or reduce the expiration time of existing domains. +- Name owners may transfer ownership to another address. +- Name owners may reclaim ownership in the ENS registry if they have lost it. +- Owners of names in the interim registrar may transfer them to the new registrar, during the 1 year transition period. When they do so, their deposit is returned to them in its entirety. + +This separation of concerns provides name owners strong guarantees over continued ownership of their existing names, while still permitting innovation and change in the way names are registered and renewed via the controller mechanism. + +### EthRegistrarController + +EthRegistrarController is the first implementation of a registration controller for the new registrar. This contract implements the following functionality: + +- The owner of the registrar may set a price oracle contract, which determines the cost of registrations and renewals based on the name and the desired registration or renewal duration. +- The owner of the registrar may withdraw any collected funds to their account. +- Users can register new names using a commit/reveal process and by paying the appropriate registration fee. +- Users can renew a name by paying the appropriate fee. Any user may renew a domain, not just the name's owner. + +The commit/reveal process is used to avoid frontrunning, and operates as follows: + +1. A user commits to a hash, the preimage of which contains the name to be registered and a secret value. +2. After a minimum delay period and before the commitment expires, the user calls the register function with the name to register and the secret value from the commitment. If a valid commitment is found and the other preconditions are met, the name is registered. + +The minimum delay and expiry for commitments exist to prevent miners or other users from effectively frontrunning registrations. + +### SimplePriceOracle + +SimplePriceOracle is a trivial implementation of the pricing oracle for the EthRegistrarController that always returns a fixed price per domain per year, determined by the contract owner. + +### TokenPriceOracle + +TokenPriceOracle is a price oracle implementation that allows the contract owner to specify pricing based on the length of a name. It uses a fiat currency oracle to set a fixed price per name and checks the equivalent value in the native chain currency (e.g., BNB), CAKE, and USD1. + +### ReferralController + +The ReferralController contract manages the referral system by allocating a portion of the payment to the referrer after each token mint. It also tracks and calculates the total number of successful referrals made by each address. + +## Resolvers + +Resolver implements a general-purpose ENS resolver that is suitable for most standard ENS use cases. The public resolver permits updates to ENS records by the owner of the corresponding name. + +PublicResolver includes the following profiles that implements different EIPs. + +- ABIResolver = EIP 205 - ABI support (`ABI()`). +- AddrResolver = EIP 137 - Contract address interface. EIP 2304 - Multicoin support (`addr()`). +- ContentHashResolver = EIP 1577 - Content hash support (`contenthash()`). +- InterfaceResolver = EIP 165 - Interface Detection (`supportsInterface()`). +- NameResolver = EIP 181 - Reverse resolution (`name()`). +- PubkeyResolver = EIP 619 - SECP256k1 public keys (`pubkey()`). +- TextResolver = EIP 634 - Text records (`text()`). +- DNSResolver = Experimental support is available for hosting DNS domains on the Ethereum blockchain via ENS. [The more detail](https://veox-ens.readthedocs.io/en/latest/dns.html) is on the old ENS doc. + +## Developer guide + +### Prettier pre-commit hook + +This repo runs a husky precommit to prettify all contract files to keep them consistent. Add new folder/files to `prettier format` script in package.json. If you need to add other tasks to the pre-commit script, add them to `.husky/pre-commit` + +### How to setup + +``` +git clone https://github.com/Level3AI-Hub/ens-contracts +cd ens-contracts +bun i +``` + +### How to publish + +``` +bun run pub +``` + +### Deployment + +``` +NODE_OPTIONS='--experimental-loader ts-node/esm/transpile-only' bun run hardhat --network deploy +``` + +Full list of available networks for deployment is [here](hardhat.config.cts#L38). + +### Release flow + +1. Create a `feature` branch from `staging` branch +2. Make code updates +3. Ensure you are synced up with `staging` +4. Code should now be in a state where you think it can be deployed to production +5. Create a "Release Candidate" [release](https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases) on GitHub. This will be of the form `v1.2.3-RC0`. This tagged commit is now subject to our bug bounty. +6. Have the tagged commit audited if necessary +7. If changes are required, make the changes and then once ready for review create another GitHub release with an incremented RC value `v1.2.3-RC0` -> `v.1.2.3-RC1`. Repeat as necessary. +8. Deploy to testnet. Open a pull request to merge the deploy artifacts into + the `feature` branch. Create GitHub release of the form `v1.2.3-testnet` from the commit that has the new deployment artifacts. +9. Get someone to review and approve the deployment and then merge. You now MUST merge this branch into `staging` branch. +10. If any further changes are needed, you can either make them on the existing feature branch that is in sync or create a new branch, and follow steps 1 -> 9. Repeat as necessary. +11. Make a deployment to ethereum mainnet from `staging`. Create a GitHub release of the form `v1.2.3` from the commit that has the new deployment artifacts. +12. Open a PR to merge into `main`. Have it reviewed and merged. + +### Cherry-picked release flow + +Certain changes can be released in isolation via cherry-picking, although ideally we would always release from `staging`. + +1. Create a new branch from `mainnet`. +2. Cherry-pick from `staging` into new branch. +3. Deploy to ethereum mainnet, tag the commit that has deployment artifacts and create a release. +4. Merge into `mainnet`. + +### Emergency release process + +1. Branch from `main`, make fixes, deploy to testnet (can skip), deploy to mainnet +2. Merge changes back into `main` and `staging` immediately after deploy +3. Create GitHub releases, if you didn't deploy to testnet in step 1, do it now + +### Notes + +- Deployed code should always match source code in mainnet releases. This may not be the case for `staging`. +- `staging` branch and `main` branch should start in sync +- `staging` is intended to be a practice `main`. Only code that is intended to be released to `main` can be merged to `staging`. Consequently: + - Feature branches will be long-lived + - Feature branches must be kept in sync with `staging` + - Audits are conducted on feature branches +- All code that is on `staging` and `main` should be deployed to testnet and mainnet respectively i.e. these branches should not have any undeployed code +- It is preferable to not edit the same file on different feature branches. +- Code on `staging` and `main` will always be a subset of what is deployed, as smart contracts cannot be undeployed. +- Release candidates, `staging` and `main` branch are subject to our bug bounty +- Releases follow semantic versioning and releases should contain a description of changes with developers being the intended audience + diff --git a/solidity/dns-contracts/bun.lock b/solidity/dns-contracts/bun.lock new file mode 100644 index 0000000..dbbb8ad --- /dev/null +++ b/solidity/dns-contracts/bun.lock @@ -0,0 +1,1326 @@ +{ + "lockfileVersion": 1, + "workspaces": { + "": { + "name": "@ensdomains/ens-contracts", + "dependencies": { + "@ensdomains/buffer": "^0.1.1", + "@ensdomains/solsha1": "0.0.3", + "@openzeppelin/contracts": "^4.1.0", + "dns-packet": "^5.3.0", + }, + "devDependencies": { + "@ensdomains/dnsprovejs": "^0.5.1", + "@ensdomains/hardhat-chai-matchers-viem": "^0.0.8", + "@nomicfoundation/hardhat-toolbox-viem": "^3.0.0", + "@types/mocha": "^9.1.1", + "@types/node": "^18.0.0", + "@viem/anvil": "^0.0.10", + "@vitest/expect": "^1.6.0", + "abitype": "^1.0.2", + "chai": "^5.1.1", + "dotenv": "^16.4.5", + "hardhat": "^2.22.2", + "hardhat-abi-exporter": "^2.9.0", + "hardhat-contract-sizer": "^2.6.1", + "hardhat-deploy": "^0.12.4", + "hardhat-gas-reporter": "^1.0.4", + "husky": "^9.1.7", + "prettier": "^2.6.2", + "prettier-plugin-solidity": "^1.0.0-beta.24", + "ts-node": "^10.9.2", + "typescript": "^5.4.5", + "viem": "2.12.0", + }, + }, + }, + "packages": { + "@adraffy/ens-normalize": ["@adraffy/ens-normalize@1.10.0", "", {}, "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q=="], + + "@colors/colors": ["@colors/colors@1.5.0", "", {}, "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ=="], + + "@cspotcode/source-map-support": ["@cspotcode/source-map-support@0.8.1", "", { "dependencies": { "@jridgewell/trace-mapping": "0.3.9" } }, "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw=="], + + "@ensdomains/buffer": ["@ensdomains/buffer@0.1.1", "", {}, "sha512-92SfSiNS8XorgU7OUBHo/i1ZU7JV7iz/6bKuLPNVsMxV79/eI7fJR6jfJJc40zAHjs3ha+Xo965Idomlq3rqnw=="], + + "@ensdomains/dnsprovejs": ["@ensdomains/dnsprovejs@0.5.1", "", { "dependencies": { "@noble/hashes": "^1.3.2", "dns-packet": "^5.6.1", "typescript-logging": "^1.0.1" } }, "sha512-nfm4ggpK5YBVwVwLZKF9WPjRGRTL9aUxX2O4pqv/AnQCz3WeGHsW7VhVFLj2s4EoWSzCXwR1E6nuqgUwnH692w=="], + + "@ensdomains/hardhat-chai-matchers-viem": ["@ensdomains/hardhat-chai-matchers-viem@0.0.8", "", { "dependencies": { "@vitest/expect": "^2.0.0-beta.3" }, "peerDependencies": { "chai": "^5.1.1", "hardhat": "^2.22.3", "viem": "^2.10.2" } }, "sha512-fgEmgedxOBjmLE+tfPsvb2/TuT8K3+edFhvlbpIgelA2zbye+2L0k+49TGsryga2qPGvU2cpkV1oEMGBFpQ+Fg=="], + + "@ensdomains/solsha1": ["@ensdomains/solsha1@0.0.3", "", { "dependencies": { "hash-test-vectors": "^1.3.2" } }, "sha512-uhuG5LzRt/UJC0Ux83cE2rCKwSleRePoYdQVcqPN1wyf3/ekMzT/KZUF9+v7/AG5w9jlMLCQkUM50vfjr0Yu9Q=="], + + "@ethereumjs/rlp": ["@ethereumjs/rlp@4.0.1", "", { "bin": { "rlp": "bin/rlp" } }, "sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw=="], + + "@ethereumjs/util": ["@ethereumjs/util@8.1.0", "", { "dependencies": { "@ethereumjs/rlp": "^4.0.1", "ethereum-cryptography": "^2.0.0", "micro-ftch": "^0.3.1" } }, "sha512-zQ0IqbdX8FZ9aw11vP+dZkKDkS+kgIvQPHnSAXzP9pLu+Rfu3D3XEeLbicvoXJTYnhZiPmsZUxgdzXwNKxRPbA=="], + + "@ethersproject/abi": ["@ethersproject/abi@5.7.0", "", { "dependencies": { "@ethersproject/address": "^5.7.0", "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", "@ethersproject/constants": "^5.7.0", "@ethersproject/hash": "^5.7.0", "@ethersproject/keccak256": "^5.7.0", "@ethersproject/logger": "^5.7.0", "@ethersproject/properties": "^5.7.0", "@ethersproject/strings": "^5.7.0" } }, "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA=="], + + "@ethersproject/abstract-provider": ["@ethersproject/abstract-provider@5.7.0", "", { "dependencies": { "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0", "@ethersproject/networks": "^5.7.0", "@ethersproject/properties": "^5.7.0", "@ethersproject/transactions": "^5.7.0", "@ethersproject/web": "^5.7.0" } }, "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw=="], + + "@ethersproject/abstract-signer": ["@ethersproject/abstract-signer@5.7.0", "", { "dependencies": { "@ethersproject/abstract-provider": "^5.7.0", "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0", "@ethersproject/properties": "^5.7.0" } }, "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ=="], + + "@ethersproject/address": ["@ethersproject/address@5.7.0", "", { "dependencies": { "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", "@ethersproject/keccak256": "^5.7.0", "@ethersproject/logger": "^5.7.0", "@ethersproject/rlp": "^5.7.0" } }, "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA=="], + + "@ethersproject/base64": ["@ethersproject/base64@5.7.0", "", { "dependencies": { "@ethersproject/bytes": "^5.7.0" } }, "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ=="], + + "@ethersproject/basex": ["@ethersproject/basex@5.7.0", "", { "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/properties": "^5.7.0" } }, "sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw=="], + + "@ethersproject/bignumber": ["@ethersproject/bignumber@5.7.0", "", { "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0", "bn.js": "^5.2.1" } }, "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw=="], + + "@ethersproject/bytes": ["@ethersproject/bytes@5.7.0", "", { "dependencies": { "@ethersproject/logger": "^5.7.0" } }, "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A=="], + + "@ethersproject/constants": ["@ethersproject/constants@5.7.0", "", { "dependencies": { "@ethersproject/bignumber": "^5.7.0" } }, "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA=="], + + "@ethersproject/contracts": ["@ethersproject/contracts@5.7.0", "", { "dependencies": { "@ethersproject/abi": "^5.7.0", "@ethersproject/abstract-provider": "^5.7.0", "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/address": "^5.7.0", "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", "@ethersproject/constants": "^5.7.0", "@ethersproject/logger": "^5.7.0", "@ethersproject/properties": "^5.7.0", "@ethersproject/transactions": "^5.7.0" } }, "sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg=="], + + "@ethersproject/hash": ["@ethersproject/hash@5.7.0", "", { "dependencies": { "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/address": "^5.7.0", "@ethersproject/base64": "^5.7.0", "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", "@ethersproject/keccak256": "^5.7.0", "@ethersproject/logger": "^5.7.0", "@ethersproject/properties": "^5.7.0", "@ethersproject/strings": "^5.7.0" } }, "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g=="], + + "@ethersproject/hdnode": ["@ethersproject/hdnode@5.7.0", "", { "dependencies": { "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/basex": "^5.7.0", "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0", "@ethersproject/pbkdf2": "^5.7.0", "@ethersproject/properties": "^5.7.0", "@ethersproject/sha2": "^5.7.0", "@ethersproject/signing-key": "^5.7.0", "@ethersproject/strings": "^5.7.0", "@ethersproject/transactions": "^5.7.0", "@ethersproject/wordlists": "^5.7.0" } }, "sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg=="], + + "@ethersproject/json-wallets": ["@ethersproject/json-wallets@5.7.0", "", { "dependencies": { "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/address": "^5.7.0", "@ethersproject/bytes": "^5.7.0", "@ethersproject/hdnode": "^5.7.0", "@ethersproject/keccak256": "^5.7.0", "@ethersproject/logger": "^5.7.0", "@ethersproject/pbkdf2": "^5.7.0", "@ethersproject/properties": "^5.7.0", "@ethersproject/random": "^5.7.0", "@ethersproject/strings": "^5.7.0", "@ethersproject/transactions": "^5.7.0", "aes-js": "3.0.0", "scrypt-js": "3.0.1" } }, "sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g=="], + + "@ethersproject/keccak256": ["@ethersproject/keccak256@5.7.0", "", { "dependencies": { "@ethersproject/bytes": "^5.7.0", "js-sha3": "0.8.0" } }, "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg=="], + + "@ethersproject/logger": ["@ethersproject/logger@5.7.0", "", {}, "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig=="], + + "@ethersproject/networks": ["@ethersproject/networks@5.7.1", "", { "dependencies": { "@ethersproject/logger": "^5.7.0" } }, "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ=="], + + "@ethersproject/pbkdf2": ["@ethersproject/pbkdf2@5.7.0", "", { "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/sha2": "^5.7.0" } }, "sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw=="], + + "@ethersproject/properties": ["@ethersproject/properties@5.7.0", "", { "dependencies": { "@ethersproject/logger": "^5.7.0" } }, "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw=="], + + "@ethersproject/providers": ["@ethersproject/providers@5.7.2", "", { "dependencies": { "@ethersproject/abstract-provider": "^5.7.0", "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/address": "^5.7.0", "@ethersproject/base64": "^5.7.0", "@ethersproject/basex": "^5.7.0", "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", "@ethersproject/constants": "^5.7.0", "@ethersproject/hash": "^5.7.0", "@ethersproject/logger": "^5.7.0", "@ethersproject/networks": "^5.7.0", "@ethersproject/properties": "^5.7.0", "@ethersproject/random": "^5.7.0", "@ethersproject/rlp": "^5.7.0", "@ethersproject/sha2": "^5.7.0", "@ethersproject/strings": "^5.7.0", "@ethersproject/transactions": "^5.7.0", "@ethersproject/web": "^5.7.0", "bech32": "1.1.4", "ws": "7.4.6" } }, "sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg=="], + + "@ethersproject/random": ["@ethersproject/random@5.7.0", "", { "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0" } }, "sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ=="], + + "@ethersproject/rlp": ["@ethersproject/rlp@5.7.0", "", { "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0" } }, "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w=="], + + "@ethersproject/sha2": ["@ethersproject/sha2@5.7.0", "", { "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0", "hash.js": "1.1.7" } }, "sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw=="], + + "@ethersproject/signing-key": ["@ethersproject/signing-key@5.7.0", "", { "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0", "@ethersproject/properties": "^5.7.0", "bn.js": "^5.2.1", "elliptic": "6.5.4", "hash.js": "1.1.7" } }, "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q=="], + + "@ethersproject/solidity": ["@ethersproject/solidity@5.7.0", "", { "dependencies": { "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", "@ethersproject/keccak256": "^5.7.0", "@ethersproject/logger": "^5.7.0", "@ethersproject/sha2": "^5.7.0", "@ethersproject/strings": "^5.7.0" } }, "sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA=="], + + "@ethersproject/strings": ["@ethersproject/strings@5.7.0", "", { "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/constants": "^5.7.0", "@ethersproject/logger": "^5.7.0" } }, "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg=="], + + "@ethersproject/transactions": ["@ethersproject/transactions@5.7.0", "", { "dependencies": { "@ethersproject/address": "^5.7.0", "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", "@ethersproject/constants": "^5.7.0", "@ethersproject/keccak256": "^5.7.0", "@ethersproject/logger": "^5.7.0", "@ethersproject/properties": "^5.7.0", "@ethersproject/rlp": "^5.7.0", "@ethersproject/signing-key": "^5.7.0" } }, "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ=="], + + "@ethersproject/units": ["@ethersproject/units@5.7.0", "", { "dependencies": { "@ethersproject/bignumber": "^5.7.0", "@ethersproject/constants": "^5.7.0", "@ethersproject/logger": "^5.7.0" } }, "sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg=="], + + "@ethersproject/wallet": ["@ethersproject/wallet@5.7.0", "", { "dependencies": { "@ethersproject/abstract-provider": "^5.7.0", "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/address": "^5.7.0", "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", "@ethersproject/hash": "^5.7.0", "@ethersproject/hdnode": "^5.7.0", "@ethersproject/json-wallets": "^5.7.0", "@ethersproject/keccak256": "^5.7.0", "@ethersproject/logger": "^5.7.0", "@ethersproject/properties": "^5.7.0", "@ethersproject/random": "^5.7.0", "@ethersproject/signing-key": "^5.7.0", "@ethersproject/transactions": "^5.7.0", "@ethersproject/wordlists": "^5.7.0" } }, "sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA=="], + + "@ethersproject/web": ["@ethersproject/web@5.7.1", "", { "dependencies": { "@ethersproject/base64": "^5.7.0", "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0", "@ethersproject/properties": "^5.7.0", "@ethersproject/strings": "^5.7.0" } }, "sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w=="], + + "@ethersproject/wordlists": ["@ethersproject/wordlists@5.7.0", "", { "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/hash": "^5.7.0", "@ethersproject/logger": "^5.7.0", "@ethersproject/properties": "^5.7.0", "@ethersproject/strings": "^5.7.0" } }, "sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA=="], + + "@fastify/busboy": ["@fastify/busboy@2.1.1", "", {}, "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA=="], + + "@jest/schemas": ["@jest/schemas@29.6.3", "", { "dependencies": { "@sinclair/typebox": "^0.27.8" } }, "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA=="], + + "@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.2", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="], + + "@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.0", "", {}, "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ=="], + + "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.9", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" } }, "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ=="], + + "@leichtgewicht/ip-codec": ["@leichtgewicht/ip-codec@2.0.5", "", {}, "sha512-Vo+PSpZG2/fmgmiNzYK9qWRh8h/CHrwD0mo1h1DzL4yzHNSfWYujGTYsWGreD000gcgmZ7K4Ys6Tx9TxtsKdDw=="], + + "@metamask/eth-sig-util": ["@metamask/eth-sig-util@4.0.1", "", { "dependencies": { "ethereumjs-abi": "^0.6.8", "ethereumjs-util": "^6.2.1", "ethjs-util": "^0.1.6", "tweetnacl": "^1.0.3", "tweetnacl-util": "^0.15.1" } }, "sha512-tghyZKLHZjcdlDqCA3gNZmLeR0XvOE9U1qoQO9ohyAZT6Pya+H9vkBPcsyXytmYLNgVoin7CKCmweo/R43V+tQ=="], + + "@noble/curves": ["@noble/curves@1.2.0", "", { "dependencies": { "@noble/hashes": "1.3.2" } }, "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw=="], + + "@noble/hashes": ["@noble/hashes@1.7.1", "", {}, "sha512-B8XBPsn4vT/KJAGqDzbwztd+6Yte3P4V7iafm24bxgDe/mlRuK6xmWPuCNrKt2vDafZ8MfJLlchDG/vYafQEjQ=="], + + "@noble/secp256k1": ["@noble/secp256k1@1.7.1", "", {}, "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw=="], + + "@nodelib/fs.scandir": ["@nodelib/fs.scandir@2.1.5", "", { "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g=="], + + "@nodelib/fs.stat": ["@nodelib/fs.stat@2.0.5", "", {}, "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A=="], + + "@nodelib/fs.walk": ["@nodelib/fs.walk@1.2.8", "", { "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" } }, "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg=="], + + "@nomicfoundation/edr": ["@nomicfoundation/edr@0.7.0", "", { "dependencies": { "@nomicfoundation/edr-darwin-arm64": "0.7.0", "@nomicfoundation/edr-darwin-x64": "0.7.0", "@nomicfoundation/edr-linux-arm64-gnu": "0.7.0", "@nomicfoundation/edr-linux-arm64-musl": "0.7.0", "@nomicfoundation/edr-linux-x64-gnu": "0.7.0", "@nomicfoundation/edr-linux-x64-musl": "0.7.0", "@nomicfoundation/edr-win32-x64-msvc": "0.7.0" } }, "sha512-+Zyu7TE47TGNcPhOfWLPA/zISs32WDMXrhSWdWYyPHDVn/Uux5TVuOeScKb0BR/R8EJ+leR8COUF/EGxvDOVKg=="], + + "@nomicfoundation/edr-darwin-arm64": ["@nomicfoundation/edr-darwin-arm64@0.7.0", "", {}, "sha512-vAH20oh4GaSB/iQFTRcoO8jLc0CLd9XuLY9I7vtcqZWAiM4U1J4Y8cu67PWmtxbvUQOqXR7S6FtAr8/AlWm14g=="], + + "@nomicfoundation/edr-darwin-x64": ["@nomicfoundation/edr-darwin-x64@0.7.0", "", {}, "sha512-WHDdIrPvLlgXQr2eKypBM5xOZAwdxhDAEQIvEMQL8tEEm2qYW2bliUlssBPrs8E3bdivFbe1HizImslMAfU3+g=="], + + "@nomicfoundation/edr-linux-arm64-gnu": ["@nomicfoundation/edr-linux-arm64-gnu@0.7.0", "", {}, "sha512-WXpJB54ukz1no7gxCPXVEw9pgl/9UZ/WO3l1ctyv/T7vOygjqA4SUd6kppTs6MNXAuTiisPtvJ/fmvHiMBLrsw=="], + + "@nomicfoundation/edr-linux-arm64-musl": ["@nomicfoundation/edr-linux-arm64-musl@0.7.0", "", {}, "sha512-1iZYOcEgc+zJI7JQrlAFziuy9sBz1WgnIx3HIIu0J7lBRZ/AXeHHgATb+4InqxtEx9O3W8A0s7f11SyFqJL4Aw=="], + + "@nomicfoundation/edr-linux-x64-gnu": ["@nomicfoundation/edr-linux-x64-gnu@0.7.0", "", {}, "sha512-wSjC94WcR5MM8sg9w3OsAmT6+bbmChJw6uJKoXR3qscps/jdhjzJWzfgT0XGRq3XMUfimyafW2RWOyfX3ouhrQ=="], + + "@nomicfoundation/edr-linux-x64-musl": ["@nomicfoundation/edr-linux-x64-musl@0.7.0", "", {}, "sha512-Us22+AZ7wkG1mZwxqE4S4ZcuwkEA5VrUiBOJSvKHGOgy6vFvB/Euh5Lkp4GovwjrtiXuvyGO2UmtkzymZKDxZw=="], + + "@nomicfoundation/edr-win32-x64-msvc": ["@nomicfoundation/edr-win32-x64-msvc@0.7.0", "", {}, "sha512-HAry0heTsWkzReVtjHwoIq3BgFCvXpVhJ5qPmTnegZGsr/KxqvMmHyDMifzKao4bycU8yrpTSyOiAJt27RWjzQ=="], + + "@nomicfoundation/ethereumjs-common": ["@nomicfoundation/ethereumjs-common@4.0.4", "", { "dependencies": { "@nomicfoundation/ethereumjs-util": "9.0.4" } }, "sha512-9Rgb658lcWsjiicr5GzNCjI1llow/7r0k50dLL95OJ+6iZJcVbi15r3Y0xh2cIO+zgX0WIHcbzIu6FeQf9KPrg=="], + + "@nomicfoundation/ethereumjs-rlp": ["@nomicfoundation/ethereumjs-rlp@5.0.4", "", { "bin": { "rlp": "bin/rlp.cjs" } }, "sha512-8H1S3s8F6QueOc/X92SdrA4RDenpiAEqMg5vJH99kcQaCy/a3Q6fgseo75mgWlbanGJXSlAPtnCeG9jvfTYXlw=="], + + "@nomicfoundation/ethereumjs-tx": ["@nomicfoundation/ethereumjs-tx@5.0.4", "", { "dependencies": { "@nomicfoundation/ethereumjs-common": "4.0.4", "@nomicfoundation/ethereumjs-rlp": "5.0.4", "@nomicfoundation/ethereumjs-util": "9.0.4", "ethereum-cryptography": "0.1.3" }, "peerDependencies": { "c-kzg": "^2.1.2" }, "optionalPeers": ["c-kzg"] }, "sha512-Xjv8wAKJGMrP1f0n2PeyfFCCojHd7iS3s/Ab7qzF1S64kxZ8Z22LCMynArYsVqiFx6rzYy548HNVEyI+AYN/kw=="], + + "@nomicfoundation/ethereumjs-util": ["@nomicfoundation/ethereumjs-util@9.0.4", "", { "dependencies": { "@nomicfoundation/ethereumjs-rlp": "5.0.4", "ethereum-cryptography": "0.1.3" }, "peerDependencies": { "c-kzg": "^2.1.2" }, "optionalPeers": ["c-kzg"] }, "sha512-sLOzjnSrlx9Bb9EFNtHzK/FJFsfg2re6bsGqinFinH1gCqVfz9YYlXiMWwDM4C/L4ywuHFCYwfKTVr/QHQcU0Q=="], + + "@nomicfoundation/hardhat-ignition": ["@nomicfoundation/hardhat-ignition@0.15.9", "", { "dependencies": { "@nomicfoundation/ignition-core": "^0.15.9", "@nomicfoundation/ignition-ui": "^0.15.9", "chalk": "^4.0.0", "debug": "^4.3.2", "fs-extra": "^10.0.0", "json5": "^2.2.3", "prompts": "^2.4.2" }, "peerDependencies": { "@nomicfoundation/hardhat-verify": "^2.0.1", "hardhat": "^2.18.0" } }, "sha512-lSWqhaDOBt6gsqMadkRLvH6HdoFV1v8/bx7z+12cghaOloVwwn48CPoTH2iXXnkqilPGw8rdH5eVTE6UM+2v6Q=="], + + "@nomicfoundation/hardhat-ignition-viem": ["@nomicfoundation/hardhat-ignition-viem@0.15.9", "", { "peerDependencies": { "@nomicfoundation/hardhat-ignition": "^0.15.9", "@nomicfoundation/hardhat-viem": "^2.0.0", "@nomicfoundation/ignition-core": "^0.15.9", "hardhat": "^2.18.0", "viem": "^2.7.6" } }, "sha512-yV5Z7Tc/sHS7FIdpNDNbnrtXzEpDyvMijgqL9pYttcEGAWqG2YD754kuKKteI1oZxe70YDBQNUy94w/w3fdlqA=="], + + "@nomicfoundation/hardhat-network-helpers": ["@nomicfoundation/hardhat-network-helpers@1.0.12", "", { "dependencies": { "ethereumjs-util": "^7.1.4" }, "peerDependencies": { "hardhat": "^2.9.5" } }, "sha512-xTNQNI/9xkHvjmCJnJOTyqDSl8uq1rKb2WOVmixQxFtRd7Oa3ecO8zM0cyC2YmOK+jHB9WPZ+F/ijkHg1CoORA=="], + + "@nomicfoundation/hardhat-toolbox-viem": ["@nomicfoundation/hardhat-toolbox-viem@3.0.0", "", { "dependencies": { "chai-as-promised": "^7.1.1" }, "peerDependencies": { "@nomicfoundation/hardhat-ignition-viem": "^0.15.0", "@nomicfoundation/hardhat-network-helpers": "^1.0.0", "@nomicfoundation/hardhat-verify": "^2.0.0", "@nomicfoundation/hardhat-viem": "^2.0.0", "@types/chai": "^4.2.0", "@types/chai-as-promised": "^7.1.6", "@types/mocha": ">=9.1.0", "@types/node": ">=18.0.0", "chai": "^4.2.0", "hardhat": "^2.11.0", "hardhat-gas-reporter": "^1.0.8", "solidity-coverage": "^0.8.1", "ts-node": ">=8.0.0", "typescript": "^5.0.4", "viem": "^2.7.6" } }, "sha512-cr+aRozCtTwaRz5qc9OVY1kegWrnVwyhHZonICmlcm21cvJ31uvJnuPG688tMbjUvwRDw8tpZYZK0kI5M+4CKg=="], + + "@nomicfoundation/hardhat-verify": ["@nomicfoundation/hardhat-verify@2.0.12", "", { "dependencies": { "@ethersproject/abi": "^5.1.2", "@ethersproject/address": "^5.0.2", "cbor": "^8.1.0", "debug": "^4.1.1", "lodash.clonedeep": "^4.5.0", "picocolors": "^1.1.0", "semver": "^6.3.0", "table": "^6.8.0", "undici": "^5.14.0" }, "peerDependencies": { "hardhat": "^2.0.4" } }, "sha512-Lg3Nu7DCXASQRVI/YysjuAX2z8jwOCbS0w5tz2HalWGSTZThqA0v9N0v0psHbKNqzPJa8bNOeapIVSziyJTnAg=="], + + "@nomicfoundation/hardhat-viem": ["@nomicfoundation/hardhat-viem@2.0.6", "", { "dependencies": { "abitype": "^0.9.8", "lodash.memoize": "^4.1.2" }, "peerDependencies": { "hardhat": "^2.17.0", "viem": "^2.7.6" } }, "sha512-Pl5pvYK5VYKflfoUk4fVBESqKMNBtAIGPIT4j+Q8KNFueAe1vB2PsbRESeNJyW5YLL9pqKaD1RVqLmgIa1yvDg=="], + + "@nomicfoundation/ignition-core": ["@nomicfoundation/ignition-core@0.15.9", "", { "dependencies": { "@ethersproject/address": "5.6.1", "@nomicfoundation/solidity-analyzer": "^0.1.1", "cbor": "^9.0.0", "debug": "^4.3.2", "ethers": "^6.7.0", "fs-extra": "^10.0.0", "immer": "10.0.2", "lodash": "4.17.21", "ndjson": "2.0.0" } }, "sha512-X8W+7UP/UQPorpHUnGvA1OdsEr/edGi8tDpNwEqzaLm83FMZVbRWdOsr3vNICHN2XMzNY/xIm18Cx7xGKL2PQw=="], + + "@nomicfoundation/ignition-ui": ["@nomicfoundation/ignition-ui@0.15.9", "", {}, "sha512-8lzbT7gpJ5PoowPQDQilkwdyqBviUKDMoHp/5rhgnwG1bDslnCS+Lxuo6s9R2akWu9LtEL14dNyqQb6WsURTag=="], + + "@nomicfoundation/solidity-analyzer": ["@nomicfoundation/solidity-analyzer@0.1.2", "", { "optionalDependencies": { "@nomicfoundation/solidity-analyzer-darwin-arm64": "0.1.2", "@nomicfoundation/solidity-analyzer-darwin-x64": "0.1.2", "@nomicfoundation/solidity-analyzer-linux-arm64-gnu": "0.1.2", "@nomicfoundation/solidity-analyzer-linux-arm64-musl": "0.1.2", "@nomicfoundation/solidity-analyzer-linux-x64-gnu": "0.1.2", "@nomicfoundation/solidity-analyzer-linux-x64-musl": "0.1.2", "@nomicfoundation/solidity-analyzer-win32-x64-msvc": "0.1.2" } }, "sha512-q4n32/FNKIhQ3zQGGw5CvPF6GTvDCpYwIf7bEY/dZTZbgfDsHyjJwURxUJf3VQuuJj+fDIFl4+KkBVbw4Ef6jA=="], + + "@nomicfoundation/solidity-analyzer-darwin-arm64": ["@nomicfoundation/solidity-analyzer-darwin-arm64@0.1.2", "", {}, "sha512-JaqcWPDZENCvm++lFFGjrDd8mxtf+CtLd2MiXvMNTBD33dContTZ9TWETwNFwg7JTJT5Q9HEecH7FA+HTSsIUw=="], + + "@nomicfoundation/solidity-analyzer-darwin-x64": ["@nomicfoundation/solidity-analyzer-darwin-x64@0.1.2", "", {}, "sha512-fZNmVztrSXC03e9RONBT+CiksSeYcxI1wlzqyr0L7hsQlK1fzV+f04g2JtQ1c/Fe74ZwdV6aQBdd6Uwl1052sw=="], + + "@nomicfoundation/solidity-analyzer-linux-arm64-gnu": ["@nomicfoundation/solidity-analyzer-linux-arm64-gnu@0.1.2", "", {}, "sha512-3d54oc+9ZVBuB6nbp8wHylk4xh0N0Gc+bk+/uJae+rUgbOBwQSfuGIbAZt1wBXs5REkSmynEGcqx6DutoK0tPA=="], + + "@nomicfoundation/solidity-analyzer-linux-arm64-musl": ["@nomicfoundation/solidity-analyzer-linux-arm64-musl@0.1.2", "", {}, "sha512-iDJfR2qf55vgsg7BtJa7iPiFAsYf2d0Tv/0B+vhtnI16+wfQeTbP7teookbGvAo0eJo7aLLm0xfS/GTkvHIucA=="], + + "@nomicfoundation/solidity-analyzer-linux-x64-gnu": ["@nomicfoundation/solidity-analyzer-linux-x64-gnu@0.1.2", "", {}, "sha512-9dlHMAt5/2cpWyuJ9fQNOUXFB/vgSFORg1jpjX1Mh9hJ/MfZXlDdHQ+DpFCs32Zk5pxRBb07yGvSHk9/fezL+g=="], + + "@nomicfoundation/solidity-analyzer-linux-x64-musl": ["@nomicfoundation/solidity-analyzer-linux-x64-musl@0.1.2", "", {}, "sha512-GzzVeeJob3lfrSlDKQw2bRJ8rBf6mEYaWY+gW0JnTDHINA0s2gPR4km5RLIj1xeZZOYz4zRw+AEeYgLRqB2NXg=="], + + "@nomicfoundation/solidity-analyzer-win32-x64-msvc": ["@nomicfoundation/solidity-analyzer-win32-x64-msvc@0.1.2", "", {}, "sha512-Fdjli4DCcFHb4Zgsz0uEJXZ2K7VEO+w5KVv7HmT7WO10iODdU9csC2az4jrhEsRtiR9Gfd74FlG0NYlw1BMdyA=="], + + "@openzeppelin/contracts": ["@openzeppelin/contracts@4.9.6", "", {}, "sha512-xSmezSupL+y9VkHZJGDoCBpmnB2ogM13ccaYDWqJTfS3dbuHkgjuwDFUmaFauBCboQMGB/S5UqUl2y54X99BmA=="], + + "@scure/base": ["@scure/base@1.1.9", "", {}, "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg=="], + + "@scure/bip32": ["@scure/bip32@1.3.2", "", { "dependencies": { "@noble/curves": "~1.2.0", "@noble/hashes": "~1.3.2", "@scure/base": "~1.1.2" } }, "sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA=="], + + "@scure/bip39": ["@scure/bip39@1.2.1", "", { "dependencies": { "@noble/hashes": "~1.3.0", "@scure/base": "~1.1.0" } }, "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg=="], + + "@sentry/core": ["@sentry/core@5.30.0", "", { "dependencies": { "@sentry/hub": "5.30.0", "@sentry/minimal": "5.30.0", "@sentry/types": "5.30.0", "@sentry/utils": "5.30.0", "tslib": "^1.9.3" } }, "sha512-TmfrII8w1PQZSZgPpUESqjB+jC6MvZJZdLtE/0hZ+SrnKhW3x5WlYLvTXZpcWePYBku7rl2wn1RZu6uT0qCTeg=="], + + "@sentry/hub": ["@sentry/hub@5.30.0", "", { "dependencies": { "@sentry/types": "5.30.0", "@sentry/utils": "5.30.0", "tslib": "^1.9.3" } }, "sha512-2tYrGnzb1gKz2EkMDQcfLrDTvmGcQPuWxLnJKXJvYTQDGLlEvi2tWz1VIHjunmOvJrB5aIQLhm+dcMRwFZDCqQ=="], + + "@sentry/minimal": ["@sentry/minimal@5.30.0", "", { "dependencies": { "@sentry/hub": "5.30.0", "@sentry/types": "5.30.0", "tslib": "^1.9.3" } }, "sha512-BwWb/owZKtkDX+Sc4zCSTNcvZUq7YcH3uAVlmh/gtR9rmUvbzAA3ewLuB3myi4wWRAMEtny6+J/FN/x+2wn9Xw=="], + + "@sentry/node": ["@sentry/node@5.30.0", "", { "dependencies": { "@sentry/core": "5.30.0", "@sentry/hub": "5.30.0", "@sentry/tracing": "5.30.0", "@sentry/types": "5.30.0", "@sentry/utils": "5.30.0", "cookie": "^0.4.1", "https-proxy-agent": "^5.0.0", "lru_map": "^0.3.3", "tslib": "^1.9.3" } }, "sha512-Br5oyVBF0fZo6ZS9bxbJZG4ApAjRqAnqFFurMVJJdunNb80brh7a5Qva2kjhm+U6r9NJAB5OmDyPkA1Qnt+QVg=="], + + "@sentry/tracing": ["@sentry/tracing@5.30.0", "", { "dependencies": { "@sentry/hub": "5.30.0", "@sentry/minimal": "5.30.0", "@sentry/types": "5.30.0", "@sentry/utils": "5.30.0", "tslib": "^1.9.3" } }, "sha512-dUFowCr0AIMwiLD7Fs314Mdzcug+gBVo/+NCMyDw8tFxJkwWAKl7Qa2OZxLQ0ZHjakcj1hNKfCQJ9rhyfOl4Aw=="], + + "@sentry/types": ["@sentry/types@5.30.0", "", {}, "sha512-R8xOqlSTZ+htqrfteCWU5Nk0CDN5ApUTvrlvBuiH1DyP6czDZ4ktbZB0hAgBlVcK0U+qpD3ag3Tqqpa5Q67rPw=="], + + "@sentry/utils": ["@sentry/utils@5.30.0", "", { "dependencies": { "@sentry/types": "5.30.0", "tslib": "^1.9.3" } }, "sha512-zaYmoH0NWWtvnJjC9/CBseXMtKHm/tm40sz3YfJRxeQjyzRqNQPgivpd9R/oDJCYj999mzdW382p/qi2ypjLww=="], + + "@sinclair/typebox": ["@sinclair/typebox@0.27.8", "", {}, "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA=="], + + "@solidity-parser/parser": ["@solidity-parser/parser@0.19.0", "", {}, "sha512-RV16k/qIxW/wWc+mLzV3ARyKUaMUTBy9tOLMzFhtNSKYeTAanQ3a5MudJKf/8arIFnA2L27SNjarQKmFg0w/jA=="], + + "@tsconfig/node10": ["@tsconfig/node10@1.0.11", "", {}, "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw=="], + + "@tsconfig/node12": ["@tsconfig/node12@1.0.11", "", {}, "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag=="], + + "@tsconfig/node14": ["@tsconfig/node14@1.0.3", "", {}, "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow=="], + + "@tsconfig/node16": ["@tsconfig/node16@1.0.4", "", {}, "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA=="], + + "@types/bn.js": ["@types/bn.js@5.1.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-Xh8vSwUeMKeYYrj3cX4lGQgFSF/N03r+tv4AiLl1SucqV+uTQpxRcnM8AkXKHwYP9ZPXOYXRr2KPXpVlIvqh9w=="], + + "@types/chai": ["@types/chai@4.3.20", "", {}, "sha512-/pC9HAB5I/xMlc5FP77qjCnI16ChlJfW0tGa0IUcFn38VJrTV6DeZ60NU5KZBtaOZqjdpwTWohz5HU1RrhiYxQ=="], + + "@types/chai-as-promised": ["@types/chai-as-promised@7.1.8", "", { "dependencies": { "@types/chai": "*" } }, "sha512-ThlRVIJhr69FLlh6IctTXFkmhtP3NpMZ2QGq69StYLyKZFp/HOp1VdKZj7RvfNWYYcJ1xlbLGLLWj1UvP5u/Gw=="], + + "@types/concat-stream": ["@types/concat-stream@1.6.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-eHE4cQPoj6ngxBZMvVf6Hw7Mh4jMW4U9lpGmS5GBPB9RYxlFg+CHaVN7ErNY4W9XfLIEn20b4VDYaIrbq0q4uA=="], + + "@types/estree": ["@types/estree@1.0.6", "", {}, "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw=="], + + "@types/form-data": ["@types/form-data@0.0.33", "", { "dependencies": { "@types/node": "*" } }, "sha512-8BSvG1kGm83cyJITQMZSulnl6QV8jqAGreJsc5tPu1Jq0vTSOiY/k24Wx82JRpWwZSqrala6sd5rWi6aNXvqcw=="], + + "@types/glob": ["@types/glob@7.2.0", "", { "dependencies": { "@types/minimatch": "*", "@types/node": "*" } }, "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA=="], + + "@types/lru-cache": ["@types/lru-cache@5.1.1", "", {}, "sha512-ssE3Vlrys7sdIzs5LOxCzTVMsU7i9oa/IaW92wF32JFb3CVczqOkru2xspuKczHEbG3nvmPY7IFqVmGGHdNbYw=="], + + "@types/minimatch": ["@types/minimatch@5.1.2", "", {}, "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA=="], + + "@types/mocha": ["@types/mocha@9.1.1", "", {}, "sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw=="], + + "@types/node": ["@types/node@18.19.74", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-HMwEkkifei3L605gFdV+/UwtpxP6JSzM+xFk2Ia6DNFSwSVBRh9qp5Tgf4lNFOMfPVuU0WnkcWpXZpgn5ufO4A=="], + + "@types/pbkdf2": ["@types/pbkdf2@3.1.2", "", { "dependencies": { "@types/node": "*" } }, "sha512-uRwJqmiXmh9++aSu1VNEn3iIxWOhd8AHXNSdlaLfdAAdSTY9jYVeGWnzejM3dvrkbqE3/hyQkQQ29IFATEGlew=="], + + "@types/qs": ["@types/qs@6.9.18", "", {}, "sha512-kK7dgTYDyGqS+e2Q4aK9X3D7q234CIZ1Bv0q/7Z5IwRDoADNU81xXJK/YVyLbLTZCoIwUoDoffFeF+p/eIklAA=="], + + "@types/secp256k1": ["@types/secp256k1@4.0.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-hHxJU6PAEUn0TP4S/ZOzuTUvJWuZ6eIKeNKb5RBpODvSl6hp1Wrw4s7ATY50rklRCScUDpHzVA/DQdSjJ3UoYQ=="], + + "@viem/anvil": ["@viem/anvil@0.0.10", "", { "dependencies": { "execa": "^7.1.1", "get-port": "^6.1.2", "http-proxy": "^1.18.1", "ws": "^8.13.0" } }, "sha512-9PzYXBRikfSUhhm8Bd0avv07agwcbMJ5FaSu2D2vbE0cxkvXGtolL3fW5nz2yefMqOqVQL4XzfM5nwY81x3ytw=="], + + "@vitest/expect": ["@vitest/expect@1.6.0", "", { "dependencies": { "@vitest/spy": "1.6.0", "@vitest/utils": "1.6.0", "chai": "^4.3.10" } }, "sha512-ixEvFVQjycy/oNgHjqsL6AZCDduC+tflRluaHIzKIsdbzkLn2U/iBnVeJwB6HsIjQBdfMR8Z0tRxKUsvFJEeWQ=="], + + "@vitest/pretty-format": ["@vitest/pretty-format@2.1.8", "", { "dependencies": { "tinyrainbow": "^1.2.0" } }, "sha512-9HiSZ9zpqNLKlbIDRWOnAWqgcA7xu+8YxXSekhr0Ykab7PAYFkhkwoqVArPOtJhPmYeE2YHgKZlj3CP36z2AJQ=="], + + "@vitest/spy": ["@vitest/spy@1.6.0", "", { "dependencies": { "tinyspy": "^2.2.0" } }, "sha512-leUTap6B/cqi/bQkXUu6bQV5TZPx7pmMBKBQiI0rJA8c3pB56ZsaTbREnF7CJfmvAS4V2cXIBAh/3rVwrrCYgw=="], + + "@vitest/utils": ["@vitest/utils@1.6.0", "", { "dependencies": { "diff-sequences": "^29.6.3", "estree-walker": "^3.0.3", "loupe": "^2.3.7", "pretty-format": "^29.7.0" } }, "sha512-21cPiuGMoMZwiOHa2i4LXkMkMkCGzA+MVFV70jRwHo95dL4x/ts5GZhML1QWuy7yfp3WzK3lRvZi3JnXTYqrBw=="], + + "abbrev": ["abbrev@1.0.9", "", {}, "sha512-LEyx4aLEC3x6T0UguF6YILf+ntvmOaWsVfENmIW0E9H09vKlLDGelMjjSm0jkDHALj8A8quZ/HapKNigzwge+Q=="], + + "abitype": ["abitype@1.0.8", "", { "peerDependencies": { "typescript": ">=5.0.4", "zod": "^3 >=3.22.0" }, "optionalPeers": ["typescript", "zod"] }, "sha512-ZeiI6h3GnW06uYDLx0etQtX/p8E24UaHHBj57RSjK7YBFe7iuVn07EDpOeP451D06sF27VOz9JJPlIKJmXgkEg=="], + + "acorn": ["acorn@8.14.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA=="], + + "acorn-walk": ["acorn-walk@8.3.4", "", { "dependencies": { "acorn": "^8.11.0" } }, "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g=="], + + "adm-zip": ["adm-zip@0.4.16", "", {}, "sha512-TFi4HBKSGfIKsK5YCkKaaFG2m4PEDyViZmEwof3MTIgzimHLto6muaHVpbrljdIvIrFZzEq/p4nafOeLcYegrg=="], + + "aes-js": ["aes-js@3.0.0", "", {}, "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw=="], + + "agent-base": ["agent-base@6.0.2", "", { "dependencies": { "debug": "4" } }, "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ=="], + + "aggregate-error": ["aggregate-error@3.1.0", "", { "dependencies": { "clean-stack": "^2.0.0", "indent-string": "^4.0.0" } }, "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA=="], + + "ajv": ["ajv@8.17.1", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g=="], + + "amdefine": ["amdefine@1.0.1", "", {}, "sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg=="], + + "ansi-align": ["ansi-align@3.0.1", "", { "dependencies": { "string-width": "^4.1.0" } }, "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w=="], + + "ansi-colors": ["ansi-colors@4.1.3", "", {}, "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw=="], + + "ansi-escapes": ["ansi-escapes@4.3.2", "", { "dependencies": { "type-fest": "^0.21.3" } }, "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ=="], + + "ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], + + "ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], + + "antlr4ts": ["antlr4ts@0.5.0-alpha.4", "", {}, "sha512-WPQDt1B74OfPv/IMS2ekXAKkTZIHl88uMetg6q3OTqgFxZ/dxDXI0EWLyZid/1Pe6hTftyg5N7gel5wNAGxXyQ=="], + + "anymatch": ["anymatch@3.1.3", "", { "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" } }, "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw=="], + + "arg": ["arg@4.1.3", "", {}, "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="], + + "argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], + + "array-union": ["array-union@2.1.0", "", {}, "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw=="], + + "array-uniq": ["array-uniq@1.0.3", "", {}, "sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q=="], + + "asap": ["asap@2.0.6", "", {}, "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA=="], + + "assertion-error": ["assertion-error@2.0.1", "", {}, "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA=="], + + "astral-regex": ["astral-regex@2.0.0", "", {}, "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ=="], + + "async": ["async@1.5.2", "", {}, "sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w=="], + + "asynckit": ["asynckit@0.4.0", "", {}, "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="], + + "axios": ["axios@0.21.4", "", { "dependencies": { "follow-redirects": "^1.14.0" } }, "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg=="], + + "balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], + + "base-x": ["base-x@3.0.10", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-7d0s06rR9rYaIWHkpfLIFICM/tkSVdoPC9qYAQRpxn9DdKNWNsKC0uk++akckyLq16Tx2WIinnZ6WRriAt6njQ=="], + + "bech32": ["bech32@1.1.4", "", {}, "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ=="], + + "binary-extensions": ["binary-extensions@2.3.0", "", {}, "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw=="], + + "blakejs": ["blakejs@1.2.1", "", {}, "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ=="], + + "bn.js": ["bn.js@4.12.1", "", {}, "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg=="], + + "boxen": ["boxen@5.1.2", "", { "dependencies": { "ansi-align": "^3.0.0", "camelcase": "^6.2.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.1", "string-width": "^4.2.2", "type-fest": "^0.20.2", "widest-line": "^3.1.0", "wrap-ansi": "^7.0.0" } }, "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ=="], + + "brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="], + + "braces": ["braces@3.0.3", "", { "dependencies": { "fill-range": "^7.1.1" } }, "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA=="], + + "brorand": ["brorand@1.1.0", "", {}, "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w=="], + + "browser-stdout": ["browser-stdout@1.3.1", "", {}, "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw=="], + + "browserify-aes": ["browserify-aes@1.2.0", "", { "dependencies": { "buffer-xor": "^1.0.3", "cipher-base": "^1.0.0", "create-hash": "^1.1.0", "evp_bytestokey": "^1.0.3", "inherits": "^2.0.1", "safe-buffer": "^5.0.1" } }, "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA=="], + + "bs58": ["bs58@4.0.1", "", { "dependencies": { "base-x": "^3.0.2" } }, "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw=="], + + "bs58check": ["bs58check@2.1.2", "", { "dependencies": { "bs58": "^4.0.0", "create-hash": "^1.1.0", "safe-buffer": "^5.1.2" } }, "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA=="], + + "buffer-from": ["buffer-from@1.1.2", "", {}, "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="], + + "buffer-xor": ["buffer-xor@1.0.3", "", {}, "sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ=="], + + "bytes": ["bytes@3.1.2", "", {}, "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="], + + "call-bind-apply-helpers": ["call-bind-apply-helpers@1.0.1", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2" } }, "sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g=="], + + "call-bound": ["call-bound@1.0.3", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "get-intrinsic": "^1.2.6" } }, "sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA=="], + + "camelcase": ["camelcase@6.3.0", "", {}, "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA=="], + + "caseless": ["caseless@0.12.0", "", {}, "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw=="], + + "cbor": ["cbor@8.1.0", "", { "dependencies": { "nofilter": "^3.1.0" } }, "sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg=="], + + "chai": ["chai@5.1.2", "", { "dependencies": { "assertion-error": "^2.0.1", "check-error": "^2.1.1", "deep-eql": "^5.0.1", "loupe": "^3.1.0", "pathval": "^2.0.0" } }, "sha512-aGtmf24DW6MLHHG5gCx4zaI3uBq3KRtxeVs0DjFH6Z0rDNbsvTxFASFvdj79pxjxZ8/5u3PIiN3IwEIQkiiuPw=="], + + "chai-as-promised": ["chai-as-promised@7.1.2", "", { "dependencies": { "check-error": "^1.0.2" }, "peerDependencies": { "chai": ">= 2.1.2 < 6" } }, "sha512-aBDHZxRzYnUYuIAIPBH2s511DjlKPzXNlXSGFC8CwmroWQLfrW0LtE1nK3MAwwNhJPa9raEjNCmRoFpG0Hurdw=="], + + "chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], + + "charenc": ["charenc@0.0.2", "", {}, "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA=="], + + "check-error": ["check-error@2.1.1", "", {}, "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw=="], + + "chokidar": ["chokidar@4.0.3", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="], + + "ci-info": ["ci-info@2.0.0", "", {}, "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ=="], + + "cipher-base": ["cipher-base@1.0.6", "", { "dependencies": { "inherits": "^2.0.4", "safe-buffer": "^5.2.1" } }, "sha512-3Ek9H3X6pj5TgenXYtNWdaBon1tgYCaebd+XPg0keyjEbEfkD4KkmAxkQ/i1vYvxdcT5nscLBfq9VJRmCBcFSw=="], + + "clean-stack": ["clean-stack@2.2.0", "", {}, "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A=="], + + "cli-boxes": ["cli-boxes@2.2.1", "", {}, "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw=="], + + "cli-table3": ["cli-table3@0.6.5", "", { "dependencies": { "string-width": "^4.2.0" }, "optionalDependencies": { "@colors/colors": "1.5.0" } }, "sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ=="], + + "cliui": ["cliui@7.0.4", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^7.0.0" } }, "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ=="], + + "color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], + + "color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], + + "colors": ["colors@1.4.0", "", {}, "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA=="], + + "combined-stream": ["combined-stream@1.0.8", "", { "dependencies": { "delayed-stream": "~1.0.0" } }, "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg=="], + + "command-exists": ["command-exists@1.2.9", "", {}, "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w=="], + + "commander": ["commander@8.3.0", "", {}, "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww=="], + + "concat-map": ["concat-map@0.0.1", "", {}, "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="], + + "concat-stream": ["concat-stream@1.6.2", "", { "dependencies": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^2.2.2", "typedarray": "^0.0.6" } }, "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw=="], + + "cookie": ["cookie@0.4.2", "", {}, "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA=="], + + "core-util-is": ["core-util-is@1.0.3", "", {}, "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="], + + "create-hash": ["create-hash@1.2.0", "", { "dependencies": { "cipher-base": "^1.0.1", "inherits": "^2.0.1", "md5.js": "^1.3.4", "ripemd160": "^2.0.1", "sha.js": "^2.4.0" } }, "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg=="], + + "create-hmac": ["create-hmac@1.1.7", "", { "dependencies": { "cipher-base": "^1.0.3", "create-hash": "^1.1.0", "inherits": "^2.0.1", "ripemd160": "^2.0.0", "safe-buffer": "^5.0.1", "sha.js": "^2.4.8" } }, "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg=="], + + "create-require": ["create-require@1.1.1", "", {}, "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ=="], + + "cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="], + + "crypt": ["crypt@0.0.2", "", {}, "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow=="], + + "death": ["death@1.1.0", "", {}, "sha512-vsV6S4KVHvTGxbEcij7hkWRv0It+sGGWVOM67dQde/o5Xjnr+KmLjxWJii2uEObIrt1CcM9w0Yaovx+iOlIL+w=="], + + "debug": ["debug@4.4.0", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA=="], + + "decamelize": ["decamelize@4.0.0", "", {}, "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ=="], + + "deep-eql": ["deep-eql@5.0.2", "", {}, "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q=="], + + "deep-is": ["deep-is@0.1.4", "", {}, "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ=="], + + "delayed-stream": ["delayed-stream@1.0.0", "", {}, "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="], + + "delete-empty": ["delete-empty@3.0.0", "", { "dependencies": { "ansi-colors": "^4.1.0", "minimist": "^1.2.0", "path-starts-with": "^2.0.0", "rimraf": "^2.6.2" }, "bin": { "delete-empty": "bin/cli.js" } }, "sha512-ZUyiwo76W+DYnKsL3Kim6M/UOavPdBJgDYWOmuQhYaZvJH0AXAHbUNyEDtRbBra8wqqr686+63/0azfEk1ebUQ=="], + + "depd": ["depd@2.0.0", "", {}, "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="], + + "diff": ["diff@4.0.2", "", {}, "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A=="], + + "diff-sequences": ["diff-sequences@29.6.3", "", {}, "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q=="], + + "difflib": ["difflib@0.2.4", "", { "dependencies": { "heap": ">= 0.2.0" } }, "sha512-9YVwmMb0wQHQNr5J9m6BSj6fk4pfGITGQOOs+D9Fl+INODWFOfvhIU1hNv6GgR1RBoC/9NJcwu77zShxV0kT7w=="], + + "dir-glob": ["dir-glob@3.0.1", "", { "dependencies": { "path-type": "^4.0.0" } }, "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA=="], + + "dns-packet": ["dns-packet@5.6.1", "", { "dependencies": { "@leichtgewicht/ip-codec": "^2.0.1" } }, "sha512-l4gcSouhcgIKRvyy99RNVOgxXiicE+2jZoNmaNmZ6JXiGajBOJAesk1OBlJuM5k2c+eudGdLxDqXuPCKIj6kpw=="], + + "dotenv": ["dotenv@16.4.7", "", {}, "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ=="], + + "dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="], + + "elliptic": ["elliptic@6.6.1", "", { "dependencies": { "bn.js": "^4.11.9", "brorand": "^1.1.0", "hash.js": "^1.0.0", "hmac-drbg": "^1.0.1", "inherits": "^2.0.4", "minimalistic-assert": "^1.0.1", "minimalistic-crypto-utils": "^1.0.1" } }, "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g=="], + + "emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], + + "encode-utf8": ["encode-utf8@1.0.3", "", {}, "sha512-ucAnuBEhUK4boH2HjVYG5Q2mQyPorvv0u/ocS+zhdw0S8AlHYY+GOFhP1Gio5z4icpP2ivFSvhtFjQi8+T9ppw=="], + + "enquirer": ["enquirer@2.4.1", "", { "dependencies": { "ansi-colors": "^4.1.1", "strip-ansi": "^6.0.1" } }, "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ=="], + + "env-paths": ["env-paths@2.2.1", "", {}, "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A=="], + + "error-stack-parser": ["error-stack-parser@1.3.6", "", { "dependencies": { "stackframe": "^0.3.1" } }, "sha512-xhuSYd8wLgOXwNgjcPeXMPL/IiiA1Huck+OPvClpJViVNNlJVtM41o+1emp7bPvlCJwCatFX2DWc05/DgfbWzA=="], + + "es-define-property": ["es-define-property@1.0.1", "", {}, "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="], + + "es-errors": ["es-errors@1.3.0", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="], + + "es-object-atoms": ["es-object-atoms@1.1.1", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA=="], + + "escalade": ["escalade@3.2.0", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="], + + "escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="], + + "escodegen": ["escodegen@1.8.1", "", { "dependencies": { "esprima": "^2.7.1", "estraverse": "^1.9.1", "esutils": "^2.0.2", "optionator": "^0.8.1" }, "optionalDependencies": { "source-map": "~0.2.0" }, "bin": { "esgenerate": "./bin/esgenerate.js", "escodegen": "./bin/escodegen.js" } }, "sha512-yhi5S+mNTOuRvyW4gWlg5W1byMaQGWWSYHXsuFZ7GBo7tpyOwi2EdzMP/QWxh9hwkD2m+wDVHJsxhRIj+v/b/A=="], + + "esprima": ["esprima@2.7.3", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-OarPfz0lFCiW4/AV2Oy1Rp9qu0iusTKqykwTspGCZtPxmF81JR4MmIebvF1F9+UOKth2ZubLQ4XGGaU+hSn99A=="], + + "estraverse": ["estraverse@1.9.3", "", {}, "sha512-25w1fMXQrGdoquWnScXZGckOv+Wes+JDnuN/+7ex3SauFRS72r2lFDec0EKPt2YD1wUJ/IrfEex+9yp4hfSOJA=="], + + "estree-walker": ["estree-walker@3.0.3", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g=="], + + "esutils": ["esutils@2.0.3", "", {}, "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="], + + "eth-gas-reporter": ["eth-gas-reporter@0.2.27", "", { "dependencies": { "@solidity-parser/parser": "^0.14.0", "axios": "^1.5.1", "cli-table3": "^0.5.0", "colors": "1.4.0", "ethereum-cryptography": "^1.0.3", "ethers": "^5.7.2", "fs-readdir-recursive": "^1.1.0", "lodash": "^4.17.14", "markdown-table": "^1.1.3", "mocha": "^10.2.0", "req-cwd": "^2.0.0", "sha1": "^1.1.1", "sync-request": "^6.0.0" }, "peerDependencies": { "@codechecks/client": "^0.1.0" }, "optionalPeers": ["@codechecks/client"] }, "sha512-femhvoAM7wL0GcI8ozTdxfuBtBFJ9qsyIAsmKVjlWAHUbdnnXHt+lKzz/kmldM5lA9jLuNHGwuIxorNpLbR1Zw=="], + + "ethereum-bloom-filters": ["ethereum-bloom-filters@1.2.0", "", { "dependencies": { "@noble/hashes": "^1.4.0" } }, "sha512-28hyiE7HVsWubqhpVLVmZXFd4ITeHi+BUu05o9isf0GUpMtzBUi+8/gFrGaGYzvGAJQmJ3JKj77Mk9G98T84rA=="], + + "ethereum-cryptography": ["ethereum-cryptography@1.2.0", "", { "dependencies": { "@noble/hashes": "1.2.0", "@noble/secp256k1": "1.7.1", "@scure/bip32": "1.1.5", "@scure/bip39": "1.1.1" } }, "sha512-6yFQC9b5ug6/17CQpCyE3k9eKBMdhyVjzUy1WkiuY/E4vj/SXDBbCw8QEIaXqf0Mf2SnY6RmpDcwlUmBSS0EJw=="], + + "ethereumjs-abi": ["ethereumjs-abi@0.6.8", "", { "dependencies": { "bn.js": "^4.11.8", "ethereumjs-util": "^6.0.0" } }, "sha512-Tx0r/iXI6r+lRsdvkFDlut0N08jWMnKRZ6Gkq+Nmw75lZe4e6o3EkSnkaBP5NF6+m5PTGAr9JP43N3LyeoglsA=="], + + "ethereumjs-util": ["ethereumjs-util@7.1.5", "", { "dependencies": { "@types/bn.js": "^5.1.0", "bn.js": "^5.1.2", "create-hash": "^1.1.2", "ethereum-cryptography": "^0.1.3", "rlp": "^2.2.4" } }, "sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg=="], + + "ethers": ["ethers@5.7.2", "", { "dependencies": { "@ethersproject/abi": "5.7.0", "@ethersproject/abstract-provider": "5.7.0", "@ethersproject/abstract-signer": "5.7.0", "@ethersproject/address": "5.7.0", "@ethersproject/base64": "5.7.0", "@ethersproject/basex": "5.7.0", "@ethersproject/bignumber": "5.7.0", "@ethersproject/bytes": "5.7.0", "@ethersproject/constants": "5.7.0", "@ethersproject/contracts": "5.7.0", "@ethersproject/hash": "5.7.0", "@ethersproject/hdnode": "5.7.0", "@ethersproject/json-wallets": "5.7.0", "@ethersproject/keccak256": "5.7.0", "@ethersproject/logger": "5.7.0", "@ethersproject/networks": "5.7.1", "@ethersproject/pbkdf2": "5.7.0", "@ethersproject/properties": "5.7.0", "@ethersproject/providers": "5.7.2", "@ethersproject/random": "5.7.0", "@ethersproject/rlp": "5.7.0", "@ethersproject/sha2": "5.7.0", "@ethersproject/signing-key": "5.7.0", "@ethersproject/solidity": "5.7.0", "@ethersproject/strings": "5.7.0", "@ethersproject/transactions": "5.7.0", "@ethersproject/units": "5.7.0", "@ethersproject/wallet": "5.7.0", "@ethersproject/web": "5.7.1", "@ethersproject/wordlists": "5.7.0" } }, "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg=="], + + "ethjs-unit": ["ethjs-unit@0.1.6", "", { "dependencies": { "bn.js": "4.11.6", "number-to-bn": "1.7.0" } }, "sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw=="], + + "ethjs-util": ["ethjs-util@0.1.6", "", { "dependencies": { "is-hex-prefixed": "1.0.0", "strip-hex-prefix": "1.0.0" } }, "sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w=="], + + "eventemitter3": ["eventemitter3@4.0.7", "", {}, "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="], + + "evp_bytestokey": ["evp_bytestokey@1.0.3", "", { "dependencies": { "md5.js": "^1.3.4", "safe-buffer": "^5.1.1" } }, "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA=="], + + "execa": ["execa@7.2.0", "", { "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.1", "human-signals": "^4.3.0", "is-stream": "^3.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^5.1.0", "onetime": "^6.0.0", "signal-exit": "^3.0.7", "strip-final-newline": "^3.0.0" } }, "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA=="], + + "fast-deep-equal": ["fast-deep-equal@3.1.3", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="], + + "fast-glob": ["fast-glob@3.3.3", "", { "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", "glob-parent": "^5.1.2", "merge2": "^1.3.0", "micromatch": "^4.0.8" } }, "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg=="], + + "fast-levenshtein": ["fast-levenshtein@2.0.6", "", {}, "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw=="], + + "fast-uri": ["fast-uri@3.0.6", "", {}, "sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw=="], + + "fastq": ["fastq@1.18.0", "", { "dependencies": { "reusify": "^1.0.4" } }, "sha512-QKHXPW0hD8g4UET03SdOdunzSouc9N4AuHdsX8XNcTsuz+yYFILVNIX4l9yHABMhiEI9Db0JTTIpu0wB+Y1QQw=="], + + "fdir": ["fdir@6.4.3", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw=="], + + "fill-range": ["fill-range@7.1.1", "", { "dependencies": { "to-regex-range": "^5.0.1" } }, "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg=="], + + "find-up": ["find-up@5.0.0", "", { "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng=="], + + "flat": ["flat@5.0.2", "", { "bin": { "flat": "cli.js" } }, "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ=="], + + "fmix": ["fmix@0.1.0", "", { "dependencies": { "imul": "^1.0.0" } }, "sha512-Y6hyofImk9JdzU8k5INtTXX1cu8LDlePWDFU5sftm9H+zKCr5SGrVjdhkvsim646cw5zD0nADj8oHyXMZmCZ9w=="], + + "follow-redirects": ["follow-redirects@1.15.9", "", {}, "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ=="], + + "form-data": ["form-data@4.0.1", "", { "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "mime-types": "^2.1.12" } }, "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw=="], + + "fp-ts": ["fp-ts@1.19.3", "", {}, "sha512-H5KQDspykdHuztLTg+ajGN0Z2qUjcEf3Ybxc6hLt0k7/zPkn29XnKnxlBPyW2XIddWrGaJBzBl4VLYOtk39yZg=="], + + "fs-extra": ["fs-extra@7.0.1", "", { "dependencies": { "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", "universalify": "^0.1.0" } }, "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw=="], + + "fs-readdir-recursive": ["fs-readdir-recursive@1.1.0", "", {}, "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA=="], + + "fs.realpath": ["fs.realpath@1.0.0", "", {}, "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="], + + "fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="], + + "function-bind": ["function-bind@1.1.2", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="], + + "get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="], + + "get-func-name": ["get-func-name@2.0.2", "", {}, "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ=="], + + "get-intrinsic": ["get-intrinsic@1.2.7", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.0.0", "function-bind": "^1.1.2", "get-proto": "^1.0.0", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-VW6Pxhsrk0KAOqs3WEd0klDiF/+V7gQOpAvY1jVU/LHmaD/kQO4523aiJuikX/QAKYiW6x8Jh+RJej1almdtCA=="], + + "get-port": ["get-port@6.1.2", "", {}, "sha512-BrGGraKm2uPqurfGVj/z97/zv8dPleC6x9JBNRTrDNtCkkRF4rPwrQXFgL7+I+q8QSdU4ntLQX2D7KIxSy8nGw=="], + + "get-proto": ["get-proto@1.0.1", "", { "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" } }, "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g=="], + + "get-stream": ["get-stream@6.0.1", "", {}, "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg=="], + + "ghost-testrpc": ["ghost-testrpc@0.0.2", "", { "dependencies": { "chalk": "^2.4.2", "node-emoji": "^1.10.0" }, "bin": { "testrpc-sc": "./index.js" } }, "sha512-i08dAEgJ2g8z5buJIrCTduwPIhih3DP+hOCTyyryikfV8T0bNvHnGXO67i0DD1H4GBDETTclPy9njZbfluQYrQ=="], + + "glob": ["glob@8.1.0", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^5.0.1", "once": "^1.3.0" } }, "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ=="], + + "glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="], + + "global-modules": ["global-modules@2.0.0", "", { "dependencies": { "global-prefix": "^3.0.0" } }, "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A=="], + + "global-prefix": ["global-prefix@3.0.0", "", { "dependencies": { "ini": "^1.3.5", "kind-of": "^6.0.2", "which": "^1.3.1" } }, "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg=="], + + "globby": ["globby@10.0.2", "", { "dependencies": { "@types/glob": "^7.1.1", "array-union": "^2.1.0", "dir-glob": "^3.0.1", "fast-glob": "^3.0.3", "glob": "^7.1.3", "ignore": "^5.1.1", "merge2": "^1.2.3", "slash": "^3.0.0" } }, "sha512-7dUi7RvCoT/xast/o/dLN53oqND4yk0nsHkhRgn9w65C4PofCLOoJ39iSOg+qVDdWQPIEj+eszMHQ+aLVwwQSg=="], + + "gopd": ["gopd@1.2.0", "", {}, "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg=="], + + "graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="], + + "handlebars": ["handlebars@4.7.8", "", { "dependencies": { "minimist": "^1.2.5", "neo-async": "^2.6.2", "source-map": "^0.6.1", "wordwrap": "^1.0.0" }, "optionalDependencies": { "uglify-js": "^3.1.4" }, "bin": { "handlebars": "bin/handlebars" } }, "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ=="], + + "hardhat": ["hardhat@2.22.18", "", { "dependencies": { "@ethersproject/abi": "^5.1.2", "@metamask/eth-sig-util": "^4.0.0", "@nomicfoundation/edr": "^0.7.0", "@nomicfoundation/ethereumjs-common": "4.0.4", "@nomicfoundation/ethereumjs-tx": "5.0.4", "@nomicfoundation/ethereumjs-util": "9.0.4", "@nomicfoundation/solidity-analyzer": "^0.1.0", "@sentry/node": "^5.18.1", "@types/bn.js": "^5.1.0", "@types/lru-cache": "^5.1.0", "adm-zip": "^0.4.16", "aggregate-error": "^3.0.0", "ansi-escapes": "^4.3.0", "boxen": "^5.1.2", "chokidar": "^4.0.0", "ci-info": "^2.0.0", "debug": "^4.1.1", "enquirer": "^2.3.0", "env-paths": "^2.2.0", "ethereum-cryptography": "^1.0.3", "ethereumjs-abi": "^0.6.8", "find-up": "^5.0.0", "fp-ts": "1.19.3", "fs-extra": "^7.0.1", "immutable": "^4.0.0-rc.12", "io-ts": "1.10.4", "json-stream-stringify": "^3.1.4", "keccak": "^3.0.2", "lodash": "^4.17.11", "mnemonist": "^0.38.0", "mocha": "^10.0.0", "p-map": "^4.0.0", "picocolors": "^1.1.0", "raw-body": "^2.4.1", "resolve": "1.17.0", "semver": "^6.3.0", "solc": "0.8.26", "source-map-support": "^0.5.13", "stacktrace-parser": "^0.1.10", "tinyglobby": "^0.2.6", "tsort": "0.0.1", "undici": "^5.14.0", "uuid": "^8.3.2", "ws": "^7.4.6" }, "peerDependencies": { "ts-node": "*", "typescript": "*" }, "optionalPeers": ["ts-node", "typescript"], "bin": { "hardhat": "internal/cli/bootstrap.js" } }, "sha512-2+kUz39gvMo56s75cfLBhiFedkQf+gXdrwCcz4R/5wW0oBdwiyfj2q9BIkMoaA0WIGYYMU2I1Cc4ucTunhfjzw=="], + + "hardhat-abi-exporter": ["hardhat-abi-exporter@2.10.1", "", { "dependencies": { "@ethersproject/abi": "^5.5.0", "delete-empty": "^3.0.0" }, "peerDependencies": { "hardhat": "^2.0.0" } }, "sha512-X8GRxUTtebMAd2k4fcPyVnCdPa6dYK4lBsrwzKP5yiSq4i+WadWPIumaLfce53TUf/o2TnLpLOduyO1ylE2NHQ=="], + + "hardhat-contract-sizer": ["hardhat-contract-sizer@2.10.0", "", { "dependencies": { "chalk": "^4.0.0", "cli-table3": "^0.6.0", "strip-ansi": "^6.0.0" }, "peerDependencies": { "hardhat": "^2.0.0" } }, "sha512-QiinUgBD5MqJZJh1hl1jc9dNnpJg7eE/w4/4GEnrcmZJJTDbVFNe3+/3Ep24XqISSkYxRz36czcPHKHd/a0dwA=="], + + "hardhat-deploy": ["hardhat-deploy@0.12.4", "", { "dependencies": { "@ethersproject/abi": "^5.7.0", "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/address": "^5.7.0", "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", "@ethersproject/constants": "^5.7.0", "@ethersproject/contracts": "^5.7.0", "@ethersproject/providers": "^5.7.2", "@ethersproject/solidity": "^5.7.0", "@ethersproject/transactions": "^5.7.0", "@ethersproject/wallet": "^5.7.0", "@types/qs": "^6.9.7", "axios": "^0.21.1", "chalk": "^4.1.2", "chokidar": "^3.5.2", "debug": "^4.3.2", "enquirer": "^2.3.6", "ethers": "^5.7.0", "form-data": "^4.0.0", "fs-extra": "^10.0.0", "match-all": "^1.2.6", "murmur-128": "^0.2.1", "qs": "^6.9.4", "zksync-ethers": "^5.0.0" } }, "sha512-bYO8DIyeGxZWlhnMoCBon9HNZb6ji0jQn7ngP1t5UmGhC8rQYhji7B73qETMOFhzt5ECZPr+U52duj3nubsqdQ=="], + + "hardhat-gas-reporter": ["hardhat-gas-reporter@1.0.10", "", { "dependencies": { "array-uniq": "1.0.3", "eth-gas-reporter": "^0.2.25", "sha1": "^1.1.1" }, "peerDependencies": { "hardhat": "^2.0.2" } }, "sha512-02N4+So/fZrzJ88ci54GqwVA3Zrf0C9duuTyGt0CFRIh/CdNwbnTgkXkRfojOMLBQ+6t+lBIkgbsOtqMvNwikA=="], + + "has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], + + "has-symbols": ["has-symbols@1.1.0", "", {}, "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ=="], + + "hash-base": ["hash-base@3.1.0", "", { "dependencies": { "inherits": "^2.0.4", "readable-stream": "^3.6.0", "safe-buffer": "^5.2.0" } }, "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA=="], + + "hash-test-vectors": ["hash-test-vectors@1.3.2", "", {}, "sha512-PKd/fitmsrlWGh3OpKbgNLE04ZQZsvs1ZkuLoQpeIKuwx+6CYVNdW6LaPIS1QAdZvV40+skk0w4YomKnViUnvQ=="], + + "hash.js": ["hash.js@1.1.7", "", { "dependencies": { "inherits": "^2.0.3", "minimalistic-assert": "^1.0.1" } }, "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA=="], + + "hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="], + + "he": ["he@1.2.0", "", { "bin": { "he": "bin/he" } }, "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="], + + "heap": ["heap@0.2.7", "", {}, "sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg=="], + + "hmac-drbg": ["hmac-drbg@1.0.1", "", { "dependencies": { "hash.js": "^1.0.3", "minimalistic-assert": "^1.0.0", "minimalistic-crypto-utils": "^1.0.1" } }, "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg=="], + + "http-basic": ["http-basic@8.1.3", "", { "dependencies": { "caseless": "^0.12.0", "concat-stream": "^1.6.2", "http-response-object": "^3.0.1", "parse-cache-control": "^1.0.1" } }, "sha512-/EcDMwJZh3mABI2NhGfHOGOeOZITqfkEO4p/xK+l3NpyncIHUQBoMvCSF/b5GqvKtySC2srL/GGG3+EtlqlmCw=="], + + "http-errors": ["http-errors@2.0.0", "", { "dependencies": { "depd": "2.0.0", "inherits": "2.0.4", "setprototypeof": "1.2.0", "statuses": "2.0.1", "toidentifier": "1.0.1" } }, "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ=="], + + "http-proxy": ["http-proxy@1.18.1", "", { "dependencies": { "eventemitter3": "^4.0.0", "follow-redirects": "^1.0.0", "requires-port": "^1.0.0" } }, "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ=="], + + "http-response-object": ["http-response-object@3.0.2", "", { "dependencies": { "@types/node": "^10.0.3" } }, "sha512-bqX0XTF6fnXSQcEJ2Iuyr75yVakyjIDCqroJQ/aHfSdlM743Cwqoi2nDYMzLGWUcuTWGWy8AAvOKXTfiv6q9RA=="], + + "https-proxy-agent": ["https-proxy-agent@5.0.1", "", { "dependencies": { "agent-base": "6", "debug": "4" } }, "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA=="], + + "human-signals": ["human-signals@4.3.1", "", {}, "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ=="], + + "husky": ["husky@9.1.7", "", { "bin": { "husky": "bin.js" } }, "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA=="], + + "iconv-lite": ["iconv-lite@0.4.24", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3" } }, "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA=="], + + "ignore": ["ignore@5.3.2", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="], + + "immer": ["immer@10.0.2", "", {}, "sha512-Rx3CqeqQ19sxUtYV9CU911Vhy8/721wRFnJv3REVGWUmoAcIwzifTsdmJte/MV+0/XpM35LZdQMBGkRIoLPwQA=="], + + "immutable": ["immutable@4.3.7", "", {}, "sha512-1hqclzwYwjRDFLjcFxOM5AYkkG0rpFPpr1RLPMEuGczoS7YA8gLhy8SWXYRAA/XwfEHpfo3cw5JGioS32fnMRw=="], + + "imul": ["imul@1.0.1", "", {}, "sha512-WFAgfwPLAjU66EKt6vRdTlKj4nAgIDQzh29JonLa4Bqtl6D8JrIMvWjCnx7xEjVNmP3U0fM5o8ZObk7d0f62bA=="], + + "indent-string": ["indent-string@4.0.0", "", {}, "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg=="], + + "inflight": ["inflight@1.0.6", "", { "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA=="], + + "inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="], + + "ini": ["ini@1.3.8", "", {}, "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="], + + "interpret": ["interpret@1.4.0", "", {}, "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA=="], + + "io-ts": ["io-ts@1.10.4", "", { "dependencies": { "fp-ts": "^1.0.0" } }, "sha512-b23PteSnYXSONJ6JQXRAlvJhuw8KOtkqa87W4wDtvMrud/DTJd5X+NpOOI+O/zZwVq6v0VLAaJ+1EDViKEuN9g=="], + + "is-binary-path": ["is-binary-path@2.1.0", "", { "dependencies": { "binary-extensions": "^2.0.0" } }, "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw=="], + + "is-extglob": ["is-extglob@2.1.1", "", {}, "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ=="], + + "is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="], + + "is-glob": ["is-glob@4.0.3", "", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="], + + "is-hex-prefixed": ["is-hex-prefixed@1.0.0", "", {}, "sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA=="], + + "is-number": ["is-number@7.0.0", "", {}, "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="], + + "is-plain-obj": ["is-plain-obj@2.1.0", "", {}, "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA=="], + + "is-stream": ["is-stream@3.0.0", "", {}, "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA=="], + + "is-unicode-supported": ["is-unicode-supported@0.1.0", "", {}, "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw=="], + + "isarray": ["isarray@1.0.0", "", {}, "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="], + + "isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="], + + "isows": ["isows@1.0.4", "", { "peerDependencies": { "ws": "*" } }, "sha512-hEzjY+x9u9hPmBom9IIAqdJCwNLax+xrPb51vEPpERoFlIxgmZcHzsT5jKG06nvInKOBGvReAVz80Umed5CczQ=="], + + "js-sha3": ["js-sha3@0.8.0", "", {}, "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q=="], + + "js-yaml": ["js-yaml@4.1.0", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA=="], + + "json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="], + + "json-stream-stringify": ["json-stream-stringify@3.1.6", "", {}, "sha512-x7fpwxOkbhFCaJDJ8vb1fBY3DdSa4AlITaz+HHILQJzdPMnHEFjxPwVUi1ALIbcIxDE0PNe/0i7frnY8QnBQog=="], + + "json-stringify-safe": ["json-stringify-safe@5.0.1", "", {}, "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA=="], + + "json5": ["json5@2.2.3", "", { "bin": { "json5": "lib/cli.js" } }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="], + + "jsonfile": ["jsonfile@4.0.0", "", { "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg=="], + + "jsonschema": ["jsonschema@1.5.0", "", {}, "sha512-K+A9hhqbn0f3pJX17Q/7H6yQfD/5OXgdrR5UE12gMXCiN9D5Xq2o5mddV2QEcX/bjla99ASsAAQUyMCCRWAEhw=="], + + "keccak": ["keccak@3.0.4", "", { "dependencies": { "node-addon-api": "^2.0.0", "node-gyp-build": "^4.2.0", "readable-stream": "^3.6.0" } }, "sha512-3vKuW0jV8J3XNTzvfyicFR5qvxrSAGl7KIhvgOu5cmWwM7tZRj3fMbj/pfIf4be7aznbc+prBWGjywox/g2Y6Q=="], + + "kind-of": ["kind-of@6.0.3", "", {}, "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw=="], + + "kleur": ["kleur@3.0.3", "", {}, "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w=="], + + "levn": ["levn@0.3.0", "", { "dependencies": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" } }, "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA=="], + + "locate-path": ["locate-path@6.0.0", "", { "dependencies": { "p-locate": "^5.0.0" } }, "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw=="], + + "lodash": ["lodash@4.17.21", "", {}, "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="], + + "lodash.clonedeep": ["lodash.clonedeep@4.5.0", "", {}, "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ=="], + + "lodash.memoize": ["lodash.memoize@4.1.2", "", {}, "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag=="], + + "lodash.truncate": ["lodash.truncate@4.4.2", "", {}, "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw=="], + + "log-symbols": ["log-symbols@4.1.0", "", { "dependencies": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" } }, "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg=="], + + "loupe": ["loupe@3.1.3", "", {}, "sha512-kkIp7XSkP78ZxJEsSxW3712C6teJVoeHHwgo9zJ380de7IYyJ2ISlxojcH2pC5OFLewESmnRi/+XCDIEEVyoug=="], + + "lru_map": ["lru_map@0.3.3", "", {}, "sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ=="], + + "make-error": ["make-error@1.3.6", "", {}, "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="], + + "markdown-table": ["markdown-table@1.1.3", "", {}, "sha512-1RUZVgQlpJSPWYbFSpmudq5nHY1doEIv89gBtF0s4gW1GF2XorxcA/70M5vq7rLv0a6mhOUccRsqkwhwLCIQ2Q=="], + + "match-all": ["match-all@1.2.6", "", {}, "sha512-0EESkXiTkWzrQQntBu2uzKvLu6vVkUGz40nGPbSZuegcfE5UuSzNjLaIu76zJWuaT/2I3Z/8M06OlUOZLGwLlQ=="], + + "math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="], + + "md5.js": ["md5.js@1.3.5", "", { "dependencies": { "hash-base": "^3.0.0", "inherits": "^2.0.1", "safe-buffer": "^5.1.2" } }, "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg=="], + + "memorystream": ["memorystream@0.3.1", "", {}, "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw=="], + + "merge-stream": ["merge-stream@2.0.0", "", {}, "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w=="], + + "merge2": ["merge2@1.4.1", "", {}, "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg=="], + + "micro-ftch": ["micro-ftch@0.3.1", "", {}, "sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg=="], + + "micromatch": ["micromatch@4.0.8", "", { "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" } }, "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA=="], + + "mime-db": ["mime-db@1.52.0", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="], + + "mime-types": ["mime-types@2.1.35", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="], + + "mimic-fn": ["mimic-fn@4.0.0", "", {}, "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw=="], + + "minimalistic-assert": ["minimalistic-assert@1.0.1", "", {}, "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A=="], + + "minimalistic-crypto-utils": ["minimalistic-crypto-utils@1.0.1", "", {}, "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg=="], + + "minimatch": ["minimatch@5.1.6", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g=="], + + "minimist": ["minimist@1.2.8", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="], + + "mkdirp": ["mkdirp@0.5.6", "", { "dependencies": { "minimist": "^1.2.6" }, "bin": { "mkdirp": "bin/cmd.js" } }, "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw=="], + + "mnemonist": ["mnemonist@0.38.5", "", { "dependencies": { "obliterator": "^2.0.0" } }, "sha512-bZTFT5rrPKtPJxj8KSV0WkPyNxl72vQepqqVUAW2ARUpUSF2qXMB6jZj7hW5/k7C1rtpzqbD/IIbJwLXUjCHeg=="], + + "mocha": ["mocha@10.8.2", "", { "dependencies": { "ansi-colors": "^4.1.3", "browser-stdout": "^1.3.1", "chokidar": "^3.5.3", "debug": "^4.3.5", "diff": "^5.2.0", "escape-string-regexp": "^4.0.0", "find-up": "^5.0.0", "glob": "^8.1.0", "he": "^1.2.0", "js-yaml": "^4.1.0", "log-symbols": "^4.1.0", "minimatch": "^5.1.6", "ms": "^2.1.3", "serialize-javascript": "^6.0.2", "strip-json-comments": "^3.1.1", "supports-color": "^8.1.1", "workerpool": "^6.5.1", "yargs": "^16.2.0", "yargs-parser": "^20.2.9", "yargs-unparser": "^2.0.0" }, "bin": { "mocha": "bin/mocha.js", "_mocha": "bin/_mocha" } }, "sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg=="], + + "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], + + "murmur-128": ["murmur-128@0.2.1", "", { "dependencies": { "encode-utf8": "^1.0.2", "fmix": "^0.1.0", "imul": "^1.0.0" } }, "sha512-WseEgiRkI6aMFBbj8Cg9yBj/y+OdipwVC7zUo3W2W1JAJITwouUOtpqsmGSg67EQmwwSyod7hsVsWY5LsrfQVg=="], + + "ndjson": ["ndjson@2.0.0", "", { "dependencies": { "json-stringify-safe": "^5.0.1", "minimist": "^1.2.5", "readable-stream": "^3.6.0", "split2": "^3.0.0", "through2": "^4.0.0" }, "bin": { "ndjson": "cli.js" } }, "sha512-nGl7LRGrzugTtaFcJMhLbpzJM6XdivmbkdlaGcrk/LXg2KL/YBC6z1g70xh0/al+oFuVFP8N8kiWRucmeEH/qQ=="], + + "neo-async": ["neo-async@2.6.2", "", {}, "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw=="], + + "node-addon-api": ["node-addon-api@2.0.2", "", {}, "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA=="], + + "node-emoji": ["node-emoji@1.11.0", "", { "dependencies": { "lodash": "^4.17.21" } }, "sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A=="], + + "node-gyp-build": ["node-gyp-build@4.8.4", "", { "bin": { "node-gyp-build": "bin.js", "node-gyp-build-optional": "optional.js", "node-gyp-build-test": "build-test.js" } }, "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ=="], + + "nofilter": ["nofilter@3.1.0", "", {}, "sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g=="], + + "nopt": ["nopt@3.0.6", "", { "dependencies": { "abbrev": "1" }, "bin": { "nopt": "./bin/nopt.js" } }, "sha512-4GUt3kSEYmk4ITxzB/b9vaIDfUVWN/Ml1Fwl11IlnIG2iaJ9O6WXZ9SrYM9NLI8OCBieN2Y8SWC2oJV0RQ7qYg=="], + + "normalize-path": ["normalize-path@3.0.0", "", {}, "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="], + + "npm-run-path": ["npm-run-path@5.3.0", "", { "dependencies": { "path-key": "^4.0.0" } }, "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ=="], + + "number-to-bn": ["number-to-bn@1.7.0", "", { "dependencies": { "bn.js": "4.11.6", "strip-hex-prefix": "1.0.0" } }, "sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig=="], + + "object-assign": ["object-assign@4.1.1", "", {}, "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="], + + "object-inspect": ["object-inspect@1.13.3", "", {}, "sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA=="], + + "obliterator": ["obliterator@2.0.5", "", {}, "sha512-42CPE9AhahZRsMNslczq0ctAEtqk8Eka26QofnqC346BZdHDySk3LWka23LI7ULIw11NmltpiLagIq8gBozxTw=="], + + "once": ["once@1.4.0", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="], + + "onetime": ["onetime@6.0.0", "", { "dependencies": { "mimic-fn": "^4.0.0" } }, "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ=="], + + "optionator": ["optionator@0.8.3", "", { "dependencies": { "deep-is": "~0.1.3", "fast-levenshtein": "~2.0.6", "levn": "~0.3.0", "prelude-ls": "~1.1.2", "type-check": "~0.3.2", "word-wrap": "~1.2.3" } }, "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA=="], + + "os-tmpdir": ["os-tmpdir@1.0.2", "", {}, "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g=="], + + "p-limit": ["p-limit@3.1.0", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="], + + "p-locate": ["p-locate@5.0.0", "", { "dependencies": { "p-limit": "^3.0.2" } }, "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw=="], + + "p-map": ["p-map@4.0.0", "", { "dependencies": { "aggregate-error": "^3.0.0" } }, "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ=="], + + "parse-cache-control": ["parse-cache-control@1.0.1", "", {}, "sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg=="], + + "path-exists": ["path-exists@4.0.0", "", {}, "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="], + + "path-is-absolute": ["path-is-absolute@1.0.1", "", {}, "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg=="], + + "path-key": ["path-key@3.1.1", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="], + + "path-parse": ["path-parse@1.0.7", "", {}, "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="], + + "path-starts-with": ["path-starts-with@2.0.1", "", {}, "sha512-wZ3AeiRBRlNwkdUxvBANh0+esnt38DLffHDujZyRHkqkaKHTglnY2EP5UX3b8rdeiSutgO4y9NEJwXezNP5vHg=="], + + "path-type": ["path-type@4.0.0", "", {}, "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw=="], + + "pathval": ["pathval@2.0.0", "", {}, "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA=="], + + "pbkdf2": ["pbkdf2@3.1.2", "", { "dependencies": { "create-hash": "^1.1.2", "create-hmac": "^1.1.4", "ripemd160": "^2.0.1", "safe-buffer": "^5.0.1", "sha.js": "^2.4.8" } }, "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA=="], + + "picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="], + + "picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="], + + "pify": ["pify@4.0.1", "", {}, "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g=="], + + "prelude-ls": ["prelude-ls@1.1.2", "", {}, "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w=="], + + "prettier": ["prettier@2.8.8", "", { "bin": { "prettier": "bin-prettier.js" } }, "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q=="], + + "prettier-plugin-solidity": ["prettier-plugin-solidity@1.4.2", "", { "dependencies": { "@solidity-parser/parser": "^0.19.0", "semver": "^7.6.3" }, "peerDependencies": { "prettier": ">=2.3.0" } }, "sha512-VVD/4XlDjSzyPWWCPW8JEleFa8JNKFYac5kNlMjVXemQyQZKfpekPMhFZSePuXB6L+RixlFvWe20iacGjFYrLw=="], + + "pretty-format": ["pretty-format@29.7.0", "", { "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" } }, "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ=="], + + "process-nextick-args": ["process-nextick-args@2.0.1", "", {}, "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="], + + "promise": ["promise@8.3.0", "", { "dependencies": { "asap": "~2.0.6" } }, "sha512-rZPNPKTOYVNEEKFaq1HqTgOwZD+4/YHS5ukLzQCypkj+OkYx7iv0mA91lJlpPPZ8vMau3IIGj5Qlwrx+8iiSmg=="], + + "prompts": ["prompts@2.4.2", "", { "dependencies": { "kleur": "^3.0.3", "sisteransi": "^1.0.5" } }, "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q=="], + + "proxy-from-env": ["proxy-from-env@1.1.0", "", {}, "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="], + + "qs": ["qs@6.14.0", "", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w=="], + + "queue-microtask": ["queue-microtask@1.2.3", "", {}, "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="], + + "randombytes": ["randombytes@2.1.0", "", { "dependencies": { "safe-buffer": "^5.1.0" } }, "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ=="], + + "raw-body": ["raw-body@2.5.2", "", { "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", "iconv-lite": "0.4.24", "unpipe": "1.0.0" } }, "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA=="], + + "react-is": ["react-is@18.3.1", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="], + + "readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="], + + "readdirp": ["readdirp@4.1.1", "", {}, "sha512-h80JrZu/MHUZCyHu5ciuoI0+WxsCxzxJTILn6Fs8rxSnFPh+UVHYfeIxK1nVGugMqkfC4vJcBOYbkfkwYK0+gw=="], + + "rechoir": ["rechoir@0.6.2", "", { "dependencies": { "resolve": "^1.1.6" } }, "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw=="], + + "recursive-readdir": ["recursive-readdir@2.2.3", "", { "dependencies": { "minimatch": "^3.0.5" } }, "sha512-8HrF5ZsXk5FAH9dgsx3BlUer73nIhuj+9OrQwEbLTPOBzGkL1lsFCR01am+v+0m2Cmbs1nP12hLDl5FA7EszKA=="], + + "req-cwd": ["req-cwd@2.0.0", "", { "dependencies": { "req-from": "^2.0.0" } }, "sha512-ueoIoLo1OfB6b05COxAA9UpeoscNpYyM+BqYlA7H6LVF4hKGPXQQSSaD2YmvDVJMkk4UDpAHIeU1zG53IqjvlQ=="], + + "req-from": ["req-from@2.0.0", "", { "dependencies": { "resolve-from": "^3.0.0" } }, "sha512-LzTfEVDVQHBRfjOUMgNBA+V6DWsSnoeKzf42J7l0xa/B4jyPOuuF5MlNSmomLNGemWTnV2TIdjSSLnEn95fOQA=="], + + "require-directory": ["require-directory@2.1.1", "", {}, "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q=="], + + "require-from-string": ["require-from-string@2.0.2", "", {}, "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="], + + "requires-port": ["requires-port@1.0.0", "", {}, "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ=="], + + "resolve": ["resolve@1.17.0", "", { "dependencies": { "path-parse": "^1.0.6" } }, "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w=="], + + "resolve-from": ["resolve-from@3.0.0", "", {}, "sha512-GnlH6vxLymXJNMBo7XP1fJIzBFbdYt49CuTwmB/6N53t+kMPRMFKz783LlQ4tv28XoQfMWinAJX6WCGf2IlaIw=="], + + "reusify": ["reusify@1.0.4", "", {}, "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw=="], + + "rimraf": ["rimraf@2.7.1", "", { "dependencies": { "glob": "^7.1.3" }, "bin": { "rimraf": "./bin.js" } }, "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w=="], + + "ripemd160": ["ripemd160@2.0.2", "", { "dependencies": { "hash-base": "^3.0.0", "inherits": "^2.0.1" } }, "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA=="], + + "rlp": ["rlp@2.2.7", "", { "dependencies": { "bn.js": "^5.2.0" }, "bin": { "rlp": "bin/rlp" } }, "sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ=="], + + "run-parallel": ["run-parallel@1.2.0", "", { "dependencies": { "queue-microtask": "^1.2.2" } }, "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA=="], + + "safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + + "safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="], + + "sc-istanbul": ["sc-istanbul@0.4.6", "", { "dependencies": { "abbrev": "1.0.x", "async": "1.x", "escodegen": "1.8.x", "esprima": "2.7.x", "glob": "^5.0.15", "handlebars": "^4.0.1", "js-yaml": "3.x", "mkdirp": "0.5.x", "nopt": "3.x", "once": "1.x", "resolve": "1.1.x", "supports-color": "^3.1.0", "which": "^1.1.1", "wordwrap": "^1.0.0" }, "bin": { "istanbul": "lib/cli.js" } }, "sha512-qJFF/8tW/zJsbyfh/iT/ZM5QNHE3CXxtLJbZsL+CzdJLBsPD7SedJZoUA4d8iAcN2IoMp/Dx80shOOd2x96X/g=="], + + "scrypt-js": ["scrypt-js@3.0.1", "", {}, "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA=="], + + "secp256k1": ["secp256k1@4.0.4", "", { "dependencies": { "elliptic": "^6.5.7", "node-addon-api": "^5.0.0", "node-gyp-build": "^4.2.0" } }, "sha512-6JfvwvjUOn8F/jUoBY2Q1v5WY5XS+rj8qSe0v8Y4ezH4InLgTEeOOPQsRll9OV429Pvo6BCHGavIyJfr3TAhsw=="], + + "semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], + + "serialize-javascript": ["serialize-javascript@6.0.2", "", { "dependencies": { "randombytes": "^2.1.0" } }, "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g=="], + + "setimmediate": ["setimmediate@1.0.5", "", {}, "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA=="], + + "setprototypeof": ["setprototypeof@1.2.0", "", {}, "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="], + + "sha.js": ["sha.js@2.4.11", "", { "dependencies": { "inherits": "^2.0.1", "safe-buffer": "^5.0.1" }, "bin": { "sha.js": "./bin.js" } }, "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ=="], + + "sha1": ["sha1@1.1.1", "", { "dependencies": { "charenc": ">= 0.0.1", "crypt": ">= 0.0.1" } }, "sha512-dZBS6OrMjtgVkopB1Gmo4RQCDKiZsqcpAQpkV/aaj+FCrCg8r4I4qMkDPQjBgLIxlmu9k4nUbWq6ohXahOneYA=="], + + "shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="], + + "shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="], + + "shelljs": ["shelljs@0.8.5", "", { "dependencies": { "glob": "^7.0.0", "interpret": "^1.0.0", "rechoir": "^0.6.2" }, "bin": { "shjs": "bin/shjs" } }, "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow=="], + + "side-channel": ["side-channel@1.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3", "side-channel-list": "^1.0.0", "side-channel-map": "^1.0.1", "side-channel-weakmap": "^1.0.2" } }, "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw=="], + + "side-channel-list": ["side-channel-list@1.0.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3" } }, "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA=="], + + "side-channel-map": ["side-channel-map@1.0.1", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3" } }, "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA=="], + + "side-channel-weakmap": ["side-channel-weakmap@1.0.2", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3", "side-channel-map": "^1.0.1" } }, "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A=="], + + "signal-exit": ["signal-exit@3.0.7", "", {}, "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="], + + "sisteransi": ["sisteransi@1.0.5", "", {}, "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="], + + "slash": ["slash@3.0.0", "", {}, "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q=="], + + "slice-ansi": ["slice-ansi@4.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "astral-regex": "^2.0.0", "is-fullwidth-code-point": "^3.0.0" } }, "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ=="], + + "solc": ["solc@0.8.26", "", { "dependencies": { "command-exists": "^1.2.8", "commander": "^8.1.0", "follow-redirects": "^1.12.1", "js-sha3": "0.8.0", "memorystream": "^0.3.1", "semver": "^5.5.0", "tmp": "0.0.33" }, "bin": { "solcjs": "solc.js" } }, "sha512-yiPQNVf5rBFHwN6SIf3TUUvVAFKcQqmSUFeq+fb6pNRCo0ZCgpYOZDi3BVoezCPIAcKrVYd/qXlBLUP9wVrZ9g=="], + + "solidity-coverage": ["solidity-coverage@0.8.14", "", { "dependencies": { "@ethersproject/abi": "^5.0.9", "@solidity-parser/parser": "^0.19.0", "chalk": "^2.4.2", "death": "^1.1.0", "difflib": "^0.2.4", "fs-extra": "^8.1.0", "ghost-testrpc": "^0.0.2", "global-modules": "^2.0.0", "globby": "^10.0.1", "jsonschema": "^1.2.4", "lodash": "^4.17.21", "mocha": "^10.2.0", "node-emoji": "^1.10.0", "pify": "^4.0.1", "recursive-readdir": "^2.2.2", "sc-istanbul": "^0.4.5", "semver": "^7.3.4", "shelljs": "^0.8.3", "web3-utils": "^1.3.6" }, "peerDependencies": { "hardhat": "^2.11.0" }, "bin": { "solidity-coverage": "plugins/bin.js" } }, "sha512-ItAAObe5GaEOp20kXC2BZRnph+9P7Rtoqg2mQc2SXGEHgSDF2wWd1Wxz3ntzQWXkbCtIIGdJT918HG00cObwbA=="], + + "source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="], + + "source-map-support": ["source-map-support@0.5.21", "", { "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w=="], + + "split2": ["split2@3.2.2", "", { "dependencies": { "readable-stream": "^3.0.0" } }, "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg=="], + + "sprintf-js": ["sprintf-js@1.0.3", "", {}, "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="], + + "stack-generator": ["stack-generator@1.1.0", "", { "dependencies": { "stackframe": "^1.0.2" } }, "sha512-sZDVjwC56vZoo+a5t0LH/1sMQLWYLi/r+Z2ztyCAOhOX3QBP34GWxK0FWf2eU1TIU2CJKCKBAtDZycUh/ZKMlw=="], + + "stackframe": ["stackframe@0.3.1", "", {}, "sha512-XmoiF4T5nuWEp2x2w92WdGjdHGY/cZa6LIbRsDRQR/Xlk4uW0PAUlH1zJYVffocwKpCdwyuypIp25xsSXEtZHw=="], + + "stacktrace-gps": ["stacktrace-gps@2.4.4", "", { "dependencies": { "source-map": "0.5.6", "stackframe": "~0.3" } }, "sha512-msFhuMEEklQLUtaJ+GeCDjzUN+PamfHWQiK3C1LnbHjoxSeF5dAxiE+aJkptNMmMNOropGFJ7G3ZT7dPZHgDaQ=="], + + "stacktrace-js": ["stacktrace-js@1.3.1", "", { "dependencies": { "error-stack-parser": "^1.3.6", "stack-generator": "^1.0.7", "stacktrace-gps": "^2.4.3" } }, "sha512-b+5voFnXqg9TWdOE50soXL+WuOreYUm1Ukg9U7rzEWGL4+gcVxIcFasNBtOffVX0I1lYqVZj0PZXZvTt5e3YRQ=="], + + "stacktrace-parser": ["stacktrace-parser@0.1.10", "", { "dependencies": { "type-fest": "^0.7.1" } }, "sha512-KJP1OCML99+8fhOHxwwzyWrlUuVX5GQ0ZpJTd1DFXhdkrvg1szxfHhawXUZ3g9TkXORQd4/WG68jMlQZ2p8wlg=="], + + "statuses": ["statuses@2.0.1", "", {}, "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="], + + "string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], + + "string_decoder": ["string_decoder@1.3.0", "", { "dependencies": { "safe-buffer": "~5.2.0" } }, "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="], + + "strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], + + "strip-final-newline": ["strip-final-newline@3.0.0", "", {}, "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw=="], + + "strip-hex-prefix": ["strip-hex-prefix@1.0.0", "", { "dependencies": { "is-hex-prefixed": "1.0.0" } }, "sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A=="], + + "strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="], + + "supports-color": ["supports-color@8.1.1", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="], + + "sync-request": ["sync-request@6.1.0", "", { "dependencies": { "http-response-object": "^3.0.1", "sync-rpc": "^1.2.1", "then-request": "^6.0.0" } }, "sha512-8fjNkrNlNCrVc/av+Jn+xxqfCjYaBoHqCsDz6mt030UMxJGr+GSfCV1dQt2gRtlL63+VPidwDVLr7V2OcTSdRw=="], + + "sync-rpc": ["sync-rpc@1.3.6", "", { "dependencies": { "get-port": "^3.1.0" } }, "sha512-J8jTXuZzRlvU7HemDgHi3pGnh/rkoqR/OZSjhTyyZrEkkYQbk7Z33AXp37mkPfPpfdOuj7Ex3H/TJM1z48uPQw=="], + + "table": ["table@6.9.0", "", { "dependencies": { "ajv": "^8.0.1", "lodash.truncate": "^4.4.2", "slice-ansi": "^4.0.0", "string-width": "^4.2.3", "strip-ansi": "^6.0.1" } }, "sha512-9kY+CygyYM6j02t5YFHbNz2FN5QmYGv9zAjVp4lCDjlCw7amdckXlEt/bjMhUIfj4ThGRE4gCUH5+yGnNuPo5A=="], + + "then-request": ["then-request@6.0.2", "", { "dependencies": { "@types/concat-stream": "^1.6.0", "@types/form-data": "0.0.33", "@types/node": "^8.0.0", "@types/qs": "^6.2.31", "caseless": "~0.12.0", "concat-stream": "^1.6.0", "form-data": "^2.2.0", "http-basic": "^8.1.1", "http-response-object": "^3.0.1", "promise": "^8.0.0", "qs": "^6.4.0" } }, "sha512-3ZBiG7JvP3wbDzA9iNY5zJQcHL4jn/0BWtXIkagfz7QgOL/LqjCEOBQuJNZfu0XYnv5JhKh+cDxCPM4ILrqruA=="], + + "through2": ["through2@4.0.2", "", { "dependencies": { "readable-stream": "3" } }, "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw=="], + + "tinyglobby": ["tinyglobby@0.2.10", "", { "dependencies": { "fdir": "^6.4.2", "picomatch": "^4.0.2" } }, "sha512-Zc+8eJlFMvgatPZTl6A9L/yht8QqdmUNtURHaKZLmKBE12hNPSrqNkUp2cs3M/UKmNVVAMFQYSjYIVHDjW5zew=="], + + "tinyrainbow": ["tinyrainbow@1.2.0", "", {}, "sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ=="], + + "tinyspy": ["tinyspy@2.2.1", "", {}, "sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A=="], + + "tmp": ["tmp@0.0.33", "", { "dependencies": { "os-tmpdir": "~1.0.2" } }, "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw=="], + + "to-regex-range": ["to-regex-range@5.0.1", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="], + + "toidentifier": ["toidentifier@1.0.1", "", {}, "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="], + + "ts-node": ["ts-node@10.9.2", "", { "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", "@tsconfig/node12": "^1.0.7", "@tsconfig/node14": "^1.0.0", "@tsconfig/node16": "^1.0.2", "acorn": "^8.4.1", "acorn-walk": "^8.1.1", "arg": "^4.1.0", "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", "v8-compile-cache-lib": "^3.0.1", "yn": "3.1.1" }, "peerDependencies": { "@swc/core": ">=1.2.50", "@swc/wasm": ">=1.2.50", "@types/node": "*", "typescript": ">=2.7" }, "optionalPeers": ["@swc/core", "@swc/wasm"], "bin": { "ts-node": "dist/bin.js", "ts-script": "dist/bin-script-deprecated.js", "ts-node-cwd": "dist/bin-cwd.js", "ts-node-esm": "dist/bin-esm.js", "ts-node-script": "dist/bin-script.js", "ts-node-transpile-only": "dist/bin-transpile.js" } }, "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ=="], + + "tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="], + + "tsort": ["tsort@0.0.1", "", {}, "sha512-Tyrf5mxF8Ofs1tNoxA13lFeZ2Zrbd6cKbuH3V+MQ5sb6DtBj5FjrXVsRWT8YvNAQTqNoz66dz1WsbigI22aEnw=="], + + "tweetnacl": ["tweetnacl@1.0.3", "", {}, "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw=="], + + "tweetnacl-util": ["tweetnacl-util@0.15.1", "", {}, "sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw=="], + + "type-check": ["type-check@0.3.2", "", { "dependencies": { "prelude-ls": "~1.1.2" } }, "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg=="], + + "type-detect": ["type-detect@4.1.0", "", {}, "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw=="], + + "type-fest": ["type-fest@0.21.3", "", {}, "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="], + + "typedarray": ["typedarray@0.0.6", "", {}, "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA=="], + + "typescript": ["typescript@5.7.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw=="], + + "typescript-logging": ["typescript-logging@1.0.1", "", { "dependencies": { "stacktrace-js": "1.3.1" } }, "sha512-zp28ABme0m5q/nXabBaY9Hv/35N8lMH4FsvhpUO0zVi4vFs3uKlb5br2it61HAZF5k+U0aP6E67j0VD0IzXGpQ=="], + + "uglify-js": ["uglify-js@3.19.3", "", { "bin": { "uglifyjs": "bin/uglifyjs" } }, "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ=="], + + "undici": ["undici@5.28.5", "", { "dependencies": { "@fastify/busboy": "^2.0.0" } }, "sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA=="], + + "undici-types": ["undici-types@5.26.5", "", {}, "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="], + + "universalify": ["universalify@0.1.2", "", {}, "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="], + + "unpipe": ["unpipe@1.0.0", "", {}, "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ=="], + + "utf8": ["utf8@3.0.0", "", {}, "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ=="], + + "util-deprecate": ["util-deprecate@1.0.2", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="], + + "uuid": ["uuid@8.3.2", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="], + + "v8-compile-cache-lib": ["v8-compile-cache-lib@3.0.1", "", {}, "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg=="], + + "viem": ["viem@2.12.0", "", { "dependencies": { "@adraffy/ens-normalize": "1.10.0", "@noble/curves": "1.2.0", "@noble/hashes": "1.3.2", "@scure/bip32": "1.3.2", "@scure/bip39": "1.2.1", "abitype": "1.0.0", "isows": "1.0.4", "ws": "8.13.0" }, "peerDependencies": { "typescript": ">=5.0.4" }, "optionalPeers": ["typescript"] }, "sha512-XBvORspE4x2/gfy7idH6IVFwkJiXirygFCU3lxUH6fttsj8zufLtgiokfvZF/LAZUEDvdxSgL08whSYgffM2fw=="], + + "web3-utils": ["web3-utils@1.10.4", "", { "dependencies": { "@ethereumjs/util": "^8.1.0", "bn.js": "^5.2.1", "ethereum-bloom-filters": "^1.0.6", "ethereum-cryptography": "^2.1.2", "ethjs-unit": "0.1.6", "number-to-bn": "1.7.0", "randombytes": "^2.1.0", "utf8": "3.0.0" } }, "sha512-tsu8FiKJLk2PzhDl9fXbGUWTkkVXYhtTA+SmEFkKft+9BgwLxfCRpU96sWv7ICC8zixBNd3JURVoiR3dUXgP8A=="], + + "which": ["which@1.3.1", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "which": "./bin/which" } }, "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ=="], + + "widest-line": ["widest-line@3.1.0", "", { "dependencies": { "string-width": "^4.0.0" } }, "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg=="], + + "word-wrap": ["word-wrap@1.2.5", "", {}, "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA=="], + + "wordwrap": ["wordwrap@1.0.0", "", {}, "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q=="], + + "workerpool": ["workerpool@6.5.1", "", {}, "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA=="], + + "wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], + + "wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="], + + "ws": ["ws@8.13.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA=="], + + "y18n": ["y18n@5.0.8", "", {}, "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="], + + "yargs": ["yargs@16.2.0", "", { "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.0", "y18n": "^5.0.5", "yargs-parser": "^20.2.2" } }, "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw=="], + + "yargs-parser": ["yargs-parser@20.2.9", "", {}, "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w=="], + + "yargs-unparser": ["yargs-unparser@2.0.0", "", { "dependencies": { "camelcase": "^6.0.0", "decamelize": "^4.0.0", "flat": "^5.0.2", "is-plain-obj": "^2.1.0" } }, "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA=="], + + "yn": ["yn@3.1.1", "", {}, "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q=="], + + "yocto-queue": ["yocto-queue@0.1.0", "", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="], + + "zksync-ethers": ["zksync-ethers@5.10.0", "", { "dependencies": { "ethers": "~5.7.0" } }, "sha512-OAjTGAHF9wbdkRGkj7XZuF/a1Sk/FVbwH4pmLjAKlR7mJ7sQtQhBhrPU2dCc67xLaNvEESPfwil19ES5wooYFg=="], + + "@ensdomains/hardhat-chai-matchers-viem/@vitest/expect": ["@vitest/expect@2.1.8", "", { "dependencies": { "@vitest/spy": "2.1.8", "@vitest/utils": "2.1.8", "chai": "^5.1.2", "tinyrainbow": "^1.2.0" } }, "sha512-8ytZ/fFHq2g4PJVAtDX57mayemKgDR6X3Oa2Foro+EygiOJHUXhCqBAAKQYYajZpFoIfvBCF1j6R6IYRSIUFuw=="], + + "@ethereumjs/util/ethereum-cryptography": ["ethereum-cryptography@2.2.1", "", { "dependencies": { "@noble/curves": "1.4.2", "@noble/hashes": "1.4.0", "@scure/bip32": "1.4.0", "@scure/bip39": "1.3.0" } }, "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg=="], + + "@ethersproject/bignumber/bn.js": ["bn.js@5.2.1", "", {}, "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ=="], + + "@ethersproject/providers/ws": ["ws@7.4.6", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A=="], + + "@ethersproject/signing-key/bn.js": ["bn.js@5.2.1", "", {}, "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ=="], + + "@ethersproject/signing-key/elliptic": ["elliptic@6.5.4", "", { "dependencies": { "bn.js": "^4.11.9", "brorand": "^1.1.0", "hash.js": "^1.0.0", "hmac-drbg": "^1.0.1", "inherits": "^2.0.4", "minimalistic-assert": "^1.0.1", "minimalistic-crypto-utils": "^1.0.1" } }, "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ=="], + + "@metamask/eth-sig-util/ethereumjs-util": ["ethereumjs-util@6.2.1", "", { "dependencies": { "@types/bn.js": "^4.11.3", "bn.js": "^4.11.0", "create-hash": "^1.1.2", "elliptic": "^6.5.2", "ethereum-cryptography": "^0.1.3", "ethjs-util": "0.1.6", "rlp": "^2.2.3" } }, "sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw=="], + + "@noble/curves/@noble/hashes": ["@noble/hashes@1.3.2", "", {}, "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ=="], + + "@nomicfoundation/ethereumjs-tx/ethereum-cryptography": ["ethereum-cryptography@0.1.3", "", { "dependencies": { "@types/pbkdf2": "^3.0.0", "@types/secp256k1": "^4.0.1", "blakejs": "^1.1.0", "browserify-aes": "^1.2.0", "bs58check": "^2.1.2", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", "hash.js": "^1.1.7", "keccak": "^3.0.0", "pbkdf2": "^3.0.17", "randombytes": "^2.1.0", "safe-buffer": "^5.1.2", "scrypt-js": "^3.0.0", "secp256k1": "^4.0.1", "setimmediate": "^1.0.5" } }, "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ=="], + + "@nomicfoundation/ethereumjs-util/ethereum-cryptography": ["ethereum-cryptography@0.1.3", "", { "dependencies": { "@types/pbkdf2": "^3.0.0", "@types/secp256k1": "^4.0.1", "blakejs": "^1.1.0", "browserify-aes": "^1.2.0", "bs58check": "^2.1.2", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", "hash.js": "^1.1.7", "keccak": "^3.0.0", "pbkdf2": "^3.0.17", "randombytes": "^2.1.0", "safe-buffer": "^5.1.2", "scrypt-js": "^3.0.0", "secp256k1": "^4.0.1", "setimmediate": "^1.0.5" } }, "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ=="], + + "@nomicfoundation/hardhat-ignition/fs-extra": ["fs-extra@10.1.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ=="], + + "@nomicfoundation/hardhat-viem/abitype": ["abitype@0.9.10", "", { "peerDependencies": { "typescript": ">=5.0.4", "zod": "^3 >=3.22.0" }, "optionalPeers": ["typescript", "zod"] }, "sha512-FIS7U4n7qwAT58KibwYig5iFG4K61rbhAqaQh/UWj8v1Y8mjX3F8TC9gd8cz9yT1TYel9f8nS5NO5kZp2RW0jQ=="], + + "@nomicfoundation/ignition-core/@ethersproject/address": ["@ethersproject/address@5.6.1", "", { "dependencies": { "@ethersproject/bignumber": "^5.6.2", "@ethersproject/bytes": "^5.6.1", "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/rlp": "^5.6.1" } }, "sha512-uOgF0kS5MJv9ZvCz7x6T2EXJSzotiybApn4XlOgoTX0xdtyVIJ7pF+6cGPxiEq/dpBiTfMiw7Yc81JcwhSYA0Q=="], + + "@nomicfoundation/ignition-core/cbor": ["cbor@9.0.2", "", { "dependencies": { "nofilter": "^3.1.0" } }, "sha512-JPypkxsB10s9QOWwa6zwPzqE1Md3vqpPc+cai4sAecuCsRyAtAl/pMyhPlMbT/xtPnm2dznJZYRLui57qiRhaQ=="], + + "@nomicfoundation/ignition-core/ethers": ["ethers@6.13.5", "", { "dependencies": { "@adraffy/ens-normalize": "1.10.1", "@noble/curves": "1.2.0", "@noble/hashes": "1.3.2", "@types/node": "22.7.5", "aes-js": "4.0.0-beta.5", "tslib": "2.7.0", "ws": "8.17.1" } }, "sha512-+knKNieu5EKRThQJWwqaJ10a6HE9sSehGeqWN65//wE7j47ZpFhKAnHB/JJFibwwg61I/koxaPsXbXpD/skNOQ=="], + + "@nomicfoundation/ignition-core/fs-extra": ["fs-extra@10.1.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ=="], + + "@scure/bip32/@noble/hashes": ["@noble/hashes@1.3.2", "", {}, "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ=="], + + "@scure/bip39/@noble/hashes": ["@noble/hashes@1.3.2", "", {}, "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ=="], + + "@vitest/expect/chai": ["chai@4.5.0", "", { "dependencies": { "assertion-error": "^1.1.0", "check-error": "^1.0.3", "deep-eql": "^4.1.3", "get-func-name": "^2.0.2", "loupe": "^2.3.6", "pathval": "^1.1.1", "type-detect": "^4.1.0" } }, "sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw=="], + + "@vitest/utils/loupe": ["loupe@2.3.7", "", { "dependencies": { "get-func-name": "^2.0.1" } }, "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA=="], + + "anymatch/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], + + "boxen/type-fest": ["type-fest@0.20.2", "", {}, "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ=="], + + "chai-as-promised/check-error": ["check-error@1.0.3", "", { "dependencies": { "get-func-name": "^2.0.2" } }, "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg=="], + + "chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], + + "concat-stream/readable-stream": ["readable-stream@2.3.8", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="], + + "cross-spawn/which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="], + + "escodegen/source-map": ["source-map@0.2.0", "", { "dependencies": { "amdefine": ">=0.0.4" } }, "sha512-CBdZ2oa/BHhS4xj5DlhjWNHcan57/5YuvfdLf17iVmIpd9KRm+DFLmC6nBNj+6Ua7Kt3TmOjDpQT1aTYOQtoUA=="], + + "eth-gas-reporter/@solidity-parser/parser": ["@solidity-parser/parser@0.14.5", "", { "dependencies": { "antlr4ts": "^0.5.0-alpha.4" } }, "sha512-6dKnHZn7fg/iQATVEzqyUOyEidbn05q7YA2mQ9hC0MMXhhV3/JrsxmFSYZAcr7j1yUP700LLhTruvJ3MiQmjJg=="], + + "eth-gas-reporter/axios": ["axios@1.7.9", "", { "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } }, "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw=="], + + "eth-gas-reporter/cli-table3": ["cli-table3@0.5.1", "", { "dependencies": { "object-assign": "^4.1.0", "string-width": "^2.1.1" }, "optionalDependencies": { "colors": "^1.1.2" } }, "sha512-7Qg2Jrep1S/+Q3EceiZtQcDPWxhAvBw+ERf1162v4sikJrvojMHFqXt8QIVha8UlH9rgU0BeWPytZ9/TzYqlUw=="], + + "ethereum-cryptography/@noble/hashes": ["@noble/hashes@1.2.0", "", {}, "sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ=="], + + "ethereum-cryptography/@scure/bip32": ["@scure/bip32@1.1.5", "", { "dependencies": { "@noble/hashes": "~1.2.0", "@noble/secp256k1": "~1.7.0", "@scure/base": "~1.1.0" } }, "sha512-XyNh1rB0SkEqd3tXcXMi+Xe1fvg+kUIcoRIEujP1Jgv7DqW2r9lg3Ah0NkFaCs9sTkQAQA8kw7xiRXzENi9Rtw=="], + + "ethereum-cryptography/@scure/bip39": ["@scure/bip39@1.1.1", "", { "dependencies": { "@noble/hashes": "~1.2.0", "@scure/base": "~1.1.0" } }, "sha512-t+wDck2rVkh65Hmv280fYdVdY25J9YeEUIgn2LG1WM6gxFkGzcksoDiUkWVpVp3Oex9xGC68JU2dSbUfwZ2jPg=="], + + "ethereumjs-abi/ethereumjs-util": ["ethereumjs-util@6.2.1", "", { "dependencies": { "@types/bn.js": "^4.11.3", "bn.js": "^4.11.0", "create-hash": "^1.1.2", "elliptic": "^6.5.2", "ethereum-cryptography": "^0.1.3", "ethjs-util": "0.1.6", "rlp": "^2.2.3" } }, "sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw=="], + + "ethereumjs-util/bn.js": ["bn.js@5.2.1", "", {}, "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ=="], + + "ethereumjs-util/ethereum-cryptography": ["ethereum-cryptography@0.1.3", "", { "dependencies": { "@types/pbkdf2": "^3.0.0", "@types/secp256k1": "^4.0.1", "blakejs": "^1.1.0", "browserify-aes": "^1.2.0", "bs58check": "^2.1.2", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", "hash.js": "^1.1.7", "keccak": "^3.0.0", "pbkdf2": "^3.0.17", "randombytes": "^2.1.0", "safe-buffer": "^5.1.2", "scrypt-js": "^3.0.0", "secp256k1": "^4.0.1", "setimmediate": "^1.0.5" } }, "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ=="], + + "ethjs-unit/bn.js": ["bn.js@4.11.6", "", {}, "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA=="], + + "ghost-testrpc/chalk": ["chalk@2.4.2", "", { "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" } }, "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ=="], + + "globby/glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="], + + "hardhat/ws": ["ws@7.5.10", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ=="], + + "hardhat-deploy/chokidar": ["chokidar@3.6.0", "", { "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.6.0" }, "optionalDependencies": { "fsevents": "~2.3.2" } }, "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw=="], + + "hardhat-deploy/fs-extra": ["fs-extra@10.1.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ=="], + + "http-response-object/@types/node": ["@types/node@10.17.60", "", {}, "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw=="], + + "micromatch/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], + + "mocha/chokidar": ["chokidar@3.6.0", "", { "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.6.0" }, "optionalDependencies": { "fsevents": "~2.3.2" } }, "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw=="], + + "mocha/diff": ["diff@5.2.0", "", {}, "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A=="], + + "npm-run-path/path-key": ["path-key@4.0.0", "", {}, "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ=="], + + "number-to-bn/bn.js": ["bn.js@4.11.6", "", {}, "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA=="], + + "prettier-plugin-solidity/semver": ["semver@7.7.0", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-DrfFnPzblFmNrIZzg5RzHegbiRWg7KMR7btwi2yjHwx06zsUbO5g613sVwEV7FTwmzJu+Io0lJe2GJ3LxqpvBQ=="], + + "pretty-format/ansi-styles": ["ansi-styles@5.2.0", "", {}, "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA=="], + + "recursive-readdir/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="], + + "rimraf/glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="], + + "rlp/bn.js": ["bn.js@5.2.1", "", {}, "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ=="], + + "sc-istanbul/glob": ["glob@5.0.15", "", { "dependencies": { "inflight": "^1.0.4", "inherits": "2", "minimatch": "2 || 3", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-c9IPMazfRITpmAAKi22dK1VKxGDX9ehhqfABDriL/lzO92xcUKEJPQHrVA/2YHSNFB4iFlykVmWvwo48nr3OxA=="], + + "sc-istanbul/js-yaml": ["js-yaml@3.14.1", "", { "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g=="], + + "sc-istanbul/resolve": ["resolve@1.1.7", "", {}, "sha512-9znBF0vBcaSN3W2j7wKvdERPwqTxSpCq+if5C0WoTCyV9n24rua28jeuQ2pL/HOf+yUe/Mef+H/5p60K0Id3bg=="], + + "sc-istanbul/supports-color": ["supports-color@3.2.3", "", { "dependencies": { "has-flag": "^1.0.0" } }, "sha512-Jds2VIYDrlp5ui7t8abHN2bjAu4LV/q4N2KivFPpGH0lrka0BMq/33AmECUXlKPcHigkNaqfXRENFju+rlcy+A=="], + + "secp256k1/node-addon-api": ["node-addon-api@5.1.0", "", {}, "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA=="], + + "shelljs/glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="], + + "solc/semver": ["semver@5.7.2", "", { "bin": { "semver": "bin/semver" } }, "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g=="], + + "solidity-coverage/chalk": ["chalk@2.4.2", "", { "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" } }, "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ=="], + + "solidity-coverage/fs-extra": ["fs-extra@8.1.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^4.0.0", "universalify": "^0.1.0" } }, "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g=="], + + "solidity-coverage/semver": ["semver@7.7.0", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-DrfFnPzblFmNrIZzg5RzHegbiRWg7KMR7btwi2yjHwx06zsUbO5g613sVwEV7FTwmzJu+Io0lJe2GJ3LxqpvBQ=="], + + "stack-generator/stackframe": ["stackframe@1.3.4", "", {}, "sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw=="], + + "stacktrace-gps/source-map": ["source-map@0.5.6", "", {}, "sha512-MjZkVp0NHr5+TPihLcadqnlVoGIoWo4IBHptutGh9wI3ttUYvCG26HkSuDi+K6lsZ25syXJXcctwgyVCt//xqA=="], + + "stacktrace-parser/type-fest": ["type-fest@0.7.1", "", {}, "sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg=="], + + "sync-rpc/get-port": ["get-port@3.2.0", "", {}, "sha512-x5UJKlgeUiNT8nyo/AcnwLnZuZNcSjSw0kogRB+Whd1fjjFq4B1hySFxSFWWSn4mIBzg3sRNUDFYc4g5gjPoLg=="], + + "then-request/@types/node": ["@types/node@8.10.66", "", {}, "sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw=="], + + "then-request/form-data": ["form-data@2.5.2", "", { "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", "mime-types": "^2.1.12", "safe-buffer": "^5.2.1" } }, "sha512-GgwY0PS7DbXqajuGf4OYlsrIu3zgxD6Vvql43IBhm6MahqA5SK/7mwhtNj2AdH2z35YR34ujJ7BN+3fFC3jP5Q=="], + + "viem/@noble/hashes": ["@noble/hashes@1.3.2", "", {}, "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ=="], + + "viem/abitype": ["abitype@1.0.0", "", { "peerDependencies": { "typescript": ">=5.0.4", "zod": "^3 >=3.22.0" }, "optionalPeers": ["typescript", "zod"] }, "sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ=="], + + "web3-utils/bn.js": ["bn.js@5.2.1", "", {}, "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ=="], + + "web3-utils/ethereum-cryptography": ["ethereum-cryptography@2.2.1", "", { "dependencies": { "@noble/curves": "1.4.2", "@noble/hashes": "1.4.0", "@scure/bip32": "1.4.0", "@scure/bip39": "1.3.0" } }, "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg=="], + + "@ensdomains/hardhat-chai-matchers-viem/@vitest/expect/@vitest/spy": ["@vitest/spy@2.1.8", "", { "dependencies": { "tinyspy": "^3.0.2" } }, "sha512-5swjf2q95gXeYPevtW0BLk6H8+bPlMb4Vw/9Em4hFxDcaOxS+e0LOX4yqNxoHzMR2akEB2xfpnWUzkZokmgWDg=="], + + "@ensdomains/hardhat-chai-matchers-viem/@vitest/expect/@vitest/utils": ["@vitest/utils@2.1.8", "", { "dependencies": { "@vitest/pretty-format": "2.1.8", "loupe": "^3.1.2", "tinyrainbow": "^1.2.0" } }, "sha512-dwSoui6djdwbfFmIgbIjX2ZhIoG7Ex/+xpxyiEgIGzjliY8xGkcpITKTlp6B4MgtGkF2ilvm97cPM96XZaAgcA=="], + + "@ethereumjs/util/ethereum-cryptography/@noble/curves": ["@noble/curves@1.4.2", "", { "dependencies": { "@noble/hashes": "1.4.0" } }, "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw=="], + + "@ethereumjs/util/ethereum-cryptography/@noble/hashes": ["@noble/hashes@1.4.0", "", {}, "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg=="], + + "@ethereumjs/util/ethereum-cryptography/@scure/bip32": ["@scure/bip32@1.4.0", "", { "dependencies": { "@noble/curves": "~1.4.0", "@noble/hashes": "~1.4.0", "@scure/base": "~1.1.6" } }, "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg=="], + + "@ethereumjs/util/ethereum-cryptography/@scure/bip39": ["@scure/bip39@1.3.0", "", { "dependencies": { "@noble/hashes": "~1.4.0", "@scure/base": "~1.1.6" } }, "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ=="], + + "@ethersproject/signing-key/elliptic/bn.js": ["bn.js@4.12.1", "", {}, "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg=="], + + "@metamask/eth-sig-util/ethereumjs-util/@types/bn.js": ["@types/bn.js@4.11.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg=="], + + "@metamask/eth-sig-util/ethereumjs-util/ethereum-cryptography": ["ethereum-cryptography@0.1.3", "", { "dependencies": { "@types/pbkdf2": "^3.0.0", "@types/secp256k1": "^4.0.1", "blakejs": "^1.1.0", "browserify-aes": "^1.2.0", "bs58check": "^2.1.2", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", "hash.js": "^1.1.7", "keccak": "^3.0.0", "pbkdf2": "^3.0.17", "randombytes": "^2.1.0", "safe-buffer": "^5.1.2", "scrypt-js": "^3.0.0", "secp256k1": "^4.0.1", "setimmediate": "^1.0.5" } }, "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ=="], + + "@nomicfoundation/hardhat-ignition/fs-extra/jsonfile": ["jsonfile@6.1.0", "", { "dependencies": { "universalify": "^2.0.0" }, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ=="], + + "@nomicfoundation/hardhat-ignition/fs-extra/universalify": ["universalify@2.0.1", "", {}, "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw=="], + + "@nomicfoundation/ignition-core/ethers/@adraffy/ens-normalize": ["@adraffy/ens-normalize@1.10.1", "", {}, "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw=="], + + "@nomicfoundation/ignition-core/ethers/@noble/hashes": ["@noble/hashes@1.3.2", "", {}, "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ=="], + + "@nomicfoundation/ignition-core/ethers/@types/node": ["@types/node@22.7.5", "", { "dependencies": { "undici-types": "~6.19.2" } }, "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ=="], + + "@nomicfoundation/ignition-core/ethers/aes-js": ["aes-js@4.0.0-beta.5", "", {}, "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q=="], + + "@nomicfoundation/ignition-core/ethers/tslib": ["tslib@2.7.0", "", {}, "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA=="], + + "@nomicfoundation/ignition-core/ethers/ws": ["ws@8.17.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ=="], + + "@nomicfoundation/ignition-core/fs-extra/jsonfile": ["jsonfile@6.1.0", "", { "dependencies": { "universalify": "^2.0.0" }, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ=="], + + "@nomicfoundation/ignition-core/fs-extra/universalify": ["universalify@2.0.1", "", {}, "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw=="], + + "@vitest/expect/chai/assertion-error": ["assertion-error@1.1.0", "", {}, "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw=="], + + "@vitest/expect/chai/check-error": ["check-error@1.0.3", "", { "dependencies": { "get-func-name": "^2.0.2" } }, "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg=="], + + "@vitest/expect/chai/deep-eql": ["deep-eql@4.1.4", "", { "dependencies": { "type-detect": "^4.0.0" } }, "sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg=="], + + "@vitest/expect/chai/loupe": ["loupe@2.3.7", "", { "dependencies": { "get-func-name": "^2.0.1" } }, "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA=="], + + "@vitest/expect/chai/pathval": ["pathval@1.1.1", "", {}, "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ=="], + + "concat-stream/readable-stream/safe-buffer": ["safe-buffer@5.1.2", "", {}, "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="], + + "concat-stream/readable-stream/string_decoder": ["string_decoder@1.1.1", "", { "dependencies": { "safe-buffer": "~5.1.0" } }, "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg=="], + + "eth-gas-reporter/cli-table3/string-width": ["string-width@2.1.1", "", { "dependencies": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" } }, "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw=="], + + "ethereumjs-abi/ethereumjs-util/@types/bn.js": ["@types/bn.js@4.11.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg=="], + + "ethereumjs-abi/ethereumjs-util/ethereum-cryptography": ["ethereum-cryptography@0.1.3", "", { "dependencies": { "@types/pbkdf2": "^3.0.0", "@types/secp256k1": "^4.0.1", "blakejs": "^1.1.0", "browserify-aes": "^1.2.0", "bs58check": "^2.1.2", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", "hash.js": "^1.1.7", "keccak": "^3.0.0", "pbkdf2": "^3.0.17", "randombytes": "^2.1.0", "safe-buffer": "^5.1.2", "scrypt-js": "^3.0.0", "secp256k1": "^4.0.1", "setimmediate": "^1.0.5" } }, "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ=="], + + "ghost-testrpc/chalk/ansi-styles": ["ansi-styles@3.2.1", "", { "dependencies": { "color-convert": "^1.9.0" } }, "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA=="], + + "ghost-testrpc/chalk/escape-string-regexp": ["escape-string-regexp@1.0.5", "", {}, "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="], + + "ghost-testrpc/chalk/supports-color": ["supports-color@5.5.0", "", { "dependencies": { "has-flag": "^3.0.0" } }, "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow=="], + + "globby/glob/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="], + + "hardhat-deploy/chokidar/readdirp": ["readdirp@3.6.0", "", { "dependencies": { "picomatch": "^2.2.1" } }, "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA=="], + + "hardhat-deploy/fs-extra/jsonfile": ["jsonfile@6.1.0", "", { "dependencies": { "universalify": "^2.0.0" }, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ=="], + + "hardhat-deploy/fs-extra/universalify": ["universalify@2.0.1", "", {}, "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw=="], + + "mocha/chokidar/readdirp": ["readdirp@3.6.0", "", { "dependencies": { "picomatch": "^2.2.1" } }, "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA=="], + + "recursive-readdir/minimatch/brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="], + + "rimraf/glob/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="], + + "sc-istanbul/glob/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="], + + "sc-istanbul/js-yaml/argparse": ["argparse@1.0.10", "", { "dependencies": { "sprintf-js": "~1.0.2" } }, "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg=="], + + "sc-istanbul/js-yaml/esprima": ["esprima@4.0.1", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="], + + "sc-istanbul/supports-color/has-flag": ["has-flag@1.0.0", "", {}, "sha512-DyYHfIYwAJmjAjSSPKANxI8bFY9YtFrgkAfinBojQ8YJTOuOuav64tMUJv584SES4xl74PmuaevIyaLESHdTAA=="], + + "shelljs/glob/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="], + + "solidity-coverage/chalk/ansi-styles": ["ansi-styles@3.2.1", "", { "dependencies": { "color-convert": "^1.9.0" } }, "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA=="], + + "solidity-coverage/chalk/escape-string-regexp": ["escape-string-regexp@1.0.5", "", {}, "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="], + + "solidity-coverage/chalk/supports-color": ["supports-color@5.5.0", "", { "dependencies": { "has-flag": "^3.0.0" } }, "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow=="], + + "web3-utils/ethereum-cryptography/@noble/curves": ["@noble/curves@1.4.2", "", { "dependencies": { "@noble/hashes": "1.4.0" } }, "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw=="], + + "web3-utils/ethereum-cryptography/@noble/hashes": ["@noble/hashes@1.4.0", "", {}, "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg=="], + + "web3-utils/ethereum-cryptography/@scure/bip32": ["@scure/bip32@1.4.0", "", { "dependencies": { "@noble/curves": "~1.4.0", "@noble/hashes": "~1.4.0", "@scure/base": "~1.1.6" } }, "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg=="], + + "web3-utils/ethereum-cryptography/@scure/bip39": ["@scure/bip39@1.3.0", "", { "dependencies": { "@noble/hashes": "~1.4.0", "@scure/base": "~1.1.6" } }, "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ=="], + + "@ensdomains/hardhat-chai-matchers-viem/@vitest/expect/@vitest/spy/tinyspy": ["tinyspy@3.0.2", "", {}, "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q=="], + + "@nomicfoundation/ignition-core/ethers/@types/node/undici-types": ["undici-types@6.19.8", "", {}, "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="], + + "eth-gas-reporter/cli-table3/string-width/is-fullwidth-code-point": ["is-fullwidth-code-point@2.0.0", "", {}, "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w=="], + + "eth-gas-reporter/cli-table3/string-width/strip-ansi": ["strip-ansi@4.0.0", "", { "dependencies": { "ansi-regex": "^3.0.0" } }, "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow=="], + + "ghost-testrpc/chalk/ansi-styles/color-convert": ["color-convert@1.9.3", "", { "dependencies": { "color-name": "1.1.3" } }, "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg=="], + + "ghost-testrpc/chalk/supports-color/has-flag": ["has-flag@3.0.0", "", {}, "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw=="], + + "globby/glob/minimatch/brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="], + + "hardhat-deploy/chokidar/readdirp/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], + + "mocha/chokidar/readdirp/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], + + "rimraf/glob/minimatch/brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="], + + "sc-istanbul/glob/minimatch/brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="], + + "shelljs/glob/minimatch/brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="], + + "solidity-coverage/chalk/ansi-styles/color-convert": ["color-convert@1.9.3", "", { "dependencies": { "color-name": "1.1.3" } }, "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg=="], + + "solidity-coverage/chalk/supports-color/has-flag": ["has-flag@3.0.0", "", {}, "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw=="], + + "eth-gas-reporter/cli-table3/string-width/strip-ansi/ansi-regex": ["ansi-regex@3.0.1", "", {}, "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw=="], + + "ghost-testrpc/chalk/ansi-styles/color-convert/color-name": ["color-name@1.1.3", "", {}, "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="], + + "solidity-coverage/chalk/ansi-styles/color-convert/color-name": ["color-name@1.1.3", "", {}, "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="], + } +} diff --git a/solidity/dns-contracts/bun.lockb b/solidity/dns-contracts/bun.lockb new file mode 100755 index 0000000..3d6f75c Binary files /dev/null and b/solidity/dns-contracts/bun.lockb differ diff --git a/solidity/dns-contracts/contracts/dnsregistrar/DNSClaimChecker.sol b/solidity/dns-contracts/contracts/dnsregistrar/DNSClaimChecker.sol new file mode 100644 index 0000000..5e70488 --- /dev/null +++ b/solidity/dns-contracts/contracts/dnsregistrar/DNSClaimChecker.sol @@ -0,0 +1,75 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import "../dnssec-oracle/DNSSEC.sol"; +import "../dnssec-oracle/RRUtils.sol"; +import "../utils/BytesUtils.sol"; +import "../utils/HexUtils.sol"; +import "@ensdomains/buffer/contracts/Buffer.sol"; + +library DNSClaimChecker { + using BytesUtils for bytes; + using HexUtils for bytes; + using RRUtils for *; + using Buffer for Buffer.buffer; + + uint16 constant CLASS_INET = 1; + uint16 constant TYPE_TXT = 16; + + function getOwnerAddress( + bytes memory name, + bytes memory data + ) internal pure returns (address, bool) { + // Add "_ens." to the front of the name. + Buffer.buffer memory buf; + buf.init(name.length + 5); + buf.append("\x04_ens"); + buf.append(name); + + for ( + RRUtils.RRIterator memory iter = data.iterateRRs(0); + !iter.done(); + iter.next() + ) { + if (iter.name().compareNames(buf.buf) != 0) continue; + bool found; + address addr; + (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset); + if (found) { + return (addr, true); + } + } + + return (address(0x0), false); + } + + function parseRR( + bytes memory rdata, + uint256 idx, + uint256 endIdx + ) internal pure returns (address, bool) { + while (idx < endIdx) { + uint256 len = rdata.readUint8(idx); + idx += 1; + + bool found; + address addr; + (addr, found) = parseString(rdata, idx, len); + + if (found) return (addr, true); + idx += len; + } + + return (address(0x0), false); + } + + function parseString( + bytes memory str, + uint256 idx, + uint256 len + ) internal pure returns (address, bool) { + // TODO: More robust parsing that handles whitespace and multiple key/value pairs + if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x' + return str.hexToAddress(idx + 4, idx + len); + } +} diff --git a/solidity/dns-contracts/contracts/dnsregistrar/DNSRegistrar.sol b/solidity/dns-contracts/contracts/dnsregistrar/DNSRegistrar.sol new file mode 100644 index 0000000..2ac4cbf --- /dev/null +++ b/solidity/dns-contracts/contracts/dnsregistrar/DNSRegistrar.sol @@ -0,0 +1,206 @@ +//SPDX-License-Identifier: MIT + +pragma solidity ^0.8.4; + +import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; +import "@ensdomains/buffer/contracts/Buffer.sol"; +import "../dnssec-oracle/DNSSEC.sol"; +import "../dnssec-oracle/RRUtils.sol"; +import "../registry/ENSRegistry.sol"; +import "../root/Root.sol"; +import "../resolvers/profiles/AddrResolver.sol"; +import "../utils/BytesUtils.sol"; +import "./DNSClaimChecker.sol"; +import "./PublicSuffixList.sol"; +import "./IDNSRegistrar.sol"; + +/** + * @dev An ENS registrar that allows the owner of a DNS name to claim the + * corresponding name in ENS. + */ +contract DNSRegistrar is IDNSRegistrar, IERC165 { + using BytesUtils for bytes; + using Buffer for Buffer.buffer; + using RRUtils for *; + + ENS public immutable ens; + DNSSEC public immutable oracle; + PublicSuffixList public suffixes; + address public immutable previousRegistrar; + address public immutable resolver; + // A mapping of the most recent signatures seen for each claimed domain. + mapping(bytes32 => uint32) public inceptions; + + error NoOwnerRecordFound(); + error PermissionDenied(address caller, address owner); + error PreconditionNotMet(); + error StaleProof(); + error InvalidPublicSuffix(bytes name); + + struct OwnerRecord { + bytes name; + address owner; + address resolver; + uint64 ttl; + } + + event Claim( + bytes32 indexed node, + address indexed owner, + bytes dnsname, + uint32 inception + ); + event NewPublicSuffixList(address suffixes); + + constructor( + address _previousRegistrar, + address _resolver, + DNSSEC _dnssec, + PublicSuffixList _suffixes, + ENS _ens + ) { + previousRegistrar = _previousRegistrar; + resolver = _resolver; + oracle = _dnssec; + suffixes = _suffixes; + emit NewPublicSuffixList(address(suffixes)); + ens = _ens; + } + + /** + * @dev This contract's owner-only functions can be invoked by the owner of the ENS root. + */ + modifier onlyOwner() { + Root root = Root(ens.owner(bytes32(0))); + address owner = root.owner(); + require(msg.sender == owner); + _; + } + + function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner { + suffixes = _suffixes; + emit NewPublicSuffixList(address(suffixes)); + } + + /** + * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs. + * @param name The name to claim, in DNS wire format. + * @param input A chain of signed DNS RRSETs ending with a text record. + */ + function proveAndClaim( + bytes memory name, + DNSSEC.RRSetWithSignature[] memory input + ) public override { + (bytes32 rootNode, bytes32 labelHash, address addr) = _claim( + name, + input + ); + ens.setSubnodeOwner(rootNode, labelHash, addr); + } + + function proveAndClaimWithResolver( + bytes memory name, + DNSSEC.RRSetWithSignature[] memory input, + address resolver, + address addr + ) public override { + (bytes32 rootNode, bytes32 labelHash, address owner) = _claim( + name, + input + ); + if (msg.sender != owner) { + revert PermissionDenied(msg.sender, owner); + } + ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0); + if (addr != address(0)) { + if (resolver == address(0)) { + revert PreconditionNotMet(); + } + bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash)); + // Set the resolver record + AddrResolver(resolver).setAddr(node, addr); + } + } + + function supportsInterface( + bytes4 interfaceID + ) external pure override returns (bool) { + return + interfaceID == type(IERC165).interfaceId || + interfaceID == type(IDNSRegistrar).interfaceId; + } + + function _claim( + bytes memory name, + DNSSEC.RRSetWithSignature[] memory input + ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) { + (bytes memory data, uint32 inception) = oracle.verifyRRSet(input); + + // Get the first label + uint256 labelLen = name.readUint8(0); + labelHash = name.keccak(1, labelLen); + + bytes memory parentName = name.substring( + labelLen + 1, + name.length - labelLen - 1 + ); + + // Make sure the parent name is enabled + parentNode = enableNode(parentName); + + bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash)); + if (!RRUtils.serialNumberGte(inception, inceptions[node])) { + revert StaleProof(); + } + inceptions[node] = inception; + + bool found; + (addr, found) = DNSClaimChecker.getOwnerAddress(name, data); + if (!found) { + revert NoOwnerRecordFound(); + } + + emit Claim(node, addr, name, inception); + } + + function enableNode(bytes memory domain) public returns (bytes32 node) { + // Name must be in the public suffix list. + if (!suffixes.isPublicSuffix(domain)) { + revert InvalidPublicSuffix(domain); + } + return _enableNode(domain, 0); + } + + function _enableNode( + bytes memory domain, + uint256 offset + ) internal returns (bytes32 node) { + uint256 len = domain.readUint8(offset); + if (len == 0) { + return bytes32(0); + } + + bytes32 parentNode = _enableNode(domain, offset + len + 1); + bytes32 label = domain.keccak(offset + 1, len); + node = keccak256(abi.encodePacked(parentNode, label)); + address owner = ens.owner(node); + if (owner == address(0) || owner == previousRegistrar) { + if (parentNode == bytes32(0)) { + Root root = Root(ens.owner(bytes32(0))); + root.setSubnodeOwner(label, address(this)); + ens.setResolver(node, resolver); + } else { + ens.setSubnodeRecord( + parentNode, + label, + address(this), + resolver, + 0 + ); + } + } else if (owner != address(this)) { + revert PreconditionNotMet(); + } + return node; + } +} diff --git a/solidity/dns-contracts/contracts/dnsregistrar/IDNSRegistrar.sol b/solidity/dns-contracts/contracts/dnsregistrar/IDNSRegistrar.sol new file mode 100644 index 0000000..7963787 --- /dev/null +++ b/solidity/dns-contracts/contracts/dnsregistrar/IDNSRegistrar.sol @@ -0,0 +1,18 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import "../dnssec-oracle/DNSSEC.sol"; + +interface IDNSRegistrar { + function proveAndClaim( + bytes memory name, + DNSSEC.RRSetWithSignature[] memory input + ) external; + + function proveAndClaimWithResolver( + bytes memory name, + DNSSEC.RRSetWithSignature[] memory input, + address resolver, + address addr + ) external; +} diff --git a/solidity/dns-contracts/contracts/dnsregistrar/OffchainDNSResolver.sol b/solidity/dns-contracts/contracts/dnsregistrar/OffchainDNSResolver.sol new file mode 100644 index 0000000..a15e27b --- /dev/null +++ b/solidity/dns-contracts/contracts/dnsregistrar/OffchainDNSResolver.sol @@ -0,0 +1,336 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import "../../contracts/resolvers/profiles/IAddrResolver.sol"; +import "../../contracts/resolvers/profiles/IExtendedResolver.sol"; +import "../../contracts/resolvers/profiles/IExtendedDNSResolver.sol"; +import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; +import "../dnssec-oracle/DNSSEC.sol"; +import "../dnssec-oracle/RRUtils.sol"; +import "../registry/ENSRegistry.sol"; +import "../utils/HexUtils.sol"; +import "../utils/BytesUtils.sol"; + +import {Address} from "@openzeppelin/contracts/utils/Address.sol"; +import {LowLevelCallUtils} from "../utils/LowLevelCallUtils.sol"; + +error InvalidOperation(); +error OffchainLookup( + address sender, + string[] urls, + bytes callData, + bytes4 callbackFunction, + bytes extraData +); + +interface IDNSGateway { + function resolve( + bytes memory name, + uint16 qtype + ) external returns (DNSSEC.RRSetWithSignature[] memory); +} + +uint16 constant CLASS_INET = 1; +uint16 constant TYPE_TXT = 16; + +contract OffchainDNSResolver is IExtendedResolver, IERC165 { + using RRUtils for *; + using Address for address; + using BytesUtils for bytes; + using HexUtils for bytes; + + ENS public immutable ens; + DNSSEC public immutable oracle; + string public gatewayURL; + + error CouldNotResolve(bytes name); + + constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) { + ens = _ens; + oracle = _oracle; + gatewayURL = _gatewayURL; + } + + function supportsInterface( + bytes4 interfaceId + ) external pure override returns (bool) { + return interfaceId == type(IExtendedResolver).interfaceId; + } + + function resolve( + bytes calldata name, + bytes calldata data + ) external view returns (bytes memory) { + revertWithDefaultOffchainLookup(name, data); + } + + function resolveCallback( + bytes calldata response, + bytes calldata extraData + ) external view returns (bytes memory) { + (bytes memory name, bytes memory query, bytes4 selector) = abi.decode( + extraData, + (bytes, bytes, bytes4) + ); + + if (selector != bytes4(0)) { + (bytes memory targetData, address targetResolver) = abi.decode( + query, + (bytes, address) + ); + return + callWithOffchainLookupPropagation( + targetResolver, + name, + query, + abi.encodeWithSelector( + selector, + response, + abi.encode(targetData, address(this)) + ) + ); + } + + DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode( + response, + (DNSSEC.RRSetWithSignature[]) + ); + + (bytes memory data, ) = oracle.verifyRRSet(rrsets); + for ( + RRUtils.RRIterator memory iter = data.iterateRRs(0); + !iter.done(); + iter.next() + ) { + // Ignore records with wrong name, type, or class + bytes memory rrname = RRUtils.readName(iter.data, iter.offset); + if ( + !rrname.equals(name) || + iter.class != CLASS_INET || + iter.dnstype != TYPE_TXT + ) { + continue; + } + + // Look for a valid ENS-DNS TXT record + (address dnsresolver, bytes memory context) = parseRR( + iter.data, + iter.rdataOffset, + iter.nextOffset + ); + + // If we found a valid record, try to resolve it + if (dnsresolver != address(0)) { + if ( + IERC165(dnsresolver).supportsInterface( + IExtendedDNSResolver.resolve.selector + ) + ) { + return + callWithOffchainLookupPropagation( + dnsresolver, + name, + query, + abi.encodeCall( + IExtendedDNSResolver.resolve, + (name, query, context) + ) + ); + } else if ( + IERC165(dnsresolver).supportsInterface( + IExtendedResolver.resolve.selector + ) + ) { + return + callWithOffchainLookupPropagation( + dnsresolver, + name, + query, + abi.encodeCall( + IExtendedResolver.resolve, + (name, query) + ) + ); + } else { + (bool ok, bytes memory ret) = address(dnsresolver) + .staticcall(query); + if (ok) { + return ret; + } else { + revert CouldNotResolve(name); + } + } + } + } + + // No valid records; revert. + revert CouldNotResolve(name); + } + + function parseRR( + bytes memory data, + uint256 idx, + uint256 lastIdx + ) internal view returns (address, bytes memory) { + bytes memory txt = readTXT(data, idx, lastIdx); + + // Must start with the magic word + if (txt.length < 5 || !txt.equals(0, "ENS1 ", 0, 5)) { + return (address(0), ""); + } + + // Parse the name or address + uint256 lastTxtIdx = txt.find(5, txt.length - 5, " "); + if (lastTxtIdx > txt.length) { + address dnsResolver = parseAndResolve(txt, 5, txt.length); + return (dnsResolver, ""); + } else { + address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx); + return ( + dnsResolver, + txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1) + ); + } + } + + function readTXT( + bytes memory data, + uint256 startIdx, + uint256 lastIdx + ) internal pure returns (bytes memory) { + // TODO: Concatenate multiple text fields + uint256 fieldLength = data.readUint8(startIdx); + assert(startIdx + fieldLength < lastIdx); + return data.substring(startIdx + 1, fieldLength); + } + + function parseAndResolve( + bytes memory nameOrAddress, + uint256 idx, + uint256 lastIdx + ) internal view returns (address) { + if (nameOrAddress[idx] == "0" && nameOrAddress[idx + 1] == "x") { + (address ret, bool valid) = nameOrAddress.hexToAddress( + idx + 2, + lastIdx + ); + if (valid) { + return ret; + } + } + return resolveName(nameOrAddress, idx, lastIdx); + } + + function resolveName( + bytes memory name, + uint256 idx, + uint256 lastIdx + ) internal view returns (address) { + bytes32 node = textNamehash(name, idx, lastIdx); + address resolver = ens.resolver(node); + if (resolver == address(0)) { + return address(0); + } + return IAddrResolver(resolver).addr(node); + } + + /** + * @dev Namehash function that operates on dot-separated names (not dns-encoded names) + * @param name Name to hash + * @param idx Index to start at + * @param lastIdx Index to end at + */ + function textNamehash( + bytes memory name, + uint256 idx, + uint256 lastIdx + ) internal view returns (bytes32) { + uint256 separator = name.find(idx, name.length - idx, bytes1(".")); + bytes32 parentNode = bytes32(0); + if (separator < lastIdx) { + parentNode = textNamehash(name, separator + 1, lastIdx); + } else { + separator = lastIdx; + } + return + keccak256( + abi.encodePacked(parentNode, name.keccak(idx, separator - idx)) + ); + } + + function callWithOffchainLookupPropagation( + address target, + bytes memory name, + bytes memory innerdata, + bytes memory data + ) internal view returns (bytes memory) { + if (!target.isContract()) { + revertWithDefaultOffchainLookup(name, innerdata); + } + + bool result = LowLevelCallUtils.functionStaticCall( + address(target), + data + ); + uint256 size = LowLevelCallUtils.returnDataSize(); + if (result) { + bytes memory returnData = LowLevelCallUtils.readReturnData(0, size); + return abi.decode(returnData, (bytes)); + } + // Failure + if (size >= 4) { + bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4); + if (bytes4(errorId) == OffchainLookup.selector) { + // Offchain lookup. Decode the revert message and create our own that nests it. + bytes memory revertData = LowLevelCallUtils.readReturnData( + 4, + size - 4 + ); + handleOffchainLookupError(revertData, target, name); + } + } + LowLevelCallUtils.propagateRevert(); + } + + function revertWithDefaultOffchainLookup( + bytes memory name, + bytes memory data + ) internal view { + string[] memory urls = new string[](1); + urls[0] = gatewayURL; + + revert OffchainLookup( + address(this), + urls, + abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)), + OffchainDNSResolver.resolveCallback.selector, + abi.encode(name, data, bytes4(0)) + ); + } + + function handleOffchainLookupError( + bytes memory returnData, + address target, + bytes memory name + ) internal view { + ( + address sender, + string[] memory urls, + bytes memory callData, + bytes4 innerCallbackFunction, + bytes memory extraData + ) = abi.decode(returnData, (address, string[], bytes, bytes4, bytes)); + + if (sender != target) { + revert InvalidOperation(); + } + + revert OffchainLookup( + address(this), + urls, + callData, + OffchainDNSResolver.resolveCallback.selector, + abi.encode(name, extraData, innerCallbackFunction) + ); + } +} diff --git a/solidity/dns-contracts/contracts/dnsregistrar/PublicSuffixList.sol b/solidity/dns-contracts/contracts/dnsregistrar/PublicSuffixList.sol new file mode 100644 index 0000000..68bd7a4 --- /dev/null +++ b/solidity/dns-contracts/contracts/dnsregistrar/PublicSuffixList.sol @@ -0,0 +1,5 @@ +pragma solidity ^0.8.4; + +interface PublicSuffixList { + function isPublicSuffix(bytes calldata name) external view returns (bool); +} diff --git a/solidity/dns-contracts/contracts/dnsregistrar/RecordParser.sol b/solidity/dns-contracts/contracts/dnsregistrar/RecordParser.sol new file mode 100644 index 0000000..6e94060 --- /dev/null +++ b/solidity/dns-contracts/contracts/dnsregistrar/RecordParser.sol @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.11; + +import "../utils/BytesUtils.sol"; + +library RecordParser { + using BytesUtils for bytes; + + /** + * @dev Parses a key-value record into a key and value. + * @param input The input string + * @param offset The offset to start reading at + */ + function readKeyValue( + bytes memory input, + uint256 offset, + uint256 len + ) + internal + pure + returns (bytes memory key, bytes memory value, uint256 nextOffset) + { + uint256 separator = input.find(offset, len, "="); + if (separator == type(uint256).max) { + return ("", "", type(uint256).max); + } + + uint256 terminator = input.find( + separator, + len + offset - separator, + " " + ); + if (terminator == type(uint256).max) { + terminator = len + offset; + nextOffset = terminator; + } else { + nextOffset = terminator + 1; + } + + key = input.substring(offset, separator - offset); + value = input.substring(separator + 1, terminator - separator - 1); + } +} diff --git a/solidity/dns-contracts/contracts/dnsregistrar/SimplePublicSuffixList.sol b/solidity/dns-contracts/contracts/dnsregistrar/SimplePublicSuffixList.sol new file mode 100644 index 0000000..1d6b8aa --- /dev/null +++ b/solidity/dns-contracts/contracts/dnsregistrar/SimplePublicSuffixList.sol @@ -0,0 +1,24 @@ +pragma solidity ^0.8.4; +pragma experimental ABIEncoderV2; + +import "../root/Ownable.sol"; +import "./PublicSuffixList.sol"; + +contract SimplePublicSuffixList is PublicSuffixList, Ownable { + mapping(bytes => bool) suffixes; + + event SuffixAdded(bytes suffix); + + function addPublicSuffixes(bytes[] memory names) public onlyOwner { + for (uint256 i = 0; i < names.length; i++) { + suffixes[names[i]] = true; + emit SuffixAdded(names[i]); + } + } + + function isPublicSuffix( + bytes calldata name + ) external view override returns (bool) { + return suffixes[name]; + } +} diff --git a/solidity/dns-contracts/contracts/dnsregistrar/TLDPublicSuffixList.sol b/solidity/dns-contracts/contracts/dnsregistrar/TLDPublicSuffixList.sol new file mode 100644 index 0000000..8bf72db --- /dev/null +++ b/solidity/dns-contracts/contracts/dnsregistrar/TLDPublicSuffixList.sol @@ -0,0 +1,18 @@ +pragma solidity ^0.8.4; + +import "../utils/BytesUtils.sol"; +import "./PublicSuffixList.sol"; + +/** + * @dev A public suffix list that treats all TLDs as public suffixes. + */ +contract TLDPublicSuffixList is PublicSuffixList { + using BytesUtils for bytes; + + function isPublicSuffix( + bytes calldata name + ) external view override returns (bool) { + uint256 labellen = name.readUint8(0); + return labellen > 0 && name.readUint8(labellen + 1) == 0; + } +} diff --git a/solidity/dns-contracts/contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol b/solidity/dns-contracts/contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol new file mode 100644 index 0000000..fea2dea --- /dev/null +++ b/solidity/dns-contracts/contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol @@ -0,0 +1,34 @@ +pragma solidity ^0.8.4; + +contract DummyDNSSEC { + uint16 expectedType; + bytes expectedName; + uint32 inception; + uint64 inserted; + bytes20 hash; + + function setData( + uint16 _expectedType, + bytes memory _expectedName, + uint32 _inception, + uint64 _inserted, + bytes memory _proof + ) public { + expectedType = _expectedType; + expectedName = _expectedName; + inception = _inception; + inserted = _inserted; + if (_proof.length != 0) { + hash = bytes20(keccak256(_proof)); + } + } + + function rrdata( + uint16 dnstype, + bytes memory name + ) public view returns (uint32, uint64, bytes20) { + require(dnstype == expectedType); + require(keccak256(name) == keccak256(expectedName)); + return (inception, inserted, hash); + } +} diff --git a/solidity/dns-contracts/contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol b/solidity/dns-contracts/contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol new file mode 100644 index 0000000..fe52fab --- /dev/null +++ b/solidity/dns-contracts/contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import "../../resolvers/profiles/IExtendedDNSResolver.sol"; +import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; + +contract DummyExtendedDNSSECResolver is IExtendedDNSResolver, IERC165 { + function supportsInterface( + bytes4 interfaceId + ) external pure override returns (bool) { + return interfaceId == type(IExtendedDNSResolver).interfaceId; + } + + function resolve( + bytes memory /* name */, + bytes memory /* data */, + bytes memory context + ) external view override returns (bytes memory) { + return abi.encode(context); + } +} diff --git a/solidity/dns-contracts/contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol b/solidity/dns-contracts/contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol new file mode 100644 index 0000000..3119722 --- /dev/null +++ b/solidity/dns-contracts/contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import "../../resolvers/profiles/ITextResolver.sol"; +import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; + +contract DummyLegacyTextResolver is ITextResolver, IERC165 { + function supportsInterface( + bytes4 interfaceId + ) external pure override returns (bool) { + return interfaceId == type(ITextResolver).interfaceId; + } + + function text( + bytes32 /* node */, + string calldata key + ) external view override returns (string memory) { + return key; + } +} diff --git a/solidity/dns-contracts/contracts/dnsregistrar/mocks/DummyNonCCIPAwareResolver.sol b/solidity/dns-contracts/contracts/dnsregistrar/mocks/DummyNonCCIPAwareResolver.sol new file mode 100644 index 0000000..61b6cc5 --- /dev/null +++ b/solidity/dns-contracts/contracts/dnsregistrar/mocks/DummyNonCCIPAwareResolver.sol @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; +import "../OffchainDNSResolver.sol"; +import "../../resolvers/profiles/IExtendedResolver.sol"; + +contract DummyNonCCIPAwareResolver is IExtendedResolver, ERC165 { + OffchainDNSResolver dnsResolver; + + constructor(OffchainDNSResolver _dnsResolver) { + dnsResolver = _dnsResolver; + } + + function supportsInterface( + bytes4 interfaceId + ) public view virtual override returns (bool) { + return + interfaceId == type(IExtendedResolver).interfaceId || + super.supportsInterface(interfaceId); + } + + function resolve( + bytes calldata /* name */, + bytes calldata data + ) external view returns (bytes memory) { + string[] memory urls = new string[](1); + urls[0] = "https://example.com/"; + revert OffchainLookup( + address(dnsResolver), + urls, + data, + OffchainDNSResolver.resolveCallback.selector, + data + ); + } +} diff --git a/solidity/dns-contracts/contracts/dnsregistrar/mocks/DummyParser.sol b/solidity/dns-contracts/contracts/dnsregistrar/mocks/DummyParser.sol new file mode 100644 index 0000000..403d3dc --- /dev/null +++ b/solidity/dns-contracts/contracts/dnsregistrar/mocks/DummyParser.sol @@ -0,0 +1,47 @@ +pragma solidity ^0.8.4; + +import "../../utils/BytesUtils.sol"; +import "../RecordParser.sol"; + +contract DummyParser { + using BytesUtils for bytes; + + // parse data in format: name;key1=value1 key2=value2;url + function parseData( + bytes memory data, + uint256 kvCount + ) + external + pure + returns ( + string memory name, + string[] memory keys, + string[] memory values, + string memory url + ) + { + uint256 len = data.length; + // retrieve name + uint256 sep1 = data.find(0, len, ";"); + name = string(data.substring(0, sep1)); + + // retrieve url + uint256 sep2 = data.find(sep1 + 1, len - sep1, ";"); + url = string(data.substring(sep2 + 1, len - sep2 - 1)); + + keys = new string[](kvCount); + values = new string[](kvCount); + // retrieve keys and values + uint256 offset = sep1 + 1; + for (uint256 i; i < kvCount && offset < len; i++) { + ( + bytes memory key, + bytes memory val, + uint256 nextOffset + ) = RecordParser.readKeyValue(data, offset, sep2 - offset); + keys[i] = string(key); + values[i] = string(val); + offset = nextOffset; + } + } +} diff --git a/solidity/dns-contracts/contracts/dnssec-oracle/DNSSEC.sol b/solidity/dns-contracts/contracts/dnssec-oracle/DNSSEC.sol new file mode 100644 index 0000000..9da8e78 --- /dev/null +++ b/solidity/dns-contracts/contracts/dnssec-oracle/DNSSEC.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; +pragma experimental ABIEncoderV2; + +abstract contract DNSSEC { + bytes public anchors; + + struct RRSetWithSignature { + bytes rrset; + bytes sig; + } + + event AlgorithmUpdated(uint8 id, address addr); + event DigestUpdated(uint8 id, address addr); + + function verifyRRSet( + RRSetWithSignature[] memory input + ) external view virtual returns (bytes memory rrs, uint32 inception); + + function verifyRRSet( + RRSetWithSignature[] memory input, + uint256 now + ) public view virtual returns (bytes memory rrs, uint32 inception); +} diff --git a/solidity/dns-contracts/contracts/dnssec-oracle/DNSSECImpl.sol b/solidity/dns-contracts/contracts/dnssec-oracle/DNSSECImpl.sol new file mode 100644 index 0000000..bf8ddeb --- /dev/null +++ b/solidity/dns-contracts/contracts/dnssec-oracle/DNSSECImpl.sol @@ -0,0 +1,425 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; +pragma experimental ABIEncoderV2; + +import "./Owned.sol"; +import "./RRUtils.sol"; +import "./DNSSEC.sol"; +import "./algorithms/Algorithm.sol"; +import "./digests/Digest.sol"; +import "../utils/BytesUtils.sol"; +import "@ensdomains/buffer/contracts/Buffer.sol"; + +/* + * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records. + * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards: + * - NSEC & NSEC3 are not supported; only positive proofs are allowed. + * - Proofs involving wildcard names will not validate. + * - TTLs on records are ignored, as data is not stored persistently. + * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting + * proofs with non-canonical names will only result in registering unresolvable ENS names. + */ +contract DNSSECImpl is DNSSEC, Owned { + using Buffer for Buffer.buffer; + using BytesUtils for bytes; + using RRUtils for *; + + uint16 constant DNSCLASS_IN = 1; + + uint16 constant DNSTYPE_DS = 43; + uint16 constant DNSTYPE_DNSKEY = 48; + + uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100; + + error InvalidLabelCount(bytes name, uint256 labelsExpected); + error SignatureNotValidYet(uint32 inception, uint32 now); + error SignatureExpired(uint32 expiration, uint32 now); + error InvalidClass(uint16 class); + error InvalidRRSet(); + error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType); + error InvalidSignerName(bytes rrsetName, bytes signerName); + error InvalidProofType(uint16 proofType); + error ProofNameMismatch(bytes signerName, bytes proofName); + error NoMatchingProof(bytes signerName); + + mapping(uint8 => Algorithm) public algorithms; + mapping(uint8 => Digest) public digests; + + /** + * @dev Constructor. + * @param _anchors The binary format RR entries for the root DS records. + */ + constructor(bytes memory _anchors) { + // Insert the 'trust anchors' - the key hashes that start the chain + // of trust for all other records. + anchors = _anchors; + } + + /** + * @dev Sets the contract address for a signature verification algorithm. + * Callable only by the owner. + * @param id The algorithm ID + * @param algo The address of the algorithm contract. + */ + function setAlgorithm(uint8 id, Algorithm algo) public owner_only { + algorithms[id] = algo; + emit AlgorithmUpdated(id, address(algo)); + } + + /** + * @dev Sets the contract address for a digest verification algorithm. + * Callable only by the owner. + * @param id The digest ID + * @param digest The address of the digest contract. + */ + function setDigest(uint8 id, Digest digest) public owner_only { + digests[id] = digest; + emit DigestUpdated(id, address(digest)); + } + + /** + * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain. + * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records. + * @param input A list of signed RRSets. + * @return rrs The RRData from the last RRSet in the chain. + * @return inception The inception time of the signed record set. + */ + function verifyRRSet( + RRSetWithSignature[] memory input + ) + external + view + virtual + override + returns (bytes memory rrs, uint32 inception) + { + return verifyRRSet(input, block.timestamp); + } + + /** + * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain. + * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records. + * @param input A list of signed RRSets. + * @param now The Unix timestamp to validate the records at. + * @return rrs The RRData from the last RRSet in the chain. + * @return inception The inception time of the signed record set. + */ + function verifyRRSet( + RRSetWithSignature[] memory input, + uint256 now + ) + public + view + virtual + override + returns (bytes memory rrs, uint32 inception) + { + bytes memory proof = anchors; + for (uint256 i = 0; i < input.length; i++) { + RRUtils.SignedSet memory rrset = validateSignedSet( + input[i], + proof, + now + ); + proof = rrset.data; + inception = rrset.inception; + } + return (proof, inception); + } + + /** + * @dev Validates an RRSet against the already trusted RR provided in `proof`. + * + * @param input The signed RR set. This is in the format described in section + * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature + * data, followed by a series of canonicalised RR records that the signature + * applies to. + * @param proof The DNSKEY or DS to validate the signature against. + * @param now The current timestamp. + */ + function validateSignedSet( + RRSetWithSignature memory input, + bytes memory proof, + uint256 now + ) internal view returns (RRUtils.SignedSet memory rrset) { + rrset = input.rrset.readSignedSet(); + + // Do some basic checks on the RRs and extract the name + bytes memory name = validateRRs(rrset, rrset.typeCovered); + if (name.labelCount(0) != rrset.labels) { + revert InvalidLabelCount(name, rrset.labels); + } + rrset.name = name; + + // All comparisons involving the Signature Expiration and + // Inception fields MUST use "serial number arithmetic", as + // defined in RFC 1982 + + // o The validator's notion of the current time MUST be less than or + // equal to the time listed in the RRSIG RR's Expiration field. + if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) { + revert SignatureExpired(rrset.expiration, uint32(now)); + } + + // o The validator's notion of the current time MUST be greater than or + // equal to the time listed in the RRSIG RR's Inception field. + if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) { + revert SignatureNotValidYet(rrset.inception, uint32(now)); + } + + // Validate the signature + verifySignature(name, rrset, input, proof); + + return rrset; + } + + /** + * @dev Validates a set of RRs. + * @param rrset The RR set. + * @param typecovered The type covered by the RRSIG record. + */ + function validateRRs( + RRUtils.SignedSet memory rrset, + uint16 typecovered + ) internal pure returns (bytes memory name) { + // Iterate over all the RRs + for ( + RRUtils.RRIterator memory iter = rrset.rrs(); + !iter.done(); + iter.next() + ) { + // We only support class IN (Internet) + if (iter.class != DNSCLASS_IN) { + revert InvalidClass(iter.class); + } + + if (name.length == 0) { + name = iter.name(); + } else { + // Name must be the same on all RRs. We do things this way to avoid copying the name + // repeatedly. + if ( + name.length != iter.data.nameLength(iter.offset) || + !name.equals(0, iter.data, iter.offset, name.length) + ) { + revert InvalidRRSet(); + } + } + + // o The RRSIG RR's Type Covered field MUST equal the RRset's type. + if (iter.dnstype != typecovered) { + revert SignatureTypeMismatch(iter.dnstype, typecovered); + } + } + } + + /** + * @dev Performs signature verification. + * + * Throws or reverts if unable to verify the record. + * + * @param name The name of the RRSIG record, in DNS label-sequence format. + * @param data The original data to verify. + * @param proof A DS or DNSKEY record that's already verified by the oracle. + */ + function verifySignature( + bytes memory name, + RRUtils.SignedSet memory rrset, + RRSetWithSignature memory data, + bytes memory proof + ) internal view { + // o The RRSIG RR's Signer's Name field MUST be the name of the zone + // that contains the RRset. + if (!name.isSubdomainOf(rrset.signerName)) { + revert InvalidSignerName(name, rrset.signerName); + } + + RRUtils.RRIterator memory proofRR = proof.iterateRRs(0); + // Check the proof + if (proofRR.dnstype == DNSTYPE_DS) { + verifyWithDS(rrset, data, proofRR); + } else if (proofRR.dnstype == DNSTYPE_DNSKEY) { + verifyWithKnownKey(rrset, data, proofRR); + } else { + revert InvalidProofType(proofRR.dnstype); + } + } + + /** + * @dev Attempts to verify a signed RRSET against an already known public key. + * @param rrset The signed set to verify. + * @param data The original data the signed set was read from. + * @param proof The serialized DS or DNSKEY record to use as proof. + */ + function verifyWithKnownKey( + RRUtils.SignedSet memory rrset, + RRSetWithSignature memory data, + RRUtils.RRIterator memory proof + ) internal view { + // Check the DNSKEY's owner name matches the signer name on the RRSIG + for (; !proof.done(); proof.next()) { + bytes memory proofName = proof.name(); + if (!proofName.equals(rrset.signerName)) { + revert ProofNameMismatch(rrset.signerName, proofName); + } + + bytes memory keyrdata = proof.rdata(); + RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY( + 0, + keyrdata.length + ); + if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) { + return; + } + } + revert NoMatchingProof(rrset.signerName); + } + + /** + * @dev Attempts to verify some data using a provided key and a signature. + * @param dnskey The dns key record to verify the signature with. + * @param rrset The signed RRSET being verified. + * @param data The original data `rrset` was decoded from. + * @return True iff the key verifies the signature. + */ + function verifySignatureWithKey( + RRUtils.DNSKEY memory dnskey, + bytes memory keyrdata, + RRUtils.SignedSet memory rrset, + RRSetWithSignature memory data + ) internal view returns (bool) { + // TODO: Check key isn't expired, unless updating key itself + + // The Protocol Field MUST have value 3 (RFC4034 2.1.2) + if (dnskey.protocol != 3) { + return false; + } + + // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST + // match the owner name, algorithm, and key tag for some DNSKEY RR in + // the zone's apex DNSKEY RRset. + if (dnskey.algorithm != rrset.algorithm) { + return false; + } + uint16 computedkeytag = keyrdata.computeKeytag(); + if (computedkeytag != rrset.keytag) { + return false; + } + + // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY + // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7) + // set. + if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) { + return false; + } + + Algorithm algorithm = algorithms[dnskey.algorithm]; + if (address(algorithm) == address(0)) { + return false; + } + return algorithm.verify(keyrdata, data.rrset, data.sig); + } + + /** + * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes + * that the record + * @param rrset The signed set to verify. + * @param data The original data the signed set was read from. + * @param proof The serialized DS or DNSKEY record to use as proof. + */ + function verifyWithDS( + RRUtils.SignedSet memory rrset, + RRSetWithSignature memory data, + RRUtils.RRIterator memory proof + ) internal view { + uint256 proofOffset = proof.offset; + for ( + RRUtils.RRIterator memory iter = rrset.rrs(); + !iter.done(); + iter.next() + ) { + if (iter.dnstype != DNSTYPE_DNSKEY) { + revert InvalidProofType(iter.dnstype); + } + + bytes memory keyrdata = iter.rdata(); + RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY( + 0, + keyrdata.length + ); + if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) { + // It's self-signed - look for a DS record to verify it. + if ( + verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata) + ) { + return; + } + // Rewind proof iterator to the start for the next loop iteration. + proof.nextOffset = proofOffset; + proof.next(); + } + } + revert NoMatchingProof(rrset.signerName); + } + + /** + * @dev Attempts to verify a key using DS records. + * @param keyname The DNS name of the key, in DNS label-sequence format. + * @param dsrrs The DS records to use in verification. + * @param dnskey The dnskey to verify. + * @param keyrdata The RDATA section of the key. + * @return True if a DS record verifies this key. + */ + function verifyKeyWithDS( + bytes memory keyname, + RRUtils.RRIterator memory dsrrs, + RRUtils.DNSKEY memory dnskey, + bytes memory keyrdata + ) internal view returns (bool) { + uint16 keytag = keyrdata.computeKeytag(); + for (; !dsrrs.done(); dsrrs.next()) { + bytes memory proofName = dsrrs.name(); + if (!proofName.equals(keyname)) { + revert ProofNameMismatch(keyname, proofName); + } + + RRUtils.DS memory ds = dsrrs.data.readDS( + dsrrs.rdataOffset, + dsrrs.nextOffset - dsrrs.rdataOffset + ); + if (ds.keytag != keytag) { + continue; + } + if (ds.algorithm != dnskey.algorithm) { + continue; + } + + Buffer.buffer memory buf; + buf.init(keyname.length + keyrdata.length); + buf.append(keyname); + buf.append(keyrdata); + if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) { + return true; + } + } + return false; + } + + /** + * @dev Attempts to verify a DS record's hash value against some data. + * @param digesttype The digest ID from the DS record. + * @param data The data to digest. + * @param digest The digest data to check against. + * @return True iff the digest matches. + */ + function verifyDSHash( + uint8 digesttype, + bytes memory data, + bytes memory digest + ) internal view returns (bool) { + if (address(digests[digesttype]) == address(0)) { + return false; + } + return digests[digesttype].verify(data, digest); + } +} diff --git a/solidity/dns-contracts/contracts/dnssec-oracle/Owned.sol b/solidity/dns-contracts/contracts/dnssec-oracle/Owned.sol new file mode 100644 index 0000000..319d6a9 --- /dev/null +++ b/solidity/dns-contracts/contracts/dnssec-oracle/Owned.sol @@ -0,0 +1,21 @@ +pragma solidity ^0.8.4; + +/** + * @dev Contract mixin for 'owned' contracts. + */ +contract Owned { + address public owner; + + modifier owner_only() { + require(msg.sender == owner); + _; + } + + constructor() public { + owner = msg.sender; + } + + function setOwner(address newOwner) public owner_only { + owner = newOwner; + } +} diff --git a/solidity/dns-contracts/contracts/dnssec-oracle/RRUtils.sol b/solidity/dns-contracts/contracts/dnssec-oracle/RRUtils.sol new file mode 100644 index 0000000..89a88b9 --- /dev/null +++ b/solidity/dns-contracts/contracts/dnssec-oracle/RRUtils.sol @@ -0,0 +1,434 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import "../utils/BytesUtils.sol"; +import "@ensdomains/buffer/contracts/Buffer.sol"; + +/** + * @dev RRUtils is a library that provides utilities for parsing DNS resource records. + */ +library RRUtils { + using BytesUtils for *; + using Buffer for *; + + /** + * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'. + * @param self The byte array to read a name from. + * @param offset The offset to start reading at. + * @return The length of the DNS name at 'offset', in bytes. + */ + function nameLength( + bytes memory self, + uint256 offset + ) internal pure returns (uint256) { + uint256 idx = offset; + while (true) { + assert(idx < self.length); + uint256 labelLen = self.readUint8(idx); + idx += labelLen + 1; + if (labelLen == 0) { + break; + } + } + return idx - offset; + } + + /** + * @dev Returns a DNS format name at the specified offset of self. + * @param self The byte array to read a name from. + * @param offset The offset to start reading at. + * @return ret The name. + */ + function readName( + bytes memory self, + uint256 offset + ) internal pure returns (bytes memory ret) { + uint256 len = nameLength(self, offset); + return self.substring(offset, len); + } + + /** + * @dev Returns the number of labels in the DNS name at 'offset' in 'self'. + * @param self The byte array to read a name from. + * @param offset The offset to start reading at. + * @return The number of labels in the DNS name at 'offset', in bytes. + */ + function labelCount( + bytes memory self, + uint256 offset + ) internal pure returns (uint256) { + uint256 count = 0; + while (true) { + assert(offset < self.length); + uint256 labelLen = self.readUint8(offset); + offset += labelLen + 1; + if (labelLen == 0) { + break; + } + count += 1; + } + return count; + } + + uint256 constant RRSIG_TYPE = 0; + uint256 constant RRSIG_ALGORITHM = 2; + uint256 constant RRSIG_LABELS = 3; + uint256 constant RRSIG_TTL = 4; + uint256 constant RRSIG_EXPIRATION = 8; + uint256 constant RRSIG_INCEPTION = 12; + uint256 constant RRSIG_KEY_TAG = 16; + uint256 constant RRSIG_SIGNER_NAME = 18; + + struct SignedSet { + uint16 typeCovered; + uint8 algorithm; + uint8 labels; + uint32 ttl; + uint32 expiration; + uint32 inception; + uint16 keytag; + bytes signerName; + bytes data; + bytes name; + } + + function readSignedSet( + bytes memory data + ) internal pure returns (SignedSet memory self) { + self.typeCovered = data.readUint16(RRSIG_TYPE); + self.algorithm = data.readUint8(RRSIG_ALGORITHM); + self.labels = data.readUint8(RRSIG_LABELS); + self.ttl = data.readUint32(RRSIG_TTL); + self.expiration = data.readUint32(RRSIG_EXPIRATION); + self.inception = data.readUint32(RRSIG_INCEPTION); + self.keytag = data.readUint16(RRSIG_KEY_TAG); + self.signerName = readName(data, RRSIG_SIGNER_NAME); + self.data = data.substring( + RRSIG_SIGNER_NAME + self.signerName.length, + data.length - RRSIG_SIGNER_NAME - self.signerName.length + ); + } + + function rrs( + SignedSet memory rrset + ) internal pure returns (RRIterator memory) { + return iterateRRs(rrset.data, 0); + } + + /** + * @dev An iterator over resource records. + */ + struct RRIterator { + bytes data; + uint256 offset; + uint16 dnstype; + uint16 class; + uint32 ttl; + uint256 rdataOffset; + uint256 nextOffset; + } + + /** + * @dev Begins iterating over resource records. + * @param self The byte string to read from. + * @param offset The offset to start reading at. + * @return ret An iterator object. + */ + function iterateRRs( + bytes memory self, + uint256 offset + ) internal pure returns (RRIterator memory ret) { + ret.data = self; + ret.nextOffset = offset; + next(ret); + } + + /** + * @dev Returns true iff there are more RRs to iterate. + * @param iter The iterator to check. + * @return True iff the iterator has finished. + */ + function done(RRIterator memory iter) internal pure returns (bool) { + return iter.offset >= iter.data.length; + } + + /** + * @dev Moves the iterator to the next resource record. + * @param iter The iterator to advance. + */ + function next(RRIterator memory iter) internal pure { + iter.offset = iter.nextOffset; + if (iter.offset >= iter.data.length) { + return; + } + + // Skip the name + uint256 off = iter.offset + nameLength(iter.data, iter.offset); + + // Read type, class, and ttl + iter.dnstype = iter.data.readUint16(off); + off += 2; + iter.class = iter.data.readUint16(off); + off += 2; + iter.ttl = iter.data.readUint32(off); + off += 4; + + // Read the rdata + uint256 rdataLength = iter.data.readUint16(off); + off += 2; + iter.rdataOffset = off; + iter.nextOffset = off + rdataLength; + } + + /** + * @dev Returns the name of the current record. + * @param iter The iterator. + * @return A new bytes object containing the owner name from the RR. + */ + function name(RRIterator memory iter) internal pure returns (bytes memory) { + return + iter.data.substring( + iter.offset, + nameLength(iter.data, iter.offset) + ); + } + + /** + * @dev Returns the rdata portion of the current record. + * @param iter The iterator. + * @return A new bytes object containing the RR's RDATA. + */ + function rdata( + RRIterator memory iter + ) internal pure returns (bytes memory) { + return + iter.data.substring( + iter.rdataOffset, + iter.nextOffset - iter.rdataOffset + ); + } + + uint256 constant DNSKEY_FLAGS = 0; + uint256 constant DNSKEY_PROTOCOL = 2; + uint256 constant DNSKEY_ALGORITHM = 3; + uint256 constant DNSKEY_PUBKEY = 4; + + struct DNSKEY { + uint16 flags; + uint8 protocol; + uint8 algorithm; + bytes publicKey; + } + + function readDNSKEY( + bytes memory data, + uint256 offset, + uint256 length + ) internal pure returns (DNSKEY memory self) { + self.flags = data.readUint16(offset + DNSKEY_FLAGS); + self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL); + self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM); + self.publicKey = data.substring( + offset + DNSKEY_PUBKEY, + length - DNSKEY_PUBKEY + ); + } + + uint256 constant DS_KEY_TAG = 0; + uint256 constant DS_ALGORITHM = 2; + uint256 constant DS_DIGEST_TYPE = 3; + uint256 constant DS_DIGEST = 4; + + struct DS { + uint16 keytag; + uint8 algorithm; + uint8 digestType; + bytes digest; + } + + function readDS( + bytes memory data, + uint256 offset, + uint256 length + ) internal pure returns (DS memory self) { + self.keytag = data.readUint16(offset + DS_KEY_TAG); + self.algorithm = data.readUint8(offset + DS_ALGORITHM); + self.digestType = data.readUint8(offset + DS_DIGEST_TYPE); + self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST); + } + + function isSubdomainOf( + bytes memory self, + bytes memory other + ) internal pure returns (bool) { + uint256 off = 0; + uint256 counts = labelCount(self, 0); + uint256 othercounts = labelCount(other, 0); + + while (counts > othercounts) { + off = progress(self, off); + counts--; + } + + return self.equals(off, other, 0); + } + + function compareNames( + bytes memory self, + bytes memory other + ) internal pure returns (int256) { + if (self.equals(other)) { + return 0; + } + + uint256 off; + uint256 otheroff; + uint256 prevoff; + uint256 otherprevoff; + uint256 counts = labelCount(self, 0); + uint256 othercounts = labelCount(other, 0); + + // Keep removing labels from the front of the name until both names are equal length + while (counts > othercounts) { + prevoff = off; + off = progress(self, off); + counts--; + } + + while (othercounts > counts) { + otherprevoff = otheroff; + otheroff = progress(other, otheroff); + othercounts--; + } + + // Compare the last nonequal labels to each other + while (counts > 0 && !self.equals(off, other, otheroff)) { + prevoff = off; + off = progress(self, off); + otherprevoff = otheroff; + otheroff = progress(other, otheroff); + counts -= 1; + } + + if (off == 0) { + return -1; + } + if (otheroff == 0) { + return 1; + } + + return + self.compare( + prevoff + 1, + self.readUint8(prevoff), + other, + otherprevoff + 1, + other.readUint8(otherprevoff) + ); + } + + /** + * @dev Compares two serial numbers using RFC1982 serial number math. + */ + function serialNumberGte( + uint32 i1, + uint32 i2 + ) internal pure returns (bool) { + unchecked { + return int32(i1) - int32(i2) >= 0; + } + } + + function progress( + bytes memory body, + uint256 off + ) internal pure returns (uint256) { + return off + 1 + body.readUint8(off); + } + + /** + * @dev Computes the keytag for a chunk of data. + * @param data The data to compute a keytag for. + * @return The computed key tag. + */ + function computeKeytag(bytes memory data) internal pure returns (uint16) { + /* This function probably deserves some explanation. + * The DNSSEC keytag function is a checksum that relies on summing up individual bytes + * from the input string, with some mild bitshifting. Here's a Naive solidity implementation: + * + * function computeKeytag(bytes memory data) internal pure returns (uint16) { + * uint ac; + * for (uint i = 0; i < data.length; i++) { + * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i); + * } + * return uint16(ac + (ac >> 16)); + * } + * + * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations; + * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's + * large words work in our favour. + * + * The code below works by treating the input as a series of 256 bit words. It first masks out + * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`. + * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're + * effectively summing 16 different numbers with each EVM ADD opcode. + * + * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together. + * It does this using the same trick - mask out every other value, shift to align them, add them together. + * After the first addition on both accumulators, there's enough room to add the two accumulators together, + * and the remaining sums can be done just on ac1. + */ + unchecked { + require(data.length <= 8192, "Long keys not permitted"); + uint256 ac1; + uint256 ac2; + for (uint256 i = 0; i < data.length + 31; i += 32) { + uint256 word; + assembly { + word := mload(add(add(data, 32), i)) + } + if (i + 32 > data.length) { + uint256 unused = 256 - (data.length - i) * 8; + word = (word >> unused) << unused; + } + ac1 += + (word & + 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >> + 8; + ac2 += (word & + 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF); + } + ac1 = + (ac1 & + 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) + + ((ac1 & + 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >> + 16); + ac2 = + (ac2 & + 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) + + ((ac2 & + 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >> + 16); + ac1 = (ac1 << 8) + ac2; + ac1 = + (ac1 & + 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) + + ((ac1 & + 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >> + 32); + ac1 = + (ac1 & + 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) + + ((ac1 & + 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >> + 64); + ac1 = + (ac1 & + 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) + + (ac1 >> 128); + ac1 += (ac1 >> 16) & 0xFFFF; + return uint16(ac1); + } + } +} diff --git a/solidity/dns-contracts/contracts/dnssec-oracle/SHA1.sol b/solidity/dns-contracts/contracts/dnssec-oracle/SHA1.sol new file mode 100644 index 0000000..ed2129e --- /dev/null +++ b/solidity/dns-contracts/contracts/dnssec-oracle/SHA1.sol @@ -0,0 +1,241 @@ +pragma solidity >=0.8.4; + +library SHA1 { + event Debug(bytes32 x); + + function sha1(bytes memory data) internal pure returns (bytes20 ret) { + assembly { + // Get a safe scratch location + let scratch := mload(0x40) + + // Get the data length, and point data at the first byte + let len := mload(data) + data := add(data, 32) + + // Find the length after padding + let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64) + switch lt(sub(totallen, len), 9) + case 1 { + totallen := add(totallen, 64) + } + + let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0 + + function readword(ptr, off, count) -> result { + result := 0 + if lt(off, count) { + result := mload(add(ptr, off)) + count := sub(count, off) + if lt(count, 32) { + let mask := not(sub(exp(256, sub(32, count)), 1)) + result := and(result, mask) + } + } + } + + for { + let i := 0 + } lt(i, totallen) { + i := add(i, 64) + } { + mstore(scratch, readword(data, i, len)) + mstore(add(scratch, 32), readword(data, add(i, 32), len)) + + // If we loaded the last byte, store the terminator byte + switch lt(sub(len, i), 64) + case 1 { + mstore8(add(scratch, sub(len, i)), 0x80) + } + + // If this is the last block, store the length + switch eq(i, sub(totallen, 64)) + case 1 { + mstore( + add(scratch, 32), + or(mload(add(scratch, 32)), mul(len, 8)) + ) + } + + // Expand the 16 32-bit words into 80 + for { + let j := 64 + } lt(j, 128) { + j := add(j, 12) + } { + let temp := xor( + xor( + mload(add(scratch, sub(j, 12))), + mload(add(scratch, sub(j, 32))) + ), + xor( + mload(add(scratch, sub(j, 56))), + mload(add(scratch, sub(j, 64))) + ) + ) + temp := or( + and( + mul(temp, 2), + 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE + ), + and( + div(temp, 0x80000000), + 0x0000000100000001000000010000000100000001000000010000000100000001 + ) + ) + mstore(add(scratch, j), temp) + } + for { + let j := 128 + } lt(j, 320) { + j := add(j, 24) + } { + let temp := xor( + xor( + mload(add(scratch, sub(j, 24))), + mload(add(scratch, sub(j, 64))) + ), + xor( + mload(add(scratch, sub(j, 112))), + mload(add(scratch, sub(j, 128))) + ) + ) + temp := or( + and( + mul(temp, 4), + 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC + ), + and( + div(temp, 0x40000000), + 0x0000000300000003000000030000000300000003000000030000000300000003 + ) + ) + mstore(add(scratch, j), temp) + } + + let x := h + let f := 0 + let k := 0 + for { + let j := 0 + } lt(j, 80) { + j := add(j, 1) + } { + switch div(j, 20) + case 0 { + // f = d xor (b and (c xor d)) + f := xor( + div(x, 0x100000000000000000000), + div(x, 0x10000000000) + ) + f := and(div(x, 0x1000000000000000000000000000000), f) + f := xor(div(x, 0x10000000000), f) + k := 0x5A827999 + } + case 1 { + // f = b xor c xor d + f := xor( + div(x, 0x1000000000000000000000000000000), + div(x, 0x100000000000000000000) + ) + f := xor(div(x, 0x10000000000), f) + k := 0x6ED9EBA1 + } + case 2 { + // f = (b and c) or (d and (b or c)) + f := or( + div(x, 0x1000000000000000000000000000000), + div(x, 0x100000000000000000000) + ) + f := and(div(x, 0x10000000000), f) + f := or( + and( + div(x, 0x1000000000000000000000000000000), + div(x, 0x100000000000000000000) + ), + f + ) + k := 0x8F1BBCDC + } + case 3 { + // f = b xor c xor d + f := xor( + div(x, 0x1000000000000000000000000000000), + div(x, 0x100000000000000000000) + ) + f := xor(div(x, 0x10000000000), f) + k := 0xCA62C1D6 + } + // temp = (a leftrotate 5) + f + e + k + w[i] + let temp := and( + div( + x, + 0x80000000000000000000000000000000000000000000000 + ), + 0x1F + ) + temp := or( + and( + div(x, 0x800000000000000000000000000000000000000), + 0xFFFFFFE0 + ), + temp + ) + temp := add(f, temp) + temp := add(and(x, 0xFFFFFFFF), temp) + temp := add(k, temp) + temp := add( + div( + mload(add(scratch, mul(j, 4))), + 0x100000000000000000000000000000000000000000000000000000000 + ), + temp + ) + x := or( + div(x, 0x10000000000), + mul(temp, 0x10000000000000000000000000000000000000000) + ) + x := or( + and( + x, + 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF + ), + mul( + or( + and(div(x, 0x4000000000000), 0xC0000000), + and(div(x, 0x400000000000000000000), 0x3FFFFFFF) + ), + 0x100000000000000000000 + ) + ) + } + + h := and( + add(h, x), + 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF + ) + } + ret := mul( + or( + or( + or( + or( + and( + div(h, 0x100000000), + 0xFFFFFFFF00000000000000000000000000000000 + ), + and( + div(h, 0x1000000), + 0xFFFFFFFF000000000000000000000000 + ) + ), + and(div(h, 0x10000), 0xFFFFFFFF0000000000000000) + ), + and(div(h, 0x100), 0xFFFFFFFF00000000) + ), + and(h, 0xFFFFFFFF) + ), + 0x1000000000000000000000000 + ) + } + } +} diff --git a/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/Algorithm.sol b/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/Algorithm.sol new file mode 100644 index 0000000..75db76c --- /dev/null +++ b/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/Algorithm.sol @@ -0,0 +1,19 @@ +pragma solidity ^0.8.4; + +/** + * @dev An interface for contracts implementing a DNSSEC (signing) algorithm. + */ +interface Algorithm { + /** + * @dev Verifies a signature. + * @param key The public key to verify with. + * @param data The signed data to verify. + * @param signature The signature to verify. + * @return True iff the signature is valid. + */ + function verify( + bytes calldata key, + bytes calldata data, + bytes calldata signature + ) external view virtual returns (bool); +} diff --git a/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol b/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol new file mode 100644 index 0000000..97f1472 --- /dev/null +++ b/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol @@ -0,0 +1,17 @@ +pragma solidity ^0.8.4; + +import "./Algorithm.sol"; + +/** + * @dev Implements a dummy DNSSEC (signing) algorithm that approves all + * signatures, for testing. + */ +contract DummyAlgorithm is Algorithm { + function verify( + bytes calldata, + bytes calldata, + bytes calldata + ) external view override returns (bool) { + return true; + } +} diff --git a/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/EllipticCurve.sol b/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/EllipticCurve.sol new file mode 100644 index 0000000..6861264 --- /dev/null +++ b/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/EllipticCurve.sol @@ -0,0 +1,419 @@ +pragma solidity ^0.8.4; + +/** + * @title EllipticCurve + * + * @author Tilman Drerup; + * + * @notice Implements elliptic curve math; Parametrized for SECP256R1. + * + * Includes components of code by Andreas Olofsson, Alexander Vlasov + * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag + * (https://github.com/orbs-network/elliptic-curve-solidity) + * + * Source: https://github.com/tdrerup/elliptic-curve-solidity + * + * @dev NOTE: To disambiguate public keys when verifying signatures, activate + * condition 'rs[1] > lowSmax' in validateSignature(). + */ +contract EllipticCurve { + // Set parameters for curve. + uint256 constant a = + 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC; + uint256 constant b = + 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B; + uint256 constant gx = + 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296; + uint256 constant gy = + 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5; + uint256 constant p = + 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF; + uint256 constant n = + 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551; + + uint256 constant lowSmax = + 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0; + + /** + * @dev Inverse of u in the field of modulo m. + */ + function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) { + unchecked { + if (u == 0 || u == m || m == 0) return 0; + if (u > m) u = u % m; + + int256 t1; + int256 t2 = 1; + uint256 r1 = m; + uint256 r2 = u; + uint256 q; + + while (r2 != 0) { + q = r1 / r2; + (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2); + } + + if (t1 < 0) return (m - uint256(-t1)); + + return uint256(t1); + } + } + + /** + * @dev Transform affine coordinates into projective coordinates. + */ + function toProjectivePoint( + uint256 x0, + uint256 y0 + ) internal pure returns (uint256[3] memory P) { + P[2] = addmod(0, 1, p); + P[0] = mulmod(x0, P[2], p); + P[1] = mulmod(y0, P[2], p); + } + + /** + * @dev Add two points in affine coordinates and return projective point. + */ + function addAndReturnProjectivePoint( + uint256 x1, + uint256 y1, + uint256 x2, + uint256 y2 + ) internal pure returns (uint256[3] memory P) { + uint256 x; + uint256 y; + (x, y) = add(x1, y1, x2, y2); + P = toProjectivePoint(x, y); + } + + /** + * @dev Transform from projective to affine coordinates. + */ + function toAffinePoint( + uint256 x0, + uint256 y0, + uint256 z0 + ) internal pure returns (uint256 x1, uint256 y1) { + uint256 z0Inv; + z0Inv = inverseMod(z0, p); + x1 = mulmod(x0, z0Inv, p); + y1 = mulmod(y0, z0Inv, p); + } + + /** + * @dev Return the zero curve in projective coordinates. + */ + function zeroProj() + internal + pure + returns (uint256 x, uint256 y, uint256 z) + { + return (0, 1, 0); + } + + /** + * @dev Return the zero curve in affine coordinates. + */ + function zeroAffine() internal pure returns (uint256 x, uint256 y) { + return (0, 0); + } + + /** + * @dev Check if the curve is the zero curve. + */ + function isZeroCurve( + uint256 x0, + uint256 y0 + ) internal pure returns (bool isZero) { + if (x0 == 0 && y0 == 0) { + return true; + } + return false; + } + + /** + * @dev Check if a point in affine coordinates is on the curve. + */ + function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) { + if (0 == x || x == p || 0 == y || y == p) { + return false; + } + + uint256 LHS = mulmod(y, y, p); // y^2 + uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3 + + if (a != 0) { + RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x + } + if (b != 0) { + RHS = addmod(RHS, b, p); // x^3 + a*x + b + } + + return LHS == RHS; + } + + /** + * @dev Double an elliptic curve point in projective coordinates. See + * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates + */ + function twiceProj( + uint256 x0, + uint256 y0, + uint256 z0 + ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) { + uint256 t; + uint256 u; + uint256 v; + uint256 w; + + if (isZeroCurve(x0, y0)) { + return zeroProj(); + } + + u = mulmod(y0, z0, p); + u = mulmod(u, 2, p); + + v = mulmod(u, x0, p); + v = mulmod(v, y0, p); + v = mulmod(v, 2, p); + + x0 = mulmod(x0, x0, p); + t = mulmod(x0, 3, p); + + z0 = mulmod(z0, z0, p); + z0 = mulmod(z0, a, p); + t = addmod(t, z0, p); + + w = mulmod(t, t, p); + x0 = mulmod(2, v, p); + w = addmod(w, p - x0, p); + + x0 = addmod(v, p - w, p); + x0 = mulmod(t, x0, p); + y0 = mulmod(y0, u, p); + y0 = mulmod(y0, y0, p); + y0 = mulmod(2, y0, p); + y1 = addmod(x0, p - y0, p); + + x1 = mulmod(u, w, p); + + z1 = mulmod(u, u, p); + z1 = mulmod(z1, u, p); + } + + /** + * @dev Add two elliptic curve points in projective coordinates. See + * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates + */ + function addProj( + uint256 x0, + uint256 y0, + uint256 z0, + uint256 x1, + uint256 y1, + uint256 z1 + ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) { + uint256 t0; + uint256 t1; + uint256 u0; + uint256 u1; + + if (isZeroCurve(x0, y0)) { + return (x1, y1, z1); + } else if (isZeroCurve(x1, y1)) { + return (x0, y0, z0); + } + + t0 = mulmod(y0, z1, p); + t1 = mulmod(y1, z0, p); + + u0 = mulmod(x0, z1, p); + u1 = mulmod(x1, z0, p); + + if (u0 == u1) { + if (t0 == t1) { + return twiceProj(x0, y0, z0); + } else { + return zeroProj(); + } + } + + (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0); + } + + /** + * @dev Helper function that splits addProj to avoid too many local variables. + */ + function addProj2( + uint256 v, + uint256 u0, + uint256 u1, + uint256 t1, + uint256 t0 + ) private pure returns (uint256 x2, uint256 y2, uint256 z2) { + uint256 u; + uint256 u2; + uint256 u3; + uint256 w; + uint256 t; + + t = addmod(t0, p - t1, p); + u = addmod(u0, p - u1, p); + u2 = mulmod(u, u, p); + + w = mulmod(t, t, p); + w = mulmod(w, v, p); + u1 = addmod(u1, u0, p); + u1 = mulmod(u1, u2, p); + w = addmod(w, p - u1, p); + + x2 = mulmod(u, w, p); + + u3 = mulmod(u2, u, p); + u0 = mulmod(u0, u2, p); + u0 = addmod(u0, p - w, p); + t = mulmod(t, u0, p); + t0 = mulmod(t0, u3, p); + + y2 = addmod(t, p - t0, p); + + z2 = mulmod(u3, v, p); + } + + /** + * @dev Add two elliptic curve points in affine coordinates. + */ + function add( + uint256 x0, + uint256 y0, + uint256 x1, + uint256 y1 + ) internal pure returns (uint256, uint256) { + uint256 z0; + + (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1); + + return toAffinePoint(x0, y0, z0); + } + + /** + * @dev Double an elliptic curve point in affine coordinates. + */ + function twice( + uint256 x0, + uint256 y0 + ) internal pure returns (uint256, uint256) { + uint256 z0; + + (x0, y0, z0) = twiceProj(x0, y0, 1); + + return toAffinePoint(x0, y0, z0); + } + + /** + * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)). + */ + function multiplyPowerBase2( + uint256 x0, + uint256 y0, + uint256 exp + ) internal pure returns (uint256, uint256) { + uint256 base2X = x0; + uint256 base2Y = y0; + uint256 base2Z = 1; + + for (uint256 i = 0; i < exp; i++) { + (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z); + } + + return toAffinePoint(base2X, base2Y, base2Z); + } + + /** + * @dev Multiply an elliptic curve point by a scalar. + */ + function multiplyScalar( + uint256 x0, + uint256 y0, + uint256 scalar + ) internal pure returns (uint256 x1, uint256 y1) { + if (scalar == 0) { + return zeroAffine(); + } else if (scalar == 1) { + return (x0, y0); + } else if (scalar == 2) { + return twice(x0, y0); + } + + uint256 base2X = x0; + uint256 base2Y = y0; + uint256 base2Z = 1; + uint256 z1 = 1; + x1 = x0; + y1 = y0; + + if (scalar % 2 == 0) { + x1 = y1 = 0; + } + + scalar = scalar >> 1; + + while (scalar > 0) { + (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z); + + if (scalar % 2 == 1) { + (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1); + } + + scalar = scalar >> 1; + } + + return toAffinePoint(x1, y1, z1); + } + + /** + * @dev Multiply the curve's generator point by a scalar. + */ + function multipleGeneratorByScalar( + uint256 scalar + ) internal pure returns (uint256, uint256) { + return multiplyScalar(gx, gy, scalar); + } + + /** + * @dev Validate combination of message, signature, and public key. + */ + function validateSignature( + bytes32 message, + uint256[2] memory rs, + uint256[2] memory Q + ) internal pure returns (bool) { + // To disambiguate between public key solutions, include comment below. + if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) { + // || rs[1] > lowSmax) + return false; + } + if (!isOnCurve(Q[0], Q[1])) { + return false; + } + + uint256 x1; + uint256 x2; + uint256 y1; + uint256 y2; + + uint256 sInv = inverseMod(rs[1], n); + (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n)); + (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n)); + uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2); + + if (P[2] == 0) { + return false; + } + + uint256 Px = inverseMod(P[2], p); + Px = mulmod(P[0], mulmod(Px, Px, p), p); + + return Px % n == rs[0]; + } +} diff --git a/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol b/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol new file mode 100644 index 0000000..3b8e5b1 --- /dev/null +++ b/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol @@ -0,0 +1,34 @@ +pragma solidity ^0.8.4; + +library ModexpPrecompile { + /** + * @dev Computes (base ^ exponent) % modulus over big numbers. + */ + function modexp( + bytes memory base, + bytes memory exponent, + bytes memory modulus + ) internal view returns (bool success, bytes memory output) { + bytes memory input = abi.encodePacked( + uint256(base.length), + uint256(exponent.length), + uint256(modulus.length), + base, + exponent, + modulus + ); + + output = new bytes(modulus.length); + + assembly { + success := staticcall( + gas(), + 5, + add(input, 32), + mload(input), + add(output, 32), + mload(modulus) + ) + } + } +} diff --git a/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol b/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol new file mode 100644 index 0000000..ece3633 --- /dev/null +++ b/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol @@ -0,0 +1,43 @@ +pragma solidity ^0.8.4; + +import "./Algorithm.sol"; +import "./EllipticCurve.sol"; +import "../../utils/BytesUtils.sol"; + +contract P256SHA256Algorithm is Algorithm, EllipticCurve { + using BytesUtils for *; + + /** + * @dev Verifies a signature. + * @param key The public key to verify with. + * @param data The signed data to verify. + * @param signature The signature to verify. + * @return True iff the signature is valid. + */ + function verify( + bytes calldata key, + bytes calldata data, + bytes calldata signature + ) external view override returns (bool) { + return + validateSignature( + sha256(data), + parseSignature(signature), + parseKey(key) + ); + } + + function parseSignature( + bytes memory data + ) internal pure returns (uint256[2] memory) { + require(data.length == 64, "Invalid p256 signature length"); + return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))]; + } + + function parseKey( + bytes memory data + ) internal pure returns (uint256[2] memory) { + require(data.length == 68, "Invalid p256 key length"); + return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))]; + } +} diff --git a/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol b/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol new file mode 100644 index 0000000..7377074 --- /dev/null +++ b/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol @@ -0,0 +1,46 @@ +pragma solidity ^0.8.4; + +import "./Algorithm.sol"; +import "./RSAVerify.sol"; +import "../../utils/BytesUtils.sol"; +import "@ensdomains/solsha1/contracts/SHA1.sol"; + +/** + * @dev Implements the DNSSEC RSASHA1 algorithm. + */ +contract RSASHA1Algorithm is Algorithm { + using BytesUtils for *; + + function verify( + bytes calldata key, + bytes calldata data, + bytes calldata sig + ) external view override returns (bool) { + bytes memory exponent; + bytes memory modulus; + + uint16 exponentLen = uint16(key.readUint8(4)); + if (exponentLen != 0) { + exponent = key.substring(5, exponentLen); + modulus = key.substring( + exponentLen + 5, + key.length - exponentLen - 5 + ); + } else { + exponentLen = key.readUint16(5); + exponent = key.substring(7, exponentLen); + modulus = key.substring( + exponentLen + 7, + key.length - exponentLen - 7 + ); + } + + // Recover the message from the signature + bool ok; + bytes memory result; + (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig); + + // Verify it ends with the hash of our data + return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20); + } +} diff --git a/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol b/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol new file mode 100644 index 0000000..9d85c06 --- /dev/null +++ b/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol @@ -0,0 +1,45 @@ +pragma solidity ^0.8.4; + +import "./Algorithm.sol"; +import "./RSAVerify.sol"; +import "../../utils/BytesUtils.sol"; + +/** + * @dev Implements the DNSSEC RSASHA256 algorithm. + */ +contract RSASHA256Algorithm is Algorithm { + using BytesUtils for *; + + function verify( + bytes calldata key, + bytes calldata data, + bytes calldata sig + ) external view override returns (bool) { + bytes memory exponent; + bytes memory modulus; + + uint16 exponentLen = uint16(key.readUint8(4)); + if (exponentLen != 0) { + exponent = key.substring(5, exponentLen); + modulus = key.substring( + exponentLen + 5, + key.length - exponentLen - 5 + ); + } else { + exponentLen = key.readUint16(5); + exponent = key.substring(7, exponentLen); + modulus = key.substring( + exponentLen + 7, + key.length - exponentLen - 7 + ); + } + + // Recover the message from the signature + bool ok; + bytes memory result; + (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig); + + // Verify it ends with the hash of our data + return ok && sha256(data) == result.readBytes32(result.length - 32); + } +} diff --git a/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/RSAVerify.sol b/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/RSAVerify.sol new file mode 100644 index 0000000..9a1f056 --- /dev/null +++ b/solidity/dns-contracts/contracts/dnssec-oracle/algorithms/RSAVerify.sol @@ -0,0 +1,21 @@ +pragma solidity ^0.8.4; + +import "./ModexpPrecompile.sol"; +import "../../utils/BytesUtils.sol"; + +library RSAVerify { + /** + * @dev Recovers the input data from an RSA signature, returning the result in S. + * @param N The RSA public modulus. + * @param E The RSA public exponent. + * @param S The signature to recover. + * @return True if the recovery succeeded. + */ + function rsarecover( + bytes memory N, + bytes memory E, + bytes memory S + ) internal view returns (bool, bytes memory) { + return ModexpPrecompile.modexp(S, E, N); + } +} diff --git a/solidity/dns-contracts/contracts/dnssec-oracle/digests/Digest.sol b/solidity/dns-contracts/contracts/dnssec-oracle/digests/Digest.sol new file mode 100644 index 0000000..8409b3e --- /dev/null +++ b/solidity/dns-contracts/contracts/dnssec-oracle/digests/Digest.sol @@ -0,0 +1,17 @@ +pragma solidity ^0.8.4; + +/** + * @dev An interface for contracts implementing a DNSSEC digest. + */ +interface Digest { + /** + * @dev Verifies a cryptographic hash. + * @param data The data to hash. + * @param hash The hash to compare to. + * @return True iff the hashed data matches the provided hash value. + */ + function verify( + bytes calldata data, + bytes calldata hash + ) external pure virtual returns (bool); +} diff --git a/solidity/dns-contracts/contracts/dnssec-oracle/digests/DummyDigest.sol b/solidity/dns-contracts/contracts/dnssec-oracle/digests/DummyDigest.sol new file mode 100644 index 0000000..280d064 --- /dev/null +++ b/solidity/dns-contracts/contracts/dnssec-oracle/digests/DummyDigest.sol @@ -0,0 +1,15 @@ +pragma solidity ^0.8.4; + +import "./Digest.sol"; + +/** + * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing. + */ +contract DummyDigest is Digest { + function verify( + bytes calldata, + bytes calldata + ) external pure override returns (bool) { + return true; + } +} diff --git a/solidity/dns-contracts/contracts/dnssec-oracle/digests/SHA1Digest.sol b/solidity/dns-contracts/contracts/dnssec-oracle/digests/SHA1Digest.sol new file mode 100644 index 0000000..33f6f5b --- /dev/null +++ b/solidity/dns-contracts/contracts/dnssec-oracle/digests/SHA1Digest.sol @@ -0,0 +1,22 @@ +pragma solidity ^0.8.4; + +import "./Digest.sol"; +import "../../utils/BytesUtils.sol"; +import "@ensdomains/solsha1/contracts/SHA1.sol"; + +/** + * @dev Implements the DNSSEC SHA1 digest. + */ +contract SHA1Digest is Digest { + using BytesUtils for *; + + function verify( + bytes calldata data, + bytes calldata hash + ) external pure override returns (bool) { + require(hash.length == 20, "Invalid sha1 hash length"); + bytes32 expected = hash.readBytes20(0); + bytes20 computed = SHA1.sha1(data); + return expected == computed; + } +} diff --git a/solidity/dns-contracts/contracts/dnssec-oracle/digests/SHA256Digest.sol b/solidity/dns-contracts/contracts/dnssec-oracle/digests/SHA256Digest.sol new file mode 100644 index 0000000..0bcc081 --- /dev/null +++ b/solidity/dns-contracts/contracts/dnssec-oracle/digests/SHA256Digest.sol @@ -0,0 +1,19 @@ +pragma solidity ^0.8.4; + +import "./Digest.sol"; +import "../../utils/BytesUtils.sol"; + +/** + * @dev Implements the DNSSEC SHA256 digest. + */ +contract SHA256Digest is Digest { + using BytesUtils for *; + + function verify( + bytes calldata data, + bytes calldata hash + ) external pure override returns (bool) { + require(hash.length == 32, "Invalid sha256 hash length"); + return sha256(data) == hash.readBytes32(0); + } +} diff --git a/solidity/dns-contracts/contracts/ethregistrar/BaseRegistrarImplementation.sol b/solidity/dns-contracts/contracts/ethregistrar/BaseRegistrarImplementation.sol new file mode 100644 index 0000000..564aed0 --- /dev/null +++ b/solidity/dns-contracts/contracts/ethregistrar/BaseRegistrarImplementation.sol @@ -0,0 +1,204 @@ +pragma solidity >=0.8.4; + +import "../registry/ENS.sol"; +import "./IBaseRegistrar.sol"; +import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; + +contract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable { + // A map of expiry times + mapping(uint256 => uint256) expiries; + // The ENS registry + ENS public ens; + // The namehash of the TLD this registrar owns (eg, .eth) + bytes32 public baseNode; + // A map of addresses that are authorised to register and renew names. + mapping(address => bool) public controllers; + uint256 public constant GRACE_PERIOD = 30 days; + uint256 public constant LIFETIME = type(uint256).max; + bytes4 private constant INTERFACE_META_ID = + bytes4(keccak256("supportsInterface(bytes4)")); + bytes4 private constant ERC721_ID = + bytes4( + keccak256("balanceOf(address)") ^ + keccak256("ownerOf(uint256)") ^ + keccak256("approve(address,uint256)") ^ + keccak256("getApproved(uint256)") ^ + keccak256("setApprovalForAll(address,bool)") ^ + keccak256("isApprovedForAll(address,address)") ^ + keccak256("transferFrom(address,address,uint256)") ^ + keccak256("safeTransferFrom(address,address,uint256)") ^ + keccak256("safeTransferFrom(address,address,uint256,bytes)") + ); + bytes4 private constant RECLAIM_ID = + bytes4(keccak256("reclaim(uint256,address)")); + + /// v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId); + /// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187 + /// @dev Returns whether the given spender can transfer a given token ID + /// @param spender address of the spender to query + /// @param tokenId uint256 ID of the token to be transferred + /// @return bool whether the msg.sender is approved for the given token ID, + /// is an operator of the owner, or is the owner of the token + function _isApprovedOrOwner( + address spender, + uint256 tokenId + ) internal view override returns (bool) { + address owner = ownerOf(tokenId); + return (spender == owner || + getApproved(tokenId) == spender || + isApprovedForAll(owner, spender)); + } + + constructor(ENS _ens, bytes32 _baseNode) ERC721("", "") { + ens = _ens; + baseNode = _baseNode; + Ownable(msg.sender); + } + + modifier live() { + require(ens.owner(baseNode) == address(this)); + _; + } + + modifier onlyController() { + require(controllers[msg.sender]); + _; + } + + /// @dev Gets the owner of the specified token ID. Names become unowned + /// when their registration expires. + /// @param tokenId uint256 ID of the token to query the owner of + /// @return address currently marked as the owner of the given token ID + function ownerOf( + uint256 tokenId + ) public view override(IERC721, ERC721) returns (address) { + require(expiries[tokenId] > block.timestamp); + return super.ownerOf(tokenId); + } + + // Authorises a controller, who can register and renew domains. + function addController(address controller) external override onlyOwner { + controllers[controller] = true; + emit ControllerAdded(controller); + } + + // Revoke controller permission for an address. + function removeController(address controller) external override onlyOwner { + controllers[controller] = false; + emit ControllerRemoved(controller); + } + + // Set the resolver for the TLD this registrar manages. + function setResolver(address resolver) external override onlyOwner { + ens.setResolver(baseNode, resolver); + } + + // Returns the expiration timestamp of the specified id. + function nameExpires(uint256 id) external view override returns (uint256) { + return expiries[id]; + } + + // Returns true iff the specified name is available for registration. + function available(uint256 id) public view override returns (bool) { + // Not available if it's registered here or in its grace period. + return expiries[id] + GRACE_PERIOD < block.timestamp; + } + + /// @dev Register a name. + /// @param id The token ID (keccak256 of the label). + /// @param owner The address that should own the registration. + /// @param duration Duration in seconds for the registration. + function register( + uint256 id, + address owner, + uint256 duration + ) external override virtual returns (uint256) { + return _register(id, owner, duration, true); + } + + /// @dev Register a name, without modifying the registry. + /// @param id The token ID (keccak256 of the label). + /// @param owner The address that should own the registration. + /// @param duration Duration in seconds for the registration. + function registerOnly( + uint256 id, + address owner, + uint256 duration + ) external returns (uint256) { + return _register(id, owner, duration, false); + } + + function _register( + uint256 id, + address owner, + uint256 duration, + bool updateRegistry + ) internal live onlyController returns (uint256) { + require(available(id)); + require( + block.timestamp + duration + GRACE_PERIOD > + block.timestamp + GRACE_PERIOD + ); // Prevent future overflow + + + uint256 expiration; + + if (duration == 31536000000) { + // Lifetime registration + expiration = LIFETIME; + } else { + // Annual registration + expiration = block.timestamp + duration; + } + + expiries[id] = expiration; + if (_exists(id)) { + // Name was previously owned, and expired + _burn(id); + } + _mint(owner, id); + if (updateRegistry) { + ens.setSubnodeOwner(baseNode, bytes32(id), owner); + } + + emit NameRegistered(id, owner, expiration); + + return expiration; + } + + function renew( + uint256 id, + uint256 duration + ) external override virtual live onlyController returns (uint256) { + require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period + require(expiries[id] != LIFETIME, "Lifetime names cannot be renewed"); + require( + expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD + ); // Prevent future overflow + + expiries[id] += duration; + emit NameRenewed(id, expiries[id]); + return expiries[id]; + } + + /// @dev Reclaim ownership of a name in ENS, if you own it in the registrar. + function reclaim(uint256 id, address owner) external override live { + require(_isApprovedOrOwner(msg.sender, id)); + ens.setSubnodeOwner(baseNode, bytes32(id), owner); + } + + function supportsInterface( + bytes4 interfaceID + ) public view override(ERC721, IERC165) returns (bool) { + return + interfaceID == INTERFACE_META_ID || + interfaceID == ERC721_ID || + interfaceID == RECLAIM_ID; + } + + function _exists(uint256 tokenId) internal view override returns (bool) { + return super._exists(tokenId); + } + +} diff --git a/solidity/dns-contracts/contracts/ethregistrar/BulkRenewal.sol b/solidity/dns-contracts/contracts/ethregistrar/BulkRenewal.sol new file mode 100644 index 0000000..e960d7a --- /dev/null +++ b/solidity/dns-contracts/contracts/ethregistrar/BulkRenewal.sol @@ -0,0 +1,86 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +import "../registry/ENS.sol"; +import "./ETHRegistrarController.sol"; +import "./IETHRegistrarController.sol"; +import "../resolvers/Resolver.sol"; +import "./IBulkRenewal.sol"; +import "./IPriceOracle.sol"; + +import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; + +contract BulkRenewal is IBulkRenewal { + bytes32 private constant ETH_NAMEHASH = + 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae; + + ENS public immutable ens; + + constructor(ENS _ens) { + ens = _ens; + } + + function getController() internal view returns (ETHRegistrarController) { + Resolver r = Resolver(ens.resolver(ETH_NAMEHASH)); + return + ETHRegistrarController( + r.interfaceImplementer( + ETH_NAMEHASH, + type(IETHRegistrarController).interfaceId + ) + ); + } + + function rentPrice( + string[] calldata names, + uint256 duration, + bool lifetime + ) external view override returns (uint256 total) { + ETHRegistrarController controller = getController(); + uint256 length = names.length; + for (uint256 i = 0; i < length; ) { + IPriceOracle.Price memory price = controller.rentPrice( + names[i], + duration, + lifetime + ); + unchecked { + ++i; + total += (price.base + price.premium); + } + } + } + + function renewAll( + string[] calldata names, + uint256 duration, + bool lifetime + ) external payable override { + ETHRegistrarController controller = getController(); + uint256 length = names.length; + uint256 total; + for (uint256 i = 0; i < length; ) { + IPriceOracle.Price memory price = controller.rentPrice( + names[i], + duration, + lifetime + ); + uint256 totalPrice = price.base + price.premium; + controller.renew{value: totalPrice}(names[i], duration, lifetime); + unchecked { + ++i; + total += totalPrice; + } + } + // Send any excess funds back + payable(msg.sender).transfer(address(this).balance); + } + + function supportsInterface( + bytes4 interfaceID + ) external pure returns (bool) { + return + interfaceID == type(IERC165).interfaceId || + interfaceID == type(IBulkRenewal).interfaceId; + } +} diff --git a/solidity/dns-contracts/contracts/ethregistrar/DummyOracle.sol b/solidity/dns-contracts/contracts/ethregistrar/DummyOracle.sol new file mode 100644 index 0000000..1a9bdb4 --- /dev/null +++ b/solidity/dns-contracts/contracts/ethregistrar/DummyOracle.sol @@ -0,0 +1,17 @@ +pragma solidity >=0.8.4; + +contract DummyOracle { + int256 value; + + constructor(int256 _value) public { + set(_value); + } + + function set(int256 _value) public { + value = _value; + } + + function latestAnswer() public view returns (int256) { + return value; + } +} diff --git a/solidity/dns-contracts/contracts/ethregistrar/ETHRegistrarController.sol b/solidity/dns-contracts/contracts/ethregistrar/ETHRegistrarController.sol new file mode 100644 index 0000000..4d25dca --- /dev/null +++ b/solidity/dns-contracts/contracts/ethregistrar/ETHRegistrarController.sol @@ -0,0 +1,704 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +import {BaseRegistrarImplementation} from "./BaseRegistrarImplementation.sol"; +import {StringUtils} from "../utils/StringUtils.sol"; +import {Resolver} from "../resolvers/Resolver.sol"; +import {ENS} from "../registry/ENS.sol"; +import {ReverseRegistrar} from "../reverseRegistrar/ReverseRegistrar.sol"; +import {ReverseClaimer} from "../reverseRegistrar/ReverseClaimer.sol"; +import {IETHRegistrarController, IPriceOracle} from "./IETHRegistrarController.sol"; + +import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; +import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; +import {Address} from "@openzeppelin/contracts/utils/Address.sol"; +import {INameWrapper} from "../wrapper/INameWrapper.sol"; +import {ERC20Recoverable} from "../utils/ERC20Recoverable.sol"; +import {TokenPriceOracle} from "./TokenPriceOracle.sol"; +import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +using SafeERC20 for IERC20; +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {ReferralController} from "./ReferralController.sol"; + +error CommitmentTooNew(bytes32 commitment); +error CommitmentTooOld(bytes32 commitment); +error NameNotAvailable(string name); +error DurationTooShort(uint256 duration); +error ResolverRequiredWhenDataSupplied(); +error UnexpiredCommitmentExists(bytes32 commitment); +error InsufficientValue(); +error Unauthorised(bytes32 node); +error MaxCommitmentAgeTooLow(); +error MaxCommitmentAgeTooHigh(); + +/// @dev A registrar controller for registering and renewing names at fixed cost. +contract ETHRegistrarController is + Ownable, + IETHRegistrarController, + IERC165, + ERC20Recoverable, + ReverseClaimer +{ + using StringUtils for *; + using Address for address; + + uint256 public constant MIN_REGISTRATION_DURATION = 28 days; + bytes32 private constant ETH_NODE = + 0x4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454; + uint64 private constant MAX_EXPIRY = type(uint64).max; + BaseRegistrarImplementation immutable base; + TokenPriceOracle public immutable prices; + uint256 public immutable minCommitmentAge; + uint256 public immutable maxCommitmentAge; + ReverseRegistrar public immutable reverseRegistrar; + INameWrapper public immutable nameWrapper; + ReferralController public immutable referralController; + address public infoFi; + mapping(bytes32 => uint256) public commitments; + address public backendWallet; + uint256 public untrackedInfoFi; + mapping(address => bool) public verifiedTokens; + + event NameRegistered( + string name, + bytes32 indexed label, + address indexed owner, + uint256 baseCost, + uint256 premium, + uint256 expires + ); + event NameRenewed( + string name, + bytes32 indexed label, + uint256 cost, + uint256 expires + ); + + modifier onlyBackend() { + require(msg.sender == backendWallet, "Not Backend"); + _; + } + + constructor( + BaseRegistrarImplementation _base, + TokenPriceOracle _prices, + uint256 _minCommitmentAge, + uint256 _maxCommitmentAge, + ReverseRegistrar _reverseRegistrar, + INameWrapper _nameWrapper, + ENS _ens, + address _infoFi, + ReferralController _referralController + ) ReverseClaimer(_ens, msg.sender) { + if (_maxCommitmentAge <= _minCommitmentAge) { + revert MaxCommitmentAgeTooLow(); + } + + if (_maxCommitmentAge > block.timestamp) { + revert MaxCommitmentAgeTooHigh(); + } + + base = _base; + prices = _prices; + minCommitmentAge = _minCommitmentAge; + maxCommitmentAge = _maxCommitmentAge; + reverseRegistrar = _reverseRegistrar; + nameWrapper = _nameWrapper; + infoFi = _infoFi; + referralController = _referralController; + } + + function setBackend(address wallet) public onlyOwner { + backendWallet = wallet; + } + + function setToken(address tokenAddress) public onlyOwner { + verifiedTokens[tokenAddress] = true; + } + + function rentPrice( + string memory name, + uint256 duration, + bool lifetime + ) public view virtual override returns (IPriceOracle.Price memory price) { + require( + duration == 0 || duration >= MIN_REGISTRATION_DURATION, + "Invalid duration" + ); + bytes32 label = keccak256(bytes(name)); + price = prices.price( + name, + base.nameExpires(uint256(label)), + duration, + lifetime + ); + } + + function rentPriceToken( + string memory name, + uint256 duration, + string memory token, + bool lifetime + ) public view virtual override returns (IPriceOracle.Price memory price) { + require( + duration == 0 || duration >= MIN_REGISTRATION_DURATION, + "Invalid duration" + ); + bytes32 label = keccak256(bytes(name)); + price = prices.priceToken( + name, + base.nameExpires(uint256(label)), + duration, + token, + lifetime + ); + } + + function valid(string memory name) public pure returns (bool) { + return name.strlen() >= 2; + } + + function available(string memory name) public view override returns (bool) { + bytes32 label = keccak256(bytes(name)); + return valid(name) && base.available(uint256(label)); + } + + function makeCommitment( + string memory name, + address owner, + uint256 duration, + bytes32 secret, + address resolver, + bytes[] memory data, + bool reverseRecord, + uint16 ownerControlledFuses, + bool lifetime + ) public pure override returns (bytes32) { + bytes32 label = keccak256(bytes(name)); + if (data.length > 0 && resolver == address(0)) { + revert ResolverRequiredWhenDataSupplied(); + } + return + keccak256( + abi.encode( + label, + owner, + duration, + secret, + resolver, + data, + reverseRecord, + ownerControlledFuses, + lifetime + ) + ); + } + + function commit(bytes32 commitment) public override { + if (commitments[commitment] + maxCommitmentAge >= block.timestamp) { + revert UnexpiredCommitmentExists(commitment); + } + commitments[commitment] = block.timestamp; + } + + function register( + string memory name, + address owner, + uint256 duration, + bytes32 secret, + address resolver, + bytes[] memory data, + bool reverseRecord, + uint16 ownerControlledFuses, + bool lifetime, + string memory referree + ) public payable override { + IPriceOracle.Price memory price = rentPrice(name, duration, lifetime); + if (msg.value < price.base + price.premium) { + revert InsufficientValue(); + } + + _consumeCommitment( + name, + duration, + makeCommitment( + name, + owner, + duration, + secret, + resolver, + data, + reverseRecord, + ownerControlledFuses, + lifetime + ) + ); + + uint256 expires = nameWrapper.registerAndWrapETH2LD( + name, + owner, + duration, + resolver, + ownerControlledFuses + ); + + if (data.length > 0) { + _setRecords(resolver, keccak256(bytes(name)), data); + } + + if (reverseRecord) { + _setReverseRecord(name, resolver, msg.sender); + referralController.setReferree( + keccak256(bytes(name)), + owner, + expires + ); + } + + emit NameRegistered( + name, + keccak256(bytes(name)), + owner, + price.base, + price.premium, + expires + ); + if (msg.value > (price.base + price.premium)) { + payable(msg.sender).transfer( + msg.value - (price.base + price.premium) + ); + } + _referralPayout(price, referree, name, owner); + } + + function registerWithCard( + string memory name, + address owner, + uint256 duration, + bytes32 secret, + address resolver, + bytes[] memory data, + bool reverseRecord, + uint16 ownerControlledFuses, + bool lifetime, + string memory referree + ) public onlyBackend { + IPriceOracle.Price memory price = rentPrice(name, duration, lifetime); + + _consumeCommitment( + name, + duration, + makeCommitment( + name, + owner, + duration, + secret, + resolver, + data, + reverseRecord, + ownerControlledFuses, + lifetime + ) + ); + + uint256 expires = nameWrapper.registerAndWrapETH2LD( + name, + owner, + duration, + resolver, + ownerControlledFuses + ); + + if (data.length > 0) { + _setRecords(resolver, keccak256(bytes(name)), data); + } + + if (reverseRecord) { + _setReverseRecord(name, resolver, owner); + referralController.setReferree( + keccak256(bytes(name)), + owner, + duration + ); + } + + emit NameRegistered( + name, + keccak256(bytes(name)), + owner, + price.base, + price.premium, + expires + ); + address receiver = referralController.referrees( + keccak256(bytes(referree)) + ); + if (keccak256(bytes(referree)) != keccak256(bytes(""))) { + referralController.settlementRegisterWithCard( + referree, + name, + owner, + price.base + price.premium, + receiver + ); + } + untrackedInfoFi += (((price.base + price.premium) * 35) / 100); + } + + function resetInfoFi() external payable onlyOwner { + require(msg.value > 0, "Must send value to reset infoFi"); + (bool ok, ) = payable(infoFi).call{value: msg.value}(""); + require(ok, "Payment to infoFi failed"); + untrackedInfoFi = 0; + } + + function _tokenTransfer( + address tokenAddress, + IPriceOracle.Price memory price + ) internal { + + IERC20(tokenAddress).safeTransferFrom( + msg.sender, + address(this), + price.base + price.premium + ); + } + + function _internalRecordsCall( + string memory name, + bytes[] memory data, + address owner, + address resolver, + bool reverseRecord, + uint256 duration + ) internal { + if (data.length > 0) { + _setRecords(resolver, keccak256(bytes(name)), data); + } + + if (reverseRecord) { + _setReverseRecord(name, resolver, msg.sender); + referralController.setReferree( + keccak256(bytes(name)), + owner, + duration + ); + } + } + + function registerWithToken( + RegisterParams memory registerParams, + TokenParams memory tokenParams, + bool lifetime, + string memory referree + ) external override { + require( + verifiedTokens[tokenParams.tokenAddress] == true, + "Unnacepted Token Address" + ); + _consumeCommitment( + registerParams.name, + registerParams.duration, + makeCommitment( + registerParams.name, + registerParams.owner, + registerParams.duration, + registerParams.secret, + registerParams.resolver, + registerParams.data, + registerParams.reverseRecord, + registerParams.ownerControlledFuses, + lifetime + ) + ); + + IPriceOracle.Price memory price = rentPriceToken( + registerParams.name, + registerParams.duration, + tokenParams.token, + lifetime + ); + if ( + IERC20(tokenParams.tokenAddress).balanceOf(msg.sender) < + price.base + price.premium + ) { + revert InsufficientValue(); + } + + uint256 expires = nameWrapper.registerAndWrapETH2LD( + registerParams.name, + registerParams.owner, + registerParams.duration, + registerParams.resolver, + registerParams.ownerControlledFuses + ); + + _internalRecordsCall( + registerParams.name, + registerParams.data, + registerParams.owner, + registerParams.resolver, + registerParams.reverseRecord, + expires + ); + _tokenTransfer(tokenParams.tokenAddress, price); + + emit NameRegistered( + registerParams.name, + keccak256(bytes(registerParams.name)), + registerParams.owner, + price.base, + price.premium, + expires + ); + address receiver = referralController.referrees( + keccak256(bytes(referree)) + ); + + uint256 referrals = referralController.totalReferrals(receiver); + if (keccak256(bytes(referree)) != keccak256(bytes(""))) { + uint256 pct = referralController._rewardPct(referrals); + + IERC20(tokenParams.tokenAddress).safeTransfer( + address(referralController), + ((price.base + price.premium) * pct) / 100 + ); + referralController.settlementRegisterWithToken( + referree, + registerParams.name, + registerParams.owner, + price.base + price.premium, + tokenParams.tokenAddress + ); + } + IERC20(tokenParams.tokenAddress).safeTransfer( + infoFi, + ((price.base + price.premium) * 35) / 100 + ); + } + + function renewCard( + string calldata name, + uint256 duration, + bool lifetime + ) external onlyBackend { + bytes32 labelhash = keccak256(bytes(name)); + uint256 tokenId = uint256(labelhash); + IPriceOracle.Price memory price = rentPrice(name, duration, lifetime); + string memory referree = referralController.referredBy(labelhash); + + uint256 expires = nameWrapper.renew(tokenId, duration); + referralController.updateReferralCode(keccak256(bytes(name)), expires); + + emit NameRenewed(name, labelhash, price.base, expires); + if ( + referralController.referrees(keccak256(bytes(referree))) != + address(0) + ) { + address receiver = referralController.referrees( + keccak256(bytes(referree)) + ); + referralController.settlementCard( + price.base + price.premium, + receiver, + referree + ); + } + untrackedInfoFi += ((price.base + price.premium) * 35) / 100; + } + + function renew( + string calldata name, + uint256 duration, + bool lifetime + ) external payable { + bytes32 labelhash = keccak256(bytes(name)); + uint256 tokenId = uint256(labelhash); + IPriceOracle.Price memory price = rentPrice(name, duration, lifetime); + string memory referree = referralController.referredBy(labelhash); + if (msg.value < price.base) { + revert InsufficientValue(); + } + uint256 expires = nameWrapper.renew(tokenId, duration); + referralController.updateReferralCode(keccak256(bytes(name)), expires); + + if (msg.value > price.base) { + payable(msg.sender).transfer(msg.value - price.base); + } + emit NameRenewed(name, labelhash, msg.value, expires); + if ( + referralController.referrees(keccak256(bytes(referree))) != + address(0) + ) { + address receiver = referralController.referrees( + keccak256(bytes(referree)) + ); + referralController.settlement( + price.base + price.premium, + receiver, + referree + ); + } + (bool ok, ) = payable(infoFi).call{ + value: ((price.base + price.premium) * 35) / 100 + }(""); + require(ok, "Payment to infoFi failed"); + } + + function renewTokens( + string calldata name, + uint256 duration, + string memory token, + address tokenAddress, + bool lifetime + ) external override { + require( + verifiedTokens[tokenAddress] == true, + "Unnacepted Token Address" + ); + bytes32 labelhash = keccak256(bytes(name)); + uint256 tokenId = uint256(labelhash); + string memory referree = referralController.referredBy(labelhash); + IPriceOracle.Price memory price = rentPriceToken( + name, + duration, + token, + lifetime + ); + if ( + IERC20(tokenAddress).balanceOf(msg.sender) < + price.base + price.premium + ) { + revert InsufficientValue(); + } + IERC20(tokenAddress).safeTransferFrom( + msg.sender, + address(this), + price.base + price.premium + ); + uint256 expires = nameWrapper.renew(tokenId, duration); + referralController.updateReferralCode(keccak256(bytes(name)), expires); + + emit NameRenewed(name, labelhash, price.base + price.premium, expires); + + if ( + referralController.referrees(keccak256(bytes(referree))) != + address(0) + ) { + address receiver = referralController.referrees( + keccak256(bytes(referree)) + ); + uint256 referrals = referralController.totalReferrals(receiver); + uint256 pct = referralController._rewardPct(referrals); + + IERC20(tokenAddress).safeTransferFrom( + address(this), + address(referralController), + ((price.base + price.premium) * pct) / 100 + ); + referralController.settlementWithToken( + price.base + price.premium, + receiver, + tokenAddress, + referree + ); + } + IERC20(tokenAddress).safeTransferFrom( + address(this), + infoFi, + ((price.base + price.premium) * 35) / 100 + ); + } + + function withdraw() public { + payable(owner()).transfer(address(this).balance); + } + + function withdrawTokens(address tokenAddress) public { + IERC20(tokenAddress).safeTransfer( + owner(), + IERC20(tokenAddress).balanceOf(address(this)) + ); + } + + function _referralPayout( + IPriceOracle.Price memory price, + string memory referree, + string memory name, + address owner + ) internal { + address receiver = referralController.referrees( + keccak256(bytes(referree)) + ); + uint256 referrals = referralController.totalReferrals(receiver); + if (keccak256(bytes(referree)) != keccak256(bytes(""))) { + uint256 pct = referralController._rewardPct(referrals); + referralController.settlementRegister{ + value: (((price.base + price.premium) * pct) / 100) + }(referree, name, owner, price.base + price.premium, receiver); + } + (bool ok, ) = payable(infoFi).call{ + value: ((price.base + price.premium) * 35) / 100 + }(""); + require(ok, "Payment to infoFi failed"); + } + + function supportsInterface( + bytes4 interfaceID + ) external pure returns (bool) { + return + interfaceID == type(IERC165).interfaceId || + interfaceID == type(IETHRegistrarController).interfaceId; + } + + /* Internal functions */ + + function _consumeCommitment( + string memory name, + uint256 duration, + bytes32 commitment + ) internal { + // Require an old enough commitment. + if (commitments[commitment] + minCommitmentAge > block.timestamp) { + revert CommitmentTooNew(commitment); + } + + // If the commitment is too old, or the name is registered, stop + if (commitments[commitment] + maxCommitmentAge <= block.timestamp) { + revert CommitmentTooOld(commitment); + } + if (!available(name)) { + revert NameNotAvailable(name); + } + + delete (commitments[commitment]); + + if (duration != 0 && duration < MIN_REGISTRATION_DURATION) { + revert DurationTooShort(duration); + } + } + + function _setRecords( + address resolverAddress, + bytes32 label, + bytes[] memory data + ) internal { + // use hardcoded .eth namehash + bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label)); + Resolver resolver = Resolver(resolverAddress); + resolver.multicallWithNodeCheck(nodehash, data); + } + + function _setReverseRecord( + string memory name, + address resolver, + address owner + ) internal { + reverseRegistrar.setNameForAddr( + msg.sender, + owner, + resolver, + string.concat(name, ".creator") + ); + } +} diff --git a/solidity/dns-contracts/contracts/ethregistrar/ExponentialPremiumPriceOracle.sol b/solidity/dns-contracts/contracts/ethregistrar/ExponentialPremiumPriceOracle.sol new file mode 100644 index 0000000..2fc5f16 --- /dev/null +++ b/solidity/dns-contracts/contracts/ethregistrar/ExponentialPremiumPriceOracle.sol @@ -0,0 +1,138 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +import "./StablePriceOracle.sol"; + +contract ExponentialPremiumPriceOracle is StablePriceOracle { + uint256 constant GRACE_PERIOD = 90 days; + uint256 immutable startPremium; + uint256 immutable endValue; + + constructor( + AggregatorV3Interface _usdOracle, + uint256[] memory _rentPrices, + uint256 _startPremium, + uint256 totalDays + ) StablePriceOracle(_usdOracle, _rentPrices) { + startPremium = _startPremium; + endValue = _startPremium >> totalDays; + } + + uint256 constant PRECISION = 1e18; + uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18) + uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18) + uint256 constant bit3 = 999957694548431104; + uint256 constant bit4 = 999915390886613504; + uint256 constant bit5 = 999830788931929088; + uint256 constant bit6 = 999661606496243712; + uint256 constant bit7 = 999323327502650752; + uint256 constant bit8 = 998647112890970240; + uint256 constant bit9 = 997296056085470080; + uint256 constant bit10 = 994599423483633152; + uint256 constant bit11 = 989228013193975424; + uint256 constant bit12 = 978572062087700096; + uint256 constant bit13 = 957603280698573696; + uint256 constant bit14 = 917004043204671232; + uint256 constant bit15 = 840896415253714560; + uint256 constant bit16 = 707106781186547584; + + /** + * @dev Returns the pricing premium in internal base units. + */ + function _premium( + string memory, + uint256 expires, + uint256 + ) internal view override returns (uint256) { + expires = expires + GRACE_PERIOD; + if (expires > block.timestamp) { + return 0; + } + + uint256 elapsed = block.timestamp - expires; + uint256 premium = decayedPremium(startPremium, elapsed); + if (premium >= endValue) { + return premium - endValue; + } + return 0; + } + + /** + * @dev Returns the premium price at current time elapsed + * @param startPremium starting price + * @param elapsed time past since expiry + */ + function decayedPremium( + uint256 startPremium, + uint256 elapsed + ) public pure returns (uint256) { + uint256 daysPast = (elapsed * PRECISION) / 1 days; + uint256 intDays = daysPast / PRECISION; + uint256 premium = startPremium >> intDays; + uint256 partDay = (daysPast - intDays * PRECISION); + uint256 fraction = (partDay * (2 ** 16)) / PRECISION; + uint256 totalPremium = addFractionalPremium(fraction, premium); + return totalPremium; + } + + function addFractionalPremium( + uint256 fraction, + uint256 premium + ) internal pure returns (uint256) { + if (fraction & (1 << 0) != 0) { + premium = (premium * bit1) / PRECISION; + } + if (fraction & (1 << 1) != 0) { + premium = (premium * bit2) / PRECISION; + } + if (fraction & (1 << 2) != 0) { + premium = (premium * bit3) / PRECISION; + } + if (fraction & (1 << 3) != 0) { + premium = (premium * bit4) / PRECISION; + } + if (fraction & (1 << 4) != 0) { + premium = (premium * bit5) / PRECISION; + } + if (fraction & (1 << 5) != 0) { + premium = (premium * bit6) / PRECISION; + } + if (fraction & (1 << 6) != 0) { + premium = (premium * bit7) / PRECISION; + } + if (fraction & (1 << 7) != 0) { + premium = (premium * bit8) / PRECISION; + } + if (fraction & (1 << 8) != 0) { + premium = (premium * bit9) / PRECISION; + } + if (fraction & (1 << 9) != 0) { + premium = (premium * bit10) / PRECISION; + } + if (fraction & (1 << 10) != 0) { + premium = (premium * bit11) / PRECISION; + } + if (fraction & (1 << 11) != 0) { + premium = (premium * bit12) / PRECISION; + } + if (fraction & (1 << 12) != 0) { + premium = (premium * bit13) / PRECISION; + } + if (fraction & (1 << 13) != 0) { + premium = (premium * bit14) / PRECISION; + } + if (fraction & (1 << 14) != 0) { + premium = (premium * bit15) / PRECISION; + } + if (fraction & (1 << 15) != 0) { + premium = (premium * bit16) / PRECISION; + } + return premium; + } + + function supportsInterface( + bytes4 interfaceID + ) public view virtual override returns (bool) { + return super.supportsInterface(interfaceID); + } +} diff --git a/solidity/dns-contracts/contracts/ethregistrar/IBaseRegistrar.sol b/solidity/dns-contracts/contracts/ethregistrar/IBaseRegistrar.sol new file mode 100644 index 0000000..5f43e9c --- /dev/null +++ b/solidity/dns-contracts/contracts/ethregistrar/IBaseRegistrar.sol @@ -0,0 +1,50 @@ +import "../registry/ENS.sol"; +import "./IBaseRegistrar.sol"; +import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; + +interface IBaseRegistrar is IERC721 { + event ControllerAdded(address indexed controller); + event ControllerRemoved(address indexed controller); + event NameMigrated( + uint256 indexed id, + address indexed owner, + uint256 expires + ); + event NameRegistered( + uint256 indexed id, + address indexed owner, + uint256 expires + ); + event NameRenewed(uint256 indexed id, uint256 expires); + + // Authorises a controller, who can register and renew domains. + function addController(address controller) external; + + // Revoke controller permission for an address. + function removeController(address controller) external; + + // Set the resolver for the TLD this registrar manages. + function setResolver(address resolver) external; + + // Returns the expiration timestamp of the specified label hash. + function nameExpires(uint256 id) external view returns (uint256); + + // Returns true if the specified name is available for registration. + function available(uint256 id) external view returns (bool); + + /** + * @dev Register a name. + */ + function register( + uint256 id, + address owner, + uint256 duration + ) external returns (uint256); + + function renew(uint256 id, uint256 duration) external returns (uint256); + + /** + * @dev Reclaim ownership of a name in ENS, if you own it in the registrar. + */ + function reclaim(uint256 id, address owner) external; +} diff --git a/solidity/dns-contracts/contracts/ethregistrar/IBulkRenewal.sol b/solidity/dns-contracts/contracts/ethregistrar/IBulkRenewal.sol new file mode 100644 index 0000000..c1b218c --- /dev/null +++ b/solidity/dns-contracts/contracts/ethregistrar/IBulkRenewal.sol @@ -0,0 +1,13 @@ +interface IBulkRenewal { + function rentPrice( + string[] calldata names, + uint256 duration, + bool lifetime + ) external view returns (uint256 total); + + function renewAll( + string[] calldata names, + uint256 duration, + bool lifetime + ) external payable; +} diff --git a/solidity/dns-contracts/contracts/ethregistrar/IETHRegistrarController.sol b/solidity/dns-contracts/contracts/ethregistrar/IETHRegistrarController.sol new file mode 100644 index 0000000..dbc6219 --- /dev/null +++ b/solidity/dns-contracts/contracts/ethregistrar/IETHRegistrarController.sol @@ -0,0 +1,80 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +import "./IPriceOracle.sol"; + +interface IETHRegistrarController { + + struct TokenParams{ + string token; + address tokenAddress; + } + struct RegisterParams { + string name; + address owner; + uint256 duration; + bytes32 secret; + address resolver; + bytes[] data; + bool reverseRecord; + uint16 ownerControlledFuses; + } + function rentPrice( + string memory, + uint256, + bool + ) external view returns (IPriceOracle.Price memory); + + function rentPriceToken( + string memory name, + uint256 duration, + string memory token, + bool lifetime + ) external view returns (IPriceOracle.Price memory price); + + function available(string memory) external returns (bool); + + function makeCommitment( + string memory, + address, + uint256, + bytes32, + address, + bytes[] calldata, + bool, + uint16, + bool + ) external pure returns (bytes32); + + function commit(bytes32) external; + + function register( + string memory, + address, + uint256, + bytes32, + address, + bytes[] calldata, + bool, + uint16, + bool, + string memory + ) external payable; + + function registerWithToken( + RegisterParams memory registerParams, + TokenParams memory tokenParams, + bool lifetime, + string memory referree + ) external; + + function renew(string calldata, uint256, bool) external payable; + + function renewTokens( + string calldata name, + uint256 duration, + string memory token, + address tokenAddress, + bool lifetime + ) external; +} diff --git a/solidity/dns-contracts/contracts/ethregistrar/ILinearPremiumPriceOracle.sol b/solidity/dns-contracts/contracts/ethregistrar/ILinearPremiumPriceOracle.sol new file mode 100644 index 0000000..54f94a3 --- /dev/null +++ b/solidity/dns-contracts/contracts/ethregistrar/ILinearPremiumPriceOracle.sol @@ -0,0 +1,9 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +interface ILinearPremiumPriceOracle { + function timeUntilPremium( + uint256 expires, + uint256 amount + ) external view returns (uint256); +} diff --git a/solidity/dns-contracts/contracts/ethregistrar/IPriceOracle.sol b/solidity/dns-contracts/contracts/ethregistrar/IPriceOracle.sol new file mode 100644 index 0000000..852f8a6 --- /dev/null +++ b/solidity/dns-contracts/contracts/ethregistrar/IPriceOracle.sol @@ -0,0 +1,23 @@ +//SPDX-License-Identifier: MIT +pragma solidity >=0.8.17 <0.9.0; + +interface IPriceOracle { + struct Price { + uint256 base; + uint256 premium; + } + + /** + * @dev Returns the price to register or renew a name. + * @param name The name being registered or renewed. + * @param expires When the name presently expires (0 if this is a new registration). + * @param duration How long the name is being registered or extended for, in seconds. + * @return base premium tuple of base price + premium price + */ + function price( + string calldata name, + uint256 expires, + uint256 duration, + bool lifetime + ) external view returns (Price calldata); +} diff --git a/solidity/dns-contracts/contracts/ethregistrar/LinearPremiumPriceOracle.sol b/solidity/dns-contracts/contracts/ethregistrar/LinearPremiumPriceOracle.sol new file mode 100644 index 0000000..2284e01 --- /dev/null +++ b/solidity/dns-contracts/contracts/ethregistrar/LinearPremiumPriceOracle.sol @@ -0,0 +1,80 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +import "./SafeMath.sol"; +import "./StablePriceOracle.sol"; + +contract LinearPremiumPriceOracle is StablePriceOracle { + using SafeMath for *; + + uint256 immutable GRACE_PERIOD = 90 days; + + uint256 public immutable initialPremium; + uint256 public immutable premiumDecreaseRate; + + bytes4 private constant TIME_UNTIL_PREMIUM_ID = + bytes4(keccak256("timeUntilPremium(uint,uint")); + + constructor( + AggregatorV3Interface _usdOracle, + uint256[] memory _rentPrices, + uint256 _initialPremium, + uint256 _premiumDecreaseRate + ) public StablePriceOracle(_usdOracle, _rentPrices) { + initialPremium = _initialPremium; + premiumDecreaseRate = _premiumDecreaseRate; + } + + function _premium( + string memory name, + uint256 expires, + uint256 /*duration*/ + ) internal view override returns (uint256) { + expires = expires.add(GRACE_PERIOD); + if (expires > block.timestamp) { + // No premium for renewals + return 0; + } + + // Calculate the discount off the maximum premium + uint256 discount = premiumDecreaseRate.mul( + block.timestamp.sub(expires) + ); + + // If we've run out the premium period, return 0. + if (discount > initialPremium) { + return 0; + } + + return initialPremium - discount; + } + + /** + * @dev Returns the timestamp at which a name with the specified expiry date will have + * the specified re-registration price premium. + * @param expires The timestamp at which the name expires. + * @param amount The amount, in wei, the caller is willing to pay + * @return The timestamp at which the premium for this domain will be `amount`. + */ + function timeUntilPremium( + uint256 expires, + uint256 amount + ) external view returns (uint256) { + amount = weiToAttoUSD(amount); + require(amount <= initialPremium); + + expires = expires.add(GRACE_PERIOD); + + uint256 discount = initialPremium.sub(amount); + uint256 duration = discount.div(premiumDecreaseRate); + return expires.add(duration); + } + + function supportsInterface( + bytes4 interfaceID + ) public view virtual override returns (bool) { + return + (interfaceID == TIME_UNTIL_PREMIUM_ID) || + super.supportsInterface(interfaceID); + } +} diff --git a/solidity/dns-contracts/contracts/ethregistrar/ReferralController.sol b/solidity/dns-contracts/contracts/ethregistrar/ReferralController.sol new file mode 100644 index 0000000..02f2f6b --- /dev/null +++ b/solidity/dns-contracts/contracts/ethregistrar/ReferralController.sol @@ -0,0 +1,361 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; +import {IPriceOracle} from "./IETHRegistrarController.sol"; +import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +using SafeERC20 for IERC20; +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; + +contract ReferralController is Ownable { + // Mapping from referral code to referrer address + uint16 private constant TIER1 = 2; + uint16 private constant TIER2 = 15; + uint16 private constant TIER3 = 20; + uint256 private constant PCT1 = 15; + uint256 private constant PCT2 = 20; + uint256 private constant PCT3 = 25; + mapping(address => bool) public controllers; + mapping(bytes32 => uint256) public commitments; + mapping(bytes32 => address) public referrees; + mapping(bytes32 => uint256) public expirydates; + mapping(address => bytes32[]) public referrals; + mapping(bytes32 => string) public referredBy; + mapping(address => uint256) public nativeEarnings; + mapping(address => mapping(address => uint256)) public tokenEarnings; + + bytes32[] public referralCodes; + uint256 public untrackedEarnings; + uint256 public snapshotUntrackedEarnings; + mapping(address => uint256) public snapshotNativeEarnings; + mapping(address => mapping(address => uint256)) + public snapshotTokenEarnings; + uint256 public trackedNativeEarnings; + mapping(address => uint256) public trackedTokenEarnings; + + event ReferralCodeAdded(string indexed code, address indexed referrer); + event WithdrawalDispersed(address indexed); + modifier onlyControllerOrOwner() { + require( + controllers[msg.sender] || msg.sender == owner(), + "Not a controller or owner" + ); + _; + } + + function addController(address controller) external onlyOwner { + require(controller != address(0), "Invalid controller address"); + controllers[controller] = true; + } + + function settlementRegister( + string memory referree, + string memory name, + address owner, + uint256 amount, + address receiver + ) external payable onlyControllerOrOwner { + // If the referree is already registered, we can use it + + require( + receiver != address(0) && receiver != owner, + "Invalid receiver address" + ); + if (expirydates[keccak256(bytes(referree))] > block.timestamp) { + bool contains; + for (uint256 i = 0; i < referrals[receiver].length; i++) { + if (referrals[receiver][i] == keccak256(bytes(name))) { + contains = true; + break; + } + } + if (contains == false) { + referrals[receiver].push(keccak256(bytes(name))); + referredBy[keccak256(bytes(name))] = referree; + _applyNativeReward(receiver, amount, false); + } else { + _applyNativeReward(receiver, amount, false); + } + } else { + payable(Ownable.owner()).transfer(amount); + } + } + + function settlementRegisterWithCard( + string memory referree, + string memory name, + address owner, + uint256 amount, + address receiver + ) external onlyControllerOrOwner { + // If the referree is already registered, we can use it + require( + receiver != address(0) && receiver != owner, + "Invalid receiver address" + ); + if (expirydates[keccak256(bytes(referree))] > block.timestamp) { + bool contains; + for (uint256 i = 0; i < referrals[receiver].length; i++) { + if (referrals[receiver][i] == keccak256(bytes(name))) { + contains = true; + } + } + if (contains == false) { + referrals[receiver].push(keccak256(bytes(name))); + referredBy[keccak256(bytes(name))] = referree; + _applyNativeReward(receiver, amount, true); + } else { + _applyNativeReward(receiver, amount, true); + } + } + } + + /// @notice Only your controller or admin should be able to call this! + function setReferree( + bytes32 code, + address who, + uint256 duration + ) external onlyControllerOrOwner { + require(code != bytes32(0), "Invalid referral code"); + require(who != address(0), "Invalid referree address"); + require( + referrees[code] == address(0), + "Referral code already registered" + ); + address prevReferree = referrees[code]; + if (prevReferree != address(0)) { + referrals[prevReferree] = new bytes32[](0); + } + referrees[code] = who; + referralCodes.push(code); + expirydates[code] = duration; + } + + function settlementCard( + uint256 amount, + address receiver, + string memory referree + ) external onlyControllerOrOwner { + // If the referree is already registered, we can use it + if (expirydates[keccak256(bytes(referree))] > block.timestamp) { + require(receiver != address(0), "Invalid receiver address"); + _applyNativeReward(receiver, amount, true); + } + } + + function settlement( + uint256 amount, + address receiver, + string memory referree + ) external payable onlyControllerOrOwner { + // If the referree is already registered, we can use it + if (expirydates[keccak256(bytes(referree))] > block.timestamp) { + require(receiver != address(0), "Invalid receiver address"); + _applyNativeReward(receiver, amount, false); + } else { + payable(Ownable.owner()).transfer(amount); + } + } + + function settlementWithToken( + uint256 amount, + address receiver, + address tokenAddress, + string memory referree + ) external onlyControllerOrOwner { + // If the referree is already registered, we can use it + if (expirydates[keccak256(bytes(referree))] > block.timestamp) { + require(receiver != address(0), "Invalid receiver address"); + _applyTokenReward(receiver, tokenAddress, amount); + } else { + IERC20(tokenAddress).safeTransfer(Ownable.owner(), amount); + } + } + + function settlementRegisterWithToken( + string memory referree, + string memory name, + address owner, + uint256 amount, + address tokenAddress + ) external onlyControllerOrOwner { + // If the referree is already registered, we can use it + // Implement token settlement logic here if needed + if (expirydates[keccak256(bytes(referree))] > block.timestamp) { + address receiver = referrees[keccak256(bytes(referree))]; + if (receiver != address(0) && receiver != owner) { + bool contains; + for (uint256 i = 0; i < referrals[receiver].length; i++) { + if (referrals[receiver][i] == keccak256(bytes(name))) { + contains = true; + } + } + if (contains == false) { + referrals[receiver].push(keccak256(bytes(name))); + referredBy[keccak256(bytes(name))] = referree; + _applyTokenReward(receiver, tokenAddress, amount); + } else { + _applyTokenReward(receiver, tokenAddress, amount); + } + } + } else { + // If the referree is not registered, we can transfer the amount to the owner + IERC20(tokenAddress).safeTransfer(Ownable.owner(), amount); + } + } + + function withdrawAllNativeEarnings(uint256 batch, uint256 start) external onlyOwner { + for (uint256 i = start; i < batch; ) { + bytes32 code = referralCodes[batch]; + if (block.timestamp < expirydates[code]) { + address referrer = referrees[code]; + uint256 earnings = snapshotNativeEarnings[referrer]; + if (earnings > 0) { + (bool ok, ) = payable(referrer).call{value: earnings}(""); + require(ok, "Payment failed"); + nativeEarnings[referrer] = 0; + snapshotNativeEarnings[referrer] = 0; + } + } + unchecked { + ++i; + } + } + // Transfer any remaining balance to the owner + uint256 remainingBalance = address(this).balance; + if (remainingBalance > 0) { + payable(owner()).transfer(remainingBalance); + } + // Emit an event for the withdrawal + emit WithdrawalDispersed(msg.sender); + } + + function withdrawAllTokenEarnings( + address[] memory tokenAddresses, + uint256 batch, + uint256 start + ) external onlyOwner { + uint256 tokenLength = tokenAddresses.length; + for (uint256 j = 0; j < tokenLength; ) { + address tokenAddress = tokenAddresses[j]; + for (uint256 i = start; i < batch;) { + bytes32 code = referralCodes[i]; + if (block.timestamp < expirydates[code]) { + address referrer = referrees[code]; + uint256 earnings = snapshotTokenEarnings[referrer][ + tokenAddress + ]; + require(earnings > 0, "No earnings to withdraw"); + if (earnings > 0) { + IERC20(tokenAddress).safeTransfer(referrer, earnings); + snapshotTokenEarnings[referrer][tokenAddress] = 0; + tokenEarnings[referrer][tokenAddress] = 0; + } + } + unchecked { + ++i; + } + } + unchecked { + ++j; + } + } + } + + function totalReferrals(address referrer) external view returns (uint256) { + return referrals[referrer].length; + } + + function totalNativeEarnings( + address referrer + ) external view returns (uint256) { + return nativeEarnings[referrer]; + } + + function totalTokenEarnings( + address referrer, + address tokenAddress + ) external view returns (uint256) { + return tokenEarnings[referrer][tokenAddress]; + } + + function getCodes() external view returns (uint256) { + return referralCodes.length; + } + + function updateReferralCode( + bytes32 code, + uint256 newExpiry + ) external onlyControllerOrOwner { + require(expirydates[code] > 0, "Referral code does not exist"); + expirydates[code] = newExpiry; + } + + function _rewardPct(uint256 numReferrals) public pure returns (uint256) { + if (numReferrals >= TIER3) return PCT3; + if (numReferrals >= TIER2) return PCT2; + if (numReferrals >= TIER1) return PCT1; + return 0; // No reward for less than TIER1 referrals + } + + function _applyNativeReward( + address receiver, + uint256 amount, + bool isFiat + ) private { + nativeEarnings[receiver] += + (amount * _rewardPct(referrals[receiver].length)) / + 100; + if (isFiat) { + untrackedEarnings += + (amount * _rewardPct(referrals[receiver].length)) / + 100; + } + } + + function _applyTokenReward( + address receiver, + address token, + uint256 amount + ) private { + tokenEarnings[receiver][token] += + (amount * _rewardPct(referrals[receiver].length)) / + 100; + } + + function balance() public view returns (uint256) { + return address(this).balance; + } + + function tokenBalance(address tokenAddress) public view returns (uint256) { + return IERC20(tokenAddress).balanceOf(address(this)); + } + + function getUntracked() public view returns (uint256) { + return untrackedEarnings; + } + + function createSnapshot( + address[] memory tokenAddresses + ) external onlyOwner { + snapshotUntrackedEarnings = untrackedEarnings; + for (uint256 i = 0; i < referralCodes.length; i++) { + bytes32 code = referralCodes[i]; + address referrer = referrees[code]; + snapshotNativeEarnings[referrer] = nativeEarnings[referrer]; + } + for (uint256 j = 0; j < tokenAddresses.length; j++) { + address tokenAddress = tokenAddresses[j]; + for (uint256 i = 0; i < referralCodes.length; i++) { + bytes32 code = referralCodes[i]; + address referrer = referrees[code]; + snapshotTokenEarnings[referrer][tokenAddress] = tokenEarnings[ + referrer + ][tokenAddress]; + } + } + } + + function getSnapshotEarnings() public view returns (uint256) { + return (snapshotUntrackedEarnings); + } +} diff --git a/solidity/dns-contracts/contracts/ethregistrar/SafeMath.sol b/solidity/dns-contracts/contracts/ethregistrar/SafeMath.sol new file mode 100644 index 0000000..796e864 --- /dev/null +++ b/solidity/dns-contracts/contracts/ethregistrar/SafeMath.sol @@ -0,0 +1,66 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +/** + * @title SafeMath + * @dev Unsigned math operations with safety checks that revert on error + */ +library SafeMath { + /** + * @dev Multiplies two unsigned integers, reverts on overflow. + */ + function mul(uint256 a, uint256 b) internal pure returns (uint256) { + // Gas optimization: this is cheaper than requiring 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 + if (a == 0) { + return 0; + } + + uint256 c = a * b; + require(c / a == b); + + return c; + } + + /** + * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. + */ + function div(uint256 a, uint256 b) internal pure returns (uint256) { + // Solidity only automatically asserts when dividing by 0 + require(b > 0); + uint256 c = a / b; + // assert(a == b * c + a % b); // There is no case in which this doesn't hold + + return c; + } + + /** + * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). + */ + function sub(uint256 a, uint256 b) internal pure returns (uint256) { + require(b <= a); + uint256 c = a - b; + + return c; + } + + /** + * @dev Adds two unsigned integers, reverts on overflow. + */ + function add(uint256 a, uint256 b) internal pure returns (uint256) { + uint256 c = a + b; + require(c >= a); + + return c; + } + + /** + * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), + * reverts when dividing by zero. + */ + function mod(uint256 a, uint256 b) internal pure returns (uint256) { + require(b != 0); + return a % b; + } +} diff --git a/solidity/dns-contracts/contracts/ethregistrar/StablePriceOracle.sol b/solidity/dns-contracts/contracts/ethregistrar/StablePriceOracle.sol new file mode 100644 index 0000000..3b705cd --- /dev/null +++ b/solidity/dns-contracts/contracts/ethregistrar/StablePriceOracle.sol @@ -0,0 +1,113 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +import "./IPriceOracle.sol"; +import "../utils/StringUtils.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; +import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; +import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol"; + + + +// StablePriceOracle sets a price in USD, based on an oracle. +contract StablePriceOracle is IPriceOracle { + using StringUtils for *; + AggregatorV3Interface internal usdOracle; + + // Rent in base price units by length + uint256 public immutable price1Letter; + uint256 public immutable price2Letter; + uint256 public immutable price3Letter; + uint256 public immutable price4Letter; + uint256 public immutable price5Letter; + + // Oracle address + + event RentPriceChanged(uint256[] prices); + + constructor(AggregatorV3Interface _usdOracle, uint256[] memory _rentPrices) { + usdOracle = _usdOracle; + price1Letter = _rentPrices[0]; + price2Letter = _rentPrices[1]; + price3Letter = _rentPrices[2]; + price4Letter = _rentPrices[3]; + price5Letter = _rentPrices[4]; + } + + function price( + string calldata name, + uint256 expires, + uint256 duration, + bool lifetime + ) external view override returns (IPriceOracle.Price memory) { + uint256 len = name.strlen(); + uint256 basePrice; + + if (len >= 5 && lifetime) { + basePrice = price5Letter * 31536000 * 4; + } else if (len == 4 && lifetime) { + basePrice = price4Letter * 31536000 * 4; + } else if (len == 3 && lifetime) { + basePrice = price3Letter * 31536000 * 6; + } else if (len == 2 && lifetime) { + basePrice = price2Letter * 31536000 * 10; + } else if (len == 1 && lifetime) { + basePrice = price1Letter * 31536000; + } else if (len >= 5 && lifetime == false) { + basePrice = price5Letter * duration; + } else if (len == 4 && lifetime == false) { + basePrice = price4Letter * duration; + } else if (len == 3 && lifetime == false) { + basePrice = price3Letter * duration; + } else if (len == 2 && lifetime == false) { + basePrice = price2Letter * duration; + } else { + basePrice = price1Letter * duration; + } + return + IPriceOracle.Price({ + base: attoUSDToWei(basePrice), + premium: attoUSDToWei(_premium(name, expires, duration)) + }); + } + + /** + * @dev Returns the pricing premium in wei. + */ + function premium( + string calldata name, + uint256 expires, + uint256 duration + ) external view returns (uint256) { + return attoUSDToWei(_premium(name, expires, duration)); + } + + /** + * @dev Returns the pricing premium in internal base units. + */ + function _premium( + string memory name, + uint256 expires, + uint256 duration + ) internal view virtual returns (uint256) { + return 0; + } + + function attoUSDToWei(uint256 amount) internal view returns (uint256) { + (, int256 ethPrice,,,) = usdOracle.latestRoundData(); + return (amount * 1e8) / uint256(ethPrice); + } + + function weiToAttoUSD(uint256 amount) internal view returns (uint256) { + (, int256 ethPrice,,,) = usdOracle.latestRoundData(); + return (amount * uint256(ethPrice)) / 1e8; + } + + function supportsInterface( + bytes4 interfaceID + ) public view virtual returns (bool) { + return + interfaceID == type(IERC165).interfaceId || + interfaceID == type(IPriceOracle).interfaceId; + } +} diff --git a/solidity/dns-contracts/contracts/ethregistrar/StaticBulkRenewal.sol b/solidity/dns-contracts/contracts/ethregistrar/StaticBulkRenewal.sol new file mode 100644 index 0000000..c5db90a --- /dev/null +++ b/solidity/dns-contracts/contracts/ethregistrar/StaticBulkRenewal.sol @@ -0,0 +1,111 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +import "./ETHRegistrarController.sol"; +import "./IBulkRenewal.sol"; +import "./IPriceOracle.sol"; + +import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; + +contract StaticBulkRenewal is IBulkRenewal { + ETHRegistrarController controller; + + constructor(ETHRegistrarController _controller) { + controller = _controller; + } + + function rentPrice( + string[] calldata names, + uint256 duration, + bool lifetime + ) external view override returns (uint256 total) { + uint256 length = names.length; + for (uint256 i = 0; i < length; ) { + IPriceOracle.Price memory price = controller.rentPrice( + names[i], + duration, + lifetime + ); + unchecked { + ++i; + total += (price.base + price.premium); + } + } + } + function rentPriceToken( + string[] calldata names, + uint256 duration, + string memory token, + bool lifetime + ) external view returns (uint256 total) { + uint256 length = names.length; + for (uint256 i = 0; i < length; ) { + IPriceOracle.Price memory price = controller.rentPriceToken( + names[i], + duration, + token, + lifetime + ); + unchecked { + ++i; + total += (price.base + price.premium); + } + } + } + + function renewAll( + string[] calldata names, + uint256 duration, + bool lifetime + ) external payable override { + uint256 length = names.length; + uint256 total; + for (uint256 i = 0; i < length; ) { + IPriceOracle.Price memory price = controller.rentPrice( + names[i], + duration, + lifetime + ); + uint256 totalPrice = price.base + price.premium; + controller.renew{value: totalPrice}(names[i], duration, lifetime); + unchecked { + ++i; + total += totalPrice; + } + } + // Send any excess funds back + payable(msg.sender).transfer(address(this).balance); + } + function renewAllWithToken( + string[] calldata names, + uint256 duration, + string memory token, + address tokenAddress, + bool lifetime + ) external payable { + uint256 length = names.length; + uint256 total; + for (uint256 i = 0; i < length; ) { + IPriceOracle.Price memory price = controller.rentPriceToken( + names[i], + duration, + token, + lifetime + ); + uint256 totalPrice = price.base + price.premium; + controller.renewTokens(names[i], duration, token, tokenAddress, lifetime); + unchecked { + ++i; + total += totalPrice; + } + } + } + + function supportsInterface( + bytes4 interfaceID + ) external pure returns (bool) { + return + interfaceID == type(IERC165).interfaceId || + interfaceID == type(IBulkRenewal).interfaceId; + } +} diff --git a/solidity/dns-contracts/contracts/ethregistrar/TestResolver.sol b/solidity/dns-contracts/contracts/ethregistrar/TestResolver.sol new file mode 100644 index 0000000..e5f4d5d --- /dev/null +++ b/solidity/dns-contracts/contracts/ethregistrar/TestResolver.sol @@ -0,0 +1,22 @@ +pragma solidity >=0.8.4; + +/** + * @dev A test resolver implementation + */ +contract TestResolver { + mapping(bytes32 => address) addresses; + + constructor() public {} + + function supportsInterface(bytes4 interfaceID) public pure returns (bool) { + return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de; + } + + function addr(bytes32 node) public view returns (address) { + return addresses[node]; + } + + function setAddr(bytes32 node, address addr) public { + addresses[node] = addr; + } +} diff --git a/solidity/dns-contracts/contracts/ethregistrar/TokenPriceOracle.sol b/solidity/dns-contracts/contracts/ethregistrar/TokenPriceOracle.sol new file mode 100644 index 0000000..d46186e --- /dev/null +++ b/solidity/dns-contracts/contracts/ethregistrar/TokenPriceOracle.sol @@ -0,0 +1,87 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +import "./ExponentialPremiumPriceOracle.sol"; +import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol"; + +contract TokenPriceOracle is ExponentialPremiumPriceOracle { + AggregatorV3Interface internal cakeOracle; + AggregatorV3Interface internal usd1Oracle; + using StringUtils for *; + constructor( + AggregatorV3Interface _usdOracle, + AggregatorV3Interface _cakeOracle, + AggregatorV3Interface _usd1Oracle, + uint256[] memory _rentPrices, + uint256 _startPremium, + uint256 totalDays + )ExponentialPremiumPriceOracle(_usdOracle, _rentPrices, _startPremium, totalDays) { + usd1Oracle = _usd1Oracle; + cakeOracle = _cakeOracle; + } + + + function priceToken( + string calldata name, + uint256 expires, + uint256 duration, + string memory token, + bool lifetime + ) external view returns (IPriceOracle.Price memory) { + uint256 len = name.strlen(); + uint256 basePrice; + + if (len >= 5 && lifetime) { + basePrice = price5Letter * 31536000 * 4; + } else if (len == 4 && lifetime) { + basePrice = price4Letter * 31536000 * 4; + } else if (len == 3 && lifetime) { + basePrice = price3Letter * 31536000 * 6; + } else if (len == 2 && lifetime) { + basePrice = price2Letter * 31536000 * 10; + } else if (len == 1 && lifetime) { + basePrice = price1Letter * 31536000; + } else if (len >= 5 && lifetime == false) { + basePrice = price5Letter * duration; + } else if (len == 4 && lifetime == false) { + basePrice = price4Letter * duration; + } else if (len == 3 && lifetime == false) { + basePrice = price3Letter * duration; + } else if (len == 2 && lifetime == false) { + basePrice = price2Letter * duration; + } else { + basePrice = price1Letter * duration; + } + if(keccak256(bytes(token)) == keccak256(bytes("cake"))){ + return + IPriceOracle.Price({ + base: attoUSDToCake(basePrice), + premium: attoUSDToCake(_premium(name, expires, duration)) + }); + } else { + return + IPriceOracle.Price({ + base: attoUSDToUSD1(basePrice), + premium: attoUSDToCake(_premium(name, expires, duration)) + }); + } + + } + function attoUSDToCake(uint256 amount) internal view returns (uint256) { + (, int256 cakePrice,,,) = cakeOracle.latestRoundData(); + return (amount * 1e8) / uint256(cakePrice); + } + function attoUSDToUSD1(uint256 amount) internal view returns (uint256) { + (, int256 usd1Price,,,) = usd1Oracle.latestRoundData(); + return (amount * 1e8) / uint256(usd1Price); + } + function attoCakeToUSD(uint256 amount) internal view returns (uint256) { + (, int256 cakePrice,,,) = cakeOracle.latestRoundData(); + return (amount * uint256(cakePrice)) / 1e8; + } + function attoUSD1ToUSD(uint256 amount) internal view returns (uint256) { + (, int256 usd1Price,,,) = usd1Oracle.latestRoundData(); + return (amount * uint256(usd1Price)) / 1e8; + } + +} diff --git a/solidity/dns-contracts/contracts/ethregistrar/mocks/DummyProxyRegistry.sol b/solidity/dns-contracts/contracts/ethregistrar/mocks/DummyProxyRegistry.sol new file mode 100644 index 0000000..a824343 --- /dev/null +++ b/solidity/dns-contracts/contracts/ethregistrar/mocks/DummyProxyRegistry.sol @@ -0,0 +1,13 @@ +pragma solidity >=0.8.4; + +contract DummyProxyRegistry { + address target; + + constructor(address _target) public { + target = _target; + } + + function proxies(address a) external view returns (address) { + return target; + } +} diff --git a/solidity/dns-contracts/contracts/registry/ENS.sol b/solidity/dns-contracts/contracts/registry/ENS.sol new file mode 100644 index 0000000..6b5a21d --- /dev/null +++ b/solidity/dns-contracts/contracts/registry/ENS.sol @@ -0,0 +1,65 @@ +//SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +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); + + function setResolver(bytes32 node, address resolver) external; + + function setOwner(bytes32 node, address owner) external; + + function setTTL(bytes32 node, uint64 ttl) external; + + function setApprovalForAll(address operator, bool approved) external; + + function owner(bytes32 node) external view returns (address); + + function resolver(bytes32 node) external view returns (address); + + function ttl(bytes32 node) external view returns (uint64); + + function recordExists(bytes32 node) external view returns (bool); + + function isApprovedForAll( + address owner, + address operator + ) external view returns (bool); +} diff --git a/solidity/dns-contracts/contracts/registry/ENSRegistry.sol b/solidity/dns-contracts/contracts/registry/ENSRegistry.sol new file mode 100644 index 0000000..80c8584 --- /dev/null +++ b/solidity/dns-contracts/contracts/registry/ENSRegistry.sol @@ -0,0 +1,217 @@ +pragma solidity >=0.8.4; + +import "./ENS.sol"; + +/** + * The ENS registry contract. + */ +contract ENSRegistry is ENS { + struct Record { + address owner; + address resolver; + uint64 ttl; + } + + mapping(bytes32 => Record) records; + mapping(address => mapping(address => bool)) operators; + + // Permits modifications only by the owner of the specified node. + modifier authorised(bytes32 node) { + address owner = records[node].owner; + require(owner == msg.sender || operators[owner][msg.sender]); + _; + } + + /** + * @dev Constructs a new ENS registry. + */ + constructor() public { + records[0x0].owner = msg.sender; + } + + /** + * @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 virtual override { + setOwner(node, owner); + _setResolverAndTTL(node, resolver, ttl); + } + + /** + * @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 virtual override { + bytes32 subnode = setSubnodeOwner(node, label, owner); + _setResolverAndTTL(subnode, resolver, ttl); + } + + /** + * @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 virtual override authorised(node) { + _setOwner(node, owner); + emit Transfer(node, owner); + } + + /** + * @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 virtual override authorised(node) returns (bytes32) { + bytes32 subnode = keccak256(abi.encodePacked(node, label)); + _setOwner(subnode, owner); + emit NewOwner(node, label, owner); + return subnode; + } + + /** + * @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 virtual override authorised(node) { + emit NewResolver(node, resolver); + records[node].resolver = resolver; + } + + /** + * @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 virtual override authorised(node) { + emit NewTTL(node, ttl); + records[node].ttl = ttl; + } + + /** + * @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 virtual override { + operators[msg.sender][operator] = approved; + emit ApprovalForAll(msg.sender, operator, approved); + } + + /** + * @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 virtual override returns (address) { + address addr = records[node].owner; + if (addr == address(this)) { + return address(0x0); + } + + return addr; + } + + /** + * @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 virtual override returns (address) { + return records[node].resolver; + } + + /** + * @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 virtual override returns (uint64) { + return records[node].ttl; + } + + /** + * @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 virtual override returns (bool) { + return records[node].owner != address(0x0); + } + + /** + * @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 virtual override returns (bool) { + return operators[owner][operator]; + } + + function _setOwner(bytes32 node, address owner) internal virtual { + records[node].owner = owner; + } + + function _setResolverAndTTL( + bytes32 node, + address resolver, + uint64 ttl + ) internal { + if (resolver != records[node].resolver) { + records[node].resolver = resolver; + emit NewResolver(node, resolver); + } + + if (ttl != records[node].ttl) { + records[node].ttl = ttl; + emit NewTTL(node, ttl); + } + } +} diff --git a/solidity/dns-contracts/contracts/registry/ENSRegistryWithFallback.sol b/solidity/dns-contracts/contracts/registry/ENSRegistryWithFallback.sol new file mode 100644 index 0000000..bd67b10 --- /dev/null +++ b/solidity/dns-contracts/contracts/registry/ENSRegistryWithFallback.sol @@ -0,0 +1,66 @@ +pragma solidity >=0.8.4; + +import "./ENS.sol"; +import "./ENSRegistry.sol"; + +/** + * The ENS registry contract. + */ +contract ENSRegistryWithFallback is ENSRegistry { + ENS public old; + + /** + * @dev Constructs a new ENS registrar. + */ + constructor(ENS _old) public ENSRegistry() { + old = _old; + } + + /** + * @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 override returns (address) { + if (!recordExists(node)) { + return old.resolver(node); + } + + return super.resolver(node); + } + + /** + * @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 override returns (address) { + if (!recordExists(node)) { + return old.owner(node); + } + + return super.owner(node); + } + + /** + * @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 override returns (uint64) { + if (!recordExists(node)) { + return old.ttl(node); + } + + return super.ttl(node); + } + + function _setOwner(bytes32 node, address owner) internal override { + address addr = owner; + if (addr == address(0x0)) { + addr = address(this); + } + + super._setOwner(node, addr); + } +} diff --git a/solidity/dns-contracts/contracts/registry/FIFSRegistrar.sol b/solidity/dns-contracts/contracts/registry/FIFSRegistrar.sol new file mode 100644 index 0000000..52488ce --- /dev/null +++ b/solidity/dns-contracts/contracts/registry/FIFSRegistrar.sol @@ -0,0 +1,38 @@ +pragma solidity >=0.8.4; + +import "./ENS.sol"; + +/** + * A registrar that allocates subdomains to the first person to claim them. + */ +contract FIFSRegistrar { + ENS ens; + bytes32 rootNode; + + modifier only_owner(bytes32 label) { + address currentOwner = ens.owner( + keccak256(abi.encodePacked(rootNode, label)) + ); + require(currentOwner == address(0x0) || currentOwner == msg.sender); + _; + } + + /** + * Constructor. + * @param ensAddr The address of the ENS registry. + * @param node The node that this registrar administers. + */ + constructor(ENS ensAddr, bytes32 node) public { + ens = ensAddr; + rootNode = node; + } + + /** + * Register a name, or change the owner of an existing registration. + * @param label The hash of the label to register. + * @param owner The address of the new owner. + */ + function register(bytes32 label, address owner) public only_owner(label) { + ens.setSubnodeOwner(rootNode, label, owner); + } +} diff --git a/solidity/dns-contracts/contracts/registry/TestRegistrar.sol b/solidity/dns-contracts/contracts/registry/TestRegistrar.sol new file mode 100644 index 0000000..f65c762 --- /dev/null +++ b/solidity/dns-contracts/contracts/registry/TestRegistrar.sol @@ -0,0 +1,37 @@ +pragma solidity >=0.8.4; + +import "./ENS.sol"; + +/** + * A registrar that allocates subdomains to the first person to claim them, but + * expires registrations a fixed period after they're initially claimed. + */ +contract TestRegistrar { + uint256 constant registrationPeriod = 4 weeks; + + ENS public immutable ens; + bytes32 public immutable rootNode; + mapping(bytes32 => uint256) public expiryTimes; + + /** + * Constructor. + * @param ensAddr The address of the ENS registry. + * @param node The node that this registrar administers. + */ + constructor(ENS ensAddr, bytes32 node) { + ens = ensAddr; + rootNode = node; + } + + /** + * Register a name that's not currently registered + * @param label The hash of the label to register. + * @param owner The address of the new owner. + */ + function register(bytes32 label, address owner) public { + require(expiryTimes[label] < block.timestamp); + + expiryTimes[label] = block.timestamp + registrationPeriod; + ens.setSubnodeOwner(rootNode, label, owner); + } +} diff --git a/solidity/dns-contracts/contracts/resolvers/IMulticallable.sol b/solidity/dns-contracts/contracts/resolvers/IMulticallable.sol new file mode 100644 index 0000000..9f51fb4 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/IMulticallable.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +interface IMulticallable { + function multicall( + bytes[] calldata data + ) external returns (bytes[] memory results); + + function multicallWithNodeCheck( + bytes32, + bytes[] calldata data + ) external returns (bytes[] memory results); +} diff --git a/solidity/dns-contracts/contracts/resolvers/Multicallable.sol b/solidity/dns-contracts/contracts/resolvers/Multicallable.sol new file mode 100644 index 0000000..6200430 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/Multicallable.sol @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import "./IMulticallable.sol"; +import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; + +abstract contract Multicallable is IMulticallable, ERC165 { + function _multicall( + bytes32 nodehash, + bytes[] calldata data + ) internal returns (bytes[] memory results) { + results = new bytes[](data.length); + for (uint256 i = 0; i < data.length; i++) { + if (nodehash != bytes32(0)) { + bytes32 txNamehash = bytes32(data[i][4:36]); + require( + txNamehash == nodehash, + "multicall: All records must have a matching namehash" + ); + } + (bool success, bytes memory result) = address(this).delegatecall( + data[i] + ); + require(success); + results[i] = result; + } + return results; + } + + // This function provides an extra security check when called + // from priviledged contracts (such as EthRegistrarController) + // that can set records on behalf of the node owners + function multicallWithNodeCheck( + bytes32 nodehash, + bytes[] calldata data + ) external returns (bytes[] memory results) { + return _multicall(nodehash, data); + } + + function multicall( + bytes[] calldata data + ) public override returns (bytes[] memory results) { + return _multicall(bytes32(0), data); + } + + function supportsInterface( + bytes4 interfaceID + ) public view virtual override returns (bool) { + return + interfaceID == type(IMulticallable).interfaceId || + super.supportsInterface(interfaceID); + } +} diff --git a/solidity/dns-contracts/contracts/resolvers/OwnedResolver.sol b/solidity/dns-contracts/contracts/resolvers/OwnedResolver.sol new file mode 100644 index 0000000..429f3b5 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/OwnedResolver.sol @@ -0,0 +1,54 @@ +//SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; +import "@openzeppelin/contracts/access/Ownable.sol"; +import "./profiles/ABIResolver.sol"; +import "./profiles/AddrResolver.sol"; +import "./profiles/ContentHashResolver.sol"; +import "./profiles/DNSResolver.sol"; +import "./profiles/InterfaceResolver.sol"; +import "./profiles/NameResolver.sol"; +import "./profiles/PubkeyResolver.sol"; +import "./profiles/TextResolver.sol"; +import "./profiles/ExtendedResolver.sol"; + +/** + * A simple resolver anyone can use; only allows the owner of a node to set its + * address. + */ +contract OwnedResolver is + Ownable, + ABIResolver, + AddrResolver, + ContentHashResolver, + DNSResolver, + InterfaceResolver, + NameResolver, + PubkeyResolver, + TextResolver, + ExtendedResolver +{ + function isAuthorised(bytes32) internal view override returns (bool) { + return msg.sender == owner(); + } + + function supportsInterface( + bytes4 interfaceID + ) + public + view + virtual + override( + ABIResolver, + AddrResolver, + ContentHashResolver, + DNSResolver, + InterfaceResolver, + NameResolver, + PubkeyResolver, + TextResolver + ) + returns (bool) + { + return super.supportsInterface(interfaceID); + } +} diff --git a/solidity/dns-contracts/contracts/resolvers/PublicResolver.sol b/solidity/dns-contracts/contracts/resolvers/PublicResolver.sol new file mode 100644 index 0000000..91cb163 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/PublicResolver.sol @@ -0,0 +1,163 @@ +//SPDX-License-Identifier: MIT +pragma solidity >=0.8.17 <0.9.0; + +import "../registry/ENS.sol"; +import "./profiles/ABIResolver.sol"; +import "./profiles/AddrResolver.sol"; +import "./profiles/ContentHashResolver.sol"; +import "./profiles/DNSResolver.sol"; +import "./profiles/InterfaceResolver.sol"; +import "./profiles/NameResolver.sol"; +import "./profiles/PubkeyResolver.sol"; +import "./profiles/TextResolver.sol"; +import "./Multicallable.sol"; +import {ReverseClaimer} from "../reverseRegistrar/ReverseClaimer.sol"; +import {INameWrapper} from "../wrapper/INameWrapper.sol"; + +/** + * A simple resolver anyone can use; only allows the owner of a node to set its + * address. + */ +contract PublicResolver is + Multicallable, + ABIResolver, + AddrResolver, + ContentHashResolver, + DNSResolver, + InterfaceResolver, + NameResolver, + PubkeyResolver, + TextResolver, + ReverseClaimer +{ + ENS immutable ens; + INameWrapper immutable nameWrapper; + address immutable trustedETHController; + address immutable trustedReverseRegistrar; + + /** + * A mapping of operators. An address that is authorised for an address + * may make any changes to the name that the owner could, but may not update + * the set of authorisations. + * (owner, operator) => approved + */ + mapping(address => mapping(address => bool)) private _operatorApprovals; + + /** + * A mapping of delegates. A delegate that is authorised by an owner + * for a name may make changes to the name's resolver, but may not update + * the set of token approvals. + * (owner, name, delegate) => approved + */ + mapping(address => mapping(bytes32 => mapping(address => bool))) + private _tokenApprovals; + + // Logged when an operator is added or removed. + event ApprovalForAll( + address indexed owner, + address indexed operator, + bool approved + ); + + // Logged when a delegate is approved or an approval is revoked. + event Approved( + address owner, + bytes32 indexed node, + address indexed delegate, + bool indexed approved + ); + + constructor( + ENS _ens, + INameWrapper wrapperAddress, + address _trustedETHController, + address _trustedReverseRegistrar + ) ReverseClaimer(_ens, msg.sender) { + ens = _ens; + nameWrapper = wrapperAddress; + trustedETHController = _trustedETHController; + trustedReverseRegistrar = _trustedReverseRegistrar; + } + + /** + * @dev See {IERC1155-setApprovalForAll}. + */ + function setApprovalForAll(address operator, bool approved) external { + require( + msg.sender != operator, + "ERC1155: setting approval status for self" + ); + + _operatorApprovals[msg.sender][operator] = approved; + emit ApprovalForAll(msg.sender, operator, approved); + } + + /** + * @dev See {IERC1155-isApprovedForAll}. + */ + function isApprovedForAll( + address account, + address operator + ) public view returns (bool) { + return _operatorApprovals[account][operator]; + } + + /** + * @dev Approve a delegate to be able to updated records on a node. + */ + function approve(bytes32 node, address delegate, bool approved) external { + require(msg.sender != delegate, "Setting delegate status for self"); + + _tokenApprovals[msg.sender][node][delegate] = approved; + emit Approved(msg.sender, node, delegate, approved); + } + + /** + * @dev Check to see if the delegate has been approved by the owner for the node. + */ + function isApprovedFor( + address owner, + bytes32 node, + address delegate + ) public view returns (bool) { + return _tokenApprovals[owner][node][delegate]; + } + + function isAuthorised(bytes32 node) internal view override returns (bool) { + if ( + msg.sender == trustedETHController || + msg.sender == trustedReverseRegistrar + ) { + return true; + } + address owner = ens.owner(node); + if (owner == address(nameWrapper)) { + owner = nameWrapper.ownerOf(uint256(node)); + } + return + owner == msg.sender || + isApprovedForAll(owner, msg.sender) || + isApprovedFor(owner, node, msg.sender); + } + + function supportsInterface( + bytes4 interfaceID + ) + public + view + override( + Multicallable, + ABIResolver, + AddrResolver, + ContentHashResolver, + DNSResolver, + InterfaceResolver, + NameResolver, + PubkeyResolver, + TextResolver + ) + returns (bool) + { + return super.supportsInterface(interfaceID); + } +} diff --git a/solidity/dns-contracts/contracts/resolvers/Resolver.sol b/solidity/dns-contracts/contracts/resolvers/Resolver.sol new file mode 100644 index 0000000..1a2dc78 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/Resolver.sol @@ -0,0 +1,96 @@ +//SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; +import "./profiles/IABIResolver.sol"; +import "./profiles/IAddressResolver.sol"; +import "./profiles/IAddrResolver.sol"; +import "./profiles/IContentHashResolver.sol"; +import "./profiles/IDNSRecordResolver.sol"; +import "./profiles/IDNSZoneResolver.sol"; +import "./profiles/IInterfaceResolver.sol"; +import "./profiles/INameResolver.sol"; +import "./profiles/IPubkeyResolver.sol"; +import "./profiles/ITextResolver.sol"; +import "./profiles/IExtendedResolver.sol"; + +/** + * A generic resolver interface which includes all the functions including the ones deprecated + */ +interface Resolver is + IERC165, + IABIResolver, + IAddressResolver, + IAddrResolver, + IContentHashResolver, + IDNSRecordResolver, + IDNSZoneResolver, + IInterfaceResolver, + INameResolver, + IPubkeyResolver, + ITextResolver, + IExtendedResolver +{ + /* Deprecated events */ + event ContentChanged(bytes32 indexed node, bytes32 hash); + + function setApprovalForAll(address, bool) external; + + function approve(bytes32 node, address delegate, bool approved) external; + + function isApprovedForAll(address account, address operator) external; + + function isApprovedFor( + address owner, + bytes32 node, + address delegate + ) external; + + function setABI( + bytes32 node, + uint256 contentType, + bytes calldata data + ) external; + + function setAddr(bytes32 node, address addr) external; + + function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external; + + function setContenthash(bytes32 node, bytes calldata hash) external; + + function setDnsrr(bytes32 node, bytes calldata data) external; + + function setName(bytes32 node, string calldata _name) external; + + function setPubkey(bytes32 node, bytes32 x, bytes32 y) external; + + function setText( + bytes32 node, + string calldata key, + string calldata value + ) external; + + function setInterface( + bytes32 node, + bytes4 interfaceID, + address implementer + ) external; + + function multicall( + bytes[] calldata data + ) external returns (bytes[] memory results); + + function multicallWithNodeCheck( + bytes32 nodehash, + bytes[] calldata data + ) external returns (bytes[] memory results); + + /* Deprecated functions */ + function content(bytes32 node) external view returns (bytes32); + + function multihash(bytes32 node) external view returns (bytes memory); + + function setContent(bytes32 node, bytes32 hash) external; + + function setMultihash(bytes32 node, bytes calldata hash) external; +} diff --git a/solidity/dns-contracts/contracts/resolvers/ResolverBase.sol b/solidity/dns-contracts/contracts/resolvers/ResolverBase.sol new file mode 100644 index 0000000..3eb8ba7 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/ResolverBase.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; +import "./profiles/IVersionableResolver.sol"; + +abstract contract ResolverBase is ERC165, IVersionableResolver { + mapping(bytes32 => uint64) public recordVersions; + + function isAuthorised(bytes32 node) internal view virtual returns (bool); + + modifier authorised(bytes32 node) { + require(isAuthorised(node)); + _; + } + + /** + * Increments the record version 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. + */ + function clearRecords(bytes32 node) public virtual authorised(node) { + recordVersions[node]++; + emit VersionChanged(node, recordVersions[node]); + } + + function supportsInterface( + bytes4 interfaceID + ) public view virtual override returns (bool) { + return + interfaceID == type(IVersionableResolver).interfaceId || + super.supportsInterface(interfaceID); + } +} diff --git a/solidity/dns-contracts/contracts/resolvers/mocks/DummyNameWrapper.sol b/solidity/dns-contracts/contracts/resolvers/mocks/DummyNameWrapper.sol new file mode 100644 index 0000000..2274fd7 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/mocks/DummyNameWrapper.sol @@ -0,0 +1,10 @@ +pragma solidity ^0.8.4; + +/** + * @dev Implements a dummy NameWrapper which returns the caller's address + */ +contract DummyNameWrapper { + function ownerOf(uint256 /* id */) public view returns (address) { + return tx.origin; + } +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/ABIResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/ABIResolver.sol new file mode 100644 index 0000000..8af7332 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/ABIResolver.sol @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +import "./IABIResolver.sol"; +import "../ResolverBase.sol"; + +abstract contract ABIResolver is IABIResolver, ResolverBase { + mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis; + + /** + * 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 virtual authorised(node) { + // Content types must be powers of 2 + require(((contentType - 1) & contentType) == 0); + + versionable_abis[recordVersions[node]][node][contentType] = data; + emit ABIChanged(node, contentType); + } + + /** + * 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 virtual override returns (uint256, bytes memory) { + mapping(uint256 => bytes) storage abiset = versionable_abis[ + recordVersions[node] + ][node]; + + for ( + uint256 contentType = 1; + contentType <= contentTypes; + contentType <<= 1 + ) { + if ( + (contentType & contentTypes) != 0 && + abiset[contentType].length > 0 + ) { + return (contentType, abiset[contentType]); + } + } + + return (0, bytes("")); + } + + function supportsInterface( + bytes4 interfaceID + ) public view virtual override returns (bool) { + return + interfaceID == type(IABIResolver).interfaceId || + super.supportsInterface(interfaceID); + } +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/AddrResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/AddrResolver.sol new file mode 100644 index 0000000..b9df7ad --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/AddrResolver.sol @@ -0,0 +1,88 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +import "../ResolverBase.sol"; +import "./IAddrResolver.sol"; +import "./IAddressResolver.sol"; + +abstract contract AddrResolver is + IAddrResolver, + IAddressResolver, + ResolverBase +{ + uint256 private constant COIN_TYPE_ETH = 714; + + mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses; + + /** + * 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 virtual authorised(node) { + setAddr(node, COIN_TYPE_ETH, addressToBytes(a)); + } + + /** + * 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 virtual override returns (address payable) { + bytes memory a = addr(node, COIN_TYPE_ETH); + if (a.length == 0) { + return payable(0); + } + return bytesToAddress(a); + } + + function setAddr( + bytes32 node, + uint256 coinType, + bytes memory a + ) public virtual authorised(node) { + emit AddressChanged(node, coinType, a); + if (coinType == COIN_TYPE_ETH) { + emit AddrChanged(node, bytesToAddress(a)); + } + versionable_addresses[recordVersions[node]][node][coinType] = a; + } + + function addr( + bytes32 node, + uint256 coinType + ) public view virtual override returns (bytes memory) { + return versionable_addresses[recordVersions[node]][node][coinType]; + } + + function supportsInterface( + bytes4 interfaceID + ) public view virtual override returns (bool) { + return + interfaceID == type(IAddrResolver).interfaceId || + interfaceID == type(IAddressResolver).interfaceId || + super.supportsInterface(interfaceID); + } + + function bytesToAddress( + bytes memory b + ) internal pure returns (address payable a) { + require(b.length == 20); + assembly { + a := div(mload(add(b, 32)), exp(256, 12)) + } + } + + function addressToBytes(address a) internal pure returns (bytes memory b) { + b = new bytes(20); + assembly { + mstore(add(b, 32), mul(a, exp(256, 12))) + } + } +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/ContentHashResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/ContentHashResolver.sol new file mode 100644 index 0000000..57ade4b --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/ContentHashResolver.sol @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +import "../ResolverBase.sol"; +import "./IContentHashResolver.sol"; + +abstract contract ContentHashResolver is IContentHashResolver, ResolverBase { + mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes; + + /** + * 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 virtual authorised(node) { + versionable_hashes[recordVersions[node]][node] = hash; + emit ContenthashChanged(node, hash); + } + + /** + * 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 virtual override returns (bytes memory) { + return versionable_hashes[recordVersions[node]][node]; + } + + function supportsInterface( + bytes4 interfaceID + ) public view virtual override returns (bool) { + return + interfaceID == type(IContentHashResolver).interfaceId || + super.supportsInterface(interfaceID); + } +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/DNSResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/DNSResolver.sol new file mode 100644 index 0000000..e7b3dab --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/DNSResolver.sol @@ -0,0 +1,208 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +import "../ResolverBase.sol"; +import "../../dnssec-oracle/RRUtils.sol"; +import "./IDNSRecordResolver.sol"; +import "./IDNSZoneResolver.sol"; + +abstract contract DNSResolver is + IDNSRecordResolver, + IDNSZoneResolver, + ResolverBase +{ + using RRUtils for *; + using BytesUtils for bytes; + + // Zone hashes for the domains. + // A zone hash is an EIP-1577 content hash in binary format that should point to a + // resource containing a single zonefile. + // node => contenthash + mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes; + + // The records themselves. Stored as binary RRSETs + // node => version => name => resource => data + mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes)))) + private versionable_records; + + // Count of number of entries for a given name. Required for DNS resolvers + // when resolving wildcards. + // node => version => name => number of records + mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16))) + private versionable_nameEntriesCount; + + /** + * 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 virtual authorised(node) { + uint16 resource = 0; + uint256 offset = 0; + bytes memory name; + bytes memory value; + bytes32 nameHash; + uint64 version = recordVersions[node]; + // Iterate over the data to add the resource records + for ( + RRUtils.RRIterator memory iter = data.iterateRRs(0); + !iter.done(); + iter.next() + ) { + if (resource == 0) { + resource = iter.dnstype; + name = iter.name(); + nameHash = keccak256(abi.encodePacked(name)); + value = bytes(iter.rdata()); + } else { + bytes memory newName = iter.name(); + if (resource != iter.dnstype || !name.equals(newName)) { + setDNSRRSet( + node, + name, + resource, + data, + offset, + iter.offset - offset, + value.length == 0, + version + ); + resource = iter.dnstype; + offset = iter.offset; + name = newName; + nameHash = keccak256(name); + value = bytes(iter.rdata()); + } + } + } + if (name.length > 0) { + setDNSRRSet( + node, + name, + resource, + data, + offset, + data.length - offset, + value.length == 0, + version + ); + } + } + + /** + * 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 virtual override returns (bytes memory) { + return versionable_records[recordVersions[node]][node][name][resource]; + } + + /** + * 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 virtual returns (bool) { + return (versionable_nameEntriesCount[recordVersions[node]][node][ + name + ] != 0); + } + + /** + * setZonehash sets the hash for the zone. + * May only be called by the owner of that node in the ENS registry. + * @param node The node to update. + * @param hash The zonehash to set + */ + function setZonehash( + bytes32 node, + bytes calldata hash + ) external virtual authorised(node) { + uint64 currentRecordVersion = recordVersions[node]; + bytes memory oldhash = versionable_zonehashes[currentRecordVersion][ + node + ]; + versionable_zonehashes[currentRecordVersion][node] = hash; + emit DNSZonehashChanged(node, oldhash, hash); + } + + /** + * zonehash obtains the hash for the zone. + * @param node The ENS node to query. + * @return The associated contenthash. + */ + function zonehash( + bytes32 node + ) external view virtual override returns (bytes memory) { + return versionable_zonehashes[recordVersions[node]][node]; + } + + function supportsInterface( + bytes4 interfaceID + ) public view virtual override returns (bool) { + return + interfaceID == type(IDNSRecordResolver).interfaceId || + interfaceID == type(IDNSZoneResolver).interfaceId || + super.supportsInterface(interfaceID); + } + + function setDNSRRSet( + bytes32 node, + bytes memory name, + uint16 resource, + bytes memory data, + uint256 offset, + uint256 size, + bool deleteRecord, + uint64 version + ) private { + bytes32 nameHash = keccak256(name); + bytes memory rrData = data.substring(offset, size); + if (deleteRecord) { + if ( + versionable_records[version][node][nameHash][resource].length != + 0 + ) { + versionable_nameEntriesCount[version][node][nameHash]--; + } + delete (versionable_records[version][node][nameHash][resource]); + emit DNSRecordDeleted(node, name, resource); + } else { + if ( + versionable_records[version][node][nameHash][resource].length == + 0 + ) { + versionable_nameEntriesCount[version][node][nameHash]++; + } + versionable_records[version][node][nameHash][resource] = rrData; + emit DNSRecordChanged(node, name, resource, rrData); + } + } +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/ExtendedDNSResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/ExtendedDNSResolver.sol new file mode 100644 index 0000000..b864466 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/ExtendedDNSResolver.sol @@ -0,0 +1,289 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; +import "@openzeppelin/contracts/utils/Strings.sol"; +import "../../resolvers/profiles/IExtendedDNSResolver.sol"; +import "../../resolvers/profiles/IAddressResolver.sol"; +import "../../resolvers/profiles/IAddrResolver.sol"; +import "../../resolvers/profiles/ITextResolver.sol"; +import "../../utils/HexUtils.sol"; +import "../../utils/BytesUtils.sol"; + +/** + * @dev Resolves names on ENS by interpreting record data stored in a DNS TXT record. + * This resolver implements the IExtendedDNSResolver interface, meaning that when + * a DNS name specifies it as the resolver via a TXT record, this resolver's + * resolve() method is invoked, and is passed any additional information from that + * text record. This resolver implements a simple text parser allowing a variety + * of records to be specified in text, which will then be used to resolve the name + * in ENS. + * + * To use this, set a TXT record on your DNS name in the following format: + * ENS1
+ * + * For example: + * ENS1 2.dnsname.ens.eth a[60]=0x1234... + * + * The record data consists of a series of key=value pairs, separated by spaces. Keys + * may have an optional argument in square brackets, and values may be either unquoted + * - in which case they may not contain spaces - or single-quoted. Single quotes in + * a quoted value may be backslash-escaped. + * + * + * ┌────────┐ + * │ ┌───┐ │ + * ┌──────────────────────────────┴─┤" "│◄─┴────────────────────────────────────────┐ + * │ └───┘ │ + * │ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌────────────┐ ┌───┐ │ + * ^─┴─►│key├─┬─►│"["├───►│arg├───►│"]"├─┬─►│"="├─┬─►│"'"├───►│quoted_value├───►│"'"├─┼─$ + * └───┘ │ └───┘ └───┘ └───┘ │ └───┘ │ └───┘ └────────────┘ └───┘ │ + * └──────────────────────────┘ │ ┌──────────────┐ │ + * └─────────►│unquoted_value├─────────┘ + * └──────────────┘ + * + * Record types: + * - a[] - Specifies how an `addr()` request should be resolved for the specified + * `coinType`. Ethereum has `coinType` 60. The value must be 0x-prefixed hexadecimal, and will + * be returned unmodified; this means that non-EVM addresses will need to be translated + * into binary format and then encoded in hex. + * Examples: + * - a[60]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7 + * - a[0]=0x00149010587f8364b964fcaa70687216b53bd2cbd798 + * - a[e] - Specifies how an `addr()` request should be resolved for the specified + * `chainId`. The value must be 0x-prefixed hexadecimal. When encoding an address for an + * EVM-based cryptocurrency that uses a chainId instead of a coinType, this syntax *must* + * be used in place of the coin type - eg, Optimism is `a[e10]`, not `a[2147483658]`. + * A list of supported cryptocurrencies for both syntaxes can be found here: + * https://github.com/ensdomains/address-encoder/blob/master/docs/supported-cryptocurrencies.md + * Example: + * - a[e10]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7 + * - t[] - Specifies how a `text()` request should be resolved for the specified `key`. + * Examples: + * - t[com.twitter]=nicksdjohnson + * - t[url]='https://ens.domains/' + * - t[note]='I\'m great' + */ +contract ExtendedDNSResolver is IExtendedDNSResolver, IERC165 { + using HexUtils for *; + using BytesUtils for *; + using Strings for *; + + uint256 private constant COIN_TYPE_ETH = 60; + + error NotImplemented(); + error InvalidAddressFormat(bytes addr); + + function supportsInterface( + bytes4 interfaceId + ) external view virtual override returns (bool) { + return interfaceId == type(IExtendedDNSResolver).interfaceId; + } + + function resolve( + bytes calldata /* name */, + bytes calldata data, + bytes calldata context + ) external pure override returns (bytes memory) { + bytes4 selector = bytes4(data); + if (selector == IAddrResolver.addr.selector) { + return _resolveAddr(context); + } else if (selector == IAddressResolver.addr.selector) { + return _resolveAddress(data, context); + } else if (selector == ITextResolver.text.selector) { + return _resolveText(data, context); + } + revert NotImplemented(); + } + + function _resolveAddress( + bytes calldata data, + bytes calldata context + ) internal pure returns (bytes memory) { + (, uint256 coinType) = abi.decode(data[4:], (bytes32, uint256)); + bytes memory value; + // Per https://docs.ens.domains/ensip/11#specification + if (coinType & 0x80000000 != 0) { + value = _findValue( + context, + bytes.concat( + "a[e", + bytes((coinType & 0x7fffffff).toString()), + "]=" + ) + ); + } else { + value = _findValue( + context, + bytes.concat("a[", bytes(coinType.toString()), "]=") + ); + } + if (value.length == 0) { + return value; + } + (address record, bool valid) = value.hexToAddress(2, value.length); + if (!valid) revert InvalidAddressFormat(value); + return abi.encode(record); + } + + function _resolveAddr( + bytes calldata context + ) internal pure returns (bytes memory) { + bytes memory value = _findValue(context, "a[60]="); + if (value.length == 0) { + return value; + } + (address record, bool valid) = value.hexToAddress(2, value.length); + if (!valid) revert InvalidAddressFormat(value); + return abi.encode(record); + } + + function _resolveText( + bytes calldata data, + bytes calldata context + ) internal pure returns (bytes memory) { + (, string memory key) = abi.decode(data[4:], (bytes32, string)); + bytes memory value = _findValue( + context, + bytes.concat("t[", bytes(key), "]=") + ); + return abi.encode(value); + } + + uint256 constant STATE_START = 0; + uint256 constant STATE_IGNORED_KEY = 1; + uint256 constant STATE_IGNORED_KEY_ARG = 2; + uint256 constant STATE_VALUE = 3; + uint256 constant STATE_QUOTED_VALUE = 4; + uint256 constant STATE_UNQUOTED_VALUE = 5; + uint256 constant STATE_IGNORED_VALUE = 6; + uint256 constant STATE_IGNORED_QUOTED_VALUE = 7; + uint256 constant STATE_IGNORED_UNQUOTED_VALUE = 8; + + /** + * @dev Implements a DFA to parse the text record, looking for an entry + * matching `key`. + * @param data The text record to parse. + * @param key The exact key to search for. + * @return value The value if found, or an empty string if `key` does not exist. + */ + function _findValue( + bytes memory data, + bytes memory key + ) internal pure returns (bytes memory value) { + // Here we use a simple state machine to parse the text record. We + // process characters one at a time; each character can trigger a + // transition to a new state, or terminate the DFA and return a value. + // For states that expect to process a number of tokens, we use + // inner loops for efficiency reasons, to avoid the need to go + // through the outer loop and switch statement for every character. + uint256 state = STATE_START; + uint256 len = data.length; + for (uint256 i = 0; i < len; ) { + if (state == STATE_START) { + // Look for a matching key. + if (data.equals(i, key, 0, key.length)) { + i += key.length; + state = STATE_VALUE; + } else { + state = STATE_IGNORED_KEY; + } + } else if (state == STATE_IGNORED_KEY) { + for (; i < len; i++) { + if (data[i] == "=") { + state = STATE_IGNORED_VALUE; + i += 1; + break; + } else if (data[i] == "[") { + state = STATE_IGNORED_KEY_ARG; + i += 1; + break; + } + } + } else if (state == STATE_IGNORED_KEY_ARG) { + for (; i < len; i++) { + if (data[i] == "]") { + state = STATE_IGNORED_VALUE; + i += 1; + if (data[i] == "=") { + i += 1; + } + break; + } + } + } else if (state == STATE_VALUE) { + if (data[i] == "'") { + state = STATE_QUOTED_VALUE; + i += 1; + } else { + state = STATE_UNQUOTED_VALUE; + } + } else if (state == STATE_QUOTED_VALUE) { + uint256 start = i; + uint256 valueLen = 0; + bool escaped = false; + for (; i < len; i++) { + if (escaped) { + data[start + valueLen] = data[i]; + valueLen += 1; + escaped = false; + } else { + if (data[i] == "\\") { + escaped = true; + } else if (data[i] == "'") { + return data.substring(start, valueLen); + } else { + data[start + valueLen] = data[i]; + valueLen += 1; + } + } + } + } else if (state == STATE_UNQUOTED_VALUE) { + uint256 start = i; + for (; i < len; i++) { + if (data[i] == " ") { + return data.substring(start, i - start); + } + } + return data.substring(start, len - start); + } else if (state == STATE_IGNORED_VALUE) { + if (data[i] == "'") { + state = STATE_IGNORED_QUOTED_VALUE; + i += 1; + } else { + state = STATE_IGNORED_UNQUOTED_VALUE; + } + } else if (state == STATE_IGNORED_QUOTED_VALUE) { + bool escaped = false; + for (; i < len; i++) { + if (escaped) { + escaped = false; + } else { + if (data[i] == "\\") { + escaped = true; + } else if (data[i] == "'") { + i += 1; + while (data[i] == " ") { + i += 1; + } + state = STATE_START; + break; + } + } + } + } else { + assert(state == STATE_IGNORED_UNQUOTED_VALUE); + for (; i < len; i++) { + if (data[i] == " ") { + while (data[i] == " ") { + i += 1; + } + state = STATE_START; + break; + } + } + } + } + return ""; + } +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/ExtendedResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/ExtendedResolver.sol new file mode 100644 index 0000000..e3159c3 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/ExtendedResolver.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +contract ExtendedResolver { + function resolve( + bytes memory /* name */, + bytes memory data + ) external view returns (bytes memory) { + (bool success, bytes memory result) = address(this).staticcall(data); + if (success) { + return result; + } else { + // Revert with the reason provided by the call + assembly { + revert(add(result, 0x20), mload(result)) + } + } + } +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/IABIResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/IABIResolver.sol new file mode 100644 index 0000000..c8b4b26 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/IABIResolver.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +interface IABIResolver { + event ABIChanged(bytes32 indexed node, uint256 indexed contentType); + + /** + * 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); +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/IAddrResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/IAddrResolver.sol new file mode 100644 index 0000000..6ae6628 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/IAddrResolver.sol @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +/** + * Interface for the legacy (ETH-only) addr function. + */ +interface IAddrResolver { + event AddrChanged(bytes32 indexed node, address a); + + /** + * Returns the address associated with an ENS node. + * @param node The ENS node to query. + * @return The associated address. + */ + function addr(bytes32 node) external view returns (address payable); +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/IAddressResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/IAddressResolver.sol new file mode 100644 index 0000000..28e8386 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/IAddressResolver.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +/** + * Interface for the new (multicoin) addr function. + */ +interface IAddressResolver { + event AddressChanged( + bytes32 indexed node, + uint256 coinType, + bytes newAddress + ); + + function addr( + bytes32 node, + uint256 coinType + ) external view returns (bytes memory); +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/IContentHashResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/IContentHashResolver.sol new file mode 100644 index 0000000..64b50dd --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/IContentHashResolver.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +interface IContentHashResolver { + event ContenthashChanged(bytes32 indexed node, bytes hash); + + /** + * 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); +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/IDNSRecordResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/IDNSRecordResolver.sol new file mode 100644 index 0000000..ac849dc --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/IDNSRecordResolver.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +interface IDNSRecordResolver { + // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated. + event DNSRecordChanged( + bytes32 indexed node, + bytes name, + uint16 resource, + bytes record + ); + // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted. + event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource); + + /** + * 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); +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/IDNSZoneResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/IDNSZoneResolver.sol new file mode 100644 index 0000000..b4caad5 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/IDNSZoneResolver.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +interface IDNSZoneResolver { + // DNSZonehashChanged is emitted whenever a given node's zone hash is updated. + event DNSZonehashChanged( + bytes32 indexed node, + bytes lastzonehash, + bytes zonehash + ); + + /** + * zonehash obtains the hash for the zone. + * @param node The ENS node to query. + * @return The associated contenthash. + */ + function zonehash(bytes32 node) external view returns (bytes memory); +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/IExtendedDNSResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/IExtendedDNSResolver.sol new file mode 100644 index 0000000..f59a07e --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/IExtendedDNSResolver.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +interface IExtendedDNSResolver { + function resolve( + bytes memory name, + bytes memory data, + bytes memory context + ) external view returns (bytes memory); +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/IExtendedResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/IExtendedResolver.sol new file mode 100644 index 0000000..c5fbb21 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/IExtendedResolver.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +interface IExtendedResolver { + function resolve( + bytes memory name, + bytes memory data + ) external view returns (bytes memory); +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/IInterfaceResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/IInterfaceResolver.sol new file mode 100644 index 0000000..3e7fd95 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/IInterfaceResolver.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +interface IInterfaceResolver { + event InterfaceChanged( + bytes32 indexed node, + bytes4 indexed interfaceID, + address implementer + ); + + /** + * 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 ENS 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); +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/INameResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/INameResolver.sol new file mode 100644 index 0000000..639d328 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/INameResolver.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +interface INameResolver { + event NameChanged(bytes32 indexed node, string name); + + /** + * 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); +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/IPubkeyResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/IPubkeyResolver.sol new file mode 100644 index 0000000..db8cd53 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/IPubkeyResolver.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +interface IPubkeyResolver { + event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y); + + /** + * Returns the SECP256k1 public key associated with an ENS node. + * Defined in EIP 619. + * @param node The ENS 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); +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/ITextResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/ITextResolver.sol new file mode 100644 index 0000000..85a8097 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/ITextResolver.sol @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +interface ITextResolver { + event TextChanged( + bytes32 indexed node, + string indexed indexedKey, + string key, + string value + ); + + /** + * 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); +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/IVersionableResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/IVersionableResolver.sol new file mode 100644 index 0000000..01c074a --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/IVersionableResolver.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +interface IVersionableResolver { + event VersionChanged(bytes32 indexed node, uint64 newVersion); + + function recordVersions(bytes32 node) external view returns (uint64); +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/InterfaceResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/InterfaceResolver.sol new file mode 100644 index 0000000..da0aeac --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/InterfaceResolver.sol @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; +import "../ResolverBase.sol"; +import "./AddrResolver.sol"; +import "./IInterfaceResolver.sol"; + +abstract contract InterfaceResolver is IInterfaceResolver, AddrResolver { + mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces; + + /** + * 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 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 virtual authorised(node) { + versionable_interfaces[recordVersions[node]][node][ + interfaceID + ] = implementer; + emit InterfaceChanged(node, interfaceID, implementer); + } + + /** + * 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 ENS 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 virtual override returns (address) { + address implementer = versionable_interfaces[recordVersions[node]][ + node + ][interfaceID]; + if (implementer != address(0)) { + return implementer; + } + + address a = addr(node); + if (a == address(0)) { + return address(0); + } + + (bool success, bytes memory returnData) = a.staticcall( + abi.encodeWithSignature( + "supportsInterface(bytes4)", + type(IERC165).interfaceId + ) + ); + if (!success || returnData.length < 32 || returnData[31] == 0) { + // EIP 165 not supported by target + return address(0); + } + + (success, returnData) = a.staticcall( + abi.encodeWithSignature("supportsInterface(bytes4)", interfaceID) + ); + if (!success || returnData.length < 32 || returnData[31] == 0) { + // Specified interface not supported by target + return address(0); + } + + return a; + } + + function supportsInterface( + bytes4 interfaceID + ) public view virtual override returns (bool) { + return + interfaceID == type(IInterfaceResolver).interfaceId || + super.supportsInterface(interfaceID); + } +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/NameResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/NameResolver.sol new file mode 100644 index 0000000..a2452ea --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/NameResolver.sol @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +import "../ResolverBase.sol"; +import "./INameResolver.sol"; + +abstract contract NameResolver is INameResolver, ResolverBase { + mapping(uint64 => mapping(bytes32 => string)) versionable_names; + + /** + * 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. + */ + function setName( + bytes32 node, + string calldata newName + ) external virtual authorised(node) { + versionable_names[recordVersions[node]][node] = newName; + emit NameChanged(node, newName); + } + + /** + * 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 virtual override returns (string memory) { + return versionable_names[recordVersions[node]][node]; + } + + function supportsInterface( + bytes4 interfaceID + ) public view virtual override returns (bool) { + return + interfaceID == type(INameResolver).interfaceId || + super.supportsInterface(interfaceID); + } +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/PubkeyResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/PubkeyResolver.sol new file mode 100644 index 0000000..7d22d54 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/PubkeyResolver.sol @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +import "../ResolverBase.sol"; +import "./IPubkeyResolver.sol"; + +abstract contract PubkeyResolver is IPubkeyResolver, ResolverBase { + struct PublicKey { + bytes32 x; + bytes32 y; + } + + mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys; + + /** + * 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 virtual authorised(node) { + versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y); + emit PubkeyChanged(node, x, y); + } + + /** + * Returns the SECP256k1 public key associated with an ENS node. + * Defined in EIP 619. + * @param node The ENS 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 virtual override returns (bytes32 x, bytes32 y) { + uint64 currentRecordVersion = recordVersions[node]; + return ( + versionable_pubkeys[currentRecordVersion][node].x, + versionable_pubkeys[currentRecordVersion][node].y + ); + } + + function supportsInterface( + bytes4 interfaceID + ) public view virtual override returns (bool) { + return + interfaceID == type(IPubkeyResolver).interfaceId || + super.supportsInterface(interfaceID); + } +} diff --git a/solidity/dns-contracts/contracts/resolvers/profiles/TextResolver.sol b/solidity/dns-contracts/contracts/resolvers/profiles/TextResolver.sol new file mode 100644 index 0000000..7f4d906 --- /dev/null +++ b/solidity/dns-contracts/contracts/resolvers/profiles/TextResolver.sol @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +import "../ResolverBase.sol"; +import "./ITextResolver.sol"; + +abstract contract TextResolver is ITextResolver, ResolverBase { + mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts; + + /** + * 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 virtual authorised(node) { + versionable_texts[recordVersions[node]][node][key] = value; + emit TextChanged(node, key, key, value); + } + + /** + * 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 virtual override returns (string memory) { + return versionable_texts[recordVersions[node]][node][key]; + } + + function supportsInterface( + bytes4 interfaceID + ) public view virtual override returns (bool) { + return + interfaceID == type(ITextResolver).interfaceId || + super.supportsInterface(interfaceID); + } +} diff --git a/solidity/dns-contracts/contracts/reverseRegistrar/IReverseRegistrar.sol b/solidity/dns-contracts/contracts/reverseRegistrar/IReverseRegistrar.sol new file mode 100644 index 0000000..9b99dd5 --- /dev/null +++ b/solidity/dns-contracts/contracts/reverseRegistrar/IReverseRegistrar.sol @@ -0,0 +1,29 @@ +pragma solidity >=0.8.4; + +interface IReverseRegistrar { + function setDefaultResolver(address resolver) external; + + function claim(address owner) external returns (bytes32); + + function claimForAddr( + address addr, + address owner, + address resolver + ) external returns (bytes32); + + function claimWithResolver( + address owner, + address resolver + ) external returns (bytes32); + + function setName(string memory name) external returns (bytes32); + + function setNameForAddr( + address addr, + address owner, + address resolver, + string memory name + ) external returns (bytes32); + + function node(address addr) external pure returns (bytes32); +} diff --git a/solidity/dns-contracts/contracts/reverseRegistrar/ReverseClaimer.sol b/solidity/dns-contracts/contracts/reverseRegistrar/ReverseClaimer.sol new file mode 100644 index 0000000..6197bc5 --- /dev/null +++ b/solidity/dns-contracts/contracts/reverseRegistrar/ReverseClaimer.sol @@ -0,0 +1,17 @@ +//SPDX-License-Identifier: MIT +pragma solidity >=0.8.17 <0.9.0; + +import {ENS} from "../registry/ENS.sol"; +import {IReverseRegistrar} from "../reverseRegistrar/IReverseRegistrar.sol"; + +contract ReverseClaimer { + bytes32 constant ADDR_REVERSE_NODE = + 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2; + + constructor(ENS ens, address claimant) { + IReverseRegistrar reverseRegistrar = IReverseRegistrar( + ens.owner(ADDR_REVERSE_NODE) + ); + reverseRegistrar.claim(claimant); + } +} diff --git a/solidity/dns-contracts/contracts/reverseRegistrar/ReverseRegistrar.sol b/solidity/dns-contracts/contracts/reverseRegistrar/ReverseRegistrar.sol new file mode 100644 index 0000000..b065bf0 --- /dev/null +++ b/solidity/dns-contracts/contracts/reverseRegistrar/ReverseRegistrar.sol @@ -0,0 +1,190 @@ +pragma solidity >=0.8.4; + +import "../registry/ENS.sol"; +import "./IReverseRegistrar.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; +import "../root/Controllable.sol"; + +abstract contract NameResolver { + function setName(bytes32 node, string memory name) public virtual; +} + +bytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000; + +bytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2; + +// namehash('addr.reverse') + +contract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar { + ENS public immutable ens; + NameResolver public defaultResolver; + + event ReverseClaimed(address indexed addr, bytes32 indexed node); + event DefaultResolverChanged(NameResolver indexed resolver); + + /** + * @dev Constructor + * @param ensAddr The address of the ENS registry. + */ + constructor(ENS ensAddr) { + ens = ensAddr; + + // Assign ownership of the reverse record to our deployer + ReverseRegistrar oldRegistrar = ReverseRegistrar( + ensAddr.owner(ADDR_REVERSE_NODE) + ); + if (address(oldRegistrar) != address(0x0)) { + oldRegistrar.claim(msg.sender); + } + } + + modifier authorised(address addr) { + require( + addr == msg.sender || + controllers[msg.sender] || + ens.isApprovedForAll(addr, msg.sender) || + ownsContract(addr), + "ReverseRegistrar: Caller is not a controller or authorised by address or the address itself" + ); + _; + } + + function setDefaultResolver(address resolver) public override onlyOwner { + require( + address(resolver) != address(0), + "ReverseRegistrar: Resolver address must not be 0" + ); + defaultResolver = NameResolver(resolver); + emit DefaultResolverChanged(NameResolver(resolver)); + } + + /** + * @dev Transfers ownership of the reverse ENS record associated with the + * calling account. + * @param owner The address to set as the owner of the reverse record in ENS. + * @return The ENS node hash of the reverse record. + */ + function claim(address owner) public override returns (bytes32) { + return claimForAddr(msg.sender, owner, address(defaultResolver)); + } + + /** + * @dev Transfers ownership of the reverse ENS record associated with the + * calling account. + * @param addr The reverse record to set + * @param owner The address to set as the owner of the reverse record in ENS. + * @param resolver The resolver of the reverse node + * @return The ENS node hash of the reverse record. + */ + function claimForAddr( + address addr, + address owner, + address resolver + ) public override authorised(addr) returns (bytes32) { + bytes32 labelHash = sha3HexAddress(addr); + bytes32 reverseNode = keccak256( + abi.encodePacked(ADDR_REVERSE_NODE, labelHash) + ); + emit ReverseClaimed(addr, reverseNode); + ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0); + return reverseNode; + } + + /** + * @dev Transfers ownership of the reverse ENS record associated with the + * calling account. + * @param owner The address to set as the owner of the reverse record in ENS. + * @param resolver The address of the resolver to set; 0 to leave unchanged. + * @return The ENS node hash of the reverse record. + */ + function claimWithResolver( + address owner, + address resolver + ) public override returns (bytes32) { + return claimForAddr(msg.sender, owner, resolver); + } + + /** + * @dev Sets the `name()` record for the reverse ENS record associated with + * the calling account. First updates the resolver to the default reverse + * resolver if necessary. + * @param name The name to set for this address. + * @return The ENS node hash of the reverse record. + */ + function setName(string memory name) public override returns (bytes32) { + return + setNameForAddr( + msg.sender, + msg.sender, + address(defaultResolver), + name + ); + } + + /** + * @dev Sets the `name()` record for the reverse ENS record associated with + * the account provided. Updates the resolver to a designated resolver + * Only callable by controllers and authorised users + * @param addr The reverse record to set + * @param owner The owner of the reverse node + * @param resolver The resolver of the reverse node + * @param name The name to set for this address. + * @return The ENS node hash of the reverse record. + */ + function setNameForAddr( + address addr, + address owner, + address resolver, + string memory name + ) public override returns (bytes32) { + bytes32 node = claimForAddr(addr, owner, resolver); + NameResolver(resolver).setName(node, name); + return node; + } + + /** + * @dev Returns the node hash for a given account's reverse records. + * @param addr The address to hash + * @return The ENS node hash. + */ + function node(address addr) public pure override returns (bytes32) { + return + keccak256( + abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr)) + ); + } + + /** + * @dev An optimised function to compute the sha3 of the lower-case + * hexadecimal representation of an Ethereum address. + * @param addr The address to hash + * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the + * input address. + */ + function sha3HexAddress(address addr) private pure returns (bytes32 ret) { + assembly { + for { + let i := 40 + } gt(i, 0) { + + } { + i := sub(i, 1) + mstore8(i, byte(and(addr, 0xf), lookup)) + addr := div(addr, 0x10) + i := sub(i, 1) + mstore8(i, byte(and(addr, 0xf), lookup)) + addr := div(addr, 0x10) + } + + ret := keccak256(0, 40) + } + } + + function ownsContract(address addr) internal view returns (bool) { + try Ownable(addr).owner() returns (address owner) { + return owner == msg.sender; + } catch { + return false; + } + } +} diff --git a/solidity/dns-contracts/contracts/root/Controllable.sol b/solidity/dns-contracts/contracts/root/Controllable.sol new file mode 100644 index 0000000..ab079c6 --- /dev/null +++ b/solidity/dns-contracts/contracts/root/Controllable.sol @@ -0,0 +1,22 @@ +pragma solidity ^0.8.4; + +import "@openzeppelin/contracts/access/Ownable.sol"; + +contract Controllable is Ownable { + mapping(address => bool) public controllers; + + event ControllerChanged(address indexed controller, bool enabled); + + modifier onlyController() { + require( + controllers[msg.sender], + "Controllable: Caller is not a controller" + ); + _; + } + + function setController(address controller, bool enabled) public onlyOwner { + controllers[controller] = enabled; + emit ControllerChanged(controller, enabled); + } +} diff --git a/solidity/dns-contracts/contracts/root/Ownable.sol b/solidity/dns-contracts/contracts/root/Ownable.sol new file mode 100644 index 0000000..7517097 --- /dev/null +++ b/solidity/dns-contracts/contracts/root/Ownable.sol @@ -0,0 +1,28 @@ +pragma solidity ^0.8.4; + +contract Ownable { + address public owner; + + event OwnershipTransferred( + address indexed previousOwner, + address indexed newOwner + ); + + modifier onlyOwner() { + require(isOwner(msg.sender)); + _; + } + + constructor() public { + owner = msg.sender; + } + + function transferOwnership(address newOwner) public onlyOwner { + emit OwnershipTransferred(owner, newOwner); + owner = newOwner; + } + + function isOwner(address addr) public view returns (bool) { + return owner == addr; + } +} diff --git a/solidity/dns-contracts/contracts/root/Root.sol b/solidity/dns-contracts/contracts/root/Root.sol new file mode 100644 index 0000000..5863c70 --- /dev/null +++ b/solidity/dns-contracts/contracts/root/Root.sol @@ -0,0 +1,44 @@ +pragma solidity ^0.8.4; + +import "../registry/ENS.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; +import "./Controllable.sol"; + +contract Root is Ownable, Controllable { + bytes32 private constant ROOT_NODE = bytes32(0); + + bytes4 private constant INTERFACE_META_ID = + bytes4(keccak256("supportsInterface(bytes4)")); + + event TLDLocked(bytes32 indexed label); + + ENS public ens; + mapping(bytes32 => bool) public locked; + + constructor(ENS _ens) public { + ens = _ens; + } + + function setSubnodeOwner( + bytes32 label, + address owner + ) external onlyController { + require(!locked[label]); + ens.setSubnodeOwner(ROOT_NODE, label, owner); + } + + function setResolver(address resolver) external onlyOwner { + ens.setResolver(ROOT_NODE, resolver); + } + + function lock(bytes32 label) external onlyOwner { + emit TLDLocked(label); + locked[label] = true; + } + + function supportsInterface( + bytes4 interfaceID + ) external pure returns (bool) { + return interfaceID == INTERFACE_META_ID; + } +} diff --git a/solidity/dns-contracts/contracts/test/TestBytesUtils.sol b/solidity/dns-contracts/contracts/test/TestBytesUtils.sol new file mode 100644 index 0000000..cd8900f --- /dev/null +++ b/solidity/dns-contracts/contracts/test/TestBytesUtils.sol @@ -0,0 +1,246 @@ +pragma solidity ^0.8.4; + +import "../../contracts/dnssec-oracle/RRUtils.sol"; +import "../../contracts/utils/BytesUtils.sol"; + +contract TestBytesUtils { + using BytesUtils for *; + + function testKeccak() public pure { + require( + "".keccak(0, 0) == + bytes32( + 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 + ), + "Incorrect hash of empty string" + ); + require( + "foo".keccak(0, 3) == + bytes32( + 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d + ), + "Incorrect hash of 'foo'" + ); + require( + "foo".keccak(0, 0) == + bytes32( + 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 + ), + "Incorrect hash of empty string" + ); + } + + function testEquals() public pure { + require("hello".equals("hello") == true, "String equality"); + require("hello".equals("goodbye") == false, "String inequality"); + require( + "hello".equals(1, "ello") == true, + "Substring to string equality" + ); + require( + "hello".equals(1, "jello", 1, 4) == true, + "Substring to substring equality" + ); + require( + "zhello".equals(1, "abchello", 3) == true, + "Compare different value with multiple length" + ); + require( + "0x0102030000".equals(0, "0x010203") == false, + "Compare with offset and trailing bytes" + ); + } + + function testComparePartial() public pure { + require( + "xax".compare(1, 1, "xxbxx", 2, 1) < 0 == true, + "Compare same length" + ); + require( + "xax".compare(1, 1, "xxabxx", 2, 2) < 0 == true, + "Compare different length" + ); + require( + "xax".compare(1, 1, "xxaxx", 2, 1) == 0 == true, + "Compare same with different offset" + ); + require( + "01234567890123450123456789012345ab".compare( + 0, + 33, + "01234567890123450123456789012345aa", + 0, + 33 + ) == + 0 == + true, + "Compare different long strings same length smaller partial length which must be equal" + ); + require( + "01234567890123450123456789012345ab".compare( + 0, + 33, + "01234567890123450123456789012345aa", + 0, + 34 + ) < + 0 == + true, + "Compare long strings same length different partial length" + ); + require( + "0123456789012345012345678901234a".compare( + 0, + 32, + "0123456789012345012345678901234b", + 0, + 32 + ) < + 0 == + true, + "Compare strings exactly 32 characters long" + ); + } + + function testCompare() public pure { + require("a".compare("a") == 0 == true, "Compare equal"); + require( + "a".compare("b") < 0 == true, + "Compare different value with same length" + ); + require( + "b".compare("a") > 0 == true, + "Compare different value with same length" + ); + require( + "aa".compare("ab") < 0 == true, + "Compare different value with multiple length" + ); + require( + "a".compare("aa") < 0 == true, + "Compare different value with different length" + ); + require( + "aa".compare("a") > 0 == true, + "Compare different value with different length" + ); + bytes memory longChar = "1234567890123456789012345678901234"; + require( + longChar.compare(longChar) == 0 == true, + "Compares more than 32 bytes char" + ); + bytes memory otherLongChar = "2234567890123456789012345678901234"; + require( + longChar.compare(otherLongChar) < 0 == true, + "Compare long char with difference at start" + ); + } + + function testSubstring() public pure { + require( + keccak256(bytes("hello".substring(0, 0))) == keccak256(bytes("")), + "Copy 0 bytes" + ); + require( + keccak256(bytes("hello".substring(0, 4))) == + keccak256(bytes("hell")), + "Copy substring" + ); + require( + keccak256(bytes("hello".substring(1, 4))) == + keccak256(bytes("ello")), + "Copy substring" + ); + require( + keccak256(bytes("hello".substring(0, 5))) == + keccak256(bytes("hello")), + "Copy whole string" + ); + } + + function testReadUint8() public pure { + require(uint("a".readUint8(0)) == 0x61, "a == 0x61"); + require(uint("ba".readUint8(1)) == 0x61, "a == 0x61"); + } + + function testReadUint16() public pure { + require(uint("abc".readUint16(1)) == 0x6263, "Read uint 16"); + } + + function testReadUint32() public pure { + require(uint("abcde".readUint32(1)) == 0x62636465, "Read uint 32"); + } + + function testReadBytes20() public pure { + require( + bytes32("abcdefghijklmnopqrstuv".readBytes20(1)) == + bytes32( + 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000 + ), + "readBytes20" + ); + } + + function testReadBytes32() public pure { + require( + "0123456789abcdef0123456789abcdef".readBytes32(0) == + bytes32( + 0x3031323334353637383961626364656630313233343536373839616263646566 + ), + "readBytes32" + ); + } + + function testBase32HexDecodeWord() public pure { + require( + "C4".base32HexDecodeWord(0, 2) == bytes32(bytes1("a")), + "Decode 'a'" + ); + require( + "C5GG".base32HexDecodeWord(0, 4) == bytes32(bytes2("aa")), + "Decode 'aa'" + ); + require( + "C5GM2".base32HexDecodeWord(0, 5) == bytes32(bytes3("aaa")), + "Decode 'aaa'" + ); + require( + "C5GM2O8".base32HexDecodeWord(0, 7) == bytes32(bytes4("aaaa")), + "Decode 'aaaa'" + ); + require( + "C5GM2OB1".base32HexDecodeWord(0, 8) == bytes32(bytes5("aaaaa")), + "Decode 'aaaaa'" + ); + require( + "c5gm2Ob1".base32HexDecodeWord(0, 8) == bytes32(bytes5("aaaaa")), + "Decode 'aaaaa' lowercase" + ); + require( + "C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8".base32HexDecodeWord( + 0, + 42 + ) == bytes32(bytes26("abcdefghijklmnopqrstuvwxyz")), + "Decode alphabet" + ); + require( + "c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8".base32HexDecodeWord( + 0, + 42 + ) == bytes32(bytes26("abcdefghijklmnopqrstuvwxyz")), + "Decode alphabet lowercase" + ); + require( + "C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG" + .base32HexDecodeWord(0, 52) == + bytes32("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + "Decode 32*'a'" + ); + require( + " bst4hlje7r0o8c8p4o8q582lm0ejmiqt\x07matoken\x03xyz\x00" + .base32HexDecodeWord(1, 32) == + bytes32(hex"5f3a48d66e3ec18431192611a2a055b01d3b4b5d"), + "Decode real bytes32hex" + ); + } +} diff --git a/solidity/dns-contracts/contracts/test/TestRRUtils.sol b/solidity/dns-contracts/contracts/test/TestRRUtils.sol new file mode 100644 index 0000000..726e815 --- /dev/null +++ b/solidity/dns-contracts/contracts/test/TestRRUtils.sol @@ -0,0 +1,165 @@ +pragma solidity ^0.8.4; + +import "../../contracts/dnssec-oracle/RRUtils.sol"; +import "../../contracts/utils/BytesUtils.sol"; + +contract TestRRUtils { + using BytesUtils for *; + using RRUtils for *; + + uint16 constant DNSTYPE_A = 1; + uint16 constant DNSTYPE_CNAME = 5; + uint16 constant DNSTYPE_MX = 15; + uint16 constant DNSTYPE_TEXT = 16; + uint16 constant DNSTYPE_RRSIG = 46; + uint16 constant DNSTYPE_TYPE1234 = 1234; + + function testNameLength() public pure { + require(hex"00".nameLength(0) == 1, "nameLength('.') == 1"); + require(hex"0361626300".nameLength(4) == 1, "nameLength('.') == 1"); + require(hex"0361626300".nameLength(0) == 5, "nameLength('abc.') == 5"); + } + + function testLabelCount() public pure { + require(hex"00".labelCount(0) == 0, "labelCount('.') == 0"); + require(hex"016100".labelCount(0) == 1, "labelCount('a.') == 1"); + require( + hex"016201610000".labelCount(0) == 2, + "labelCount('b.a.') == 2" + ); + require( + hex"066574686c61620378797a00".labelCount(6 + 1) == 1, + "nameLength('(bthlab).xyz.') == 6" + ); + } + + function testIterateRRs() public pure { + // a. IN A 3600 127.0.0.1 + // b.a. IN A 3600 192.168.1.1 + bytes + memory rrs = hex"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101"; + bytes[2] memory names = [bytes(hex"016100"), bytes(hex"0162016100")]; + bytes[2] memory rdatas = [bytes(hex"74000001"), bytes(hex"c0a80101")]; + uint i = 0; + for ( + RRUtils.RRIterator memory iter = rrs.iterateRRs(0); + !iter.done(); + iter.next() + ) { + require(uint(iter.dnstype) == 1, "Type matches"); + require(uint(iter.class) == 1, "Class matches"); + require(uint(iter.ttl) == 3600, "TTL matches"); + require( + keccak256(iter.name()) == keccak256(names[i]), + "Name matches" + ); + require( + keccak256(iter.rdata()) == keccak256(rdatas[i]), + "Rdata matches" + ); + i++; + } + require(i == 2, "Expected 2 records"); + } + + // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1 + function testCompareNames() public pure { + bytes memory bthLabXyz = hex"066274686c61620378797a00"; + bytes memory ethLabXyz = hex"066574686c61620378797a00"; + bytes memory xyz = hex"0378797a00"; + bytes memory a_b_c = hex"01610162016300"; + bytes memory b_b_c = hex"01620162016300"; + bytes memory c = hex"016300"; + bytes memory d = hex"016400"; + bytes memory a_d_c = hex"01610164016300"; + bytes memory b_a_c = hex"01620161016300"; + bytes memory ab_c_d = hex"0261620163016400"; + bytes memory a_c_d = hex"01610163016400"; + bytes + memory verylong1_eth = hex"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800"; + bytes + memory verylong2_eth = hex"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800"; + + require( + hex"0301616100".compareNames(hex"0302616200") < 0, + "label lengths are correctly checked" + ); + require( + a_b_c.compareNames(c) > 0, + "one name has a difference of >1 label to with the same root name" + ); + require( + a_b_c.compareNames(d) < 0, + "one name has a difference of >1 label to with different root name" + ); + require( + a_b_c.compareNames(a_d_c) < 0, + "two names start the same but have differences in later labels" + ); + require( + a_b_c.compareNames(b_a_c) > 0, + "the first label sorts later, but the first label sorts earlier" + ); + require( + ab_c_d.compareNames(a_c_d) > 0, + "two names where the first label on one is a prefix of the first label on the other" + ); + require( + a_b_c.compareNames(b_b_c) < 0, + "two names where the first label on one is a prefix of the first label on the other" + ); + require(xyz.compareNames(ethLabXyz) < 0, "xyz comes before ethLab.xyz"); + require( + bthLabXyz.compareNames(ethLabXyz) < 0, + "bthLab.xyz comes before ethLab.xyz" + ); + require( + bthLabXyz.compareNames(bthLabXyz) == 0, + "bthLab.xyz and bthLab.xyz are the same" + ); + require( + ethLabXyz.compareNames(bthLabXyz) > 0, + "ethLab.xyz comes after bethLab.xyz" + ); + require(bthLabXyz.compareNames(xyz) > 0, "bthLab.xyz comes after xyz"); + + require( + verylong1_eth.compareNames(verylong2_eth) > 0, + "longa.vlong.eth comes after long.vlong.eth" + ); + } + + function testSerialNumberGt() public pure { + require(RRUtils.serialNumberGte(1, 0), "1 >= 0"); + require(!RRUtils.serialNumberGte(0, 1), "!(0 <= 1)"); + require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), "0 >= 0xFFFFFFFF"); + require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), "!(0 <= 0xFFFFFFFF)"); + require( + RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA), + "0x11111111 >= 0xAAAAAAAA" + ); + require(RRUtils.serialNumberGte(1, 1), "1 >= 1"); + } + + function testKeyTag() public view { + require( + hex"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d" + .computeKeytag() == 19036, + "Invalid keytag" + ); + require( + hex"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf" + .computeKeytag() == 21693, + "Invalid keytag (2)" + ); + require( + hex"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3" + .computeKeytag() == 33630 + ); + require( + hex"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5" + .computeKeytag() == 20326, + "Invalid keytag (3)" + ); + } +} diff --git a/solidity/dns-contracts/contracts/test/mocks/DummyOffchainResolver.sol b/solidity/dns-contracts/contracts/test/mocks/DummyOffchainResolver.sol new file mode 100644 index 0000000..8378096 --- /dev/null +++ b/solidity/dns-contracts/contracts/test/mocks/DummyOffchainResolver.sol @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; +import "../../../contracts/resolvers/profiles/ITextResolver.sol"; +import "../../../contracts/resolvers/profiles/IExtendedResolver.sol"; + +error OffchainLookup( + address sender, + string[] urls, + bytes callData, + bytes4 callbackFunction, + bytes extraData +); + +contract DummyOffchainResolver is IExtendedResolver, ERC165 { + function supportsInterface( + bytes4 interfaceId + ) public view virtual override returns (bool) { + return + interfaceId == type(IExtendedResolver).interfaceId || + super.supportsInterface(interfaceId); + } + + function resolve( + bytes calldata /* name */, + bytes calldata data + ) external view returns (bytes memory) { + string[] memory urls = new string[](1); + urls[0] = "https://example.com/"; + + if (bytes4(data) == bytes4(0x12345678)) { + return abi.encode("foo"); + } + revert OffchainLookup( + address(this), + urls, + data, + DummyOffchainResolver.resolveCallback.selector, + data + ); + } + + function addr(bytes32) external pure returns (address) { + return 0x69420f05A11f617B4B74fFe2E04B2D300dFA556F; + } + + function resolveCallback( + bytes calldata response, + bytes calldata extraData + ) external view returns (bytes memory) { + require( + keccak256(response) == keccak256(extraData), + "Response data error" + ); + if (bytes4(extraData) == bytes4(keccak256("name(bytes32)"))) { + return abi.encode("offchain.test.eth"); + } + return abi.encode(address(this)); + } +} diff --git a/solidity/dns-contracts/contracts/test/mocks/LegacyResolver.sol b/solidity/dns-contracts/contracts/test/mocks/LegacyResolver.sol new file mode 100644 index 0000000..720dd5a --- /dev/null +++ b/solidity/dns-contracts/contracts/test/mocks/LegacyResolver.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.13; + +contract LegacyResolver { + function addr(bytes32 /* node */) public view returns (address) { + return address(this); + } +} diff --git a/solidity/dns-contracts/contracts/test/mocks/MockERC20.sol b/solidity/dns-contracts/contracts/test/mocks/MockERC20.sol new file mode 100644 index 0000000..bd8d721 --- /dev/null +++ b/solidity/dns-contracts/contracts/test/mocks/MockERC20.sol @@ -0,0 +1,18 @@ +//SPDX-License-Identifier: MIT +pragma solidity >=0.8.17 <0.9.0; + +import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + +contract MockERC20 is ERC20 { + constructor( + string memory name, + string memory symbol, + address[] memory addresses + ) ERC20(name, symbol) { + _mint(msg.sender, 100 * 10 ** uint256(decimals())); + + for (uint256 i = 0; i < addresses.length; i++) { + _mint(addresses[i], 100 * 10 ** uint256(decimals())); + } + } +} diff --git a/solidity/dns-contracts/contracts/test/mocks/MockOffchainResolver.sol b/solidity/dns-contracts/contracts/test/mocks/MockOffchainResolver.sol new file mode 100644 index 0000000..1ed4045 --- /dev/null +++ b/solidity/dns-contracts/contracts/test/mocks/MockOffchainResolver.sol @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; +import "../../../contracts/resolvers/profiles/IExtendedResolver.sol"; + +error OffchainLookup( + address sender, + string[] urls, + bytes callData, + bytes4 callbackFunction, + bytes extraData +); + +contract MockOffchainResolver is IExtendedResolver, ERC165 { + function supportsInterface( + bytes4 interfaceId + ) public view virtual override returns (bool) { + return + interfaceId == type(IExtendedResolver).interfaceId || + super.supportsInterface(interfaceId); + } + + function resolve( + bytes calldata /* name */, + bytes calldata data + ) external view returns (bytes memory) { + string[] memory urls = new string[](1); + urls[0] = "https://example.com/"; + revert OffchainLookup( + address(this), + urls, + data, + MockOffchainResolver.resolveCallback.selector, + data + ); + } + + function addr(bytes32) external pure returns (bytes memory) { + return abi.encode("onchain"); + } + + function resolveCallback( + bytes calldata response, + bytes calldata extraData + ) external view returns (bytes memory) { + (, bytes memory callData, ) = abi.decode( + extraData, + (bytes, bytes, bytes4) + ); + if (bytes4(callData) == bytes4(keccak256("addr(bytes32)"))) { + (bytes memory result, , ) = abi.decode( + response, + (bytes, uint64, bytes) + ); + return result; + } + return abi.encode(address(this)); + } +} diff --git a/solidity/dns-contracts/contracts/test/mocks/MockReverseClaimerImplementer.sol b/solidity/dns-contracts/contracts/test/mocks/MockReverseClaimerImplementer.sol new file mode 100644 index 0000000..606e4b4 --- /dev/null +++ b/solidity/dns-contracts/contracts/test/mocks/MockReverseClaimerImplementer.sol @@ -0,0 +1,9 @@ +//SPDX-License-Identifier: MIT +pragma solidity >=0.8.17 <0.9.0; + +import {ENS} from "../../../contracts/registry/ENS.sol"; +import {ReverseClaimer} from "../../../contracts/reverseRegistrar/ReverseClaimer.sol"; + +contract MockReverseClaimerImplementer is ReverseClaimer { + constructor(ENS ens, address claimant) ReverseClaimer(ens, claimant) {} +} diff --git a/solidity/dns-contracts/contracts/test/mocks/StringUtilsTest.sol b/solidity/dns-contracts/contracts/test/mocks/StringUtilsTest.sol new file mode 100644 index 0000000..ffce35c --- /dev/null +++ b/solidity/dns-contracts/contracts/test/mocks/StringUtilsTest.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT +import "../../../contracts/utils/StringUtils.sol"; + +library StringUtilsTest { + function testEscape( + string calldata testStr + ) public pure returns (string memory) { + return StringUtils.escape(testStr); + } +} diff --git a/solidity/dns-contracts/contracts/utils/BytesUtils.sol b/solidity/dns-contracts/contracts/utils/BytesUtils.sol new file mode 100644 index 0000000..0f8fd7c --- /dev/null +++ b/solidity/dns-contracts/contracts/utils/BytesUtils.sol @@ -0,0 +1,441 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +library BytesUtils { + error OffsetOutOfBoundsError(uint256 offset, uint256 length); + + /* + * @dev Returns the keccak-256 hash of a byte range. + * @param self The byte string to hash. + * @param offset The position to start hashing at. + * @param len The number of bytes to hash. + * @return The hash of the byte range. + */ + function keccak( + bytes memory self, + uint256 offset, + uint256 len + ) internal pure returns (bytes32 ret) { + require(offset + len <= self.length); + assembly { + ret := keccak256(add(add(self, 32), offset), len) + } + } + + /** + * @dev Returns the ENS namehash of a DNS-encoded name. + * @param self The DNS-encoded name to hash. + * @param offset The offset at which to start hashing. + * @return The namehash of the name. + */ + function namehash( + bytes memory self, + uint256 offset + ) internal pure returns (bytes32) { + (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset); + if (labelhash == bytes32(0)) { + require(offset == self.length - 1, "namehash: Junk at end of name"); + return bytes32(0); + } + return + keccak256(abi.encodePacked(namehash(self, newOffset), labelhash)); + } + + /** + * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label. + * @param self The byte string to read a label from. + * @param idx The index to read a label at. + * @return labelhash The hash of the label at the specified index, or 0 if it is the last label. + * @return newIdx The index of the start of the next label. + */ + function readLabel( + bytes memory self, + uint256 idx + ) internal pure returns (bytes32 labelhash, uint256 newIdx) { + require(idx < self.length, "readLabel: Index out of bounds"); + uint256 len = uint256(uint8(self[idx])); + if (len > 0) { + labelhash = keccak(self, idx + 1, len); + } else { + labelhash = bytes32(0); + } + newIdx = idx + len + 1; + } + + /* + * @dev Returns a positive number if `other` comes lexicographically after + * `self`, a negative number if it comes before, or zero if the + * contents of the two bytes are equal. + * @param self The first bytes to compare. + * @param other The second bytes to compare. + * @return The result of the comparison. + */ + function compare( + bytes memory self, + bytes memory other + ) internal pure returns (int256) { + return compare(self, 0, self.length, other, 0, other.length); + } + + /* + * @dev Returns a positive number if `other` comes lexicographically after + * `self`, a negative number if it comes before, or zero if the + * contents of the two bytes are equal. Comparison is done per-rune, + * on unicode codepoints. + * @param self The first bytes to compare. + * @param offset The offset of self. + * @param len The length of self. + * @param other The second bytes to compare. + * @param otheroffset The offset of the other string. + * @param otherlen The length of the other string. + * @return The result of the comparison. + */ + function compare( + bytes memory self, + uint256 offset, + uint256 len, + bytes memory other, + uint256 otheroffset, + uint256 otherlen + ) internal pure returns (int256) { + if (offset + len > self.length) { + revert OffsetOutOfBoundsError(offset + len, self.length); + } + if (otheroffset + otherlen > other.length) { + revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length); + } + + uint256 shortest = len; + if (otherlen < len) shortest = otherlen; + + uint256 selfptr; + uint256 otherptr; + + assembly { + selfptr := add(self, add(offset, 32)) + otherptr := add(other, add(otheroffset, 32)) + } + for (uint256 idx = 0; idx < shortest; idx += 32) { + uint256 a; + uint256 b; + assembly { + a := mload(selfptr) + b := mload(otherptr) + } + if (a != b) { + // Mask out irrelevant bytes and check again + uint256 mask; + if (shortest - idx >= 32) { + mask = type(uint256).max; + } else { + mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1); + } + int256 diff = int256(a & mask) - int256(b & mask); + if (diff != 0) return diff; + } + selfptr += 32; + otherptr += 32; + } + + return int256(len) - int256(otherlen); + } + + /* + * @dev Returns true if the two byte ranges are equal. + * @param self The first byte range to compare. + * @param offset The offset into the first byte range. + * @param other The second byte range to compare. + * @param otherOffset The offset into the second byte range. + * @param len The number of bytes to compare + * @return True if the byte ranges are equal, false otherwise. + */ + function equals( + bytes memory self, + uint256 offset, + bytes memory other, + uint256 otherOffset, + uint256 len + ) internal pure returns (bool) { + return keccak(self, offset, len) == keccak(other, otherOffset, len); + } + + /* + * @dev Returns true if the two byte ranges are equal with offsets. + * @param self The first byte range to compare. + * @param offset The offset into the first byte range. + * @param other The second byte range to compare. + * @param otherOffset The offset into the second byte range. + * @return True if the byte ranges are equal, false otherwise. + */ + function equals( + bytes memory self, + uint256 offset, + bytes memory other, + uint256 otherOffset + ) internal pure returns (bool) { + return + keccak(self, offset, self.length - offset) == + keccak(other, otherOffset, other.length - otherOffset); + } + + /* + * @dev Compares a range of 'self' to all of 'other' and returns True iff + * they are equal. + * @param self The first byte range to compare. + * @param offset The offset into the first byte range. + * @param other The second byte range to compare. + * @return True if the byte ranges are equal, false otherwise. + */ + function equals( + bytes memory self, + uint256 offset, + bytes memory other + ) internal pure returns (bool) { + return + self.length == offset + other.length && + equals(self, offset, other, 0, other.length); + } + + /* + * @dev Returns true if the two byte ranges are equal. + * @param self The first byte range to compare. + * @param other The second byte range to compare. + * @return True if the byte ranges are equal, false otherwise. + */ + function equals( + bytes memory self, + bytes memory other + ) internal pure returns (bool) { + return + self.length == other.length && + equals(self, 0, other, 0, self.length); + } + + /* + * @dev Returns the 8-bit number at the specified index of self. + * @param self The byte string. + * @param idx The index into the bytes + * @return The specified 8 bits of the string, interpreted as an integer. + */ + function readUint8( + bytes memory self, + uint256 idx + ) internal pure returns (uint8 ret) { + return uint8(self[idx]); + } + + /* + * @dev Returns the 16-bit number at the specified index of self. + * @param self The byte string. + * @param idx The index into the bytes + * @return The specified 16 bits of the string, interpreted as an integer. + */ + function readUint16( + bytes memory self, + uint256 idx + ) internal pure returns (uint16 ret) { + require(idx + 2 <= self.length); + assembly { + ret := and(mload(add(add(self, 2), idx)), 0xFFFF) + } + } + + /* + * @dev Returns the 32-bit number at the specified index of self. + * @param self The byte string. + * @param idx The index into the bytes + * @return The specified 32 bits of the string, interpreted as an integer. + */ + function readUint32( + bytes memory self, + uint256 idx + ) internal pure returns (uint32 ret) { + require(idx + 4 <= self.length); + assembly { + ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF) + } + } + + /* + * @dev Returns the 32 byte value at the specified index of self. + * @param self The byte string. + * @param idx The index into the bytes + * @return The specified 32 bytes of the string. + */ + function readBytes32( + bytes memory self, + uint256 idx + ) internal pure returns (bytes32 ret) { + require(idx + 32 <= self.length); + assembly { + ret := mload(add(add(self, 32), idx)) + } + } + + /* + * @dev Returns the 32 byte value at the specified index of self. + * @param self The byte string. + * @param idx The index into the bytes + * @return The specified 32 bytes of the string. + */ + function readBytes20( + bytes memory self, + uint256 idx + ) internal pure returns (bytes20 ret) { + require(idx + 20 <= self.length); + assembly { + ret := and( + mload(add(add(self, 32), idx)), + 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000 + ) + } + } + + /* + * @dev Returns the n byte value at the specified index of self. + * @param self The byte string. + * @param idx The index into the bytes. + * @param len The number of bytes. + * @return The specified 32 bytes of the string. + */ + function readBytesN( + bytes memory self, + uint256 idx, + uint256 len + ) internal pure returns (bytes32 ret) { + require(len <= 32); + require(idx + len <= self.length); + assembly { + let mask := not(sub(exp(256, sub(32, len)), 1)) + ret := and(mload(add(add(self, 32), idx)), mask) + } + } + + function memcpy(uint256 dest, uint256 src, uint256 len) private pure { + // Copy word-length chunks while possible + for (; len >= 32; len -= 32) { + assembly { + mstore(dest, mload(src)) + } + dest += 32; + src += 32; + } + + // Copy remaining bytes + unchecked { + uint256 mask = (256 ** (32 - len)) - 1; + assembly { + let srcpart := and(mload(src), not(mask)) + let destpart := and(mload(dest), mask) + mstore(dest, or(destpart, srcpart)) + } + } + } + + /* + * @dev Copies a substring into a new byte string. + * @param self The byte string to copy from. + * @param offset The offset to start copying at. + * @param len The number of bytes to copy. + */ + function substring( + bytes memory self, + uint256 offset, + uint256 len + ) internal pure returns (bytes memory) { + require(offset + len <= self.length); + + bytes memory ret = new bytes(len); + uint256 dest; + uint256 src; + + assembly { + dest := add(ret, 32) + src := add(add(self, 32), offset) + } + memcpy(dest, src, len); + + return ret; + } + + // Maps characters from 0x30 to 0x7A to their base32 values. + // 0xFF represents invalid characters in that range. + bytes constant base32HexTable = + hex"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F"; + + /** + * @dev Decodes unpadded base32 data of up to one word in length. + * @param self The data to decode. + * @param off Offset into the string to start at. + * @param len Number of characters to decode. + * @return The decoded data, left aligned. + */ + function base32HexDecodeWord( + bytes memory self, + uint256 off, + uint256 len + ) internal pure returns (bytes32) { + require(len <= 52); + + uint256 ret = 0; + uint8 decoded; + for (uint256 i = 0; i < len; i++) { + bytes1 char = self[off + i]; + require(char >= 0x30 && char <= 0x7A); + decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]); + require(decoded <= 0x20); + if (i == len - 1) { + break; + } + ret = (ret << 5) | decoded; + } + + uint256 bitlen = len * 5; + if (len % 8 == 0) { + // Multiple of 8 characters, no padding + ret = (ret << 5) | decoded; + } else if (len % 8 == 2) { + // Two extra characters - 1 byte + ret = (ret << 3) | (decoded >> 2); + bitlen -= 2; + } else if (len % 8 == 4) { + // Four extra characters - 2 bytes + ret = (ret << 1) | (decoded >> 4); + bitlen -= 4; + } else if (len % 8 == 5) { + // Five extra characters - 3 bytes + ret = (ret << 4) | (decoded >> 1); + bitlen -= 1; + } else if (len % 8 == 7) { + // Seven extra characters - 4 bytes + ret = (ret << 2) | (decoded >> 3); + bitlen -= 3; + } else { + revert(); + } + + return bytes32(ret << (256 - bitlen)); + } + + /** + * @dev Finds the first occurrence of the byte `needle` in `self`. + * @param self The string to search + * @param off The offset to start searching at + * @param len The number of bytes to search + * @param needle The byte to search for + * @return The offset of `needle` in `self`, or 2**256-1 if it was not found. + */ + function find( + bytes memory self, + uint256 off, + uint256 len, + bytes1 needle + ) internal pure returns (uint256) { + for (uint256 idx = off; idx < off + len; idx++) { + if (self[idx] == needle) { + return idx; + } + } + return type(uint256).max; + } +} diff --git a/solidity/dns-contracts/contracts/utils/DummyOldResolver.sol b/solidity/dns-contracts/contracts/utils/DummyOldResolver.sol new file mode 100644 index 0000000..ed38225 --- /dev/null +++ b/solidity/dns-contracts/contracts/utils/DummyOldResolver.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.4.11; + +contract DummyOldResolver { + function test() public returns (bool) { + return true; + } + + function name(bytes32) public returns (string memory) { + return "test.eth"; + } +} diff --git a/solidity/dns-contracts/contracts/utils/DummyRevertResolver.sol b/solidity/dns-contracts/contracts/utils/DummyRevertResolver.sol new file mode 100644 index 0000000..f21993c --- /dev/null +++ b/solidity/dns-contracts/contracts/utils/DummyRevertResolver.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.17 <0.9.0; + +contract DummyRevertResolver { + function resolve( + bytes calldata, + bytes calldata + ) external pure returns (bytes memory) { + revert("Not Supported"); + } + + function supportsInterface(bytes4) external pure returns (bool) { + return true; + } +} diff --git a/solidity/dns-contracts/contracts/utils/ERC20Recoverable.sol b/solidity/dns-contracts/contracts/utils/ERC20Recoverable.sol new file mode 100644 index 0000000..4ef90e6 --- /dev/null +++ b/solidity/dns-contracts/contracts/utils/ERC20Recoverable.sol @@ -0,0 +1,26 @@ +//SPDX-License-Identifier: MIT +pragma solidity >=0.8.17 <0.9.0; + +import "@openzeppelin/contracts/access/Ownable.sol"; +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; + +/** + @notice Contract is used to recover ERC20 tokens sent to the contract by mistake. + */ + +contract ERC20Recoverable is Ownable { + /** + @notice Recover ERC20 tokens sent to the contract by mistake. + @dev The contract is Ownable and only the owner can call the recover function. + @param _to The address to send the tokens to. +@param _token The address of the ERC20 token to recover + @param _amount The amount of tokens to recover. + */ + function recoverFunds( + address _token, + address _to, + uint256 _amount + ) external onlyOwner { + IERC20(_token).transfer(_to, _amount); + } +} diff --git a/solidity/dns-contracts/contracts/utils/HexUtils.sol b/solidity/dns-contracts/contracts/utils/HexUtils.sol new file mode 100644 index 0000000..0f79927 --- /dev/null +++ b/solidity/dns-contracts/contracts/utils/HexUtils.sol @@ -0,0 +1,124 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +library HexUtils { + /** + * @dev Attempts to parse bytes32 from a hex string + * @param str The string to parse + * @param idx The offset to start parsing at + * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string. + */ + function hexStringToBytes32( + bytes memory str, + uint256 idx, + uint256 lastIdx + ) internal pure returns (bytes32, bool) { + require(lastIdx - idx <= 64); + (bytes memory r, bool valid) = hexToBytes(str, idx, lastIdx); + if (!valid) { + return (bytes32(0), false); + } + bytes32 ret; + assembly { + ret := shr(mul(4, sub(64, sub(lastIdx, idx))), mload(add(r, 32))) + } + return (ret, true); + } + + function hexToBytes( + bytes memory str, + uint256 idx, + uint256 lastIdx + ) internal pure returns (bytes memory r, bool valid) { + uint256 hexLength = lastIdx - idx; + if (hexLength % 2 == 1) { + revert("Invalid string length"); + } + r = new bytes(hexLength / 2); + valid = true; + assembly { + // check that the index to read to is not past the end of the string + if gt(lastIdx, mload(str)) { + revert(0, 0) + } + + function getHex(c) -> ascii { + // chars 48-57: 0-9 + if and(gt(c, 47), lt(c, 58)) { + ascii := sub(c, 48) + leave + } + // chars 65-70: A-F + if and(gt(c, 64), lt(c, 71)) { + ascii := add(sub(c, 65), 10) + leave + } + // chars 97-102: a-f + if and(gt(c, 96), lt(c, 103)) { + ascii := add(sub(c, 97), 10) + leave + } + // invalid char + ascii := 0xff + } + + let ptr := add(str, 32) + for { + let i := idx + } lt(i, lastIdx) { + i := add(i, 2) + } { + let byte1 := getHex(byte(0, mload(add(ptr, i)))) + let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1))))) + // if either byte is invalid, set invalid and break loop + if or(eq(byte1, 0xff), eq(byte2, 0xff)) { + valid := false + break + } + let combined := or(shl(4, byte1), byte2) + mstore8(add(add(r, 32), div(sub(i, idx), 2)), combined) + } + } + } + + /** + * @dev Attempts to parse an address from a hex string + * @param str The string to parse + * @param idx The offset to start parsing at + * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string. + */ + function hexToAddress( + bytes memory str, + uint256 idx, + uint256 lastIdx + ) internal pure returns (address, bool) { + if (lastIdx - idx < 40) return (address(0x0), false); + (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx); + return (address(uint160(uint256(r))), valid); + } + + /** + * @dev Attempts to convert an address to a hex string + * @param addr The _addr to parse + */ + function addressToHex(address addr) internal pure returns (string memory) { + bytes memory hexString = new bytes(40); + for (uint i = 0; i < 20; i++) { + bytes1 byteValue = bytes1(uint8(uint160(addr) >> (8 * (19 - i)))); + bytes1 highNibble = bytes1(uint8(byteValue) / 16); + bytes1 lowNibble = bytes1( + uint8(byteValue) - 16 * uint8(highNibble) + ); + hexString[2 * i] = _nibbleToHexChar(highNibble); + hexString[2 * i + 1] = _nibbleToHexChar(lowNibble); + } + return string(hexString); + } + + function _nibbleToHexChar( + bytes1 nibble + ) internal pure returns (bytes1 hexChar) { + if (uint8(nibble) < 10) return bytes1(uint8(nibble) + 0x30); + else return bytes1(uint8(nibble) + 0x57); + } +} diff --git a/solidity/dns-contracts/contracts/utils/IWBNB.sol b/solidity/dns-contracts/contracts/utils/IWBNB.sol new file mode 100644 index 0000000..a174c58 --- /dev/null +++ b/solidity/dns-contracts/contracts/utils/IWBNB.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +/// @dev Minimal WBNB interface (same as WETH9) +interface IWBNB { + /// @notice Deposit native BNB and mint WBNB 1:1 + function deposit() external payable; + /// @notice Burn WBNB and withdraw native BNB 1:1 + function withdraw(uint256 wad) external; + /// @notice ERC20: total tokens in existence + function totalSupply() external view returns (uint256); + /// @notice ERC20: balance of `who` + function balanceOf(address who) external view returns (uint256); + /// @notice ERC20: transfer `wad` tokens to `to` + function transfer(address to, uint256 wad) external returns (bool); + /// @notice ERC20: allowance from `owner` to `spender` + function allowance(address owner, address spender) external view returns (uint256); + /// @notice ERC20: approve `spender` to spend up to `wad` tokens + function approve(address spender, uint256 wad) external returns (bool); + /// @notice ERC20: transfer `wad` tokens from `from` to `to` + function transferFrom( + address from, + address to, + uint256 wad + ) external returns (bool); + + // Optional: some implementations also emit these + event Approval(address indexed owner, address indexed spender, uint256 value); + event Transfer(address indexed from, address indexed to, uint256 value); +} diff --git a/solidity/dns-contracts/contracts/utils/LowLevelCallUtils.sol b/solidity/dns-contracts/contracts/utils/LowLevelCallUtils.sol new file mode 100644 index 0000000..ee5919b --- /dev/null +++ b/solidity/dns-contracts/contracts/utils/LowLevelCallUtils.sol @@ -0,0 +1,86 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.13; + +import {Address} from "@openzeppelin/contracts/utils/Address.sol"; + +library LowLevelCallUtils { + using Address for address; + + /** + * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with + * `returnDataSize` and `readReturnData`. + * @param target The address to staticcall. + * @param data The data to pass to the call. + * @return success True if the call succeeded, or false if it reverts. + */ + function functionStaticCall( + address target, + bytes memory data + ) internal view returns (bool success) { + return functionStaticCall(target, data, gasleft()); + } + + /** + * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with + * `returnDataSize` and `readReturnData`. + * @param target The address to staticcall. + * @param data The data to pass to the call. + * @param gasLimit The gas limit to use for the call. + * @return success True if the call succeeded, or false if it reverts. + */ + function functionStaticCall( + address target, + bytes memory data, + uint256 gasLimit + ) internal view returns (bool success) { + require( + target.isContract(), + "LowLevelCallUtils: static call to non-contract" + ); + assembly { + success := staticcall( + gasLimit, + target, + add(data, 32), + mload(data), + 0, + 0 + ) + } + } + + /** + * @dev Returns the size of the return data of the most recent external call. + */ + function returnDataSize() internal pure returns (uint256 len) { + assembly { + len := returndatasize() + } + } + + /** + * @dev Reads return data from the most recent external call. + * @param offset Offset into the return data. + * @param length Number of bytes to return. + */ + function readReturnData( + uint256 offset, + uint256 length + ) internal pure returns (bytes memory data) { + data = new bytes(length); + assembly { + returndatacopy(add(data, 32), offset, length) + } + } + + /** + * @dev Reverts with the return data from the most recent external call. + */ + function propagateRevert() internal pure { + assembly { + returndatacopy(0, 0, returndatasize()) + revert(0, returndatasize()) + } + } +} diff --git a/solidity/dns-contracts/contracts/utils/MigrationHelper.sol b/solidity/dns-contracts/contracts/utils/MigrationHelper.sol new file mode 100644 index 0000000..ae29dd7 --- /dev/null +++ b/solidity/dns-contracts/contracts/utils/MigrationHelper.sol @@ -0,0 +1,68 @@ +//SPDX-License-Identifier: MIT +pragma solidity >=0.8.4; + +import {IBaseRegistrar} from "../ethregistrar/IBaseRegistrar.sol"; +import {INameWrapper} from "../wrapper/INameWrapper.sol"; +import {Controllable} from "../wrapper/Controllable.sol"; +import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; + +contract MigrationHelper is Ownable, Controllable { + IBaseRegistrar public immutable registrar; + INameWrapper public immutable wrapper; + address public migrationTarget; + + error MigrationTargetNotSet(); + + event MigrationTargetUpdated(address indexed target); + + constructor(IBaseRegistrar _registrar, INameWrapper _wrapper) { + registrar = _registrar; + wrapper = _wrapper; + } + + function setMigrationTarget(address target) external onlyOwner { + migrationTarget = target; + emit MigrationTargetUpdated(target); + } + + function migrateNames( + address nameOwner, + uint256[] memory tokenIds, + bytes memory data + ) external onlyController { + if (migrationTarget == address(0)) { + revert MigrationTargetNotSet(); + } + + for (uint256 i = 0; i < tokenIds.length; i++) { + registrar.safeTransferFrom( + nameOwner, + migrationTarget, + tokenIds[i], + data + ); + } + } + + function migrateWrappedNames( + address nameOwner, + uint256[] memory tokenIds, + bytes memory data + ) external onlyController { + if (migrationTarget == address(0)) { + revert MigrationTargetNotSet(); + } + + uint256[] memory amounts = new uint256[](tokenIds.length); + for (uint256 i = 0; i < amounts.length; i++) { + amounts[i] = 1; + } + wrapper.safeBatchTransferFrom( + nameOwner, + migrationTarget, + tokenIds, + amounts, + data + ); + } +} diff --git a/solidity/dns-contracts/contracts/utils/NameEncoder.sol b/solidity/dns-contracts/contracts/utils/NameEncoder.sol new file mode 100644 index 0000000..5139297 --- /dev/null +++ b/solidity/dns-contracts/contracts/utils/NameEncoder.sol @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +import {BytesUtils} from "../utils/BytesUtils.sol"; + +library NameEncoder { + using BytesUtils for bytes; + + function dnsEncodeName( + string memory name + ) internal pure returns (bytes memory dnsName, bytes32 node) { + uint8 labelLength = 0; + bytes memory bytesName = bytes(name); + uint256 length = bytesName.length; + dnsName = new bytes(length + 2); + node = 0; + if (length == 0) { + dnsName[0] = 0; + return (dnsName, node); + } + + // use unchecked to save gas since we check for an underflow + // and we check for the length before the loop + unchecked { + for (uint256 i = length - 1; i >= 0; i--) { + if (bytesName[i] == ".") { + dnsName[i + 1] = bytes1(labelLength); + node = keccak256( + abi.encodePacked( + node, + bytesName.keccak(i + 1, labelLength) + ) + ); + labelLength = 0; + } else { + labelLength += 1; + dnsName[i + 1] = bytesName[i]; + } + if (i == 0) { + break; + } + } + } + + node = keccak256( + abi.encodePacked(node, bytesName.keccak(0, labelLength)) + ); + + dnsName[0] = bytes1(labelLength); + return (dnsName, node); + } +} diff --git a/solidity/dns-contracts/contracts/utils/StringUtils.sol b/solidity/dns-contracts/contracts/utils/StringUtils.sol new file mode 100644 index 0000000..2dde4c4 --- /dev/null +++ b/solidity/dns-contracts/contracts/utils/StringUtils.sol @@ -0,0 +1,85 @@ +pragma solidity >=0.8.4; + +library StringUtils { + /** + * @dev Returns the length of a given string + * + * @param s The string to measure the length of + * @return The length of the input string + */ + function strlen(string memory s) internal pure returns (uint256) { + uint256 len; + uint256 i = 0; + uint256 bytelength = bytes(s).length; + for (len = 0; i < bytelength; len++) { + bytes1 b = bytes(s)[i]; + if (b < 0x80) { + i += 1; + } else if (b < 0xE0) { + i += 2; + } else if (b < 0xF0) { + i += 3; + } else if (b < 0xF8) { + i += 4; + } else if (b < 0xFC) { + i += 5; + } else { + i += 6; + } + } + return len; + } + + /** + * @dev Escapes special characters in a given string + * + * @param str The string to escape + * @return The escaped string + */ + function escape(string memory str) internal pure returns (string memory) { + bytes memory strBytes = bytes(str); + uint extraChars = 0; + + // count extra space needed for escaping + for (uint i = 0; i < strBytes.length; i++) { + if (_needsEscaping(strBytes[i])) { + extraChars++; + } + } + + // allocate buffer with the exact size needed + bytes memory buffer = new bytes(strBytes.length + extraChars); + uint index = 0; + + // escape characters + for (uint i = 0; i < strBytes.length; i++) { + if (_needsEscaping(strBytes[i])) { + buffer[index++] = "\\"; + buffer[index++] = _getEscapedChar(strBytes[i]); + } else { + buffer[index++] = strBytes[i]; + } + } + + return string(buffer); + } + + // determine if a character needs escaping + function _needsEscaping(bytes1 char) private pure returns (bool) { + return + char == '"' || + char == "/" || + char == "\\" || + char == "\n" || + char == "\r" || + char == "\t"; + } + + // get the escaped character + function _getEscapedChar(bytes1 char) private pure returns (bytes1) { + if (char == "\n") return "n"; + if (char == "\r") return "r"; + if (char == "\t") return "t"; + return char; + } +} diff --git a/solidity/dns-contracts/contracts/utils/TestBytesUtils.sol b/solidity/dns-contracts/contracts/utils/TestBytesUtils.sol new file mode 100644 index 0000000..bda4ab7 --- /dev/null +++ b/solidity/dns-contracts/contracts/utils/TestBytesUtils.sol @@ -0,0 +1,22 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +import {BytesUtils} from "./BytesUtils.sol"; + +contract TestBytesUtils { + using BytesUtils for *; + + function readLabel( + bytes calldata name, + uint256 offset + ) public pure returns (bytes32, uint256) { + return name.readLabel(offset); + } + + function namehash( + bytes calldata name, + uint256 offset + ) public pure returns (bytes32) { + return name.namehash(offset); + } +} diff --git a/solidity/dns-contracts/contracts/utils/TestHexUtils.sol b/solidity/dns-contracts/contracts/utils/TestHexUtils.sol new file mode 100644 index 0000000..b6624f0 --- /dev/null +++ b/solidity/dns-contracts/contracts/utils/TestHexUtils.sol @@ -0,0 +1,32 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +import {HexUtils} from "./HexUtils.sol"; + +contract TestHexUtils { + using HexUtils for *; + + function hexToBytes( + bytes calldata name, + uint256 idx, + uint256 lastInx + ) public pure returns (bytes memory, bool) { + return name.hexToBytes(idx, lastInx); + } + + function hexStringToBytes32( + bytes calldata name, + uint256 idx, + uint256 lastInx + ) public pure returns (bytes32, bool) { + return name.hexStringToBytes32(idx, lastInx); + } + + function hexToAddress( + bytes calldata input, + uint256 idx, + uint256 lastInx + ) public pure returns (address, bool) { + return input.hexToAddress(idx, lastInx); + } +} diff --git a/solidity/dns-contracts/contracts/utils/TestNameEncoder.sol b/solidity/dns-contracts/contracts/utils/TestNameEncoder.sol new file mode 100644 index 0000000..31e89bd --- /dev/null +++ b/solidity/dns-contracts/contracts/utils/TestNameEncoder.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +import {NameEncoder} from "./NameEncoder.sol"; + +contract TestNameEncoder { + using NameEncoder for string; + + function encodeName( + string memory name + ) public pure returns (bytes memory, bytes32) { + return name.dnsEncodeName(); + } +} diff --git a/solidity/dns-contracts/contracts/utils/UniversalResolver.sol b/solidity/dns-contracts/contracts/utils/UniversalResolver.sol new file mode 100644 index 0000000..79f9922 --- /dev/null +++ b/solidity/dns-contracts/contracts/utils/UniversalResolver.sol @@ -0,0 +1,685 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.17 <0.9.0; + +import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol"; +import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; +import {Address} from "@openzeppelin/contracts/utils/Address.sol"; +import {LowLevelCallUtils} from "./LowLevelCallUtils.sol"; +import {ENS} from "../registry/ENS.sol"; +import {IExtendedResolver} from "../resolvers/profiles/IExtendedResolver.sol"; +import {Resolver, INameResolver, IAddrResolver} from "../resolvers/Resolver.sol"; +import {BytesUtils} from "../utils/BytesUtils.sol"; +import {NameEncoder} from "./NameEncoder.sol"; +import {HexUtils} from "./HexUtils.sol"; + +error OffchainLookup( + address sender, + string[] urls, + bytes callData, + bytes4 callbackFunction, + bytes extraData +); + +error ResolverNotFound(); + +error ResolverWildcardNotSupported(); + +error ResolverNotContract(); + +error ResolverError(bytes returnData); + +error HttpError(HttpErrorItem[] errors); + +struct HttpErrorItem { + uint16 status; + string message; +} + +struct MulticallData { + bytes name; + bytes[] data; + string[] gateways; + bytes4 callbackFunction; + bool isWildcard; + address resolver; + bytes metaData; + bool[] failures; +} + +struct MulticallChecks { + bool isCallback; + bool hasExtendedResolver; +} + +struct OffchainLookupCallData { + address sender; + string[] urls; + bytes callData; +} + +struct OffchainLookupExtraData { + bytes4 callbackFunction; + bytes data; +} + +struct Result { + bool success; + bytes returnData; +} + +interface BatchGateway { + function query( + OffchainLookupCallData[] memory data + ) external returns (bool[] memory failures, bytes[] memory responses); +} + +/** + * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain, + * making it possible to make a single smart contract call to resolve an ENS name. + */ +contract UniversalResolver is ERC165, Ownable { + using Address for address; + using NameEncoder for string; + using BytesUtils for bytes; + using HexUtils for bytes; + + string[] public batchGatewayURLs; + ENS public immutable registry; + + constructor(address _registry, string[] memory _urls) { + registry = ENS(_registry); + batchGatewayURLs = _urls; + } + + function setGatewayURLs(string[] memory _urls) public onlyOwner { + batchGatewayURLs = _urls; + } + + /** + * @dev Performs ENS name resolution for the supplied name and resolution data. + * @param name The name to resolve, in normalised and DNS-encoded form. + * @param data The resolution data, as specified in ENSIP-10. + * @return The result of resolving the name. + */ + function resolve( + bytes calldata name, + bytes memory data + ) external view returns (bytes memory, address) { + return + _resolveSingle( + name, + data, + batchGatewayURLs, + this.resolveSingleCallback.selector, + "" + ); + } + + function resolve( + bytes calldata name, + bytes[] memory data + ) external view returns (Result[] memory, address) { + return resolve(name, data, batchGatewayURLs); + } + + function resolve( + bytes calldata name, + bytes memory data, + string[] memory gateways + ) external view returns (bytes memory, address) { + return + _resolveSingle( + name, + data, + gateways, + this.resolveSingleCallback.selector, + "" + ); + } + + function resolve( + bytes calldata name, + bytes[] memory data, + string[] memory gateways + ) public view returns (Result[] memory, address) { + return + _resolve(name, data, gateways, this.resolveCallback.selector, ""); + } + + function _resolveSingle( + bytes calldata name, + bytes memory data, + string[] memory gateways, + bytes4 callbackFunction, + bytes memory metaData + ) public view returns (bytes memory, address) { + bytes[] memory dataArr = new bytes[](1); + dataArr[0] = data; + (Result[] memory results, address resolver) = _resolve( + name, + dataArr, + gateways, + callbackFunction, + metaData + ); + + Result memory result = results[0]; + + _checkResolveSingle(result); + + return (result.returnData, resolver); + } + + function _resolve( + bytes calldata name, + bytes[] memory data, + string[] memory gateways, + bytes4 callbackFunction, + bytes memory metaData + ) internal view returns (Result[] memory results, address resolverAddress) { + (Resolver resolver, , uint256 finalOffset) = findResolver(name); + resolverAddress = address(resolver); + if (resolverAddress == address(0)) { + revert ResolverNotFound(); + } + + if (!resolverAddress.isContract()) { + revert ResolverNotContract(); + } + + bool isWildcard = finalOffset != 0; + + results = _multicall( + MulticallData( + name, + data, + gateways, + callbackFunction, + isWildcard, + resolverAddress, + metaData, + new bool[](data.length) + ) + ); + } + + function reverse( + bytes calldata reverseName + ) external view returns (string memory, address, address, address) { + return reverse(reverseName, batchGatewayURLs); + } + + /** + * @dev Performs ENS name reverse resolution for the supplied reverse name. + * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse + * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address. + */ + function reverse( + bytes calldata reverseName, + string[] memory gateways + ) public view returns (string memory, address, address, address) { + bytes memory encodedCall = abi.encodeCall( + INameResolver.name, + reverseName.namehash(0) + ); + ( + bytes memory reverseResolvedData, + address reverseResolverAddress + ) = _resolveSingle( + reverseName, + encodedCall, + gateways, + this.reverseCallback.selector, + "" + ); + + return + getForwardDataFromReverse( + reverseResolvedData, + reverseResolverAddress, + gateways + ); + } + + function getForwardDataFromReverse( + bytes memory resolvedReverseData, + address reverseResolverAddress, + string[] memory gateways + ) internal view returns (string memory, address, address, address) { + string memory resolvedName = abi.decode(resolvedReverseData, (string)); + + (bytes memory encodedName, bytes32 namehash) = resolvedName + .dnsEncodeName(); + + bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash); + bytes memory metaData = abi.encode( + resolvedName, + reverseResolverAddress + ); + (bytes memory resolvedData, address resolverAddress) = this + ._resolveSingle( + encodedName, + encodedCall, + gateways, + this.reverseCallback.selector, + metaData + ); + + address resolvedAddress = abi.decode(resolvedData, (address)); + + return ( + resolvedName, + resolvedAddress, + reverseResolverAddress, + resolverAddress + ); + } + + function resolveSingleCallback( + bytes calldata response, + bytes calldata extraData + ) external view returns (bytes memory, address) { + (Result[] memory results, address resolver, , ) = _resolveCallback( + response, + extraData, + this.resolveSingleCallback.selector + ); + Result memory result = results[0]; + + _checkResolveSingle(result); + + return (result.returnData, resolver); + } + + function resolveCallback( + bytes calldata response, + bytes calldata extraData + ) external view returns (Result[] memory, address) { + (Result[] memory results, address resolver, , ) = _resolveCallback( + response, + extraData, + this.resolveCallback.selector + ); + return (results, resolver); + } + + function reverseCallback( + bytes calldata response, + bytes calldata extraData + ) external view returns (string memory, address, address, address) { + ( + Result[] memory results, + address resolverAddress, + string[] memory gateways, + bytes memory metaData + ) = _resolveCallback( + response, + extraData, + this.reverseCallback.selector + ); + + Result memory result = results[0]; + + _checkResolveSingle(result); + + if (metaData.length > 0) { + (string memory resolvedName, address reverseResolverAddress) = abi + .decode(metaData, (string, address)); + address resolvedAddress = abi.decode(result.returnData, (address)); + return ( + resolvedName, + resolvedAddress, + reverseResolverAddress, + resolverAddress + ); + } + + return + getForwardDataFromReverse( + result.returnData, + resolverAddress, + gateways + ); + } + + function supportsInterface( + bytes4 interfaceId + ) public view virtual override returns (bool) { + return + interfaceId == type(IExtendedResolver).interfaceId || + super.supportsInterface(interfaceId); + } + + function _resolveCallback( + bytes calldata response, + bytes calldata extraData, + bytes4 callbackFunction + ) + internal + view + returns (Result[] memory, address, string[] memory, bytes memory) + { + MulticallData memory multicallData; + multicallData.callbackFunction = callbackFunction; + (bool[] memory failures, bytes[] memory responses) = abi.decode( + response, + (bool[], bytes[]) + ); + OffchainLookupExtraData[] memory extraDatas; + ( + multicallData.isWildcard, + multicallData.resolver, + multicallData.gateways, + multicallData.metaData, + extraDatas + ) = abi.decode( + extraData, + (bool, address, string[], bytes, OffchainLookupExtraData[]) + ); + require(responses.length <= extraDatas.length); + multicallData.data = new bytes[](extraDatas.length); + multicallData.failures = new bool[](extraDatas.length); + uint256 offchainCount = 0; + for (uint256 i = 0; i < extraDatas.length; i++) { + if (extraDatas[i].callbackFunction == bytes4(0)) { + // This call did not require an offchain lookup; use the previous input data. + multicallData.data[i] = extraDatas[i].data; + } else { + if (failures[offchainCount]) { + multicallData.failures[i] = true; + multicallData.data[i] = responses[offchainCount]; + } else { + multicallData.data[i] = abi.encodeWithSelector( + extraDatas[i].callbackFunction, + responses[offchainCount], + extraDatas[i].data + ); + } + offchainCount = offchainCount + 1; + } + } + + return ( + _multicall(multicallData), + multicallData.resolver, + multicallData.gateways, + multicallData.metaData + ); + } + + /** + * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps + * the error with the data necessary to continue the request where it left off. + * @param target The address to call. + * @param data The data to call `target` with. + * @return offchain Whether the call reverted with an `OffchainLookup` error. + * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct. + * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct. + * @return result Whether the call succeeded. + */ + function callWithOffchainLookupPropagation( + address target, + bytes memory data, + bool isSafe + ) + internal + view + returns ( + bool offchain, + bytes memory returnData, + OffchainLookupExtraData memory extraData, + bool result + ) + { + if (isSafe) { + result = LowLevelCallUtils.functionStaticCall(target, data); + } else { + result = LowLevelCallUtils.functionStaticCall(target, data, 50000); + } + uint256 size = LowLevelCallUtils.returnDataSize(); + + if (result) { + return ( + false, + LowLevelCallUtils.readReturnData(0, size), + extraData, + true + ); + } + + // Failure + if (size >= 4) { + bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4); + // Offchain lookup. Decode the revert message and create our own that nests it. + bytes memory revertData = LowLevelCallUtils.readReturnData( + 4, + size - 4 + ); + if (bytes4(errorId) == OffchainLookup.selector) { + ( + address wrappedSender, + string[] memory wrappedUrls, + bytes memory wrappedCallData, + bytes4 wrappedCallbackFunction, + bytes memory wrappedExtraData + ) = abi.decode( + revertData, + (address, string[], bytes, bytes4, bytes) + ); + if (wrappedSender == target) { + returnData = abi.encode( + OffchainLookupCallData( + wrappedSender, + wrappedUrls, + wrappedCallData + ) + ); + extraData = OffchainLookupExtraData( + wrappedCallbackFunction, + wrappedExtraData + ); + return (true, returnData, extraData, false); + } + } else { + returnData = bytes.concat(errorId, revertData); + return (false, returnData, extraData, false); + } + } + } + + /** + * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively + * removing labels until it finds a result. + * @param name The name to resolve, in DNS-encoded and normalised form. + * @return resolver The Resolver responsible for this name. + * @return namehash The namehash of the full name. + * @return finalOffset The offset of the first label with a resolver. + */ + function findResolver( + bytes calldata name + ) public view returns (Resolver, bytes32, uint256) { + ( + address resolver, + bytes32 namehash, + uint256 finalOffset + ) = findResolver(name, 0); + return (Resolver(resolver), namehash, finalOffset); + } + + function findResolver( + bytes calldata name, + uint256 offset + ) internal view returns (address, bytes32, uint256) { + uint256 labelLength = uint256(uint8(name[offset])); + if (labelLength == 0) { + return (address(0), bytes32(0), offset); + } + uint256 nextLabel = offset + labelLength + 1; + bytes32 labelHash; + if ( + labelLength == 66 && + // 0x5b == '[' + name[offset + 1] == 0x5b && + // 0x5d == ']' + name[nextLabel - 1] == 0x5d + ) { + // Encrypted label + (labelHash, ) = bytes(name[offset + 2:nextLabel - 1]) + .hexStringToBytes32(0, 64); + } else { + labelHash = keccak256(name[offset + 1:nextLabel]); + } + ( + address parentresolver, + bytes32 parentnode, + uint256 parentoffset + ) = findResolver(name, nextLabel); + bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash)); + address resolver = registry.resolver(node); + if (resolver != address(0)) { + return (resolver, node, offset); + } + return (parentresolver, node, parentoffset); + } + + function _checkInterface( + address resolver, + bytes4 interfaceId + ) internal view returns (bool) { + try + Resolver(resolver).supportsInterface{gas: 50000}(interfaceId) + returns (bool supported) { + return supported; + } catch { + return false; + } + } + + function _checkSafetyAndItem( + bytes memory name, + bytes memory item, + address resolver, + MulticallChecks memory multicallChecks + ) internal view returns (bool, bytes memory) { + if (!multicallChecks.isCallback) { + if (multicallChecks.hasExtendedResolver) { + return ( + true, + abi.encodeCall(IExtendedResolver.resolve, (name, item)) + ); + } + return (_checkInterface(resolver, bytes4(item)), item); + } + return (true, item); + } + + function _checkMulticall( + MulticallData memory multicallData + ) internal view returns (MulticallChecks memory) { + bool isCallback = multicallData.name.length == 0; + bool hasExtendedResolver = _checkInterface( + multicallData.resolver, + type(IExtendedResolver).interfaceId + ); + + if (multicallData.isWildcard && !hasExtendedResolver) { + revert ResolverWildcardNotSupported(); + } + + return MulticallChecks(isCallback, hasExtendedResolver); + } + + function _checkResolveSingle(Result memory result) internal pure { + if (!result.success) { + if (bytes4(result.returnData) == HttpError.selector) { + bytes memory returnData = result.returnData; + assembly { + revert(add(returnData, 32), mload(returnData)) + } + } + revert ResolverError(result.returnData); + } + } + + function _multicall( + MulticallData memory multicallData + ) internal view returns (Result[] memory results) { + uint256 length = multicallData.data.length; + uint256 offchainCount = 0; + OffchainLookupCallData[] + memory callDatas = new OffchainLookupCallData[](length); + OffchainLookupExtraData[] + memory extraDatas = new OffchainLookupExtraData[](length); + results = new Result[](length); + MulticallChecks memory multicallChecks = _checkMulticall(multicallData); + + for (uint256 i = 0; i < length; i++) { + bytes memory item = multicallData.data[i]; + bool failure = multicallData.failures[i]; + + if (failure) { + results[i] = Result(false, item); + continue; + } + + bool isSafe = false; + (isSafe, item) = _checkSafetyAndItem( + multicallData.name, + item, + multicallData.resolver, + multicallChecks + ); + + ( + bool offchain, + bytes memory returnData, + OffchainLookupExtraData memory extraData, + bool success + ) = callWithOffchainLookupPropagation( + multicallData.resolver, + item, + isSafe + ); + + if (offchain) { + callDatas[offchainCount] = abi.decode( + returnData, + (OffchainLookupCallData) + ); + extraDatas[i] = extraData; + offchainCount += 1; + continue; + } + + if (success && multicallChecks.hasExtendedResolver) { + // if this is a successful resolve() call, unwrap the result + returnData = abi.decode(returnData, (bytes)); + } + results[i] = Result(success, returnData); + extraDatas[i].data = item; + } + + if (offchainCount == 0) { + return results; + } + + // Trim callDatas if offchain data exists + assembly { + mstore(callDatas, offchainCount) + } + + revert OffchainLookup( + address(this), + multicallData.gateways, + abi.encodeWithSelector(BatchGateway.query.selector, callDatas), + multicallData.callbackFunction, + abi.encode( + multicallData.isWildcard, + multicallData.resolver, + multicallData.gateways, + multicallData.metaData, + extraDatas + ) + ); + } +} diff --git a/solidity/dns-contracts/contracts/wrapper/Controllable.sol b/solidity/dns-contracts/contracts/wrapper/Controllable.sol new file mode 100644 index 0000000..c4eb2db --- /dev/null +++ b/solidity/dns-contracts/contracts/wrapper/Controllable.sol @@ -0,0 +1,23 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +import "@openzeppelin/contracts/access/Ownable.sol"; + +contract Controllable is Ownable { + mapping(address => bool) public controllers; + + event ControllerChanged(address indexed controller, bool active); + + function setController(address controller, bool active) public onlyOwner { + controllers[controller] = active; + emit ControllerChanged(controller, active); + } + + modifier onlyController() { + require( + controllers[msg.sender], + "Controllable: Caller is not a controller" + ); + _; + } +} diff --git a/solidity/dns-contracts/contracts/wrapper/ERC1155Fuse.sol b/solidity/dns-contracts/contracts/wrapper/ERC1155Fuse.sol new file mode 100644 index 0000000..6cfbbc4 --- /dev/null +++ b/solidity/dns-contracts/contracts/wrapper/ERC1155Fuse.sol @@ -0,0 +1,410 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; +import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; +import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; +import "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol"; +import "@openzeppelin/contracts/utils/Address.sol"; + +/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */ + +abstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI { + using Address for address; + /** + * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. + */ + event Approval( + address indexed owner, + address indexed approved, + uint256 indexed tokenId + ); + mapping(uint256 => uint256) public _tokens; + + // Mapping from owner to operator approvals + mapping(address => mapping(address => bool)) private _operatorApprovals; + // Mapping from token ID to approved address + mapping(uint256 => address) internal _tokenApprovals; + + /************************************************************************** + * ERC721 methods + *************************************************************************/ + + function ownerOf(uint256 id) public view virtual returns (address) { + (address owner, , ) = getData(id); + return owner; + } + + /** + * @dev See {IERC721-approve}. + */ + function approve(address to, uint256 tokenId) public virtual { + address owner = ownerOf(tokenId); + require(to != owner, "ERC721: approval to current owner"); + + require( + msg.sender == owner || isApprovedForAll(owner, msg.sender), + "ERC721: approve caller is not token owner or approved for all" + ); + + _approve(to, tokenId); + } + + /** + * @dev See {IERC721-getApproved}. + */ + function getApproved( + uint256 tokenId + ) public view virtual returns (address) { + return _tokenApprovals[tokenId]; + } + + /** + * @dev See {IERC165-supportsInterface}. + */ + function supportsInterface( + bytes4 interfaceId + ) public view virtual override(ERC165, IERC165) returns (bool) { + return + interfaceId == type(IERC1155).interfaceId || + interfaceId == type(IERC1155MetadataURI).interfaceId || + super.supportsInterface(interfaceId); + } + + /** + * @dev See {IERC1155-balanceOf}. + * + * Requirements: + * + * - `account` cannot be the zero address. + */ + function balanceOf( + address account, + uint256 id + ) public view virtual override returns (uint256) { + require( + account != address(0), + "ERC1155: balance query for the zero address" + ); + address owner = ownerOf(id); + if (owner == account) { + return 1; + } + return 0; + } + + /** + * @dev See {IERC1155-balanceOfBatch}. + * + * Requirements: + * + * - `accounts` and `ids` must have the same length. + */ + function balanceOfBatch( + address[] memory accounts, + uint256[] memory ids + ) public view virtual override returns (uint256[] memory) { + require( + accounts.length == ids.length, + "ERC1155: accounts and ids length mismatch" + ); + + uint256[] memory batchBalances = new uint256[](accounts.length); + + for (uint256 i = 0; i < accounts.length; ++i) { + batchBalances[i] = balanceOf(accounts[i], ids[i]); + } + + return batchBalances; + } + + /** + * @dev See {IERC1155-setApprovalForAll}. + */ + function setApprovalForAll( + address operator, + bool approved + ) public virtual override { + require( + msg.sender != operator, + "ERC1155: setting approval status for self" + ); + + _operatorApprovals[msg.sender][operator] = approved; + emit ApprovalForAll(msg.sender, operator, approved); + } + + /** + * @dev See {IERC1155-isApprovedForAll}. + */ + function isApprovedForAll( + address account, + address operator + ) public view virtual override returns (bool) { + return _operatorApprovals[account][operator]; + } + + /** + * @dev Returns the Name's owner address and fuses + */ + function getData( + uint256 tokenId + ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) { + uint256 t = _tokens[tokenId]; + owner = address(uint160(t)); + expiry = uint64(t >> 192); + fuses = uint32(t >> 160); + } + + /** + * @dev See {IERC1155-safeTransferFrom}. + */ + function safeTransferFrom( + address from, + address to, + uint256 id, + uint256 amount, + bytes memory data + ) public virtual override { + require(to != address(0), "ERC1155: transfer to the zero address"); + require( + from == msg.sender || isApprovedForAll(from, msg.sender), + "ERC1155: caller is not owner nor approved" + ); + + _transfer(from, to, id, amount, data); + } + + /** + * @dev See {IERC1155-safeBatchTransferFrom}. + */ + function safeBatchTransferFrom( + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) public virtual override { + require( + ids.length == amounts.length, + "ERC1155: ids and amounts length mismatch" + ); + require(to != address(0), "ERC1155: transfer to the zero address"); + require( + from == msg.sender || isApprovedForAll(from, msg.sender), + "ERC1155: transfer caller is not owner nor approved" + ); + + for (uint256 i = 0; i < ids.length; ++i) { + uint256 id = ids[i]; + uint256 amount = amounts[i]; + + (address oldOwner, uint32 fuses, uint64 expiry) = getData(id); + + _beforeTransfer(id, fuses, expiry); + + require( + amount == 1 && oldOwner == from, + "ERC1155: insufficient balance for transfer" + ); + _setData(id, to, fuses, expiry); + } + + emit TransferBatch(msg.sender, from, to, ids, amounts); + + _doSafeBatchTransferAcceptanceCheck( + msg.sender, + from, + to, + ids, + amounts, + data + ); + } + + /************************************************************************** + * Internal/private methods + *************************************************************************/ + + /** + * @dev Sets the Name's owner address and fuses + */ + function _setData( + uint256 tokenId, + address owner, + uint32 fuses, + uint64 expiry + ) internal virtual { + _tokens[tokenId] = + uint256(uint160(owner)) | + (uint256(fuses) << 160) | + (uint256(expiry) << 192); + } + + function _beforeTransfer( + uint256 id, + uint32 fuses, + uint64 expiry + ) internal virtual; + + function _clearOwnerAndFuses( + address owner, + uint32 fuses, + uint64 expiry + ) internal virtual returns (address, uint32); + + function _mint( + bytes32 node, + address owner, + uint32 fuses, + uint64 expiry + ) internal virtual { + uint256 tokenId = uint256(node); + (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData( + uint256(node) + ); + + uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) & + oldFuses; + + if (oldExpiry > expiry) { + expiry = oldExpiry; + } + + if (oldExpiry >= block.timestamp) { + fuses = fuses | parentControlledFuses; + } + + require(oldOwner == address(0), "ERC1155: mint of existing token"); + require(owner != address(0), "ERC1155: mint to the zero address"); + require( + owner != address(this), + "ERC1155: newOwner cannot be the NameWrapper contract" + ); + + _setData(tokenId, owner, fuses, expiry); + emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1); + _doSafeTransferAcceptanceCheck( + msg.sender, + address(0), + owner, + tokenId, + 1, + "" + ); + } + + function _burn(uint256 tokenId) internal virtual { + (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData( + tokenId + ); + (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry); + // Clear approvals + delete _tokenApprovals[tokenId]; + // Fuses and expiry are kept on burn + _setData(tokenId, address(0x0), fuses, expiry); + emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1); + } + + function _transfer( + address from, + address to, + uint256 id, + uint256 amount, + bytes memory data + ) internal { + (address oldOwner, uint32 fuses, uint64 expiry) = getData(id); + + _beforeTransfer(id, fuses, expiry); + + require( + amount == 1 && oldOwner == from, + "ERC1155: insufficient balance for transfer" + ); + + if (oldOwner == to) { + return; + } + + _setData(id, to, fuses, expiry); + + emit TransferSingle(msg.sender, from, to, id, amount); + + _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data); + } + + function _doSafeTransferAcceptanceCheck( + address operator, + address from, + address to, + uint256 id, + uint256 amount, + bytes memory data + ) private { + if (to.isContract()) { + try + IERC1155Receiver(to).onERC1155Received( + operator, + from, + id, + amount, + data + ) + returns (bytes4 response) { + if ( + response != IERC1155Receiver(to).onERC1155Received.selector + ) { + revert("ERC1155: ERC1155Receiver rejected tokens"); + } + } catch Error(string memory reason) { + revert(reason); + } catch { + revert("ERC1155: transfer to non ERC1155Receiver implementer"); + } + } + } + + function _doSafeBatchTransferAcceptanceCheck( + address operator, + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) private { + if (to.isContract()) { + try + IERC1155Receiver(to).onERC1155BatchReceived( + operator, + from, + ids, + amounts, + data + ) + returns (bytes4 response) { + if ( + response != + IERC1155Receiver(to).onERC1155BatchReceived.selector + ) { + revert("ERC1155: ERC1155Receiver rejected tokens"); + } + } catch Error(string memory reason) { + revert(reason); + } catch { + revert("ERC1155: transfer to non ERC1155Receiver implementer"); + } + } + } + + /* ERC721 internal functions */ + + /** + * @dev Approve `to` to operate on `tokenId` + * + * Emits an {Approval} event. + */ + function _approve(address to, uint256 tokenId) internal virtual { + _tokenApprovals[tokenId] = to; + emit Approval(ownerOf(tokenId), to, tokenId); + } +} diff --git a/solidity/dns-contracts/contracts/wrapper/IMetadataService.sol b/solidity/dns-contracts/contracts/wrapper/IMetadataService.sol new file mode 100644 index 0000000..0e8cb88 --- /dev/null +++ b/solidity/dns-contracts/contracts/wrapper/IMetadataService.sol @@ -0,0 +1,6 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +interface IMetadataService { + function uri(uint256) external view returns (string memory); +} diff --git a/solidity/dns-contracts/contracts/wrapper/INameWrapper.sol b/solidity/dns-contracts/contracts/wrapper/INameWrapper.sol new file mode 100644 index 0000000..051e50d --- /dev/null +++ b/solidity/dns-contracts/contracts/wrapper/INameWrapper.sol @@ -0,0 +1,166 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +import "../registry/ENS.sol"; +import "../ethregistrar/IBaseRegistrar.sol"; +import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; +import "./IMetadataService.sol"; +import "./INameWrapperUpgrade.sol"; + +uint32 constant CANNOT_UNWRAP = 1; +uint32 constant CANNOT_BURN_FUSES = 2; +uint32 constant CANNOT_TRANSFER = 4; +uint32 constant CANNOT_SET_RESOLVER = 8; +uint32 constant CANNOT_SET_TTL = 16; +uint32 constant CANNOT_CREATE_SUBDOMAIN = 32; +uint32 constant CANNOT_APPROVE = 64; +//uint16 reserved for parent controlled fuses from bit 17 to bit 32 +uint32 constant PARENT_CANNOT_CONTROL = 1 << 16; +uint32 constant IS_DOT_CRE8OR = 1 << 17; +uint32 constant CAN_EXTEND_EXPIRY = 1 << 18; +uint32 constant CAN_DO_EVERYTHING = 0; +uint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000; +// all fuses apart from IS_DOT_ETH +uint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF; + +interface INameWrapper is IERC1155 { + event NameWrapped( + bytes32 indexed node, + bytes name, + address owner, + uint32 fuses, + uint64 expiry + ); + + event NameUnwrapped(bytes32 indexed node, address owner); + + event FusesSet(bytes32 indexed node, uint32 fuses); + event ExpiryExtended(bytes32 indexed node, uint64 expiry); + + function ens() external view returns (ENS); + + function registrar() external view returns (IBaseRegistrar); + + function metadataService() external view returns (IMetadataService); + + function names(bytes32) external view returns (bytes memory); + + function name() external view returns (string memory); + + function upgradeContract() external view returns (INameWrapperUpgrade); + + function supportsInterface(bytes4 interfaceID) external view returns (bool); + + function wrap( + bytes calldata name, + address wrappedOwner, + address resolver + ) external; + + function wrapETH2LD( + string calldata label, + address wrappedOwner, + uint16 ownerControlledFuses, + address resolver + ) external returns (uint64 expires); + + function registerAndWrapETH2LD( + string calldata label, + address wrappedOwner, + uint256 duration, + address resolver, + uint16 ownerControlledFuses + ) external returns (uint256 registrarExpiry); + + function renew( + uint256 labelHash, + uint256 duration + ) external returns (uint256 expires); + + function unwrap(bytes32 node, bytes32 label, address owner) external; + + function unwrapETH2LD( + bytes32 label, + address newRegistrant, + address newController + ) external; + + function upgrade(bytes calldata name, bytes calldata extraData) external; + + function setFuses( + bytes32 node, + uint16 ownerControlledFuses + ) external returns (uint32 newFuses); + + function setChildFuses( + bytes32 parentNode, + bytes32 labelhash, + uint32 fuses, + uint64 expiry + ) external; + + function setSubnodeRecord( + bytes32 node, + string calldata label, + address owner, + address resolver, + uint64 ttl, + uint32 fuses, + uint64 expiry + ) external returns (bytes32); + + function setRecord( + bytes32 node, + address owner, + address resolver, + uint64 ttl + ) external; + + function setSubnodeOwner( + bytes32 node, + string calldata label, + address newOwner, + uint32 fuses, + uint64 expiry + ) external returns (bytes32); + + function extendExpiry( + bytes32 node, + bytes32 labelhash, + uint64 expiry + ) external returns (uint64); + + function canModifyName( + bytes32 node, + address addr + ) external view returns (bool); + + function setResolver(bytes32 node, address resolver) external; + + function setTTL(bytes32 node, uint64 ttl) external; + + function ownerOf(uint256 id) external view returns (address owner); + + function approve(address to, uint256 tokenId) external; + + function getApproved(uint256 tokenId) external view returns (address); + + function getData( + uint256 id + ) external view returns (address, uint32, uint64); + + function setMetadataService(IMetadataService _metadataService) external; + + function uri(uint256 tokenId) external view returns (string memory); + + function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external; + + function allFusesBurned( + bytes32 node, + uint32 fuseMask + ) external view returns (bool); + + function isWrapped(bytes32) external view returns (bool); + + function isWrapped(bytes32, bytes32) external view returns (bool); +} diff --git a/solidity/dns-contracts/contracts/wrapper/INameWrapperUpgrade.sol b/solidity/dns-contracts/contracts/wrapper/INameWrapperUpgrade.sol new file mode 100644 index 0000000..9328295 --- /dev/null +++ b/solidity/dns-contracts/contracts/wrapper/INameWrapperUpgrade.sol @@ -0,0 +1,13 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +interface INameWrapperUpgrade { + function wrapFromUpgrade( + bytes calldata name, + address wrappedOwner, + uint32 fuses, + uint64 expiry, + address approved, + bytes calldata extraData + ) external; +} diff --git a/solidity/dns-contracts/contracts/wrapper/NameWrapper.sol b/solidity/dns-contracts/contracts/wrapper/NameWrapper.sol new file mode 100644 index 0000000..0548cc4 --- /dev/null +++ b/solidity/dns-contracts/contracts/wrapper/NameWrapper.sol @@ -0,0 +1,1092 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +import {ERC1155Fuse, IERC165, IERC1155MetadataURI} from "./ERC1155Fuse.sol"; +import {Controllable} from "./Controllable.sol"; +import {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_CRE8OR, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from "./INameWrapper.sol"; +import {INameWrapperUpgrade} from "./INameWrapperUpgrade.sol"; +import {IMetadataService} from "./IMetadataService.sol"; +import {ENS} from "../registry/ENS.sol"; +import {Resolver} from "../resolvers/Resolver.sol"; +import {IReverseRegistrar} from "../reverseRegistrar/IReverseRegistrar.sol"; +import {ReverseClaimer} from "../reverseRegistrar/ReverseClaimer.sol"; +import {IBaseRegistrar} from "../ethregistrar/IBaseRegistrar.sol"; +import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; +import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; +import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; +import {BytesUtils} from "../utils/BytesUtils.sol"; +import {ERC20Recoverable} from "../utils/ERC20Recoverable.sol"; + +error Unauthorised(bytes32 node, address addr); +error IncompatibleParent(); +error IncorrectTokenType(); +error LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash); +error LabelTooShort(); +error LabelTooLong(string label); +error IncorrectTargetOwner(address owner); +error CannotUpgrade(); +error OperationProhibited(bytes32 node); +error NameIsNotWrapped(); +error NameIsStillExpired(); + +contract NameWrapper is + Ownable, + ERC1155Fuse, + INameWrapper, + Controllable, + IERC721Receiver, + ERC20Recoverable, + ReverseClaimer +{ + using BytesUtils for bytes; + + ENS public immutable ens; + IBaseRegistrar public immutable registrar; + IMetadataService public metadataService; + mapping(bytes32 => bytes) public names; + string public constant name = "NameWrapper"; + + uint64 private constant GRACE_PERIOD = 30 days; + bytes32 private constant CRE8OR_NODE = + 0x4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454; + + bytes32 private constant CRE8OR_LABELHASH = + 0x0d1f301a4d55e328cfe2f78743e489a98cedaf66d744b3ab1bb877ff82930b0b; + bytes32 private constant ROOT_NODE = + 0x0000000000000000000000000000000000000000000000000000000000000000; + + INameWrapperUpgrade public upgradeContract; + uint64 private constant MAX_EXPIRY = type(uint64).max; + + constructor( + ENS _ens, + IBaseRegistrar _registrar, + IMetadataService _metadataService + ) ReverseClaimer(_ens, msg.sender) { + ens = _ens; + registrar = _registrar; + metadataService = _metadataService; + + /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and CRE8OR_NODE and set expiry to max */ + + _setData( + uint256(CRE8OR_NODE), + address(0), + uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP), + MAX_EXPIRY + ); + _setData( + uint256(ROOT_NODE), + address(0), + uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP), + MAX_EXPIRY + ); + names[ROOT_NODE] = "\x00"; + names[CRE8OR_NODE] = "\x07creator\x00"; + } + + function supportsInterface( + bytes4 interfaceId + ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) { + return + interfaceId == type(INameWrapper).interfaceId || + interfaceId == type(IERC721Receiver).interfaceId || + super.supportsInterface(interfaceId); + } + + /* ERC1155 Fuse */ + + /// @notice Gets the owner of a name + /// @param id Label as a string of the .eth domain to wrap + /// @return owner The owner of the name + function ownerOf( + uint256 id + ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) { + return super.ownerOf(id); + } + + /// @notice Gets the owner of a name + /// @param id Namehash of the name + /// @return operator Approved operator of a name + function getApproved( + uint256 id + ) + public + view + override(ERC1155Fuse, INameWrapper) + returns (address operator) + { + address owner = ownerOf(id); + if (owner == address(0)) { + return address(0); + } + return super.getApproved(id); + } + + /// @notice Approves an address for a name + /// @param to address to approve + /// @param tokenId name to approve + function approve( + address to, + uint256 tokenId + ) public override(ERC1155Fuse, INameWrapper) { + (, uint32 fuses, ) = getData(tokenId); + if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) { + revert OperationProhibited(bytes32(tokenId)); + } + super.approve(to, tokenId); + } + + /// @notice Gets the data for a name + /// @param id Namehash of the name + /// @return owner Owner of the name + /// @return fuses Fuses of the name + /// @return expiry Expiry of the name + function getData( + uint256 id + ) + public + view + override(ERC1155Fuse, INameWrapper) + returns (address owner, uint32 fuses, uint64 expiry) + { + (owner, fuses, expiry) = super.getData(id); + + (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry); + } + + /* Metadata service */ + + /// @notice Set the metadata service. Only the owner can do this + /// @param _metadataService The new metadata service + function setMetadataService( + IMetadataService _metadataService + ) public onlyOwner { + metadataService = _metadataService; + } + + /// @notice Get the metadata uri + /// @param tokenId The id of the token + /// @return string uri of the metadata service + function uri( + uint256 tokenId + ) + public + view + override(INameWrapper, IERC1155MetadataURI) + returns (string memory) + { + return metadataService.uri(tokenId); + } + + /// @notice Set the address of the upgradeContract of the contract. only admin can do this + /// @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time + /// to make the contract not upgradable. + /// @param _upgradeAddress address of an upgraded contract + function setUpgradeContract( + INameWrapperUpgrade _upgradeAddress + ) public onlyOwner { + if (address(upgradeContract) != address(0)) { + registrar.setApprovalForAll(address(upgradeContract), false); + ens.setApprovalForAll(address(upgradeContract), false); + } + + upgradeContract = _upgradeAddress; + + if (address(upgradeContract) != address(0)) { + registrar.setApprovalForAll(address(upgradeContract), true); + ens.setApprovalForAll(address(upgradeContract), true); + } + } + + /// @notice Checks if msg.sender is the owner or operator of the owner of a name + /// @param node namehash of the name to check + modifier onlyTokenOwner(bytes32 node) { + if (!canModifyName(node, msg.sender)) { + revert Unauthorised(node, msg.sender); + } + + _; + } + + /// @notice Checks if owner or operator of the owner + /// @param node namehash of the name to check + /// @param addr which address to check permissions for + /// @return whether or not is owner or operator + function canModifyName( + bytes32 node, + address addr + ) public view returns (bool) { + (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node)); + return + (owner == addr || isApprovedForAll(owner, addr)) && + !_isETH2LDInGracePeriod(fuses, expiry); + } + + /// @notice Checks if owner/operator or approved by owner + /// @param node namehash of the name to check + /// @param addr which address to check permissions for + /// @return whether or not is owner/operator or approved + function canExtendSubnames( + bytes32 node, + address addr + ) public view returns (bool) { + (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node)); + return + (owner == addr || + isApprovedForAll(owner, addr) || + getApproved(uint256(node)) == addr) && + !_isETH2LDInGracePeriod(fuses, expiry); + } + + /// @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract + /// @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar + /// @param label Label as a string of the .eth domain to wrap + /// @param wrappedOwner Owner of the name in this contract + /// @param ownerControlledFuses Initial owner-controlled fuses to set + /// @param resolver Resolver contract address + function wrapETH2LD( + string calldata label, + address wrappedOwner, + uint16 ownerControlledFuses, + address resolver + ) public returns (uint64 expiry) { + uint256 tokenId = uint256(keccak256(bytes(label))); + address registrant = registrar.ownerOf(tokenId); + if ( + registrant != msg.sender && + !registrar.isApprovedForAll(registrant, msg.sender) + ) { + revert Unauthorised( + _makeNode(CRE8OR_NODE, bytes32(tokenId)), + msg.sender + ); + } + + // transfer the token from the user to this contract + registrar.transferFrom(registrant, address(this), tokenId); + + // transfer the ens record back to the new owner (this contract) + registrar.reclaim(tokenId, address(this)); + + expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD; + + _wrapETH2LD( + label, + wrappedOwner, + ownerControlledFuses, + expiry, + resolver + ); + } + + /// @dev Registers a new .eth second-level domain and wraps it. + /// Only callable by authorised controllers. + /// @param label The label to register (Eg, 'foo' for 'foo.eth'). + /// @param wrappedOwner The owner of the wrapped name. + /// @param duration The duration, in seconds, to register the name for. + /// @param resolver The resolver address to set on the ENS registry (optional). + /// @param ownerControlledFuses Initial owner-controlled fuses to set + /// @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch. + function registerAndWrapETH2LD( + string calldata label, + address wrappedOwner, + uint256 duration, + address resolver, + uint16 ownerControlledFuses + ) external onlyController returns (uint256 registrarExpiry) { + uint256 tokenId = uint256(keccak256(bytes(label))); + registrarExpiry = registrar.register(tokenId, address(this), duration); + _wrapETH2LD( + label, + wrappedOwner, + ownerControlledFuses, + uint64(registrarExpiry) + GRACE_PERIOD, + resolver + ); + } + + /// @notice Renews a .eth second-level domain. + /// @dev Only callable by authorised controllers. + /// @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth'). + /// @param duration The number of seconds to renew the name for. + /// @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch. + function renew( + uint256 tokenId, + uint256 duration + ) external onlyController returns (uint256 expires) { + bytes32 node = _makeNode(CRE8OR_NODE, bytes32(tokenId)); + + uint256 registrarExpiry = registrar.renew(tokenId, duration); + + // Do not set anything in wrapper if name is not wrapped + try registrar.ownerOf(tokenId) returns (address registrarOwner) { + if ( + registrarOwner != address(this) || + ens.owner(node) != address(this) + ) { + return registrarExpiry; + } + } catch { + return registrarExpiry; + } + + // Set expiry in Wrapper + uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD; + + // Use super to allow names expired on the wrapper, but not expired on the registrar to renew() + (address owner, uint32 fuses, ) = super.getData(uint256(node)); + _setData(node, owner, fuses, expiry); + + return registrarExpiry; + } + + /// @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain + /// @dev Can be called by the owner in the registry or an authorised caller in the registry + /// @param name The name to wrap, in DNS format + /// @param wrappedOwner Owner of the name in this contract + /// @param resolver Resolver contract + function wrap( + bytes calldata name, + address wrappedOwner, + address resolver + ) public { + (bytes32 labelhash, uint256 offset) = name.readLabel(0); + bytes32 parentNode = name.namehash(offset); + bytes32 node = _makeNode(parentNode, labelhash); + + names[node] = name; + + if (parentNode == CRE8OR_NODE) { + revert IncompatibleParent(); + } + + address owner = ens.owner(node); + + if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) { + revert Unauthorised(node, msg.sender); + } + + if (resolver != address(0)) { + ens.setResolver(node, resolver); + } + + ens.setOwner(node, address(this)); + + _wrap(node, name, wrappedOwner, 0, 0); + } + + /// @notice Unwraps a .eth domain. e.g. vitalik.eth + /// @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper + /// @param labelhash Labelhash of the .eth domain + /// @param registrant Sets the owner in the .eth registrar to this address + /// @param controller Sets the owner in the registry to this address + function unwrapETH2LD( + bytes32 labelhash, + address registrant, + address controller + ) public onlyTokenOwner(_makeNode(CRE8OR_NODE, labelhash)) { + if (registrant == address(this)) { + revert IncorrectTargetOwner(registrant); + } + _unwrap(_makeNode(CRE8OR_NODE, labelhash), controller); + registrar.safeTransferFrom( + address(this), + registrant, + uint256(labelhash) + ); + } + + /// @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain + /// @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper + /// @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz') + /// @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik') + /// @param controller Sets the owner in the registry to this address + function unwrap( + bytes32 parentNode, + bytes32 labelhash, + address controller + ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) { + if (parentNode == CRE8OR_NODE) { + revert IncompatibleParent(); + } + if (controller == address(0x0) || controller == address(this)) { + revert IncorrectTargetOwner(controller); + } + _unwrap(_makeNode(parentNode, labelhash), controller); + } + + /// @notice Sets fuses of a name + /// @param node Namehash of the name + /// @param ownerControlledFuses Owner-controlled fuses to burn + /// @return Old fuses + function setFuses( + bytes32 node, + uint16 ownerControlledFuses + ) + public + onlyTokenOwner(node) + operationAllowed(node, CANNOT_BURN_FUSES) + returns (uint32) + { + // owner protected by onlyTokenOwner + (address owner, uint32 oldFuses, uint64 expiry) = getData( + uint256(node) + ); + _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry); + return oldFuses; + } + + /// @notice Extends expiry for a name + /// @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz') + /// @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik') + /// @param expiry When the name will expire in seconds since the Unix epoch + /// @return New expiry + function extendExpiry( + bytes32 parentNode, + bytes32 labelhash, + uint64 expiry + ) public returns (uint64) { + bytes32 node = _makeNode(parentNode, labelhash); + + if (!_isWrapped(node)) { + revert NameIsNotWrapped(); + } + + // this flag is used later, when checking fuses + bool canExtendSubname = canExtendSubnames(parentNode, msg.sender); + // only allow the owner of the name or owner of the parent name + if (!canExtendSubname && !canModifyName(node, msg.sender)) { + revert Unauthorised(node, msg.sender); + } + + (address owner, uint32 fuses, uint64 oldExpiry) = getData( + uint256(node) + ); + + // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name + if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) { + revert OperationProhibited(node); + } + + // Max expiry is set to the expiry of the parent + (, , uint64 maxExpiry) = getData(uint256(parentNode)); + expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry); + + _setData(node, owner, fuses, expiry); + emit ExpiryExtended(node, expiry); + return expiry; + } + + /// @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain + /// @dev Can be called by the owner or an authorised caller + /// @param name The name to upgrade, in DNS format + /// @param extraData Extra data to pass to the upgrade contract + function upgrade(bytes calldata name, bytes calldata extraData) public { + bytes32 node = name.namehash(0); + + if (address(upgradeContract) == address(0)) { + revert CannotUpgrade(); + } + + if (!canModifyName(node, msg.sender)) { + revert Unauthorised(node, msg.sender); + } + + (address currentOwner, uint32 fuses, uint64 expiry) = getData( + uint256(node) + ); + + address approved = getApproved(uint256(node)); + + _burn(uint256(node)); + + upgradeContract.wrapFromUpgrade( + name, + currentOwner, + fuses, + expiry, + approved, + extraData + ); + } + + /// /* @notice Sets fuses of a name that you own the parent of + /// @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz') + /// @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik') + /// @param fuses Fuses to burn + /// @param expiry When the name will expire in seconds since the Unix epoch + function setChildFuses( + bytes32 parentNode, + bytes32 labelhash, + uint32 fuses, + uint64 expiry + ) public { + bytes32 node = _makeNode(parentNode, labelhash); + _checkFusesAreSettable(node, fuses); + (address owner, uint32 oldFuses, uint64 oldExpiry) = getData( + uint256(node) + ); + if (owner == address(0) || ens.owner(node) != address(this)) { + revert NameIsNotWrapped(); + } + // max expiry is set to the expiry of the parent + (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode)); + if (parentNode == ROOT_NODE) { + if (!canModifyName(node, msg.sender)) { + revert Unauthorised(node, msg.sender); + } + } else { + if (!canModifyName(parentNode, msg.sender)) { + revert Unauthorised(parentNode, msg.sender); + } + } + + _checkParentFuses(node, fuses, parentFuses); + + expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry); + + // if PARENT_CANNOT_CONTROL has been burned and fuses have changed + if ( + oldFuses & PARENT_CANNOT_CONTROL != 0 && + oldFuses | fuses != oldFuses + ) { + revert OperationProhibited(node); + } + fuses |= oldFuses; + _setFuses(node, owner, fuses, oldExpiry, expiry); + } + + /// @notice Sets the subdomain owner in the registry and then wraps the subdomain + /// @param parentNode Parent namehash of the subdomain + /// @param label Label of the subdomain as a string + /// @param owner New owner in the wrapper + /// @param fuses Initial fuses for the wrapped subdomain + /// @param expiry When the name will expire in seconds since the Unix epoch + /// @return node Namehash of the subdomain + function setSubnodeOwner( + bytes32 parentNode, + string calldata label, + address owner, + uint32 fuses, + uint64 expiry + ) public onlyTokenOwner(parentNode) returns (bytes32 node) { + bytes32 labelhash = keccak256(bytes(label)); + node = _makeNode(parentNode, labelhash); + _checkCanCallSetSubnodeOwner(parentNode, node); + _checkFusesAreSettable(node, fuses); + bytes memory name = _saveLabel(parentNode, node, label); + expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry); + + if (!_isWrapped(node)) { + ens.setSubnodeOwner(parentNode, labelhash, address(this)); + _wrap(node, name, owner, fuses, expiry); + } else { + _updateName(parentNode, node, label, owner, fuses, expiry); + } + } + + /// @notice Sets the subdomain owner in the registry with records and then wraps the subdomain + /// @param parentNode parent namehash of the subdomain + /// @param label label of the subdomain as a string + /// @param owner new owner in the wrapper + /// @param resolver resolver contract in the registry + /// @param ttl ttl in the registry + /// @param fuses initial fuses for the wrapped subdomain + /// @param expiry When the name will expire in seconds since the Unix epoch + /// @return node Namehash of the subdomain + function setSubnodeRecord( + bytes32 parentNode, + string memory label, + address owner, + address resolver, + uint64 ttl, + uint32 fuses, + uint64 expiry + ) public onlyTokenOwner(parentNode) returns (bytes32 node) { + bytes32 labelhash = keccak256(bytes(label)); + node = _makeNode(parentNode, labelhash); + _checkCanCallSetSubnodeOwner(parentNode, node); + _checkFusesAreSettable(node, fuses); + _saveLabel(parentNode, node, label); + expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry); + if (!_isWrapped(node)) { + ens.setSubnodeRecord( + parentNode, + labelhash, + address(this), + resolver, + ttl + ); + _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry); + } else { + ens.setSubnodeRecord( + parentNode, + labelhash, + address(this), + resolver, + ttl + ); + _updateName(parentNode, node, label, owner, fuses, expiry); + } + } + + /// @notice Sets records for the name in the ENS Registry + /// @param node Namehash of the name to set a record for + /// @param owner New owner in the registry + /// @param resolver Resolver contract + /// @param ttl Time to live in the registry + function setRecord( + bytes32 node, + address owner, + address resolver, + uint64 ttl + ) + public + onlyTokenOwner(node) + operationAllowed( + node, + CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL + ) + { + ens.setRecord(node, address(this), resolver, ttl); + if (owner == address(0)) { + (, uint32 fuses, ) = getData(uint256(node)); + if (fuses & IS_DOT_CRE8OR == IS_DOT_CRE8OR) { + revert IncorrectTargetOwner(owner); + } + _unwrap(node, address(0)); + } else { + address oldOwner = ownerOf(uint256(node)); + _transfer(oldOwner, owner, uint256(node), 1, ""); + } + } + + /// @notice Sets resolver contract in the registry + /// @param node namehash of the name + /// @param resolver the resolver contract + function setResolver( + bytes32 node, + address resolver + ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) { + ens.setResolver(node, resolver); + } + + /// @notice Sets TTL in the registry + /// @param node Namehash of the name + /// @param ttl TTL in the registry + function setTTL( + bytes32 node, + uint64 ttl + ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) { + ens.setTTL(node, ttl); + } + + /// @dev Allows an operation only if none of the specified fuses are burned. + /// @param node The namehash of the name to check fuses on. + /// @param fuseMask A bitmask of fuses that must not be burned. + modifier operationAllowed(bytes32 node, uint32 fuseMask) { + (, uint32 fuses, ) = getData(uint256(node)); + if (fuses & fuseMask != 0) { + revert OperationProhibited(node); + } + _; + } + + /// @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord + /// @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt + /// and checks whether the owner of the subdomain is 0x0 for creating or already exists for + /// replacing a subdomain. If either conditions are true, then it is possible to call + /// setSubnodeOwner + /// @param parentNode Namehash of the parent name to check + /// @param subnode Namehash of the subname to check + function _checkCanCallSetSubnodeOwner( + bytes32 parentNode, + bytes32 subnode + ) internal view { + ( + address subnodeOwner, + uint32 subnodeFuses, + uint64 subnodeExpiry + ) = getData(uint256(subnode)); + + // check if the registry owner is 0 and expired + // check if the wrapper owner is 0 and expired + // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN + bool expired = subnodeExpiry < block.timestamp; + if ( + expired && + // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired + (subnodeOwner == address(0) || + // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired + ens.owner(subnode) == address(0)) + ) { + (, uint32 parentFuses, ) = getData(uint256(parentNode)); + if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) { + revert OperationProhibited(subnode); + } + } else { + if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) { + revert OperationProhibited(subnode); + } + } + } + + /// @notice Checks all Fuses in the mask are burned for the node + /// @param node Namehash of the name + /// @param fuseMask The fuses you want to check + /// @return Boolean of whether or not all the selected fuses are burned + function allFusesBurned( + bytes32 node, + uint32 fuseMask + ) public view returns (bool) { + (, uint32 fuses, ) = getData(uint256(node)); + return fuses & fuseMask == fuseMask; + } + + /// @notice Checks if a name is wrapped + /// @param node Namehash of the name + /// @return Boolean of whether or not the name is wrapped + function isWrapped(bytes32 node) public view returns (bool) { + bytes memory name = names[node]; + if (name.length == 0) { + return false; + } + (bytes32 labelhash, uint256 offset) = name.readLabel(0); + bytes32 parentNode = name.namehash(offset); + return isWrapped(parentNode, labelhash); + } + + /// @notice Checks if a name is wrapped in a more gas efficient way + /// @param parentNode Namehash of the name + /// @param labelhash Namehash of the name + /// @return Boolean of whether or not the name is wrapped + function isWrapped( + bytes32 parentNode, + bytes32 labelhash + ) public view returns (bool) { + bytes32 node = _makeNode(parentNode, labelhash); + bool wrapped = _isWrapped(node); + if (parentNode != CRE8OR_NODE) { + return wrapped; + } + try registrar.ownerOf(uint256(labelhash)) returns (address owner) { + return owner == address(this); + } catch { + return false; + } + } + + function onERC721Received( + address to, + address, + uint256 tokenId, + bytes calldata data + ) public returns (bytes4) { + //check if it's the eth registrar ERC721 + if (msg.sender != address(registrar)) { + revert IncorrectTokenType(); + } + + ( + string memory label, + address owner, + uint16 ownerControlledFuses, + address resolver + ) = abi.decode(data, (string, address, uint16, address)); + + bytes32 labelhash = bytes32(tokenId); + bytes32 labelhashFromData = keccak256(bytes(label)); + + if (labelhashFromData != labelhash) { + revert LabelMismatch(labelhashFromData, labelhash); + } + + // transfer the ens record back to the new owner (this contract) + registrar.reclaim(uint256(labelhash), address(this)); + + uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD; + + _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver); + + return IERC721Receiver(to).onERC721Received.selector; + } + + /***** Internal functions */ + + function _beforeTransfer( + uint256 id, + uint32 fuses, + uint64 expiry + ) internal override { + // For this check, treat .eth 2LDs as expiring at the start of the grace period. + if (fuses & IS_DOT_CRE8OR == IS_DOT_CRE8OR) { + expiry -= GRACE_PERIOD; + } + + if (expiry < block.timestamp) { + // Transferable if the name was not emancipated + if (fuses & PARENT_CANNOT_CONTROL != 0) { + revert("ERC1155: insufficient balance for transfer"); + } + } else { + // Transferable if CANNOT_TRANSFER is unburned + if (fuses & CANNOT_TRANSFER != 0) { + revert OperationProhibited(bytes32(id)); + } + } + + // delete token approval if CANNOT_APPROVE has not been burnt + if (fuses & CANNOT_APPROVE == 0) { + delete _tokenApprovals[id]; + } + } + + function _clearOwnerAndFuses( + address owner, + uint32 fuses, + uint64 expiry + ) internal view override returns (address, uint32) { + if (expiry < block.timestamp) { + if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) { + owner = address(0); + } + fuses = 0; + } + + return (owner, fuses); + } + + function _makeNode( + bytes32 node, + bytes32 labelhash + ) private pure returns (bytes32) { + return keccak256(abi.encodePacked(node, labelhash)); + } + + function _addLabel( + string memory label, + bytes memory name + ) internal pure returns (bytes memory ret) { + if (bytes(label).length < 1) { + revert LabelTooShort(); + } + if (bytes(label).length > 255) { + revert LabelTooLong(label); + } + return abi.encodePacked(uint8(bytes(label).length), label, name); + } + + function _mint( + bytes32 node, + address owner, + uint32 fuses, + uint64 expiry + ) internal override { + _canFusesBeBurned(node, fuses); + (address oldOwner, , ) = super.getData(uint256(node)); + if (oldOwner != address(0)) { + // burn and unwrap old token of old owner + _burn(uint256(node)); + emit NameUnwrapped(node, address(0)); + } + super._mint(node, owner, fuses, expiry); + } + + function _wrap( + bytes32 node, + bytes memory name, + address wrappedOwner, + uint32 fuses, + uint64 expiry + ) internal { + _mint(node, wrappedOwner, fuses, expiry); + emit NameWrapped(node, name, wrappedOwner, fuses, expiry); + } + + function _storeNameAndWrap( + bytes32 parentNode, + bytes32 node, + string memory label, + address owner, + uint32 fuses, + uint64 expiry + ) internal { + bytes memory name = _addLabel(label, names[parentNode]); + _wrap(node, name, owner, fuses, expiry); + } + + function _saveLabel( + bytes32 parentNode, + bytes32 node, + string memory label + ) internal returns (bytes memory) { + bytes memory name = _addLabel(label, names[parentNode]); + names[node] = name; + return name; + } + + function _updateName( + bytes32 parentNode, + bytes32 node, + string memory label, + address owner, + uint32 fuses, + uint64 expiry + ) internal { + (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData( + uint256(node) + ); + bytes memory name = _addLabel(label, names[parentNode]); + if (names[node].length == 0) { + names[node] = name; + } + _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry); + if (owner == address(0)) { + _unwrap(node, address(0)); + } else { + _transfer(oldOwner, owner, uint256(node), 1, ""); + } + } + + // wrapper function for stack limit + function _checkParentFusesAndExpiry( + bytes32 parentNode, + bytes32 node, + uint32 fuses, + uint64 expiry + ) internal view returns (uint64) { + (, , uint64 oldExpiry) = getData(uint256(node)); + (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode)); + _checkParentFuses(node, fuses, parentFuses); + return _normaliseExpiry(expiry, oldExpiry, maxExpiry); + } + + function _checkParentFuses( + bytes32 node, + uint32 fuses, + uint32 parentFuses + ) internal pure { + bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES != + 0; + + bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0; + + if (isBurningParentControlledFuses && parentHasNotBurnedCU) { + revert OperationProhibited(node); + } + } + + function _normaliseExpiry( + uint64 expiry, + uint64 oldExpiry, + uint64 maxExpiry + ) private pure returns (uint64) { + // Expiry cannot be more than maximum allowed + // .eth names will check registrar, non .eth check parent + if (expiry > maxExpiry) { + expiry = maxExpiry; + } + // Expiry cannot be less than old expiry + if (expiry < oldExpiry) { + expiry = oldExpiry; + } + + return expiry; + } + + function _wrapETH2LD( + string memory label, + address wrappedOwner, + uint32 fuses, + uint64 expiry, + address resolver + ) private { + bytes32 labelhash = keccak256(bytes(label)); + bytes32 node = _makeNode(CRE8OR_NODE, labelhash); + // hardcode dns-encoded eth string for gas savings + bytes memory name = _addLabel(label, "\x07creator\x00"); + names[node] = name; + + _wrap( + node, + name, + wrappedOwner, + fuses | PARENT_CANNOT_CONTROL | IS_DOT_CRE8OR, + expiry + ); + + if (resolver != address(0)) { + ens.setResolver(node, resolver); + } + } + + function _unwrap(bytes32 node, address owner) private { + if (allFusesBurned(node, CANNOT_UNWRAP)) { + revert OperationProhibited(node); + } + + // Burn token and fuse data + _burn(uint256(node)); + ens.setOwner(node, owner); + + emit NameUnwrapped(node, owner); + } + + function _setFuses( + bytes32 node, + address owner, + uint32 fuses, + uint64 oldExpiry, + uint64 expiry + ) internal { + _setData(node, owner, fuses, expiry); + emit FusesSet(node, fuses); + if (expiry > oldExpiry) { + emit ExpiryExtended(node, expiry); + } + } + + function _setData( + bytes32 node, + address owner, + uint32 fuses, + uint64 expiry + ) internal { + _canFusesBeBurned(node, fuses); + super._setData(uint256(node), owner, fuses, expiry); + } + + function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure { + // If a non-parent controlled fuse is being burned, check PCC and CU are burnt + if ( + fuses & ~PARENT_CONTROLLED_FUSES != 0 && + fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) != + (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) + ) { + revert OperationProhibited(node); + } + } + + function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure { + if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) { + // Cannot directly burn other non-user settable fuses + revert OperationProhibited(node); + } + } + + function _isWrapped(bytes32 node) internal view returns (bool) { + return + ownerOf(uint256(node)) != address(0) && + ens.owner(node) == address(this); + } + + function _isETH2LDInGracePeriod( + uint32 fuses, + uint64 expiry + ) internal view returns (bool) { + return + fuses & IS_DOT_CRE8OR == IS_DOT_CRE8OR && + expiry - GRACE_PERIOD < block.timestamp; + } +} diff --git a/solidity/dns-contracts/contracts/wrapper/README.md b/solidity/dns-contracts/contracts/wrapper/README.md new file mode 100644 index 0000000..d189087 --- /dev/null +++ b/solidity/dns-contracts/contracts/wrapper/README.md @@ -0,0 +1,505 @@ +# NameWrapper docs + +The NameWrapper wraps ENS names, adding new functionality to them: + +- Makes all ENS names at any level into ERC1155 tokens. +- Supports 'emancipating' names by allowing the owner of a parent name to revoke control over subdomains. +- Supports 'locking' names by allowing the owner of a name to revoke control over changes in resolver, creation of subdomains, and other parameters. +- Wrapped names can expire; a name that is emancipated or locked has a built in expiration at which the name (and that status) expires. +- UIs and Smart Contracts can check the status of a name with a single function call, allowing them to ensure security guarantees are upheld. +- .eth names can be registered and renewed via the wrapper, removing any need to wrap names separately after registration. +- Owners of names can create wrapped subdomains directly, without having to register-then-wrap. + +## Glossary of terms + +- Wrap - Transfers ownership of the ENS name to the Name Wrapper. The wrapper then issues an ERC1155 token for the name. +- Unwrap - Reverses the wrap process and transfers the name to an address of the token owner's choice. +- Fuse - The term for a flag that can be set irreversibly until expiry. Fuses can do many things, including controlling permissions for the name itself. +- Emancipation - The process of the owner of a parent name revoking its control over a subname. +- Locking - The process of the owner of a name revoking some level of control over its own name. +- Owner-controlled fuses - Fuses that can be burned by the owner of a name or the owner of the parent name if the name is not emancipated. +- Parent-controlled fuses - Fuses that can be burned by the owner of the parent name. +- Expiry - Expiry is the date when the name expires and is no longer able to be owned. Expiry only comes into effect when a name is emancipated or locked. Expiry can be extended by parent or approved addresses, and if the parent burnt the parent controlled fuses(PCF), then the subnames can extend their expiry by themselves. However, the PCF can be unburnt later if the parent name expires. For the latest update, refer to: https://discuss.ens.domains/t/namewrapper-updates-including-testnet-deployment-addresses/14505/48 + +## Lifecycle of a name + +The behaviour of names and the name wrapper is best thought of in terms of a state machine, whose states names proceed through over their lifecycles: + +```mermaid +graph TD; + unregistered((Unregistered)); + unwrapped(Unwrapped); + wrapped(Wrapped); + emancipated(Emancipated); + locked(Locked); + unregistered--->|register|unwrapped; + unwrapped--->|wrap|wrapped; + wrapped--->|unwrap|unwrapped; + wrapped--->|protect|emancipated; + emancipated--->|lock|locked; + emancipated--->|unwrap|unwrapped; + emancipated--->|expire|unregistered; + locked-->|expire|unregistered; +``` + +State transitions are facilitated by functions on the name wrapper and registrar controller contracts. One function can potentially move a name through multiple states - for example, calling `registerAndWrapETH2LD()` will register a .eth second-level name, wrap it, and emancipate it, moving it from `[Unregistered]` to `Emancipated` state in a single call. + +Some state transitions are irrevocable; once a name is Emancipated or Locked, it can only return to being Wrapped or Unwrapped after it expires. + +### Name States + +#### Unregistered + +Names start out in the unregistered state before they are registered, and return to it after they expire. + +To check if a name is Unregistered, verify that `NameWrapper.ownerOf` returns `address(0)` and `Registry.owner` returns either `address(0)` or the address of the NameWrapper contract. + +#### Unwrapped + +A name that is registered but not managed by the name wrapper is Unwrapped. + +Unwrapped names do not expire, with the exception of .eth second-level names, which have behaviour enforced by the .eth registrar. + +To check if a name is Unwrapped, verify that `NameWrapper.ownerOf` returns `address(0)` and `Registry.owner` returns any address except for `address(0)` or the address of the NameWrapper contract. + +#### Wrapped + +Wrapping an Unwrapped name makes it Wrapped. Wrapped names are managed by the name wrapper, and have ERC1155 tokens, but can be unwrapped at any time, and have no special protections over and above an unwrapped name - for example, the owner of the parent name can still make changes to the name or take back ownership. + +Wrapped names do not expire, with the exception of .eth second-level names, which have behaviour enforced by the .eth registrar, and have a wrapper expiry equal to the end of the name's grace period. + +To check if a name is Wrapped, verify that `NameWrapper.ownerOf(node)` does not return `address(0)`, `Registry.owner` is the NameWrapper contract and if it's a .eth name `registrar.ownerOf(labelhash)` must be the NameWrapper contract. If any of these are false, the name should be consider unwrapped. + +#### Emancipated + +An Emancipated name provides the assurance that the owner of the parent name cannot affect it in any way until it expires. + +A name is Emancipated when the owner of the parent domain gives up control over it. They do this by setting an expiration date - which can be extended at any time - and burning the `PARENT_CANNOT_CONTROL` fuse over the name. To do this, the parent name must already be in the `Locked` state. + +.eth second-level names are automatically Emancipated when wrapped, and their expiry is fixed at the end of the grace period in the .eth registrar. + +An Emancipated name can be unwrapped - but when it is wrapped again it will automatically return to the `Emancipated` state. + +When the expiration set by the owner of the parent domain is reached, the name expires and moves to the `Unregistered` state. + +To check if a name is Emancipated, verify that the `PARENT_CANNOT_CONTROL` fuse is burned, and the `CANNOT_UNWRAP` fuse is not. + +#### Locked + +A Locked name provides the assurance that neither the owner of the name nor the owner of any parent name can affect it until it expires. + +A name is Locked when the owner of the name revokes their ability to unwrap the name. Only Emancipated names can be Locked, and Locking is a prerequisite for Emancipating subnames. A name can also be optionally locked when a parent emancipates a name, by burning both `PARENT_CANNOT_CONTROL` and `CANNOT_UNWRAP` + +Additional permissions over a name can be revoked, such as the ability to create subdomains or set the resolver, and Locking is a prerequisite for revoking these permissions as well. + +To check if a name is Locked, verify that the `CANNOT_UNWRAP` fuse is burned. + +## Expiry + +The NameWrapper tracks an expiration time for each name. Expiry of names is not enabled by default. This means you can leave expiry at 0 or a number less than `block.timestamp` and the name will have an owner and be able to set records. Expiry causes fuses to reset for any wrapped name. However the name itself will only expire if it is in the Emancipated or Locked state. + +For all wrapped names, the following change happens when the expiry has been reached: + +- The NameWrapper treats all fuses as unset and returns uint32(0) from `getData()` for fuses. + +In addition, if the name is Emancipated or Locked, the following change happens when the expiry has been reached: + +- The NameWrapper returns `address(0)` as the name owner from `ownerOf()` or `getData()`. + +If a name is Wrapped (but not Emancipated or Locked), then the expiry will only cause parent-controlled fuses to reset, and otherwise has no practical effect on the name. + +.eth names derive their expiry from the .eth registrar; the wrapper's expiry is set to the end of the name's grace period. A name that is extended using the Name Wrapper aware .eth registrar controller calling `renew()` or wrapped using `wrapETH2LD()`, the name's expiry will **sync** the wrapper expiry to the .eth registrar expiry. At the expiry date, the .eth name will be frozen for the entirety of the grace period. This includes all functionality that checks the owner, but does not affect its subdomains. If the name is renewed by a wrapper unaware .eth registrar controller, the wrapper expiry of the name will remain in the same expired state and will not sync. + +Expiry can be extended using the following functions: + +- `setChildFuses()` +- `setSubnodeOwner()` +- `setSubnodeRecord()` +- `renew()` +- `extendExpiry()` + +`setChildFuses()` and `renew()` do not have any direct restrictions around when they can be called to extend expiry. `renew()` cannot be called on a name that has expired (past grace period) on the .eth registrar and must be re-registered instead. + +`setSubnodeOwner()` and `setSubnodeRecord()` both revert when the subdomain is Emancipated or Locked. + +`renew()` indirectly extends the expiry of a .eth name by renewing the name inside the .eth registrar. + +`extendExpiry()` extends the expiry of any name. It can only be called by the owner of the name, an approved address or the owner of the parent name. When called by the owner of the name, the `CAN_EXTEND_EXPIRY` fuse must have already been burned by the parent. An approved address can be set by calling `approve()`. + +## Fuses + +Restrictions on names are handled by fuses. Fuses are labels that can be irreversibly added to a name until that name expires. + +Fuses are split into two categories, owner-controlled fuses and parent-controlled fuses. Owner-controlled fuses can be set by either the owner of the name or the owner of the parent name, but parent-controlled fuses can only be set by the owner of the parent name. + +When a fuse is set, we say it is "burned", to illustrate the one-way nature of fuses. Fuses cannot be unset, and will only reset if the name's expiry is less than the current `block.timestamp`. + +There are three fuses that have special control over the burning mechanism: `PARENT_CANNOT_CONTROL`, `CANNOT_UNWRAP`, and `CANNOT_BURN_FUSES`. + +- `PARENT_CANNOT_CONTROL` cannot be burned unless `CANNOT_UNWRAP` is burned on the parent name. Burning `PARENT_CANNOT_CONTROL` moves the name to the Emancipated state. +- `CANNOT_UNWRAP` cannot be burned unless `PARENT_CANNOT_CONTROL` is also burned. Burning `CANNOT_UNWRAP` moves the name to the Locked state. +- Other user-controlled fuses cannot be burned unless `CANNOT_UNWRAP` is burned. +- A parent name's owner can still extend the expiry of a name with `PARENT_CANNOT_CONTROL` burned. +- Burning `PARENT_CANNOT_CONTROL` prevents the owner of the parent name from burning any further fuses on the name. +- Burning `PARENT_CANNOT_CONTROL` ensures the parent cannot call `setSubnodeOwner()` or `setSubnodeRecord()` on that specific subdomain. This means that a parent cannot change the owner or records of a subdomain using `setSubnode*()` and additionally a parent cannot burn fuses or extend with `setSubnode*()` and `setChildFuses()`, since the functions are now restricted. +- Burning `PARENT_CANNOT_CONTROL` allows the parent or name owner to burn owner-controlled fuses. Until `PARENT_CANNOT_CONTROL` is burnt, no owner-controlled fuses can be set. This does not affect parent-controlled fuses. +- Important note for developers: To ensure `PARENT_CANNOT_CONTROL` is actually set and not automatically reset to 0, the expiry MUST be extended at the same time to be greater than the current block's timestamp. +- Burning `CANNOT_UNWRAP` ensures the name cannot be unwrapped. +- Other user-controlled fuses can only be burned if `CANNOT_UNWRAP` is also burned. This also allows the owner of the name to burn `PARENT_CANNOT_CONTROL` and all parent-controlled fuses on subdomains. +- `CANNOT_BURN_FUSES` can be burned to prevent any further changes to fuses. As with all user-controlled fuses, this cannot be burned unless `PARENT_CANNOT_CONTROL` and `CANNOT_UNWRAP` are both burned. + +### List of pre-defined fuses + +These fuses are used within the NameWrapper and are not available for custom use. + +Anything that is not predefined here as a fuse can be also burnt as a custom fuse. Fuse bits 1-16 (the first uint16 of the uint32) can be burnt by the owner of the name, or by the owner of the parent name at the same time as burning `PARENT_CANNOT_CONTROL`. Fuse bits 17-32 (the second half of the uint32) can only be burnt by the owner of the parent name. + +#### CANNOT_UNWRAP = 1 + +If this fuse is burned, the name cannot be unwrapped, and calls to unwrap and unwrapETH2LD, as well as other effects that would unwrap a name such as `setSubnodeOwner` will fail. + +#### CANNOT_BURN_FUSES = 2 + +If this fuse is burned, no further fuses can be burned. This has the effect of 'locking open' some set of permissions on the name. Calls to setFuses, and other methods that modify the set of fuses, will fail. Other methods can still be called successfully so long as they do not specify new fuses to burn. + +#### CANNOT_TRANSFER = 4 + +If this fuse is burned, the name cannot be transferred. Calls to safeTransferFrom and safeBatchTransferFrom will fail. + +#### CANNOT_SET_RESOLVER = 8 + +If this fuse is burned, the resolver cannot be changed. Calls to setResolver, setRecord and setSubnodeRecord will fail. + +#### CANNOT_SET_TTL = 16 + +If this fuse is burned, the TTL cannot be changed. Calls to setTTL, setRecord, and setSubnodeRecord will fail. + +#### CANNOT_CREATE_SUBDOMAIN = 32 + +If this fuse is burned, new subdomains cannot be created. Calls to setSubnodeOwner and setSubnodeRecord will fail if they reference a name that does not already exist. + +#### CANNOT_APPROVE = 64 + +If this fuse is burned, `approve()` cannot be called on this name anymore and so the current approved address cannot be changed until expiry. + +#### PARENT_CANNOT_CONTROL = 65536 + +If this fuse is burned, existing subdomains cannot be replaced by the parent name and the parent can no longer burn other fuses on this child. Calls to setSubnodeOwner and setSubnodeRecord will fail if they reference a name that already exists. Attempting to burn fuses in setChildFuses will also fail. This fuse can only be burnt by the parent of a node. + +#### IS_DOT_ETH = 131072 + +If this fuse is burned, it means that the name is a .eth name. This fuse cannot be burned manually and is burned when wrapETH2LD() or onERC721Received() is called. + +#### CAN_EXTEND_EXPIRY = 262144 + +If this fuse is burned, a name will be able to extend its own expiry in the NameWrapper. Does not apply to .eth 2LDs, as the expiry will inherit from the registrar in that case, and this fuse will not be burned when wrapping/registering .eth 2LDs. + +### Checking Fuses using `allFusesBurned(node, fuseMask)` + +To check whether or not a fuse is burnt you can use this function that takes a fuse mask of all fuses you want to check. + +```js +const areBurned = await allFusesBurned( + namehash('vitalik.eth'), + CANNOT_TRANSFER | CANNOT_SET_RESOLVER, +) +// if CANNOT_UNWRAP AND CANNOT_SET_RESOLVER are *both* burned this will return true +``` + +### Get current owner, fuses and expiry using `getData(node)` + +getData gets the owner, fuses and also the expiry of the name. The fuses it returns will be a `uint32` and you will have to decode this yourself. If you just need to check a fuse has been burned, you can call `allFusesBurned` as it will use less gas. + +## Function Reference + +### `wrapETH2LD()` + +**Start State**: Unwrapped +**End State**: Emancipated | Locked + +Wraps a .eth second-level name. The wrapped name's expiration will always be equal to the name's expiration in the .eth registrar plus the grace period (90 days). + +If fuses are provided, they will be burned at the same time as wrapping, moving the name directly to Locked status. + +### `wrap()` + +**Start State**: Unwrapped +**End State**: Wrapped | Emancipated + +Wraps any name other than a .eth second-level name. + +Parent-controlled fuses are retained on unwrap, so if the name was previously Emancipated and has not since expired, it will return directly to the Emancipated state. + +### `onERC721Received()` + +**Start State**: Unwrapped +**End State**: Emancipated | Locked + +Wraps a .eth second-level name by sending the ERC721 NFT to the wrapper contract. Transfers must contain additional data encoding information about the wrapped name such as fuses and expiration, or they will be rejected. + +Otherwise behaves identically to `wrapETH2LD`. + +### `registerAndWrapETH2LD()` + +**Start State**: Unregistered +**End State**: Emancipated | Locked + +Allows a registrar controller to register and wrap a name in a single operation. After registering the name, behaves identically to `wrapETH2LD`. + +### `renew()` + +**Start State**: Emancipated | Locked +**End State**: Emancipated | Locked + +Allows a registrar controller to renew a .eth second-level name. + +### `setSubnodeOwner()` + +**Start State**: Unregistered | Unwrapped | Wrapped +**End State**: Unregistered | Wrapped | Emancipated | Locked + +Creates, replaces, or deletes a subname. + +When called with a subname that does not yet exist, creates the name and wraps it. + +When called with a subname that already exists, transfers the name to a new owner, wrapping it if necessary, provided the name is not Emancipated or Locked. + +When called with a subname that exists and a new owner value of `address(0)`, unwraps and deletes the name. + +If an expiration is provided, the subname's expiration will be set to the greater of the provided expiration and the one already on the subname. + +If fuses are provided, they will be burned on the subname. + +### `setSubnodeRecord()` + +**Start State**: Unregistered | Unwrapped | Wrapped +**End State**: Wrapped | Emancipated | Locked + +Creates or replaces a subname while updating resolver and TTL records. + +Behaves identically to `setSubnodeOwner()`, additionally setting the resolver and TTL for the subname. If the new owner is `address(0)`, resolver and TTL are ignored. + +### `unwrapETH2LD()` + +**Start State**: Emancipated +**End State**: Unwrapped + +Unwraps a .eth second-level name, provided that the name is not Locked. + +### `unwrap()` + +**Start State**: Wrapped | Emancipated +**End State**: Unwrapped + +Unwraps any name other than a .eth second-level name, provided that the name is not Locked. + +Parent-controlled fuses are retained on unwrap, so if the name was previously Emancipated and has not since expired, it will return directly to the Emancipated state if `wrap()` is called on it. + +### `setRecord()` + +**Start State**: Wrapped | Emancipated | Locked +**End State**: Unregistered | Wrapped | Emancipated | Locked + +Mirrors the existing registry functionality, allowing you to set owner, resolver and ttl at the same time. + +When called with an owner of `address(0)`, unwraps the name provided it is not Locked and not a .eth second-level name. + +### `setFuses()` + +**Start State**: Emancipated | Locked +**End State**: Locked + +`setFuses()` can only be called by the owner of a name, and can burn any user-controlled fuses. It cannot burn parent-controlled fuses. + +In order to burn any other fuse, `CANNOT_UNWRAP` must be burned as well, moving the name to the Locked state. + +Cannot be called if `CANNOT_BURN_FUSES` has been burned. + +### `extendExpiry()` + +**Start State**: Wrapped | Emancipated | Locked +**End State**: Wrapped | Emancipated | Locked + +`extendExpiry()` can only be called by the owner of a name, the owner of the parent name or an approved address (known as a renewal manager). When called by the owner of the name, the `CAN_EXTEND_EXPIRY` fuse must have already been burned by the parent. The approved address can be set by calling `approve + +The expiry can only be extended, not reduced. And the max expiry is automatically set to the expiry of the parent node. + +### `setChildFuses()` + +**Start State**: Wrapped +**End State**: Emancipated | Locked + +`setChildFuses()` can only be called the parent owner of a name. It can burn both user-controlled and parent-controlled fuses. + +If the name is Emancipated or Locked, this function may be called to extend the expiry, but cannot burn any further fuses. + +### Setting Records + +The NameWrapper mirrors most of the functionality from the original ENS registry in its own API. + +- `setResolver()` +- `setTTL()` +- `setRecord()` + +`setResolver()` and `setTTL()` call the corresponding registry functions after checking that the caller is authorised. + +`setRecord()` acts differently depending if the name is .eth or not. If you set the owner to `address(0)`, it will automatically unwrap the name and set the registry owner to 0, deleting the subdomain. If you set the owner to `address(0)`, but the name is a .eth 2LD, the function will revert as the ERC721 token cannot be set to the zero address. If the owner is not 0, it will simply transfer the ERC1155 to the specified owner within NameWrapper and set the resolver and ttl on the registry. + +### Getting Data + +The NameWrapper has 2 functions for getting data from the contract. + +- `getData` +- `ownerOf` + +`getData` gets the data that is stored for a name. This is a tuple of `owner`,`fuses` and `expiry`. + +`ownerOf` will return the owner of a name. It adheres to the rules applied by emancipating a name. If the name is emancipated, expired names will return `address(0)` when calling `ownerOf` + +### Subdomain management + +Managing subdomains can be done with the same functions as in the registry: + +- `setSubnodeOwner()` +- `setSubnodeRecord()` + +These functions manage both creating and deleting subdomains, as well as changing their owner. They also have the ability to change the ttl and resolver, just like in the registry. The operation of these functions changes depending on whether or not the name is already wrapped and exists within the NameWrapper. + +If a name does not exist within the NameWrapper, both functions will both create the name in the registry AND automatically wrap the name in the NameWrapper. This will emit a `NameWrapped` event and a `Transfer` event. + +If a name does exist within the NameWrapper and the owner is set to a non-zero address, both functions will transfer the name to the new owner and emit a `Transfer` event. + +If a name does exist within the NameWrapper and the owner is to set to the zero address, both functions will unwrap the name and set the owner in the registry to `address(0)`. This will also emit a `NameUnwrapped` event. + +## Checking if a name is wrapped + +To check if a name has been wrapped, call `isWrapped()`. This checks that the owner in the NameWrapper is non-zero + +## Wrapping Names + +If you transfer your subdomain to the NameWrapper using `registry.setSubnodeOwner()`, `registry.setSubnodeRecord` or `registry.setOwner()`, the NameWrapper will NOT recognise this as a wrap. There will be no `NameWrapped` event emitted, and there won't be an ERC1155 minted for that specific name. For this reason, if you want to check whether or not a name has been wrapped, you must check if the owner in the registry is the NameWrapper AND the owner in the NameWrapper is non-zero. + +Since the NameWrapper does have `onERC721Received` support, the NameWrapper WILL recognise a transfer of the .eth registrar ERC721 token to the NameWrapper as a wrap. + +## Register wrapped names + +Names can be registered as normal using the current .eth registrar controller. However, the new .eth registrar controller will be a controller on the NameWrapper, and have NameWrapper will be a controller on the .eth base registrar. The NameWrapper exposes a `registerAndWrapETH2LD()` function that can be called by the new .eth registrar to directly register wrapped names. This new function removes the need to first transfer the owner to the contract itself before transferring it to the final owner, which saves gas. + +Both .eth registrar controllers will be active during a deprecation period, giving time for front-end clients to switch their code to point at the new and improved .eth registrar controller. + +## Ownership of the NameWrapper + +The NameWrapper is an `Ownable()` contract and this owner has a few limited admin functions. Most of the functionality of the NameWrapper is trustless and names cannot be interfered with in any way even by the owner of the contract. The contract owner can do the following things: + +- Change the metadata service URL. +- Add and remove controllers to the NameWrapper. +- Specify an upgrade target for a new name wrapper instance. + +Controllers can call the following functions + +- `registerAndWrapETH2LD()` +- `renew()` +- `setUpgradeContract()` + +## Installation and setup + +```bash +npm install +``` + +## Testing + +```bash +npm run test +``` + +Any contract with `2` at the end, is referring to the contract being called by `account2`, rather than `account1`. This is for tests that require authorising another user. + +## Deploying test contracts into Rinkeby + +### Create .env + +``` +cp .env.org .env +``` + +### Set credentials + +``` +PRIVATE_KEY= +ETHERSCAN_API_KEY= +INFURA_API_KEY= +``` + +Please leave the following fields as blank + +``` +SEED_NAME= +METADATA_ADDRESS= +WRAPPER_ADDRESS= +RESOLVER_ADDRESS= +``` + +### Run deploy script + +`bun run deploy:rinkeby` will deploy to rinkeby and verify its source code + +NOTE: If you want to override the default metadata url, set `METADATA_HOST=` to `.env` + +``` +$ bun run deploy:rinkeby +$ npx hardhat run --network rinkeby scripts/deploy.js +Deploying contracts to rinkeby with the account:0x97bA55F61345665cF08c4233b9D6E61051A43B18 +Account balance: 1934772596667918724 true +{ + registryAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', + registrarAddress: '0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85' +} +Setting metadata service to https://ens-metadata-service.appspot.com/name/0x{id} +Metadata address: 0x08f2D8D8240fC70FD777358b0c63e539714DD473 +Wrapper address: 0x88ce50eFeA21996B20838d5E71994191562758f9 +Resolver address: 0x784b7B9BA0Fc04b90187c06C0C7efC51AeA06aFB +wait for 5 sec until bytecodes are uploaded into etherscan +verify 0x08f2D8D8240fC70FD777358b0c63e539714DD473 with arguments https://ens-metadata-service.appspot.com/name/0x{id} +verify 0x88ce50eFeA21996B20838d5E71994191562758f9 with arguments 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e,0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85,0x08f2D8D8240fC70FD777358b0c63e539714DD473 +verify 0x784b7B9BA0Fc04b90187c06C0C7efC51AeA06aFB with arguments 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e,0x88ce50eFeA21996B20838d5E71994191562758f9 +``` + +After running the script it sets addresses to `.env`. If you want to redeploy some of contracts, remove the contract address from `.env` and runs the script again. + +## Seeding test data into Rinkeby + +1. Register a name using the account you used to deploy the contract +2. Set the label (`matoken` for `matoken.eth`) to `SEED_NAME=` on `.env` +3. Run `bun run seed:rinkeby` + +``` +~/.../ens/name-wrapper (seed)$ bun run seed:rinkeby +$ npx hardhat run --network rinkeby scripts/seed.js +Account balance: 1925134991223891632 +{ + registryAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', + registrarAddress: '0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85', + wrapperAddress: '0x88ce50eFeA21996B20838d5E71994191562758f9', + resolverAddress: '0x784b7B9BA0Fc04b90187c06C0C7efC51AeA06aFB', + firstAddress: '0x97bA55F61345665cF08c4233b9D6E61051A43B18', + name: 'wrappertest4' +} +Wrapped NFT for wrappertest4.eth is available at https://testnets.opensea.io/assets/0x88ce50eFeA21996B20838d5E71994191562758f9/42538507198368349158588132934279877358592939677496199760991827793914037599925 +Wrapped NFT for sub2.wrappertest4.eth is available at https://testnets.opensea.io/assets/0x88ce50eFeA21996B20838d5E71994191562758f9/22588238952906792220944282072078294622689934598844133294480594786812258911617 +``` + +## Notes on upgrading the Name Wrapper + +The Name Wrapper has a built-in upgrade function that allows the owner of the Name Wrapper to set a new contract for all names to be migrated to as a last resort migration. Upgrading a name is optional and is only able to be done by the owner of the name in the original NameWrapper. A name can only be migrated when the parent has been migrated to the new registrar. By default the `ROOT_NODE` and `ETH_NODE` should be wrapped in the constructor of the new Name Wrapper. + +The upgraded namewrapper must include the interface `INameWrapperUpgrade.sol`, which mandates two functions that already exist in the new wrapper: `wrapETH2LD` and `setSubnodeRecord`. The `wrapETH2LD` function can be used as-is, however the `setSubnodeRecord` needs one additional permission, which checks for if the parent of the name you are wrapping has already been wrapped and the `msg.sender` is the old wrapper. + +```solidity +// Example of that check in solidity +require(isTokenOwnerOrApproved(parentNode) || msg.sender == oldWrapperAddress && registrar.ownerOf(parentLabelHash) == address(this)) +``` + +It is recommended to have this check after the normal checks, so normal usage in the new wrapper does not cost any additional gas (unless the require actually reverts). + +If the function signature of the new NameWrapper changes, there must be an extra function added to the new NameWrapper, that takes the old function signature of `wrap()` and `wrapETH2LD()` and then translates them into the new function signatures to avoid a situation where the old NameWrapper cannot call the new NameWrapper. diff --git a/solidity/dns-contracts/contracts/wrapper/StaticMetadataService.sol b/solidity/dns-contracts/contracts/wrapper/StaticMetadataService.sol new file mode 100644 index 0000000..4ac836a --- /dev/null +++ b/solidity/dns-contracts/contracts/wrapper/StaticMetadataService.sol @@ -0,0 +1,14 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +contract StaticMetadataService { + string private _uri; + + constructor(string memory _metaDataUri) { + _uri = _metaDataUri; + } + + function uri(uint256) public view returns (string memory) { + return _uri; + } +} diff --git a/solidity/dns-contracts/contracts/wrapper/mocks/ERC1155ReceiverMock.sol b/solidity/dns-contracts/contracts/wrapper/mocks/ERC1155ReceiverMock.sol new file mode 100644 index 0000000..0985dd9 --- /dev/null +++ b/solidity/dns-contracts/contracts/wrapper/mocks/ERC1155ReceiverMock.sol @@ -0,0 +1,70 @@ +// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js +// Copyright (c) 2016-2020 zOS Global Limited + +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.0; + +import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; +import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; + +contract ERC1155ReceiverMock is IERC1155Receiver, ERC165 { + bytes4 private _recRetval; + bool private _recReverts; + bytes4 private _batRetval; + bool private _batReverts; + + event Received( + address operator, + address from, + uint256 id, + uint256 value, + bytes data + ); + event BatchReceived( + address operator, + address from, + uint256[] ids, + uint256[] values, + bytes data + ); + + constructor( + bytes4 recRetval, + bool recReverts, + bytes4 batRetval, + bool batReverts + ) { + _recRetval = recRetval; + _recReverts = recReverts; + _batRetval = batRetval; + _batReverts = batReverts; + } + + function onERC1155Received( + address operator, + address from, + uint256 id, + uint256 value, + bytes calldata data + ) external override returns (bytes4) { + require(!_recReverts, "ERC1155ReceiverMock: reverting on receive"); + emit Received(operator, from, id, value, data); + return _recRetval; + } + + function onERC1155BatchReceived( + address operator, + address from, + uint256[] calldata ids, + uint256[] calldata values, + bytes calldata data + ) external override returns (bytes4) { + require( + !_batReverts, + "ERC1155ReceiverMock: reverting on batch receive" + ); + emit BatchReceived(operator, from, ids, values, data); + return _batRetval; + } +} diff --git a/solidity/dns-contracts/contracts/wrapper/mocks/TestUnwrap.sol b/solidity/dns-contracts/contracts/wrapper/mocks/TestUnwrap.sol new file mode 100644 index 0000000..8c2fe60 --- /dev/null +++ b/solidity/dns-contracts/contracts/wrapper/mocks/TestUnwrap.sol @@ -0,0 +1,114 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; +import "../../registry/ENS.sol"; +import "../../ethregistrar/IBaseRegistrar.sol"; +import {BytesUtils} from "../../utils/BytesUtils.sol"; +import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; + +contract TestUnwrap is Ownable { + using BytesUtils for bytes; + + bytes32 private constant ETH_NODE = + 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae; + + ENS public immutable ens; + IBaseRegistrar public immutable registrar; + mapping(address => bool) public approvedWrapper; + + constructor(ENS _ens, IBaseRegistrar _registrar) { + ens = _ens; + registrar = _registrar; + } + + function setWrapperApproval( + address wrapper, + bool approved + ) public onlyOwner { + approvedWrapper[wrapper] = approved; + } + + function wrapETH2LD( + string calldata label, + address wrappedOwner, + uint32 fuses, + uint64 expiry, + address resolver + ) public { + _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender); + } + + function setSubnodeRecord( + bytes32 parentNode, + string memory label, + address newOwner, + address resolver, + uint64 ttl, + uint32 fuses, + uint64 expiry + ) public { + bytes32 node = _makeNode(parentNode, keccak256(bytes(label))); + _unwrapSubnode(node, newOwner, msg.sender); + } + + function wrapFromUpgrade( + bytes calldata name, + address wrappedOwner, + uint32 fuses, + uint64 expiry, + address approved, + bytes calldata extraData + ) public { + (bytes32 labelhash, uint256 offset) = name.readLabel(0); + bytes32 parentNode = name.namehash(offset); + bytes32 node = _makeNode(parentNode, labelhash); + + if (parentNode == ETH_NODE) { + _unwrapETH2LD(labelhash, wrappedOwner, msg.sender); + } else { + _unwrapSubnode(node, wrappedOwner, msg.sender); + } + } + + function _unwrapETH2LD( + bytes32 labelhash, + address wrappedOwner, + address sender + ) private { + uint256 tokenId = uint256(labelhash); + address registrant = registrar.ownerOf(tokenId); + + require( + approvedWrapper[sender] && + sender == registrant && + registrar.isApprovedForAll(registrant, address(this)), + "Unauthorised" + ); + + registrar.reclaim(tokenId, wrappedOwner); + registrar.transferFrom(registrant, wrappedOwner, tokenId); + } + + function _unwrapSubnode( + bytes32 node, + address newOwner, + address sender + ) private { + address owner = ens.owner(node); + + require( + approvedWrapper[sender] && + owner == sender && + ens.isApprovedForAll(owner, address(this)), + "Unauthorised" + ); + + ens.setOwner(node, newOwner); + } + + function _makeNode( + bytes32 node, + bytes32 labelhash + ) private pure returns (bytes32) { + return keccak256(abi.encodePacked(node, labelhash)); + } +} diff --git a/solidity/dns-contracts/contracts/wrapper/mocks/UpgradedNameWrapperMock.sol b/solidity/dns-contracts/contracts/wrapper/mocks/UpgradedNameWrapperMock.sol new file mode 100644 index 0000000..e04ab03 --- /dev/null +++ b/solidity/dns-contracts/contracts/wrapper/mocks/UpgradedNameWrapperMock.sol @@ -0,0 +1,74 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; +import {INameWrapperUpgrade} from "../INameWrapperUpgrade.sol"; +import "../../registry/ENS.sol"; +import "../../ethregistrar/IBaseRegistrar.sol"; +import {BytesUtils} from "../../utils/BytesUtils.sol"; + +contract UpgradedNameWrapperMock is INameWrapperUpgrade { + using BytesUtils for bytes; + + bytes32 private constant ETH_NODE = + 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae; + + ENS public immutable ens; + IBaseRegistrar public immutable registrar; + + constructor(ENS _ens, IBaseRegistrar _registrar) { + ens = _ens; + registrar = _registrar; + } + + event NameUpgraded( + bytes name, + address wrappedOwner, + uint32 fuses, + uint64 expiry, + address approved, + bytes extraData + ); + + function wrapFromUpgrade( + bytes calldata name, + address wrappedOwner, + uint32 fuses, + uint64 expiry, + address approved, + bytes calldata extraData + ) public { + (bytes32 labelhash, uint256 offset) = name.readLabel(0); + bytes32 parentNode = name.namehash(offset); + bytes32 node = _makeNode(parentNode, labelhash); + + if (parentNode == ETH_NODE) { + address registrant = registrar.ownerOf(uint256(labelhash)); + require( + msg.sender == registrant && + registrar.isApprovedForAll(registrant, address(this)), + "No approval for registrar" + ); + } else { + address owner = ens.owner(node); + require( + msg.sender == owner && + ens.isApprovedForAll(owner, address(this)), + "No approval for registry" + ); + } + emit NameUpgraded( + name, + wrappedOwner, + fuses, + expiry, + approved, + extraData + ); + } + + function _makeNode( + bytes32 node, + bytes32 labelhash + ) private pure returns (bytes32) { + return keccak256(abi.encodePacked(node, labelhash)); + } +} diff --git a/solidity/dns-contracts/contracts/wrapper/test/NameGriefer.sol b/solidity/dns-contracts/contracts/wrapper/test/NameGriefer.sol new file mode 100644 index 0000000..437ab6e --- /dev/null +++ b/solidity/dns-contracts/contracts/wrapper/test/NameGriefer.sol @@ -0,0 +1,65 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +import {INameWrapper} from "../INameWrapper.sol"; +import {ENS} from "../../registry/ENS.sol"; +import {BytesUtils} from "../../utils/BytesUtils.sol"; +import {IERC1155Receiver} from "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; + +contract NameGriefer is IERC1155Receiver { + using BytesUtils for *; + + ENS public immutable ens; + INameWrapper public immutable wrapper; + + constructor(INameWrapper _wrapper) { + wrapper = _wrapper; + ENS _ens = _wrapper.ens(); + ens = _ens; + _ens.setApprovalForAll(address(_wrapper), true); + } + + function destroy(bytes calldata name) public { + wrapper.wrap(name, address(this), address(0)); + } + + function onERC1155Received( + address operator, + address from, + uint256 id, + uint256, + bytes calldata + ) external override returns (bytes4) { + require(operator == address(this), "Operator must be us"); + require(from == address(0), "Token must be new"); + + // Unwrap the name + bytes memory name = wrapper.names(bytes32(id)); + (bytes32 labelhash, uint256 offset) = name.readLabel(0); + bytes32 parentNode = name.namehash(offset); + wrapper.unwrap(parentNode, labelhash, address(this)); + + // Here we can do something with the name before it's permanently burned, like + // set the resolver or create subdomains. + + return NameGriefer.onERC1155Received.selector; + } + + function onERC1155BatchReceived( + address, + address, + uint256[] calldata, + uint256[] calldata, + bytes calldata + ) external override returns (bytes4) { + return NameGriefer.onERC1155BatchReceived.selector; + } + + function supportsInterface( + bytes4 interfaceID + ) external view override returns (bool) { + return + interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`). + interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)")) ^ bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`). + } +} diff --git a/solidity/dns-contracts/contracts/wrapper/test/TestNameWrapperReentrancy.sol b/solidity/dns-contracts/contracts/wrapper/test/TestNameWrapperReentrancy.sol new file mode 100644 index 0000000..b608e75 --- /dev/null +++ b/solidity/dns-contracts/contracts/wrapper/test/TestNameWrapperReentrancy.sol @@ -0,0 +1,61 @@ +//SPDX-License-Identifier: MIT +pragma solidity ~0.8.17; + +import "../INameWrapper.sol"; +import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; +import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; + +contract TestNameWrapperReentrancy is ERC165, IERC1155Receiver { + INameWrapper nameWrapper; + address owner; + bytes32 parentNode; + bytes32 labelHash; + uint256 tokenId; + + constructor( + address _owner, + INameWrapper _nameWrapper, + bytes32 _parentNode, + bytes32 _labelHash + ) { + owner = _owner; + nameWrapper = _nameWrapper; + parentNode = _parentNode; + labelHash = _labelHash; + } + + function supportsInterface( + bytes4 interfaceId + ) public view virtual override(ERC165, IERC165) returns (bool) { + return + interfaceId == type(IERC1155Receiver).interfaceId || + super.supportsInterface(interfaceId); + } + + function onERC1155Received( + address, + address, + uint256 _id, + uint256, + bytes calldata + ) public override returns (bytes4) { + tokenId = _id; + nameWrapper.unwrap(parentNode, labelHash, owner); + + return this.onERC1155Received.selector; + } + + function onERC1155BatchReceived( + address, + address, + uint256[] memory, + uint256[] memory, + bytes memory + ) public virtual override returns (bytes4) { + return this.onERC1155BatchReceived.selector; + } + + function claimToOwner() public { + nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, ""); + } +} diff --git a/solidity/dns-contracts/deploy/ethregistrar/00_deploy_base_registrar_implementation.ts b/solidity/dns-contracts/deploy/ethregistrar/00_deploy_base_registrar_implementation.ts new file mode 100644 index 0000000..87c0b03 --- /dev/null +++ b/solidity/dns-contracts/deploy/ethregistrar/00_deploy_base_registrar_implementation.ts @@ -0,0 +1,24 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' +import { namehash } from 'viem/ens' + +const func: DeployFunction = async function (hre) { + const { network, viem } = hre + + if (!network.tags.use_root) { + return true + } + + const registry = await viem.getContract('ENSRegistry') + + const bri = await viem.deploy('BaseRegistrarImplementation', [ + registry.address, + namehash('creator'), + ]) + if (!bri.newlyDeployed) return +} + +func.id = 'registrar' +func.tags = ['ethregistrar', 'BaseRegistrarImplementation'] +func.dependencies = ['registry', 'root'] + +export default func diff --git a/solidity/dns-contracts/deploy/ethregistrar/00_setup_base_registrar.ts b/solidity/dns-contracts/deploy/ethregistrar/00_setup_base_registrar.ts new file mode 100644 index 0000000..f9aa6d8 --- /dev/null +++ b/solidity/dns-contracts/deploy/ethregistrar/00_setup_base_registrar.ts @@ -0,0 +1,43 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' +import { labelhash } from 'viem' + +const func: DeployFunction = async function (hre) { + const { network, viem } = hre + + const { deployer, owner } = await viem.getNamedClients() + const publicClient = await viem.getPublicClient() + + if (!network.tags.use_root) { + return true + } + + const root = await viem.getContract('Root') + const registrar = await viem.getContract('BaseRegistrarImplementation') + + console.log('Running base registrar setup') + + const transferOwnershipHash = await registrar.write.transferOwnership( + [owner.address], + { account: deployer.account }, + ) + console.log( + `Transferring ownership of registrar to owner (tx: ${transferOwnershipHash})...`, + ) + await viem.waitForTransactionSuccess(transferOwnershipHash) + + const setSubnodeOwnerHash = await root.write.setSubnodeOwner( + [labelhash('creator'), registrar.address], + { account: owner.account }, + ) + console.log( + `Setting owner of creator node to registrar on root (tx: ${setSubnodeOwnerHash})...`, + ) + await viem.waitForTransactionSuccess(setSubnodeOwnerHash) +} + +func.id = 'setupRegistrar' +func.tags = ['setupRegistrar'] +//Runs after the root is setup +func.dependencies = ['setupRoot'] + +export default func diff --git a/solidity/dns-contracts/deploy/ethregistrar/01_deploy_token_price_oracle.ts b/solidity/dns-contracts/deploy/ethregistrar/01_deploy_token_price_oracle.ts new file mode 100644 index 0000000..9908555 --- /dev/null +++ b/solidity/dns-contracts/deploy/ethregistrar/01_deploy_token_price_oracle.ts @@ -0,0 +1,26 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' +import type { Address } from 'viem' +import {parseUnits} from 'viem' + +const func: DeployFunction = async function (hre) { + const { network, viem } = hre + + let oracleAddress: Address = '0x2514895c72f50D8bd4B4F9b1110F0D6bD2c97526' + let cakeAddress: Address = '0x81faeDDfeBc2F8Ac524327d70Cf913001732224C' + let usd1Address: Address = '0xEca2605f0BCF2BA5966372C99837b1F182d3D620' + + await viem.deploy('TokenPriceOracle', [ + oracleAddress, + cakeAddress, + usd1Address, + [0n, 3170979198377n, 1585489599188n, 792744799594n, 317097919838n], + 100000000000000000000000000n, + 21n, + ]) +} + +func.id = 'price-oracle' +func.tags = ['ethregistrar', 'TokenPriceOracle', 'DummyOracle'] +func.dependencies = ['registry'] + +export default func \ No newline at end of file diff --git a/solidity/dns-contracts/deploy/ethregistrar/02_deploy_legacy_eth_registrar_controller.ts b/solidity/dns-contracts/deploy/ethregistrar/02_deploy_legacy_eth_registrar_controller.ts new file mode 100644 index 0000000..1ee0f7a --- /dev/null +++ b/solidity/dns-contracts/deploy/ethregistrar/02_deploy_legacy_eth_registrar_controller.ts @@ -0,0 +1,64 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' +import type { Address } from 'viem' + +const func: DeployFunction = async function (hre) { + const { deployments, viem } = hre + const { run } = deployments + + const { owner } = await viem.getNamedClients() + + const registrar = await viem.getContract('BaseRegistrarImplementation') // as owner + const priceOracle = await viem.getContract('TokenPriceOracle') + const reverseRegistrar = await viem.getContract('ReverseRegistrar') // as owner + + const controller = await viem.deploy( + 'LegacyETHRegistrarController', + [registrar.address, priceOracle.address, 60n, 86400n], + { + artifact: await deployments.getArtifact( + 'ETHRegistrarController_mainnet_9380471', + ), + }, + ) + + const registrarAddControllerHash = await registrar.write.addController( + [controller.address as Address], + { account: owner.account }, + ) + console.log( + `Adding controller as controller on registrar (tx: ${registrarAddControllerHash})...`, + ) + await viem.waitForTransactionSuccess(registrarAddControllerHash) + + const reverseRegistrarSetControllerHash = + await reverseRegistrar.write.setController( + [controller.address as Address, true], + { account: owner.account }, + ) + console.log( + `Setting controller of ReverseRegistrar to controller (tx: ${reverseRegistrarSetControllerHash})...`, + ) + await viem.waitForTransactionSuccess(reverseRegistrarSetControllerHash) + + if (process.env.npm_package_name !== '@ensdomains/ens-contracts') { + console.log('Running unwrapped name registrations...') + await run('register-unwrapped-names', { + deletePreviousDeployments: false, + resetMemory: false, + }) + } + + return true +} + +func.id = 'legacy-controller' +func.tags = ['LegacyETHRegistrarController'] +func.dependencies = [ + 'registry', + 'wrapper', + 'LegacyPublicResolver', + 'TokenPriceOracle', + 'ReverseRegistrar', +] + +export default func diff --git a/solidity/dns-contracts/deploy/ethregistrar/03_deploy_eth_registrar_controller.ts b/solidity/dns-contracts/deploy/ethregistrar/03_deploy_eth_registrar_controller.ts new file mode 100644 index 0000000..a0d4576 --- /dev/null +++ b/solidity/dns-contracts/deploy/ethregistrar/03_deploy_eth_registrar_controller.ts @@ -0,0 +1,116 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' +import { namehash, zeroAddress } from 'viem' +import { createInterfaceId } from '../../test/fixtures/createInterfaceId.js' + +const func: DeployFunction = async function (hre) { + const { deployments, network, viem } = hre + + const { deployer, owner } = await viem.getNamedClients() + + const registry = await viem.getContract('ENSRegistry', owner) + const tokenAddresses: `0x${string}`[] = [ + '0xFa60D973F7642B748046464e165A65B7323b0DEE', + '0x64544969ed7EBf5f083679233325356EbE738930', + ] + + const registrar = await viem.getContract('BaseRegistrarImplementation', owner) + const priceOracle = await viem.getContract('TokenPriceOracle', owner) + const reverseRegistrar = await viem.getContract('ReverseRegistrar', owner) + const nameWrapper = await viem.getContract('NameWrapper', owner) + + const referralDeployment = await viem.deploy('ReferralController', []) + + const controllerDeployment = await viem.deploy('ETHRegistrarController', [ + registrar.address, + priceOracle.address, + 60n, + 86400n, + reverseRegistrar.address, + nameWrapper.address, + registry.address, + owner.address, + referralDeployment.address, + ]) + if (!controllerDeployment.newlyDeployed) return + + const controller = await viem.getContract('ETHRegistrarController') + + const refferal = await viem.getContract('ReferralController') + + if (owner.address !== deployer.address) { + const hash = await controller.write.transferOwnership([owner.address]) + console.log( + `Transferring ownership of ETHRegistrarController to ${owner.address} (tx: ${hash})...`, + ) + await viem.waitForTransactionSuccess(hash) + } + + for (const tokenAddress of tokenAddresses) { + const hash = await controller.write.setToken([tokenAddress]) + console.log(`Adding ${tokenAddress} to ETHRegistrarController`) + await viem.waitForTransactionSuccess(hash) + } + + // Only attempt to make controller etc changes directly on testnets + if (network.name === 'mainnet') return + + const referralControllerHash = await refferal.write.addController([ + controller.address, + ]) + console.log( + `Adding controller as a controller of Referral (tx: ${referralControllerHash})...`, + ) + await viem.waitForTransactionSuccess(referralControllerHash) + const backendHash = await controller.write.setBackend([owner.address]) + console.log(`Adding backend (tx: ${backendHash})...`) + await viem.waitForTransactionSuccess(backendHash) + const nameWrapperSetControllerHash = await nameWrapper.write.setController([ + controller.address, + true, + ]) + console.log( + `Adding ETHRegistrarController as a controller of NameWrapper (tx: ${nameWrapperSetControllerHash})...`, + ) + await viem.waitForTransactionSuccess(nameWrapperSetControllerHash) + + const reverseRegistrarSetControllerHash = + await reverseRegistrar.write.setController([controller.address, true]) + console.log( + `Adding ETHRegistrarController as a controller of ReverseRegistrar (tx: ${reverseRegistrarSetControllerHash})...`, + ) + await viem.waitForTransactionSuccess(reverseRegistrarSetControllerHash) + + const artifact = await deployments.getArtifact('IETHRegistrarController') + const interfaceId = createInterfaceId(artifact.abi) + + const resolver = await registry.read.resolver([namehash('creator')]) + if (resolver === zeroAddress) { + console.log( + `No resolver set for .creator; not setting interface ${interfaceId} for creator Registrar Controller`, + ) + return + } + + const ethOwnedResolver = await viem.getContract('OwnedResolver') + const setInterfaceHash = await ethOwnedResolver.write.setInterface([ + namehash('creator'), + interfaceId, + controller.address, + ]) + console.log( + `Setting ETHRegistrarController interface ID ${interfaceId} on .creator resolver (tx: ${setInterfaceHash})...`, + ) + await viem.waitForTransactionSuccess(setInterfaceHash) +} + +func.tags = ['ethregistrar', 'ETHRegistrarController'] +func.dependencies = [ + 'ENSRegistry', + 'BaseRegistrarImplementation', + 'TokenPriceOracle', + 'ReverseRegistrar', + 'NameWrapper', + 'OwnedResolver', +] + +export default func diff --git a/solidity/dns-contracts/deploy/ethregistrar/04_deploy_bulk_renewal.ts b/solidity/dns-contracts/deploy/ethregistrar/04_deploy_bulk_renewal.ts new file mode 100644 index 0000000..354d37b --- /dev/null +++ b/solidity/dns-contracts/deploy/ethregistrar/04_deploy_bulk_renewal.ts @@ -0,0 +1,47 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' +import { namehash, zeroAddress, type Address } from 'viem' +import { createInterfaceId } from '../../test/fixtures/createInterfaceId.js' + +const func: DeployFunction = async function (hre) { + const { deployments, network, viem } = hre + + const registry = await viem.getContract('ENSRegistry') + const controller = await viem.getContract('ETHRegistrarController') + + const bulkRenewal = await viem.deploy('StaticBulkRenewal', [ + controller.address, + ]) + + // Only attempt to make resolver etc changes directly on testnets + if (network.name === 'mainnet') return + + const artifact = await deployments.getArtifact('IBulkRenewal') + const interfaceId = createInterfaceId(artifact.abi) + + const resolver = await registry.read.resolver([namehash('creator')]) + if (resolver === zeroAddress) { + console.log( + `No resolver set for .creator; not setting interface ${interfaceId} for BulkRenewal`, + ) + return + } + + const ethOwnedResolver = await viem.getContract('OwnedResolver') + const setInterfaceHash = await ethOwnedResolver.write.setInterface([ + namehash('creator'), + interfaceId, + bulkRenewal.address as Address, + ]) + console.log( + `Setting BulkRenewal interface ID ${interfaceId} on .creator resolver (tx: ${setInterfaceHash})...`, + ) + await viem.waitForTransactionSuccess(setInterfaceHash) + + return true +} + +func.id = 'bulk-renewal' +func.tags = ['BulkRenewal'] +func.dependencies = ['registry'] + +export default func diff --git a/solidity/dns-contracts/deploy/registry/00_deploy_registry.ts b/solidity/dns-contracts/deploy/registry/00_deploy_registry.ts new file mode 100644 index 0000000..2996016 --- /dev/null +++ b/solidity/dns-contracts/deploy/registry/00_deploy_registry.ts @@ -0,0 +1,79 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' +import { zeroAddress, zeroHash } from 'viem' + +const func: DeployFunction = async function (hre) { + const { deployments, network, viem } = hre + const { run } = deployments + + const { deployer, owner } = await viem.getNamedClients() + + if (network.tags.legacy) { + const contract = await viem.deploy('LegacyENSRegistry', [], { + client: owner, + artifact: await deployments.getArtifact('ENSRegistry') + }) + + const legacyRegistry = await viem.getContract('LegacyENSRegistry', owner) + + const setRootHash = await legacyRegistry.write.setOwner( + [zeroHash, owner.address], + { + gas: 1000000n, + }, + ) + console.log(`Setting owner of root node to owner (tx: ${setRootHash})`) + await viem.waitForTransactionSuccess(setRootHash) + + if (process.env.npm_package_name !== '@ensdomains/ens-contracts') { + console.log('Running legacy registry scripts...') + await run('legacy-registry-names', { + deletePreviousDeployments: false, + resetMemory: false, + }) + } + + const revertRootHash = await legacyRegistry.write.setOwner([ + zeroHash, + zeroAddress, + ]) + console.log(`Unsetting owner of root node (tx: ${revertRootHash})`) + await viem.waitForTransactionSuccess(revertRootHash) + + await viem.deploy('ENSRegistry', [contract.address], { + artifact: await deployments.getArtifact('ENSRegistryWithFallback'), + }) + } else { + await viem.deploy('ENSRegistry', [], { + artifact: await deployments.getArtifact('ENSRegistry'), + }) + } + + if (!network.tags.use_root) { + const registry = await viem.getContract('ENSRegistry') + const rootOwner = await registry.read.owner([zeroHash]) + switch (rootOwner) { + case deployer.address: + const hash = await registry.write.setOwner([zeroHash, owner.address], { + account: deployer.account, + }) + console.log( + `Setting final owner of root node on registry (tx:${hash})...`, + ) + await viem.waitForTransactionSuccess(hash) + break + case owner.address: + break + default: + console.log( + `WARNING: ENS registry root is owned by ${rootOwner}; cannot transfer to owner`, + ) + } + } + + return true +} + +func.id = 'ens' +func.tags = ['registry', 'ENSRegistry'] + +export default func diff --git a/solidity/dns-contracts/deploy/registry/01_deploy_reverse_registrar.ts b/solidity/dns-contracts/deploy/registry/01_deploy_reverse_registrar.ts new file mode 100644 index 0000000..4d92da0 --- /dev/null +++ b/solidity/dns-contracts/deploy/registry/01_deploy_reverse_registrar.ts @@ -0,0 +1,54 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' +import { labelhash, namehash } from 'viem' + +const func: DeployFunction = async function (hre) { + const { network, viem } = hre + + const { deployer, owner } = await viem.getNamedClients() + + const registry = await viem.getContract('ENSRegistry') + + const reverseRegistrarDeployment = await viem.deploy('ReverseRegistrar', [ + registry.address, + ]) + if (!reverseRegistrarDeployment.newlyDeployed) return + + const reverseRegistrar = await viem.getContract('ReverseRegistrar') + + if (owner.address !== deployer.address) { + const hash = await reverseRegistrar.write.transferOwnership([owner.address]) + console.log( + `Transferring ownership of ReverseRegistrar to ${owner.address} (tx: ${hash})...`, + ) + await viem.waitForTransactionSuccess(hash) + } + + // Only attempt to make controller etc changes directly on testnets + if (network.name === 'mainnet') return + + const root = await viem.getContract('Root') + + const setReverseOwnerHash = await root.write.setSubnodeOwner( + [labelhash('reverse'), owner.address], + { account: owner.account }, + ) + console.log( + `Setting owner of .reverse to owner on root (tx: ${setReverseOwnerHash})...`, + ) + await viem.waitForTransactionSuccess(setReverseOwnerHash) + + const setAddrOwnerHash = await registry.write.setSubnodeOwner( + [namehash('reverse'), labelhash('addr'), reverseRegistrar.address], + { account: owner.account }, + ) + console.log( + `Setting owner of .addr.reverse to ReverseRegistrar on registry (tx: ${setAddrOwnerHash})...`, + ) + await viem.waitForTransactionSuccess(setAddrOwnerHash) +} + +func.id = 'reverse-registrar' +func.tags = ['ReverseRegistrar'] +func.dependencies = ['root'] + +export default func diff --git a/solidity/dns-contracts/deploy/resolvers/00_deploy_eth_owned_resolver.ts b/solidity/dns-contracts/deploy/resolvers/00_deploy_eth_owned_resolver.ts new file mode 100644 index 0000000..d90c642 --- /dev/null +++ b/solidity/dns-contracts/deploy/resolvers/00_deploy_eth_owned_resolver.ts @@ -0,0 +1,31 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' +import { namehash } from 'viem' + +const func: DeployFunction = async function (hre) { + const { viem } = hre + + const { owner } = await viem.getNamedClients() + + const ethOwnedResolver = await viem.deploy('OwnedResolver', []) + + if (!ethOwnedResolver.newlyDeployed) return + + const registry = await viem.getContract('ENSRegistry') + const registrar = await viem.getContract('BaseRegistrarImplementation') + + const setResolverHash = await registrar.write.setResolver( + [ethOwnedResolver.address], + { account: owner.account }, + ) + await viem.waitForTransactionSuccess(setResolverHash) + + const resolver = await registry.read.resolver([namehash('creator')]) + console.log(`set resolver for .creator to ${resolver}`) + if (!ethOwnedResolver.newlyDeployed) return +} + +func.id = 'creator-owned-resolver' +func.tags = ['resolvers', 'OwnedResolver', 'EthOwnedResolver'] +func.dependencies = ['Registry'] + +export default func diff --git a/solidity/dns-contracts/deploy/resolvers/00_deploy_extended_dns_resolver.ts b/solidity/dns-contracts/deploy/resolvers/00_deploy_extended_dns_resolver.ts new file mode 100644 index 0000000..6401952 --- /dev/null +++ b/solidity/dns-contracts/deploy/resolvers/00_deploy_extended_dns_resolver.ts @@ -0,0 +1,11 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' + +const func: DeployFunction = async function (hre) { + const { viem } = hre + + await viem.deploy('ExtendedDNSResolver', []) +} + +func.tags = ['resolvers', 'ExtendedDNSResolver'] + +export default func diff --git a/solidity/dns-contracts/deploy/resolvers/00_deploy_legacy_public_resolver.ts b/solidity/dns-contracts/deploy/resolvers/00_deploy_legacy_public_resolver.ts new file mode 100644 index 0000000..f513742 --- /dev/null +++ b/solidity/dns-contracts/deploy/resolvers/00_deploy_legacy_public_resolver.ts @@ -0,0 +1,23 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' + +const func: DeployFunction = async function (hre) { + const { deployments, network, viem } = hre + + const registry = await viem.getContract('ENSRegistry') + + if (!network.tags.legacy) { + return + } + + await viem.deploy('LegacyPublicResolver', [registry.address], { + artifact: await deployments.getArtifact('PublicResolver_mainnet_9412610'), + }) + + return true +} + +func.id = 'legacy-resolver' +func.tags = ['resolvers', 'LegacyPublicResolver'] +func.dependencies = ['registry', 'wrapper'] + +export default func diff --git a/solidity/dns-contracts/deploy/resolvers/00_deploy_public_resolver.ts b/solidity/dns-contracts/deploy/resolvers/00_deploy_public_resolver.ts new file mode 100644 index 0000000..12d159c --- /dev/null +++ b/solidity/dns-contracts/deploy/resolvers/00_deploy_public_resolver.ts @@ -0,0 +1,68 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' +import { namehash } from 'viem' + +const func: DeployFunction = async function (hre) { + const { viem } = hre + + const { owner } = await viem.getNamedClients() + + const registry = await viem.getContract('ENSRegistry', owner) + const nameWrapper = await viem.getContract('NameWrapper') + const controller = await viem.getContract('ETHRegistrarController') + const reverseRegistrar = await viem.getContract('ReverseRegistrar', owner) + + const publicResolverDeployment = await viem.deploy('PublicResolver', [ + registry.address, + nameWrapper.address, + controller.address, + reverseRegistrar.address, + ]) + if (!publicResolverDeployment.newlyDeployed) return + + const reverseRegistrarSetDefaultResolverHash = + await reverseRegistrar.write.setDefaultResolver([ + publicResolverDeployment.address, + ]) + console.log( + `Setting default resolver on ReverseRegistrar to PublicResolver (tx: ${reverseRegistrarSetDefaultResolverHash})...`, + ) + await viem.waitForTransactionSuccess(reverseRegistrarSetDefaultResolverHash) + + const resolverEthOwner = await registry.read.owner([namehash('resolver.creator')]) + + if (resolverEthOwner === owner.address) { + const publicResolver = await viem.getContract('PublicResolver', owner) + const setResolverHash = await registry.write.setResolver([ + namehash('resolver.creator'), + publicResolver.address, + ]) + console.log( + `Setting resolver for resolver.creator to PublicResolver (tx: ${setResolverHash})...`, + ) + await viem.waitForTransactionSuccess(setResolverHash) + + const setAddrHash = await publicResolver.write.setAddr([ + namehash('resolver.creator'), + publicResolver.address, + ]) + console.log( + `Setting address for resolver.creator to PublicResolver (tx: ${setAddrHash})...`, + ) + await viem.waitForTransactionSuccess(setAddrHash) + } else { + console.log( + 'resolver.creator is not owned by the owner address, not setting resolver', + ) + } +} + +func.id = 'resolver' +func.tags = ['resolvers', 'PublicResolver'] +func.dependencies = [ + 'registry', + 'ETHRegistrarController', + 'NameWrapper', + 'ReverseRegistrar', +] + +export default func diff --git a/solidity/dns-contracts/deploy/root/00_deploy_root.ts b/solidity/dns-contracts/deploy/root/00_deploy_root.ts new file mode 100644 index 0000000..9f4e16c --- /dev/null +++ b/solidity/dns-contracts/deploy/root/00_deploy_root.ts @@ -0,0 +1,21 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' + +const func: DeployFunction = async function (hre) { + const { network, viem } = hre + + if (!network.tags.use_root) { + return true + } + + const registry = await viem.getContract('ENSRegistry') + + await viem.deploy('Root', [registry.address]) + + return true +} + +func.id = 'root' +func.tags = ['root', 'Root'] +func.dependencies = ['ENSRegistry'] + +export default func diff --git a/solidity/dns-contracts/deploy/root/00_setup_root.ts b/solidity/dns-contracts/deploy/root/00_setup_root.ts new file mode 100644 index 0000000..e5ed0cb --- /dev/null +++ b/solidity/dns-contracts/deploy/root/00_setup_root.ts @@ -0,0 +1,61 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' +import { zeroHash } from 'viem' + +const func: DeployFunction = async function (hre) { + const { network, viem } = hre + + const { deployer, owner } = await viem.getNamedClients() + + if (!network.tags.use_root) { + return true + } + + console.log('Running root setup') + + const registry = await viem.getContract('ENSRegistry') + const root = await viem.getContract('Root') + + const setOwnerHash = await registry.write.setOwner([zeroHash, root.address]) + console.log( + `Setting owner of root node to root contract (tx: ${setOwnerHash})...`, + ) + await viem.waitForTransactionSuccess(setOwnerHash) + + const rootOwner = await root.read.owner() + + switch (rootOwner) { + case deployer.address: + const transferOwnershipHash = await root.write.transferOwnership([ + owner.address, + ]) + console.log( + `Transferring root ownership to final owner (tx: ${transferOwnershipHash})...`, + ) + await viem.waitForTransactionSuccess(transferOwnershipHash) + case owner.address: + const ownerIsRootController = await root.read.controllers([owner.address]) + if (!ownerIsRootController) { + const setControllerHash = await root.write.setController( + [owner.address, true], + { account: owner.account }, + ) + console.log( + `Setting final owner as controller on root contract (tx: ${setControllerHash})...`, + ) + await viem.waitForTransactionSuccess(setControllerHash) + } + break + default: + console.log( + `WARNING: Root is owned by ${rootOwner}; cannot transfer to owner account`, + ) + } + + return true +} + +func.id = 'setupRoot' +func.tags = ['setupRoot'] +func.dependencies = ['Root'] + +export default func diff --git a/solidity/dns-contracts/deploy/wrapper/00_deploy_static_metadata_service.ts b/solidity/dns-contracts/deploy/wrapper/00_deploy_static_metadata_service.ts new file mode 100644 index 0000000..a16c700 --- /dev/null +++ b/solidity/dns-contracts/deploy/wrapper/00_deploy_static_metadata_service.ts @@ -0,0 +1,23 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' + +const func: DeployFunction = async function (hre) { + const { network, viem } = hre + + let metadataHost = + process.env.METADATA_HOST || 'ens-metadata-service.appspot.com' + + if (network.name === 'localhost') { + metadataHost = 'http://localhost:8080' + } + + const metadataUrl = `${metadataHost}/name/0x{id}` + + await viem.deploy('StaticMetadataService', [metadataUrl]) +} + +func.id = 'metadata' +func.tags = ['wrapper', 'StaticMetadataService'] +// technically not a dep, but we want to make sure it's deployed first for the consistent address +func.dependencies = ['BaseRegistrarImplementation'] + +export default func diff --git a/solidity/dns-contracts/deploy/wrapper/01_deploy_name_wrapper.ts b/solidity/dns-contracts/deploy/wrapper/01_deploy_name_wrapper.ts new file mode 100644 index 0000000..3e31916 --- /dev/null +++ b/solidity/dns-contracts/deploy/wrapper/01_deploy_name_wrapper.ts @@ -0,0 +1,72 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' +import { namehash, zeroAddress } from 'viem' +import { getInterfaceId } from '../../test/fixtures/createInterfaceId.js' + +const func: DeployFunction = async function (hre) { + const { network, viem } = hre + + const { deployer, owner } = await viem.getNamedClients() + + const registry = await viem.getContract('ENSRegistry', owner) + const registrar = await viem.getContract('BaseRegistrarImplementation', owner) + const metadata = await viem.getContract('StaticMetadataService', owner) + + const nameWrapperDeployment = await viem.deploy('NameWrapper', [ + registry.address, + registrar.address, + metadata.address, + ]) + if (!nameWrapperDeployment.newlyDeployed) return + + const nameWrapper = await viem.getContract('NameWrapper') + + if (owner.address !== deployer.address) { + const hash = await nameWrapper.write.transferOwnership([owner.address]) + console.log( + `Transferring ownership of NameWrapper to ${owner.address} (tx: ${hash})...`, + ) + await viem.waitForTransactionSuccess(hash) + } + + // Only attempt to make controller etc changes directly on testnets + if (network.name === 'mainnet') return + + const addControllerHash = await registrar.write.addController([ + nameWrapper.address, + ]) + console.log( + `Adding NameWrapper as controller on registrar (tx: ${addControllerHash})...`, + ) + await viem.waitForTransactionSuccess(addControllerHash) + + const interfaceId = await getInterfaceId('INameWrapper') + const resolver = await registry.read.resolver([namehash('creator')]) + if (resolver === zeroAddress) { + console.log( + `No resolver set for .creator; not setting interface ${interfaceId} for NameWrapper`, + ) + return + } + + const resolverContract = await viem.getContractAt('OwnedResolver', resolver) + const setInterfaceHash = await resolverContract.write.setInterface([ + namehash('creator'), + interfaceId, + nameWrapper.address, + ]) + console.log( + `Setting NameWrapper interface ID ${interfaceId} on .creator resolver (tx: ${setInterfaceHash})...`, + ) + await viem.waitForTransactionSuccess(setInterfaceHash) +} + +func.id = 'name-wrapper' +func.tags = ['wrapper', 'NameWrapper'] +func.dependencies = [ + 'StaticMetadataService', + 'registry', + 'ReverseRegistrar', + 'OwnedResolver', +] + +export default func diff --git a/solidity/dns-contracts/deploy/wrapper/02_deploy_test_unwrap.ts b/solidity/dns-contracts/deploy/wrapper/02_deploy_test_unwrap.ts new file mode 100644 index 0000000..4002ff0 --- /dev/null +++ b/solidity/dns-contracts/deploy/wrapper/02_deploy_test_unwrap.ts @@ -0,0 +1,117 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' +import type { Address } from 'viem' + +const TESTNET_WRAPPER_ADDRESSES = { + goerli: [ + '0x582224b8d4534F4749EFA4f22eF7241E0C56D4B8', + '0xEe1F756aCde7E81B2D8cC6aB3c8A1E2cE6db0F39', + '0x060f1546642E67c485D56248201feA2f9AB1803C', + // Add more testnet NameWrapper addresses here... + ], +} + +const func: DeployFunction = async function (hre) { + const { deployments, network, viem } = hre + + const { deployer, owner, ...namedAccounts } = await viem.getNamedClients() + const unnamedClients = await viem.getUnnamedClients() + const clients = [deployer, owner, ...unnamedClients] + + // only deploy on testnets + if (network.name === 'mainnet') return + + const registry = await viem.getContract('ENSRegistry', owner) + const registrar = await viem.getContract('BaseRegistrarImplementation', owner) + + await viem.deploy('TestUnwrap', [registry.address, registrar.address]) + + const testnetWrapperAddresses = TESTNET_WRAPPER_ADDRESSES[ + network.name as keyof typeof TESTNET_WRAPPER_ADDRESSES + ] as Address[] + + if (!testnetWrapperAddresses || testnetWrapperAddresses.length === 0) { + console.log('No testnet wrappers found, skipping') + return + } + + let testUnwrap = await viem.getContract('TestUnwrap') + const contractOwner = await testUnwrap.read.owner() + const contractOwnerClient = clients.find((c) => c.address === contractOwner) + const canModifyTestUnwrap = !!contractOwnerClient + + if (!canModifyTestUnwrap) { + console.log( + "WARNING: Can't modify TestUnwrap, will not run setWrapperApproval()", + ) + } else { + testUnwrap = await viem.getContract('TestUnwrap', contractOwnerClient) + } + + for (const wrapperAddress of testnetWrapperAddresses) { + let wrapper = await viem.getContractAt('NameWrapper', wrapperAddress) + const upgradeContract = await wrapper.read.upgradeContract() + + const isUpgradeSet = upgradeContract === testUnwrap.address + const isApprovedWrapper = await testUnwrap.read.approvedWrapper([ + wrapperAddress, + ]) + + if (isUpgradeSet && isApprovedWrapper) { + console.log(`Wrapper ${wrapperAddress} already set up, skipping contract`) + continue + } + + if (!isUpgradeSet) { + const owner = await wrapper.read.owner() + const wrapperOwnerClient = clients.find((c) => c.address === owner) + const canModifyWrapper = !!wrapperOwnerClient + + if (!canModifyWrapper && !canModifyTestUnwrap) { + console.log( + `WARNING: Can't modify wrapper ${wrapperAddress} or TestUnwrap, skipping contract`, + ) + continue + } else if (!canModifyWrapper) { + console.log( + `WARNING: Can't modify wrapper ${wrapperAddress}, skipping setUpgradeContract()`, + ) + } else { + wrapper = await viem.getContractAt('NameWrapper', wrapperAddress, { + client: wrapperOwnerClient, + }) + const hash = await wrapper.write.setUpgradeContract([ + testUnwrap.address, + ]) + console.log( + `Setting upgrade contract for ${wrapperAddress} to ${testUnwrap.address} (tx: ${hash})...`, + ) + await viem.waitForTransactionSuccess(hash) + } + if (isApprovedWrapper) { + console.log( + `Wrapper ${wrapperAddress} already approved, skipping setWrapperApproval()`, + ) + continue + } + } + if (!canModifyTestUnwrap) { + console.log( + `WARNING: Can't modify TestUnwrap, skipping setWrapperApproval() for ${wrapperAddress}`, + ) + continue + } + + const hash = await testUnwrap.write.setWrapperApproval([ + wrapperAddress, + true, + ]) + console.log(`Approving wrapper ${wrapperAddress} (tx: ${hash})...`) + await viem.waitForTransactionSuccess(hash) + } +} + +func.id = 'test-unwrap' +func.tags = ['wrapper', 'TestUnwrap'] +func.dependencies = ['BaseRegistrarImplementation', 'registry'] + +export default func diff --git a/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/BaseRegistrar.json b/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/BaseRegistrar.json new file mode 100644 index 0000000..712499a --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/BaseRegistrar.json @@ -0,0 +1,714 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "BaseRegistrar", + "sourceName": "contracts/legacy/ETHRegistrarController_mainnet_9380471.sol", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "ControllerAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "ControllerRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameMigrated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRenewed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "GRACE_PERIOD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "addController", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "available", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "baseNode", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "nameExpires", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "reclaim", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "register", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "removeController", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "_approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/ENS.json b/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/ENS.json new file mode 100644 index 0000000..02abe7a --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/ENS.json @@ -0,0 +1,404 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "ENS", + "sourceName": "contracts/legacy/ETHRegistrarController_mainnet_9380471.sol", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NewOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "NewResolver", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "NewTTL", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "recordExists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "resolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setRecord", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "ttl", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/ETHRegistrarController_mainnet_9380471.json b/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/ETHRegistrarController_mainnet_9380471.json new file mode 100644 index 0000000..b1f62f6 --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/ETHRegistrarController_mainnet_9380471.json @@ -0,0 +1,568 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "ETHRegistrarController_mainnet_9380471", + "sourceName": "contracts/legacy/ETHRegistrarController_mainnet_9380471.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "contract BaseRegistrar", + "name": "_base", + "type": "address" + }, + { + "internalType": "contract PriceOracle", + "name": "_prices", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minCommitmentAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxCommitmentAge", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRenewed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oracle", + "type": "address" + } + ], + "name": "NewPriceOracle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "MIN_REGISTRATION_DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "available", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "commit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "commitments", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + } + ], + "name": "makeCommitment", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "makeCommitmentWithConfig", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "maxCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "minCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + } + ], + "name": "register", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "registerWithConfig", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "rentPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_minCommitmentAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxCommitmentAge", + "type": "uint256" + } + ], + "name": "setCommitmentAges", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract PriceOracle", + "name": "_prices", + "type": "address" + } + ], + "name": "setPriceOracle", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "valid", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "withdraw", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x608060405234801561001057600080fd5b50604051611f8c380380611f8c8339818101604052608081101561003357600080fd5b5080516020820151604080840151606090940151600080546001600160a01b031916331780825592519495939491926001600160a01b0316917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a381811161009d57600080fd5b600180546001600160a01b039586166001600160a01b0319918216179091556002805494909516931692909217909255600391909155600455611ea7806100e56000396000f3fe60806040526004361061016a5760003560e01c80638d839ffe116100cb578063aeb8ce9b1161007f578063f2fde38b11610059578063f2fde38b1461075f578063f49826be1461079f578063f7a169631461086d5761016a565b8063aeb8ce9b1461066d578063ce1e09c014610720578063f14fcbc8146107355761016a565b80638f32d59b116100b05780638f32d59b146105355780639791c0971461054a578063acf1a841146105fd5761016a565b80638d839ffe146104e25780638da5cb5b146104f75761016a565b80637e3244791161012257806383e7f6ff1161010757806383e7f6ff1461038657806385f6d1551461043b5780638a95b09f146104cd5761016a565b80637e3244791461032c578063839df9451461035c5761016a565b80633d86c52f116101535780633d86c52f146101e6578063530e784f146102d7578063715018a6146103175761016a565b806301ffc9a71461016f5780633ccfd60b146101cf575b600080fd5b34801561017b57600080fd5b506101bb6004803603602081101561019257600080fd5b50357fffffffff0000000000000000000000000000000000000000000000000000000016610944565b604080519115158252519081900360200190f35b3480156101db57600080fd5b506101e4610b63565b005b3480156101f257600080fd5b506102c5600480360360a081101561020957600080fd5b81019060208101813564010000000081111561022457600080fd5b82018360208201111561023657600080fd5b8035906020019184600183028401116401000000008311171561025857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff83358116945060208401359360408101358216935060600135169050610ba3565b60408051918252519081900360200190f35b3480156102e357600080fd5b506101e4600480360360208110156102fa57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610cdf565b34801561032357600080fd5b506101e4610d65565b34801561033857600080fd5b506101e46004803603604081101561034f57600080fd5b5080359060200135610de5565b34801561036857600080fd5b506102c56004803603602081101561037f57600080fd5b5035610e01565b34801561039257600080fd5b506102c5600480360360408110156103a957600080fd5b8101906020810181356401000000008111156103c457600080fd5b8201836020820111156103d657600080fd5b803590602001918460018302840111640100000000831117156103f857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610e13915050565b6101e46004803603608081101561045157600080fd5b81019060208101813564010000000081111561046c57600080fd5b82018360208201111561047e57600080fd5b803590602001918460018302840111640100000000831117156104a057600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff8135169060208101359060400135610fc3565b3480156104d957600080fd5b506102c561100e565b3480156104ee57600080fd5b506102c5611015565b34801561050357600080fd5b5061050c61101b565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561054157600080fd5b506101bb611037565b34801561055657600080fd5b506101bb6004803603602081101561056d57600080fd5b81019060208101813564010000000081111561058857600080fd5b82018360208201111561059a57600080fd5b803590602001918460018302840111640100000000831117156105bc57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611055945050505050565b6101e46004803603604081101561061357600080fd5b81019060208101813564010000000081111561062e57600080fd5b82018360208201111561064057600080fd5b8035906020019184600183028401116401000000008311171561066257600080fd5b91935091503561106a565b34801561067957600080fd5b506101bb6004803603602081101561069057600080fd5b8101906020810181356401000000008111156106ab57600080fd5b8201836020820111156106bd57600080fd5b803590602001918460018302840111640100000000831117156106df57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611252945050505050565b34801561072c57600080fd5b506102c5611312565b34801561074157600080fd5b506101e46004803603602081101561075857600080fd5b5035611318565b34801561076b57600080fd5b506101e46004803603602081101561078257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661134a565b3480156107ab57600080fd5b506102c5600480360360608110156107c257600080fd5b8101906020810181356401000000008111156107dd57600080fd5b8201836020820111156107ef57600080fd5b8035906020019184600183028401116401000000008311171561081157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff8335169350505060200135611364565b6101e4600480360360c081101561088357600080fd5b81019060208101813564010000000081111561089e57600080fd5b8201836020820111156108b057600080fd5b803590602001918460018302840111640100000000831117156108d257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff83358116945060208401359360408101359350606081013582169250608001351661137c565b604080517f737570706f727473496e74657266616365286279746573342900000000000000815290519081900360190190206000907fffffffff0000000000000000000000000000000000000000000000000000000083811691161480610ae75750604080517f72656e657728737472696e672c75696e743235362900000000000000000000008152905190819003601501812090806028611de38239604080519182900360280182207f636f6d6d697428627974657333322900000000000000000000000000000000008352905191829003600f01822090925090806026611e0b82396026019050604051809103902060405180807f617661696c61626c6528737472696e67290000000000000000000000000000008152506011019050604051809103902060405180807f72656e74507269636528737472696e672c75696e7432353629000000000000008152506019019050604051809103902018181818187bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610b5d57506040518080611da36040913960408051918290030181209150806042611e31823960420190506040518091039020187bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b92915050565b610b6b611037565b610b7457600080fd5b60405133904780156108fc02916000818181858888f19350505050158015610ba0573d6000803e3d6000fd5b50565b8451602086012060009073ffffffffffffffffffffffffffffffffffffffff8416158015610be5575073ffffffffffffffffffffffffffffffffffffffff8316155b15610c4857604080516020808201939093527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089901b1681830152605480820188905282518083039091018152607490910190915280519101209050610cd6565b73ffffffffffffffffffffffffffffffffffffffff8416610c6857600080fd5b604080516020808201939093527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b82168385015287811b8216605484015286901b166068820152607c80820188905282518083039091018152609c909101909152805191012090505b95945050505050565b610ce7611037565b610cf057600080fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691909117918290556040519116907ff261845a790fe29bbd6631e2ca4a5bdc83e6eed7c3271d9590d97287e00e912390600090a250565b610d6d611037565b610d7657600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b610ded611037565b610df657600080fd5b600391909155600455565b60056020526000908152604090205481565b8151602080840191909120600254600154604080517fd6e4fa8600000000000000000000000000000000000000000000000000000000815260048101859052905160009573ffffffffffffffffffffffffffffffffffffffff948516946350e9a715948a9491169263d6e4fa8692602480840193919291829003018186803b158015610e9e57600080fd5b505afa158015610eb2573d6000803e3d6000fd5b505050506040513d6020811015610ec857600080fd5b50516040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152602481018290526044810188905260606004820190815283516064830152835189928291608490910190602087019080838360005b83811015610f43578181015183820152602001610f2b565b50505050905090810190601f168015610f705780820380516001836020036101000a031916815260200191505b5094505050505060206040518083038186803b158015610f8f57600080fd5b505afa158015610fa3573d6000803e3d6000fd5b505050506040513d6020811015610fb957600080fd5b5051949350505050565b61100785858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508893508792508691508061137c565b5050505050565b6224ea0081565b60035481565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60005473ffffffffffffffffffffffffffffffffffffffff16331490565b6000600361106283611a7c565b101592915050565b60006110ad84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869250610e13915050565b9050803410156110bc57600080fd5b6000848460405180838380828437604080519390910183900383206001547fc475abff00000000000000000000000000000000000000000000000000000000855260048501829052602485018b905291519097506000965073ffffffffffffffffffffffffffffffffffffffff909116945063c475abff93506044808401936020935082900301818787803b15801561115457600080fd5b505af1158015611168573d6000803e3d6000fd5b505050506040513d602081101561117e57600080fd5b50519050348310156111bb5760405133903485900380156108fc02916000818181858888f193505050501580156111b9573d6000803e3d6000fd5b505b817f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae8787868560405180806020018481526020018381526020018281038252868682818152602001925080828437600083820152604051601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690920182900397509095505050505050a2505050505050565b8051602082012060009061126583611055565b801561130b5750600154604080517f96e494e800000000000000000000000000000000000000000000000000000000815260048101849052905173ffffffffffffffffffffffffffffffffffffffff909216916396e494e891602480820192602092909190829003018186803b1580156112de57600080fd5b505afa1580156112f2573d6000803e3d6000fd5b505050506040513d602081101561130857600080fd5b50515b9392505050565b60045481565b6004546000828152600560205260409020544291011061133757600080fd5b6000908152600560205260409020429055565b611352611037565b61135b57600080fd5b610ba081611c68565b6000611374848484600080610ba3565b949350505050565b600061138b8787868686610ba3565b9050600061139a888784611d15565b885160208a012090915080600073ffffffffffffffffffffffffffffffffffffffff8716156118a257600154604080517ffca247ac00000000000000000000000000000000000000000000000000000000815260048101859052306024820152604481018c9052905173ffffffffffffffffffffffffffffffffffffffff9092169163fca247ac916064808201926020929091908290030181600087803b15801561144457600080fd5b505af1158015611458573d6000803e3d6000fd5b505050506040513d602081101561146e57600080fd5b5051600154604080517fddf7fcb0000000000000000000000000000000000000000000000000000000008152905192935060009273ffffffffffffffffffffffffffffffffffffffff9092169163ddf7fcb091600480820192602092909190829003018186803b1580156114e157600080fd5b505afa1580156114f5573d6000803e3d6000fd5b505050506040513d602081101561150b57600080fd5b505160408051602081810193909352808201879052815180820383018152606082018084528151918501919091206001547f3f15457f00000000000000000000000000000000000000000000000000000000909252925192945073ffffffffffffffffffffffffffffffffffffffff1692633f15457f92606480840193829003018186803b15801561159c57600080fd5b505afa1580156115b0573d6000803e3d6000fd5b505050506040513d60208110156115c657600080fd5b5051604080517f1896f70a0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8b8116602483015291519190921691631896f70a91604480830192600092919082900301818387803b15801561164057600080fd5b505af1158015611654573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff871615611714578773ffffffffffffffffffffffffffffffffffffffff1663d5fa2b0082896040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050600060405180830381600087803b1580156116fb57600080fd5b505af115801561170f573d6000803e3d6000fd5b505050505b600154604080517f28ed4f6c0000000000000000000000000000000000000000000000000000000081526004810186905273ffffffffffffffffffffffffffffffffffffffff8e81166024830152915191909216916328ed4f6c91604480830192600092919082900301818387803b15801561178f57600080fd5b505af11580156117a3573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd308d866040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561188457600080fd5b505af1158015611898573d6000803e3d6000fd5b5050505050611975565b73ffffffffffffffffffffffffffffffffffffffff8616156118c357600080fd5b600154604080517ffca247ac0000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff8d81166024830152604482018d90529151919092169163fca247ac9160648083019260209291908290030181600087803b15801561194657600080fd5b505af115801561195a573d6000803e3d6000fd5b505050506040513d602081101561197057600080fd5b505190505b8973ffffffffffffffffffffffffffffffffffffffff16837fca6abbe9d7f11422cb6ca7629fbf6fe9efb1c621f71ce8f02b9f2a230097404f8d87856040518080602001848152602001838152602001828103825285818151815260200191508051906020019080838360005b838110156119fa5781810151838201526020016119e2565b50505050905090810190601f168015611a275780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a383341115611a6f5760405133903486900380156108fc02916000818181858888f19350505050158015611a6d573d6000803e3d6000fd5b505b5050505050505050505050565b8051600090819081905b80821015611c5f576000858381518110611a9c57fe5b01602001517fff000000000000000000000000000000000000000000000000000000000000001690507f8000000000000000000000000000000000000000000000000000000000000000811015611af857600183019250611c53565b7fe0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611b4d57600283019250611c53565b7ff0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611ba257600383019250611c53565b7ff8000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611bf757600483019250611c53565b7ffc000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611c4c57600583019250611c53565b6006830192505b50600190920191611a86565b50909392505050565b73ffffffffffffffffffffffffffffffffffffffff8116611c8857600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60035460008281526005602052604081205490914291011115611d3757600080fd5b60045460008381526005602052604090205442910111611d5657600080fd5b611d5f84611252565b611d6857600080fd5b6000828152600560205260408120819055611d838585610e13565b90506224ea00841015611d9557600080fd5b8034101561137457600080fdfe6d616b65436f6d6d69746d656e7457697468436f6e66696728737472696e672c616464726573732c627974657333322c616464726573732c6164647265737329726567697374657228737472696e672c616464726573732c75696e743235362c62797465733332296d616b65436f6d6d69746d656e7428737472696e672c616464726573732c6279746573333229726567697374657257697468436f6e66696728737472696e672c616464726573732c75696e743235362c627974657333322c616464726573732c6164647265737329a265627a7a7231582053a253c3d59287a7d8afcbca61f9a34825e2003361654c7f2350c82db76d3db764736f6c63430005110032", + "deployedBytecode": "0x60806040526004361061016a5760003560e01c80638d839ffe116100cb578063aeb8ce9b1161007f578063f2fde38b11610059578063f2fde38b1461075f578063f49826be1461079f578063f7a169631461086d5761016a565b8063aeb8ce9b1461066d578063ce1e09c014610720578063f14fcbc8146107355761016a565b80638f32d59b116100b05780638f32d59b146105355780639791c0971461054a578063acf1a841146105fd5761016a565b80638d839ffe146104e25780638da5cb5b146104f75761016a565b80637e3244791161012257806383e7f6ff1161010757806383e7f6ff1461038657806385f6d1551461043b5780638a95b09f146104cd5761016a565b80637e3244791461032c578063839df9451461035c5761016a565b80633d86c52f116101535780633d86c52f146101e6578063530e784f146102d7578063715018a6146103175761016a565b806301ffc9a71461016f5780633ccfd60b146101cf575b600080fd5b34801561017b57600080fd5b506101bb6004803603602081101561019257600080fd5b50357fffffffff0000000000000000000000000000000000000000000000000000000016610944565b604080519115158252519081900360200190f35b3480156101db57600080fd5b506101e4610b63565b005b3480156101f257600080fd5b506102c5600480360360a081101561020957600080fd5b81019060208101813564010000000081111561022457600080fd5b82018360208201111561023657600080fd5b8035906020019184600183028401116401000000008311171561025857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff83358116945060208401359360408101358216935060600135169050610ba3565b60408051918252519081900360200190f35b3480156102e357600080fd5b506101e4600480360360208110156102fa57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610cdf565b34801561032357600080fd5b506101e4610d65565b34801561033857600080fd5b506101e46004803603604081101561034f57600080fd5b5080359060200135610de5565b34801561036857600080fd5b506102c56004803603602081101561037f57600080fd5b5035610e01565b34801561039257600080fd5b506102c5600480360360408110156103a957600080fd5b8101906020810181356401000000008111156103c457600080fd5b8201836020820111156103d657600080fd5b803590602001918460018302840111640100000000831117156103f857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610e13915050565b6101e46004803603608081101561045157600080fd5b81019060208101813564010000000081111561046c57600080fd5b82018360208201111561047e57600080fd5b803590602001918460018302840111640100000000831117156104a057600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff8135169060208101359060400135610fc3565b3480156104d957600080fd5b506102c561100e565b3480156104ee57600080fd5b506102c5611015565b34801561050357600080fd5b5061050c61101b565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561054157600080fd5b506101bb611037565b34801561055657600080fd5b506101bb6004803603602081101561056d57600080fd5b81019060208101813564010000000081111561058857600080fd5b82018360208201111561059a57600080fd5b803590602001918460018302840111640100000000831117156105bc57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611055945050505050565b6101e46004803603604081101561061357600080fd5b81019060208101813564010000000081111561062e57600080fd5b82018360208201111561064057600080fd5b8035906020019184600183028401116401000000008311171561066257600080fd5b91935091503561106a565b34801561067957600080fd5b506101bb6004803603602081101561069057600080fd5b8101906020810181356401000000008111156106ab57600080fd5b8201836020820111156106bd57600080fd5b803590602001918460018302840111640100000000831117156106df57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611252945050505050565b34801561072c57600080fd5b506102c5611312565b34801561074157600080fd5b506101e46004803603602081101561075857600080fd5b5035611318565b34801561076b57600080fd5b506101e46004803603602081101561078257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661134a565b3480156107ab57600080fd5b506102c5600480360360608110156107c257600080fd5b8101906020810181356401000000008111156107dd57600080fd5b8201836020820111156107ef57600080fd5b8035906020019184600183028401116401000000008311171561081157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff8335169350505060200135611364565b6101e4600480360360c081101561088357600080fd5b81019060208101813564010000000081111561089e57600080fd5b8201836020820111156108b057600080fd5b803590602001918460018302840111640100000000831117156108d257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff83358116945060208401359360408101359350606081013582169250608001351661137c565b604080517f737570706f727473496e74657266616365286279746573342900000000000000815290519081900360190190206000907fffffffff0000000000000000000000000000000000000000000000000000000083811691161480610ae75750604080517f72656e657728737472696e672c75696e743235362900000000000000000000008152905190819003601501812090806028611de38239604080519182900360280182207f636f6d6d697428627974657333322900000000000000000000000000000000008352905191829003600f01822090925090806026611e0b82396026019050604051809103902060405180807f617661696c61626c6528737472696e67290000000000000000000000000000008152506011019050604051809103902060405180807f72656e74507269636528737472696e672c75696e7432353629000000000000008152506019019050604051809103902018181818187bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610b5d57506040518080611da36040913960408051918290030181209150806042611e31823960420190506040518091039020187bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b92915050565b610b6b611037565b610b7457600080fd5b60405133904780156108fc02916000818181858888f19350505050158015610ba0573d6000803e3d6000fd5b50565b8451602086012060009073ffffffffffffffffffffffffffffffffffffffff8416158015610be5575073ffffffffffffffffffffffffffffffffffffffff8316155b15610c4857604080516020808201939093527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089901b1681830152605480820188905282518083039091018152607490910190915280519101209050610cd6565b73ffffffffffffffffffffffffffffffffffffffff8416610c6857600080fd5b604080516020808201939093527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b82168385015287811b8216605484015286901b166068820152607c80820188905282518083039091018152609c909101909152805191012090505b95945050505050565b610ce7611037565b610cf057600080fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691909117918290556040519116907ff261845a790fe29bbd6631e2ca4a5bdc83e6eed7c3271d9590d97287e00e912390600090a250565b610d6d611037565b610d7657600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b610ded611037565b610df657600080fd5b600391909155600455565b60056020526000908152604090205481565b8151602080840191909120600254600154604080517fd6e4fa8600000000000000000000000000000000000000000000000000000000815260048101859052905160009573ffffffffffffffffffffffffffffffffffffffff948516946350e9a715948a9491169263d6e4fa8692602480840193919291829003018186803b158015610e9e57600080fd5b505afa158015610eb2573d6000803e3d6000fd5b505050506040513d6020811015610ec857600080fd5b50516040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152602481018290526044810188905260606004820190815283516064830152835189928291608490910190602087019080838360005b83811015610f43578181015183820152602001610f2b565b50505050905090810190601f168015610f705780820380516001836020036101000a031916815260200191505b5094505050505060206040518083038186803b158015610f8f57600080fd5b505afa158015610fa3573d6000803e3d6000fd5b505050506040513d6020811015610fb957600080fd5b5051949350505050565b61100785858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508893508792508691508061137c565b5050505050565b6224ea0081565b60035481565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60005473ffffffffffffffffffffffffffffffffffffffff16331490565b6000600361106283611a7c565b101592915050565b60006110ad84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869250610e13915050565b9050803410156110bc57600080fd5b6000848460405180838380828437604080519390910183900383206001547fc475abff00000000000000000000000000000000000000000000000000000000855260048501829052602485018b905291519097506000965073ffffffffffffffffffffffffffffffffffffffff909116945063c475abff93506044808401936020935082900301818787803b15801561115457600080fd5b505af1158015611168573d6000803e3d6000fd5b505050506040513d602081101561117e57600080fd5b50519050348310156111bb5760405133903485900380156108fc02916000818181858888f193505050501580156111b9573d6000803e3d6000fd5b505b817f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae8787868560405180806020018481526020018381526020018281038252868682818152602001925080828437600083820152604051601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690920182900397509095505050505050a2505050505050565b8051602082012060009061126583611055565b801561130b5750600154604080517f96e494e800000000000000000000000000000000000000000000000000000000815260048101849052905173ffffffffffffffffffffffffffffffffffffffff909216916396e494e891602480820192602092909190829003018186803b1580156112de57600080fd5b505afa1580156112f2573d6000803e3d6000fd5b505050506040513d602081101561130857600080fd5b50515b9392505050565b60045481565b6004546000828152600560205260409020544291011061133757600080fd5b6000908152600560205260409020429055565b611352611037565b61135b57600080fd5b610ba081611c68565b6000611374848484600080610ba3565b949350505050565b600061138b8787868686610ba3565b9050600061139a888784611d15565b885160208a012090915080600073ffffffffffffffffffffffffffffffffffffffff8716156118a257600154604080517ffca247ac00000000000000000000000000000000000000000000000000000000815260048101859052306024820152604481018c9052905173ffffffffffffffffffffffffffffffffffffffff9092169163fca247ac916064808201926020929091908290030181600087803b15801561144457600080fd5b505af1158015611458573d6000803e3d6000fd5b505050506040513d602081101561146e57600080fd5b5051600154604080517fddf7fcb0000000000000000000000000000000000000000000000000000000008152905192935060009273ffffffffffffffffffffffffffffffffffffffff9092169163ddf7fcb091600480820192602092909190829003018186803b1580156114e157600080fd5b505afa1580156114f5573d6000803e3d6000fd5b505050506040513d602081101561150b57600080fd5b505160408051602081810193909352808201879052815180820383018152606082018084528151918501919091206001547f3f15457f00000000000000000000000000000000000000000000000000000000909252925192945073ffffffffffffffffffffffffffffffffffffffff1692633f15457f92606480840193829003018186803b15801561159c57600080fd5b505afa1580156115b0573d6000803e3d6000fd5b505050506040513d60208110156115c657600080fd5b5051604080517f1896f70a0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8b8116602483015291519190921691631896f70a91604480830192600092919082900301818387803b15801561164057600080fd5b505af1158015611654573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff871615611714578773ffffffffffffffffffffffffffffffffffffffff1663d5fa2b0082896040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050600060405180830381600087803b1580156116fb57600080fd5b505af115801561170f573d6000803e3d6000fd5b505050505b600154604080517f28ed4f6c0000000000000000000000000000000000000000000000000000000081526004810186905273ffffffffffffffffffffffffffffffffffffffff8e81166024830152915191909216916328ed4f6c91604480830192600092919082900301818387803b15801561178f57600080fd5b505af11580156117a3573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd308d866040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561188457600080fd5b505af1158015611898573d6000803e3d6000fd5b5050505050611975565b73ffffffffffffffffffffffffffffffffffffffff8616156118c357600080fd5b600154604080517ffca247ac0000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff8d81166024830152604482018d90529151919092169163fca247ac9160648083019260209291908290030181600087803b15801561194657600080fd5b505af115801561195a573d6000803e3d6000fd5b505050506040513d602081101561197057600080fd5b505190505b8973ffffffffffffffffffffffffffffffffffffffff16837fca6abbe9d7f11422cb6ca7629fbf6fe9efb1c621f71ce8f02b9f2a230097404f8d87856040518080602001848152602001838152602001828103825285818151815260200191508051906020019080838360005b838110156119fa5781810151838201526020016119e2565b50505050905090810190601f168015611a275780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a383341115611a6f5760405133903486900380156108fc02916000818181858888f19350505050158015611a6d573d6000803e3d6000fd5b505b5050505050505050505050565b8051600090819081905b80821015611c5f576000858381518110611a9c57fe5b01602001517fff000000000000000000000000000000000000000000000000000000000000001690507f8000000000000000000000000000000000000000000000000000000000000000811015611af857600183019250611c53565b7fe0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611b4d57600283019250611c53565b7ff0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611ba257600383019250611c53565b7ff8000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611bf757600483019250611c53565b7ffc000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611c4c57600583019250611c53565b6006830192505b50600190920191611a86565b50909392505050565b73ffffffffffffffffffffffffffffffffffffffff8116611c8857600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60035460008281526005602052604081205490914291011115611d3757600080fd5b60045460008381526005602052604090205442910111611d5657600080fd5b611d5f84611252565b611d6857600080fd5b6000828152600560205260408120819055611d838585610e13565b90506224ea00841015611d9557600080fd5b8034101561137457600080fdfe6d616b65436f6d6d69746d656e7457697468436f6e66696728737472696e672c616464726573732c627974657333322c616464726573732c6164647265737329726567697374657228737472696e672c616464726573732c75696e743235362c62797465733332296d616b65436f6d6d69746d656e7428737472696e672c616464726573732c6279746573333229726567697374657257697468436f6e66696728737472696e672c616464726573732c75696e743235362c627974657333322c616464726573732c6164647265737329a265627a7a7231582053a253c3d59287a7d8afcbca61f9a34825e2003361654c7f2350c82db76d3db764736f6c63430005110032", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/IERC165.json b/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/IERC165.json new file mode 100644 index 0000000..29d74d2 --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/IERC165.json @@ -0,0 +1,32 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "IERC165", + "sourceName": "contracts/legacy/ETHRegistrarController_mainnet_9380471.sol", + "abi": [ + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/IERC721.json b/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/IERC721.json new file mode 100644 index 0000000..d57024e --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/IERC721.json @@ -0,0 +1,316 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "IERC721", + "sourceName": "contracts/legacy/ETHRegistrarController_mainnet_9380471.sol", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "_approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/Ownable.json b/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/Ownable.json new file mode 100644 index 0000000..4f7a2c5 --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/Ownable.json @@ -0,0 +1,90 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "Ownable", + "sourceName": "contracts/legacy/ETHRegistrarController_mainnet_9380471.sol", + "abi": [ + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/PriceOracle.json b/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/PriceOracle.json new file mode 100644 index 0000000..485ffdf --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/PriceOracle.json @@ -0,0 +1,42 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "PriceOracle", + "sourceName": "contracts/legacy/ETHRegistrarController_mainnet_9380471.sol", + "abi": [ + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "price", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/Resolver.json b/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/Resolver.json new file mode 100644 index 0000000..3056993 --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/Resolver.json @@ -0,0 +1,708 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "Resolver", + "sourceName": "contracts/legacy/ETHRegistrarController_mainnet_9380471.sol", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + } + ], + "name": "ABIChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "AddrChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "name": "ContentChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "ContenthashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "PubkeyChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "string", + "name": "indexedKey", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "TextChanged", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentTypes", + "type": "uint256" + } + ], + "name": "ABI", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "content", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "contenthash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "dnsrr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "interfaceImplementer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "multihash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "pubkey", + "outputs": [ + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setABI", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "a", + "type": "bytes" + } + ], + "name": "setAddr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "setAddr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "name": "setContent", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setContenthash", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setDnsrr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "setInterface", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setMultihash", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "setPubkey", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "setText", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "text", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/StringUtils.json b/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/StringUtils.json new file mode 100644 index 0000000..d6aad61 --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/ETHRegistrarController_mainnet_9380471.sol/StringUtils.json @@ -0,0 +1,10 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "StringUtils", + "sourceName": "contracts/legacy/ETHRegistrarController_mainnet_9380471.sol", + "abi": [], + "bytecode": "0x60556023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72315820aaf7b8318e8004dd02fab147570660ad0d00db8ef375be9f7efc8927224409f864736f6c63430005110032", + "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72315820aaf7b8318e8004dd02fab147570660ad0d00db8ef375be9f7efc8927224409f864736f6c63430005110032", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/ABIResolver.json b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/ABIResolver.json new file mode 100644 index 0000000..f727158 --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/ABIResolver.json @@ -0,0 +1,107 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "ABIResolver", + "sourceName": "contracts/legacy/PublicResolver_mainnet_9412610.sol", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + } + ], + "name": "ABIChanged", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentTypes", + "type": "uint256" + } + ], + "name": "ABI", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setABI", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/AddrResolver.json b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/AddrResolver.json new file mode 100644 index 0000000..e0c1c39 --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/AddrResolver.json @@ -0,0 +1,168 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "AddrResolver", + "sourceName": "contracts/legacy/PublicResolver_mainnet_9412610.sol", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "AddrChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "a", + "type": "bytes" + } + ], + "name": "setAddr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "setAddr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/Buffer.json b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/Buffer.json new file mode 100644 index 0000000..81fed6c --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/Buffer.json @@ -0,0 +1,10 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "Buffer", + "sourceName": "contracts/legacy/PublicResolver_mainnet_9412610.sol", + "abi": [], + "bytecode": "0x60636023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea365627a7a7231582010b3f0480e604d1ec4a8378abf0cc88b870bf9f1dde6dba8cdabe13e76b810126c6578706572696d656e74616cf564736f6c63430005110040", + "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea365627a7a7231582010b3f0480e604d1ec4a8378abf0cc88b870bf9f1dde6dba8cdabe13e76b810126c6578706572696d656e74616cf564736f6c63430005110040", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/BytesUtils.json b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/BytesUtils.json new file mode 100644 index 0000000..1a34a75 --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/BytesUtils.json @@ -0,0 +1,10 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "BytesUtils", + "sourceName": "contracts/legacy/PublicResolver_mainnet_9412610.sol", + "abi": [], + "bytecode": "0x60636023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea365627a7a7231582070c6b1e2e7530961a23eae7629fa40adaa71145c87e954dbcd9df58aace515d96c6578706572696d656e74616cf564736f6c63430005110040", + "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea365627a7a7231582070c6b1e2e7530961a23eae7629fa40adaa71145c87e954dbcd9df58aace515d96c6578706572696d656e74616cf564736f6c63430005110040", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/ContentHashResolver.json b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/ContentHashResolver.json new file mode 100644 index 0000000..c2e0d0c --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/ContentHashResolver.json @@ -0,0 +1,92 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "ContentHashResolver", + "sourceName": "contracts/legacy/PublicResolver_mainnet_9412610.sol", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "ContenthashChanged", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "contenthash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setContenthash", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/DNSResolver.json b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/DNSResolver.json new file mode 100644 index 0000000..dc306f2 --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/DNSResolver.json @@ -0,0 +1,193 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "DNSResolver", + "sourceName": "contracts/legacy/PublicResolver_mainnet_9412610.sol", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "record", + "type": "bytes" + } + ], + "name": "DNSRecordChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "DNSRecordDeleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "DNSZoneCleared", + "type": "event" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "clearDNSZone", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "dnsRecord", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + } + ], + "name": "hasDNSRecords", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setDNSRecords", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/ENS.json b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/ENS.json new file mode 100644 index 0000000..256b8f9 --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/ENS.json @@ -0,0 +1,241 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "ENS", + "sourceName": "contracts/legacy/PublicResolver_mainnet_9412610.sol", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NewOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "NewResolver", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "NewTTL", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "resolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "ttl", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/InterfaceResolver.json b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/InterfaceResolver.json new file mode 100644 index 0000000..91d95db --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/InterfaceResolver.json @@ -0,0 +1,244 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "InterfaceResolver", + "sourceName": "contracts/legacy/PublicResolver_mainnet_9412610.sol", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "AddrChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "InterfaceChanged", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "interfaceImplementer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "a", + "type": "bytes" + } + ], + "name": "setAddr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "setAddr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "setInterface", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/NameResolver.json b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/NameResolver.json new file mode 100644 index 0000000..878c09c --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/NameResolver.json @@ -0,0 +1,92 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "NameResolver", + "sourceName": "contracts/legacy/PublicResolver_mainnet_9412610.sol", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameChanged", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/PubkeyResolver.json b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/PubkeyResolver.json new file mode 100644 index 0000000..c62548d --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/PubkeyResolver.json @@ -0,0 +1,108 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "PubkeyResolver", + "sourceName": "contracts/legacy/PublicResolver_mainnet_9412610.sol", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "PubkeyChanged", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "pubkey", + "outputs": [ + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "setPubkey", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/PublicResolver_mainnet_9412610.json b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/PublicResolver_mainnet_9412610.json new file mode 100644 index 0000000..2baffd5 --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/PublicResolver_mainnet_9412610.json @@ -0,0 +1,872 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "PublicResolver_mainnet_9412610", + "sourceName": "contracts/legacy/PublicResolver_mainnet_9412610.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + } + ], + "name": "ABIChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "AddrChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isAuthorised", + "type": "bool" + } + ], + "name": "AuthorisationChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "ContenthashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "record", + "type": "bytes" + } + ], + "name": "DNSRecordChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "DNSRecordDeleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "DNSZoneCleared", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "InterfaceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "PubkeyChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "string", + "name": "indexedKey", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "TextChanged", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentTypes", + "type": "uint256" + } + ], + "name": "ABI", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "authorisations", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "clearDNSZone", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "contenthash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "dnsRecord", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + } + ], + "name": "hasDNSRecords", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "interfaceImplementer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "pubkey", + "outputs": [ + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setABI", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "a", + "type": "bytes" + } + ], + "name": "setAddr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "setAddr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bool", + "name": "isAuthorised", + "type": "bool" + } + ], + "name": "setAuthorisation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setContenthash", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setDNSRecords", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "setInterface", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "setPubkey", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "setText", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "text", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x60806040523480156200001157600080fd5b5060405162002abe38038062002abe83398101604081905262000034916200006d565b600a80546001600160a01b0319166001600160a01b0392909216919091179055620000d6565b80516200006781620000bc565b92915050565b6000602082840312156200008057600080fd5b60006200008e84846200005a565b949350505050565b60006200006782620000b0565b6000620000678262000096565b6001600160a01b031690565b620000c781620000a3565b8114620000d357600080fd5b50565b6129d880620000e66000396000f3fe608060405234801561001057600080fd5b50600436106101985760003560e01c8063691f3431116100e3578063bc1c58d11161008c578063e59d895d11610066578063e59d895d14610387578063f1cb7e061461039a578063f86bc879146103ad57610198565b8063bc1c58d114610340578063c869023314610353578063d5fa2b001461037457610198565b8063a8fa5682116100bd578063a8fa5682146102fa578063ac9650d81461030d578063ad5780af1461032d57610198565b8063691f3431146102c157806377372213146102d45780638b95dd71146102e757610198565b8063304e6ade116101455780634cbf6ba41161011f5780634cbf6ba41461027b57806359d1d43c1461028e578063623195b0146102ae57610198565b8063304e6ade146102425780633b3b57de146102555780633e9ce7941461026857610198565b8063124a319c11610176578063124a319c146101ee5780632203ab561461020e57806329cd62ea1461022f57610198565b806301ffc9a71461019d5780630af179d7146101c657806310f13a8c146101db575b600080fd5b6101b06101ab366004612504565b6103c0565b6040516101bd9190612730565b60405180910390f35b6101d96101d4366004612364565b61041e565b005b6101d96101e93660046123ba565b61060b565b6102016101fc366004612302565b6106b8565b6040516101bd9190612703565b61022161021c36600461224c565b6109f7565b6040516101bd9291906127f3565b6101d961023d36600461227c565b610b16565b6101d9610250366004612364565b610b96565b610201610263366004612164565b610bf5565b6101d9610276366004612209565b610c2a565b6101b061028936600461224c565b610ccf565b6102a161029c366004612364565b610d01565b6040516101bd9190612787565b6101d96102bc366004612441565b610dc3565b6102a16102cf366004612164565b610e3e565b6101d96102e2366004612364565b610edf565b6101d96102f53660046124a9565b610f3e565b6102a16103083660046122bf565b611003565b61032061031b366004612122565b611090565b6040516101bd919061271f565b6101d961033b366004612164565b6111d4565b6102a161034e366004612164565b611227565b610366610361366004612164565b61128f565b6040516101bd92919061274c565b6101d9610382366004612182565b6112a9565b6101d9610395366004612332565b6112d0565b6102a16103a836600461224c565b61139d565b6101b06103bb3660046121bc565b611446565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f59d1d43c00000000000000000000000000000000000000000000000000000000148061041657506104168261146c565b90505b919050565b82610428816114c2565b61043157600080fd5b60008060608082610440611e30565b61048a60008a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505063ffffffff6115d1169050565b90505b610496816115ec565b6105ae5761ffff86166104ee57806040015195506104b3816115fa565b9350836040516020016104c691906126ec565b6040516020818303038152906040528051906020012091506104e781611621565b92506105a0565b60606104f9826115fa565b9050816040015161ffff168761ffff161415806105235750610521858263ffffffff61164216565b155b1561059e576105778b86898d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505050602087015189518c918290039015611660565b81604001519650816020015195508094508480519060200120925061059b82611621565b93505b505b6105a9816118c7565b61048d565b50825115610600576106008984878b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505088518b9250828f03915015611660565b505050505050505050565b84610615816114c2565b61061e57600080fd5b82826009600089815260200190815260200160002087876040516106439291906126df565b90815260405190819003602001902061065d929091611e7b565b50848460405161066e9291906126df565b6040518091039020867fd8c9334b1a9c2f9da342a0a2b32629c1a229b6445dad78947f674b44444a755087876040516106a8929190612775565b60405180910390a3505050505050565b60008281526006602090815260408083207fffffffff000000000000000000000000000000000000000000000000000000008516845290915281205473ffffffffffffffffffffffffffffffffffffffff1680156107175790506109f1565b600061072285610bf5565b905073ffffffffffffffffffffffffffffffffffffffff811661074a576000925050506109f1565b600060608273ffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b60405160240161077d9190612767565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a700000000000000000000000000000000000000000000000000000000179052516107fe91906126ec565b600060405180830381855afa9150503d8060008114610839576040519150601f19603f3d011682016040523d82523d6000602084013e61083e565b606091505b5091509150811580610851575060208151105b8061088d575080601f8151811061086457fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b1561089f5760009450505050506109f1565b8273ffffffffffffffffffffffffffffffffffffffff16866040516024016108c79190612767565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001790525161094891906126ec565b600060405180830381855afa9150503d8060008114610983576040519150601f19603f3d011682016040523d82523d6000602084013e610988565b606091505b50909250905081158061099c575060208151105b806109d8575080601f815181106109af57fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109ea5760009450505050506109f1565b5090925050505b92915050565b600082815260208190526040812060609060015b848111610af85780851615801590610a4357506000818152602083905260409020546002600019610100600184161502019091160415155b15610af0576000818152602083815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845284939192839190830182828015610ade5780601f10610ab357610100808354040283529160200191610ade565b820191906000526020600020905b815481529060010190602001808311610ac157829003601f168201915b50505050509050935093505050610b0f565b60011b610a0b565b505060408051602081019091526000808252925090505b9250929050565b82610b20816114c2565b610b2957600080fd5b6040805180820182528481526020808201858152600088815260089092529083902091518255516001909101555184907f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4690610b88908690869061274c565b60405180910390a250505050565b82610ba0816114c2565b610ba957600080fd5b6000848152600260205260409020610bc2908484611e7b565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610b88929190612775565b60006060610c0483603c61139d565b9050805160001415610c1a576000915050610419565b610c238161199a565b9392505050565b6000838152600b602090815260408083203380855290835281842073ffffffffffffffffffffffffffffffffffffffff871680865293529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515151790555190919085907fe1c5610a6e0cbe10764ecd182adcef1ec338dc4e199c99c32ce98f38e12791df90610cc2908690612730565b60405180910390a4505050565b600091825260056020908152604080842060038352818520548552825280842092845291905290205461ffff16151590565b6060600960008581526020019081526020016000208383604051610d269291906126df565b9081526040805160209281900383018120805460026001821615610100026000190190911604601f81018590048502830185019093528282529092909190830182828015610db55780601f10610d8a57610100808354040283529160200191610db5565b820191906000526020600020905b815481529060010190602001808311610d9857829003601f168201915b505050505090509392505050565b83610dcd816114c2565b610dd657600080fd5b6000198401841615610de757600080fd5b6000858152602081815260408083208784529091529020610e09908484611e7b565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b60008181526007602090815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610ed35780601f10610ea857610100808354040283529160200191610ed3565b820191906000526020600020905b815481529060010190602001808311610eb657829003601f168201915b50505050509050919050565b82610ee9816114c2565b610ef257600080fd5b6000848152600760205260409020610f0b908484611e7b565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610b88929190612775565b82610f48816114c2565b610f5157600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af7528484604051610f839291906127f3565b60405180910390a2603c831415610fd557837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd2610fbf8461199a565b604051610fcc9190612711565b60405180910390a25b600084815260016020908152604080832086845282529091208351610ffc92850190611f17565b5050505050565b6000838152600460209081526040808320600383528184205484528252808320858452825280832061ffff8516845282529182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610db55780601f10610d8a57610100808354040283529160200191610db5565b6040805182815260208084028201019091526060908280156110c657816020015b60608152602001906001900390816110b15790505b50905060005b828110156111cd5760006060308686858181106110e557fe5b6020028201905080357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe13684900301811261111f57600080fd5b9091016020810191503567ffffffffffffffff81111561113e57600080fd5b3681900382131561114e57600080fd5b60405161115c9291906126df565b600060405180830381855af49150503d8060008114611197576040519150601f19603f3d011682016040523d82523d6000602084013e61119c565b606091505b5091509150816111ab57600080fd5b808484815181106111b857fe5b602090810291909101015250506001016110cc565b5092915050565b806111de816114c2565b6111e757600080fd5b600082815260036020526040808220805460010190555183917fb757169b8492ca2f1c6619d9d76ce22803035c3b1d5f6930dffe7b127c1a198391a25050565b600081815260026020818152604092839020805484516001821615610100026000190190911693909304601f81018390048302840183019094528383526060939091830182828015610ed35780601f10610ea857610100808354040283529160200191610ed3565b600090815260086020526040902080546001909101549091565b816112b3816114c2565b6112bc57600080fd5b6112cb83603c6102f5856119c2565b505050565b826112da816114c2565b6112e357600080fd5b60008481526006602090815260408083207fffffffff00000000000000000000000000000000000000000000000000000000871680855292529182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616179055905185907f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa9061138f908690612703565b60405180910390a350505050565b600082815260016020818152604080842085855282529283902080548451600294821615610100026000190190911693909304601f810183900483028401830190945283835260609390918301828280156114395780601f1061140e57610100808354040283529160200191611439565b820191906000526020600020905b81548152906001019060200180831161141c57829003601f168201915b5050505050905092915050565b600b60209081526000938452604080852082529284528284209052825290205460ff1681565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fc86902330000000000000000000000000000000000000000000000000000000014806104165750610416826119fb565b600a546040517f02571be3000000000000000000000000000000000000000000000000000000008152600091829173ffffffffffffffffffffffffffffffffffffffff909116906302571be39061151d90869060040161273e565b60206040518083038186803b15801561153557600080fd5b505afa158015611549573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061156d91908101906120fc565b905073ffffffffffffffffffffffffffffffffffffffff8116331480610c2357506000838152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452825280832033845290915290205460ff16915050919050565b6115d9611e30565b82815260c081018290526109f1816118c7565b805151602090910151101590565b60208101518151606091610416916116129082611a51565b8451919063ffffffff611a9816565b60a081015160c082015182516060926104169281900363ffffffff611a9816565b600081518351148015610c235750610c238360008460008751611afa565b600087815260036020908152604090912054875191880191909120606061168e87878763ffffffff611a9816565b905083156117a85760008a81526004602090815260408083208684528252808320858452825280832061ffff8c16845290915290205460026000196101006001841615020190911604156117335760008a81526005602090815260408083208684528252808320858452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000811661ffff918216600019019091161790555b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c168452909152812061176991611f85565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a60405161179b929190612798565b60405180910390a26118bb565b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c168452909152902054600260001961010060018416150201909116046118425760008a815260056020908152604080832086845282528083208584529091529020805461ffff808216600101167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00009091161790555b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c1684528252909120825161187d92840190611f17565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a846040516118b2939291906127b8565b60405180910390a25b50505050505050505050565b60c081015160208201819052815151116118e057611997565b60006118f482600001518360200151611a51565b602083015183519101915061190f908263ffffffff611b1d16565b61ffff166040830152815160029190910190611931908263ffffffff611b1d16565b61ffff166060830152815160029190910190611953908263ffffffff611b3d16565b63ffffffff908116608084015282516004929092019160009161197991908490611b1d16565b600283810160a086015261ffff9190911690920190910160c0830152505b50565b600081516014146119aa57600080fd5b50602001516c01000000000000000000000000900490565b6040805160148082528183019092526060916020820181803883395050506c010000000000000000000000009290920260208301525090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f691f3431000000000000000000000000000000000000000000000000000000001480610416575061041682611b5f565b6000815b83518110611a5f57fe5b6000611a71858363ffffffff611bc416565b60ff1691820160010191905080611a885750611a8e565b50611a55565b9190910392915050565b606083518284011115611aaa57600080fd5b6060826040519080825280601f01601f191660200182016040528015611ad7576020820181803883390190505b50905060208082019086860101611aef828287611be2565b509095945050505050565b6000611b07848484611c3e565b611b12878785611c3e565b149695505050505050565b60008251826002011115611b3057600080fd5b50016002015161ffff1690565b60008251826004011115611b5057600080fd5b50016004015163ffffffff1690565b6000604051611b6d906126f8565b60405180910390207bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610416575061041682611c5a565b6000828281518110611bd257fe5b016020015160f81c905092915050565b5b60208110611c205781518352602092830192909101907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001611be3565b905182516020929092036101000a6000190180199091169116179052565b600083518284011115611c5057600080fd5b5091016020012090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fa8fa568200000000000000000000000000000000000000000000000000000000148061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167fbc1c58d100000000000000000000000000000000000000000000000000000000148061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167f3b3b57de000000000000000000000000000000000000000000000000000000001480611d8f57507fffffffff0000000000000000000000000000000000000000000000000000000082167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167f2203ab5600000000000000000000000000000000000000000000000000000000148061041657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610416565b6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611eda578280017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00823516178555611f07565b82800160010185558215611f07579182015b82811115611f07578235825591602001919060010190611eec565b50611f13929150611fc5565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611f5857805160ff1916838001178555611f07565b82800160010185558215611f07579182015b82811115611f07578251825591602001919060010190611f6a565b50805460018160011615610100020316600290046000825580601f10611fab5750611997565b601f01602090049060005260206000209081019061199791905b611fdf91905b80821115611f135760008155600101611fcb565b90565b80356109f18161295d565b80516109f18161295d565b60008083601f84011261200a57600080fd5b50813567ffffffffffffffff81111561202257600080fd5b602083019150836020820283011115610b0f57600080fd5b80356109f181612971565b80356109f18161297a565b80356109f181612983565b60008083601f84011261206d57600080fd5b50813567ffffffffffffffff81111561208557600080fd5b602083019150836001820283011115610b0f57600080fd5b600082601f8301126120ae57600080fd5b81356120c16120bc8261283a565b612813565b915080825260208301602083018583830111156120dd57600080fd5b6120e88382846128f9565b50505092915050565b80356109f18161298c565b60006020828403121561210e57600080fd5b600061211a8484611fed565b949350505050565b6000806020838503121561213557600080fd5b823567ffffffffffffffff81111561214c57600080fd5b61215885828601611ff8565b92509250509250929050565b60006020828403121561217657600080fd5b600061211a8484612045565b6000806040838503121561219557600080fd5b60006121a18585612045565b92505060206121b285828601611fe2565b9150509250929050565b6000806000606084860312156121d157600080fd5b60006121dd8686612045565b93505060206121ee86828701611fe2565b92505060406121ff86828701611fe2565b9150509250925092565b60008060006060848603121561221e57600080fd5b600061222a8686612045565b935050602061223b86828701611fe2565b92505060406121ff8682870161203a565b6000806040838503121561225f57600080fd5b600061226b8585612045565b92505060206121b285828601612045565b60008060006060848603121561229157600080fd5b600061229d8686612045565b93505060206122ae86828701612045565b92505060406121ff86828701612045565b6000806000606084860312156122d457600080fd5b60006122e08686612045565b93505060206122f186828701612045565b92505060406121ff868287016120f1565b6000806040838503121561231557600080fd5b60006123218585612045565b92505060206121b285828601612050565b60008060006060848603121561234757600080fd5b60006123538686612045565b93505060206121ee86828701612050565b60008060006040848603121561237957600080fd5b60006123858686612045565b935050602084013567ffffffffffffffff8111156123a257600080fd5b6123ae8682870161205b565b92509250509250925092565b6000806000806000606086880312156123d257600080fd5b60006123de8888612045565b955050602086013567ffffffffffffffff8111156123fb57600080fd5b6124078882890161205b565b9450945050604086013567ffffffffffffffff81111561242657600080fd5b6124328882890161205b565b92509250509295509295909350565b6000806000806060858703121561245757600080fd5b60006124638787612045565b945050602061247487828801612045565b935050604085013567ffffffffffffffff81111561249157600080fd5b61249d8782880161205b565b95989497509550505050565b6000806000606084860312156124be57600080fd5b60006124ca8686612045565b93505060206124db86828701612045565b925050604084013567ffffffffffffffff8111156124f857600080fd5b6121ff8682870161209d565b60006020828403121561251657600080fd5b600061211a8484612050565b6000610c23838361261a565b612537816128e8565b82525050565b61253781612893565b600061255182612886565b61255b818561288a565b93508360208202850161256d85612880565b8060005b858110156125a7578484038952815161258a8582612522565b945061259583612880565b60209a909a0199925050600101612571565b5091979650505050505050565b6125378161289e565b61253781611fdf565b612537816128a3565b60006125db838561288a565b93506125e88385846128f9565b6125f183612935565b9093019392505050565b60006126078385610419565b93506126148385846128f9565b50500190565b600061262582612886565b61262f818561288a565b935061263f818560208601612905565b6125f181612935565b600061265382612886565b61265d8185610419565b935061266d818560208601612905565b9290920192915050565b6000612684602483610419565b7f696e74657266616365496d706c656d656e74657228627974657333322c62797481527f6573342900000000000000000000000000000000000000000000000000000000602082015260240192915050565b612537816128c8565b600061211a8284866125fb565b6000610c238284612648565b60006109f182612677565b602081016109f1828461253d565b602081016109f1828461252e565b60208082528101610c238184612546565b602081016109f182846125b4565b602081016109f182846125bd565b6040810161275a82856125bd565b610c2360208301846125bd565b602081016109f182846125c6565b6020808252810161211a8184866125cf565b60208082528101610c23818461261a565b604080825281016127a9818561261a565b9050610c2360208301846126d6565b606080825281016127c9818661261a565b90506127d860208301856126d6565b81810360408301526127ea818461261a565b95945050505050565b6040810161280182856125bd565b818103602083015261211a818461261a565b60405181810167ffffffffffffffff8111828210171561283257600080fd5b604052919050565b600067ffffffffffffffff82111561285157600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b90815260200190565b6000610416826128cf565b151590565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b61ffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b600061041682600061041682612893565b82818337506000910152565b60005b83811015612920578181015183820152602001612908565b8381111561292f576000848401525b50505050565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b61296681612893565b811461199757600080fd5b6129668161289e565b61296681611fdf565b612966816128a3565b612966816128c856fea365627a7a7231582082927c55ed80cd2c2b4af3ecca0340c755f0257fadbdd76a4c4b6458f1c8eefc6c6578706572696d656e74616cf564736f6c63430005110040", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101985760003560e01c8063691f3431116100e3578063bc1c58d11161008c578063e59d895d11610066578063e59d895d14610387578063f1cb7e061461039a578063f86bc879146103ad57610198565b8063bc1c58d114610340578063c869023314610353578063d5fa2b001461037457610198565b8063a8fa5682116100bd578063a8fa5682146102fa578063ac9650d81461030d578063ad5780af1461032d57610198565b8063691f3431146102c157806377372213146102d45780638b95dd71146102e757610198565b8063304e6ade116101455780634cbf6ba41161011f5780634cbf6ba41461027b57806359d1d43c1461028e578063623195b0146102ae57610198565b8063304e6ade146102425780633b3b57de146102555780633e9ce7941461026857610198565b8063124a319c11610176578063124a319c146101ee5780632203ab561461020e57806329cd62ea1461022f57610198565b806301ffc9a71461019d5780630af179d7146101c657806310f13a8c146101db575b600080fd5b6101b06101ab366004612504565b6103c0565b6040516101bd9190612730565b60405180910390f35b6101d96101d4366004612364565b61041e565b005b6101d96101e93660046123ba565b61060b565b6102016101fc366004612302565b6106b8565b6040516101bd9190612703565b61022161021c36600461224c565b6109f7565b6040516101bd9291906127f3565b6101d961023d36600461227c565b610b16565b6101d9610250366004612364565b610b96565b610201610263366004612164565b610bf5565b6101d9610276366004612209565b610c2a565b6101b061028936600461224c565b610ccf565b6102a161029c366004612364565b610d01565b6040516101bd9190612787565b6101d96102bc366004612441565b610dc3565b6102a16102cf366004612164565b610e3e565b6101d96102e2366004612364565b610edf565b6101d96102f53660046124a9565b610f3e565b6102a16103083660046122bf565b611003565b61032061031b366004612122565b611090565b6040516101bd919061271f565b6101d961033b366004612164565b6111d4565b6102a161034e366004612164565b611227565b610366610361366004612164565b61128f565b6040516101bd92919061274c565b6101d9610382366004612182565b6112a9565b6101d9610395366004612332565b6112d0565b6102a16103a836600461224c565b61139d565b6101b06103bb3660046121bc565b611446565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f59d1d43c00000000000000000000000000000000000000000000000000000000148061041657506104168261146c565b90505b919050565b82610428816114c2565b61043157600080fd5b60008060608082610440611e30565b61048a60008a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505063ffffffff6115d1169050565b90505b610496816115ec565b6105ae5761ffff86166104ee57806040015195506104b3816115fa565b9350836040516020016104c691906126ec565b6040516020818303038152906040528051906020012091506104e781611621565b92506105a0565b60606104f9826115fa565b9050816040015161ffff168761ffff161415806105235750610521858263ffffffff61164216565b155b1561059e576105778b86898d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505050602087015189518c918290039015611660565b81604001519650816020015195508094508480519060200120925061059b82611621565b93505b505b6105a9816118c7565b61048d565b50825115610600576106008984878b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505088518b9250828f03915015611660565b505050505050505050565b84610615816114c2565b61061e57600080fd5b82826009600089815260200190815260200160002087876040516106439291906126df565b90815260405190819003602001902061065d929091611e7b565b50848460405161066e9291906126df565b6040518091039020867fd8c9334b1a9c2f9da342a0a2b32629c1a229b6445dad78947f674b44444a755087876040516106a8929190612775565b60405180910390a3505050505050565b60008281526006602090815260408083207fffffffff000000000000000000000000000000000000000000000000000000008516845290915281205473ffffffffffffffffffffffffffffffffffffffff1680156107175790506109f1565b600061072285610bf5565b905073ffffffffffffffffffffffffffffffffffffffff811661074a576000925050506109f1565b600060608273ffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b60405160240161077d9190612767565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a700000000000000000000000000000000000000000000000000000000179052516107fe91906126ec565b600060405180830381855afa9150503d8060008114610839576040519150601f19603f3d011682016040523d82523d6000602084013e61083e565b606091505b5091509150811580610851575060208151105b8061088d575080601f8151811061086457fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b1561089f5760009450505050506109f1565b8273ffffffffffffffffffffffffffffffffffffffff16866040516024016108c79190612767565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001790525161094891906126ec565b600060405180830381855afa9150503d8060008114610983576040519150601f19603f3d011682016040523d82523d6000602084013e610988565b606091505b50909250905081158061099c575060208151105b806109d8575080601f815181106109af57fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109ea5760009450505050506109f1565b5090925050505b92915050565b600082815260208190526040812060609060015b848111610af85780851615801590610a4357506000818152602083905260409020546002600019610100600184161502019091160415155b15610af0576000818152602083815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845284939192839190830182828015610ade5780601f10610ab357610100808354040283529160200191610ade565b820191906000526020600020905b815481529060010190602001808311610ac157829003601f168201915b50505050509050935093505050610b0f565b60011b610a0b565b505060408051602081019091526000808252925090505b9250929050565b82610b20816114c2565b610b2957600080fd5b6040805180820182528481526020808201858152600088815260089092529083902091518255516001909101555184907f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4690610b88908690869061274c565b60405180910390a250505050565b82610ba0816114c2565b610ba957600080fd5b6000848152600260205260409020610bc2908484611e7b565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610b88929190612775565b60006060610c0483603c61139d565b9050805160001415610c1a576000915050610419565b610c238161199a565b9392505050565b6000838152600b602090815260408083203380855290835281842073ffffffffffffffffffffffffffffffffffffffff871680865293529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515151790555190919085907fe1c5610a6e0cbe10764ecd182adcef1ec338dc4e199c99c32ce98f38e12791df90610cc2908690612730565b60405180910390a4505050565b600091825260056020908152604080842060038352818520548552825280842092845291905290205461ffff16151590565b6060600960008581526020019081526020016000208383604051610d269291906126df565b9081526040805160209281900383018120805460026001821615610100026000190190911604601f81018590048502830185019093528282529092909190830182828015610db55780601f10610d8a57610100808354040283529160200191610db5565b820191906000526020600020905b815481529060010190602001808311610d9857829003601f168201915b505050505090509392505050565b83610dcd816114c2565b610dd657600080fd5b6000198401841615610de757600080fd5b6000858152602081815260408083208784529091529020610e09908484611e7b565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b60008181526007602090815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610ed35780601f10610ea857610100808354040283529160200191610ed3565b820191906000526020600020905b815481529060010190602001808311610eb657829003601f168201915b50505050509050919050565b82610ee9816114c2565b610ef257600080fd5b6000848152600760205260409020610f0b908484611e7b565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610b88929190612775565b82610f48816114c2565b610f5157600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af7528484604051610f839291906127f3565b60405180910390a2603c831415610fd557837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd2610fbf8461199a565b604051610fcc9190612711565b60405180910390a25b600084815260016020908152604080832086845282529091208351610ffc92850190611f17565b5050505050565b6000838152600460209081526040808320600383528184205484528252808320858452825280832061ffff8516845282529182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610db55780601f10610d8a57610100808354040283529160200191610db5565b6040805182815260208084028201019091526060908280156110c657816020015b60608152602001906001900390816110b15790505b50905060005b828110156111cd5760006060308686858181106110e557fe5b6020028201905080357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe13684900301811261111f57600080fd5b9091016020810191503567ffffffffffffffff81111561113e57600080fd5b3681900382131561114e57600080fd5b60405161115c9291906126df565b600060405180830381855af49150503d8060008114611197576040519150601f19603f3d011682016040523d82523d6000602084013e61119c565b606091505b5091509150816111ab57600080fd5b808484815181106111b857fe5b602090810291909101015250506001016110cc565b5092915050565b806111de816114c2565b6111e757600080fd5b600082815260036020526040808220805460010190555183917fb757169b8492ca2f1c6619d9d76ce22803035c3b1d5f6930dffe7b127c1a198391a25050565b600081815260026020818152604092839020805484516001821615610100026000190190911693909304601f81018390048302840183019094528383526060939091830182828015610ed35780601f10610ea857610100808354040283529160200191610ed3565b600090815260086020526040902080546001909101549091565b816112b3816114c2565b6112bc57600080fd5b6112cb83603c6102f5856119c2565b505050565b826112da816114c2565b6112e357600080fd5b60008481526006602090815260408083207fffffffff00000000000000000000000000000000000000000000000000000000871680855292529182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616179055905185907f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa9061138f908690612703565b60405180910390a350505050565b600082815260016020818152604080842085855282529283902080548451600294821615610100026000190190911693909304601f810183900483028401830190945283835260609390918301828280156114395780601f1061140e57610100808354040283529160200191611439565b820191906000526020600020905b81548152906001019060200180831161141c57829003601f168201915b5050505050905092915050565b600b60209081526000938452604080852082529284528284209052825290205460ff1681565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fc86902330000000000000000000000000000000000000000000000000000000014806104165750610416826119fb565b600a546040517f02571be3000000000000000000000000000000000000000000000000000000008152600091829173ffffffffffffffffffffffffffffffffffffffff909116906302571be39061151d90869060040161273e565b60206040518083038186803b15801561153557600080fd5b505afa158015611549573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061156d91908101906120fc565b905073ffffffffffffffffffffffffffffffffffffffff8116331480610c2357506000838152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452825280832033845290915290205460ff16915050919050565b6115d9611e30565b82815260c081018290526109f1816118c7565b805151602090910151101590565b60208101518151606091610416916116129082611a51565b8451919063ffffffff611a9816565b60a081015160c082015182516060926104169281900363ffffffff611a9816565b600081518351148015610c235750610c238360008460008751611afa565b600087815260036020908152604090912054875191880191909120606061168e87878763ffffffff611a9816565b905083156117a85760008a81526004602090815260408083208684528252808320858452825280832061ffff8c16845290915290205460026000196101006001841615020190911604156117335760008a81526005602090815260408083208684528252808320858452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000811661ffff918216600019019091161790555b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c168452909152812061176991611f85565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a60405161179b929190612798565b60405180910390a26118bb565b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c168452909152902054600260001961010060018416150201909116046118425760008a815260056020908152604080832086845282528083208584529091529020805461ffff808216600101167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00009091161790555b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c1684528252909120825161187d92840190611f17565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a846040516118b2939291906127b8565b60405180910390a25b50505050505050505050565b60c081015160208201819052815151116118e057611997565b60006118f482600001518360200151611a51565b602083015183519101915061190f908263ffffffff611b1d16565b61ffff166040830152815160029190910190611931908263ffffffff611b1d16565b61ffff166060830152815160029190910190611953908263ffffffff611b3d16565b63ffffffff908116608084015282516004929092019160009161197991908490611b1d16565b600283810160a086015261ffff9190911690920190910160c0830152505b50565b600081516014146119aa57600080fd5b50602001516c01000000000000000000000000900490565b6040805160148082528183019092526060916020820181803883395050506c010000000000000000000000009290920260208301525090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f691f3431000000000000000000000000000000000000000000000000000000001480610416575061041682611b5f565b6000815b83518110611a5f57fe5b6000611a71858363ffffffff611bc416565b60ff1691820160010191905080611a885750611a8e565b50611a55565b9190910392915050565b606083518284011115611aaa57600080fd5b6060826040519080825280601f01601f191660200182016040528015611ad7576020820181803883390190505b50905060208082019086860101611aef828287611be2565b509095945050505050565b6000611b07848484611c3e565b611b12878785611c3e565b149695505050505050565b60008251826002011115611b3057600080fd5b50016002015161ffff1690565b60008251826004011115611b5057600080fd5b50016004015163ffffffff1690565b6000604051611b6d906126f8565b60405180910390207bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610416575061041682611c5a565b6000828281518110611bd257fe5b016020015160f81c905092915050565b5b60208110611c205781518352602092830192909101907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001611be3565b905182516020929092036101000a6000190180199091169116179052565b600083518284011115611c5057600080fd5b5091016020012090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fa8fa568200000000000000000000000000000000000000000000000000000000148061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167fbc1c58d100000000000000000000000000000000000000000000000000000000148061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167f3b3b57de000000000000000000000000000000000000000000000000000000001480611d8f57507fffffffff0000000000000000000000000000000000000000000000000000000082167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167f2203ab5600000000000000000000000000000000000000000000000000000000148061041657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610416565b6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611eda578280017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00823516178555611f07565b82800160010185558215611f07579182015b82811115611f07578235825591602001919060010190611eec565b50611f13929150611fc5565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611f5857805160ff1916838001178555611f07565b82800160010185558215611f07579182015b82811115611f07578251825591602001919060010190611f6a565b50805460018160011615610100020316600290046000825580601f10611fab5750611997565b601f01602090049060005260206000209081019061199791905b611fdf91905b80821115611f135760008155600101611fcb565b90565b80356109f18161295d565b80516109f18161295d565b60008083601f84011261200a57600080fd5b50813567ffffffffffffffff81111561202257600080fd5b602083019150836020820283011115610b0f57600080fd5b80356109f181612971565b80356109f18161297a565b80356109f181612983565b60008083601f84011261206d57600080fd5b50813567ffffffffffffffff81111561208557600080fd5b602083019150836001820283011115610b0f57600080fd5b600082601f8301126120ae57600080fd5b81356120c16120bc8261283a565b612813565b915080825260208301602083018583830111156120dd57600080fd5b6120e88382846128f9565b50505092915050565b80356109f18161298c565b60006020828403121561210e57600080fd5b600061211a8484611fed565b949350505050565b6000806020838503121561213557600080fd5b823567ffffffffffffffff81111561214c57600080fd5b61215885828601611ff8565b92509250509250929050565b60006020828403121561217657600080fd5b600061211a8484612045565b6000806040838503121561219557600080fd5b60006121a18585612045565b92505060206121b285828601611fe2565b9150509250929050565b6000806000606084860312156121d157600080fd5b60006121dd8686612045565b93505060206121ee86828701611fe2565b92505060406121ff86828701611fe2565b9150509250925092565b60008060006060848603121561221e57600080fd5b600061222a8686612045565b935050602061223b86828701611fe2565b92505060406121ff8682870161203a565b6000806040838503121561225f57600080fd5b600061226b8585612045565b92505060206121b285828601612045565b60008060006060848603121561229157600080fd5b600061229d8686612045565b93505060206122ae86828701612045565b92505060406121ff86828701612045565b6000806000606084860312156122d457600080fd5b60006122e08686612045565b93505060206122f186828701612045565b92505060406121ff868287016120f1565b6000806040838503121561231557600080fd5b60006123218585612045565b92505060206121b285828601612050565b60008060006060848603121561234757600080fd5b60006123538686612045565b93505060206121ee86828701612050565b60008060006040848603121561237957600080fd5b60006123858686612045565b935050602084013567ffffffffffffffff8111156123a257600080fd5b6123ae8682870161205b565b92509250509250925092565b6000806000806000606086880312156123d257600080fd5b60006123de8888612045565b955050602086013567ffffffffffffffff8111156123fb57600080fd5b6124078882890161205b565b9450945050604086013567ffffffffffffffff81111561242657600080fd5b6124328882890161205b565b92509250509295509295909350565b6000806000806060858703121561245757600080fd5b60006124638787612045565b945050602061247487828801612045565b935050604085013567ffffffffffffffff81111561249157600080fd5b61249d8782880161205b565b95989497509550505050565b6000806000606084860312156124be57600080fd5b60006124ca8686612045565b93505060206124db86828701612045565b925050604084013567ffffffffffffffff8111156124f857600080fd5b6121ff8682870161209d565b60006020828403121561251657600080fd5b600061211a8484612050565b6000610c23838361261a565b612537816128e8565b82525050565b61253781612893565b600061255182612886565b61255b818561288a565b93508360208202850161256d85612880565b8060005b858110156125a7578484038952815161258a8582612522565b945061259583612880565b60209a909a0199925050600101612571565b5091979650505050505050565b6125378161289e565b61253781611fdf565b612537816128a3565b60006125db838561288a565b93506125e88385846128f9565b6125f183612935565b9093019392505050565b60006126078385610419565b93506126148385846128f9565b50500190565b600061262582612886565b61262f818561288a565b935061263f818560208601612905565b6125f181612935565b600061265382612886565b61265d8185610419565b935061266d818560208601612905565b9290920192915050565b6000612684602483610419565b7f696e74657266616365496d706c656d656e74657228627974657333322c62797481527f6573342900000000000000000000000000000000000000000000000000000000602082015260240192915050565b612537816128c8565b600061211a8284866125fb565b6000610c238284612648565b60006109f182612677565b602081016109f1828461253d565b602081016109f1828461252e565b60208082528101610c238184612546565b602081016109f182846125b4565b602081016109f182846125bd565b6040810161275a82856125bd565b610c2360208301846125bd565b602081016109f182846125c6565b6020808252810161211a8184866125cf565b60208082528101610c23818461261a565b604080825281016127a9818561261a565b9050610c2360208301846126d6565b606080825281016127c9818661261a565b90506127d860208301856126d6565b81810360408301526127ea818461261a565b95945050505050565b6040810161280182856125bd565b818103602083015261211a818461261a565b60405181810167ffffffffffffffff8111828210171561283257600080fd5b604052919050565b600067ffffffffffffffff82111561285157600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b90815260200190565b6000610416826128cf565b151590565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b61ffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b600061041682600061041682612893565b82818337506000910152565b60005b83811015612920578181015183820152602001612908565b8381111561292f576000848401525b50505050565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b61296681612893565b811461199757600080fd5b6129668161289e565b61296681611fdf565b612966816128a3565b612966816128c856fea365627a7a7231582082927c55ed80cd2c2b4af3ecca0340c755f0257fadbdd76a4c4b6458f1c8eefc6c6578706572696d656e74616cf564736f6c63430005110040", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/RRUtils.json b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/RRUtils.json new file mode 100644 index 0000000..f42df2d --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/RRUtils.json @@ -0,0 +1,10 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "RRUtils", + "sourceName": "contracts/legacy/PublicResolver_mainnet_9412610.sol", + "abi": [], + "bytecode": "0x60636023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea365627a7a7231582098d5f02c44eb8d313e0e0facc49aaed1a8bc1bbd3e93d6164d69215694892aee6c6578706572696d656e74616cf564736f6c63430005110040", + "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea365627a7a7231582098d5f02c44eb8d313e0e0facc49aaed1a8bc1bbd3e93d6164d69215694892aee6c6578706572696d656e74616cf564736f6c63430005110040", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/ResolverBase.json b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/ResolverBase.json new file mode 100644 index 0000000..90ac819 --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/ResolverBase.json @@ -0,0 +1,32 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "ResolverBase", + "sourceName": "contracts/legacy/PublicResolver_mainnet_9412610.sol", + "abi": [ + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/TextResolver.json b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/TextResolver.json new file mode 100644 index 0000000..b7203bd --- /dev/null +++ b/solidity/dns-contracts/deployments/archive/PublicResolver_mainnet_9412610.sol/TextResolver.json @@ -0,0 +1,108 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "TextResolver", + "sourceName": "contracts/legacy/PublicResolver_mainnet_9412610.sol", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "string", + "name": "indexedKey", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "TextChanged", + "type": "event" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "setText", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "text", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x", + "deployedBytecode": "0x", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/solidity/dns-contracts/deployments/goerli/.chainId b/solidity/dns-contracts/deployments/goerli/.chainId new file mode 100644 index 0000000..7813681 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/.chainId @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/.migrations.json b/solidity/dns-contracts/deployments/goerli/.migrations.json new file mode 100644 index 0000000..55a2097 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/.migrations.json @@ -0,0 +1,7 @@ +{ + "ens": 2086611, + "root": 2086752, + "registrar": 2086621, + "legacy-controller": 2086640, + "legacy-resolver": 2086614 +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/BaseRegistrarImplementation.json b/solidity/dns-contracts/deployments/goerli/BaseRegistrarImplementation.json new file mode 100644 index 0000000..80516b5 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/BaseRegistrarImplementation.json @@ -0,0 +1,757 @@ +{ + "address": "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85", + "transactionHash": "0x9fcb0dab1d11d06bca519e36581ec70b47b6373c26e1c5c91b0fd6e29153d349", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_baseNode", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "ControllerAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "ControllerRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameMigrated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRenewed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "GRACE_PERIOD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "addController", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "available", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "baseNode", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "nameExpires", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "reclaim", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "register", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "registerOnly", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "removeController", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ] +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/DNSRegistrar.json b/solidity/dns-contracts/deployments/goerli/DNSRegistrar.json new file mode 100644 index 0000000..cd417f9 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/DNSRegistrar.json @@ -0,0 +1,382 @@ +{ + "address": "0x8edc487D26F6c8Fa76e032066A3D4F87E273515d", + "transactionHash": "0x9bc1943e89a850a05dcf1fab8cf5689495a1aada11c3ad964c4b327b5355dc29", + "abi": [ + { + "inputs": [ + { + "internalType": "contract DNSSEC", + "name": "_dnssec", + "type": "address" + }, + { + "internalType": "contract PublicSuffixList", + "name": "_suffixes", + "type": "address" + }, + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "dnsname", + "type": "bytes" + } + ], + "name": "Claim", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oracle", + "type": "address" + } + ], + "name": "NewOracle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "suffixes", + "type": "address" + } + ], + "name": "NewPublicSuffixList", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract DNSSEC", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature[]", + "name": "input", + "type": "tuple[]" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + } + ], + "name": "proveAndClaim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature[]", + "name": "input", + "type": "tuple[]" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "proveAndClaimWithResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DNSSEC", + "name": "_dnssec", + "type": "address" + } + ], + "name": "setOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract PublicSuffixList", + "name": "_suffixes", + "type": "address" + } + ], + "name": "setPublicSuffixList", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "suffixes", + "outputs": [ + { + "internalType": "contract PublicSuffixList", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x9bc1943e89a850a05dcf1fab8cf5689495a1aada11c3ad964c4b327b5355dc29", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x8edc487D26F6c8Fa76e032066A3D4F87E273515d", + "transactionIndex": 26, + "gasUsed": "2157334", + "logsBloom": "0x00000000000000100100000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000000000000000000000000008000000000000000000000000000000000000000008000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x0c53bb1267eac2453025659478ad87e921924599a276babad76f8f9ae49a70a6", + "transactionHash": "0x9bc1943e89a850a05dcf1fab8cf5689495a1aada11c3ad964c4b327b5355dc29", + "logs": [ + { + "transactionIndex": 26, + "blockNumber": 6470145, + "transactionHash": "0x9bc1943e89a850a05dcf1fab8cf5689495a1aada11c3ad964c4b327b5355dc29", + "address": "0x8edc487D26F6c8Fa76e032066A3D4F87E273515d", + "topics": [ + "0xb3eacd0e351fafdfefdec84e1cd19679b38dbcd63ea7c2c24da17fd2bc3b3c0e" + ], + "data": "0x000000000000000000000000f427c4aded8b6dfde604865c1a7e953b160c26f0", + "logIndex": 51, + "blockHash": "0x0c53bb1267eac2453025659478ad87e921924599a276babad76f8f9ae49a70a6" + }, + { + "transactionIndex": 26, + "blockNumber": 6470145, + "transactionHash": "0x9bc1943e89a850a05dcf1fab8cf5689495a1aada11c3ad964c4b327b5355dc29", + "address": "0x8edc487D26F6c8Fa76e032066A3D4F87E273515d", + "topics": [ + "0x9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba8" + ], + "data": "0x000000000000000000000000ed2e4cdc0280743b42f4415e3e8f7425a2d6b059", + "logIndex": 52, + "blockHash": "0x0c53bb1267eac2453025659478ad87e921924599a276babad76f8f9ae49a70a6" + } + ], + "blockNumber": 6470145, + "cumulativeGasUsed": "6636550", + "status": 1, + "byzantium": true + }, + "args": [ + "0xF427c4AdED8B6dfde604865c1a7E953B160C26f0", + "0xed2E4cDc0280743B42F4415E3e8F7425a2d6b059", + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "solcInputHash": "7948b60c3b601df824761a337a51d661", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract DNSSEC\",\"name\":\"_dnssec\",\"type\":\"address\"},{\"internalType\":\"contract PublicSuffixList\",\"name\":\"_suffixes\",\"type\":\"address\"},{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"dnsname\",\"type\":\"bytes\"}],\"name\":\"Claim\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oracle\",\"type\":\"address\"}],\"name\":\"NewOracle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"suffixes\",\"type\":\"address\"}],\"name\":\"NewPublicSuffixList\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract DNSSEC\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature[]\",\"name\":\"input\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"proveAndClaim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature[]\",\"name\":\"input\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"proveAndClaimWithResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract DNSSEC\",\"name\":\"_dnssec\",\"type\":\"address\"}],\"name\":\"setOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract PublicSuffixList\",\"name\":\"_suffixes\",\"type\":\"address\"}],\"name\":\"setPublicSuffixList\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"suffixes\",\"outputs\":[{\"internalType\":\"contract PublicSuffixList\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"An ENS registrar that allows the owner of a DNS name to claim the corresponding name in ENS.\",\"kind\":\"dev\",\"methods\":{\"claim(bytes,bytes)\":{\"details\":\"Claims a name by proving ownership of its DNS equivalent.\",\"params\":{\"name\":\"The name to claim, in DNS wire format.\",\"proof\":\"A DNS RRSet proving ownership of the name. Must be verified in the DNSSEC oracle before calling. This RRSET must contain a TXT record for '_ens.' + name, with the value 'a=0x...'. Ownership of the name will be transferred to the address specified in the TXT record.\"}},\"proveAndClaim(bytes,(bytes,bytes)[],bytes)\":{\"details\":\"Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\",\"params\":{\"input\":\"The data to be passed to the Oracle's `submitProofs` function. The last proof must be the TXT record required by the registrar.\",\"name\":\"The name to claim, in DNS wire format.\",\"proof\":\"The proof record for the first element in input.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnsregistrar/DNSRegistrar.sol\":\"DNSRegistrar\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for writing to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n mstore(0x40, add(32, add(ptr, capacity)))\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n function max(uint a, uint b) private pure returns(uint) {\\n if (a > b) {\\n return a;\\n }\\n return b;\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The start offset to write to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n if (off + len > buf.capacity) {\\n resize(buf, max(buf.capacity, len + off) * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(add(len, off), buflen) {\\n mstore(bufptr, add(len, off))\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, len);\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, data.length);\\n }\\n\\n /**\\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write the byte at.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\\n if (off >= buf.capacity) {\\n resize(buf, buf.capacity * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if eq(off, buflen) {\\n mstore(bufptr, add(buflen, 1))\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n return writeUint8(buf, buf.buf.length, data);\\n }\\n\\n /**\\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\\n if (len + off > buf.capacity) {\\n resize(buf, (len + off) * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off + len\\n let dest := add(add(bufptr, off), len)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(add(off, len), mload(bufptr)) {\\n mstore(bufptr, add(off, len))\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\\n return write(buf, off, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, 32);\\n }\\n\\n /**\\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\\n if (len + off > buf.capacity) {\\n resize(buf, (len + off) * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + off + sizeof(buffer length) + len\\n let dest := add(add(bufptr, off), len)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(add(off, len), mload(bufptr)) {\\n mstore(bufptr, add(off, len))\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n return writeInt(buf, buf.buf.length, data, len);\\n }\\n}\\n\",\"keccak256\":\"0x18e42be1a3e4f7b4442d7ab0b524af5e09163503439954faf0ab3792cce91caa\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _setOwner(_msgSender());\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _setOwner(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _setOwner(newOwner);\\n }\\n\\n function _setOwner(address newOwner) private {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0x6bb804a310218875e89d12c053e94a13a4607cdf7cc2052f3e52bd32a0dc50a1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x90565a39ae45c80f0468dc96c7b20d0afc3055f344c8203a0c9258239f350b9f\",\"license\":\"MIT\"},\"contracts/dnsregistrar/DNSClaimChecker.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../dnssec-oracle/DNSSEC.sol\\\";\\nimport \\\"../dnssec-oracle/BytesUtils.sol\\\";\\nimport \\\"../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\nlibrary DNSClaimChecker {\\n\\n using BytesUtils for bytes;\\n using RRUtils for *;\\n using Buffer for Buffer.buffer;\\n\\n uint16 constant CLASS_INET = 1;\\n uint16 constant TYPE_TXT = 16;\\n\\n function getOwnerAddress(DNSSEC oracle, bytes memory name, bytes memory proof)\\n internal\\n view\\n returns (address, bool)\\n {\\n // Add \\\"_ens.\\\" to the front of the name.\\n Buffer.buffer memory buf;\\n buf.init(name.length + 5);\\n buf.append(\\\"\\\\x04_ens\\\");\\n buf.append(name);\\n bytes20 hash;\\n uint32 expiration;\\n // Check the provided TXT record has been validated by the oracle\\n (, expiration, hash) = oracle.rrdata(TYPE_TXT, buf.buf);\\n if (hash == bytes20(0) && proof.length == 0) return (address(0x0), false);\\n\\n require(hash == bytes20(keccak256(proof)));\\n\\n for (RRUtils.RRIterator memory iter = proof.iterateRRs(0); !iter.done(); iter.next()) {\\n require(RRUtils.serialNumberGte(expiration + iter.ttl, uint32(block.timestamp)), \\\"DNS record is stale; refresh or delete it before proceeding.\\\");\\n\\n bool found;\\n address addr;\\n (addr, found) = parseRR(proof, iter.rdataOffset);\\n if (found) {\\n return (addr, true);\\n }\\n }\\n\\n return (address(0x0), false);\\n }\\n\\n function parseRR(bytes memory rdata, uint idx) internal pure returns (address, bool) {\\n while (idx < rdata.length) {\\n uint len = rdata.readUint8(idx); idx += 1;\\n\\n bool found;\\n address addr;\\n (addr, found) = parseString(rdata, idx, len);\\n\\n if (found) return (addr, true);\\n idx += len;\\n }\\n\\n return (address(0x0), false);\\n }\\n\\n function parseString(bytes memory str, uint idx, uint len) internal pure returns (address, bool) {\\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\\n if (len < 44) return (address(0x0), false);\\n return hexToAddress(str, idx + 4);\\n }\\n\\n function hexToAddress(bytes memory str, uint idx) internal pure returns (address, bool) {\\n if (str.length - idx < 40) return (address(0x0), false);\\n uint ret = 0;\\n for (uint i = idx; i < idx + 40; i++) {\\n ret <<= 4;\\n uint x = str.readUint8(i);\\n if (x >= 48 && x < 58) {\\n ret |= x - 48;\\n } else if (x >= 65 && x < 71) {\\n ret |= x - 55;\\n } else if (x >= 97 && x < 103) {\\n ret |= x - 87;\\n } else {\\n return (address(0x0), false);\\n }\\n }\\n return (address(uint160(ret)), true);\\n }\\n}\\n\",\"keccak256\":\"0xbbae9477060a4e16d01432400029b85d278a7186dad7139d0f24381906cf63db\"},\"contracts/dnsregistrar/DNSRegistrar.sol\":{\"content\":\"pragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nimport \\\"../dnssec-oracle/BytesUtils.sol\\\";\\nimport \\\"../dnssec-oracle/DNSSEC.sol\\\";\\nimport \\\"../registry/ENSRegistry.sol\\\";\\nimport \\\"../root/Root.sol\\\";\\nimport \\\"./DNSClaimChecker.sol\\\";\\nimport \\\"./PublicSuffixList.sol\\\";\\nimport \\\"../resolvers/profiles/AddrResolver.sol\\\";\\n\\ninterface IDNSRegistrar {\\n function claim(bytes memory name, bytes memory proof) external;\\n function proveAndClaim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof) external;\\n function proveAndClaimWithResolver(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof, address resolver, address addr) external;\\n}\\n\\n/**\\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\\n * corresponding name in ENS.\\n */\\ncontract DNSRegistrar is IDNSRegistrar {\\n using BytesUtils for bytes;\\n\\n DNSSEC public oracle;\\n ENS public ens;\\n PublicSuffixList public suffixes;\\n\\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n\\n event Claim(bytes32 indexed node, address indexed owner, bytes dnsname);\\n event NewOracle(address oracle);\\n event NewPublicSuffixList(address suffixes);\\n\\n constructor(DNSSEC _dnssec, PublicSuffixList _suffixes, ENS _ens) {\\n oracle = _dnssec;\\n emit NewOracle(address(oracle));\\n suffixes = _suffixes;\\n emit NewPublicSuffixList(address(suffixes));\\n ens = _ens;\\n }\\n\\n /**\\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\\n */\\n modifier onlyOwner {\\n Root root = Root(ens.owner(bytes32(0)));\\n address owner = root.owner();\\n require(msg.sender == owner);\\n _;\\n }\\n\\n function setOracle(DNSSEC _dnssec) public onlyOwner {\\n oracle = _dnssec;\\n emit NewOracle(address(oracle));\\n }\\n\\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\\n suffixes = _suffixes;\\n emit NewPublicSuffixList(address(suffixes));\\n }\\n\\n /**\\n * @dev Claims a name by proving ownership of its DNS equivalent.\\n * @param name The name to claim, in DNS wire format.\\n * @param proof A DNS RRSet proving ownership of the name. Must be verified\\n * in the DNSSEC oracle before calling. This RRSET must contain a TXT\\n * record for '_ens.' + name, with the value 'a=0x...'. Ownership of\\n * the name will be transferred to the address specified in the TXT\\n * record.\\n */\\n function claim(bytes memory name, bytes memory proof) public override {\\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(name, proof);\\n ens.setSubnodeOwner(rootNode, labelHash, addr);\\n }\\n\\n /**\\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\\n * @param name The name to claim, in DNS wire format.\\n * @param input The data to be passed to the Oracle's `submitProofs` function. The last\\n * proof must be the TXT record required by the registrar.\\n * @param proof The proof record for the first element in input.\\n */\\n function proveAndClaim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof) public override {\\n proof = oracle.submitRRSets(input, proof);\\n claim(name, proof);\\n }\\n\\n function proveAndClaimWithResolver(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof, address resolver, address addr) public override {\\n proof = oracle.submitRRSets(input, proof);\\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(name, proof);\\n require(msg.sender == owner, \\\"Only owner can call proveAndClaimWithResolver\\\");\\n if(addr != address(0)) {\\n require(resolver != address(0), \\\"Cannot set addr if resolver is not set\\\");\\n // Set ourselves as the owner so we can set a record on the resolver\\n ens.setSubnodeRecord(rootNode, labelHash, address(this), resolver, 0);\\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\\n // Set the resolver record\\n AddrResolver(resolver).setAddr(node, addr);\\n // Transfer the record to the owner\\n ens.setOwner(node, owner);\\n } else {\\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\\n }\\n }\\n\\n function supportsInterface(bytes4 interfaceID) external pure returns (bool) {\\n return interfaceID == INTERFACE_META_ID ||\\n interfaceID == type(IDNSRegistrar).interfaceId;\\n }\\n\\n function _claim(bytes memory name, bytes memory proof) internal returns(bytes32 rootNode, bytes32 labelHash, address addr) {\\n // Get the first label\\n uint labelLen = name.readUint8(0);\\n labelHash = name.keccak(1, labelLen);\\n\\n // Parent name must be in the public suffix list.\\n bytes memory parentName = name.substring(labelLen + 1, name.length - labelLen - 1);\\n require(suffixes.isPublicSuffix(parentName), \\\"Parent name must be a public suffix\\\");\\n\\n // Make sure the parent name is enabled\\n rootNode = enableNode(parentName, 0);\\n\\n (addr,) = DNSClaimChecker.getOwnerAddress(oracle, name, proof);\\n\\n emit Claim(keccak256(abi.encodePacked(rootNode, labelHash)), addr, name);\\n }\\n\\n function enableNode(bytes memory domain, uint offset) internal returns(bytes32 node) {\\n uint len = domain.readUint8(offset);\\n if(len == 0) {\\n return bytes32(0);\\n }\\n\\n bytes32 parentNode = enableNode(domain, offset + len + 1);\\n bytes32 label = domain.keccak(offset + 1, len);\\n node = keccak256(abi.encodePacked(parentNode, label));\\n address owner = ens.owner(node);\\n require(owner == address(0) || owner == address(this), \\\"Cannot enable a name owned by someone else\\\");\\n if(owner != address(this)) {\\n if(parentNode == bytes32(0)) {\\n Root root = Root(ens.owner(bytes32(0)));\\n root.setSubnodeOwner(label, address(this));\\n } else {\\n ens.setSubnodeOwner(parentNode, label, address(this));\\n }\\n }\\n return node;\\n }\\n}\\n\",\"keccak256\":\"0x0781f008efeefa1ff7a9517ed94d69fe160c399c7cd6388a79e26d7f0e4e6001\"},\"contracts/dnsregistrar/PublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\ninterface PublicSuffixList {\\n function isPublicSuffix(bytes calldata name) external view returns(bool);\\n}\\n\",\"keccak256\":\"0x8e593c73f54e07a54074ed3b6bc8e976d06211f923051c9793bcb9c10114854d\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\\n uint shortest = len;\\n if (otherlen < len)\\n shortest = otherlen;\\n\\n uint selfptr;\\n uint otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint idx = 0; idx < shortest; idx += 32) {\\n uint a;\\n uint b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint mask;\\n if (shortest > 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\\n }\\n int diff = int(a & mask) - int(b & mask);\\n if (diff != 0)\\n return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int(len) - int(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\\n return self.length == other.length && equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint dest, uint src, uint len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint dest;\\n uint src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\\n require(len <= 52);\\n\\n uint ret = 0;\\n uint8 decoded;\\n for(uint i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if(i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint bitlen = len * 5;\\n if(len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if(len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if(len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if(len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if(len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n}\",\"keccak256\":\"0x83315df2e54c74451577c70da2c267c3459802b08b9aeec6516302eee70f796e\"},\"contracts/dnssec-oracle/DNSSEC.sol\":{\"content\":\"pragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nabstract contract DNSSEC {\\n\\n bytes public anchors;\\n\\n struct RRSetWithSignature {\\n bytes rrset;\\n bytes sig;\\n }\\n\\n event AlgorithmUpdated(uint8 id, address addr);\\n event DigestUpdated(uint8 id, address addr);\\n event NSEC3DigestUpdated(uint8 id, address addr);\\n event RRSetUpdated(bytes name, bytes rrset);\\n\\n function submitRRSets(RRSetWithSignature[] memory input, bytes calldata proof) public virtual returns (bytes memory);\\n function submitRRSet(RRSetWithSignature calldata input, bytes calldata proof) public virtual returns (bytes memory);\\n function deleteRRSet(uint16 deleteType, bytes calldata deleteName, RRSetWithSignature calldata nsec, bytes calldata proof) public virtual;\\n function deleteRRSetNSEC3(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory closestEncloser, RRSetWithSignature memory nextClosest, bytes memory dnskey) public virtual;\\n function rrdata(uint16 dnstype, bytes calldata name) external virtual view returns (uint32, uint32, bytes20);\\n}\\n\",\"keccak256\":\"0x5b8d2391f66e878e09aa88a97fe8ea5b26604a0c0ad9247feb6124db9817f6c1\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n* @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n*/\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(bytes memory self, uint offset) internal pure returns(uint) {\\n uint idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(bytes memory self, uint offset) internal pure returns(bytes memory ret) {\\n uint len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(bytes memory self, uint offset) internal pure returns(uint) {\\n uint count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint constant RRSIG_TYPE = 0;\\n uint constant RRSIG_ALGORITHM = 2;\\n uint constant RRSIG_LABELS = 3;\\n uint constant RRSIG_TTL = 4;\\n uint constant RRSIG_EXPIRATION = 8;\\n uint constant RRSIG_INCEPTION = 12;\\n uint constant RRSIG_KEY_TAG = 16;\\n uint constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(bytes memory data) internal pure returns(SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(RRSIG_SIGNER_NAME + self.signerName.length, data.length - RRSIG_SIGNER_NAME - self.signerName.length);\\n }\\n\\n function rrs(SignedSet memory rrset) internal pure returns(RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint rdataOffset;\\n uint nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(bytes memory self, uint offset) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns(bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns(bytes memory) {\\n return iter.data.substring(iter.offset, nameLength(iter.data, iter.offset));\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(RRIterator memory iter) internal pure returns(bytes memory) {\\n return iter.data.substring(iter.rdataOffset, iter.nextOffset - iter.rdataOffset);\\n }\\n\\n uint constant DNSKEY_FLAGS = 0;\\n uint constant DNSKEY_PROTOCOL = 2;\\n uint constant DNSKEY_ALGORITHM = 3;\\n uint constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(bytes memory data, uint offset, uint length) internal pure returns(DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(offset + DNSKEY_PUBKEY, length - DNSKEY_PUBKEY);\\n } \\n\\n uint constant DS_KEY_TAG = 0;\\n uint constant DS_ALGORITHM = 2;\\n uint constant DS_DIGEST_TYPE = 3;\\n uint constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(bytes memory data, uint offset, uint length) internal pure returns(DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n struct NSEC3 {\\n uint8 hashAlgorithm;\\n uint8 flags;\\n uint16 iterations;\\n bytes salt;\\n bytes32 nextHashedOwnerName;\\n bytes typeBitmap;\\n }\\n\\n uint constant NSEC3_HASH_ALGORITHM = 0;\\n uint constant NSEC3_FLAGS = 1;\\n uint constant NSEC3_ITERATIONS = 2;\\n uint constant NSEC3_SALT_LENGTH = 4;\\n uint constant NSEC3_SALT = 5;\\n\\n function readNSEC3(bytes memory data, uint offset, uint length) internal pure returns(NSEC3 memory self) {\\n uint end = offset + length;\\n self.hashAlgorithm = data.readUint8(offset + NSEC3_HASH_ALGORITHM);\\n self.flags = data.readUint8(offset + NSEC3_FLAGS);\\n self.iterations = data.readUint16(offset + NSEC3_ITERATIONS);\\n uint8 saltLength = data.readUint8(offset + NSEC3_SALT_LENGTH);\\n offset = offset + NSEC3_SALT;\\n self.salt = data.substring(offset, saltLength);\\n offset += saltLength;\\n uint8 nextLength = data.readUint8(offset);\\n require(nextLength <= 32);\\n offset += 1;\\n self.nextHashedOwnerName = data.readBytesN(offset, nextLength);\\n offset += nextLength;\\n self.typeBitmap = data.substring(offset, end - offset);\\n }\\n\\n function checkTypeBitmap(NSEC3 memory self, uint16 rrtype) internal pure returns(bool) {\\n return checkTypeBitmap(self.typeBitmap, 0, rrtype);\\n }\\n\\n /**\\n * @dev Checks if a given RR type exists in a type bitmap.\\n * @param bitmap The byte string to read the type bitmap from.\\n * @param offset The offset to start reading at.\\n * @param rrtype The RR type to check for.\\n * @return True if the type is found in the bitmap, false otherwise.\\n */\\n function checkTypeBitmap(bytes memory bitmap, uint offset, uint16 rrtype) internal pure returns (bool) {\\n uint8 typeWindow = uint8(rrtype >> 8);\\n uint8 windowByte = uint8((rrtype & 0xff) / 8);\\n uint8 windowBitmask = uint8(uint8(1) << (uint8(7) - uint8(rrtype & 0x7)));\\n for (uint off = offset; off < bitmap.length;) {\\n uint8 window = bitmap.readUint8(off);\\n uint8 len = bitmap.readUint8(off + 1);\\n if (typeWindow < window) {\\n // We've gone past our window; it's not here.\\n return false;\\n } else if (typeWindow == window) {\\n // Check this type bitmap\\n if (len <= windowByte) {\\n // Our type is past the end of the bitmap\\n return false;\\n }\\n return (bitmap.readUint8(off + windowByte + 2) & windowBitmask) != 0;\\n } else {\\n // Skip this type bitmap\\n off += len + 2;\\n }\\n }\\n\\n return false;\\n }\\n\\n function compareNames(bytes memory self, bytes memory other) internal pure returns (int) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint off;\\n uint otheroff;\\n uint prevoff;\\n uint otherprevoff;\\n uint counts = labelCount(self, 0);\\n uint othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if(otheroff == 0) {\\n return 1;\\n }\\n\\n return self.compare(prevoff + 1, self.readUint8(prevoff), other, otherprevoff + 1, other.readUint8(otherprevoff));\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(uint32 i1, uint32 i2) internal pure returns(bool) {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n\\n function progress(bytes memory body, uint off) internal pure returns(uint) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint ac1;\\n uint ac2;\\n for(uint i = 0; i < data.length + 31; i += 32) {\\n uint word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if(i + 32 > data.length) {\\n uint unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 += (word & 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >> 8;\\n ac2 += (word & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 = (ac1 & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF)\\n + ((ac1 & 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >> 16);\\n ac2 = (ac2 & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF)\\n + ((ac2 & 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >> 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 = (ac1 & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF)\\n + ((ac1 & 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >> 32);\\n ac1 = (ac1 & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF)\\n + ((ac1 & 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >> 64);\\n ac1 = (ac1 & 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\\n + (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\",\"keccak256\":\"0x811642c86c539d645ef99a15fa1bf0eb4ce963cf1a618ef2a6f34d27a5e34030\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual;\\n function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual;\\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external virtual returns(bytes32);\\n function setResolver(bytes32 node, address resolver) external virtual;\\n function setOwner(bytes32 node, address owner) external virtual;\\n function setTTL(bytes32 node, uint64 ttl) external virtual;\\n function setApprovalForAll(address operator, bool approved) external virtual;\\n function owner(bytes32 node) external virtual view returns (address);\\n function resolver(bytes32 node) external virtual view returns (address);\\n function ttl(bytes32 node) external virtual view returns (uint64);\\n function recordExists(bytes32 node) external virtual view returns (bool);\\n function isApprovedForAll(address owner, address operator) external virtual view returns (bool);\\n}\\n\",\"keccak256\":\"0x942ef29bd7c0f62228aeb91879ddd1ba101f52a2162970d3e48adffa498f4483\"},\"contracts/registry/ENSRegistry.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"./ENS.sol\\\";\\n\\n/**\\n * The ENS registry contract.\\n */\\ncontract ENSRegistry is ENS {\\n\\n struct Record {\\n address owner;\\n address resolver;\\n uint64 ttl;\\n }\\n\\n mapping (bytes32 => Record) records;\\n mapping (address => mapping(address => bool)) operators;\\n\\n // Permits modifications only by the owner of the specified node.\\n modifier authorised(bytes32 node) {\\n address owner = records[node].owner;\\n require(owner == msg.sender || operators[owner][msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Constructs a new ENS registrar.\\n */\\n constructor() public {\\n records[0x0].owner = msg.sender;\\n }\\n\\n /**\\n * @dev Sets the record for a node.\\n * @param node The node to update.\\n * @param owner The address of the new owner.\\n * @param resolver The address of the resolver.\\n * @param ttl The TTL in seconds.\\n */\\n function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual override {\\n setOwner(node, owner);\\n _setResolverAndTTL(node, resolver, ttl);\\n }\\n\\n /**\\n * @dev Sets the record for a subnode.\\n * @param node The parent node.\\n * @param label The hash of the label specifying the subnode.\\n * @param owner The address of the new owner.\\n * @param resolver The address of the resolver.\\n * @param ttl The TTL in seconds.\\n */\\n function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual override {\\n bytes32 subnode = setSubnodeOwner(node, label, owner);\\n _setResolverAndTTL(subnode, resolver, ttl);\\n }\\n\\n /**\\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\\n * @param node The node to transfer ownership of.\\n * @param owner The address of the new owner.\\n */\\n function setOwner(bytes32 node, address owner) public virtual override authorised(node) {\\n _setOwner(node, owner);\\n emit Transfer(node, owner);\\n }\\n\\n /**\\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\\n * @param node The parent node.\\n * @param label The hash of the label specifying the subnode.\\n * @param owner The address of the new owner.\\n */\\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public virtual override authorised(node) returns(bytes32) {\\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\\n _setOwner(subnode, owner);\\n emit NewOwner(node, label, owner);\\n return subnode;\\n }\\n\\n /**\\n * @dev Sets the resolver address for the specified node.\\n * @param node The node to update.\\n * @param resolver The address of the resolver.\\n */\\n function setResolver(bytes32 node, address resolver) public virtual override authorised(node) {\\n emit NewResolver(node, resolver);\\n records[node].resolver = resolver;\\n }\\n\\n /**\\n * @dev Sets the TTL for the specified node.\\n * @param node The node to update.\\n * @param ttl The TTL in seconds.\\n */\\n function setTTL(bytes32 node, uint64 ttl) public virtual override authorised(node) {\\n emit NewTTL(node, ttl);\\n records[node].ttl = ttl;\\n }\\n\\n /**\\n * @dev Enable or disable approval for a third party (\\\"operator\\\") to manage\\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\\n * @param operator Address to add to the set of authorized operators.\\n * @param approved True if the operator is approved, false to revoke approval.\\n */\\n function setApprovalForAll(address operator, bool approved) external virtual override {\\n operators[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev Returns the address that owns the specified node.\\n * @param node The specified node.\\n * @return address of the owner.\\n */\\n function owner(bytes32 node) public virtual override view returns (address) {\\n address addr = records[node].owner;\\n if (addr == address(this)) {\\n return address(0x0);\\n }\\n\\n return addr;\\n }\\n\\n /**\\n * @dev Returns the address of the resolver for the specified node.\\n * @param node The specified node.\\n * @return address of the resolver.\\n */\\n function resolver(bytes32 node) public virtual override view returns (address) {\\n return records[node].resolver;\\n }\\n\\n /**\\n * @dev Returns the TTL of a node, and any records associated with it.\\n * @param node The specified node.\\n * @return ttl of the node.\\n */\\n function ttl(bytes32 node) public virtual override view returns (uint64) {\\n return records[node].ttl;\\n }\\n\\n /**\\n * @dev Returns whether a record has been imported to the registry.\\n * @param node The specified node.\\n * @return Bool if record exists\\n */\\n function recordExists(bytes32 node) public virtual override view returns (bool) {\\n return records[node].owner != address(0x0);\\n }\\n\\n /**\\n * @dev Query if an address is an authorized operator for another address.\\n * @param owner The address that owns the records.\\n * @param operator The address that acts on behalf of the owner.\\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\\n */\\n function isApprovedForAll(address owner, address operator) external virtual override view returns (bool) {\\n return operators[owner][operator];\\n }\\n\\n function _setOwner(bytes32 node, address owner) internal virtual {\\n records[node].owner = owner;\\n }\\n\\n function _setResolverAndTTL(bytes32 node, address resolver, uint64 ttl) internal {\\n if(resolver != records[node].resolver) {\\n records[node].resolver = resolver;\\n emit NewResolver(node, resolver);\\n }\\n\\n if(ttl != records[node].ttl) {\\n records[node].ttl = ttl;\\n emit NewTTL(node, ttl);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf025a2fa3fcf89a3db7064e85e9b618707a39cb47c9c1bfedaec5313b118a1c6\"},\"contracts/resolvers/ISupportsInterface.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface ISupportsInterface {\\n function supportsInterface(bytes4 interfaceID) external pure returns(bool);\\n}\",\"keccak256\":\"0x4960422af4a3d38a2c440c656104465cba7dea0231cb7ae4a489a85dd65f645f\",\"license\":\"MIT\"},\"contracts/resolvers/ResolverBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"./SupportsInterface.sol\\\";\\n\\nabstract contract ResolverBase is SupportsInterface {\\n function isAuthorised(bytes32 node) internal virtual view returns(bool);\\n\\n modifier authorised(bytes32 node) {\\n require(isAuthorised(node));\\n _;\\n }\\n}\\n\",\"keccak256\":\"0xee4e3e99b515bdb2fc231c81fc6ff35cf09c3b57e9aaef538bfbb32f7c59248c\",\"license\":\"MIT\"},\"contracts/resolvers/SupportsInterface.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"./ISupportsInterface.sol\\\";\\n\\nabstract contract SupportsInterface is ISupportsInterface {\\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\\n return interfaceID == type(ISupportsInterface).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xcd27206ee8f8bd520d5441294f6438dde98f6933eb8801ee59a0155b8a8cde1b\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/AddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IAddrResolver.sol\\\";\\nimport \\\"./IAddressResolver.sol\\\";\\n\\nabstract contract AddrResolver is IAddrResolver, IAddressResolver, ResolverBase {\\n uint constant private COIN_TYPE_ETH = 60;\\n\\n mapping(bytes32=>mapping(uint=>bytes)) _addresses;\\n\\n /**\\n * Sets the address associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param a The address to set.\\n */\\n function setAddr(bytes32 node, address a) virtual external authorised(node) {\\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\\n }\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) virtual override public view returns (address payable) {\\n bytes memory a = addr(node, COIN_TYPE_ETH);\\n if(a.length == 0) {\\n return payable(0);\\n }\\n return bytesToAddress(a);\\n }\\n\\n function setAddr(bytes32 node, uint coinType, bytes memory a) virtual public authorised(node) {\\n emit AddressChanged(node, coinType, a);\\n if(coinType == COIN_TYPE_ETH) {\\n emit AddrChanged(node, bytesToAddress(a));\\n }\\n _addresses[node][coinType] = a;\\n }\\n\\n function addr(bytes32 node, uint coinType) virtual override public view returns(bytes memory) {\\n return _addresses[node][coinType];\\n }\\n\\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\\n return interfaceID == type(IAddrResolver).interfaceId || interfaceID == type(IAddressResolver).interfaceId || super.supportsInterface(interfaceID);\\n }\\n\\n function bytesToAddress(bytes memory b) internal pure returns(address payable a) {\\n require(b.length == 20);\\n assembly {\\n a := div(mload(add(b, 32)), exp(256, 12))\\n }\\n }\\n\\n function addressToBytes(address a) internal pure returns(bytes memory b) {\\n b = new bytes(20);\\n assembly {\\n mstore(add(b, 32), mul(a, exp(256, 12)))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x356ed43442c7598b7489e1d1fef89f7b226e53c55e5cd319274b1fb7b7a81355\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress);\\n\\n function addr(bytes32 node, uint coinType) external view returns(bytes memory);\\n}\\n\",\"keccak256\":\"0x20717682fa28eb1755a3b6ade738c8e0239c1cc393579058d4c3ffaca238c04b\",\"license\":\"MIT\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0x0c364a5b65b6fff279adbe1fd6498c488feabeec781599cd60a5844e80ee7d88\"},\"contracts/root/Root.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"./Controllable.sol\\\";\\n\\ncontract Root is Ownable, Controllable {\\n bytes32 private constant ROOT_NODE = bytes32(0);\\n\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n\\n event TLDLocked(bytes32 indexed label);\\n\\n ENS public ens;\\n mapping(bytes32 => bool) public locked;\\n\\n constructor(ENS _ens) public {\\n ens = _ens;\\n }\\n\\n function setSubnodeOwner(bytes32 label, address owner)\\n external\\n onlyController\\n {\\n require(!locked[label]);\\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\\n }\\n\\n function setResolver(address resolver) external onlyOwner {\\n ens.setResolver(ROOT_NODE, resolver);\\n }\\n\\n function lock(bytes32 label) external onlyOwner {\\n emit TLDLocked(label);\\n locked[label] = true;\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n external\\n pure\\n returns (bool)\\n {\\n return interfaceID == INTERFACE_META_ID;\\n }\\n}\\n\",\"keccak256\":\"0xf6fed46bbdc8a425d112c473a649045148b2e0404647c97590d2a3e2798c9fe3\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b5060405162002669380380620026698339810160408190526200003491620000ff565b600080546001600160a01b0319166001600160a01b0385169081179091556040519081527fb3eacd0e351fafdfefdec84e1cd19679b38dbcd63ea7c2c24da17fd2bc3b3c0e9060200160405180910390a1600280546001600160a01b0319166001600160a01b0384169081179091556040519081527f9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba89060200160405180910390a1600180546001600160a01b0319166001600160a01b0392909216919091179055506200016b9050565b60008060006060848603121562000114578283fd5b8351620001218162000152565b6020850151909350620001348162000152565b6040850151909250620001478162000152565b809150509250925092565b6001600160a01b03811681146200016857600080fd5b50565b6124ee806200017b6000396000f3fe608060405234801561001057600080fd5b50600436106100a35760003560e01c80633f15457f116100765780637dc0d1d01161005b5780637dc0d1d0146101705780638bbedf7514610190578063be27b22c146101a357600080fd5b80633f15457f1461013d5780637adbf9731461015d57600080fd5b806301ffc9a7146100a85780631ecfc411146100d0578063224199c2146100e557806330349ebe146100f8575b600080fd5b6100bb6100b6366004611e6a565b6101b6565b60405190151581526020015b60405180910390f35b6100e36100de3660046120ae565b61024f565b005b6100e36100f3366004611fa1565b610414565b6002546101189073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100c7565b6001546101189073ffffffffffffffffffffffffffffffffffffffff1681565b6100e361016b3660046120ae565b6108e1565b6000546101189073ffffffffffffffffffffffffffffffffffffffff1681565b6100e361019e366004611f1d565b610a9d565b6100e36101b136600461204d565b610b5c565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061024957507fffffffff0000000000000000000000000000000000000000000000000000000082167f17d8f49b00000000000000000000000000000000000000000000000000000000145b92915050565b6001546040517f02571be30000000000000000000000000000000000000000000000000000000081526000600482018190529173ffffffffffffffffffffffffffffffffffffffff16906302571be39060240160206040518083038186803b1580156102ba57600080fd5b505afa1580156102ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f29190611e16565b905060008173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561033c57600080fd5b505afa158015610350573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103749190611e16565b90503373ffffffffffffffffffffffffffffffffffffffff82161461039857600080fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85169081179091556040519081527f9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba8906020015b60405180910390a1505050565b6000546040517f435cc16200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063435cc1629061046c9087908790600401612160565b600060405180830381600087803b15801561048657600080fd5b505af115801561049a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104c29190810190611eaa565b925060008060006104d38887610c30565b919450925090503373ffffffffffffffffffffffffffffffffffffffff821614610584576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f4f6e6c79206f776e65722063616e2063616c6c2070726f7665416e64436c616960448201527f6d576974685265736f6c7665720000000000000000000000000000000000000060648201526084015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8416156108345773ffffffffffffffffffffffffffffffffffffffff8516610643576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f43616e6e6f74207365742061646472206966207265736f6c766572206973206e60448201527f6f74207365740000000000000000000000000000000000000000000000000000606482015260840161057b565b6001546040517f5ef2c7f0000000000000000000000000000000000000000000000000000000008152600481018590526024810184905230604482015273ffffffffffffffffffffffffffffffffffffffff87811660648301526000608483015290911690635ef2c7f09060a401600060405180830381600087803b1580156106cb57600080fd5b505af11580156106df573d6000803e3d6000fd5b5050505060008383604051602001610701929190918252602082015260400190565b60408051808303601f190181529082905280516020909101207fd5fa2b000000000000000000000000000000000000000000000000000000000082526004820181905273ffffffffffffffffffffffffffffffffffffffff878116602484015290925087169063d5fa2b0090604401600060405180830381600087803b15801561078a57600080fd5b505af115801561079e573d6000803e3d6000fd5b50506001546040517f5b0fc9c30000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff86811660248301529091169250635b0fc9c39150604401600060405180830381600087803b15801561081657600080fd5b505af115801561082a573d6000803e3d6000fd5b50505050506108d7565b6001546040517f5ef2c7f0000000000000000000000000000000000000000000000000000000008152600481018590526024810184905273ffffffffffffffffffffffffffffffffffffffff838116604483015287811660648301526000608483015290911690635ef2c7f09060a401600060405180830381600087803b1580156108be57600080fd5b505af11580156108d2573d6000803e3d6000fd5b505050505b5050505050505050565b6001546040517f02571be30000000000000000000000000000000000000000000000000000000081526000600482018190529173ffffffffffffffffffffffffffffffffffffffff16906302571be39060240160206040518083038186803b15801561094c57600080fd5b505afa158015610960573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109849190611e16565b905060008173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ce57600080fd5b505afa1580156109e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a069190611e16565b90503373ffffffffffffffffffffffffffffffffffffffff821614610a2a57600080fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85169081179091556040519081527fb3eacd0e351fafdfefdec84e1cd19679b38dbcd63ea7c2c24da17fd2bc3b3c0e90602001610407565b6000546040517f435cc16200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063435cc16290610af59085908590600401612160565b600060405180830381600087803b158015610b0f57600080fd5b505af1158015610b23573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b4b9190810190611eaa565b9050610b578382610b5c565b505050565b6000806000610b6b8585610c30565b6001546040517f06ab5923000000000000000000000000000000000000000000000000000000008152600481018590526024810184905273ffffffffffffffffffffffffffffffffffffffff808416604483015294975092955090935091909116906306ab592390606401602060405180830381600087803b158015610bf057600080fd5b505af1158015610c04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c289190611e52565b505050505050565b6000808080610c3f8682610e6e565b60ff169050610c5086600183610eb9565b92506000610c83610c6283600161229f565b6001848a51610c719190612380565b610c7b9190612380565b899190610edd565b6002546040517f4f89059e00000000000000000000000000000000000000000000000000000000815291925073ffffffffffffffffffffffffffffffffffffffff1690634f89059e90610cda908490600401612216565b60206040518083038186803b158015610cf257600080fd5b505afa158015610d06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2a9190611e32565b610db6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f506172656e74206e616d65206d7573742062652061207075626c69632073756660448201527f6669780000000000000000000000000000000000000000000000000000000000606482015260840161057b565b610dc1816000610f86565b600054909550610de89073ffffffffffffffffffffffffffffffffffffffff16888861138d565b50604080516020810188905290810186905290935073ffffffffffffffffffffffffffffffffffffffff841690606001604051602081830303815290604052805190602001207fa2e66ce20e6fb2c4f61339c364ad79f15160cf5307230c8bc4d628adbca2ba3989604051610e5d9190612216565b60405180910390a350509250925092565b6000828281518110610ea9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b016020015160f81c905092915050565b8251600090610ec8838561229f565b1115610ed357600080fd5b5091016020012090565b8251606090610eec838561229f565b1115610ef757600080fd5b60008267ffffffffffffffff811115610f39577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015610f63576020820181803683370190505b50905060208082019086860101610f7b82828761164c565b509095945050505050565b600080610f938484610e6e565b60ff16905080610fa7575060009050610249565b6000610fc785610fb7848761229f565b610fc290600161229f565b610f86565b90506000610fe1610fd986600161229f565b879085610eb9565b604080516020810185905290810182905290915060600160408051808303601f190181529082905280516020909101206001547f02571be30000000000000000000000000000000000000000000000000000000083526004830182905290955060009173ffffffffffffffffffffffffffffffffffffffff909116906302571be39060240160206040518083038186803b15801561107e57600080fd5b505afa158015611092573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b69190611e16565b905073ffffffffffffffffffffffffffffffffffffffff811615806110f0575073ffffffffffffffffffffffffffffffffffffffff811630145b61117c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f43616e6e6f7420656e61626c652061206e616d65206f776e656420627920736f60448201527f6d656f6e6520656c736500000000000000000000000000000000000000000000606482015260840161057b565b73ffffffffffffffffffffffffffffffffffffffff8116301461138357826112d0576001546040517f02571be30000000000000000000000000000000000000000000000000000000081526000600482018190529173ffffffffffffffffffffffffffffffffffffffff16906302571be39060240160206040518083038186803b15801561120957600080fd5b505afa15801561121d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112419190611e16565b6040517f8cb8ecec0000000000000000000000000000000000000000000000000000000081526004810185905230602482015290915073ffffffffffffffffffffffffffffffffffffffff821690638cb8ecec90604401600060405180830381600087803b1580156112b257600080fd5b505af11580156112c6573d6000803e3d6000fd5b5050505050611383565b6001546040517f06ab5923000000000000000000000000000000000000000000000000000000008152600481018590526024810184905230604482015273ffffffffffffffffffffffffffffffffffffffff909116906306ab592390606401602060405180830381600087803b15801561134957600080fd5b505af115801561135d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113819190611e52565b505b5050505092915050565b6000806113ad604051806040016040528060608152602001600081525090565b6113c5855160056113be919061229f565b82906116c0565b5060408051808201909152600581527f045f656e730000000000000000000000000000000000000000000000000000006020820152611405908290611725565b506114108186611725565b5080516040517f087991bc000000000000000000000000000000000000000000000000000000008152600091829173ffffffffffffffffffffffffffffffffffffffff8a169163087991bc9161146b91601091600401612229565b60606040518083038186803b15801561148357600080fd5b505afa158015611497573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114bb91906120ca565b93509150507fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082161580156114ef57508551155b156115035760008094509450505050611644565b855160208701207fffffffffffffffffffffffffffffffffffffffff00000000000000000000000083811691161461153a57600080fd5b60006115468782611753565b90505b805151602082015110156116385761157081608001518361156a91906122b7565b426117b4565b6115fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603c60248201527f444e53207265636f7264206973207374616c653b2072656672657368206f722060448201527f64656c657465206974206265666f72652070726f63656564696e672e00000000606482015260840161057b565b60008061160d898460a001516117cd565b92509050811561162857965060019550611644945050505050565b505061163381611840565b611549565b50600080945094505050505b935093915050565b60208110611684578151835261166360208461229f565b925061167060208361229f565b915061167d602082612380565b905061164c565b905182516020929092036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199091169116179052565b6040805180820190915260608152600060208201526116e06020836123fc565b15611708576116f06020836123fc565b6116fb906020612380565b611705908361229f565b91505b506020828101829052604080518085526000815290920101905290565b60408051808201909152606081526000602082015261174c83846000015151848551611928565b9392505050565b6117a16040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261024981611840565b6000806117c1838561231c565b60030b12159392505050565b6000805b83518310156118325760006117e68585610e6e565b60ff1690506117f660018561229f565b9350600080611806878785611a30565b92509050811561181e57935060019250611839915050565b611828838761229f565b95505050506117d1565b5060009050805b9250929050565b60c081015160208201819052815151116118575750565b600061186b82600001518360200151611a8c565b826020015161187a919061229f565b82519091506118899082611b12565b61ffff16604083015261189d60028261229f565b82519091506118ac9082611b12565b61ffff1660608301526118c060028261229f565b82519091506118cf9082611b3a565b63ffffffff1660808301526118e560048261229f565b82519091506000906118f79083611b12565b61ffff16905061190860028361229f565b60a08401819052915061191b818361229f565b60c0909301929092525050565b604080518082019091526060815260006020820152825182111561194b57600080fd5b602085015161195a838661229f565b111561198d5761198d8561197d87602001518786611978919061229f565b611b64565b6119889060026122df565b611b7b565b6000808651805187602083010193508088870111156119ac5787860182525b505050602084015b602084106119ec57805182526119cb60208361229f565b91506119d860208261229f565b90506119e5602085612380565b93506119b4565b5181517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60208690036101000a019081169019919091161790525083949350505050565b600080611a3d8585611b3a565b63ffffffff1663613d307814611a5857506000905080611644565b602c831015611a6c57506000905080611644565b611a8085611a7b86600461229f565b611b98565b91509150935093915050565b6000815b83518110611ac7577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000611ad38583610e6e565b60ff169050611ae381600161229f565b611aed908361229f565b915080611afa5750611b00565b50611a90565b611b0a8382612380565b949350505050565b8151600090611b2283600261229f565b1115611b2d57600080fd5b50016002015161ffff1690565b8151600090611b4a83600461229f565b1115611b5557600080fd5b50016004015163ffffffff1690565b600081831115611b75575081610249565b50919050565b8151611b8783836116c0565b50611b928382611725565b50505050565b6000806028838551611baa9190612380565b1015611bbb57506000905080611839565b6000835b611bca85602861229f565b811015611c775760049190911b906000611be48783610e6e565b60ff16905060308110158015611bfa5750603a81105b15611c1357611c0a603082612380565b83179250611c64565b60418110158015611c245750604781105b15611c3457611c0a603782612380565b60618110158015611c455750606781105b15611c5557611c0a605782612380565b60008094509450505050611839565b5080611c6f816123c3565b915050611bbf565b50946001945092505050565b600082601f830112611c93578081fd5b8135602067ffffffffffffffff80831115611cb057611cb0612464565b8260051b611cbf838201612246565b8481528381019087850183890186018a1015611cd9578788fd5b8793505b86841015611d1657803585811115611cf3578889fd5b611d018b88838d0101611d74565b84525060019390930192918501918501611cdd565b5098975050505050505050565b600082601f830112611d33578081fd5b8135611d46611d4182612277565b612246565b818152846020838601011115611d5a578283fd5b816020850160208301379081016020019190915292915050565b600060408284031215611d85578081fd5b6040516040810167ffffffffffffffff8282108183111715611da957611da9612464565b816040528293508435915080821115611dc157600080fd5b611dcd86838701611d23565b83526020850135915080821115611de357600080fd5b50611df085828601611d23565b6020830152505092915050565b805163ffffffff81168114611e1157600080fd5b919050565b600060208284031215611e27578081fd5b815161174c81612493565b600060208284031215611e43578081fd5b8151801515811461174c578182fd5b600060208284031215611e63578081fd5b5051919050565b600060208284031215611e7b578081fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461174c578182fd5b600060208284031215611ebb578081fd5b815167ffffffffffffffff811115611ed1578182fd5b8201601f81018413611ee1578182fd5b8051611eef611d4182612277565b818152856020838501011115611f03578384fd5b611f14826020830160208601612397565b95945050505050565b600080600060608486031215611f31578182fd5b833567ffffffffffffffff80821115611f48578384fd5b611f5487838801611d23565b94506020860135915080821115611f69578384fd5b611f7587838801611c83565b93506040860135915080821115611f8a578283fd5b50611f9786828701611d23565b9150509250925092565b600080600080600060a08688031215611fb8578081fd5b853567ffffffffffffffff80821115611fcf578283fd5b611fdb89838a01611d23565b96506020880135915080821115611ff0578283fd5b611ffc89838a01611c83565b95506040880135915080821115612011578283fd5b5061201e88828901611d23565b935050606086013561202f81612493565b9150608086013561203f81612493565b809150509295509295909350565b6000806040838503121561205f578182fd5b823567ffffffffffffffff80821115612076578384fd5b61208286838701611d23565b93506020850135915080821115612097578283fd5b506120a485828601611d23565b9150509250929050565b6000602082840312156120bf578081fd5b813561174c81612493565b6000806000606084860312156120de578081fd5b6120e784611dfd565b92506120f560208501611dfd565b915060408401517fffffffffffffffffffffffffffffffffffffffff00000000000000000000000081168114612129578182fd5b809150509250925092565b6000815180845261214c816020860160208601612397565b601f01601f19169290920160200192915050565b6000604080830181845280865180835260608601915060608160051b87010192506020808901865b838110156121f6577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0898703018552815180518888526121ca89890182612134565b91850151888303898701529190506121e28183612134565b975050509382019390820190600101612188565b50508684038188015250505061220c8186612134565b9695505050505050565b60208152600061174c6020830184612134565b61ffff83168152604060208201526000611b0a6040830184612134565b604051601f8201601f1916810167ffffffffffffffff8111828210171561226f5761226f612464565b604052919050565b600067ffffffffffffffff82111561229157612291612464565b50601f01601f191660200190565b600082198211156122b2576122b2612435565b500190565b600063ffffffff8083168185168083038211156122d6576122d6612435565b01949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561231757612317612435565b500290565b60008160030b8360030b828112817fffffffffffffffffffffffffffffffffffffffffffffffffffffffff800000000183128115161561235e5761235e612435565b81637fffffff01831381161561237657612376612435565b5090039392505050565b60008282101561239257612392612435565b500390565b60005b838110156123b257818101518382015260200161239a565b83811115611b925750506000910152565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156123f5576123f5612435565b5060010190565b600082612430577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146124b557600080fd5b5056fea2646970667358221220ae0dd6139ae0cb36a2718e587e540353a25d46471a76819b506675195c4767d464736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a35760003560e01c80633f15457f116100765780637dc0d1d01161005b5780637dc0d1d0146101705780638bbedf7514610190578063be27b22c146101a357600080fd5b80633f15457f1461013d5780637adbf9731461015d57600080fd5b806301ffc9a7146100a85780631ecfc411146100d0578063224199c2146100e557806330349ebe146100f8575b600080fd5b6100bb6100b6366004611e6a565b6101b6565b60405190151581526020015b60405180910390f35b6100e36100de3660046120ae565b61024f565b005b6100e36100f3366004611fa1565b610414565b6002546101189073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100c7565b6001546101189073ffffffffffffffffffffffffffffffffffffffff1681565b6100e361016b3660046120ae565b6108e1565b6000546101189073ffffffffffffffffffffffffffffffffffffffff1681565b6100e361019e366004611f1d565b610a9d565b6100e36101b136600461204d565b610b5c565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061024957507fffffffff0000000000000000000000000000000000000000000000000000000082167f17d8f49b00000000000000000000000000000000000000000000000000000000145b92915050565b6001546040517f02571be30000000000000000000000000000000000000000000000000000000081526000600482018190529173ffffffffffffffffffffffffffffffffffffffff16906302571be39060240160206040518083038186803b1580156102ba57600080fd5b505afa1580156102ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f29190611e16565b905060008173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561033c57600080fd5b505afa158015610350573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103749190611e16565b90503373ffffffffffffffffffffffffffffffffffffffff82161461039857600080fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85169081179091556040519081527f9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba8906020015b60405180910390a1505050565b6000546040517f435cc16200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063435cc1629061046c9087908790600401612160565b600060405180830381600087803b15801561048657600080fd5b505af115801561049a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104c29190810190611eaa565b925060008060006104d38887610c30565b919450925090503373ffffffffffffffffffffffffffffffffffffffff821614610584576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f4f6e6c79206f776e65722063616e2063616c6c2070726f7665416e64436c616960448201527f6d576974685265736f6c7665720000000000000000000000000000000000000060648201526084015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8416156108345773ffffffffffffffffffffffffffffffffffffffff8516610643576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f43616e6e6f74207365742061646472206966207265736f6c766572206973206e60448201527f6f74207365740000000000000000000000000000000000000000000000000000606482015260840161057b565b6001546040517f5ef2c7f0000000000000000000000000000000000000000000000000000000008152600481018590526024810184905230604482015273ffffffffffffffffffffffffffffffffffffffff87811660648301526000608483015290911690635ef2c7f09060a401600060405180830381600087803b1580156106cb57600080fd5b505af11580156106df573d6000803e3d6000fd5b5050505060008383604051602001610701929190918252602082015260400190565b60408051808303601f190181529082905280516020909101207fd5fa2b000000000000000000000000000000000000000000000000000000000082526004820181905273ffffffffffffffffffffffffffffffffffffffff878116602484015290925087169063d5fa2b0090604401600060405180830381600087803b15801561078a57600080fd5b505af115801561079e573d6000803e3d6000fd5b50506001546040517f5b0fc9c30000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff86811660248301529091169250635b0fc9c39150604401600060405180830381600087803b15801561081657600080fd5b505af115801561082a573d6000803e3d6000fd5b50505050506108d7565b6001546040517f5ef2c7f0000000000000000000000000000000000000000000000000000000008152600481018590526024810184905273ffffffffffffffffffffffffffffffffffffffff838116604483015287811660648301526000608483015290911690635ef2c7f09060a401600060405180830381600087803b1580156108be57600080fd5b505af11580156108d2573d6000803e3d6000fd5b505050505b5050505050505050565b6001546040517f02571be30000000000000000000000000000000000000000000000000000000081526000600482018190529173ffffffffffffffffffffffffffffffffffffffff16906302571be39060240160206040518083038186803b15801561094c57600080fd5b505afa158015610960573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109849190611e16565b905060008173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ce57600080fd5b505afa1580156109e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a069190611e16565b90503373ffffffffffffffffffffffffffffffffffffffff821614610a2a57600080fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85169081179091556040519081527fb3eacd0e351fafdfefdec84e1cd19679b38dbcd63ea7c2c24da17fd2bc3b3c0e90602001610407565b6000546040517f435cc16200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063435cc16290610af59085908590600401612160565b600060405180830381600087803b158015610b0f57600080fd5b505af1158015610b23573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b4b9190810190611eaa565b9050610b578382610b5c565b505050565b6000806000610b6b8585610c30565b6001546040517f06ab5923000000000000000000000000000000000000000000000000000000008152600481018590526024810184905273ffffffffffffffffffffffffffffffffffffffff808416604483015294975092955090935091909116906306ab592390606401602060405180830381600087803b158015610bf057600080fd5b505af1158015610c04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c289190611e52565b505050505050565b6000808080610c3f8682610e6e565b60ff169050610c5086600183610eb9565b92506000610c83610c6283600161229f565b6001848a51610c719190612380565b610c7b9190612380565b899190610edd565b6002546040517f4f89059e00000000000000000000000000000000000000000000000000000000815291925073ffffffffffffffffffffffffffffffffffffffff1690634f89059e90610cda908490600401612216565b60206040518083038186803b158015610cf257600080fd5b505afa158015610d06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2a9190611e32565b610db6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f506172656e74206e616d65206d7573742062652061207075626c69632073756660448201527f6669780000000000000000000000000000000000000000000000000000000000606482015260840161057b565b610dc1816000610f86565b600054909550610de89073ffffffffffffffffffffffffffffffffffffffff16888861138d565b50604080516020810188905290810186905290935073ffffffffffffffffffffffffffffffffffffffff841690606001604051602081830303815290604052805190602001207fa2e66ce20e6fb2c4f61339c364ad79f15160cf5307230c8bc4d628adbca2ba3989604051610e5d9190612216565b60405180910390a350509250925092565b6000828281518110610ea9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b016020015160f81c905092915050565b8251600090610ec8838561229f565b1115610ed357600080fd5b5091016020012090565b8251606090610eec838561229f565b1115610ef757600080fd5b60008267ffffffffffffffff811115610f39577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015610f63576020820181803683370190505b50905060208082019086860101610f7b82828761164c565b509095945050505050565b600080610f938484610e6e565b60ff16905080610fa7575060009050610249565b6000610fc785610fb7848761229f565b610fc290600161229f565b610f86565b90506000610fe1610fd986600161229f565b879085610eb9565b604080516020810185905290810182905290915060600160408051808303601f190181529082905280516020909101206001547f02571be30000000000000000000000000000000000000000000000000000000083526004830182905290955060009173ffffffffffffffffffffffffffffffffffffffff909116906302571be39060240160206040518083038186803b15801561107e57600080fd5b505afa158015611092573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b69190611e16565b905073ffffffffffffffffffffffffffffffffffffffff811615806110f0575073ffffffffffffffffffffffffffffffffffffffff811630145b61117c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f43616e6e6f7420656e61626c652061206e616d65206f776e656420627920736f60448201527f6d656f6e6520656c736500000000000000000000000000000000000000000000606482015260840161057b565b73ffffffffffffffffffffffffffffffffffffffff8116301461138357826112d0576001546040517f02571be30000000000000000000000000000000000000000000000000000000081526000600482018190529173ffffffffffffffffffffffffffffffffffffffff16906302571be39060240160206040518083038186803b15801561120957600080fd5b505afa15801561121d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112419190611e16565b6040517f8cb8ecec0000000000000000000000000000000000000000000000000000000081526004810185905230602482015290915073ffffffffffffffffffffffffffffffffffffffff821690638cb8ecec90604401600060405180830381600087803b1580156112b257600080fd5b505af11580156112c6573d6000803e3d6000fd5b5050505050611383565b6001546040517f06ab5923000000000000000000000000000000000000000000000000000000008152600481018590526024810184905230604482015273ffffffffffffffffffffffffffffffffffffffff909116906306ab592390606401602060405180830381600087803b15801561134957600080fd5b505af115801561135d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113819190611e52565b505b5050505092915050565b6000806113ad604051806040016040528060608152602001600081525090565b6113c5855160056113be919061229f565b82906116c0565b5060408051808201909152600581527f045f656e730000000000000000000000000000000000000000000000000000006020820152611405908290611725565b506114108186611725565b5080516040517f087991bc000000000000000000000000000000000000000000000000000000008152600091829173ffffffffffffffffffffffffffffffffffffffff8a169163087991bc9161146b91601091600401612229565b60606040518083038186803b15801561148357600080fd5b505afa158015611497573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114bb91906120ca565b93509150507fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082161580156114ef57508551155b156115035760008094509450505050611644565b855160208701207fffffffffffffffffffffffffffffffffffffffff00000000000000000000000083811691161461153a57600080fd5b60006115468782611753565b90505b805151602082015110156116385761157081608001518361156a91906122b7565b426117b4565b6115fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603c60248201527f444e53207265636f7264206973207374616c653b2072656672657368206f722060448201527f64656c657465206974206265666f72652070726f63656564696e672e00000000606482015260840161057b565b60008061160d898460a001516117cd565b92509050811561162857965060019550611644945050505050565b505061163381611840565b611549565b50600080945094505050505b935093915050565b60208110611684578151835261166360208461229f565b925061167060208361229f565b915061167d602082612380565b905061164c565b905182516020929092036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199091169116179052565b6040805180820190915260608152600060208201526116e06020836123fc565b15611708576116f06020836123fc565b6116fb906020612380565b611705908361229f565b91505b506020828101829052604080518085526000815290920101905290565b60408051808201909152606081526000602082015261174c83846000015151848551611928565b9392505050565b6117a16040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261024981611840565b6000806117c1838561231c565b60030b12159392505050565b6000805b83518310156118325760006117e68585610e6e565b60ff1690506117f660018561229f565b9350600080611806878785611a30565b92509050811561181e57935060019250611839915050565b611828838761229f565b95505050506117d1565b5060009050805b9250929050565b60c081015160208201819052815151116118575750565b600061186b82600001518360200151611a8c565b826020015161187a919061229f565b82519091506118899082611b12565b61ffff16604083015261189d60028261229f565b82519091506118ac9082611b12565b61ffff1660608301526118c060028261229f565b82519091506118cf9082611b3a565b63ffffffff1660808301526118e560048261229f565b82519091506000906118f79083611b12565b61ffff16905061190860028361229f565b60a08401819052915061191b818361229f565b60c0909301929092525050565b604080518082019091526060815260006020820152825182111561194b57600080fd5b602085015161195a838661229f565b111561198d5761198d8561197d87602001518786611978919061229f565b611b64565b6119889060026122df565b611b7b565b6000808651805187602083010193508088870111156119ac5787860182525b505050602084015b602084106119ec57805182526119cb60208361229f565b91506119d860208261229f565b90506119e5602085612380565b93506119b4565b5181517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60208690036101000a019081169019919091161790525083949350505050565b600080611a3d8585611b3a565b63ffffffff1663613d307814611a5857506000905080611644565b602c831015611a6c57506000905080611644565b611a8085611a7b86600461229f565b611b98565b91509150935093915050565b6000815b83518110611ac7577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000611ad38583610e6e565b60ff169050611ae381600161229f565b611aed908361229f565b915080611afa5750611b00565b50611a90565b611b0a8382612380565b949350505050565b8151600090611b2283600261229f565b1115611b2d57600080fd5b50016002015161ffff1690565b8151600090611b4a83600461229f565b1115611b5557600080fd5b50016004015163ffffffff1690565b600081831115611b75575081610249565b50919050565b8151611b8783836116c0565b50611b928382611725565b50505050565b6000806028838551611baa9190612380565b1015611bbb57506000905080611839565b6000835b611bca85602861229f565b811015611c775760049190911b906000611be48783610e6e565b60ff16905060308110158015611bfa5750603a81105b15611c1357611c0a603082612380565b83179250611c64565b60418110158015611c245750604781105b15611c3457611c0a603782612380565b60618110158015611c455750606781105b15611c5557611c0a605782612380565b60008094509450505050611839565b5080611c6f816123c3565b915050611bbf565b50946001945092505050565b600082601f830112611c93578081fd5b8135602067ffffffffffffffff80831115611cb057611cb0612464565b8260051b611cbf838201612246565b8481528381019087850183890186018a1015611cd9578788fd5b8793505b86841015611d1657803585811115611cf3578889fd5b611d018b88838d0101611d74565b84525060019390930192918501918501611cdd565b5098975050505050505050565b600082601f830112611d33578081fd5b8135611d46611d4182612277565b612246565b818152846020838601011115611d5a578283fd5b816020850160208301379081016020019190915292915050565b600060408284031215611d85578081fd5b6040516040810167ffffffffffffffff8282108183111715611da957611da9612464565b816040528293508435915080821115611dc157600080fd5b611dcd86838701611d23565b83526020850135915080821115611de357600080fd5b50611df085828601611d23565b6020830152505092915050565b805163ffffffff81168114611e1157600080fd5b919050565b600060208284031215611e27578081fd5b815161174c81612493565b600060208284031215611e43578081fd5b8151801515811461174c578182fd5b600060208284031215611e63578081fd5b5051919050565b600060208284031215611e7b578081fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461174c578182fd5b600060208284031215611ebb578081fd5b815167ffffffffffffffff811115611ed1578182fd5b8201601f81018413611ee1578182fd5b8051611eef611d4182612277565b818152856020838501011115611f03578384fd5b611f14826020830160208601612397565b95945050505050565b600080600060608486031215611f31578182fd5b833567ffffffffffffffff80821115611f48578384fd5b611f5487838801611d23565b94506020860135915080821115611f69578384fd5b611f7587838801611c83565b93506040860135915080821115611f8a578283fd5b50611f9786828701611d23565b9150509250925092565b600080600080600060a08688031215611fb8578081fd5b853567ffffffffffffffff80821115611fcf578283fd5b611fdb89838a01611d23565b96506020880135915080821115611ff0578283fd5b611ffc89838a01611c83565b95506040880135915080821115612011578283fd5b5061201e88828901611d23565b935050606086013561202f81612493565b9150608086013561203f81612493565b809150509295509295909350565b6000806040838503121561205f578182fd5b823567ffffffffffffffff80821115612076578384fd5b61208286838701611d23565b93506020850135915080821115612097578283fd5b506120a485828601611d23565b9150509250929050565b6000602082840312156120bf578081fd5b813561174c81612493565b6000806000606084860312156120de578081fd5b6120e784611dfd565b92506120f560208501611dfd565b915060408401517fffffffffffffffffffffffffffffffffffffffff00000000000000000000000081168114612129578182fd5b809150509250925092565b6000815180845261214c816020860160208601612397565b601f01601f19169290920160200192915050565b6000604080830181845280865180835260608601915060608160051b87010192506020808901865b838110156121f6577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0898703018552815180518888526121ca89890182612134565b91850151888303898701529190506121e28183612134565b975050509382019390820190600101612188565b50508684038188015250505061220c8186612134565b9695505050505050565b60208152600061174c6020830184612134565b61ffff83168152604060208201526000611b0a6040830184612134565b604051601f8201601f1916810167ffffffffffffffff8111828210171561226f5761226f612464565b604052919050565b600067ffffffffffffffff82111561229157612291612464565b50601f01601f191660200190565b600082198211156122b2576122b2612435565b500190565b600063ffffffff8083168185168083038211156122d6576122d6612435565b01949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561231757612317612435565b500290565b60008160030b8360030b828112817fffffffffffffffffffffffffffffffffffffffffffffffffffffffff800000000183128115161561235e5761235e612435565b81637fffffff01831381161561237657612376612435565b5090039392505050565b60008282101561239257612392612435565b500390565b60005b838110156123b257818101518382015260200161239a565b83811115611b925750506000910152565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156123f5576123f5612435565b5060010190565b600082612430577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146124b557600080fd5b5056fea2646970667358221220ae0dd6139ae0cb36a2718e587e540353a25d46471a76819b506675195c4767d464736f6c63430008040033", + "devdoc": { + "details": "An ENS registrar that allows the owner of a DNS name to claim the corresponding name in ENS.", + "kind": "dev", + "methods": { + "claim(bytes,bytes)": { + "details": "Claims a name by proving ownership of its DNS equivalent.", + "params": { + "name": "The name to claim, in DNS wire format.", + "proof": "A DNS RRSet proving ownership of the name. Must be verified in the DNSSEC oracle before calling. This RRSET must contain a TXT record for '_ens.' + name, with the value 'a=0x...'. Ownership of the name will be transferred to the address specified in the TXT record." + } + }, + "proveAndClaim(bytes,(bytes,bytes)[],bytes)": { + "details": "Submits proofs to the DNSSEC oracle, then claims a name using those proofs.", + "params": { + "input": "The data to be passed to the Oracle's `submitProofs` function. The last proof must be the TXT record required by the registrar.", + "name": "The name to claim, in DNS wire format.", + "proof": "The proof record for the first element in input." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 2810, + "contract": "contracts/dnsregistrar/DNSRegistrar.sol:DNSRegistrar", + "label": "oracle", + "offset": 0, + "slot": "0", + "type": "t_contract(DNSSEC)4290" + }, + { + "astId": 2813, + "contract": "contracts/dnsregistrar/DNSRegistrar.sol:DNSRegistrar", + "label": "ens", + "offset": 0, + "slot": "1", + "type": "t_contract(ENS)12028" + }, + { + "astId": 2816, + "contract": "contracts/dnsregistrar/DNSRegistrar.sol:DNSRegistrar", + "label": "suffixes", + "offset": 0, + "slot": "2", + "type": "t_contract(PublicSuffixList)3363" + } + ], + "types": { + "t_contract(DNSSEC)4290": { + "encoding": "inplace", + "label": "contract DNSSEC", + "numberOfBytes": "20" + }, + "t_contract(ENS)12028": { + "encoding": "inplace", + "label": "contract ENS", + "numberOfBytes": "20" + }, + "t_contract(PublicSuffixList)3363": { + "encoding": "inplace", + "label": "contract PublicSuffixList", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/DNSSECImpl.json b/solidity/dns-contracts/deployments/goerli/DNSSECImpl.json new file mode 100644 index 0000000..45ddca9 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/DNSSECImpl.json @@ -0,0 +1,756 @@ +{ + "address": "0xF427c4AdED8B6dfde604865c1a7E953B160C26f0", + "transactionHash": "0x027e94842740fec52dc25b17fcc9d4c0291ed08f6aacb9f4c54e08cb926a5631", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "_anchors", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "AlgorithmUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "DigestUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "Marker", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "NSEC3DigestUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + } + ], + "name": "RRSetUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "t", + "type": "uint256" + } + ], + "name": "Test", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "algorithms", + "outputs": [ + { + "internalType": "contract Algorithm", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "anchors", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "deleteType", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "deleteName", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature", + "name": "nsec", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + } + ], + "name": "deleteRRSet", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "deleteType", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "deleteName", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature", + "name": "closestEncloser", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature", + "name": "nextClosest", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "dnskey", + "type": "bytes" + } + ], + "name": "deleteRRSetNSEC3", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "digests", + "outputs": [ + { + "internalType": "contract Digest", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "nsec3Digests", + "outputs": [ + { + "internalType": "contract NSEC3Digest", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "dnstype", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "rrdata", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "", + "type": "uint32" + }, + { + "internalType": "bytes20", + "name": "", + "type": "bytes20" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "internalType": "contract Algorithm", + "name": "algo", + "type": "address" + } + ], + "name": "setAlgorithm", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "internalType": "contract Digest", + "name": "digest", + "type": "address" + } + ], + "name": "setDigest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "internalType": "contract NSEC3Digest", + "name": "digest", + "type": "address" + } + ], + "name": "setNSEC3Digest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature", + "name": "input", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + } + ], + "name": "submitRRSet", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature[]", + "name": "input", + "type": "tuple[]" + }, + { + "internalType": "bytes", + "name": "_proof", + "type": "bytes" + } + ], + "name": "submitRRSets", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x027e94842740fec52dc25b17fcc9d4c0291ed08f6aacb9f4c54e08cb926a5631", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0xF427c4AdED8B6dfde604865c1a7E953B160C26f0", + "transactionIndex": 35, + "gasUsed": "3198290", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x3bd90892eb6dfb4d6e63aa01ab9aee246385e5237f780553ae5783550f18b97c", + "transactionHash": "0x027e94842740fec52dc25b17fcc9d4c0291ed08f6aacb9f4c54e08cb926a5631", + "logs": [ + { + "transactionIndex": 35, + "blockNumber": 6470040, + "transactionHash": "0x027e94842740fec52dc25b17fcc9d4c0291ed08f6aacb9f4c54e08cb926a5631", + "address": "0xF427c4AdED8B6dfde604865c1a7E953B160C26f0", + "topics": [ + "0x55ced933cdd5a34dd03eb5d4bef19ec6ebb251dcd7a988eee0c1b9a13baaa88b" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006d00002b000100000e1000244a5c080249aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb500002b000100000e1000244f660802e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d00002b000100000e10000404fefdfd00000000000000000000000000000000000000", + "logIndex": 96, + "blockHash": "0x3bd90892eb6dfb4d6e63aa01ab9aee246385e5237f780553ae5783550f18b97c" + } + ], + "blockNumber": 6470040, + "cumulativeGasUsed": "12458761", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00002b000100000e1000244a5c080249aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb500002b000100000e1000244f660802e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d00002b000100000e10000404fefdfd" + ], + "solcInputHash": "7948b60c3b601df824761a337a51d661", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_anchors\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"AlgorithmUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"DigestUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"Marker\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"NSEC3DigestUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"}],\"name\":\"RRSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"t\",\"type\":\"uint256\"}],\"name\":\"Test\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"algorithms\",\"outputs\":[{\"internalType\":\"contract Algorithm\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"anchors\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"deleteType\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"deleteName\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature\",\"name\":\"nsec\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"deleteRRSet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"deleteType\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"deleteName\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature\",\"name\":\"closestEncloser\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature\",\"name\":\"nextClosest\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"dnskey\",\"type\":\"bytes\"}],\"name\":\"deleteRRSetNSEC3\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"digests\",\"outputs\":[{\"internalType\":\"contract Digest\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"nsec3Digests\",\"outputs\":[{\"internalType\":\"contract NSEC3Digest\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"dnstype\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"rrdata\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"},{\"internalType\":\"bytes20\",\"name\":\"\",\"type\":\"bytes20\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"internalType\":\"contract Algorithm\",\"name\":\"algo\",\"type\":\"address\"}],\"name\":\"setAlgorithm\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"internalType\":\"contract Digest\",\"name\":\"digest\",\"type\":\"address\"}],\"name\":\"setDigest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"internalType\":\"contract NSEC3Digest\",\"name\":\"digest\",\"type\":\"address\"}],\"name\":\"setNSEC3Digest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature\",\"name\":\"input\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"submitRRSet\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature[]\",\"name\":\"input\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"_proof\",\"type\":\"bytes\"}],\"name\":\"submitRRSets\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_anchors\":\"The binary format RR entries for the root DS records.\"}},\"deleteRRSet(uint16,bytes,(bytes,bytes),bytes)\":{\"details\":\"Deletes an RR from the oracle.\",\"params\":{\"deleteName\":\"which you want to delete\",\"deleteType\":\"The DNS record type to delete.\",\"nsec\":\"The signed NSEC RRset. This is in the format described in section 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature data, followed by a series of canonicalised RR records that the signature applies to.\"}},\"deleteRRSetNSEC3(uint16,bytes,(bytes,bytes),(bytes,bytes),bytes)\":{\"details\":\"Deletes an RR from the oracle using an NSEC3 proof. Deleting a record using NSEC3 requires using up to two NSEC3 records. There are two cases: 1. The name exists, but the record type doesn't. Eg, example.com has A records but no TXT records. 2. The name does not exist, but a parent name does. In the first case, we submit one NSEC3 proof in `closestEncloser` that matches the target name but does not have the bit for `deleteType` set in its type bitmap. In the second case, we submit two proofs: closestEncloser and nextClosest, that together prove that the name does not exist. NSEC3 records are in the format described in section 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature data, followed by a series of canonicalised RR records that the signature applies to.\",\"params\":{\"closestEncloser\":\"An NSEC3 proof matching the closest enclosing name - that is, the nearest ancestor of the target name that *does* exist.\",\"deleteName\":\"The name to delete.\",\"deleteType\":\"The DNS record type to delete.\",\"dnskey\":\"An encoded DNSKEY record that has already been submitted to the oracle and can be used to verify the signatures closestEncloserSig and nextClosestSig\",\"nextClosest\":\"An NSEC3 proof covering the next closest name. This proves that the immediate subdomain of the closestEncloser does not exist.\"}},\"rrdata(uint16,bytes)\":{\"details\":\"Returns data about the RRs (if any) known to this oracle with the provided type and name.\",\"params\":{\"dnstype\":\"The DNS record type to query.\",\"name\":\"The name to query, in DNS label-sequence format.\"},\"returns\":{\"_0\":\"inception The unix timestamp (wrapped) at which the signature for this RRSET was created.\",\"_1\":\"expiration The unix timestamp (wrapped) at which the signature for this RRSET expires.\",\"_2\":\"hash The hash of the RRset.\"}},\"setAlgorithm(uint8,address)\":{\"details\":\"Sets the contract address for a signature verification algorithm. Callable only by the owner.\",\"params\":{\"algo\":\"The address of the algorithm contract.\",\"id\":\"The algorithm ID\"}},\"setDigest(uint8,address)\":{\"details\":\"Sets the contract address for a digest verification algorithm. Callable only by the owner.\",\"params\":{\"digest\":\"The address of the digest contract.\",\"id\":\"The digest ID\"}},\"setNSEC3Digest(uint8,address)\":{\"details\":\"Sets the contract address for an NSEC3 digest algorithm. Callable only by the owner.\",\"params\":{\"digest\":\"The address of the digest contract.\",\"id\":\"The digest ID\"}},\"submitRRSet((bytes,bytes),bytes)\":{\"details\":\"Submits a signed set of RRs to the oracle. RRSETs are only accepted if they are signed with a key that is already trusted, or if they are self-signed, and the signing key is identified by a DS record that is already trusted.\",\"params\":{\"input\":\"The signed RR set. This is in the format described in section 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature data, followed by a series of canonicalised RR records that the signature applies to.\",\"proof\":\"The DNSKEY or DS to validate the signature against. Must Already have been submitted and proved previously.\"}},\"submitRRSets((bytes,bytes)[],bytes)\":{\"details\":\"Submits multiple RRSets\",\"params\":{\"_proof\":\"The DNSKEY or DS to validate the first signature against.\",\"input\":\"A list of RRSets and signatures forming a chain of trust from an existing known-good record.\"},\"returns\":{\"_0\":\"The last RRSET submitted.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/DNSSECImpl.sol\":\"DNSSECImpl\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for writing to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n mstore(0x40, add(32, add(ptr, capacity)))\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n function max(uint a, uint b) private pure returns(uint) {\\n if (a > b) {\\n return a;\\n }\\n return b;\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The start offset to write to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n if (off + len > buf.capacity) {\\n resize(buf, max(buf.capacity, len + off) * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(add(len, off), buflen) {\\n mstore(bufptr, add(len, off))\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, len);\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, data.length);\\n }\\n\\n /**\\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write the byte at.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\\n if (off >= buf.capacity) {\\n resize(buf, buf.capacity * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if eq(off, buflen) {\\n mstore(bufptr, add(buflen, 1))\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n return writeUint8(buf, buf.buf.length, data);\\n }\\n\\n /**\\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\\n if (len + off > buf.capacity) {\\n resize(buf, (len + off) * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off + len\\n let dest := add(add(bufptr, off), len)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(add(off, len), mload(bufptr)) {\\n mstore(bufptr, add(off, len))\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\\n return write(buf, off, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, 32);\\n }\\n\\n /**\\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\\n if (len + off > buf.capacity) {\\n resize(buf, (len + off) * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + off + sizeof(buffer length) + len\\n let dest := add(add(bufptr, off), len)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(add(off, len), mload(bufptr)) {\\n mstore(bufptr, add(off, len))\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n return writeInt(buf, buf.buf.length, data, len);\\n }\\n}\\n\",\"keccak256\":\"0x18e42be1a3e4f7b4442d7ab0b524af5e09163503439954faf0ab3792cce91caa\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\\n uint shortest = len;\\n if (otherlen < len)\\n shortest = otherlen;\\n\\n uint selfptr;\\n uint otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint idx = 0; idx < shortest; idx += 32) {\\n uint a;\\n uint b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint mask;\\n if (shortest > 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\\n }\\n int diff = int(a & mask) - int(b & mask);\\n if (diff != 0)\\n return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int(len) - int(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\\n return self.length == other.length && equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint dest, uint src, uint len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint dest;\\n uint src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\\n require(len <= 52);\\n\\n uint ret = 0;\\n uint8 decoded;\\n for(uint i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if(i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint bitlen = len * 5;\\n if(len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if(len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if(len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if(len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if(len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n}\",\"keccak256\":\"0x83315df2e54c74451577c70da2c267c3459802b08b9aeec6516302eee70f796e\"},\"contracts/dnssec-oracle/DNSSEC.sol\":{\"content\":\"pragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nabstract contract DNSSEC {\\n\\n bytes public anchors;\\n\\n struct RRSetWithSignature {\\n bytes rrset;\\n bytes sig;\\n }\\n\\n event AlgorithmUpdated(uint8 id, address addr);\\n event DigestUpdated(uint8 id, address addr);\\n event NSEC3DigestUpdated(uint8 id, address addr);\\n event RRSetUpdated(bytes name, bytes rrset);\\n\\n function submitRRSets(RRSetWithSignature[] memory input, bytes calldata proof) public virtual returns (bytes memory);\\n function submitRRSet(RRSetWithSignature calldata input, bytes calldata proof) public virtual returns (bytes memory);\\n function deleteRRSet(uint16 deleteType, bytes calldata deleteName, RRSetWithSignature calldata nsec, bytes calldata proof) public virtual;\\n function deleteRRSetNSEC3(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory closestEncloser, RRSetWithSignature memory nextClosest, bytes memory dnskey) public virtual;\\n function rrdata(uint16 dnstype, bytes calldata name) external virtual view returns (uint32, uint32, bytes20);\\n}\\n\",\"keccak256\":\"0x5b8d2391f66e878e09aa88a97fe8ea5b26604a0c0ad9247feb6124db9817f6c1\"},\"contracts/dnssec-oracle/DNSSECImpl.sol\":{\"content\":\"pragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nimport \\\"./Owned.sol\\\";\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"./RRUtils.sol\\\";\\nimport \\\"./DNSSEC.sol\\\";\\nimport \\\"./algorithms/Algorithm.sol\\\";\\nimport \\\"./digests/Digest.sol\\\";\\nimport \\\"./nsec3digests/NSEC3Digest.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/*\\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\\n *\\n * TODO: Support for NSEC3 records\\n */\\ncontract DNSSECImpl is DNSSEC, Owned {\\n using Buffer for Buffer.buffer;\\n using BytesUtils for bytes;\\n using RRUtils for *;\\n\\n uint16 constant DNSCLASS_IN = 1;\\n\\n uint16 constant DNSTYPE_NS = 2;\\n uint16 constant DNSTYPE_SOA = 6;\\n uint16 constant DNSTYPE_DNAME = 39;\\n uint16 constant DNSTYPE_DS = 43;\\n uint16 constant DNSTYPE_RRSIG = 46;\\n uint16 constant DNSTYPE_NSEC = 47;\\n uint16 constant DNSTYPE_DNSKEY = 48;\\n uint16 constant DNSTYPE_NSEC3 = 50;\\n\\n uint constant DNSKEY_FLAG_ZONEKEY = 0x100;\\n\\n uint8 constant ALGORITHM_RSASHA256 = 8;\\n\\n uint8 constant DIGEST_ALGORITHM_SHA256 = 2;\\n\\n struct RRSet {\\n uint32 inception;\\n uint32 expiration;\\n bytes20 hash;\\n }\\n\\n // (name, type) => RRSet\\n mapping (bytes32 => mapping(uint16 => RRSet)) rrsets;\\n\\n mapping (uint8 => Algorithm) public algorithms;\\n mapping (uint8 => Digest) public digests;\\n mapping (uint8 => NSEC3Digest) public nsec3Digests;\\n\\n event Test(uint t);\\n event Marker();\\n\\n /**\\n * @dev Constructor.\\n * @param _anchors The binary format RR entries for the root DS records.\\n */\\n constructor(bytes memory _anchors) {\\n // Insert the 'trust anchors' - the key hashes that start the chain\\n // of trust for all other records.\\n anchors = _anchors;\\n rrsets[keccak256(hex\\\"00\\\")][DNSTYPE_DS] = RRSet({\\n inception: uint32(0),\\n expiration: uint32(3767581600), // May 22 2089 - the latest date we can encode as of writing this\\n hash: bytes20(keccak256(anchors))\\n });\\n emit RRSetUpdated(hex\\\"00\\\", anchors);\\n }\\n\\n /**\\n * @dev Sets the contract address for a signature verification algorithm.\\n * Callable only by the owner.\\n * @param id The algorithm ID\\n * @param algo The address of the algorithm contract.\\n */\\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\\n algorithms[id] = algo;\\n emit AlgorithmUpdated(id, address(algo));\\n }\\n\\n /**\\n * @dev Sets the contract address for a digest verification algorithm.\\n * Callable only by the owner.\\n * @param id The digest ID\\n * @param digest The address of the digest contract.\\n */\\n function setDigest(uint8 id, Digest digest) public owner_only {\\n digests[id] = digest;\\n emit DigestUpdated(id, address(digest));\\n }\\n\\n /**\\n * @dev Sets the contract address for an NSEC3 digest algorithm.\\n * Callable only by the owner.\\n * @param id The digest ID\\n * @param digest The address of the digest contract.\\n */\\n function setNSEC3Digest(uint8 id, NSEC3Digest digest) public owner_only {\\n nsec3Digests[id] = digest;\\n emit NSEC3DigestUpdated(id, address(digest));\\n }\\n\\n /**\\n * @dev Submits multiple RRSets\\n * @param input A list of RRSets and signatures forming a chain of trust from an existing known-good record.\\n * @param _proof The DNSKEY or DS to validate the first signature against.\\n * @return The last RRSET submitted.\\n */\\n function submitRRSets(RRSetWithSignature[] memory input, bytes calldata _proof) public override returns (bytes memory) {\\n bytes memory proof = _proof;\\n for(uint i = 0; i < input.length; i++) {\\n proof = _submitRRSet(input[i], proof);\\n }\\n return proof;\\n }\\n\\n /**\\n * @dev Submits a signed set of RRs to the oracle.\\n *\\n * RRSETs are only accepted if they are signed with a key that is already\\n * trusted, or if they are self-signed, and the signing key is identified by\\n * a DS record that is already trusted.\\n *\\n * @param input The signed RR set. This is in the format described in section\\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\\n * data, followed by a series of canonicalised RR records that the signature\\n * applies to.\\n * @param proof The DNSKEY or DS to validate the signature against. Must Already\\n * have been submitted and proved previously.\\n */\\n function submitRRSet(RRSetWithSignature memory input, bytes memory proof)\\n public override\\n returns (bytes memory)\\n {\\n return _submitRRSet(input, proof);\\n }\\n\\n /**\\n * @dev Deletes an RR from the oracle.\\n *\\n * @param deleteType The DNS record type to delete.\\n * @param deleteName which you want to delete\\n * @param nsec The signed NSEC RRset. This is in the format described in section\\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\\n * data, followed by a series of canonicalised RR records that the signature\\n * applies to.\\n */\\n function deleteRRSet(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory nsec, bytes memory proof)\\n public override\\n {\\n RRUtils.SignedSet memory rrset;\\n rrset = validateSignedSet(nsec, proof);\\n require(rrset.typeCovered == DNSTYPE_NSEC);\\n\\n // Don't let someone use an old proof to delete a new name\\n require(RRUtils.serialNumberGte(rrset.inception, rrsets[keccak256(deleteName)][deleteType].inception));\\n\\n for (RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\\n // We're dealing with three names here:\\n // - deleteName is the name the user wants us to delete\\n // - nsecName is the owner name of the NSEC record\\n // - nextName is the next name specified in the NSEC record\\n //\\n // And three cases:\\n // - deleteName equals nsecName, in which case we can delete the\\n // record if it's not in the type bitmap.\\n // - nextName comes after nsecName, in which case we can delete\\n // the record if deleteName comes between nextName and nsecName.\\n // - nextName comes before nsecName, in which case nextName is the\\n // zone apex, and deleteName must come after nsecName.\\n checkNsecName(iter, rrset.name, deleteName, deleteType);\\n delete rrsets[keccak256(deleteName)][deleteType];\\n return;\\n }\\n // We should never reach this point\\n revert();\\n }\\n\\n function checkNsecName(RRUtils.RRIterator memory iter, bytes memory nsecName, bytes memory deleteName, uint16 deleteType) private pure {\\n uint rdataOffset = iter.rdataOffset;\\n uint nextNameLength = iter.data.nameLength(rdataOffset);\\n uint rDataLength = iter.nextOffset - iter.rdataOffset;\\n\\n // We assume that there is always typed bitmap after the next domain name\\n require(rDataLength > nextNameLength);\\n\\n int compareResult = deleteName.compareNames(nsecName);\\n if(compareResult == 0) {\\n // Name to delete is on the same label as the NSEC record\\n require(!iter.data.checkTypeBitmap(rdataOffset + nextNameLength, deleteType));\\n } else {\\n // First check if the NSEC next name comes after the NSEC name.\\n bytes memory nextName = iter.data.substring(rdataOffset,nextNameLength);\\n // deleteName must come after nsecName\\n require(compareResult > 0);\\n if(nsecName.compareNames(nextName) < 0) {\\n // deleteName must also come before nextName\\n require(deleteName.compareNames(nextName) < 0);\\n }\\n }\\n }\\n\\n /**\\n * @dev Deletes an RR from the oracle using an NSEC3 proof.\\n * Deleting a record using NSEC3 requires using up to two NSEC3 records. There are two cases:\\n * 1. The name exists, but the record type doesn't. Eg, example.com has A records but no TXT records.\\n * 2. The name does not exist, but a parent name does.\\n * In the first case, we submit one NSEC3 proof in `closestEncloser` that matches the target name\\n * but does not have the bit for `deleteType` set in its type bitmap. In the second case, we submit\\n * two proofs: closestEncloser and nextClosest, that together prove that the name does not exist.\\n * NSEC3 records are in the format described in section 5.3.2 of RFC4035: The RRDATA section\\n * from the RRSIG without the signature data, followed by a series of canonicalised RR records\\n * that the signature applies to.\\n *\\n * @param deleteType The DNS record type to delete.\\n * @param deleteName The name to delete.\\n * @param closestEncloser An NSEC3 proof matching the closest enclosing name - that is,\\n * the nearest ancestor of the target name that *does* exist.\\n * @param nextClosest An NSEC3 proof covering the next closest name. This proves that the immediate\\n * subdomain of the closestEncloser does not exist.\\n * @param dnskey An encoded DNSKEY record that has already been submitted to the oracle and can be used\\n * to verify the signatures closestEncloserSig and nextClosestSig\\n */\\n function deleteRRSetNSEC3(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory closestEncloser, RRSetWithSignature memory nextClosest, bytes memory dnskey)\\n public override\\n {\\n uint32 originalInception = rrsets[keccak256(deleteName)][deleteType].inception;\\n\\n RRUtils.SignedSet memory ce = validateSignedSet(closestEncloser, dnskey);\\n checkNSEC3Validity(ce, deleteName, originalInception);\\n\\n RRUtils.SignedSet memory nc;\\n if(nextClosest.rrset.length > 0) {\\n nc = validateSignedSet(nextClosest, dnskey);\\n checkNSEC3Validity(nc, deleteName, originalInception);\\n }\\n\\n RRUtils.NSEC3 memory ceNSEC3 = readNSEC3(ce);\\n // The flags field must be 0 or 1 (RFC5155 section 8.2).\\n require(ceNSEC3.flags & 0xfe == 0);\\n // Check that the closest encloser is from the correct zone (RFC5155 section 8.3)\\n // \\\"The DNAME type bit must not be set and the NS type bit may only be set if the SOA type bit is set.\\\"\\n require(!ceNSEC3.checkTypeBitmap(DNSTYPE_DNAME) && (!ceNSEC3.checkTypeBitmap(DNSTYPE_NS) || ceNSEC3.checkTypeBitmap(DNSTYPE_SOA)));\\n\\n // Case 1: deleteName does exist, but no records of RRTYPE deleteType do.\\n if(isMatchingNSEC3Record(deleteType, deleteName, ce.name, ceNSEC3)) {\\n delete rrsets[keccak256(deleteName)][deleteType];\\n // Case 2: deleteName does not exist.\\n } else if(isCoveringNSEC3Record(deleteName, ce.name, ceNSEC3, nc.name, readNSEC3(nc))) {\\n delete rrsets[keccak256(deleteName)][deleteType];\\n } else {\\n revert();\\n }\\n }\\n\\n function checkNSEC3Validity(RRUtils.SignedSet memory nsec, bytes memory deleteName, uint32 originalInception) private pure {\\n // The records must have been signed after the record we're trying to delete\\n require(RRUtils.serialNumberGte(nsec.inception, originalInception));\\n\\n // The record must be an NSEC3\\n require(nsec.typeCovered == DNSTYPE_NSEC3);\\n\\n // nsecName is of the form .zone.xyz. is the NSEC3 hash of the entire name the NSEC3 record matches, while\\n // zone.xyz can be any ancestor of that name. We'll check that, so someone can't use a record on foo.com\\n // as proof of the nonexistence of bar.org.\\n require(checkNSEC3OwnerName(nsec.name, deleteName));\\n }\\n\\n function isMatchingNSEC3Record(uint16 deleteType, bytes memory deleteName, bytes memory closestEncloserName, RRUtils.NSEC3 memory closestEncloser) private view returns(bool) {\\n // Check the record matches the hashed name, but the type bitmap does not include the type\\n if(checkNSEC3Name(closestEncloser, closestEncloserName, deleteName)) {\\n return !closestEncloser.checkTypeBitmap(deleteType);\\n }\\n\\n return false;\\n }\\n\\n function isCoveringNSEC3Record(bytes memory deleteName, bytes memory ceName, RRUtils.NSEC3 memory ce, bytes memory ncName, RRUtils.NSEC3 memory nc) private view returns(bool) {\\n // The flags field must be 0 or 1 (RFC5155 section 8.2).\\n require(nc.flags & 0xfe == 0);\\n\\n bytes32 ceNameHash = decodeOwnerNameHash(ceName);\\n bytes32 ncNameHash = decodeOwnerNameHash(ncName);\\n\\n uint lastOffset = 0;\\n // Iterate over suffixes of the name to delete until one matches the closest encloser\\n for(uint offset = deleteName.readUint8(0) + 1; offset < deleteName.length; offset += deleteName.readUint8(offset) + 1) {\\n if(hashName(ce, deleteName.substring(offset, deleteName.length - offset)) == ceNameHash) {\\n // Check that the next closest record encloses the name one label longer\\n bytes32 checkHash = hashName(nc, deleteName.substring(lastOffset, deleteName.length - lastOffset));\\n if(ncNameHash < nc.nextHashedOwnerName) {\\n return checkHash > ncNameHash && checkHash < nc.nextHashedOwnerName;\\n } else {\\n return checkHash > ncNameHash || checkHash < nc.nextHashedOwnerName;\\n }\\n }\\n lastOffset = offset;\\n }\\n // If we reached the root without finding a match, return false.\\n return false;\\n }\\n\\n function readNSEC3(RRUtils.SignedSet memory ss) private pure returns(RRUtils.NSEC3 memory) {\\n RRUtils.RRIterator memory iter = ss.rrs();\\n return iter.data.readNSEC3(iter.rdataOffset, iter.nextOffset - iter.rdataOffset);\\n }\\n\\n function checkNSEC3Name(RRUtils.NSEC3 memory nsec, bytes memory ownerName, bytes memory deleteName) private view returns(bool) {\\n // Compute the NSEC3 name hash of the name to delete.\\n bytes32 deleteNameHash = hashName(nsec, deleteName);\\n\\n // Decode the NSEC3 name hash from the first label of the NSEC3 owner name.\\n bytes32 nsecNameHash = decodeOwnerNameHash(ownerName);\\n\\n return deleteNameHash == nsecNameHash;\\n }\\n\\n function hashName(RRUtils.NSEC3 memory nsec, bytes memory name) private view returns(bytes32) {\\n return nsec3Digests[nsec.hashAlgorithm].hash(nsec.salt, name, nsec.iterations);\\n }\\n\\n function decodeOwnerNameHash(bytes memory name) private pure returns(bytes32) {\\n return name.base32HexDecodeWord(1, uint(name.readUint8(0)));\\n }\\n\\n function checkNSEC3OwnerName(bytes memory nsecName, bytes memory deleteName) private pure returns(bool) {\\n uint nsecNameOffset = nsecName.readUint8(0) + 1;\\n uint deleteNameOffset = 0;\\n while(deleteNameOffset < deleteName.length) {\\n if(deleteName.equals(deleteNameOffset, nsecName, nsecNameOffset)) {\\n return true;\\n }\\n deleteNameOffset += deleteName.readUint8(deleteNameOffset) + 1;\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Returns data about the RRs (if any) known to this oracle with the provided type and name.\\n * @param dnstype The DNS record type to query.\\n * @param name The name to query, in DNS label-sequence format.\\n * @return inception The unix timestamp (wrapped) at which the signature for this RRSET was created.\\n * @return expiration The unix timestamp (wrapped) at which the signature for this RRSET expires.\\n * @return hash The hash of the RRset.\\n */\\n function rrdata(uint16 dnstype, bytes calldata name) external override view returns (uint32, uint32, bytes20) {\\n RRSet storage result = rrsets[keccak256(name)][dnstype];\\n return (result.inception, result.expiration, result.hash);\\n }\\n\\n function _submitRRSet(RRSetWithSignature memory input, bytes memory proof) internal returns (bytes memory) {\\n RRUtils.SignedSet memory rrset;\\n rrset = validateSignedSet(input, proof);\\n\\n RRSet storage storedSet = rrsets[keccak256(rrset.name)][rrset.typeCovered];\\n if (storedSet.hash != bytes20(0)) {\\n // To replace an existing rrset, the signature must be at least as new\\n require(RRUtils.serialNumberGte(rrset.inception, storedSet.inception));\\n }\\n rrsets[keccak256(rrset.name)][rrset.typeCovered] = RRSet({\\n inception: rrset.inception,\\n expiration: rrset.expiration,\\n hash: bytes20(keccak256(rrset.data))\\n });\\n\\n emit RRSetUpdated(rrset.name, rrset.data);\\n\\n return rrset.data;\\n }\\n\\n /**\\n * @dev Submits a signed set of RRs to the oracle.\\n *\\n * RRSETs are only accepted if they are signed with a key that is already\\n * trusted, or if they are self-signed, and the signing key is identified by\\n * a DS record that is already trusted.\\n *\\n * @param input The signed RR set. This is in the format described in section\\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\\n * data, followed by a series of canonicalised RR records that the signature\\n * applies to.\\n * @param proof The DNSKEY or DS to validate the signature against. Must Already\\n * have been submitted and proved previously.\\n */\\n function validateSignedSet(RRSetWithSignature memory input, bytes memory proof) internal view returns(RRUtils.SignedSet memory rrset) {\\n rrset = input.rrset.readSignedSet();\\n require(validProof(rrset.signerName, proof));\\n\\n // Do some basic checks on the RRs and extract the name\\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\\n require(name.labelCount(0) == rrset.labels);\\n rrset.name = name;\\n\\n // All comparisons involving the Signature Expiration and\\n // Inception fields MUST use \\\"serial number arithmetic\\\", as\\n // defined in RFC 1982\\n\\n // o The validator's notion of the current time MUST be less than or\\n // equal to the time listed in the RRSIG RR's Expiration field.\\n require(RRUtils.serialNumberGte(rrset.expiration, uint32(block.timestamp)));\\n\\n // o The validator's notion of the current time MUST be greater than or\\n // equal to the time listed in the RRSIG RR's Inception field.\\n require(RRUtils.serialNumberGte(uint32(block.timestamp), rrset.inception));\\n\\n // Validate the signature\\n verifySignature(name, rrset, input, proof);\\n\\n return rrset;\\n }\\n\\n function validProof(bytes memory name, bytes memory proof) internal view returns(bool) {\\n uint16 dnstype = proof.readUint16(proof.nameLength(0));\\n return rrsets[keccak256(name)][dnstype].hash == bytes20(keccak256(proof));\\n }\\n\\n /**\\n * @dev Validates a set of RRs.\\n * @param rrset The RR set.\\n * @param typecovered The type covered by the RRSIG record.\\n */\\n function validateRRs(RRUtils.SignedSet memory rrset, uint16 typecovered) internal pure returns (bytes memory name) {\\n // Iterate over all the RRs\\n for (RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\\n // We only support class IN (Internet)\\n require(iter.class == DNSCLASS_IN);\\n\\n if(name.length == 0) {\\n name = iter.name();\\n } else {\\n // Name must be the same on all RRs. We do things this way to avoid copying the name\\n // repeatedly.\\n require(name.length == iter.data.nameLength(iter.offset));\\n require(name.equals(0, iter.data, iter.offset, name.length));\\n }\\n\\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\\n require(iter.dnstype == typecovered);\\n }\\n }\\n\\n /**\\n * @dev Performs signature verification.\\n *\\n * Throws or reverts if unable to verify the record.\\n *\\n * @param name The name of the RRSIG record, in DNS label-sequence format.\\n * @param data The original data to verify.\\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\\n */\\n function verifySignature(bytes memory name, RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, bytes memory proof) internal view {\\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\\n // that contains the RRset.\\n require(rrset.signerName.length <= name.length);\\n require(rrset.signerName.equals(0, name, name.length - rrset.signerName.length));\\n\\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\\n // Check the proof\\n if (proofRR.dnstype == DNSTYPE_DS) {\\n require(verifyWithDS(rrset, data, proofRR));\\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\\n require(verifyWithKnownKey(rrset, data, proofRR));\\n } else {\\n revert(\\\"No valid proof found\\\");\\n }\\n }\\n\\n /**\\n * @dev Attempts to verify a signed RRSET against an already known public key.\\n * @param rrset The signed set to verify.\\n * @param data The original data the signed set was read from.\\n * @param proof The serialized DS or DNSKEY record to use as proof.\\n * @return True if the RRSET could be verified, false otherwise.\\n */\\n function verifyWithKnownKey(RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, RRUtils.RRIterator memory proof) internal view returns(bool) {\\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\\n require(proof.name().equals(rrset.signerName));\\n for(; !proof.done(); proof.next()) {\\n require(proof.name().equals(rrset.signerName));\\n bytes memory keyrdata = proof.rdata();\\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(0, keyrdata.length);\\n if(verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\\n return true;\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Attempts to verify some data using a provided key and a signature.\\n * @param dnskey The dns key record to verify the signature with.\\n * @param rrset The signed RRSET being verified.\\n * @param data The original data `rrset` was decoded from.\\n * @return True iff the key verifies the signature.\\n */\\n function verifySignatureWithKey(RRUtils.DNSKEY memory dnskey, bytes memory keyrdata, RRUtils.SignedSet memory rrset, RRSetWithSignature memory data)\\n internal\\n view\\n returns (bool)\\n {\\n // TODO: Check key isn't expired, unless updating key itself\\n\\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\\n if(dnskey.protocol != 3) {\\n return false;\\n }\\n\\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\\n // the zone's apex DNSKEY RRset.\\n if(dnskey.algorithm != rrset.algorithm) {\\n return false;\\n }\\n uint16 computedkeytag = keyrdata.computeKeytag();\\n if (computedkeytag != rrset.keytag) {\\n return false;\\n }\\n\\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\\n // set.\\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\\n return false;\\n }\\n\\n return algorithms[dnskey.algorithm].verify(keyrdata, data.rrset, data.sig);\\n }\\n\\n /**\\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\\n * that the record \\n * @param rrset The signed set to verify.\\n * @param data The original data the signed set was read from.\\n * @param proof The serialized DS or DNSKEY record to use as proof.\\n * @return True if the RRSET could be verified, false otherwise.\\n */\\n function verifyWithDS(RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, RRUtils.RRIterator memory proof) internal view returns(bool) {\\n for(RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\\n require(iter.dnstype == DNSTYPE_DNSKEY);\\n bytes memory keyrdata = iter.rdata();\\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(0, keyrdata.length);\\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\\n // It's self-signed - look for a DS record to verify it.\\n return verifyKeyWithDS(iter.name(), proof, dnskey, keyrdata);\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Attempts to verify a key using DS records.\\n * @param keyname The DNS name of the key, in DNS label-sequence format.\\n * @param dsrrs The DS records to use in verification.\\n * @param dnskey The dnskey to verify.\\n * @param keyrdata The RDATA section of the key.\\n * @return True if a DS record verifies this key.\\n */\\n function verifyKeyWithDS(bytes memory keyname, RRUtils.RRIterator memory dsrrs, RRUtils.DNSKEY memory dnskey, bytes memory keyrdata)\\n internal view returns (bool)\\n {\\n uint16 keytag = keyrdata.computeKeytag();\\n for (; !dsrrs.done(); dsrrs.next()) {\\n RRUtils.DS memory ds = dsrrs.data.readDS(dsrrs.rdataOffset, dsrrs.nextOffset - dsrrs.rdataOffset);\\n if(ds.keytag != keytag) {\\n continue;\\n }\\n if (ds.algorithm != dnskey.algorithm) {\\n continue;\\n }\\n\\n Buffer.buffer memory buf;\\n buf.init(keyname.length + keyrdata.length);\\n buf.append(keyname);\\n buf.append(keyrdata);\\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\\n return true;\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Attempts to verify a DS record's hash value against some data.\\n * @param digesttype The digest ID from the DS record.\\n * @param data The data to digest.\\n * @param digest The digest data to check against.\\n * @return True iff the digest matches.\\n */\\n function verifyDSHash(uint8 digesttype, bytes memory data, bytes memory digest) internal view returns (bool) {\\n if (address(digests[digesttype]) == address(0)) {\\n return false;\\n }\\n return digests[digesttype].verify(data, digest);\\n }\\n}\\n\",\"keccak256\":\"0x347fdc38971b863831f00f0e5a8e791ace9dda1196da57fbf726a125c9d99a04\"},\"contracts/dnssec-oracle/Owned.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev Contract mixin for 'owned' contracts.\\n*/\\ncontract Owned {\\n address public owner;\\n \\n modifier owner_only() {\\n require(msg.sender == owner);\\n _;\\n }\\n\\n constructor() public {\\n owner = msg.sender;\\n }\\n\\n function setOwner(address newOwner) public owner_only {\\n owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x14ca1cbae3a361b9d868147498af8bdea7e7d5b0829e207fb7719f607cce5ab3\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n* @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n*/\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(bytes memory self, uint offset) internal pure returns(uint) {\\n uint idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(bytes memory self, uint offset) internal pure returns(bytes memory ret) {\\n uint len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(bytes memory self, uint offset) internal pure returns(uint) {\\n uint count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint constant RRSIG_TYPE = 0;\\n uint constant RRSIG_ALGORITHM = 2;\\n uint constant RRSIG_LABELS = 3;\\n uint constant RRSIG_TTL = 4;\\n uint constant RRSIG_EXPIRATION = 8;\\n uint constant RRSIG_INCEPTION = 12;\\n uint constant RRSIG_KEY_TAG = 16;\\n uint constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(bytes memory data) internal pure returns(SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(RRSIG_SIGNER_NAME + self.signerName.length, data.length - RRSIG_SIGNER_NAME - self.signerName.length);\\n }\\n\\n function rrs(SignedSet memory rrset) internal pure returns(RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint rdataOffset;\\n uint nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(bytes memory self, uint offset) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns(bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns(bytes memory) {\\n return iter.data.substring(iter.offset, nameLength(iter.data, iter.offset));\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(RRIterator memory iter) internal pure returns(bytes memory) {\\n return iter.data.substring(iter.rdataOffset, iter.nextOffset - iter.rdataOffset);\\n }\\n\\n uint constant DNSKEY_FLAGS = 0;\\n uint constant DNSKEY_PROTOCOL = 2;\\n uint constant DNSKEY_ALGORITHM = 3;\\n uint constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(bytes memory data, uint offset, uint length) internal pure returns(DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(offset + DNSKEY_PUBKEY, length - DNSKEY_PUBKEY);\\n } \\n\\n uint constant DS_KEY_TAG = 0;\\n uint constant DS_ALGORITHM = 2;\\n uint constant DS_DIGEST_TYPE = 3;\\n uint constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(bytes memory data, uint offset, uint length) internal pure returns(DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n struct NSEC3 {\\n uint8 hashAlgorithm;\\n uint8 flags;\\n uint16 iterations;\\n bytes salt;\\n bytes32 nextHashedOwnerName;\\n bytes typeBitmap;\\n }\\n\\n uint constant NSEC3_HASH_ALGORITHM = 0;\\n uint constant NSEC3_FLAGS = 1;\\n uint constant NSEC3_ITERATIONS = 2;\\n uint constant NSEC3_SALT_LENGTH = 4;\\n uint constant NSEC3_SALT = 5;\\n\\n function readNSEC3(bytes memory data, uint offset, uint length) internal pure returns(NSEC3 memory self) {\\n uint end = offset + length;\\n self.hashAlgorithm = data.readUint8(offset + NSEC3_HASH_ALGORITHM);\\n self.flags = data.readUint8(offset + NSEC3_FLAGS);\\n self.iterations = data.readUint16(offset + NSEC3_ITERATIONS);\\n uint8 saltLength = data.readUint8(offset + NSEC3_SALT_LENGTH);\\n offset = offset + NSEC3_SALT;\\n self.salt = data.substring(offset, saltLength);\\n offset += saltLength;\\n uint8 nextLength = data.readUint8(offset);\\n require(nextLength <= 32);\\n offset += 1;\\n self.nextHashedOwnerName = data.readBytesN(offset, nextLength);\\n offset += nextLength;\\n self.typeBitmap = data.substring(offset, end - offset);\\n }\\n\\n function checkTypeBitmap(NSEC3 memory self, uint16 rrtype) internal pure returns(bool) {\\n return checkTypeBitmap(self.typeBitmap, 0, rrtype);\\n }\\n\\n /**\\n * @dev Checks if a given RR type exists in a type bitmap.\\n * @param bitmap The byte string to read the type bitmap from.\\n * @param offset The offset to start reading at.\\n * @param rrtype The RR type to check for.\\n * @return True if the type is found in the bitmap, false otherwise.\\n */\\n function checkTypeBitmap(bytes memory bitmap, uint offset, uint16 rrtype) internal pure returns (bool) {\\n uint8 typeWindow = uint8(rrtype >> 8);\\n uint8 windowByte = uint8((rrtype & 0xff) / 8);\\n uint8 windowBitmask = uint8(uint8(1) << (uint8(7) - uint8(rrtype & 0x7)));\\n for (uint off = offset; off < bitmap.length;) {\\n uint8 window = bitmap.readUint8(off);\\n uint8 len = bitmap.readUint8(off + 1);\\n if (typeWindow < window) {\\n // We've gone past our window; it's not here.\\n return false;\\n } else if (typeWindow == window) {\\n // Check this type bitmap\\n if (len <= windowByte) {\\n // Our type is past the end of the bitmap\\n return false;\\n }\\n return (bitmap.readUint8(off + windowByte + 2) & windowBitmask) != 0;\\n } else {\\n // Skip this type bitmap\\n off += len + 2;\\n }\\n }\\n\\n return false;\\n }\\n\\n function compareNames(bytes memory self, bytes memory other) internal pure returns (int) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint off;\\n uint otheroff;\\n uint prevoff;\\n uint otherprevoff;\\n uint counts = labelCount(self, 0);\\n uint othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if(otheroff == 0) {\\n return 1;\\n }\\n\\n return self.compare(prevoff + 1, self.readUint8(prevoff), other, otherprevoff + 1, other.readUint8(otherprevoff));\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(uint32 i1, uint32 i2) internal pure returns(bool) {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n\\n function progress(bytes memory body, uint off) internal pure returns(uint) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint ac1;\\n uint ac2;\\n for(uint i = 0; i < data.length + 31; i += 32) {\\n uint word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if(i + 32 > data.length) {\\n uint unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 += (word & 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >> 8;\\n ac2 += (word & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 = (ac1 & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF)\\n + ((ac1 & 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >> 16);\\n ac2 = (ac2 & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF)\\n + ((ac2 & 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >> 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 = (ac1 & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF)\\n + ((ac1 & 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >> 32);\\n ac1 = (ac1 & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF)\\n + ((ac1 & 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >> 64);\\n ac1 = (ac1 & 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\\n + (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\",\"keccak256\":\"0x811642c86c539d645ef99a15fa1bf0eb4ce963cf1a618ef2a6f34d27a5e34030\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n*/\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external virtual view returns (bool);\\n}\\n\",\"keccak256\":\"0x51d6251568844e435f58952354abe8c8c8e978ab40ecb0bbb2f5bd767838b3a7\"},\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev An interface for contracts implementing a DNSSEC digest.\\n*/\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(bytes calldata data, bytes calldata hash) external virtual pure returns (bool);\\n}\\n\",\"keccak256\":\"0x259720cef78c019d38b908bc7dd524f087c58d8c40792cebcdd4e982c628bc9a\"},\"contracts/dnssec-oracle/nsec3digests/NSEC3Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev Interface for contracts that implement NSEC3 digest algorithms.\\n */\\ninterface NSEC3Digest {\\n /**\\n * @dev Performs an NSEC3 iterated hash.\\n * @param salt The salt value to use on each iteration.\\n * @param data The data to hash.\\n * @param iterations The number of iterations to perform.\\n * @return The result of the iterated hash operation.\\n */\\n function hash(bytes calldata salt, bytes calldata data, uint iterations) external virtual pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0xb3b61aee6bb472158b7ace6b5644dcb668271296b98a6dcde24dc72e3cdf4950\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b5060405162003a4c38038062003a4c833981016040819052620000349162000226565b600180546001600160a01b0319163317905580516200005b90600090602084019062000180565b5060408051606081018252600080825263e090bba0602083015282519192830191620000889190620002fc565b60408051918290039091206001600160601b031916909152602b60009081527fc92a43746f20f69898978a3075767b860ba247ac0639d1831bf8c942c5db2389602090815283517f95c6356c1b7a542b884d2484ef785c9c7224e77e1016c20007bddc15c23b452f8054928601519585015160601c6801000000000000000002600160401b600160e01b031963ffffffff978816640100000000026001600160401b03199095169790931696909617929092171693909317909255517f55ced933cdd5a34dd03eb5d4bef19ec6ebb251dcd7a988eee0c1b9a13baaa88b91620001719162000373565b60405180910390a15062000463565b8280546200018e9062000410565b90600052602060002090601f016020900481019282620001b25760008555620001fd565b82601f10620001cd57805160ff1916838001178555620001fd565b82800160010185558215620001fd579182015b82811115620001fd578251825591602001919060010190620001e0565b506200020b9291506200020f565b5090565b5b808211156200020b576000815560010162000210565b6000602080838503121562000239578182fd5b82516001600160401b038082111562000250578384fd5b818501915085601f83011262000264578384fd5b8151818111156200027957620002796200044d565b604051601f8201601f19908116603f01168101908382118183101715620002a457620002a46200044d565b816040528281528886848701011115620002bc578687fd5b8693505b82841015620002df5784840186015181850187015292850192620002c0565b82841115620002f057868684830101525b98975050505050505050565b60008083546200030c8162000410565b60018281168015620003275760018114620003395762000367565b60ff1984168752828701945062000367565b8786526020808720875b858110156200035e5781548a82015290840190820162000343565b50505082870194505b50929695505050505050565b604081526000600180604084015281606084015260206080818501528285546200039d8162000410565b80608088015260a085831660008114620003c05760018114620003d55762000402565b60ff1984168983015260c08901945062000402565b898852858820885b84811015620003fa5781548b8201850152908801908701620003dd565b8a0183019550505b509298975050505050505050565b600181811c908216806200042557607f821691505b602082108114156200044757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6135d980620004736000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c806373cc48a61161008c57806398d35f201161006657806398d35f201461025b578063bd7ed31a14610263578063c327deef14610299578063d7b82ebe146102cf57600080fd5b806373cc48a6146101cd5780638438dc04146102285780638da5cb5b1461023b57600080fd5b806313af4035116100c857806313af40351461017457806328e7677d146101875780632c095cbb1461019a578063435cc162146101ad57600080fd5b8063020ed8d3146100ef578063087991bc146101045780630b1a249514610161575b600080fd5b6101026100fd366004612ff3565b6102e2565b005b610117610112366004612e47565b610396565b6040805163ffffffff94851681529390921660208401527fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016908201526060015b60405180910390f35b61010261016f366004612f20565b61040b565b610102610182366004612ca9565b6105fa565b610102610195366004612ff3565b610665565b6101026101a8366004612e8b565b610711565b6101c06101bb366004612cc5565b61084f565b60405161015891906130a2565b6102036101db366004612fd9565b60046020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610158565b610102610236366004612ff3565b6108fe565b6001546102039073ffffffffffffffffffffffffffffffffffffffff1681565b6101c06109aa565b610203610271366004612fd9565b60056020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b6102036102a7366004612fd9565b60036020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b6101c06102dd366004612de6565b610a38565b60015473ffffffffffffffffffffffffffffffffffffffff16331461030657600080fd5b60ff821660008181526003602090815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff86169081179091558251938452908301527ff73c3c226af96b7f1ba666a21b3ceaf2be3ee6a365e3178fd9cd1eaae0075aa891015b60405180910390a15050565b6000806000806002600087876040516103b0929190613092565b60408051918290039091208252602080830193909352908101600090812061ffff8b16825290925290205463ffffffff8082169550640100000000820416935068010000000000000000900460601b91505093509350939050565b8351602080860191909120600090815260028252604080822061ffff891683529092529081205463ffffffff16906104438584610a4d565b9050610450818784610b3e565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c082019290925260e081018290526101008101829052610120810191909152845151156104c2576104b58585610a4d565b90506104c2818885610b3e565b60006104cd83610b84565b602081015190915060fe16156104e257600080fd5b6104ed816027610be3565b1580156105125750610500816002610be3565b15806105125750610512816006610be3565b61051b57600080fd5b61052c898985610120015184610bf5565b156105805787516020808a0191909120600090815260028252604080822061ffff8d1683529092522080547fffffffff000000000000000000000000000000000000000000000000000000001690556105ef565b61059f888461012001518385610120015161059a87610b84565b610c25565b156100ea5787516020808a0191909120600090815260028252604080822061ffff8d1683529092522080547fffffffff000000000000000000000000000000000000000000000000000000001690555b505050505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff16331461061e57600080fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60015473ffffffffffffffffffffffffffffffffffffffff16331461068957600080fd5b60ff821660008181526004602090815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff86169081179091558251938452908301527f2fcc274c3b72dd483ab201bfa87295e3817e8b9b10693219873b722ca1af00c7910161038a565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c082019290925260e08101829052610100810182905261012081019190915261076e8383610a4d565b805190915061ffff16602f1461078357600080fd5b60a08101518451602080870191909120600090815260028252604080822061ffff8a16835290925220546107bd919063ffffffff16610d41565b6107c657600080fd5b60006107d182610d5a565b905080515160208201511015610843576107f2818361012001518789610db8565b50508251602080850191909120600090815260028252604080822061ffff881683529092522080547fffffffff00000000000000000000000000000000000000000000000000000000169055610849565b50600080fd5b50505050565b6060600083838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509394505050505b85518110156108f3576108df8682815181106108d1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015183610f63565b9150806108eb8161347b565b91505061088c565b5090505b9392505050565b60015473ffffffffffffffffffffffffffffffffffffffff16331461092257600080fd5b60ff821660008181526005602090815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff86169081179091558251938452908301527fc7eec866a7a1386188cc3ca20ffea75b71bd3e90a60b6791b1d3f0971145118d910161038a565b600080546109b79061342d565b80601f01602080910402602001604051908101604052809291908181526020018280546109e39061342d565b8015610a305780601f10610a0557610100808354040283529160200191610a30565b820191906000526020600020905b815481529060010190602001808311610a1357829003601f168201915b505050505081565b6060610a448383610f63565b90505b92915050565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c082019290925260e0810182905261010081018290526101208101919091528251610aab9061118b565b9050610abb8160e00151836112cd565b610ac457600080fd5b6000610ad4828360000151611352565b604083015190915060ff16610aea8260006113fd565b14610af457600080fd5b61012082018190526080820151610b0b9042610d41565b610b1457600080fd5b610b22428360a00151610d41565b610b2b57600080fd5b610b378183868661147e565b5092915050565b610b4c8360a0015182610d41565b610b5557600080fd5b825161ffff16603214610b6757600080fd5b610b7683610120015183611582565b610b7f57600080fd5b505050565b6040805160c08101825260008082526020820181905291810182905260608082018190526080820183905260a082015290610bbe83610d5a565b60a081015160c08201519192506108f791610bda9082906133dc565b835191906115f0565b6000610a448360a00151600084611737565b6000610c0282848661184d565b15610c1957610c118286610be3565b159050610c1d565b5060005b949350505050565b602081015160009060fe1615610c3a57600080fd5b6000610c4586611874565b90506000610c5285611874565b9050600080610c618a82611890565b610c6c9060016131b4565b60ff1690505b8951811015610d2f5783610c9e89610c9984858f51610c9191906133dc565b8f91906118db565b611984565b1415610d03576000610cbb87610c9985868f51610c9191906133dc565b90508660800151841015610ce7578381118015610cdb5750866080015181105b95505050505050610d38565b83811180610cdb57508660800151811095505050505050610d38565b905080610d108a82611890565b610d1b9060016131b4565b610d289060ff168261319c565b9050610c72565b50600093505050505b95945050505050565b600080610d4e8385613378565b60030b12159392505050565b610da86040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b610a478261010001516000611a45565b60a08401518451600090610dcc9083611aa6565b905060008660a001518760c00151610de491906133dc565b9050818111610df257600080fd5b6000610dfe8688611b24565b905080610e2a57610e1b610e12848661319c565b89519087611737565b15610e2557600080fd5b610e71565b8751600090610e3a9086866118db565b905060008213610e4957600080fd5b6000610e558983611b24565b12156105ef576000610e678883611b24565b126105ef57600080fd5b5050505050505050565b60c08101516020820181905281515111610e925750565b6000610ea682600001518360200151611aa6565b8260200151610eb5919061319c565b8251909150610ec49082611c77565b61ffff166040830152610ed860028261319c565b8251909150610ee79082611c77565b61ffff166060830152610efb60028261319c565b8251909150610f0a9082611c9f565b63ffffffff166080830152610f2060048261319c565b8251909150600090610f329083611c77565b61ffff169050610f4360028361319c565b60a084018190529150610f56818361319c565b60c0909301929092525050565b604080516101408101825260008082526020820181905291810182905260608181018390526080820183905260a0820183905260c082019290925260e0810182905261010081018290526101208101829052610fbf8484610a4d565b61012081015180516020918201206000908152600282526040808220845161ffff1683529092522080549192509068010000000000000000900460601b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016156110435760a0820151815461103a919063ffffffff16610d41565b61104357600080fd5b604080516060808201835260a085015163ffffffff9081168352608086015181166020808501918252610100880180518051908301207fffffffffffffffffffffffffffffffffffffffff000000000000000000000000168688019081526101208a0180518051908501206000908152600285528981208c5161ffff16825290945292889020965187549451915190961c68010000000000000000027fffffffff0000000000000000000000000000000000000000ffffffffffffffff918616640100000000027fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000909516969095169590951792909217939093169190911790925551905191517f55ced933cdd5a34dd03eb5d4bef19ec6ebb251dcd7a988eee0c1b9a13baaa88b9261117692916130b5565b60405180910390a15061010001519392505050565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e082018190526101008201819052610120820152906111e6908390611c77565b61ffff1681526111f7826002611890565b60ff16602082015261120a826003611890565b60ff16604082015261121d826004611c9f565b63ffffffff9081166060830152611239908390600890611c9f16565b63ffffffff9081166080830152611255908390600c90611c9f16565b63ffffffff90811660a0830152611271908390601090611c7716565b61ffff1660c0820152611285826012611cc9565b60e08201819052516112c29061129c90601261319c565b8260e0015151601285516112b091906133dc565b6112ba91906133dc565b8491906118db565b610100820152919050565b6000806112e46112dd8483611aa6565b8490611c77565b8351602080860191909120865187830120600090815260028352604080822061ffff9095168252939092529190205468010000000000000000900460601b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090811691161491505092915050565b6060600061135f84610d5a565b90505b80515160208201511015610b3757606081015161ffff1660011461138557600080fd5b815161139b5761139481611ce4565b91506113d7565b602081015181516113ab91611aa6565b8251146113b757600080fd5b8051602082015183516113ce928592600092611d05565b6113d757600080fd5b8261ffff16816040015161ffff16146113ef57600080fd5b6113f881610e7b565b611362565b6000805b83518310611438577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b60006114448585611890565b60ff16905061145481600161319c565b61145e908561319c565b93508061146b5750610a44565b61147660018361319c565b915050611401565b83518360e0015151111561149157600080fd5b6114b66000858560e001515187516114a991906133dc565b60e0870151929190611d28565b6114bf57600080fd5b60006114cb8282611a45565b604081015190915061ffff16602b14156114f8576114ea848483611d5d565b6114f357600080fd5b61157b565b604081015161ffff1660301415611514576114ea848483611df6565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4e6f2076616c69642070726f6f6620666f756e6400000000000000000000000060448201526064015b60405180910390fd5b5050505050565b60008061158f8482611890565b61159a9060016131b4565b60ff16905060005b8351811015610c19576115b784828785611d28565b156115c757600192505050610a47565b6115d18482611890565b6115dc9060016131b4565b6115e99060ff168261319c565b90506115a2565b6040805160c08101825260008082526020820181905291810182905260608082018190526080820183905260a08201529061162b838561319c565b905061164261163b60008661319c565b8690611890565b60ff16825261165561163b60018661319c565b60ff16602083015261167261166b60028661319c565b8690611c77565b61ffff166040830152600061169261168b60048761319c565b8790611890565b905061169f60058661319c565b94506116af868660ff84166118db565b60608401526116c160ff82168661319c565b945060006116cf8787611890565b905060208160ff1611156116e257600080fd5b6116ed60018761319c565b95506116fd878760ff8416611e9e565b608085015261170f60ff82168761319c565b95506117278661171f81866133dc565b8991906118db565b60a0850152509195945050505050565b600060ff600883811c82169183916117509186166131d9565b905060006117626007808716906133f3565b600160ff919091161b9050855b875181101561183f5760006117848983611890565b9050600061179d61179684600161319c565b8b90611890565b90508160ff168660ff1610156117bc57600096505050505050506108f7565b8160ff168660ff16141561181e578460ff168160ff16116117e657600096505050505050506108f7565b836118096117f760ff88168661319c565b61180290600261319c565b8c90611890565b1660ff166000141596505050505050506108f7565b6118298160026131b4565b6118369060ff168461319c565b9250505061176f565b506000979650505050505050565b60008061185a8584611984565b9050600061186785611874565b9190911495945050505050565b6000610a4760016118858484611890565b84919060ff16611edf565b60008282815181106118cb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b016020015160f81c905092915050565b82516060906118ea838561319c565b11156118f557600080fd5b60008267ffffffffffffffff811115611937577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611961576020820181803683370190505b509050602080820190868601016119798282876121af565b509095945050505050565b815160ff166000908152600560205260408082205460608501518286015192517f68f9dab200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909216926368f9dab2926119f592918791600401613113565b60206040518083038186803b158015611a0d57600080fd5b505afa158015611a21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a449190612dce565b611a936040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c08101829052610a4781610e7b565b6000815b83518110611ae1577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000611aed8583611890565b60ff169050611afd81600161319c565b611b07908361319c565b915080611b145750611b1a565b50611aaa565b610c1d83826133dc565b6000611b308383612205565b15611b3d57506000610a47565b6000806000806000611b508860006113fd565b90506000611b5f8860006113fd565b90505b80821115611b8b57859350611b778987612223565b955081611b8381613416565b925050611b62565b81811115611bb457849250611ba08886612223565b945080611bac81613416565b915050611b8b565b600082118015611bcd5750611bcb89878a88611d28565b155b15611c0257859350611bdf8987612223565b9550849250611bee8886612223565b9450611bfb6001836133dc565b9150611bb4565b85611c17576000199650505050505050610a47565b84611c2b5760019650505050505050610a47565b611c6a611c3985600161319c565b611c438b87611890565b60ff168a611c5287600161319c565b611c5c8d89611890565b8e949392919060ff16612247565b9998505050505050505050565b8151600090611c8783600261319c565b1115611c9257600080fd5b50016002015161ffff1690565b8151600090611caf83600461319c565b1115611cba57600080fd5b50016004015163ffffffff1690565b60606000611cd78484611aa6565b9050610c1d8484836118db565b60208101518151606091610a4791611cfc9082611aa6565b845191906118db565b6000611d1284848461233c565b611d1d87878561233c565b149695505050505050565b6000611d418383848651611d3c91906133dc565b61233c565b611d538686878951611d3c91906133dc565b1495945050505050565b600080611d6985610d5a565b90505b80515160208201511015610c1957604081015161ffff16603014611d8f57600080fd5b6000611d9a82612360565b90506000611db5600083518461237c9092919063ffffffff16565b9050611dc38183898961241a565b15611de657611ddc611dd484611ce4565b868385612551565b93505050506108f7565b5050611df181610e7b565b611d6c565b6000611e0f8460e00151611e0984611ce4565b90612205565b611e1857600080fd5b81515160208301511015611e9457611e378460e00151611e0984611ce4565b611e4057600080fd5b6000611e4b83612360565b90506000611e66600083518461237c9092919063ffffffff16565b9050611e748183888861241a565b15611e84576001925050506108f7565b5050611e8f82610e7b565b611e18565b5060009392505050565b60006020821115611eae57600080fd5b8351611eba838561319c565b1115611ec557600080fd5b506020919092018101519190036101000a60001901191690565b60006034821115611eef57600080fd5b600080805b8481101561209257600087611f09838961319c565b81518110611f40577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff000000000000000000000000000000000000000000000000000000000000001690507f30000000000000000000000000000000000000000000000000000000000000008110801590611fdb57507f7a000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821611155b611fe457600080fd5b60405180608001604052806047815260200161355d6047913961200c603060f884901c6133dc565b81518110612043577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b0160209081015160f81c935083111561205b57600080fd5b6120666001876133dc565b8214156120735750612092565b5060059290921b60ff821617918061208a8161347b565b915050611ef4565b5060006120a08560056132e5565b90506120ad600886613496565b6120c2578160ff16600584901b179250612195565b6120cd600886613496565b600214156120fc5760028260ff16901c60ff16600384901b1792506002816120f591906133dc565b9050612195565b612107600886613496565b6004141561212f5760048260ff16901c60ff16600184901b1792506004816120f591906133dc565b61213a600886613496565b600514156121625760018260ff16901c60ff16600484901b1792506001816120f591906133dc565b61216d600886613496565b600714156100ea5760038260ff16901c60ff16600284901b1792506003816120f591906133dc565b6121a1816101006133dc565b9290921b9695505050505050565b602081106121e757815183526121c660208461319c565b92506121d360208361319c565b91506121e06020826133dc565b90506121af565b905182516020929092036101000a6000190180199091169116179052565b600081518351148015610a445750610a448360008460008751611d05565b600061222f8383611890565b60ff1661223d83600161319c565b610a44919061319c565b600084808310156122555750815b60208789018101908587010160005b8381101561232157825182518082146122f1576000602087111561228b57506000196122c7565b6001846122998960206133dc565b6122a3919061319c565b6122ae9060086132e5565b6122b990600261323d565b6122c391906133dc565b1990505b60006122d7838316858416613304565b905080156122ee5797506123329650505050505050565b50505b6122fc60208661319c565b945061230960208561319c565b9350505060208161231a919061319c565b9050612264565b5061232c8589613304565b93505050505b9695505050505050565b825160009061234b838561319c565b111561235657600080fd5b5091016020012090565b60a081015160c0820151606091610a4791611cfc9082906133dc565b60408051608081018252600080825260208201819052918101919091526060808201526123b46123ad60008561319c565b8590611c77565b61ffff1681526123cf6123c860028561319c565b8590611890565b60ff1660208201526123e56123c860038561319c565b60ff16604082015261240e6123fb60048561319c565b6124066004856133dc565b8691906118db565b60608201529392505050565b6000846020015160ff1660031461243357506000610c1d565b826020015160ff16856040015160ff161461245057506000610c1d565b600061245b85612652565b90508360c0015161ffff168161ffff161461247a576000915050610c1d565b85516101001661248e576000915050610c1d565b60408087015160ff16600090815260036020908152908290205485519186015192517fde8f50a100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169263de8f50a192612501928a92906004016130da565b60206040518083038186803b15801561251957600080fd5b505afa15801561252d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123329190612dae565b60008061255d83612652565b90505b845151602086015110156126465760a085015160c08601516000916125939161258a9082906133dc565b8851919061237c565b90508161ffff16816000015161ffff16146125ae5750612638565b846040015160ff16816020015160ff16146125c95750612638565b6040805180820190915260608152600060208201526125f6855189516125ef919061319c565b8290612896565b5061260181896128fb565b5061260c81866128fb565b50612624826040015182600001518460600151612922565b156126355760019350505050610c1d565b50505b61264185610e7b565b612560565b50600095945050505050565b6000612000825111156126c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4c6f6e67206b657973206e6f74207065726d69747465640000000000000000006044820152606401611572565b60008060005b8451601f0181101561273657600081602087010151905085518260200111156126fc5785518290036008026101000390811c901b5b7eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff600882901c811694909401931691909101906020016126c7565b506010827fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff000016901c827dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff160191506010817fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff000016901c817dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff1601905080600883901b0191506020827fffffffff00000000ffffffff00000000ffffffff00000000ffffffff0000000016901c827bffffffff00000000ffffffff00000000ffffffff00000000ffffffff160191506040827fffffffffffffffff0000000000000000ffffffffffffffff000000000000000016901c8277ffffffffffffffff0000000000000000ffffffffffffffff16019150608082901c826fffffffffffffffffffffffffffffffff16019150601082901c61ffff16820191508192505050919050565b6040805180820190915260608152600060208201526128b6602083613496565b156128de576128c6602083613496565b6128d19060206133dc565b6128db908361319c565b91505b506020828101829052604080518085526000815290920101905290565b604080518082019091526060815260006020820152610a4483846000015151848551612a10565b60ff831660009081526004602052604081205473ffffffffffffffffffffffffffffffffffffffff16612957575060006108f7565b60ff84166000908152600460208190526040918290205491517ff7e83aee00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9092169163f7e83aee916129c09187918791016130b5565b60206040518083038186803b1580156129d857600080fd5b505afa1580156129ec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1d9190612dae565b6040805180820190915260608152600060208201528251821115612a3357600080fd5b6020850151612a42838661319c565b1115612a7557612a7585612a6587602001518786612a60919061319c565b612afa565b612a709060026132e5565b612b11565b600080865180518760208301019350808887011115612a945787860182525b505050602084015b60208410612ad45780518252612ab360208361319c565b9150612ac060208261319c565b9050612acd6020856133dc565b9350612a9c565b51815160001960208690036101000a019081169019919091161790525083949350505050565b600081831115612b0b575081610a47565b50919050565b8151612b1d8383612896565b5061084983826128fb565b60008083601f840112612b39578182fd5b50813567ffffffffffffffff811115612b50578182fd5b602083019150836020828501011115612b6857600080fd5b9250929050565b600082601f830112612b7f578081fd5b813567ffffffffffffffff811115612b9957612b99613508565b612bca60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160161314d565b818152846020838601011115612bde578283fd5b816020850160208301379081016020019190915292915050565b600060408284031215612c09578081fd5b6040516040810167ffffffffffffffff8282108183111715612c2d57612c2d613508565b816040528293508435915080821115612c4557600080fd5b612c5186838701612b6f565b83526020850135915080821115612c6757600080fd5b50612c7485828601612b6f565b6020830152505092915050565b803561ffff81168114612c9357600080fd5b919050565b803560ff81168114612c9357600080fd5b600060208284031215612cba578081fd5b8135610a4481613537565b600080600060408486031215612cd9578182fd5b833567ffffffffffffffff80821115612cf0578384fd5b818601915086601f830112612d03578384fd5b8135602082821115612d1757612d17613508565b8160051b612d2682820161314d565b8381528281019086840183880185018d1015612d4057898afd5b8993505b85841015612d7d57803587811115612d5a578a8bfd5b612d688e87838c0101612bf8565b84525060019390930192918401918401612d44565b509850505087013592505080821115612d94578384fd5b50612da186828701612b28565b9497909650939450505050565b600060208284031215612dbf578081fd5b81518015158114610a44578182fd5b600060208284031215612ddf578081fd5b5051919050565b60008060408385031215612df8578182fd5b823567ffffffffffffffff80821115612e0f578384fd5b612e1b86838701612bf8565b93506020850135915080821115612e30578283fd5b50612e3d85828601612b6f565b9150509250929050565b600080600060408486031215612e5b578283fd5b612e6484612c81565b9250602084013567ffffffffffffffff811115612e7f578283fd5b612da186828701612b28565b60008060008060808587031215612ea0578081fd5b612ea985612c81565b9350602085013567ffffffffffffffff80821115612ec5578283fd5b612ed188838901612b6f565b94506040870135915080821115612ee6578283fd5b612ef288838901612bf8565b93506060870135915080821115612f07578283fd5b50612f1487828801612b6f565b91505092959194509250565b600080600080600060a08688031215612f37578081fd5b612f4086612c81565b9450602086013567ffffffffffffffff80821115612f5c578283fd5b612f6889838a01612b6f565b95506040880135915080821115612f7d578283fd5b612f8989838a01612bf8565b94506060880135915080821115612f9e578283fd5b612faa89838a01612bf8565b93506080880135915080821115612fbf578283fd5b50612fcc88828901612b6f565b9150509295509295909350565b600060208284031215612fea578081fd5b610a4482612c98565b60008060408385031215613005578182fd5b61300e83612c98565b9150602083013561301e81613537565b809150509250929050565b60008151808452815b8181101561304e57602081850181015186830182015201613032565b8181111561305f5782602083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b8183823760009101908152919050565b602081526000610a446020830184613029565b6040815260006130c86040830185613029565b8281036020840152610d388185613029565b6060815260006130ed6060830186613029565b82810360208401526130ff8186613029565b905082810360408401526123328185613029565b6060815260006131266060830186613029565b82810360208401526131388186613029565b91505061ffff83166040830152949350505050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561319457613194613508565b604052919050565b600082198211156131af576131af6134aa565b500190565b600060ff821660ff84168060ff038211156131d1576131d16134aa565b019392505050565b600061ffff808416806131ee576131ee6134d9565b92169190910492915050565b600181815b8085111561323557816000190482111561321b5761321b6134aa565b8085161561322857918102915b93841c93908002906131ff565b509250929050565b6000610a44838360008261325357506001610a47565b8161326057506000610a47565b816001811461327657600281146132805761329c565b6001915050610a47565b60ff841115613291576132916134aa565b50506001821b610a47565b5060208310610133831016604e8410600b84101617156132bf575081810a610a47565b6132c983836131fa565b80600019048211156132dd576132dd6134aa565b029392505050565b60008160001904831182151516156132ff576132ff6134aa565b500290565b6000808312837f80000000000000000000000000000000000000000000000000000000000000000183128115161561333e5761333e6134aa565b837f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018313811615613372576133726134aa565b50500390565b60008160030b8360030b828112817fffffffffffffffffffffffffffffffffffffffffffffffffffffffff80000000018312811516156133ba576133ba6134aa565b81637fffffff0183138116156133d2576133d26134aa565b5090039392505050565b6000828210156133ee576133ee6134aa565b500390565b600060ff821660ff84168082101561340d5761340d6134aa565b90039392505050565b600081613425576134256134aa565b506000190190565b600181811c9082168061344157607f821691505b60208210811415612b0b577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060001982141561348f5761348f6134aa565b5060010190565b6000826134a5576134a56134d9565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461355957600080fd5b5056fe00010203040506070809ffffffffffffff0a0b0c0d0e0f101112131415161718191a1b1c1d1e1fffffffffffffffffffff0a0b0c0d0e0f101112131415161718191a1b1c1d1e1fa264697066735822122021dd1abc05c3cbc1d56c91af7ce4f1050efc7b81ed60cdbe68e35a4dc1df0bb364736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806373cc48a61161008c57806398d35f201161006657806398d35f201461025b578063bd7ed31a14610263578063c327deef14610299578063d7b82ebe146102cf57600080fd5b806373cc48a6146101cd5780638438dc04146102285780638da5cb5b1461023b57600080fd5b806313af4035116100c857806313af40351461017457806328e7677d146101875780632c095cbb1461019a578063435cc162146101ad57600080fd5b8063020ed8d3146100ef578063087991bc146101045780630b1a249514610161575b600080fd5b6101026100fd366004612ff3565b6102e2565b005b610117610112366004612e47565b610396565b6040805163ffffffff94851681529390921660208401527fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016908201526060015b60405180910390f35b61010261016f366004612f20565b61040b565b610102610182366004612ca9565b6105fa565b610102610195366004612ff3565b610665565b6101026101a8366004612e8b565b610711565b6101c06101bb366004612cc5565b61084f565b60405161015891906130a2565b6102036101db366004612fd9565b60046020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610158565b610102610236366004612ff3565b6108fe565b6001546102039073ffffffffffffffffffffffffffffffffffffffff1681565b6101c06109aa565b610203610271366004612fd9565b60056020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b6102036102a7366004612fd9565b60036020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b6101c06102dd366004612de6565b610a38565b60015473ffffffffffffffffffffffffffffffffffffffff16331461030657600080fd5b60ff821660008181526003602090815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff86169081179091558251938452908301527ff73c3c226af96b7f1ba666a21b3ceaf2be3ee6a365e3178fd9cd1eaae0075aa891015b60405180910390a15050565b6000806000806002600087876040516103b0929190613092565b60408051918290039091208252602080830193909352908101600090812061ffff8b16825290925290205463ffffffff8082169550640100000000820416935068010000000000000000900460601b91505093509350939050565b8351602080860191909120600090815260028252604080822061ffff891683529092529081205463ffffffff16906104438584610a4d565b9050610450818784610b3e565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c082019290925260e081018290526101008101829052610120810191909152845151156104c2576104b58585610a4d565b90506104c2818885610b3e565b60006104cd83610b84565b602081015190915060fe16156104e257600080fd5b6104ed816027610be3565b1580156105125750610500816002610be3565b15806105125750610512816006610be3565b61051b57600080fd5b61052c898985610120015184610bf5565b156105805787516020808a0191909120600090815260028252604080822061ffff8d1683529092522080547fffffffff000000000000000000000000000000000000000000000000000000001690556105ef565b61059f888461012001518385610120015161059a87610b84565b610c25565b156100ea5787516020808a0191909120600090815260028252604080822061ffff8d1683529092522080547fffffffff000000000000000000000000000000000000000000000000000000001690555b505050505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff16331461061e57600080fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60015473ffffffffffffffffffffffffffffffffffffffff16331461068957600080fd5b60ff821660008181526004602090815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff86169081179091558251938452908301527f2fcc274c3b72dd483ab201bfa87295e3817e8b9b10693219873b722ca1af00c7910161038a565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c082019290925260e08101829052610100810182905261012081019190915261076e8383610a4d565b805190915061ffff16602f1461078357600080fd5b60a08101518451602080870191909120600090815260028252604080822061ffff8a16835290925220546107bd919063ffffffff16610d41565b6107c657600080fd5b60006107d182610d5a565b905080515160208201511015610843576107f2818361012001518789610db8565b50508251602080850191909120600090815260028252604080822061ffff881683529092522080547fffffffff00000000000000000000000000000000000000000000000000000000169055610849565b50600080fd5b50505050565b6060600083838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509394505050505b85518110156108f3576108df8682815181106108d1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015183610f63565b9150806108eb8161347b565b91505061088c565b5090505b9392505050565b60015473ffffffffffffffffffffffffffffffffffffffff16331461092257600080fd5b60ff821660008181526005602090815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff86169081179091558251938452908301527fc7eec866a7a1386188cc3ca20ffea75b71bd3e90a60b6791b1d3f0971145118d910161038a565b600080546109b79061342d565b80601f01602080910402602001604051908101604052809291908181526020018280546109e39061342d565b8015610a305780601f10610a0557610100808354040283529160200191610a30565b820191906000526020600020905b815481529060010190602001808311610a1357829003601f168201915b505050505081565b6060610a448383610f63565b90505b92915050565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c082019290925260e0810182905261010081018290526101208101919091528251610aab9061118b565b9050610abb8160e00151836112cd565b610ac457600080fd5b6000610ad4828360000151611352565b604083015190915060ff16610aea8260006113fd565b14610af457600080fd5b61012082018190526080820151610b0b9042610d41565b610b1457600080fd5b610b22428360a00151610d41565b610b2b57600080fd5b610b378183868661147e565b5092915050565b610b4c8360a0015182610d41565b610b5557600080fd5b825161ffff16603214610b6757600080fd5b610b7683610120015183611582565b610b7f57600080fd5b505050565b6040805160c08101825260008082526020820181905291810182905260608082018190526080820183905260a082015290610bbe83610d5a565b60a081015160c08201519192506108f791610bda9082906133dc565b835191906115f0565b6000610a448360a00151600084611737565b6000610c0282848661184d565b15610c1957610c118286610be3565b159050610c1d565b5060005b949350505050565b602081015160009060fe1615610c3a57600080fd5b6000610c4586611874565b90506000610c5285611874565b9050600080610c618a82611890565b610c6c9060016131b4565b60ff1690505b8951811015610d2f5783610c9e89610c9984858f51610c9191906133dc565b8f91906118db565b611984565b1415610d03576000610cbb87610c9985868f51610c9191906133dc565b90508660800151841015610ce7578381118015610cdb5750866080015181105b95505050505050610d38565b83811180610cdb57508660800151811095505050505050610d38565b905080610d108a82611890565b610d1b9060016131b4565b610d289060ff168261319c565b9050610c72565b50600093505050505b95945050505050565b600080610d4e8385613378565b60030b12159392505050565b610da86040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b610a478261010001516000611a45565b60a08401518451600090610dcc9083611aa6565b905060008660a001518760c00151610de491906133dc565b9050818111610df257600080fd5b6000610dfe8688611b24565b905080610e2a57610e1b610e12848661319c565b89519087611737565b15610e2557600080fd5b610e71565b8751600090610e3a9086866118db565b905060008213610e4957600080fd5b6000610e558983611b24565b12156105ef576000610e678883611b24565b126105ef57600080fd5b5050505050505050565b60c08101516020820181905281515111610e925750565b6000610ea682600001518360200151611aa6565b8260200151610eb5919061319c565b8251909150610ec49082611c77565b61ffff166040830152610ed860028261319c565b8251909150610ee79082611c77565b61ffff166060830152610efb60028261319c565b8251909150610f0a9082611c9f565b63ffffffff166080830152610f2060048261319c565b8251909150600090610f329083611c77565b61ffff169050610f4360028361319c565b60a084018190529150610f56818361319c565b60c0909301929092525050565b604080516101408101825260008082526020820181905291810182905260608181018390526080820183905260a0820183905260c082019290925260e0810182905261010081018290526101208101829052610fbf8484610a4d565b61012081015180516020918201206000908152600282526040808220845161ffff1683529092522080549192509068010000000000000000900460601b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016156110435760a0820151815461103a919063ffffffff16610d41565b61104357600080fd5b604080516060808201835260a085015163ffffffff9081168352608086015181166020808501918252610100880180518051908301207fffffffffffffffffffffffffffffffffffffffff000000000000000000000000168688019081526101208a0180518051908501206000908152600285528981208c5161ffff16825290945292889020965187549451915190961c68010000000000000000027fffffffff0000000000000000000000000000000000000000ffffffffffffffff918616640100000000027fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000909516969095169590951792909217939093169190911790925551905191517f55ced933cdd5a34dd03eb5d4bef19ec6ebb251dcd7a988eee0c1b9a13baaa88b9261117692916130b5565b60405180910390a15061010001519392505050565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e082018190526101008201819052610120820152906111e6908390611c77565b61ffff1681526111f7826002611890565b60ff16602082015261120a826003611890565b60ff16604082015261121d826004611c9f565b63ffffffff9081166060830152611239908390600890611c9f16565b63ffffffff9081166080830152611255908390600c90611c9f16565b63ffffffff90811660a0830152611271908390601090611c7716565b61ffff1660c0820152611285826012611cc9565b60e08201819052516112c29061129c90601261319c565b8260e0015151601285516112b091906133dc565b6112ba91906133dc565b8491906118db565b610100820152919050565b6000806112e46112dd8483611aa6565b8490611c77565b8351602080860191909120865187830120600090815260028352604080822061ffff9095168252939092529190205468010000000000000000900460601b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090811691161491505092915050565b6060600061135f84610d5a565b90505b80515160208201511015610b3757606081015161ffff1660011461138557600080fd5b815161139b5761139481611ce4565b91506113d7565b602081015181516113ab91611aa6565b8251146113b757600080fd5b8051602082015183516113ce928592600092611d05565b6113d757600080fd5b8261ffff16816040015161ffff16146113ef57600080fd5b6113f881610e7b565b611362565b6000805b83518310611438577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b60006114448585611890565b60ff16905061145481600161319c565b61145e908561319c565b93508061146b5750610a44565b61147660018361319c565b915050611401565b83518360e0015151111561149157600080fd5b6114b66000858560e001515187516114a991906133dc565b60e0870151929190611d28565b6114bf57600080fd5b60006114cb8282611a45565b604081015190915061ffff16602b14156114f8576114ea848483611d5d565b6114f357600080fd5b61157b565b604081015161ffff1660301415611514576114ea848483611df6565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4e6f2076616c69642070726f6f6620666f756e6400000000000000000000000060448201526064015b60405180910390fd5b5050505050565b60008061158f8482611890565b61159a9060016131b4565b60ff16905060005b8351811015610c19576115b784828785611d28565b156115c757600192505050610a47565b6115d18482611890565b6115dc9060016131b4565b6115e99060ff168261319c565b90506115a2565b6040805160c08101825260008082526020820181905291810182905260608082018190526080820183905260a08201529061162b838561319c565b905061164261163b60008661319c565b8690611890565b60ff16825261165561163b60018661319c565b60ff16602083015261167261166b60028661319c565b8690611c77565b61ffff166040830152600061169261168b60048761319c565b8790611890565b905061169f60058661319c565b94506116af868660ff84166118db565b60608401526116c160ff82168661319c565b945060006116cf8787611890565b905060208160ff1611156116e257600080fd5b6116ed60018761319c565b95506116fd878760ff8416611e9e565b608085015261170f60ff82168761319c565b95506117278661171f81866133dc565b8991906118db565b60a0850152509195945050505050565b600060ff600883811c82169183916117509186166131d9565b905060006117626007808716906133f3565b600160ff919091161b9050855b875181101561183f5760006117848983611890565b9050600061179d61179684600161319c565b8b90611890565b90508160ff168660ff1610156117bc57600096505050505050506108f7565b8160ff168660ff16141561181e578460ff168160ff16116117e657600096505050505050506108f7565b836118096117f760ff88168661319c565b61180290600261319c565b8c90611890565b1660ff166000141596505050505050506108f7565b6118298160026131b4565b6118369060ff168461319c565b9250505061176f565b506000979650505050505050565b60008061185a8584611984565b9050600061186785611874565b9190911495945050505050565b6000610a4760016118858484611890565b84919060ff16611edf565b60008282815181106118cb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b016020015160f81c905092915050565b82516060906118ea838561319c565b11156118f557600080fd5b60008267ffffffffffffffff811115611937577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611961576020820181803683370190505b509050602080820190868601016119798282876121af565b509095945050505050565b815160ff166000908152600560205260408082205460608501518286015192517f68f9dab200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909216926368f9dab2926119f592918791600401613113565b60206040518083038186803b158015611a0d57600080fd5b505afa158015611a21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a449190612dce565b611a936040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c08101829052610a4781610e7b565b6000815b83518110611ae1577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000611aed8583611890565b60ff169050611afd81600161319c565b611b07908361319c565b915080611b145750611b1a565b50611aaa565b610c1d83826133dc565b6000611b308383612205565b15611b3d57506000610a47565b6000806000806000611b508860006113fd565b90506000611b5f8860006113fd565b90505b80821115611b8b57859350611b778987612223565b955081611b8381613416565b925050611b62565b81811115611bb457849250611ba08886612223565b945080611bac81613416565b915050611b8b565b600082118015611bcd5750611bcb89878a88611d28565b155b15611c0257859350611bdf8987612223565b9550849250611bee8886612223565b9450611bfb6001836133dc565b9150611bb4565b85611c17576000199650505050505050610a47565b84611c2b5760019650505050505050610a47565b611c6a611c3985600161319c565b611c438b87611890565b60ff168a611c5287600161319c565b611c5c8d89611890565b8e949392919060ff16612247565b9998505050505050505050565b8151600090611c8783600261319c565b1115611c9257600080fd5b50016002015161ffff1690565b8151600090611caf83600461319c565b1115611cba57600080fd5b50016004015163ffffffff1690565b60606000611cd78484611aa6565b9050610c1d8484836118db565b60208101518151606091610a4791611cfc9082611aa6565b845191906118db565b6000611d1284848461233c565b611d1d87878561233c565b149695505050505050565b6000611d418383848651611d3c91906133dc565b61233c565b611d538686878951611d3c91906133dc565b1495945050505050565b600080611d6985610d5a565b90505b80515160208201511015610c1957604081015161ffff16603014611d8f57600080fd5b6000611d9a82612360565b90506000611db5600083518461237c9092919063ffffffff16565b9050611dc38183898961241a565b15611de657611ddc611dd484611ce4565b868385612551565b93505050506108f7565b5050611df181610e7b565b611d6c565b6000611e0f8460e00151611e0984611ce4565b90612205565b611e1857600080fd5b81515160208301511015611e9457611e378460e00151611e0984611ce4565b611e4057600080fd5b6000611e4b83612360565b90506000611e66600083518461237c9092919063ffffffff16565b9050611e748183888861241a565b15611e84576001925050506108f7565b5050611e8f82610e7b565b611e18565b5060009392505050565b60006020821115611eae57600080fd5b8351611eba838561319c565b1115611ec557600080fd5b506020919092018101519190036101000a60001901191690565b60006034821115611eef57600080fd5b600080805b8481101561209257600087611f09838961319c565b81518110611f40577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff000000000000000000000000000000000000000000000000000000000000001690507f30000000000000000000000000000000000000000000000000000000000000008110801590611fdb57507f7a000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821611155b611fe457600080fd5b60405180608001604052806047815260200161355d6047913961200c603060f884901c6133dc565b81518110612043577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b0160209081015160f81c935083111561205b57600080fd5b6120666001876133dc565b8214156120735750612092565b5060059290921b60ff821617918061208a8161347b565b915050611ef4565b5060006120a08560056132e5565b90506120ad600886613496565b6120c2578160ff16600584901b179250612195565b6120cd600886613496565b600214156120fc5760028260ff16901c60ff16600384901b1792506002816120f591906133dc565b9050612195565b612107600886613496565b6004141561212f5760048260ff16901c60ff16600184901b1792506004816120f591906133dc565b61213a600886613496565b600514156121625760018260ff16901c60ff16600484901b1792506001816120f591906133dc565b61216d600886613496565b600714156100ea5760038260ff16901c60ff16600284901b1792506003816120f591906133dc565b6121a1816101006133dc565b9290921b9695505050505050565b602081106121e757815183526121c660208461319c565b92506121d360208361319c565b91506121e06020826133dc565b90506121af565b905182516020929092036101000a6000190180199091169116179052565b600081518351148015610a445750610a448360008460008751611d05565b600061222f8383611890565b60ff1661223d83600161319c565b610a44919061319c565b600084808310156122555750815b60208789018101908587010160005b8381101561232157825182518082146122f1576000602087111561228b57506000196122c7565b6001846122998960206133dc565b6122a3919061319c565b6122ae9060086132e5565b6122b990600261323d565b6122c391906133dc565b1990505b60006122d7838316858416613304565b905080156122ee5797506123329650505050505050565b50505b6122fc60208661319c565b945061230960208561319c565b9350505060208161231a919061319c565b9050612264565b5061232c8589613304565b93505050505b9695505050505050565b825160009061234b838561319c565b111561235657600080fd5b5091016020012090565b60a081015160c0820151606091610a4791611cfc9082906133dc565b60408051608081018252600080825260208201819052918101919091526060808201526123b46123ad60008561319c565b8590611c77565b61ffff1681526123cf6123c860028561319c565b8590611890565b60ff1660208201526123e56123c860038561319c565b60ff16604082015261240e6123fb60048561319c565b6124066004856133dc565b8691906118db565b60608201529392505050565b6000846020015160ff1660031461243357506000610c1d565b826020015160ff16856040015160ff161461245057506000610c1d565b600061245b85612652565b90508360c0015161ffff168161ffff161461247a576000915050610c1d565b85516101001661248e576000915050610c1d565b60408087015160ff16600090815260036020908152908290205485519186015192517fde8f50a100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169263de8f50a192612501928a92906004016130da565b60206040518083038186803b15801561251957600080fd5b505afa15801561252d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123329190612dae565b60008061255d83612652565b90505b845151602086015110156126465760a085015160c08601516000916125939161258a9082906133dc565b8851919061237c565b90508161ffff16816000015161ffff16146125ae5750612638565b846040015160ff16816020015160ff16146125c95750612638565b6040805180820190915260608152600060208201526125f6855189516125ef919061319c565b8290612896565b5061260181896128fb565b5061260c81866128fb565b50612624826040015182600001518460600151612922565b156126355760019350505050610c1d565b50505b61264185610e7b565b612560565b50600095945050505050565b6000612000825111156126c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4c6f6e67206b657973206e6f74207065726d69747465640000000000000000006044820152606401611572565b60008060005b8451601f0181101561273657600081602087010151905085518260200111156126fc5785518290036008026101000390811c901b5b7eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff600882901c811694909401931691909101906020016126c7565b506010827fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff000016901c827dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff160191506010817fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff000016901c817dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff1601905080600883901b0191506020827fffffffff00000000ffffffff00000000ffffffff00000000ffffffff0000000016901c827bffffffff00000000ffffffff00000000ffffffff00000000ffffffff160191506040827fffffffffffffffff0000000000000000ffffffffffffffff000000000000000016901c8277ffffffffffffffff0000000000000000ffffffffffffffff16019150608082901c826fffffffffffffffffffffffffffffffff16019150601082901c61ffff16820191508192505050919050565b6040805180820190915260608152600060208201526128b6602083613496565b156128de576128c6602083613496565b6128d19060206133dc565b6128db908361319c565b91505b506020828101829052604080518085526000815290920101905290565b604080518082019091526060815260006020820152610a4483846000015151848551612a10565b60ff831660009081526004602052604081205473ffffffffffffffffffffffffffffffffffffffff16612957575060006108f7565b60ff84166000908152600460208190526040918290205491517ff7e83aee00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9092169163f7e83aee916129c09187918791016130b5565b60206040518083038186803b1580156129d857600080fd5b505afa1580156129ec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1d9190612dae565b6040805180820190915260608152600060208201528251821115612a3357600080fd5b6020850151612a42838661319c565b1115612a7557612a7585612a6587602001518786612a60919061319c565b612afa565b612a709060026132e5565b612b11565b600080865180518760208301019350808887011115612a945787860182525b505050602084015b60208410612ad45780518252612ab360208361319c565b9150612ac060208261319c565b9050612acd6020856133dc565b9350612a9c565b51815160001960208690036101000a019081169019919091161790525083949350505050565b600081831115612b0b575081610a47565b50919050565b8151612b1d8383612896565b5061084983826128fb565b60008083601f840112612b39578182fd5b50813567ffffffffffffffff811115612b50578182fd5b602083019150836020828501011115612b6857600080fd5b9250929050565b600082601f830112612b7f578081fd5b813567ffffffffffffffff811115612b9957612b99613508565b612bca60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160161314d565b818152846020838601011115612bde578283fd5b816020850160208301379081016020019190915292915050565b600060408284031215612c09578081fd5b6040516040810167ffffffffffffffff8282108183111715612c2d57612c2d613508565b816040528293508435915080821115612c4557600080fd5b612c5186838701612b6f565b83526020850135915080821115612c6757600080fd5b50612c7485828601612b6f565b6020830152505092915050565b803561ffff81168114612c9357600080fd5b919050565b803560ff81168114612c9357600080fd5b600060208284031215612cba578081fd5b8135610a4481613537565b600080600060408486031215612cd9578182fd5b833567ffffffffffffffff80821115612cf0578384fd5b818601915086601f830112612d03578384fd5b8135602082821115612d1757612d17613508565b8160051b612d2682820161314d565b8381528281019086840183880185018d1015612d4057898afd5b8993505b85841015612d7d57803587811115612d5a578a8bfd5b612d688e87838c0101612bf8565b84525060019390930192918401918401612d44565b509850505087013592505080821115612d94578384fd5b50612da186828701612b28565b9497909650939450505050565b600060208284031215612dbf578081fd5b81518015158114610a44578182fd5b600060208284031215612ddf578081fd5b5051919050565b60008060408385031215612df8578182fd5b823567ffffffffffffffff80821115612e0f578384fd5b612e1b86838701612bf8565b93506020850135915080821115612e30578283fd5b50612e3d85828601612b6f565b9150509250929050565b600080600060408486031215612e5b578283fd5b612e6484612c81565b9250602084013567ffffffffffffffff811115612e7f578283fd5b612da186828701612b28565b60008060008060808587031215612ea0578081fd5b612ea985612c81565b9350602085013567ffffffffffffffff80821115612ec5578283fd5b612ed188838901612b6f565b94506040870135915080821115612ee6578283fd5b612ef288838901612bf8565b93506060870135915080821115612f07578283fd5b50612f1487828801612b6f565b91505092959194509250565b600080600080600060a08688031215612f37578081fd5b612f4086612c81565b9450602086013567ffffffffffffffff80821115612f5c578283fd5b612f6889838a01612b6f565b95506040880135915080821115612f7d578283fd5b612f8989838a01612bf8565b94506060880135915080821115612f9e578283fd5b612faa89838a01612bf8565b93506080880135915080821115612fbf578283fd5b50612fcc88828901612b6f565b9150509295509295909350565b600060208284031215612fea578081fd5b610a4482612c98565b60008060408385031215613005578182fd5b61300e83612c98565b9150602083013561301e81613537565b809150509250929050565b60008151808452815b8181101561304e57602081850181015186830182015201613032565b8181111561305f5782602083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b8183823760009101908152919050565b602081526000610a446020830184613029565b6040815260006130c86040830185613029565b8281036020840152610d388185613029565b6060815260006130ed6060830186613029565b82810360208401526130ff8186613029565b905082810360408401526123328185613029565b6060815260006131266060830186613029565b82810360208401526131388186613029565b91505061ffff83166040830152949350505050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561319457613194613508565b604052919050565b600082198211156131af576131af6134aa565b500190565b600060ff821660ff84168060ff038211156131d1576131d16134aa565b019392505050565b600061ffff808416806131ee576131ee6134d9565b92169190910492915050565b600181815b8085111561323557816000190482111561321b5761321b6134aa565b8085161561322857918102915b93841c93908002906131ff565b509250929050565b6000610a44838360008261325357506001610a47565b8161326057506000610a47565b816001811461327657600281146132805761329c565b6001915050610a47565b60ff841115613291576132916134aa565b50506001821b610a47565b5060208310610133831016604e8410600b84101617156132bf575081810a610a47565b6132c983836131fa565b80600019048211156132dd576132dd6134aa565b029392505050565b60008160001904831182151516156132ff576132ff6134aa565b500290565b6000808312837f80000000000000000000000000000000000000000000000000000000000000000183128115161561333e5761333e6134aa565b837f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018313811615613372576133726134aa565b50500390565b60008160030b8360030b828112817fffffffffffffffffffffffffffffffffffffffffffffffffffffffff80000000018312811516156133ba576133ba6134aa565b81637fffffff0183138116156133d2576133d26134aa565b5090039392505050565b6000828210156133ee576133ee6134aa565b500390565b600060ff821660ff84168082101561340d5761340d6134aa565b90039392505050565b600081613425576134256134aa565b506000190190565b600181811c9082168061344157607f821691505b60208210811415612b0b577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060001982141561348f5761348f6134aa565b5060010190565b6000826134a5576134a56134d9565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461355957600080fd5b5056fe00010203040506070809ffffffffffffff0a0b0c0d0e0f101112131415161718191a1b1c1d1e1fffffffffffffffffffff0a0b0c0d0e0f101112131415161718191a1b1c1d1e1fa264697066735822122021dd1abc05c3cbc1d56c91af7ce4f1050efc7b81ed60cdbe68e35a4dc1df0bb364736f6c63430008040033", + "devdoc": { + "kind": "dev", + "methods": { + "constructor": { + "details": "Constructor.", + "params": { + "_anchors": "The binary format RR entries for the root DS records." + } + }, + "deleteRRSet(uint16,bytes,(bytes,bytes),bytes)": { + "details": "Deletes an RR from the oracle.", + "params": { + "deleteName": "which you want to delete", + "deleteType": "The DNS record type to delete.", + "nsec": "The signed NSEC RRset. This is in the format described in section 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature data, followed by a series of canonicalised RR records that the signature applies to." + } + }, + "deleteRRSetNSEC3(uint16,bytes,(bytes,bytes),(bytes,bytes),bytes)": { + "details": "Deletes an RR from the oracle using an NSEC3 proof. Deleting a record using NSEC3 requires using up to two NSEC3 records. There are two cases: 1. The name exists, but the record type doesn't. Eg, example.com has A records but no TXT records. 2. The name does not exist, but a parent name does. In the first case, we submit one NSEC3 proof in `closestEncloser` that matches the target name but does not have the bit for `deleteType` set in its type bitmap. In the second case, we submit two proofs: closestEncloser and nextClosest, that together prove that the name does not exist. NSEC3 records are in the format described in section 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature data, followed by a series of canonicalised RR records that the signature applies to.", + "params": { + "closestEncloser": "An NSEC3 proof matching the closest enclosing name - that is, the nearest ancestor of the target name that *does* exist.", + "deleteName": "The name to delete.", + "deleteType": "The DNS record type to delete.", + "dnskey": "An encoded DNSKEY record that has already been submitted to the oracle and can be used to verify the signatures closestEncloserSig and nextClosestSig", + "nextClosest": "An NSEC3 proof covering the next closest name. This proves that the immediate subdomain of the closestEncloser does not exist." + } + }, + "rrdata(uint16,bytes)": { + "details": "Returns data about the RRs (if any) known to this oracle with the provided type and name.", + "params": { + "dnstype": "The DNS record type to query.", + "name": "The name to query, in DNS label-sequence format." + }, + "returns": { + "_0": "inception The unix timestamp (wrapped) at which the signature for this RRSET was created.", + "_1": "expiration The unix timestamp (wrapped) at which the signature for this RRSET expires.", + "_2": "hash The hash of the RRset." + } + }, + "setAlgorithm(uint8,address)": { + "details": "Sets the contract address for a signature verification algorithm. Callable only by the owner.", + "params": { + "algo": "The address of the algorithm contract.", + "id": "The algorithm ID" + } + }, + "setDigest(uint8,address)": { + "details": "Sets the contract address for a digest verification algorithm. Callable only by the owner.", + "params": { + "digest": "The address of the digest contract.", + "id": "The digest ID" + } + }, + "setNSEC3Digest(uint8,address)": { + "details": "Sets the contract address for an NSEC3 digest algorithm. Callable only by the owner.", + "params": { + "digest": "The address of the digest contract.", + "id": "The digest ID" + } + }, + "submitRRSet((bytes,bytes),bytes)": { + "details": "Submits a signed set of RRs to the oracle. RRSETs are only accepted if they are signed with a key that is already trusted, or if they are self-signed, and the signing key is identified by a DS record that is already trusted.", + "params": { + "input": "The signed RR set. This is in the format described in section 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature data, followed by a series of canonicalised RR records that the signature applies to.", + "proof": "The DNSKEY or DS to validate the signature against. Must Already have been submitted and proved previously." + } + }, + "submitRRSets((bytes,bytes)[],bytes)": { + "details": "Submits multiple RRSets", + "params": { + "_proof": "The DNSKEY or DS to validate the first signature against.", + "input": "A list of RRSets and signatures forming a chain of trust from an existing known-good record." + }, + "returns": { + "_0": "The last RRSET submitted." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 4199, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "anchors", + "offset": 0, + "slot": "0", + "type": "t_bytes_storage" + }, + { + "astId": 6039, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "owner", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 4364, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "rrsets", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_bytes32,t_mapping(t_uint16,t_struct(RRSet)4357_storage))" + }, + { + "astId": 4369, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "algorithms", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint8,t_contract(Algorithm)7446)" + }, + { + "astId": 4374, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "digests", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_uint8,t_contract(Digest)9287)" + }, + { + "astId": 4379, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "nsec3Digests", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_uint8,t_contract(NSEC3Digest)9409)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes20": { + "encoding": "inplace", + "label": "bytes20", + "numberOfBytes": "20" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(Algorithm)7446": { + "encoding": "inplace", + "label": "contract Algorithm", + "numberOfBytes": "20" + }, + "t_contract(Digest)9287": { + "encoding": "inplace", + "label": "contract Digest", + "numberOfBytes": "20" + }, + "t_contract(NSEC3Digest)9409": { + "encoding": "inplace", + "label": "contract NSEC3Digest", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes32,t_mapping(t_uint16,t_struct(RRSet)4357_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint16 => struct DNSSECImpl.RRSet))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint16,t_struct(RRSet)4357_storage)" + }, + "t_mapping(t_uint16,t_struct(RRSet)4357_storage)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => struct DNSSECImpl.RRSet)", + "numberOfBytes": "32", + "value": "t_struct(RRSet)4357_storage" + }, + "t_mapping(t_uint8,t_contract(Algorithm)7446)": { + "encoding": "mapping", + "key": "t_uint8", + "label": "mapping(uint8 => contract Algorithm)", + "numberOfBytes": "32", + "value": "t_contract(Algorithm)7446" + }, + "t_mapping(t_uint8,t_contract(Digest)9287)": { + "encoding": "mapping", + "key": "t_uint8", + "label": "mapping(uint8 => contract Digest)", + "numberOfBytes": "32", + "value": "t_contract(Digest)9287" + }, + "t_mapping(t_uint8,t_contract(NSEC3Digest)9409)": { + "encoding": "mapping", + "key": "t_uint8", + "label": "mapping(uint8 => contract NSEC3Digest)", + "numberOfBytes": "32", + "value": "t_contract(NSEC3Digest)9409" + }, + "t_struct(RRSet)4357_storage": { + "encoding": "inplace", + "label": "struct DNSSECImpl.RRSet", + "members": [ + { + "astId": 4352, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "inception", + "offset": 0, + "slot": "0", + "type": "t_uint32" + }, + { + "astId": 4354, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "expiration", + "offset": 4, + "slot": "0", + "type": "t_uint32" + }, + { + "astId": 4356, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "hash", + "offset": 8, + "slot": "0", + "type": "t_bytes20" + } + ], + "numberOfBytes": "32" + }, + "t_uint16": { + "encoding": "inplace", + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/DefaultReverseResolver.json b/solidity/dns-contracts/deployments/goerli/DefaultReverseResolver.json new file mode 100644 index 0000000..9210a93 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/DefaultReverseResolver.json @@ -0,0 +1,74 @@ +{ + "address": "0x084b1c3C81545d370f3634392De611CaaBFf8148", + "transactionHash": "0x1d9a813b8c1a458a02f12fb32aa344ad61bba0bcf3bc0b4cde52bd42446ba5a0", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "ensAddr", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "constant": true, + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ] +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/DummyAlgorithm.json b/solidity/dns-contracts/deployments/goerli/DummyAlgorithm.json new file mode 100644 index 0000000..d444cd3 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/DummyAlgorithm.json @@ -0,0 +1,71 @@ +{ + "address": "0x5f27ee2a367b644300232b28D6E13F1BAC433fA8", + "transactionHash": "0xf8a1b8ba412c9523adb0430bfe835b597489eb32e5baf3ce0dcb317a568771ba", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xf8a1b8ba412c9523adb0430bfe835b597489eb32e5baf3ce0dcb317a568771ba", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x5f27ee2a367b644300232b28D6E13F1BAC433fA8", + "transactionIndex": 1, + "gasUsed": "132967", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xa9b5f49c82046398d50dc8bce52c7b62d53f68cbb5bd2c7953ee115928494bdf", + "transactionHash": "0xf8a1b8ba412c9523adb0430bfe835b597489eb32e5baf3ce0dcb317a568771ba", + "logs": [], + "blockNumber": 6470033, + "cumulativeGasUsed": "202231", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "7948b60c3b601df824761a337a51d661", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements a dummy DNSSEC (signing) algorithm that approves all signatures, for testing.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol\":\"DummyAlgorithm\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n*/\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external virtual view returns (bool);\\n}\\n\",\"keccak256\":\"0x51d6251568844e435f58952354abe8c8c8e978ab40ecb0bbb2f5bd767838b3a7\"},\"contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\n\\n/**\\n* @dev Implements a dummy DNSSEC (signing) algorithm that approves all\\n* signatures, for testing.\\n*/\\ncontract DummyAlgorithm is Algorithm {\\n function verify(bytes calldata, bytes calldata, bytes calldata) external override view returns (bool) { return true; }\\n}\\n\",\"keccak256\":\"0x59bb926cf8544aa5624717a2fd5850508ac7dd2a09620b05799b4ee00b708b2d\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610171806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004a61003e3660046100a5565b60019695505050505050565b604051901515815260200160405180910390f35b60008083601f84011261006f578182fd5b50813567ffffffffffffffff811115610086578182fd5b60208301915083602082850101111561009e57600080fd5b9250929050565b600080600080600080606087890312156100bd578182fd5b863567ffffffffffffffff808211156100d4578384fd5b6100e08a838b0161005e565b909850965060208901359150808211156100f8578384fd5b6101048a838b0161005e565b9096509450604089013591508082111561011c578384fd5b5061012989828a0161005e565b979a969950949750929593949250505056fea2646970667358221220701bc799da4e2d48a9ebb2506c702156f8e121aa3bc785a1273711602d7a0c8b64736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004a61003e3660046100a5565b60019695505050505050565b604051901515815260200160405180910390f35b60008083601f84011261006f578182fd5b50813567ffffffffffffffff811115610086578182fd5b60208301915083602082850101111561009e57600080fd5b9250929050565b600080600080600080606087890312156100bd578182fd5b863567ffffffffffffffff808211156100d4578384fd5b6100e08a838b0161005e565b909850965060208901359150808211156100f8578384fd5b6101048a838b0161005e565b9096509450604089013591508082111561011c578384fd5b5061012989828a0161005e565b979a969950949750929593949250505056fea2646970667358221220701bc799da4e2d48a9ebb2506c702156f8e121aa3bc785a1273711602d7a0c8b64736f6c63430008040033", + "devdoc": { + "details": "Implements a dummy DNSSEC (signing) algorithm that approves all signatures, for testing.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/DummyDigest.json b/solidity/dns-contracts/deployments/goerli/DummyDigest.json new file mode 100644 index 0000000..d4992d6 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/DummyDigest.json @@ -0,0 +1,66 @@ +{ + "address": "0x2Ea5d7A80987ec70d504d64234e6f03689a1C9Bf", + "transactionHash": "0xe7cfa540daaa44c63b5516b22e8dd11a70769e5211c2c78226fde602f632bd80", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0xe7cfa540daaa44c63b5516b22e8dd11a70769e5211c2c78226fde602f632bd80", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x2Ea5d7A80987ec70d504d64234e6f03689a1C9Bf", + "transactionIndex": 5, + "gasUsed": "119551", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xe94deff42b8af8768b15c8919b1a57b936be3e2d8ee3dba8b3e474c23e74b25b", + "transactionHash": "0xe7cfa540daaa44c63b5516b22e8dd11a70769e5211c2c78226fde602f632bd80", + "logs": [], + "blockNumber": 6470037, + "cumulativeGasUsed": "869778", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "7948b60c3b601df824761a337a51d661", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements a dummy DNSSEC digest that approves all hashes, for testing.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/digests/DummyDigest.sol\":\"DummyDigest\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev An interface for contracts implementing a DNSSEC digest.\\n*/\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(bytes calldata data, bytes calldata hash) external virtual pure returns (bool);\\n}\\n\",\"keccak256\":\"0x259720cef78c019d38b908bc7dd524f087c58d8c40792cebcdd4e982c628bc9a\"},\"contracts/dnssec-oracle/digests/DummyDigest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Digest.sol\\\";\\n\\n/**\\n* @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\\n*/\\ncontract DummyDigest is Digest {\\n function verify(bytes calldata, bytes calldata) external override pure returns (bool) { return true; }\\n}\\n\",\"keccak256\":\"0x15e3a63572d9325d0e59346e5758181aed1865b934b3422f53cac930c7902c14\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610132806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063f7e83aee14602d575b600080fd5b60426038366004609a565b6001949350505050565b604051901515815260200160405180910390f35b60008083601f8401126066578182fd5b50813567ffffffffffffffff811115607c578182fd5b602083019150836020828501011115609357600080fd5b9250929050565b6000806000806040858703121560ae578384fd5b843567ffffffffffffffff8082111560c4578586fd5b60ce888389016056565b9096509450602087013591508082111560e5578384fd5b5060f0878288016056565b9598949750955050505056fea264697066735822122041ceb00124643679e016d6d16621a8b6506a42fb1e1d12c87aa9fc7f504bfb4e64736f6c63430008040033", + "deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060285760003560e01c8063f7e83aee14602d575b600080fd5b60426038366004609a565b6001949350505050565b604051901515815260200160405180910390f35b60008083601f8401126066578182fd5b50813567ffffffffffffffff811115607c578182fd5b602083019150836020828501011115609357600080fd5b9250929050565b6000806000806040858703121560ae578384fd5b843567ffffffffffffffff8082111560c4578586fd5b60ce888389016056565b9096509450602087013591508082111560e5578384fd5b5060f0878288016056565b9598949750955050505056fea264697066735822122041ceb00124643679e016d6d16621a8b6506a42fb1e1d12c87aa9fc7f504bfb4e64736f6c63430008040033", + "devdoc": { + "details": "Implements a dummy DNSSEC digest that approves all hashes, for testing.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/DummyOracle.json b/solidity/dns-contracts/deployments/goerli/DummyOracle.json new file mode 100644 index 0000000..1da76fb --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/DummyOracle.json @@ -0,0 +1,95 @@ +{ + "address": "0x32e6c069d2C8Bec43157293929419A263ed7180D", + "abi": [ + { + "inputs": [ + { + "internalType": "int256", + "name": "_value", + "type": "int256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "latestAnswer", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int256", + "name": "_value", + "type": "int256" + } + ], + "name": "set", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x8c0fc260f5f9dba88bad6f90c658e15f0330fc3fd410be6545542be989fcc0ac", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x32e6c069d2C8Bec43157293929419A263ed7180D", + "transactionIndex": 72, + "gasUsed": "114009", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xaa7bd44d4ff0eb88087e042d3ef6ec30edf17468476ead06dc78862563b513dd", + "transactionHash": "0x8c0fc260f5f9dba88bad6f90c658e15f0330fc3fd410be6545542be989fcc0ac", + "logs": [], + "blockNumber": 8586010, + "cumulativeGasUsed": "14910595", + "status": 1, + "byzantium": true + }, + "args": [ + "160000000000" + ], + "numDeployments": 3, + "solcInputHash": "2813443d96b2eb882a21ada25755af03", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"_value\",\"type\":\"int256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"_value\",\"type\":\"int256\"}],\"name\":\"set\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/DummyOracle.sol\":\"DummyOracle\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1500},\"remappings\":[]},\"sources\":{\"contracts/ethregistrar/DummyOracle.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ncontract DummyOracle {\\n int256 value;\\n\\n constructor(int256 _value) public {\\n set(_value);\\n }\\n\\n function set(int256 _value) public {\\n value = _value;\\n }\\n\\n function latestAnswer() public view returns (int256) {\\n return value;\\n }\\n}\\n\",\"keccak256\":\"0x8f0d88c42c074c3fb80710f7639cb455a582fa96629e26a974dd6a19c15678ff\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161011138038061011183398101604081905261002f9161003e565b61003881600055565b50610057565b60006020828403121561005057600080fd5b5051919050565b60ac806100656000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806350d25bcd146037578063e5c19b2d14604c575b600080fd5b60005460405190815260200160405180910390f35b605c6057366004605e565b600055565b005b600060208284031215606f57600080fd5b503591905056fea2646970667358221220f187daa57c6cbf0d06755647ea010a8b94c874520430b0e35a8c45343e3772ee64736f6c63430008110033", + "deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060325760003560e01c806350d25bcd146037578063e5c19b2d14604c575b600080fd5b60005460405190815260200160405180910390f35b605c6057366004605e565b600055565b005b600060208284031215606f57600080fd5b503591905056fea2646970667358221220f187daa57c6cbf0d06755647ea010a8b94c874520430b0e35a8c45343e3772ee64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 11561, + "contract": "contracts/ethregistrar/DummyOracle.sol:DummyOracle", + "label": "value", + "offset": 0, + "slot": "0", + "type": "t_int256" + } + ], + "types": { + "t_int256": { + "encoding": "inplace", + "label": "int256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/ENSRegistry.json b/solidity/dns-contracts/deployments/goerli/ENSRegistry.json new file mode 100644 index 0000000..c0b10c5 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/ENSRegistry.json @@ -0,0 +1,426 @@ +{ + "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "transactionHash": "0x408a700dd95c50c3b76f373047a9901185824dce4e99e3831f41a4cbbf0b4f1b", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_old", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NewOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "NewResolver", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "NewTTL", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "old", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "recordExists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "resolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setRecord", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "ttl", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ] +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/ETHRegistrarController.json b/solidity/dns-contracts/deployments/goerli/ETHRegistrarController.json new file mode 100644 index 0000000..c7e6058 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/ETHRegistrarController.json @@ -0,0 +1,716 @@ +{ + "address": "0xCc5e7dB10E65EED1BBD105359e7268aa660f6734", + "abi": [ + { + "inputs": [ + { + "internalType": "contract BaseRegistrarImplementation", + "name": "_base", + "type": "address" + }, + { + "internalType": "contract IPriceOracle", + "name": "_prices", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minCommitmentAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxCommitmentAge", + "type": "uint256" + }, + { + "internalType": "contract ReverseRegistrar", + "name": "_reverseRegistrar", + "type": "address" + }, + { + "internalType": "contract INameWrapper", + "name": "_nameWrapper", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "CommitmentTooNew", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "CommitmentTooOld", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "DurationTooShort", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientValue", + "type": "error" + }, + { + "inputs": [], + "name": "MaxCommitmentAgeTooHigh", + "type": "error" + }, + { + "inputs": [], + "name": "MaxCommitmentAgeTooLow", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameNotAvailable", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverRequiredWhenDataSupplied", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "UnexpiredCommitmentExists", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "baseCost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "premium", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRenewed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "MIN_REGISTRATION_DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "available", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "commit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "commitments", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "bool", + "name": "reverseRecord", + "type": "bool" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "name": "makeCommitment", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "maxCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nameWrapper", + "outputs": [ + { + "internalType": "contract INameWrapper", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "prices", + "outputs": [ + { + "internalType": "contract IPriceOracle", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "recoverFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "bool", + "name": "reverseRecord", + "type": "bool" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "rentPrice", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "base", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "premium", + "type": "uint256" + } + ], + "internalType": "struct IPriceOracle.Price", + "name": "price", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "reverseRegistrar", + "outputs": [ + { + "internalType": "contract ReverseRegistrar", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "valid", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x1f1f303cdfdccb63487404a8c442a6ccaea80e4eb88d76d40a317a7223912168", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0xCc5e7dB10E65EED1BBD105359e7268aa660f6734", + "transactionIndex": 85, + "gasUsed": "1721777", + "logsBloom": "0x00000000000010000000000008000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000001000000000000000000400000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000010000000000000000000000000000", + "blockHash": "0x732acf7d7c3129acdb13081991442afa0b82aeef486fb8cf4f866aa91517ce5c", + "transactionHash": "0x1f1f303cdfdccb63487404a8c442a6ccaea80e4eb88d76d40a317a7223912168", + "logs": [ + { + "transactionIndex": 85, + "blockNumber": 8649286, + "transactionHash": "0x1f1f303cdfdccb63487404a8c442a6ccaea80e4eb88d76d40a317a7223912168", + "address": "0xCc5e7dB10E65EED1BBD105359e7268aa660f6734", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000904dac3347ea47d208f3fd67402d039a3b99859" + ], + "data": "0x", + "logIndex": 188, + "blockHash": "0x732acf7d7c3129acdb13081991442afa0b82aeef486fb8cf4f866aa91517ce5c" + } + ], + "blockNumber": 8649286, + "cumulativeGasUsed": "12997625", + "status": 1, + "byzantium": true + }, + "args": [ + "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85", + "0xE4354bCf22e3C6a6496C31901399D46FC4Ac6a61", + 60, + 86400, + "0x4f7A657451358a22dc397d5eE7981FfC526cd856", + "0x114D4603199df73e7D157787f8778E21fCd13066" + ], + "numDeployments": 6, + "solcInputHash": "0ba2159dea6e6f2226840e68f6c0a0ff", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract BaseRegistrarImplementation\",\"name\":\"_base\",\"type\":\"address\"},{\"internalType\":\"contract IPriceOracle\",\"name\":\"_prices\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_minCommitmentAge\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxCommitmentAge\",\"type\":\"uint256\"},{\"internalType\":\"contract ReverseRegistrar\",\"name\":\"_reverseRegistrar\",\"type\":\"address\"},{\"internalType\":\"contract INameWrapper\",\"name\":\"_nameWrapper\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"CommitmentTooNew\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"CommitmentTooOld\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"DurationTooShort\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxCommitmentAgeTooHigh\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxCommitmentAgeTooLow\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NameNotAvailable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverRequiredWhenDataSupplied\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"UnexpiredCommitmentExists\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"baseCost\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameRenewed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MIN_REGISTRATION_DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"available\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"commit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"commitments\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"bool\",\"name\":\"reverseRecord\",\"type\":\"bool\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"name\":\"makeCommitment\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxCommitmentAge\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minCommitmentAge\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nameWrapper\",\"outputs\":[{\"internalType\":\"contract INameWrapper\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"prices\",\"outputs\":[{\"internalType\":\"contract IPriceOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"recoverFunds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"bool\",\"name\":\"reverseRecord\",\"type\":\"bool\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"renew\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"rentPrice\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"base\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"}],\"internalType\":\"struct IPriceOracle.Price\",\"name\":\"price\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"reverseRegistrar\",\"outputs\":[{\"internalType\":\"contract ReverseRegistrar\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"valid\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"A registrar controller for registering and renewing names at fixed cost.\",\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"recoverFunds(address,address,uint256)\":{\"details\":\"The contract is Ownable and only the owner can call the recover function.\",\"params\":{\"_amount\":\"The amount of tokens to recover.\",\"_to\":\"The address to send the tokens to.\",\"_token\":\"The address of the ERC20 token to recover\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"recoverFunds(address,address,uint256)\":{\"notice\":\"Recover ERC20 tokens sent to the contract by mistake.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/ETHRegistrarController.sol\":\"ETHRegistrarController\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1500},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6392f2cfe3a5ee802227fe7a2dfd47096d881aec89bddd214b35c5b46d3cd941\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/ERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721.sol\\\";\\nimport \\\"./IERC721Receiver.sol\\\";\\nimport \\\"./extensions/IERC721Metadata.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\nimport \\\"../../utils/Strings.sol\\\";\\nimport \\\"../../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\n * {ERC721Enumerable}.\\n */\\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\\n using Address for address;\\n using Strings for uint256;\\n\\n // Token name\\n string private _name;\\n\\n // Token symbol\\n string private _symbol;\\n\\n // Mapping from token ID to owner address\\n mapping(uint256 => address) private _owners;\\n\\n // Mapping owner address to token count\\n mapping(address => uint256) private _balances;\\n\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) private _tokenApprovals;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IERC721).interfaceId ||\\n interfaceId == type(IERC721Metadata).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721-balanceOf}.\\n */\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\n return _balances[owner];\\n }\\n\\n /**\\n * @dev See {IERC721-ownerOf}.\\n */\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\n address owner = _ownerOf(tokenId);\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n _requireMinted(tokenId);\\n\\n string memory baseURI = _baseURI();\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\n }\\n\\n /**\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\n * by default, can be overridden in child contracts.\\n */\\n function _baseURI() internal view virtual returns (string memory) {\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual override {\\n address owner = ERC721.ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\n _requireMinted(tokenId);\\n\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC721-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC721-isApprovedForAll}.\\n */\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[owner][operator];\\n }\\n\\n /**\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n _safeTransfer(from, to, tokenId, data);\\n }\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\n *\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeTransfer(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) internal virtual {\\n _transfer(from, to, tokenId);\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n }\\n\\n /**\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\n }\\n\\n /**\\n * @dev Returns whether `tokenId` exists.\\n *\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\n *\\n * Tokens start existing when they are minted (`_mint`),\\n * and stop existing when they are burned (`_burn`).\\n */\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\n return _ownerOf(tokenId) != address(0);\\n }\\n\\n /**\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\n address owner = ERC721.ownerOf(tokenId);\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\n }\\n\\n /**\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\n _safeMint(to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\n */\\n function _safeMint(\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) internal virtual {\\n _mint(to, tokenId);\\n require(\\n _checkOnERC721Received(address(0), to, tokenId, data),\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\n );\\n }\\n\\n /**\\n * @dev Mints `tokenId` and transfers it to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - `to` cannot be the zero address.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _mint(address to, uint256 tokenId) internal virtual {\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n _beforeTokenTransfer(address(0), to, tokenId, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _burn(uint256 tokenId) internal virtual {\\n address owner = ERC721.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\n }\\n\\n /**\\n * @dev Transfers `tokenId` from `from` to `to`.\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _transfer(\\n address from,\\n address to,\\n uint256 tokenId\\n ) internal virtual {\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, tokenId, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(\\n address owner,\\n address operator,\\n bool approved\\n ) internal virtual {\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Reverts if the `tokenId` has not been minted yet.\\n */\\n function _requireMinted(uint256 tokenId) internal view virtual {\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\n }\\n\\n /**\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\n * The call is not executed if the target address is not a contract.\\n *\\n * @param from address representing the previous owner of the given token ID\\n * @param to target address that will receive the tokens\\n * @param tokenId uint256 ID of the token to be transferred\\n * @param data bytes optional data to send along with the call\\n * @return bool whether the call correctly returned the expected magic value\\n */\\n function _checkOnERC721Received(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) private returns (bool) {\\n if (to.isContract()) {\\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721Receiver.onERC721Received.selector;\\n } catch (bytes memory reason) {\\n if (reason.length == 0) {\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n } else {\\n /// @solidity memory-safe-assembly\\n assembly {\\n revert(add(32, reason), mload(reason))\\n }\\n }\\n }\\n } else {\\n return true;\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256, /* firstTokenId */\\n uint256 batchSize\\n ) internal virtual {\\n if (batchSize > 1) {\\n if (from != address(0)) {\\n _balances[from] -= batchSize;\\n }\\n if (to != address(0)) {\\n _balances[to] += batchSize;\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 firstTokenId,\\n uint256 batchSize\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0xd89f3585b211fc9e3408384a4c4efdc3a93b2f877a3821046fa01c219d35be1b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xab28a56179c1db258c9bf5235b382698cb650debecb51b23d12be9e241374b68\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721Metadata is IERC721 {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\"},\"contracts/ethregistrar/BaseRegistrarImplementation.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/ERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\\n // A map of expiry times\\n mapping(uint256 => uint256) expiries;\\n // The ENS registry\\n ENS public ens;\\n // The namehash of the TLD this registrar owns (eg, .eth)\\n bytes32 public baseNode;\\n // A map of addresses that are authorised to register and renew names.\\n mapping(address => bool) public controllers;\\n uint256 public constant GRACE_PERIOD = 90 days;\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n bytes4 private constant ERC721_ID =\\n bytes4(\\n keccak256(\\\"balanceOf(address)\\\") ^\\n keccak256(\\\"ownerOf(uint256)\\\") ^\\n keccak256(\\\"approve(address,uint256)\\\") ^\\n keccak256(\\\"getApproved(uint256)\\\") ^\\n keccak256(\\\"setApprovalForAll(address,bool)\\\") ^\\n keccak256(\\\"isApprovedForAll(address,address)\\\") ^\\n keccak256(\\\"transferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256,bytes)\\\")\\n );\\n bytes4 private constant RECLAIM_ID =\\n bytes4(keccak256(\\\"reclaim(uint256,address)\\\"));\\n\\n /**\\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\\n * @dev Returns whether the given spender can transfer a given token ID\\n * @param spender address of the spender to query\\n * @param tokenId uint256 ID of the token to be transferred\\n * @return bool whether the msg.sender is approved for the given token ID,\\n * is an operator of the owner, or is the owner of the token\\n */\\n function _isApprovedOrOwner(\\n address spender,\\n uint256 tokenId\\n ) internal view override returns (bool) {\\n address owner = ownerOf(tokenId);\\n return (spender == owner ||\\n getApproved(tokenId) == spender ||\\n isApprovedForAll(owner, spender));\\n }\\n\\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\\\"\\\", \\\"\\\") {\\n ens = _ens;\\n baseNode = _baseNode;\\n }\\n\\n modifier live() {\\n require(ens.owner(baseNode) == address(this));\\n _;\\n }\\n\\n modifier onlyController() {\\n require(controllers[msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Gets the owner of the specified token ID. Names become unowned\\n * when their registration expires.\\n * @param tokenId uint256 ID of the token to query the owner of\\n * @return address currently marked as the owner of the given token ID\\n */\\n function ownerOf(\\n uint256 tokenId\\n ) public view override(IERC721, ERC721) returns (address) {\\n require(expiries[tokenId] > block.timestamp);\\n return super.ownerOf(tokenId);\\n }\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external override onlyOwner {\\n controllers[controller] = true;\\n emit ControllerAdded(controller);\\n }\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external override onlyOwner {\\n controllers[controller] = false;\\n emit ControllerRemoved(controller);\\n }\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external override onlyOwner {\\n ens.setResolver(baseNode, resolver);\\n }\\n\\n // Returns the expiration timestamp of the specified id.\\n function nameExpires(uint256 id) external view override returns (uint256) {\\n return expiries[id];\\n }\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) public view override returns (bool) {\\n // Not available if it's registered here or in its grace period.\\n return expiries[id] + GRACE_PERIOD < block.timestamp;\\n }\\n\\n /**\\n * @dev Register a name.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external override returns (uint256) {\\n return _register(id, owner, duration, true);\\n }\\n\\n /**\\n * @dev Register a name, without modifying the registry.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function registerOnly(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256) {\\n return _register(id, owner, duration, false);\\n }\\n\\n function _register(\\n uint256 id,\\n address owner,\\n uint256 duration,\\n bool updateRegistry\\n ) internal live onlyController returns (uint256) {\\n require(available(id));\\n require(\\n block.timestamp + duration + GRACE_PERIOD >\\n block.timestamp + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] = block.timestamp + duration;\\n if (_exists(id)) {\\n // Name was previously owned, and expired\\n _burn(id);\\n }\\n _mint(owner, id);\\n if (updateRegistry) {\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n emit NameRegistered(id, owner, block.timestamp + duration);\\n\\n return block.timestamp + duration;\\n }\\n\\n function renew(\\n uint256 id,\\n uint256 duration\\n ) external override live onlyController returns (uint256) {\\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\\n require(\\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] += duration;\\n emit NameRenewed(id, expiries[id]);\\n return expiries[id];\\n }\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external override live {\\n require(_isApprovedOrOwner(msg.sender, id));\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view override(ERC721, IERC165) returns (bool) {\\n return\\n interfaceID == INTERFACE_META_ID ||\\n interfaceID == ERC721_ID ||\\n interfaceID == RECLAIM_ID;\\n }\\n}\\n\",\"keccak256\":\"0xaee6eb36aead449d397b86a02e9c63bc46e3ef378d0a62bfd68beaae1150c9d0\"},\"contracts/ethregistrar/ETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport {BaseRegistrarImplementation} from \\\"./BaseRegistrarImplementation.sol\\\";\\nimport {StringUtils} from \\\"./StringUtils.sol\\\";\\nimport {Resolver} from \\\"../resolvers/Resolver.sol\\\";\\nimport {ReverseRegistrar} from \\\"../registry/ReverseRegistrar.sol\\\";\\nimport {IETHRegistrarController, IPriceOracle} from \\\"./IETHRegistrarController.sol\\\";\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {INameWrapper} from \\\"../wrapper/INameWrapper.sol\\\";\\nimport {ERC20Recoverable} from \\\"../utils/ERC20Recoverable.sol\\\";\\n\\nerror CommitmentTooNew(bytes32 commitment);\\nerror CommitmentTooOld(bytes32 commitment);\\nerror NameNotAvailable(string name);\\nerror DurationTooShort(uint256 duration);\\nerror ResolverRequiredWhenDataSupplied();\\nerror UnexpiredCommitmentExists(bytes32 commitment);\\nerror InsufficientValue();\\nerror Unauthorised(bytes32 node);\\nerror MaxCommitmentAgeTooLow();\\nerror MaxCommitmentAgeTooHigh();\\n\\n/**\\n * @dev A registrar controller for registering and renewing names at fixed cost.\\n */\\ncontract ETHRegistrarController is\\n Ownable,\\n IETHRegistrarController,\\n IERC165,\\n ERC20Recoverable\\n{\\n using StringUtils for *;\\n using Address for address;\\n\\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\\n bytes32 private constant ETH_NODE =\\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\\n uint64 private constant MAX_EXPIRY = type(uint64).max;\\n BaseRegistrarImplementation immutable base;\\n IPriceOracle public immutable prices;\\n uint256 public immutable minCommitmentAge;\\n uint256 public immutable maxCommitmentAge;\\n ReverseRegistrar public immutable reverseRegistrar;\\n INameWrapper public immutable nameWrapper;\\n\\n mapping(bytes32 => uint256) public commitments;\\n\\n event NameRegistered(\\n string name,\\n bytes32 indexed label,\\n address indexed owner,\\n uint256 baseCost,\\n uint256 premium,\\n uint256 expires\\n );\\n event NameRenewed(\\n string name,\\n bytes32 indexed label,\\n uint256 cost,\\n uint256 expires\\n );\\n\\n constructor(\\n BaseRegistrarImplementation _base,\\n IPriceOracle _prices,\\n uint256 _minCommitmentAge,\\n uint256 _maxCommitmentAge,\\n ReverseRegistrar _reverseRegistrar,\\n INameWrapper _nameWrapper\\n ) {\\n if (_maxCommitmentAge <= _minCommitmentAge) {\\n revert MaxCommitmentAgeTooLow();\\n }\\n\\n if (_maxCommitmentAge > block.timestamp) {\\n revert MaxCommitmentAgeTooHigh();\\n }\\n\\n base = _base;\\n prices = _prices;\\n minCommitmentAge = _minCommitmentAge;\\n maxCommitmentAge = _maxCommitmentAge;\\n reverseRegistrar = _reverseRegistrar;\\n nameWrapper = _nameWrapper;\\n }\\n\\n function rentPrice(\\n string memory name,\\n uint256 duration\\n ) public view override returns (IPriceOracle.Price memory price) {\\n bytes32 label = keccak256(bytes(name));\\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\\n }\\n\\n function valid(string memory name) public pure returns (bool) {\\n return name.strlen() >= 3;\\n }\\n\\n function available(string memory name) public view override returns (bool) {\\n bytes32 label = keccak256(bytes(name));\\n return valid(name) && base.available(uint256(label));\\n }\\n\\n function makeCommitment(\\n string memory name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] calldata data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses\\n ) public pure override returns (bytes32) {\\n bytes32 label = keccak256(bytes(name));\\n if (data.length > 0 && resolver == address(0)) {\\n revert ResolverRequiredWhenDataSupplied();\\n }\\n return\\n keccak256(\\n abi.encode(\\n label,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses\\n )\\n );\\n }\\n\\n function commit(bytes32 commitment) public override {\\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\\n revert UnexpiredCommitmentExists(commitment);\\n }\\n commitments[commitment] = block.timestamp;\\n }\\n\\n function register(\\n string calldata name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] calldata data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses\\n ) public payable override {\\n IPriceOracle.Price memory price = rentPrice(name, duration);\\n if (msg.value < price.base + price.premium) {\\n revert InsufficientValue();\\n }\\n\\n _consumeCommitment(\\n name,\\n duration,\\n makeCommitment(\\n name,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses\\n )\\n );\\n\\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\\n name,\\n owner,\\n duration,\\n resolver,\\n ownerControlledFuses\\n );\\n\\n if (data.length > 0) {\\n _setRecords(resolver, keccak256(bytes(name)), data);\\n }\\n\\n if (reverseRecord) {\\n _setReverseRecord(name, resolver, msg.sender);\\n }\\n\\n emit NameRegistered(\\n name,\\n keccak256(bytes(name)),\\n owner,\\n price.base,\\n price.premium,\\n expires\\n );\\n\\n if (msg.value > (price.base + price.premium)) {\\n payable(msg.sender).transfer(\\n msg.value - (price.base + price.premium)\\n );\\n }\\n }\\n\\n function renew(\\n string calldata name,\\n uint256 duration\\n ) external payable override {\\n bytes32 labelhash = keccak256(bytes(name));\\n uint256 tokenId = uint256(labelhash);\\n IPriceOracle.Price memory price = rentPrice(name, duration);\\n if (msg.value < price.base) {\\n revert InsufficientValue();\\n }\\n uint256 expires = nameWrapper.renew(tokenId, duration);\\n\\n if (msg.value > price.base) {\\n payable(msg.sender).transfer(msg.value - price.base);\\n }\\n\\n emit NameRenewed(name, labelhash, msg.value, expires);\\n }\\n\\n function withdraw() public {\\n payable(owner()).transfer(address(this).balance);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IETHRegistrarController).interfaceId;\\n }\\n\\n /* Internal functions */\\n\\n function _consumeCommitment(\\n string memory name,\\n uint256 duration,\\n bytes32 commitment\\n ) internal {\\n // Require an old enough commitment.\\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\\n revert CommitmentTooNew(commitment);\\n }\\n\\n // If the commitment is too old, or the name is registered, stop\\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\\n revert CommitmentTooOld(commitment);\\n }\\n if (!available(name)) {\\n revert NameNotAvailable(name);\\n }\\n\\n delete (commitments[commitment]);\\n\\n if (duration < MIN_REGISTRATION_DURATION) {\\n revert DurationTooShort(duration);\\n }\\n }\\n\\n function _setRecords(\\n address resolverAddress,\\n bytes32 label,\\n bytes[] calldata data\\n ) internal {\\n // use hardcoded .eth namehash\\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\\n Resolver resolver = Resolver(resolverAddress);\\n resolver.multicallWithNodeCheck(nodehash, data);\\n }\\n\\n function _setReverseRecord(\\n string memory name,\\n address resolver,\\n address owner\\n ) internal {\\n reverseRegistrar.setNameForAddr(\\n msg.sender,\\n owner,\\n resolver,\\n string.concat(name, \\\".eth\\\")\\n );\\n }\\n}\\n\",\"keccak256\":\"0x358e04afce83d8321092efebbf41ed09391a9d807a9b247b1a6877d1893c4ab7\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x9ac51351ff72d73083aed62b7cdad4c07e9d1eb68401d7fd8457bdd828f2c6fe\"},\"contracts/ethregistrar/IETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./IPriceOracle.sol\\\";\\n\\ninterface IETHRegistrarController {\\n function rentPrice(\\n string memory,\\n uint256\\n ) external view returns (IPriceOracle.Price memory);\\n\\n function available(string memory) external returns (bool);\\n\\n function makeCommitment(\\n string memory,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16\\n ) external pure returns (bytes32);\\n\\n function commit(bytes32) external;\\n\\n function register(\\n string calldata,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16\\n ) external payable;\\n\\n function renew(string calldata, uint256) external payable;\\n}\\n\",\"keccak256\":\"0x54575cc2e4245c0ba79e42a58086335ec0522f4cbeb8c92d71b886593c97060e\",\"license\":\"MIT\"},\"contracts/ethregistrar/IPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\ninterface IPriceOracle {\\n struct Price {\\n uint256 base;\\n uint256 premium;\\n }\\n\\n /**\\n * @dev Returns the price to register or renew a name.\\n * @param name The name being registered or renewed.\\n * @param expires When the name presently expires (0 if this is a new registration).\\n * @param duration How long the name is being registered or extended for, in seconds.\\n * @return base premium tuple of base price + premium price\\n */\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (Price calldata);\\n}\\n\",\"keccak256\":\"0x1ec537b4c7f9cc40363b39dcc7ade8c29bf94662e6b01d38e681487637bd577e\",\"license\":\"MIT\"},\"contracts/ethregistrar/StringUtils.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary StringUtils {\\n /**\\n * @dev Returns the length of a given string\\n *\\n * @param s The string to measure the length of\\n * @return The length of the input string\\n */\\n function strlen(string memory s) internal pure returns (uint256) {\\n uint256 len;\\n uint256 i = 0;\\n uint256 bytelength = bytes(s).length;\\n for (len = 0; i < bytelength; len++) {\\n bytes1 b = bytes(s)[i];\\n if (b < 0x80) {\\n i += 1;\\n } else if (b < 0xE0) {\\n i += 2;\\n } else if (b < 0xF0) {\\n i += 3;\\n } else if (b < 0xF8) {\\n i += 4;\\n } else if (b < 0xFC) {\\n i += 5;\\n } else {\\n i += 6;\\n }\\n }\\n return len;\\n }\\n}\\n\",\"keccak256\":\"0x4cc8363a850dc9130c433ee50e7c97e29a45ae5d9bd0808205ac7134b34f24e4\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/registry/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/registry/ReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"./ENS.sol\\\";\\nimport \\\"./IReverseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"../root/Controllable.sol\\\";\\n\\nabstract contract NameResolver {\\n function setName(bytes32 node, string memory name) public virtual;\\n}\\n\\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\\n\\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n// namehash('addr.reverse')\\n\\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\\n ENS public immutable ens;\\n NameResolver public defaultResolver;\\n\\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\\n event DefaultResolverChanged(NameResolver indexed resolver);\\n\\n /**\\n * @dev Constructor\\n * @param ensAddr The address of the ENS registry.\\n */\\n constructor(ENS ensAddr) {\\n ens = ensAddr;\\n\\n // Assign ownership of the reverse record to our deployer\\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\\n ensAddr.owner(ADDR_REVERSE_NODE)\\n );\\n if (address(oldRegistrar) != address(0x0)) {\\n oldRegistrar.claim(msg.sender);\\n }\\n }\\n\\n modifier authorised(address addr) {\\n require(\\n addr == msg.sender ||\\n controllers[msg.sender] ||\\n ens.isApprovedForAll(addr, msg.sender) ||\\n ownsContract(addr),\\n \\\"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\\\"\\n );\\n _;\\n }\\n\\n function setDefaultResolver(address resolver) public override onlyOwner {\\n require(\\n address(resolver) != address(0),\\n \\\"ReverseRegistrar: Resolver address must not be 0\\\"\\n );\\n defaultResolver = NameResolver(resolver);\\n emit DefaultResolverChanged(NameResolver(resolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claim(address owner) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, address(defaultResolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param addr The reverse record to set\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The resolver of the reverse node\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) public override authorised(addr) returns (bytes32) {\\n bytes32 labelHash = sha3HexAddress(addr);\\n bytes32 reverseNode = keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\\n );\\n emit ReverseClaimed(addr, reverseNode);\\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\\n return reverseNode;\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, resolver);\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the calling account. First updates the resolver to the default reverse\\n * resolver if necessary.\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setName(string memory name) public override returns (bytes32) {\\n return\\n setNameForAddr(\\n msg.sender,\\n msg.sender,\\n address(defaultResolver),\\n name\\n );\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the account provided. Updates the resolver to a designated resolver\\n * Only callable by controllers and authorised users\\n * @param addr The reverse record to set\\n * @param owner The owner of the reverse node\\n * @param resolver The resolver of the reverse node\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) public override returns (bytes32) {\\n bytes32 node = claimForAddr(addr, owner, resolver);\\n NameResolver(resolver).setName(node, name);\\n return node;\\n }\\n\\n /**\\n * @dev Returns the node hash for a given account's reverse records.\\n * @param addr The address to hash\\n * @return The ENS node hash.\\n */\\n function node(address addr) public pure override returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\\n );\\n }\\n\\n /**\\n * @dev An optimised function to compute the sha3 of the lower-case\\n * hexadecimal representation of an Ethereum address.\\n * @param addr The address to hash\\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\\n * input address.\\n */\\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\\n assembly {\\n for {\\n let i := 40\\n } gt(i, 0) {\\n\\n } {\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n }\\n\\n ret := keccak256(0, 40)\\n }\\n }\\n\\n function ownsContract(address addr) internal view returns (bool) {\\n try Ownable(addr).owner() returns (address owner) {\\n return owner == msg.sender;\\n } catch {\\n return false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6c79056e7f564409e834619de2cf0511321dcbcf90b9f68d8ffed50fab070791\"},\"contracts/resolvers/Resolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"./profiles/IABIResolver.sol\\\";\\nimport \\\"./profiles/IAddressResolver.sol\\\";\\nimport \\\"./profiles/IAddrResolver.sol\\\";\\nimport \\\"./profiles/IContentHashResolver.sol\\\";\\nimport \\\"./profiles/IDNSRecordResolver.sol\\\";\\nimport \\\"./profiles/IDNSZoneResolver.sol\\\";\\nimport \\\"./profiles/IInterfaceResolver.sol\\\";\\nimport \\\"./profiles/INameResolver.sol\\\";\\nimport \\\"./profiles/IPubkeyResolver.sol\\\";\\nimport \\\"./profiles/ITextResolver.sol\\\";\\nimport \\\"./profiles/IExtendedResolver.sol\\\";\\n\\n/**\\n * A generic resolver interface which includes all the functions including the ones deprecated\\n */\\ninterface Resolver is\\n IERC165,\\n IABIResolver,\\n IAddressResolver,\\n IAddrResolver,\\n IContentHashResolver,\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n IInterfaceResolver,\\n INameResolver,\\n IPubkeyResolver,\\n ITextResolver,\\n IExtendedResolver\\n{\\n /* Deprecated events */\\n event ContentChanged(bytes32 indexed node, bytes32 hash);\\n\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external;\\n\\n function setAddr(bytes32 node, address addr) external;\\n\\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\\n\\n function setContenthash(bytes32 node, bytes calldata hash) external;\\n\\n function setDnsrr(bytes32 node, bytes calldata data) external;\\n\\n function setName(bytes32 node, string calldata _name) external;\\n\\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\\n\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external;\\n\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external;\\n\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n /* Deprecated functions */\\n function content(bytes32 node) external view returns (bytes32);\\n\\n function multihash(bytes32 node) external view returns (bytes memory);\\n\\n function setContent(bytes32 node, bytes32 hash) external;\\n\\n function setMultihash(bytes32 node, bytes calldata hash) external;\\n}\\n\",\"keccak256\":\"0x62b71222aa65138e124b94f5835c2163cc88213491e5f0a80d7a4c45641fbe64\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"},\"contracts/utils/ERC20Recoverable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\\n */\\n\\ncontract ERC20Recoverable is Ownable {\\n /**\\n @notice Recover ERC20 tokens sent to the contract by mistake.\\n @dev The contract is Ownable and only the owner can call the recover function.\\n @param _to The address to send the tokens to.\\n@param _token The address of the ERC20 token to recover\\n @param _amount The amount of tokens to recover.\\n */\\n function recoverFunds(\\n address _token,\\n address _to,\\n uint256 _amount\\n ) external onlyOwner {\\n IERC20(_token).transfer(_to, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x793a38091e1f81499a29ddba82c2b2f3cdd07071b81a832886e8e02a45ff352a\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_ETH = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x70310eb67146d7290731c31841399640ac3b6a949eadc6598bc150123d185c57\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101406040523480156200001257600080fd5b5060405162001ff038038062001ff083398101604081905262000035916200011a565b6200004033620000b1565b83831162000061576040516307cb550760e31b815260040160405180910390fd5b428311156200008357604051630b4319e560e21b815260040160405180910390fd5b6001600160a01b0395861660805293851660a05260c09290925260e052821661010052166101205262000197565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200011757600080fd5b50565b60008060008060008060c087890312156200013457600080fd5b8651620001418162000101565b6020880151909650620001548162000101565b8095505060408701519350606087015192506080870151620001768162000101565b60a0880151909250620001898162000101565b809150509295509295509295565b60805160a05160c05160e0516101005161012051611dd16200021f60003960008181610375015281816107e00152610bd501526000818161023801526111e00152600081816103dc01528181610db301526110070152600081816103030152610f9001526000818161041001526109fa015260008181610a2f0152610d220152611dd16000f3fe60806040526004361061015f5760003560e01c80638d839ffe116100c0578063aeb8ce9b11610074578063d3419bf311610059578063d3419bf3146103fe578063f14fcbc814610432578063f2fde38b1461045257600080fd5b8063aeb8ce9b146103aa578063ce1e09c0146103ca57600080fd5b80639791c097116100a55780639791c09714610343578063a8e5fbc014610363578063acf1a8411461039757600080fd5b80638d839ffe146102f15780638da5cb5b1461032557600080fd5b806374694a2b11610117578063839df945116100fc578063839df9451461027257806383e7f6ff1461029f5780638a95b09f146102da57600080fd5b806374694a2b14610213578063808698531461022657600080fd5b80635d3590d5116101485780635d3590d5146101b057806365a69dcf146101d0578063715018a6146101fe57600080fd5b806301ffc9a7146101645780633ccfd60b14610199575b600080fd5b34801561017057600080fd5b5061018461017f366004611421565b610472565b60405190151581526020015b60405180910390f35b3480156101a557600080fd5b506101ae61050b565b005b3480156101bc57600080fd5b506101ae6101cb36600461147f565b610548565b3480156101dc57600080fd5b506101f06101eb3660046115ec565b6105e2565b604051908152602001610190565b34801561020a57600080fd5b506101ae610680565b6101ae6102213660046116ef565b610694565b34801561023257600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610190565b34801561027e57600080fd5b506101f061028d3660046117b9565b60016020526000908152604090205481565b3480156102ab57600080fd5b506102bf6102ba3660046117d2565b6109b0565b60408051825181526020928301519281019290925201610190565b3480156102e657600080fd5b506101f06224ea0081565b3480156102fd57600080fd5b506101f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561033157600080fd5b506000546001600160a01b031661025a565b34801561034f57600080fd5b5061018461035e366004611817565b610b03565b34801561036f57600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b6101ae6103a536600461184c565b610b18565b3480156103b657600080fd5b506101846103c5366004611817565b610cd9565b3480156103d657600080fd5b506101f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561040a57600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b34801561043e57600080fd5b506101ae61044d3660046117b9565b610d9c565b34801561045e57600080fd5b506101ae61046d366004611898565b610e2a565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061050557507fffffffff0000000000000000000000000000000000000000000000000000000082167f612e8c0900000000000000000000000000000000000000000000000000000000145b92915050565b600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015610545573d6000803e3d6000fd5b50565b610550610eb7565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af11580156105b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dc91906118b3565b50505050565b885160208a0120600090841580159061060257506001600160a01b038716155b15610639576040517fd3f605c400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808a8a8a8a8a8a8a8a60405160200161065a9998979695949392919061198b565b604051602081830303815290604052805190602001209150509998505050505050505050565b610688610eb7565b6106926000610f11565b565b60006106d78b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92506109b0915050565b602081015181519192506106ea91611a03565b34101561070a5760405163044044a560e21b815260040160405180910390fd5b6107ad8b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050896107a88e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d8d8d8d8d8d8d8d6105e2565b610f79565b6040517fa40149820000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a40149829061081f908f908f908f908f908e908b90600401611a16565b6020604051808303816000875af115801561083e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108629190611a60565b9050841561088d5761088d878d8d60405161087e929190611a79565b604051809103902088886110fb565b83156108d6576108d68c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508b92503391506111de9050565b896001600160a01b03168c8c6040516108f0929190611a79565b60405180910390207f69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf278e8e8660000151876020015187604051610937959493929190611a89565b60405180910390a3602082015182516109509190611a03565b3411156109a2576020820151825133916108fc9161096e9190611a03565b6109789034611aba565b6040518115909202916000818181858888f193505050501580156109a0573d6000803e3d6000fd5b505b505050505050505050505050565b6040805180820190915260008082526020820152825160208401206040517fd6e4fa86000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03908116916350e9a7159187917f00000000000000000000000000000000000000000000000000000000000000009091169063d6e4fa8690602401602060405180830381865afa158015610a78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9c9190611a60565b866040518463ffffffff1660e01b8152600401610abb93929190611b1d565b6040805180830381865afa158015610ad7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afb9190611b42565b949350505050565b60006003610b1083611292565b101592915050565b60008383604051610b2a929190611a79565b604080519182900382206020601f870181900481028401810190925285835292508291600091610b77919088908890819084018382808284376000920191909152508892506109b0915050565b8051909150341015610b9c5760405163044044a560e21b815260040160405180910390fd5b6040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101839052602481018590526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c475abff906044016020604051808303816000875af1158015610c26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4a9190611a60565b8251909150341115610c9257815133906108fc90610c689034611aba565b6040518115909202916000818181858888f19350505050158015610c90573d6000803e3d6000fd5b505b837f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae88883485604051610cc89493929190611b91565b60405180910390a250505050505050565b80516020820120600090610cec83610b03565b8015610d9557506040517f96e494e8000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906396e494e890602401602060405180830381865afa158015610d71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9591906118b3565b9392505050565b6000818152600160205260409020544290610dd8907f000000000000000000000000000000000000000000000000000000000000000090611a03565b10610e17576040517f0a059d71000000000000000000000000000000000000000000000000000000008152600481018290526024015b60405180910390fd5b6000908152600160205260409020429055565b610e32610eb7565b6001600160a01b038116610eae5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610e0e565b61054581610f11565b6000546001600160a01b031633146106925760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610e0e565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000818152600160205260409020544290610fb5907f000000000000000000000000000000000000000000000000000000000000000090611a03565b1115610ff0576040517f5320bcf900000000000000000000000000000000000000000000000000000000815260048101829052602401610e0e565b600081815260016020526040902054429061102c907f000000000000000000000000000000000000000000000000000000000000000090611a03565b11611066576040517fcb7690d700000000000000000000000000000000000000000000000000000000815260048101829052602401610e0e565b61106f83610cd9565b6110a757826040517f477707e8000000000000000000000000000000000000000000000000000000008152600401610e0e9190611bb8565b6000818152600160205260408120556224ea008210156110f6576040517f9a71997b00000000000000000000000000000000000000000000000000000000815260048101839052602401610e0e565b505050565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301869052825180830384018152606083019384905280519101207fe32954eb0000000000000000000000000000000000000000000000000000000090925285906001600160a01b0382169063e32954eb9061118e90859088908890606401611bcb565b6000604051808303816000875af11580156111ad573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111d59190810190611bee565b50505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637a806d6b338385876040516020016112219190611ced565b6040516020818303038152906040526040518563ffffffff1660e01b815260040161124f9493929190611d2e565b6020604051808303816000875af115801561126e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dc9190611a60565b8051600090819081905b808210156114185760008583815181106112b8576112b8611d6c565b01602001516001600160f81b03191690507f8000000000000000000000000000000000000000000000000000000000000000811015611303576112fc600184611a03565b9250611405565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015611340576112fc600284611a03565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561137d576112fc600384611a03565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156113ba576112fc600484611a03565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156113f7576112fc600584611a03565b611402600684611a03565b92505b508261141081611d82565b93505061129c565b50909392505050565b60006020828403121561143357600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610d9557600080fd5b80356001600160a01b038116811461147a57600080fd5b919050565b60008060006060848603121561149457600080fd5b61149d84611463565b92506114ab60208501611463565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156114fa576114fa6114bb565b604052919050565b600067ffffffffffffffff82111561151c5761151c6114bb565b50601f01601f191660200190565b600082601f83011261153b57600080fd5b813561154e61154982611502565b6114d1565b81815284602083860101111561156357600080fd5b816020850160208301376000918101602001919091529392505050565b60008083601f84011261159257600080fd5b50813567ffffffffffffffff8111156115aa57600080fd5b6020830191508360208260051b85010111156115c557600080fd5b9250929050565b801515811461054557600080fd5b803561ffff8116811461147a57600080fd5b60008060008060008060008060006101008a8c03121561160b57600080fd5b893567ffffffffffffffff8082111561162357600080fd5b61162f8d838e0161152a565b9a5061163d60208d01611463565b995060408c0135985060608c0135975061165960808d01611463565b965060a08c013591508082111561166f57600080fd5b5061167c8c828d01611580565b90955093505060c08a0135611690816115cc565b915061169e60e08b016115da565b90509295985092959850929598565b60008083601f8401126116bf57600080fd5b50813567ffffffffffffffff8111156116d757600080fd5b6020830191508360208285010111156115c557600080fd5b6000806000806000806000806000806101008b8d03121561170f57600080fd5b8a3567ffffffffffffffff8082111561172757600080fd5b6117338e838f016116ad565b909c509a508a915061174760208e01611463565b995060408d0135985060608d0135975061176360808e01611463565b965060a08d013591508082111561177957600080fd5b506117868d828e01611580565b90955093505060c08b013561179a816115cc565b91506117a860e08c016115da565b90509295989b9194979a5092959850565b6000602082840312156117cb57600080fd5b5035919050565b600080604083850312156117e557600080fd5b823567ffffffffffffffff8111156117fc57600080fd5b6118088582860161152a565b95602094909401359450505050565b60006020828403121561182957600080fd5b813567ffffffffffffffff81111561184057600080fd5b610afb8482850161152a565b60008060006040848603121561186157600080fd5b833567ffffffffffffffff81111561187857600080fd5b611884868287016116ad565b909790965060209590950135949350505050565b6000602082840312156118aa57600080fd5b610d9582611463565b6000602082840312156118c557600080fd5b8151610d95816115cc565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b81835260006020808501808196508560051b810191508460005b8781101561197e5782840389528135601e1988360301811261193457600080fd5b8701858101903567ffffffffffffffff81111561195057600080fd5b80360382131561195f57600080fd5b61196a8682846118d0565b9a87019a9550505090840190600101611913565b5091979650505050505050565b60006101008b83526001600160a01b03808c1660208501528a60408501528960608501528089166080850152508060a08401526119cb81840187896118f9565b94151560c0840152505061ffff9190911660e090910152979650505050505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610505576105056119ed565b60a081526000611a2a60a08301888a6118d0565b90506001600160a01b03808716602084015285604084015280851660608401525061ffff83166080830152979650505050505050565b600060208284031215611a7257600080fd5b5051919050565b8183823760009101908152919050565b608081526000611a9d6080830187896118d0565b602083019590955250604081019290925260609091015292915050565b81810381811115610505576105056119ed565b60005b83811015611ae8578181015183820152602001611ad0565b50506000910152565b60008151808452611b09816020860160208601611acd565b601f01601f19169290920160200192915050565b606081526000611b306060830186611af1565b60208301949094525060400152919050565b600060408284031215611b5457600080fd5b6040516040810181811067ffffffffffffffff82111715611b7757611b776114bb565b604052825181526020928301519281019290925250919050565b606081526000611ba56060830186886118d0565b6020830194909452506040015292915050565b602081526000610d956020830184611af1565b838152604060208201526000611be56040830184866118f9565b95945050505050565b60006020808385031215611c0157600080fd5b825167ffffffffffffffff80821115611c1957600080fd5b818501915085601f830112611c2d57600080fd5b815181811115611c3f57611c3f6114bb565b8060051b611c4e8582016114d1565b9182528381018501918581019089841115611c6857600080fd5b86860192505b83831015611ce057825185811115611c865760008081fd5b8601603f81018b13611c985760008081fd5b878101516040611caa61154983611502565b8281528d82848601011115611cbf5760008081fd5b611cce838c8301848701611acd565b85525050509186019190860190611c6e565b9998505050505050505050565b60008251611cff818460208701611acd565b7f2e65746800000000000000000000000000000000000000000000000000000000920191825250600401919050565b60006001600160a01b038087168352808616602084015280851660408401525060806060830152611d626080830184611af1565b9695505050505050565b634e487b7160e01b600052603260045260246000fd5b600060018201611d9457611d946119ed565b506001019056fea26469706673582212206c183c1880fc176dc29d4d238b4b4ab82a0b356482423471678ab9fe901805d964736f6c63430008110033", + "deployedBytecode": "0x60806040526004361061015f5760003560e01c80638d839ffe116100c0578063aeb8ce9b11610074578063d3419bf311610059578063d3419bf3146103fe578063f14fcbc814610432578063f2fde38b1461045257600080fd5b8063aeb8ce9b146103aa578063ce1e09c0146103ca57600080fd5b80639791c097116100a55780639791c09714610343578063a8e5fbc014610363578063acf1a8411461039757600080fd5b80638d839ffe146102f15780638da5cb5b1461032557600080fd5b806374694a2b11610117578063839df945116100fc578063839df9451461027257806383e7f6ff1461029f5780638a95b09f146102da57600080fd5b806374694a2b14610213578063808698531461022657600080fd5b80635d3590d5116101485780635d3590d5146101b057806365a69dcf146101d0578063715018a6146101fe57600080fd5b806301ffc9a7146101645780633ccfd60b14610199575b600080fd5b34801561017057600080fd5b5061018461017f366004611421565b610472565b60405190151581526020015b60405180910390f35b3480156101a557600080fd5b506101ae61050b565b005b3480156101bc57600080fd5b506101ae6101cb36600461147f565b610548565b3480156101dc57600080fd5b506101f06101eb3660046115ec565b6105e2565b604051908152602001610190565b34801561020a57600080fd5b506101ae610680565b6101ae6102213660046116ef565b610694565b34801561023257600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610190565b34801561027e57600080fd5b506101f061028d3660046117b9565b60016020526000908152604090205481565b3480156102ab57600080fd5b506102bf6102ba3660046117d2565b6109b0565b60408051825181526020928301519281019290925201610190565b3480156102e657600080fd5b506101f06224ea0081565b3480156102fd57600080fd5b506101f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561033157600080fd5b506000546001600160a01b031661025a565b34801561034f57600080fd5b5061018461035e366004611817565b610b03565b34801561036f57600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b6101ae6103a536600461184c565b610b18565b3480156103b657600080fd5b506101846103c5366004611817565b610cd9565b3480156103d657600080fd5b506101f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561040a57600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b34801561043e57600080fd5b506101ae61044d3660046117b9565b610d9c565b34801561045e57600080fd5b506101ae61046d366004611898565b610e2a565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061050557507fffffffff0000000000000000000000000000000000000000000000000000000082167f612e8c0900000000000000000000000000000000000000000000000000000000145b92915050565b600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015610545573d6000803e3d6000fd5b50565b610550610eb7565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af11580156105b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dc91906118b3565b50505050565b885160208a0120600090841580159061060257506001600160a01b038716155b15610639576040517fd3f605c400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808a8a8a8a8a8a8a8a60405160200161065a9998979695949392919061198b565b604051602081830303815290604052805190602001209150509998505050505050505050565b610688610eb7565b6106926000610f11565b565b60006106d78b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92506109b0915050565b602081015181519192506106ea91611a03565b34101561070a5760405163044044a560e21b815260040160405180910390fd5b6107ad8b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050896107a88e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d8d8d8d8d8d8d8d6105e2565b610f79565b6040517fa40149820000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a40149829061081f908f908f908f908f908e908b90600401611a16565b6020604051808303816000875af115801561083e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108629190611a60565b9050841561088d5761088d878d8d60405161087e929190611a79565b604051809103902088886110fb565b83156108d6576108d68c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508b92503391506111de9050565b896001600160a01b03168c8c6040516108f0929190611a79565b60405180910390207f69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf278e8e8660000151876020015187604051610937959493929190611a89565b60405180910390a3602082015182516109509190611a03565b3411156109a2576020820151825133916108fc9161096e9190611a03565b6109789034611aba565b6040518115909202916000818181858888f193505050501580156109a0573d6000803e3d6000fd5b505b505050505050505050505050565b6040805180820190915260008082526020820152825160208401206040517fd6e4fa86000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03908116916350e9a7159187917f00000000000000000000000000000000000000000000000000000000000000009091169063d6e4fa8690602401602060405180830381865afa158015610a78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9c9190611a60565b866040518463ffffffff1660e01b8152600401610abb93929190611b1d565b6040805180830381865afa158015610ad7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afb9190611b42565b949350505050565b60006003610b1083611292565b101592915050565b60008383604051610b2a929190611a79565b604080519182900382206020601f870181900481028401810190925285835292508291600091610b77919088908890819084018382808284376000920191909152508892506109b0915050565b8051909150341015610b9c5760405163044044a560e21b815260040160405180910390fd5b6040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101839052602481018590526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c475abff906044016020604051808303816000875af1158015610c26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4a9190611a60565b8251909150341115610c9257815133906108fc90610c689034611aba565b6040518115909202916000818181858888f19350505050158015610c90573d6000803e3d6000fd5b505b837f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae88883485604051610cc89493929190611b91565b60405180910390a250505050505050565b80516020820120600090610cec83610b03565b8015610d9557506040517f96e494e8000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906396e494e890602401602060405180830381865afa158015610d71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9591906118b3565b9392505050565b6000818152600160205260409020544290610dd8907f000000000000000000000000000000000000000000000000000000000000000090611a03565b10610e17576040517f0a059d71000000000000000000000000000000000000000000000000000000008152600481018290526024015b60405180910390fd5b6000908152600160205260409020429055565b610e32610eb7565b6001600160a01b038116610eae5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610e0e565b61054581610f11565b6000546001600160a01b031633146106925760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610e0e565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000818152600160205260409020544290610fb5907f000000000000000000000000000000000000000000000000000000000000000090611a03565b1115610ff0576040517f5320bcf900000000000000000000000000000000000000000000000000000000815260048101829052602401610e0e565b600081815260016020526040902054429061102c907f000000000000000000000000000000000000000000000000000000000000000090611a03565b11611066576040517fcb7690d700000000000000000000000000000000000000000000000000000000815260048101829052602401610e0e565b61106f83610cd9565b6110a757826040517f477707e8000000000000000000000000000000000000000000000000000000008152600401610e0e9190611bb8565b6000818152600160205260408120556224ea008210156110f6576040517f9a71997b00000000000000000000000000000000000000000000000000000000815260048101839052602401610e0e565b505050565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301869052825180830384018152606083019384905280519101207fe32954eb0000000000000000000000000000000000000000000000000000000090925285906001600160a01b0382169063e32954eb9061118e90859088908890606401611bcb565b6000604051808303816000875af11580156111ad573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111d59190810190611bee565b50505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637a806d6b338385876040516020016112219190611ced565b6040516020818303038152906040526040518563ffffffff1660e01b815260040161124f9493929190611d2e565b6020604051808303816000875af115801561126e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dc9190611a60565b8051600090819081905b808210156114185760008583815181106112b8576112b8611d6c565b01602001516001600160f81b03191690507f8000000000000000000000000000000000000000000000000000000000000000811015611303576112fc600184611a03565b9250611405565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015611340576112fc600284611a03565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561137d576112fc600384611a03565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156113ba576112fc600484611a03565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156113f7576112fc600584611a03565b611402600684611a03565b92505b508261141081611d82565b93505061129c565b50909392505050565b60006020828403121561143357600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610d9557600080fd5b80356001600160a01b038116811461147a57600080fd5b919050565b60008060006060848603121561149457600080fd5b61149d84611463565b92506114ab60208501611463565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156114fa576114fa6114bb565b604052919050565b600067ffffffffffffffff82111561151c5761151c6114bb565b50601f01601f191660200190565b600082601f83011261153b57600080fd5b813561154e61154982611502565b6114d1565b81815284602083860101111561156357600080fd5b816020850160208301376000918101602001919091529392505050565b60008083601f84011261159257600080fd5b50813567ffffffffffffffff8111156115aa57600080fd5b6020830191508360208260051b85010111156115c557600080fd5b9250929050565b801515811461054557600080fd5b803561ffff8116811461147a57600080fd5b60008060008060008060008060006101008a8c03121561160b57600080fd5b893567ffffffffffffffff8082111561162357600080fd5b61162f8d838e0161152a565b9a5061163d60208d01611463565b995060408c0135985060608c0135975061165960808d01611463565b965060a08c013591508082111561166f57600080fd5b5061167c8c828d01611580565b90955093505060c08a0135611690816115cc565b915061169e60e08b016115da565b90509295985092959850929598565b60008083601f8401126116bf57600080fd5b50813567ffffffffffffffff8111156116d757600080fd5b6020830191508360208285010111156115c557600080fd5b6000806000806000806000806000806101008b8d03121561170f57600080fd5b8a3567ffffffffffffffff8082111561172757600080fd5b6117338e838f016116ad565b909c509a508a915061174760208e01611463565b995060408d0135985060608d0135975061176360808e01611463565b965060a08d013591508082111561177957600080fd5b506117868d828e01611580565b90955093505060c08b013561179a816115cc565b91506117a860e08c016115da565b90509295989b9194979a5092959850565b6000602082840312156117cb57600080fd5b5035919050565b600080604083850312156117e557600080fd5b823567ffffffffffffffff8111156117fc57600080fd5b6118088582860161152a565b95602094909401359450505050565b60006020828403121561182957600080fd5b813567ffffffffffffffff81111561184057600080fd5b610afb8482850161152a565b60008060006040848603121561186157600080fd5b833567ffffffffffffffff81111561187857600080fd5b611884868287016116ad565b909790965060209590950135949350505050565b6000602082840312156118aa57600080fd5b610d9582611463565b6000602082840312156118c557600080fd5b8151610d95816115cc565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b81835260006020808501808196508560051b810191508460005b8781101561197e5782840389528135601e1988360301811261193457600080fd5b8701858101903567ffffffffffffffff81111561195057600080fd5b80360382131561195f57600080fd5b61196a8682846118d0565b9a87019a9550505090840190600101611913565b5091979650505050505050565b60006101008b83526001600160a01b03808c1660208501528a60408501528960608501528089166080850152508060a08401526119cb81840187896118f9565b94151560c0840152505061ffff9190911660e090910152979650505050505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610505576105056119ed565b60a081526000611a2a60a08301888a6118d0565b90506001600160a01b03808716602084015285604084015280851660608401525061ffff83166080830152979650505050505050565b600060208284031215611a7257600080fd5b5051919050565b8183823760009101908152919050565b608081526000611a9d6080830187896118d0565b602083019590955250604081019290925260609091015292915050565b81810381811115610505576105056119ed565b60005b83811015611ae8578181015183820152602001611ad0565b50506000910152565b60008151808452611b09816020860160208601611acd565b601f01601f19169290920160200192915050565b606081526000611b306060830186611af1565b60208301949094525060400152919050565b600060408284031215611b5457600080fd5b6040516040810181811067ffffffffffffffff82111715611b7757611b776114bb565b604052825181526020928301519281019290925250919050565b606081526000611ba56060830186886118d0565b6020830194909452506040015292915050565b602081526000610d956020830184611af1565b838152604060208201526000611be56040830184866118f9565b95945050505050565b60006020808385031215611c0157600080fd5b825167ffffffffffffffff80821115611c1957600080fd5b818501915085601f830112611c2d57600080fd5b815181811115611c3f57611c3f6114bb565b8060051b611c4e8582016114d1565b9182528381018501918581019089841115611c6857600080fd5b86860192505b83831015611ce057825185811115611c865760008081fd5b8601603f81018b13611c985760008081fd5b878101516040611caa61154983611502565b8281528d82848601011115611cbf5760008081fd5b611cce838c8301848701611acd565b85525050509186019190860190611c6e565b9998505050505050505050565b60008251611cff818460208701611acd565b7f2e65746800000000000000000000000000000000000000000000000000000000920191825250600401919050565b60006001600160a01b038087168352808616602084015280851660408401525060806060830152611d626080830184611af1565b9695505050505050565b634e487b7160e01b600052603260045260246000fd5b600060018201611d9457611d946119ed565b506001019056fea26469706673582212206c183c1880fc176dc29d4d238b4b4ab82a0b356482423471678ab9fe901805d964736f6c63430008110033", + "devdoc": { + "details": "A registrar controller for registering and renewing names at fixed cost.", + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "recoverFunds(address,address,uint256)": { + "details": "The contract is Ownable and only the owner can call the recover function.", + "params": { + "_amount": "The amount of tokens to recover.", + "_to": "The address to send the tokens to.", + "_token": "The address of the ERC20 token to recover" + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "recoverFunds(address,address,uint256)": { + "notice": "Recover ERC20 tokens sent to the contract by mistake." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 428, + "contract": "contracts/ethregistrar/ETHRegistrarController.sol:ETHRegistrarController", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 8602, + "contract": "contracts/ethregistrar/ETHRegistrarController.sol:ETHRegistrarController", + "label": "commitments", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_uint256)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_uint256)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/ExponentialPremiumPriceOracle.json b/solidity/dns-contracts/deployments/goerli/ExponentialPremiumPriceOracle.json new file mode 100644 index 0000000..16301b2 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/ExponentialPremiumPriceOracle.json @@ -0,0 +1,304 @@ +{ + "address": "0xE4354bCf22e3C6a6496C31901399D46FC4Ac6a61", + "abi": [ + { + "inputs": [ + { + "internalType": "contract AggregatorInterface", + "name": "_usdOracle", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "_rentPrices", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "_startPremium", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalDays", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256[]", + "name": "prices", + "type": "uint256[]" + } + ], + "name": "RentPriceChanged", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "startPremium", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "elapsed", + "type": "uint256" + } + ], + "name": "decayedPremium", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "premium", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "price", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "base", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "premium", + "type": "uint256" + } + ], + "internalType": "struct IPriceOracle.Price", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price1Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price2Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price3Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price4Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price5Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "usdOracle", + "outputs": [ + { + "internalType": "contract AggregatorInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x875c57db81ec6968656994c2bcda4c6fa6eb292e6c28462aa0a2fb76a40902ee", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0xE4354bCf22e3C6a6496C31901399D46FC4Ac6a61", + "transactionIndex": 67, + "gasUsed": "814592", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xa5ae1bd85492eeca244120f32f0a7a9a0621369cbc6777d219df6dd1f8c8e57c", + "transactionHash": "0x875c57db81ec6968656994c2bcda4c6fa6eb292e6c28462aa0a2fb76a40902ee", + "logs": [], + "blockNumber": 8586035, + "cumulativeGasUsed": "9774911", + "status": 1, + "byzantium": true + }, + "args": [ + "0x32e6c069d2C8Bec43157293929419A263ed7180D", + [ + 0, + 0, + "20294266869609", + "5073566717402", + "158548959919" + ], + "100000000000000000000000000", + 21 + ], + "numDeployments": 3, + "solcInputHash": "2813443d96b2eb882a21ada25755af03", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract AggregatorInterface\",\"name\":\"_usdOracle\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"_rentPrices\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_startPremium\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalDays\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"prices\",\"type\":\"uint256[]\"}],\"name\":\"RentPriceChanged\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"startPremium\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"elapsed\",\"type\":\"uint256\"}],\"name\":\"decayedPremium\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"premium\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"price\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"base\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"}],\"internalType\":\"struct IPriceOracle.Price\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price1Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price2Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price3Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price4Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price5Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"usdOracle\",\"outputs\":[{\"internalType\":\"contract AggregatorInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"decayedPremium(uint256,uint256)\":{\"details\":\"Returns the premium price at current time elapsed\",\"params\":{\"elapsed\":\"time past since expiry\",\"startPremium\":\"starting price\"}},\"premium(string,uint256,uint256)\":{\"details\":\"Returns the pricing premium in wei.\"},\"price(string,uint256,uint256)\":{\"details\":\"Returns the price to register or renew a name.\",\"params\":{\"duration\":\"How long the name is being registered or extended for, in seconds.\",\"expires\":\"When the name presently expires (0 if this is a new registration).\",\"name\":\"The name being registered or renewed.\"},\"returns\":{\"_0\":\"base premium tuple of base price + premium price\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/ExponentialPremiumPriceOracle.sol\":\"ExponentialPremiumPriceOracle\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1500},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/ethregistrar/ExponentialPremiumPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./StablePriceOracle.sol\\\";\\n\\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\\n uint256 constant GRACE_PERIOD = 90 days;\\n uint256 immutable startPremium;\\n uint256 immutable endValue;\\n\\n constructor(\\n AggregatorInterface _usdOracle,\\n uint256[] memory _rentPrices,\\n uint256 _startPremium,\\n uint256 totalDays\\n ) StablePriceOracle(_usdOracle, _rentPrices) {\\n startPremium = _startPremium;\\n endValue = _startPremium >> totalDays;\\n }\\n\\n uint256 constant PRECISION = 1e18;\\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\\n uint256 constant bit3 = 999957694548431104;\\n uint256 constant bit4 = 999915390886613504;\\n uint256 constant bit5 = 999830788931929088;\\n uint256 constant bit6 = 999661606496243712;\\n uint256 constant bit7 = 999323327502650752;\\n uint256 constant bit8 = 998647112890970240;\\n uint256 constant bit9 = 997296056085470080;\\n uint256 constant bit10 = 994599423483633152;\\n uint256 constant bit11 = 989228013193975424;\\n uint256 constant bit12 = 978572062087700096;\\n uint256 constant bit13 = 957603280698573696;\\n uint256 constant bit14 = 917004043204671232;\\n uint256 constant bit15 = 840896415253714560;\\n uint256 constant bit16 = 707106781186547584;\\n\\n /**\\n * @dev Returns the pricing premium in internal base units.\\n */\\n function _premium(\\n string memory,\\n uint256 expires,\\n uint256\\n ) internal view override returns (uint256) {\\n expires = expires + GRACE_PERIOD;\\n if (expires > block.timestamp) {\\n return 0;\\n }\\n\\n uint256 elapsed = block.timestamp - expires;\\n uint256 premium = decayedPremium(startPremium, elapsed);\\n if (premium >= endValue) {\\n return premium - endValue;\\n }\\n return 0;\\n }\\n\\n /**\\n * @dev Returns the premium price at current time elapsed\\n * @param startPremium starting price\\n * @param elapsed time past since expiry\\n */\\n function decayedPremium(\\n uint256 startPremium,\\n uint256 elapsed\\n ) public pure returns (uint256) {\\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\\n uint256 intDays = daysPast / PRECISION;\\n uint256 premium = startPremium >> intDays;\\n uint256 partDay = (daysPast - intDays * PRECISION);\\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\\n uint256 totalPremium = addFractionalPremium(fraction, premium);\\n return totalPremium;\\n }\\n\\n function addFractionalPremium(\\n uint256 fraction,\\n uint256 premium\\n ) internal pure returns (uint256) {\\n if (fraction & (1 << 0) != 0) {\\n premium = (premium * bit1) / PRECISION;\\n }\\n if (fraction & (1 << 1) != 0) {\\n premium = (premium * bit2) / PRECISION;\\n }\\n if (fraction & (1 << 2) != 0) {\\n premium = (premium * bit3) / PRECISION;\\n }\\n if (fraction & (1 << 3) != 0) {\\n premium = (premium * bit4) / PRECISION;\\n }\\n if (fraction & (1 << 4) != 0) {\\n premium = (premium * bit5) / PRECISION;\\n }\\n if (fraction & (1 << 5) != 0) {\\n premium = (premium * bit6) / PRECISION;\\n }\\n if (fraction & (1 << 6) != 0) {\\n premium = (premium * bit7) / PRECISION;\\n }\\n if (fraction & (1 << 7) != 0) {\\n premium = (premium * bit8) / PRECISION;\\n }\\n if (fraction & (1 << 8) != 0) {\\n premium = (premium * bit9) / PRECISION;\\n }\\n if (fraction & (1 << 9) != 0) {\\n premium = (premium * bit10) / PRECISION;\\n }\\n if (fraction & (1 << 10) != 0) {\\n premium = (premium * bit11) / PRECISION;\\n }\\n if (fraction & (1 << 11) != 0) {\\n premium = (premium * bit12) / PRECISION;\\n }\\n if (fraction & (1 << 12) != 0) {\\n premium = (premium * bit13) / PRECISION;\\n }\\n if (fraction & (1 << 13) != 0) {\\n premium = (premium * bit14) / PRECISION;\\n }\\n if (fraction & (1 << 14) != 0) {\\n premium = (premium * bit15) / PRECISION;\\n }\\n if (fraction & (1 << 15) != 0) {\\n premium = (premium * bit16) / PRECISION;\\n }\\n return premium;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x09149a39e7660d65873e5160971cf0904630b266cbec4f02721dad0aad28320b\",\"license\":\"MIT\"},\"contracts/ethregistrar/IPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\ninterface IPriceOracle {\\n struct Price {\\n uint256 base;\\n uint256 premium;\\n }\\n\\n /**\\n * @dev Returns the price to register or renew a name.\\n * @param name The name being registered or renewed.\\n * @param expires When the name presently expires (0 if this is a new registration).\\n * @param duration How long the name is being registered or extended for, in seconds.\\n * @return base premium tuple of base price + premium price\\n */\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (Price calldata);\\n}\\n\",\"keccak256\":\"0x1ec537b4c7f9cc40363b39dcc7ade8c29bf94662e6b01d38e681487637bd577e\",\"license\":\"MIT\"},\"contracts/ethregistrar/StablePriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./IPriceOracle.sol\\\";\\nimport \\\"./StringUtils.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\ninterface AggregatorInterface {\\n function latestAnswer() external view returns (int256);\\n}\\n\\n// StablePriceOracle sets a price in USD, based on an oracle.\\ncontract StablePriceOracle is IPriceOracle {\\n using StringUtils for *;\\n\\n // Rent in base price units by length\\n uint256 public immutable price1Letter;\\n uint256 public immutable price2Letter;\\n uint256 public immutable price3Letter;\\n uint256 public immutable price4Letter;\\n uint256 public immutable price5Letter;\\n\\n // Oracle address\\n AggregatorInterface public immutable usdOracle;\\n\\n event RentPriceChanged(uint256[] prices);\\n\\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\\n usdOracle = _usdOracle;\\n price1Letter = _rentPrices[0];\\n price2Letter = _rentPrices[1];\\n price3Letter = _rentPrices[2];\\n price4Letter = _rentPrices[3];\\n price5Letter = _rentPrices[4];\\n }\\n\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view override returns (IPriceOracle.Price memory) {\\n uint256 len = name.strlen();\\n uint256 basePrice;\\n\\n if (len >= 5) {\\n basePrice = price5Letter * duration;\\n } else if (len == 4) {\\n basePrice = price4Letter * duration;\\n } else if (len == 3) {\\n basePrice = price3Letter * duration;\\n } else if (len == 2) {\\n basePrice = price2Letter * duration;\\n } else {\\n basePrice = price1Letter * duration;\\n }\\n\\n return\\n IPriceOracle.Price({\\n base: attoUSDToWei(basePrice),\\n premium: attoUSDToWei(_premium(name, expires, duration))\\n });\\n }\\n\\n /**\\n * @dev Returns the pricing premium in wei.\\n */\\n function premium(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (uint256) {\\n return attoUSDToWei(_premium(name, expires, duration));\\n }\\n\\n /**\\n * @dev Returns the pricing premium in internal base units.\\n */\\n function _premium(\\n string memory name,\\n uint256 expires,\\n uint256 duration\\n ) internal view virtual returns (uint256) {\\n return 0;\\n }\\n\\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\\n return (amount * 1e8) / ethPrice;\\n }\\n\\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\\n return (amount * ethPrice) / 1e8;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IPriceOracle).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0x23a3d1eb3021080f20eb5f6af941b2d29a5d252a0a6119ba74f595da9c1ae1d6\",\"license\":\"MIT\"},\"contracts/ethregistrar/StringUtils.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary StringUtils {\\n /**\\n * @dev Returns the length of a given string\\n *\\n * @param s The string to measure the length of\\n * @return The length of the input string\\n */\\n function strlen(string memory s) internal pure returns (uint256) {\\n uint256 len;\\n uint256 i = 0;\\n uint256 bytelength = bytes(s).length;\\n for (len = 0; i < bytelength; len++) {\\n bytes1 b = bytes(s)[i];\\n if (b < 0x80) {\\n i += 1;\\n } else if (b < 0xE0) {\\n i += 2;\\n } else if (b < 0xF0) {\\n i += 3;\\n } else if (b < 0xF8) {\\n i += 4;\\n } else if (b < 0xFC) {\\n i += 5;\\n } else {\\n i += 6;\\n }\\n }\\n return len;\\n }\\n}\\n\",\"keccak256\":\"0x4cc8363a850dc9130c433ee50e7c97e29a45ae5d9bd0808205ac7134b34f24e4\"}},\"version\":1}", + "bytecode": "0x6101806040523480156200001257600080fd5b50604051620010863803806200108683398101604081905262000035916200012c565b6001600160a01b0384166101205282518490849081906000906200005d576200005d62000227565b6020026020010151608081815250508060018151811062000082576200008262000227565b602002602001015160a0818152505080600281518110620000a757620000a762000227565b602002602001015160c0818152505080600381518110620000cc57620000cc62000227565b602002602001015160e0818152505080600481518110620000f157620000f162000227565b60209081029190910101516101005250506101408290521c61016052506200023d9050565b634e487b7160e01b600052604160045260246000fd5b600080600080608085870312156200014357600080fd5b84516001600160a01b03811681146200015b57600080fd5b602086810151919550906001600160401b03808211156200017b57600080fd5b818801915088601f8301126200019057600080fd5b815181811115620001a557620001a562000116565b8060051b604051601f19603f83011681018181108582111715620001cd57620001cd62000116565b60405291825284820192508381018501918b831115620001ec57600080fd5b938501935b828510156200020c57845184529385019392850192620001f1565b60408b01516060909b0151999c909b50975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60805160a05160c05160e05161010051610120516101405161016051610db3620002d3600039600081816108590152610883015260006108300152600081816101c7015261074b01526000818161015301526102d401526000818161023a015261030d01526000818161018d015261033f015260008181610213015261037101526000818160f0015261039b0152610db36000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c8063a200e15311610076578063c8a4271f1161005b578063c8a4271f146101c2578063cd5d2c741461020e578063d820ed421461023557600080fd5b8063a200e15314610188578063a34e3596146101af57600080fd5b806350e9a715116100a757806350e9a7151461012057806359b6b86c1461014e57806359e1777c1461017557600080fd5b806301ffc9a7146100c35780632c0fd74c146100eb575b600080fd5b6100d66100d1366004610bdd565b61025c565b60405190151581526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016100e2565b61013361012e366004610c1f565b61026d565b604080518251815260209283015192810192909252016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b610112610183366004610c9e565b610433565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101126101bd366004610c1f565b6104ce565b6101e97f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b60006102678261051f565b92915050565b604080518082019091526000808252602082015260006102c286868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506105b792505050565b90506000600582106102ff576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b90506103c2565b81600403610331576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b81600303610363576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b81600203610395576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b6103bf847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b90505b60405180604001604052806103d683610746565b81526020016104266104218a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92508b91506107fa9050565b610746565b9052979650505050505050565b6000806201518061044c670de0b6b3a764000085610cd6565b6104569190610ced565b9050600061046c670de0b6b3a764000083610ced565b905084811c6000610485670de0b6b3a764000084610cd6565b61048f9085610d0f565b90506000670de0b6b3a76400006104a98362010000610cd6565b6104b39190610ced565b905060006104c182856108bd565b9998505050505050505050565b600061051661042186868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508892508791506107fa9050565b95945050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061026757507fffffffff0000000000000000000000000000000000000000000000000000000082167f50e9a715000000000000000000000000000000000000000000000000000000001492915050565b8051600090819081905b8082101561073d5760008583815181106105dd576105dd610d22565b01602001516001600160f81b03191690507f800000000000000000000000000000000000000000000000000000000000000081101561062857610621600184610d38565b925061072a565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561066557610621600284610d38565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156106a257610621600384610d38565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156106df57610621600484610d38565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561071c57610621600584610d38565b610727600684610d38565b92505b508261073581610d4b565b9350506105c1565b50909392505050565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d89190610d64565b9050806107e9846305f5e100610cd6565b6107f39190610ced565b9392505050565b60006108096276a70084610d38565b92504283111561081b575060006107f3565b60006108278442610d0f565b905060006108557f000000000000000000000000000000000000000000000000000000000000000083610433565b90507f000000000000000000000000000000000000000000000000000000000000000081106108b1576108a87f000000000000000000000000000000000000000000000000000000000000000082610d0f565b925050506107f3565b50600095945050505050565b600060018316156108f057670de0b6b3a76400006108e3670de0ad151d09418084610cd6565b6108ed9190610ced565b91505b600283161561092157670de0b6b3a7640000610914670de0a3769959680084610cd6565b61091e9190610ced565b91505b600483161561095257670de0b6b3a7640000610945670de09039a5fa510084610cd6565b61094f9190610ced565b91505b600883161561098357670de0b6b3a7640000610976670de069c00f3e120084610cd6565b6109809190610ced565b91505b60108316156109b457670de0b6b3a76400006109a7670de01cce21c9440084610cd6565b6109b19190610ced565b91505b60208316156109e557670de0b6b3a76400006109d8670ddf82ef46ce100084610cd6565b6109e29190610ced565b91505b6040831615610a1657670de0b6b3a7640000610a09670dde4f458f8e8d8084610cd6565b610a139190610ced565b91505b6080831615610a4757670de0b6b3a7640000610a3a670ddbe84213d5f08084610cd6565b610a449190610ced565b91505b610100831615610a7957670de0b6b3a7640000610a6c670dd71b7aa6df5b8084610cd6565b610a769190610ced565b91505b610200831615610aab57670de0b6b3a7640000610a9e670dcd86e7f28cde0084610cd6565b610aa89190610ced565b91505b610400831615610add57670de0b6b3a7640000610ad0670dba71a3084ad68084610cd6565b610ada9190610ced565b91505b610800831615610b0f57670de0b6b3a7640000610b02670d94961b13dbde8084610cd6565b610b0c9190610ced565b91505b611000831615610b4157670de0b6b3a7640000610b34670d4a171c35c9838084610cd6565b610b3e9190610ced565b91505b612000831615610b7357670de0b6b3a7640000610b66670cb9da519ccfb70084610cd6565b610b709190610ced565b91505b614000831615610ba557670de0b6b3a7640000610b98670bab76d59c18d68084610cd6565b610ba29190610ced565b91505b618000831615610bd757670de0b6b3a7640000610bca6709d025defee4df8084610cd6565b610bd49190610ced565b91505b50919050565b600060208284031215610bef57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146107f357600080fd5b60008060008060608587031215610c3557600080fd5b843567ffffffffffffffff80821115610c4d57600080fd5b818701915087601f830112610c6157600080fd5b813581811115610c7057600080fd5b886020828501011115610c8257600080fd5b6020928301999098509187013596604001359550909350505050565b60008060408385031215610cb157600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761026757610267610cc0565b600082610d0a57634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561026757610267610cc0565b634e487b7160e01b600052603260045260246000fd5b8082018082111561026757610267610cc0565b600060018201610d5d57610d5d610cc0565b5060010190565b600060208284031215610d7657600080fd5b505191905056fea26469706673582212209d907a1e84c4b052eef123469f122f3158c5296dbfde11396f88c3072cef316c64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100be5760003560e01c8063a200e15311610076578063c8a4271f1161005b578063c8a4271f146101c2578063cd5d2c741461020e578063d820ed421461023557600080fd5b8063a200e15314610188578063a34e3596146101af57600080fd5b806350e9a715116100a757806350e9a7151461012057806359b6b86c1461014e57806359e1777c1461017557600080fd5b806301ffc9a7146100c35780632c0fd74c146100eb575b600080fd5b6100d66100d1366004610bdd565b61025c565b60405190151581526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016100e2565b61013361012e366004610c1f565b61026d565b604080518251815260209283015192810192909252016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b610112610183366004610c9e565b610433565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101126101bd366004610c1f565b6104ce565b6101e97f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b60006102678261051f565b92915050565b604080518082019091526000808252602082015260006102c286868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506105b792505050565b90506000600582106102ff576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b90506103c2565b81600403610331576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b81600303610363576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b81600203610395576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b6103bf847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b90505b60405180604001604052806103d683610746565b81526020016104266104218a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92508b91506107fa9050565b610746565b9052979650505050505050565b6000806201518061044c670de0b6b3a764000085610cd6565b6104569190610ced565b9050600061046c670de0b6b3a764000083610ced565b905084811c6000610485670de0b6b3a764000084610cd6565b61048f9085610d0f565b90506000670de0b6b3a76400006104a98362010000610cd6565b6104b39190610ced565b905060006104c182856108bd565b9998505050505050505050565b600061051661042186868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508892508791506107fa9050565b95945050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061026757507fffffffff0000000000000000000000000000000000000000000000000000000082167f50e9a715000000000000000000000000000000000000000000000000000000001492915050565b8051600090819081905b8082101561073d5760008583815181106105dd576105dd610d22565b01602001516001600160f81b03191690507f800000000000000000000000000000000000000000000000000000000000000081101561062857610621600184610d38565b925061072a565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561066557610621600284610d38565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156106a257610621600384610d38565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156106df57610621600484610d38565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561071c57610621600584610d38565b610727600684610d38565b92505b508261073581610d4b565b9350506105c1565b50909392505050565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d89190610d64565b9050806107e9846305f5e100610cd6565b6107f39190610ced565b9392505050565b60006108096276a70084610d38565b92504283111561081b575060006107f3565b60006108278442610d0f565b905060006108557f000000000000000000000000000000000000000000000000000000000000000083610433565b90507f000000000000000000000000000000000000000000000000000000000000000081106108b1576108a87f000000000000000000000000000000000000000000000000000000000000000082610d0f565b925050506107f3565b50600095945050505050565b600060018316156108f057670de0b6b3a76400006108e3670de0ad151d09418084610cd6565b6108ed9190610ced565b91505b600283161561092157670de0b6b3a7640000610914670de0a3769959680084610cd6565b61091e9190610ced565b91505b600483161561095257670de0b6b3a7640000610945670de09039a5fa510084610cd6565b61094f9190610ced565b91505b600883161561098357670de0b6b3a7640000610976670de069c00f3e120084610cd6565b6109809190610ced565b91505b60108316156109b457670de0b6b3a76400006109a7670de01cce21c9440084610cd6565b6109b19190610ced565b91505b60208316156109e557670de0b6b3a76400006109d8670ddf82ef46ce100084610cd6565b6109e29190610ced565b91505b6040831615610a1657670de0b6b3a7640000610a09670dde4f458f8e8d8084610cd6565b610a139190610ced565b91505b6080831615610a4757670de0b6b3a7640000610a3a670ddbe84213d5f08084610cd6565b610a449190610ced565b91505b610100831615610a7957670de0b6b3a7640000610a6c670dd71b7aa6df5b8084610cd6565b610a769190610ced565b91505b610200831615610aab57670de0b6b3a7640000610a9e670dcd86e7f28cde0084610cd6565b610aa89190610ced565b91505b610400831615610add57670de0b6b3a7640000610ad0670dba71a3084ad68084610cd6565b610ada9190610ced565b91505b610800831615610b0f57670de0b6b3a7640000610b02670d94961b13dbde8084610cd6565b610b0c9190610ced565b91505b611000831615610b4157670de0b6b3a7640000610b34670d4a171c35c9838084610cd6565b610b3e9190610ced565b91505b612000831615610b7357670de0b6b3a7640000610b66670cb9da519ccfb70084610cd6565b610b709190610ced565b91505b614000831615610ba557670de0b6b3a7640000610b98670bab76d59c18d68084610cd6565b610ba29190610ced565b91505b618000831615610bd757670de0b6b3a7640000610bca6709d025defee4df8084610cd6565b610bd49190610ced565b91505b50919050565b600060208284031215610bef57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146107f357600080fd5b60008060008060608587031215610c3557600080fd5b843567ffffffffffffffff80821115610c4d57600080fd5b818701915087601f830112610c6157600080fd5b813581811115610c7057600080fd5b886020828501011115610c8257600080fd5b6020928301999098509187013596604001359550909350505050565b60008060408385031215610cb157600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761026757610267610cc0565b600082610d0a57634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561026757610267610cc0565b634e487b7160e01b600052603260045260246000fd5b8082018082111561026757610267610cc0565b600060018201610d5d57610d5d610cc0565b5060010190565b600060208284031215610d7657600080fd5b505191905056fea26469706673582212209d907a1e84c4b052eef123469f122f3158c5296dbfde11396f88c3072cef316c64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "decayedPremium(uint256,uint256)": { + "details": "Returns the premium price at current time elapsed", + "params": { + "elapsed": "time past since expiry", + "startPremium": "starting price" + } + }, + "premium(string,uint256,uint256)": { + "details": "Returns the pricing premium in wei." + }, + "price(string,uint256,uint256)": { + "details": "Returns the price to register or renew a name.", + "params": { + "duration": "How long the name is being registered or extended for, in seconds.", + "expires": "When the name presently expires (0 if this is a new registration).", + "name": "The name being registered or renewed." + }, + "returns": { + "_0": "base premium tuple of base price + premium price" + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/LegacyENSRegistry.json b/solidity/dns-contracts/deployments/goerli/LegacyENSRegistry.json new file mode 100644 index 0000000..e263ba9 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/LegacyENSRegistry.json @@ -0,0 +1,205 @@ +{ + "address": "0x112234455C3a32FD11230C42E7Bccd4A84e02010", + "transactionHash": "0xb224be1316b42012c5f562c28eed1e3bcf401c938016b9edbe0e71d2b0e8cfff", + "abi": [ + { + "constant": true, + "inputs": [ + { + "name": "node", + "type": "bytes32" + } + ], + "name": "resolver", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "node", + "type": "bytes32" + } + ], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "node", + "type": "bytes32" + }, + { + "name": "label", + "type": "bytes32" + }, + { + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "node", + "type": "bytes32" + }, + { + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "node", + "type": "bytes32" + } + ], + "name": "ttl", + "outputs": [ + { + "name": "", + "type": "uint64" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "node", + "type": "bytes32" + }, + { + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "node", + "type": "bytes32" + }, + { + "name": "owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "name": "owner", + "type": "address" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "name": "owner", + "type": "address" + } + ], + "name": "NewOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "name": "resolver", + "type": "address" + } + ], + "name": "NewResolver", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "name": "ttl", + "type": "uint64" + } + ], + "name": "NewTTL", + "type": "event" + } + ] +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/LegacyETHRegistrarController.json b/solidity/dns-contracts/deployments/goerli/LegacyETHRegistrarController.json new file mode 100644 index 0000000..986b9bf --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/LegacyETHRegistrarController.json @@ -0,0 +1,563 @@ +{ + "address": "0x283Af0B28c62C092C9727F1Ee09c02CA627EB7F5", + "transactionHash": "0x3e6f01ae912abaf6567f5a23bd5ce557859354dde1fa3606d3c0d5531c90ef78", + "abi": [ + { + "inputs": [ + { + "internalType": "contract BaseRegistrar", + "name": "_base", + "type": "address" + }, + { + "internalType": "contract PriceOracle", + "name": "_prices", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minCommitmentAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxCommitmentAge", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRenewed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oracle", + "type": "address" + } + ], + "name": "NewPriceOracle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "MIN_REGISTRATION_DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "available", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "commit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "commitments", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + } + ], + "name": "makeCommitment", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "makeCommitmentWithConfig", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "maxCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "minCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + } + ], + "name": "register", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "registerWithConfig", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "rentPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_minCommitmentAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxCommitmentAge", + "type": "uint256" + } + ], + "name": "setCommitmentAges", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract PriceOracle", + "name": "_prices", + "type": "address" + } + ], + "name": "setPriceOracle", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "valid", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "withdraw", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ] +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/LegacyPublicResolver.json b/solidity/dns-contracts/deployments/goerli/LegacyPublicResolver.json new file mode 100644 index 0000000..a42077a --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/LegacyPublicResolver.json @@ -0,0 +1,685 @@ +{ + "address": "0xDaaF96c344f63131acadD0Ea35170E7892d3dfBA", + "transactionHash": "0x459ee3e590854eefae6aa11f9a67952d7dff204283f502ecafc1dc26ff38207e", + "abi": [ + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "setText", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "interfaceImplementer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentTypes", + "type": "uint256" + } + ], + "name": "ABI", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "setPubkey", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setContenthash", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bool", + "name": "isAuthorised", + "type": "bool" + } + ], + "name": "setAuthorisation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "text", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setABI", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "a", + "type": "bytes" + } + ], + "name": "setAddr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "contenthash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "pubkey", + "outputs": [ + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "setAddr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "setInterface", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "authorisations", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isAuthorised", + "type": "bool" + } + ], + "name": "AuthorisationChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "indexedKey", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "TextChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "PubkeyChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "InterfaceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "ContenthashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "AddrChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + } + ], + "name": "ABIChanged", + "type": "event" + } + ] +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/NameWrapper.json b/solidity/dns-contracts/deployments/goerli/NameWrapper.json new file mode 100644 index 0000000..79ea051 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/NameWrapper.json @@ -0,0 +1,1998 @@ +{ + "address": "0x114D4603199df73e7D157787f8778E21fCd13066", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract IBaseRegistrar", + "name": "_registrar", + "type": "address" + }, + { + "internalType": "contract IMetadataService", + "name": "_metadataService", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "CannotUpgrade", + "type": "error" + }, + { + "inputs": [], + "name": "IncompatibleParent", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "IncorrectTargetOwner", + "type": "error" + }, + { + "inputs": [], + "name": "IncorrectTokenType", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "labelHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "expectedLabelhash", + "type": "bytes32" + } + ], + "name": "LabelMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + } + ], + "name": "LabelTooLong", + "type": "error" + }, + { + "inputs": [], + "name": "LabelTooShort", + "type": "error" + }, + { + "inputs": [], + "name": "NameIsNotWrapped", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "OperationProhibited", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "Unauthorised", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "ControllerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "ExpiryExtended", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + } + ], + "name": "FusesSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NameUnwrapped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "NameWrapped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + } + ], + "name": "TransferBatch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "TransferSingle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "value", + "type": "string" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "URI", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "_tokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint32", + "name": "fuseMask", + "type": "uint32" + } + ], + "name": "allFusesBurned", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "accounts", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + } + ], + "name": "balanceOfBatch", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "canExtendSubnames", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "canModifyName", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "extendExpiry", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "getData", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + } + ], + "name": "isWrapped", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "isWrapped", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "metadataService", + "outputs": [ + { + "internalType": "contract IMetadataService", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "names", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "recoverFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "name": "registerAndWrapETH2LD", + "outputs": [ + { + "internalType": "uint256", + "name": "registrarExpiry", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "registrar", + "outputs": [ + { + "internalType": "contract IBaseRegistrar", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [ + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeBatchTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setChildFuses", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "name": "setFuses", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IMetadataService", + "name": "_metadataService", + "type": "address" + } + ], + "name": "setMetadataService", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setSubnodeOwner", + "outputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract INameWrapperUpgrade", + "name": "_upgradeAddress", + "type": "address" + } + ], + "name": "setUpgradeContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "unwrap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "unwrapETH2LD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "upgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "upgradeContract", + "outputs": [ + { + "internalType": "contract INameWrapperUpgrade", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "uri", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "wrap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "wrapETH2LD", + "outputs": [ + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xa539eda200d04086248d097c6d109346447c5d9e2aa390c186e826081a8af34b", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0x114D4603199df73e7D157787f8778E21fCd13066", + "transactionIndex": 62, + "gasUsed": "5489292", + "logsBloom": "0x00000000000000080000000008000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000001000000000000000000400000001000000000000000000000000000000000000200000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xa91c670129d52c17730670ebbec9a0efcdac5bfa57462966b7f0dc7d00a93241", + "transactionHash": "0xa539eda200d04086248d097c6d109346447c5d9e2aa390c186e826081a8af34b", + "logs": [ + { + "transactionIndex": 62, + "blockNumber": 8649122, + "transactionHash": "0xa539eda200d04086248d097c6d109346447c5d9e2aa390c186e826081a8af34b", + "address": "0x114D4603199df73e7D157787f8778E21fCd13066", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000904dac3347ea47d208f3fd67402d039a3b99859" + ], + "data": "0x", + "logIndex": 161, + "blockHash": "0xa91c670129d52c17730670ebbec9a0efcdac5bfa57462966b7f0dc7d00a93241" + } + ], + "blockNumber": 8649122, + "cumulativeGasUsed": "17963146", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85", + "0x269eb6AeDeEa030B96354Bc73f0A09eae3546e23" + ], + "numDeployments": 6, + "solcInputHash": "0ba2159dea6e6f2226840e68f6c0a0ff", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"_registrar\",\"type\":\"address\"},{\"internalType\":\"contract IMetadataService\",\"name\":\"_metadataService\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CannotUpgrade\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncompatibleParent\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"IncorrectTargetOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncorrectTokenType\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"labelHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"expectedLabelhash\",\"type\":\"bytes32\"}],\"name\":\"LabelMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"}],\"name\":\"LabelTooLong\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LabelTooShort\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NameIsNotWrapped\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"OperationProhibited\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"Unauthorised\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"}],\"name\":\"ControllerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"ExpiryExtended\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"}],\"name\":\"FusesSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"NameUnwrapped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"NameWrapped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"name\":\"TransferBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"TransferSingle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"URI\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"_tokens\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"fuseMask\",\"type\":\"uint32\"}],\"name\":\"allFusesBurned\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"balanceOfBatch\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"canExtendSubnames\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"canModifyName\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"extendExpiry\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getData\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"}],\"name\":\"isWrapped\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"isWrapped\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"metadataService\",\"outputs\":[{\"internalType\":\"contract IMetadataService\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"names\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"onERC721Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"recoverFunds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"name\":\"registerAndWrapETH2LD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"registrarExpiry\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"registrar\",\"outputs\":[{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"renew\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeBatchTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setChildFuses\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"name\":\"setFuses\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IMetadataService\",\"name\":\"_metadataService\",\"type\":\"address\"}],\"name\":\"setMetadataService\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"}],\"name\":\"setRecord\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setSubnodeOwner\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setSubnodeRecord\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"}],\"name\":\"setTTL\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract INameWrapperUpgrade\",\"name\":\"_upgradeAddress\",\"type\":\"address\"}],\"name\":\"setUpgradeContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"unwrap\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"registrant\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"unwrapETH2LD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"upgrade\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"upgradeContract\",\"outputs\":[{\"internalType\":\"contract INameWrapperUpgrade\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"wrap\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"wrapETH2LD\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"allFusesBurned(bytes32,uint32)\":{\"params\":{\"fuseMask\":\"The fuses you want to check\",\"node\":\"Namehash of the name\"},\"returns\":{\"_0\":\"Boolean of whether or not all the selected fuses are burned\"}},\"approve(address,uint256)\":{\"params\":{\"to\":\"address to approve\",\"tokenId\":\"name to approve\"}},\"balanceOf(address,uint256)\":{\"details\":\"See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address.\"},\"balanceOfBatch(address[],uint256[])\":{\"details\":\"See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length.\"},\"canExtendSubnames(bytes32,address)\":{\"params\":{\"addr\":\"which address to check permissions for\",\"node\":\"namehash of the name to check\"},\"returns\":{\"_0\":\"whether or not is owner/operator or approved\"}},\"canModifyName(bytes32,address)\":{\"params\":{\"addr\":\"which address to check permissions for\",\"node\":\"namehash of the name to check\"},\"returns\":{\"_0\":\"whether or not is owner or operator\"}},\"extendExpiry(bytes32,bytes32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"labelhash\":\"Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\",\"parentNode\":\"Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\"},\"returns\":{\"_0\":\"New expiry\"}},\"getApproved(uint256)\":{\"params\":{\"id\":\"Namehash of the name\"},\"returns\":{\"operator\":\"Approved operator of a name\"}},\"getData(uint256)\":{\"params\":{\"id\":\"Namehash of the name\"},\"returns\":{\"expiry\":\"Expiry of the name\",\"fuses\":\"Fuses of the name\",\"owner\":\"Owner of the name\"}},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC1155-isApprovedForAll}.\"},\"isWrapped(bytes32)\":{\"params\":{\"node\":\"Namehash of the name\"},\"returns\":{\"_0\":\"Boolean of whether or not the name is wrapped\"}},\"isWrapped(bytes32,bytes32)\":{\"params\":{\"labelhash\":\"Namehash of the name\",\"parentNode\":\"Namehash of the name\"},\"returns\":{\"_0\":\"Boolean of whether or not the name is wrapped\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"ownerOf(uint256)\":{\"params\":{\"id\":\"Label as a string of the .eth domain to wrap\"},\"returns\":{\"owner\":\"The owner of the name\"}},\"recoverFunds(address,address,uint256)\":{\"details\":\"The contract is Ownable and only the owner can call the recover function.\",\"params\":{\"_amount\":\"The amount of tokens to recover.\",\"_to\":\"The address to send the tokens to.\",\"_token\":\"The address of the ERC20 token to recover\"}},\"registerAndWrapETH2LD(string,address,uint256,address,uint16)\":{\"details\":\"Registers a new .eth second-level domain and wraps it. Only callable by authorised controllers.\",\"params\":{\"duration\":\"The duration, in seconds, to register the name for.\",\"label\":\"The label to register (Eg, 'foo' for 'foo.eth').\",\"ownerControlledFuses\":\"Initial owner-controlled fuses to set\",\"resolver\":\"The resolver address to set on the ENS registry (optional).\",\"wrappedOwner\":\"The owner of the wrapped name.\"},\"returns\":{\"registrarExpiry\":\"The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\"}},\"renew(uint256,uint256)\":{\"details\":\"Only callable by authorised controllers.\",\"params\":{\"duration\":\"The number of seconds to renew the name for.\",\"tokenId\":\"The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\"},\"returns\":{\"expires\":\"The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)\":{\"details\":\"See {IERC1155-safeBatchTransferFrom}.\"},\"safeTransferFrom(address,address,uint256,uint256,bytes)\":{\"details\":\"See {IERC1155-safeTransferFrom}.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC1155-setApprovalForAll}.\"},\"setChildFuses(bytes32,bytes32,uint32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"fuses\":\"Fuses to burn\",\"labelhash\":\"Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\",\"parentNode\":\"Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\"}},\"setFuses(bytes32,uint16)\":{\"params\":{\"node\":\"Namehash of the name\",\"ownerControlledFuses\":\"Owner-controlled fuses to burn\"},\"returns\":{\"_0\":\"Old fuses\"}},\"setMetadataService(address)\":{\"params\":{\"_metadataService\":\"The new metadata service\"}},\"setRecord(bytes32,address,address,uint64)\":{\"params\":{\"node\":\"Namehash of the name to set a record for\",\"owner\":\"New owner in the registry\",\"resolver\":\"Resolver contract\",\"ttl\":\"Time to live in the registry\"}},\"setResolver(bytes32,address)\":{\"params\":{\"node\":\"namehash of the name\",\"resolver\":\"the resolver contract\"}},\"setSubnodeOwner(bytes32,string,address,uint32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"fuses\":\"Initial fuses for the wrapped subdomain\",\"label\":\"Label of the subdomain as a string\",\"owner\":\"New owner in the wrapper\",\"parentNode\":\"Parent namehash of the subdomain\"},\"returns\":{\"node\":\"Namehash of the subdomain\"}},\"setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"fuses\":\"initial fuses for the wrapped subdomain\",\"label\":\"label of the subdomain as a string\",\"owner\":\"new owner in the wrapper\",\"parentNode\":\"parent namehash of the subdomain\",\"resolver\":\"resolver contract in the registry\",\"ttl\":\"ttl in the registry\"},\"returns\":{\"node\":\"Namehash of the subdomain\"}},\"setTTL(bytes32,uint64)\":{\"params\":{\"node\":\"Namehash of the name\",\"ttl\":\"TTL in the registry\"}},\"setUpgradeContract(address)\":{\"details\":\"The default value of upgradeContract is the 0 address. Use the 0 address at any time to make the contract not upgradable.\",\"params\":{\"_upgradeAddress\":\"address of an upgraded contract\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"unwrap(bytes32,bytes32,address)\":{\"details\":\"Can be called by the owner in the wrapper or an authorised caller in the wrapper\",\"params\":{\"controller\":\"Sets the owner in the registry to this address\",\"labelhash\":\"Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\",\"parentNode\":\"Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\"}},\"unwrapETH2LD(bytes32,address,address)\":{\"details\":\"Can be called by the owner in the wrapper or an authorised caller in the wrapper\",\"params\":{\"controller\":\"Sets the owner in the registry to this address\",\"labelhash\":\"Labelhash of the .eth domain\",\"registrant\":\"Sets the owner in the .eth registrar to this address\"}},\"upgrade(bytes,bytes)\":{\"details\":\"Can be called by the owner or an authorised caller\",\"params\":{\"extraData\":\"Extra data to pass to the upgrade contract\",\"name\":\"The name to upgrade, in DNS format\"}},\"uri(uint256)\":{\"params\":{\"tokenId\":\"The id of the token\"},\"returns\":{\"_0\":\"string uri of the metadata service\"}},\"wrap(bytes,address,address)\":{\"details\":\"Can be called by the owner in the registry or an authorised caller in the registry\",\"params\":{\"name\":\"The name to wrap, in DNS format\",\"resolver\":\"Resolver contract\",\"wrappedOwner\":\"Owner of the name in this contract\"}},\"wrapETH2LD(string,address,uint16,address)\":{\"details\":\"Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\",\"params\":{\"label\":\"Label as a string of the .eth domain to wrap\",\"ownerControlledFuses\":\"Initial owner-controlled fuses to set\",\"resolver\":\"Resolver contract address\",\"wrappedOwner\":\"Owner of the name in this contract\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"allFusesBurned(bytes32,uint32)\":{\"notice\":\"Checks all Fuses in the mask are burned for the node\"},\"approve(address,uint256)\":{\"notice\":\"Approves an address for a name\"},\"canExtendSubnames(bytes32,address)\":{\"notice\":\"Checks if owner/operator or approved by owner\"},\"canModifyName(bytes32,address)\":{\"notice\":\"Checks if owner or operator of the owner\"},\"extendExpiry(bytes32,bytes32,uint64)\":{\"notice\":\"Extends expiry for a name\"},\"getApproved(uint256)\":{\"notice\":\"Gets the owner of a name\"},\"getData(uint256)\":{\"notice\":\"Gets the data for a name\"},\"isWrapped(bytes32)\":{\"notice\":\"Checks if a name is wrapped\"},\"isWrapped(bytes32,bytes32)\":{\"notice\":\"Checks if a name is wrapped in a more gas efficient way\"},\"ownerOf(uint256)\":{\"notice\":\"Gets the owner of a name\"},\"recoverFunds(address,address,uint256)\":{\"notice\":\"Recover ERC20 tokens sent to the contract by mistake.\"},\"renew(uint256,uint256)\":{\"notice\":\"Renews a .eth second-level domain.\"},\"setChildFuses(bytes32,bytes32,uint32,uint64)\":{\"notice\":\"Sets fuses of a name that you own the parent of\"},\"setFuses(bytes32,uint16)\":{\"notice\":\"Sets fuses of a name\"},\"setMetadataService(address)\":{\"notice\":\"Set the metadata service. Only the owner can do this\"},\"setRecord(bytes32,address,address,uint64)\":{\"notice\":\"Sets records for the name in the ENS Registry\"},\"setResolver(bytes32,address)\":{\"notice\":\"Sets resolver contract in the registry\"},\"setSubnodeOwner(bytes32,string,address,uint32,uint64)\":{\"notice\":\"Sets the subdomain owner in the registry and then wraps the subdomain\"},\"setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)\":{\"notice\":\"Sets the subdomain owner in the registry with records and then wraps the subdomain\"},\"setTTL(bytes32,uint64)\":{\"notice\":\"Sets TTL in the registry\"},\"setUpgradeContract(address)\":{\"notice\":\"Set the address of the upgradeContract of the contract. only admin can do this\"},\"unwrap(bytes32,bytes32,address)\":{\"notice\":\"Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\"},\"unwrapETH2LD(bytes32,address,address)\":{\"notice\":\"Unwraps a .eth domain. e.g. vitalik.eth\"},\"upgrade(bytes,bytes)\":{\"notice\":\"Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\"},\"uri(uint256)\":{\"notice\":\"Get the metadata uri\"},\"wrap(bytes,address,address)\":{\"notice\":\"Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\"},\"wrapETH2LD(string,address,uint16,address)\":{\"notice\":\"Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/wrapper/NameWrapper.sol\":\"NameWrapper\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1500},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6392f2cfe3a5ee802227fe7a2dfd47096d881aec89bddd214b35c5b46d3cd941\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\ninterface IERC1155Receiver is IERC165 {\\n /**\\n * @dev Handles the receipt of a single ERC1155 token type. This function is\\n * called at the end of a `safeTransferFrom` after the balance has been updated.\\n *\\n * NOTE: To accept the transfer, this must return\\n * `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))`\\n * (i.e. 0xf23a6e61, or its own function selector).\\n *\\n * @param operator The address which initiated the transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param id The ID of the token being transferred\\n * @param value The amount of tokens being transferred\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155Received(\\n address operator,\\n address from,\\n uint256 id,\\n uint256 value,\\n bytes calldata data\\n ) external returns (bytes4);\\n\\n /**\\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\\n * is called at the end of a `safeBatchTransferFrom` after the balances have\\n * been updated.\\n *\\n * NOTE: To accept the transfer(s), this must return\\n * `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))`\\n * (i.e. 0xbc197c81, or its own function selector).\\n *\\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xeb373f1fdc7b755c6a750123a9b9e3a8a02c1470042fd6505d875000a80bde0b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC1155.sol\\\";\\n\\n/**\\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155MetadataURI is IERC1155 {\\n /**\\n * @dev Returns the URI for token type `id`.\\n *\\n * If the `\\\\{id\\\\}` substring is present in the URI, it must be replaced by\\n * clients with the actual token type ID.\\n */\\n function uri(uint256 id) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xa66d18b9a85458d28fc3304717964502ae36f7f8a2ff35bc83f6f85d74b03574\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xab28a56179c1db258c9bf5235b382698cb650debecb51b23d12be9e241374b68\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x9ac51351ff72d73083aed62b7cdad4c07e9d1eb68401d7fd8457bdd828f2c6fe\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/utils/ERC20Recoverable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\\n */\\n\\ncontract ERC20Recoverable is Ownable {\\n /**\\n @notice Recover ERC20 tokens sent to the contract by mistake.\\n @dev The contract is Ownable and only the owner can call the recover function.\\n @param _to The address to send the tokens to.\\n@param _token The address of the ERC20 token to recover\\n @param _amount The amount of tokens to recover.\\n */\\n function recoverFunds(\\n address _token,\\n address _to,\\n uint256 _amount\\n ) external onlyOwner {\\n IERC20(_token).transfer(_to, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x793a38091e1f81499a29ddba82c2b2f3cdd07071b81a832886e8e02a45ff352a\",\"license\":\"MIT\"},\"contracts/wrapper/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes32) {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n}\\n\",\"keccak256\":\"0xf862cd86d749158a554e3cb517efa9097331ec0cf7225117f21e96fb50c67edb\",\"license\":\"MIT\"},\"contracts/wrapper/Controllable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool active);\\n\\n function setController(address controller, bool active) public onlyOwner {\\n controllers[controller] = active;\\n emit ControllerChanged(controller, active);\\n }\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x9a9191656a82eda6763cda29ce893ddbfddb6c43559ff3b90c00a184e14e1fa1\",\"license\":\"MIT\"},\"contracts/wrapper/ERC1155Fuse.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\\n\\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\\n using Address for address;\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(\\n address indexed owner,\\n address indexed approved,\\n uint256 indexed tokenId\\n );\\n mapping(uint256 => uint256) public _tokens;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) internal _tokenApprovals;\\n\\n /**************************************************************************\\n * ERC721 methods\\n *************************************************************************/\\n\\n function ownerOf(uint256 id) public view virtual returns (address) {\\n (address owner, , ) = getData(id);\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual {\\n address owner = ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(\\n uint256 tokenId\\n ) public view virtual returns (address) {\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IERC1155).interfaceId ||\\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(\\n address account,\\n uint256 id\\n ) public view virtual override returns (uint256) {\\n require(\\n account != address(0),\\n \\\"ERC1155: balance query for the zero address\\\"\\n );\\n address owner = ownerOf(id);\\n if (owner == account) {\\n return 1;\\n }\\n return 0;\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOfBatch}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] memory accounts,\\n uint256[] memory ids\\n ) public view virtual override returns (uint256[] memory) {\\n require(\\n accounts.length == ids.length,\\n \\\"ERC1155: accounts and ids length mismatch\\\"\\n );\\n\\n uint256[] memory batchBalances = new uint256[](accounts.length);\\n\\n for (uint256 i = 0; i < accounts.length; ++i) {\\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\\n }\\n\\n return batchBalances;\\n }\\n\\n /**\\n * @dev See {IERC1155-setApprovalForAll}.\\n */\\n function setApprovalForAll(\\n address operator,\\n bool approved\\n ) public virtual override {\\n require(\\n msg.sender != operator,\\n \\\"ERC1155: setting approval status for self\\\"\\n );\\n\\n _operatorApprovals[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC1155-isApprovedForAll}.\\n */\\n function isApprovedForAll(\\n address account,\\n address operator\\n ) public view virtual override returns (bool) {\\n return _operatorApprovals[account][operator];\\n }\\n\\n /**\\n * @dev Returns the Name's owner address and fuses\\n */\\n function getData(\\n uint256 tokenId\\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\\n uint256 t = _tokens[tokenId];\\n owner = address(uint160(t));\\n expiry = uint64(t >> 192);\\n fuses = uint32(t >> 160);\\n }\\n\\n /**\\n * @dev See {IERC1155-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) public virtual override {\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n require(\\n from == msg.sender || isApprovedForAll(from, msg.sender),\\n \\\"ERC1155: caller is not owner nor approved\\\"\\n );\\n\\n _transfer(from, to, id, amount, data);\\n }\\n\\n /**\\n * @dev See {IERC1155-safeBatchTransferFrom}.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) public virtual override {\\n require(\\n ids.length == amounts.length,\\n \\\"ERC1155: ids and amounts length mismatch\\\"\\n );\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n require(\\n from == msg.sender || isApprovedForAll(from, msg.sender),\\n \\\"ERC1155: transfer caller is not owner nor approved\\\"\\n );\\n\\n for (uint256 i = 0; i < ids.length; ++i) {\\n uint256 id = ids[i];\\n uint256 amount = amounts[i];\\n\\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\\n\\n _beforeTransfer(id, fuses, expiry);\\n\\n require(\\n amount == 1 && oldOwner == from,\\n \\\"ERC1155: insufficient balance for transfer\\\"\\n );\\n _setData(id, to, fuses, expiry);\\n }\\n\\n emit TransferBatch(msg.sender, from, to, ids, amounts);\\n\\n _doSafeBatchTransferAcceptanceCheck(\\n msg.sender,\\n from,\\n to,\\n ids,\\n amounts,\\n data\\n );\\n }\\n\\n /**************************************************************************\\n * Internal/private methods\\n *************************************************************************/\\n\\n /**\\n * @dev Sets the Name's owner address and fuses\\n */\\n function _setData(\\n uint256 tokenId,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual {\\n _tokens[tokenId] =\\n uint256(uint160(owner)) |\\n (uint256(fuses) << 160) |\\n (uint256(expiry) << 192);\\n }\\n\\n function _beforeTransfer(\\n uint256 id,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual;\\n\\n function _clearOwnerAndFuses(\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual returns (address, uint32);\\n\\n function _mint(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual {\\n uint256 tokenId = uint256(node);\\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n\\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\\n oldFuses;\\n\\n if (oldExpiry > expiry) {\\n expiry = oldExpiry;\\n }\\n\\n if (oldExpiry >= block.timestamp) {\\n fuses = fuses | parentControlledFuses;\\n }\\n\\n require(oldOwner == address(0), \\\"ERC1155: mint of existing token\\\");\\n require(owner != address(0), \\\"ERC1155: mint to the zero address\\\");\\n require(\\n owner != address(this),\\n \\\"ERC1155: newOwner cannot be the NameWrapper contract\\\"\\n );\\n\\n _setData(tokenId, owner, fuses, expiry);\\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\\n _doSafeTransferAcceptanceCheck(\\n msg.sender,\\n address(0),\\n owner,\\n tokenId,\\n 1,\\n \\\"\\\"\\n );\\n }\\n\\n function _burn(uint256 tokenId) internal virtual {\\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\\n tokenId\\n );\\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n // Fuses and expiry are kept on burn\\n _setData(tokenId, address(0x0), fuses, expiry);\\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\\n }\\n\\n function _transfer(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) internal {\\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\\n\\n _beforeTransfer(id, fuses, expiry);\\n\\n require(\\n amount == 1 && oldOwner == from,\\n \\\"ERC1155: insufficient balance for transfer\\\"\\n );\\n\\n if (oldOwner == to) {\\n return;\\n }\\n\\n _setData(id, to, fuses, expiry);\\n\\n emit TransferSingle(msg.sender, from, to, id, amount);\\n\\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\\n }\\n\\n function _doSafeTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try\\n IERC1155Receiver(to).onERC1155Received(\\n operator,\\n from,\\n id,\\n amount,\\n data\\n )\\n returns (bytes4 response) {\\n if (\\n response != IERC1155Receiver(to).onERC1155Received.selector\\n ) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n function _doSafeBatchTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try\\n IERC1155Receiver(to).onERC1155BatchReceived(\\n operator,\\n from,\\n ids,\\n amounts,\\n data\\n )\\n returns (bytes4 response) {\\n if (\\n response !=\\n IERC1155Receiver(to).onERC1155BatchReceived.selector\\n ) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n /* ERC721 internal functions */\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ownerOf(tokenId), to, tokenId);\\n }\\n}\\n\",\"keccak256\":\"0xfbbd36e7f5df0fe7a8e9199783af99ac61ab24122e4a9fdb072bbd4cd676a88b\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_ETH = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x70310eb67146d7290731c31841399640ac3b6a949eadc6598bc150123d185c57\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"},\"contracts/wrapper/NameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \\\"./ERC1155Fuse.sol\\\";\\nimport {Controllable} from \\\"./Controllable.sol\\\";\\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \\\"./INameWrapper.sol\\\";\\nimport {INameWrapperUpgrade} from \\\"./INameWrapperUpgrade.sol\\\";\\nimport {IMetadataService} from \\\"./IMetadataService.sol\\\";\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IBaseRegistrar} from \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport {IERC721Receiver} from \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {BytesUtils} from \\\"./BytesUtils.sol\\\";\\nimport {ERC20Recoverable} from \\\"../utils/ERC20Recoverable.sol\\\";\\n\\nerror Unauthorised(bytes32 node, address addr);\\nerror IncompatibleParent();\\nerror IncorrectTokenType();\\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\\nerror LabelTooShort();\\nerror LabelTooLong(string label);\\nerror IncorrectTargetOwner(address owner);\\nerror CannotUpgrade();\\nerror OperationProhibited(bytes32 node);\\nerror NameIsNotWrapped();\\nerror NameIsStillExpired();\\n\\ncontract NameWrapper is\\n Ownable,\\n ERC1155Fuse,\\n INameWrapper,\\n Controllable,\\n IERC721Receiver,\\n ERC20Recoverable\\n{\\n using BytesUtils for bytes;\\n\\n ENS public immutable ens;\\n IBaseRegistrar public immutable registrar;\\n IMetadataService public metadataService;\\n mapping(bytes32 => bytes) public names;\\n string public constant name = \\\"NameWrapper\\\";\\n\\n uint64 private constant GRACE_PERIOD = 90 days;\\n bytes32 private constant ETH_NODE =\\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\\n bytes32 private constant ETH_LABELHASH =\\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\\n bytes32 private constant ROOT_NODE =\\n 0x0000000000000000000000000000000000000000000000000000000000000000;\\n\\n INameWrapperUpgrade public upgradeContract;\\n uint64 private constant MAX_EXPIRY = type(uint64).max;\\n\\n constructor(\\n ENS _ens,\\n IBaseRegistrar _registrar,\\n IMetadataService _metadataService\\n ) {\\n ens = _ens;\\n registrar = _registrar;\\n metadataService = _metadataService;\\n\\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE */\\n\\n _setData(\\n uint256(ETH_NODE),\\n address(0),\\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\\n MAX_EXPIRY\\n );\\n _setData(\\n uint256(ROOT_NODE),\\n address(0),\\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\\n MAX_EXPIRY\\n );\\n names[ROOT_NODE] = \\\"\\\\x00\\\";\\n names[ETH_NODE] = \\\"\\\\x03eth\\\\x00\\\";\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\\n return\\n interfaceId == type(INameWrapper).interfaceId ||\\n interfaceId == type(IERC721Receiver).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /* ERC1155 Fuse */\\n\\n /**\\n * @notice Gets the owner of a name\\n * @param id Label as a string of the .eth domain to wrap\\n * @return owner The owner of the name\\n */\\n\\n function ownerOf(\\n uint256 id\\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\\n return super.ownerOf(id);\\n }\\n\\n /**\\n * @notice Gets the owner of a name\\n * @param id Namehash of the name\\n * @return operator Approved operator of a name\\n */\\n\\n function getApproved(\\n uint256 id\\n )\\n public\\n view\\n override(ERC1155Fuse, INameWrapper)\\n returns (address operator)\\n {\\n address owner = ownerOf(id);\\n if (owner == address(0)) {\\n return address(0);\\n }\\n return super.getApproved(id);\\n }\\n\\n /**\\n * @notice Approves an address for a name\\n * @param to address to approve\\n * @param tokenId name to approve\\n */\\n\\n function approve(\\n address to,\\n uint256 tokenId\\n ) public override(ERC1155Fuse, INameWrapper) {\\n (, uint32 fuses, ) = getData(tokenId);\\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\\n revert OperationProhibited(bytes32(tokenId));\\n }\\n super.approve(to, tokenId);\\n }\\n\\n /**\\n * @notice Gets the data for a name\\n * @param id Namehash of the name\\n * @return owner Owner of the name\\n * @return fuses Fuses of the name\\n * @return expiry Expiry of the name\\n */\\n\\n function getData(\\n uint256 id\\n )\\n public\\n view\\n override(ERC1155Fuse, INameWrapper)\\n returns (address owner, uint32 fuses, uint64 expiry)\\n {\\n (owner, fuses, expiry) = super.getData(id);\\n\\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\\n }\\n\\n /* Metadata service */\\n\\n /**\\n * @notice Set the metadata service. Only the owner can do this\\n * @param _metadataService The new metadata service\\n */\\n\\n function setMetadataService(\\n IMetadataService _metadataService\\n ) public onlyOwner {\\n metadataService = _metadataService;\\n }\\n\\n /**\\n * @notice Get the metadata uri\\n * @param tokenId The id of the token\\n * @return string uri of the metadata service\\n */\\n\\n function uri(\\n uint256 tokenId\\n )\\n public\\n view\\n override(INameWrapper, IERC1155MetadataURI)\\n returns (string memory)\\n {\\n return metadataService.uri(tokenId);\\n }\\n\\n /**\\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\\n * to make the contract not upgradable.\\n * @param _upgradeAddress address of an upgraded contract\\n */\\n\\n function setUpgradeContract(\\n INameWrapperUpgrade _upgradeAddress\\n ) public onlyOwner {\\n if (address(upgradeContract) != address(0)) {\\n registrar.setApprovalForAll(address(upgradeContract), false);\\n ens.setApprovalForAll(address(upgradeContract), false);\\n }\\n\\n upgradeContract = _upgradeAddress;\\n\\n if (address(upgradeContract) != address(0)) {\\n registrar.setApprovalForAll(address(upgradeContract), true);\\n ens.setApprovalForAll(address(upgradeContract), true);\\n }\\n }\\n\\n /**\\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\\n * @param node namehash of the name to check\\n */\\n\\n modifier onlyTokenOwner(bytes32 node) {\\n if (!canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n _;\\n }\\n\\n /**\\n * @notice Checks if owner or operator of the owner\\n * @param node namehash of the name to check\\n * @param addr which address to check permissions for\\n * @return whether or not is owner or operator\\n */\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) public view returns (bool) {\\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\\n return\\n (owner == addr || isApprovedForAll(owner, addr)) &&\\n !_isETH2LDInGracePeriod(fuses, expiry);\\n }\\n\\n /**\\n * @notice Checks if owner/operator or approved by owner\\n * @param node namehash of the name to check\\n * @param addr which address to check permissions for\\n * @return whether or not is owner/operator or approved\\n */\\n\\n function canExtendSubnames(\\n bytes32 node,\\n address addr\\n ) public view returns (bool) {\\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\\n return\\n (owner == addr ||\\n isApprovedForAll(owner, addr) ||\\n getApproved(uint256(node)) == addr) &&\\n !_isETH2LDInGracePeriod(fuses, expiry);\\n }\\n\\n /**\\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\\n * @param label Label as a string of the .eth domain to wrap\\n * @param wrappedOwner Owner of the name in this contract\\n * @param ownerControlledFuses Initial owner-controlled fuses to set\\n * @param resolver Resolver contract address\\n */\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) public returns (uint64 expiry) {\\n uint256 tokenId = uint256(keccak256(bytes(label)));\\n address registrant = registrar.ownerOf(tokenId);\\n if (\\n registrant != msg.sender &&\\n !registrar.isApprovedForAll(registrant, msg.sender)\\n ) {\\n revert Unauthorised(\\n _makeNode(ETH_NODE, bytes32(tokenId)),\\n msg.sender\\n );\\n }\\n\\n // transfer the token from the user to this contract\\n registrar.transferFrom(registrant, address(this), tokenId);\\n\\n // transfer the ens record back to the new owner (this contract)\\n registrar.reclaim(tokenId, address(this));\\n\\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\\n\\n _wrapETH2LD(\\n label,\\n wrappedOwner,\\n ownerControlledFuses,\\n expiry,\\n resolver\\n );\\n }\\n\\n /**\\n * @dev Registers a new .eth second-level domain and wraps it.\\n * Only callable by authorised controllers.\\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\\n * @param wrappedOwner The owner of the wrapped name.\\n * @param duration The duration, in seconds, to register the name for.\\n * @param resolver The resolver address to set on the ENS registry (optional).\\n * @param ownerControlledFuses Initial owner-controlled fuses to set\\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\\n */\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external onlyController returns (uint256 registrarExpiry) {\\n uint256 tokenId = uint256(keccak256(bytes(label)));\\n registrarExpiry = registrar.register(tokenId, address(this), duration);\\n _wrapETH2LD(\\n label,\\n wrappedOwner,\\n ownerControlledFuses,\\n uint64(registrarExpiry) + GRACE_PERIOD,\\n resolver\\n );\\n }\\n\\n /**\\n * @notice Renews a .eth second-level domain.\\n * @dev Only callable by authorised controllers.\\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\\n * @param duration The number of seconds to renew the name for.\\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\\n */\\n\\n function renew(\\n uint256 tokenId,\\n uint256 duration\\n ) external onlyController returns (uint256 expires) {\\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\\n\\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\\n\\n // Do not set anything in wrapper if name is not wrapped\\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\\n if (\\n registrarOwner != address(this) ||\\n ens.owner(node) != address(this)\\n ) {\\n return registrarExpiry;\\n }\\n } catch {\\n return registrarExpiry;\\n }\\n\\n // set expiry in Wrapper\\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\\n\\n //use super to allow names expired on the wrapper, but not expired on the registrar to renew()\\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\\n _setData(node, owner, fuses, expiry);\\n\\n return registrarExpiry;\\n }\\n\\n /**\\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\\n * @param name The name to wrap, in DNS format\\n * @param wrappedOwner Owner of the name in this contract\\n * @param resolver Resolver contract\\n */\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) public {\\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\\n bytes32 parentNode = name.namehash(offset);\\n bytes32 node = _makeNode(parentNode, labelhash);\\n\\n names[node] = name;\\n\\n if (parentNode == ETH_NODE) {\\n revert IncompatibleParent();\\n }\\n\\n address owner = ens.owner(node);\\n\\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n if (resolver != address(0)) {\\n ens.setResolver(node, resolver);\\n }\\n\\n ens.setOwner(node, address(this));\\n\\n _wrap(node, name, wrappedOwner, 0, 0);\\n }\\n\\n /**\\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\\n * @param labelhash Labelhash of the .eth domain\\n * @param registrant Sets the owner in the .eth registrar to this address\\n * @param controller Sets the owner in the registry to this address\\n */\\n\\n function unwrapETH2LD(\\n bytes32 labelhash,\\n address registrant,\\n address controller\\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\\n if (registrant == address(this)) {\\n revert IncorrectTargetOwner(registrant);\\n }\\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\\n registrar.safeTransferFrom(\\n address(this),\\n registrant,\\n uint256(labelhash)\\n );\\n }\\n\\n /**\\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\\n * @param controller Sets the owner in the registry to this address\\n */\\n\\n function unwrap(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n address controller\\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\\n if (parentNode == ETH_NODE) {\\n revert IncompatibleParent();\\n }\\n if (controller == address(0x0) || controller == address(this)) {\\n revert IncorrectTargetOwner(controller);\\n }\\n _unwrap(_makeNode(parentNode, labelhash), controller);\\n }\\n\\n /**\\n * @notice Sets fuses of a name\\n * @param node Namehash of the name\\n * @param ownerControlledFuses Owner-controlled fuses to burn\\n * @return Old fuses\\n */\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n )\\n public\\n onlyTokenOwner(node)\\n operationAllowed(node, CANNOT_BURN_FUSES)\\n returns (uint32)\\n {\\n // owner protected by onlyTokenOwner\\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\\n uint256(node)\\n );\\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\\n return oldFuses;\\n }\\n\\n /**\\n * @notice Extends expiry for a name\\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\\n * @param expiry When the name will expire in seconds since the Unix epoch\\n * @return New expiry\\n */\\n\\n function extendExpiry(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint64 expiry\\n ) public returns (uint64) {\\n bytes32 node = _makeNode(parentNode, labelhash);\\n\\n if (!_isWrapped(node)) {\\n revert NameIsNotWrapped();\\n }\\n\\n // this flag is used later, when checking fuses\\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\\n // only allow the owner of the name or owner of the parent name\\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n\\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\\n revert OperationProhibited(node);\\n }\\n\\n // max expiry is set to the expiry of the parent\\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\\n\\n _setData(node, owner, fuses, expiry);\\n emit ExpiryExtended(node, expiry);\\n return expiry;\\n }\\n\\n /**\\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\\n * @dev Can be called by the owner or an authorised caller\\n * @param name The name to upgrade, in DNS format\\n * @param extraData Extra data to pass to the upgrade contract\\n */\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) public {\\n bytes32 node = name.namehash(0);\\n\\n if (address(upgradeContract) == address(0)) {\\n revert CannotUpgrade();\\n }\\n\\n if (!canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\\n uint256(node)\\n );\\n\\n address approved = getApproved(uint256(node));\\n\\n _burn(uint256(node));\\n\\n upgradeContract.wrapFromUpgrade(\\n name,\\n currentOwner,\\n fuses,\\n expiry,\\n approved,\\n extraData\\n );\\n }\\n\\n /** \\n /* @notice Sets fuses of a name that you own the parent of\\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\\n * @param fuses Fuses to burn\\n * @param expiry When the name will expire in seconds since the Unix epoch\\n */\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) public {\\n bytes32 node = _makeNode(parentNode, labelhash);\\n _checkFusesAreSettable(node, fuses);\\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n if (owner == address(0) || ens.owner(node) != address(this)) {\\n revert NameIsNotWrapped();\\n }\\n // max expiry is set to the expiry of the parent\\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\\n if (parentNode == ROOT_NODE) {\\n if (!canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n } else {\\n if (!canModifyName(parentNode, msg.sender)) {\\n revert Unauthorised(parentNode, msg.sender);\\n }\\n }\\n\\n _checkParentFuses(node, fuses, parentFuses);\\n\\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\\n\\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\\n if (\\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\\n oldFuses | fuses != oldFuses\\n ) {\\n revert OperationProhibited(node);\\n }\\n fuses |= oldFuses;\\n _setFuses(node, owner, fuses, oldExpiry, expiry);\\n }\\n\\n /**\\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\\n * @param parentNode Parent namehash of the subdomain\\n * @param label Label of the subdomain as a string\\n * @param owner New owner in the wrapper\\n * @param fuses Initial fuses for the wrapped subdomain\\n * @param expiry When the name will expire in seconds since the Unix epoch\\n * @return node Namehash of the subdomain\\n */\\n\\n function setSubnodeOwner(\\n bytes32 parentNode,\\n string calldata label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\\n bytes32 labelhash = keccak256(bytes(label));\\n node = _makeNode(parentNode, labelhash);\\n _checkCanCallSetSubnodeOwner(parentNode, node);\\n _checkFusesAreSettable(node, fuses);\\n bytes memory name = _saveLabel(parentNode, node, label);\\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\\n\\n if (!_isWrapped(node)) {\\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\\n _wrap(node, name, owner, fuses, expiry);\\n } else {\\n _updateName(parentNode, node, label, owner, fuses, expiry);\\n }\\n }\\n\\n /**\\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\\n * @param parentNode parent namehash of the subdomain\\n * @param label label of the subdomain as a string\\n * @param owner new owner in the wrapper\\n * @param resolver resolver contract in the registry\\n * @param ttl ttl in the registry\\n * @param fuses initial fuses for the wrapped subdomain\\n * @param expiry When the name will expire in seconds since the Unix epoch\\n * @return node Namehash of the subdomain\\n */\\n\\n function setSubnodeRecord(\\n bytes32 parentNode,\\n string memory label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\\n bytes32 labelhash = keccak256(bytes(label));\\n node = _makeNode(parentNode, labelhash);\\n _checkCanCallSetSubnodeOwner(parentNode, node);\\n _checkFusesAreSettable(node, fuses);\\n _saveLabel(parentNode, node, label);\\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\\n if (!_isWrapped(node)) {\\n ens.setSubnodeRecord(\\n parentNode,\\n labelhash,\\n address(this),\\n resolver,\\n ttl\\n );\\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\\n } else {\\n ens.setSubnodeRecord(\\n parentNode,\\n labelhash,\\n address(this),\\n resolver,\\n ttl\\n );\\n _updateName(parentNode, node, label, owner, fuses, expiry);\\n }\\n }\\n\\n /**\\n * @notice Sets records for the name in the ENS Registry\\n * @param node Namehash of the name to set a record for\\n * @param owner New owner in the registry\\n * @param resolver Resolver contract\\n * @param ttl Time to live in the registry\\n */\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n )\\n public\\n onlyTokenOwner(node)\\n operationAllowed(\\n node,\\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\\n )\\n {\\n ens.setRecord(node, address(this), resolver, ttl);\\n if (owner == address(0)) {\\n (, uint32 fuses, ) = getData(uint256(node));\\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\\n revert IncorrectTargetOwner(owner);\\n }\\n _unwrap(node, address(0));\\n } else {\\n address oldOwner = ownerOf(uint256(node));\\n _transfer(oldOwner, owner, uint256(node), 1, \\\"\\\");\\n }\\n }\\n\\n /**\\n * @notice Sets resolver contract in the registry\\n * @param node namehash of the name\\n * @param resolver the resolver contract\\n */\\n\\n function setResolver(\\n bytes32 node,\\n address resolver\\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\\n ens.setResolver(node, resolver);\\n }\\n\\n /**\\n * @notice Sets TTL in the registry\\n * @param node Namehash of the name\\n * @param ttl TTL in the registry\\n */\\n\\n function setTTL(\\n bytes32 node,\\n uint64 ttl\\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\\n ens.setTTL(node, ttl);\\n }\\n\\n /**\\n * @dev Allows an operation only if none of the specified fuses are burned.\\n * @param node The namehash of the name to check fuses on.\\n * @param fuseMask A bitmask of fuses that must not be burned.\\n */\\n\\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\\n (, uint32 fuses, ) = getData(uint256(node));\\n if (fuses & fuseMask != 0) {\\n revert OperationProhibited(node);\\n }\\n _;\\n }\\n\\n /**\\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\\n * replacing a subdomain. If either conditions are true, then it is possible to call\\n * setSubnodeOwner\\n * @param parentNode Namehash of the parent name to check\\n * @param subnode Namehash of the subname to check\\n */\\n\\n function _checkCanCallSetSubnodeOwner(\\n bytes32 parentNode,\\n bytes32 subnode\\n ) internal view {\\n (\\n address subnodeOwner,\\n uint32 subnodeFuses,\\n uint64 subnodeExpiry\\n ) = getData(uint256(subnode));\\n\\n // check if the registry owner is 0 and expired\\n // check if the wrapper owner is 0 and expired\\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\\n bool expired = subnodeExpiry < block.timestamp;\\n if (\\n expired &&\\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\\n (subnodeOwner == address(0) ||\\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\\n ens.owner(subnode) == address(0))\\n ) {\\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\\n revert OperationProhibited(subnode);\\n }\\n } else {\\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\\n revert OperationProhibited(subnode);\\n }\\n }\\n }\\n\\n /**\\n * @notice Checks all Fuses in the mask are burned for the node\\n * @param node Namehash of the name\\n * @param fuseMask The fuses you want to check\\n * @return Boolean of whether or not all the selected fuses are burned\\n */\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) public view returns (bool) {\\n (, uint32 fuses, ) = getData(uint256(node));\\n return fuses & fuseMask == fuseMask;\\n }\\n\\n /**\\n * @notice Checks if a name is wrapped\\n * @param node Namehash of the name\\n * @return Boolean of whether or not the name is wrapped\\n */\\n\\n function isWrapped(bytes32 node) public view returns (bool) {\\n bytes memory name = names[node];\\n if (name.length == 0) {\\n return false;\\n }\\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\\n bytes32 parentNode = name.namehash(offset);\\n return isWrapped(parentNode, labelhash);\\n }\\n\\n /**\\n * @notice Checks if a name is wrapped in a more gas efficient way\\n * @param parentNode Namehash of the name\\n * @param labelhash Namehash of the name\\n * @return Boolean of whether or not the name is wrapped\\n */\\n\\n function isWrapped(\\n bytes32 parentNode,\\n bytes32 labelhash\\n ) public view returns (bool) {\\n bytes32 node = _makeNode(parentNode, labelhash);\\n bool wrapped = _isWrapped(node);\\n if (parentNode != ETH_NODE) {\\n return wrapped;\\n }\\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\\n return owner == address(this);\\n } catch {\\n return false;\\n }\\n }\\n\\n function onERC721Received(\\n address to,\\n address,\\n uint256 tokenId,\\n bytes calldata data\\n ) public returns (bytes4) {\\n //check if it's the eth registrar ERC721\\n if (msg.sender != address(registrar)) {\\n revert IncorrectTokenType();\\n }\\n\\n (\\n string memory label,\\n address owner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) = abi.decode(data, (string, address, uint16, address));\\n\\n bytes32 labelhash = bytes32(tokenId);\\n bytes32 labelhashFromData = keccak256(bytes(label));\\n\\n if (labelhashFromData != labelhash) {\\n revert LabelMismatch(labelhashFromData, labelhash);\\n }\\n\\n // transfer the ens record back to the new owner (this contract)\\n registrar.reclaim(uint256(labelhash), address(this));\\n\\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\\n\\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\\n\\n return IERC721Receiver(to).onERC721Received.selector;\\n }\\n\\n /***** Internal functions */\\n\\n function _beforeTransfer(\\n uint256 id,\\n uint32 fuses,\\n uint64 expiry\\n ) internal override {\\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\\n expiry -= GRACE_PERIOD;\\n }\\n\\n if (expiry < block.timestamp) {\\n // Transferable if the name was not emancipated\\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\\n revert(\\\"ERC1155: insufficient balance for transfer\\\");\\n }\\n } else {\\n // Transferable if CANNOT_TRANSFER is unburned\\n if (fuses & CANNOT_TRANSFER != 0) {\\n revert OperationProhibited(bytes32(id));\\n }\\n }\\n\\n // delete token approval if CANNOT_APPROVE has not been burnt\\n if (fuses & CANNOT_APPROVE == 0) {\\n delete _tokenApprovals[id];\\n }\\n }\\n\\n function _clearOwnerAndFuses(\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal view override returns (address, uint32) {\\n if (expiry < block.timestamp) {\\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\\n owner = address(0);\\n }\\n fuses = 0;\\n }\\n\\n return (owner, fuses);\\n }\\n\\n function _makeNode(\\n bytes32 node,\\n bytes32 labelhash\\n ) private pure returns (bytes32) {\\n return keccak256(abi.encodePacked(node, labelhash));\\n }\\n\\n function _addLabel(\\n string memory label,\\n bytes memory name\\n ) internal pure returns (bytes memory ret) {\\n if (bytes(label).length < 1) {\\n revert LabelTooShort();\\n }\\n if (bytes(label).length > 255) {\\n revert LabelTooLong(label);\\n }\\n return abi.encodePacked(uint8(bytes(label).length), label, name);\\n }\\n\\n function _mint(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal override {\\n _canFusesBeBurned(node, fuses);\\n (address oldOwner, , ) = super.getData(uint256(node));\\n if (oldOwner != address(0)) {\\n // burn and unwrap old token of old owner\\n _burn(uint256(node));\\n emit NameUnwrapped(node, address(0));\\n }\\n super._mint(node, owner, fuses, expiry);\\n }\\n\\n function _wrap(\\n bytes32 node,\\n bytes memory name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n _mint(node, wrappedOwner, fuses, expiry);\\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\\n }\\n\\n function _storeNameAndWrap(\\n bytes32 parentNode,\\n bytes32 node,\\n string memory label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n bytes memory name = _addLabel(label, names[parentNode]);\\n _wrap(node, name, owner, fuses, expiry);\\n }\\n\\n function _saveLabel(\\n bytes32 parentNode,\\n bytes32 node,\\n string memory label\\n ) internal returns (bytes memory) {\\n bytes memory name = _addLabel(label, names[parentNode]);\\n names[node] = name;\\n return name;\\n }\\n\\n function _updateName(\\n bytes32 parentNode,\\n bytes32 node,\\n string memory label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n bytes memory name = _addLabel(label, names[parentNode]);\\n if (names[node].length == 0) {\\n names[node] = name;\\n }\\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\\n if (owner == address(0)) {\\n _unwrap(node, address(0));\\n } else {\\n _transfer(oldOwner, owner, uint256(node), 1, \\\"\\\");\\n }\\n }\\n\\n // wrapper function for stack limit\\n function _checkParentFusesAndExpiry(\\n bytes32 parentNode,\\n bytes32 node,\\n uint32 fuses,\\n uint64 expiry\\n ) internal view returns (uint64) {\\n (, , uint64 oldExpiry) = getData(uint256(node));\\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\\n _checkParentFuses(node, fuses, parentFuses);\\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\\n }\\n\\n function _checkParentFuses(\\n bytes32 node,\\n uint32 fuses,\\n uint32 parentFuses\\n ) internal pure {\\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\\n 0;\\n\\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\\n\\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\\n revert OperationProhibited(node);\\n }\\n }\\n\\n function _normaliseExpiry(\\n uint64 expiry,\\n uint64 oldExpiry,\\n uint64 maxExpiry\\n ) private pure returns (uint64) {\\n // Expiry cannot be more than maximum allowed\\n // .eth names will check registrar, non .eth check parent\\n if (expiry > maxExpiry) {\\n expiry = maxExpiry;\\n }\\n // Expiry cannot be less than old expiry\\n if (expiry < oldExpiry) {\\n expiry = oldExpiry;\\n }\\n\\n return expiry;\\n }\\n\\n function _wrapETH2LD(\\n string memory label,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address resolver\\n ) private {\\n bytes32 labelhash = keccak256(bytes(label));\\n bytes32 node = _makeNode(ETH_NODE, labelhash);\\n // hardcode dns-encoded eth string for gas savings\\n bytes memory name = _addLabel(label, \\\"\\\\x03eth\\\\x00\\\");\\n names[node] = name;\\n\\n _wrap(\\n node,\\n name,\\n wrappedOwner,\\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\\n expiry\\n );\\n\\n if (resolver != address(0)) {\\n ens.setResolver(node, resolver);\\n }\\n }\\n\\n function _unwrap(bytes32 node, address owner) private {\\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\\n revert OperationProhibited(node);\\n }\\n\\n // Burn token and fuse data\\n _burn(uint256(node));\\n ens.setOwner(node, owner);\\n\\n emit NameUnwrapped(node, owner);\\n }\\n\\n function _setFuses(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 oldExpiry,\\n uint64 expiry\\n ) internal {\\n _setData(node, owner, fuses, expiry);\\n emit FusesSet(node, fuses);\\n if (expiry > oldExpiry) {\\n emit ExpiryExtended(node, expiry);\\n }\\n }\\n\\n function _setData(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n _canFusesBeBurned(node, fuses);\\n super._setData(uint256(node), owner, fuses, expiry);\\n }\\n\\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\\n if (\\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\\n ) {\\n revert OperationProhibited(node);\\n }\\n }\\n\\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\\n // Cannot directly burn other non-user settable fuses\\n revert OperationProhibited(node);\\n }\\n }\\n\\n function _isWrapped(bytes32 node) internal view returns (bool) {\\n return\\n ownerOf(uint256(node)) != address(0) &&\\n ens.owner(node) == address(this);\\n }\\n\\n function _isETH2LDInGracePeriod(\\n uint32 fuses,\\n uint64 expiry\\n ) internal view returns (bool) {\\n return\\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\\n expiry - GRACE_PERIOD < block.timestamp;\\n }\\n}\\n\",\"keccak256\":\"0xf748ce264c7eea247e67cf8eb53f711262ab6b9f077d9972ace62b8a10542d81\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c06040523480156200001157600080fd5b50604051620064b1380380620064b18339810160408190526200003491620001f1565b6200003f3362000188565b6001600160a01b0383811660805282811660a052600580546001600160a01b031916918316919091179055600163fffeffff60a01b03197fafa26c20e8b3d9a2853d642cfe1021dae26242ffedfac91c97aab212c1a4b93b8190557fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb4955604080518082019091526001815260006020808301829052908052600690527f54cdd369e4e8a8515e52ca72ec816c2101831ad1f18bf44102ed171459c9b4f890620001099082620002ea565b506040805180820190915260058152626cae8d60e31b6020808301919091527f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae600052600690527ffb9e8e321b8a5ec48f12a7b41f22c6e595d761285c9eb19d8dda7c99edf1b54f906200017e9082620002ea565b50505050620003b6565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114620001ee57600080fd5b50565b6000806000606084860312156200020757600080fd5b83516200021481620001d8565b60208501519093506200022781620001d8565b60408501519092506200023a81620001d8565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200027057607f821691505b6020821081036200029157634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620002e557600081815260208120601f850160051c81016020861015620002c05750805b601f850160051c820191505b81811015620002e157828155600101620002cc565b5050505b505050565b81516001600160401b0381111562000306576200030662000245565b6200031e816200031784546200025b565b8462000297565b602080601f8311600181146200035657600084156200033d5750858301515b600019600386901b1c1916600185901b178555620002e1565b600085815260208120601f198616915b82811015620003875788860151825594840194600190910190840162000366565b5085821015620003a65787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a051615fee620004c36000396000818161050601528181610c1501528181610cef01528181610d7901528181611c8401528181611d1a01528181611dc801528181611eea01528181611f6001528181611fe001528181612277015281816123b3015281816124f2015281816126ec015281816127720152612fa701526000818161055301528181610b9b01528181610ee4015281816110980152818161114a0152818161157301528181612438015281816125770152818161281d01528181612a1401528181612d22015281816131d20152818161328001528181613349015281816133c201528181613a1f01528181613b3a01528181613da201526144220152615fee6000f3fe608060405234801561001057600080fd5b506004361061031f5760003560e01c80636352211e116101a7578063c93ab3fd116100ee578063e985e9c511610097578063f242432a11610071578063f242432a146107d7578063f2fde38b146107ea578063fd0cd0d9146107fd57600080fd5b8063e985e9c514610768578063eb8ae530146107a4578063ed70554d146107b757600080fd5b8063d9a50c12116100c8578063d9a50c121461071f578063da8c229e14610732578063e0dba60f1461075557600080fd5b8063c93ab3fd146106e6578063cf408823146106f9578063d8c9921a1461070c57600080fd5b8063a22cb46511610150578063b6bcad261161012a578063b6bcad26146106ad578063c475abff146106c0578063c658e086146106d357600080fd5b8063a22cb46514610674578063a401498214610687578063adf4960a1461069a57600080fd5b80638b4dfa75116101815780638b4dfa751461063d5780638cf8b41e146106505780638da5cb5b1461066357600080fd5b80636352211e146105f65780636e5d6ad214610609578063715018a61461063557600080fd5b80631f4e15041161026b5780633f15457f116102145780634e1273f4116101ee5780634e1273f4146105b057806353095467146105d05780635d3590d5146105e357600080fd5b80633f15457f1461054e578063402906fc1461057557806341415eab1461059d57600080fd5b80632b20e397116102455780632b20e397146105015780632eb2c2d61461052857806333c69ea91461053b57600080fd5b80631f4e1504146104c857806320c38e2b146104db57806324c1af44146104ee57600080fd5b80630e4cd725116102cd578063150b7a02116102a7578063150b7a02146104765780631534e177146104a25780631896f70a146104b557600080fd5b80630e4cd7251461043d5780630e89341c1461045057806314ab90381461046357600080fd5b806306fdde03116102fe57806306fdde03146103b4578063081812fc146103fd578063095ea7b31461042857600080fd5b8062fdd58e146103245780630178fe3f1461034a57806301ffc9a714610391575b600080fd5b610337610332366004614e1d565b610810565b6040519081526020015b60405180910390f35b61035d610358366004614e49565b6108cf565b604080516001600160a01b03909416845263ffffffff909216602084015267ffffffffffffffff1690820152606001610341565b6103a461039f366004614e78565b6108ff565b6040519015158152602001610341565b6103f06040518060400160405280600b81526020017f4e616d655772617070657200000000000000000000000000000000000000000081525081565b6040516103419190614ee5565b61041061040b366004614e49565b610958565b6040516001600160a01b039091168152602001610341565b61043b610436366004614e1d565b61099d565b005b6103a461044b366004614ef8565b6109e3565b6103f061045e366004614e49565b610a7d565b61043b610471366004614f45565b610aef565b610489610484366004614fba565b610c08565b6040516001600160e01b03199091168152602001610341565b61043b6104b036600461502d565b610e1a565b61043b6104c3366004614ef8565b610e51565b600754610410906001600160a01b031681565b6103f06104e9366004614e49565b610f13565b6103376104fc366004615125565b610fad565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b61043b61053636600461524d565b6111c1565b61043b6105493660046152fb565b6114fc565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b610588610583366004615353565b6116f1565b60405163ffffffff9091168152602001610341565b6103a46105ab366004614ef8565b611793565b6105c36105be366004615376565b6117f0565b6040516103419190615474565b600554610410906001600160a01b031681565b61043b6105f1366004615487565b61192e565b610410610604366004614e49565b6119c8565b61061c6106173660046154c8565b6119d3565b60405167ffffffffffffffff9091168152602001610341565b61043b611b28565b61043b61064b3660046154fd565b611b3c565b61061c61065e36600461553f565b611ce6565b6000546001600160a01b0316610410565b61043b6106823660046155c8565b6120b2565b6103376106953660046155f6565b61219c565b6103a46106a8366004615677565b61234c565b61043b6106bb36600461502d565b612371565b6103376106ce36600461569a565b6125d6565b6103376106e13660046156bc565b6128e2565b61043b6106f436600461572f565b612aef565b61043b61070736600461579b565b612c60565b61043b61071a3660046157d3565b612e19565b6103a461072d36600461569a565b612f29565b6103a461074036600461502d565b60046020526000908152604090205460ff1681565b61043b6107633660046155c8565b613036565b6103a4610776366004615801565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b61043b6107b236600461582f565b61309e565b6103376107c5366004614e49565b60016020526000908152604090205481565b61043b6107e5366004615897565b613469565b61043b6107f836600461502d565b613586565b6103a461080b366004614e49565b613613565b60006001600160a01b0383166108935760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084015b60405180910390fd5b600061089e836119c8565b9050836001600160a01b0316816001600160a01b0316036108c35760019150506108c9565b60009150505b92915050565b60008181526001602052604090205460a081901c60c082901c6108f38383836136eb565b90959094509092509050565b60006001600160e01b031982167fd82c42d800000000000000000000000000000000000000000000000000000000148061094957506001600160e01b03198216630a85bd0160e11b145b806108c957506108c982613722565b600080610964836119c8565b90506001600160a01b03811661097d5750600092915050565b6000838152600360205260409020546001600160a01b03165b9392505050565b60006109a8826108cf565b50915050603f1960408216016109d45760405163a2a7201360e01b81526004810183905260240161088a565b6109de83836137a4565b505050565b60008080806109f1866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a3c57506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff165b80610a6057506001600160a01b038516610a5587610958565b6001600160a01b0316145b8015610a735750610a7182826138ee565b155b9695505050505050565b6005546040516303a24d0760e21b8152600481018390526060916001600160a01b031690630e89341c90602401600060405180830381865afa158015610ac7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108c99190810190615900565b81610afa8133611793565b610b205760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260106000610b2e836108cf565b5091505063ffffffff8282161615610b5c5760405163a2a7201360e01b81526004810184905260240161088a565b6040517f14ab90380000000000000000000000000000000000000000000000000000000081526004810187905267ffffffffffffffff861660248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906314ab9038906044015b600060405180830381600087803b158015610be857600080fd5b505af1158015610bfc573d6000803e3d6000fd5b50505050505050505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610c6c576040517f1931a53800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080610c7d86880188615978565b83516020850120939750919550935091508890808214610cd3576040517fc65c3ccc000000000000000000000000000000000000000000000000000000008152600481018290526024810183905260440161088a565b604051630a3b53db60e21b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906328ed4f6c90604401600060405180830381600087803b158015610d3b57600080fd5b505af1158015610d4f573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018d9052600092506276a70091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d6e4fa8690602401602060405180830381865afa158015610dc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de491906159e0565b610dee9190615a0f565b9050610e0187878761ffff16848861391f565b50630a85bd0160e11b9c9b505050505050505050505050565b610e22613a85565b6005805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b81610e5c8133611793565b610e825760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260086000610e90836108cf565b5091505063ffffffff8282161615610ebe5760405163a2a7201360e01b81526004810184905260240161088a565b604051630c4b7b8560e11b8152600481018790526001600160a01b0386811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401610bce565b60066020526000908152604090208054610f2c90615a37565b80601f0160208091040260200160405190810160405280929190818152602001828054610f5890615a37565b8015610fa55780601f10610f7a57610100808354040283529160200191610fa5565b820191906000526020600020905b815481529060010190602001808311610f8857829003601f168201915b505050505081565b600087610fba8133611793565b610fe05760405163168ab55d60e31b81526004810182905233602482015260440161088a565b875160208901206110188a82604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506110248a84613adf565b61102e8386613c1e565b6110398a848b613c51565b506110468a848787613d1e565b935061105183613d64565b611107576040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156110dc57600080fd5b505af11580156110f0573d6000803e3d6000fd5b505050506111028a848b8b8989613e1d565b6111b4565b6040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561118e57600080fd5b505af11580156111a2573d6000803e3d6000fd5b505050506111b48a848b8b8989613e54565b5050979650505050505050565b81518351146112385760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060448201527f6d69736d61746368000000000000000000000000000000000000000000000000606482015260840161088a565b6001600160a01b03841661129c5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b0385163314806112d657506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b6113485760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000606482015260840161088a565b60005b835181101561148f57600084828151811061136857611368615a71565b60200260200101519050600084838151811061138657611386615a71565b60200260200101519050600080600061139e856108cf565b9250925092506113af858383613f18565b8360011480156113d057508a6001600160a01b0316836001600160a01b0316145b61142f5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b60008581526001602052604090206001600160a01b038b1663ffffffff60a01b60a085901b161777ffffffffffffffffffffffffffffffffffffffffffffffff1960c084901b1617905550505050508061148890615a87565b905061134b565b50836001600160a01b0316856001600160a01b0316336001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516114df929190615aa0565b60405180910390a46114f5338686868686614012565b5050505050565b6040805160208082018790528183018690528251808303840181526060909201909252805191012061152e8184613c1e565b6000808061153b846108cf565b919450925090506001600160a01b03831615806115ea57506040516302571be360e01b81526004810185905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa1580156115ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115de9190615ace565b6001600160a01b031614155b1561160857604051635374b59960e01b815260040160405180910390fd5b6000806116148a6108cf565b90935091508a90506116555761162a8633611793565b6116505760405163168ab55d60e31b81526004810187905233602482015260440161088a565b611685565b61165f8a33611793565b6116855760405163168ab55d60e31b8152600481018b905233602482015260440161088a565b6116908689846141cc565b61169b878483614207565b9650620100008416158015906116bf57508363ffffffff1688851763ffffffff1614155b156116e05760405163a2a7201360e01b81526004810187905260240161088a565b96831796610bfc86868a868b614251565b6000826116fe8133611793565b6117245760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8360026000611732836108cf565b5091505063ffffffff82821616156117605760405163a2a7201360e01b81526004810184905260240161088a565b6000808061176d8a6108cf565b9250925092506117868a84848c61ffff16178485614251565b5098975050505050505050565b60008080806117a1866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a6057506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff16610a60565b606081518351146118695760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d617463680000000000000000000000000000000000000000000000606482015260840161088a565b6000835167ffffffffffffffff8111156118855761188561504a565b6040519080825280602002602001820160405280156118ae578160200160208202803683370190505b50905060005b8451811015611926576118f98582815181106118d2576118d2615a71565b60200260200101518583815181106118ec576118ec615a71565b6020026020010151610810565b82828151811061190b5761190b615a71565b602090810291909101015261191f81615a87565b90506118b4565b509392505050565b611936613a85565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af115801561199e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c29190615aeb565b50505050565b60006108c9826142fb565b60408051602080820186905281830185905282518083038401815260609092019092528051910120600090611a0781613d64565b611a2457604051635374b59960e01b815260040160405180910390fd5b6000611a3086336109e3565b905080158015611a475750611a458233611793565b155b15611a6e5760405163168ab55d60e31b81526004810183905233602482015260440161088a565b60008080611a7b856108cf565b92509250925083158015611a925750620400008216155b15611ab35760405163a2a7201360e01b81526004810186905260240161088a565b6000611abe8a6108cf565b92505050611acd888383614207565b9750611adb8685858b614311565b60405167ffffffffffffffff8916815286907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b1329060200160405180910390a2509598975050505050505050565b611b30613a85565b611b3a600061436a565b565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830186905282518083038401815260609092019092528051910120611b908133611793565b611bb65760405163168ab55d60e31b81526004810182905233602482015260440161088a565b306001600160a01b03841603611bea57604051632ca49b0d60e11b81526001600160a01b038416600482015260240161088a565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830187905282518083038401815260609092019092528051910120611c3f905b836143c7565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038481166024830152604482018690527f000000000000000000000000000000000000000000000000000000000000000016906342842e0e90606401600060405180830381600087803b158015611cc857600080fd5b505af1158015611cdc573d6000803e3d6000fd5b5050505050505050565b6000808686604051611cf9929190615b08565b6040519081900381206331a9108f60e11b82526004820181905291506000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611d69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d8d9190615ace565b90506001600160a01b0381163314801590611e35575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015611e0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e339190615aeb565b155b15611ea557604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae6020808301919091528183018590528251808303840181526060830193849052805191012063168ab55d60e31b909252606481019190915233608482015260a40161088a565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152306024830152604482018490527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90606401600060405180830381600087803b158015611f2e57600080fd5b505af1158015611f42573d6000803e3d6000fd5b5050604051630a3b53db60e21b8152600481018590523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506328ed4f6c9150604401600060405180830381600087803b158015611fae57600080fd5b505af1158015611fc2573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018590526276a70092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316915063d6e4fa8690602401602060405180830381865afa158015612030573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205491906159e0565b61205e9190615a0f565b92506120a788888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff8816868861391f565b505095945050505050565b6001600160a01b03821633036121305760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c660000000000000000000000000000000000000000000000606482015260840161088a565b3360008181526002602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b3360009081526004602052604081205460ff166122215760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f60448201527f6e74726f6c6c6572000000000000000000000000000000000000000000000000606482015260840161088a565b60008787604051612233929190615b08565b6040519081900381207ffca247ac000000000000000000000000000000000000000000000000000000008252600482018190523060248301526044820187905291507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fca247ac906064016020604051808303816000875af11580156122c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122ec91906159e0565b915061234188888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff861661233b6276a70087615a0f565b8861391f565b509695505050505050565b600080612358846108cf565b50841663ffffffff908116908516149250505092915050565b612379613a85565b6007546001600160a01b0316156124995760075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156123f957600080fd5b505af115801561240d573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561248057600080fd5b505af1158015612494573d6000803e3d6000fd5b505050505b6007805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316908117909155156125d35760075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b15801561253857600080fd5b505af115801561254c573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b1580156125bf57600080fd5b505af11580156114f5573d6000803e3d6000fd5b50565b3360009081526004602052604081205460ff1661265b5760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f60448201527f6e74726f6c6c6572000000000000000000000000000000000000000000000000606482015260840161088a565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301869052825180830384018152606090920190925280519101206000906040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101869052602481018590529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c475abff906044016020604051808303816000875af1158015612735573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061275991906159e0565b6040516331a9108f60e11b8152600481018790529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa9250505080156127dd575060408051601f3d908101601f191682019092526127da91810190615ace565b60015b6127ea5791506108c99050565b6001600160a01b0381163014158061289457506040516302571be360e01b81526004810184905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015612864573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128889190615ace565b6001600160a01b031614155b156128a3575091506108c99050565b5060006128b36276a70083615a0f565b60008481526001602052604090205490915060a081901c6128d685838386614311565b50919695505050505050565b6000866128ef8133611793565b6129155760405163168ab55d60e31b81526004810182905233602482015260440161088a565b60008787604051612927929190615b08565b604051809103902090506129628982604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b925061296e8984613adf565b6129788386613c1e565b60006129bb8a858b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613c5192505050565b90506129c98a858888613d1e565b94506129d484613d64565b612a9c576040517f06ab5923000000000000000000000000000000000000000000000000000000008152600481018b9052602481018390523060448201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906306ab5923906064016020604051808303816000875af1158015612a65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a8991906159e0565b50612a9784828989896144b9565b612ae2565b612ae28a858b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d92508c91508b9050613e54565b5050509695505050505050565b6000612b35600086868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506144fb9050565b6007549091506001600160a01b0316612b7a576040517f24c1d6d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612b848133611793565b612baa5760405163168ab55d60e31b81526004810182905233602482015260440161088a565b60008080612bb7846108cf565b919450925090506000612bc985610958565b9050612bd4856145ba565b600760009054906101000a90046001600160a01b03166001600160a01b0316639198c2768a8a878787878e8e6040518963ffffffff1660e01b8152600401612c23989796959493929190615b41565b600060405180830381600087803b158015612c3d57600080fd5b505af1158015612c51573d6000803e3d6000fd5b50505050505050505050505050565b83612c6b8133611793565b612c915760405163168ab55d60e31b81526004810182905233602482015260440161088a565b84601c6000612c9f836108cf565b5091505063ffffffff8282161615612ccd5760405163a2a7201360e01b81526004810184905260240161088a565b6040517fcf408823000000000000000000000000000000000000000000000000000000008152600481018990523060248201526001600160a01b03878116604483015267ffffffffffffffff871660648301527f0000000000000000000000000000000000000000000000000000000000000000169063cf40882390608401600060405180830381600087803b158015612d6657600080fd5b505af1158015612d7a573d6000803e3d6000fd5b5050506001600160a01b0388169050612de1576000612d98896108cf565b509150506201ffff1962020000821601612dd057604051632ca49b0d60e11b81526001600160a01b038916600482015260240161088a565b612ddb8960006143c7565b50611cdc565b6000612dec896119c8565b9050612e0e81898b60001c60016040518060200160405280600081525061469a565b505050505050505050565b60408051602080820186905281830185905282518083038401815260609092019092528051910120612e4b8133611793565b612e715760405163168ab55d60e31b81526004810182905233602482015260440161088a565b7f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b528401612eb15760405163615a470360e01b815260040160405180910390fd5b6001600160a01b0382161580612ecf57506001600160a01b03821630145b15612ef857604051632ca49b0d60e11b81526001600160a01b038316600482015260240161088a565b604080516020808201879052818301869052825180830384018152606090920190925280519101206119c290611c39565b604080516020808201859052818301849052825180830384018152606090920190925280519101206000906000612f5f82613d64565b90507f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae8514612f915791506108c99050565b6040516331a9108f60e11b8152600481018590527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa925050508015613012575060408051601f3d908101601f1916820190925261300f91810190615ace565b60015b613021576000925050506108c9565b6001600160a01b0316301492506108c9915050565b61303e613a85565b6001600160a01b038216600081815260046020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf8791015b60405180910390a25050565b6000806130e5600087878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506147fd9050565b91509150600061312e8288888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506144fb9050565b604080516020808201849052818301879052825180830384018152606090920190925280519101209091506000906000818152600660205260409020909150613178888a83615bf0565b507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b5282016131b95760405163615a470360e01b815260040160405180910390fd5b6040516302571be360e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015613221573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132459190615ace565b90506001600160a01b03811633148015906132ed575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa1580156132c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132eb9190615aeb565b155b156133145760405163168ab55d60e31b81526004810183905233602482015260440161088a565b6001600160a01b038616156133a657604051630c4b7b8560e11b8152600481018390526001600160a01b0387811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b15801561338d57600080fd5b505af11580156133a1573d6000803e3d6000fd5b505050505b604051635b0fc9c360e01b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635b0fc9c390604401600060405180830381600087803b15801561340e57600080fd5b505af1158015613422573d6000803e3d6000fd5b50505050612e0e828a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508d935091508190506144b9565b6001600160a01b0384166134cd5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b03851633148061350757506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b6135795760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201527f20617070726f7665640000000000000000000000000000000000000000000000606482015260840161088a565b6114f5858585858561469a565b61358e613a85565b6001600160a01b03811661360a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161088a565b6125d38161436a565b6000818152600660205260408120805482919061362f90615a37565b80601f016020809104026020016040519081016040528092919081815260200182805461365b90615a37565b80156136a85780601f1061367d576101008083540402835291602001916136a8565b820191906000526020600020905b81548152906001019060200180831161368b57829003601f168201915b5050505050905080516000036136c15750600092915050565b6000806136ce83826147fd565b909250905060006136df84836144fb565b9050610a738184612f29565b600080428367ffffffffffffffff1610156137195761ffff196201000085160161371457600094505b600093505b50929391925050565b60006001600160e01b031982167fd9b67a2600000000000000000000000000000000000000000000000000000000148061376c57506001600160e01b031982166303a24d0760e21b145b806108c957507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146108c9565b60006137af826119c8565b9050806001600160a01b0316836001600160a01b0316036138385760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f7200000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b336001600160a01b038216148061387257506001600160a01b038116600090815260026020908152604080832033845290915290205460ff165b6138e45760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161088a565b6109de83836148b4565b60006202000083811614801561099657504261390d6276a70084615cb0565b67ffffffffffffffff16109392505050565b8451602086012060006139797f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae83604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b905060006139bc886040518060400160405280600581526020017f036574680000000000000000000000000000000000000000000000000000000081525061492f565b60008381526006602052604090209091506139d78282615cd1565b506139ea828289620300008a17896144b9565b6001600160a01b03841615611cdc57604051630c4b7b8560e11b8152600481018390526001600160a01b0385811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b158015613a6357600080fd5b505af1158015613a77573d6000803e3d6000fd5b505050505050505050505050565b6000546001600160a01b03163314611b3a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161088a565b60008080613aec846108cf565b919450925090504267ffffffffffffffff821610808015613bb057506001600160a01b0384161580613bb057506040516302571be360e01b8152600481018690526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613b81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ba59190615ace565b6001600160a01b0316145b15613bef576000613bc0876108cf565b509150506020811615613be95760405163a2a7201360e01b81526004810187905260240161088a565b50613c16565b62010000831615613c165760405163a2a7201360e01b81526004810186905260240161088a565b505050505050565b63fffdffff81811763ffffffff1614613c4d5760405163a2a7201360e01b81526004810183905260240161088a565b5050565b60606000613cfa83600660008881526020019081526020016000208054613c7790615a37565b80601f0160208091040260200160405190810160405280929190818152602001828054613ca390615a37565b8015613cf05780601f10613cc557610100808354040283529160200191613cf0565b820191906000526020600020905b815481529060010190602001808311613cd357829003601f168201915b505050505061492f565b6000858152600660205260409020909150613d158282615cd1565b50949350505050565b600080613d2a856108cf565b92505050600080613d3d8860001c6108cf565b9250925050613d4d8787846141cc565b613d58858483614207565b98975050505050505050565b600080613d70836119c8565b6001600160a01b0316141580156108c957506040516302571be360e01b81526004810183905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613de9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e0d9190615ace565b6001600160a01b03161492915050565b60008681526006602052604081208054613e3c918791613c7790615a37565b9050613e4b86828686866144b9565b50505050505050565b60008080613e61886108cf565b9250925092506000613e8b88600660008d81526020019081526020016000208054613c7790615a37565b60008a8152600660205260409020805491925090613ea890615a37565b9050600003613ecb576000898152600660205260409020613ec98282615cd1565b505b613eda89858886178589614251565b6001600160a01b038716613ef857613ef38960006143c7565b610bfc565b610bfc84888b60001c60016040518060200160405280600081525061469a565b6201ffff1962020000831601613f3857613f356276a70082615cb0565b90505b428167ffffffffffffffff161015613fb55762010000821615613fb05760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b613fda565b6004821615613fda5760405163a2a7201360e01b81526004810184905260240161088a565b604082166000036109de5750506000908152600360205260409020805473ffffffffffffffffffffffffffffffffffffffff19169055565b6001600160a01b0384163b15613c165760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906140569089908990889088908890600401615d91565b6020604051808303816000875af1925050508015614091575060408051601f3d908101601f1916820190925261408e91810190615de3565b60015b6141465761409d615e00565b806308c379a0036140d657506140b1615e1c565b806140bc57506140d8565b8060405162461bcd60e51b815260040161088a9190614ee5565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560448201527f526563656976657220696d706c656d656e746572000000000000000000000000606482015260840161088a565b6001600160e01b0319811663bc197c8160e01b14613e4b5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e73000000000000000000000000000000000000000000000000606482015260840161088a565b63ffff000082161580159060018316159082906141e65750805b156114f55760405163a2a7201360e01b81526004810186905260240161088a565b60008167ffffffffffffffff168467ffffffffffffffff161115614229578193505b8267ffffffffffffffff168467ffffffffffffffff161015614249578293505b509192915050565b61425d85858584614311565b60405163ffffffff8416815285907f39873f00c80f4f94b7bd1594aebcf650f003545b74824d57ddf4939e3ff3a34b9060200160405180910390a28167ffffffffffffffff168167ffffffffffffffff1611156114f55760405167ffffffffffffffff8216815285907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b132906020015b60405180910390a25050505050565b600080614307836108cf565b5090949350505050565b61431b84836149d8565b60008481526001602052604090206001600160a01b03841663ffffffff60a01b60a085901b161777ffffffffffffffffffffffffffffffffffffffffffffffff1960c084901b161790556119c2565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6143d282600161234c565b156143f35760405163a2a7201360e01b81526004810183905260240161088a565b6143fc826145ba565b604051635b0fc9c360e01b8152600481018390526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b15801561446657600080fd5b505af115801561447a573d6000803e3d6000fd5b50506040516001600160a01b03841681528492507fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49150602001613092565b6144c585848484614a11565b847f8ce7013e8abebc55c3890a68f5a27c67c3f7efa64e584de5fb22363c606fd340858585856040516142ec9493929190615ea6565b600080600061450a85856147fd565b90925090508161457c57600185516145229190615eee565b84146145705760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d65000000604482015260640161088a565b50600091506108c99050565b61458685826144fb565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b60008181526001602052604090205460a081901c60c082901c6145de8383836136eb565b6000868152600360209081526040808320805473ffffffffffffffffffffffffffffffffffffffff191690556001909152902063ffffffff60a01b60a083901b1677ffffffffffffffffffffffffffffffffffffffffffffffff1960c086901b16179055925061464b9050565b60408051858152600160208201526000916001600160a01b0386169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a450505050565b60008060006146a8866108cf565b9250925092506146b9868383613f18565b8460011480156146da5750876001600160a01b0316836001600160a01b0316145b6147395760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b866001600160a01b0316836001600160a01b03160361475a575050506114f5565b60008681526001602052604090206001600160a01b03881663ffffffff60a01b60a085901b161777ffffffffffffffffffffffffffffffffffffffffffffffff1960c084901b1617905560408051878152602081018790526001600160a01b03808a1692908b169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611cdc338989898989614a85565b600080835183106148505760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e64730000604482015260640161088a565b600084848151811061486457614864615a71565b016020015160f81c905080156148905761488985614883866001615f01565b83614b96565b9250614895565b600092505b61489f8185615f01565b6148aa906001615f01565b9150509250929050565b6000818152600360205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03841690811790915581906148f6826119c8565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b606060018351101561496d576040517f280dacb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60ff835111156149ab57826040517fe3ba295f00000000000000000000000000000000000000000000000000000000815260040161088a9190614ee5565b825183836040516020016149c193929190615f14565b604051602081830303815290604052905092915050565b61ffff8116158015906149f057506201000181811614155b15613c4d5760405163a2a7201360e01b81526004810183905260240161088a565b614a1b84836149d8565b6000848152600160205260409020546001600160a01b03811615614a7957614a42856145ba565b6040516000815285907fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49060200160405180910390a25b6114f585858585614bba565b6001600160a01b0384163b15613c165760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190614ac99089908990889088908890600401615f75565b6020604051808303816000875af1925050508015614b04575060408051601f3d908101601f19168201909252614b0191810190615de3565b60015b614b105761409d615e00565b6001600160e01b0319811663f23a6e6160e01b14613e4b5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e73000000000000000000000000000000000000000000000000606482015260840161088a565b8251600090614ba58385615f01565b1115614bb057600080fd5b5091016020012090565b8360008080614bc8846108cf565b9194509250905063ffff0000821667ffffffffffffffff8087169083161115614bef578195505b428267ffffffffffffffff1610614c0557958617955b6001600160a01b03841615614c5c5760405162461bcd60e51b815260206004820152601f60248201527f455243313135353a206d696e74206f66206578697374696e6720746f6b656e00604482015260640161088a565b6001600160a01b038816614cd85760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b306001600160a01b03891603614d565760405162461bcd60e51b815260206004820152603460248201527f455243313135353a206e65774f776e65722063616e6e6f74206265207468652060448201527f4e616d655772617070657220636f6e7472616374000000000000000000000000606482015260840161088a565b60008581526001602052604090206001600160a01b03891663ffffffff60a01b60a08a901b161777ffffffffffffffffffffffffffffffffffffffffffffffff1960c089901b1617905560408051868152600160208201526001600160a01b038a169160009133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4612e0e3360008a88600160405180602001604052806000815250614a85565b6001600160a01b03811681146125d357600080fd5b60008060408385031215614e3057600080fd5b8235614e3b81614e08565b946020939093013593505050565b600060208284031215614e5b57600080fd5b5035919050565b6001600160e01b0319811681146125d357600080fd5b600060208284031215614e8a57600080fd5b813561099681614e62565b60005b83811015614eb0578181015183820152602001614e98565b50506000910152565b60008151808452614ed1816020860160208601614e95565b601f01601f19169290920160200192915050565b6020815260006109966020830184614eb9565b60008060408385031215614f0b57600080fd5b823591506020830135614f1d81614e08565b809150509250929050565b803567ffffffffffffffff81168114614f4057600080fd5b919050565b60008060408385031215614f5857600080fd5b82359150614f6860208401614f28565b90509250929050565b60008083601f840112614f8357600080fd5b50813567ffffffffffffffff811115614f9b57600080fd5b602083019150836020828501011115614fb357600080fd5b9250929050565b600080600080600060808688031215614fd257600080fd5b8535614fdd81614e08565b94506020860135614fed81614e08565b935060408601359250606086013567ffffffffffffffff81111561501057600080fd5b61501c88828901614f71565b969995985093965092949392505050565b60006020828403121561503f57600080fd5b813561099681614e08565b634e487b7160e01b600052604160045260246000fd5b601f8201601f1916810167ffffffffffffffff811182821017156150865761508661504a565b6040525050565b600067ffffffffffffffff8211156150a7576150a761504a565b50601f01601f191660200190565b600082601f8301126150c657600080fd5b81356150d18161508d565b6040516150de8282615060565b8281528560208487010111156150f357600080fd5b82602086016020830137600092810160200192909252509392505050565b803563ffffffff81168114614f4057600080fd5b600080600080600080600060e0888a03121561514057600080fd5b87359650602088013567ffffffffffffffff81111561515e57600080fd5b61516a8a828b016150b5565b965050604088013561517b81614e08565b9450606088013561518b81614e08565b935061519960808901614f28565b92506151a760a08901615111565b91506151b560c08901614f28565b905092959891949750929550565b600067ffffffffffffffff8211156151dd576151dd61504a565b5060051b60200190565b600082601f8301126151f857600080fd5b81356020615205826151c3565b6040516152128282615060565b83815260059390931b850182019282810191508684111561523257600080fd5b8286015b848110156123415780358352918301918301615236565b600080600080600060a0868803121561526557600080fd5b853561527081614e08565b9450602086013561528081614e08565b9350604086013567ffffffffffffffff8082111561529d57600080fd5b6152a989838a016151e7565b945060608801359150808211156152bf57600080fd5b6152cb89838a016151e7565b935060808801359150808211156152e157600080fd5b506152ee888289016150b5565b9150509295509295909350565b6000806000806080858703121561531157600080fd5b843593506020850135925061532860408601615111565b915061533660608601614f28565b905092959194509250565b803561ffff81168114614f4057600080fd5b6000806040838503121561536657600080fd5b82359150614f6860208401615341565b6000806040838503121561538957600080fd5b823567ffffffffffffffff808211156153a157600080fd5b818501915085601f8301126153b557600080fd5b813560206153c2826151c3565b6040516153cf8282615060565b83815260059390931b85018201928281019150898411156153ef57600080fd5b948201945b8386101561541657853561540781614e08565b825294820194908201906153f4565b9650508601359250508082111561542c57600080fd5b506148aa858286016151e7565b600081518084526020808501945080840160005b838110156154695781518752958201959082019060010161544d565b509495945050505050565b6020815260006109966020830184615439565b60008060006060848603121561549c57600080fd5b83356154a781614e08565b925060208401356154b781614e08565b929592945050506040919091013590565b6000806000606084860312156154dd57600080fd5b83359250602084013591506154f460408501614f28565b90509250925092565b60008060006060848603121561551257600080fd5b83359250602084013561552481614e08565b9150604084013561553481614e08565b809150509250925092565b60008060008060006080868803121561555757600080fd5b853567ffffffffffffffff81111561556e57600080fd5b61557a88828901614f71565b909650945050602086013561558e81614e08565b925061559c60408701615341565b915060608601356155ac81614e08565b809150509295509295909350565b80151581146125d357600080fd5b600080604083850312156155db57600080fd5b82356155e681614e08565b91506020830135614f1d816155ba565b60008060008060008060a0878903121561560f57600080fd5b863567ffffffffffffffff81111561562657600080fd5b61563289828a01614f71565b909750955050602087013561564681614e08565b935060408701359250606087013561565d81614e08565b915061566b60808801615341565b90509295509295509295565b6000806040838503121561568a57600080fd5b82359150614f6860208401615111565b600080604083850312156156ad57600080fd5b50508035926020909101359150565b60008060008060008060a087890312156156d557600080fd5b86359550602087013567ffffffffffffffff8111156156f357600080fd5b6156ff89828a01614f71565b909650945050604087013561571381614e08565b925061572160608801615111565b915061566b60808801614f28565b6000806000806040858703121561574557600080fd5b843567ffffffffffffffff8082111561575d57600080fd5b61576988838901614f71565b9096509450602087013591508082111561578257600080fd5b5061578f87828801614f71565b95989497509550505050565b600080600080608085870312156157b157600080fd5b8435935060208501356157c381614e08565b9250604085013561532881614e08565b6000806000606084860312156157e857600080fd5b8335925060208401359150604084013561553481614e08565b6000806040838503121561581457600080fd5b823561581f81614e08565b91506020830135614f1d81614e08565b6000806000806060858703121561584557600080fd5b843567ffffffffffffffff81111561585c57600080fd5b61586887828801614f71565b909550935050602085013561587c81614e08565b9150604085013561588c81614e08565b939692955090935050565b600080600080600060a086880312156158af57600080fd5b85356158ba81614e08565b945060208601356158ca81614e08565b93506040860135925060608601359150608086013567ffffffffffffffff8111156158f457600080fd5b6152ee888289016150b5565b60006020828403121561591257600080fd5b815167ffffffffffffffff81111561592957600080fd5b8201601f8101841361593a57600080fd5b80516159458161508d565b6040516159528282615060565b82815286602084860101111561596757600080fd5b610a73836020830160208701614e95565b6000806000806080858703121561598e57600080fd5b843567ffffffffffffffff8111156159a557600080fd5b6159b1878288016150b5565b94505060208501356159c281614e08565b92506159d060408601615341565b9150606085013561588c81614e08565b6000602082840312156159f257600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b67ffffffffffffffff818116838216019080821115615a3057615a306159f9565b5092915050565b600181811c90821680615a4b57607f821691505b602082108103615a6b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b600060018201615a9957615a996159f9565b5060010190565b604081526000615ab36040830185615439565b8281036020840152615ac58185615439565b95945050505050565b600060208284031215615ae057600080fd5b815161099681614e08565b600060208284031215615afd57600080fd5b8151610996816155ba565b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60c081526000615b5560c083018a8c615b18565b6001600160a01b03898116602085015263ffffffff8916604085015267ffffffffffffffff881660608501528616608084015282810360a0840152615b9b818587615b18565b9b9a5050505050505050505050565b601f8211156109de57600081815260208120601f850160051c81016020861015615bd15750805b601f850160051c820191505b81811015613c1657828155600101615bdd565b67ffffffffffffffff831115615c0857615c0861504a565b615c1c83615c168354615a37565b83615baa565b6000601f841160018114615c505760008515615c385750838201355b600019600387901b1c1916600186901b1783556114f5565b600083815260209020601f19861690835b82811015615c815786850135825560209485019460019092019101615c61565b5086821015615c9e5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b67ffffffffffffffff828116828216039080821115615a3057615a306159f9565b815167ffffffffffffffff811115615ceb57615ceb61504a565b615cff81615cf98454615a37565b84615baa565b602080601f831160018114615d345760008415615d1c5750858301515b600019600386901b1c1916600185901b178555613c16565b600085815260208120601f198616915b82811015615d6357888601518255948401946001909101908401615d44565b5085821015615d815787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006001600160a01b03808816835280871660208401525060a06040830152615dbd60a0830186615439565b8281036060840152615dcf8186615439565b90508281036080840152613d588185614eb9565b600060208284031215615df557600080fd5b815161099681614e62565b600060033d1115615e195760046000803e5060005160e01c5b90565b600060443d1015615e2a5790565b6040516003193d81016004833e81513d67ffffffffffffffff8160248401118184111715615e5a57505050505090565b8285019150815181811115615e725750505050505090565b843d8701016020828501011115615e8c5750505050505090565b615e9b60208286010187615060565b509095945050505050565b608081526000615eb96080830187614eb9565b6001600160a01b039590951660208301525063ffffffff92909216604083015267ffffffffffffffff16606090910152919050565b818103818111156108c9576108c96159f9565b808201808211156108c9576108c96159f9565b7fff000000000000000000000000000000000000000000000000000000000000008460f81b16815260008351615f51816001850160208801614e95565b835190830190615f68816001840160208801614e95565b0160010195945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152615fad60a0830184614eb9565b97965050505050505056fea26469706673582212203223b0a44605b0982e1edfba8ce02132bc1eb21d9dccff0aa71d14cd93bc594564736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061031f5760003560e01c80636352211e116101a7578063c93ab3fd116100ee578063e985e9c511610097578063f242432a11610071578063f242432a146107d7578063f2fde38b146107ea578063fd0cd0d9146107fd57600080fd5b8063e985e9c514610768578063eb8ae530146107a4578063ed70554d146107b757600080fd5b8063d9a50c12116100c8578063d9a50c121461071f578063da8c229e14610732578063e0dba60f1461075557600080fd5b8063c93ab3fd146106e6578063cf408823146106f9578063d8c9921a1461070c57600080fd5b8063a22cb46511610150578063b6bcad261161012a578063b6bcad26146106ad578063c475abff146106c0578063c658e086146106d357600080fd5b8063a22cb46514610674578063a401498214610687578063adf4960a1461069a57600080fd5b80638b4dfa75116101815780638b4dfa751461063d5780638cf8b41e146106505780638da5cb5b1461066357600080fd5b80636352211e146105f65780636e5d6ad214610609578063715018a61461063557600080fd5b80631f4e15041161026b5780633f15457f116102145780634e1273f4116101ee5780634e1273f4146105b057806353095467146105d05780635d3590d5146105e357600080fd5b80633f15457f1461054e578063402906fc1461057557806341415eab1461059d57600080fd5b80632b20e397116102455780632b20e397146105015780632eb2c2d61461052857806333c69ea91461053b57600080fd5b80631f4e1504146104c857806320c38e2b146104db57806324c1af44146104ee57600080fd5b80630e4cd725116102cd578063150b7a02116102a7578063150b7a02146104765780631534e177146104a25780631896f70a146104b557600080fd5b80630e4cd7251461043d5780630e89341c1461045057806314ab90381461046357600080fd5b806306fdde03116102fe57806306fdde03146103b4578063081812fc146103fd578063095ea7b31461042857600080fd5b8062fdd58e146103245780630178fe3f1461034a57806301ffc9a714610391575b600080fd5b610337610332366004614e1d565b610810565b6040519081526020015b60405180910390f35b61035d610358366004614e49565b6108cf565b604080516001600160a01b03909416845263ffffffff909216602084015267ffffffffffffffff1690820152606001610341565b6103a461039f366004614e78565b6108ff565b6040519015158152602001610341565b6103f06040518060400160405280600b81526020017f4e616d655772617070657200000000000000000000000000000000000000000081525081565b6040516103419190614ee5565b61041061040b366004614e49565b610958565b6040516001600160a01b039091168152602001610341565b61043b610436366004614e1d565b61099d565b005b6103a461044b366004614ef8565b6109e3565b6103f061045e366004614e49565b610a7d565b61043b610471366004614f45565b610aef565b610489610484366004614fba565b610c08565b6040516001600160e01b03199091168152602001610341565b61043b6104b036600461502d565b610e1a565b61043b6104c3366004614ef8565b610e51565b600754610410906001600160a01b031681565b6103f06104e9366004614e49565b610f13565b6103376104fc366004615125565b610fad565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b61043b61053636600461524d565b6111c1565b61043b6105493660046152fb565b6114fc565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b610588610583366004615353565b6116f1565b60405163ffffffff9091168152602001610341565b6103a46105ab366004614ef8565b611793565b6105c36105be366004615376565b6117f0565b6040516103419190615474565b600554610410906001600160a01b031681565b61043b6105f1366004615487565b61192e565b610410610604366004614e49565b6119c8565b61061c6106173660046154c8565b6119d3565b60405167ffffffffffffffff9091168152602001610341565b61043b611b28565b61043b61064b3660046154fd565b611b3c565b61061c61065e36600461553f565b611ce6565b6000546001600160a01b0316610410565b61043b6106823660046155c8565b6120b2565b6103376106953660046155f6565b61219c565b6103a46106a8366004615677565b61234c565b61043b6106bb36600461502d565b612371565b6103376106ce36600461569a565b6125d6565b6103376106e13660046156bc565b6128e2565b61043b6106f436600461572f565b612aef565b61043b61070736600461579b565b612c60565b61043b61071a3660046157d3565b612e19565b6103a461072d36600461569a565b612f29565b6103a461074036600461502d565b60046020526000908152604090205460ff1681565b61043b6107633660046155c8565b613036565b6103a4610776366004615801565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b61043b6107b236600461582f565b61309e565b6103376107c5366004614e49565b60016020526000908152604090205481565b61043b6107e5366004615897565b613469565b61043b6107f836600461502d565b613586565b6103a461080b366004614e49565b613613565b60006001600160a01b0383166108935760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084015b60405180910390fd5b600061089e836119c8565b9050836001600160a01b0316816001600160a01b0316036108c35760019150506108c9565b60009150505b92915050565b60008181526001602052604090205460a081901c60c082901c6108f38383836136eb565b90959094509092509050565b60006001600160e01b031982167fd82c42d800000000000000000000000000000000000000000000000000000000148061094957506001600160e01b03198216630a85bd0160e11b145b806108c957506108c982613722565b600080610964836119c8565b90506001600160a01b03811661097d5750600092915050565b6000838152600360205260409020546001600160a01b03165b9392505050565b60006109a8826108cf565b50915050603f1960408216016109d45760405163a2a7201360e01b81526004810183905260240161088a565b6109de83836137a4565b505050565b60008080806109f1866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a3c57506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff165b80610a6057506001600160a01b038516610a5587610958565b6001600160a01b0316145b8015610a735750610a7182826138ee565b155b9695505050505050565b6005546040516303a24d0760e21b8152600481018390526060916001600160a01b031690630e89341c90602401600060405180830381865afa158015610ac7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108c99190810190615900565b81610afa8133611793565b610b205760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260106000610b2e836108cf565b5091505063ffffffff8282161615610b5c5760405163a2a7201360e01b81526004810184905260240161088a565b6040517f14ab90380000000000000000000000000000000000000000000000000000000081526004810187905267ffffffffffffffff861660248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906314ab9038906044015b600060405180830381600087803b158015610be857600080fd5b505af1158015610bfc573d6000803e3d6000fd5b50505050505050505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610c6c576040517f1931a53800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080610c7d86880188615978565b83516020850120939750919550935091508890808214610cd3576040517fc65c3ccc000000000000000000000000000000000000000000000000000000008152600481018290526024810183905260440161088a565b604051630a3b53db60e21b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906328ed4f6c90604401600060405180830381600087803b158015610d3b57600080fd5b505af1158015610d4f573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018d9052600092506276a70091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d6e4fa8690602401602060405180830381865afa158015610dc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de491906159e0565b610dee9190615a0f565b9050610e0187878761ffff16848861391f565b50630a85bd0160e11b9c9b505050505050505050505050565b610e22613a85565b6005805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b81610e5c8133611793565b610e825760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260086000610e90836108cf565b5091505063ffffffff8282161615610ebe5760405163a2a7201360e01b81526004810184905260240161088a565b604051630c4b7b8560e11b8152600481018790526001600160a01b0386811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401610bce565b60066020526000908152604090208054610f2c90615a37565b80601f0160208091040260200160405190810160405280929190818152602001828054610f5890615a37565b8015610fa55780601f10610f7a57610100808354040283529160200191610fa5565b820191906000526020600020905b815481529060010190602001808311610f8857829003601f168201915b505050505081565b600087610fba8133611793565b610fe05760405163168ab55d60e31b81526004810182905233602482015260440161088a565b875160208901206110188a82604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506110248a84613adf565b61102e8386613c1e565b6110398a848b613c51565b506110468a848787613d1e565b935061105183613d64565b611107576040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156110dc57600080fd5b505af11580156110f0573d6000803e3d6000fd5b505050506111028a848b8b8989613e1d565b6111b4565b6040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561118e57600080fd5b505af11580156111a2573d6000803e3d6000fd5b505050506111b48a848b8b8989613e54565b5050979650505050505050565b81518351146112385760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060448201527f6d69736d61746368000000000000000000000000000000000000000000000000606482015260840161088a565b6001600160a01b03841661129c5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b0385163314806112d657506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b6113485760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000606482015260840161088a565b60005b835181101561148f57600084828151811061136857611368615a71565b60200260200101519050600084838151811061138657611386615a71565b60200260200101519050600080600061139e856108cf565b9250925092506113af858383613f18565b8360011480156113d057508a6001600160a01b0316836001600160a01b0316145b61142f5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b60008581526001602052604090206001600160a01b038b1663ffffffff60a01b60a085901b161777ffffffffffffffffffffffffffffffffffffffffffffffff1960c084901b1617905550505050508061148890615a87565b905061134b565b50836001600160a01b0316856001600160a01b0316336001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516114df929190615aa0565b60405180910390a46114f5338686868686614012565b5050505050565b6040805160208082018790528183018690528251808303840181526060909201909252805191012061152e8184613c1e565b6000808061153b846108cf565b919450925090506001600160a01b03831615806115ea57506040516302571be360e01b81526004810185905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa1580156115ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115de9190615ace565b6001600160a01b031614155b1561160857604051635374b59960e01b815260040160405180910390fd5b6000806116148a6108cf565b90935091508a90506116555761162a8633611793565b6116505760405163168ab55d60e31b81526004810187905233602482015260440161088a565b611685565b61165f8a33611793565b6116855760405163168ab55d60e31b8152600481018b905233602482015260440161088a565b6116908689846141cc565b61169b878483614207565b9650620100008416158015906116bf57508363ffffffff1688851763ffffffff1614155b156116e05760405163a2a7201360e01b81526004810187905260240161088a565b96831796610bfc86868a868b614251565b6000826116fe8133611793565b6117245760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8360026000611732836108cf565b5091505063ffffffff82821616156117605760405163a2a7201360e01b81526004810184905260240161088a565b6000808061176d8a6108cf565b9250925092506117868a84848c61ffff16178485614251565b5098975050505050505050565b60008080806117a1866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a6057506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff16610a60565b606081518351146118695760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d617463680000000000000000000000000000000000000000000000606482015260840161088a565b6000835167ffffffffffffffff8111156118855761188561504a565b6040519080825280602002602001820160405280156118ae578160200160208202803683370190505b50905060005b8451811015611926576118f98582815181106118d2576118d2615a71565b60200260200101518583815181106118ec576118ec615a71565b6020026020010151610810565b82828151811061190b5761190b615a71565b602090810291909101015261191f81615a87565b90506118b4565b509392505050565b611936613a85565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af115801561199e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c29190615aeb565b50505050565b60006108c9826142fb565b60408051602080820186905281830185905282518083038401815260609092019092528051910120600090611a0781613d64565b611a2457604051635374b59960e01b815260040160405180910390fd5b6000611a3086336109e3565b905080158015611a475750611a458233611793565b155b15611a6e5760405163168ab55d60e31b81526004810183905233602482015260440161088a565b60008080611a7b856108cf565b92509250925083158015611a925750620400008216155b15611ab35760405163a2a7201360e01b81526004810186905260240161088a565b6000611abe8a6108cf565b92505050611acd888383614207565b9750611adb8685858b614311565b60405167ffffffffffffffff8916815286907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b1329060200160405180910390a2509598975050505050505050565b611b30613a85565b611b3a600061436a565b565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830186905282518083038401815260609092019092528051910120611b908133611793565b611bb65760405163168ab55d60e31b81526004810182905233602482015260440161088a565b306001600160a01b03841603611bea57604051632ca49b0d60e11b81526001600160a01b038416600482015260240161088a565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830187905282518083038401815260609092019092528051910120611c3f905b836143c7565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038481166024830152604482018690527f000000000000000000000000000000000000000000000000000000000000000016906342842e0e90606401600060405180830381600087803b158015611cc857600080fd5b505af1158015611cdc573d6000803e3d6000fd5b5050505050505050565b6000808686604051611cf9929190615b08565b6040519081900381206331a9108f60e11b82526004820181905291506000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611d69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d8d9190615ace565b90506001600160a01b0381163314801590611e35575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015611e0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e339190615aeb565b155b15611ea557604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae6020808301919091528183018590528251808303840181526060830193849052805191012063168ab55d60e31b909252606481019190915233608482015260a40161088a565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152306024830152604482018490527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90606401600060405180830381600087803b158015611f2e57600080fd5b505af1158015611f42573d6000803e3d6000fd5b5050604051630a3b53db60e21b8152600481018590523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506328ed4f6c9150604401600060405180830381600087803b158015611fae57600080fd5b505af1158015611fc2573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018590526276a70092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316915063d6e4fa8690602401602060405180830381865afa158015612030573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205491906159e0565b61205e9190615a0f565b92506120a788888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff8816868861391f565b505095945050505050565b6001600160a01b03821633036121305760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c660000000000000000000000000000000000000000000000606482015260840161088a565b3360008181526002602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b3360009081526004602052604081205460ff166122215760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f60448201527f6e74726f6c6c6572000000000000000000000000000000000000000000000000606482015260840161088a565b60008787604051612233929190615b08565b6040519081900381207ffca247ac000000000000000000000000000000000000000000000000000000008252600482018190523060248301526044820187905291507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fca247ac906064016020604051808303816000875af11580156122c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122ec91906159e0565b915061234188888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff861661233b6276a70087615a0f565b8861391f565b509695505050505050565b600080612358846108cf565b50841663ffffffff908116908516149250505092915050565b612379613a85565b6007546001600160a01b0316156124995760075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156123f957600080fd5b505af115801561240d573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561248057600080fd5b505af1158015612494573d6000803e3d6000fd5b505050505b6007805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316908117909155156125d35760075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b15801561253857600080fd5b505af115801561254c573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b1580156125bf57600080fd5b505af11580156114f5573d6000803e3d6000fd5b50565b3360009081526004602052604081205460ff1661265b5760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f60448201527f6e74726f6c6c6572000000000000000000000000000000000000000000000000606482015260840161088a565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301869052825180830384018152606090920190925280519101206000906040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101869052602481018590529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c475abff906044016020604051808303816000875af1158015612735573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061275991906159e0565b6040516331a9108f60e11b8152600481018790529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa9250505080156127dd575060408051601f3d908101601f191682019092526127da91810190615ace565b60015b6127ea5791506108c99050565b6001600160a01b0381163014158061289457506040516302571be360e01b81526004810184905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015612864573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128889190615ace565b6001600160a01b031614155b156128a3575091506108c99050565b5060006128b36276a70083615a0f565b60008481526001602052604090205490915060a081901c6128d685838386614311565b50919695505050505050565b6000866128ef8133611793565b6129155760405163168ab55d60e31b81526004810182905233602482015260440161088a565b60008787604051612927929190615b08565b604051809103902090506129628982604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b925061296e8984613adf565b6129788386613c1e565b60006129bb8a858b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613c5192505050565b90506129c98a858888613d1e565b94506129d484613d64565b612a9c576040517f06ab5923000000000000000000000000000000000000000000000000000000008152600481018b9052602481018390523060448201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906306ab5923906064016020604051808303816000875af1158015612a65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a8991906159e0565b50612a9784828989896144b9565b612ae2565b612ae28a858b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d92508c91508b9050613e54565b5050509695505050505050565b6000612b35600086868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506144fb9050565b6007549091506001600160a01b0316612b7a576040517f24c1d6d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612b848133611793565b612baa5760405163168ab55d60e31b81526004810182905233602482015260440161088a565b60008080612bb7846108cf565b919450925090506000612bc985610958565b9050612bd4856145ba565b600760009054906101000a90046001600160a01b03166001600160a01b0316639198c2768a8a878787878e8e6040518963ffffffff1660e01b8152600401612c23989796959493929190615b41565b600060405180830381600087803b158015612c3d57600080fd5b505af1158015612c51573d6000803e3d6000fd5b50505050505050505050505050565b83612c6b8133611793565b612c915760405163168ab55d60e31b81526004810182905233602482015260440161088a565b84601c6000612c9f836108cf565b5091505063ffffffff8282161615612ccd5760405163a2a7201360e01b81526004810184905260240161088a565b6040517fcf408823000000000000000000000000000000000000000000000000000000008152600481018990523060248201526001600160a01b03878116604483015267ffffffffffffffff871660648301527f0000000000000000000000000000000000000000000000000000000000000000169063cf40882390608401600060405180830381600087803b158015612d6657600080fd5b505af1158015612d7a573d6000803e3d6000fd5b5050506001600160a01b0388169050612de1576000612d98896108cf565b509150506201ffff1962020000821601612dd057604051632ca49b0d60e11b81526001600160a01b038916600482015260240161088a565b612ddb8960006143c7565b50611cdc565b6000612dec896119c8565b9050612e0e81898b60001c60016040518060200160405280600081525061469a565b505050505050505050565b60408051602080820186905281830185905282518083038401815260609092019092528051910120612e4b8133611793565b612e715760405163168ab55d60e31b81526004810182905233602482015260440161088a565b7f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b528401612eb15760405163615a470360e01b815260040160405180910390fd5b6001600160a01b0382161580612ecf57506001600160a01b03821630145b15612ef857604051632ca49b0d60e11b81526001600160a01b038316600482015260240161088a565b604080516020808201879052818301869052825180830384018152606090920190925280519101206119c290611c39565b604080516020808201859052818301849052825180830384018152606090920190925280519101206000906000612f5f82613d64565b90507f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae8514612f915791506108c99050565b6040516331a9108f60e11b8152600481018590527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa925050508015613012575060408051601f3d908101601f1916820190925261300f91810190615ace565b60015b613021576000925050506108c9565b6001600160a01b0316301492506108c9915050565b61303e613a85565b6001600160a01b038216600081815260046020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf8791015b60405180910390a25050565b6000806130e5600087878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506147fd9050565b91509150600061312e8288888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506144fb9050565b604080516020808201849052818301879052825180830384018152606090920190925280519101209091506000906000818152600660205260409020909150613178888a83615bf0565b507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b5282016131b95760405163615a470360e01b815260040160405180910390fd5b6040516302571be360e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015613221573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132459190615ace565b90506001600160a01b03811633148015906132ed575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa1580156132c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132eb9190615aeb565b155b156133145760405163168ab55d60e31b81526004810183905233602482015260440161088a565b6001600160a01b038616156133a657604051630c4b7b8560e11b8152600481018390526001600160a01b0387811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b15801561338d57600080fd5b505af11580156133a1573d6000803e3d6000fd5b505050505b604051635b0fc9c360e01b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635b0fc9c390604401600060405180830381600087803b15801561340e57600080fd5b505af1158015613422573d6000803e3d6000fd5b50505050612e0e828a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508d935091508190506144b9565b6001600160a01b0384166134cd5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b03851633148061350757506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b6135795760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201527f20617070726f7665640000000000000000000000000000000000000000000000606482015260840161088a565b6114f5858585858561469a565b61358e613a85565b6001600160a01b03811661360a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161088a565b6125d38161436a565b6000818152600660205260408120805482919061362f90615a37565b80601f016020809104026020016040519081016040528092919081815260200182805461365b90615a37565b80156136a85780601f1061367d576101008083540402835291602001916136a8565b820191906000526020600020905b81548152906001019060200180831161368b57829003601f168201915b5050505050905080516000036136c15750600092915050565b6000806136ce83826147fd565b909250905060006136df84836144fb565b9050610a738184612f29565b600080428367ffffffffffffffff1610156137195761ffff196201000085160161371457600094505b600093505b50929391925050565b60006001600160e01b031982167fd9b67a2600000000000000000000000000000000000000000000000000000000148061376c57506001600160e01b031982166303a24d0760e21b145b806108c957507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146108c9565b60006137af826119c8565b9050806001600160a01b0316836001600160a01b0316036138385760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f7200000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b336001600160a01b038216148061387257506001600160a01b038116600090815260026020908152604080832033845290915290205460ff165b6138e45760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161088a565b6109de83836148b4565b60006202000083811614801561099657504261390d6276a70084615cb0565b67ffffffffffffffff16109392505050565b8451602086012060006139797f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae83604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b905060006139bc886040518060400160405280600581526020017f036574680000000000000000000000000000000000000000000000000000000081525061492f565b60008381526006602052604090209091506139d78282615cd1565b506139ea828289620300008a17896144b9565b6001600160a01b03841615611cdc57604051630c4b7b8560e11b8152600481018390526001600160a01b0385811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b158015613a6357600080fd5b505af1158015613a77573d6000803e3d6000fd5b505050505050505050505050565b6000546001600160a01b03163314611b3a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161088a565b60008080613aec846108cf565b919450925090504267ffffffffffffffff821610808015613bb057506001600160a01b0384161580613bb057506040516302571be360e01b8152600481018690526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613b81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ba59190615ace565b6001600160a01b0316145b15613bef576000613bc0876108cf565b509150506020811615613be95760405163a2a7201360e01b81526004810187905260240161088a565b50613c16565b62010000831615613c165760405163a2a7201360e01b81526004810186905260240161088a565b505050505050565b63fffdffff81811763ffffffff1614613c4d5760405163a2a7201360e01b81526004810183905260240161088a565b5050565b60606000613cfa83600660008881526020019081526020016000208054613c7790615a37565b80601f0160208091040260200160405190810160405280929190818152602001828054613ca390615a37565b8015613cf05780601f10613cc557610100808354040283529160200191613cf0565b820191906000526020600020905b815481529060010190602001808311613cd357829003601f168201915b505050505061492f565b6000858152600660205260409020909150613d158282615cd1565b50949350505050565b600080613d2a856108cf565b92505050600080613d3d8860001c6108cf565b9250925050613d4d8787846141cc565b613d58858483614207565b98975050505050505050565b600080613d70836119c8565b6001600160a01b0316141580156108c957506040516302571be360e01b81526004810183905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613de9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e0d9190615ace565b6001600160a01b03161492915050565b60008681526006602052604081208054613e3c918791613c7790615a37565b9050613e4b86828686866144b9565b50505050505050565b60008080613e61886108cf565b9250925092506000613e8b88600660008d81526020019081526020016000208054613c7790615a37565b60008a8152600660205260409020805491925090613ea890615a37565b9050600003613ecb576000898152600660205260409020613ec98282615cd1565b505b613eda89858886178589614251565b6001600160a01b038716613ef857613ef38960006143c7565b610bfc565b610bfc84888b60001c60016040518060200160405280600081525061469a565b6201ffff1962020000831601613f3857613f356276a70082615cb0565b90505b428167ffffffffffffffff161015613fb55762010000821615613fb05760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b613fda565b6004821615613fda5760405163a2a7201360e01b81526004810184905260240161088a565b604082166000036109de5750506000908152600360205260409020805473ffffffffffffffffffffffffffffffffffffffff19169055565b6001600160a01b0384163b15613c165760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906140569089908990889088908890600401615d91565b6020604051808303816000875af1925050508015614091575060408051601f3d908101601f1916820190925261408e91810190615de3565b60015b6141465761409d615e00565b806308c379a0036140d657506140b1615e1c565b806140bc57506140d8565b8060405162461bcd60e51b815260040161088a9190614ee5565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560448201527f526563656976657220696d706c656d656e746572000000000000000000000000606482015260840161088a565b6001600160e01b0319811663bc197c8160e01b14613e4b5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e73000000000000000000000000000000000000000000000000606482015260840161088a565b63ffff000082161580159060018316159082906141e65750805b156114f55760405163a2a7201360e01b81526004810186905260240161088a565b60008167ffffffffffffffff168467ffffffffffffffff161115614229578193505b8267ffffffffffffffff168467ffffffffffffffff161015614249578293505b509192915050565b61425d85858584614311565b60405163ffffffff8416815285907f39873f00c80f4f94b7bd1594aebcf650f003545b74824d57ddf4939e3ff3a34b9060200160405180910390a28167ffffffffffffffff168167ffffffffffffffff1611156114f55760405167ffffffffffffffff8216815285907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b132906020015b60405180910390a25050505050565b600080614307836108cf565b5090949350505050565b61431b84836149d8565b60008481526001602052604090206001600160a01b03841663ffffffff60a01b60a085901b161777ffffffffffffffffffffffffffffffffffffffffffffffff1960c084901b161790556119c2565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6143d282600161234c565b156143f35760405163a2a7201360e01b81526004810183905260240161088a565b6143fc826145ba565b604051635b0fc9c360e01b8152600481018390526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b15801561446657600080fd5b505af115801561447a573d6000803e3d6000fd5b50506040516001600160a01b03841681528492507fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49150602001613092565b6144c585848484614a11565b847f8ce7013e8abebc55c3890a68f5a27c67c3f7efa64e584de5fb22363c606fd340858585856040516142ec9493929190615ea6565b600080600061450a85856147fd565b90925090508161457c57600185516145229190615eee565b84146145705760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d65000000604482015260640161088a565b50600091506108c99050565b61458685826144fb565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b60008181526001602052604090205460a081901c60c082901c6145de8383836136eb565b6000868152600360209081526040808320805473ffffffffffffffffffffffffffffffffffffffff191690556001909152902063ffffffff60a01b60a083901b1677ffffffffffffffffffffffffffffffffffffffffffffffff1960c086901b16179055925061464b9050565b60408051858152600160208201526000916001600160a01b0386169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a450505050565b60008060006146a8866108cf565b9250925092506146b9868383613f18565b8460011480156146da5750876001600160a01b0316836001600160a01b0316145b6147395760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b866001600160a01b0316836001600160a01b03160361475a575050506114f5565b60008681526001602052604090206001600160a01b03881663ffffffff60a01b60a085901b161777ffffffffffffffffffffffffffffffffffffffffffffffff1960c084901b1617905560408051878152602081018790526001600160a01b03808a1692908b169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611cdc338989898989614a85565b600080835183106148505760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e64730000604482015260640161088a565b600084848151811061486457614864615a71565b016020015160f81c905080156148905761488985614883866001615f01565b83614b96565b9250614895565b600092505b61489f8185615f01565b6148aa906001615f01565b9150509250929050565b6000818152600360205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03841690811790915581906148f6826119c8565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b606060018351101561496d576040517f280dacb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60ff835111156149ab57826040517fe3ba295f00000000000000000000000000000000000000000000000000000000815260040161088a9190614ee5565b825183836040516020016149c193929190615f14565b604051602081830303815290604052905092915050565b61ffff8116158015906149f057506201000181811614155b15613c4d5760405163a2a7201360e01b81526004810183905260240161088a565b614a1b84836149d8565b6000848152600160205260409020546001600160a01b03811615614a7957614a42856145ba565b6040516000815285907fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49060200160405180910390a25b6114f585858585614bba565b6001600160a01b0384163b15613c165760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190614ac99089908990889088908890600401615f75565b6020604051808303816000875af1925050508015614b04575060408051601f3d908101601f19168201909252614b0191810190615de3565b60015b614b105761409d615e00565b6001600160e01b0319811663f23a6e6160e01b14613e4b5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e73000000000000000000000000000000000000000000000000606482015260840161088a565b8251600090614ba58385615f01565b1115614bb057600080fd5b5091016020012090565b8360008080614bc8846108cf565b9194509250905063ffff0000821667ffffffffffffffff8087169083161115614bef578195505b428267ffffffffffffffff1610614c0557958617955b6001600160a01b03841615614c5c5760405162461bcd60e51b815260206004820152601f60248201527f455243313135353a206d696e74206f66206578697374696e6720746f6b656e00604482015260640161088a565b6001600160a01b038816614cd85760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b306001600160a01b03891603614d565760405162461bcd60e51b815260206004820152603460248201527f455243313135353a206e65774f776e65722063616e6e6f74206265207468652060448201527f4e616d655772617070657220636f6e7472616374000000000000000000000000606482015260840161088a565b60008581526001602052604090206001600160a01b03891663ffffffff60a01b60a08a901b161777ffffffffffffffffffffffffffffffffffffffffffffffff1960c089901b1617905560408051868152600160208201526001600160a01b038a169160009133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4612e0e3360008a88600160405180602001604052806000815250614a85565b6001600160a01b03811681146125d357600080fd5b60008060408385031215614e3057600080fd5b8235614e3b81614e08565b946020939093013593505050565b600060208284031215614e5b57600080fd5b5035919050565b6001600160e01b0319811681146125d357600080fd5b600060208284031215614e8a57600080fd5b813561099681614e62565b60005b83811015614eb0578181015183820152602001614e98565b50506000910152565b60008151808452614ed1816020860160208601614e95565b601f01601f19169290920160200192915050565b6020815260006109966020830184614eb9565b60008060408385031215614f0b57600080fd5b823591506020830135614f1d81614e08565b809150509250929050565b803567ffffffffffffffff81168114614f4057600080fd5b919050565b60008060408385031215614f5857600080fd5b82359150614f6860208401614f28565b90509250929050565b60008083601f840112614f8357600080fd5b50813567ffffffffffffffff811115614f9b57600080fd5b602083019150836020828501011115614fb357600080fd5b9250929050565b600080600080600060808688031215614fd257600080fd5b8535614fdd81614e08565b94506020860135614fed81614e08565b935060408601359250606086013567ffffffffffffffff81111561501057600080fd5b61501c88828901614f71565b969995985093965092949392505050565b60006020828403121561503f57600080fd5b813561099681614e08565b634e487b7160e01b600052604160045260246000fd5b601f8201601f1916810167ffffffffffffffff811182821017156150865761508661504a565b6040525050565b600067ffffffffffffffff8211156150a7576150a761504a565b50601f01601f191660200190565b600082601f8301126150c657600080fd5b81356150d18161508d565b6040516150de8282615060565b8281528560208487010111156150f357600080fd5b82602086016020830137600092810160200192909252509392505050565b803563ffffffff81168114614f4057600080fd5b600080600080600080600060e0888a03121561514057600080fd5b87359650602088013567ffffffffffffffff81111561515e57600080fd5b61516a8a828b016150b5565b965050604088013561517b81614e08565b9450606088013561518b81614e08565b935061519960808901614f28565b92506151a760a08901615111565b91506151b560c08901614f28565b905092959891949750929550565b600067ffffffffffffffff8211156151dd576151dd61504a565b5060051b60200190565b600082601f8301126151f857600080fd5b81356020615205826151c3565b6040516152128282615060565b83815260059390931b850182019282810191508684111561523257600080fd5b8286015b848110156123415780358352918301918301615236565b600080600080600060a0868803121561526557600080fd5b853561527081614e08565b9450602086013561528081614e08565b9350604086013567ffffffffffffffff8082111561529d57600080fd5b6152a989838a016151e7565b945060608801359150808211156152bf57600080fd5b6152cb89838a016151e7565b935060808801359150808211156152e157600080fd5b506152ee888289016150b5565b9150509295509295909350565b6000806000806080858703121561531157600080fd5b843593506020850135925061532860408601615111565b915061533660608601614f28565b905092959194509250565b803561ffff81168114614f4057600080fd5b6000806040838503121561536657600080fd5b82359150614f6860208401615341565b6000806040838503121561538957600080fd5b823567ffffffffffffffff808211156153a157600080fd5b818501915085601f8301126153b557600080fd5b813560206153c2826151c3565b6040516153cf8282615060565b83815260059390931b85018201928281019150898411156153ef57600080fd5b948201945b8386101561541657853561540781614e08565b825294820194908201906153f4565b9650508601359250508082111561542c57600080fd5b506148aa858286016151e7565b600081518084526020808501945080840160005b838110156154695781518752958201959082019060010161544d565b509495945050505050565b6020815260006109966020830184615439565b60008060006060848603121561549c57600080fd5b83356154a781614e08565b925060208401356154b781614e08565b929592945050506040919091013590565b6000806000606084860312156154dd57600080fd5b83359250602084013591506154f460408501614f28565b90509250925092565b60008060006060848603121561551257600080fd5b83359250602084013561552481614e08565b9150604084013561553481614e08565b809150509250925092565b60008060008060006080868803121561555757600080fd5b853567ffffffffffffffff81111561556e57600080fd5b61557a88828901614f71565b909650945050602086013561558e81614e08565b925061559c60408701615341565b915060608601356155ac81614e08565b809150509295509295909350565b80151581146125d357600080fd5b600080604083850312156155db57600080fd5b82356155e681614e08565b91506020830135614f1d816155ba565b60008060008060008060a0878903121561560f57600080fd5b863567ffffffffffffffff81111561562657600080fd5b61563289828a01614f71565b909750955050602087013561564681614e08565b935060408701359250606087013561565d81614e08565b915061566b60808801615341565b90509295509295509295565b6000806040838503121561568a57600080fd5b82359150614f6860208401615111565b600080604083850312156156ad57600080fd5b50508035926020909101359150565b60008060008060008060a087890312156156d557600080fd5b86359550602087013567ffffffffffffffff8111156156f357600080fd5b6156ff89828a01614f71565b909650945050604087013561571381614e08565b925061572160608801615111565b915061566b60808801614f28565b6000806000806040858703121561574557600080fd5b843567ffffffffffffffff8082111561575d57600080fd5b61576988838901614f71565b9096509450602087013591508082111561578257600080fd5b5061578f87828801614f71565b95989497509550505050565b600080600080608085870312156157b157600080fd5b8435935060208501356157c381614e08565b9250604085013561532881614e08565b6000806000606084860312156157e857600080fd5b8335925060208401359150604084013561553481614e08565b6000806040838503121561581457600080fd5b823561581f81614e08565b91506020830135614f1d81614e08565b6000806000806060858703121561584557600080fd5b843567ffffffffffffffff81111561585c57600080fd5b61586887828801614f71565b909550935050602085013561587c81614e08565b9150604085013561588c81614e08565b939692955090935050565b600080600080600060a086880312156158af57600080fd5b85356158ba81614e08565b945060208601356158ca81614e08565b93506040860135925060608601359150608086013567ffffffffffffffff8111156158f457600080fd5b6152ee888289016150b5565b60006020828403121561591257600080fd5b815167ffffffffffffffff81111561592957600080fd5b8201601f8101841361593a57600080fd5b80516159458161508d565b6040516159528282615060565b82815286602084860101111561596757600080fd5b610a73836020830160208701614e95565b6000806000806080858703121561598e57600080fd5b843567ffffffffffffffff8111156159a557600080fd5b6159b1878288016150b5565b94505060208501356159c281614e08565b92506159d060408601615341565b9150606085013561588c81614e08565b6000602082840312156159f257600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b67ffffffffffffffff818116838216019080821115615a3057615a306159f9565b5092915050565b600181811c90821680615a4b57607f821691505b602082108103615a6b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b600060018201615a9957615a996159f9565b5060010190565b604081526000615ab36040830185615439565b8281036020840152615ac58185615439565b95945050505050565b600060208284031215615ae057600080fd5b815161099681614e08565b600060208284031215615afd57600080fd5b8151610996816155ba565b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60c081526000615b5560c083018a8c615b18565b6001600160a01b03898116602085015263ffffffff8916604085015267ffffffffffffffff881660608501528616608084015282810360a0840152615b9b818587615b18565b9b9a5050505050505050505050565b601f8211156109de57600081815260208120601f850160051c81016020861015615bd15750805b601f850160051c820191505b81811015613c1657828155600101615bdd565b67ffffffffffffffff831115615c0857615c0861504a565b615c1c83615c168354615a37565b83615baa565b6000601f841160018114615c505760008515615c385750838201355b600019600387901b1c1916600186901b1783556114f5565b600083815260209020601f19861690835b82811015615c815786850135825560209485019460019092019101615c61565b5086821015615c9e5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b67ffffffffffffffff828116828216039080821115615a3057615a306159f9565b815167ffffffffffffffff811115615ceb57615ceb61504a565b615cff81615cf98454615a37565b84615baa565b602080601f831160018114615d345760008415615d1c5750858301515b600019600386901b1c1916600185901b178555613c16565b600085815260208120601f198616915b82811015615d6357888601518255948401946001909101908401615d44565b5085821015615d815787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006001600160a01b03808816835280871660208401525060a06040830152615dbd60a0830186615439565b8281036060840152615dcf8186615439565b90508281036080840152613d588185614eb9565b600060208284031215615df557600080fd5b815161099681614e62565b600060033d1115615e195760046000803e5060005160e01c5b90565b600060443d1015615e2a5790565b6040516003193d81016004833e81513d67ffffffffffffffff8160248401118184111715615e5a57505050505090565b8285019150815181811115615e725750505050505090565b843d8701016020828501011115615e8c5750505050505090565b615e9b60208286010187615060565b509095945050505050565b608081526000615eb96080830187614eb9565b6001600160a01b039590951660208301525063ffffffff92909216604083015267ffffffffffffffff16606090910152919050565b818103818111156108c9576108c96159f9565b808201808211156108c9576108c96159f9565b7fff000000000000000000000000000000000000000000000000000000000000008460f81b16815260008351615f51816001850160208801614e95565b835190830190615f68816001840160208801614e95565b0160010195945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152615fad60a0830184614eb9565b97965050505050505056fea26469706673582212203223b0a44605b0982e1edfba8ce02132bc1eb21d9dccff0aa71d14cd93bc594564736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "allFusesBurned(bytes32,uint32)": { + "params": { + "fuseMask": "The fuses you want to check", + "node": "Namehash of the name" + }, + "returns": { + "_0": "Boolean of whether or not all the selected fuses are burned" + } + }, + "approve(address,uint256)": { + "params": { + "to": "address to approve", + "tokenId": "name to approve" + } + }, + "balanceOf(address,uint256)": { + "details": "See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address." + }, + "balanceOfBatch(address[],uint256[])": { + "details": "See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length." + }, + "canExtendSubnames(bytes32,address)": { + "params": { + "addr": "which address to check permissions for", + "node": "namehash of the name to check" + }, + "returns": { + "_0": "whether or not is owner/operator or approved" + } + }, + "canModifyName(bytes32,address)": { + "params": { + "addr": "which address to check permissions for", + "node": "namehash of the name to check" + }, + "returns": { + "_0": "whether or not is owner or operator" + } + }, + "extendExpiry(bytes32,bytes32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "labelhash": "Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')", + "parentNode": "Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')" + }, + "returns": { + "_0": "New expiry" + } + }, + "getApproved(uint256)": { + "params": { + "id": "Namehash of the name" + }, + "returns": { + "operator": "Approved operator of a name" + } + }, + "getData(uint256)": { + "params": { + "id": "Namehash of the name" + }, + "returns": { + "expiry": "Expiry of the name", + "fuses": "Fuses of the name", + "owner": "Owner of the name" + } + }, + "isApprovedForAll(address,address)": { + "details": "See {IERC1155-isApprovedForAll}." + }, + "isWrapped(bytes32)": { + "params": { + "node": "Namehash of the name" + }, + "returns": { + "_0": "Boolean of whether or not the name is wrapped" + } + }, + "isWrapped(bytes32,bytes32)": { + "params": { + "labelhash": "Namehash of the name", + "parentNode": "Namehash of the name" + }, + "returns": { + "_0": "Boolean of whether or not the name is wrapped" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "ownerOf(uint256)": { + "params": { + "id": "Label as a string of the .eth domain to wrap" + }, + "returns": { + "owner": "The owner of the name" + } + }, + "recoverFunds(address,address,uint256)": { + "details": "The contract is Ownable and only the owner can call the recover function.", + "params": { + "_amount": "The amount of tokens to recover.", + "_to": "The address to send the tokens to.", + "_token": "The address of the ERC20 token to recover" + } + }, + "registerAndWrapETH2LD(string,address,uint256,address,uint16)": { + "details": "Registers a new .eth second-level domain and wraps it. Only callable by authorised controllers.", + "params": { + "duration": "The duration, in seconds, to register the name for.", + "label": "The label to register (Eg, 'foo' for 'foo.eth').", + "ownerControlledFuses": "Initial owner-controlled fuses to set", + "resolver": "The resolver address to set on the ENS registry (optional).", + "wrappedOwner": "The owner of the wrapped name." + }, + "returns": { + "registrarExpiry": "The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch." + } + }, + "renew(uint256,uint256)": { + "details": "Only callable by authorised controllers.", + "params": { + "duration": "The number of seconds to renew the name for.", + "tokenId": "The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth')." + }, + "returns": { + "expires": "The expiry date of the name on the .eth registrar, in seconds since the Unix epoch." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)": { + "details": "See {IERC1155-safeBatchTransferFrom}." + }, + "safeTransferFrom(address,address,uint256,uint256,bytes)": { + "details": "See {IERC1155-safeTransferFrom}." + }, + "setApprovalForAll(address,bool)": { + "details": "See {IERC1155-setApprovalForAll}." + }, + "setChildFuses(bytes32,bytes32,uint32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "fuses": "Fuses to burn", + "labelhash": "Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')", + "parentNode": "Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')" + } + }, + "setFuses(bytes32,uint16)": { + "params": { + "node": "Namehash of the name", + "ownerControlledFuses": "Owner-controlled fuses to burn" + }, + "returns": { + "_0": "Old fuses" + } + }, + "setMetadataService(address)": { + "params": { + "_metadataService": "The new metadata service" + } + }, + "setRecord(bytes32,address,address,uint64)": { + "params": { + "node": "Namehash of the name to set a record for", + "owner": "New owner in the registry", + "resolver": "Resolver contract", + "ttl": "Time to live in the registry" + } + }, + "setResolver(bytes32,address)": { + "params": { + "node": "namehash of the name", + "resolver": "the resolver contract" + } + }, + "setSubnodeOwner(bytes32,string,address,uint32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "fuses": "Initial fuses for the wrapped subdomain", + "label": "Label of the subdomain as a string", + "owner": "New owner in the wrapper", + "parentNode": "Parent namehash of the subdomain" + }, + "returns": { + "node": "Namehash of the subdomain" + } + }, + "setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "fuses": "initial fuses for the wrapped subdomain", + "label": "label of the subdomain as a string", + "owner": "new owner in the wrapper", + "parentNode": "parent namehash of the subdomain", + "resolver": "resolver contract in the registry", + "ttl": "ttl in the registry" + }, + "returns": { + "node": "Namehash of the subdomain" + } + }, + "setTTL(bytes32,uint64)": { + "params": { + "node": "Namehash of the name", + "ttl": "TTL in the registry" + } + }, + "setUpgradeContract(address)": { + "details": "The default value of upgradeContract is the 0 address. Use the 0 address at any time to make the contract not upgradable.", + "params": { + "_upgradeAddress": "address of an upgraded contract" + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "unwrap(bytes32,bytes32,address)": { + "details": "Can be called by the owner in the wrapper or an authorised caller in the wrapper", + "params": { + "controller": "Sets the owner in the registry to this address", + "labelhash": "Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')", + "parentNode": "Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')" + } + }, + "unwrapETH2LD(bytes32,address,address)": { + "details": "Can be called by the owner in the wrapper or an authorised caller in the wrapper", + "params": { + "controller": "Sets the owner in the registry to this address", + "labelhash": "Labelhash of the .eth domain", + "registrant": "Sets the owner in the .eth registrar to this address" + } + }, + "upgrade(bytes,bytes)": { + "details": "Can be called by the owner or an authorised caller", + "params": { + "extraData": "Extra data to pass to the upgrade contract", + "name": "The name to upgrade, in DNS format" + } + }, + "uri(uint256)": { + "params": { + "tokenId": "The id of the token" + }, + "returns": { + "_0": "string uri of the metadata service" + } + }, + "wrap(bytes,address,address)": { + "details": "Can be called by the owner in the registry or an authorised caller in the registry", + "params": { + "name": "The name to wrap, in DNS format", + "resolver": "Resolver contract", + "wrappedOwner": "Owner of the name in this contract" + } + }, + "wrapETH2LD(string,address,uint16,address)": { + "details": "Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar", + "params": { + "label": "Label as a string of the .eth domain to wrap", + "ownerControlledFuses": "Initial owner-controlled fuses to set", + "resolver": "Resolver contract address", + "wrappedOwner": "Owner of the name in this contract" + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "allFusesBurned(bytes32,uint32)": { + "notice": "Checks all Fuses in the mask are burned for the node" + }, + "approve(address,uint256)": { + "notice": "Approves an address for a name" + }, + "canExtendSubnames(bytes32,address)": { + "notice": "Checks if owner/operator or approved by owner" + }, + "canModifyName(bytes32,address)": { + "notice": "Checks if owner or operator of the owner" + }, + "extendExpiry(bytes32,bytes32,uint64)": { + "notice": "Extends expiry for a name" + }, + "getApproved(uint256)": { + "notice": "Gets the owner of a name" + }, + "getData(uint256)": { + "notice": "Gets the data for a name" + }, + "isWrapped(bytes32)": { + "notice": "Checks if a name is wrapped" + }, + "isWrapped(bytes32,bytes32)": { + "notice": "Checks if a name is wrapped in a more gas efficient way" + }, + "ownerOf(uint256)": { + "notice": "Gets the owner of a name" + }, + "recoverFunds(address,address,uint256)": { + "notice": "Recover ERC20 tokens sent to the contract by mistake." + }, + "renew(uint256,uint256)": { + "notice": "Renews a .eth second-level domain." + }, + "setChildFuses(bytes32,bytes32,uint32,uint64)": { + "notice": "Sets fuses of a name that you own the parent of" + }, + "setFuses(bytes32,uint16)": { + "notice": "Sets fuses of a name" + }, + "setMetadataService(address)": { + "notice": "Set the metadata service. Only the owner can do this" + }, + "setRecord(bytes32,address,address,uint64)": { + "notice": "Sets records for the name in the ENS Registry" + }, + "setResolver(bytes32,address)": { + "notice": "Sets resolver contract in the registry" + }, + "setSubnodeOwner(bytes32,string,address,uint32,uint64)": { + "notice": "Sets the subdomain owner in the registry and then wraps the subdomain" + }, + "setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)": { + "notice": "Sets the subdomain owner in the registry with records and then wraps the subdomain" + }, + "setTTL(bytes32,uint64)": { + "notice": "Sets TTL in the registry" + }, + "setUpgradeContract(address)": { + "notice": "Set the address of the upgradeContract of the contract. only admin can do this" + }, + "unwrap(bytes32,bytes32,address)": { + "notice": "Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain" + }, + "unwrapETH2LD(bytes32,address,address)": { + "notice": "Unwraps a .eth domain. e.g. vitalik.eth" + }, + "upgrade(bytes,bytes)": { + "notice": "Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain" + }, + "uri(uint256)": { + "notice": "Get the metadata uri" + }, + "wrap(bytes,address,address)": { + "notice": "Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain" + }, + "wrapETH2LD(string,address,uint16,address)": { + "notice": "Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 428, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 13480, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_tokens", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 13486, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_operatorApprovals", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" + }, + { + "astId": 13490, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_tokenApprovals", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_address)" + }, + { + "astId": 13411, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "controllers", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 14946, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "metadataService", + "offset": 0, + "slot": "5", + "type": "t_contract(IMetadataService)14454" + }, + { + "astId": 14950, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "names", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_bytes32,t_bytes_storage)" + }, + { + "astId": 14968, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "upgradeContract", + "offset": 0, + "slot": "7", + "type": "t_contract(INameWrapperUpgrade)14846" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(IMetadataService)14454": { + "encoding": "inplace", + "label": "contract IMetadataService", + "numberOfBytes": "20" + }, + "t_contract(INameWrapperUpgrade)14846": { + "encoding": "inplace", + "label": "contract INameWrapperUpgrade", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_bytes32,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint256,t_address)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/P256SHA256Algorithm.json b/solidity/dns-contracts/deployments/goerli/P256SHA256Algorithm.json new file mode 100644 index 0000000..ace0d2a --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/P256SHA256Algorithm.json @@ -0,0 +1,82 @@ +{ + "address": "0x2FbEcE7fD8E6ceF6eB0F962FEDBEe95374fc3C2A", + "transactionHash": "0x9803c6afed45bfd399e34479523ef527c38a85dc84de7c4b56da51cb9ed245b2", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "key", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x9803c6afed45bfd399e34479523ef527c38a85dc84de7c4b56da51cb9ed245b2", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x2FbEcE7fD8E6ceF6eB0F962FEDBEe95374fc3C2A", + "transactionIndex": 3, + "gasUsed": "1013169", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x16d6df256ff9565bcfcb245d2440f301f7eb11a2b389c6826d93cb3d48242d19", + "transactionHash": "0x9803c6afed45bfd399e34479523ef527c38a85dc84de7c4b56da51cb9ed245b2", + "logs": [], + "blockNumber": 6470032, + "cumulativeGasUsed": "1172642", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "7948b60c3b601df824761a337a51d661", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"verify(bytes,bytes,bytes)\":{\"details\":\"Verifies a signature.\",\"params\":{\"data\":\"The signed data to verify.\",\"key\":\"The public key to verify with.\",\"signature\":\"The signature to verify.\"},\"returns\":{\"_0\":\"True iff the signature is valid.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol\":\"P256SHA256Algorithm\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\\n uint shortest = len;\\n if (otherlen < len)\\n shortest = otherlen;\\n\\n uint selfptr;\\n uint otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint idx = 0; idx < shortest; idx += 32) {\\n uint a;\\n uint b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint mask;\\n if (shortest > 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\\n }\\n int diff = int(a & mask) - int(b & mask);\\n if (diff != 0)\\n return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int(len) - int(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\\n return self.length == other.length && equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint dest, uint src, uint len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint dest;\\n uint src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\\n require(len <= 52);\\n\\n uint ret = 0;\\n uint8 decoded;\\n for(uint i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if(i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint bitlen = len * 5;\\n if(len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if(len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if(len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if(len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if(len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n}\",\"keccak256\":\"0x83315df2e54c74451577c70da2c267c3459802b08b9aeec6516302eee70f796e\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n*/\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external virtual view returns (bool);\\n}\\n\",\"keccak256\":\"0x51d6251568844e435f58952354abe8c8c8e978ab40ecb0bbb2f5bd767838b3a7\"},\"contracts/dnssec-oracle/algorithms/EllipticCurve.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @title EllipticCurve\\n *\\n * @author Tilman Drerup;\\n *\\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\\n *\\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\\n * (https://github.com/orbs-network/elliptic-curve-solidity)\\n *\\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\\n *\\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\\n * condition 'rs[1] > lowSmax' in validateSignature().\\n */\\ncontract EllipticCurve {\\n\\n // Set parameters for curve.\\n uint constant a = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\\n uint constant b = 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\\n uint constant gx = 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\\n uint constant gy = 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\\n uint constant p = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\\n uint constant n = 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\\n\\n uint constant lowSmax = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\\n\\n /**\\n * @dev Inverse of u in the field of modulo m.\\n */\\n function inverseMod(uint u, uint m) internal pure\\n returns (uint)\\n {\\n unchecked {\\n if (u == 0 || u == m || m == 0)\\n return 0;\\n if (u > m)\\n u = u % m;\\n\\n int t1;\\n int t2 = 1;\\n uint r1 = m;\\n uint r2 = u;\\n uint q;\\n\\n while (r2 != 0) {\\n q = r1 / r2;\\n (t1, t2, r1, r2) = (t2, t1 - int(q) * t2, r2, r1 - q * r2);\\n }\\n\\n if (t1 < 0)\\n return (m - uint(-t1));\\n\\n return uint(t1);\\n }\\n }\\n\\n /**\\n * @dev Transform affine coordinates into projective coordinates.\\n */\\n function toProjectivePoint(uint x0, uint y0) internal pure\\n returns (uint[3] memory P)\\n {\\n P[2] = addmod(0, 1, p);\\n P[0] = mulmod(x0, P[2], p);\\n P[1] = mulmod(y0, P[2], p);\\n }\\n\\n /**\\n * @dev Add two points in affine coordinates and return projective point.\\n */\\n function addAndReturnProjectivePoint(uint x1, uint y1, uint x2, uint y2) internal pure\\n returns (uint[3] memory P)\\n {\\n uint x;\\n uint y;\\n (x, y) = add(x1, y1, x2, y2);\\n P = toProjectivePoint(x, y);\\n }\\n\\n /**\\n * @dev Transform from projective to affine coordinates.\\n */\\n function toAffinePoint(uint x0, uint y0, uint z0) internal pure\\n returns (uint x1, uint y1)\\n {\\n uint z0Inv;\\n z0Inv = inverseMod(z0, p);\\n x1 = mulmod(x0, z0Inv, p);\\n y1 = mulmod(y0, z0Inv, p);\\n }\\n\\n /**\\n * @dev Return the zero curve in projective coordinates.\\n */\\n function zeroProj() internal pure\\n returns (uint x, uint y, uint z)\\n {\\n return (0, 1, 0);\\n }\\n\\n /**\\n * @dev Return the zero curve in affine coordinates.\\n */\\n function zeroAffine() internal pure\\n returns (uint x, uint y)\\n {\\n return (0, 0);\\n }\\n\\n /**\\n * @dev Check if the curve is the zero curve.\\n */\\n function isZeroCurve(uint x0, uint y0) internal pure\\n returns (bool isZero)\\n {\\n if(x0 == 0 && y0 == 0) {\\n return true;\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Check if a point in affine coordinates is on the curve.\\n */\\n function isOnCurve(uint x, uint y) internal pure\\n returns (bool)\\n {\\n if (0 == x || x == p || 0 == y || y == p) {\\n return false;\\n }\\n\\n uint LHS = mulmod(y, y, p); // y^2\\n uint RHS = mulmod(mulmod(x, x, p), x, p); // x^3\\n\\n if (a != 0) {\\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\\n }\\n if (b != 0) {\\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\\n }\\n\\n return LHS == RHS;\\n }\\n\\n /**\\n * @dev Double an elliptic curve point in projective coordinates. See\\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\\n */\\n function twiceProj(uint x0, uint y0, uint z0) internal pure\\n returns (uint x1, uint y1, uint z1)\\n {\\n uint t;\\n uint u;\\n uint v;\\n uint w;\\n\\n if(isZeroCurve(x0, y0)) {\\n return zeroProj();\\n }\\n\\n u = mulmod(y0, z0, p);\\n u = mulmod(u, 2, p);\\n\\n v = mulmod(u, x0, p);\\n v = mulmod(v, y0, p);\\n v = mulmod(v, 2, p);\\n\\n x0 = mulmod(x0, x0, p);\\n t = mulmod(x0, 3, p);\\n\\n z0 = mulmod(z0, z0, p);\\n z0 = mulmod(z0, a, p);\\n t = addmod(t, z0, p);\\n\\n w = mulmod(t, t, p);\\n x0 = mulmod(2, v, p);\\n w = addmod(w, p-x0, p);\\n\\n x0 = addmod(v, p-w, p);\\n x0 = mulmod(t, x0, p);\\n y0 = mulmod(y0, u, p);\\n y0 = mulmod(y0, y0, p);\\n y0 = mulmod(2, y0, p);\\n y1 = addmod(x0, p-y0, p);\\n\\n x1 = mulmod(u, w, p);\\n\\n z1 = mulmod(u, u, p);\\n z1 = mulmod(z1, u, p);\\n }\\n\\n /**\\n * @dev Add two elliptic curve points in projective coordinates. See\\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\\n */\\n function addProj(uint x0, uint y0, uint z0, uint x1, uint y1, uint z1) internal pure\\n returns (uint x2, uint y2, uint z2)\\n {\\n uint t0;\\n uint t1;\\n uint u0;\\n uint u1;\\n\\n if (isZeroCurve(x0, y0)) {\\n return (x1, y1, z1);\\n }\\n else if (isZeroCurve(x1, y1)) {\\n return (x0, y0, z0);\\n }\\n\\n t0 = mulmod(y0, z1, p);\\n t1 = mulmod(y1, z0, p);\\n\\n u0 = mulmod(x0, z1, p);\\n u1 = mulmod(x1, z0, p);\\n\\n if (u0 == u1) {\\n if (t0 == t1) {\\n return twiceProj(x0, y0, z0);\\n }\\n else {\\n return zeroProj();\\n }\\n }\\n\\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\\n }\\n\\n /**\\n * @dev Helper function that splits addProj to avoid too many local variables.\\n */\\n function addProj2(uint v, uint u0, uint u1, uint t1, uint t0) private pure\\n returns (uint x2, uint y2, uint z2)\\n {\\n uint u;\\n uint u2;\\n uint u3;\\n uint w;\\n uint t;\\n\\n t = addmod(t0, p-t1, p);\\n u = addmod(u0, p-u1, p);\\n u2 = mulmod(u, u, p);\\n\\n w = mulmod(t, t, p);\\n w = mulmod(w, v, p);\\n u1 = addmod(u1, u0, p);\\n u1 = mulmod(u1, u2, p);\\n w = addmod(w, p-u1, p);\\n\\n x2 = mulmod(u, w, p);\\n\\n u3 = mulmod(u2, u, p);\\n u0 = mulmod(u0, u2, p);\\n u0 = addmod(u0, p-w, p);\\n t = mulmod(t, u0, p);\\n t0 = mulmod(t0, u3, p);\\n\\n y2 = addmod(t, p-t0, p);\\n\\n z2 = mulmod(u3, v, p);\\n }\\n\\n /**\\n * @dev Add two elliptic curve points in affine coordinates.\\n */\\n function add(uint x0, uint y0, uint x1, uint y1) internal pure\\n returns (uint, uint)\\n {\\n uint z0;\\n\\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\\n\\n return toAffinePoint(x0, y0, z0);\\n }\\n\\n /**\\n * @dev Double an elliptic curve point in affine coordinates.\\n */\\n function twice(uint x0, uint y0) internal pure\\n returns (uint, uint)\\n {\\n uint z0;\\n\\n (x0, y0, z0) = twiceProj(x0, y0, 1);\\n\\n return toAffinePoint(x0, y0, z0);\\n }\\n\\n /**\\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\\n */\\n function multiplyPowerBase2(uint x0, uint y0, uint exp) internal pure\\n returns (uint, uint)\\n {\\n uint base2X = x0;\\n uint base2Y = y0;\\n uint base2Z = 1;\\n\\n for(uint i = 0; i < exp; i++) {\\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\\n }\\n\\n return toAffinePoint(base2X, base2Y, base2Z);\\n }\\n\\n /**\\n * @dev Multiply an elliptic curve point by a scalar.\\n */\\n function multiplyScalar(uint x0, uint y0, uint scalar) internal pure\\n returns (uint x1, uint y1)\\n {\\n if(scalar == 0) {\\n return zeroAffine();\\n }\\n else if (scalar == 1) {\\n return (x0, y0);\\n }\\n else if (scalar == 2) {\\n return twice(x0, y0);\\n }\\n\\n uint base2X = x0;\\n uint base2Y = y0;\\n uint base2Z = 1;\\n uint z1 = 1;\\n x1 = x0;\\n y1 = y0;\\n\\n if(scalar%2 == 0) {\\n x1 = y1 = 0;\\n }\\n\\n scalar = scalar >> 1;\\n\\n while(scalar > 0) {\\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\\n\\n if(scalar%2 == 1) {\\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\\n }\\n\\n scalar = scalar >> 1;\\n }\\n\\n return toAffinePoint(x1, y1, z1);\\n }\\n\\n /**\\n * @dev Multiply the curve's generator point by a scalar.\\n */\\n function multipleGeneratorByScalar(uint scalar) internal pure\\n returns (uint, uint)\\n {\\n return multiplyScalar(gx, gy, scalar);\\n }\\n\\n /**\\n * @dev Validate combination of message, signature, and public key.\\n */\\n function validateSignature(bytes32 message, uint[2] memory rs, uint[2] memory Q) internal pure\\n returns (bool)\\n {\\n\\n // To disambiguate between public key solutions, include comment below.\\n if(rs[0] == 0 || rs[0] >= n || rs[1] == 0) {// || rs[1] > lowSmax)\\n return false;\\n }\\n if (!isOnCurve(Q[0], Q[1])) {\\n return false;\\n }\\n\\n uint x1;\\n uint x2;\\n uint y1;\\n uint y2;\\n\\n uint sInv = inverseMod(rs[1], n);\\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint(message), sInv, n));\\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\\n uint[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\\n\\n if (P[2] == 0) {\\n return false;\\n }\\n\\n uint Px = inverseMod(P[2], p);\\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\\n\\n return Px % n == rs[0];\\n }\\n}\",\"keccak256\":\"0xa0dc7fe8a8877e69c22e3e2e47dbc8370027c27dbd6a22cf5d36a4c3679608c8\"},\"contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\nimport \\\"./EllipticCurve.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\n\\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\\n\\n using BytesUtils for *;\\n\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external override view returns (bool) {\\n return validateSignature(sha256(data), parseSignature(signature), parseKey(key));\\n }\\n\\n function parseSignature(bytes memory data) internal pure returns (uint256[2] memory) {\\n require(data.length == 64, \\\"Invalid p256 signature length\\\");\\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\\n }\\n\\n function parseKey(bytes memory data) internal pure returns (uint256[2] memory) {\\n require(data.length == 68, \\\"Invalid p256 key length\\\");\\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\\n }\\n}\\n\",\"keccak256\":\"0x60c0ee554d9a3a3f1cda75c49050143c2aaa33ade54b20d782322035baeb5f81\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50611168806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e366004610ff5565b610057565b604051901515815260200160405180910390f35b60006101316002868660405161006e92919061108b565b602060405180830381855afa15801561008b573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906100ae9190610fdd565b6100ed85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061013c92505050565b61012c8a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101e592505050565b61027e565b979650505050505050565b610144610f61565b81516040146101b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f496e76616c69642070323536207369676e6174757265206c656e67746800000060448201526064015b60405180910390fd5b60408051808201909152806101ca846000610482565b81526020908101906101dd908590610482565b905292915050565b6101ed610f61565b8151604414610258576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f496e76616c69642070323536206b6579206c656e67746800000000000000000060448201526064016101ab565b604080518082019091528061026e846004610482565b81526020016101dd846024610482565b815160009015806102b0575082517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc63255111155b806102bd57506020830151155b156102ca5750600061047b565b815160208301516102db91906104a6565b6102e75750600061047b565b60008080808061031e88600160200201517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc6325516105cc565b905061038e7f6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c2967f4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f57fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551848d096106b5565b885160208a01518b519398509195506103ce929091907fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551908590096106b5565b909450915060006103e186858786610782565b60408101519091506103fc576000965050505050505061047b565b600061042382600260200201516ffffffffeffffffffffffffffffffffff60601b196105cc565b90506ffffffffeffffffffffffffffffffffff60601b19808283098351098a519091506104707fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551836110ca565b149750505050505050505b9392505050565b815160009061049283602061109b565b111561049d57600080fd5b50016020015190565b60008215806104c857506ffffffffeffffffffffffffffffffffff60601b1983145b806104d1575081155b806104ef57506ffffffffeffffffffffffffffffffffff60601b1982145b156104fc575060006105c6565b60006ffffffffeffffffffffffffffffffffff60601b19838409905060006ffffffffeffffffffffffffffffffffff60601b19856ffffffffeffffffffffffffffffffffff60601b198788090990506ffffffffeffffffffffffffffffffffff60601b19807fffffffff00000001000000000000000000000000fffffffffffffffffffffffc8709820890506ffffffffeffffffffffffffffffffffff60601b197f5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b820890501490505b92915050565b60008215806105da57508183145b806105e3575081155b156105f0575060006105c6565b818311156106325781838161062e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b0692505b600060018385835b811561069057818381610676577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b94959404858102909403939192838302900391905061063a565b60008512156106a95750505050600003820390506105c6565b50929695505050505050565b600080826106ca576000805b9150915061077a565b82600114156106dd57508390508261077a565b82600214156106f0576106c185856107a8565b508390508281816001806107056002886110ca565b61071157600094508495505b600187901c96505b86156107665761072a8484846107d8565b9195509350915061073c6002886110ca565b6001141561075a57610752848484898986610acc565b919750955090505b600187901c9650610719565b610771868683610bf1565b95509550505050505b935093915050565b61078a610f7f565b60008061079987878787610c53565b90925090506101318282610c88565b60008060006107b9858560016107d8565b919650945090506107cb858583610bf1565b92509250505b9250929050565b60008060008060008060006107ed8a8a610cf3565b1561080657600060018196509650965050505050610ac3565b6ffffffffeffffffffffffffffffffffff60601b19888a0992506ffffffffeffffffffffffffffffffffff60601b196002840992506ffffffffeffffffffffffffffffffffff60601b198a840991506ffffffffeffffffffffffffffffffffff60601b1989830991506ffffffffeffffffffffffffffffffffff60601b196002830991506ffffffffeffffffffffffffffffffffff60601b198a8b0999506ffffffffeffffffffffffffffffffffff60601b1960038b0993506ffffffffeffffffffffffffffffffffff60601b1988890997506ffffffffeffffffffffffffffffffffff60601b197fffffffff00000001000000000000000000000000fffffffffffffffffffffffc890997506ffffffffeffffffffffffffffffffffff60601b1988850893506ffffffffeffffffffffffffffffffffff60601b1984850990506ffffffffeffffffffffffffffffffffff60601b198260020999506ffffffffeffffffffffffffffffffffff60601b196109958b6ffffffffeffffffffffffffffffffffff60601b196110b3565b820890506ffffffffeffffffffffffffffffffffff60601b196109cc826ffffffffeffffffffffffffffffffffff60601b196110b3565b830899506ffffffffeffffffffffffffffffffffff60601b198a850999506ffffffffeffffffffffffffffffffffff60601b19838a0998506ffffffffeffffffffffffffffffffffff60601b19898a0998506ffffffffeffffffffffffffffffffffff60601b198960020998506ffffffffeffffffffffffffffffffffff60601b19610a6c8a6ffffffffeffffffffffffffffffffffff60601b196110b3565b8b0895506ffffffffeffffffffffffffffffffffff60601b1981840996506ffffffffeffffffffffffffffffffffff60601b1983840994506ffffffffeffffffffffffffffffffffff60601b198386099450505050505b93509350939050565b6000806000806000806000610ae18d8d610cf3565b15610af85789898996509650965050505050610be5565b610b028a8a610cf3565b15610b19578c8c8c96509650965050505050610be5565b6ffffffffeffffffffffffffffffffffff60601b19888d0993506ffffffffeffffffffffffffffffffffff60601b198b8a0992506ffffffffeffffffffffffffffffffffff60601b19888e0991506ffffffffeffffffffffffffffffffffff60601b198b8b09905080821415610bb55782841415610bab57610b9c8d8d8d6107d8565b96509650965050505050610be5565b6000600181610b9c565b610bd96ffffffffeffffffffffffffffffffffff60601b19898d0983838688610d17565b91985096509450505050505b96509650969350505050565b6000806000610c14846ffffffffeffffffffffffffffffffffff60601b196105cc565b90506ffffffffeffffffffffffffffffffffff60601b1981870992506ffffffffeffffffffffffffffffffffff60601b19818609915050935093915050565b6000806000610c688787600188886001610acc565b91985096509050610c7a878783610bf1565b925092505094509492505050565b610c90610f7f565b6ffffffffeffffffffffffffffffffffff60601b196001600008604082018190526ffffffffeffffffffffffffffffffffff60601b19908409815260408101516ffffffffeffffffffffffffffffffffff60601b19908309602082015292915050565b600082158015610d01575081155b15610d0e575060016105c6565b50600092915050565b6000808080808080806ffffffffeffffffffffffffffffffffff60601b19610d538b6ffffffffeffffffffffffffffffffffff60601b196110b3565b8a0890506ffffffffeffffffffffffffffffffffff60601b19610d8a8c6ffffffffeffffffffffffffffffffffff60601b196110b3565b8d0894506ffffffffeffffffffffffffffffffffff60601b1985860993506ffffffffeffffffffffffffffffffffff60601b1981820991506ffffffffeffffffffffffffffffffffff60601b198d830991506ffffffffeffffffffffffffffffffffff60601b198c8c089a506ffffffffeffffffffffffffffffffffff60601b19848c099a506ffffffffeffffffffffffffffffffffff60601b19610e438c6ffffffffeffffffffffffffffffffffff60601b196110b3565b830891506ffffffffeffffffffffffffffffffffff60601b1982860997506ffffffffeffffffffffffffffffffffff60601b1985850992506ffffffffeffffffffffffffffffffffff60601b19848d099b506ffffffffeffffffffffffffffffffffff60601b19610ec8836ffffffffeffffffffffffffffffffffff60601b196110b3565b8d089b506ffffffffeffffffffffffffffffffffff60601b198c820990506ffffffffeffffffffffffffffffffffff60601b19838a0998506ffffffffeffffffffffffffffffffffff60601b19610f338a6ffffffffeffffffffffffffffffffffff60601b196110b3565b820896506ffffffffeffffffffffffffffffffffff60601b198d840995505050505050955095509592505050565b60405180604001604052806002906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60008083601f840112610fae578182fd5b50813567ffffffffffffffff811115610fc5578182fd5b6020830191508360208285010111156107d157600080fd5b600060208284031215610fee578081fd5b5051919050565b6000806000806000806060878903121561100d578182fd5b863567ffffffffffffffff80821115611024578384fd5b6110308a838b01610f9d565b90985096506020890135915080821115611048578384fd5b6110548a838b01610f9d565b9096509450604089013591508082111561106c578384fd5b5061107989828a01610f9d565b979a9699509497509295939492505050565b8183823760009101908152919050565b600082198211156110ae576110ae611103565b500190565b6000828210156110c5576110c5611103565b500390565b6000826110fe577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220036936a4782f07c047a688a0be4b90fa9f2e8184ce2f42ccc8c65ee8fe74944664736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e366004610ff5565b610057565b604051901515815260200160405180910390f35b60006101316002868660405161006e92919061108b565b602060405180830381855afa15801561008b573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906100ae9190610fdd565b6100ed85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061013c92505050565b61012c8a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101e592505050565b61027e565b979650505050505050565b610144610f61565b81516040146101b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f496e76616c69642070323536207369676e6174757265206c656e67746800000060448201526064015b60405180910390fd5b60408051808201909152806101ca846000610482565b81526020908101906101dd908590610482565b905292915050565b6101ed610f61565b8151604414610258576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f496e76616c69642070323536206b6579206c656e67746800000000000000000060448201526064016101ab565b604080518082019091528061026e846004610482565b81526020016101dd846024610482565b815160009015806102b0575082517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc63255111155b806102bd57506020830151155b156102ca5750600061047b565b815160208301516102db91906104a6565b6102e75750600061047b565b60008080808061031e88600160200201517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc6325516105cc565b905061038e7f6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c2967f4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f57fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551848d096106b5565b885160208a01518b519398509195506103ce929091907fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551908590096106b5565b909450915060006103e186858786610782565b60408101519091506103fc576000965050505050505061047b565b600061042382600260200201516ffffffffeffffffffffffffffffffffff60601b196105cc565b90506ffffffffeffffffffffffffffffffffff60601b19808283098351098a519091506104707fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551836110ca565b149750505050505050505b9392505050565b815160009061049283602061109b565b111561049d57600080fd5b50016020015190565b60008215806104c857506ffffffffeffffffffffffffffffffffff60601b1983145b806104d1575081155b806104ef57506ffffffffeffffffffffffffffffffffff60601b1982145b156104fc575060006105c6565b60006ffffffffeffffffffffffffffffffffff60601b19838409905060006ffffffffeffffffffffffffffffffffff60601b19856ffffffffeffffffffffffffffffffffff60601b198788090990506ffffffffeffffffffffffffffffffffff60601b19807fffffffff00000001000000000000000000000000fffffffffffffffffffffffc8709820890506ffffffffeffffffffffffffffffffffff60601b197f5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b820890501490505b92915050565b60008215806105da57508183145b806105e3575081155b156105f0575060006105c6565b818311156106325781838161062e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b0692505b600060018385835b811561069057818381610676577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b94959404858102909403939192838302900391905061063a565b60008512156106a95750505050600003820390506105c6565b50929695505050505050565b600080826106ca576000805b9150915061077a565b82600114156106dd57508390508261077a565b82600214156106f0576106c185856107a8565b508390508281816001806107056002886110ca565b61071157600094508495505b600187901c96505b86156107665761072a8484846107d8565b9195509350915061073c6002886110ca565b6001141561075a57610752848484898986610acc565b919750955090505b600187901c9650610719565b610771868683610bf1565b95509550505050505b935093915050565b61078a610f7f565b60008061079987878787610c53565b90925090506101318282610c88565b60008060006107b9858560016107d8565b919650945090506107cb858583610bf1565b92509250505b9250929050565b60008060008060008060006107ed8a8a610cf3565b1561080657600060018196509650965050505050610ac3565b6ffffffffeffffffffffffffffffffffff60601b19888a0992506ffffffffeffffffffffffffffffffffff60601b196002840992506ffffffffeffffffffffffffffffffffff60601b198a840991506ffffffffeffffffffffffffffffffffff60601b1989830991506ffffffffeffffffffffffffffffffffff60601b196002830991506ffffffffeffffffffffffffffffffffff60601b198a8b0999506ffffffffeffffffffffffffffffffffff60601b1960038b0993506ffffffffeffffffffffffffffffffffff60601b1988890997506ffffffffeffffffffffffffffffffffff60601b197fffffffff00000001000000000000000000000000fffffffffffffffffffffffc890997506ffffffffeffffffffffffffffffffffff60601b1988850893506ffffffffeffffffffffffffffffffffff60601b1984850990506ffffffffeffffffffffffffffffffffff60601b198260020999506ffffffffeffffffffffffffffffffffff60601b196109958b6ffffffffeffffffffffffffffffffffff60601b196110b3565b820890506ffffffffeffffffffffffffffffffffff60601b196109cc826ffffffffeffffffffffffffffffffffff60601b196110b3565b830899506ffffffffeffffffffffffffffffffffff60601b198a850999506ffffffffeffffffffffffffffffffffff60601b19838a0998506ffffffffeffffffffffffffffffffffff60601b19898a0998506ffffffffeffffffffffffffffffffffff60601b198960020998506ffffffffeffffffffffffffffffffffff60601b19610a6c8a6ffffffffeffffffffffffffffffffffff60601b196110b3565b8b0895506ffffffffeffffffffffffffffffffffff60601b1981840996506ffffffffeffffffffffffffffffffffff60601b1983840994506ffffffffeffffffffffffffffffffffff60601b198386099450505050505b93509350939050565b6000806000806000806000610ae18d8d610cf3565b15610af85789898996509650965050505050610be5565b610b028a8a610cf3565b15610b19578c8c8c96509650965050505050610be5565b6ffffffffeffffffffffffffffffffffff60601b19888d0993506ffffffffeffffffffffffffffffffffff60601b198b8a0992506ffffffffeffffffffffffffffffffffff60601b19888e0991506ffffffffeffffffffffffffffffffffff60601b198b8b09905080821415610bb55782841415610bab57610b9c8d8d8d6107d8565b96509650965050505050610be5565b6000600181610b9c565b610bd96ffffffffeffffffffffffffffffffffff60601b19898d0983838688610d17565b91985096509450505050505b96509650969350505050565b6000806000610c14846ffffffffeffffffffffffffffffffffff60601b196105cc565b90506ffffffffeffffffffffffffffffffffff60601b1981870992506ffffffffeffffffffffffffffffffffff60601b19818609915050935093915050565b6000806000610c688787600188886001610acc565b91985096509050610c7a878783610bf1565b925092505094509492505050565b610c90610f7f565b6ffffffffeffffffffffffffffffffffff60601b196001600008604082018190526ffffffffeffffffffffffffffffffffff60601b19908409815260408101516ffffffffeffffffffffffffffffffffff60601b19908309602082015292915050565b600082158015610d01575081155b15610d0e575060016105c6565b50600092915050565b6000808080808080806ffffffffeffffffffffffffffffffffff60601b19610d538b6ffffffffeffffffffffffffffffffffff60601b196110b3565b8a0890506ffffffffeffffffffffffffffffffffff60601b19610d8a8c6ffffffffeffffffffffffffffffffffff60601b196110b3565b8d0894506ffffffffeffffffffffffffffffffffff60601b1985860993506ffffffffeffffffffffffffffffffffff60601b1981820991506ffffffffeffffffffffffffffffffffff60601b198d830991506ffffffffeffffffffffffffffffffffff60601b198c8c089a506ffffffffeffffffffffffffffffffffff60601b19848c099a506ffffffffeffffffffffffffffffffffff60601b19610e438c6ffffffffeffffffffffffffffffffffff60601b196110b3565b830891506ffffffffeffffffffffffffffffffffff60601b1982860997506ffffffffeffffffffffffffffffffffff60601b1985850992506ffffffffeffffffffffffffffffffffff60601b19848d099b506ffffffffeffffffffffffffffffffffff60601b19610ec8836ffffffffeffffffffffffffffffffffff60601b196110b3565b8d089b506ffffffffeffffffffffffffffffffffff60601b198c820990506ffffffffeffffffffffffffffffffffff60601b19838a0998506ffffffffeffffffffffffffffffffffff60601b19610f338a6ffffffffeffffffffffffffffffffffff60601b196110b3565b820896506ffffffffeffffffffffffffffffffffff60601b198d840995505050505050955095509592505050565b60405180604001604052806002906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60008083601f840112610fae578182fd5b50813567ffffffffffffffff811115610fc5578182fd5b6020830191508360208285010111156107d157600080fd5b600060208284031215610fee578081fd5b5051919050565b6000806000806000806060878903121561100d578182fd5b863567ffffffffffffffff80821115611024578384fd5b6110308a838b01610f9d565b90985096506020890135915080821115611048578384fd5b6110548a838b01610f9d565b9096509450604089013591508082111561106c578384fd5b5061107989828a01610f9d565b979a9699509497509295939492505050565b8183823760009101908152919050565b600082198211156110ae576110ae611103565b500190565b6000828210156110c5576110c5611103565b500390565b6000826110fe577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220036936a4782f07c047a688a0be4b90fa9f2e8184ce2f42ccc8c65ee8fe74944664736f6c63430008040033", + "devdoc": { + "kind": "dev", + "methods": { + "verify(bytes,bytes,bytes)": { + "details": "Verifies a signature.", + "params": { + "data": "The signed data to verify.", + "key": "The public key to verify with.", + "signature": "The signature to verify." + }, + "returns": { + "_0": "True iff the signature is valid." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/PublicResolver.json b/solidity/dns-contracts/deployments/goerli/PublicResolver.json new file mode 100644 index 0000000..8d300fb --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/PublicResolver.json @@ -0,0 +1,1671 @@ +{ + "address": "0xd7a4F6473f32aC2Af804B3686AE8F1932bC35750", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract INameWrapper", + "name": "wrapperAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_trustedETHController", + "type": "address" + }, + { + "internalType": "address", + "name": "_trustedReverseRegistrar", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + } + ], + "name": "ABIChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "AddrChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "Approved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "ContenthashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "record", + "type": "bytes" + } + ], + "name": "DNSRecordChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "DNSRecordDeleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "lastzonehash", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "zonehash", + "type": "bytes" + } + ], + "name": "DNSZonehashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "InterfaceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "PubkeyChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "string", + "name": "indexedKey", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "TextChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "newVersion", + "type": "uint64" + } + ], + "name": "VersionChanged", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentTypes", + "type": "uint256" + } + ], + "name": "ABI", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "clearRecords", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "contenthash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "dnsRecord", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + } + ], + "name": "hasDNSRecords", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "interfaceImplementer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "delegate", + "type": "address" + } + ], + "name": "isApprovedFor", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "nodehash", + "type": "bytes32" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicallWithNodeCheck", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "pubkey", + "outputs": [ + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "recordVersions", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setABI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "a", + "type": "bytes" + } + ], + "name": "setAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "setAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setContenthash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setDNSRecords", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "setInterface", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "newName", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "setPubkey", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "setText", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setZonehash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "text", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "zonehash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x545ee9cae18582b69d7ee13ecf081a5512c9925124f9005d13feee483a367b83", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0xd7a4F6473f32aC2Af804B3686AE8F1932bC35750", + "transactionIndex": 39, + "gasUsed": "2774047", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x5c44f0379d21c74f5dd21a6fb5c14fd62e59fec62614b32ead683b65707b7b30", + "transactionHash": "0x545ee9cae18582b69d7ee13ecf081a5512c9925124f9005d13feee483a367b83", + "logs": [], + "blockNumber": 8649374, + "cumulativeGasUsed": "10338349", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0x114D4603199df73e7D157787f8778E21fCd13066", + "0xCc5e7dB10E65EED1BBD105359e7268aa660f6734", + "0x4f7A657451358a22dc397d5eE7981FfC526cd856" + ], + "numDeployments": 6, + "solcInputHash": "0ba2159dea6e6f2226840e68f6c0a0ff", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract INameWrapper\",\"name\":\"wrapperAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_trustedETHController\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_trustedReverseRegistrar\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"}],\"name\":\"ABIChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"AddrChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"newAddress\",\"type\":\"bytes\"}],\"name\":\"AddressChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"Approved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"ContenthashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"record\",\"type\":\"bytes\"}],\"name\":\"DNSRecordChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"DNSRecordDeleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"lastzonehash\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"zonehash\",\"type\":\"bytes\"}],\"name\":\"DNSZonehashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"InterfaceChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NameChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"PubkeyChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"indexedKey\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"TextChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"newVersion\",\"type\":\"uint64\"}],\"name\":\"VersionChanged\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentTypes\",\"type\":\"uint256\"}],\"name\":\"ABI\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"clearRecords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"contenthash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"dnsRecord\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"hasDNSRecords\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"interfaceImplementer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"}],\"name\":\"isApprovedFor\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nodehash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicallWithNodeCheck\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"pubkey\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"recordVersions\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setABI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"a\",\"type\":\"bytes\"}],\"name\":\"setAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"setAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setContenthash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setDNSRecords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"setInterface\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"newName\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"setPubkey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"setText\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setZonehash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"}],\"name\":\"text\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"zonehash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"ABI(bytes32,uint256)\":{\"params\":{\"contentTypes\":\"A bitwise OR of the ABI formats accepted by the caller.\",\"node\":\"The ENS node to query\"},\"returns\":{\"_0\":\"contentType The content type of the return value\",\"_1\":\"data The ABI data\"}},\"addr(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated address.\"}},\"approve(bytes32,address,bool)\":{\"details\":\"Approve a delegate to be able to updated records on a node.\"},\"clearRecords(bytes32)\":{\"params\":{\"node\":\"The node to update.\"}},\"contenthash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated contenthash.\"}},\"dnsRecord(bytes32,bytes32,uint16)\":{\"params\":{\"name\":\"the keccak-256 hash of the fully-qualified name for which to fetch the record\",\"node\":\"the namehash of the node for which to fetch the record\",\"resource\":\"the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\"},\"returns\":{\"_0\":\"the DNS record in wire format if present, otherwise empty\"}},\"hasDNSRecords(bytes32,bytes32)\":{\"params\":{\"name\":\"the namehash of the node for which to check the records\",\"node\":\"the namehash of the node for which to check the records\"}},\"interfaceImplementer(bytes32,bytes4)\":{\"params\":{\"interfaceID\":\"The EIP 165 interface ID to check for.\",\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The address that implements this interface, or 0 if the interface is unsupported.\"}},\"isApprovedFor(address,bytes32,address)\":{\"details\":\"Check to see if the delegate has been approved by the owner for the node.\"},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC1155-isApprovedForAll}.\"},\"name(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated name.\"}},\"pubkey(bytes32)\":{\"params\":{\"node\":\"The ENS node to query\"},\"returns\":{\"x\":\"The X coordinate of the curve point for the public key.\",\"y\":\"The Y coordinate of the curve point for the public key.\"}},\"setABI(bytes32,uint256,bytes)\":{\"params\":{\"contentType\":\"The content type of the ABI\",\"data\":\"The ABI data.\",\"node\":\"The node to update.\"}},\"setAddr(bytes32,address)\":{\"params\":{\"a\":\"The address to set.\",\"node\":\"The node to update.\"}},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC1155-setApprovalForAll}.\"},\"setContenthash(bytes32,bytes)\":{\"params\":{\"hash\":\"The contenthash to set\",\"node\":\"The node to update.\"}},\"setDNSRecords(bytes32,bytes)\":{\"params\":{\"data\":\"the DNS wire format records to set\",\"node\":\"the namehash of the node for which to set the records\"}},\"setInterface(bytes32,bytes4,address)\":{\"params\":{\"implementer\":\"The address of a contract that implements this interface for this node.\",\"interfaceID\":\"The EIP 165 interface ID.\",\"node\":\"The node to update.\"}},\"setName(bytes32,string)\":{\"params\":{\"node\":\"The node to update.\"}},\"setPubkey(bytes32,bytes32,bytes32)\":{\"params\":{\"node\":\"The ENS node to query\",\"x\":\"the X coordinate of the curve point for the public key.\",\"y\":\"the Y coordinate of the curve point for the public key.\"}},\"setText(bytes32,string,string)\":{\"params\":{\"key\":\"The key to set.\",\"node\":\"The node to update.\",\"value\":\"The text data value to set.\"}},\"setZonehash(bytes32,bytes)\":{\"params\":{\"hash\":\"The zonehash to set\",\"node\":\"The node to update.\"}},\"text(bytes32,string)\":{\"params\":{\"key\":\"The text data key to query.\",\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated text data.\"}},\"zonehash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated contenthash.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"ABI(bytes32,uint256)\":{\"notice\":\"Returns the ABI associated with an ENS node. Defined in EIP205.\"},\"addr(bytes32)\":{\"notice\":\"Returns the address associated with an ENS node.\"},\"clearRecords(bytes32)\":{\"notice\":\"Increments the record version associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"contenthash(bytes32)\":{\"notice\":\"Returns the contenthash associated with an ENS node.\"},\"dnsRecord(bytes32,bytes32,uint16)\":{\"notice\":\"Obtain a DNS record.\"},\"hasDNSRecords(bytes32,bytes32)\":{\"notice\":\"Check if a given node has records.\"},\"interfaceImplementer(bytes32,bytes4)\":{\"notice\":\"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.\"},\"name(bytes32)\":{\"notice\":\"Returns the name associated with an ENS node, for reverse records. Defined in EIP181.\"},\"pubkey(bytes32)\":{\"notice\":\"Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619.\"},\"setABI(bytes32,uint256,bytes)\":{\"notice\":\"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.\"},\"setAddr(bytes32,address)\":{\"notice\":\"Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setContenthash(bytes32,bytes)\":{\"notice\":\"Sets the contenthash associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setDNSRecords(bytes32,bytes)\":{\"notice\":\"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.\"},\"setInterface(bytes32,bytes4,address)\":{\"notice\":\"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.\"},\"setName(bytes32,string)\":{\"notice\":\"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.\"},\"setPubkey(bytes32,bytes32,bytes32)\":{\"notice\":\"Sets the SECP256k1 public key associated with an ENS node.\"},\"setText(bytes32,string,string)\":{\"notice\":\"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.\"},\"setZonehash(bytes32,bytes)\":{\"notice\":\"setZonehash sets the hash for the zone. May only be called by the owner of that node in the ENS registry.\"},\"text(bytes32,string)\":{\"notice\":\"Returns the text data associated with an ENS node and key.\"},\"zonehash(bytes32)\":{\"notice\":\"zonehash obtains the hash for the zone.\"}},\"notice\":\"A simple resolver anyone can use; only allows the owner of a node to set its address.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/resolvers/PublicResolver.sol\":\"PublicResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1500},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-2-Clause\\npragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for appending to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n let fpm := add(32, add(ptr, capacity))\\n if lt(fpm, ptr) {\\n revert(0, 0)\\n }\\n mstore(0x40, fpm)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n uint off = buf.buf.length;\\n uint newCapacity = off + len;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(newCapacity, buflen) {\\n mstore(bufptr, newCapacity)\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return append(buf, data, data.length);\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint offPlusOne = off + 1;\\n if (off >= buf.capacity) {\\n resize(buf, offPlusOne * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if gt(offPlusOne, mload(bufptr)) {\\n mstore(bufptr, offPlusOne)\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return append(buf, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return append(buf, data, 32);\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n return buf;\\n }\\n}\\n\",\"keccak256\":\"0xd6dd3b0b327288f8e1b711a609f4040fea602e2ad4bba9febdf2f33b4e56eb0c\",\"license\":\"BSD-2-Clause\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6392f2cfe3a5ee802227fe7a2dfd47096d881aec89bddd214b35c5b46d3cd941\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xab28a56179c1db258c9bf5235b382698cb650debecb51b23d12be9e241374b68\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n */\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint256 labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes memory ret) {\\n uint256 len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint256 labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint256 constant RRSIG_TYPE = 0;\\n uint256 constant RRSIG_ALGORITHM = 2;\\n uint256 constant RRSIG_LABELS = 3;\\n uint256 constant RRSIG_TTL = 4;\\n uint256 constant RRSIG_EXPIRATION = 8;\\n uint256 constant RRSIG_INCEPTION = 12;\\n uint256 constant RRSIG_KEY_TAG = 16;\\n uint256 constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(\\n bytes memory data\\n ) internal pure returns (SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(\\n RRSIG_SIGNER_NAME + self.signerName.length,\\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\\n );\\n }\\n\\n function rrs(\\n SignedSet memory rrset\\n ) internal pure returns (RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint256 offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint256 rdataOffset;\\n uint256 nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns (bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint256 rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.offset,\\n nameLength(iter.data, iter.offset)\\n );\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(\\n RRIterator memory iter\\n ) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.rdataOffset,\\n iter.nextOffset - iter.rdataOffset\\n );\\n }\\n\\n uint256 constant DNSKEY_FLAGS = 0;\\n uint256 constant DNSKEY_PROTOCOL = 2;\\n uint256 constant DNSKEY_ALGORITHM = 3;\\n uint256 constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(\\n offset + DNSKEY_PUBKEY,\\n length - DNSKEY_PUBKEY\\n );\\n }\\n\\n uint256 constant DS_KEY_TAG = 0;\\n uint256 constant DS_ALGORITHM = 2;\\n uint256 constant DS_DIGEST_TYPE = 3;\\n uint256 constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n function isSubdomainOf(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n uint256 off = 0;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n while (counts > othercounts) {\\n off = progress(self, off);\\n counts--;\\n }\\n\\n return self.equals(off, other, 0);\\n }\\n\\n function compareNames(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint256 off;\\n uint256 otheroff;\\n uint256 prevoff;\\n uint256 otherprevoff;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if (otheroff == 0) {\\n return 1;\\n }\\n\\n return\\n self.compare(\\n prevoff + 1,\\n self.readUint8(prevoff),\\n other,\\n otherprevoff + 1,\\n other.readUint8(otherprevoff)\\n );\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(\\n uint32 i1,\\n uint32 i2\\n ) internal pure returns (bool) {\\n unchecked {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n }\\n\\n function progress(\\n bytes memory body,\\n uint256 off\\n ) internal pure returns (uint256) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint256 ac1;\\n uint256 ac2;\\n for (uint256 i = 0; i < data.length + 31; i += 32) {\\n uint256 word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if (i + 32 > data.length) {\\n uint256 unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 +=\\n (word &\\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\\n 8;\\n ac2 += (word &\\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 =\\n (ac1 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac1 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac2 =\\n (ac2 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac2 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 =\\n (ac1 &\\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\\n 32);\\n ac1 =\\n (ac1 &\\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\\n 64);\\n ac1 =\\n (ac1 &\\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\\n (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4dd68a6efd7c38f6b0e95ca0c056ecb74f88583da650b1a8639e6e78be36fede\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x9ac51351ff72d73083aed62b7cdad4c07e9d1eb68401d7fd8457bdd828f2c6fe\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/resolvers/IMulticallable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IMulticallable {\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n}\\n\",\"keccak256\":\"0x0334202e20bb11995997083d05963f5e8e7ed6194cba494e7f9371ab7bf4e2c3\",\"license\":\"MIT\"},\"contracts/resolvers/Multicallable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"./IMulticallable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nabstract contract Multicallable is IMulticallable, ERC165 {\\n function _multicall(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) internal returns (bytes[] memory results) {\\n results = new bytes[](data.length);\\n for (uint256 i = 0; i < data.length; i++) {\\n if (nodehash != bytes32(0)) {\\n bytes32 txNamehash = bytes32(data[i][4:36]);\\n require(\\n txNamehash == nodehash,\\n \\\"multicall: All records must have a matching namehash\\\"\\n );\\n }\\n (bool success, bytes memory result) = address(this).delegatecall(\\n data[i]\\n );\\n require(success);\\n results[i] = result;\\n }\\n return results;\\n }\\n\\n // This function provides an extra security check when called\\n // from priviledged contracts (such as EthRegistrarController)\\n // that can set records on behalf of the node owners\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results) {\\n return _multicall(nodehash, data);\\n }\\n\\n function multicall(\\n bytes[] calldata data\\n ) public override returns (bytes[] memory results) {\\n return _multicall(bytes32(0), data);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IMulticallable).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x1063a9dd3b94ba304624d5ec6deb43c1916640758ae970eece4d4e3ef8b2fcb1\",\"license\":\"MIT\"},\"contracts/resolvers/PublicResolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./profiles/ABIResolver.sol\\\";\\nimport \\\"./profiles/AddrResolver.sol\\\";\\nimport \\\"./profiles/ContentHashResolver.sol\\\";\\nimport \\\"./profiles/DNSResolver.sol\\\";\\nimport \\\"./profiles/InterfaceResolver.sol\\\";\\nimport \\\"./profiles/NameResolver.sol\\\";\\nimport \\\"./profiles/PubkeyResolver.sol\\\";\\nimport \\\"./profiles/TextResolver.sol\\\";\\nimport \\\"./profiles/ExtendedResolver.sol\\\";\\nimport \\\"./Multicallable.sol\\\";\\nimport \\\"../wrapper/INameWrapper.sol\\\";\\n\\n/**\\n * A simple resolver anyone can use; only allows the owner of a node to set its\\n * address.\\n */\\ncontract PublicResolver is\\n Multicallable,\\n ABIResolver,\\n AddrResolver,\\n ContentHashResolver,\\n DNSResolver,\\n InterfaceResolver,\\n NameResolver,\\n PubkeyResolver,\\n TextResolver,\\n ExtendedResolver\\n{\\n ENS immutable ens;\\n INameWrapper immutable nameWrapper;\\n address immutable trustedETHController;\\n address immutable trustedReverseRegistrar;\\n\\n /**\\n * A mapping of operators. An address that is authorised for an address\\n * may make any changes to the name that the owner could, but may not update\\n * the set of authorisations.\\n * (owner, operator) => approved\\n */\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * A mapping of delegates. A delegate that is authorised by an owner\\n * for a name may make changes to the name's resolver, but may not update\\n * the set of token approvals.\\n * (owner, name, delegate) => approved\\n */\\n mapping(address => mapping(bytes32 => mapping(address => bool)))\\n private _tokenApprovals;\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n // Logged when a delegate is approved or an approval is revoked.\\n event Approved(\\n address owner,\\n bytes32 indexed node,\\n address indexed delegate,\\n bool indexed approved\\n );\\n\\n constructor(\\n ENS _ens,\\n INameWrapper wrapperAddress,\\n address _trustedETHController,\\n address _trustedReverseRegistrar\\n ) {\\n ens = _ens;\\n nameWrapper = wrapperAddress;\\n trustedETHController = _trustedETHController;\\n trustedReverseRegistrar = _trustedReverseRegistrar;\\n }\\n\\n /**\\n * @dev See {IERC1155-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) external {\\n require(\\n msg.sender != operator,\\n \\\"ERC1155: setting approval status for self\\\"\\n );\\n\\n _operatorApprovals[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC1155-isApprovedForAll}.\\n */\\n function isApprovedForAll(\\n address account,\\n address operator\\n ) public view returns (bool) {\\n return _operatorApprovals[account][operator];\\n }\\n\\n /**\\n * @dev Approve a delegate to be able to updated records on a node.\\n */\\n function approve(bytes32 node, address delegate, bool approved) external {\\n require(msg.sender != delegate, \\\"Setting delegate status for self\\\");\\n\\n _tokenApprovals[msg.sender][node][delegate] = approved;\\n emit Approved(msg.sender, node, delegate, approved);\\n }\\n\\n /**\\n * @dev Check to see if the delegate has been approved by the owner for the node.\\n */\\n function isApprovedFor(\\n address owner,\\n bytes32 node,\\n address delegate\\n ) public view returns (bool) {\\n return _tokenApprovals[owner][node][delegate];\\n }\\n\\n function isAuthorised(bytes32 node) internal view override returns (bool) {\\n if (\\n msg.sender == trustedETHController ||\\n msg.sender == trustedReverseRegistrar\\n ) {\\n return true;\\n }\\n address owner = ens.owner(node);\\n if (owner == address(nameWrapper)) {\\n owner = nameWrapper.ownerOf(uint256(node));\\n }\\n return\\n owner == msg.sender ||\\n isApprovedForAll(owner, msg.sender) ||\\n isApprovedFor(owner, node, msg.sender);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n )\\n public\\n view\\n override(\\n Multicallable,\\n ABIResolver,\\n AddrResolver,\\n ContentHashResolver,\\n DNSResolver,\\n InterfaceResolver,\\n NameResolver,\\n PubkeyResolver,\\n TextResolver\\n )\\n returns (bool)\\n {\\n return super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x68bc184c5693cc69b60b9106628659ae966f033da5605bc7bc16e523cb24a326\",\"license\":\"MIT\"},\"contracts/resolvers/ResolverBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"./profiles/IVersionableResolver.sol\\\";\\n\\nabstract contract ResolverBase is ERC165, IVersionableResolver {\\n mapping(bytes32 => uint64) public recordVersions;\\n\\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\\n\\n modifier authorised(bytes32 node) {\\n require(isAuthorised(node));\\n _;\\n }\\n\\n /**\\n * Increments the record version associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function clearRecords(bytes32 node) public virtual authorised(node) {\\n recordVersions[node]++;\\n emit VersionChanged(node, recordVersions[node]);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IVersionableResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x893049fffd6feee06d7acef1680f6e26505bedff62a9f7a17e921c0ba2f66307\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"./IABIResolver.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\n\\nabstract contract ABIResolver is IABIResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\\n\\n /**\\n * Sets the ABI associated with an ENS node.\\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\\n * the empty string.\\n * @param node The node to update.\\n * @param contentType The content type of the ABI\\n * @param data The ABI data.\\n */\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external virtual authorised(node) {\\n // Content types must be powers of 2\\n require(((contentType - 1) & contentType) == 0);\\n\\n versionable_abis[recordVersions[node]][node][contentType] = data;\\n emit ABIChanged(node, contentType);\\n }\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view virtual override returns (uint256, bytes memory) {\\n mapping(uint256 => bytes) storage abiset = versionable_abis[\\n recordVersions[node]\\n ][node];\\n\\n for (\\n uint256 contentType = 1;\\n contentType <= contentTypes;\\n contentType <<= 1\\n ) {\\n if (\\n (contentType & contentTypes) != 0 &&\\n abiset[contentType].length > 0\\n ) {\\n return (contentType, abiset[contentType]);\\n }\\n }\\n\\n return (0, bytes(\\\"\\\"));\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IABIResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x2da96d7750786afe3be019fc6ff768e2d98a5e61d360bd92d8d7bc3c7c1dcc27\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/AddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IAddrResolver.sol\\\";\\nimport \\\"./IAddressResolver.sol\\\";\\n\\nabstract contract AddrResolver is\\n IAddrResolver,\\n IAddressResolver,\\n ResolverBase\\n{\\n uint256 private constant COIN_TYPE_ETH = 60;\\n\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\\n\\n /**\\n * Sets the address associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param a The address to set.\\n */\\n function setAddr(\\n bytes32 node,\\n address a\\n ) external virtual authorised(node) {\\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\\n }\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(\\n bytes32 node\\n ) public view virtual override returns (address payable) {\\n bytes memory a = addr(node, COIN_TYPE_ETH);\\n if (a.length == 0) {\\n return payable(0);\\n }\\n return bytesToAddress(a);\\n }\\n\\n function setAddr(\\n bytes32 node,\\n uint256 coinType,\\n bytes memory a\\n ) public virtual authorised(node) {\\n emit AddressChanged(node, coinType, a);\\n if (coinType == COIN_TYPE_ETH) {\\n emit AddrChanged(node, bytesToAddress(a));\\n }\\n versionable_addresses[recordVersions[node]][node][coinType] = a;\\n }\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) public view virtual override returns (bytes memory) {\\n return versionable_addresses[recordVersions[node]][node][coinType];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IAddrResolver).interfaceId ||\\n interfaceID == type(IAddressResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function bytesToAddress(\\n bytes memory b\\n ) internal pure returns (address payable a) {\\n require(b.length == 20);\\n assembly {\\n a := div(mload(add(b, 32)), exp(256, 12))\\n }\\n }\\n\\n function addressToBytes(address a) internal pure returns (bytes memory b) {\\n b = new bytes(20);\\n assembly {\\n mstore(add(b, 32), mul(a, exp(256, 12)))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7f6ebb3144530a02db03379f33ade869c8408eceed36dfbd751aaff198735b55\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IContentHashResolver.sol\\\";\\n\\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\\n\\n /**\\n * Sets the contenthash associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param hash The contenthash to set\\n */\\n function setContenthash(\\n bytes32 node,\\n bytes calldata hash\\n ) external virtual authorised(node) {\\n versionable_hashes[recordVersions[node]][node] = hash;\\n emit ContenthashChanged(node, hash);\\n }\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(\\n bytes32 node\\n ) external view virtual override returns (bytes memory) {\\n return versionable_hashes[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IContentHashResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xc9755bfb77985375ded880ecab5af41f2b9e8280f30d3e523fe5042ea59f93ea\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/DNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"../../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"./IDNSRecordResolver.sol\\\";\\nimport \\\"./IDNSZoneResolver.sol\\\";\\n\\nabstract contract DNSResolver is\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n ResolverBase\\n{\\n using RRUtils for *;\\n using BytesUtils for bytes;\\n\\n // Zone hashes for the domains.\\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\\n // resource containing a single zonefile.\\n // node => contenthash\\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\\n\\n // The records themselves. Stored as binary RRSETs\\n // node => version => name => resource => data\\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\\n private versionable_records;\\n\\n // Count of number of entries for a given name. Required for DNS resolvers\\n // when resolving wildcards.\\n // node => version => name => number of records\\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\\n private versionable_nameEntriesCount;\\n\\n /**\\n * Set one or more DNS records. Records are supplied in wire-format.\\n * Records with the same node/name/resource must be supplied one after the\\n * other to ensure the data is updated correctly. For example, if the data\\n * was supplied:\\n * a.example.com IN A 1.2.3.4\\n * a.example.com IN A 5.6.7.8\\n * www.example.com IN CNAME a.example.com.\\n * then this would store the two A records for a.example.com correctly as a\\n * single RRSET, however if the data was supplied:\\n * a.example.com IN A 1.2.3.4\\n * www.example.com IN CNAME a.example.com.\\n * a.example.com IN A 5.6.7.8\\n * then this would store the first A record, the CNAME, then the second A\\n * record which would overwrite the first.\\n *\\n * @param node the namehash of the node for which to set the records\\n * @param data the DNS wire format records to set\\n */\\n function setDNSRecords(\\n bytes32 node,\\n bytes calldata data\\n ) external virtual authorised(node) {\\n uint16 resource = 0;\\n uint256 offset = 0;\\n bytes memory name;\\n bytes memory value;\\n bytes32 nameHash;\\n uint64 version = recordVersions[node];\\n // Iterate over the data to add the resource records\\n for (\\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\\n !iter.done();\\n iter.next()\\n ) {\\n if (resource == 0) {\\n resource = iter.dnstype;\\n name = iter.name();\\n nameHash = keccak256(abi.encodePacked(name));\\n value = bytes(iter.rdata());\\n } else {\\n bytes memory newName = iter.name();\\n if (resource != iter.dnstype || !name.equals(newName)) {\\n setDNSRRSet(\\n node,\\n name,\\n resource,\\n data,\\n offset,\\n iter.offset - offset,\\n value.length == 0,\\n version\\n );\\n resource = iter.dnstype;\\n offset = iter.offset;\\n name = newName;\\n nameHash = keccak256(name);\\n value = bytes(iter.rdata());\\n }\\n }\\n }\\n if (name.length > 0) {\\n setDNSRRSet(\\n node,\\n name,\\n resource,\\n data,\\n offset,\\n data.length - offset,\\n value.length == 0,\\n version\\n );\\n }\\n }\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) public view virtual override returns (bytes memory) {\\n return versionable_records[recordVersions[node]][node][name][resource];\\n }\\n\\n /**\\n * Check if a given node has records.\\n * @param node the namehash of the node for which to check the records\\n * @param name the namehash of the node for which to check the records\\n */\\n function hasDNSRecords(\\n bytes32 node,\\n bytes32 name\\n ) public view virtual returns (bool) {\\n return (versionable_nameEntriesCount[recordVersions[node]][node][\\n name\\n ] != 0);\\n }\\n\\n /**\\n * setZonehash sets the hash for the zone.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param hash The zonehash to set\\n */\\n function setZonehash(\\n bytes32 node,\\n bytes calldata hash\\n ) external virtual authorised(node) {\\n uint64 currentRecordVersion = recordVersions[node];\\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\\n node\\n ];\\n versionable_zonehashes[currentRecordVersion][node] = hash;\\n emit DNSZonehashChanged(node, oldhash, hash);\\n }\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(\\n bytes32 node\\n ) external view virtual override returns (bytes memory) {\\n return versionable_zonehashes[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IDNSRecordResolver).interfaceId ||\\n interfaceID == type(IDNSZoneResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function setDNSRRSet(\\n bytes32 node,\\n bytes memory name,\\n uint16 resource,\\n bytes memory data,\\n uint256 offset,\\n uint256 size,\\n bool deleteRecord,\\n uint64 version\\n ) private {\\n bytes32 nameHash = keccak256(name);\\n bytes memory rrData = data.substring(offset, size);\\n if (deleteRecord) {\\n if (\\n versionable_records[version][node][nameHash][resource].length !=\\n 0\\n ) {\\n versionable_nameEntriesCount[version][node][nameHash]--;\\n }\\n delete (versionable_records[version][node][nameHash][resource]);\\n emit DNSRecordDeleted(node, name, resource);\\n } else {\\n if (\\n versionable_records[version][node][nameHash][resource].length ==\\n 0\\n ) {\\n versionable_nameEntriesCount[version][node][nameHash]++;\\n }\\n versionable_records[version][node][nameHash][resource] = rrData;\\n emit DNSRecordChanged(node, name, resource, rrData);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7233e4d2edca222ce6e1cdb07adf127ab52ecaea599fa5369971a7b28dbc59ac\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ncontract ExtendedResolver {\\n function resolve(\\n bytes memory /* name */,\\n bytes memory data\\n ) external view returns (bytes memory) {\\n (bool success, bytes memory result) = address(this).staticcall(data);\\n if (success) {\\n return result;\\n } else {\\n // Revert with the reason provided by the call\\n assembly {\\n revert(add(result, 0x20), mload(result))\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd0e5c93ac9f4d21a0278282e2a32a9c5606a0053ce4781773b7faade57a4a54e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IVersionableResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IVersionableResolver {\\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\\n\\n function recordVersions(bytes32 node) external view returns (uint64);\\n}\\n\",\"keccak256\":\"0xd0d09596f20c57bafb2ffa8521a8c57120e9af6c6b194f9c689d4da56f91a57c\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/InterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./AddrResolver.sol\\\";\\nimport \\\"./IInterfaceResolver.sol\\\";\\n\\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\\n\\n /**\\n * Sets an interface associated with a name.\\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\\n * @param node The node to update.\\n * @param interfaceID The EIP 165 interface ID.\\n * @param implementer The address of a contract that implements this interface for this node.\\n */\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external virtual authorised(node) {\\n versionable_interfaces[recordVersions[node]][node][\\n interfaceID\\n ] = implementer;\\n emit InterfaceChanged(node, interfaceID, implementer);\\n }\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view virtual override returns (address) {\\n address implementer = versionable_interfaces[recordVersions[node]][\\n node\\n ][interfaceID];\\n if (implementer != address(0)) {\\n return implementer;\\n }\\n\\n address a = addr(node);\\n if (a == address(0)) {\\n return address(0);\\n }\\n\\n (bool success, bytes memory returnData) = a.staticcall(\\n abi.encodeWithSignature(\\n \\\"supportsInterface(bytes4)\\\",\\n type(IERC165).interfaceId\\n )\\n );\\n if (!success || returnData.length < 32 || returnData[31] == 0) {\\n // EIP 165 not supported by target\\n return address(0);\\n }\\n\\n (success, returnData) = a.staticcall(\\n abi.encodeWithSignature(\\\"supportsInterface(bytes4)\\\", interfaceID)\\n );\\n if (!success || returnData.length < 32 || returnData[31] == 0) {\\n // Specified interface not supported by target\\n return address(0);\\n }\\n\\n return a;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IInterfaceResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x820ec60183e7a49a4ee399cf4708acb776725c8e4ad275d1f316c152eace0a59\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/NameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./INameResolver.sol\\\";\\n\\nabstract contract NameResolver is INameResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\\n\\n /**\\n * Sets the name associated with an ENS node, for reverse records.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function setName(\\n bytes32 node,\\n string calldata newName\\n ) external virtual authorised(node) {\\n versionable_names[recordVersions[node]][node] = newName;\\n emit NameChanged(node, newName);\\n }\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(\\n bytes32 node\\n ) external view virtual override returns (string memory) {\\n return versionable_names[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(INameResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x52d0bbb8f9dd33fae471ef2f5f6b3118b221954e5bb7ba724885d4562e75b8e2\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/PubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IPubkeyResolver.sol\\\";\\n\\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\\n struct PublicKey {\\n bytes32 x;\\n bytes32 y;\\n }\\n\\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\\n\\n /**\\n * Sets the SECP256k1 public key associated with an ENS node.\\n * @param node The ENS node to query\\n * @param x the X coordinate of the curve point for the public key.\\n * @param y the Y coordinate of the curve point for the public key.\\n */\\n function setPubkey(\\n bytes32 node,\\n bytes32 x,\\n bytes32 y\\n ) external virtual authorised(node) {\\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\\n emit PubkeyChanged(node, x, y);\\n }\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(\\n bytes32 node\\n ) external view virtual override returns (bytes32 x, bytes32 y) {\\n uint64 currentRecordVersion = recordVersions[node];\\n return (\\n versionable_pubkeys[currentRecordVersion][node].x,\\n versionable_pubkeys[currentRecordVersion][node].y\\n );\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IPubkeyResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x1a1f10a0e40520c998a9296fc81c092c81521e05a784e9bd9ee44cc4c62c8c78\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/TextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./ITextResolver.sol\\\";\\n\\nabstract contract TextResolver is ITextResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\\n\\n /**\\n * Sets the text data associated with an ENS node and key.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param key The key to set.\\n * @param value The text data value to set.\\n */\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external virtual authorised(node) {\\n versionable_texts[recordVersions[node]][node][key] = value;\\n emit TextChanged(node, key, key, value);\\n }\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view virtual override returns (string memory) {\\n return versionable_texts[recordVersions[node]][node][key];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(ITextResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xf9bedd807add38136779d84083ac2fa4f8c92d017c9e1a72fbc9003fa5074379\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_ETH = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x70310eb67146d7290731c31841399640ac3b6a949eadc6598bc150123d185c57\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101006040523480156200001257600080fd5b506040516200325e3803806200325e833981016040819052620000359162000071565b6001600160a01b0393841660805291831660a052821660c0521660e052620000d9565b6001600160a01b03811681146200006e57600080fd5b50565b600080600080608085870312156200008857600080fd5b8451620000958162000058565b6020860151909450620000a88162000058565b6040860151909350620000bb8162000058565b6060860151909250620000ce8162000058565b939692955090935050565b60805160a05160c05160e0516131446200011a600039600061186e0152600061183c01526000818161194601526119ac015260006118cf01526131446000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80638b95dd711161010f578063c8690233116100a2578063e32954eb11610071578063e32954eb14610522578063e59d895d14610535578063e985e9c514610548578063f1cb7e061461058457600080fd5b8063c869023314610460578063ce3decdc146104b9578063d5fa2b00146104cc578063d700ff33146104df57600080fd5b8063a8fa5682116100de578063a8fa5682146103d6578063a9784b3e146103e9578063ac9650d81461042d578063bc1c58d11461044d57600080fd5b80638b95dd711461038a5780639061b9231461039d578063a22cb465146103b0578063a4b91a01146103c357600080fd5b80633603d758116101875780635c98042b116101565780635c98042b1461033e578063623195b014610351578063691f343114610364578063773722131461037757600080fd5b80633603d758146102ac5780633b3b57de146102bf5780634cbf6ba4146102d257806359d1d43c1461031e57600080fd5b8063124a319c116101c3578063124a319c1461023a5780632203ab561461026557806329cd62ea14610286578063304e6ade1461029957600080fd5b806301ffc9a7146101ea5780630af179d71461021257806310f13a8c14610227575b600080fd5b6101fd6101f83660046125c0565b610597565b60405190151581526020015b60405180910390f35b61022561022036600461261d565b6105a8565b005b610225610235366004612669565b6107b2565b61024d6102483660046126e3565b61087f565b6040516001600160a01b039091168152602001610209565b61027861027336600461270f565b610b2b565b604051610209929190612781565b61022561029436600461279a565b610c62565b6102256102a736600461261d565b610cfd565b6102256102ba3660046127c6565b610d79565b61024d6102cd3660046127c6565b610e1c565b6101fd6102e036600461270f565b6000828152602081815260408083205467ffffffffffffffff1683526006825280832094835293815283822092825291909152205461ffff16151590565b61033161032c36600461261d565b610e4e565b60405161020991906127df565b61033161034c3660046127c6565b610f2e565b61022561035f3660046127f2565b610fed565b6103316103723660046127c6565b61108a565b61022561038536600461261d565b6110c4565b6102256103983660046128e8565b611140565b6103316103ab366004612938565b611220565b6102256103be3660046129c1565b611299565b6102256103d13660046129ed565b611388565b6103316103e4366004612a2b565b611455565b6101fd6103f7366004612a6b565b6001600160a01b039283166000908152600c60209081526040808320948352938152838220929094168152925290205460ff1690565b61044061043b366004612ae7565b6114a3565b6040516102099190612b29565b61033161045b3660046127c6565b6114b1565b6104a461046e3660046127c6565b6000818152602081815260408083205467ffffffffffffffff168352600982528083209383529290522080546001909101549091565b60408051928352602083019190915201610209565b6102256104c736600461261d565b6114eb565b6102256104da366004612b8b565b61162e565b6105096104ed3660046127c6565b60006020819052908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610209565b610440610530366004612bbb565b611655565b610225610543366004612bfa565b61166a565b6101fd610556366004612c2f565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b61033161059236600461270f565b611729565b60006105a2826117f1565b92915050565b826105b28161182f565b6105bb57600080fd5b600084815260208181526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff9091169183916106219183918d908d90819084018382808284376000920191909152509293925050611a969050565b90505b8051516020820151101561074b578661ffff16600003610689578060400151965061064e81611af7565b9450846040516020016106619190612c5d565b60405160208183030381529060405280519060200120925061068281611b18565b935061073d565b600061069482611af7565b9050816040015161ffff168861ffff161415806106b857506106b68682611b34565b155b1561073b576107148c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d915061070b908290612c8f565b8b51158a611b52565b81604001519750816020015196508095508580519060200120935061073882611b18565b94505b505b61074681611dbf565b610624565b508351156107a6576107a68a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c925061079d91508290508f612c8f565b89511588611b52565b50505050505050505050565b846107bc8161182f565b6107c557600080fd5b6000868152602081815260408083205467ffffffffffffffff168352600a8252808320898452909152908190209051849184916108059089908990612ca2565b90815260200160405180910390209182610820929190612d3a565b508484604051610831929190612ca2565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a18787878760405161086f9493929190612e23565b60405180910390a3505050505050565b6000828152602081815260408083205467ffffffffffffffff1683526007825280832085845282528083206001600160e01b0319851684529091528120546001600160a01b031680156108d35790506105a2565b60006108de85610e1c565b90506001600160a01b0381166108f9576000925050506105a2565b6040516301ffc9a760e01b602482015260009081906001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516109669190612c5d565b600060405180830381855afa9150503d80600081146109a1576040519150601f19603f3d011682016040523d82523d6000602084013e6109a6565b606091505b50915091508115806109b9575060208151105b806109fb575080601f815181106109d2576109d2612e55565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610a0d5760009450505050506105a2565b6040516001600160e01b0319871660248201526001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b17905251610a789190612c5d565b600060405180830381855afa9150503d8060008114610ab3576040519150601f19603f3d011682016040523d82523d6000602084013e610ab8565b606091505b509092509050811580610acc575060208151105b80610b0e575080601f81518110610ae557610ae5612e55565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610b205760009450505050506105a2565b509095945050505050565b6000828152602081815260408083205467ffffffffffffffff168352600180835281842086855290925282206060915b848111610c425780851615801590610b8b575060008181526020839052604081208054610b8790612cb2565b9050115b15610c3a5780826000838152602001908152602001600020808054610baf90612cb2565b80601f0160208091040260200160405190810160405280929190818152602001828054610bdb90612cb2565b8015610c285780601f10610bfd57610100808354040283529160200191610c28565b820191906000526020600020905b815481529060010190602001808311610c0b57829003601f168201915b50505050509050935093505050610c5b565b60011b610b5b565b5060006040518060200160405280600081525092509250505b9250929050565b82610c6c8161182f565b610c7557600080fd5b604080518082018252848152602080820185815260008881528083528481205467ffffffffffffffff1681526009835284812089825283528490209251835551600190920191909155815185815290810184905285917f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4691015b60405180910390a250505050565b82610d078161182f565b610d1057600080fd5b6000848152602081815260408083205467ffffffffffffffff168352600382528083208784529091529020610d46838583612d3a565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610cef929190612e6b565b80610d838161182f565b610d8c57600080fd5b6000828152602081905260408120805467ffffffffffffffff1691610db083612e7f565b82546101009290920a67ffffffffffffffff818102199093169183160217909155600084815260208181526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610e2a83603c611729565b90508051600003610e3e5750600092915050565b610e4781611ea7565b9392505050565b6000838152602081815260408083205467ffffffffffffffff168352600a825280832086845290915290819020905160609190610e8e9085908590612ca2565b90815260200160405180910390208054610ea790612cb2565b80601f0160208091040260200160405190810160405280929190818152602001828054610ed390612cb2565b8015610f205780601f10610ef557610100808354040283529160200191610f20565b820191906000526020600020905b815481529060010190602001808311610f0357829003601f168201915b505050505090509392505050565b6000818152602081815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610f6890612cb2565b80601f0160208091040260200160405190810160405280929190818152602001828054610f9490612cb2565b8015610fe15780601f10610fb657610100808354040283529160200191610fe1565b820191906000526020600020905b815481529060010190602001808311610fc457829003601f168201915b50505050509050919050565b83610ff78161182f565b61100057600080fd5b8361100c600182612c8f565b161561101757600080fd5b6000858152602081815260408083205467ffffffffffffffff1683526001825280832088845282528083208784529091529020611055838583612d3a565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b6000818152602081815260408083205467ffffffffffffffff168352600882528083208484529091529020805460609190610f6890612cb2565b826110ce8161182f565b6110d757600080fd5b6000848152602081815260408083205467ffffffffffffffff16835260088252808320878452909152902061110d838583612d3a565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610cef929190612e6b565b8261114a8161182f565b61115357600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af7528484604051611185929190612781565b60405180910390a2603c83036111dc57837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd26111c084611ea7565b6040516001600160a01b03909116815260200160405180910390a25b6000848152602081815260408083205467ffffffffffffffff16835260028252808320878452825280832086845290915290206112198382612ea6565b5050505050565b6060600080306001600160a01b03168460405161123d9190612c5d565b600060405180830381855afa9150503d8060008114611278576040519150601f19603f3d011682016040523d82523d6000602084013e61127d565b606091505b509150915081156112915791506105a29050565b805160208201fd5b6001600160a01b038216330361131c5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336000818152600b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6001600160a01b03821633036113e05760405162461bcd60e51b815260206004820181905260248201527f53657474696e672064656c65676174652073746174757320666f722073656c666044820152606401611313565b336000818152600c6020908152604080832087845282528083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519384529286917ff0ddb3b04746704017f9aa8bd728fcc2c1d11675041205350018915f5e4750a0910160405180910390a4505050565b6000838152602081815260408083205467ffffffffffffffff168352600582528083208684528252808320858452825280832061ffff851684529091529020805460609190610ea790612cb2565b6060610e4760008484611ecf565b6000818152602081815260408083205467ffffffffffffffff168352600382528083208484529091529020805460609190610f6890612cb2565b826114f58161182f565b6114fe57600080fd5b6000848152602081815260408083205467ffffffffffffffff16808452600483528184208885529092528220805491929161153890612cb2565b80601f016020809104026020016040519081016040528092919081815260200182805461156490612cb2565b80156115b15780601f10611586576101008083540402835291602001916115b1565b820191906000526020600020905b81548152906001019060200180831161159457829003601f168201915b5050505067ffffffffffffffff841660009081526004602090815260408083208b845290915290209192506115e99050858783612d3a565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f8582878760405161161e93929190612f66565b60405180910390a2505050505050565b816116388161182f565b61164157600080fd5b61165083603c610398856120a8565b505050565b6060611662848484611ecf565b949350505050565b826116748161182f565b61167d57600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526007825280832087845282528083206001600160e01b031987168085529083529281902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b6000828152602081815260408083205467ffffffffffffffff168352600282528083208584528252808320848452909152902080546060919061176b90612cb2565b80601f016020809104026020016040519081016040528092919081815260200182805461179790612cb2565b80156117e45780601f106117b9576101008083540402835291602001916117e4565b820191906000526020600020905b8154815290600101906020018083116117c757829003601f168201915b5050505050905092915050565b60006001600160e01b031982167f59d1d43c0000000000000000000000000000000000000000000000000000000014806105a257506105a2826120e1565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806118905750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b1561189d57506001919050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa15801561191e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119429190612f96565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031603611a22576040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa1580156119fb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a1f9190612f96565b90505b6001600160a01b038116331480611a5c57506001600160a01b0381166000908152600b6020908152604080832033845290915290205460ff165b80610e4757506001600160a01b0381166000908152600c60209081526040808320868452825280832033845290915290205460ff16610e47565b611ae46040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c081018290526105a281611dbf565b602081015181516060916105a291611b0f908261211f565b84519190612179565b60a081015160c08201516060916105a291611b0f908290612c8f565b600081518351148015610e475750610e4783600084600087516121f0565b865160208801206000611b66878787612179565b90508315611c905767ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611bb190612cb2565b159050611c105767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611bf483612fb3565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091528120611c519161254d565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a604051611c83929190612fd1565b60405180910390a26107a6565b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611cd390612cb2565b9050600003611d345767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611d1883612ff7565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091529020611d768282612ea6565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a84604051611dab9392919061300e565b60405180910390a250505050505050505050565b60c08101516020820181905281515111611dd65750565b6000611dea8260000151836020015161211f565b8260200151611df9919061303d565b8251909150611e089082612213565b61ffff166040830152611e1c60028261303d565b8251909150611e2b9082612213565b61ffff166060830152611e3f60028261303d565b8251909150611e4e908261223b565b63ffffffff166080830152611e6460048261303d565b8251909150600090611e769083612213565b61ffff169050611e8760028361303d565b60a084018190529150611e9a818361303d565b60c0909301929092525050565b60008151601414611eb757600080fd5b50602001516c01000000000000000000000000900490565b60608167ffffffffffffffff811115611eea57611eea612845565b604051908082528060200260200182016040528015611f1d57816020015b6060815260200190600190039081611f085790505b50905060005b828110156120a0578415611fe8576000848483818110611f4557611f45612e55565b9050602002810190611f579190613050565b611f6691602491600491613097565b611f6f916130c1565b9050858114611fe65760405162461bcd60e51b815260206004820152603460248201527f6d756c746963616c6c3a20416c6c207265636f726473206d757374206861766560448201527f2061206d61746368696e67206e616d65686173680000000000000000000000006064820152608401611313565b505b60008030868685818110611ffe57611ffe612e55565b90506020028101906120109190613050565b60405161201e929190612ca2565b600060405180830381855af49150503d8060008114612059576040519150601f19603f3d011682016040523d82523d6000602084013e61205e565b606091505b50915091508161206d57600080fd5b8084848151811061208057612080612e55565b602002602001018190525050508080612098906130df565b915050611f23565b509392505050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60006001600160e01b031982167fc86902330000000000000000000000000000000000000000000000000000000014806105a257506105a282612265565b6000815b83518110612133576121336130f8565b600061213f85836122a3565b60ff16905061214f81600161303d565b612159908361303d565b915080600003612169575061216f565b50612123565b6116628382612c8f565b8251606090612188838561303d565b111561219357600080fd5b60008267ffffffffffffffff8111156121ae576121ae612845565b6040519080825280601f01601f1916602001820160405280156121d8576020820181803683370190505b50905060208082019086860101610b208282876122c7565b60006121fd84848461231d565b61220887878561231d565b149695505050505050565b815160009061222383600261303d565b111561222e57600080fd5b50016002015161ffff1690565b815160009061224b83600461303d565b111561225657600080fd5b50016004015163ffffffff1690565b60006001600160e01b031982167f691f34310000000000000000000000000000000000000000000000000000000014806105a257506105a282612341565b60008282815181106122b7576122b7612e55565b016020015160f81c905092915050565b602081106122ff57815183526122de60208461303d565b92506122eb60208361303d565b91506122f8602082612c8f565b90506122c7565b905182516020929092036101000a6000190180199091169116179052565b825160009061232c838561303d565b111561233757600080fd5b5091016020012090565b60006001600160e01b031982167f124a319c0000000000000000000000000000000000000000000000000000000014806105a257506105a28260006001600160e01b031982167fa8fa56820000000000000000000000000000000000000000000000000000000014806123dd57506001600160e01b031982167f5c98042b00000000000000000000000000000000000000000000000000000000145b806105a257506105a28260006001600160e01b031982167fbc1c58d10000000000000000000000000000000000000000000000000000000014806105a257506105a28260006001600160e01b031982167f3b3b57de00000000000000000000000000000000000000000000000000000000148061248357506001600160e01b031982167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b806105a257506105a28260006001600160e01b031982167f2203ab560000000000000000000000000000000000000000000000000000000014806105a257506105a28260006001600160e01b031982167fd700ff330000000000000000000000000000000000000000000000000000000014806105a257506105a28260006001600160e01b031982167f4fbf04330000000000000000000000000000000000000000000000000000000014806105a257506301ffc9a760e01b6001600160e01b03198316146105a2565b50805461255990612cb2565b6000825580601f10612569575050565b601f016020900490600052602060002090810190612587919061258a565b50565b5b8082111561259f576000815560010161258b565b5090565b80356001600160e01b0319811681146125bb57600080fd5b919050565b6000602082840312156125d257600080fd5b610e47826125a3565b60008083601f8401126125ed57600080fd5b50813567ffffffffffffffff81111561260557600080fd5b602083019150836020828501011115610c5b57600080fd5b60008060006040848603121561263257600080fd5b83359250602084013567ffffffffffffffff81111561265057600080fd5b61265c868287016125db565b9497909650939450505050565b60008060008060006060868803121561268157600080fd5b85359450602086013567ffffffffffffffff808211156126a057600080fd5b6126ac89838a016125db565b909650945060408801359150808211156126c557600080fd5b506126d2888289016125db565b969995985093965092949392505050565b600080604083850312156126f657600080fd5b82359150612706602084016125a3565b90509250929050565b6000806040838503121561272257600080fd5b50508035926020909101359150565b60005b8381101561274c578181015183820152602001612734565b50506000910152565b6000815180845261276d816020860160208601612731565b601f01601f19169290920160200192915050565b8281526040602082015260006116626040830184612755565b6000806000606084860312156127af57600080fd5b505081359360208301359350604090920135919050565b6000602082840312156127d857600080fd5b5035919050565b602081526000610e476020830184612755565b6000806000806060858703121561280857600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561282d57600080fd5b612839878288016125db565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261286c57600080fd5b813567ffffffffffffffff8082111561288757612887612845565b604051601f8301601f19908116603f011681019082821181831017156128af576128af612845565b816040528381528660208588010111156128c857600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000606084860312156128fd57600080fd5b8335925060208401359150604084013567ffffffffffffffff81111561292257600080fd5b61292e8682870161285b565b9150509250925092565b6000806040838503121561294b57600080fd5b823567ffffffffffffffff8082111561296357600080fd5b61296f8683870161285b565b9350602085013591508082111561298557600080fd5b506129928582860161285b565b9150509250929050565b6001600160a01b038116811461258757600080fd5b803580151581146125bb57600080fd5b600080604083850312156129d457600080fd5b82356129df8161299c565b9150612706602084016129b1565b600080600060608486031215612a0257600080fd5b833592506020840135612a148161299c565b9150612a22604085016129b1565b90509250925092565b600080600060608486031215612a4057600080fd5b8335925060208401359150604084013561ffff81168114612a6057600080fd5b809150509250925092565b600080600060608486031215612a8057600080fd5b8335612a8b8161299c565b9250602084013591506040840135612a608161299c565b60008083601f840112612ab457600080fd5b50813567ffffffffffffffff811115612acc57600080fd5b6020830191508360208260051b8501011115610c5b57600080fd5b60008060208385031215612afa57600080fd5b823567ffffffffffffffff811115612b1157600080fd5b612b1d85828601612aa2565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612b7e57603f19888603018452612b6c858351612755565b94509285019290850190600101612b50565b5092979650505050505050565b60008060408385031215612b9e57600080fd5b823591506020830135612bb08161299c565b809150509250929050565b600080600060408486031215612bd057600080fd5b83359250602084013567ffffffffffffffff811115612bee57600080fd5b61265c86828701612aa2565b600080600060608486031215612c0f57600080fd5b83359250612c1f602085016125a3565b91506040840135612a608161299c565b60008060408385031215612c4257600080fd5b8235612c4d8161299c565b91506020830135612bb08161299c565b60008251612c6f818460208701612731565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b818103818111156105a2576105a2612c79565b8183823760009101908152919050565b600181811c90821680612cc657607f821691505b602082108103612ce657634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561165057600081815260208120601f850160051c81016020861015612d135750805b601f850160051c820191505b81811015612d3257828155600101612d1f565b505050505050565b67ffffffffffffffff831115612d5257612d52612845565b612d6683612d608354612cb2565b83612cec565b6000601f841160018114612d9a5760008515612d825750838201355b600019600387901b1c1916600186901b178355611219565b600083815260209020601f19861690835b82811015612dcb5786850135825560209485019460019092019101612dab565b5086821015612de85760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b604081526000612e37604083018688612dfa565b8281036020840152612e4a818587612dfa565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b602081526000611662602083018486612dfa565b600067ffffffffffffffff808316818103612e9c57612e9c612c79565b6001019392505050565b815167ffffffffffffffff811115612ec057612ec0612845565b612ed481612ece8454612cb2565b84612cec565b602080601f831160018114612f095760008415612ef15750858301515b600019600386901b1c1916600185901b178555612d32565b600085815260208120601f198616915b82811015612f3857888601518255948401946001909101908401612f19565b5085821015612f565787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000612f796040830186612755565b8281036020840152612f8c818587612dfa565b9695505050505050565b600060208284031215612fa857600080fd5b8151610e478161299c565b600061ffff821680612fc757612fc7612c79565b6000190192915050565b604081526000612fe46040830185612755565b905061ffff831660208301529392505050565b600061ffff808316818103612e9c57612e9c612c79565b6060815260006130216060830186612755565b61ffff851660208401528281036040840152612f8c8185612755565b808201808211156105a2576105a2612c79565b6000808335601e1984360301811261306757600080fd5b83018035915067ffffffffffffffff82111561308257600080fd5b602001915036819003821315610c5b57600080fd5b600080858511156130a757600080fd5b838611156130b457600080fd5b5050820193919092039150565b803560208310156105a257600019602084900360031b1b1692915050565b6000600182016130f1576130f1612c79565b5060010190565b634e487b7160e01b600052600160045260246000fdfea264697066735822122084ef6dfab3b251ea09a156a3edbbfa4f7258662847b096ca16b021cc39199bc464736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80638b95dd711161010f578063c8690233116100a2578063e32954eb11610071578063e32954eb14610522578063e59d895d14610535578063e985e9c514610548578063f1cb7e061461058457600080fd5b8063c869023314610460578063ce3decdc146104b9578063d5fa2b00146104cc578063d700ff33146104df57600080fd5b8063a8fa5682116100de578063a8fa5682146103d6578063a9784b3e146103e9578063ac9650d81461042d578063bc1c58d11461044d57600080fd5b80638b95dd711461038a5780639061b9231461039d578063a22cb465146103b0578063a4b91a01146103c357600080fd5b80633603d758116101875780635c98042b116101565780635c98042b1461033e578063623195b014610351578063691f343114610364578063773722131461037757600080fd5b80633603d758146102ac5780633b3b57de146102bf5780634cbf6ba4146102d257806359d1d43c1461031e57600080fd5b8063124a319c116101c3578063124a319c1461023a5780632203ab561461026557806329cd62ea14610286578063304e6ade1461029957600080fd5b806301ffc9a7146101ea5780630af179d71461021257806310f13a8c14610227575b600080fd5b6101fd6101f83660046125c0565b610597565b60405190151581526020015b60405180910390f35b61022561022036600461261d565b6105a8565b005b610225610235366004612669565b6107b2565b61024d6102483660046126e3565b61087f565b6040516001600160a01b039091168152602001610209565b61027861027336600461270f565b610b2b565b604051610209929190612781565b61022561029436600461279a565b610c62565b6102256102a736600461261d565b610cfd565b6102256102ba3660046127c6565b610d79565b61024d6102cd3660046127c6565b610e1c565b6101fd6102e036600461270f565b6000828152602081815260408083205467ffffffffffffffff1683526006825280832094835293815283822092825291909152205461ffff16151590565b61033161032c36600461261d565b610e4e565b60405161020991906127df565b61033161034c3660046127c6565b610f2e565b61022561035f3660046127f2565b610fed565b6103316103723660046127c6565b61108a565b61022561038536600461261d565b6110c4565b6102256103983660046128e8565b611140565b6103316103ab366004612938565b611220565b6102256103be3660046129c1565b611299565b6102256103d13660046129ed565b611388565b6103316103e4366004612a2b565b611455565b6101fd6103f7366004612a6b565b6001600160a01b039283166000908152600c60209081526040808320948352938152838220929094168152925290205460ff1690565b61044061043b366004612ae7565b6114a3565b6040516102099190612b29565b61033161045b3660046127c6565b6114b1565b6104a461046e3660046127c6565b6000818152602081815260408083205467ffffffffffffffff168352600982528083209383529290522080546001909101549091565b60408051928352602083019190915201610209565b6102256104c736600461261d565b6114eb565b6102256104da366004612b8b565b61162e565b6105096104ed3660046127c6565b60006020819052908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610209565b610440610530366004612bbb565b611655565b610225610543366004612bfa565b61166a565b6101fd610556366004612c2f565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b61033161059236600461270f565b611729565b60006105a2826117f1565b92915050565b826105b28161182f565b6105bb57600080fd5b600084815260208181526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff9091169183916106219183918d908d90819084018382808284376000920191909152509293925050611a969050565b90505b8051516020820151101561074b578661ffff16600003610689578060400151965061064e81611af7565b9450846040516020016106619190612c5d565b60405160208183030381529060405280519060200120925061068281611b18565b935061073d565b600061069482611af7565b9050816040015161ffff168861ffff161415806106b857506106b68682611b34565b155b1561073b576107148c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d915061070b908290612c8f565b8b51158a611b52565b81604001519750816020015196508095508580519060200120935061073882611b18565b94505b505b61074681611dbf565b610624565b508351156107a6576107a68a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c925061079d91508290508f612c8f565b89511588611b52565b50505050505050505050565b846107bc8161182f565b6107c557600080fd5b6000868152602081815260408083205467ffffffffffffffff168352600a8252808320898452909152908190209051849184916108059089908990612ca2565b90815260200160405180910390209182610820929190612d3a565b508484604051610831929190612ca2565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a18787878760405161086f9493929190612e23565b60405180910390a3505050505050565b6000828152602081815260408083205467ffffffffffffffff1683526007825280832085845282528083206001600160e01b0319851684529091528120546001600160a01b031680156108d35790506105a2565b60006108de85610e1c565b90506001600160a01b0381166108f9576000925050506105a2565b6040516301ffc9a760e01b602482015260009081906001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516109669190612c5d565b600060405180830381855afa9150503d80600081146109a1576040519150601f19603f3d011682016040523d82523d6000602084013e6109a6565b606091505b50915091508115806109b9575060208151105b806109fb575080601f815181106109d2576109d2612e55565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610a0d5760009450505050506105a2565b6040516001600160e01b0319871660248201526001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b17905251610a789190612c5d565b600060405180830381855afa9150503d8060008114610ab3576040519150601f19603f3d011682016040523d82523d6000602084013e610ab8565b606091505b509092509050811580610acc575060208151105b80610b0e575080601f81518110610ae557610ae5612e55565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610b205760009450505050506105a2565b509095945050505050565b6000828152602081815260408083205467ffffffffffffffff168352600180835281842086855290925282206060915b848111610c425780851615801590610b8b575060008181526020839052604081208054610b8790612cb2565b9050115b15610c3a5780826000838152602001908152602001600020808054610baf90612cb2565b80601f0160208091040260200160405190810160405280929190818152602001828054610bdb90612cb2565b8015610c285780601f10610bfd57610100808354040283529160200191610c28565b820191906000526020600020905b815481529060010190602001808311610c0b57829003601f168201915b50505050509050935093505050610c5b565b60011b610b5b565b5060006040518060200160405280600081525092509250505b9250929050565b82610c6c8161182f565b610c7557600080fd5b604080518082018252848152602080820185815260008881528083528481205467ffffffffffffffff1681526009835284812089825283528490209251835551600190920191909155815185815290810184905285917f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4691015b60405180910390a250505050565b82610d078161182f565b610d1057600080fd5b6000848152602081815260408083205467ffffffffffffffff168352600382528083208784529091529020610d46838583612d3a565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610cef929190612e6b565b80610d838161182f565b610d8c57600080fd5b6000828152602081905260408120805467ffffffffffffffff1691610db083612e7f565b82546101009290920a67ffffffffffffffff818102199093169183160217909155600084815260208181526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610e2a83603c611729565b90508051600003610e3e5750600092915050565b610e4781611ea7565b9392505050565b6000838152602081815260408083205467ffffffffffffffff168352600a825280832086845290915290819020905160609190610e8e9085908590612ca2565b90815260200160405180910390208054610ea790612cb2565b80601f0160208091040260200160405190810160405280929190818152602001828054610ed390612cb2565b8015610f205780601f10610ef557610100808354040283529160200191610f20565b820191906000526020600020905b815481529060010190602001808311610f0357829003601f168201915b505050505090509392505050565b6000818152602081815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610f6890612cb2565b80601f0160208091040260200160405190810160405280929190818152602001828054610f9490612cb2565b8015610fe15780601f10610fb657610100808354040283529160200191610fe1565b820191906000526020600020905b815481529060010190602001808311610fc457829003601f168201915b50505050509050919050565b83610ff78161182f565b61100057600080fd5b8361100c600182612c8f565b161561101757600080fd5b6000858152602081815260408083205467ffffffffffffffff1683526001825280832088845282528083208784529091529020611055838583612d3a565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b6000818152602081815260408083205467ffffffffffffffff168352600882528083208484529091529020805460609190610f6890612cb2565b826110ce8161182f565b6110d757600080fd5b6000848152602081815260408083205467ffffffffffffffff16835260088252808320878452909152902061110d838583612d3a565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610cef929190612e6b565b8261114a8161182f565b61115357600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af7528484604051611185929190612781565b60405180910390a2603c83036111dc57837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd26111c084611ea7565b6040516001600160a01b03909116815260200160405180910390a25b6000848152602081815260408083205467ffffffffffffffff16835260028252808320878452825280832086845290915290206112198382612ea6565b5050505050565b6060600080306001600160a01b03168460405161123d9190612c5d565b600060405180830381855afa9150503d8060008114611278576040519150601f19603f3d011682016040523d82523d6000602084013e61127d565b606091505b509150915081156112915791506105a29050565b805160208201fd5b6001600160a01b038216330361131c5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336000818152600b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6001600160a01b03821633036113e05760405162461bcd60e51b815260206004820181905260248201527f53657474696e672064656c65676174652073746174757320666f722073656c666044820152606401611313565b336000818152600c6020908152604080832087845282528083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519384529286917ff0ddb3b04746704017f9aa8bd728fcc2c1d11675041205350018915f5e4750a0910160405180910390a4505050565b6000838152602081815260408083205467ffffffffffffffff168352600582528083208684528252808320858452825280832061ffff851684529091529020805460609190610ea790612cb2565b6060610e4760008484611ecf565b6000818152602081815260408083205467ffffffffffffffff168352600382528083208484529091529020805460609190610f6890612cb2565b826114f58161182f565b6114fe57600080fd5b6000848152602081815260408083205467ffffffffffffffff16808452600483528184208885529092528220805491929161153890612cb2565b80601f016020809104026020016040519081016040528092919081815260200182805461156490612cb2565b80156115b15780601f10611586576101008083540402835291602001916115b1565b820191906000526020600020905b81548152906001019060200180831161159457829003601f168201915b5050505067ffffffffffffffff841660009081526004602090815260408083208b845290915290209192506115e99050858783612d3a565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f8582878760405161161e93929190612f66565b60405180910390a2505050505050565b816116388161182f565b61164157600080fd5b61165083603c610398856120a8565b505050565b6060611662848484611ecf565b949350505050565b826116748161182f565b61167d57600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526007825280832087845282528083206001600160e01b031987168085529083529281902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b6000828152602081815260408083205467ffffffffffffffff168352600282528083208584528252808320848452909152902080546060919061176b90612cb2565b80601f016020809104026020016040519081016040528092919081815260200182805461179790612cb2565b80156117e45780601f106117b9576101008083540402835291602001916117e4565b820191906000526020600020905b8154815290600101906020018083116117c757829003601f168201915b5050505050905092915050565b60006001600160e01b031982167f59d1d43c0000000000000000000000000000000000000000000000000000000014806105a257506105a2826120e1565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806118905750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b1561189d57506001919050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa15801561191e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119429190612f96565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031603611a22576040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa1580156119fb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a1f9190612f96565b90505b6001600160a01b038116331480611a5c57506001600160a01b0381166000908152600b6020908152604080832033845290915290205460ff165b80610e4757506001600160a01b0381166000908152600c60209081526040808320868452825280832033845290915290205460ff16610e47565b611ae46040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c081018290526105a281611dbf565b602081015181516060916105a291611b0f908261211f565b84519190612179565b60a081015160c08201516060916105a291611b0f908290612c8f565b600081518351148015610e475750610e4783600084600087516121f0565b865160208801206000611b66878787612179565b90508315611c905767ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611bb190612cb2565b159050611c105767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611bf483612fb3565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091528120611c519161254d565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a604051611c83929190612fd1565b60405180910390a26107a6565b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611cd390612cb2565b9050600003611d345767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611d1883612ff7565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091529020611d768282612ea6565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a84604051611dab9392919061300e565b60405180910390a250505050505050505050565b60c08101516020820181905281515111611dd65750565b6000611dea8260000151836020015161211f565b8260200151611df9919061303d565b8251909150611e089082612213565b61ffff166040830152611e1c60028261303d565b8251909150611e2b9082612213565b61ffff166060830152611e3f60028261303d565b8251909150611e4e908261223b565b63ffffffff166080830152611e6460048261303d565b8251909150600090611e769083612213565b61ffff169050611e8760028361303d565b60a084018190529150611e9a818361303d565b60c0909301929092525050565b60008151601414611eb757600080fd5b50602001516c01000000000000000000000000900490565b60608167ffffffffffffffff811115611eea57611eea612845565b604051908082528060200260200182016040528015611f1d57816020015b6060815260200190600190039081611f085790505b50905060005b828110156120a0578415611fe8576000848483818110611f4557611f45612e55565b9050602002810190611f579190613050565b611f6691602491600491613097565b611f6f916130c1565b9050858114611fe65760405162461bcd60e51b815260206004820152603460248201527f6d756c746963616c6c3a20416c6c207265636f726473206d757374206861766560448201527f2061206d61746368696e67206e616d65686173680000000000000000000000006064820152608401611313565b505b60008030868685818110611ffe57611ffe612e55565b90506020028101906120109190613050565b60405161201e929190612ca2565b600060405180830381855af49150503d8060008114612059576040519150601f19603f3d011682016040523d82523d6000602084013e61205e565b606091505b50915091508161206d57600080fd5b8084848151811061208057612080612e55565b602002602001018190525050508080612098906130df565b915050611f23565b509392505050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60006001600160e01b031982167fc86902330000000000000000000000000000000000000000000000000000000014806105a257506105a282612265565b6000815b83518110612133576121336130f8565b600061213f85836122a3565b60ff16905061214f81600161303d565b612159908361303d565b915080600003612169575061216f565b50612123565b6116628382612c8f565b8251606090612188838561303d565b111561219357600080fd5b60008267ffffffffffffffff8111156121ae576121ae612845565b6040519080825280601f01601f1916602001820160405280156121d8576020820181803683370190505b50905060208082019086860101610b208282876122c7565b60006121fd84848461231d565b61220887878561231d565b149695505050505050565b815160009061222383600261303d565b111561222e57600080fd5b50016002015161ffff1690565b815160009061224b83600461303d565b111561225657600080fd5b50016004015163ffffffff1690565b60006001600160e01b031982167f691f34310000000000000000000000000000000000000000000000000000000014806105a257506105a282612341565b60008282815181106122b7576122b7612e55565b016020015160f81c905092915050565b602081106122ff57815183526122de60208461303d565b92506122eb60208361303d565b91506122f8602082612c8f565b90506122c7565b905182516020929092036101000a6000190180199091169116179052565b825160009061232c838561303d565b111561233757600080fd5b5091016020012090565b60006001600160e01b031982167f124a319c0000000000000000000000000000000000000000000000000000000014806105a257506105a28260006001600160e01b031982167fa8fa56820000000000000000000000000000000000000000000000000000000014806123dd57506001600160e01b031982167f5c98042b00000000000000000000000000000000000000000000000000000000145b806105a257506105a28260006001600160e01b031982167fbc1c58d10000000000000000000000000000000000000000000000000000000014806105a257506105a28260006001600160e01b031982167f3b3b57de00000000000000000000000000000000000000000000000000000000148061248357506001600160e01b031982167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b806105a257506105a28260006001600160e01b031982167f2203ab560000000000000000000000000000000000000000000000000000000014806105a257506105a28260006001600160e01b031982167fd700ff330000000000000000000000000000000000000000000000000000000014806105a257506105a28260006001600160e01b031982167f4fbf04330000000000000000000000000000000000000000000000000000000014806105a257506301ffc9a760e01b6001600160e01b03198316146105a2565b50805461255990612cb2565b6000825580601f10612569575050565b601f016020900490600052602060002090810190612587919061258a565b50565b5b8082111561259f576000815560010161258b565b5090565b80356001600160e01b0319811681146125bb57600080fd5b919050565b6000602082840312156125d257600080fd5b610e47826125a3565b60008083601f8401126125ed57600080fd5b50813567ffffffffffffffff81111561260557600080fd5b602083019150836020828501011115610c5b57600080fd5b60008060006040848603121561263257600080fd5b83359250602084013567ffffffffffffffff81111561265057600080fd5b61265c868287016125db565b9497909650939450505050565b60008060008060006060868803121561268157600080fd5b85359450602086013567ffffffffffffffff808211156126a057600080fd5b6126ac89838a016125db565b909650945060408801359150808211156126c557600080fd5b506126d2888289016125db565b969995985093965092949392505050565b600080604083850312156126f657600080fd5b82359150612706602084016125a3565b90509250929050565b6000806040838503121561272257600080fd5b50508035926020909101359150565b60005b8381101561274c578181015183820152602001612734565b50506000910152565b6000815180845261276d816020860160208601612731565b601f01601f19169290920160200192915050565b8281526040602082015260006116626040830184612755565b6000806000606084860312156127af57600080fd5b505081359360208301359350604090920135919050565b6000602082840312156127d857600080fd5b5035919050565b602081526000610e476020830184612755565b6000806000806060858703121561280857600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561282d57600080fd5b612839878288016125db565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261286c57600080fd5b813567ffffffffffffffff8082111561288757612887612845565b604051601f8301601f19908116603f011681019082821181831017156128af576128af612845565b816040528381528660208588010111156128c857600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000606084860312156128fd57600080fd5b8335925060208401359150604084013567ffffffffffffffff81111561292257600080fd5b61292e8682870161285b565b9150509250925092565b6000806040838503121561294b57600080fd5b823567ffffffffffffffff8082111561296357600080fd5b61296f8683870161285b565b9350602085013591508082111561298557600080fd5b506129928582860161285b565b9150509250929050565b6001600160a01b038116811461258757600080fd5b803580151581146125bb57600080fd5b600080604083850312156129d457600080fd5b82356129df8161299c565b9150612706602084016129b1565b600080600060608486031215612a0257600080fd5b833592506020840135612a148161299c565b9150612a22604085016129b1565b90509250925092565b600080600060608486031215612a4057600080fd5b8335925060208401359150604084013561ffff81168114612a6057600080fd5b809150509250925092565b600080600060608486031215612a8057600080fd5b8335612a8b8161299c565b9250602084013591506040840135612a608161299c565b60008083601f840112612ab457600080fd5b50813567ffffffffffffffff811115612acc57600080fd5b6020830191508360208260051b8501011115610c5b57600080fd5b60008060208385031215612afa57600080fd5b823567ffffffffffffffff811115612b1157600080fd5b612b1d85828601612aa2565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612b7e57603f19888603018452612b6c858351612755565b94509285019290850190600101612b50565b5092979650505050505050565b60008060408385031215612b9e57600080fd5b823591506020830135612bb08161299c565b809150509250929050565b600080600060408486031215612bd057600080fd5b83359250602084013567ffffffffffffffff811115612bee57600080fd5b61265c86828701612aa2565b600080600060608486031215612c0f57600080fd5b83359250612c1f602085016125a3565b91506040840135612a608161299c565b60008060408385031215612c4257600080fd5b8235612c4d8161299c565b91506020830135612bb08161299c565b60008251612c6f818460208701612731565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b818103818111156105a2576105a2612c79565b8183823760009101908152919050565b600181811c90821680612cc657607f821691505b602082108103612ce657634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561165057600081815260208120601f850160051c81016020861015612d135750805b601f850160051c820191505b81811015612d3257828155600101612d1f565b505050505050565b67ffffffffffffffff831115612d5257612d52612845565b612d6683612d608354612cb2565b83612cec565b6000601f841160018114612d9a5760008515612d825750838201355b600019600387901b1c1916600186901b178355611219565b600083815260209020601f19861690835b82811015612dcb5786850135825560209485019460019092019101612dab565b5086821015612de85760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b604081526000612e37604083018688612dfa565b8281036020840152612e4a818587612dfa565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b602081526000611662602083018486612dfa565b600067ffffffffffffffff808316818103612e9c57612e9c612c79565b6001019392505050565b815167ffffffffffffffff811115612ec057612ec0612845565b612ed481612ece8454612cb2565b84612cec565b602080601f831160018114612f095760008415612ef15750858301515b600019600386901b1c1916600185901b178555612d32565b600085815260208120601f198616915b82811015612f3857888601518255948401946001909101908401612f19565b5085821015612f565787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000612f796040830186612755565b8281036020840152612f8c818587612dfa565b9695505050505050565b600060208284031215612fa857600080fd5b8151610e478161299c565b600061ffff821680612fc757612fc7612c79565b6000190192915050565b604081526000612fe46040830185612755565b905061ffff831660208301529392505050565b600061ffff808316818103612e9c57612e9c612c79565b6060815260006130216060830186612755565b61ffff851660208401528281036040840152612f8c8185612755565b808201808211156105a2576105a2612c79565b6000808335601e1984360301811261306757600080fd5b83018035915067ffffffffffffffff82111561308257600080fd5b602001915036819003821315610c5b57600080fd5b600080858511156130a757600080fd5b838611156130b457600080fd5b5050820193919092039150565b803560208310156105a257600019602084900360031b1b1692915050565b6000600182016130f1576130f1612c79565b5060010190565b634e487b7160e01b600052600160045260246000fdfea264697066735822122084ef6dfab3b251ea09a156a3edbbfa4f7258662847b096ca16b021cc39199bc464736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "ABI(bytes32,uint256)": { + "params": { + "contentTypes": "A bitwise OR of the ABI formats accepted by the caller.", + "node": "The ENS node to query" + }, + "returns": { + "_0": "contentType The content type of the return value", + "_1": "data The ABI data" + } + }, + "addr(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated address." + } + }, + "approve(bytes32,address,bool)": { + "details": "Approve a delegate to be able to updated records on a node." + }, + "clearRecords(bytes32)": { + "params": { + "node": "The node to update." + } + }, + "contenthash(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated contenthash." + } + }, + "dnsRecord(bytes32,bytes32,uint16)": { + "params": { + "name": "the keccak-256 hash of the fully-qualified name for which to fetch the record", + "node": "the namehash of the node for which to fetch the record", + "resource": "the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types" + }, + "returns": { + "_0": "the DNS record in wire format if present, otherwise empty" + } + }, + "hasDNSRecords(bytes32,bytes32)": { + "params": { + "name": "the namehash of the node for which to check the records", + "node": "the namehash of the node for which to check the records" + } + }, + "interfaceImplementer(bytes32,bytes4)": { + "params": { + "interfaceID": "The EIP 165 interface ID to check for.", + "node": "The ENS node to query." + }, + "returns": { + "_0": "The address that implements this interface, or 0 if the interface is unsupported." + } + }, + "isApprovedFor(address,bytes32,address)": { + "details": "Check to see if the delegate has been approved by the owner for the node." + }, + "isApprovedForAll(address,address)": { + "details": "See {IERC1155-isApprovedForAll}." + }, + "name(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated name." + } + }, + "pubkey(bytes32)": { + "params": { + "node": "The ENS node to query" + }, + "returns": { + "x": "The X coordinate of the curve point for the public key.", + "y": "The Y coordinate of the curve point for the public key." + } + }, + "setABI(bytes32,uint256,bytes)": { + "params": { + "contentType": "The content type of the ABI", + "data": "The ABI data.", + "node": "The node to update." + } + }, + "setAddr(bytes32,address)": { + "params": { + "a": "The address to set.", + "node": "The node to update." + } + }, + "setApprovalForAll(address,bool)": { + "details": "See {IERC1155-setApprovalForAll}." + }, + "setContenthash(bytes32,bytes)": { + "params": { + "hash": "The contenthash to set", + "node": "The node to update." + } + }, + "setDNSRecords(bytes32,bytes)": { + "params": { + "data": "the DNS wire format records to set", + "node": "the namehash of the node for which to set the records" + } + }, + "setInterface(bytes32,bytes4,address)": { + "params": { + "implementer": "The address of a contract that implements this interface for this node.", + "interfaceID": "The EIP 165 interface ID.", + "node": "The node to update." + } + }, + "setName(bytes32,string)": { + "params": { + "node": "The node to update." + } + }, + "setPubkey(bytes32,bytes32,bytes32)": { + "params": { + "node": "The ENS node to query", + "x": "the X coordinate of the curve point for the public key.", + "y": "the Y coordinate of the curve point for the public key." + } + }, + "setText(bytes32,string,string)": { + "params": { + "key": "The key to set.", + "node": "The node to update.", + "value": "The text data value to set." + } + }, + "setZonehash(bytes32,bytes)": { + "params": { + "hash": "The zonehash to set", + "node": "The node to update." + } + }, + "text(bytes32,string)": { + "params": { + "key": "The text data key to query.", + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated text data." + } + }, + "zonehash(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated contenthash." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "ABI(bytes32,uint256)": { + "notice": "Returns the ABI associated with an ENS node. Defined in EIP205." + }, + "addr(bytes32)": { + "notice": "Returns the address associated with an ENS node." + }, + "clearRecords(bytes32)": { + "notice": "Increments the record version associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "contenthash(bytes32)": { + "notice": "Returns the contenthash associated with an ENS node." + }, + "dnsRecord(bytes32,bytes32,uint16)": { + "notice": "Obtain a DNS record." + }, + "hasDNSRecords(bytes32,bytes32)": { + "notice": "Check if a given node has records." + }, + "interfaceImplementer(bytes32,bytes4)": { + "notice": "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." + }, + "name(bytes32)": { + "notice": "Returns the name associated with an ENS node, for reverse records. Defined in EIP181." + }, + "pubkey(bytes32)": { + "notice": "Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619." + }, + "setABI(bytes32,uint256,bytes)": { + "notice": "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." + }, + "setAddr(bytes32,address)": { + "notice": "Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "setContenthash(bytes32,bytes)": { + "notice": "Sets the contenthash associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "setDNSRecords(bytes32,bytes)": { + "notice": "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." + }, + "setInterface(bytes32,bytes4,address)": { + "notice": "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." + }, + "setName(bytes32,string)": { + "notice": "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." + }, + "setPubkey(bytes32,bytes32,bytes32)": { + "notice": "Sets the SECP256k1 public key associated with an ENS node." + }, + "setText(bytes32,string,string)": { + "notice": "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." + }, + "setZonehash(bytes32,bytes)": { + "notice": "setZonehash sets the hash for the zone. May only be called by the owner of that node in the ENS registry." + }, + "text(bytes32,string)": { + "notice": "Returns the text data associated with an ENS node and key." + }, + "zonehash(bytes32)": { + "notice": "zonehash obtains the hash for the zone." + } + }, + "notice": "A simple resolver anyone can use; only allows the owner of a node to set its address.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 11262, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "recordVersions", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_bytes32,t_uint64)" + }, + { + "astId": 11341, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_abis", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))" + }, + { + "astId": 11495, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_addresses", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))" + }, + { + "astId": 11686, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_hashes", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))" + }, + { + "astId": 11776, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_zonehashes", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))" + }, + { + "astId": 11786, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_records", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))))" + }, + { + "astId": 11794, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_nameEntriesCount", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16)))" + }, + { + "astId": 12532, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_interfaces", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes4,t_address)))" + }, + { + "astId": 12724, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_names", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_string_storage))" + }, + { + "astId": 12811, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_pubkeys", + "offset": 0, + "slot": "9", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_struct(PublicKey)12804_storage))" + }, + { + "astId": 12914, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_texts", + "offset": 0, + "slot": "10", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage)))" + }, + { + "astId": 10828, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "_operatorApprovals", + "offset": 0, + "slot": "11", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" + }, + { + "astId": 10837, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "_tokenApprovals", + "offset": 0, + "slot": "12", + "type": "t_mapping(t_address,t_mapping(t_bytes32,t_mapping(t_address,t_bool)))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes4": { + "encoding": "inplace", + "label": "bytes4", + "numberOfBytes": "4" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_address,t_mapping(t_bytes32,t_mapping(t_address,t_bool)))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(bytes32 => mapping(address => bool)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_address,t_bool))" + }, + "t_mapping(t_bytes32,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_bytes32,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage)))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes32 => uint16))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_uint16)" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes4,t_address))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes4 => address))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes4,t_address)" + }, + "t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(string => string))", + "numberOfBytes": "32", + "value": "t_mapping(t_string_memory_ptr,t_string_storage)" + }, + "t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint16 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint16,t_bytes_storage)" + }, + "t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint256 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_bytes_storage)" + }, + "t_mapping(t_bytes32,t_string_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_bytes32,t_struct(PublicKey)12804_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct PubkeyResolver.PublicKey)", + "numberOfBytes": "32", + "value": "t_struct(PublicKey)12804_storage" + }, + "t_mapping(t_bytes32,t_uint16)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint16)", + "numberOfBytes": "32", + "value": "t_uint16" + }, + "t_mapping(t_bytes32,t_uint64)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint64)", + "numberOfBytes": "32", + "value": "t_uint64" + }, + "t_mapping(t_bytes4,t_address)": { + "encoding": "mapping", + "key": "t_bytes4", + "label": "mapping(bytes4 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_string_memory_ptr,t_string_storage)": { + "encoding": "mapping", + "key": "t_string_memory_ptr", + "label": "mapping(string => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_uint16,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint256,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_bytes_storage)" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage)))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes4,t_address)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes4,t_address))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(string => string)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_string_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => string))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_string_storage)" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_struct(PublicKey)12804_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => struct PubkeyResolver.PublicKey))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_struct(PublicKey)12804_storage)" + }, + "t_string_memory_ptr": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(PublicKey)12804_storage": { + "encoding": "inplace", + "label": "struct PubkeyResolver.PublicKey", + "members": [ + { + "astId": 12801, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "x", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 12803, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "y", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint16": { + "encoding": "inplace", + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint64": { + "encoding": "inplace", + "label": "uint64", + "numberOfBytes": "8" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/RSASHA1Algorithm.json b/solidity/dns-contracts/deployments/goerli/RSASHA1Algorithm.json new file mode 100644 index 0000000..ddf39e7 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/RSASHA1Algorithm.json @@ -0,0 +1,71 @@ +{ + "address": "0xD0ADDcc2C6d49c04296A331bf2A07E269f88A287", + "transactionHash": "0x6c2a5374fe0c8937e33dcd5d8f849a896be171f43b41426317865691471575f5", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "key", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x6c2a5374fe0c8937e33dcd5d8f849a896be171f43b41426317865691471575f5", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0xD0ADDcc2C6d49c04296A331bf2A07E269f88A287", + "transactionIndex": 2, + "gasUsed": "803850", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xd48a9db2d8f755de1d5ce4a92a97e54563fcbfaff260b704c2299c254c8fd27e", + "transactionHash": "0x6c2a5374fe0c8937e33dcd5d8f849a896be171f43b41426317865691471575f5", + "logs": [], + "blockNumber": 6469094, + "cumulativeGasUsed": "1214094", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "7948b60c3b601df824761a337a51d661", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC RSASHA1 algorithm.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol\":\"RSASHA1Algorithm\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@ensdomains/solsha1/contracts/SHA1.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary SHA1 {\\n event Debug(bytes32 x);\\n\\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\\n assembly {\\n // Get a safe scratch location\\n let scratch := mload(0x40)\\n\\n // Get the data length, and point data at the first byte\\n let len := mload(data)\\n data := add(data, 32)\\n\\n // Find the length after padding\\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\\n switch lt(sub(totallen, len), 9)\\n case 1 { totallen := add(totallen, 64) }\\n\\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\\n\\n function readword(ptr, off, count) -> result {\\n result := 0\\n if lt(off, count) {\\n result := mload(add(ptr, off))\\n count := sub(count, off)\\n if lt(count, 32) {\\n let mask := not(sub(exp(256, sub(32, count)), 1))\\n result := and(result, mask)\\n }\\n }\\n }\\n\\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\\n mstore(scratch, readword(data, i, len))\\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\\n\\n // If we loaded the last byte, store the terminator byte\\n switch lt(sub(len, i), 64)\\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\\n\\n // If this is the last block, store the length\\n switch eq(i, sub(totallen, 64))\\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\\n\\n // Expand the 16 32-bit words into 80\\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\\n mstore(add(scratch, j), temp)\\n }\\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\\n mstore(add(scratch, j), temp)\\n }\\n\\n let x := h\\n let f := 0\\n let k := 0\\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\\n switch div(j, 20)\\n case 0 {\\n // f = d xor (b and (c xor d))\\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\\n f := and(div(x, 0x1000000000000000000000000000000), f)\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x5A827999\\n }\\n case 1{\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x6ED9EBA1\\n }\\n case 2 {\\n // f = (b and c) or (d and (b or c))\\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := and(div(x, 0x10000000000), f)\\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\\n k := 0x8F1BBCDC\\n }\\n case 3 {\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0xCA62C1D6\\n }\\n // temp = (a leftrotate 5) + f + e + k + w[i]\\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\\n temp := add(f, temp)\\n temp := add(and(x, 0xFFFFFFFF), temp)\\n temp := add(k, temp)\\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\\n }\\n\\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\\n }\\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x746d9b85de197afbc13182cbe4ba4f7917f19594e07c655d6a0c85fdf7460a8a\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\\n uint shortest = len;\\n if (otherlen < len)\\n shortest = otherlen;\\n\\n uint selfptr;\\n uint otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint idx = 0; idx < shortest; idx += 32) {\\n uint a;\\n uint b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint mask;\\n if (shortest > 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\\n }\\n int diff = int(a & mask) - int(b & mask);\\n if (diff != 0)\\n return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int(len) - int(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\\n return self.length == other.length && equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint dest, uint src, uint len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint dest;\\n uint src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\\n require(len <= 52);\\n\\n uint ret = 0;\\n uint8 decoded;\\n for(uint i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if(i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint bitlen = len * 5;\\n if(len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if(len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if(len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if(len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if(len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n}\",\"keccak256\":\"0x83315df2e54c74451577c70da2c267c3459802b08b9aeec6516302eee70f796e\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n*/\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external virtual view returns (bool);\\n}\\n\",\"keccak256\":\"0x51d6251568844e435f58952354abe8c8c8e978ab40ecb0bbb2f5bd767838b3a7\"},\"contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary ModexpPrecompile {\\n /**\\n * @dev Computes (base ^ exponent) % modulus over big numbers.\\n */\\n function modexp(bytes memory base, bytes memory exponent, bytes memory modulus) internal view returns (bool success, bytes memory output) {\\n bytes memory input = abi.encodePacked(\\n uint256(base.length),\\n uint256(exponent.length),\\n uint256(modulus.length),\\n base,\\n exponent,\\n modulus\\n );\\n\\n output = new bytes(modulus.length);\\n\\n assembly {\\n success := staticcall(gas(), 5, add(input, 32), mload(input), add(output, 32), mload(modulus))\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe3d689d14cf0294f433f4e14cdd8feab8d542e5b8342c911d5c7cb518170e2b1\"},\"contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./RSAVerify.sol\\\";\\nimport \\\"@ensdomains/solsha1/contracts/SHA1.sol\\\";\\n\\n/**\\n* @dev Implements the DNSSEC RSASHA1 algorithm.\\n*/\\ncontract RSASHA1Algorithm is Algorithm {\\n using BytesUtils for *;\\n\\n function verify(bytes calldata key, bytes calldata data, bytes calldata sig) external override view returns (bool) {\\n bytes memory exponent;\\n bytes memory modulus;\\n\\n uint16 exponentLen = uint16(key.readUint8(4));\\n if (exponentLen != 0) {\\n exponent = key.substring(5, exponentLen);\\n modulus = key.substring(exponentLen + 5, key.length - exponentLen - 5);\\n } else {\\n exponentLen = key.readUint16(5);\\n exponent = key.substring(7, exponentLen);\\n modulus = key.substring(exponentLen + 7, key.length - exponentLen - 7);\\n }\\n\\n // Recover the message from the signature\\n bool ok;\\n bytes memory result;\\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\\n\\n // Verify it ends with the hash of our data\\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\\n }\\n}\\n\",\"keccak256\":\"0x4d3b4b7873785b2d1806faa3fc31aca7b5897b1ae69b1224f6a12d06e295939e\"},\"contracts/dnssec-oracle/algorithms/RSAVerify.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./ModexpPrecompile.sol\\\";\\n\\nlibrary RSAVerify {\\n /**\\n * @dev Recovers the input data from an RSA signature, returning the result in S.\\n * @param N The RSA public modulus.\\n * @param E The RSA public exponent.\\n * @param S The signature to recover.\\n * @return True if the recovery succeeded.\\n */\\n function rsarecover(bytes memory N, bytes memory E, bytes memory S) internal view returns (bool, bytes memory) {\\n return ModexpPrecompile.modexp(S, E, N);\\n }\\n}\\n\",\"keccak256\":\"0xc630e4d296e2d7bd2b968f8a9a8df629fef5161e10ffae9973e045900741cfe4\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610dae806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e366004610be9565b610057565b604051901515815260200160405180910390f35b600060608060006100a260048b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506103139050565b60ff169050801561016e576100f760058261ffff168c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061035e9050565b9250610167610107826005610cf4565b61ffff9081169060059061011d9085168d610d32565b6101279190610d32565b8c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061035e9050565b9150610227565b6101b260058b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506104099050565b90506101fe60078261ffff168c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061035e9050565b925061022461020e826007610cf4565b61ffff9081169060079061011d9085168d610d32565b91505b6000606061026c84868a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061043192505050565b909250905081801561030357506102916014825161028a9190610d32565b829061044c565b6bffffffffffffffffffffffff19166102df8b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061049292505050565b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016145b9c9b505050505050505050505050565b600082828151811061034e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b016020015160f81c905092915050565b825160609061036d8385610d1a565b111561037857600080fd5b60008267ffffffffffffffff8111156103ba577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156103e4576020820181803683370190505b509050602080820190868601016103fc828287610a70565b50909150505b9392505050565b8151600090610419836002610d1a565b111561042457600080fd5b50016002015161ffff1690565b60006060610440838587610ae4565b91509150935093915050565b815160009061045c836014610d1a565b111561046757600080fd5b5001602001517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001690565b60006040518251602084019350604067ffffffffffffffc0600183011601600982820310600181146104c3576104ca565b6040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f061053a565b60008383101561040257508082015192829003926020841015610402577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60208590036101000a0119169392505050565b60005b828110156109f0576105508482896104e9565b85526105608460208301896104e9565b60208601526040818503106001811461057857610581565b60808286038701535b5060408303811460018114610595576105a3565b602086018051600887021790525b5060405b60808110156106a3578581017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08101517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc88201517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08301517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff48401516002911891909218189081027ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe1663800000009091047c010000000100000001000000010000000100000001000000010000000116179052600c016105a7565b5060805b6101408110156107a4578581017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808101517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff908201517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08301517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe88401516004911891909218189081027ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc1663400000009091047c0300000003000000030000000300000003000000030000000300000003161790526018016106a7565b508160008060005b60508110156109c6576014810480156107dc576001811461081857600281146108525760038114610891576108c7565b6501000000000085046a0100000000000000000000860481186f01000000000000000000000000000000870416189350635a82799992506108c7565b6501000000000085046f0100000000000000000000000000000086046a0100000000000000000000870418189350636ed9eba192506108c7565b6a010000000000000000000085046f010000000000000000000000000000008604818117650100000000008804169116179350638f1bbcdc92506108c7565b6501000000000085046f0100000000000000000000000000000086046a010000000000000000000087041818935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c015104019050740100000000000000000000000000000000000000008102650100000000008604179450506a0100000000000000000000633fffffff6a040000000000000000000086041663c00000006604000000000000870416170277ffffffff00ffffffff000000000000ffffffff00ffffffff85161793506001810190506107ac565b5050509190910177ffffffff00ffffffff00ffffffff00ffffffff00ffffffff169060400161053d565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b60208110610aa85781518352610a87602084610d1a565b9250610a94602083610d1a565b9150610aa1602082610d32565b9050610a70565b905182516020929092036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199091169116179052565b600060606000855185518551888888604051602001610b0896959493929190610cb8565b6040516020818303038152906040529050835167ffffffffffffffff811115610b5a577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015610b84576020820181803683370190505b50915083516020830182516020840160055afa925050935093915050565b60008083601f840112610bb3578182fd5b50813567ffffffffffffffff811115610bca578182fd5b602083019150836020828501011115610be257600080fd5b9250929050565b60008060008060008060608789031215610c01578182fd5b863567ffffffffffffffff80821115610c18578384fd5b610c248a838b01610ba2565b90985096506020890135915080821115610c3c578384fd5b610c488a838b01610ba2565b90965094506040890135915080821115610c60578384fd5b50610c6d89828a01610ba2565b979a9699509497509295939492505050565b60008151815b81811015610c9f5760208185018101518683015201610c85565b81811115610cad5782828601525b509290920192915050565b8681528560208201528460408201526000610ce8610ce2610cdc6060850188610c7f565b86610c7f565b84610c7f565b98975050505050505050565b600061ffff808316818516808303821115610d1157610d11610d49565b01949350505050565b60008219821115610d2d57610d2d610d49565b500190565b600082821015610d4457610d44610d49565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220cc56d6044c6eb3e05aae27f5b06df65eab4d770573a834e90a1f050d59a467a864736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e366004610be9565b610057565b604051901515815260200160405180910390f35b600060608060006100a260048b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506103139050565b60ff169050801561016e576100f760058261ffff168c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061035e9050565b9250610167610107826005610cf4565b61ffff9081169060059061011d9085168d610d32565b6101279190610d32565b8c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061035e9050565b9150610227565b6101b260058b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506104099050565b90506101fe60078261ffff168c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061035e9050565b925061022461020e826007610cf4565b61ffff9081169060079061011d9085168d610d32565b91505b6000606061026c84868a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061043192505050565b909250905081801561030357506102916014825161028a9190610d32565b829061044c565b6bffffffffffffffffffffffff19166102df8b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061049292505050565b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016145b9c9b505050505050505050505050565b600082828151811061034e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b016020015160f81c905092915050565b825160609061036d8385610d1a565b111561037857600080fd5b60008267ffffffffffffffff8111156103ba577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156103e4576020820181803683370190505b509050602080820190868601016103fc828287610a70565b50909150505b9392505050565b8151600090610419836002610d1a565b111561042457600080fd5b50016002015161ffff1690565b60006060610440838587610ae4565b91509150935093915050565b815160009061045c836014610d1a565b111561046757600080fd5b5001602001517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001690565b60006040518251602084019350604067ffffffffffffffc0600183011601600982820310600181146104c3576104ca565b6040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f061053a565b60008383101561040257508082015192829003926020841015610402577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60208590036101000a0119169392505050565b60005b828110156109f0576105508482896104e9565b85526105608460208301896104e9565b60208601526040818503106001811461057857610581565b60808286038701535b5060408303811460018114610595576105a3565b602086018051600887021790525b5060405b60808110156106a3578581017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08101517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc88201517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08301517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff48401516002911891909218189081027ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe1663800000009091047c010000000100000001000000010000000100000001000000010000000116179052600c016105a7565b5060805b6101408110156107a4578581017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808101517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff908201517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08301517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe88401516004911891909218189081027ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc1663400000009091047c0300000003000000030000000300000003000000030000000300000003161790526018016106a7565b508160008060005b60508110156109c6576014810480156107dc576001811461081857600281146108525760038114610891576108c7565b6501000000000085046a0100000000000000000000860481186f01000000000000000000000000000000870416189350635a82799992506108c7565b6501000000000085046f0100000000000000000000000000000086046a0100000000000000000000870418189350636ed9eba192506108c7565b6a010000000000000000000085046f010000000000000000000000000000008604818117650100000000008804169116179350638f1bbcdc92506108c7565b6501000000000085046f0100000000000000000000000000000086046a010000000000000000000087041818935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c015104019050740100000000000000000000000000000000000000008102650100000000008604179450506a0100000000000000000000633fffffff6a040000000000000000000086041663c00000006604000000000000870416170277ffffffff00ffffffff000000000000ffffffff00ffffffff85161793506001810190506107ac565b5050509190910177ffffffff00ffffffff00ffffffff00ffffffff00ffffffff169060400161053d565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b60208110610aa85781518352610a87602084610d1a565b9250610a94602083610d1a565b9150610aa1602082610d32565b9050610a70565b905182516020929092036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199091169116179052565b600060606000855185518551888888604051602001610b0896959493929190610cb8565b6040516020818303038152906040529050835167ffffffffffffffff811115610b5a577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015610b84576020820181803683370190505b50915083516020830182516020840160055afa925050935093915050565b60008083601f840112610bb3578182fd5b50813567ffffffffffffffff811115610bca578182fd5b602083019150836020828501011115610be257600080fd5b9250929050565b60008060008060008060608789031215610c01578182fd5b863567ffffffffffffffff80821115610c18578384fd5b610c248a838b01610ba2565b90985096506020890135915080821115610c3c578384fd5b610c488a838b01610ba2565b90965094506040890135915080821115610c60578384fd5b50610c6d89828a01610ba2565b979a9699509497509295939492505050565b60008151815b81811015610c9f5760208185018101518683015201610c85565b81811115610cad5782828601525b509290920192915050565b8681528560208201528460408201526000610ce8610ce2610cdc6060850188610c7f565b86610c7f565b84610c7f565b98975050505050505050565b600061ffff808316818516808303821115610d1157610d11610d49565b01949350505050565b60008219821115610d2d57610d2d610d49565b500190565b600082821015610d4457610d44610d49565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220cc56d6044c6eb3e05aae27f5b06df65eab4d770573a834e90a1f050d59a467a864736f6c63430008040033", + "devdoc": { + "details": "Implements the DNSSEC RSASHA1 algorithm.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/RSASHA256Algorithm.json b/solidity/dns-contracts/deployments/goerli/RSASHA256Algorithm.json new file mode 100644 index 0000000..f0cbd9f --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/RSASHA256Algorithm.json @@ -0,0 +1,71 @@ +{ + "address": "0x9AD4D97363652970BbA7923a4DbBF401BFa76D8e", + "transactionHash": "0xb9c79b60d28c73a2e285d3ff9cecc9388836d63e31ecb9341342061159e73417", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "key", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xb9c79b60d28c73a2e285d3ff9cecc9388836d63e31ecb9341342061159e73417", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x9AD4D97363652970BbA7923a4DbBF401BFa76D8e", + "transactionIndex": 20, + "gasUsed": "478262", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x1dfc3b1c599fdc05960d3237a10c2d5bf7111d75398202be5bf3d9c257eb8725", + "transactionHash": "0xb9c79b60d28c73a2e285d3ff9cecc9388836d63e31ecb9341342061159e73417", + "logs": [], + "blockNumber": 6469095, + "cumulativeGasUsed": "5570856", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "7948b60c3b601df824761a337a51d661", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC RSASHA256 algorithm.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol\":\"RSASHA256Algorithm\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\\n uint shortest = len;\\n if (otherlen < len)\\n shortest = otherlen;\\n\\n uint selfptr;\\n uint otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint idx = 0; idx < shortest; idx += 32) {\\n uint a;\\n uint b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint mask;\\n if (shortest > 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\\n }\\n int diff = int(a & mask) - int(b & mask);\\n if (diff != 0)\\n return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int(len) - int(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\\n return self.length == other.length && equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint dest, uint src, uint len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint dest;\\n uint src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\\n require(len <= 52);\\n\\n uint ret = 0;\\n uint8 decoded;\\n for(uint i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if(i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint bitlen = len * 5;\\n if(len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if(len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if(len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if(len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if(len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n}\",\"keccak256\":\"0x83315df2e54c74451577c70da2c267c3459802b08b9aeec6516302eee70f796e\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n*/\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external virtual view returns (bool);\\n}\\n\",\"keccak256\":\"0x51d6251568844e435f58952354abe8c8c8e978ab40ecb0bbb2f5bd767838b3a7\"},\"contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary ModexpPrecompile {\\n /**\\n * @dev Computes (base ^ exponent) % modulus over big numbers.\\n */\\n function modexp(bytes memory base, bytes memory exponent, bytes memory modulus) internal view returns (bool success, bytes memory output) {\\n bytes memory input = abi.encodePacked(\\n uint256(base.length),\\n uint256(exponent.length),\\n uint256(modulus.length),\\n base,\\n exponent,\\n modulus\\n );\\n\\n output = new bytes(modulus.length);\\n\\n assembly {\\n success := staticcall(gas(), 5, add(input, 32), mload(input), add(output, 32), mload(modulus))\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe3d689d14cf0294f433f4e14cdd8feab8d542e5b8342c911d5c7cb518170e2b1\"},\"contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./RSAVerify.sol\\\";\\n\\n/**\\n* @dev Implements the DNSSEC RSASHA256 algorithm.\\n*/\\ncontract RSASHA256Algorithm is Algorithm {\\n using BytesUtils for *;\\n\\n function verify(bytes calldata key, bytes calldata data, bytes calldata sig) external override view returns (bool) {\\n bytes memory exponent;\\n bytes memory modulus;\\n\\n uint16 exponentLen = uint16(key.readUint8(4));\\n if (exponentLen != 0) {\\n exponent = key.substring(5, exponentLen);\\n modulus = key.substring(exponentLen + 5, key.length - exponentLen - 5);\\n } else {\\n exponentLen = key.readUint16(5);\\n exponent = key.substring(7, exponentLen);\\n modulus = key.substring(exponentLen + 7, key.length - exponentLen - 7);\\n }\\n\\n // Recover the message from the signature\\n bool ok;\\n bytes memory result;\\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\\n\\n // Verify it ends with the hash of our data\\n return ok && sha256(data) == result.readBytes32(result.length - 32);\\n }\\n}\\n\",\"keccak256\":\"0x8a5f89ac82a433590cd29d0a9e72ca68618b86105dfcd62e04dff313ddcf809d\"},\"contracts/dnssec-oracle/algorithms/RSAVerify.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./ModexpPrecompile.sol\\\";\\n\\nlibrary RSAVerify {\\n /**\\n * @dev Recovers the input data from an RSA signature, returning the result in S.\\n * @param N The RSA public modulus.\\n * @param E The RSA public exponent.\\n * @param S The signature to recover.\\n * @return True if the recovery succeeded.\\n */\\n function rsarecover(bytes memory N, bytes memory E, bytes memory S) internal view returns (bool, bytes memory) {\\n return ModexpPrecompile.modexp(S, E, N);\\n }\\n}\\n\",\"keccak256\":\"0xc630e4d296e2d7bd2b968f8a9a8df629fef5161e10ffae9973e045900741cfe4\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506107b6806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e3660046105e1565b610057565b604051901515815260200160405180910390f35b600060608060006100a260048b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506102f59050565b60ff169050801561016e576100f760058261ffff168c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103409050565b92506101676101078260056106fc565b61ffff9081169060059061011d9085168d61073a565b610127919061073a565b8c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103409050565b9150610227565b6101b260058b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506103e99050565b90506101fe60078261ffff168c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103409050565b925061022461020e8260076106fc565b61ffff9081169060079061011d9085168d61073a565b91505b6000606061026c84868a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061041192505050565b90925090508180156102e557506102916020825161028a919061073a565b829061042c565b60028b8b6040516102a39291906106b0565b602060405180830381855afa1580156102c0573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906102e391906105c9565b145b9c9b505050505050505050505050565b6000828281518110610330577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b016020015160f81c905092915050565b825160609061034f8385610722565b111561035a57600080fd5b60008267ffffffffffffffff81111561039c577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156103c6576020820181803683370190505b509050602080820190868601016103de828287610450565b509095945050505050565b81516000906103f9836002610722565b111561040457600080fd5b50016002015161ffff1690565b600060606104208385876104c4565b91509150935093915050565b815160009061043c836020610722565b111561044757600080fd5b50016020015190565b602081106104885781518352610467602084610722565b9250610474602083610722565b915061048160208261073a565b9050610450565b905182516020929092036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199091169116179052565b6000606060008551855185518888886040516020016104e8969594939291906106c0565b6040516020818303038152906040529050835167ffffffffffffffff81111561053a577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015610564576020820181803683370190505b50915083516020830182516020840160055afa925050935093915050565b60008083601f840112610593578182fd5b50813567ffffffffffffffff8111156105aa578182fd5b6020830191508360208285010111156105c257600080fd5b9250929050565b6000602082840312156105da578081fd5b5051919050565b600080600080600080606087890312156105f9578182fd5b863567ffffffffffffffff80821115610610578384fd5b61061c8a838b01610582565b90985096506020890135915080821115610634578384fd5b6106408a838b01610582565b90965094506040890135915080821115610658578384fd5b5061066589828a01610582565b979a9699509497509295939492505050565b60008151815b81811015610697576020818501810151868301520161067d565b818111156106a55782828601525b509290920192915050565b8183823760009101908152919050565b86815285602082015284604082015260006106f06106ea6106e46060850188610677565b86610677565b84610677565b98975050505050505050565b600061ffff80831681851680830382111561071957610719610751565b01949350505050565b6000821982111561073557610735610751565b500190565b60008282101561074c5761074c610751565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220507656509c1f1143561786f54a4725fbba70d4171b4e9f3bec13ba4f8696d07464736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e3660046105e1565b610057565b604051901515815260200160405180910390f35b600060608060006100a260048b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506102f59050565b60ff169050801561016e576100f760058261ffff168c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103409050565b92506101676101078260056106fc565b61ffff9081169060059061011d9085168d61073a565b610127919061073a565b8c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103409050565b9150610227565b6101b260058b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506103e99050565b90506101fe60078261ffff168c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103409050565b925061022461020e8260076106fc565b61ffff9081169060079061011d9085168d61073a565b91505b6000606061026c84868a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061041192505050565b90925090508180156102e557506102916020825161028a919061073a565b829061042c565b60028b8b6040516102a39291906106b0565b602060405180830381855afa1580156102c0573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906102e391906105c9565b145b9c9b505050505050505050505050565b6000828281518110610330577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b016020015160f81c905092915050565b825160609061034f8385610722565b111561035a57600080fd5b60008267ffffffffffffffff81111561039c577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156103c6576020820181803683370190505b509050602080820190868601016103de828287610450565b509095945050505050565b81516000906103f9836002610722565b111561040457600080fd5b50016002015161ffff1690565b600060606104208385876104c4565b91509150935093915050565b815160009061043c836020610722565b111561044757600080fd5b50016020015190565b602081106104885781518352610467602084610722565b9250610474602083610722565b915061048160208261073a565b9050610450565b905182516020929092036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199091169116179052565b6000606060008551855185518888886040516020016104e8969594939291906106c0565b6040516020818303038152906040529050835167ffffffffffffffff81111561053a577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015610564576020820181803683370190505b50915083516020830182516020840160055afa925050935093915050565b60008083601f840112610593578182fd5b50813567ffffffffffffffff8111156105aa578182fd5b6020830191508360208285010111156105c257600080fd5b9250929050565b6000602082840312156105da578081fd5b5051919050565b600080600080600080606087890312156105f9578182fd5b863567ffffffffffffffff80821115610610578384fd5b61061c8a838b01610582565b90985096506020890135915080821115610634578384fd5b6106408a838b01610582565b90965094506040890135915080821115610658578384fd5b5061066589828a01610582565b979a9699509497509295939492505050565b60008151815b81811015610697576020818501810151868301520161067d565b818111156106a55782828601525b509290920192915050565b8183823760009101908152919050565b86815285602082015284604082015260006106f06106ea6106e46060850188610677565b86610677565b84610677565b98975050505050505050565b600061ffff80831681851680830382111561071957610719610751565b01949350505050565b6000821982111561073557610735610751565b500190565b60008282101561074c5761074c610751565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220507656509c1f1143561786f54a4725fbba70d4171b4e9f3bec13ba4f8696d07464736f6c63430008040033", + "devdoc": { + "details": "Implements the DNSSEC RSASHA256 algorithm.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/ReverseRegistrar.json b/solidity/dns-contracts/deployments/goerli/ReverseRegistrar.json new file mode 100644 index 0000000..9ae0c86 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/ReverseRegistrar.json @@ -0,0 +1,557 @@ +{ + "address": "0x4f7A657451358a22dc397d5eE7981FfC526cd856", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "ensAddr", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "ControllerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract NameResolver", + "name": "resolver", + "type": "address" + } + ], + "name": "DefaultResolverChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "ReverseClaimed", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "claim", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "claimForAddr", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "claimWithResolver", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "defaultResolver", + "outputs": [ + { + "internalType": "contract NameResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "node", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setDefaultResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "setName", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "setNameForAddr", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x24a86a0a031a06e6735a750502f26035b68d0122084523c2349b113787dfd5f2", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x4f7A657451358a22dc397d5eE7981FfC526cd856", + "transactionIndex": 99, + "gasUsed": "882414", + "logsBloom": "0x00000000000000000000000004000000000040000000000000800000000000000000000000000000000000000000000000000000000012000000000040020000000000000000000040000000008000000001000000008000000000008000010000020000020000000000000000000800000000000000000000000000000000400000011000000000000000000000104004000000000000200000000000000002000000000000040000000010000000000004000001000000008000040010000000000000000000000000010000005000000000000000000000000000000020000000000000000000000001000100000000000000001000000000000000000000", + "blockHash": "0x458b6c8c9a7ada15627bdde3af1fe49026d06b4c2dcc2499c182f1b7738920ef", + "transactionHash": "0x24a86a0a031a06e6735a750502f26035b68d0122084523c2349b113787dfd5f2", + "logs": [ + { + "transactionIndex": 99, + "blockNumber": 8585993, + "transactionHash": "0x24a86a0a031a06e6735a750502f26035b68d0122084523c2349b113787dfd5f2", + "address": "0x4f7A657451358a22dc397d5eE7981FfC526cd856", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000a303ddc620aa7d1390baccc8a495508b183fab59" + ], + "data": "0x", + "logIndex": 231, + "blockHash": "0x458b6c8c9a7ada15627bdde3af1fe49026d06b4c2dcc2499c182f1b7738920ef" + }, + { + "transactionIndex": 99, + "blockNumber": 8585993, + "transactionHash": "0x24a86a0a031a06e6735a750502f26035b68d0122084523c2349b113787dfd5f2", + "address": "0x9a879320A9F7ad2BBb02063d67baF5551D6BD8B0", + "topics": [ + "0x6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e92", + "0x0000000000000000000000004f7a657451358a22dc397d5ee7981ffc526cd856", + "0xb5690bb6d79ec59769cfbb667f635e2af5dcecfed4f0807766cb4bbe7efe64f5" + ], + "data": "0x", + "logIndex": 232, + "blockHash": "0x458b6c8c9a7ada15627bdde3af1fe49026d06b4c2dcc2499c182f1b7738920ef" + }, + { + "transactionIndex": 99, + "blockNumber": 8585993, + "transactionHash": "0x24a86a0a031a06e6735a750502f26035b68d0122084523c2349b113787dfd5f2", + "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "topics": [ + "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", + "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2", + "0x509fd55413b7604d04b574d48c9e1c0c6c41647d009be202dff55d884197ef54" + ], + "data": "0x000000000000000000000000a303ddc620aa7d1390baccc8a495508b183fab59", + "logIndex": 233, + "blockHash": "0x458b6c8c9a7ada15627bdde3af1fe49026d06b4c2dcc2499c182f1b7738920ef" + }, + { + "transactionIndex": 99, + "blockNumber": 8585993, + "transactionHash": "0x24a86a0a031a06e6735a750502f26035b68d0122084523c2349b113787dfd5f2", + "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "topics": [ + "0x335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0", + "0xb5690bb6d79ec59769cfbb667f635e2af5dcecfed4f0807766cb4bbe7efe64f5" + ], + "data": "0x00000000000000000000000019c2d5d0f035563344dbb7be5fd09c8dad62b001", + "logIndex": 234, + "blockHash": "0x458b6c8c9a7ada15627bdde3af1fe49026d06b4c2dcc2499c182f1b7738920ef" + } + ], + "blockNumber": 8585993, + "cumulativeGasUsed": "20722126", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "numDeployments": 4, + "solcInputHash": "2813443d96b2eb882a21ada25755af03", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"ensAddr\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"ControllerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract NameResolver\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"DefaultResolverChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"ReverseClaimed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"claimForAddr\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"claimWithResolver\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"defaultResolver\",\"outputs\":[{\"internalType\":\"contract NameResolver\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"node\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setDefaultResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"setNameForAddr\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"claim(address)\":{\"details\":\"Transfers ownership of the reverse ENS record associated with the calling account.\",\"params\":{\"owner\":\"The address to set as the owner of the reverse record in ENS.\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"claimForAddr(address,address,address)\":{\"details\":\"Transfers ownership of the reverse ENS record associated with the calling account.\",\"params\":{\"addr\":\"The reverse record to set\",\"owner\":\"The address to set as the owner of the reverse record in ENS.\",\"resolver\":\"The resolver of the reverse node\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"claimWithResolver(address,address)\":{\"details\":\"Transfers ownership of the reverse ENS record associated with the calling account.\",\"params\":{\"owner\":\"The address to set as the owner of the reverse record in ENS.\",\"resolver\":\"The address of the resolver to set; 0 to leave unchanged.\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"constructor\":{\"details\":\"Constructor\",\"params\":{\"ensAddr\":\"The address of the ENS registry.\"}},\"node(address)\":{\"details\":\"Returns the node hash for a given account's reverse records.\",\"params\":{\"addr\":\"The address to hash\"},\"returns\":{\"_0\":\"The ENS node hash.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setName(string)\":{\"details\":\"Sets the `name()` record for the reverse ENS record associated with the calling account. First updates the resolver to the default reverse resolver if necessary.\",\"params\":{\"name\":\"The name to set for this address.\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"setNameForAddr(address,address,address,string)\":{\"details\":\"Sets the `name()` record for the reverse ENS record associated with the account provided. Updates the resolver to a designated resolver Only callable by controllers and authorised users\",\"params\":{\"addr\":\"The reverse record to set\",\"name\":\"The name to set for this address.\",\"owner\":\"The owner of the reverse node\",\"resolver\":\"The resolver of the reverse node\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/registry/ReverseRegistrar.sol\":\"ReverseRegistrar\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1500},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/registry/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/registry/ReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"./ENS.sol\\\";\\nimport \\\"./IReverseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"../root/Controllable.sol\\\";\\n\\nabstract contract NameResolver {\\n function setName(bytes32 node, string memory name) public virtual;\\n}\\n\\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\\n\\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n// namehash('addr.reverse')\\n\\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\\n ENS public immutable ens;\\n NameResolver public defaultResolver;\\n\\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\\n event DefaultResolverChanged(NameResolver indexed resolver);\\n\\n /**\\n * @dev Constructor\\n * @param ensAddr The address of the ENS registry.\\n */\\n constructor(ENS ensAddr) {\\n ens = ensAddr;\\n\\n // Assign ownership of the reverse record to our deployer\\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\\n ensAddr.owner(ADDR_REVERSE_NODE)\\n );\\n if (address(oldRegistrar) != address(0x0)) {\\n oldRegistrar.claim(msg.sender);\\n }\\n }\\n\\n modifier authorised(address addr) {\\n require(\\n addr == msg.sender ||\\n controllers[msg.sender] ||\\n ens.isApprovedForAll(addr, msg.sender) ||\\n ownsContract(addr),\\n \\\"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\\\"\\n );\\n _;\\n }\\n\\n function setDefaultResolver(address resolver) public override onlyOwner {\\n require(\\n address(resolver) != address(0),\\n \\\"ReverseRegistrar: Resolver address must not be 0\\\"\\n );\\n defaultResolver = NameResolver(resolver);\\n emit DefaultResolverChanged(NameResolver(resolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claim(address owner) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, address(defaultResolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param addr The reverse record to set\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The resolver of the reverse node\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) public override authorised(addr) returns (bytes32) {\\n bytes32 labelHash = sha3HexAddress(addr);\\n bytes32 reverseNode = keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\\n );\\n emit ReverseClaimed(addr, reverseNode);\\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\\n return reverseNode;\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, resolver);\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the calling account. First updates the resolver to the default reverse\\n * resolver if necessary.\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setName(string memory name) public override returns (bytes32) {\\n return\\n setNameForAddr(\\n msg.sender,\\n msg.sender,\\n address(defaultResolver),\\n name\\n );\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the account provided. Updates the resolver to a designated resolver\\n * Only callable by controllers and authorised users\\n * @param addr The reverse record to set\\n * @param owner The owner of the reverse node\\n * @param resolver The resolver of the reverse node\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) public override returns (bytes32) {\\n bytes32 node = claimForAddr(addr, owner, resolver);\\n NameResolver(resolver).setName(node, name);\\n return node;\\n }\\n\\n /**\\n * @dev Returns the node hash for a given account's reverse records.\\n * @param addr The address to hash\\n * @return The ENS node hash.\\n */\\n function node(address addr) public pure override returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\\n );\\n }\\n\\n /**\\n * @dev An optimised function to compute the sha3 of the lower-case\\n * hexadecimal representation of an Ethereum address.\\n * @param addr The address to hash\\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\\n * input address.\\n */\\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\\n assembly {\\n for {\\n let i := 40\\n } gt(i, 0) {\\n\\n } {\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n }\\n\\n ret := keccak256(0, 40)\\n }\\n }\\n\\n function ownsContract(address addr) internal view returns (bool) {\\n try Ownable(addr).owner() returns (address owner) {\\n return owner == msg.sender;\\n } catch {\\n return false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6c79056e7f564409e834619de2cf0511321dcbcf90b9f68d8ffed50fab070791\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"}},\"version\":1}", + "bytecode": "0x60a060405234801561001057600080fd5b5060405162000f6938038062000f69833981016040819052610031916101b6565b61003a3361014e565b6001600160a01b03811660808190526040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152600091906302571be390602401602060405180830381865afa1580156100a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ca91906101b6565b90506001600160a01b0381161561014757604051630f41a04d60e11b81523360048201526001600160a01b03821690631e83409a906024016020604051808303816000875af1158015610121573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061014591906101da565b505b50506101f3565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146101b357600080fd5b50565b6000602082840312156101c857600080fd5b81516101d38161019e565b9392505050565b6000602082840312156101ec57600080fd5b5051919050565b608051610d4c6200021d6000396000818161012d015281816102f001526105070152610d4c6000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063c66485b211610066578063c66485b2146101e1578063da8c229e146101f4578063e0dba60f14610227578063f2fde38b1461023a57600080fd5b80638da5cb5b146101aa578063bffbe61c146101bb578063c47f0027146101ce57600080fd5b806365669631116100c85780636566963114610167578063715018a61461017a5780637a806d6b14610184578063828eab0e1461019757600080fd5b80630f5a5466146100ef5780631e83409a146101155780633f15457f14610128575b600080fd5b6101026100fd366004610a3b565b61024d565b6040519081526020015b60405180910390f35b610102610123366004610a74565b610261565b61014f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b610102610175366004610a91565b610283565b61018261056e565b005b610102610192366004610b98565b610582565b60025461014f906001600160a01b031681565b6000546001600160a01b031661014f565b6101026101c9366004610a74565b610616565b6101026101dc366004610c0d565b610671565b6101826101ef366004610a74565b61068e565b610217610202366004610a74565b60016020526000908152604090205460ff1681565b604051901515815260200161010c565b610182610235366004610c58565b610774565b610182610248366004610a74565b6107db565b600061025a338484610283565b9392505050565b60025460009061027d90339084906001600160a01b0316610283565b92915050565b6000836001600160a01b0381163314806102ac57503360009081526001602052604090205460ff165b8061035b57506040517fe985e9c50000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610337573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035b9190610c86565b8061036a575061036a8161086b565b6104075760405162461bcd60e51b815260206004820152605b60248201527f526576657273655265676973747261723a2043616c6c6572206973206e6f742060448201527f6120636f6e74726f6c6c6572206f7220617574686f726973656420627920616460648201527f6472657373206f7220746865206164647265737320697473656c660000000000608482015260a4015b60405180910390fd5b6000610412866108e4565b604080517f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2602080830191909152818301849052825180830384018152606090920192839052815191012091925081906001600160a01b038916907f6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e9290600090a36040517f5ef2c7f00000000000000000000000000000000000000000000000000000000081527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152602481018390526001600160a01b0387811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561054b57600080fd5b505af115801561055f573d6000803e3d6000fd5b50929998505050505050505050565b610576610964565b61058060006109be565b565b600080610590868686610283565b6040517f773722130000000000000000000000000000000000000000000000000000000081529091506001600160a01b038516906377372213906105da9084908790600401610ca3565b600060405180830381600087803b1580156105f457600080fd5b505af1158015610608573d6000803e3d6000fd5b509298975050505050505050565b60007f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2610642836108e4565b604080516020810193909352820152606001604051602081830303815290604052805190602001209050919050565b60025460009061027d90339081906001600160a01b031685610582565b610696610964565b6001600160a01b0381166107125760405162461bcd60e51b815260206004820152603060248201527f526576657273655265676973747261723a205265736f6c76657220616464726560448201527f7373206d757374206e6f7420626520300000000000000000000000000000000060648201526084016103fe565b600280547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040517feae17a84d9eb83d8c8eb317f9e7d64857bc363fa51674d996c023f4340c577cf90600090a250565b61077c610964565b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b6107e3610964565b6001600160a01b03811661085f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103fe565b610868816109be565b50565b6000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156108c7575060408051601f3d908101601f191682019092526108c491810190610cf9565b60015b6108d357506000919050565b6001600160a01b0316331492915050565b600060285b801561095857600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a8153601090920491600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a81536010830492506108e9565b50506028600020919050565b6000546001600160a01b031633146105805760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103fe565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461086857600080fd5b60008060408385031215610a4e57600080fd5b8235610a5981610a26565b91506020830135610a6981610a26565b809150509250929050565b600060208284031215610a8657600080fd5b813561025a81610a26565b600080600060608486031215610aa657600080fd5b8335610ab181610a26565b92506020840135610ac181610a26565b91506040840135610ad181610a26565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112610b1c57600080fd5b813567ffffffffffffffff80821115610b3757610b37610adc565b604051601f8301601f19908116603f01168101908282118183101715610b5f57610b5f610adc565b81604052838152866020858801011115610b7857600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060808587031215610bae57600080fd5b8435610bb981610a26565b93506020850135610bc981610a26565b92506040850135610bd981610a26565b9150606085013567ffffffffffffffff811115610bf557600080fd5b610c0187828801610b0b565b91505092959194509250565b600060208284031215610c1f57600080fd5b813567ffffffffffffffff811115610c3657600080fd5b610c4284828501610b0b565b949350505050565b801515811461086857600080fd5b60008060408385031215610c6b57600080fd5b8235610c7681610a26565b91506020830135610a6981610c4a565b600060208284031215610c9857600080fd5b815161025a81610c4a565b82815260006020604081840152835180604085015260005b81811015610cd757858101830151858201606001528201610cbb565b506000606082860101526060601f19601f830116850101925050509392505050565b600060208284031215610d0b57600080fd5b815161025a81610a2656fea2646970667358221220de68352cdb9ec961cdd93101ef28225be11183dda40e44bcf83c9939bf7e679c64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063c66485b211610066578063c66485b2146101e1578063da8c229e146101f4578063e0dba60f14610227578063f2fde38b1461023a57600080fd5b80638da5cb5b146101aa578063bffbe61c146101bb578063c47f0027146101ce57600080fd5b806365669631116100c85780636566963114610167578063715018a61461017a5780637a806d6b14610184578063828eab0e1461019757600080fd5b80630f5a5466146100ef5780631e83409a146101155780633f15457f14610128575b600080fd5b6101026100fd366004610a3b565b61024d565b6040519081526020015b60405180910390f35b610102610123366004610a74565b610261565b61014f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b610102610175366004610a91565b610283565b61018261056e565b005b610102610192366004610b98565b610582565b60025461014f906001600160a01b031681565b6000546001600160a01b031661014f565b6101026101c9366004610a74565b610616565b6101026101dc366004610c0d565b610671565b6101826101ef366004610a74565b61068e565b610217610202366004610a74565b60016020526000908152604090205460ff1681565b604051901515815260200161010c565b610182610235366004610c58565b610774565b610182610248366004610a74565b6107db565b600061025a338484610283565b9392505050565b60025460009061027d90339084906001600160a01b0316610283565b92915050565b6000836001600160a01b0381163314806102ac57503360009081526001602052604090205460ff165b8061035b57506040517fe985e9c50000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610337573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035b9190610c86565b8061036a575061036a8161086b565b6104075760405162461bcd60e51b815260206004820152605b60248201527f526576657273655265676973747261723a2043616c6c6572206973206e6f742060448201527f6120636f6e74726f6c6c6572206f7220617574686f726973656420627920616460648201527f6472657373206f7220746865206164647265737320697473656c660000000000608482015260a4015b60405180910390fd5b6000610412866108e4565b604080517f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2602080830191909152818301849052825180830384018152606090920192839052815191012091925081906001600160a01b038916907f6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e9290600090a36040517f5ef2c7f00000000000000000000000000000000000000000000000000000000081527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152602481018390526001600160a01b0387811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561054b57600080fd5b505af115801561055f573d6000803e3d6000fd5b50929998505050505050505050565b610576610964565b61058060006109be565b565b600080610590868686610283565b6040517f773722130000000000000000000000000000000000000000000000000000000081529091506001600160a01b038516906377372213906105da9084908790600401610ca3565b600060405180830381600087803b1580156105f457600080fd5b505af1158015610608573d6000803e3d6000fd5b509298975050505050505050565b60007f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2610642836108e4565b604080516020810193909352820152606001604051602081830303815290604052805190602001209050919050565b60025460009061027d90339081906001600160a01b031685610582565b610696610964565b6001600160a01b0381166107125760405162461bcd60e51b815260206004820152603060248201527f526576657273655265676973747261723a205265736f6c76657220616464726560448201527f7373206d757374206e6f7420626520300000000000000000000000000000000060648201526084016103fe565b600280547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040517feae17a84d9eb83d8c8eb317f9e7d64857bc363fa51674d996c023f4340c577cf90600090a250565b61077c610964565b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b6107e3610964565b6001600160a01b03811661085f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103fe565b610868816109be565b50565b6000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156108c7575060408051601f3d908101601f191682019092526108c491810190610cf9565b60015b6108d357506000919050565b6001600160a01b0316331492915050565b600060285b801561095857600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a8153601090920491600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a81536010830492506108e9565b50506028600020919050565b6000546001600160a01b031633146105805760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103fe565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461086857600080fd5b60008060408385031215610a4e57600080fd5b8235610a5981610a26565b91506020830135610a6981610a26565b809150509250929050565b600060208284031215610a8657600080fd5b813561025a81610a26565b600080600060608486031215610aa657600080fd5b8335610ab181610a26565b92506020840135610ac181610a26565b91506040840135610ad181610a26565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112610b1c57600080fd5b813567ffffffffffffffff80821115610b3757610b37610adc565b604051601f8301601f19908116603f01168101908282118183101715610b5f57610b5f610adc565b81604052838152866020858801011115610b7857600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060808587031215610bae57600080fd5b8435610bb981610a26565b93506020850135610bc981610a26565b92506040850135610bd981610a26565b9150606085013567ffffffffffffffff811115610bf557600080fd5b610c0187828801610b0b565b91505092959194509250565b600060208284031215610c1f57600080fd5b813567ffffffffffffffff811115610c3657600080fd5b610c4284828501610b0b565b949350505050565b801515811461086857600080fd5b60008060408385031215610c6b57600080fd5b8235610c7681610a26565b91506020830135610a6981610c4a565b600060208284031215610c9857600080fd5b815161025a81610c4a565b82815260006020604081840152835180604085015260005b81811015610cd757858101830151858201606001528201610cbb565b506000606082860101526060601f19601f830116850101925050509392505050565b600060208284031215610d0b57600080fd5b815161025a81610a2656fea2646970667358221220de68352cdb9ec961cdd93101ef28225be11183dda40e44bcf83c9939bf7e679c64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "claim(address)": { + "details": "Transfers ownership of the reverse ENS record associated with the calling account.", + "params": { + "owner": "The address to set as the owner of the reverse record in ENS." + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "claimForAddr(address,address,address)": { + "details": "Transfers ownership of the reverse ENS record associated with the calling account.", + "params": { + "addr": "The reverse record to set", + "owner": "The address to set as the owner of the reverse record in ENS.", + "resolver": "The resolver of the reverse node" + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "claimWithResolver(address,address)": { + "details": "Transfers ownership of the reverse ENS record associated with the calling account.", + "params": { + "owner": "The address to set as the owner of the reverse record in ENS.", + "resolver": "The address of the resolver to set; 0 to leave unchanged." + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "constructor": { + "details": "Constructor", + "params": { + "ensAddr": "The address of the ENS registry." + } + }, + "node(address)": { + "details": "Returns the node hash for a given account's reverse records.", + "params": { + "addr": "The address to hash" + }, + "returns": { + "_0": "The ENS node hash." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "setName(string)": { + "details": "Sets the `name()` record for the reverse ENS record associated with the calling account. First updates the resolver to the default reverse resolver if necessary.", + "params": { + "name": "The name to set for this address." + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "setNameForAddr(address,address,address,string)": { + "details": "Sets the `name()` record for the reverse ENS record associated with the account provided. Updates the resolver to a designated resolver Only callable by controllers and authorised users", + "params": { + "addr": "The reverse record to set", + "name": "The name to set for this address.", + "owner": "The owner of the reverse node", + "resolver": "The resolver of the reverse node" + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 545, + "contract": "contracts/registry/ReverseRegistrar.sol:ReverseRegistrar", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 17597, + "contract": "contracts/registry/ReverseRegistrar.sol:ReverseRegistrar", + "label": "controllers", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 14722, + "contract": "contracts/registry/ReverseRegistrar.sol:ReverseRegistrar", + "label": "defaultResolver", + "offset": 0, + "slot": "2", + "type": "t_contract(NameResolver)14704" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(NameResolver)14704": { + "encoding": "inplace", + "label": "contract NameResolver", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/Root.json b/solidity/dns-contracts/deployments/goerli/Root.json new file mode 100644 index 0000000..0a08d1d --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/Root.json @@ -0,0 +1,363 @@ +{ + "address": "0x31e789Eb325aB116997942f7809731197a3dc059", + "transactionHash": "0x0a7ee7932ad527671f61eedb62d33906cbca7e16cabcd4a5981e3f5b22e08700", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "ControllerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + } + ], + "name": "TLDLocked", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + } + ], + "name": "lock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "locked", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xc3437c766e475166db108bb1da1aa6b2763eaebb63c7d6e3cd26f98ef246d7c0", + "receipt": { + "to": null, + "from": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "contractAddress": "0x8B2760811Eb2CAf088F2Aa0AF654534Be2Ddf1Cc", + "transactionIndex": 0, + "gasUsed": "970135", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000100000800000000000000000000000000000000400000008000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000002000000000000000000020000000000000000000000000000000000000000008000000000000000000000000", + "blockHash": "0x5c926fa5b9b02373fbbb3879f79a74837a584c9196492960347ec055daed8764", + "transactionHash": "0xc3437c766e475166db108bb1da1aa6b2763eaebb63c7d6e3cd26f98ef246d7c0", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10645548, + "transactionHash": "0xc3437c766e475166db108bb1da1aa6b2763eaebb63c7d6e3cd26f98ef246d7c0", + "address": "0x8B2760811Eb2CAf088F2Aa0AF654534Be2Ddf1Cc", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x5c926fa5b9b02373fbbb3879f79a74837a584c9196492960347ec055daed8764" + } + ], + "blockNumber": 10645548, + "cumulativeGasUsed": "970135", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "solcInputHash": "a50cca78b1bed5d39e9ebe70f5371ee9", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"ControllerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"}],\"name\":\"TLDLocked\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"}],\"name\":\"lock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"locked\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setSubnodeOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/root/Root.sol\":\"Root\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x1cae4f85f114ff17b90414f5da67365b1d00337abb5bce9bf944eb78a2c0673c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xf930d2df426bfcfc1f7415be724f04081c96f4fb9ec8d0e3a521c07692dface0\",\"license\":\"MIT\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual;\\n function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual;\\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external virtual returns(bytes32);\\n function setResolver(bytes32 node, address resolver) external virtual;\\n function setOwner(bytes32 node, address owner) external virtual;\\n function setTTL(bytes32 node, uint64 ttl) external virtual;\\n function setApprovalForAll(address operator, bool approved) external virtual;\\n function owner(bytes32 node) external virtual view returns (address);\\n function resolver(bytes32 node) external virtual view returns (address);\\n function ttl(bytes32 node) external virtual view returns (uint64);\\n function recordExists(bytes32 node) external virtual view returns (bool);\\n function isApprovedForAll(address owner, address operator) external virtual view returns (bool);\\n}\\n\",\"keccak256\":\"0x942ef29bd7c0f62228aeb91879ddd1ba101f52a2162970d3e48adffa498f4483\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0x0c364a5b65b6fff279adbe1fd6498c488feabeec781599cd60a5844e80ee7d88\"},\"contracts/root/Root.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"./Controllable.sol\\\";\\n\\ncontract Root is Ownable, Controllable {\\n bytes32 private constant ROOT_NODE = bytes32(0);\\n\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n\\n event TLDLocked(bytes32 indexed label);\\n\\n ENS public ens;\\n mapping(bytes32 => bool) public locked;\\n\\n constructor(ENS _ens) public {\\n ens = _ens;\\n }\\n\\n function setSubnodeOwner(bytes32 label, address owner)\\n external\\n onlyController\\n {\\n require(!locked[label]);\\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\\n }\\n\\n function setResolver(address resolver) external onlyOwner {\\n ens.setResolver(ROOT_NODE, resolver);\\n }\\n\\n function lock(bytes32 label) external onlyOwner {\\n emit TLDLocked(label);\\n locked[label] = true;\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n external\\n pure\\n returns (bool)\\n {\\n return interfaceID == INTERFACE_META_ID;\\n }\\n}\\n\",\"keccak256\":\"0xf6fed46bbdc8a425d112c473a649045148b2e0404647c97590d2a3e2798c9fe3\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506040516200119b3803806200119b83398181016040528101906200003791906200014e565b6000620000496200012f60201b60201c565b9050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050620001dc565b600033905090565b6000815190506200014881620001c2565b92915050565b6000602082840312156200016157600080fd5b6000620001718482850162000137565b91505092915050565b60006200018782620001a2565b9050919050565b60006200019b826200017a565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b620001cd816200018e565b8114620001d957600080fd5b50565b610faf80620001ec6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80638cb8ecec116100715780638cb8ecec1461013e5780638da5cb5b1461015a578063cbe9e76414610178578063da8c229e146101a8578063e0dba60f146101d8578063f2fde38b146101f4576100a9565b806301670ba9146100ae57806301ffc9a7146100ca5780633f15457f146100fa5780634e543b2614610118578063715018a614610134575b600080fd5b6100c860048036038101906100c39190610b40565b610210565b005b6100e460048036038101906100df9190610bce565b6102e8565b6040516100f19190610cb7565b60405180910390f35b610102610352565b60405161010f9190610d32565b60405180910390f35b610132600480360381019061012d9190610adb565b610378565b005b61013c610489565b005b61015860048036038101906101539190610b92565b6105c3565b005b610162610733565b60405161016f9190610c9c565b60405180910390f35b610192600480360381019061018d9190610b40565b61075c565b60405161019f9190610cb7565b60405180910390f35b6101c260048036038101906101bd9190610adb565b61077c565b6040516101cf9190610cb7565b60405180910390f35b6101f260048036038101906101ed9190610b04565b61079c565b005b61020e60048036038101906102099190610adb565b6108c1565b005b610218610a6a565b73ffffffffffffffffffffffffffffffffffffffff16610236610733565b73ffffffffffffffffffffffffffffffffffffffff161461028c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161028390610d8d565b60405180910390fd5b807f1764176cfa565853ba1ded547a830a9f9bff95231ef6fd228b3ddd617577756960405160405180910390a260016003600083815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60007f01ffc9a7a5cef8baa21ed3c5c0d7e23accb804b619e9333b597f47a0d84076e27bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610380610a6a565b73ffffffffffffffffffffffffffffffffffffffff1661039e610733565b73ffffffffffffffffffffffffffffffffffffffff16146103f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103eb90610d8d565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631896f70a6000801b836040518363ffffffff1660e01b8152600401610454929190610cd2565b600060405180830381600087803b15801561046e57600080fd5b505af1158015610482573d6000803e3d6000fd5b5050505050565b610491610a6a565b73ffffffffffffffffffffffffffffffffffffffff166104af610733565b73ffffffffffffffffffffffffffffffffffffffff1614610505576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104fc90610d8d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661064f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161064690610d6d565b60405180910390fd5b6003600083815260200190815260200160002060009054906101000a900460ff161561067a57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166306ab59236000801b84846040518463ffffffff1660e01b81526004016106dc93929190610cfb565b602060405180830381600087803b1580156106f657600080fd5b505af115801561070a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072e9190610b69565b505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60036020528060005260406000206000915054906101000a900460ff1681565b60016020528060005260406000206000915054906101000a900460ff1681565b6107a4610a6a565b73ffffffffffffffffffffffffffffffffffffffff166107c2610733565b73ffffffffffffffffffffffffffffffffffffffff1614610818576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080f90610d8d565b60405180910390fd5b80600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87826040516108b59190610cb7565b60405180910390a25050565b6108c9610a6a565b73ffffffffffffffffffffffffffffffffffffffff166108e7610733565b73ffffffffffffffffffffffffffffffffffffffff161461093d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093490610d8d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156109ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a490610d4d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600081359050610a8181610f1d565b92915050565b600081359050610a9681610f34565b92915050565b600081359050610aab81610f4b565b92915050565b600081519050610ac081610f4b565b92915050565b600081359050610ad581610f62565b92915050565b600060208284031215610aed57600080fd5b6000610afb84828501610a72565b91505092915050565b60008060408385031215610b1757600080fd5b6000610b2585828601610a72565b9250506020610b3685828601610a87565b9150509250929050565b600060208284031215610b5257600080fd5b6000610b6084828501610a9c565b91505092915050565b600060208284031215610b7b57600080fd5b6000610b8984828501610ab1565b91505092915050565b60008060408385031215610ba557600080fd5b6000610bb385828601610a9c565b9250506020610bc485828601610a72565b9150509250929050565b600060208284031215610be057600080fd5b6000610bee84828501610ac6565b91505092915050565b610c0081610dbe565b82525050565b610c0f81610dd0565b82525050565b610c1e81610ddc565b82525050565b610c2d81610e32565b82525050565b6000610c40602683610dad565b9150610c4b82610e56565b604082019050919050565b6000610c63602883610dad565b9150610c6e82610ea5565b604082019050919050565b6000610c86602083610dad565b9150610c9182610ef4565b602082019050919050565b6000602082019050610cb16000830184610bf7565b92915050565b6000602082019050610ccc6000830184610c06565b92915050565b6000604082019050610ce76000830185610c15565b610cf46020830184610bf7565b9392505050565b6000606082019050610d106000830186610c15565b610d1d6020830185610c15565b610d2a6040830184610bf7565b949350505050565b6000602082019050610d476000830184610c24565b92915050565b60006020820190508181036000830152610d6681610c33565b9050919050565b60006020820190508181036000830152610d8681610c56565b9050919050565b60006020820190508181036000830152610da681610c79565b9050919050565b600082825260208201905092915050565b6000610dc982610e12565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610e3d82610e44565b9050919050565b6000610e4f82610e12565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f60008201527f6e74726f6c6c6572000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b610f2681610dbe565b8114610f3157600080fd5b50565b610f3d81610dd0565b8114610f4857600080fd5b50565b610f5481610ddc565b8114610f5f57600080fd5b50565b610f6b81610de6565b8114610f7657600080fd5b5056fea26469706673582212205e697f39b3f6ec0e2f53ccf2db1bb39804cfe7b19856f913dbb6b3a50b993e8264736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80638cb8ecec116100715780638cb8ecec1461013e5780638da5cb5b1461015a578063cbe9e76414610178578063da8c229e146101a8578063e0dba60f146101d8578063f2fde38b146101f4576100a9565b806301670ba9146100ae57806301ffc9a7146100ca5780633f15457f146100fa5780634e543b2614610118578063715018a614610134575b600080fd5b6100c860048036038101906100c39190610b40565b610210565b005b6100e460048036038101906100df9190610bce565b6102e8565b6040516100f19190610cb7565b60405180910390f35b610102610352565b60405161010f9190610d32565b60405180910390f35b610132600480360381019061012d9190610adb565b610378565b005b61013c610489565b005b61015860048036038101906101539190610b92565b6105c3565b005b610162610733565b60405161016f9190610c9c565b60405180910390f35b610192600480360381019061018d9190610b40565b61075c565b60405161019f9190610cb7565b60405180910390f35b6101c260048036038101906101bd9190610adb565b61077c565b6040516101cf9190610cb7565b60405180910390f35b6101f260048036038101906101ed9190610b04565b61079c565b005b61020e60048036038101906102099190610adb565b6108c1565b005b610218610a6a565b73ffffffffffffffffffffffffffffffffffffffff16610236610733565b73ffffffffffffffffffffffffffffffffffffffff161461028c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161028390610d8d565b60405180910390fd5b807f1764176cfa565853ba1ded547a830a9f9bff95231ef6fd228b3ddd617577756960405160405180910390a260016003600083815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60007f01ffc9a7a5cef8baa21ed3c5c0d7e23accb804b619e9333b597f47a0d84076e27bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610380610a6a565b73ffffffffffffffffffffffffffffffffffffffff1661039e610733565b73ffffffffffffffffffffffffffffffffffffffff16146103f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103eb90610d8d565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631896f70a6000801b836040518363ffffffff1660e01b8152600401610454929190610cd2565b600060405180830381600087803b15801561046e57600080fd5b505af1158015610482573d6000803e3d6000fd5b5050505050565b610491610a6a565b73ffffffffffffffffffffffffffffffffffffffff166104af610733565b73ffffffffffffffffffffffffffffffffffffffff1614610505576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104fc90610d8d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661064f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161064690610d6d565b60405180910390fd5b6003600083815260200190815260200160002060009054906101000a900460ff161561067a57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166306ab59236000801b84846040518463ffffffff1660e01b81526004016106dc93929190610cfb565b602060405180830381600087803b1580156106f657600080fd5b505af115801561070a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072e9190610b69565b505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60036020528060005260406000206000915054906101000a900460ff1681565b60016020528060005260406000206000915054906101000a900460ff1681565b6107a4610a6a565b73ffffffffffffffffffffffffffffffffffffffff166107c2610733565b73ffffffffffffffffffffffffffffffffffffffff1614610818576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080f90610d8d565b60405180910390fd5b80600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87826040516108b59190610cb7565b60405180910390a25050565b6108c9610a6a565b73ffffffffffffffffffffffffffffffffffffffff166108e7610733565b73ffffffffffffffffffffffffffffffffffffffff161461093d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093490610d8d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156109ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a490610d4d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600081359050610a8181610f1d565b92915050565b600081359050610a9681610f34565b92915050565b600081359050610aab81610f4b565b92915050565b600081519050610ac081610f4b565b92915050565b600081359050610ad581610f62565b92915050565b600060208284031215610aed57600080fd5b6000610afb84828501610a72565b91505092915050565b60008060408385031215610b1757600080fd5b6000610b2585828601610a72565b9250506020610b3685828601610a87565b9150509250929050565b600060208284031215610b5257600080fd5b6000610b6084828501610a9c565b91505092915050565b600060208284031215610b7b57600080fd5b6000610b8984828501610ab1565b91505092915050565b60008060408385031215610ba557600080fd5b6000610bb385828601610a9c565b9250506020610bc485828601610a72565b9150509250929050565b600060208284031215610be057600080fd5b6000610bee84828501610ac6565b91505092915050565b610c0081610dbe565b82525050565b610c0f81610dd0565b82525050565b610c1e81610ddc565b82525050565b610c2d81610e32565b82525050565b6000610c40602683610dad565b9150610c4b82610e56565b604082019050919050565b6000610c63602883610dad565b9150610c6e82610ea5565b604082019050919050565b6000610c86602083610dad565b9150610c9182610ef4565b602082019050919050565b6000602082019050610cb16000830184610bf7565b92915050565b6000602082019050610ccc6000830184610c06565b92915050565b6000604082019050610ce76000830185610c15565b610cf46020830184610bf7565b9392505050565b6000606082019050610d106000830186610c15565b610d1d6020830185610c15565b610d2a6040830184610bf7565b949350505050565b6000602082019050610d476000830184610c24565b92915050565b60006020820190508181036000830152610d6681610c33565b9050919050565b60006020820190508181036000830152610d8681610c56565b9050919050565b60006020820190508181036000830152610da681610c79565b9050919050565b600082825260208201905092915050565b6000610dc982610e12565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610e3d82610e44565b9050919050565b6000610e4f82610e12565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f60008201527f6e74726f6c6c6572000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b610f2681610dbe565b8114610f3157600080fd5b50565b610f3d81610dd0565b8114610f4857600080fd5b50565b610f5481610ddc565b8114610f5f57600080fd5b50565b610f6b81610de6565b8114610f7657600080fd5b5056fea26469706673582212205e697f39b3f6ec0e2f53ccf2db1bb39804cfe7b19856f913dbb6b3a50b993e8264736f6c63430008040033", + "devdoc": { + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 545, + "contract": "contracts/root/Root.sol:Root", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 15162, + "contract": "contracts/root/Root.sol:Root", + "label": "controllers", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 15292, + "contract": "contracts/root/Root.sol:Root", + "label": "ens", + "offset": 0, + "slot": "2", + "type": "t_contract(ENS)11959" + }, + { + "astId": 15296, + "contract": "contracts/root/Root.sol:Root", + "label": "locked", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_bytes32,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(ENS)11959": { + "encoding": "inplace", + "label": "contract ENS", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_bytes32,t_bool)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/SHA1Digest.json b/solidity/dns-contracts/deployments/goerli/SHA1Digest.json new file mode 100644 index 0000000..d6d50a4 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/SHA1Digest.json @@ -0,0 +1,77 @@ +{ + "address": "0x557e4f99f30916108a7bE7DDa6AF8Df935dBF179", + "transactionHash": "0x11339a2c0d1ce3cf4764200e808bb8ceb507692a77bbd970d662150e20fe0b05", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x11339a2c0d1ce3cf4764200e808bb8ceb507692a77bbd970d662150e20fe0b05", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x557e4f99f30916108a7bE7DDa6AF8Df935dBF179", + "transactionIndex": 4, + "gasUsed": "536878", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x53b3b11045279e2fc321a5adbc8191e1f685067c1cbbbfee38d7142052824fa8", + "transactionHash": "0x11339a2c0d1ce3cf4764200e808bb8ceb507692a77bbd970d662150e20fe0b05", + "logs": [], + "blockNumber": 6470034, + "cumulativeGasUsed": "801133", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "7948b60c3b601df824761a337a51d661", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC SHA1 digest.\",\"kind\":\"dev\",\"methods\":{\"verify(bytes,bytes)\":{\"details\":\"Verifies a cryptographic hash.\",\"params\":{\"data\":\"The data to hash.\",\"hash\":\"The hash to compare to.\"},\"returns\":{\"_0\":\"True iff the hashed data matches the provided hash value.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/digests/SHA1Digest.sol\":\"SHA1Digest\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@ensdomains/solsha1/contracts/SHA1.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary SHA1 {\\n event Debug(bytes32 x);\\n\\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\\n assembly {\\n // Get a safe scratch location\\n let scratch := mload(0x40)\\n\\n // Get the data length, and point data at the first byte\\n let len := mload(data)\\n data := add(data, 32)\\n\\n // Find the length after padding\\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\\n switch lt(sub(totallen, len), 9)\\n case 1 { totallen := add(totallen, 64) }\\n\\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\\n\\n function readword(ptr, off, count) -> result {\\n result := 0\\n if lt(off, count) {\\n result := mload(add(ptr, off))\\n count := sub(count, off)\\n if lt(count, 32) {\\n let mask := not(sub(exp(256, sub(32, count)), 1))\\n result := and(result, mask)\\n }\\n }\\n }\\n\\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\\n mstore(scratch, readword(data, i, len))\\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\\n\\n // If we loaded the last byte, store the terminator byte\\n switch lt(sub(len, i), 64)\\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\\n\\n // If this is the last block, store the length\\n switch eq(i, sub(totallen, 64))\\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\\n\\n // Expand the 16 32-bit words into 80\\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\\n mstore(add(scratch, j), temp)\\n }\\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\\n mstore(add(scratch, j), temp)\\n }\\n\\n let x := h\\n let f := 0\\n let k := 0\\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\\n switch div(j, 20)\\n case 0 {\\n // f = d xor (b and (c xor d))\\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\\n f := and(div(x, 0x1000000000000000000000000000000), f)\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x5A827999\\n }\\n case 1{\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x6ED9EBA1\\n }\\n case 2 {\\n // f = (b and c) or (d and (b or c))\\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := and(div(x, 0x10000000000), f)\\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\\n k := 0x8F1BBCDC\\n }\\n case 3 {\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0xCA62C1D6\\n }\\n // temp = (a leftrotate 5) + f + e + k + w[i]\\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\\n temp := add(f, temp)\\n temp := add(and(x, 0xFFFFFFFF), temp)\\n temp := add(k, temp)\\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\\n }\\n\\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\\n }\\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x746d9b85de197afbc13182cbe4ba4f7917f19594e07c655d6a0c85fdf7460a8a\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\\n uint shortest = len;\\n if (otherlen < len)\\n shortest = otherlen;\\n\\n uint selfptr;\\n uint otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint idx = 0; idx < shortest; idx += 32) {\\n uint a;\\n uint b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint mask;\\n if (shortest > 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\\n }\\n int diff = int(a & mask) - int(b & mask);\\n if (diff != 0)\\n return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int(len) - int(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\\n return self.length == other.length && equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint dest, uint src, uint len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint dest;\\n uint src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\\n require(len <= 52);\\n\\n uint ret = 0;\\n uint8 decoded;\\n for(uint i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if(i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint bitlen = len * 5;\\n if(len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if(len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if(len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if(len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if(len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n}\",\"keccak256\":\"0x83315df2e54c74451577c70da2c267c3459802b08b9aeec6516302eee70f796e\"},\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev An interface for contracts implementing a DNSSEC digest.\\n*/\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(bytes calldata data, bytes calldata hash) external virtual pure returns (bool);\\n}\\n\",\"keccak256\":\"0x259720cef78c019d38b908bc7dd524f087c58d8c40792cebcdd4e982c628bc9a\"},\"contracts/dnssec-oracle/digests/SHA1Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Digest.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"@ensdomains/solsha1/contracts/SHA1.sol\\\";\\n\\n/**\\n* @dev Implements the DNSSEC SHA1 digest.\\n*/\\ncontract SHA1Digest is Digest {\\n using BytesUtils for *;\\n\\n function verify(bytes calldata data, bytes calldata hash) external override pure returns (bool) {\\n require(hash.length == 20, \\\"Invalid sha1 hash length\\\");\\n bytes32 expected = hash.readBytes20(0);\\n bytes20 computed = SHA1.sha1(data);\\n return expected == computed;\\n }\\n}\\n\",\"keccak256\":\"0xe22a081f2622e2bf3e532dba60c18d01914db3945767362be9b504b07c0c9e1d\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506108d7806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004361003e3660046107fb565b610057565b604051901515815260200160405180910390f35b6000601482146100c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e76616c696420736861312068617368206c656e6774680000000000000000604482015260640160405180910390fd5b600061010d600085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061018f9050565b6bffffffffffffffffffffffff19169050600061015f87878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101d592505050565b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016919091149695505050505050565b815160009061019f836014610864565b11156101aa57600080fd5b5001602001517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001690565b60006040518251602084019350604067ffffffffffffffc0600183011601600982820310600181146102065761020d565b6040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f061027e565b60008383101561027757508082015192829003926020841015610277577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60208590036101000a0119165b9392505050565b60005b828110156107345761029484828961022c565b85526102a484602083018961022c565b6020860152604081850310600181146102bc576102c5565b60808286038701535b50604083038114600181146102d9576102e7565b602086018051600887021790525b5060405b60808110156103e7578581017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08101517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc88201517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08301517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff48401516002911891909218189081027ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe1663800000009091047c010000000100000001000000010000000100000001000000010000000116179052600c016102eb565b5060805b6101408110156104e8578581017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808101517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff908201517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08301517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe88401516004911891909218189081027ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc1663400000009091047c0300000003000000030000000300000003000000030000000300000003161790526018016103eb565b508160008060005b605081101561070a57601481048015610520576001811461055c576002811461059657600381146105d55761060b565b6501000000000085046a0100000000000000000000860481186f01000000000000000000000000000000870416189350635a827999925061060b565b6501000000000085046f0100000000000000000000000000000086046a0100000000000000000000870418189350636ed9eba1925061060b565b6a010000000000000000000085046f010000000000000000000000000000008604818117650100000000008804169116179350638f1bbcdc925061060b565b6501000000000085046f0100000000000000000000000000000086046a010000000000000000000087041818935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c015104019050740100000000000000000000000000000000000000008102650100000000008604179450506a0100000000000000000000633fffffff6a040000000000000000000086041663c00000006604000000000000870416170277ffffffff00ffffffff000000000000ffffffff00ffffffff85161793506001810190506104f0565b5050509190910177ffffffff00ffffffff00ffffffff00ffffffff00ffffffff1690604001610281565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b60008083601f8401126107c5578182fd5b50813567ffffffffffffffff8111156107dc578182fd5b6020830191508360208285010111156107f457600080fd5b9250929050565b60008060008060408587031215610810578384fd5b843567ffffffffffffffff80821115610827578586fd5b610833888389016107b4565b9096509450602087013591508082111561084b578384fd5b50610858878288016107b4565b95989497509550505050565b6000821982111561089c577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b50019056fea2646970667358221220c406678cb7287893e44e528a42b06d6def8d64c2c31909fed03330c09e36384764736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004361003e3660046107fb565b610057565b604051901515815260200160405180910390f35b6000601482146100c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e76616c696420736861312068617368206c656e6774680000000000000000604482015260640160405180910390fd5b600061010d600085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061018f9050565b6bffffffffffffffffffffffff19169050600061015f87878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101d592505050565b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016919091149695505050505050565b815160009061019f836014610864565b11156101aa57600080fd5b5001602001517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001690565b60006040518251602084019350604067ffffffffffffffc0600183011601600982820310600181146102065761020d565b6040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f061027e565b60008383101561027757508082015192829003926020841015610277577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60208590036101000a0119165b9392505050565b60005b828110156107345761029484828961022c565b85526102a484602083018961022c565b6020860152604081850310600181146102bc576102c5565b60808286038701535b50604083038114600181146102d9576102e7565b602086018051600887021790525b5060405b60808110156103e7578581017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08101517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc88201517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08301517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff48401516002911891909218189081027ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe1663800000009091047c010000000100000001000000010000000100000001000000010000000116179052600c016102eb565b5060805b6101408110156104e8578581017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808101517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff908201517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08301517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe88401516004911891909218189081027ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc1663400000009091047c0300000003000000030000000300000003000000030000000300000003161790526018016103eb565b508160008060005b605081101561070a57601481048015610520576001811461055c576002811461059657600381146105d55761060b565b6501000000000085046a0100000000000000000000860481186f01000000000000000000000000000000870416189350635a827999925061060b565b6501000000000085046f0100000000000000000000000000000086046a0100000000000000000000870418189350636ed9eba1925061060b565b6a010000000000000000000085046f010000000000000000000000000000008604818117650100000000008804169116179350638f1bbcdc925061060b565b6501000000000085046f0100000000000000000000000000000086046a010000000000000000000087041818935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c015104019050740100000000000000000000000000000000000000008102650100000000008604179450506a0100000000000000000000633fffffff6a040000000000000000000086041663c00000006604000000000000870416170277ffffffff00ffffffff000000000000ffffffff00ffffffff85161793506001810190506104f0565b5050509190910177ffffffff00ffffffff00ffffffff00ffffffff00ffffffff1690604001610281565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b60008083601f8401126107c5578182fd5b50813567ffffffffffffffff8111156107dc578182fd5b6020830191508360208285010111156107f457600080fd5b9250929050565b60008060008060408587031215610810578384fd5b843567ffffffffffffffff80821115610827578586fd5b610833888389016107b4565b9096509450602087013591508082111561084b578384fd5b50610858878288016107b4565b95989497509550505050565b6000821982111561089c577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b50019056fea2646970667358221220c406678cb7287893e44e528a42b06d6def8d64c2c31909fed03330c09e36384764736f6c63430008040033", + "devdoc": { + "details": "Implements the DNSSEC SHA1 digest.", + "kind": "dev", + "methods": { + "verify(bytes,bytes)": { + "details": "Verifies a cryptographic hash.", + "params": { + "data": "The data to hash.", + "hash": "The hash to compare to." + }, + "returns": { + "_0": "True iff the hashed data matches the provided hash value." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/SHA1NSEC3Digest.json b/solidity/dns-contracts/deployments/goerli/SHA1NSEC3Digest.json new file mode 100644 index 0000000..8a4e911 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/SHA1NSEC3Digest.json @@ -0,0 +1,83 @@ +{ + "address": "0x7C423BB94844E734d347d794C88057cf0C68c321", + "transactionHash": "0x84f62b5a276f40a7e033ff6cbd110b0486ce10e7bc2695fac30f5010c46db7d8", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "salt", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "iterations", + "type": "uint256" + } + ], + "name": "hash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x84f62b5a276f40a7e033ff6cbd110b0486ce10e7bc2695fac30f5010c46db7d8", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x7C423BB94844E734d347d794C88057cf0C68c321", + "transactionIndex": 3, + "gasUsed": "752907", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x24123b63dd143f6ff63df1746b2cafacb0c8f32f76170b781ca9e30c9105f049", + "transactionHash": "0x84f62b5a276f40a7e033ff6cbd110b0486ce10e7bc2695fac30f5010c46db7d8", + "logs": [], + "blockNumber": 6470039, + "cumulativeGasUsed": "1093773", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "7948b60c3b601df824761a337a51d661", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"salt\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"iterations\",\"type\":\"uint256\"}],\"name\":\"hash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC iterated SHA1 digest used for NSEC3 records.\",\"kind\":\"dev\",\"methods\":{\"hash(bytes,bytes,uint256)\":{\"details\":\"Performs an NSEC3 iterated hash.\",\"params\":{\"data\":\"The data to hash.\",\"iterations\":\"The number of iterations to perform.\",\"salt\":\"The salt value to use on each iteration.\"},\"returns\":{\"_0\":\"The result of the iterated hash operation.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/nsec3digests/SHA1NSEC3Digest.sol\":\"SHA1NSEC3Digest\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for writing to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n mstore(0x40, add(32, add(ptr, capacity)))\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n function max(uint a, uint b) private pure returns(uint) {\\n if (a > b) {\\n return a;\\n }\\n return b;\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The start offset to write to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n if (off + len > buf.capacity) {\\n resize(buf, max(buf.capacity, len + off) * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(add(len, off), buflen) {\\n mstore(bufptr, add(len, off))\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, len);\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, data.length);\\n }\\n\\n /**\\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write the byte at.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\\n if (off >= buf.capacity) {\\n resize(buf, buf.capacity * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if eq(off, buflen) {\\n mstore(bufptr, add(buflen, 1))\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n return writeUint8(buf, buf.buf.length, data);\\n }\\n\\n /**\\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\\n if (len + off > buf.capacity) {\\n resize(buf, (len + off) * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off + len\\n let dest := add(add(bufptr, off), len)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(add(off, len), mload(bufptr)) {\\n mstore(bufptr, add(off, len))\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\\n return write(buf, off, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, 32);\\n }\\n\\n /**\\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\\n if (len + off > buf.capacity) {\\n resize(buf, (len + off) * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + off + sizeof(buffer length) + len\\n let dest := add(add(bufptr, off), len)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(add(off, len), mload(bufptr)) {\\n mstore(bufptr, add(off, len))\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n return writeInt(buf, buf.buf.length, data, len);\\n }\\n}\\n\",\"keccak256\":\"0x18e42be1a3e4f7b4442d7ab0b524af5e09163503439954faf0ab3792cce91caa\"},\"contracts/dnssec-oracle/SHA1.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary SHA1 {\\n event Debug(bytes32 x);\\n\\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\\n assembly {\\n // Get a safe scratch location\\n let scratch := mload(0x40)\\n\\n // Get the data length, and point data at the first byte\\n let len := mload(data)\\n data := add(data, 32)\\n\\n // Find the length after padding\\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\\n switch lt(sub(totallen, len), 9)\\n case 1 { totallen := add(totallen, 64) }\\n\\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\\n\\n function readword(ptr, off, count) -> result {\\n result := 0\\n if lt(off, count) {\\n result := mload(add(ptr, off))\\n count := sub(count, off)\\n if lt(count, 32) {\\n let mask := not(sub(exp(256, sub(32, count)), 1))\\n result := and(result, mask)\\n }\\n }\\n }\\n\\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\\n mstore(scratch, readword(data, i, len))\\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\\n\\n // If we loaded the last byte, store the terminator byte\\n switch lt(sub(len, i), 64)\\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\\n\\n // If this is the last block, store the length\\n switch eq(i, sub(totallen, 64))\\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\\n\\n // Expand the 16 32-bit words into 80\\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\\n mstore(add(scratch, j), temp)\\n }\\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\\n mstore(add(scratch, j), temp)\\n }\\n\\n let x := h\\n let f := 0\\n let k := 0\\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\\n switch div(j, 20)\\n case 0 {\\n // f = d xor (b and (c xor d))\\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\\n f := and(div(x, 0x1000000000000000000000000000000), f)\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x5A827999\\n }\\n case 1{\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x6ED9EBA1\\n }\\n case 2 {\\n // f = (b and c) or (d and (b or c))\\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := and(div(x, 0x10000000000), f)\\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\\n k := 0x8F1BBCDC\\n }\\n case 3 {\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0xCA62C1D6\\n }\\n // temp = (a leftrotate 5) + f + e + k + w[i]\\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\\n temp := add(f, temp)\\n temp := add(and(x, 0xFFFFFFFF), temp)\\n temp := add(k, temp)\\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\\n }\\n\\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\\n }\\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\\n }\\n }\\n}\",\"keccak256\":\"0x43d6fc9dfba44bcc5d696ac24d8e1b90355942b41c8324ea31dce1ebfce82263\"},\"contracts/dnssec-oracle/nsec3digests/NSEC3Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev Interface for contracts that implement NSEC3 digest algorithms.\\n */\\ninterface NSEC3Digest {\\n /**\\n * @dev Performs an NSEC3 iterated hash.\\n * @param salt The salt value to use on each iteration.\\n * @param data The data to hash.\\n * @param iterations The number of iterations to perform.\\n * @return The result of the iterated hash operation.\\n */\\n function hash(bytes calldata salt, bytes calldata data, uint iterations) external virtual pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0xb3b61aee6bb472158b7ace6b5644dcb668271296b98a6dcde24dc72e3cdf4950\"},\"contracts/dnssec-oracle/nsec3digests/SHA1NSEC3Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./NSEC3Digest.sol\\\";\\nimport \\\"../SHA1.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n/**\\n* @dev Implements the DNSSEC iterated SHA1 digest used for NSEC3 records.\\n*/\\ncontract SHA1NSEC3Digest is NSEC3Digest {\\n using Buffer for Buffer.buffer;\\n\\n function hash(bytes calldata salt, bytes calldata data, uint iterations) external override pure returns (bytes32) {\\n Buffer.buffer memory buf;\\n buf.init(salt.length + data.length + 16);\\n\\n buf.append(data);\\n buf.append(salt);\\n bytes20 h = SHA1.sha1(buf.buf);\\n if (iterations > 0) {\\n buf.truncate();\\n buf.appendBytes20(bytes20(0));\\n buf.append(salt);\\n\\n for (uint i = 0; i < iterations; i++) {\\n buf.writeBytes20(0, h);\\n h = SHA1.sha1(buf.buf);\\n }\\n }\\n\\n return bytes32(h);\\n }\\n}\\n\",\"keccak256\":\"0x2255d276d74fa236875f6cddd3061ce07189f84acd04538d002dbaa78daa48a0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610cc0806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806368f9dab214610030575b600080fd5b61004361003e366004610b0c565b610055565b60405190815260200160405180910390f35b6000610074604051806040016040528060608152602001600081525090565b6100936100818588610b7d565b61008c906010610b7d565b8290610201565b506100d685858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250859392505061026c9050565b5061011987878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250859392505061026c9050565b506000610129826000015161029a565b905083156101d457604080518082019091526060815260006020909101819052825152610157826000610878565b5061019a88888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869392505061026c9050565b5060005b848110156101d2576101b2836000846108c0565b5082516101be9061029a565b9150806101ca81610be9565b91505061019e565b505b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016979650505050505050565b604080518082019091526060815260006020820152610221602083610c22565b1561024957610231602083610c22565b61023c906020610bd2565b6102469083610b7d565b91505b506020808301829052604080518085526000815283019091019052815b92915050565b6040805180820190915260608152600060208201526102938384600001515184855161090c565b9392505050565b60006040518251602084019350604067ffffffffffffffc0600183011601600982820310600181146102cb576102d2565b6040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f0610342565b60008383101561029357508082015192829003926020841015610293577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60208590036101000a0119169392505050565b60005b828110156107f8576103588482896102f1565b85526103688460208301896102f1565b60208601526040818503106001811461038057610389565b60808286038701535b506040830381146001811461039d576103ab565b602086018051600887021790525b5060405b60808110156104ab578581017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08101517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc88201517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08301517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff48401516002911891909218189081027ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe1663800000009091047c010000000100000001000000010000000100000001000000010000000116179052600c016103af565b5060805b6101408110156105ac578581017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808101517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff908201517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08301517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe88401516004911891909218189081027ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc1663400000009091047c0300000003000000030000000300000003000000030000000300000003161790526018016104af565b508160008060005b60508110156107ce576014810480156105e45760018114610620576002811461065a5760038114610699576106cf565b6501000000000085046a0100000000000000000000860481186f01000000000000000000000000000000870416189350635a82799992506106cf565b6501000000000085046f0100000000000000000000000000000086046a0100000000000000000000870418189350636ed9eba192506106cf565b6a010000000000000000000085046f010000000000000000000000000000008604818117650100000000008804169116179350638f1bbcdc92506106cf565b6501000000000085046f0100000000000000000000000000000086046a010000000000000000000087041818935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c015104019050740100000000000000000000000000000000000000008102650100000000008604179450506a0100000000000000000000633fffffff6a040000000000000000000086041663c00000006604000000000000870416170277ffffffff00ffffffff000000000000ffffffff00ffffffff85161793506001810190506105b4565b5050509190910177ffffffff00ffffffff00ffffffff00ffffffff00ffffffff1690604001610345565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b6040805180820190915260608152600060208201528251516102939084907fffffffffffffffffffffffffffffffffffffffff00000000000000000000000085166014610a14565b60408051808201909152606081526000602082015261090484847fffffffffffffffffffffffffffffffffffffffff00000000000000000000000085166014610a14565b949350505050565b604080518082019091526060815260006020820152825182111561092f57600080fd5b602085015161093e8386610b7d565b111561097157610971856109618760200151878661095c9190610b7d565b610a91565b61096c906002610b95565b610aa8565b6000808651805187602083010193508088870111156109905787860182525b505050602084015b602084106109d057805182526109af602083610b7d565b91506109bc602082610b7d565b90506109c9602085610bd2565b9350610998565b5181517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60208690036101000a019081169019919091161790525083949350505050565b6040805180820190915260608152600060208201526020850151610a388584610b7d565b1115610a4c57610a4c856109618685610b7d565b60006001836101000a0390508260200360080284901c9350855183868201018583198251161781525080518487011115610a865783860181525b509495945050505050565b600081831115610aa2575081610266565b50919050565b8151610ab48383610201565b50610abf838261026c565b50505050565b60008083601f840112610ad6578182fd5b50813567ffffffffffffffff811115610aed578182fd5b602083019150836020828501011115610b0557600080fd5b9250929050565b600080600080600060608688031215610b23578081fd5b853567ffffffffffffffff80821115610b3a578283fd5b610b4689838a01610ac5565b90975095506020880135915080821115610b5e578283fd5b50610b6b88828901610ac5565b96999598509660400135949350505050565b60008219821115610b9057610b90610c5b565b500190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610bcd57610bcd610c5b565b500290565b600082821015610be457610be4610c5b565b500390565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610c1b57610c1b610c5b565b5060010190565b600082610c56577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220f9230d749a560593daff603192dce8817520fd5067f9ea2e1c29b8e417fbd94564736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c806368f9dab214610030575b600080fd5b61004361003e366004610b0c565b610055565b60405190815260200160405180910390f35b6000610074604051806040016040528060608152602001600081525090565b6100936100818588610b7d565b61008c906010610b7d565b8290610201565b506100d685858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250859392505061026c9050565b5061011987878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250859392505061026c9050565b506000610129826000015161029a565b905083156101d457604080518082019091526060815260006020909101819052825152610157826000610878565b5061019a88888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869392505061026c9050565b5060005b848110156101d2576101b2836000846108c0565b5082516101be9061029a565b9150806101ca81610be9565b91505061019e565b505b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016979650505050505050565b604080518082019091526060815260006020820152610221602083610c22565b1561024957610231602083610c22565b61023c906020610bd2565b6102469083610b7d565b91505b506020808301829052604080518085526000815283019091019052815b92915050565b6040805180820190915260608152600060208201526102938384600001515184855161090c565b9392505050565b60006040518251602084019350604067ffffffffffffffc0600183011601600982820310600181146102cb576102d2565b6040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f0610342565b60008383101561029357508082015192829003926020841015610293577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60208590036101000a0119169392505050565b60005b828110156107f8576103588482896102f1565b85526103688460208301896102f1565b60208601526040818503106001811461038057610389565b60808286038701535b506040830381146001811461039d576103ab565b602086018051600887021790525b5060405b60808110156104ab578581017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08101517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc88201517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08301517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff48401516002911891909218189081027ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe1663800000009091047c010000000100000001000000010000000100000001000000010000000116179052600c016103af565b5060805b6101408110156105ac578581017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808101517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff908201517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08301517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe88401516004911891909218189081027ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc1663400000009091047c0300000003000000030000000300000003000000030000000300000003161790526018016104af565b508160008060005b60508110156107ce576014810480156105e45760018114610620576002811461065a5760038114610699576106cf565b6501000000000085046a0100000000000000000000860481186f01000000000000000000000000000000870416189350635a82799992506106cf565b6501000000000085046f0100000000000000000000000000000086046a0100000000000000000000870418189350636ed9eba192506106cf565b6a010000000000000000000085046f010000000000000000000000000000008604818117650100000000008804169116179350638f1bbcdc92506106cf565b6501000000000085046f0100000000000000000000000000000086046a010000000000000000000087041818935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c015104019050740100000000000000000000000000000000000000008102650100000000008604179450506a0100000000000000000000633fffffff6a040000000000000000000086041663c00000006604000000000000870416170277ffffffff00ffffffff000000000000ffffffff00ffffffff85161793506001810190506105b4565b5050509190910177ffffffff00ffffffff00ffffffff00ffffffff00ffffffff1690604001610345565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b6040805180820190915260608152600060208201528251516102939084907fffffffffffffffffffffffffffffffffffffffff00000000000000000000000085166014610a14565b60408051808201909152606081526000602082015261090484847fffffffffffffffffffffffffffffffffffffffff00000000000000000000000085166014610a14565b949350505050565b604080518082019091526060815260006020820152825182111561092f57600080fd5b602085015161093e8386610b7d565b111561097157610971856109618760200151878661095c9190610b7d565b610a91565b61096c906002610b95565b610aa8565b6000808651805187602083010193508088870111156109905787860182525b505050602084015b602084106109d057805182526109af602083610b7d565b91506109bc602082610b7d565b90506109c9602085610bd2565b9350610998565b5181517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60208690036101000a019081169019919091161790525083949350505050565b6040805180820190915260608152600060208201526020850151610a388584610b7d565b1115610a4c57610a4c856109618685610b7d565b60006001836101000a0390508260200360080284901c9350855183868201018583198251161781525080518487011115610a865783860181525b509495945050505050565b600081831115610aa2575081610266565b50919050565b8151610ab48383610201565b50610abf838261026c565b50505050565b60008083601f840112610ad6578182fd5b50813567ffffffffffffffff811115610aed578182fd5b602083019150836020828501011115610b0557600080fd5b9250929050565b600080600080600060608688031215610b23578081fd5b853567ffffffffffffffff80821115610b3a578283fd5b610b4689838a01610ac5565b90975095506020880135915080821115610b5e578283fd5b50610b6b88828901610ac5565b96999598509660400135949350505050565b60008219821115610b9057610b90610c5b565b500190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610bcd57610bcd610c5b565b500290565b600082821015610be457610be4610c5b565b500390565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610c1b57610c1b610c5b565b5060010190565b600082610c56577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220f9230d749a560593daff603192dce8817520fd5067f9ea2e1c29b8e417fbd94564736f6c63430008040033", + "devdoc": { + "details": "Implements the DNSSEC iterated SHA1 digest used for NSEC3 records.", + "kind": "dev", + "methods": { + "hash(bytes,bytes,uint256)": { + "details": "Performs an NSEC3 iterated hash.", + "params": { + "data": "The data to hash.", + "iterations": "The number of iterations to perform.", + "salt": "The salt value to use on each iteration." + }, + "returns": { + "_0": "The result of the iterated hash operation." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/SHA256Digest.json b/solidity/dns-contracts/deployments/goerli/SHA256Digest.json new file mode 100644 index 0000000..a340d88 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/SHA256Digest.json @@ -0,0 +1,77 @@ +{ + "address": "0x489197C8a154874E3b4B4F3794f3C99b71B3Ab63", + "transactionHash": "0xce6341b5642a85f270f24425da6923806da0ef9f9d526845ba398af6e2980c63", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0xce6341b5642a85f270f24425da6923806da0ef9f9d526845ba398af6e2980c63", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x489197C8a154874E3b4B4F3794f3C99b71B3Ab63", + "transactionIndex": 16, + "gasUsed": "209402", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xc8fcd0d424bf8c9680685c2866eda09e7723b229632203af832ca1992d5d6fa1", + "transactionHash": "0xce6341b5642a85f270f24425da6923806da0ef9f9d526845ba398af6e2980c63", + "logs": [], + "blockNumber": 6470036, + "cumulativeGasUsed": "4502372", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "7948b60c3b601df824761a337a51d661", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC SHA256 digest.\",\"kind\":\"dev\",\"methods\":{\"verify(bytes,bytes)\":{\"details\":\"Verifies a cryptographic hash.\",\"params\":{\"data\":\"The data to hash.\",\"hash\":\"The hash to compare to.\"},\"returns\":{\"_0\":\"True iff the hashed data matches the provided hash value.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/digests/SHA256Digest.sol\":\"SHA256Digest\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\\n uint shortest = len;\\n if (otherlen < len)\\n shortest = otherlen;\\n\\n uint selfptr;\\n uint otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint idx = 0; idx < shortest; idx += 32) {\\n uint a;\\n uint b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint mask;\\n if (shortest > 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\\n }\\n int diff = int(a & mask) - int(b & mask);\\n if (diff != 0)\\n return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int(len) - int(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\\n return self.length == other.length && equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint dest, uint src, uint len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint dest;\\n uint src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\\n require(len <= 52);\\n\\n uint ret = 0;\\n uint8 decoded;\\n for(uint i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if(i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint bitlen = len * 5;\\n if(len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if(len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if(len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if(len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if(len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n}\",\"keccak256\":\"0x83315df2e54c74451577c70da2c267c3459802b08b9aeec6516302eee70f796e\"},\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev An interface for contracts implementing a DNSSEC digest.\\n*/\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(bytes calldata data, bytes calldata hash) external virtual pure returns (bool);\\n}\\n\",\"keccak256\":\"0x259720cef78c019d38b908bc7dd524f087c58d8c40792cebcdd4e982c628bc9a\"},\"contracts/dnssec-oracle/digests/SHA256Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Digest.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\n\\n/**\\n* @dev Implements the DNSSEC SHA256 digest.\\n*/\\ncontract SHA256Digest is Digest {\\n using BytesUtils for *;\\n\\n function verify(bytes calldata data, bytes calldata hash) external override pure returns (bool) {\\n require(hash.length == 32, \\\"Invalid sha256 hash length\\\");\\n return sha256(data) == hash.readBytes32(0);\\n }\\n}\\n\",\"keccak256\":\"0xd4661871bc8d4ddd7186631d1126693ea0b5c435e4b0c793b1c3ffbcc426f4dd\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506102d6806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004361003e3660046101ea565b610057565b604051901515815260200160405180910390f35b6000602082146100c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f496e76616c6964207368613235362068617368206c656e677468000000000000604482015260640160405180910390fd5b61010b600084848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506101679050565b6002868660405161011d929190610253565b602060405180830381855afa15801561013a573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061015d91906101d2565b1495945050505050565b8151600090610177836020610263565b111561018257600080fd5b50016020015190565b60008083601f84011261019c578182fd5b50813567ffffffffffffffff8111156101b3578182fd5b6020830191508360208285010111156101cb57600080fd5b9250929050565b6000602082840312156101e3578081fd5b5051919050565b600080600080604085870312156101ff578283fd5b843567ffffffffffffffff80821115610216578485fd5b6102228883890161018b565b9096509450602087013591508082111561023a578384fd5b506102478782880161018b565b95989497509550505050565b8183823760009101908152919050565b6000821982111561029b577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b50019056fea26469706673582212203051cc7fb887b402236ea99f1be5b5a7c267481805c4f4215f88af1c2df6596964736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004361003e3660046101ea565b610057565b604051901515815260200160405180910390f35b6000602082146100c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f496e76616c6964207368613235362068617368206c656e677468000000000000604482015260640160405180910390fd5b61010b600084848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506101679050565b6002868660405161011d929190610253565b602060405180830381855afa15801561013a573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061015d91906101d2565b1495945050505050565b8151600090610177836020610263565b111561018257600080fd5b50016020015190565b60008083601f84011261019c578182fd5b50813567ffffffffffffffff8111156101b3578182fd5b6020830191508360208285010111156101cb57600080fd5b9250929050565b6000602082840312156101e3578081fd5b5051919050565b600080600080604085870312156101ff578283fd5b843567ffffffffffffffff80821115610216578485fd5b6102228883890161018b565b9096509450602087013591508082111561023a578384fd5b506102478782880161018b565b95989497509550505050565b8183823760009101908152919050565b6000821982111561029b577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b50019056fea26469706673582212203051cc7fb887b402236ea99f1be5b5a7c267481805c4f4215f88af1c2df6596964736f6c63430008040033", + "devdoc": { + "details": "Implements the DNSSEC SHA256 digest.", + "kind": "dev", + "methods": { + "verify(bytes,bytes)": { + "details": "Verifies a cryptographic hash.", + "params": { + "data": "The data to hash.", + "hash": "The hash to compare to." + }, + "returns": { + "_0": "True iff the hashed data matches the provided hash value." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/StaticBulkRenewal.json b/solidity/dns-contracts/deployments/goerli/StaticBulkRenewal.json new file mode 100644 index 0000000..ad078b9 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/StaticBulkRenewal.json @@ -0,0 +1,130 @@ +{ + "address": "0xeA64C81d0d718620daBC02D61f3B255C641f475F", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ETHRegistrarController", + "name": "_controller", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "names", + "type": "string[]" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renewAll", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "names", + "type": "string[]" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "rentPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "total", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x56fa588d7fc3b239047f1dae2a2f5f0399551e3f4a75ef5619e39135a73a3959", + "receipt": { + "to": null, + "from": "0x69420f05A11f617B4B74fFe2E04B2D300dFA556F", + "contractAddress": "0xeA64C81d0d718620daBC02D61f3B255C641f475F", + "transactionIndex": 21, + "gasUsed": "396872", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x4267ea92ec17d87149f0190c6bda68f21bcb9cc3f4a1b464359d5304217bf6bd", + "transactionHash": "0x56fa588d7fc3b239047f1dae2a2f5f0399551e3f4a75ef5619e39135a73a3959", + "logs": [], + "blockNumber": 8886147, + "cumulativeGasUsed": "9374125", + "status": 1, + "byzantium": true + }, + "args": [ + "0xCc5e7dB10E65EED1BBD105359e7268aa660f6734" + ], + "numDeployments": 1, + "solcInputHash": "ad37cc3cd3f1925923b5003f9803ae69", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ETHRegistrarController\",\"name\":\"_controller\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"names\",\"type\":\"string[]\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"renewAll\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"names\",\"type\":\"string[]\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"rentPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/StaticBulkRenewal.sol\":\"StaticBulkRenewal\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1300},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6392f2cfe3a5ee802227fe7a2dfd47096d881aec89bddd214b35c5b46d3cd941\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/ERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721.sol\\\";\\nimport \\\"./IERC721Receiver.sol\\\";\\nimport \\\"./extensions/IERC721Metadata.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\nimport \\\"../../utils/Strings.sol\\\";\\nimport \\\"../../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\n * {ERC721Enumerable}.\\n */\\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\\n using Address for address;\\n using Strings for uint256;\\n\\n // Token name\\n string private _name;\\n\\n // Token symbol\\n string private _symbol;\\n\\n // Mapping from token ID to owner address\\n mapping(uint256 => address) private _owners;\\n\\n // Mapping owner address to token count\\n mapping(address => uint256) private _balances;\\n\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) private _tokenApprovals;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IERC721).interfaceId ||\\n interfaceId == type(IERC721Metadata).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721-balanceOf}.\\n */\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\n return _balances[owner];\\n }\\n\\n /**\\n * @dev See {IERC721-ownerOf}.\\n */\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\n address owner = _ownerOf(tokenId);\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n _requireMinted(tokenId);\\n\\n string memory baseURI = _baseURI();\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\n }\\n\\n /**\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\n * by default, can be overridden in child contracts.\\n */\\n function _baseURI() internal view virtual returns (string memory) {\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual override {\\n address owner = ERC721.ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\n _requireMinted(tokenId);\\n\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC721-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC721-isApprovedForAll}.\\n */\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[owner][operator];\\n }\\n\\n /**\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n _safeTransfer(from, to, tokenId, data);\\n }\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\n *\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeTransfer(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) internal virtual {\\n _transfer(from, to, tokenId);\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n }\\n\\n /**\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\n }\\n\\n /**\\n * @dev Returns whether `tokenId` exists.\\n *\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\n *\\n * Tokens start existing when they are minted (`_mint`),\\n * and stop existing when they are burned (`_burn`).\\n */\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\n return _ownerOf(tokenId) != address(0);\\n }\\n\\n /**\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\n address owner = ERC721.ownerOf(tokenId);\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\n }\\n\\n /**\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\n _safeMint(to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\n */\\n function _safeMint(\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) internal virtual {\\n _mint(to, tokenId);\\n require(\\n _checkOnERC721Received(address(0), to, tokenId, data),\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\n );\\n }\\n\\n /**\\n * @dev Mints `tokenId` and transfers it to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - `to` cannot be the zero address.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _mint(address to, uint256 tokenId) internal virtual {\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n _beforeTokenTransfer(address(0), to, tokenId, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _burn(uint256 tokenId) internal virtual {\\n address owner = ERC721.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\n }\\n\\n /**\\n * @dev Transfers `tokenId` from `from` to `to`.\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _transfer(\\n address from,\\n address to,\\n uint256 tokenId\\n ) internal virtual {\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, tokenId, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(\\n address owner,\\n address operator,\\n bool approved\\n ) internal virtual {\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Reverts if the `tokenId` has not been minted yet.\\n */\\n function _requireMinted(uint256 tokenId) internal view virtual {\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\n }\\n\\n /**\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\n * The call is not executed if the target address is not a contract.\\n *\\n * @param from address representing the previous owner of the given token ID\\n * @param to target address that will receive the tokens\\n * @param tokenId uint256 ID of the token to be transferred\\n * @param data bytes optional data to send along with the call\\n * @return bool whether the call correctly returned the expected magic value\\n */\\n function _checkOnERC721Received(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) private returns (bool) {\\n if (to.isContract()) {\\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721Receiver.onERC721Received.selector;\\n } catch (bytes memory reason) {\\n if (reason.length == 0) {\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n } else {\\n /// @solidity memory-safe-assembly\\n assembly {\\n revert(add(32, reason), mload(reason))\\n }\\n }\\n }\\n } else {\\n return true;\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256, /* firstTokenId */\\n uint256 batchSize\\n ) internal virtual {\\n if (batchSize > 1) {\\n if (from != address(0)) {\\n _balances[from] -= batchSize;\\n }\\n if (to != address(0)) {\\n _balances[to] += batchSize;\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 firstTokenId,\\n uint256 batchSize\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0xd89f3585b211fc9e3408384a4c4efdc3a93b2f877a3821046fa01c219d35be1b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xab28a56179c1db258c9bf5235b382698cb650debecb51b23d12be9e241374b68\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721Metadata is IERC721 {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\"},\"contracts/ethregistrar/BaseRegistrarImplementation.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/ERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\\n // A map of expiry times\\n mapping(uint256 => uint256) expiries;\\n // The ENS registry\\n ENS public ens;\\n // The namehash of the TLD this registrar owns (eg, .eth)\\n bytes32 public baseNode;\\n // A map of addresses that are authorised to register and renew names.\\n mapping(address => bool) public controllers;\\n uint256 public constant GRACE_PERIOD = 90 days;\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n bytes4 private constant ERC721_ID =\\n bytes4(\\n keccak256(\\\"balanceOf(address)\\\") ^\\n keccak256(\\\"ownerOf(uint256)\\\") ^\\n keccak256(\\\"approve(address,uint256)\\\") ^\\n keccak256(\\\"getApproved(uint256)\\\") ^\\n keccak256(\\\"setApprovalForAll(address,bool)\\\") ^\\n keccak256(\\\"isApprovedForAll(address,address)\\\") ^\\n keccak256(\\\"transferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256,bytes)\\\")\\n );\\n bytes4 private constant RECLAIM_ID =\\n bytes4(keccak256(\\\"reclaim(uint256,address)\\\"));\\n\\n /**\\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\\n * @dev Returns whether the given spender can transfer a given token ID\\n * @param spender address of the spender to query\\n * @param tokenId uint256 ID of the token to be transferred\\n * @return bool whether the msg.sender is approved for the given token ID,\\n * is an operator of the owner, or is the owner of the token\\n */\\n function _isApprovedOrOwner(\\n address spender,\\n uint256 tokenId\\n ) internal view override returns (bool) {\\n address owner = ownerOf(tokenId);\\n return (spender == owner ||\\n getApproved(tokenId) == spender ||\\n isApprovedForAll(owner, spender));\\n }\\n\\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\\\"\\\", \\\"\\\") {\\n ens = _ens;\\n baseNode = _baseNode;\\n }\\n\\n modifier live() {\\n require(ens.owner(baseNode) == address(this));\\n _;\\n }\\n\\n modifier onlyController() {\\n require(controllers[msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Gets the owner of the specified token ID. Names become unowned\\n * when their registration expires.\\n * @param tokenId uint256 ID of the token to query the owner of\\n * @return address currently marked as the owner of the given token ID\\n */\\n function ownerOf(\\n uint256 tokenId\\n ) public view override(IERC721, ERC721) returns (address) {\\n require(expiries[tokenId] > block.timestamp);\\n return super.ownerOf(tokenId);\\n }\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external override onlyOwner {\\n controllers[controller] = true;\\n emit ControllerAdded(controller);\\n }\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external override onlyOwner {\\n controllers[controller] = false;\\n emit ControllerRemoved(controller);\\n }\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external override onlyOwner {\\n ens.setResolver(baseNode, resolver);\\n }\\n\\n // Returns the expiration timestamp of the specified id.\\n function nameExpires(uint256 id) external view override returns (uint256) {\\n return expiries[id];\\n }\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) public view override returns (bool) {\\n // Not available if it's registered here or in its grace period.\\n return expiries[id] + GRACE_PERIOD < block.timestamp;\\n }\\n\\n /**\\n * @dev Register a name.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external override returns (uint256) {\\n return _register(id, owner, duration, true);\\n }\\n\\n /**\\n * @dev Register a name, without modifying the registry.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function registerOnly(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256) {\\n return _register(id, owner, duration, false);\\n }\\n\\n function _register(\\n uint256 id,\\n address owner,\\n uint256 duration,\\n bool updateRegistry\\n ) internal live onlyController returns (uint256) {\\n require(available(id));\\n require(\\n block.timestamp + duration + GRACE_PERIOD >\\n block.timestamp + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] = block.timestamp + duration;\\n if (_exists(id)) {\\n // Name was previously owned, and expired\\n _burn(id);\\n }\\n _mint(owner, id);\\n if (updateRegistry) {\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n emit NameRegistered(id, owner, block.timestamp + duration);\\n\\n return block.timestamp + duration;\\n }\\n\\n function renew(\\n uint256 id,\\n uint256 duration\\n ) external override live onlyController returns (uint256) {\\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\\n require(\\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] += duration;\\n emit NameRenewed(id, expiries[id]);\\n return expiries[id];\\n }\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external override live {\\n require(_isApprovedOrOwner(msg.sender, id));\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view override(ERC721, IERC165) returns (bool) {\\n return\\n interfaceID == INTERFACE_META_ID ||\\n interfaceID == ERC721_ID ||\\n interfaceID == RECLAIM_ID;\\n }\\n}\\n\",\"keccak256\":\"0xaee6eb36aead449d397b86a02e9c63bc46e3ef378d0a62bfd68beaae1150c9d0\"},\"contracts/ethregistrar/ETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport {BaseRegistrarImplementation} from \\\"./BaseRegistrarImplementation.sol\\\";\\nimport {StringUtils} from \\\"./StringUtils.sol\\\";\\nimport {Resolver} from \\\"../resolvers/Resolver.sol\\\";\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {ReverseRegistrar} from \\\"../reverseRegistrar/ReverseRegistrar.sol\\\";\\nimport {ReverseClaimer} from \\\"../reverseRegistrar/ReverseClaimer.sol\\\";\\nimport {IETHRegistrarController, IPriceOracle} from \\\"./IETHRegistrarController.sol\\\";\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {INameWrapper} from \\\"../wrapper/INameWrapper.sol\\\";\\nimport {ERC20Recoverable} from \\\"../utils/ERC20Recoverable.sol\\\";\\n\\nerror CommitmentTooNew(bytes32 commitment);\\nerror CommitmentTooOld(bytes32 commitment);\\nerror NameNotAvailable(string name);\\nerror DurationTooShort(uint256 duration);\\nerror ResolverRequiredWhenDataSupplied();\\nerror UnexpiredCommitmentExists(bytes32 commitment);\\nerror InsufficientValue();\\nerror Unauthorised(bytes32 node);\\nerror MaxCommitmentAgeTooLow();\\nerror MaxCommitmentAgeTooHigh();\\n\\n/**\\n * @dev A registrar controller for registering and renewing names at fixed cost.\\n */\\ncontract ETHRegistrarController is\\n Ownable,\\n IETHRegistrarController,\\n IERC165,\\n ERC20Recoverable,\\n ReverseClaimer\\n{\\n using StringUtils for *;\\n using Address for address;\\n\\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\\n bytes32 private constant ETH_NODE =\\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\\n uint64 private constant MAX_EXPIRY = type(uint64).max;\\n BaseRegistrarImplementation immutable base;\\n IPriceOracle public immutable prices;\\n uint256 public immutable minCommitmentAge;\\n uint256 public immutable maxCommitmentAge;\\n ReverseRegistrar public immutable reverseRegistrar;\\n INameWrapper public immutable nameWrapper;\\n\\n mapping(bytes32 => uint256) public commitments;\\n\\n event NameRegistered(\\n string name,\\n bytes32 indexed label,\\n address indexed owner,\\n uint256 baseCost,\\n uint256 premium,\\n uint256 expires\\n );\\n event NameRenewed(\\n string name,\\n bytes32 indexed label,\\n uint256 cost,\\n uint256 expires\\n );\\n\\n constructor(\\n BaseRegistrarImplementation _base,\\n IPriceOracle _prices,\\n uint256 _minCommitmentAge,\\n uint256 _maxCommitmentAge,\\n ReverseRegistrar _reverseRegistrar,\\n INameWrapper _nameWrapper,\\n ENS _ens\\n ) ReverseClaimer(_ens, msg.sender) {\\n if (_maxCommitmentAge <= _minCommitmentAge) {\\n revert MaxCommitmentAgeTooLow();\\n }\\n\\n if (_maxCommitmentAge > block.timestamp) {\\n revert MaxCommitmentAgeTooHigh();\\n }\\n\\n base = _base;\\n prices = _prices;\\n minCommitmentAge = _minCommitmentAge;\\n maxCommitmentAge = _maxCommitmentAge;\\n reverseRegistrar = _reverseRegistrar;\\n nameWrapper = _nameWrapper;\\n }\\n\\n function rentPrice(\\n string memory name,\\n uint256 duration\\n ) public view override returns (IPriceOracle.Price memory price) {\\n bytes32 label = keccak256(bytes(name));\\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\\n }\\n\\n function valid(string memory name) public pure returns (bool) {\\n return name.strlen() >= 3;\\n }\\n\\n function available(string memory name) public view override returns (bool) {\\n bytes32 label = keccak256(bytes(name));\\n return valid(name) && base.available(uint256(label));\\n }\\n\\n function makeCommitment(\\n string memory name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] calldata data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses\\n ) public pure override returns (bytes32) {\\n bytes32 label = keccak256(bytes(name));\\n if (data.length > 0 && resolver == address(0)) {\\n revert ResolverRequiredWhenDataSupplied();\\n }\\n return\\n keccak256(\\n abi.encode(\\n label,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses\\n )\\n );\\n }\\n\\n function commit(bytes32 commitment) public override {\\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\\n revert UnexpiredCommitmentExists(commitment);\\n }\\n commitments[commitment] = block.timestamp;\\n }\\n\\n function register(\\n string calldata name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] calldata data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses\\n ) public payable override {\\n IPriceOracle.Price memory price = rentPrice(name, duration);\\n if (msg.value < price.base + price.premium) {\\n revert InsufficientValue();\\n }\\n\\n _consumeCommitment(\\n name,\\n duration,\\n makeCommitment(\\n name,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses\\n )\\n );\\n\\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\\n name,\\n owner,\\n duration,\\n resolver,\\n ownerControlledFuses\\n );\\n\\n if (data.length > 0) {\\n _setRecords(resolver, keccak256(bytes(name)), data);\\n }\\n\\n if (reverseRecord) {\\n _setReverseRecord(name, resolver, msg.sender);\\n }\\n\\n emit NameRegistered(\\n name,\\n keccak256(bytes(name)),\\n owner,\\n price.base,\\n price.premium,\\n expires\\n );\\n\\n if (msg.value > (price.base + price.premium)) {\\n payable(msg.sender).transfer(\\n msg.value - (price.base + price.premium)\\n );\\n }\\n }\\n\\n function renew(\\n string calldata name,\\n uint256 duration\\n ) external payable override {\\n bytes32 labelhash = keccak256(bytes(name));\\n uint256 tokenId = uint256(labelhash);\\n IPriceOracle.Price memory price = rentPrice(name, duration);\\n if (msg.value < price.base) {\\n revert InsufficientValue();\\n }\\n uint256 expires = nameWrapper.renew(tokenId, duration);\\n\\n if (msg.value > price.base) {\\n payable(msg.sender).transfer(msg.value - price.base);\\n }\\n\\n emit NameRenewed(name, labelhash, msg.value, expires);\\n }\\n\\n function withdraw() public {\\n payable(owner()).transfer(address(this).balance);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IETHRegistrarController).interfaceId;\\n }\\n\\n /* Internal functions */\\n\\n function _consumeCommitment(\\n string memory name,\\n uint256 duration,\\n bytes32 commitment\\n ) internal {\\n // Require an old enough commitment.\\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\\n revert CommitmentTooNew(commitment);\\n }\\n\\n // If the commitment is too old, or the name is registered, stop\\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\\n revert CommitmentTooOld(commitment);\\n }\\n if (!available(name)) {\\n revert NameNotAvailable(name);\\n }\\n\\n delete (commitments[commitment]);\\n\\n if (duration < MIN_REGISTRATION_DURATION) {\\n revert DurationTooShort(duration);\\n }\\n }\\n\\n function _setRecords(\\n address resolverAddress,\\n bytes32 label,\\n bytes[] calldata data\\n ) internal {\\n // use hardcoded .eth namehash\\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\\n Resolver resolver = Resolver(resolverAddress);\\n resolver.multicallWithNodeCheck(nodehash, data);\\n }\\n\\n function _setReverseRecord(\\n string memory name,\\n address resolver,\\n address owner\\n ) internal {\\n reverseRegistrar.setNameForAddr(\\n msg.sender,\\n owner,\\n resolver,\\n string.concat(name, \\\".eth\\\")\\n );\\n }\\n}\\n\",\"keccak256\":\"0x2ba2cab655f9128ae5c803540b8712be9bdfee1a28b9623a06c02c2435d0ce8b\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/ethregistrar/IBulkRenewal.sol\":{\"content\":\"interface IBulkRenewal {\\n function rentPrice(\\n string[] calldata names,\\n uint256 duration\\n ) external view returns (uint256 total);\\n\\n function renewAll(\\n string[] calldata names,\\n uint256 duration\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x45d72e0464af5165831210496cd293cc7ceeb7307f2bdad679f64613a6bcf029\"},\"contracts/ethregistrar/IETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./IPriceOracle.sol\\\";\\n\\ninterface IETHRegistrarController {\\n function rentPrice(\\n string memory,\\n uint256\\n ) external view returns (IPriceOracle.Price memory);\\n\\n function available(string memory) external returns (bool);\\n\\n function makeCommitment(\\n string memory,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16\\n ) external pure returns (bytes32);\\n\\n function commit(bytes32) external;\\n\\n function register(\\n string calldata,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16\\n ) external payable;\\n\\n function renew(string calldata, uint256) external payable;\\n}\\n\",\"keccak256\":\"0x54575cc2e4245c0ba79e42a58086335ec0522f4cbeb8c92d71b886593c97060e\",\"license\":\"MIT\"},\"contracts/ethregistrar/IPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\ninterface IPriceOracle {\\n struct Price {\\n uint256 base;\\n uint256 premium;\\n }\\n\\n /**\\n * @dev Returns the price to register or renew a name.\\n * @param name The name being registered or renewed.\\n * @param expires When the name presently expires (0 if this is a new registration).\\n * @param duration How long the name is being registered or extended for, in seconds.\\n * @return base premium tuple of base price + premium price\\n */\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (Price calldata);\\n}\\n\",\"keccak256\":\"0x1ec537b4c7f9cc40363b39dcc7ade8c29bf94662e6b01d38e681487637bd577e\",\"license\":\"MIT\"},\"contracts/ethregistrar/StaticBulkRenewal.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./ETHRegistrarController.sol\\\";\\nimport \\\"./IBulkRenewal.sol\\\";\\nimport \\\"./IPriceOracle.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\ncontract StaticBulkRenewal is IBulkRenewal {\\n ETHRegistrarController controller;\\n\\n constructor(ETHRegistrarController _controller) {\\n controller = _controller;\\n }\\n\\n function rentPrice(\\n string[] calldata names,\\n uint256 duration\\n ) external view override returns (uint256 total) {\\n uint256 length = names.length;\\n for (uint256 i = 0; i < length; ) {\\n IPriceOracle.Price memory price = controller.rentPrice(\\n names[i],\\n duration\\n );\\n unchecked {\\n ++i;\\n total += (price.base + price.premium);\\n }\\n }\\n }\\n\\n function renewAll(\\n string[] calldata names,\\n uint256 duration\\n ) external payable override {\\n uint256 length = names.length;\\n uint256 total;\\n for (uint256 i = 0; i < length; ) {\\n IPriceOracle.Price memory price = controller.rentPrice(\\n names[i],\\n duration\\n );\\n uint256 totalPrice = price.base + price.premium;\\n controller.renew{value: totalPrice}(names[i], duration);\\n unchecked {\\n ++i;\\n total += totalPrice;\\n }\\n }\\n // Send any excess funds back\\n payable(msg.sender).transfer(address(this).balance);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IBulkRenewal).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xa4c30f4d395dec3d252e8b9e46710fe38038cfdc3e33a3bdd0ea54e046e91f48\",\"license\":\"MIT\"},\"contracts/ethregistrar/StringUtils.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary StringUtils {\\n /**\\n * @dev Returns the length of a given string\\n *\\n * @param s The string to measure the length of\\n * @return The length of the input string\\n */\\n function strlen(string memory s) internal pure returns (uint256) {\\n uint256 len;\\n uint256 i = 0;\\n uint256 bytelength = bytes(s).length;\\n for (len = 0; i < bytelength; len++) {\\n bytes1 b = bytes(s)[i];\\n if (b < 0x80) {\\n i += 1;\\n } else if (b < 0xE0) {\\n i += 2;\\n } else if (b < 0xF0) {\\n i += 3;\\n } else if (b < 0xF8) {\\n i += 4;\\n } else if (b < 0xFC) {\\n i += 5;\\n } else {\\n i += 6;\\n }\\n }\\n return len;\\n }\\n}\\n\",\"keccak256\":\"0x4cc8363a850dc9130c433ee50e7c97e29a45ae5d9bd0808205ac7134b34f24e4\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/resolvers/Resolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"./profiles/IABIResolver.sol\\\";\\nimport \\\"./profiles/IAddressResolver.sol\\\";\\nimport \\\"./profiles/IAddrResolver.sol\\\";\\nimport \\\"./profiles/IContentHashResolver.sol\\\";\\nimport \\\"./profiles/IDNSRecordResolver.sol\\\";\\nimport \\\"./profiles/IDNSZoneResolver.sol\\\";\\nimport \\\"./profiles/IInterfaceResolver.sol\\\";\\nimport \\\"./profiles/INameResolver.sol\\\";\\nimport \\\"./profiles/IPubkeyResolver.sol\\\";\\nimport \\\"./profiles/ITextResolver.sol\\\";\\nimport \\\"./profiles/IExtendedResolver.sol\\\";\\n\\n/**\\n * A generic resolver interface which includes all the functions including the ones deprecated\\n */\\ninterface Resolver is\\n IERC165,\\n IABIResolver,\\n IAddressResolver,\\n IAddrResolver,\\n IContentHashResolver,\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n IInterfaceResolver,\\n INameResolver,\\n IPubkeyResolver,\\n ITextResolver,\\n IExtendedResolver\\n{\\n /* Deprecated events */\\n event ContentChanged(bytes32 indexed node, bytes32 hash);\\n\\n function setApprovalForAll(address, bool) external;\\n\\n function approve(bytes32 node, address delegate, bool approved) external;\\n\\n function isApprovedForAll(address account, address operator) external;\\n\\n function isApprovedFor(\\n address owner,\\n bytes32 node,\\n address delegate\\n ) external;\\n\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external;\\n\\n function setAddr(bytes32 node, address addr) external;\\n\\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\\n\\n function setContenthash(bytes32 node, bytes calldata hash) external;\\n\\n function setDnsrr(bytes32 node, bytes calldata data) external;\\n\\n function setName(bytes32 node, string calldata _name) external;\\n\\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\\n\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external;\\n\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external;\\n\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n /* Deprecated functions */\\n function content(bytes32 node) external view returns (bytes32);\\n\\n function multihash(bytes32 node) external view returns (bytes memory);\\n\\n function setContent(bytes32 node, bytes32 hash) external;\\n\\n function setMultihash(bytes32 node, bytes calldata hash) external;\\n}\\n\",\"keccak256\":\"0xfc77ab6b7c59c3ebfe1c720bdebf9b08c2488ff7ac9501a9aa056c5d6d5b50c5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseClaimer.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\n\\ncontract ReverseClaimer {\\n bytes32 constant ADDR_REVERSE_NODE =\\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n constructor(ENS ens, address claimant) {\\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\\n ens.owner(ADDR_REVERSE_NODE)\\n );\\n reverseRegistrar.claim(claimant);\\n }\\n}\\n\",\"keccak256\":\"0x78a28627241535b595f6fff476a1fa7acc90c80684fe7784734920fc8af6fc22\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/ReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IReverseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"../root/Controllable.sol\\\";\\n\\nabstract contract NameResolver {\\n function setName(bytes32 node, string memory name) public virtual;\\n}\\n\\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\\n\\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n// namehash('addr.reverse')\\n\\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\\n ENS public immutable ens;\\n NameResolver public defaultResolver;\\n\\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\\n event DefaultResolverChanged(NameResolver indexed resolver);\\n\\n /**\\n * @dev Constructor\\n * @param ensAddr The address of the ENS registry.\\n */\\n constructor(ENS ensAddr) {\\n ens = ensAddr;\\n\\n // Assign ownership of the reverse record to our deployer\\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\\n ensAddr.owner(ADDR_REVERSE_NODE)\\n );\\n if (address(oldRegistrar) != address(0x0)) {\\n oldRegistrar.claim(msg.sender);\\n }\\n }\\n\\n modifier authorised(address addr) {\\n require(\\n addr == msg.sender ||\\n controllers[msg.sender] ||\\n ens.isApprovedForAll(addr, msg.sender) ||\\n ownsContract(addr),\\n \\\"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\\\"\\n );\\n _;\\n }\\n\\n function setDefaultResolver(address resolver) public override onlyOwner {\\n require(\\n address(resolver) != address(0),\\n \\\"ReverseRegistrar: Resolver address must not be 0\\\"\\n );\\n defaultResolver = NameResolver(resolver);\\n emit DefaultResolverChanged(NameResolver(resolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claim(address owner) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, address(defaultResolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param addr The reverse record to set\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The resolver of the reverse node\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) public override authorised(addr) returns (bytes32) {\\n bytes32 labelHash = sha3HexAddress(addr);\\n bytes32 reverseNode = keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\\n );\\n emit ReverseClaimed(addr, reverseNode);\\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\\n return reverseNode;\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, resolver);\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the calling account. First updates the resolver to the default reverse\\n * resolver if necessary.\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setName(string memory name) public override returns (bytes32) {\\n return\\n setNameForAddr(\\n msg.sender,\\n msg.sender,\\n address(defaultResolver),\\n name\\n );\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the account provided. Updates the resolver to a designated resolver\\n * Only callable by controllers and authorised users\\n * @param addr The reverse record to set\\n * @param owner The owner of the reverse node\\n * @param resolver The resolver of the reverse node\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) public override returns (bytes32) {\\n bytes32 node = claimForAddr(addr, owner, resolver);\\n NameResolver(resolver).setName(node, name);\\n return node;\\n }\\n\\n /**\\n * @dev Returns the node hash for a given account's reverse records.\\n * @param addr The address to hash\\n * @return The ENS node hash.\\n */\\n function node(address addr) public pure override returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\\n );\\n }\\n\\n /**\\n * @dev An optimised function to compute the sha3 of the lower-case\\n * hexadecimal representation of an Ethereum address.\\n * @param addr The address to hash\\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\\n * input address.\\n */\\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\\n assembly {\\n for {\\n let i := 40\\n } gt(i, 0) {\\n\\n } {\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n }\\n\\n ret := keccak256(0, 40)\\n }\\n }\\n\\n function ownsContract(address addr) internal view returns (bool) {\\n try Ownable(addr).owner() returns (address owner) {\\n return owner == msg.sender;\\n } catch {\\n return false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd57d28e5791b4b44650a00f5ef6c725af53698ec33faeeaa3591f0dbd939559a\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"},\"contracts/utils/ERC20Recoverable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\\n */\\n\\ncontract ERC20Recoverable is Ownable {\\n /**\\n @notice Recover ERC20 tokens sent to the contract by mistake.\\n @dev The contract is Ownable and only the owner can call the recover function.\\n @param _to The address to send the tokens to.\\n@param _token The address of the ERC20 token to recover\\n @param _amount The amount of tokens to recover.\\n */\\n function recoverFunds(\\n address _token,\\n address _to,\\n uint256 _amount\\n ) external onlyOwner {\\n IERC20(_token).transfer(_to, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x793a38091e1f81499a29ddba82c2b2f3cdd07071b81a832886e8e02a45ff352a\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_ETH = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x70310eb67146d7290731c31841399640ac3b6a949eadc6598bc150123d185c57\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161066138038061066183398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b6105ce806100936000396000f3fe6080604052600436106100345760003560e01c806301ffc9a7146100395780633971d4671461006e578063e8d6dbb41461009c575b600080fd5b34801561004557600080fd5b506100596100543660046103b9565b6100b1565b60405190151581526020015b60405180910390f35b34801561007a57600080fd5b5061008e610089366004610402565b61014a565b604051908152602001610065565b6100af6100aa366004610402565b610218565b005b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061014457507fffffffff0000000000000000000000000000000000000000000000000000000082167fd1a70fd300000000000000000000000000000000000000000000000000000000145b92915050565b600082815b8181101561020f576000805473ffffffffffffffffffffffffffffffffffffffff166383e7f6ff8888858181106101885761018861047d565b905060200281019061019a9190610493565b886040518463ffffffff1660e01b81526004016101b9939291906104e1565b6040805180830381865afa1580156101d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f9919061051a565b602081015190510193909301925060010161014f565b50509392505050565b816000805b82811015610384576000805473ffffffffffffffffffffffffffffffffffffffff166383e7f6ff8888858181106102565761025661047d565b90506020028101906102689190610493565b886040518463ffffffff1660e01b8152600401610287939291906104e1565b6040805180830381865afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c7919061051a565b90506000816020015182600001516102df9190610577565b60005490915073ffffffffffffffffffffffffffffffffffffffff1663acf1a841828a8a878181106103135761031361047d565b90506020028101906103259190610493565b8a6040518563ffffffff1660e01b8152600401610344939291906104e1565b6000604051808303818588803b15801561035d57600080fd5b505af1158015610371573d6000803e3d6000fd5b505050919094019350505060010161021d565b5060405133904780156108fc02916000818181858888f193505050501580156103b1573d6000803e3d6000fd5b505050505050565b6000602082840312156103cb57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146103fb57600080fd5b9392505050565b60008060006040848603121561041757600080fd5b833567ffffffffffffffff8082111561042f57600080fd5b818601915086601f83011261044357600080fd5b81358181111561045257600080fd5b8760208260051b850101111561046757600080fd5b6020928301989097509590910135949350505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126104aa57600080fd5b83018035915067ffffffffffffffff8211156104c557600080fd5b6020019150368190038213156104da57600080fd5b9250929050565b604081528260408201528284606083013760006060848301015260006060601f19601f8601168301019050826020830152949350505050565b60006040828403121561052c57600080fd5b6040516040810181811067ffffffffffffffff8211171561055d57634e487b7160e01b600052604160045260246000fd5b604052825181526020928301519281019290925250919050565b8082018082111561014457634e487b7160e01b600052601160045260246000fdfea2646970667358221220f2cafb300cd283e2fd3ccc16b0f7dbcddf659bdd5da544f7c2f88ee7a2a5388f64736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106100345760003560e01c806301ffc9a7146100395780633971d4671461006e578063e8d6dbb41461009c575b600080fd5b34801561004557600080fd5b506100596100543660046103b9565b6100b1565b60405190151581526020015b60405180910390f35b34801561007a57600080fd5b5061008e610089366004610402565b61014a565b604051908152602001610065565b6100af6100aa366004610402565b610218565b005b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061014457507fffffffff0000000000000000000000000000000000000000000000000000000082167fd1a70fd300000000000000000000000000000000000000000000000000000000145b92915050565b600082815b8181101561020f576000805473ffffffffffffffffffffffffffffffffffffffff166383e7f6ff8888858181106101885761018861047d565b905060200281019061019a9190610493565b886040518463ffffffff1660e01b81526004016101b9939291906104e1565b6040805180830381865afa1580156101d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f9919061051a565b602081015190510193909301925060010161014f565b50509392505050565b816000805b82811015610384576000805473ffffffffffffffffffffffffffffffffffffffff166383e7f6ff8888858181106102565761025661047d565b90506020028101906102689190610493565b886040518463ffffffff1660e01b8152600401610287939291906104e1565b6040805180830381865afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c7919061051a565b90506000816020015182600001516102df9190610577565b60005490915073ffffffffffffffffffffffffffffffffffffffff1663acf1a841828a8a878181106103135761031361047d565b90506020028101906103259190610493565b8a6040518563ffffffff1660e01b8152600401610344939291906104e1565b6000604051808303818588803b15801561035d57600080fd5b505af1158015610371573d6000803e3d6000fd5b505050919094019350505060010161021d565b5060405133904780156108fc02916000818181858888f193505050501580156103b1573d6000803e3d6000fd5b505050505050565b6000602082840312156103cb57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146103fb57600080fd5b9392505050565b60008060006040848603121561041757600080fd5b833567ffffffffffffffff8082111561042f57600080fd5b818601915086601f83011261044357600080fd5b81358181111561045257600080fd5b8760208260051b850101111561046757600080fd5b6020928301989097509590910135949350505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126104aa57600080fd5b83018035915067ffffffffffffffff8211156104c557600080fd5b6020019150368190038213156104da57600080fd5b9250929050565b604081528260408201528284606083013760006060848301015260006060601f19601f8601168301019050826020830152949350505050565b60006040828403121561052c57600080fd5b6040516040810181811067ffffffffffffffff8211171561055d57634e487b7160e01b600052604160045260246000fd5b604052825181526020928301519281019290925250919050565b8082018082111561014457634e487b7160e01b600052601160045260246000fdfea2646970667358221220f2cafb300cd283e2fd3ccc16b0f7dbcddf659bdd5da544f7c2f88ee7a2a5388f64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 4345, + "contract": "contracts/ethregistrar/StaticBulkRenewal.sol:StaticBulkRenewal", + "label": "controller", + "offset": 0, + "slot": "0", + "type": "t_contract(ETHRegistrarController)4123" + } + ], + "types": { + "t_contract(ETHRegistrarController)4123": { + "encoding": "inplace", + "label": "contract ETHRegistrarController", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/StaticMetadataService.json b/solidity/dns-contracts/deployments/goerli/StaticMetadataService.json new file mode 100644 index 0000000..f9efe06 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/StaticMetadataService.json @@ -0,0 +1,88 @@ +{ + "address": "0x269eb6AeDeEa030B96354Bc73f0A09eae3546e23", + "abi": [ + { + "inputs": [ + { + "internalType": "string", + "name": "_metaDataUri", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "uri", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xc39668c16f609da36f62b2ebd9cc02a3b5c8ae0a1e0e72385a008d105ab7be70", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x269eb6AeDeEa030B96354Bc73f0A09eae3546e23", + "transactionIndex": 55, + "gasUsed": "233748", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xca460c6d216aad09f163d8ecc5a2e5869e532cf64572cf0eaf884d23da617c01", + "transactionHash": "0xc39668c16f609da36f62b2ebd9cc02a3b5c8ae0a1e0e72385a008d105ab7be70", + "logs": [], + "blockNumber": 8586036, + "cumulativeGasUsed": "10632379", + "status": 1, + "byzantium": true + }, + "args": [ + "ens-metadata-service.appspot.com/name/0x{id}" + ], + "numDeployments": 3, + "solcInputHash": "2813443d96b2eb882a21ada25755af03", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_metaDataUri\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/wrapper/StaticMetadataService.sol\":\"StaticMetadataService\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1500},\"remappings\":[]},\"sources\":{\"contracts/wrapper/StaticMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ncontract StaticMetadataService {\\n string private _uri;\\n\\n constructor(string memory _metaDataUri) {\\n _uri = _metaDataUri;\\n }\\n\\n function uri(uint256) public view returns (string memory) {\\n return _uri;\\n }\\n}\\n\",\"keccak256\":\"0x28aad4cb829118de64965e06af8e785e6b2efa5207859d2efc63e404c26cfea3\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161045538038061045583398101604081905261002f91610058565b600061003b82826101aa565b5050610269565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561006b57600080fd5b82516001600160401b038082111561008257600080fd5b818501915085601f83011261009657600080fd5b8151818111156100a8576100a8610042565b604051601f8201601f19908116603f011681019083821181831017156100d0576100d0610042565b8160405282815288868487010111156100e857600080fd5b600093505b8284101561010a57848401860151818501870152928501926100ed565b600086848301015280965050505050505092915050565b600181811c9082168061013557607f821691505b60208210810361015557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156101a557600081815260208120601f850160051c810160208610156101825750805b601f850160051c820191505b818110156101a15782815560010161018e565b5050505b505050565b81516001600160401b038111156101c3576101c3610042565b6101d7816101d18454610121565b8461015b565b602080601f83116001811461020c57600084156101f45750858301515b600019600386901b1c1916600185901b1785556101a1565b600085815260208120601f198616915b8281101561023b5788860151825594840194600190910190840161021c565b50858210156102595787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6101dd806102786000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80630e89341c14610030575b600080fd5b61004361003e3660046100ed565b610059565b6040516100509190610106565b60405180910390f35b60606000805461006890610154565b80601f016020809104026020016040519081016040528092919081815260200182805461009490610154565b80156100e15780601f106100b6576101008083540402835291602001916100e1565b820191906000526020600020905b8154815290600101906020018083116100c457829003601f168201915b50505050509050919050565b6000602082840312156100ff57600080fd5b5035919050565b600060208083528351808285015260005b8181101561013357858101830151858201604001528201610117565b506000604082860101526040601f19601f8301168501019250505092915050565b600181811c9082168061016857607f821691505b6020821081036101a1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea264697066735822122002fba9f9d02544b13d4a0c3d553ca0085d13c2eb2a4e1b4ed0703fe003070b0b64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80630e89341c14610030575b600080fd5b61004361003e3660046100ed565b610059565b6040516100509190610106565b60405180910390f35b60606000805461006890610154565b80601f016020809104026020016040519081016040528092919081815260200182805461009490610154565b80156100e15780601f106100b6576101008083540402835291602001916100e1565b820191906000526020600020905b8154815290600101906020018083116100c457829003601f168201915b50505050509050919050565b6000602082840312156100ff57600080fd5b5035919050565b600060208083528351808285015260005b8181101561013357858101830151858201604001528201610117565b506000604082860101526040601f19601f8301168501019250505092915050565b600181811c9082168061016857607f821691505b6020821081036101a1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea264697066735822122002fba9f9d02544b13d4a0c3d553ca0085d13c2eb2a4e1b4ed0703fe003070b0b64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 24200, + "contract": "contracts/wrapper/StaticMetadataService.sol:StaticMetadataService", + "label": "_uri", + "offset": 0, + "slot": "0", + "type": "t_string_storage" + } + ], + "types": { + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/TLDPublicSuffixList.json b/solidity/dns-contracts/deployments/goerli/TLDPublicSuffixList.json new file mode 100644 index 0000000..a04ec41 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/TLDPublicSuffixList.json @@ -0,0 +1,61 @@ +{ + "address": "0xed2E4cDc0280743B42F4415E3e8F7425a2d6b059", + "transactionHash": "0x47d95e9c2f0a37ff56b1f8369e69b1690a1b94e65aff86b09d549d3b436cc137", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "isPublicSuffix", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x47d95e9c2f0a37ff56b1f8369e69b1690a1b94e65aff86b09d549d3b436cc137", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0xed2E4cDc0280743B42F4415E3e8F7425a2d6b059", + "transactionIndex": 0, + "gasUsed": "174235", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x83b9e656f154122c914704960296fbbf1a083fc3e89b2a62cc6a24da39a0de90", + "transactionHash": "0x47d95e9c2f0a37ff56b1f8369e69b1690a1b94e65aff86b09d549d3b436cc137", + "logs": [], + "blockNumber": 6470064, + "cumulativeGasUsed": "174235", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "7948b60c3b601df824761a337a51d661", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"isPublicSuffix\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"A public suffix list that treats all TLDs as public suffixes.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnsregistrar/TLDPublicSuffixList.sol\":\"TLDPublicSuffixList\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"contracts/dnsregistrar/PublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\ninterface PublicSuffixList {\\n function isPublicSuffix(bytes calldata name) external view returns(bool);\\n}\\n\",\"keccak256\":\"0x8e593c73f54e07a54074ed3b6bc8e976d06211f923051c9793bcb9c10114854d\"},\"contracts/dnsregistrar/TLDPublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../dnssec-oracle/BytesUtils.sol\\\";\\nimport \\\"./PublicSuffixList.sol\\\";\\n\\n/**\\n * @dev A public suffix list that treats all TLDs as public suffixes.\\n */\\ncontract TLDPublicSuffixList is PublicSuffixList {\\n using BytesUtils for bytes;\\n\\n function isPublicSuffix(bytes calldata name) external override view returns(bool) {\\n uint labellen = name.readUint8(0);\\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\\n }\\n}\\n\",\"keccak256\":\"0xe5b1a99e2fbc719fdf234de39724d78196fe981f9a10a241ed3014318d85f927\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\\n uint shortest = len;\\n if (otherlen < len)\\n shortest = otherlen;\\n\\n uint selfptr;\\n uint otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint idx = 0; idx < shortest; idx += 32) {\\n uint a;\\n uint b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint mask;\\n if (shortest > 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\\n }\\n int diff = int(a & mask) - int(b & mask);\\n if (diff != 0)\\n return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int(len) - int(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\\n return self.length == other.length && equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint dest, uint src, uint len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint dest;\\n uint src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\\n require(len <= 52);\\n\\n uint ret = 0;\\n uint8 decoded;\\n for(uint i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if(i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint bitlen = len * 5;\\n if(len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if(len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if(len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if(len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if(len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n}\",\"keccak256\":\"0x83315df2e54c74451577c70da2c267c3459802b08b9aeec6516302eee70f796e\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610233806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80634f89059e14610030575b600080fd5b61004361003e366004610153565b610057565b604051901515815260200160405180910390f35b60008061009e600085858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506101089050565b60ff16905060008111801561010057506100fb6100bc8260016101c0565b85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506101089050565b60ff16155b949350505050565b6000828281518110610143577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b016020015160f81c905092915050565b60008060208385031215610165578182fd5b823567ffffffffffffffff8082111561017c578384fd5b818501915085601f83011261018f578384fd5b81358181111561019d578485fd5b8660208285010111156101ae578485fd5b60209290920196919550909350505050565b600082198211156101f8577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b50019056fea26469706673582212207b16668d1330852cf731c2e3cd0037aee1e127dbdd100890aeaaf633abac31af64736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80634f89059e14610030575b600080fd5b61004361003e366004610153565b610057565b604051901515815260200160405180910390f35b60008061009e600085858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506101089050565b60ff16905060008111801561010057506100fb6100bc8260016101c0565b85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506101089050565b60ff16155b949350505050565b6000828281518110610143577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b016020015160f81c905092915050565b60008060208385031215610165578182fd5b823567ffffffffffffffff8082111561017c578384fd5b818501915085601f83011261018f578384fd5b81358181111561019d578485fd5b8660208285010111156101ae578485fd5b60209290920196919550909350505050565b600082198211156101f8577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b50019056fea26469706673582212207b16668d1330852cf731c2e3cd0037aee1e127dbdd100890aeaaf633abac31af64736f6c63430008040033", + "devdoc": { + "details": "A public suffix list that treats all TLDs as public suffixes.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/TestUnwrap.json b/solidity/dns-contracts/deployments/goerli/TestUnwrap.json new file mode 100644 index 0000000..d0e2f94 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/TestUnwrap.json @@ -0,0 +1,349 @@ +{ + "address": "0x712d24690C388Ed58C1bBf357a13655e0c78B2B7", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract IBaseRegistrar", + "name": "_registrar", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "approvedWrapper", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "registrar", + "outputs": [ + { + "internalType": "contract IBaseRegistrar", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "newOwner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "wrapper", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setWrapperApproval", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "wrapETH2LD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + }, + { + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "wrapFromUpgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x925ec02ec26fd5b50e6edd32906c16144660d372310c2166bbf05351eb3b73ba", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0x712d24690C388Ed58C1bBf357a13655e0c78B2B7", + "transactionIndex": 60, + "gasUsed": "970325", + "logsBloom": "0x00000000000000000000000008000000000000000000000000800000000000000000040000000000000000000000000000000008000000000000000000000000002000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000001000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x89b8421cad31ea3c6746b756fc04121d9ede9f062e3cdce14e81893d6e074e47", + "transactionHash": "0x925ec02ec26fd5b50e6edd32906c16144660d372310c2166bbf05351eb3b73ba", + "logs": [ + { + "transactionIndex": 60, + "blockNumber": 8649101, + "transactionHash": "0x925ec02ec26fd5b50e6edd32906c16144660d372310c2166bbf05351eb3b73ba", + "address": "0x712d24690C388Ed58C1bBf357a13655e0c78B2B7", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000904dac3347ea47d208f3fd67402d039a3b99859" + ], + "data": "0x", + "logIndex": 103, + "blockHash": "0x89b8421cad31ea3c6746b756fc04121d9ede9f062e3cdce14e81893d6e074e47" + } + ], + "blockNumber": 8649101, + "cumulativeGasUsed": "7595089", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85" + ], + "numDeployments": 2, + "solcInputHash": "0ba2159dea6e6f2226840e68f6c0a0ff", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"_registrar\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"approvedWrapper\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"registrar\",\"outputs\":[{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setSubnodeRecord\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"wrapper\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setWrapperApproval\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"wrapETH2LD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"wrapFromUpgrade\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/wrapper/mocks/TestUnwrap.sol\":\"TestUnwrap\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1500},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xab28a56179c1db258c9bf5235b382698cb650debecb51b23d12be9e241374b68\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x9ac51351ff72d73083aed62b7cdad4c07e9d1eb68401d7fd8457bdd828f2c6fe\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/wrapper/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes32) {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n}\\n\",\"keccak256\":\"0xf862cd86d749158a554e3cb517efa9097331ec0cf7225117f21e96fb50c67edb\",\"license\":\"MIT\"},\"contracts/wrapper/mocks/TestUnwrap.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\nimport \\\"../../registry/ENS.sol\\\";\\nimport \\\"../../ethregistrar/IBaseRegistrar.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {BytesUtils} from \\\"../BytesUtils.sol\\\";\\n\\ncontract TestUnwrap is Ownable {\\n using BytesUtils for bytes;\\n\\n bytes32 private constant ETH_NODE =\\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\\n\\n ENS public immutable ens;\\n IBaseRegistrar public immutable registrar;\\n mapping(address => bool) public approvedWrapper;\\n\\n constructor(ENS _ens, IBaseRegistrar _registrar) {\\n ens = _ens;\\n registrar = _registrar;\\n }\\n\\n function setWrapperApproval(\\n address wrapper,\\n bool approved\\n ) public onlyOwner {\\n approvedWrapper[wrapper] = approved;\\n }\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address resolver\\n ) public {\\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\\n }\\n\\n function setSubnodeRecord(\\n bytes32 parentNode,\\n string memory label,\\n address newOwner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) public {\\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\\n _unwrapSubnode(node, newOwner, msg.sender);\\n }\\n\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) public {\\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\\n bytes32 parentNode = name.namehash(offset);\\n bytes32 node = _makeNode(parentNode, labelhash);\\n\\n if (parentNode == ETH_NODE) {\\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\\n } else {\\n _unwrapSubnode(node, wrappedOwner, msg.sender);\\n }\\n }\\n\\n function _unwrapETH2LD(\\n bytes32 labelhash,\\n address wrappedOwner,\\n address sender\\n ) private {\\n uint256 tokenId = uint256(labelhash);\\n address registrant = registrar.ownerOf(tokenId);\\n\\n require(\\n approvedWrapper[sender] &&\\n sender == registrant &&\\n registrar.isApprovedForAll(registrant, address(this)),\\n \\\"Unauthorised\\\"\\n );\\n\\n registrar.reclaim(tokenId, wrappedOwner);\\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\\n }\\n\\n function _unwrapSubnode(\\n bytes32 node,\\n address newOwner,\\n address sender\\n ) private {\\n address owner = ens.owner(node);\\n\\n require(\\n approvedWrapper[sender] &&\\n owner == sender &&\\n ens.isApprovedForAll(owner, address(this)),\\n \\\"Unauthorised\\\"\\n );\\n\\n ens.setOwner(node, newOwner);\\n }\\n\\n function _makeNode(\\n bytes32 node,\\n bytes32 labelhash\\n ) private pure returns (bytes32) {\\n return keccak256(abi.encodePacked(node, labelhash));\\n }\\n}\\n\",\"keccak256\":\"0x738180fe6f0caae045c82df1d5a7088d07ebbf299c5c8b402a3cf04079980014\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c060405234801561001057600080fd5b5060405161117238038061117283398101604081905261002f916100b7565b6100383361004f565b6001600160a01b039182166080521660a0526100f1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146100b457600080fd5b50565b600080604083850312156100ca57600080fd5b82516100d58161009f565b60208401519092506100e68161009f565b809150509250929050565b60805160a05161102c6101466000396000818160f0015281816108f1015281816109cc01528181610ac20152610b63015260008181610134015281816104b6015281816105910152610687015261102c6000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80638da5cb5b11610076578063c6d6d7c11161005b578063c6d6d7c114610182578063f2fde38b146101b5578063f9547a9e146101c857600080fd5b80638da5cb5b1461015e5780639198c2761461016f57600080fd5b80632b20e397116100a75780632b20e397146100eb5780633f15457f1461012f578063715018a61461015657600080fd5b80630cc17365146100c357806324c1af44146100d8575b600080fd5b6100d66100d1366004610c1f565b6101db565b005b6100d66100e6366004610c9a565b61020e565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6100d6610238565b6000546001600160a01b0316610112565b6100d661017d366004610df1565b61024c565b6101a5610190366004610eac565b60016020526000908152604090205460ff1681565b6040519015158152602001610126565b6100d66101c3366004610eac565b61033c565b6100d66101d6366004610ed0565b6103d1565b6101e36103fb565b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b6000610221888880519060200120610455565b905061022e818733610484565b5050505050505050565b6102406103fb565b61024a60006106df565b565b60008061029360008b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506107479050565b9150915060006102dc828c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506107fe9050565b905060006102ea8285610455565b90507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b5282016103235761031e848b336108bd565b61032e565b61032e818b33610484565b505050505050505050505050565b6103446103fb565b6001600160a01b0381166103c55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6103ce816106df565b50565b6103f386866040516103e4929190610f5a565b604051809103902085336108bd565b505050505050565b6000546001600160a01b0316331461024a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103bc565b604080516020808201859052818301849052825180830384018152606090920190925280519101205b92915050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018490526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610505573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105299190610f6a565b6001600160a01b03831660009081526001602052604090205490915060ff1680156105655750816001600160a01b0316816001600160a01b0316145b80156105fc575060405163e985e9c560e01b81526001600160a01b0382811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa1580156105d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fc9190610f87565b6106485760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f7269736564000000000000000000000000000000000000000060448201526064016103bc565b6040517f5b0fc9c3000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b0384811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b1580156106cb57600080fd5b505af115801561022e573d6000803e3d6000fd5b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000808351831061079a5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e6473000060448201526064016103bc565b60008484815181106107ae576107ae610fa4565b016020015160f81c905080156107da576107d3856107cd866001610fd0565b83610bc8565b92506107df565b600092505b6107e98185610fd0565b6107f4906001610fd0565b9150509250929050565b600080600061080d8585610747565b90925090508161087f57600185516108259190610fe3565b84146108735760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d6500000060448201526064016103bc565b506000915061047e9050565b61088985826107fe565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b6040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810184905283906000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015610940573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109649190610f6a565b6001600160a01b03841660009081526001602052604090205490915060ff1680156109a05750806001600160a01b0316836001600160a01b0316145b8015610a37575060405163e985e9c560e01b81526001600160a01b0382811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610a13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a379190610f87565b610a835760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f7269736564000000000000000000000000000000000000000060448201526064016103bc565b6040517f28ed4f6c000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b0385811660248301527f000000000000000000000000000000000000000000000000000000000000000016906328ed4f6c90604401600060405180830381600087803b158015610b0657600080fd5b505af1158015610b1a573d6000803e3d6000fd5b50506040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528781166024830152604482018690527f00000000000000000000000000000000000000000000000000000000000000001692506323b872dd9150606401600060405180830381600087803b158015610ba957600080fd5b505af1158015610bbd573d6000803e3d6000fd5b505050505050505050565b8251600090610bd78385610fd0565b1115610be257600080fd5b5091016020012090565b6001600160a01b03811681146103ce57600080fd5b8035610c0c81610bec565b919050565b80151581146103ce57600080fd5b60008060408385031215610c3257600080fd5b8235610c3d81610bec565b91506020830135610c4d81610c11565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b803567ffffffffffffffff81168114610c0c57600080fd5b803563ffffffff81168114610c0c57600080fd5b600080600080600080600060e0888a031215610cb557600080fd5b87359650602088013567ffffffffffffffff80821115610cd457600080fd5b818a0191508a601f830112610ce857600080fd5b813581811115610cfa57610cfa610c58565b604051601f8201601f19908116603f01168101908382118183101715610d2257610d22610c58565b816040528281528d6020848701011115610d3b57600080fd5b82602086016020830137600060208483010152809a505050505050610d6260408901610c01565b9450610d7060608901610c01565b9350610d7e60808901610c6e565b9250610d8c60a08901610c86565b9150610d9a60c08901610c6e565b905092959891949750929550565b60008083601f840112610dba57600080fd5b50813567ffffffffffffffff811115610dd257600080fd5b602083019150836020828501011115610dea57600080fd5b9250929050565b60008060008060008060008060c0898b031215610e0d57600080fd5b883567ffffffffffffffff80821115610e2557600080fd5b610e318c838d01610da8565b909a50985060208b01359150610e4682610bec565b819750610e5560408c01610c86565b9650610e6360608c01610c6e565b955060808b01359150610e7582610bec565b90935060a08a01359080821115610e8b57600080fd5b50610e988b828c01610da8565b999c989b5096995094979396929594505050565b600060208284031215610ebe57600080fd5b8135610ec981610bec565b9392505050565b60008060008060008060a08789031215610ee957600080fd5b863567ffffffffffffffff811115610f0057600080fd5b610f0c89828a01610da8565b9097509550506020870135610f2081610bec565b9350610f2e60408801610c86565b9250610f3c60608801610c6e565b91506080870135610f4c81610bec565b809150509295509295509295565b8183823760009101908152919050565b600060208284031215610f7c57600080fd5b8151610ec981610bec565b600060208284031215610f9957600080fd5b8151610ec981610c11565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561047e5761047e610fba565b8181038181111561047e5761047e610fba56fea2646970667358221220091760b08f6fd7b1a6510263275455e4c37e69dde602a74b3597f4163ac96cb564736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100be5760003560e01c80638da5cb5b11610076578063c6d6d7c11161005b578063c6d6d7c114610182578063f2fde38b146101b5578063f9547a9e146101c857600080fd5b80638da5cb5b1461015e5780639198c2761461016f57600080fd5b80632b20e397116100a75780632b20e397146100eb5780633f15457f1461012f578063715018a61461015657600080fd5b80630cc17365146100c357806324c1af44146100d8575b600080fd5b6100d66100d1366004610c1f565b6101db565b005b6100d66100e6366004610c9a565b61020e565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6100d6610238565b6000546001600160a01b0316610112565b6100d661017d366004610df1565b61024c565b6101a5610190366004610eac565b60016020526000908152604090205460ff1681565b6040519015158152602001610126565b6100d66101c3366004610eac565b61033c565b6100d66101d6366004610ed0565b6103d1565b6101e36103fb565b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b6000610221888880519060200120610455565b905061022e818733610484565b5050505050505050565b6102406103fb565b61024a60006106df565b565b60008061029360008b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506107479050565b9150915060006102dc828c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506107fe9050565b905060006102ea8285610455565b90507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b5282016103235761031e848b336108bd565b61032e565b61032e818b33610484565b505050505050505050505050565b6103446103fb565b6001600160a01b0381166103c55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6103ce816106df565b50565b6103f386866040516103e4929190610f5a565b604051809103902085336108bd565b505050505050565b6000546001600160a01b0316331461024a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103bc565b604080516020808201859052818301849052825180830384018152606090920190925280519101205b92915050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018490526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610505573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105299190610f6a565b6001600160a01b03831660009081526001602052604090205490915060ff1680156105655750816001600160a01b0316816001600160a01b0316145b80156105fc575060405163e985e9c560e01b81526001600160a01b0382811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa1580156105d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fc9190610f87565b6106485760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f7269736564000000000000000000000000000000000000000060448201526064016103bc565b6040517f5b0fc9c3000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b0384811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b1580156106cb57600080fd5b505af115801561022e573d6000803e3d6000fd5b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000808351831061079a5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e6473000060448201526064016103bc565b60008484815181106107ae576107ae610fa4565b016020015160f81c905080156107da576107d3856107cd866001610fd0565b83610bc8565b92506107df565b600092505b6107e98185610fd0565b6107f4906001610fd0565b9150509250929050565b600080600061080d8585610747565b90925090508161087f57600185516108259190610fe3565b84146108735760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d6500000060448201526064016103bc565b506000915061047e9050565b61088985826107fe565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b6040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810184905283906000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015610940573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109649190610f6a565b6001600160a01b03841660009081526001602052604090205490915060ff1680156109a05750806001600160a01b0316836001600160a01b0316145b8015610a37575060405163e985e9c560e01b81526001600160a01b0382811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610a13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a379190610f87565b610a835760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f7269736564000000000000000000000000000000000000000060448201526064016103bc565b6040517f28ed4f6c000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b0385811660248301527f000000000000000000000000000000000000000000000000000000000000000016906328ed4f6c90604401600060405180830381600087803b158015610b0657600080fd5b505af1158015610b1a573d6000803e3d6000fd5b50506040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528781166024830152604482018690527f00000000000000000000000000000000000000000000000000000000000000001692506323b872dd9150606401600060405180830381600087803b158015610ba957600080fd5b505af1158015610bbd573d6000803e3d6000fd5b505050505050505050565b8251600090610bd78385610fd0565b1115610be257600080fd5b5091016020012090565b6001600160a01b03811681146103ce57600080fd5b8035610c0c81610bec565b919050565b80151581146103ce57600080fd5b60008060408385031215610c3257600080fd5b8235610c3d81610bec565b91506020830135610c4d81610c11565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b803567ffffffffffffffff81168114610c0c57600080fd5b803563ffffffff81168114610c0c57600080fd5b600080600080600080600060e0888a031215610cb557600080fd5b87359650602088013567ffffffffffffffff80821115610cd457600080fd5b818a0191508a601f830112610ce857600080fd5b813581811115610cfa57610cfa610c58565b604051601f8201601f19908116603f01168101908382118183101715610d2257610d22610c58565b816040528281528d6020848701011115610d3b57600080fd5b82602086016020830137600060208483010152809a505050505050610d6260408901610c01565b9450610d7060608901610c01565b9350610d7e60808901610c6e565b9250610d8c60a08901610c86565b9150610d9a60c08901610c6e565b905092959891949750929550565b60008083601f840112610dba57600080fd5b50813567ffffffffffffffff811115610dd257600080fd5b602083019150836020828501011115610dea57600080fd5b9250929050565b60008060008060008060008060c0898b031215610e0d57600080fd5b883567ffffffffffffffff80821115610e2557600080fd5b610e318c838d01610da8565b909a50985060208b01359150610e4682610bec565b819750610e5560408c01610c86565b9650610e6360608c01610c6e565b955060808b01359150610e7582610bec565b90935060a08a01359080821115610e8b57600080fd5b50610e988b828c01610da8565b999c989b5096995094979396929594505050565b600060208284031215610ebe57600080fd5b8135610ec981610bec565b9392505050565b60008060008060008060a08789031215610ee957600080fd5b863567ffffffffffffffff811115610f0057600080fd5b610f0c89828a01610da8565b9097509550506020870135610f2081610bec565b9350610f2e60408801610c86565b9250610f3c60608801610c6e565b91506080870135610f4c81610bec565b809150509295509295509295565b8183823760009101908152919050565b600060208284031215610f7c57600080fd5b8151610ec981610bec565b600060208284031215610f9957600080fd5b8151610ec981610c11565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561047e5761047e610fba565b8181038181111561047e5761047e610fba56fea2646970667358221220091760b08f6fd7b1a6510263275455e4c37e69dde602a74b3597f4163ac96cb564736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 428, + "contract": "contracts/wrapper/mocks/TestUnwrap.sol:TestUnwrap", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 17807, + "contract": "contracts/wrapper/mocks/TestUnwrap.sol:TestUnwrap", + "label": "approvedWrapper", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/UniversalResolver.json b/solidity/dns-contracts/deployments/goerli/UniversalResolver.json new file mode 100644 index 0000000..6de924a --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/UniversalResolver.json @@ -0,0 +1,733 @@ +{ + "address": "0x898A1182F3C2BBBF0b16b4DfEf63E9c3e9eB4821", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_registry", + "type": "address" + }, + { + "internalType": "string[]", + "name": "_urls", + "type": "string[]" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "string[]", + "name": "urls", + "type": "string[]" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes4", + "name": "callbackFunction", + "type": "bytes4" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "OffchainLookup", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "name": "ResolverError", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverNotContract", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverNotFound", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverWildcardNotSupported", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "string[]", + "name": "gateways", + "type": "string[]" + }, + { + "internalType": "bytes4", + "name": "callbackFunction", + "type": "bytes4" + }, + { + "internalType": "bytes", + "name": "metaData", + "type": "bytes" + } + ], + "name": "_resolveSingle", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "batchGatewayURLs", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "findResolver", + "outputs": [ + { + "internalType": "contract Resolver", + "name": "", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "registry", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "string[]", + "name": "gateways", + "type": "string[]" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "resolve", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "internalType": "struct Result[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "string[]", + "name": "gateways", + "type": "string[]" + } + ], + "name": "resolve", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "internalType": "struct Result[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "response", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "resolveCallback", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "internalType": "struct Result[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "response", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "resolveSingleCallback", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "reverseName", + "type": "bytes" + }, + { + "internalType": "string[]", + "name": "gateways", + "type": "string[]" + } + ], + "name": "reverse", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "reverseName", + "type": "bytes" + } + ], + "name": "reverse", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "response", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "reverseCallback", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "_urls", + "type": "string[]" + } + ], + "name": "setGatewayURLs", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x7121a4e2c2f0412faf701c2cb3d8ee8eebf771148eb06f205a011b3d155d24d0", + "receipt": { + "to": null, + "from": "0x69420f05A11f617B4B74fFe2E04B2D300dFA556F", + "contractAddress": "0x898A1182F3C2BBBF0b16b4DfEf63E9c3e9eB4821", + "transactionIndex": 36, + "gasUsed": "3139326", + "logsBloom": "0x00000000010000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000040000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000020000000000000000000008000000100000000000000000000000000000000000000", + "blockHash": "0x2a75b2f5921d015c0b05338a0f9d934063dd4f18fe6488b83970303073659c2b", + "transactionHash": "0x7121a4e2c2f0412faf701c2cb3d8ee8eebf771148eb06f205a011b3d155d24d0", + "logs": [ + { + "transactionIndex": 36, + "blockNumber": 10559621, + "transactionHash": "0x7121a4e2c2f0412faf701c2cb3d8ee8eebf771148eb06f205a011b3d155d24d0", + "address": "0x898A1182F3C2BBBF0b16b4DfEf63E9c3e9eB4821", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000069420f05a11f617b4b74ffe2e04b2d300dfa556f" + ], + "data": "0x", + "logIndex": 172, + "blockHash": "0x2a75b2f5921d015c0b05338a0f9d934063dd4f18fe6488b83970303073659c2b" + } + ], + "blockNumber": 10559621, + "cumulativeGasUsed": "13595024", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + [ + "https://ccip-v2.ens.xyz" + ] + ], + "numDeployments": 8, + "solcInputHash": "49f758ec505ff69b72f3179ac11d7cfc", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_registry\",\"type\":\"address\"},{\"internalType\":\"string[]\",\"name\":\"_urls\",\"type\":\"string[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"string[]\",\"name\":\"urls\",\"type\":\"string[]\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes4\",\"name\":\"callbackFunction\",\"type\":\"bytes4\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"OffchainLookup\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"name\":\"ResolverError\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverNotContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverWildcardNotSupported\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string[]\",\"name\":\"gateways\",\"type\":\"string[]\"},{\"internalType\":\"bytes4\",\"name\":\"callbackFunction\",\"type\":\"bytes4\"},{\"internalType\":\"bytes\",\"name\":\"metaData\",\"type\":\"bytes\"}],\"name\":\"_resolveSingle\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"batchGatewayURLs\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"findResolver\",\"outputs\":[{\"internalType\":\"contract Resolver\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"registry\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string[]\",\"name\":\"gateways\",\"type\":\"string[]\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"resolve\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"internalType\":\"struct Result[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"string[]\",\"name\":\"gateways\",\"type\":\"string[]\"}],\"name\":\"resolve\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"internalType\":\"struct Result[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"response\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"resolveCallback\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"internalType\":\"struct Result[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"response\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"resolveSingleCallback\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"reverseName\",\"type\":\"bytes\"},{\"internalType\":\"string[]\",\"name\":\"gateways\",\"type\":\"string[]\"}],\"name\":\"reverse\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"reverseName\",\"type\":\"bytes\"}],\"name\":\"reverse\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"response\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"reverseCallback\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"_urls\",\"type\":\"string[]\"}],\"name\":\"setGatewayURLs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"findResolver(bytes)\":{\"details\":\"Finds a resolver by recursively querying the registry, starting at the longest name and progressively removing labels until it finds a result.\",\"params\":{\"name\":\"The name to resolve, in DNS-encoded and normalised form.\"},\"returns\":{\"_0\":\"resolver The Resolver responsible for this name.\",\"_1\":\"namehash The namehash of the full name.\",\"_2\":\"finalOffset The offset of the first label with a resolver.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"resolve(bytes,bytes)\":{\"details\":\"Performs ENS name resolution for the supplied name and resolution data.\",\"params\":{\"data\":\"The resolution data, as specified in ENSIP-10.\",\"name\":\"The name to resolve, in normalised and DNS-encoded form.\"},\"returns\":{\"_0\":\"The result of resolving the name.\"}},\"reverse(bytes,string[])\":{\"details\":\"Performs ENS name reverse resolution for the supplied reverse name.\",\"params\":{\"reverseName\":\"The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\"},\"returns\":{\"_0\":\"The resolved name, the resolved address, the reverse resolver address, and the resolver address.\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"The Universal Resolver is a contract that handles the work of resolving a name entirely onchain, making it possible to make a single smart contract call to resolve an ENS name.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/utils/UniversalResolver.sol\":\"UniversalResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/resolvers/Resolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"./profiles/IABIResolver.sol\\\";\\nimport \\\"./profiles/IAddressResolver.sol\\\";\\nimport \\\"./profiles/IAddrResolver.sol\\\";\\nimport \\\"./profiles/IContentHashResolver.sol\\\";\\nimport \\\"./profiles/IDNSRecordResolver.sol\\\";\\nimport \\\"./profiles/IDNSZoneResolver.sol\\\";\\nimport \\\"./profiles/IInterfaceResolver.sol\\\";\\nimport \\\"./profiles/INameResolver.sol\\\";\\nimport \\\"./profiles/IPubkeyResolver.sol\\\";\\nimport \\\"./profiles/ITextResolver.sol\\\";\\nimport \\\"./profiles/IExtendedResolver.sol\\\";\\n\\n/**\\n * A generic resolver interface which includes all the functions including the ones deprecated\\n */\\ninterface Resolver is\\n IERC165,\\n IABIResolver,\\n IAddressResolver,\\n IAddrResolver,\\n IContentHashResolver,\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n IInterfaceResolver,\\n INameResolver,\\n IPubkeyResolver,\\n ITextResolver,\\n IExtendedResolver\\n{\\n /* Deprecated events */\\n event ContentChanged(bytes32 indexed node, bytes32 hash);\\n\\n function setApprovalForAll(address, bool) external;\\n\\n function approve(bytes32 node, address delegate, bool approved) external;\\n\\n function isApprovedForAll(address account, address operator) external;\\n\\n function isApprovedFor(\\n address owner,\\n bytes32 node,\\n address delegate\\n ) external;\\n\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external;\\n\\n function setAddr(bytes32 node, address addr) external;\\n\\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\\n\\n function setContenthash(bytes32 node, bytes calldata hash) external;\\n\\n function setDnsrr(bytes32 node, bytes calldata data) external;\\n\\n function setName(bytes32 node, string calldata _name) external;\\n\\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\\n\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external;\\n\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external;\\n\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n /* Deprecated functions */\\n function content(bytes32 node) external view returns (bytes32);\\n\\n function multihash(bytes32 node) external view returns (bytes memory);\\n\\n function setContent(bytes32 node, bytes32 hash) external;\\n\\n function setMultihash(bytes32 node, bytes calldata hash) external;\\n}\\n\",\"keccak256\":\"0xfc77ab6b7c59c3ebfe1c720bdebf9b08c2488ff7ac9501a9aa056c5d6d5b50c5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/utils/HexUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary HexUtils {\\n /**\\n * @dev Attempts to parse bytes32 from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexStringToBytes32(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (bytes32 r, bool valid) {\\n uint256 hexLength = lastIdx - idx;\\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\\n revert(\\\"Invalid string length\\\");\\n }\\n valid = true;\\n assembly {\\n // check that the index to read to is not past the end of the string\\n if gt(lastIdx, mload(str)) {\\n revert(0, 0)\\n }\\n\\n function getHex(c) -> ascii {\\n // chars 48-57: 0-9\\n if and(gt(c, 47), lt(c, 58)) {\\n ascii := sub(c, 48)\\n leave\\n }\\n // chars 65-70: A-F\\n if and(gt(c, 64), lt(c, 71)) {\\n ascii := add(sub(c, 65), 10)\\n leave\\n }\\n // chars 97-102: a-f\\n if and(gt(c, 96), lt(c, 103)) {\\n ascii := add(sub(c, 97), 10)\\n leave\\n }\\n // invalid char\\n ascii := 0xff\\n }\\n\\n let ptr := add(str, 32)\\n for {\\n let i := idx\\n } lt(i, lastIdx) {\\n i := add(i, 2)\\n } {\\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\\n // if either byte is invalid, set invalid and break loop\\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\\n valid := false\\n break\\n }\\n let combined := or(shl(4, byte1), byte2)\\n r := or(shl(8, r), combined)\\n }\\n }\\n }\\n\\n /**\\n * @dev Attempts to parse an address from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexToAddress(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (address, bool) {\\n if (lastIdx - idx < 40) return (address(0x0), false);\\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\\n return (address(uint160(uint256(r))), valid);\\n }\\n}\\n\",\"keccak256\":\"0x4a8a9c72d6f3effb80b310faa6dc273e7adbc3b949df9c7a42e290e5b13519f3\",\"license\":\"MIT\"},\"contracts/utils/LowLevelCallUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.13;\\n\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nlibrary LowLevelCallUtils {\\n using Address for address;\\n\\n /**\\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\\n * `returnDataSize` and `readReturnData`.\\n * @param target The address to staticcall.\\n * @param data The data to pass to the call.\\n * @return success True if the call succeeded, or false if it reverts.\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data\\n ) internal view returns (bool success) {\\n return functionStaticCall(target, data, gasleft());\\n }\\n\\n /**\\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\\n * `returnDataSize` and `readReturnData`.\\n * @param target The address to staticcall.\\n * @param data The data to pass to the call.\\n * @param gasLimit The gas limit to use for the call.\\n * @return success True if the call succeeded, or false if it reverts.\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n uint256 gasLimit\\n ) internal view returns (bool success) {\\n require(\\n target.isContract(),\\n \\\"LowLevelCallUtils: static call to non-contract\\\"\\n );\\n assembly {\\n success := staticcall(\\n gasLimit,\\n target,\\n add(data, 32),\\n mload(data),\\n 0,\\n 0\\n )\\n }\\n }\\n\\n /**\\n * @dev Returns the size of the return data of the most recent external call.\\n */\\n function returnDataSize() internal pure returns (uint256 len) {\\n assembly {\\n len := returndatasize()\\n }\\n }\\n\\n /**\\n * @dev Reads return data from the most recent external call.\\n * @param offset Offset into the return data.\\n * @param length Number of bytes to return.\\n */\\n function readReturnData(\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (bytes memory data) {\\n data = new bytes(length);\\n assembly {\\n returndatacopy(add(data, 32), offset, length)\\n }\\n }\\n\\n /**\\n * @dev Reverts with the return data from the most recent external call.\\n */\\n function propagateRevert() internal pure {\\n assembly {\\n returndatacopy(0, 0, returndatasize())\\n revert(0, returndatasize())\\n }\\n }\\n}\\n\",\"keccak256\":\"0xba30d0a44a6a2f1557e4913108b25d8b36cb40a54f44ac98086465d6bf77c5e6\",\"license\":\"MIT\"},\"contracts/utils/NameEncoder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.13;\\n\\nimport {BytesUtils} from \\\"../wrapper/BytesUtils.sol\\\";\\n\\nlibrary NameEncoder {\\n using BytesUtils for bytes;\\n\\n function dnsEncodeName(\\n string memory name\\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\\n uint8 labelLength = 0;\\n bytes memory bytesName = bytes(name);\\n uint256 length = bytesName.length;\\n dnsName = new bytes(length + 2);\\n node = 0;\\n if (length == 0) {\\n dnsName[0] = 0;\\n return (dnsName, node);\\n }\\n\\n // use unchecked to save gas since we check for an underflow\\n // and we check for the length before the loop\\n unchecked {\\n for (uint256 i = length - 1; i >= 0; i--) {\\n if (bytesName[i] == \\\".\\\") {\\n dnsName[i + 1] = bytes1(labelLength);\\n node = keccak256(\\n abi.encodePacked(\\n node,\\n bytesName.keccak(i + 1, labelLength)\\n )\\n );\\n labelLength = 0;\\n } else {\\n labelLength += 1;\\n dnsName[i + 1] = bytesName[i];\\n }\\n if (i == 0) {\\n break;\\n }\\n }\\n }\\n\\n node = keccak256(\\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\\n );\\n\\n dnsName[0] = bytes1(labelLength);\\n return (dnsName, node);\\n }\\n}\\n\",\"keccak256\":\"0x63fd5f360cef8c9b8b8cfdff20d3f0e955b4c8ac7dfac758788223c61678aad1\",\"license\":\"MIT\"},\"contracts/utils/UniversalResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ERC165} from \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {LowLevelCallUtils} from \\\"./LowLevelCallUtils.sol\\\";\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IExtendedResolver} from \\\"../resolvers/profiles/IExtendedResolver.sol\\\";\\nimport {Resolver, INameResolver, IAddrResolver} from \\\"../resolvers/Resolver.sol\\\";\\nimport {NameEncoder} from \\\"./NameEncoder.sol\\\";\\nimport {BytesUtils} from \\\"../wrapper/BytesUtils.sol\\\";\\nimport {HexUtils} from \\\"./HexUtils.sol\\\";\\n\\nerror OffchainLookup(\\n address sender,\\n string[] urls,\\n bytes callData,\\n bytes4 callbackFunction,\\n bytes extraData\\n);\\n\\nerror ResolverNotFound();\\n\\nerror ResolverWildcardNotSupported();\\n\\nerror ResolverNotContract();\\n\\nerror ResolverError(bytes returnData);\\n\\nerror HttpError(HttpErrorItem[] errors);\\n\\nstruct HttpErrorItem {\\n uint16 status;\\n string message;\\n}\\n\\nstruct MulticallData {\\n bytes name;\\n bytes[] data;\\n string[] gateways;\\n bytes4 callbackFunction;\\n bool isWildcard;\\n address resolver;\\n bytes metaData;\\n bool[] failures;\\n}\\n\\nstruct MulticallChecks {\\n bool isCallback;\\n bool hasExtendedResolver;\\n}\\n\\nstruct OffchainLookupCallData {\\n address sender;\\n string[] urls;\\n bytes callData;\\n}\\n\\nstruct OffchainLookupExtraData {\\n bytes4 callbackFunction;\\n bytes data;\\n}\\n\\nstruct Result {\\n bool success;\\n bytes returnData;\\n}\\n\\ninterface BatchGateway {\\n function query(\\n OffchainLookupCallData[] memory data\\n ) external returns (bool[] memory failures, bytes[] memory responses);\\n}\\n\\n/**\\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\\n * making it possible to make a single smart contract call to resolve an ENS name.\\n */\\ncontract UniversalResolver is ERC165, Ownable {\\n using Address for address;\\n using NameEncoder for string;\\n using BytesUtils for bytes;\\n using HexUtils for bytes;\\n\\n string[] public batchGatewayURLs;\\n ENS public immutable registry;\\n\\n constructor(address _registry, string[] memory _urls) {\\n registry = ENS(_registry);\\n batchGatewayURLs = _urls;\\n }\\n\\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\\n batchGatewayURLs = _urls;\\n }\\n\\n /**\\n * @dev Performs ENS name resolution for the supplied name and resolution data.\\n * @param name The name to resolve, in normalised and DNS-encoded form.\\n * @param data The resolution data, as specified in ENSIP-10.\\n * @return The result of resolving the name.\\n */\\n function resolve(\\n bytes calldata name,\\n bytes memory data\\n ) external view returns (bytes memory, address) {\\n return\\n _resolveSingle(\\n name,\\n data,\\n batchGatewayURLs,\\n this.resolveSingleCallback.selector,\\n \\\"\\\"\\n );\\n }\\n\\n function resolve(\\n bytes calldata name,\\n bytes[] memory data\\n ) external view returns (Result[] memory, address) {\\n return resolve(name, data, batchGatewayURLs);\\n }\\n\\n function resolve(\\n bytes calldata name,\\n bytes memory data,\\n string[] memory gateways\\n ) external view returns (bytes memory, address) {\\n return\\n _resolveSingle(\\n name,\\n data,\\n gateways,\\n this.resolveSingleCallback.selector,\\n \\\"\\\"\\n );\\n }\\n\\n function resolve(\\n bytes calldata name,\\n bytes[] memory data,\\n string[] memory gateways\\n ) public view returns (Result[] memory, address) {\\n return\\n _resolve(name, data, gateways, this.resolveCallback.selector, \\\"\\\");\\n }\\n\\n function _resolveSingle(\\n bytes calldata name,\\n bytes memory data,\\n string[] memory gateways,\\n bytes4 callbackFunction,\\n bytes memory metaData\\n ) public view returns (bytes memory, address) {\\n bytes[] memory dataArr = new bytes[](1);\\n dataArr[0] = data;\\n (Result[] memory results, address resolver) = _resolve(\\n name,\\n dataArr,\\n gateways,\\n callbackFunction,\\n metaData\\n );\\n\\n Result memory result = results[0];\\n\\n _checkResolveSingle(result);\\n\\n return (result.returnData, resolver);\\n }\\n\\n function _resolve(\\n bytes calldata name,\\n bytes[] memory data,\\n string[] memory gateways,\\n bytes4 callbackFunction,\\n bytes memory metaData\\n ) internal view returns (Result[] memory results, address resolverAddress) {\\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\\n resolverAddress = address(resolver);\\n if (resolverAddress == address(0)) {\\n revert ResolverNotFound();\\n }\\n\\n if (!resolverAddress.isContract()) {\\n revert ResolverNotContract();\\n }\\n\\n bool isWildcard = finalOffset != 0;\\n\\n results = _multicall(\\n MulticallData(\\n name,\\n data,\\n gateways,\\n callbackFunction,\\n isWildcard,\\n resolverAddress,\\n metaData,\\n new bool[](data.length)\\n )\\n );\\n }\\n\\n function reverse(\\n bytes calldata reverseName\\n ) external view returns (string memory, address, address, address) {\\n return reverse(reverseName, batchGatewayURLs);\\n }\\n\\n /**\\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\\n */\\n function reverse(\\n bytes calldata reverseName,\\n string[] memory gateways\\n ) public view returns (string memory, address, address, address) {\\n bytes memory encodedCall = abi.encodeCall(\\n INameResolver.name,\\n reverseName.namehash(0)\\n );\\n (\\n bytes memory reverseResolvedData,\\n address reverseResolverAddress\\n ) = _resolveSingle(\\n reverseName,\\n encodedCall,\\n gateways,\\n this.reverseCallback.selector,\\n \\\"\\\"\\n );\\n\\n return\\n getForwardDataFromReverse(\\n reverseResolvedData,\\n reverseResolverAddress,\\n gateways\\n );\\n }\\n\\n function getForwardDataFromReverse(\\n bytes memory resolvedReverseData,\\n address reverseResolverAddress,\\n string[] memory gateways\\n ) internal view returns (string memory, address, address, address) {\\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\\n\\n (bytes memory encodedName, bytes32 namehash) = resolvedName\\n .dnsEncodeName();\\n\\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\\n bytes memory metaData = abi.encode(\\n resolvedName,\\n reverseResolverAddress\\n );\\n (bytes memory resolvedData, address resolverAddress) = this\\n ._resolveSingle(\\n encodedName,\\n encodedCall,\\n gateways,\\n this.reverseCallback.selector,\\n metaData\\n );\\n\\n address resolvedAddress = abi.decode(resolvedData, (address));\\n\\n return (\\n resolvedName,\\n resolvedAddress,\\n reverseResolverAddress,\\n resolverAddress\\n );\\n }\\n\\n function resolveSingleCallback(\\n bytes calldata response,\\n bytes calldata extraData\\n ) external view returns (bytes memory, address) {\\n (Result[] memory results, address resolver, , ) = _resolveCallback(\\n response,\\n extraData,\\n this.resolveSingleCallback.selector\\n );\\n Result memory result = results[0];\\n\\n _checkResolveSingle(result);\\n\\n return (result.returnData, resolver);\\n }\\n\\n function resolveCallback(\\n bytes calldata response,\\n bytes calldata extraData\\n ) external view returns (Result[] memory, address) {\\n (Result[] memory results, address resolver, , ) = _resolveCallback(\\n response,\\n extraData,\\n this.resolveCallback.selector\\n );\\n return (results, resolver);\\n }\\n\\n function reverseCallback(\\n bytes calldata response,\\n bytes calldata extraData\\n ) external view returns (string memory, address, address, address) {\\n (\\n Result[] memory results,\\n address resolverAddress,\\n string[] memory gateways,\\n bytes memory metaData\\n ) = _resolveCallback(\\n response,\\n extraData,\\n this.reverseCallback.selector\\n );\\n\\n Result memory result = results[0];\\n\\n _checkResolveSingle(result);\\n\\n if (metaData.length > 0) {\\n (string memory resolvedName, address reverseResolverAddress) = abi\\n .decode(metaData, (string, address));\\n address resolvedAddress = abi.decode(result.returnData, (address));\\n return (\\n resolvedName,\\n resolvedAddress,\\n reverseResolverAddress,\\n resolverAddress\\n );\\n }\\n\\n return\\n getForwardDataFromReverse(\\n result.returnData,\\n resolverAddress,\\n gateways\\n );\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override returns (bool) {\\n return\\n interfaceId == type(IExtendedResolver).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n function _resolveCallback(\\n bytes calldata response,\\n bytes calldata extraData,\\n bytes4 callbackFunction\\n )\\n internal\\n view\\n returns (Result[] memory, address, string[] memory, bytes memory)\\n {\\n MulticallData memory multicallData;\\n multicallData.callbackFunction = callbackFunction;\\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\\n response,\\n (bool[], bytes[])\\n );\\n OffchainLookupExtraData[] memory extraDatas;\\n (\\n multicallData.isWildcard,\\n multicallData.resolver,\\n multicallData.gateways,\\n multicallData.metaData,\\n extraDatas\\n ) = abi.decode(\\n extraData,\\n (bool, address, string[], bytes, OffchainLookupExtraData[])\\n );\\n require(responses.length <= extraDatas.length);\\n multicallData.data = new bytes[](extraDatas.length);\\n multicallData.failures = new bool[](extraDatas.length);\\n uint256 offchainCount = 0;\\n for (uint256 i = 0; i < extraDatas.length; i++) {\\n if (extraDatas[i].callbackFunction == bytes4(0)) {\\n // This call did not require an offchain lookup; use the previous input data.\\n multicallData.data[i] = extraDatas[i].data;\\n } else {\\n if (failures[offchainCount]) {\\n multicallData.failures[i] = true;\\n multicallData.data[i] = responses[offchainCount];\\n } else {\\n multicallData.data[i] = abi.encodeWithSelector(\\n extraDatas[i].callbackFunction,\\n responses[offchainCount],\\n extraDatas[i].data\\n );\\n }\\n offchainCount = offchainCount + 1;\\n }\\n }\\n\\n return (\\n _multicall(multicallData),\\n multicallData.resolver,\\n multicallData.gateways,\\n multicallData.metaData\\n );\\n }\\n\\n /**\\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\\n * the error with the data necessary to continue the request where it left off.\\n * @param target The address to call.\\n * @param data The data to call `target` with.\\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\\n * @return result Whether the call succeeded.\\n */\\n function callWithOffchainLookupPropagation(\\n address target,\\n bytes memory data,\\n bool isSafe\\n )\\n internal\\n view\\n returns (\\n bool offchain,\\n bytes memory returnData,\\n OffchainLookupExtraData memory extraData,\\n bool result\\n )\\n {\\n if (isSafe) {\\n result = LowLevelCallUtils.functionStaticCall(target, data);\\n } else {\\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\\n }\\n uint256 size = LowLevelCallUtils.returnDataSize();\\n\\n if (result) {\\n return (\\n false,\\n LowLevelCallUtils.readReturnData(0, size),\\n extraData,\\n true\\n );\\n }\\n\\n // Failure\\n if (size >= 4) {\\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\\n // Offchain lookup. Decode the revert message and create our own that nests it.\\n bytes memory revertData = LowLevelCallUtils.readReturnData(\\n 4,\\n size - 4\\n );\\n if (bytes4(errorId) == OffchainLookup.selector) {\\n (\\n address wrappedSender,\\n string[] memory wrappedUrls,\\n bytes memory wrappedCallData,\\n bytes4 wrappedCallbackFunction,\\n bytes memory wrappedExtraData\\n ) = abi.decode(\\n revertData,\\n (address, string[], bytes, bytes4, bytes)\\n );\\n if (wrappedSender == target) {\\n returnData = abi.encode(\\n OffchainLookupCallData(\\n wrappedSender,\\n wrappedUrls,\\n wrappedCallData\\n )\\n );\\n extraData = OffchainLookupExtraData(\\n wrappedCallbackFunction,\\n wrappedExtraData\\n );\\n return (true, returnData, extraData, false);\\n }\\n } else {\\n returnData = bytes.concat(errorId, revertData);\\n return (false, returnData, extraData, false);\\n }\\n }\\n }\\n\\n /**\\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\\n * removing labels until it finds a result.\\n * @param name The name to resolve, in DNS-encoded and normalised form.\\n * @return resolver The Resolver responsible for this name.\\n * @return namehash The namehash of the full name.\\n * @return finalOffset The offset of the first label with a resolver.\\n */\\n function findResolver(\\n bytes calldata name\\n ) public view returns (Resolver, bytes32, uint256) {\\n (\\n address resolver,\\n bytes32 namehash,\\n uint256 finalOffset\\n ) = findResolver(name, 0);\\n return (Resolver(resolver), namehash, finalOffset);\\n }\\n\\n function findResolver(\\n bytes calldata name,\\n uint256 offset\\n ) internal view returns (address, bytes32, uint256) {\\n uint256 labelLength = uint256(uint8(name[offset]));\\n if (labelLength == 0) {\\n return (address(0), bytes32(0), offset);\\n }\\n uint256 nextLabel = offset + labelLength + 1;\\n bytes32 labelHash;\\n if (\\n labelLength == 66 &&\\n // 0x5b == '['\\n name[offset + 1] == 0x5b &&\\n // 0x5d == ']'\\n name[nextLabel - 1] == 0x5d\\n ) {\\n // Encrypted label\\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\\n .hexStringToBytes32(0, 64);\\n } else {\\n labelHash = keccak256(name[offset + 1:nextLabel]);\\n }\\n (\\n address parentresolver,\\n bytes32 parentnode,\\n uint256 parentoffset\\n ) = findResolver(name, nextLabel);\\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\\n address resolver = registry.resolver(node);\\n if (resolver != address(0)) {\\n return (resolver, node, offset);\\n }\\n return (parentresolver, node, parentoffset);\\n }\\n\\n function _checkInterface(\\n address resolver,\\n bytes4 interfaceId\\n ) internal view returns (bool) {\\n try\\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\\n returns (bool supported) {\\n return supported;\\n } catch {\\n return false;\\n }\\n }\\n\\n function _checkSafetyAndItem(\\n bytes memory name,\\n bytes memory item,\\n address resolver,\\n MulticallChecks memory multicallChecks\\n ) internal view returns (bool, bytes memory) {\\n if (!multicallChecks.isCallback) {\\n if (multicallChecks.hasExtendedResolver) {\\n return (\\n true,\\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\\n );\\n }\\n return (_checkInterface(resolver, bytes4(item)), item);\\n }\\n return (true, item);\\n }\\n\\n function _checkMulticall(\\n MulticallData memory multicallData\\n ) internal view returns (MulticallChecks memory) {\\n bool isCallback = multicallData.name.length == 0;\\n bool hasExtendedResolver = _checkInterface(\\n multicallData.resolver,\\n type(IExtendedResolver).interfaceId\\n );\\n\\n if (multicallData.isWildcard && !hasExtendedResolver) {\\n revert ResolverWildcardNotSupported();\\n }\\n\\n return MulticallChecks(isCallback, hasExtendedResolver);\\n }\\n\\n function _checkResolveSingle(Result memory result) internal pure {\\n if (!result.success) {\\n if (bytes4(result.returnData) == HttpError.selector) {\\n bytes memory returnData = result.returnData;\\n assembly {\\n revert(add(returnData, 32), mload(returnData))\\n }\\n }\\n revert ResolverError(result.returnData);\\n }\\n }\\n\\n function _multicall(\\n MulticallData memory multicallData\\n ) internal view returns (Result[] memory results) {\\n uint256 length = multicallData.data.length;\\n uint256 offchainCount = 0;\\n OffchainLookupCallData[]\\n memory callDatas = new OffchainLookupCallData[](length);\\n OffchainLookupExtraData[]\\n memory extraDatas = new OffchainLookupExtraData[](length);\\n results = new Result[](length);\\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\\n\\n for (uint256 i = 0; i < length; i++) {\\n bytes memory item = multicallData.data[i];\\n bool failure = multicallData.failures[i];\\n\\n if (failure) {\\n results[i] = Result(false, item);\\n continue;\\n }\\n\\n bool isSafe = false;\\n (isSafe, item) = _checkSafetyAndItem(\\n multicallData.name,\\n item,\\n multicallData.resolver,\\n multicallChecks\\n );\\n\\n (\\n bool offchain,\\n bytes memory returnData,\\n OffchainLookupExtraData memory extraData,\\n bool success\\n ) = callWithOffchainLookupPropagation(\\n multicallData.resolver,\\n item,\\n isSafe\\n );\\n\\n if (offchain) {\\n callDatas[offchainCount] = abi.decode(\\n returnData,\\n (OffchainLookupCallData)\\n );\\n extraDatas[i] = extraData;\\n offchainCount += 1;\\n continue;\\n }\\n\\n if (success && multicallChecks.hasExtendedResolver) {\\n // if this is a successful resolve() call, unwrap the result\\n returnData = abi.decode(returnData, (bytes));\\n }\\n results[i] = Result(success, returnData);\\n extraDatas[i].data = item;\\n }\\n\\n if (offchainCount == 0) {\\n return results;\\n }\\n\\n // Trim callDatas if offchain data exists\\n assembly {\\n mstore(callDatas, offchainCount)\\n }\\n\\n revert OffchainLookup(\\n address(this),\\n multicallData.gateways,\\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\\n multicallData.callbackFunction,\\n abi.encode(\\n multicallData.isWildcard,\\n multicallData.resolver,\\n multicallData.gateways,\\n multicallData.metaData,\\n extraDatas\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x2a03a3a94a411b599690e58634c2c5695561cbe4a16fae60cbfefa872a6c2f7b\",\"license\":\"MIT\"},\"contracts/wrapper/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes32) {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n}\\n\",\"keccak256\":\"0xf862cd86d749158a554e3cb517efa9097331ec0cf7225117f21e96fb50c67edb\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040523480156200001157600080fd5b5060405162003b0f38038062003b0f8339810160408190526200003491620001da565b6200003f336200006a565b6001600160a01b038216608052805162000061906001906020840190620000ba565b5050506200049c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b82805482825590600052602060002090810192821562000105579160200282015b82811115620001055782518290620000f49082620003d0565b5091602001919060010190620000db565b506200011392915062000117565b5090565b80821115620001135760006200012e828262000138565b5060010162000117565b508054620001469062000341565b6000825580601f1062000157575050565b601f0160209004906000526020600020908101906200017791906200017a565b50565b5b808211156200011357600081556001016200017b565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620001d257620001d262000191565b604052919050565b6000806040808486031215620001ef57600080fd5b83516001600160a01b03811681146200020757600080fd5b602085810151919450906001600160401b03808211156200022757600080fd5b8187019150601f88818401126200023d57600080fd5b82518281111562000252576200025262000191565b8060051b62000263868201620001a7565b918252848101860191868101908c8411156200027e57600080fd5b87870192505b838310156200032e578251868111156200029e5760008081fd5b8701603f81018e13620002b15760008081fd5b8881015187811115620002c857620002c862000191565b620002db818801601f19168b01620001a7565b8181528f8c838501011115620002f15760008081fd5b60005b8281101562000311578381018d01518282018d01528b01620002f4565b5060009181018b0191909152835250918701919087019062000284565b8099505050505050505050509250929050565b600181811c908216806200035657607f821691505b6020821081036200037757634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003cb57600081815260208120601f850160051c81016020861015620003a65750805b601f850160051c820191505b81811015620003c757828155600101620003b2565b5050505b505050565b81516001600160401b03811115620003ec57620003ec62000191565b6200040481620003fd845462000341565b846200037d565b602080601f8311600181146200043c5760008415620004235750858301515b600019600386901b1c1916600185901b178555620003c7565b600085815260208120601f198616915b828110156200046d578886015182559484019460019091019084016200044c565b50858210156200048c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b608051613650620004bf600039600081816101ea01526114fc01526136506000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c80638e5ea8df116100b2578063b241d0d311610081578063e0a8541211610066578063e0a85412146102ec578063ec11c823146102ff578063f2fde38b1461031257600080fd5b8063b241d0d3146102c6578063b4a85801146102d957600080fd5b80638e5ea8df146102485780639061b9231461025b578063a1cbcbaf1461026e578063a6b16419146102a657600080fd5b8063715018a6116101095780637b103999116100ee5780637b103999146101e55780638da5cb5b146102245780638e25a0f31461023557600080fd5b8063715018a6146101c857806376286c00146101d257600080fd5b806301ffc9a71461013b5780630667cfea14610163578063206c74c9146101845780636dc4fb73146101a5575b600080fd5b61014e6101493660046123d3565b610325565b60405190151581526020015b60405180910390f35b6101766101713660046125f3565b61035c565b60405161015a9291906126d1565b61019761019236600461277c565b610392565b60405161015a9291906127e5565b6101b86101b336600461286e565b61047f565b60405161015a94939291906128da565b6101d0610547565b005b6101976101e0366004612916565b61055b565b61020c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161015a565b6000546001600160a01b031661020c565b610176610243366004612975565b610583565b6101d0610256366004612a3b565b610626565b610176610269366004612a78565b610645565b61028161027c366004612ad7565b61073e565b604080516001600160a01b03909416845260208401929092529082015260600161015a565b6102b96102b4366004612b19565b610764565b60405161015a9190612b32565b6101b86102d4366004612b45565b610810565b6101976102e736600461286e565b610902565b6101766102fa36600461286e565b610946565b6101b861030d366004612ad7565b6109b8565b6101d0610320366004612bb9565b610aab565b60006001600160e01b03198216639061b92360e01b148061035657506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060006103848686868663e0a8541260e01b60405180602001604052806000815250610583565b915091505b94509492505050565b606060006104738585856001805480602002602001604051908101604052809291908181526020016000905b8282101561046a5783829060005260206000200180546103dd90612bd6565b80601f016020809104026020016040519081016040528092919081815260200182805461040990612bd6565b80156104565780601f1061042b57610100808354040283529160200191610456565b820191906000526020600020905b81548152906001019060200180831161043957829003601f168201915b5050505050815260200190600101906103be565b5050505061055b565b91509150935093915050565b6060600080808080808061049d8c8c8c8c636dc4fb7360e01b610b40565b93509350935093506000846000815181106104ba576104ba612c10565b602002602001015190506104cd81610ec6565b81511561051f57600080838060200190518101906104eb9190612c6b565b91509150600083602001518060200190518101906105099190612cbd565b929b50919950975093955061053c945050505050565b61052e81602001518585610f51565b985098509850985050505050505b945094509450949050565b61054f6110b2565b610559600061110c565b565b606060006103848686868663b4a8580160e01b60405180602001604052806000815250611174565b6040805160018082528183019092526060916000918291816020015b606081526020019060019003908161059f57905050905086816000815181106105ca576105ca612c10565b60200260200101819052506000806105e68b8b858b8b8b611174565b915091506000826000815181106105ff576105ff612c10565b6020026020010151905061061281610ec6565b602001519b909a5098505050505050505050565b61062e6110b2565b8051610641906001906020840190612300565b5050565b606060006104738585856001805480602002602001604051908101604052809291908181526020016000905b8282101561071d57838290600052602060002001805461069090612bd6565b80601f01602080910402602001604051908101604052809291908181526020018280546106bc90612bd6565b80156107095780601f106106de57610100808354040283529160200191610709565b820191906000526020600020905b8154815290600101906020018083116106ec57829003601f168201915b505050505081526020019060010190610671565b5050505063e0a8541260e01b60405180602001604052806000815250610583565b600080600080600080610753888860006112f5565b919750955093505050509250925092565b6001818154811061077457600080fd5b90600052602060002001600091509050805461078f90612bd6565b80601f01602080910402602001604051908101604052809291908181526020018280546107bb90612bd6565b80156108085780601f106107dd57610100808354040283529160200191610808565b820191906000526020600020905b8154815290600101906020018083116107eb57829003601f168201915b505050505081565b606060008060008061085c600089898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506115a39050565b60405160240161086e91815260200190565b60408051601f19818403018152918152602080830180516001600160e01b03167f691f3431000000000000000000000000000000000000000000000000000000001790528151908101909152600080825291925081906108de908b908b9086908c90636dc4fb7360e01b90610583565b915091506108ed82828a610f51565b96509650965096505050505b93509350935093565b606060008080610935888888887fb4a8580100000000000000000000000000000000000000000000000000000000610b40565b50919a909950975050505050505050565b606060008080610979888888887fe0a8541200000000000000000000000000000000000000000000000000000000610b40565b50509150915060008260008151811061099457610994612c10565b602002602001015190506109a781610ec6565b602001519890975095505050505050565b60606000806000610a9b86866001805480602002602001604051908101604052809291908181526020016000905b82821015610a92578382906000526020600020018054610a0590612bd6565b80601f0160208091040260200160405190810160405280929190818152602001828054610a3190612bd6565b8015610a7e5780601f10610a5357610100808354040283529160200191610a7e565b820191906000526020600020905b815481529060010190602001808311610a6157829003601f168201915b5050505050815260200190600101906109e6565b50505050610810565b9299919850965090945092505050565b610ab36110b2565b6001600160a01b038116610b345760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610b3d8161110c565b50565b60606000606080610ba460405180610100016040528060608152602001606081526020016060815260200160006001600160e01b031916815260200160001515815260200160006001600160a01b0316815260200160608152602001606081525090565b6001600160e01b031986166060820152600080610bc38b8d018d612ce8565b90925090506060610bd68a8c018c612da0565b60c089019190915260408801919091526001600160a01b0390911660a08701529015156080860152805183519192501015610c1057600080fd5b805167ffffffffffffffff811115610c2a57610c2a612439565b604051908082528060200260200182016040528015610c5d57816020015b6060815260200190600190039081610c485790505b506020850152805167ffffffffffffffff811115610c7d57610c7d612439565b604051908082528060200260200182016040528015610ca6578160200160208202803683370190505b5060e08501526000805b8251811015610e94578251600090849083908110610cd057610cd0612c10565b6020026020010151600001516001600160e01b03191603610d2f57828181518110610cfd57610cfd612c10565b60200260200101516020015186602001518281518110610d1f57610d1f612c10565b6020026020010181905250610e82565b848281518110610d4157610d41612c10565b602002602001015115610db85760018660e001518281518110610d6657610d66612c10565b602002602001019015159081151581525050838281518110610d8a57610d8a612c10565b602002602001015186602001518281518110610da857610da8612c10565b6020026020010181905250610e74565b828181518110610dca57610dca612c10565b602002602001015160000151848381518110610de857610de8612c10565b6020026020010151848381518110610e0257610e02612c10565b602002602001015160200151604051602401610e1f929190612f24565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b03838183161783525050505086602001518281518110610e6857610e68612c10565b60200260200101819052505b610e7f826001612f68565b91505b80610e8c81612f7b565b915050610cb0565b50610e9e85611662565b8560a0015186604001518760c001519850985098509850505050505095509550955095915050565b8051610b3d5760208101517fca7a4e750000000000000000000000000000000000000000000000000000000090610efc90612f94565b6001600160e01b03191603610f1957602080820151805190918201fd5b80602001516040517f95c0c752000000000000000000000000000000000000000000000000000000008152600401610b2b9190612b32565b606060008060008087806020019051810190610f6d9190612fcc565b9050600080610f7b83611a50565b91509150600081604051602401610f9491815260200190565b60408051601f19818403018152918152602080830180516001600160e01b03167f3b3b57de000000000000000000000000000000000000000000000000000000001790529051919250600091610fee9187918e91016126d1565b6040516020818303038152906040529050600080306001600160a01b0316638e25a0f387868f636dc4fb7360e01b886040518663ffffffff1660e01b815260040161103d959493929190613056565b600060405180830381865afa15801561105a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110829190810190612c6b565b9150915060008280602001905181019061109c9190612cbd565b979f979e50909b50959950505050505050505050565b6000546001600160a01b031633146105595760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b2b565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606060008060006111858a8a61073e565b919450849350909150506001600160a01b0382166111cf576040517f7199966d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0383163b611210576040517f4981ac0500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516101206020601f8d01819004028201810190925261010081018b8152831515926112e5929182918f908f9081908501838280828437600092019190915250505090825250602081018c9052604081018b90526001600160e01b03198a16606082015283151560808201526001600160a01b03871660a082015260c081018990528b5160e09091019067ffffffffffffffff8111156112b4576112b4612439565b6040519080825280602002602001820160405280156112dd578160200160208202803683370190505b509052611662565b9450505050965096945050505050565b60008060008086868681811061130d5761130d612c10565b919091013560f81c915050600081900361133157506000925082915083905061159a565b600061133d8287612f68565b611348906001612f68565b9050600082604214801561138e57508888611364896001612f68565b81811061137357611373612c10565b9050013560f81c60f81b6001600160f81b031916605b60f81b145b80156113cc575088886113a26001856130bf565b8181106113b1576113b1612c10565b9050013560f81c60f81b6001600160f81b031916605d60f81b145b156114445761143c600060408b8b6113e58c6002612f68565b906113f16001896130bf565b926113fe939291906130d2565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929493925050611c799050565b509050611476565b8888611451896001612f68565b61145d928592906130d2565b60405161146b9291906130fc565b604051809103902090505b60008060006114868c8c876112f5565b925092509250600082856040516020016114aa929190918252602082015260400190565b60408051601f198184030181529082905280516020909101207f0178b8bf0000000000000000000000000000000000000000000000000000000082526004820181905291506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630178b8bf90602401602060405180830381865afa158015611543573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115679190612cbd565b90506001600160a01b0381161561158b579950975089965061159a95505050505050565b50929850919650909450505050505b93509350939050565b60008060006115b28585611dcd565b90925090508161162457600185516115ca91906130bf565b84146116185760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d650000006044820152606401610b2b565b50600091506103569050565b61162e85826115a3565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b6020810151516060906000808267ffffffffffffffff81111561168757611687612439565b6040519080825280602002602001820160405280156116e557816020015b6116d2604051806060016040528060006001600160a01b0316815260200160608152602001606081525090565b8152602001906001900390816116a55790505b50905060008367ffffffffffffffff81111561170357611703612439565b60405190808252806020026020018201604052801561174957816020015b6040805180820190915260008152606060208201528152602001906001900390816117215790505b5090508367ffffffffffffffff81111561176557611765612439565b6040519080825280602002602001820160405280156117ab57816020015b6040805180820190915260008152606060208201528152602001906001900390816117835790505b50945060006117b987611e84565b905060005b8581101561198f576000886020015182815181106117de576117de612c10565b6020026020010151905060008960e00151838151811061180057611800612c10565b60200260200101519050801561184c5760405180604001604052806000151581526020018381525089848151811061183a5761183a612c10565b6020026020010181905250505061197d565b60006118628b60000151848d60a0015188611f1b565b809450819250505060008060008061187f8f60a001518887611fa3565b935093509350935083156118f557828060200190518101906118a1919061318c565b8b8d815181106118b3576118b3612c10565b6020026020010181905250818a89815181106118d1576118d1612c10565b60209081029190910101526118e760018d612f68565b9b505050505050505061197d565b808015611903575088602001515b1561191f578280602001905181019061191c9190612fcc565b92505b60405180604001604052808215158152602001848152508e898151811061194857611948612c10565b6020026020010181905250868a898151811061196657611966612c10565b602002602001015160200181905250505050505050505b8061198781612f7b565b9150506117be565b50836000036119a2575050505050919050565b83835230876040015163a780bab660e01b856040516024016119c49190613287565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b03838183161783525050505089606001518a608001518b60a001518c604001518d60c0015189604051602001611a259594939291906132e9565b60408051601f1981840301815290829052630556f18360e41b8252610b2b95949392916004016133a6565b805160609060009081908490611a67816002612f68565b67ffffffffffffffff811115611a7f57611a7f612439565b6040519080825280601f01601f191660200182016040528015611aa9576020820181803683370190505b50945060009350808403611aee57600060f81b85600081518110611acf57611acf612c10565b60200101906001600160f81b031916908160001a905350505050915091565b60001981015b828181518110611b0657611b06612c10565b01602001517fff00000000000000000000000000000000000000000000000000000000000000167f2e0000000000000000000000000000000000000000000000000000000000000003611bc8578360f81b868260010181518110611b6c57611b6c612c10565b60200101906001600160f81b031916908160001a90535084611b95846001840160ff881661215b565b60408051602081019390935282015260600160405160208183030381529060405280519060200120945060009350611c18565b600184019350828181518110611be057611be0612c10565b602001015160f81c60f81b868260010181518110611c0057611c00612c10565b60200101906001600160f81b031916908160001a9053505b8015611c275760001901611af4565b5083611c3883600060ff871661215b565b6040805160208101939093528201526060016040516020818303038152906040528051906020012093508260f81b85600081518110611acf57611acf612c10565b60008080611c8785856130bf565b905080604014158015611c9b575080602814155b80611cb05750611cac6002826133da565b6001145b15611cfd5760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610b2b565b600191508551841115611d0f57600080fd5b611d60565b6000603a8210602f83111615611d2c5750602f190190565b60478210604083111615611d4257506036190190565b60678210606083111615611d5857506056190190565b5060ff919050565b60208601855b85811015611dc257611d7d8183015160001a611d14565b611d8f6001830184015160001a611d14565b60ff811460ff83141715611da857600095505050611dc2565b60049190911b1760089590951b9490941793600201611d66565b505050935093915050565b60008083518310611e205760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e647300006044820152606401610b2b565b6000848481518110611e3457611e34612c10565b016020015160f81c90508015611e6057611e5985611e53866001612f68565b8361215b565b9250611e65565b600092505b611e6f8185612f68565b611e7a906001612f68565b9150509250929050565b604080518082019091526000808252602082015281515160a0830151901590600090611eb790639061b92360e01b61217f565b905083608001518015611ec8575080155b15611eff576040517f82c2c72800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805180820190915291151582521515602082015292915050565b600060608260000151611f9757826020015115611f7b5760018686604051602401611f47929190612f24565b60408051601f198184030181529190526020810180516001600160e01b0316639061b92360e01b1790529092509050610389565b611f8d84611f8887612f94565b61217f565b8591509150610389565b50600195939450505050565b604080518082019091526000808252606060208301819052909160008415611fd657611fcf8787612204565b9050611fe6565b611fe3878761c350612218565b90505b3d811561200a576000611ffa6000836122ab565b9095509350600191506108f99050565b60048110612151576000612020600060046122ab565b90506000612038600461203381866130bf565b6122ab565b9050630556f18360e41b61204b83612f94565b6001600160e01b031916036121195760008060008060008580602001905181019061207691906133fc565b945094509450945094508e6001600160a01b0316856001600160a01b03160361210f576040518060600160405280866001600160a01b03168152602001858152602001848152506040516020016120cd91906134ac565b60408051601f198184030181528282019091526001600160e01b03199093168152602081019190915260019b509099509750600096506108f995505050505050565b505050505061214e565b818160405160200161212c9291906134bf565b60408051601f198184030181529190526000975095508693506108f992505050565b50505b5093509350935093565b825160009061216a8385612f68565b111561217557600080fd5b5091016020012090565b6040516301ffc9a760e01b81526001600160e01b0319821660048201526000906001600160a01b038416906301ffc9a79061c350906024016020604051808303818786fa935050505080156121f1575060408051601f3d908101601f191682019092526121ee918101906134ee565b60015b6121fd57506000610356565b9050610356565b600061221183835a612218565b9392505050565b60006001600160a01b0384163b6122975760405162461bcd60e51b815260206004820152602e60248201527f4c6f774c6576656c43616c6c5574696c733a207374617469632063616c6c207460448201527f6f206e6f6e2d636f6e74726163740000000000000000000000000000000000006064820152608401610b2b565b6000808451602086018786fa949350505050565b60608167ffffffffffffffff8111156122c6576122c6612439565b6040519080825280601f01601f1916602001820160405280156122f0576020820181803683370190505b5090508183602083013e92915050565b828054828255906000526020600020908101928215612346579160200282015b828111156123465782518290612336908261355a565b5091602001919060010190612320565b50612352929150612356565b5090565b8082111561235257600061236a8282612373565b50600101612356565b50805461237f90612bd6565b6000825580601f1061238f575050565b601f016020900490600052602060002090810190610b3d91905b8082111561235257600081556001016123a9565b6001600160e01b031981168114610b3d57600080fd5b6000602082840312156123e557600080fd5b8135612211816123bd565b60008083601f84011261240257600080fd5b50813567ffffffffffffffff81111561241a57600080fd5b60208301915083602082850101111561243257600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561247257612472612439565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156124a1576124a1612439565b604052919050565b600067ffffffffffffffff8211156124c3576124c3612439565b50601f01601f191660200190565b60006124e46124df846124a9565b612478565b90508281528383830111156124f857600080fd5b828260208301376000602084830101529392505050565b600082601f83011261252057600080fd5b612211838335602085016124d1565b600067ffffffffffffffff82111561254957612549612439565b5060051b60200190565b600082601f83011261256457600080fd5b813560206125746124df8361252f565b82815260059290921b8401810191818101908684111561259357600080fd5b8286015b848110156125e857803567ffffffffffffffff8111156125b75760008081fd5b8701603f810189136125c95760008081fd5b6125da8986830135604084016124d1565b845250918301918301612597565b509695505050505050565b6000806000806060858703121561260957600080fd5b843567ffffffffffffffff8082111561262157600080fd5b61262d888389016123f0565b9096509450602087013591508082111561264657600080fd5b6126528883890161250f565b9350604087013591508082111561266857600080fd5b5061267587828801612553565b91505092959194509250565b60005b8381101561269c578181015183820152602001612684565b50506000910152565b600081518084526126bd816020860160208601612681565b601f01601f19169290920160200192915050565b6040815260006126e460408301856126a5565b90506001600160a01b03831660208301529392505050565b600082601f83011261270d57600080fd5b8135602061271d6124df8361252f565b82815260059290921b8401810191818101908684111561273c57600080fd5b8286015b848110156125e857803567ffffffffffffffff8111156127605760008081fd5b61276e8986838b010161250f565b845250918301918301612740565b60008060006040848603121561279157600080fd5b833567ffffffffffffffff808211156127a957600080fd5b6127b5878388016123f0565b909550935060208601359150808211156127ce57600080fd5b506127db868287016126fc565b9150509250925092565b6000604080830181845280865180835260608601915060608160051b8701019250602080890160005b8381101561284f57888603605f19018552815180511515875283015183870188905261283c888801826126a5565b965050938201939082019060010161280e565b50508395506001600160a01b0388168188015250505050509392505050565b6000806000806040858703121561288457600080fd5b843567ffffffffffffffff8082111561289c57600080fd5b6128a8888389016123f0565b909650945060208701359150808211156128c157600080fd5b506128ce878288016123f0565b95989497509550505050565b6080815260006128ed60808301876126a5565b6001600160a01b0395861660208401529385166040830152509216606090920191909152919050565b6000806000806060858703121561292c57600080fd5b843567ffffffffffffffff8082111561294457600080fd5b612950888389016123f0565b9096509450602087013591508082111561296957600080fd5b612652888389016126fc565b60008060008060008060a0878903121561298e57600080fd5b863567ffffffffffffffff808211156129a657600080fd5b6129b28a838b016123f0565b909850965060208901359150808211156129cb57600080fd5b6129d78a838b0161250f565b955060408901359150808211156129ed57600080fd5b6129f98a838b01612553565b945060608901359150612a0b826123bd565b90925060808801359080821115612a2157600080fd5b50612a2e89828a0161250f565b9150509295509295509295565b600060208284031215612a4d57600080fd5b813567ffffffffffffffff811115612a6457600080fd5b612a7084828501612553565b949350505050565b600080600060408486031215612a8d57600080fd5b833567ffffffffffffffff80821115612aa557600080fd5b612ab1878388016123f0565b90955093506020860135915080821115612aca57600080fd5b506127db8682870161250f565b60008060208385031215612aea57600080fd5b823567ffffffffffffffff811115612b0157600080fd5b612b0d858286016123f0565b90969095509350505050565b600060208284031215612b2b57600080fd5b5035919050565b60208152600061221160208301846126a5565b600080600060408486031215612b5a57600080fd5b833567ffffffffffffffff80821115612b7257600080fd5b612b7e878388016123f0565b90955093506020860135915080821115612b9757600080fd5b506127db86828701612553565b6001600160a01b0381168114610b3d57600080fd5b600060208284031215612bcb57600080fd5b813561221181612ba4565b600181811c90821680612bea57607f821691505b602082108103612c0a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b600082601f830112612c3757600080fd5b8151612c456124df826124a9565b818152846020838601011115612c5a57600080fd5b612a70826020830160208701612681565b60008060408385031215612c7e57600080fd5b825167ffffffffffffffff811115612c9557600080fd5b612ca185828601612c26565b9250506020830151612cb281612ba4565b809150509250929050565b600060208284031215612ccf57600080fd5b815161221181612ba4565b8015158114610b3d57600080fd5b60008060408385031215612cfb57600080fd5b823567ffffffffffffffff80821115612d1357600080fd5b818501915085601f830112612d2757600080fd5b81356020612d376124df8361252f565b82815260059290921b84018101918181019089841115612d5657600080fd5b948201945b83861015612d7d578535612d6e81612cda565b82529482019490820190612d5b565b96505086013592505080821115612d9357600080fd5b50611e7a858286016126fc565b600080600080600060a08688031215612db857600080fd5b612dc28635612cda565b85359450612dd36020870135612ba4565b6020860135935067ffffffffffffffff8060408801351115612df457600080fd5b612e048860408901358901612553565b93508060608801351115612e1757600080fd5b612e27886060890135890161250f565b92508060808801351115612e3a57600080fd5b6080870135870188601f820112612e5057600080fd5b612e5d6124df823561252f565b81358082526020808301929160051b8401018b1015612e7b57600080fd5b602083015b6020843560051b850101811015612f12578481351115612e9f57600080fd5b803584016040818e03601f19011215612eb757600080fd5b612ebf61244f565b612ecc60208301356123bd565b602082013581528660408301351115612ee457600080fd5b612ef78e6020604085013585010161250f565b60208201528085525050602083019250602081019050612e80565b50809450505050509295509295909350565b604081526000612f3760408301856126a5565b8281036020840152612f4981856126a5565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561035657610356612f52565b600060018201612f8d57612f8d612f52565b5060010190565b6000815160208301516001600160e01b031980821693506004831015612fc45780818460040360031b1b83161693505b505050919050565b600060208284031215612fde57600080fd5b815167ffffffffffffffff811115612ff557600080fd5b612a7084828501612c26565b600081518084526020808501808196508360051b8101915082860160005b858110156130495782840389526130378483516126a5565b9885019893509084019060010161301f565b5091979650505050505050565b60a08152600061306960a08301886126a5565b828103602084015261307b81886126a5565b9050828103604084015261308f8187613001565b90506001600160e01b03198516606084015282810360808401526130b381856126a5565b98975050505050505050565b8181038181111561035657610356612f52565b600080858511156130e257600080fd5b838611156130ef57600080fd5b5050820193919092039150565b8183823760009101908152919050565b600082601f83011261311d57600080fd5b8151602061312d6124df8361252f565b82815260059290921b8401810191818101908684111561314c57600080fd5b8286015b848110156125e857805167ffffffffffffffff8111156131705760008081fd5b61317e8986838b0101612c26565b845250918301918301613150565b60006020828403121561319e57600080fd5b815167ffffffffffffffff808211156131b657600080fd5b90830190606082860312156131ca57600080fd5b6040516060810181811083821117156131e5576131e5612439565b60405282516131f381612ba4565b815260208301518281111561320757600080fd5b6132138782860161310c565b60208301525060408301518281111561322b57600080fd5b61323787828601612c26565b60408301525095945050505050565b6001600160a01b038151168252600060208201516060602085015261326e6060850182613001565b905060408301518482036040860152612f4982826126a5565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156132dc57603f198886030184526132ca858351613246565b945092850192908501906001016132ae565b5092979650505050505050565b8515158152600060206001600160a01b03871681840152604060a08185015261331560a0850188613001565b848103606086015261332781886126a5565b905084810360808601528086518083528483019150848160051b84010185890160005b8381101561339357858303601f19018552815180516001600160e01b0319168452880151888401889052613380888501826126a5565b958901959350509087019060010161334a565b50909d9c50505050505050505050505050565b6001600160a01b038616815260a0602082015260006133c860a0830187613001565b828103604084015261308f81876126a5565b6000826133f757634e487b7160e01b600052601260045260246000fd5b500690565b600080600080600060a0868803121561341457600080fd5b855161341f81612ba4565b602087015190955067ffffffffffffffff8082111561343d57600080fd5b61344989838a0161310c565b9550604088015191508082111561345f57600080fd5b61346b89838a01612c26565b94506060880151915061347d826123bd565b60808801519193508082111561349257600080fd5b5061349f88828901612c26565b9150509295509295909350565b6020815260006122116020830184613246565b600083516134d1818460208801612681565b8351908301906134e5818360208801612681565b01949350505050565b60006020828403121561350057600080fd5b815161221181612cda565b601f82111561355557600081815260208120601f850160051c810160208610156135325750805b601f850160051c820191505b818110156135515782815560010161353e565b5050505b505050565b815167ffffffffffffffff81111561357457613574612439565b613588816135828454612bd6565b8461350b565b602080601f8311600181146135bd57600084156135a55750858301515b600019600386901b1c1916600185901b178555613551565b600085815260208120601f198616915b828110156135ec578886015182559484019460019091019084016135cd565b508582101561360a5787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fea2646970667358221220e80dfb43e469138d4ae0942cde3bd29b693f1811b97ac87db578fe698aaae86764736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101365760003560e01c80638e5ea8df116100b2578063b241d0d311610081578063e0a8541211610066578063e0a85412146102ec578063ec11c823146102ff578063f2fde38b1461031257600080fd5b8063b241d0d3146102c6578063b4a85801146102d957600080fd5b80638e5ea8df146102485780639061b9231461025b578063a1cbcbaf1461026e578063a6b16419146102a657600080fd5b8063715018a6116101095780637b103999116100ee5780637b103999146101e55780638da5cb5b146102245780638e25a0f31461023557600080fd5b8063715018a6146101c857806376286c00146101d257600080fd5b806301ffc9a71461013b5780630667cfea14610163578063206c74c9146101845780636dc4fb73146101a5575b600080fd5b61014e6101493660046123d3565b610325565b60405190151581526020015b60405180910390f35b6101766101713660046125f3565b61035c565b60405161015a9291906126d1565b61019761019236600461277c565b610392565b60405161015a9291906127e5565b6101b86101b336600461286e565b61047f565b60405161015a94939291906128da565b6101d0610547565b005b6101976101e0366004612916565b61055b565b61020c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161015a565b6000546001600160a01b031661020c565b610176610243366004612975565b610583565b6101d0610256366004612a3b565b610626565b610176610269366004612a78565b610645565b61028161027c366004612ad7565b61073e565b604080516001600160a01b03909416845260208401929092529082015260600161015a565b6102b96102b4366004612b19565b610764565b60405161015a9190612b32565b6101b86102d4366004612b45565b610810565b6101976102e736600461286e565b610902565b6101766102fa36600461286e565b610946565b6101b861030d366004612ad7565b6109b8565b6101d0610320366004612bb9565b610aab565b60006001600160e01b03198216639061b92360e01b148061035657506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060006103848686868663e0a8541260e01b60405180602001604052806000815250610583565b915091505b94509492505050565b606060006104738585856001805480602002602001604051908101604052809291908181526020016000905b8282101561046a5783829060005260206000200180546103dd90612bd6565b80601f016020809104026020016040519081016040528092919081815260200182805461040990612bd6565b80156104565780601f1061042b57610100808354040283529160200191610456565b820191906000526020600020905b81548152906001019060200180831161043957829003601f168201915b5050505050815260200190600101906103be565b5050505061055b565b91509150935093915050565b6060600080808080808061049d8c8c8c8c636dc4fb7360e01b610b40565b93509350935093506000846000815181106104ba576104ba612c10565b602002602001015190506104cd81610ec6565b81511561051f57600080838060200190518101906104eb9190612c6b565b91509150600083602001518060200190518101906105099190612cbd565b929b50919950975093955061053c945050505050565b61052e81602001518585610f51565b985098509850985050505050505b945094509450949050565b61054f6110b2565b610559600061110c565b565b606060006103848686868663b4a8580160e01b60405180602001604052806000815250611174565b6040805160018082528183019092526060916000918291816020015b606081526020019060019003908161059f57905050905086816000815181106105ca576105ca612c10565b60200260200101819052506000806105e68b8b858b8b8b611174565b915091506000826000815181106105ff576105ff612c10565b6020026020010151905061061281610ec6565b602001519b909a5098505050505050505050565b61062e6110b2565b8051610641906001906020840190612300565b5050565b606060006104738585856001805480602002602001604051908101604052809291908181526020016000905b8282101561071d57838290600052602060002001805461069090612bd6565b80601f01602080910402602001604051908101604052809291908181526020018280546106bc90612bd6565b80156107095780601f106106de57610100808354040283529160200191610709565b820191906000526020600020905b8154815290600101906020018083116106ec57829003601f168201915b505050505081526020019060010190610671565b5050505063e0a8541260e01b60405180602001604052806000815250610583565b600080600080600080610753888860006112f5565b919750955093505050509250925092565b6001818154811061077457600080fd5b90600052602060002001600091509050805461078f90612bd6565b80601f01602080910402602001604051908101604052809291908181526020018280546107bb90612bd6565b80156108085780601f106107dd57610100808354040283529160200191610808565b820191906000526020600020905b8154815290600101906020018083116107eb57829003601f168201915b505050505081565b606060008060008061085c600089898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506115a39050565b60405160240161086e91815260200190565b60408051601f19818403018152918152602080830180516001600160e01b03167f691f3431000000000000000000000000000000000000000000000000000000001790528151908101909152600080825291925081906108de908b908b9086908c90636dc4fb7360e01b90610583565b915091506108ed82828a610f51565b96509650965096505050505b93509350935093565b606060008080610935888888887fb4a8580100000000000000000000000000000000000000000000000000000000610b40565b50919a909950975050505050505050565b606060008080610979888888887fe0a8541200000000000000000000000000000000000000000000000000000000610b40565b50509150915060008260008151811061099457610994612c10565b602002602001015190506109a781610ec6565b602001519890975095505050505050565b60606000806000610a9b86866001805480602002602001604051908101604052809291908181526020016000905b82821015610a92578382906000526020600020018054610a0590612bd6565b80601f0160208091040260200160405190810160405280929190818152602001828054610a3190612bd6565b8015610a7e5780601f10610a5357610100808354040283529160200191610a7e565b820191906000526020600020905b815481529060010190602001808311610a6157829003601f168201915b5050505050815260200190600101906109e6565b50505050610810565b9299919850965090945092505050565b610ab36110b2565b6001600160a01b038116610b345760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610b3d8161110c565b50565b60606000606080610ba460405180610100016040528060608152602001606081526020016060815260200160006001600160e01b031916815260200160001515815260200160006001600160a01b0316815260200160608152602001606081525090565b6001600160e01b031986166060820152600080610bc38b8d018d612ce8565b90925090506060610bd68a8c018c612da0565b60c089019190915260408801919091526001600160a01b0390911660a08701529015156080860152805183519192501015610c1057600080fd5b805167ffffffffffffffff811115610c2a57610c2a612439565b604051908082528060200260200182016040528015610c5d57816020015b6060815260200190600190039081610c485790505b506020850152805167ffffffffffffffff811115610c7d57610c7d612439565b604051908082528060200260200182016040528015610ca6578160200160208202803683370190505b5060e08501526000805b8251811015610e94578251600090849083908110610cd057610cd0612c10565b6020026020010151600001516001600160e01b03191603610d2f57828181518110610cfd57610cfd612c10565b60200260200101516020015186602001518281518110610d1f57610d1f612c10565b6020026020010181905250610e82565b848281518110610d4157610d41612c10565b602002602001015115610db85760018660e001518281518110610d6657610d66612c10565b602002602001019015159081151581525050838281518110610d8a57610d8a612c10565b602002602001015186602001518281518110610da857610da8612c10565b6020026020010181905250610e74565b828181518110610dca57610dca612c10565b602002602001015160000151848381518110610de857610de8612c10565b6020026020010151848381518110610e0257610e02612c10565b602002602001015160200151604051602401610e1f929190612f24565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b03838183161783525050505086602001518281518110610e6857610e68612c10565b60200260200101819052505b610e7f826001612f68565b91505b80610e8c81612f7b565b915050610cb0565b50610e9e85611662565b8560a0015186604001518760c001519850985098509850505050505095509550955095915050565b8051610b3d5760208101517fca7a4e750000000000000000000000000000000000000000000000000000000090610efc90612f94565b6001600160e01b03191603610f1957602080820151805190918201fd5b80602001516040517f95c0c752000000000000000000000000000000000000000000000000000000008152600401610b2b9190612b32565b606060008060008087806020019051810190610f6d9190612fcc565b9050600080610f7b83611a50565b91509150600081604051602401610f9491815260200190565b60408051601f19818403018152918152602080830180516001600160e01b03167f3b3b57de000000000000000000000000000000000000000000000000000000001790529051919250600091610fee9187918e91016126d1565b6040516020818303038152906040529050600080306001600160a01b0316638e25a0f387868f636dc4fb7360e01b886040518663ffffffff1660e01b815260040161103d959493929190613056565b600060405180830381865afa15801561105a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110829190810190612c6b565b9150915060008280602001905181019061109c9190612cbd565b979f979e50909b50959950505050505050505050565b6000546001600160a01b031633146105595760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b2b565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606060008060006111858a8a61073e565b919450849350909150506001600160a01b0382166111cf576040517f7199966d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0383163b611210576040517f4981ac0500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516101206020601f8d01819004028201810190925261010081018b8152831515926112e5929182918f908f9081908501838280828437600092019190915250505090825250602081018c9052604081018b90526001600160e01b03198a16606082015283151560808201526001600160a01b03871660a082015260c081018990528b5160e09091019067ffffffffffffffff8111156112b4576112b4612439565b6040519080825280602002602001820160405280156112dd578160200160208202803683370190505b509052611662565b9450505050965096945050505050565b60008060008086868681811061130d5761130d612c10565b919091013560f81c915050600081900361133157506000925082915083905061159a565b600061133d8287612f68565b611348906001612f68565b9050600082604214801561138e57508888611364896001612f68565b81811061137357611373612c10565b9050013560f81c60f81b6001600160f81b031916605b60f81b145b80156113cc575088886113a26001856130bf565b8181106113b1576113b1612c10565b9050013560f81c60f81b6001600160f81b031916605d60f81b145b156114445761143c600060408b8b6113e58c6002612f68565b906113f16001896130bf565b926113fe939291906130d2565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929493925050611c799050565b509050611476565b8888611451896001612f68565b61145d928592906130d2565b60405161146b9291906130fc565b604051809103902090505b60008060006114868c8c876112f5565b925092509250600082856040516020016114aa929190918252602082015260400190565b60408051601f198184030181529082905280516020909101207f0178b8bf0000000000000000000000000000000000000000000000000000000082526004820181905291506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630178b8bf90602401602060405180830381865afa158015611543573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115679190612cbd565b90506001600160a01b0381161561158b579950975089965061159a95505050505050565b50929850919650909450505050505b93509350939050565b60008060006115b28585611dcd565b90925090508161162457600185516115ca91906130bf565b84146116185760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d650000006044820152606401610b2b565b50600091506103569050565b61162e85826115a3565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b6020810151516060906000808267ffffffffffffffff81111561168757611687612439565b6040519080825280602002602001820160405280156116e557816020015b6116d2604051806060016040528060006001600160a01b0316815260200160608152602001606081525090565b8152602001906001900390816116a55790505b50905060008367ffffffffffffffff81111561170357611703612439565b60405190808252806020026020018201604052801561174957816020015b6040805180820190915260008152606060208201528152602001906001900390816117215790505b5090508367ffffffffffffffff81111561176557611765612439565b6040519080825280602002602001820160405280156117ab57816020015b6040805180820190915260008152606060208201528152602001906001900390816117835790505b50945060006117b987611e84565b905060005b8581101561198f576000886020015182815181106117de576117de612c10565b6020026020010151905060008960e00151838151811061180057611800612c10565b60200260200101519050801561184c5760405180604001604052806000151581526020018381525089848151811061183a5761183a612c10565b6020026020010181905250505061197d565b60006118628b60000151848d60a0015188611f1b565b809450819250505060008060008061187f8f60a001518887611fa3565b935093509350935083156118f557828060200190518101906118a1919061318c565b8b8d815181106118b3576118b3612c10565b6020026020010181905250818a89815181106118d1576118d1612c10565b60209081029190910101526118e760018d612f68565b9b505050505050505061197d565b808015611903575088602001515b1561191f578280602001905181019061191c9190612fcc565b92505b60405180604001604052808215158152602001848152508e898151811061194857611948612c10565b6020026020010181905250868a898151811061196657611966612c10565b602002602001015160200181905250505050505050505b8061198781612f7b565b9150506117be565b50836000036119a2575050505050919050565b83835230876040015163a780bab660e01b856040516024016119c49190613287565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b03838183161783525050505089606001518a608001518b60a001518c604001518d60c0015189604051602001611a259594939291906132e9565b60408051601f1981840301815290829052630556f18360e41b8252610b2b95949392916004016133a6565b805160609060009081908490611a67816002612f68565b67ffffffffffffffff811115611a7f57611a7f612439565b6040519080825280601f01601f191660200182016040528015611aa9576020820181803683370190505b50945060009350808403611aee57600060f81b85600081518110611acf57611acf612c10565b60200101906001600160f81b031916908160001a905350505050915091565b60001981015b828181518110611b0657611b06612c10565b01602001517fff00000000000000000000000000000000000000000000000000000000000000167f2e0000000000000000000000000000000000000000000000000000000000000003611bc8578360f81b868260010181518110611b6c57611b6c612c10565b60200101906001600160f81b031916908160001a90535084611b95846001840160ff881661215b565b60408051602081019390935282015260600160405160208183030381529060405280519060200120945060009350611c18565b600184019350828181518110611be057611be0612c10565b602001015160f81c60f81b868260010181518110611c0057611c00612c10565b60200101906001600160f81b031916908160001a9053505b8015611c275760001901611af4565b5083611c3883600060ff871661215b565b6040805160208101939093528201526060016040516020818303038152906040528051906020012093508260f81b85600081518110611acf57611acf612c10565b60008080611c8785856130bf565b905080604014158015611c9b575080602814155b80611cb05750611cac6002826133da565b6001145b15611cfd5760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610b2b565b600191508551841115611d0f57600080fd5b611d60565b6000603a8210602f83111615611d2c5750602f190190565b60478210604083111615611d4257506036190190565b60678210606083111615611d5857506056190190565b5060ff919050565b60208601855b85811015611dc257611d7d8183015160001a611d14565b611d8f6001830184015160001a611d14565b60ff811460ff83141715611da857600095505050611dc2565b60049190911b1760089590951b9490941793600201611d66565b505050935093915050565b60008083518310611e205760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e647300006044820152606401610b2b565b6000848481518110611e3457611e34612c10565b016020015160f81c90508015611e6057611e5985611e53866001612f68565b8361215b565b9250611e65565b600092505b611e6f8185612f68565b611e7a906001612f68565b9150509250929050565b604080518082019091526000808252602082015281515160a0830151901590600090611eb790639061b92360e01b61217f565b905083608001518015611ec8575080155b15611eff576040517f82c2c72800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805180820190915291151582521515602082015292915050565b600060608260000151611f9757826020015115611f7b5760018686604051602401611f47929190612f24565b60408051601f198184030181529190526020810180516001600160e01b0316639061b92360e01b1790529092509050610389565b611f8d84611f8887612f94565b61217f565b8591509150610389565b50600195939450505050565b604080518082019091526000808252606060208301819052909160008415611fd657611fcf8787612204565b9050611fe6565b611fe3878761c350612218565b90505b3d811561200a576000611ffa6000836122ab565b9095509350600191506108f99050565b60048110612151576000612020600060046122ab565b90506000612038600461203381866130bf565b6122ab565b9050630556f18360e41b61204b83612f94565b6001600160e01b031916036121195760008060008060008580602001905181019061207691906133fc565b945094509450945094508e6001600160a01b0316856001600160a01b03160361210f576040518060600160405280866001600160a01b03168152602001858152602001848152506040516020016120cd91906134ac565b60408051601f198184030181528282019091526001600160e01b03199093168152602081019190915260019b509099509750600096506108f995505050505050565b505050505061214e565b818160405160200161212c9291906134bf565b60408051601f198184030181529190526000975095508693506108f992505050565b50505b5093509350935093565b825160009061216a8385612f68565b111561217557600080fd5b5091016020012090565b6040516301ffc9a760e01b81526001600160e01b0319821660048201526000906001600160a01b038416906301ffc9a79061c350906024016020604051808303818786fa935050505080156121f1575060408051601f3d908101601f191682019092526121ee918101906134ee565b60015b6121fd57506000610356565b9050610356565b600061221183835a612218565b9392505050565b60006001600160a01b0384163b6122975760405162461bcd60e51b815260206004820152602e60248201527f4c6f774c6576656c43616c6c5574696c733a207374617469632063616c6c207460448201527f6f206e6f6e2d636f6e74726163740000000000000000000000000000000000006064820152608401610b2b565b6000808451602086018786fa949350505050565b60608167ffffffffffffffff8111156122c6576122c6612439565b6040519080825280601f01601f1916602001820160405280156122f0576020820181803683370190505b5090508183602083013e92915050565b828054828255906000526020600020908101928215612346579160200282015b828111156123465782518290612336908261355a565b5091602001919060010190612320565b50612352929150612356565b5090565b8082111561235257600061236a8282612373565b50600101612356565b50805461237f90612bd6565b6000825580601f1061238f575050565b601f016020900490600052602060002090810190610b3d91905b8082111561235257600081556001016123a9565b6001600160e01b031981168114610b3d57600080fd5b6000602082840312156123e557600080fd5b8135612211816123bd565b60008083601f84011261240257600080fd5b50813567ffffffffffffffff81111561241a57600080fd5b60208301915083602082850101111561243257600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561247257612472612439565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156124a1576124a1612439565b604052919050565b600067ffffffffffffffff8211156124c3576124c3612439565b50601f01601f191660200190565b60006124e46124df846124a9565b612478565b90508281528383830111156124f857600080fd5b828260208301376000602084830101529392505050565b600082601f83011261252057600080fd5b612211838335602085016124d1565b600067ffffffffffffffff82111561254957612549612439565b5060051b60200190565b600082601f83011261256457600080fd5b813560206125746124df8361252f565b82815260059290921b8401810191818101908684111561259357600080fd5b8286015b848110156125e857803567ffffffffffffffff8111156125b75760008081fd5b8701603f810189136125c95760008081fd5b6125da8986830135604084016124d1565b845250918301918301612597565b509695505050505050565b6000806000806060858703121561260957600080fd5b843567ffffffffffffffff8082111561262157600080fd5b61262d888389016123f0565b9096509450602087013591508082111561264657600080fd5b6126528883890161250f565b9350604087013591508082111561266857600080fd5b5061267587828801612553565b91505092959194509250565b60005b8381101561269c578181015183820152602001612684565b50506000910152565b600081518084526126bd816020860160208601612681565b601f01601f19169290920160200192915050565b6040815260006126e460408301856126a5565b90506001600160a01b03831660208301529392505050565b600082601f83011261270d57600080fd5b8135602061271d6124df8361252f565b82815260059290921b8401810191818101908684111561273c57600080fd5b8286015b848110156125e857803567ffffffffffffffff8111156127605760008081fd5b61276e8986838b010161250f565b845250918301918301612740565b60008060006040848603121561279157600080fd5b833567ffffffffffffffff808211156127a957600080fd5b6127b5878388016123f0565b909550935060208601359150808211156127ce57600080fd5b506127db868287016126fc565b9150509250925092565b6000604080830181845280865180835260608601915060608160051b8701019250602080890160005b8381101561284f57888603605f19018552815180511515875283015183870188905261283c888801826126a5565b965050938201939082019060010161280e565b50508395506001600160a01b0388168188015250505050509392505050565b6000806000806040858703121561288457600080fd5b843567ffffffffffffffff8082111561289c57600080fd5b6128a8888389016123f0565b909650945060208701359150808211156128c157600080fd5b506128ce878288016123f0565b95989497509550505050565b6080815260006128ed60808301876126a5565b6001600160a01b0395861660208401529385166040830152509216606090920191909152919050565b6000806000806060858703121561292c57600080fd5b843567ffffffffffffffff8082111561294457600080fd5b612950888389016123f0565b9096509450602087013591508082111561296957600080fd5b612652888389016126fc565b60008060008060008060a0878903121561298e57600080fd5b863567ffffffffffffffff808211156129a657600080fd5b6129b28a838b016123f0565b909850965060208901359150808211156129cb57600080fd5b6129d78a838b0161250f565b955060408901359150808211156129ed57600080fd5b6129f98a838b01612553565b945060608901359150612a0b826123bd565b90925060808801359080821115612a2157600080fd5b50612a2e89828a0161250f565b9150509295509295509295565b600060208284031215612a4d57600080fd5b813567ffffffffffffffff811115612a6457600080fd5b612a7084828501612553565b949350505050565b600080600060408486031215612a8d57600080fd5b833567ffffffffffffffff80821115612aa557600080fd5b612ab1878388016123f0565b90955093506020860135915080821115612aca57600080fd5b506127db8682870161250f565b60008060208385031215612aea57600080fd5b823567ffffffffffffffff811115612b0157600080fd5b612b0d858286016123f0565b90969095509350505050565b600060208284031215612b2b57600080fd5b5035919050565b60208152600061221160208301846126a5565b600080600060408486031215612b5a57600080fd5b833567ffffffffffffffff80821115612b7257600080fd5b612b7e878388016123f0565b90955093506020860135915080821115612b9757600080fd5b506127db86828701612553565b6001600160a01b0381168114610b3d57600080fd5b600060208284031215612bcb57600080fd5b813561221181612ba4565b600181811c90821680612bea57607f821691505b602082108103612c0a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b600082601f830112612c3757600080fd5b8151612c456124df826124a9565b818152846020838601011115612c5a57600080fd5b612a70826020830160208701612681565b60008060408385031215612c7e57600080fd5b825167ffffffffffffffff811115612c9557600080fd5b612ca185828601612c26565b9250506020830151612cb281612ba4565b809150509250929050565b600060208284031215612ccf57600080fd5b815161221181612ba4565b8015158114610b3d57600080fd5b60008060408385031215612cfb57600080fd5b823567ffffffffffffffff80821115612d1357600080fd5b818501915085601f830112612d2757600080fd5b81356020612d376124df8361252f565b82815260059290921b84018101918181019089841115612d5657600080fd5b948201945b83861015612d7d578535612d6e81612cda565b82529482019490820190612d5b565b96505086013592505080821115612d9357600080fd5b50611e7a858286016126fc565b600080600080600060a08688031215612db857600080fd5b612dc28635612cda565b85359450612dd36020870135612ba4565b6020860135935067ffffffffffffffff8060408801351115612df457600080fd5b612e048860408901358901612553565b93508060608801351115612e1757600080fd5b612e27886060890135890161250f565b92508060808801351115612e3a57600080fd5b6080870135870188601f820112612e5057600080fd5b612e5d6124df823561252f565b81358082526020808301929160051b8401018b1015612e7b57600080fd5b602083015b6020843560051b850101811015612f12578481351115612e9f57600080fd5b803584016040818e03601f19011215612eb757600080fd5b612ebf61244f565b612ecc60208301356123bd565b602082013581528660408301351115612ee457600080fd5b612ef78e6020604085013585010161250f565b60208201528085525050602083019250602081019050612e80565b50809450505050509295509295909350565b604081526000612f3760408301856126a5565b8281036020840152612f4981856126a5565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561035657610356612f52565b600060018201612f8d57612f8d612f52565b5060010190565b6000815160208301516001600160e01b031980821693506004831015612fc45780818460040360031b1b83161693505b505050919050565b600060208284031215612fde57600080fd5b815167ffffffffffffffff811115612ff557600080fd5b612a7084828501612c26565b600081518084526020808501808196508360051b8101915082860160005b858110156130495782840389526130378483516126a5565b9885019893509084019060010161301f565b5091979650505050505050565b60a08152600061306960a08301886126a5565b828103602084015261307b81886126a5565b9050828103604084015261308f8187613001565b90506001600160e01b03198516606084015282810360808401526130b381856126a5565b98975050505050505050565b8181038181111561035657610356612f52565b600080858511156130e257600080fd5b838611156130ef57600080fd5b5050820193919092039150565b8183823760009101908152919050565b600082601f83011261311d57600080fd5b8151602061312d6124df8361252f565b82815260059290921b8401810191818101908684111561314c57600080fd5b8286015b848110156125e857805167ffffffffffffffff8111156131705760008081fd5b61317e8986838b0101612c26565b845250918301918301613150565b60006020828403121561319e57600080fd5b815167ffffffffffffffff808211156131b657600080fd5b90830190606082860312156131ca57600080fd5b6040516060810181811083821117156131e5576131e5612439565b60405282516131f381612ba4565b815260208301518281111561320757600080fd5b6132138782860161310c565b60208301525060408301518281111561322b57600080fd5b61323787828601612c26565b60408301525095945050505050565b6001600160a01b038151168252600060208201516060602085015261326e6060850182613001565b905060408301518482036040860152612f4982826126a5565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156132dc57603f198886030184526132ca858351613246565b945092850192908501906001016132ae565b5092979650505050505050565b8515158152600060206001600160a01b03871681840152604060a08185015261331560a0850188613001565b848103606086015261332781886126a5565b905084810360808601528086518083528483019150848160051b84010185890160005b8381101561339357858303601f19018552815180516001600160e01b0319168452880151888401889052613380888501826126a5565b958901959350509087019060010161334a565b50909d9c50505050505050505050505050565b6001600160a01b038616815260a0602082015260006133c860a0830187613001565b828103604084015261308f81876126a5565b6000826133f757634e487b7160e01b600052601260045260246000fd5b500690565b600080600080600060a0868803121561341457600080fd5b855161341f81612ba4565b602087015190955067ffffffffffffffff8082111561343d57600080fd5b61344989838a0161310c565b9550604088015191508082111561345f57600080fd5b61346b89838a01612c26565b94506060880151915061347d826123bd565b60808801519193508082111561349257600080fd5b5061349f88828901612c26565b9150509295509295909350565b6020815260006122116020830184613246565b600083516134d1818460208801612681565b8351908301906134e5818360208801612681565b01949350505050565b60006020828403121561350057600080fd5b815161221181612cda565b601f82111561355557600081815260208120601f850160051c810160208610156135325750805b601f850160051c820191505b818110156135515782815560010161353e565b5050505b505050565b815167ffffffffffffffff81111561357457613574612439565b613588816135828454612bd6565b8461350b565b602080601f8311600181146135bd57600084156135a55750858301515b600019600386901b1c1916600185901b178555613551565b600085815260208120601f198616915b828110156135ec578886015182559484019460019091019084016135cd565b508582101561360a5787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fea2646970667358221220e80dfb43e469138d4ae0942cde3bd29b693f1811b97ac87db578fe698aaae86764736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "findResolver(bytes)": { + "details": "Finds a resolver by recursively querying the registry, starting at the longest name and progressively removing labels until it finds a result.", + "params": { + "name": "The name to resolve, in DNS-encoded and normalised form." + }, + "returns": { + "_0": "resolver The Resolver responsible for this name.", + "_1": "namehash The namehash of the full name.", + "_2": "finalOffset The offset of the first label with a resolver." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "resolve(bytes,bytes)": { + "details": "Performs ENS name resolution for the supplied name and resolution data.", + "params": { + "data": "The resolution data, as specified in ENSIP-10.", + "name": "The name to resolve, in normalised and DNS-encoded form." + }, + "returns": { + "_0": "The result of resolving the name." + } + }, + "reverse(bytes,string[])": { + "details": "Performs ENS name reverse resolution for the supplied reverse name.", + "params": { + "reverseName": "The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse" + }, + "returns": { + "_0": "The resolved name, the resolved address, the reverse resolver address, and the resolver address." + } + }, + "supportsInterface(bytes4)": { + "details": "See {IERC165-supportsInterface}." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "notice": "The Universal Resolver is a contract that handles the work of resolving a name entirely onchain, making it possible to make a single smart contract call to resolve an ENS name.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 7, + "contract": "contracts/utils/UniversalResolver.sol:UniversalResolver", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 1537, + "contract": "contracts/utils/UniversalResolver.sol:UniversalResolver", + "label": "batchGatewayURLs", + "offset": 0, + "slot": "1", + "type": "t_array(t_string_storage)dyn_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_string_storage)dyn_storage": { + "base": "t_string_storage", + "encoding": "dynamic_array", + "label": "string[]", + "numberOfBytes": "32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/solcInputs/060d98a9425039d7f82a146eac9bd32e.json b/solidity/dns-contracts/deployments/goerli/solcInputs/060d98a9425039d7f82a146eac9bd32e.json new file mode 100644 index 0000000..9ce58bc --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/solcInputs/060d98a9425039d7f82a146eac9bd32e.json @@ -0,0 +1,422 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(\n uint16 _expectedType,\n bytes memory _expectedName,\n uint32 _inception,\n uint64 _inserted,\n bytes memory _proof\n ) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if (_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(\n uint16 dnstype,\n bytes memory name\n ) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyExtendedDNSSECResolver is IExtendedDNSResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes memory /* name */,\n bytes memory /* data */,\n bytes memory context\n ) external view override returns (bytes memory) {\n return abi.encode(context);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyLegacyTextResolver is ITextResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(ITextResolver).interfaceId;\n }\n\n function text(\n bytes32 /* node */,\n string calldata key\n ) external view override returns (string memory) {\n return key;\n }\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver {\n using RRUtils for *;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, data)\n );\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query) = abi.decode(\n extraData,\n (bytes, bytes)\n );\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n IExtendedDNSResolver(dnsresolver).resolve(\n name,\n query,\n context\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return IExtendedResolver(dnsresolver).resolve(name, query);\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (bytes memory key, bytes memory value, uint256 nextOffset)\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = input.length;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n nextOffset = terminator + 1;\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256[3] memory P) {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (uint256 x, uint256 y, uint256 z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(\n uint256 x0,\n uint256 y0\n ) internal pure returns (bool isZero) {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(\n uint256 scalar\n ) internal pure returns (uint256, uint256) {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(\n bytes calldata,\n bytes calldata\n ) external pure override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input\n )\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n )\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(\n RRUtils.SignedSet memory rrset,\n uint16 typecovered\n ) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if (address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns (bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 {\n totallen := add(totallen, 64)\n }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for {\n let i := 0\n } lt(i, totallen) {\n i := add(i, 64)\n } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 {\n mstore8(add(scratch, sub(len, i)), 0x80)\n }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 {\n mstore(\n add(scratch, 32),\n or(mload(add(scratch, 32)), mul(len, 8))\n )\n }\n\n // Expand the 16 32-bit words into 80\n for {\n let j := 64\n } lt(j, 128) {\n j := add(j, 12)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 12))),\n mload(add(scratch, sub(j, 32)))\n ),\n xor(\n mload(add(scratch, sub(j, 56))),\n mload(add(scratch, sub(j, 64)))\n )\n )\n temp := or(\n and(\n mul(temp, 2),\n 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE\n ),\n and(\n div(temp, 0x80000000),\n 0x0000000100000001000000010000000100000001000000010000000100000001\n )\n )\n mstore(add(scratch, j), temp)\n }\n for {\n let j := 128\n } lt(j, 320) {\n j := add(j, 24)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 24))),\n mload(add(scratch, sub(j, 64)))\n ),\n xor(\n mload(add(scratch, sub(j, 112))),\n mload(add(scratch, sub(j, 128)))\n )\n )\n temp := or(\n and(\n mul(temp, 4),\n 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC\n ),\n and(\n div(temp, 0x40000000),\n 0x0000000300000003000000030000000300000003000000030000000300000003\n )\n )\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for {\n let j := 0\n } lt(j, 80) {\n j := add(j, 1)\n } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(\n div(x, 0x100000000000000000000),\n div(x, 0x10000000000)\n )\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := and(div(x, 0x10000000000), f)\n f := or(\n and(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n ),\n f\n )\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(\n div(\n x,\n 0x80000000000000000000000000000000000000000000000\n ),\n 0x1F\n )\n temp := or(\n and(\n div(x, 0x800000000000000000000000000000000000000),\n 0xFFFFFFE0\n ),\n temp\n )\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(\n div(\n mload(add(scratch, mul(j, 4))),\n 0x100000000000000000000000000000000000000000000000000000000\n ),\n temp\n )\n x := or(\n div(x, 0x10000000000),\n mul(temp, 0x10000000000000000000000000000000000000000)\n )\n x := or(\n and(\n x,\n 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF\n ),\n mul(\n or(\n and(div(x, 0x4000000000000), 0xC0000000),\n and(div(x, 0x400000000000000000000), 0x3FFFFFFF)\n ),\n 0x100000000000000000000\n )\n )\n }\n\n h := and(\n add(h, x),\n 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF\n )\n }\n ret := mul(\n or(\n or(\n or(\n or(\n and(\n div(h, 0x100000000),\n 0xFFFFFFFF00000000000000000000000000000000\n ),\n and(\n div(h, 0x1000000),\n 0xFFFFFFFF000000000000000000000000\n )\n ),\n and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)\n ),\n and(div(h, 0x100), 0xFFFFFFFF00000000)\n ),\n and(h, 0xFFFFFFFF)\n ),\n 0x1000000000000000000000000\n )\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ReverseRegistrar} from \"../registry/ReverseRegistrar.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper\n ) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/ILinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface ILinearPremiumPriceOracle {\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256);\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns (address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping(bytes32 => address) addresses;\n\n constructor() public {}\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/registry/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Implements a dummy NameWrapper which returns the caller's address\n */\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\nimport \"./Multicallable.sol\";\nimport \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/TestHexUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {HexUtils} from \"./HexUtils.sol\";\n\ncontract TestHexUtils {\n using HexUtils for *;\n\n function hexStringToBytes32(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes32, bool) {\n return name.hexStringToBytes32(idx, lastInx);\n }\n\n function hexToAddress(\n bytes calldata input,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (address, bool) {\n return input.hexToAddress(idx, lastInx);\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(\n string memory name\n ) public pure returns (bytes memory, bytes32) {\n return name.dnsEncodeName();\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (bytes[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, ) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n return (results, address(0));\n }\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes[] memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (bytes[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n result = LowLevelCallUtils.functionStaticCall(address(target), data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = revertData;\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return The Resolver responsible for this name, and the namehash of the full name.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32) {\n (address resolver, bytes32 labelhash) = findResolver(name, 0);\n return (Resolver(resolver), labelhash);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0));\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (address parentresolver, bytes32 parentnode) = findResolver(\n name,\n nextLabel\n );\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node);\n }\n return (parentresolver, node);\n }\n\n function _hasExtendedResolver(\n address resolver\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface(\n type(IExtendedResolver).interfaceId\n )\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (bytes[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _hasExtendedResolver(multicallData.resolver);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = item;\n continue;\n }\n if (!isCallback && hasExtendedResolver) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = returnData;\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external;\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(name, wrappedOwner, fuses, expiry, extraData);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the owner of a name\n * @param id Namehash of the name\n * @return operator Approved operator of a name\n */\n\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /**\n * @notice Approves an address for a name\n * @param to address to approve\n * @param tokenId name to approve\n */\n\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if msg.sender is the owner or approved\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwnerOrApproved(bytes32 node) {\n if (!canModifySubnames(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or operator of the owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or operator\n */\n\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Checks if owner/operator or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner/operator or approved\n */\n\n function canModifySubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n //use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n // this flag is used later, when checking fuses\n bool canModifyParentSubname = canModifySubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canModifyParentSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canModifyParentSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n extraData\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of. Can also be called by the owner of a .eth name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifySubnames(parentNode, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwnerOrApproved(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwnerOrApproved(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /**\n * @notice Checks if a name is wrapped in a more gas efficient way\n * @param parentNode Namehash of the name\n * @param labelhash Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != ETH_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + }, + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external view override returns (bool) {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32, uint256) {\n return name.readLabel(offset);\n }\n\n function namehash(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32) {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\n \"\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n require(\n \"foo\".keccak(0, 3) ==\n bytes32(\n 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d\n ),\n \"Incorrect hash of 'foo'\"\n );\n require(\n \"foo\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\n \"hello\".equals(1, \"ello\") == true,\n \"Substring to string equality\"\n );\n require(\n \"hello\".equals(1, \"jello\", 1, 4) == true,\n \"Substring to substring equality\"\n );\n require(\n \"zhello\".equals(1, \"abchello\", 3) == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"0x0102030000\".equals(0, \"0x010203\") == false,\n \"Compare with offset and trailing bytes\"\n );\n }\n\n function testComparePartial() public pure {\n require(\n \"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true,\n \"Compare same length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true,\n \"Compare different length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true,\n \"Compare same with different offset\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 33\n ) ==\n 0 ==\n true,\n \"Compare different long strings same length smaller partial length which must be equal\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 34\n ) <\n 0 ==\n true,\n \"Compare long strings same length different partial length\"\n );\n require(\n \"0123456789012345012345678901234a\".compare(\n 0,\n 32,\n \"0123456789012345012345678901234b\",\n 0,\n 32\n ) <\n 0 ==\n true,\n \"Compare strings exactly 32 characters long\"\n );\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\n \"a\".compare(\"b\") < 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"b\".compare(\"a\") > 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"aa\".compare(\"ab\") < 0 == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"a\".compare(\"aa\") < 0 == true,\n \"Compare different value with different length\"\n );\n require(\n \"aa\".compare(\"a\") > 0 == true,\n \"Compare different value with different length\"\n );\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(\n longChar.compare(longChar) == 0 == true,\n \"Compares more than 32 bytes char\"\n );\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(\n longChar.compare(otherLongChar) < 0 == true,\n \"Compare long char with difference at start\"\n );\n }\n\n function testSubstring() public pure {\n require(\n keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")),\n \"Copy 0 bytes\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 4))) ==\n keccak256(bytes(\"hell\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(1, 4))) ==\n keccak256(bytes(\"ello\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 5))) ==\n keccak256(bytes(\"hello\")),\n \"Copy whole string\"\n );\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(\n bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) ==\n bytes32(\n 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000\n ),\n \"readBytes20\"\n );\n }\n\n function testReadBytes32() public pure {\n require(\n \"0123456789abcdef0123456789abcdef\".readBytes32(0) ==\n bytes32(\n 0x3031323334353637383961626364656630313233343536373839616263646566\n ),\n \"readBytes32\"\n );\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\n \"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")),\n \"Decode 'a'\"\n );\n require(\n \"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")),\n \"Decode 'aa'\"\n );\n require(\n \"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")),\n \"Decode 'aaa'\"\n );\n require(\n \"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")),\n \"Decode 'aaaa'\"\n );\n require(\n \"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa'\"\n );\n require(\n \"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa' lowercase\"\n );\n require(\n \"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet\"\n );\n require(\n \"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet lowercase\"\n );\n require(\n \"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\"\n .base32HexDecodeWord(0, 52) ==\n bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"),\n \"Decode 32*'a'\"\n );\n require(\n \" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\"\n .base32HexDecodeWord(1, 32) ==\n bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"),\n \"Decode real bytes32hex\"\n );\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex\"00\".nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex\"00\".labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex\"016100\".labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(\n hex\"016201610000\".labelCount(0) == 2,\n \"labelCount('b.a.') == 2\"\n );\n require(\n hex\"066574686c61620378797a00\".labelCount(6 + 1) == 1,\n \"nameLength('(bthlab).xyz.') == 6\"\n );\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes\n memory rrs = hex\"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101\";\n bytes[2] memory names = [bytes(hex\"016100\"), bytes(hex\"0162016100\")];\n bytes[2] memory rdatas = [bytes(hex\"74000001\"), bytes(hex\"c0a80101\")];\n uint i = 0;\n for (\n RRUtils.RRIterator memory iter = rrs.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(\n keccak256(iter.name()) == keccak256(names[i]),\n \"Name matches\"\n );\n require(\n keccak256(iter.rdata()) == keccak256(rdatas[i]),\n \"Rdata matches\"\n );\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex\"066274686c61620378797a00\";\n bytes memory ethLabXyz = hex\"066574686c61620378797a00\";\n bytes memory xyz = hex\"0378797a00\";\n bytes memory a_b_c = hex\"01610162016300\";\n bytes memory b_b_c = hex\"01620162016300\";\n bytes memory c = hex\"016300\";\n bytes memory d = hex\"016400\";\n bytes memory a_d_c = hex\"01610164016300\";\n bytes memory b_a_c = hex\"01620161016300\";\n bytes memory ab_c_d = hex\"0261620163016400\";\n bytes memory a_c_d = hex\"01610163016400\";\n bytes\n memory verylong1_eth = hex\"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n bytes\n memory verylong2_eth = hex\"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n\n require(\n hex\"0301616100\".compareNames(hex\"0302616200\") < 0,\n \"label lengths are correctly checked\"\n );\n require(\n a_b_c.compareNames(c) > 0,\n \"one name has a difference of >1 label to with the same root name\"\n );\n require(\n a_b_c.compareNames(d) < 0,\n \"one name has a difference of >1 label to with different root name\"\n );\n require(\n a_b_c.compareNames(a_d_c) < 0,\n \"two names start the same but have differences in later labels\"\n );\n require(\n a_b_c.compareNames(b_a_c) > 0,\n \"the first label sorts later, but the first label sorts earlier\"\n );\n require(\n ab_c_d.compareNames(a_c_d) > 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(\n a_b_c.compareNames(b_b_c) < 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(\n bthLabXyz.compareNames(ethLabXyz) < 0,\n \"bthLab.xyz comes before ethLab.xyz\"\n );\n require(\n bthLabXyz.compareNames(bthLabXyz) == 0,\n \"bthLab.xyz and bthLab.xyz are the same\"\n );\n require(\n ethLabXyz.compareNames(bthLabXyz) > 0,\n \"ethLab.xyz comes after bethLab.xyz\"\n );\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(\n verylong1_eth.compareNames(verylong2_eth) > 0,\n \"longa.vlong.eth comes after long.vlong.eth\"\n );\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(\n RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA),\n \"0x11111111 >= 0xAAAAAAAA\"\n );\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(\n hex\"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d\"\n .computeKeytag() == 19036,\n \"Invalid keytag\"\n );\n require(\n hex\"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf\"\n .computeKeytag() == 21693,\n \"Invalid keytag (2)\"\n );\n require(\n hex\"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3\"\n .computeKeytag() == 33630\n );\n require(\n hex\"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5\"\n .computeKeytag() == 20326,\n \"Invalid keytag (3)\"\n );\n }\n}\n" + }, + "test/registry/mocks/DummyResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyResolver {\n mapping(bytes32 => string) public name;\n\n function setName(bytes32 node, string memory _name) public {\n name[node] = _name;\n }\n}\n" + }, + "test/utils/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n if (bytes4(extraData) == bytes4(keccak256(\"name(bytes32)\"))) {\n return abi.encode(\"offchain.test.eth\");\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "test/utils/mocks/LegacyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\ncontract LegacyResolver {\n function addr(bytes32 /* node */) public view returns (address) {\n return address(this);\n }\n}\n" + }, + "test/utils/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10 ** uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10 ** uint256(decimals()));\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1500 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/solcInputs/0ba2159dea6e6f2226840e68f6c0a0ff.json b/solidity/dns-contracts/deployments/goerli/solcInputs/0ba2159dea6e6f2226840e68f6c0a0ff.json new file mode 100644 index 0000000..1ceecdf --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/solcInputs/0ba2159dea6e6f2226840e68f6c0a0ff.json @@ -0,0 +1,287 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver {\n using RRUtils for *;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, data)\n );\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query) = abi.decode(\n extraData,\n (bytes, bytes)\n );\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n IExtendedDNSResolver(dnsresolver).resolve(\n name,\n query,\n context\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return IExtendedResolver(dnsresolver).resolve(name, query);\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input\n )\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n )\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(\n RRUtils.SignedSet memory rrset,\n uint16 typecovered\n ) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if (address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ReverseRegistrar} from \"../registry/ReverseRegistrar.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper\n ) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/registry/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\nimport \"./Multicallable.sol\";\nimport \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(\n name,\n wrappedOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the owner of a name\n * @param id Namehash of the name\n * @return operator Approved operator of a name\n */\n\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /**\n * @notice Approves an address for a name\n * @param to address to approve\n * @param tokenId name to approve\n */\n\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or operator of the owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or operator\n */\n\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Checks if owner/operator or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner/operator or approved\n */\n\n function canExtendSubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public returns (uint64 expiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n //use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (!_isWrapped(node)) {\n revert NameIsNotWrapped();\n }\n\n // this flag is used later, when checking fuses\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n address approved = getApproved(uint256(node));\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(parentNode, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /**\n * @notice Checks if a name is wrapped in a more gas efficient way\n * @param parentNode Namehash of the name\n * @param labelhash Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != ETH_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external view override returns (bool) {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\n \"\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n require(\n \"foo\".keccak(0, 3) ==\n bytes32(\n 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d\n ),\n \"Incorrect hash of 'foo'\"\n );\n require(\n \"foo\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\n \"hello\".equals(1, \"ello\") == true,\n \"Substring to string equality\"\n );\n require(\n \"hello\".equals(1, \"jello\", 1, 4) == true,\n \"Substring to substring equality\"\n );\n require(\n \"zhello\".equals(1, \"abchello\", 3) == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"0x0102030000\".equals(0, \"0x010203\") == false,\n \"Compare with offset and trailing bytes\"\n );\n }\n\n function testComparePartial() public pure {\n require(\n \"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true,\n \"Compare same length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true,\n \"Compare different length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true,\n \"Compare same with different offset\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 33\n ) ==\n 0 ==\n true,\n \"Compare different long strings same length smaller partial length which must be equal\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 34\n ) <\n 0 ==\n true,\n \"Compare long strings same length different partial length\"\n );\n require(\n \"0123456789012345012345678901234a\".compare(\n 0,\n 32,\n \"0123456789012345012345678901234b\",\n 0,\n 32\n ) <\n 0 ==\n true,\n \"Compare strings exactly 32 characters long\"\n );\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\n \"a\".compare(\"b\") < 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"b\".compare(\"a\") > 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"aa\".compare(\"ab\") < 0 == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"a\".compare(\"aa\") < 0 == true,\n \"Compare different value with different length\"\n );\n require(\n \"aa\".compare(\"a\") > 0 == true,\n \"Compare different value with different length\"\n );\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(\n longChar.compare(longChar) == 0 == true,\n \"Compares more than 32 bytes char\"\n );\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(\n longChar.compare(otherLongChar) < 0 == true,\n \"Compare long char with difference at start\"\n );\n }\n\n function testSubstring() public pure {\n require(\n keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")),\n \"Copy 0 bytes\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 4))) ==\n keccak256(bytes(\"hell\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(1, 4))) ==\n keccak256(bytes(\"ello\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 5))) ==\n keccak256(bytes(\"hello\")),\n \"Copy whole string\"\n );\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(\n bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) ==\n bytes32(\n 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000\n ),\n \"readBytes20\"\n );\n }\n\n function testReadBytes32() public pure {\n require(\n \"0123456789abcdef0123456789abcdef\".readBytes32(0) ==\n bytes32(\n 0x3031323334353637383961626364656630313233343536373839616263646566\n ),\n \"readBytes32\"\n );\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\n \"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")),\n \"Decode 'a'\"\n );\n require(\n \"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")),\n \"Decode 'aa'\"\n );\n require(\n \"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")),\n \"Decode 'aaa'\"\n );\n require(\n \"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")),\n \"Decode 'aaaa'\"\n );\n require(\n \"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa'\"\n );\n require(\n \"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa' lowercase\"\n );\n require(\n \"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet\"\n );\n require(\n \"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet lowercase\"\n );\n require(\n \"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\"\n .base32HexDecodeWord(0, 52) ==\n bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"),\n \"Decode 32*'a'\"\n );\n require(\n \" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\"\n .base32HexDecodeWord(1, 32) ==\n bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"),\n \"Decode real bytes32hex\"\n );\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex\"00\".nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex\"00\".labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex\"016100\".labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(\n hex\"016201610000\".labelCount(0) == 2,\n \"labelCount('b.a.') == 2\"\n );\n require(\n hex\"066574686c61620378797a00\".labelCount(6 + 1) == 1,\n \"nameLength('(bthlab).xyz.') == 6\"\n );\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes\n memory rrs = hex\"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101\";\n bytes[2] memory names = [bytes(hex\"016100\"), bytes(hex\"0162016100\")];\n bytes[2] memory rdatas = [bytes(hex\"74000001\"), bytes(hex\"c0a80101\")];\n uint i = 0;\n for (\n RRUtils.RRIterator memory iter = rrs.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(\n keccak256(iter.name()) == keccak256(names[i]),\n \"Name matches\"\n );\n require(\n keccak256(iter.rdata()) == keccak256(rdatas[i]),\n \"Rdata matches\"\n );\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex\"066274686c61620378797a00\";\n bytes memory ethLabXyz = hex\"066574686c61620378797a00\";\n bytes memory xyz = hex\"0378797a00\";\n bytes memory a_b_c = hex\"01610162016300\";\n bytes memory b_b_c = hex\"01620162016300\";\n bytes memory c = hex\"016300\";\n bytes memory d = hex\"016400\";\n bytes memory a_d_c = hex\"01610164016300\";\n bytes memory b_a_c = hex\"01620161016300\";\n bytes memory ab_c_d = hex\"0261620163016400\";\n bytes memory a_c_d = hex\"01610163016400\";\n bytes\n memory verylong1_eth = hex\"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n bytes\n memory verylong2_eth = hex\"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n\n require(\n hex\"0301616100\".compareNames(hex\"0302616200\") < 0,\n \"label lengths are correctly checked\"\n );\n require(\n a_b_c.compareNames(c) > 0,\n \"one name has a difference of >1 label to with the same root name\"\n );\n require(\n a_b_c.compareNames(d) < 0,\n \"one name has a difference of >1 label to with different root name\"\n );\n require(\n a_b_c.compareNames(a_d_c) < 0,\n \"two names start the same but have differences in later labels\"\n );\n require(\n a_b_c.compareNames(b_a_c) > 0,\n \"the first label sorts later, but the first label sorts earlier\"\n );\n require(\n ab_c_d.compareNames(a_c_d) > 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(\n a_b_c.compareNames(b_b_c) < 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(\n bthLabXyz.compareNames(ethLabXyz) < 0,\n \"bthLab.xyz comes before ethLab.xyz\"\n );\n require(\n bthLabXyz.compareNames(bthLabXyz) == 0,\n \"bthLab.xyz and bthLab.xyz are the same\"\n );\n require(\n ethLabXyz.compareNames(bthLabXyz) > 0,\n \"ethLab.xyz comes after bethLab.xyz\"\n );\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(\n verylong1_eth.compareNames(verylong2_eth) > 0,\n \"longa.vlong.eth comes after long.vlong.eth\"\n );\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(\n RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA),\n \"0x11111111 >= 0xAAAAAAAA\"\n );\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(\n hex\"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d\"\n .computeKeytag() == 19036,\n \"Invalid keytag\"\n );\n require(\n hex\"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf\"\n .computeKeytag() == 21693,\n \"Invalid keytag (2)\"\n );\n require(\n hex\"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3\"\n .computeKeytag() == 33630\n );\n require(\n hex\"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5\"\n .computeKeytag() == 20326,\n \"Invalid keytag (3)\"\n );\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1500 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/solcInputs/2623184d1fe6fb81f7e39a0a868bd472.json b/solidity/dns-contracts/deployments/goerli/solcInputs/2623184d1fe6fb81f7e39a0a868bd472.json new file mode 100644 index 0000000..4bbde5e --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/solcInputs/2623184d1fe6fb81f7e39a0a868bd472.json @@ -0,0 +1,101 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (bytes[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n return (results, address(0));\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes[] memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (bytes[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n result = LowLevelCallUtils.functionStaticCall(address(target), data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = revertData;\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _hasExtendedResolver(\n address resolver\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(\n type(IExtendedResolver).interfaceId\n )\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (bytes[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _hasExtendedResolver(multicallData.resolver);\n\n require(\n !multicallData.isWildcard || hasExtendedResolver,\n \"UniversalResolver: Wildcard on non-extended resolvers is not supported\"\n );\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = item;\n continue;\n }\n if (!isCallback && hasExtendedResolver) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = returnData;\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1300 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/solcInputs/2813443d96b2eb882a21ada25755af03.json b/solidity/dns-contracts/deployments/goerli/solcInputs/2813443d96b2eb882a21ada25755af03.json new file mode 100644 index 0000000..abf1265 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/solcInputs/2813443d96b2eb882a21ada25755af03.json @@ -0,0 +1,422 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(\n uint16 _expectedType,\n bytes memory _expectedName,\n uint32 _inception,\n uint64 _inserted,\n bytes memory _proof\n ) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if (_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(\n uint16 dnstype,\n bytes memory name\n ) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyExtendedDNSSECResolver is IExtendedDNSResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes memory /* name */,\n bytes memory /* data */,\n bytes memory context\n ) external view override returns (bytes memory) {\n return abi.encode(context);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyLegacyTextResolver is ITextResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(ITextResolver).interfaceId;\n }\n\n function text(\n bytes32 /* node */,\n string calldata key\n ) external view override returns (string memory) {\n return key;\n }\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver {\n using RRUtils for *;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, data)\n );\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query) = abi.decode(\n extraData,\n (bytes, bytes)\n );\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n IExtendedDNSResolver(dnsresolver).resolve(\n name,\n query,\n context\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return IExtendedResolver(dnsresolver).resolve(name, query);\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (bytes memory key, bytes memory value, uint256 nextOffset)\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = input.length;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n nextOffset = terminator + 1;\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256[3] memory P) {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (uint256 x, uint256 y, uint256 z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(\n uint256 x0,\n uint256 y0\n ) internal pure returns (bool isZero) {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(\n uint256 scalar\n ) internal pure returns (uint256, uint256) {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(\n bytes calldata,\n bytes calldata\n ) external pure override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input\n )\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n )\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(\n RRUtils.SignedSet memory rrset,\n uint16 typecovered\n ) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if (address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns (bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 {\n totallen := add(totallen, 64)\n }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for {\n let i := 0\n } lt(i, totallen) {\n i := add(i, 64)\n } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 {\n mstore8(add(scratch, sub(len, i)), 0x80)\n }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 {\n mstore(\n add(scratch, 32),\n or(mload(add(scratch, 32)), mul(len, 8))\n )\n }\n\n // Expand the 16 32-bit words into 80\n for {\n let j := 64\n } lt(j, 128) {\n j := add(j, 12)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 12))),\n mload(add(scratch, sub(j, 32)))\n ),\n xor(\n mload(add(scratch, sub(j, 56))),\n mload(add(scratch, sub(j, 64)))\n )\n )\n temp := or(\n and(\n mul(temp, 2),\n 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE\n ),\n and(\n div(temp, 0x80000000),\n 0x0000000100000001000000010000000100000001000000010000000100000001\n )\n )\n mstore(add(scratch, j), temp)\n }\n for {\n let j := 128\n } lt(j, 320) {\n j := add(j, 24)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 24))),\n mload(add(scratch, sub(j, 64)))\n ),\n xor(\n mload(add(scratch, sub(j, 112))),\n mload(add(scratch, sub(j, 128)))\n )\n )\n temp := or(\n and(\n mul(temp, 4),\n 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC\n ),\n and(\n div(temp, 0x40000000),\n 0x0000000300000003000000030000000300000003000000030000000300000003\n )\n )\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for {\n let j := 0\n } lt(j, 80) {\n j := add(j, 1)\n } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(\n div(x, 0x100000000000000000000),\n div(x, 0x10000000000)\n )\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := and(div(x, 0x10000000000), f)\n f := or(\n and(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n ),\n f\n )\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(\n div(\n x,\n 0x80000000000000000000000000000000000000000000000\n ),\n 0x1F\n )\n temp := or(\n and(\n div(x, 0x800000000000000000000000000000000000000),\n 0xFFFFFFE0\n ),\n temp\n )\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(\n div(\n mload(add(scratch, mul(j, 4))),\n 0x100000000000000000000000000000000000000000000000000000000\n ),\n temp\n )\n x := or(\n div(x, 0x10000000000),\n mul(temp, 0x10000000000000000000000000000000000000000)\n )\n x := or(\n and(\n x,\n 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF\n ),\n mul(\n or(\n and(div(x, 0x4000000000000), 0xC0000000),\n and(div(x, 0x400000000000000000000), 0x3FFFFFFF)\n ),\n 0x100000000000000000000\n )\n )\n }\n\n h := and(\n add(h, x),\n 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF\n )\n }\n ret := mul(\n or(\n or(\n or(\n or(\n and(\n div(h, 0x100000000),\n 0xFFFFFFFF00000000000000000000000000000000\n ),\n and(\n div(h, 0x1000000),\n 0xFFFFFFFF000000000000000000000000\n )\n ),\n and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)\n ),\n and(div(h, 0x100), 0xFFFFFFFF00000000)\n ),\n and(h, 0xFFFFFFFF)\n ),\n 0x1000000000000000000000000\n )\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ReverseRegistrar} from \"../registry/ReverseRegistrar.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper\n ) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/ILinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface ILinearPremiumPriceOracle {\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256);\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns (address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping(bytes32 => address) addresses;\n\n constructor() public {}\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/registry/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Implements a dummy NameWrapper which returns the caller's address\n */\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\nimport \"./Multicallable.sol\";\nimport \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/TestHexUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {HexUtils} from \"./HexUtils.sol\";\n\ncontract TestHexUtils {\n using HexUtils for *;\n\n function hexStringToBytes32(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes32, bool) {\n return name.hexStringToBytes32(idx, lastInx);\n }\n\n function hexToAddress(\n bytes calldata input,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (address, bool) {\n return input.hexToAddress(idx, lastInx);\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(\n string memory name\n ) public pure returns (bytes memory, bytes32) {\n return name.dnsEncodeName();\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (bytes[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, ) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n return (results, address(0));\n }\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes[] memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (bytes[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n result = LowLevelCallUtils.functionStaticCall(address(target), data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = revertData;\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return The Resolver responsible for this name, and the namehash of the full name.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32) {\n (address resolver, bytes32 labelhash) = findResolver(name, 0);\n return (Resolver(resolver), labelhash);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0));\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (address parentresolver, bytes32 parentnode) = findResolver(\n name,\n nextLabel\n );\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node);\n }\n return (parentresolver, node);\n }\n\n function _hasExtendedResolver(\n address resolver\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface(\n type(IExtendedResolver).interfaceId\n )\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (bytes[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _hasExtendedResolver(multicallData.resolver);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = item;\n continue;\n }\n if (!isCallback && hasExtendedResolver) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = returnData;\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external;\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(name, wrappedOwner, fuses, expiry, extraData);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the owner of a name\n * @param id Namehash of the name\n * @return operator Approved operator of a name\n */\n\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /**\n * @notice Approves an address for a name\n * @param to address to approve\n * @param tokenId name to approve\n */\n\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if msg.sender is the owner or approved\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwnerOrApproved(bytes32 node) {\n if (!canModifySubnames(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or operator of the owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or operator\n */\n\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Checks if owner/operator or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner/operator or approved\n */\n\n function canModifySubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n //use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n // this flag is used later, when checking fuses\n bool canModifyParentSubname = canModifySubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canModifyParentSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canModifyParentSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n extraData\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of. Can also be called by the owner of a .eth name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifySubnames(parentNode, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwnerOrApproved(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwnerOrApproved(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /**\n * @notice Checks if a name is wrapped in a more gas efficient way\n * @param parentNode Namehash of the name\n * @param labelhash Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != ETH_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + }, + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external view override returns (bool) {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32, uint256) {\n return name.readLabel(offset);\n }\n\n function namehash(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32) {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\n \"\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n require(\n \"foo\".keccak(0, 3) ==\n bytes32(\n 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d\n ),\n \"Incorrect hash of 'foo'\"\n );\n require(\n \"foo\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\n \"hello\".equals(1, \"ello\") == true,\n \"Substring to string equality\"\n );\n require(\n \"hello\".equals(1, \"jello\", 1, 4) == true,\n \"Substring to substring equality\"\n );\n require(\n \"zhello\".equals(1, \"abchello\", 3) == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"0x0102030000\".equals(0, \"0x010203\") == false,\n \"Compare with offset and trailing bytes\"\n );\n }\n\n function testComparePartial() public pure {\n require(\n \"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true,\n \"Compare same length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true,\n \"Compare different length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true,\n \"Compare same with different offset\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 33\n ) ==\n 0 ==\n true,\n \"Compare different long strings same length smaller partial length which must be equal\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 34\n ) <\n 0 ==\n true,\n \"Compare long strings same length different partial length\"\n );\n require(\n \"0123456789012345012345678901234a\".compare(\n 0,\n 32,\n \"0123456789012345012345678901234b\",\n 0,\n 32\n ) <\n 0 ==\n true,\n \"Compare strings exactly 32 characters long\"\n );\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\n \"a\".compare(\"b\") < 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"b\".compare(\"a\") > 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"aa\".compare(\"ab\") < 0 == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"a\".compare(\"aa\") < 0 == true,\n \"Compare different value with different length\"\n );\n require(\n \"aa\".compare(\"a\") > 0 == true,\n \"Compare different value with different length\"\n );\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(\n longChar.compare(longChar) == 0 == true,\n \"Compares more than 32 bytes char\"\n );\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(\n longChar.compare(otherLongChar) < 0 == true,\n \"Compare long char with difference at start\"\n );\n }\n\n function testSubstring() public pure {\n require(\n keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")),\n \"Copy 0 bytes\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 4))) ==\n keccak256(bytes(\"hell\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(1, 4))) ==\n keccak256(bytes(\"ello\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 5))) ==\n keccak256(bytes(\"hello\")),\n \"Copy whole string\"\n );\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(\n bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) ==\n bytes32(\n 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000\n ),\n \"readBytes20\"\n );\n }\n\n function testReadBytes32() public pure {\n require(\n \"0123456789abcdef0123456789abcdef\".readBytes32(0) ==\n bytes32(\n 0x3031323334353637383961626364656630313233343536373839616263646566\n ),\n \"readBytes32\"\n );\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\n \"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")),\n \"Decode 'a'\"\n );\n require(\n \"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")),\n \"Decode 'aa'\"\n );\n require(\n \"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")),\n \"Decode 'aaa'\"\n );\n require(\n \"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")),\n \"Decode 'aaaa'\"\n );\n require(\n \"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa'\"\n );\n require(\n \"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa' lowercase\"\n );\n require(\n \"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet\"\n );\n require(\n \"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet lowercase\"\n );\n require(\n \"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\"\n .base32HexDecodeWord(0, 52) ==\n bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"),\n \"Decode 32*'a'\"\n );\n require(\n \" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\"\n .base32HexDecodeWord(1, 32) ==\n bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"),\n \"Decode real bytes32hex\"\n );\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex\"00\".nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex\"00\".labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex\"016100\".labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(\n hex\"016201610000\".labelCount(0) == 2,\n \"labelCount('b.a.') == 2\"\n );\n require(\n hex\"066574686c61620378797a00\".labelCount(6 + 1) == 1,\n \"nameLength('(bthlab).xyz.') == 6\"\n );\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes\n memory rrs = hex\"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101\";\n bytes[2] memory names = [bytes(hex\"016100\"), bytes(hex\"0162016100\")];\n bytes[2] memory rdatas = [bytes(hex\"74000001\"), bytes(hex\"c0a80101\")];\n uint i = 0;\n for (\n RRUtils.RRIterator memory iter = rrs.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(\n keccak256(iter.name()) == keccak256(names[i]),\n \"Name matches\"\n );\n require(\n keccak256(iter.rdata()) == keccak256(rdatas[i]),\n \"Rdata matches\"\n );\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex\"066274686c61620378797a00\";\n bytes memory ethLabXyz = hex\"066574686c61620378797a00\";\n bytes memory xyz = hex\"0378797a00\";\n bytes memory a_b_c = hex\"01610162016300\";\n bytes memory b_b_c = hex\"01620162016300\";\n bytes memory c = hex\"016300\";\n bytes memory d = hex\"016400\";\n bytes memory a_d_c = hex\"01610164016300\";\n bytes memory b_a_c = hex\"01620161016300\";\n bytes memory ab_c_d = hex\"0261620163016400\";\n bytes memory a_c_d = hex\"01610163016400\";\n bytes\n memory verylong1_eth = hex\"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n bytes\n memory verylong2_eth = hex\"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n\n require(\n hex\"0301616100\".compareNames(hex\"0302616200\") < 0,\n \"label lengths are correctly checked\"\n );\n require(\n a_b_c.compareNames(c) > 0,\n \"one name has a difference of >1 label to with the same root name\"\n );\n require(\n a_b_c.compareNames(d) < 0,\n \"one name has a difference of >1 label to with different root name\"\n );\n require(\n a_b_c.compareNames(a_d_c) < 0,\n \"two names start the same but have differences in later labels\"\n );\n require(\n a_b_c.compareNames(b_a_c) > 0,\n \"the first label sorts later, but the first label sorts earlier\"\n );\n require(\n ab_c_d.compareNames(a_c_d) > 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(\n a_b_c.compareNames(b_b_c) < 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(\n bthLabXyz.compareNames(ethLabXyz) < 0,\n \"bthLab.xyz comes before ethLab.xyz\"\n );\n require(\n bthLabXyz.compareNames(bthLabXyz) == 0,\n \"bthLab.xyz and bthLab.xyz are the same\"\n );\n require(\n ethLabXyz.compareNames(bthLabXyz) > 0,\n \"ethLab.xyz comes after bethLab.xyz\"\n );\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(\n verylong1_eth.compareNames(verylong2_eth) > 0,\n \"longa.vlong.eth comes after long.vlong.eth\"\n );\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(\n RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA),\n \"0x11111111 >= 0xAAAAAAAA\"\n );\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(\n hex\"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d\"\n .computeKeytag() == 19036,\n \"Invalid keytag\"\n );\n require(\n hex\"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf\"\n .computeKeytag() == 21693,\n \"Invalid keytag (2)\"\n );\n require(\n hex\"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3\"\n .computeKeytag() == 33630\n );\n require(\n hex\"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5\"\n .computeKeytag() == 20326,\n \"Invalid keytag (3)\"\n );\n }\n}\n" + }, + "test/registry/mocks/DummyResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyResolver {\n mapping(bytes32 => string) public name;\n\n function setName(bytes32 node, string memory _name) public {\n name[node] = _name;\n }\n}\n" + }, + "test/utils/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n if (bytes4(extraData) == bytes4(keccak256(\"name(bytes32)\"))) {\n return abi.encode(\"offchain.test.eth\");\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "test/utils/mocks/LegacyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\ncontract LegacyResolver {\n function addr(bytes32 /* node */) public view returns (address) {\n return address(this);\n }\n}\n" + }, + "test/utils/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10 ** uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10 ** uint256(decimals()));\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1500 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/solcInputs/2d8cd8af817b3996918016eaf0684f54.json b/solidity/dns-contracts/deployments/goerli/solcInputs/2d8cd8af817b3996918016eaf0684f54.json new file mode 100644 index 0000000..88e1d05 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/solcInputs/2d8cd8af817b3996918016eaf0684f54.json @@ -0,0 +1,35 @@ +{ + "language": "Solidity", + "sources": { + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 10000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/solcInputs/49f758ec505ff69b72f3179ac11d7cfc.json b/solidity/dns-contracts/deployments/goerli/solcInputs/49f758ec505ff69b72f3179ac11d7cfc.json new file mode 100644 index 0000000..51bd823 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/solcInputs/49f758ec505ff69b72f3179ac11d7cfc.json @@ -0,0 +1,101 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n uint256 hexLength = lastIdx - idx;\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\n revert(\"Invalid string length\");\n }\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n return functionStaticCall(target, data, gasleft());\n }\n\n /**\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @param gasLimit The gas limit to use for the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n uint256 gasLimit\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gasLimit,\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nerror ResolverNotContract();\n\nerror ResolverError(bytes returnData);\n\nerror HttpError(HttpErrorItem[] errors);\n\nstruct HttpErrorItem {\n uint16 status;\n string message;\n}\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct MulticallChecks {\n bool isCallback;\n bool hasExtendedResolver;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\nstruct Result {\n bool success;\n bytes returnData;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (Result[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (Result[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (Result[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (Result[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n if (!resolverAddress.isContract()) {\n revert ResolverNotContract();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory reverseResolvedData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n reverseResolvedData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (Result[] memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n Result[] memory results,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(result.returnData, (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n result.returnData,\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (Result[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data,\n bool isSafe\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n if (isSafe) {\n result = LowLevelCallUtils.functionStaticCall(target, data);\n } else {\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\n }\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _checkInterface(\n address resolver,\n bytes4 interfaceId\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _checkSafetyAndItem(\n bytes memory name,\n bytes memory item,\n address resolver,\n MulticallChecks memory multicallChecks\n ) internal view returns (bool, bytes memory) {\n if (!multicallChecks.isCallback) {\n if (multicallChecks.hasExtendedResolver) {\n return (\n true,\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\n );\n }\n return (_checkInterface(resolver, bytes4(item)), item);\n }\n return (true, item);\n }\n\n function _checkMulticall(\n MulticallData memory multicallData\n ) internal view returns (MulticallChecks memory) {\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _checkInterface(\n multicallData.resolver,\n type(IExtendedResolver).interfaceId\n );\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n return MulticallChecks(isCallback, hasExtendedResolver);\n }\n\n function _checkResolveSingle(Result memory result) internal pure {\n if (!result.success) {\n if (bytes4(result.returnData) == HttpError.selector) {\n bytes memory returnData = result.returnData;\n assembly {\n revert(add(returnData, 32), mload(returnData))\n }\n }\n revert ResolverError(result.returnData);\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (Result[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new Result[](length);\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n\n if (failure) {\n results[i] = Result(false, item);\n continue;\n }\n\n bool isSafe = false;\n (isSafe, item) = _checkSafetyAndItem(\n multicallData.name,\n item,\n multicallData.resolver,\n multicallChecks\n );\n\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(\n multicallData.resolver,\n item,\n isSafe\n );\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && multicallChecks.hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = Result(success, returnData);\n extraDatas[i].data = item;\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/solcInputs/6f9a02697c272c5ce262ad43f546b7d2.json b/solidity/dns-contracts/deployments/goerli/solcInputs/6f9a02697c272c5ce262ad43f546b7d2.json new file mode 100644 index 0000000..58c9fb9 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/solcInputs/6f9a02697c272c5ce262ad43f546b7d2.json @@ -0,0 +1,95 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(address owner, address operator)\n external\n view\n returns (bool);\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(bytes memory self, uint256 offset)\n internal\n pure\n returns (bytes32)\n {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(bytes memory self, uint256 idx)\n internal\n pure\n returns (bytes32 labelhash, uint256 newIdx)\n {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _preTransferCheck and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC165, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id)\n public\n view\n virtual\n override\n returns (uint256)\n {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] memory accounts, uint256[] memory ids)\n public\n view\n virtual\n override\n returns (uint256[] memory)\n {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved)\n public\n virtual\n override\n {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator)\n public\n view\n virtual\n override\n returns (bool)\n {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(uint256 tokenId)\n public\n view\n virtual\n returns (\n address owner,\n uint32 fuses,\n uint64 expiry\n )\n {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _preTransferCheck(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _preTransferCheck(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (bool);\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _preTransferCheck(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external;\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(uint256 labelHash, uint256 duration)\n external\n returns (uint256 expires);\n\n function unwrap(\n bytes32 node,\n bytes32 label,\n address owner\n ) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function setFuses(bytes32 node, uint16 ownerControlledFuses)\n external\n returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(bytes32 node, address addr) external returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external returns (address owner);\n\n function getData(uint256 id)\n external\n returns (\n address,\n uint32,\n uint64\n );\n\n function allFusesBurned(bytes32 node, uint32 fuseMask)\n external\n view\n returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function setSubnodeRecord(\n bytes32 parentNode,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) external;\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable\n{\n using BytesUtils for bytes;\n\n ENS public immutable override ens;\n IBaseRegistrar public immutable override registrar;\n IMetadataService public override metadataService;\n mapping(bytes32 => bytes) public override names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC1155Fuse, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(uint256 id)\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner)\n {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(uint256 id)\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (\n address owner,\n uint32 fuses,\n uint64 expiry\n )\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(IMetadataService _metadataService)\n public\n onlyOwner\n {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(uint256 tokenId) public view override returns (string memory) {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress)\n public\n onlyOwner\n {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or approved by the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or approved\n */\n\n function canModifyName(bytes32 node, address addr)\n public\n view\n override\n returns (bool)\n {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n (fuses & IS_DOT_ETH == 0 ||\n expiry - GRACE_PERIOD >= block.timestamp);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public override {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n _wrapETH2LD(label, wrappedOwner, ownerControlledFuses, resolver);\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external override onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(label, wrappedOwner, ownerControlledFuses, resolver);\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(uint256 tokenId, uint256 duration)\n external\n override\n onlyController\n returns (uint256 expires)\n {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n //use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public override {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public override onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public override onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return New fuses\n */\n\n function setFuses(bytes32 node, uint16 ownerControlledFuses)\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return ownerControlledFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n // this flag is used later, when checking fuses\n bool canModifyParentName = canModifyName(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canModifyParentName && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canModifyParentName && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a .eth wrapped domain by calling the wrapETH2LD function of the upgradeContract\n * and burning the token of this contract\n * @dev Can be called by the owner of the name in this contract\n * @param label Label as a string of the .eth name to upgrade\n * @param wrappedOwner The owner of the wrapped name\n */\n\n function upgradeETH2LD(\n string calldata label,\n address wrappedOwner,\n address resolver\n ) public {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n (address currentOwner, uint32 fuses, uint64 expiry) = _prepareUpgrade(\n node\n );\n\n if (wrappedOwner != currentOwner) {\n _preTransferCheck(uint256(node), fuses, expiry);\n }\n\n upgradeContract.wrapETH2LD(\n label,\n wrappedOwner,\n fuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @notice Upgrades a non .eth domain of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * Requires upgraded Namewrapper to permit old Namewrapper to call `setSubnodeRecord` for all names\n * @param parentNode Namehash of the parent name\n * @param label Label as a string of the name to upgrade\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract for this name\n */\n\n function upgrade(\n bytes32 parentNode,\n string calldata label,\n address wrappedOwner,\n address resolver\n ) public {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(parentNode, labelhash);\n (address currentOwner, uint32 fuses, uint64 expiry) = _prepareUpgrade(\n node\n );\n\n if (wrappedOwner != currentOwner) {\n _preTransferCheck(uint256(node), fuses, expiry);\n }\n\n upgradeContract.setSubnodeRecord(\n parentNode,\n label,\n wrappedOwner,\n resolver,\n 0,\n fuses,\n expiry\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of. Can also be called by the owner of a .eth name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n override\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(bytes32 node, address resolver)\n public\n override\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_SET_RESOLVER)\n {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(bytes32 node, uint64 ttl)\n public\n override\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_SET_TTL)\n {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(bytes32 parentNode, bytes32 subnode)\n internal\n view\n {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(bytes32 node, uint32 fuseMask)\n public\n view\n override\n returns (bool)\n {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n function isWrapped(bytes32 node) public view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public override returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n _wrapETH2LD(label, owner, ownerControlledFuses, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _preTransferCheck(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (bool) {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(bytes32 node, bytes32 labelhash)\n private\n pure\n returns (bytes32)\n {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(string memory label, bytes memory name)\n internal\n pure\n returns (bytes memory ret)\n {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _prepareUpgrade(bytes32 node)\n private\n returns (\n address owner,\n uint32 fuses,\n uint64 expiry\n )\n {\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (owner, fuses, expiry) = getData(uint256(node));\n\n _burn(uint256(node));\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) internal pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n uint64 expiry = uint64(registrar.nameExpires(uint256(labelhash))) +\n GRACE_PERIOD;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n ownerControlledFuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 2500 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/solcInputs/7948b60c3b601df824761a337a51d661.json b/solidity/dns-contracts/deployments/goerli/solcInputs/7948b60c3b601df824761a337a51d661.json new file mode 100644 index 0000000..64cbfc8 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/solcInputs/7948b60c3b601df824761a337a51d661.json @@ -0,0 +1,323 @@ +{ + "language": "Solidity", + "sources": { + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n\n using BytesUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(DNSSEC oracle, bytes memory name, bytes memory proof)\n internal\n view\n returns (address, bool)\n {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n bytes20 hash;\n uint32 expiration;\n // Check the provided TXT record has been validated by the oracle\n (, expiration, hash) = oracle.rrdata(TYPE_TXT, buf.buf);\n if (hash == bytes20(0) && proof.length == 0) return (address(0x0), false);\n\n require(hash == bytes20(keccak256(proof)));\n\n for (RRUtils.RRIterator memory iter = proof.iterateRRs(0); !iter.done(); iter.next()) {\n require(RRUtils.serialNumberGte(expiration + iter.ttl, uint32(block.timestamp)), \"DNS record is stale; refresh or delete it before proceeding.\");\n\n bool found;\n address addr;\n (addr, found) = parseRR(proof, iter.rdataOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(bytes memory rdata, uint idx) internal pure returns (address, bool) {\n while (idx < rdata.length) {\n uint len = rdata.readUint8(idx); idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(bytes memory str, uint idx, uint len) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n if (len < 44) return (address(0x0), false);\n return hexToAddress(str, idx + 4);\n }\n\n function hexToAddress(bytes memory str, uint idx) internal pure returns (address, bool) {\n if (str.length - idx < 40) return (address(0x0), false);\n uint ret = 0;\n for (uint i = idx; i < idx + 40; i++) {\n ret <<= 4;\n uint x = str.readUint8(i);\n if (x >= 48 && x < 58) {\n ret |= x - 48;\n } else if (x >= 65 && x < 71) {\n ret |= x - 55;\n } else if (x >= 97 && x < 103) {\n ret |= x - 87;\n } else {\n return (address(0x0), false);\n }\n }\n return (address(uint160(ret)), true);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n event NSEC3DigestUpdated(uint8 id, address addr);\n event RRSetUpdated(bytes name, bytes rrset);\n\n function submitRRSets(RRSetWithSignature[] memory input, bytes calldata proof) public virtual returns (bytes memory);\n function submitRRSet(RRSetWithSignature calldata input, bytes calldata proof) public virtual returns (bytes memory);\n function deleteRRSet(uint16 deleteType, bytes calldata deleteName, RRSetWithSignature calldata nsec, bytes calldata proof) public virtual;\n function deleteRRSetNSEC3(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory closestEncloser, RRSetWithSignature memory nextClosest, bytes memory dnskey) public virtual;\n function rrdata(uint16 dnstype, bytes calldata name) external virtual view returns (uint32, uint32, bytes20);\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\n uint shortest = len;\n if (otherlen < len)\n shortest = otherlen;\n\n uint selfptr;\n uint otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint idx = 0; idx < shortest; idx += 32) {\n uint a;\n uint b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint mask;\n if (shortest > 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\n }\n int diff = int(a & mask) - int(b & mask);\n if (diff != 0)\n return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int(len) - int(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\n return self.length == other.length && equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint dest, uint src, uint len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint dest;\n uint src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\n require(len <= 52);\n\n uint ret = 0;\n uint8 decoded;\n for(uint i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if(i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint bitlen = len * 5;\n if(len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if(len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if(len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if(len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if(len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n}" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n* @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n*/\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(bytes memory self, uint offset) internal pure returns(uint) {\n uint idx = offset;\n while (true) {\n assert(idx < self.length);\n uint labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(bytes memory self, uint offset) internal pure returns(bytes memory ret) {\n uint len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(bytes memory self, uint offset) internal pure returns(uint) {\n uint count = 0;\n while (true) {\n assert(offset < self.length);\n uint labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint constant RRSIG_TYPE = 0;\n uint constant RRSIG_ALGORITHM = 2;\n uint constant RRSIG_LABELS = 3;\n uint constant RRSIG_TTL = 4;\n uint constant RRSIG_EXPIRATION = 8;\n uint constant RRSIG_INCEPTION = 12;\n uint constant RRSIG_KEY_TAG = 16;\n uint constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(bytes memory data) internal pure returns(SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(RRSIG_SIGNER_NAME + self.signerName.length, data.length - RRSIG_SIGNER_NAME - self.signerName.length);\n }\n\n function rrs(SignedSet memory rrset) internal pure returns(RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint rdataOffset;\n uint nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(bytes memory self, uint offset) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns(bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns(bytes memory) {\n return iter.data.substring(iter.offset, nameLength(iter.data, iter.offset));\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(RRIterator memory iter) internal pure returns(bytes memory) {\n return iter.data.substring(iter.rdataOffset, iter.nextOffset - iter.rdataOffset);\n }\n\n uint constant DNSKEY_FLAGS = 0;\n uint constant DNSKEY_PROTOCOL = 2;\n uint constant DNSKEY_ALGORITHM = 3;\n uint constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(bytes memory data, uint offset, uint length) internal pure returns(DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(offset + DNSKEY_PUBKEY, length - DNSKEY_PUBKEY);\n } \n\n uint constant DS_KEY_TAG = 0;\n uint constant DS_ALGORITHM = 2;\n uint constant DS_DIGEST_TYPE = 3;\n uint constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(bytes memory data, uint offset, uint length) internal pure returns(DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n struct NSEC3 {\n uint8 hashAlgorithm;\n uint8 flags;\n uint16 iterations;\n bytes salt;\n bytes32 nextHashedOwnerName;\n bytes typeBitmap;\n }\n\n uint constant NSEC3_HASH_ALGORITHM = 0;\n uint constant NSEC3_FLAGS = 1;\n uint constant NSEC3_ITERATIONS = 2;\n uint constant NSEC3_SALT_LENGTH = 4;\n uint constant NSEC3_SALT = 5;\n\n function readNSEC3(bytes memory data, uint offset, uint length) internal pure returns(NSEC3 memory self) {\n uint end = offset + length;\n self.hashAlgorithm = data.readUint8(offset + NSEC3_HASH_ALGORITHM);\n self.flags = data.readUint8(offset + NSEC3_FLAGS);\n self.iterations = data.readUint16(offset + NSEC3_ITERATIONS);\n uint8 saltLength = data.readUint8(offset + NSEC3_SALT_LENGTH);\n offset = offset + NSEC3_SALT;\n self.salt = data.substring(offset, saltLength);\n offset += saltLength;\n uint8 nextLength = data.readUint8(offset);\n require(nextLength <= 32);\n offset += 1;\n self.nextHashedOwnerName = data.readBytesN(offset, nextLength);\n offset += nextLength;\n self.typeBitmap = data.substring(offset, end - offset);\n }\n\n function checkTypeBitmap(NSEC3 memory self, uint16 rrtype) internal pure returns(bool) {\n return checkTypeBitmap(self.typeBitmap, 0, rrtype);\n }\n\n /**\n * @dev Checks if a given RR type exists in a type bitmap.\n * @param bitmap The byte string to read the type bitmap from.\n * @param offset The offset to start reading at.\n * @param rrtype The RR type to check for.\n * @return True if the type is found in the bitmap, false otherwise.\n */\n function checkTypeBitmap(bytes memory bitmap, uint offset, uint16 rrtype) internal pure returns (bool) {\n uint8 typeWindow = uint8(rrtype >> 8);\n uint8 windowByte = uint8((rrtype & 0xff) / 8);\n uint8 windowBitmask = uint8(uint8(1) << (uint8(7) - uint8(rrtype & 0x7)));\n for (uint off = offset; off < bitmap.length;) {\n uint8 window = bitmap.readUint8(off);\n uint8 len = bitmap.readUint8(off + 1);\n if (typeWindow < window) {\n // We've gone past our window; it's not here.\n return false;\n } else if (typeWindow == window) {\n // Check this type bitmap\n if (len <= windowByte) {\n // Our type is past the end of the bitmap\n return false;\n }\n return (bitmap.readUint8(off + windowByte + 2) & windowBitmask) != 0;\n } else {\n // Skip this type bitmap\n off += len + 2;\n }\n }\n\n return false;\n }\n\n function compareNames(bytes memory self, bytes memory other) internal pure returns (int) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint off;\n uint otheroff;\n uint prevoff;\n uint otherprevoff;\n uint counts = labelCount(self, 0);\n uint othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if(otheroff == 0) {\n return 1;\n }\n\n return self.compare(prevoff + 1, self.readUint8(prevoff), other, otherprevoff + 1, other.readUint8(otherprevoff));\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(uint32 i1, uint32 i2) internal pure returns(bool) {\n return int32(i1) - int32(i2) >= 0;\n }\n\n function progress(bytes memory body, uint off) internal pure returns(uint) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint ac1;\n uint ac2;\n for(uint i = 0; i < data.length + 31; i += 32) {\n uint word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if(i + 32 > data.length) {\n uint unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 += (word & 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >> 8;\n ac2 += (word & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 = (ac1 & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF)\n + ((ac1 & 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >> 16);\n ac2 = (ac2 & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF)\n + ((ac2 & 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >> 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 = (ac1 & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF)\n + ((ac1 & 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >> 32);\n ac1 = (ac1 & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF)\n + ((ac1 & 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >> 64);\n ac1 = (ac1 & 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\n + (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}" + }, + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\n\ninterface IDNSRegistrar {\n function claim(bytes memory name, bytes memory proof) external;\n function proveAndClaim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof) external;\n function proveAndClaimWithResolver(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof, address resolver, address addr) external;\n}\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar {\n using BytesUtils for bytes;\n\n DNSSEC public oracle;\n ENS public ens;\n PublicSuffixList public suffixes;\n\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event Claim(bytes32 indexed node, address indexed owner, bytes dnsname);\n event NewOracle(address oracle);\n event NewPublicSuffixList(address suffixes);\n\n constructor(DNSSEC _dnssec, PublicSuffixList _suffixes, ENS _ens) {\n oracle = _dnssec;\n emit NewOracle(address(oracle));\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setOracle(DNSSEC _dnssec) public onlyOwner {\n oracle = _dnssec;\n emit NewOracle(address(oracle));\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Claims a name by proving ownership of its DNS equivalent.\n * @param name The name to claim, in DNS wire format.\n * @param proof A DNS RRSet proving ownership of the name. Must be verified\n * in the DNSSEC oracle before calling. This RRSET must contain a TXT\n * record for '_ens.' + name, with the value 'a=0x...'. Ownership of\n * the name will be transferred to the address specified in the TXT\n * record.\n */\n function claim(bytes memory name, bytes memory proof) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(name, proof);\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input The data to be passed to the Oracle's `submitProofs` function. The last\n * proof must be the TXT record required by the registrar.\n * @param proof The proof record for the first element in input.\n */\n function proveAndClaim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof) public override {\n proof = oracle.submitRRSets(input, proof);\n claim(name, proof);\n }\n\n function proveAndClaimWithResolver(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof, address resolver, address addr) public override {\n proof = oracle.submitRRSets(input, proof);\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(name, proof);\n require(msg.sender == owner, \"Only owner can call proveAndClaimWithResolver\");\n if(addr != address(0)) {\n require(resolver != address(0), \"Cannot set addr if resolver is not set\");\n // Set ourselves as the owner so we can set a record on the resolver\n ens.setSubnodeRecord(rootNode, labelHash, address(this), resolver, 0);\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n // Transfer the record to the owner\n ens.setOwner(node, owner);\n } else {\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n }\n }\n\n function supportsInterface(bytes4 interfaceID) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(bytes memory name, bytes memory proof) internal returns(bytes32 rootNode, bytes32 labelHash, address addr) {\n // Get the first label\n uint labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n // Parent name must be in the public suffix list.\n bytes memory parentName = name.substring(labelLen + 1, name.length - labelLen - 1);\n require(suffixes.isPublicSuffix(parentName), \"Parent name must be a public suffix\");\n\n // Make sure the parent name is enabled\n rootNode = enableNode(parentName, 0);\n\n (addr,) = DNSClaimChecker.getOwnerAddress(oracle, name, proof);\n\n emit Claim(keccak256(abi.encodePacked(rootNode, labelHash)), addr, name);\n }\n\n function enableNode(bytes memory domain, uint offset) internal returns(bytes32 node) {\n uint len = domain.readUint8(offset);\n if(len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n require(owner == address(0) || owner == address(this), \"Cannot enable a name owned by someone else\");\n if(owner != address(this)) {\n if(parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n } else {\n ens.setSubnodeOwner(parentNode, label, address(this));\n }\n }\n return node;\n }\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping (bytes32 => Record) records;\n mapping (address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(bytes32 node, address owner) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public virtual override authorised(node) returns(bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(bytes32 node, address resolver) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(bytes32 node, uint64 ttl) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(address operator, bool approved) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public virtual override view returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public virtual override view returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public virtual override view returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(bytes32 node) public virtual override view returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(address owner, address operator) external virtual override view returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(bytes32 node, address resolver, uint64 ttl) internal {\n if(resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if(ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(bytes32 label, address owner)\n external\n onlyController\n {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns(bool);\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is IAddrResolver, IAddressResolver, ResolverBase {\n uint constant private COIN_TYPE_ETH = 60;\n\n mapping(bytes32=>mapping(uint=>bytes)) _addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(bytes32 node, address a) virtual external authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) virtual override public view returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if(a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(bytes32 node, uint coinType, bytes memory a) virtual public authorised(node) {\n emit AddressChanged(node, coinType, a);\n if(coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n _addresses[node][coinType] = a;\n }\n\n function addr(bytes32 node, uint coinType) virtual override public view returns(bytes memory) {\n return _addresses[node][coinType];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == type(IAddrResolver).interfaceId || interfaceID == type(IAddressResolver).interfaceId || super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(bytes memory b) internal pure returns(address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns(bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual;\n function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual;\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external virtual returns(bytes32);\n function setResolver(bytes32 node, address resolver) external virtual;\n function setOwner(bytes32 node, address owner) external virtual;\n function setTTL(bytes32 node, uint64 ttl) external virtual;\n function setApprovalForAll(address operator, bool approved) external virtual;\n function owner(bytes32 node) external virtual view returns (address);\n function resolver(bytes32 node) external virtual view returns (address);\n function ttl(bytes32 node) external virtual view returns (uint64);\n function recordExists(bytes32 node) external virtual view returns (bool);\n function isApprovedForAll(address owner, address operator) external virtual view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _setOwner(_msgSender());\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _setOwner(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _setOwner(newOwner);\n }\n\n function _setOwner(address newOwner) private {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./SupportsInterface.sol\";\n\nabstract contract ResolverBase is SupportsInterface {\n function isAuthorised(bytes32 node) internal virtual view returns(bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress);\n\n function addr(bytes32 node, uint coinType) external view returns(bytes memory);\n}\n" + }, + "contracts/resolvers/SupportsInterface.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./ISupportsInterface.sol\";\n\nabstract contract SupportsInterface is ISupportsInterface {\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == type(ISupportsInterface).interfaceId;\n }\n}\n" + }, + "contracts/resolvers/ISupportsInterface.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface ISupportsInterface {\n function supportsInterface(bytes4 interfaceID) external pure returns(bool);\n}" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\n\ninterface INameWrapper {\n function ownerOf(uint256 id) external view returns (address);\n}\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is Multicallable, ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver {\n ENS ens;\n INameWrapper nameWrapper;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n constructor(ENS _ens, INameWrapper wrapperAddress){\n ens = _ens;\n nameWrapper = wrapperAddress;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external{\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n function isAuthorised(bytes32 node) internal override view returns(bool) {\n address owner = ens.owner(node);\n if(owner == address(nameWrapper) ){\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return owner == msg.sender || isApprovedForAll(owner, msg.sender);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator) public view returns (bool){\n return _operatorApprovals[account][operator];\n }\n\n function supportsInterface(bytes4 interfaceID) public override(Multicallable, ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver) pure returns(bool) {\n return interfaceID == type(IMulticallable).interfaceId || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(bytes32=>mapping(uint256=>bytes)) abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(bytes32 node, uint256 contentType, bytes calldata data) virtual external authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n abis[node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(bytes32 node, uint256 contentTypes) virtual override external view returns (uint256, bytes memory) {\n mapping(uint256=>bytes) storage abiset = abis[node];\n\n for (uint256 contentType = 1; contentType <= contentTypes; contentType <<= 1) {\n if ((contentType & contentTypes) != 0 && abiset[contentType].length > 0) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == type(IABIResolver).interfaceId || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(bytes32=>bytes) hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(bytes32 node, bytes calldata hash) virtual external authorised(node) {\n hashes[node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) virtual external override view returns (bytes memory) {\n return hashes[node];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == type(IContentHashResolver).interfaceId || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is IDNSRecordResolver, IDNSZoneResolver, ResolverBase {\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(bytes32=>bytes) private zonehashes;\n\n // Version the mapping for each zone. This allows users who have lost\n // track of their entries to effectively delete an entire zone by bumping\n // the version number.\n // node => version\n mapping(bytes32=>uint256) private versions;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(bytes32=>mapping(uint256=>mapping(bytes32=>mapping(uint16=>bytes)))) private records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(bytes32=>mapping(uint256=>mapping(bytes32=>uint16))) private nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(bytes32 node, bytes calldata data) virtual external authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n // Iterate over the data to add the resource records\n for (RRUtils.RRIterator memory iter = data.iterateRRs(0); !iter.done(); iter.next()) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(node, name, resource, data, offset, iter.offset - offset, value.length == 0);\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(node, name, resource, data, offset, data.length - offset, value.length == 0);\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(bytes32 node, bytes32 name, uint16 resource) virtual override public view returns (bytes memory) {\n return records[node][versions[node]][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(bytes32 node, bytes32 name) virtual public view returns (bool) {\n return (nameEntriesCount[node][versions[node]][name] != 0);\n }\n\n /**\n * Clear all information for a DNS zone.\n * @param node the namehash of the node for which to clear the zone\n */\n function clearDNSZone(bytes32 node) virtual public authorised(node) {\n versions[node]++;\n emit DNSZoneCleared(node);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(bytes32 node, bytes calldata hash) virtual external authorised(node) {\n bytes memory oldhash = zonehashes[node];\n zonehashes[node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) virtual override external view returns (bytes memory) {\n return zonehashes[node];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord) private\n {\n uint256 version = versions[node];\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (records[node][version][nameHash][resource].length != 0) {\n nameEntriesCount[node][version][nameHash]--;\n }\n delete(records[node][version][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (records[node][version][nameHash][resource].length == 0) {\n nameEntriesCount[node][version][nameHash]++;\n }\n records[node][version][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../ISupportsInterface.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(bytes32=>mapping(bytes4=>address)) interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(bytes32 node, bytes4 interfaceID, address implementer) virtual external authorised(node) {\n interfaces[node][interfaceID] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(bytes32 node, bytes4 interfaceID) virtual override external view returns (address) {\n address implementer = interfaces[node][interfaceID];\n if(implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if(a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(abi.encodeWithSignature(\"supportsInterface(bytes4)\", type(ISupportsInterface).interfaceId));\n if(!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID));\n if(!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == type(IInterfaceResolver).interfaceId || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(bytes32=>string) names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(bytes32 node, string calldata newName) virtual external authorised(node) {\n names[node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) virtual override external view returns (string memory) {\n return names[node];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == type(INameResolver).interfaceId || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(bytes32=>PublicKey) pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) virtual external authorised(node) {\n pubkeys[node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) virtual override external view returns (bytes32 x, bytes32 y) {\n return (pubkeys[node].x, pubkeys[node].y);\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == type(IPubkeyResolver).interfaceId || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(bytes32=>mapping(string=>string)) texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(bytes32 node, string calldata key, string calldata value) virtual external authorised(node) {\n texts[node][key] = value;\n emit TextChanged(node, key, key);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(bytes32 node, string calldata key) virtual override external view returns (string memory) {\n return texts[node][key];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == type(ITextResolver).interfaceId || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"./SupportsInterface.sol\";\n\nabstract contract Multicallable is IMulticallable, SupportsInterface {\n function multicall(bytes[] calldata data) external override returns(bytes[] memory results) {\n results = new bytes[](data.length);\n for(uint i = 0; i < data.length; i++) {\n (bool success, bytes memory result) = address(this).delegatecall(data[i]);\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n function supportsInterface(bytes4 interfaceID) public override virtual pure returns(bool) {\n return interfaceID == type(IMulticallable).interfaceId || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(bytes32 node, uint256 contentTypes) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(bytes32 indexed node, bytes name, uint16 resource, bytes record);\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n // DNSZoneCleared is emitted whenever a given node's zone information is cleared.\n event DNSZoneCleared(bytes32 indexed node);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(bytes32 node, bytes32 name, uint16 resource) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(bytes32 indexed node, bytes lastzonehash, bytes zonehash);\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(bytes32 indexed node, bytes4 indexed interfaceID, address implementer);\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(bytes32 node, bytes4 interfaceID) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(bytes32 indexed node, string indexed indexedKey, string key);\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(bytes32 node, string calldata key) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(bytes[] calldata data) external returns(bytes[] memory results);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./ISupportsInterface.sol\";\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is ISupportsInterface, IABIResolver, IAddressResolver, IAddrResolver, IContentHashResolver, IDNSRecordResolver, IDNSZoneResolver, IInterfaceResolver, INameResolver, IPubkeyResolver, ITextResolver {\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setABI(bytes32 node, uint256 contentType, bytes calldata data) external;\n function setAddr(bytes32 node, address addr) external;\n function setAddr(bytes32 node, uint coinType, bytes calldata a) external;\n function setContenthash(bytes32 node, bytes calldata hash) external;\n function setDnsrr(bytes32 node, bytes calldata data) external;\n function setName(bytes32 node, string calldata _name) external;\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n function setText(bytes32 node, string calldata key, string calldata value) external;\n function setInterface(bytes32 node, bytes4 interfaceID, address implementer) external;\n function multicall(bytes[] calldata data) external returns(bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n function multihash(bytes32 node) external view returns (bytes memory);\n function setContent(bytes32 node, bytes32 hash) external;\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is Ownable, ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver {\n function isAuthorised(bytes32) internal override view returns(bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override(ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver) public pure returns(bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_NSEC = 47;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex'00'.nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex'0361626300'.nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex'0361626300'.nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex'00'.labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex'016100'.labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(hex'016201610000'.labelCount(0) == 2, \"labelCount('b.a.') == 2\");\n require(hex'066574686c61620378797a00'.labelCount(6 +1) == 1, \"nameLength('(bthlab).xyz.') == 6\");\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes memory rrs = hex'0161000001000100000e1000047400000101620161000001000100000e100004c0a80101';\n string[2] memory names = [hex'016100', hex'0162016100'];\n string[2] memory rdatas = [hex'74000001', hex'c0a80101'];\n uint i = 0;\n for(RRUtils.RRIterator memory iter = rrs.iterateRRs(0); !iter.done(); iter.next()) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(keccak256(iter.name()) == keccak256(bytes(names[i])), \"Name matches\");\n require(keccak256(iter.rdata()) == keccak256(bytes(rdatas[i])), \"Rdata matches\");\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n function testCheckTypeBitmapTextType() public pure {\n bytes memory tb = hex'0003000080';\n require(tb.checkTypeBitmap(0, DNSTYPE_TEXT) == true, \"A record should exist in type bitmap\");\n }\n\n function testCheckTypeBitmap() public pure {\n // From https://tools.ietf.org/html/rfc4034#section-4.3\n // alfa.example.com. 86400 IN NSEC host.example.com. (\n // A MX RRSIG NSEC TYPE1234\n bytes memory tb = hex'FF0006400100000003041b000000000000000000000000000000000000000000000000000020';\n\n // Exists in bitmap\n require(tb.checkTypeBitmap(1, DNSTYPE_A) == true, \"A record should exist in type bitmap\");\n // Does not exist, but in a window that is included\n require(tb.checkTypeBitmap(1, DNSTYPE_CNAME) == false, \"CNAME record should not exist in type bitmap\");\n // Does not exist, past the end of a window that is included\n require(tb.checkTypeBitmap(1, 64) == false, \"Type 64 should not exist in type bitmap\");\n // Does not exist, in a window that does not exist\n require(tb.checkTypeBitmap(1, 769) == false, \"Type 769 should not exist in type bitmap\");\n // Exists in a subsequent window\n require(tb.checkTypeBitmap(1, DNSTYPE_TYPE1234) == true, \"Type 1234 should exist in type bitmap\");\n // Does not exist, past the end of the bitmap windows\n require(tb.checkTypeBitmap(1, 1281) == false, \"Type 1281 should not exist in type bitmap\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex'066274686c61620378797a00';\n bytes memory ethLabXyz = hex'066574686c61620378797a00';\n bytes memory xyz = hex'0378797a00';\n bytes memory a_b_c = hex'01610162016300';\n bytes memory b_b_c = hex'01620162016300';\n bytes memory c = hex'016300';\n bytes memory d = hex'016400';\n bytes memory a_d_c = hex'01610164016300';\n bytes memory b_a_c = hex'01620161016300';\n bytes memory ab_c_d = hex'0261620163016400';\n bytes memory a_c_d = hex'01610163016400';\n\n require(hex'0301616100'.compareNames(hex'0302616200') < 0, \"label lengths are correctly checked\");\n require(a_b_c.compareNames(c) > 0, \"one name has a difference of >1 label to with the same root name\");\n require(a_b_c.compareNames(d) < 0, \"one name has a difference of >1 label to with different root name\");\n require(a_b_c.compareNames(a_d_c) < 0, \"two names start the same but have differences in later labels\");\n require(a_b_c.compareNames(b_a_c) > 0, \"the first label sorts later, but the first label sorts earlier\");\n require(ab_c_d.compareNames(a_c_d) > 0, \"two names where the first label on one is a prefix of the first label on the other\");\n require(a_b_c.compareNames(b_b_c) < 0, \"two names where the first label on one is a prefix of the first label on the other\");\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(bthLabXyz.compareNames(ethLabXyz) < 0, \"bthLab.xyz comes before ethLab.xyz\");\n require(bthLabXyz.compareNames(bthLabXyz) == 0, \"bthLab.xyz and bthLab.xyz are the same\");\n require(ethLabXyz.compareNames(bthLabXyz) > 0, \"ethLab.xyz comes after bethLab.xyz\");\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA), \"0x11111111 >= 0xAAAAAAAA\");\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(hex'0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d'.computeKeytag() == 19036, \"Invalid keytag\");\n require(hex'010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf'.computeKeytag() == 21693, \"Invalid keytag (2)\");\n require(hex'0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3'.computeKeytag() == 33630);\n require(hex'0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5'.computeKeytag() == 20326, \"Invalid keytag (3)\");\n }\n}" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\"\".keccak(0, 0) == bytes32(0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470), \"Incorrect hash of empty string\");\n require(\"foo\".keccak(0, 3) == bytes32(0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d), \"Incorrect hash of 'foo'\");\n require(\"foo\".keccak(0, 0) == bytes32(0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470), \"Incorrect hash of empty string\");\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\"hello\".equals(1, \"ello\") == true, \"Substring to string equality\");\n require(\"hello\".equals(1, \"jello\", 1, 4) == true, \"Substring to substring equality\");\n require(\"zhello\".equals(1, \"abchello\", 3) == true, \"Compare different value with multiple length\");\n }\n\n function testComparePartial() public pure {\n require(\"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true, \"Compare same length\");\n require(\"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true, \"Compare different length\");\n require(\"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true, \"Compare same with different offset\");\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\"a\".compare(\"b\") < 0 == true, \"Compare different value with same length\");\n require(\"b\".compare(\"a\") > 0 == true, \"Compare different value with same length\");\n require(\"aa\".compare(\"ab\") < 0 == true, \"Compare different value with multiple length\");\n require(\"a\".compare(\"aa\") < 0 == true, \"Compare different value with different length\");\n require(\"aa\".compare(\"a\") > 0 == true, \"Compare different value with different length\");\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(longChar.compare(longChar) == 0 == true, \"Compares more than 32 bytes char\");\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(longChar.compare(otherLongChar) < 0 == true, \"Compare long char with difference at start\");\n }\n\n function testSubstring() public pure {\n require(keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")), \"Copy 0 bytes\");\n require(keccak256(bytes(\"hello\".substring(0, 4))) == keccak256(bytes(\"hell\")), \"Copy substring\");\n require(keccak256(bytes(\"hello\".substring(1, 4))) == keccak256(bytes(\"ello\")), \"Copy substring\");\n require(keccak256(bytes(\"hello\".substring(0, 5))) == keccak256(bytes(\"hello\")), \"Copy whole string\");\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) == bytes32(0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000), \"readBytes20\");\n }\n\n function testReadBytes32() public pure {\n require(\"0123456789abcdef0123456789abcdef\".readBytes32(0) == bytes32(0x3031323334353637383961626364656630313233343536373839616263646566), \"readBytes32\");\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")), \"Decode 'a'\");\n require(\"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")), \"Decode 'aa'\");\n require(\"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")), \"Decode 'aaa'\");\n require(\"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")), \"Decode 'aaaa'\");\n require(\"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")), \"Decode 'aaaaa'\");\n require(\"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")), \"Decode 'aaaaa' lowercase\");\n require(\"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(0, 42) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")), \"Decode alphabet\");\n require(\"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(0, 42) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")), \"Decode alphabet lowercase\");\n require(\"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\".base32HexDecodeWord(0, 52) == bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"), \"Decode 32*'a'\");\n require(\" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\".base32HexDecodeWord(1, 32) == bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"), \"Decode real bytes32hex\");\n }\n}" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"./nsec3digests/NSEC3Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n *\n * TODO: Support for NSEC3 records\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_NS = 2;\n uint16 constant DNSTYPE_SOA = 6;\n uint16 constant DNSTYPE_DNAME = 39;\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_NSEC = 47;\n uint16 constant DNSTYPE_DNSKEY = 48;\n uint16 constant DNSTYPE_NSEC3 = 50;\n\n uint constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n uint8 constant ALGORITHM_RSASHA256 = 8;\n\n uint8 constant DIGEST_ALGORITHM_SHA256 = 2;\n\n struct RRSet {\n uint32 inception;\n uint32 expiration;\n bytes20 hash;\n }\n\n // (name, type) => RRSet\n mapping (bytes32 => mapping(uint16 => RRSet)) rrsets;\n\n mapping (uint8 => Algorithm) public algorithms;\n mapping (uint8 => Digest) public digests;\n mapping (uint8 => NSEC3Digest) public nsec3Digests;\n\n event Test(uint t);\n event Marker();\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n rrsets[keccak256(hex\"00\")][DNSTYPE_DS] = RRSet({\n inception: uint32(0),\n expiration: uint32(3767581600), // May 22 2089 - the latest date we can encode as of writing this\n hash: bytes20(keccak256(anchors))\n });\n emit RRSetUpdated(hex\"00\", anchors);\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Sets the contract address for an NSEC3 digest algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setNSEC3Digest(uint8 id, NSEC3Digest digest) public owner_only {\n nsec3Digests[id] = digest;\n emit NSEC3DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Submits multiple RRSets\n * @param input A list of RRSets and signatures forming a chain of trust from an existing known-good record.\n * @param _proof The DNSKEY or DS to validate the first signature against.\n * @return The last RRSET submitted.\n */\n function submitRRSets(RRSetWithSignature[] memory input, bytes calldata _proof) public override returns (bytes memory) {\n bytes memory proof = _proof;\n for(uint i = 0; i < input.length; i++) {\n proof = _submitRRSet(input[i], proof);\n }\n return proof;\n }\n\n /**\n * @dev Submits a signed set of RRs to the oracle.\n *\n * RRSETs are only accepted if they are signed with a key that is already\n * trusted, or if they are self-signed, and the signing key is identified by\n * a DS record that is already trusted.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against. Must Already\n * have been submitted and proved previously.\n */\n function submitRRSet(RRSetWithSignature memory input, bytes memory proof)\n public override\n returns (bytes memory)\n {\n return _submitRRSet(input, proof);\n }\n\n /**\n * @dev Deletes an RR from the oracle.\n *\n * @param deleteType The DNS record type to delete.\n * @param deleteName which you want to delete\n * @param nsec The signed NSEC RRset. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n */\n function deleteRRSet(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory nsec, bytes memory proof)\n public override\n {\n RRUtils.SignedSet memory rrset;\n rrset = validateSignedSet(nsec, proof);\n require(rrset.typeCovered == DNSTYPE_NSEC);\n\n // Don't let someone use an old proof to delete a new name\n require(RRUtils.serialNumberGte(rrset.inception, rrsets[keccak256(deleteName)][deleteType].inception));\n\n for (RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\n // We're dealing with three names here:\n // - deleteName is the name the user wants us to delete\n // - nsecName is the owner name of the NSEC record\n // - nextName is the next name specified in the NSEC record\n //\n // And three cases:\n // - deleteName equals nsecName, in which case we can delete the\n // record if it's not in the type bitmap.\n // - nextName comes after nsecName, in which case we can delete\n // the record if deleteName comes between nextName and nsecName.\n // - nextName comes before nsecName, in which case nextName is the\n // zone apex, and deleteName must come after nsecName.\n checkNsecName(iter, rrset.name, deleteName, deleteType);\n delete rrsets[keccak256(deleteName)][deleteType];\n return;\n }\n // We should never reach this point\n revert();\n }\n\n function checkNsecName(RRUtils.RRIterator memory iter, bytes memory nsecName, bytes memory deleteName, uint16 deleteType) private pure {\n uint rdataOffset = iter.rdataOffset;\n uint nextNameLength = iter.data.nameLength(rdataOffset);\n uint rDataLength = iter.nextOffset - iter.rdataOffset;\n\n // We assume that there is always typed bitmap after the next domain name\n require(rDataLength > nextNameLength);\n\n int compareResult = deleteName.compareNames(nsecName);\n if(compareResult == 0) {\n // Name to delete is on the same label as the NSEC record\n require(!iter.data.checkTypeBitmap(rdataOffset + nextNameLength, deleteType));\n } else {\n // First check if the NSEC next name comes after the NSEC name.\n bytes memory nextName = iter.data.substring(rdataOffset,nextNameLength);\n // deleteName must come after nsecName\n require(compareResult > 0);\n if(nsecName.compareNames(nextName) < 0) {\n // deleteName must also come before nextName\n require(deleteName.compareNames(nextName) < 0);\n }\n }\n }\n\n /**\n * @dev Deletes an RR from the oracle using an NSEC3 proof.\n * Deleting a record using NSEC3 requires using up to two NSEC3 records. There are two cases:\n * 1. The name exists, but the record type doesn't. Eg, example.com has A records but no TXT records.\n * 2. The name does not exist, but a parent name does.\n * In the first case, we submit one NSEC3 proof in `closestEncloser` that matches the target name\n * but does not have the bit for `deleteType` set in its type bitmap. In the second case, we submit\n * two proofs: closestEncloser and nextClosest, that together prove that the name does not exist.\n * NSEC3 records are in the format described in section 5.3.2 of RFC4035: The RRDATA section\n * from the RRSIG without the signature data, followed by a series of canonicalised RR records\n * that the signature applies to.\n *\n * @param deleteType The DNS record type to delete.\n * @param deleteName The name to delete.\n * @param closestEncloser An NSEC3 proof matching the closest enclosing name - that is,\n * the nearest ancestor of the target name that *does* exist.\n * @param nextClosest An NSEC3 proof covering the next closest name. This proves that the immediate\n * subdomain of the closestEncloser does not exist.\n * @param dnskey An encoded DNSKEY record that has already been submitted to the oracle and can be used\n * to verify the signatures closestEncloserSig and nextClosestSig\n */\n function deleteRRSetNSEC3(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory closestEncloser, RRSetWithSignature memory nextClosest, bytes memory dnskey)\n public override\n {\n uint32 originalInception = rrsets[keccak256(deleteName)][deleteType].inception;\n\n RRUtils.SignedSet memory ce = validateSignedSet(closestEncloser, dnskey);\n checkNSEC3Validity(ce, deleteName, originalInception);\n\n RRUtils.SignedSet memory nc;\n if(nextClosest.rrset.length > 0) {\n nc = validateSignedSet(nextClosest, dnskey);\n checkNSEC3Validity(nc, deleteName, originalInception);\n }\n\n RRUtils.NSEC3 memory ceNSEC3 = readNSEC3(ce);\n // The flags field must be 0 or 1 (RFC5155 section 8.2).\n require(ceNSEC3.flags & 0xfe == 0);\n // Check that the closest encloser is from the correct zone (RFC5155 section 8.3)\n // \"The DNAME type bit must not be set and the NS type bit may only be set if the SOA type bit is set.\"\n require(!ceNSEC3.checkTypeBitmap(DNSTYPE_DNAME) && (!ceNSEC3.checkTypeBitmap(DNSTYPE_NS) || ceNSEC3.checkTypeBitmap(DNSTYPE_SOA)));\n\n // Case 1: deleteName does exist, but no records of RRTYPE deleteType do.\n if(isMatchingNSEC3Record(deleteType, deleteName, ce.name, ceNSEC3)) {\n delete rrsets[keccak256(deleteName)][deleteType];\n // Case 2: deleteName does not exist.\n } else if(isCoveringNSEC3Record(deleteName, ce.name, ceNSEC3, nc.name, readNSEC3(nc))) {\n delete rrsets[keccak256(deleteName)][deleteType];\n } else {\n revert();\n }\n }\n\n function checkNSEC3Validity(RRUtils.SignedSet memory nsec, bytes memory deleteName, uint32 originalInception) private pure {\n // The records must have been signed after the record we're trying to delete\n require(RRUtils.serialNumberGte(nsec.inception, originalInception));\n\n // The record must be an NSEC3\n require(nsec.typeCovered == DNSTYPE_NSEC3);\n\n // nsecName is of the form .zone.xyz. is the NSEC3 hash of the entire name the NSEC3 record matches, while\n // zone.xyz can be any ancestor of that name. We'll check that, so someone can't use a record on foo.com\n // as proof of the nonexistence of bar.org.\n require(checkNSEC3OwnerName(nsec.name, deleteName));\n }\n\n function isMatchingNSEC3Record(uint16 deleteType, bytes memory deleteName, bytes memory closestEncloserName, RRUtils.NSEC3 memory closestEncloser) private view returns(bool) {\n // Check the record matches the hashed name, but the type bitmap does not include the type\n if(checkNSEC3Name(closestEncloser, closestEncloserName, deleteName)) {\n return !closestEncloser.checkTypeBitmap(deleteType);\n }\n\n return false;\n }\n\n function isCoveringNSEC3Record(bytes memory deleteName, bytes memory ceName, RRUtils.NSEC3 memory ce, bytes memory ncName, RRUtils.NSEC3 memory nc) private view returns(bool) {\n // The flags field must be 0 or 1 (RFC5155 section 8.2).\n require(nc.flags & 0xfe == 0);\n\n bytes32 ceNameHash = decodeOwnerNameHash(ceName);\n bytes32 ncNameHash = decodeOwnerNameHash(ncName);\n\n uint lastOffset = 0;\n // Iterate over suffixes of the name to delete until one matches the closest encloser\n for(uint offset = deleteName.readUint8(0) + 1; offset < deleteName.length; offset += deleteName.readUint8(offset) + 1) {\n if(hashName(ce, deleteName.substring(offset, deleteName.length - offset)) == ceNameHash) {\n // Check that the next closest record encloses the name one label longer\n bytes32 checkHash = hashName(nc, deleteName.substring(lastOffset, deleteName.length - lastOffset));\n if(ncNameHash < nc.nextHashedOwnerName) {\n return checkHash > ncNameHash && checkHash < nc.nextHashedOwnerName;\n } else {\n return checkHash > ncNameHash || checkHash < nc.nextHashedOwnerName;\n }\n }\n lastOffset = offset;\n }\n // If we reached the root without finding a match, return false.\n return false;\n }\n\n function readNSEC3(RRUtils.SignedSet memory ss) private pure returns(RRUtils.NSEC3 memory) {\n RRUtils.RRIterator memory iter = ss.rrs();\n return iter.data.readNSEC3(iter.rdataOffset, iter.nextOffset - iter.rdataOffset);\n }\n\n function checkNSEC3Name(RRUtils.NSEC3 memory nsec, bytes memory ownerName, bytes memory deleteName) private view returns(bool) {\n // Compute the NSEC3 name hash of the name to delete.\n bytes32 deleteNameHash = hashName(nsec, deleteName);\n\n // Decode the NSEC3 name hash from the first label of the NSEC3 owner name.\n bytes32 nsecNameHash = decodeOwnerNameHash(ownerName);\n\n return deleteNameHash == nsecNameHash;\n }\n\n function hashName(RRUtils.NSEC3 memory nsec, bytes memory name) private view returns(bytes32) {\n return nsec3Digests[nsec.hashAlgorithm].hash(nsec.salt, name, nsec.iterations);\n }\n\n function decodeOwnerNameHash(bytes memory name) private pure returns(bytes32) {\n return name.base32HexDecodeWord(1, uint(name.readUint8(0)));\n }\n\n function checkNSEC3OwnerName(bytes memory nsecName, bytes memory deleteName) private pure returns(bool) {\n uint nsecNameOffset = nsecName.readUint8(0) + 1;\n uint deleteNameOffset = 0;\n while(deleteNameOffset < deleteName.length) {\n if(deleteName.equals(deleteNameOffset, nsecName, nsecNameOffset)) {\n return true;\n }\n deleteNameOffset += deleteName.readUint8(deleteNameOffset) + 1;\n }\n return false;\n }\n\n /**\n * @dev Returns data about the RRs (if any) known to this oracle with the provided type and name.\n * @param dnstype The DNS record type to query.\n * @param name The name to query, in DNS label-sequence format.\n * @return inception The unix timestamp (wrapped) at which the signature for this RRSET was created.\n * @return expiration The unix timestamp (wrapped) at which the signature for this RRSET expires.\n * @return hash The hash of the RRset.\n */\n function rrdata(uint16 dnstype, bytes calldata name) external override view returns (uint32, uint32, bytes20) {\n RRSet storage result = rrsets[keccak256(name)][dnstype];\n return (result.inception, result.expiration, result.hash);\n }\n\n function _submitRRSet(RRSetWithSignature memory input, bytes memory proof) internal returns (bytes memory) {\n RRUtils.SignedSet memory rrset;\n rrset = validateSignedSet(input, proof);\n\n RRSet storage storedSet = rrsets[keccak256(rrset.name)][rrset.typeCovered];\n if (storedSet.hash != bytes20(0)) {\n // To replace an existing rrset, the signature must be at least as new\n require(RRUtils.serialNumberGte(rrset.inception, storedSet.inception));\n }\n rrsets[keccak256(rrset.name)][rrset.typeCovered] = RRSet({\n inception: rrset.inception,\n expiration: rrset.expiration,\n hash: bytes20(keccak256(rrset.data))\n });\n\n emit RRSetUpdated(rrset.name, rrset.data);\n\n return rrset.data;\n }\n\n /**\n * @dev Submits a signed set of RRs to the oracle.\n *\n * RRSETs are only accepted if they are signed with a key that is already\n * trusted, or if they are self-signed, and the signing key is identified by\n * a DS record that is already trusted.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against. Must Already\n * have been submitted and proved previously.\n */\n function validateSignedSet(RRSetWithSignature memory input, bytes memory proof) internal view returns(RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n require(validProof(rrset.signerName, proof));\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n require(name.labelCount(0) == rrset.labels);\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n require(RRUtils.serialNumberGte(rrset.expiration, uint32(block.timestamp)));\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n require(RRUtils.serialNumberGte(uint32(block.timestamp), rrset.inception));\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n function validProof(bytes memory name, bytes memory proof) internal view returns(bool) {\n uint16 dnstype = proof.readUint16(proof.nameLength(0));\n return rrsets[keccak256(name)][dnstype].hash == bytes20(keccak256(proof));\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(RRUtils.SignedSet memory rrset, uint16 typecovered) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\n // We only support class IN (Internet)\n require(iter.class == DNSCLASS_IN);\n\n if(name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n require(name.length == iter.data.nameLength(iter.offset));\n require(name.equals(0, iter.data, iter.offset, name.length));\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n require(iter.dnstype == typecovered);\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(bytes memory name, RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, bytes memory proof) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n require(rrset.signerName.length <= name.length);\n require(rrset.signerName.equals(0, name, name.length - rrset.signerName.length));\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n require(verifyWithDS(rrset, data, proofRR));\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n require(verifyWithKnownKey(rrset, data, proofRR));\n } else {\n revert(\"No valid proof found\");\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n * @return True if the RRSET could be verified, false otherwise.\n */\n function verifyWithKnownKey(RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, RRUtils.RRIterator memory proof) internal view returns(bool) {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n require(proof.name().equals(rrset.signerName));\n for(; !proof.done(); proof.next()) {\n require(proof.name().equals(rrset.signerName));\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(0, keyrdata.length);\n if(verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(RRUtils.DNSKEY memory dnskey, bytes memory keyrdata, RRUtils.SignedSet memory rrset, RRSetWithSignature memory data)\n internal\n view\n returns (bool)\n {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if(dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if(dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n return algorithms[dnskey.algorithm].verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record \n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n * @return True if the RRSET could be verified, false otherwise.\n */\n function verifyWithDS(RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, RRUtils.RRIterator memory proof) internal view returns(bool) {\n for(RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\n require(iter.dnstype == DNSTYPE_DNSKEY);\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(0, keyrdata.length);\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n return verifyKeyWithDS(iter.name(), proof, dnskey, keyrdata);\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(bytes memory keyname, RRUtils.RRIterator memory dsrrs, RRUtils.DNSKEY memory dnskey, bytes memory keyrdata)\n internal view returns (bool)\n {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n RRUtils.DS memory ds = dsrrs.data.readDS(dsrrs.rdataOffset, dsrrs.nextOffset - dsrrs.rdataOffset);\n if(ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(uint8 digesttype, bytes memory data, bytes memory digest) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev Contract mixin for 'owned' contracts.\n*/\ncontract Owned {\n address public owner;\n \n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n*/\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external virtual view returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev An interface for contracts implementing a DNSSEC digest.\n*/\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(bytes calldata data, bytes calldata hash) external virtual pure returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/nsec3digests/NSEC3Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Interface for contracts that implement NSEC3 digest algorithms.\n */\ninterface NSEC3Digest {\n /**\n * @dev Performs an NSEC3 iterated hash.\n * @param salt The salt value to use on each iteration.\n * @param data The data to hash.\n * @param iterations The number of iterations to perform.\n * @return The result of the iterated hash operation.\n */\n function hash(bytes calldata salt, bytes calldata data, uint iterations) external virtual pure returns (bytes32);\n}\n" + }, + "contracts/dnssec-oracle/nsec3digests/SHA1NSEC3Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./NSEC3Digest.sol\";\nimport \"../SHA1.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n/**\n* @dev Implements the DNSSEC iterated SHA1 digest used for NSEC3 records.\n*/\ncontract SHA1NSEC3Digest is NSEC3Digest {\n using Buffer for Buffer.buffer;\n\n function hash(bytes calldata salt, bytes calldata data, uint iterations) external override pure returns (bytes32) {\n Buffer.buffer memory buf;\n buf.init(salt.length + data.length + 16);\n\n buf.append(data);\n buf.append(salt);\n bytes20 h = SHA1.sha1(buf.buf);\n if (iterations > 0) {\n buf.truncate();\n buf.appendBytes20(bytes20(0));\n buf.append(salt);\n\n for (uint i = 0; i < iterations; i++) {\n buf.writeBytes20(0, h);\n h = SHA1.sha1(buf.buf);\n }\n }\n\n return bytes32(h);\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n* @dev Implements the DNSSEC SHA256 digest.\n*/\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(bytes calldata data, bytes calldata hash) external override pure returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n* @dev Implements the DNSSEC SHA1 digest.\n*/\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(bytes calldata data, bytes calldata hash) external override pure returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n* @dev Implements the DNSSEC RSASHA1 algorithm.\n*/\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(bytes calldata key, bytes calldata data, bytes calldata sig) external override view returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(exponentLen + 5, key.length - exponentLen - 5);\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(exponentLen + 7, key.length - exponentLen - 7);\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(bytes memory N, bytes memory E, bytes memory S) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(bytes memory base, bytes memory exponent, bytes memory modulus) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(gas(), 5, add(input, 32), mload(input), add(output, 32), mload(modulus))\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n* @dev Implements the DNSSEC RSASHA256 algorithm.\n*/\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(bytes calldata key, bytes calldata data, bytes calldata sig) external override view returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(exponentLen + 5, key.length - exponentLen - 5);\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(exponentLen + 7, key.length - exponentLen - 7);\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external override view returns (bool) {\n return validateSignature(sha256(data), parseSignature(signature), parseKey(key));\n }\n\n function parseSignature(bytes memory data) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(bytes memory data) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n\n // Set parameters for curve.\n uint constant a = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint constant b = 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint constant gx = 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint constant gy = 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint constant p = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint constant n = 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint constant lowSmax = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint u, uint m) internal pure\n returns (uint)\n {\n unchecked {\n if (u == 0 || u == m || m == 0)\n return 0;\n if (u > m)\n u = u % m;\n\n int t1;\n int t2 = 1;\n uint r1 = m;\n uint r2 = u;\n uint q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0)\n return (m - uint(-t1));\n\n return uint(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(uint x0, uint y0) internal pure\n returns (uint[3] memory P)\n {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(uint x1, uint y1, uint x2, uint y2) internal pure\n returns (uint[3] memory P)\n {\n uint x;\n uint y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(uint x0, uint y0, uint z0) internal pure\n returns (uint x1, uint y1)\n {\n uint z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj() internal pure\n returns (uint x, uint y, uint z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure\n returns (uint x, uint y)\n {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(uint x0, uint y0) internal pure\n returns (bool isZero)\n {\n if(x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint x, uint y) internal pure\n returns (bool)\n {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint LHS = mulmod(y, y, p); // y^2\n uint RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(uint x0, uint y0, uint z0) internal pure\n returns (uint x1, uint y1, uint z1)\n {\n uint t;\n uint u;\n uint v;\n uint w;\n\n if(isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p-x0, p);\n\n x0 = addmod(v, p-w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p-y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(uint x0, uint y0, uint z0, uint x1, uint y1, uint z1) internal pure\n returns (uint x2, uint y2, uint z2)\n {\n uint t0;\n uint t1;\n uint u0;\n uint u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n }\n else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n }\n else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(uint v, uint u0, uint u1, uint t1, uint t0) private pure\n returns (uint x2, uint y2, uint z2)\n {\n uint u;\n uint u2;\n uint u3;\n uint w;\n uint t;\n\n t = addmod(t0, p-t1, p);\n u = addmod(u0, p-u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p-u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p-w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p-t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(uint x0, uint y0, uint x1, uint y1) internal pure\n returns (uint, uint)\n {\n uint z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(uint x0, uint y0) internal pure\n returns (uint, uint)\n {\n uint z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(uint x0, uint y0, uint exp) internal pure\n returns (uint, uint)\n {\n uint base2X = x0;\n uint base2Y = y0;\n uint base2Z = 1;\n\n for(uint i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(uint x0, uint y0, uint scalar) internal pure\n returns (uint x1, uint y1)\n {\n if(scalar == 0) {\n return zeroAffine();\n }\n else if (scalar == 1) {\n return (x0, y0);\n }\n else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint base2X = x0;\n uint base2Y = y0;\n uint base2Z = 1;\n uint z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if(scalar%2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while(scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if(scalar%2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(uint scalar) internal pure\n returns (uint, uint)\n {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(bytes32 message, uint[2] memory rs, uint[2] memory Q) internal pure\n returns (bool)\n {\n\n // To disambiguate between public key solutions, include comment below.\n if(rs[0] == 0 || rs[0] >= n || rs[1] == 0) {// || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint x1;\n uint x2;\n uint y1;\n uint y2;\n\n uint sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n* @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n* signatures, for testing.\n*/\ncontract DummyAlgorithm is Algorithm {\n function verify(bytes calldata, bytes calldata, bytes calldata) external override view returns (bool) { return true; }\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n* @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n*/\ncontract DummyDigest is Digest {\n function verify(bytes calldata, bytes calldata) external override pure returns (bool) { return true; }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyDNSSEC.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../../registry/ENSRegistry.sol\";\nimport \"../../dnssec-oracle/DNSSEC.sol\";\n\ncontract DummyDnsRegistrarDNSSEC {\n\n struct Data {\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n }\n\n mapping (bytes32 => Data) private datas;\n\n function setData(uint16 _expectedType, bytes memory _expectedName, uint32 _inception, uint64 _inserted, bytes memory _proof) public {\n Data storage rr = datas[keccak256(abi.encodePacked(_expectedType, _expectedName))];\n rr.inception = _inception;\n rr.inserted = _inserted;\n\n if (_proof.length != 0) {\n rr.hash = bytes20(keccak256(_proof));\n } else {\n rr.hash = bytes20(0);\n }\n }\n\n function rrdata(uint16 dnstype, bytes memory name) public view returns (uint32, uint64, bytes20) {\n Data storage rr = datas[keccak256(abi.encodePacked(dnstype, name))];\n return (rr.inception, rr.inserted, rr.hash);\n }\n\n function submitRRSets(DNSSEC.RRSetWithSignature[] memory input, bytes calldata) public virtual returns (bytes memory) {\n return input[input.length - 1].rrset;\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public override view returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public override view returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public override view returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtil.sol\";\nimport \"../INameWrapper.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), CAN_DO_EVERYTHING, address(0));\n }\n\n function onERC1155Received(address operator, address from, uint256 id, uint256, bytes calldata) external override returns(bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like \n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata) external override returns(bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(bytes4 interfaceID) external override view returns (bool) {\n return interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}" + }, + "contracts/wrapper/BytesUtil.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(bytes memory self, uint offset) internal pure returns(bytes32) {\n (bytes32 labelhash, uint newOffset) = readLabel(self, offset);\n if(labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n \n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(bytes memory self, uint256 idx) internal pure returns (bytes32 labelhash, uint newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint len = uint(uint8(self[idx]));\n if(len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/BaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\n\nuint96 constant CANNOT_UNWRAP = 1;\nuint96 constant CANNOT_BURN_FUSES = 2;\nuint96 constant CANNOT_TRANSFER = 4;\nuint96 constant CANNOT_SET_RESOLVER = 8;\nuint96 constant CANNOT_SET_TTL = 16;\nuint96 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint96 constant CANNOT_REPLACE_SUBDOMAIN = 64;\nuint96 constant CAN_DO_EVERYTHING = 0;\n\ninterface INameWrapper is IERC1155 {\n enum NameSafety {\n Safe,\n RegistrantNotWrapped,\n ControllerNotWrapped,\n SubdomainReplacementAllowed,\n Expired\n }\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint96 fuses\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesBurned(bytes32 indexed node, uint96 fuses);\n\n function ens() external view returns(ENS);\n function registrar() external view returns(BaseRegistrar);\n function metadataService() external view returns(IMetadataService);\n function names(bytes32) external view returns(bytes memory);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n uint96 _fuses,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint96 _fuses,\n address resolver\n ) external;\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint96 _fuses\n ) external returns (uint256 expires);\n\n function renew(uint256 labelHash, uint256 duration)\n external\n returns (uint256 expires);\n\n function unwrap(\n bytes32 node,\n bytes32 label,\n address owner\n ) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function burnFuses(bytes32 node, uint96 _fuses) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecordAndWrap(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint96 _fuses\n ) external;\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setSubnodeOwnerAndWrap(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint96 _fuses\n ) external returns (bytes32);\n\n function isTokenOwnerOrApproved(bytes32 node, address addr)\n external\n returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function getFuses(bytes32 node)\n external\n returns (\n uint96,\n NameSafety,\n bytes32\n );\n\n function allFusesBurned(bytes32 node, uint96 fuseMask)\n external\n view\n returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n @dev Handles the receipt of a single ERC1155 token type. This function is\n called at the end of a `safeTransferFrom` after the balance has been updated.\n To accept the transfer, this must return\n `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n (i.e. 0xf23a6e61, or its own function selector).\n @param operator The address which initiated the transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param id The ID of the token being transferred\n @param value The amount of tokens being transferred\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n @dev Handles the receipt of a multiple ERC1155 token types. This function\n is called at the end of a `safeBatchTransferFrom` after the balances have\n been updated. To accept the transfer(s), this must return\n `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n (i.e. 0xbc197c81, or its own function selector).\n @param operator The address which initiated the batch transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param ids An array containing ids of each token being transferred (order and length must match values array)\n @param values An array containing amounts of each token being transferred (order and length must match ids array)\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "contracts/ethregistrar/BaseRegistrar.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\nabstract contract BaseRegistrar is Ownable, IERC721 {\n uint constant public GRACE_PERIOD = 90 days;\n\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(uint256 indexed id, address indexed owner, uint expires);\n event NameRegistered(uint256 indexed id, address indexed owner, uint expires);\n event NameRenewed(uint256 indexed id, uint expires);\n\n // The ENS registry\n ENS public ens;\n\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n\n // A map of addresses that are authorised to register and renew names.\n mapping(address=>bool) public controllers;\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) virtual external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) virtual external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) virtual external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) virtual external view returns(uint);\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) virtual public view returns(bool);\n\n /**\n * @dev Register a name.\n */\n function register(uint256 id, address owner, uint duration) virtual external returns(uint);\n\n function renew(uint256 id, uint duration) virtual external returns(uint);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) virtual external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(address operator, address from, uint256 id, uint256 value, bytes data);\n event BatchReceived(address operator, address from, uint256[] ids, uint256[] values, bytes data);\n\n constructor (\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n )\n {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n )\n external\n override\n returns(bytes4)\n {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n )\n external\n override\n returns(bytes4)\n {\n require(!_batReverts, \"ERC1155ReceiverMock: reverting on batch receive\");\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _canTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view returns (address) {\n (address owner, ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC165, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id)\n public\n view\n virtual\n override\n returns (uint256)\n {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n (address owner, ) = getData(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] memory accounts, uint256[] memory ids)\n public\n view\n virtual\n override\n returns (uint256[] memory)\n {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved)\n public\n virtual\n override\n {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator)\n public\n view\n virtual\n override\n returns (bool)\n {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(uint256 tokenId)\n public\n view\n returns (address owner, uint96 fuses)\n {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n fuses = uint96(t >> 160);\n }\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint96 fuses\n ) internal virtual {\n _tokens[tokenId] = uint256(uint160(owner)) | (uint256(fuses) << 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n (address oldOwner, uint96 fuses) = getData(id);\n require(\n _canTransfer(fuses),\n \"NameWrapper: Fuse already burned for transferring owner\"\n );\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint96 fuses) = getData(id);\n\n require(\n _canTransfer(fuses),\n \"NameWrapper: Fuse already burned for transferring owner\"\n );\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n function _canTransfer(uint96 fuses) internal virtual returns (bool);\n\n function _mint(\n bytes32 node,\n address newOwner,\n uint96 _fuses\n ) internal virtual {\n uint256 tokenId = uint256(node);\n address owner = ownerOf(tokenId);\n require(owner == address(0), \"ERC1155: mint of existing token\");\n require(newOwner != address(0), \"ERC1155: mint to the zero address\");\n require(\n newOwner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n _setData(tokenId, newOwner, _fuses);\n emit TransferSingle(msg.sender, address(0x0), newOwner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n newOwner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n address owner = ownerOf(tokenId);\n // Clear fuses and set owner to 0\n _setData(tokenId, address(0x0), 0);\n emit TransferSingle(msg.sender, owner, address(0x0), tokenId, 1);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./ERC1155Fuse.sol\";\nimport \"./Controllable.sol\";\nimport \"./INameWrapper.sol\";\nimport \"./IMetadataService.sol\";\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/BaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./BytesUtil.sol\";\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver\n{\n using BytesUtils for bytes;\n ENS public immutable override ens;\n BaseRegistrar public immutable override registrar;\n IMetadataService public override metadataService;\n mapping(bytes32 => bytes) public override names;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n constructor(\n ENS _ens,\n BaseRegistrar _registrar,\n IMetadataService _metadataService\n ) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn CANNOT_REPLACE_SUBDOMAIN and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE */\n\n _setData(\n uint256(ETH_NODE),\n address(0x0),\n uint96(CANNOT_REPLACE_SUBDOMAIN | CANNOT_UNWRAP)\n );\n _setData(\n uint256(ROOT_NODE),\n address(0x0),\n uint96(CANNOT_REPLACE_SUBDOMAIN | CANNOT_UNWRAP)\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC1155Fuse, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. only admin can do this\n */\n\n function setMetadataService(IMetadataService _newMetadataService)\n public\n onlyOwner()\n {\n metadataService = _newMetadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @return String uri of the metadata service\n */\n\n function uri(uint256 tokenId) public view override returns (string memory) {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Checks if msg.sender is the owner or approved by the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n require(\n isTokenOwnerOrApproved(node, msg.sender),\n \"NameWrapper: msg.sender is not the owner or approved\"\n );\n _;\n }\n\n /**\n * @notice Checks if owner or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or approved\n */\n\n function isTokenOwnerOrApproved(bytes32 node, address addr)\n public\n view\n override\n returns (bool)\n {\n address owner = ownerOf(uint256(node));\n return\n owner == addr ||\n isApprovedForAll(owner, addr);\n }\n\n /**\n * @notice Gets fuse permissions for a specific name\n * @dev Fuses are represented by a uint96 where each permission is represented by 1 bit\n * The interface has predefined fuses for all registry permissions, but additional\n * fuses can be added for other use cases\n * @param node namehash of the name to check\n * @return fuses A number that represents the permissions a name has\n * @return vulnerability The type of vulnerability\n * @return vulnerableNode Which node is vulnerable\n */\n function getFuses(bytes32 node)\n public\n view\n override\n returns (\n uint96 fuses,\n NameSafety vulnerability,\n bytes32 vulnerableNode\n )\n {\n bytes memory name = names[node];\n require(name.length > 0, \"NameWrapper: Name not found\");\n (, vulnerability, vulnerableNode) = _checkHierarchy(name, 0);\n (, fuses) = getData(uint256(node));\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this * contract\n * @dev Can be called by the owner of the name in the .eth registrar or an authorised caller on the * registrar\n * @param label label as a string of the .eth domain to wrap\n * @param _fuses initial fuses to set\n * @param wrappedOwner Owner of the name in this contract\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint96 _fuses,\n address resolver\n ) public override {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n registrant == msg.sender ||\n isApprovedForAll(registrant, msg.sender) ||\n registrar.isApprovedForAll(registrant, msg.sender),\n \"NameWrapper: Sender is not owner or authorised by the owner or authorised on the .eth registrar\"\n );\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n _wrapETH2LD(label, wrappedOwner, _fuses, resolver);\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @return expires The expiry date of the new name, in seconds since the Unix epoch.\n */\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint96 _fuses\n ) external override onlyController returns (uint256 expires) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n\n expires = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(label, wrappedOwner, _fuses, resolver);\n }\n\n /**\n * @dev Renews a .eth second-level domain.\n * Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name, in seconds since the Unix epoch.\n */\n function renew(uint256 tokenId, uint256 duration)\n external\n override\n onlyController\n returns (uint256 expires)\n {\n return registrar.renew(tokenId, duration);\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param _fuses initial fuses to set represented as a number. Check getFuses() for more info\n * @param wrappedOwner Owner of the name in this contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n uint96 _fuses,\n address resolver\n ) public override {\n (bytes32 labelhash, uint offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n require(\n parentNode != ETH_NODE,\n \"NameWrapper: .eth domains need to use wrapETH2LD()\"\n );\n\n address owner = ens.owner(node);\n require(\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n ens.isApprovedForAll(owner, msg.sender),\n \"NameWrapper: Domain is not owned by the sender\"\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, _fuses);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param label label as a string of the .eth domain to wrap e.g. vitalik.xyz would be 'vitalik'\n * @param newRegistrant sets the owner in the .eth registrar to this address\n * @param newController sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) public override onlyTokenOwner(_makeNode(ETH_NODE, label)) {\n _unwrap(_makeNode(ETH_NODE, label), newController);\n registrar.transferFrom(address(this), newRegistrant, uint256(label));\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode parent namehash of the name to wrap e.g. vitalik.xyz would be namehash('xyz')\n * @param label label as a string of the .eth domain to wrap e.g. vitalik.xyz would be 'vitalik'\n * @param newController sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 label,\n address newController\n ) public override onlyTokenOwner(_makeNode(parentNode, label)) {\n require(\n parentNode != ETH_NODE,\n \"NameWrapper: .eth names must be unwrapped with unwrapETH2LD()\"\n );\n _unwrap(_makeNode(parentNode, label), newController);\n }\n\n /**\n * @notice Burns any fuse passed to this function for a name\n * @dev Fuse burns are always additive and will not unburn already burnt fuses\n * @param node namehash of the name. e.g. vitalik.xyz would be namehash('vitalik.xyz')\n * @param _fuses Fuses you want to burn.\n */\n\n function burnFuses(bytes32 node, uint96 _fuses)\n public\n override\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n {\n (address owner, uint96 fuses) = getData(uint256(node));\n\n uint96 newFuses = fuses | _fuses;\n\n _setData(uint256(node), owner, newFuses);\n\n emit FusesBurned(node, newFuses);\n }\n\n /**\n * @notice Sets records for the subdomain in the ENS Registry\n * @param parentNode namehash of the parent name\n * @param label labelhash of the subnode\n * @param owner newOwner in the registry\n * @param resolver the resolver contract in the registry\n * @param ttl ttl in the registry\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n override\n onlyTokenOwner(parentNode)\n canCallSetSubnodeOwner(parentNode, label)\n {\n ens.setSubnodeRecord(parentNode, label, owner, resolver, ttl);\n }\n\n /**\n * @notice Sets the subnode owner in the registry\n * @param parentNode namehash of the parent name\n * @param label labelhash of the subnode\n * @param owner newOwner in the registry\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n bytes32 label,\n address owner\n )\n public\n override\n onlyTokenOwner(parentNode)\n canCallSetSubnodeOwner(parentNode, label)\n returns (bytes32)\n {\n return ens.setSubnodeOwner(parentNode, label, owner);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param newOwner newOwner in the registry\n * @param _fuses initial fuses for the wrapped subdomain\n */\n\n function setSubnodeOwnerAndWrap(\n bytes32 parentNode,\n string calldata label,\n address newOwner,\n uint96 _fuses\n ) public override returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n bytes memory name = _addLabel(label, names[parentNode]);\n\n setSubnodeOwner(parentNode, labelhash, address(this));\n\n _wrap(node, name, newOwner, _fuses);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param newOwner newOwner in the registry\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the regsitry\n * @param _fuses initial fuses for the wrapped subdomain\n */\n\n function setSubnodeRecordAndWrap(\n bytes32 parentNode,\n string calldata label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint96 _fuses\n ) public override {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(parentNode, labelhash);\n bytes memory name = _addLabel(label, names[parentNode]);\n\n setSubnodeRecord(parentNode, labelhash, address(this), resolver, ttl);\n\n _wrap(node, name, newOwner, _fuses);\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node namehash of the name to set a record for\n * @param owner newOwner in the registry\n * @param resolver the resolver contract\n * @param ttl ttl in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n override\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, owner, resolver, ttl);\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(bytes32 node, address resolver)\n public\n override\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_SET_RESOLVER)\n {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(bytes32 node, uint64 ttl)\n public\n override\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_SET_TTL)\n {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n modifier operationAllowed(bytes32 node, uint96 fuseMask) {\n (, uint96 fuses) = getData(uint256(node));\n require(\n fuses & fuseMask == 0,\n \"NameWrapper: Operation prohibited by fuses\"\n );\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both canCreateSubdomain and canReplaceSubdomain and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param node namehash of the name to check\n * @param label labelhash of the name to check\n */\n\n modifier canCallSetSubnodeOwner(bytes32 node, bytes32 label) {\n bytes32 subnode = _makeNode(node, label);\n address owner = ens.owner(subnode);\n (, uint96 fuses) = getData(uint256(node));\n\n require(\n (owner == address(0) && fuses & CANNOT_CREATE_SUBDOMAIN == 0) ||\n (owner != address(0) && fuses & CANNOT_REPLACE_SUBDOMAIN == 0),\n \"NameWrapper: Operation prohibited by fuses\"\n );\n _;\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node namehash of the name\n * @param fuseMask the fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(bytes32 node, uint96 fuseMask)\n public\n view\n override\n returns (bool)\n {\n (, uint96 fuses) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public override returns (bytes4) {\n //check if it's the eth registrar ERC721\n require(\n msg.sender == address(registrar),\n \"NameWrapper: Wrapper only supports .eth ERC721 token transfers\"\n );\n\n (\n string memory label,\n address owner,\n uint96 fuses,\n address resolver\n ) = abi.decode(data, (string, address, uint96, address));\n\n bytes32 labelhash = bytes32(tokenId);\n\n require(\n keccak256(bytes(label)) == labelhash,\n \"NameWrapper: Token id does match keccak(label) of label provided in data field\"\n );\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n _wrapETH2LD(label, owner, fuses, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _canTransfer(uint96 fuses) internal pure override returns (bool) {\n return fuses & CANNOT_TRANSFER == 0;\n }\n\n function _makeNode(bytes32 node, bytes32 label)\n private\n pure\n returns (bytes32)\n {\n return keccak256(abi.encodePacked(node, label));\n }\n\n function _addLabel(string memory label, bytes memory name)\n internal\n pure\n returns (bytes memory ret)\n {\n require(bytes(label).length > 0, \"NameWrapper: Label too short\");\n require(bytes(label).length < 256, \"NameWrapper: Label too long\");\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address wrappedOwner,\n uint96 _fuses\n ) internal override {\n address oldWrappedOwner = ownerOf(uint256(node));\n if (oldWrappedOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, wrappedOwner, _fuses);\n }\n\n function _wrap(bytes32 node, bytes memory name, address wrappedOwner, uint96 fuses)\n internal\n {\n names[node] = name;\n\n _mint(node, wrappedOwner, fuses);\n\n emit NameWrapped(node, name, wrappedOwner, fuses);\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint96 _fuses,\n address resolver\n ) private returns (bytes32 labelhash) {\n labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n // mint a new ERC1155 token with fuses\n _wrap(node, name, wrappedOwner, _fuses);\n }\n\n function _unwrap(bytes32 node, address newOwner) private {\n require(\n newOwner != address(0x0),\n \"NameWrapper: Target owner cannot be 0x0\"\n );\n require(\n newOwner != address(this),\n \"NameWrapper: Target owner cannot be the NameWrapper contract\"\n );\n require(\n !allFusesBurned(node, CANNOT_UNWRAP),\n \"NameWrapper: Domain is not unwrappable\"\n );\n\n // burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, newOwner);\n\n emit NameUnwrapped(node, newOwner);\n }\n\n function _setData(\n uint256 tokenId,\n address owner,\n uint96 fuses\n ) internal override {\n require(\n fuses == CAN_DO_EVERYTHING || fuses & CANNOT_UNWRAP != 0,\n \"NameWrapper: Cannot burn fuses: domain can be unwrapped\"\n );\n super._setData(tokenId, owner, fuses);\n }\n\n /**\n * @dev Internal function that checks all a name's ancestors to ensure fuse values will be respected and parent controller/registrant are set to the Wrapper\n * @param name The name to check.\n * @param offset The offset into the name to start at.\n * @return node The calculated namehash for this part of the name.\n * @return vulnerability what kind of vulnerability the node has\n * @return vulnerableNode which node is at risk\n */\n function _checkHierarchy(bytes memory name, uint256 offset)\n internal\n view\n returns (\n bytes32 node,\n NameSafety vulnerability,\n bytes32 vulnerableNode\n )\n {\n // Read the first label. If it's the root, return immediately.\n (bytes32 labelhash, uint256 newOffset) = name.readLabel(offset);\n if (labelhash == bytes32(0)) {\n // Root node\n return (bytes32(0), NameSafety.Safe, 0);\n }\n\n // Check the parent name\n bytes32 parentNode;\n (parentNode, vulnerability, vulnerableNode) = _checkHierarchy(\n name,\n newOffset\n );\n\n node = _makeNode(parentNode, labelhash);\n\n // stop function checking any other nodes if a parent is not safe\n if (vulnerability != NameSafety.Safe) {\n return (node, vulnerability, vulnerableNode);\n }\n\n // Check the parent name's fuses to see if replacing subdomains is forbidden\n if (parentNode == ROOT_NODE) {\n // Save ourselves some gas; root node can't be replaced\n return (node, NameSafety.Safe, 0);\n }\n\n (vulnerability, vulnerableNode) = _checkOwnership(\n labelhash,\n node,\n parentNode\n );\n\n if (vulnerability != NameSafety.Safe) {\n return (node, vulnerability, vulnerableNode);\n }\n\n if (!allFusesBurned(parentNode, CANNOT_REPLACE_SUBDOMAIN)) {\n return (node, NameSafety.SubdomainReplacementAllowed, parentNode);\n }\n\n return (node, NameSafety.Safe, 0);\n }\n\n function _checkOwnership(\n bytes32 labelhash,\n bytes32 node,\n bytes32 parentNode\n ) internal view returns (NameSafety vulnerability, bytes32 vulnerableNode) {\n if (parentNode == ETH_NODE) {\n // Special case .eth: Check registrant or name isexpired\n\n try registrar.ownerOf(uint256(labelhash)) returns (\n address registrarOwner\n ) {\n if (registrarOwner != address(this)) {\n return (NameSafety.RegistrantNotWrapped, node);\n }\n } catch {\n return (NameSafety.Expired, node);\n }\n }\n\n if (ens.owner(node) != address(this)) {\n return (NameSafety.ControllerNotWrapped, node);\n }\n return (NameSafety.Safe, 0);\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address=>bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) onlyOwner() public {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(controllers[msg.sender], \"Controllable: Caller is not a controller\");\n _;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "import \"../BytesUtil.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(bytes calldata name, uint offset) public pure returns(bytes32, uint) {\n return name.readLabel(offset);\n }\n\n function namehash(bytes calldata name, uint offset) public pure returns(bytes32) {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/registry/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable {\n ENS public ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n * @param resolverAddr The address of the default reverse resolver.\n */\n constructor(ENS ensAddr, NameResolver resolverAddr) {\n ens = ensAddr;\n defaultResolver = resolverAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public returns (bytes32) {\n return _claimWithResolver(msg.sender, owner, address(0x0));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(address addr, address owner)\n public\n authorised(addr)\n returns (bytes32)\n {\n return _claimWithResolver(addr, owner, address(0x0));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(address owner, address resolver)\n public\n returns (bytes32)\n {\n return _claimWithResolver(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record specified with the\n * address provided\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolverForAddr(\n address addr,\n address owner,\n address resolver\n ) public authorised(addr) returns (bytes32) {\n return _claimWithResolver(addr, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public returns (bytes32) {\n bytes32 node = _claimWithResolver(\n msg.sender,\n address(this),\n address(defaultResolver)\n );\n defaultResolver.setName(node, name);\n return node;\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. First updates the resolver to the default reverse\n * resolver if necessary.\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n string memory name\n ) public authorised(addr) returns (bytes32) {\n bytes32 node = _claimWithResolver(\n addr,\n address(this),\n address(defaultResolver)\n );\n defaultResolver.setName(node, name);\n ens.setSubnodeOwner(ADDR_REVERSE_NODE, sha3HexAddress(addr), owner);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n /* Internal functions */\n\n function _claimWithResolver(\n address addr,\n address owner,\n address resolver\n ) internal returns (bytes32) {\n bytes32 label = sha3HexAddress(addr);\n bytes32 node = keccak256(abi.encodePacked(ADDR_REVERSE_NODE, label));\n address currentResolver = ens.resolver(node);\n bool shouldUpdateResolver = (resolver != address(0x0) &&\n resolver != currentResolver);\n address newResolver = shouldUpdateResolver ? resolver : currentResolver;\n\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, label, owner, newResolver, 0);\n\n emit ReverseClaimed(addr, node);\n\n return node;\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/resolvers/DefaultReverseResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"../registry/ReverseRegistrar.sol\";\n\n/**\n * @dev Provides a default implementation of a resolver for reverse records,\n * which permits only the owner to update it.\n */\ncontract DefaultReverseResolver {\n // namehash('addr.reverse')\n bytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n ENS public ens;\n mapping (bytes32 => string) public name;\n\n /**\n * @dev Only permits calls by the reverse registrar.\n * @param node The node permission is required for.\n */\n modifier onlyOwner(bytes32 node) {\n require(msg.sender == ens.owner(node));\n _;\n }\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar registrar = ReverseRegistrar(ens.owner(ADDR_REVERSE_NODE));\n if (address(registrar) != address(0x0)) {\n registrar.claim(msg.sender);\n }\n }\n\n /**\n * @dev Sets the name for a node.\n * @param node The node to update.\n * @param _name The name to set.\n */\n function setName(bytes32 node, string memory _name) public onlyOwner(node) {\n name[node] = _name;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./PriceOracle.sol\";\nimport \"./SafeMath.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is Ownable, PriceOracle {\n using SafeMath for *;\n using StringUtils for *;\n\n // Rent in base price units by length. Element 0 is for 1-length names, and so on.\n uint[] public rentPrices;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event OracleChanged(address oracle);\n\n event RentPriceChanged(uint[] prices);\n\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 constant private ORACLE_ID = bytes4(keccak256(\"price(string,uint256,uint256)\") ^ keccak256(\"premium(string,uint256,uint256)\"));\n\n constructor(AggregatorInterface _usdOracle, uint[] memory _rentPrices) public {\n usdOracle = _usdOracle;\n setPrices(_rentPrices);\n }\n\n function price(string calldata name, uint expires, uint duration) external view override returns(uint) {\n uint len = name.strlen();\n if(len > rentPrices.length) {\n len = rentPrices.length;\n }\n require(len > 0);\n \n uint basePrice = rentPrices[len - 1].mul(duration);\n basePrice = basePrice.add(_premium(name, expires, duration));\n\n return attoUSDToWei(basePrice);\n }\n\n /**\n * @dev Sets rent prices.\n * @param _rentPrices The price array. Each element corresponds to a specific\n * name length; names longer than the length of the array\n * default to the price of the last element. Values are\n * in base price units, equal to one attodollar (1e-18\n * dollar) each.\n */\n function setPrices(uint[] memory _rentPrices) public onlyOwner {\n rentPrices = _rentPrices;\n emit RentPriceChanged(_rentPrices);\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(string calldata name, uint expires, uint duration) external view returns(uint) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(string memory name, uint expires, uint duration) virtual internal view returns(uint) {\n return 0;\n }\n\n function attoUSDToWei(uint amount) internal view returns(uint) {\n uint ethPrice = uint(usdOracle.latestAnswer());\n return amount.mul(1e8).div(ethPrice);\n }\n\n function weiToAttoUSD(uint amount) internal view returns(uint) {\n uint ethPrice = uint(usdOracle.latestAnswer());\n return amount.mul(ethPrice).div(1e8);\n }\n\n function supportsInterface(bytes4 interfaceID) public view virtual returns (bool) {\n return interfaceID == INTERFACE_META_ID || interfaceID == ORACLE_ID;\n }\n}\n" + }, + "contracts/ethregistrar/PriceOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface PriceOracle {\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return The price of this renewal or registration, in wei.\n */\n function price(string calldata name, uint expires, uint duration) external view returns(uint);\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint) {\n uint len;\n uint i = 0;\n uint bytelength = bytes(s).length;\n for(len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if(b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./PriceOracle.sol\";\nimport \"./BaseRegistrarImplementation.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../resolvers/Resolver.sol\";\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is Ownable {\n using StringUtils for *;\n\n uint constant public MIN_REGISTRATION_DURATION = 28 days;\n\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 constant private COMMITMENT_CONTROLLER_ID = bytes4(\n keccak256(\"rentPrice(string,uint256)\") ^\n keccak256(\"available(string)\") ^\n keccak256(\"makeCommitment(string,address,bytes32)\") ^\n keccak256(\"commit(bytes32)\") ^\n keccak256(\"register(string,address,uint256,bytes32)\") ^\n keccak256(\"renew(string,uint256)\")\n );\n\n bytes4 constant private COMMITMENT_WITH_CONFIG_CONTROLLER_ID = bytes4(\n keccak256(\"registerWithConfig(string,address,uint256,bytes32,address,address)\") ^\n keccak256(\"makeCommitmentWithConfig(string,address,bytes32,address,address)\")\n );\n\n BaseRegistrarImplementation base;\n PriceOracle prices;\n uint public minCommitmentAge;\n uint public maxCommitmentAge;\n\n mapping(bytes32=>uint) public commitments;\n\n event NameRegistered(string name, bytes32 indexed label, address indexed owner, uint cost, uint expires);\n event NameRenewed(string name, bytes32 indexed label, uint cost, uint expires);\n event NewPriceOracle(address indexed oracle);\n\n constructor(BaseRegistrarImplementation _base, PriceOracle _prices, uint _minCommitmentAge, uint _maxCommitmentAge) public {\n require(_maxCommitmentAge > _minCommitmentAge);\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n }\n\n function rentPrice(string memory name, uint duration) view public returns(uint) {\n bytes32 hash = keccak256(bytes(name));\n return prices.price(name, base.nameExpires(uint256(hash)), duration);\n }\n\n function valid(string memory name) public pure returns(bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view returns(bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(string memory name, address owner, bytes32 secret) pure public returns(bytes32) {\n return makeCommitmentWithConfig(name, owner, secret, address(0), address(0));\n }\n\n function makeCommitmentWithConfig(string memory name, address owner, bytes32 secret, address resolver, address addr) pure public returns(bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (resolver == address(0) && addr == address(0)) {\n return keccak256(abi.encodePacked(label, owner, secret));\n }\n require(resolver != address(0));\n return keccak256(abi.encodePacked(label, owner, resolver, addr, secret));\n }\n\n function commit(bytes32 commitment) public {\n require(commitments[commitment] + maxCommitmentAge < block.timestamp);\n commitments[commitment] = block.timestamp;\n }\n\n function register(string calldata name, address owner, uint duration, bytes32 secret) external payable {\n registerWithConfig(name, owner, duration, secret, address(0), address(0));\n }\n\n function registerWithConfig(string memory name, address owner, uint duration, bytes32 secret, address resolver, address addr) public payable {\n bytes32 commitment = makeCommitmentWithConfig(name, owner, secret, resolver, addr);\n uint cost = _consumeCommitment(name, duration, commitment);\n\n bytes32 label = keccak256(bytes(name));\n uint256 tokenId = uint256(label);\n\n uint expires;\n if(resolver != address(0)) {\n // Set this contract as the (temporary) owner, giving it\n // permission to set up the resolver.\n expires = base.register(tokenId, address(this), duration);\n\n // The nodehash of this label\n bytes32 nodehash = keccak256(abi.encodePacked(base.baseNode(), label));\n\n // Set the resolver\n base.ens().setResolver(nodehash, resolver);\n\n // Configure the resolver\n if (addr != address(0)) {\n Resolver(resolver).setAddr(nodehash, addr);\n }\n\n // Now transfer full ownership to the expeceted owner\n base.reclaim(tokenId, owner);\n base.transferFrom(address(this), owner, tokenId);\n } else {\n require(addr == address(0));\n expires = base.register(tokenId, owner, duration);\n }\n\n emit NameRegistered(name, label, owner, cost, expires);\n\n // Refund any extra payment\n if(msg.value > cost) {\n payable(msg.sender).transfer(msg.value - cost);\n }\n }\n\n function renew(string calldata name, uint duration) external payable {\n uint cost = rentPrice(name, duration);\n require(msg.value >= cost);\n\n bytes32 label = keccak256(bytes(name));\n uint expires = base.renew(uint256(label), duration);\n\n if(msg.value > cost) {\n payable(msg.sender).transfer(msg.value - cost);\n }\n\n emit NameRenewed(name, label, cost, expires);\n }\n\n function setPriceOracle(PriceOracle _prices) public onlyOwner {\n prices = _prices;\n emit NewPriceOracle(address(prices));\n }\n\n function setCommitmentAges(uint _minCommitmentAge, uint _maxCommitmentAge) public onlyOwner {\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n }\n\n function withdraw() public onlyOwner {\n payable(msg.sender).transfer(address(this).balance); \n }\n\n function supportsInterface(bytes4 interfaceID) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID ||\n interfaceID == COMMITMENT_CONTROLLER_ID ||\n interfaceID == COMMITMENT_WITH_CONFIG_CONTROLLER_ID;\n }\n\n function _consumeCommitment(string memory name, uint duration, bytes32 commitment) internal returns (uint256) {\n // Require a valid commitment\n require(commitments[commitment] + minCommitmentAge <= block.timestamp);\n\n // If the commitment is too old, or the name is registered, stop\n require(commitments[commitment] + maxCommitmentAge > block.timestamp);\n require(available(name));\n\n delete(commitments[commitment]);\n\n uint cost = rentPrice(name, duration);\n require(duration >= MIN_REGISTRATION_DURATION);\n require(msg.value >= cost);\n\n return cost;\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\n\nimport \"./BaseRegistrar.sol\";\ncontract BaseRegistrarImplementation is ERC721, BaseRegistrar {\n // A map of expiry times\n mapping(uint256=>uint) expiries;\n\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 constant private ERC721_ID = bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 constant private RECLAIM_ID = bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\",\"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(uint256 tokenId) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns(uint) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns(bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(uint256 id, address owner, uint duration) external override returns(uint) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(uint256 id, address owner, uint duration) external returns(uint) {\n return _register(id, owner, duration, false);\n }\n\n function _register(uint256 id, address owner, uint duration, bool updateRegistry) internal live onlyController returns(uint) {\n require(available(id));\n require(block.timestamp + duration + GRACE_PERIOD > block.timestamp + GRACE_PERIOD); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if(_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if(updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(uint256 id, uint duration) external override live onlyController returns(uint) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(bytes4 interfaceID) public override(ERC721, IERC165) view returns (bool) {\n return interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: balance query for the zero address\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"ERC721: owner query for nonexistent token\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n require(_exists(tokenId), \"ERC721Metadata: URI query for nonexistent token\");\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overriden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n require(_exists(tokenId), \"ERC721: approved query for nonexistent token\");\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n require(operator != _msgSender(), \"ERC721: approve to caller\");\n\n _operatorApprovals[_msgSender()][operator] = approved;\n emit ApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n _safeTransfer(from, to, tokenId, _data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `_data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, _data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n require(_exists(tokenId), \"ERC721: operator query for nonexistent token\");\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, _data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Clear approvals\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer of token that is not own\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits a {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param _data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "pragma solidity >=0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\n\ncontract BulkRenewal {\n bytes32 constant private ETH_NAMEHASH = 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes4 constant private REGISTRAR_CONTROLLER_ID = 0x018fac06;\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 constant public BULK_RENEWAL_ID = bytes4(\n keccak256(\"rentPrice(string[],uint)\") ^\n keccak256(\"renewAll(string[],uint\")\n );\n\n ENS public ens;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function getController() internal view returns(ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return ETHRegistrarController(r.interfaceImplementer(ETH_NAMEHASH, REGISTRAR_CONTROLLER_ID));\n }\n\n function rentPrice(string[] calldata names, uint duration) external view returns(uint total) {\n ETHRegistrarController controller = getController();\n for(uint i = 0; i < names.length; i++) {\n total += controller.rentPrice(names[i], duration);\n }\n }\n\n function renewAll(string[] calldata names, uint duration) external payable {\n ETHRegistrarController controller = getController();\n for(uint i = 0; i < names.length; i++) {\n uint cost = controller.rentPrice(names[i], duration);\n controller.renew{value:cost}(names[i], duration);\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(bytes4 interfaceID) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID || interfaceID == BULK_RENEWAL_ID;\n }\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint immutable GRACE_PERIOD = 90 days;\n\n uint public immutable initialPremium;\n uint public immutable premiumDecreaseRate;\n\n bytes4 constant private TIME_UNTIL_PREMIUM_ID = bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(AggregatorInterface _usdOracle, uint[] memory _rentPrices, uint _initialPremium, uint _premiumDecreaseRate) public\n StablePriceOracle(_usdOracle, _rentPrices)\n {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(string memory name, uint expires, uint /*duration*/) override internal view returns(uint) {\n expires = expires.add(GRACE_PERIOD);\n if(expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint discount = premiumDecreaseRate.mul(block.timestamp.sub(expires));\n\n // If we've run out the premium period, return 0.\n if(discount > initialPremium) {\n return 0;\n }\n \n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(uint expires, uint amount) external view returns(uint) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint discount = initialPremium.sub(amount);\n uint duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(bytes4 interfaceID) public view virtual override returns (bool) {\n return (interfaceID == TIME_UNTIL_PREMIUM_ID) || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint constant registrationPeriod = 4 weeks;\n\n ENS public ens;\n bytes32 public rootNode;\n mapping (bytes32 => uint) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(keccak256(abi.encodePacked(rootNode, label)));\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(bytes calldata name) external override view returns(bool) {\n uint labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes=>bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for(uint i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(bytes calldata name) external override view returns(bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n\n address public owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n modifier onlyOwner {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 10000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/solcInputs/9ab134ee99f7410d077d71824d3e2f84.json b/solidity/dns-contracts/deployments/goerli/solcInputs/9ab134ee99f7410d077d71824d3e2f84.json new file mode 100644 index 0000000..ba123bd --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/solcInputs/9ab134ee99f7410d077d71824d3e2f84.json @@ -0,0 +1,35 @@ +{ + "language": "Solidity", + "sources": { + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 10000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/solcInputs/a268c4117fbf03c1acd17a54ea249795.json b/solidity/dns-contracts/deployments/goerli/solcInputs/a268c4117fbf03c1acd17a54ea249795.json new file mode 100644 index 0000000..f271bb7 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/solcInputs/a268c4117fbf03c1acd17a54ea249795.json @@ -0,0 +1,101 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n return functionStaticCall(target, data, gasleft());\n }\n\n /**\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @param gasLimit The gas limit to use for the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n uint256 gasLimit\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gasLimit,\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nerror ResolverNotContract();\n\nerror ResolverError(bytes returnData);\n\nerror HttpError(HttpErrorItem[] errors);\n\nstruct HttpErrorItem {\n uint16 status;\n string message;\n}\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct MulticallChecks {\n bool isCallback;\n bool hasExtendedResolver;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\nstruct Result {\n bool success;\n bytes returnData;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (Result[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (Result[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (Result[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (Result[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n if (!resolverAddress.isContract()) {\n revert ResolverNotContract();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory reverseResolvedData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n reverseResolvedData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (Result[] memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n Result[] memory results,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n Result memory result = results[0];\n\n if (!result.success) {\n revert ResolverError(result.returnData);\n }\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(result.returnData, (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n result.returnData,\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (Result[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data,\n bool isSafe\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n if (isSafe) {\n result = LowLevelCallUtils.functionStaticCall(target, data);\n } else {\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\n }\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _checkInterface(\n address resolver,\n bytes4 interfaceId\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _checkSafetyAndItem(\n bytes memory name,\n bytes memory item,\n address resolver,\n MulticallChecks memory multicallChecks\n ) internal view returns (bool, bytes memory) {\n if (!multicallChecks.isCallback) {\n if (multicallChecks.hasExtendedResolver) {\n return (\n true,\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\n );\n }\n return (_checkInterface(resolver, bytes4(item)), item);\n }\n return (true, item);\n }\n\n function _checkMulticall(\n MulticallData memory multicallData\n ) internal view returns (MulticallChecks memory) {\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _checkInterface(\n multicallData.resolver,\n type(IExtendedResolver).interfaceId\n );\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n return MulticallChecks(isCallback, hasExtendedResolver);\n }\n\n function _checkResolveSingle(Result memory result) internal pure {\n if (!result.success) {\n if (bytes4(result.returnData) == HttpError.selector) {\n (, HttpErrorItem[] memory errors) = abi.decode(\n result.returnData,\n (bytes4, HttpErrorItem[])\n );\n revert HttpError(errors);\n }\n revert ResolverError(result.returnData);\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (Result[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new Result[](length);\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n\n if (failure) {\n results[i] = Result(false, item);\n continue;\n }\n\n bool isSafe = false;\n (isSafe, item) = _checkSafetyAndItem(\n multicallData.name,\n item,\n multicallData.resolver,\n multicallChecks\n );\n\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(\n multicallData.resolver,\n item,\n isSafe\n );\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && multicallChecks.hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = Result(success, returnData);\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/solcInputs/a5ab15037ea2d912526c4e5696fda13f.json b/solidity/dns-contracts/deployments/goerli/solcInputs/a5ab15037ea2d912526c4e5696fda13f.json new file mode 100644 index 0000000..1d0607c --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/solcInputs/a5ab15037ea2d912526c4e5696fda13f.json @@ -0,0 +1,362 @@ +{ + "language": "Solidity", + "sources": { + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(bytes memory name, bytes memory data)\n internal\n pure\n returns (address, bool)\n {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(bytes memory rdata, uint256 idx)\n internal\n pure\n returns (address, bool)\n {\n while (idx < rdata.length) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n if (len < 44) return (address(0x0), false);\n return hexToAddress(str, idx + 4);\n }\n\n function hexToAddress(bytes memory str, uint256 idx)\n internal\n pure\n returns (address, bool)\n {\n if (str.length - idx < 40) return (address(0x0), false);\n uint256 ret = 0;\n for (uint256 i = idx; i < idx + 40; i++) {\n ret <<= 4;\n uint256 x = str.readUint8(i);\n if (x >= 48 && x < 58) {\n ret |= x - 48;\n } else if (x >= 65 && x < 71) {\n ret |= x - 55;\n } else if (x >= 97 && x < 103) {\n ret |= x - 87;\n } else {\n return (address(0x0), false);\n }\n }\n return (address(uint160(ret)), true);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(RRSetWithSignature[] memory input)\n external\n view\n virtual\n returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(RRSetWithSignature[] memory input, uint256 now)\n public\n view\n virtual\n returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(bytes memory self, bytes memory other)\n internal\n pure\n returns (int256)\n {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest > 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2**(8 * (32 - shortest + idx)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length >= offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, bytes memory other)\n internal\n pure\n returns (bool)\n {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(bytes memory self, uint256 idx)\n internal\n pure\n returns (uint8 ret)\n {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(bytes memory self, uint256 idx)\n internal\n pure\n returns (uint16 ret)\n {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(bytes memory self, uint256 idx)\n internal\n pure\n returns (uint32 ret)\n {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(bytes memory self, uint256 idx)\n internal\n pure\n returns (bytes32 ret)\n {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(bytes memory self, uint256 idx)\n internal\n pure\n returns (bytes20 ret)\n {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(\n uint256 dest,\n uint256 src,\n uint256 len\n ) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256**(32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(bytes memory self, uint256 offset)\n internal\n pure\n returns (uint256)\n {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(bytes memory self, uint256 offset)\n internal\n pure\n returns (bytes memory ret)\n {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(bytes memory self, uint256 offset)\n internal\n pure\n returns (uint256)\n {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(bytes memory data)\n internal\n pure\n returns (SignedSet memory self)\n {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(SignedSet memory rrset)\n internal\n pure\n returns (RRIterator memory)\n {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(bytes memory self, uint256 offset)\n internal\n pure\n returns (RRIterator memory ret)\n {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(RRIterator memory iter)\n internal\n pure\n returns (bytes memory)\n {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function compareNames(bytes memory self, bytes memory other)\n internal\n pure\n returns (int256)\n {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(uint32 i1, uint32 i2)\n internal\n pure\n returns (bool)\n {\n return int32(i1) - int32(i2) >= 0;\n }\n\n function progress(bytes memory body, uint256 off)\n internal\n pure\n returns (uint256)\n {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\n// TODO: Record inception time of any claimed name, so old proofs can't be used to revert changes to a name.\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error StaleProof();\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewOracle(address oracle);\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n oracle = _dnssec;\n emit NewOracle(address(oracle));\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n require(\n msg.sender == owner,\n \"Only owner can call proveAndClaimWithResolver\"\n );\n if (addr != address(0)) {\n require(\n resolver != address(0),\n \"Cannot set addr if resolver is not set\"\n );\n // Set ourselves as the owner so we can set a record on the resolver\n ens.setSubnodeRecord(\n rootNode,\n labelHash,\n address(this),\n resolver,\n 0\n );\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n // Transfer the record to the owner\n ens.setOwner(node, owner);\n } else {\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n }\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n override\n returns (bool)\n {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input)\n internal\n returns (\n bytes32 parentNode,\n bytes32 labelHash,\n address addr\n )\n {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n // Parent name must be in the public suffix list.\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n require(\n suffixes.isPublicSuffix(parentName),\n \"Parent name must be a public suffix\"\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName, 0);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n (addr, ) = DNSClaimChecker.getOwnerAddress(name, data);\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain, uint256 offset)\n internal\n returns (bytes32 node)\n {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n require(\n owner == address(0) || owner == address(this),\n \"Cannot enable a name owned by someone else\"\n );\n if (owner != address(this)) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n } else {\n ens.setSubnodeOwner(parentNode, label, address(this));\n }\n }\n return node;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(bytes32 node, address owner)\n public\n virtual\n override\n authorised(node)\n {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(bytes32 node, address resolver)\n public\n virtual\n override\n authorised(node)\n {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(bytes32 node, uint64 ttl)\n public\n virtual\n override\n authorised(node)\n {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(address operator, bool approved)\n external\n virtual\n override\n {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node)\n public\n view\n virtual\n override\n returns (address)\n {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node)\n public\n view\n virtual\n override\n returns (address)\n {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(bytes32 node)\n public\n view\n virtual\n override\n returns (bool)\n {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(address owner, address operator)\n external\n view\n virtual\n override\n returns (bool)\n {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(bytes32 label, address owner)\n external\n onlyController\n {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(bytes32 => mapping(uint256 => bytes)) _addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(bytes32 node, address a)\n external\n virtual\n authorised(node)\n {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node)\n public\n view\n virtual\n override\n returns (address payable)\n {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n _addresses[node][coinType] = a;\n }\n\n function addr(bytes32 node, uint256 coinType)\n public\n view\n virtual\n override\n returns (bytes memory)\n {\n return _addresses[node][coinType];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(bytes memory b)\n internal\n pure\n returns (address payable a)\n {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(address owner, address operator)\n external\n view\n returns (bool);\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract ResolverBase is ERC165 {\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(bytes32 node, uint256 coinType)\n external\n view\n returns (bytes memory);\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(RRSetWithSignature[] memory input)\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(RRSetWithSignature[] memory input, uint256 now)\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(RRUtils.SignedSet memory rrset, uint16 typecovered)\n internal\n pure\n returns (bytes memory name)\n {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (\n rrset.signerName.length > name.length ||\n !rrset.signerName.equals(\n 0,\n name,\n name.length - rrset.signerName.length\n )\n ) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n return\n algorithms[dnskey.algorithm].verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(bytes calldata data, bytes calldata hash)\n external\n pure\n virtual\n returns (bool);\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex'00'.nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex'0361626300'.nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex'0361626300'.nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex'00'.labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex'016100'.labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(hex'016201610000'.labelCount(0) == 2, \"labelCount('b.a.') == 2\");\n require(hex'066574686c61620378797a00'.labelCount(6 +1) == 1, \"nameLength('(bthlab).xyz.') == 6\");\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes memory rrs = hex'0161000001000100000e1000047400000101620161000001000100000e100004c0a80101';\n bytes[2] memory names = [bytes(hex'016100'), bytes(hex'0162016100')];\n bytes[2] memory rdatas = [bytes(hex'74000001'), bytes(hex'c0a80101')];\n uint i = 0;\n for(RRUtils.RRIterator memory iter = rrs.iterateRRs(0); !iter.done(); iter.next()) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(keccak256(iter.name()) == keccak256(names[i]), \"Name matches\");\n require(keccak256(iter.rdata()) == keccak256(rdatas[i]), \"Rdata matches\");\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex'066274686c61620378797a00';\n bytes memory ethLabXyz = hex'066574686c61620378797a00';\n bytes memory xyz = hex'0378797a00';\n bytes memory a_b_c = hex'01610162016300';\n bytes memory b_b_c = hex'01620162016300';\n bytes memory c = hex'016300';\n bytes memory d = hex'016400';\n bytes memory a_d_c = hex'01610164016300';\n bytes memory b_a_c = hex'01620161016300';\n bytes memory ab_c_d = hex'0261620163016400';\n bytes memory a_c_d = hex'01610163016400';\n\n require(hex'0301616100'.compareNames(hex'0302616200') < 0, \"label lengths are correctly checked\");\n require(a_b_c.compareNames(c) > 0, \"one name has a difference of >1 label to with the same root name\");\n require(a_b_c.compareNames(d) < 0, \"one name has a difference of >1 label to with different root name\");\n require(a_b_c.compareNames(a_d_c) < 0, \"two names start the same but have differences in later labels\");\n require(a_b_c.compareNames(b_a_c) > 0, \"the first label sorts later, but the first label sorts earlier\");\n require(ab_c_d.compareNames(a_c_d) > 0, \"two names where the first label on one is a prefix of the first label on the other\");\n require(a_b_c.compareNames(b_b_c) < 0, \"two names where the first label on one is a prefix of the first label on the other\");\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(bthLabXyz.compareNames(ethLabXyz) < 0, \"bthLab.xyz comes before ethLab.xyz\");\n require(bthLabXyz.compareNames(bthLabXyz) == 0, \"bthLab.xyz and bthLab.xyz are the same\");\n require(ethLabXyz.compareNames(bthLabXyz) > 0, \"ethLab.xyz comes after bethLab.xyz\");\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA), \"0x11111111 >= 0xAAAAAAAA\");\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(hex'0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d'.computeKeytag() == 19036, \"Invalid keytag\");\n require(hex'010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf'.computeKeytag() == 21693, \"Invalid keytag (2)\");\n require(hex'0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3'.computeKeytag() == 33630);\n require(hex'0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5'.computeKeytag() == 20326, \"Invalid keytag (3)\");\n }\n}" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\"\".keccak(0, 0) == bytes32(0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470), \"Incorrect hash of empty string\");\n require(\"foo\".keccak(0, 3) == bytes32(0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d), \"Incorrect hash of 'foo'\");\n require(\"foo\".keccak(0, 0) == bytes32(0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470), \"Incorrect hash of empty string\");\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\"hello\".equals(1, \"ello\") == true, \"Substring to string equality\");\n require(\"hello\".equals(1, \"jello\", 1, 4) == true, \"Substring to substring equality\");\n require(\"zhello\".equals(1, \"abchello\", 3) == true, \"Compare different value with multiple length\");\n }\n\n function testComparePartial() public pure {\n require(\"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true, \"Compare same length\");\n require(\"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true, \"Compare different length\");\n require(\"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true, \"Compare same with different offset\");\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\"a\".compare(\"b\") < 0 == true, \"Compare different value with same length\");\n require(\"b\".compare(\"a\") > 0 == true, \"Compare different value with same length\");\n require(\"aa\".compare(\"ab\") < 0 == true, \"Compare different value with multiple length\");\n require(\"a\".compare(\"aa\") < 0 == true, \"Compare different value with different length\");\n require(\"aa\".compare(\"a\") > 0 == true, \"Compare different value with different length\");\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(longChar.compare(longChar) == 0 == true, \"Compares more than 32 bytes char\");\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(longChar.compare(otherLongChar) < 0 == true, \"Compare long char with difference at start\");\n }\n\n function testSubstring() public pure {\n require(keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")), \"Copy 0 bytes\");\n require(keccak256(bytes(\"hello\".substring(0, 4))) == keccak256(bytes(\"hell\")), \"Copy substring\");\n require(keccak256(bytes(\"hello\".substring(1, 4))) == keccak256(bytes(\"ello\")), \"Copy substring\");\n require(keccak256(bytes(\"hello\".substring(0, 5))) == keccak256(bytes(\"hello\")), \"Copy whole string\");\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) == bytes32(0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000), \"readBytes20\");\n }\n\n function testReadBytes32() public pure {\n require(\"0123456789abcdef0123456789abcdef\".readBytes32(0) == bytes32(0x3031323334353637383961626364656630313233343536373839616263646566), \"readBytes32\");\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")), \"Decode 'a'\");\n require(\"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")), \"Decode 'aa'\");\n require(\"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")), \"Decode 'aaa'\");\n require(\"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")), \"Decode 'aaaa'\");\n require(\"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")), \"Decode 'aaaaa'\");\n require(\"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")), \"Decode 'aaaaa' lowercase\");\n require(\"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(0, 42) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")), \"Decode alphabet\");\n require(\"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(0, 42) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")), \"Decode alphabet lowercase\");\n require(\"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\".base32HexDecodeWord(0, 52) == bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"), \"Decode 32*'a'\");\n require(\" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\".base32HexDecodeWord(1, 32) == bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"), \"Decode real bytes32hex\");\n }\n}" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(bytes calldata data, bytes calldata hash)\n external\n pure\n override\n returns (bool)\n {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(bytes calldata data, bytes calldata hash)\n external\n pure\n override\n returns (bool)\n {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(bytes memory data)\n internal\n pure\n returns (uint256[2] memory)\n {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(bytes memory data)\n internal\n pure\n returns (uint256[2] memory)\n {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(uint256 x0, uint256 y0)\n internal\n pure\n returns (uint256[3] memory P)\n {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (\n uint256 x,\n uint256 y,\n uint256 z\n )\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(uint256 x0, uint256 y0)\n internal\n pure\n returns (bool isZero)\n {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n )\n internal\n pure\n returns (\n uint256 x1,\n uint256 y1,\n uint256 z1\n )\n {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n )\n internal\n pure\n returns (\n uint256 x2,\n uint256 y2,\n uint256 z2\n )\n {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n )\n private\n pure\n returns (\n uint256 x2,\n uint256 y2,\n uint256 z2\n )\n {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(uint256 x0, uint256 y0)\n internal\n pure\n returns (uint256, uint256)\n {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(uint256 scalar)\n internal\n pure\n returns (uint256, uint256)\n {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(bytes calldata, bytes calldata)\n external\n pure\n override\n returns (bool)\n {\n return true;\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(bytes calldata name)\n external\n view\n override\n returns (bool)\n {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(bytes calldata name)\n external\n view\n override\n returns (bool)\n {\n return suffixes[name];\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (\n bytes memory key,\n bytes memory value,\n uint256 nextOffset\n )\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = input.length;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n nextOffset = terminator + 1;\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(bytes32 => bytes) private zonehashes;\n\n // Version the mapping for each zone. This allows users who have lost\n // track of their entries to effectively delete an entire zone by bumping\n // the version number.\n // node => version\n mapping(bytes32 => uint256) private versions;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(bytes32 => mapping(uint256 => mapping(bytes32 => mapping(uint16 => bytes))))\n private records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(bytes32 => mapping(uint256 => mapping(bytes32 => uint16)))\n private nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(bytes32 node, bytes calldata data)\n external\n virtual\n authorised(node)\n {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return records[node][versions[node]][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(bytes32 node, bytes32 name)\n public\n view\n virtual\n returns (bool)\n {\n return (nameEntriesCount[node][versions[node]][name] != 0);\n }\n\n /**\n * Clear all information for a DNS zone.\n * @param node the namehash of the node for which to clear the zone\n */\n function clearDNSZone(bytes32 node) public virtual authorised(node) {\n versions[node]++;\n emit DNSZoneCleared(node);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(bytes32 node, bytes calldata hash)\n external\n virtual\n authorised(node)\n {\n bytes memory oldhash = zonehashes[node];\n zonehashes[node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node)\n external\n view\n virtual\n override\n returns (bytes memory)\n {\n return zonehashes[node];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord\n ) private {\n uint256 version = versions[node];\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (records[node][version][nameHash][resource].length != 0) {\n nameEntriesCount[node][version][nameHash]--;\n }\n delete (records[node][version][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (records[node][version][nameHash][resource].length == 0) {\n nameEntriesCount[node][version][nameHash]++;\n }\n records[node][version][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n // DNSZoneCleared is emitted whenever a given node's zone information is cleared.\n event DNSZoneCleared(bytes32 indexed node);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\n\ninterface INameWrapper {\n function ownerOf(uint256 id) external view returns (address);\n}\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator)\n public\n view\n returns (bool)\n {\n return _operatorApprovals[account][operator];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return owner == msg.sender || isApprovedForAll(owner, msg.sender);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(bytes32 => mapping(uint256 => bytes)) abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n abis[node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(bytes32 node, uint256 contentTypes)\n external\n view\n virtual\n override\n returns (uint256, bytes memory)\n {\n mapping(uint256 => bytes) storage abiset = abis[node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(bytes32 => bytes) hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(bytes32 node, bytes calldata hash)\n external\n virtual\n authorised(node)\n {\n hashes[node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node)\n external\n view\n virtual\n override\n returns (bytes memory)\n {\n return hashes[node];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(bytes32 => mapping(bytes4 => address)) interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n interfaces[node][interfaceID] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(bytes32 node, bytes4 interfaceID)\n external\n view\n virtual\n override\n returns (address)\n {\n address implementer = interfaces[node][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(bytes32 => string) names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(bytes32 node, string calldata newName)\n external\n virtual\n authorised(node)\n {\n names[node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node)\n external\n view\n virtual\n override\n returns (string memory)\n {\n return names[node];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(bytes32 => PublicKey) pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n pubkeys[node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node)\n external\n view\n virtual\n override\n returns (bytes32 x, bytes32 y)\n {\n return (pubkeys[node].x, pubkeys[node].y);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(bytes32 => mapping(string => string)) texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n texts[node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(bytes32 node, string calldata key)\n external\n view\n virtual\n override\n returns (string memory)\n {\n return texts[node][key];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(bytes32 nodehash, bytes[] calldata data)\n internal\n returns (bytes[] memory results)\n {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(bytes32 nodehash, bytes[] calldata data)\n external\n returns (bytes[] memory results)\n {\n return _multicall(nodehash, data);\n }\n\n function multicall(bytes[] calldata data)\n public\n override\n returns (bytes[] memory results)\n {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(bytes32 node, uint256 contentTypes)\n external\n view\n returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(bytes32 node, bytes4 interfaceID)\n external\n view\n returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(bytes32 node, string calldata key)\n external\n view\n returns (string memory);\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(bytes[] calldata data)\n external\n returns (bytes[] memory results);\n\n function multicallWithNodeCheck(bytes32, bytes[] calldata data)\n external\n returns (bytes[] memory results);\n}\n" + }, + "test/utils/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata, /* name */\n bytes calldata data\n ) external view returns (bytes memory, address) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function resolveCallback(bytes calldata response, bytes calldata extraData)\n external\n view\n returns (bytes memory)\n {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n return abi.encode(address(this));\n }\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(bytes memory name, bytes memory data)\n external\n view\n returns (bytes memory, address);\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is IExtendedResolver, ERC165 {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n\n ENS public immutable registry;\n\n constructor(address _registry) {\n registry = ENS(_registry);\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(bytes calldata name, bytes memory data)\n external\n view\n override\n returns (bytes memory, address)\n {\n (Resolver resolver, ) = findResolver(name);\n if (address(resolver) == address(0)) {\n return (\"\", address(0));\n }\n\n try\n resolver.supportsInterface(type(IExtendedResolver).interfaceId)\n returns (bool supported) {\n if (supported) {\n return (\n callWithOffchainLookupPropagation(\n address(resolver),\n abi.encodeCall(IExtendedResolver.resolve, (name, data)),\n UniversalResolver.resolveCallback.selector\n ),\n address(resolver)\n );\n }\n } catch {}\n return (\n callWithOffchainLookupPropagation(\n address(resolver),\n data,\n UniversalResolver.resolveCallback.selector\n ),\n address(resolver)\n );\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(bytes calldata reverseName)\n external\n view\n returns (\n string memory,\n address,\n address,\n address\n )\n {\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = this.resolve(\n reverseName,\n abi.encodeCall(INameResolver.name, reverseName.namehash(0))\n );\n\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n (bytes memory resolvedData, address resolverAddress) = this.resolve(\n encodedName,\n abi.encodeCall(IAddrResolver.addr, namehash)\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @param callbackFunction The function ID of a function on this contract to use as an EIP 3668 callback.\n * This function's `extraData` argument will be passed `(address target, bytes4 innerCallback, bytes innerExtraData)`.\n * @return ret If `target` did not revert, contains the return data from the call to `target`.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data,\n bytes4 callbackFunction\n ) internal view returns (bytes memory ret) {\n bool result = LowLevelCallUtils.functionStaticCall(target, data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return LowLevelCallUtils.readReturnData(0, size);\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n if (bytes4(errorId) == OffchainLookup.selector) {\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n (\n address sender,\n string[] memory urls,\n bytes memory callData,\n bytes4 innerCallbackFunction,\n bytes memory extraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (sender == target) {\n revert OffchainLookup(\n address(this),\n urls,\n callData,\n callbackFunction,\n abi.encode(sender, innerCallbackFunction, extraData)\n );\n }\n }\n }\n\n LowLevelCallUtils.propagateRevert();\n }\n\n /**\n * @dev Callback function for `resolve`.\n * @param response Response data returned by the target address that invoked the inner `OffchainData` revert.\n * @param extraData Extra data encoded by `callWithOffchainLookupPropagation` to allow completing the request.\n */\n function resolveCallback(bytes calldata response, bytes calldata extraData)\n external\n view\n returns (bytes memory)\n {\n (\n address target,\n bytes4 innerCallbackFunction,\n bytes memory innerExtraData\n ) = abi.decode(extraData, (address, bytes4, bytes));\n return\n abi.decode(\n target.functionStaticCall(\n abi.encodeWithSelector(\n innerCallbackFunction,\n response,\n innerExtraData\n )\n ),\n (bytes)\n );\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return The Resolver responsible for this name, and the namehash of the full name.\n */\n function findResolver(bytes calldata name)\n public\n view\n returns (Resolver, bytes32)\n {\n (address resolver, bytes32 labelhash) = findResolver(name, 0);\n return (Resolver(resolver), labelhash);\n }\n\n function findResolver(bytes calldata name, uint256 offset)\n internal\n view\n returns (address, bytes32)\n {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0));\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash = keccak256(name[offset + 1:nextLabel]);\n (address parentresolver, bytes32 parentnode) = findResolver(\n name,\n nextLabel\n );\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node);\n }\n return (parentresolver, node);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(address target, bytes memory data)\n internal\n view\n returns (bool success)\n {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(uint256 offset, uint256 length)\n internal\n pure\n returns (bytes memory data)\n {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes calldata a\n ) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(bytes[] calldata data)\n external\n returns (bytes[] memory results);\n\n function multicallWithNodeCheck(bytes32 nodehash, bytes[] calldata data)\n external\n returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(string memory name)\n internal\n pure\n returns (bytes memory dnsName, bytes32 node)\n {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(bytes memory self, uint256 offset)\n internal\n pure\n returns (bytes32)\n {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(bytes memory self, uint256 idx)\n internal\n pure\n returns (bytes32 labelhash, uint256 newIdx)\n {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(bytes calldata name, uint256 offset)\n public\n pure\n returns (bytes32, uint256)\n {\n return name.readLabel(offset);\n }\n\n function namehash(bytes calldata name, uint256 offset)\n public\n pure\n returns (bytes32)\n {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n view\n override\n returns (bool)\n {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant PARENT_CANNOT_CONTROL = 64;\nuint32 constant CAN_DO_EVERYTHING = 0;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 _expiry,\n address resolver\n ) external returns (uint64 expiry);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint32 fuses,\n uint64 expiry\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration,\n uint32 fuses,\n uint64 expiry\n ) external returns (uint256 expires);\n\n function unwrap(\n bytes32 node,\n bytes32 label,\n address owner\n ) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function setFuses(bytes32 node, uint32 fuses)\n external\n returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function isTokenOwnerOrApproved(bytes32 node, address addr)\n external\n returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external returns (address owner);\n\n function allFusesBurned(bytes32 node, uint32 fuseMask)\n external\n view\n returns (bool);\n\n function isWrapped(bytes32 node) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC165, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, OperationProhibited} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror NameNotFound();\nerror IncompatibleParent();\nerror IncompatibleName(bytes name);\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable\n{\n using BytesUtils for bytes;\n ENS public immutable override ens;\n IBaseRegistrar public immutable override registrar;\n IMetadataService public override metadataService;\n mapping(bytes32 => bytes) public override names;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC1155Fuse, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 */\n\n function ownerOf(uint256 id)\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner)\n {\n return super.ownerOf(id);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(IMetadataService _metadataService)\n public\n onlyOwner\n {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(uint256 tokenId) public view override returns (string memory) {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress)\n public\n onlyOwner\n {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or approved by the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!isTokenOwnerOrApproved(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or approved\n */\n\n function isTokenOwnerOrApproved(bytes32 node, address addr)\n public\n view\n override\n returns (bool)\n {\n address owner = ownerOf(uint256(node));\n return owner == addr || isApprovedForAll(owner, addr);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param fuses Initial fuses to set\n * @param expiry When the fuses will expire\n * @param resolver Resolver contract address\n * @return Normalised expiry of when the fuses expire\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public override returns (uint64) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n return _wrapETH2LD(label, wrappedOwner, fuses, expiry, resolver);\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param fuses Initial fuses to set\n * @param expiry When the fuses will expire\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint32 fuses,\n uint64 expiry\n ) external override onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(label, wrappedOwner, fuses, expiry, resolver);\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration,\n uint32 fuses,\n uint64 expiry\n ) external override onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n expires = registrar.renew(tokenId, duration);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n expiry = _normaliseExpiry(expiry, oldExpiry, uint64(expires));\n\n _setData(node, owner, oldFuses | fuses | PARENT_CANNOT_CONTROL, expiry);\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public override {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public override onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public override onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param fuses Fuses to burn (cannot burn PARENT_CANNOT_CONTROL)\n * @return New fuses\n */\n\n function setFuses(bytes32 node, uint32 fuses)\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n _checkForParentCannotControl(node, fuses);\n\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, expiry);\n return fuses;\n }\n\n /**\n * @notice Upgrades a .eth wrapped domain by calling the wrapETH2LD function of the upgradeContract\n * and burning the token of this contract\n * @dev Can be called by the owner of the name in this contract\n * @param label Label as a string of the .eth name to upgrade\n * @param wrappedOwner The owner of the wrapped name\n */\n\n function upgradeETH2LD(\n string calldata label,\n address wrappedOwner,\n address resolver\n ) public {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n (uint32 fuses, uint64 expiry) = _prepareUpgrade(node);\n\n upgradeContract.wrapETH2LD(\n label,\n wrappedOwner,\n fuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @notice Upgrades a non .eth domain of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * Requires upgraded Namewrapper to permit old Namewrapper to call `setSubnodeRecord` for all names\n * @param parentNode Namehash of the parent name\n * @param label Label as a string of the name to upgrade\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract for this name\n */\n\n function upgrade(\n bytes32 parentNode,\n string calldata label,\n address wrappedOwner,\n address resolver\n ) public {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(parentNode, labelhash);\n (uint32 fuses, uint64 expiry) = _prepareUpgrade(node);\n upgradeContract.setSubnodeRecord(\n parentNode,\n label,\n wrappedOwner,\n resolver,\n 0,\n fuses,\n expiry\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of. Can also be called by the owner of a .eth name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the fuses will expire\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n uint64 maxExpiry;\n (, uint32 parentFuses, uint64 parentExpiry) = getData(\n uint256(parentNode)\n );\n if (parentNode == ETH_NODE) {\n if (!isTokenOwnerOrApproved(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n // max expiry is set to the expiry on the registrar\n maxExpiry = uint64(registrar.nameExpires(uint256(labelhash)));\n } else {\n if (!isTokenOwnerOrApproved(parentNode, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n // max expiry is set to the expiry of the parent\n maxExpiry = parentExpiry;\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the fuses will expire\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n )\n public\n onlyTokenOwner(parentNode)\n canCallSetSubnodeOwner(parentNode, keccak256(bytes(label)))\n returns (bytes32 node)\n {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _addLabelAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n _addLabelSetFusesAndTransfer(\n parentNode,\n node,\n label,\n owner,\n fuses,\n expiry\n );\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the regsitry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry expiry date for the domain\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n )\n public\n onlyTokenOwner(parentNode)\n canCallSetSubnodeOwner(parentNode, keccak256(bytes(label)))\n returns (bytes32 node)\n {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _addLabelAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _addLabelSetFusesAndTransfer(\n parentNode,\n node,\n label,\n owner,\n fuses,\n expiry\n );\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n override\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n (address oldOwner, , ) = getData(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(bytes32 node, address resolver)\n public\n override\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_SET_RESOLVER)\n {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(bytes32 node, uint64 ttl)\n public\n override\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_SET_TTL)\n {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param node Namehash of the name to check\n * @param labelhash Labelhash of the name to check\n */\n\n modifier canCallSetSubnodeOwner(bytes32 node, bytes32 labelhash) {\n bytes32 subnode = _makeNode(node, labelhash);\n address owner = ens.owner(subnode);\n\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n (, uint32 subnodeFuses, ) = getData(uint256(subnode));\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n\n _;\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(bytes32 node, uint32 fuseMask)\n public\n view\n override\n returns (bool)\n {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped or not\n * @dev Both of these checks need to be true to be considered wrapped if checked without this contract\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view override returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public override returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) = abi.decode(data, (string, address, uint32, uint64, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n _wrapETH2LD(label, owner, fuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _canTransfer(uint32 fuses) internal pure override returns (bool) {\n return fuses & CANNOT_TRANSFER == 0;\n }\n\n function _makeNode(bytes32 node, bytes32 labelhash)\n private\n pure\n returns (bytes32)\n {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(string memory label, bytes memory name)\n internal\n pure\n returns (bytes memory ret)\n {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n address oldOwner = ownerOf(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n names[node] = name;\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _addLabelAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _prepareUpgrade(bytes32 node)\n private\n returns (uint32 fuses, uint64 expiry)\n {\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!isTokenOwnerOrApproved(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (, fuses, expiry) = getData(uint256(node));\n\n // burn token and fuse data\n _burn(uint256(node));\n }\n\n function _addLabelSetFusesAndTransfer(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n address oldOwner = ownerOf(uint256(node));\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, fuses, expiry);\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningPCC = fuses & PARENT_CANNOT_CONTROL ==\n PARENT_CANNOT_CONTROL;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningPCC && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _getETH2LDDataAndNormaliseExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n )\n internal\n view\n returns (\n address owner,\n uint32 fuses,\n uint64\n )\n {\n uint64 oldExpiry;\n (owner, fuses, oldExpiry) = getData(uint256(node));\n uint64 maxExpiry = uint64(registrar.nameExpires(uint256(labelhash)));\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n return (owner, fuses, expiry);\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) internal pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private returns (uint64) {\n // Mint a new ERC1155 token with fuses\n // Set PARENT_CANNOT_REPLACE to reflect wrapper + registrar control over the 2LD\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n uint32 oldFuses;\n\n (, oldFuses, expiry) = _getETH2LDDataAndNormaliseExpiry(\n node,\n labelhash,\n expiry\n );\n\n _addLabelAndWrap(\n ETH_NODE,\n node,\n label,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL,\n expiry\n );\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n return expiry;\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (owner == address(0x0) || owner == address(this)) {\n revert IncorrectTargetOwner(owner);\n }\n\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses, expiry);\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n if (\n fuses & ~PARENT_CANNOT_CONTROL != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkForParentCannotControl(bytes32 node, uint32 fuses)\n internal\n view\n {\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n // Only the parent can burn the PARENT_CANNOT_CONTROL fuse.\n revert Unauthorised(node, msg.sender);\n }\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _canTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nerror OperationProhibited(bytes32 node);\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC165, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id)\n public\n view\n virtual\n override\n returns (uint256)\n {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n (address owner, , ) = getData(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] memory accounts, uint256[] memory ids)\n public\n view\n virtual\n override\n returns (uint256[] memory)\n {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved)\n public\n virtual\n override\n {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator)\n public\n view\n virtual\n override\n returns (bool)\n {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(uint256 tokenId)\n public\n view\n returns (\n address owner,\n uint32 fuses,\n uint64 expiry\n )\n {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n if (block.timestamp > expiry) {\n fuses = 0;\n } else {\n fuses = uint32(t >> 160);\n }\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiration) = getData(id);\n\n if (!_canTransfer(fuses)) {\n revert OperationProhibited(bytes32(id));\n }\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiration);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _canTransfer(uint32 fuses) internal virtual returns (bool);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses | oldFuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address owner, uint32 fuses, uint64 expiry) = getData(tokenId);\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, owner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n if (!_canTransfer(fuses)) {\n revert OperationProhibited(bytes32(id));\n }\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function setSubnodeRecord(\n bytes32 parentNode,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, _allowances[owner][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = _allowances[owner][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Spend `amount` form the allowance of `owner` toward `spender`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: balance query for the zero address\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"ERC721: owner query for nonexistent token\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n require(_exists(tokenId), \"ERC721Metadata: URI query for nonexistent token\");\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overriden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n require(_exists(tokenId), \"ERC721: approved query for nonexistent token\");\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n _safeTransfer(from, to, tokenId, _data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `_data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, _data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n require(_exists(tokenId), \"ERC721: operator query for nonexistent token\");\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, _data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Clear approvals\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits a {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits a {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param _data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"./SafeMath.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using SafeMath for *;\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n returns (bool)\n {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(uint256 expires, uint256 amount)\n external\n view\n returns (uint256)\n {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ReverseRegistrar} from \"../registry/ReverseRegistrar.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper\n ) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(string memory name, uint256 duration)\n public\n view\n override\n returns (IPriceOracle.Price memory price)\n {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint32 fuses,\n uint64 wrapperExpiry\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n resolver,\n data,\n secret,\n reverseRecord,\n fuses,\n wrapperExpiry\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint32 fuses,\n uint64 wrapperExpiry\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n fuses,\n wrapperExpiry\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n fuses,\n wrapperExpiry\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(string calldata name, uint256 duration)\n external\n payable\n override\n {\n _renew(name, duration, 0, 0);\n }\n\n function renewWithFuses(\n string calldata name,\n uint256 duration,\n uint32 fuses,\n uint64 wrapperExpiry\n ) external payable {\n bytes32 labelhash = keccak256(bytes(name));\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, labelhash));\n if (!nameWrapper.isTokenOwnerOrApproved(nodehash, msg.sender)) {\n revert Unauthorised(nodehash);\n }\n _renew(name, duration, fuses, wrapperExpiry);\n }\n\n function _renew(\n string calldata name,\n uint256 duration,\n uint32 fuses,\n uint64 wrapperExpiry\n ) internal {\n bytes32 labelhash = keccak256(bytes(name));\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, labelhash));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires;\n if (nameWrapper.isWrapped(nodehash)) {\n expires = nameWrapper.renew(\n tokenId,\n duration,\n fuses,\n wrapperExpiry\n );\n } else {\n expires = base.renew(tokenId, duration);\n }\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId)\n internal\n view\n override\n returns (bool)\n {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(uint256 tokenId)\n public\n view\n override(IERC721, ERC721)\n returns (address)\n {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(uint256 id, uint256 duration)\n external\n override\n live\n onlyController\n returns (uint256)\n {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n override(ERC721, IERC165)\n returns (bool)\n {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/registry/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(address owner, address resolver)\n public\n override\n returns (bytes32)\n {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(string memory, uint256)\n external\n returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint32,\n uint64\n ) external returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint32,\n uint64\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/registry/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(address owner, address resolver)\n external\n returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(string[] calldata names, uint256 duration)\n external\n view\n override\n returns (uint256 total)\n {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(string[] calldata names, uint256 duration)\n external\n payable\n override\n {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(string[] calldata names, uint256 duration)\n external\n view\n returns (uint256 total);\n\n function renewAll(string[] calldata names, uint256 duration)\n external\n payable;\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../INameWrapper.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\n\ncontract UpgradedNameWrapperMock {\n address public immutable oldNameWrapper;\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(\n address _oldNameWrapper,\n ENS _ens,\n IBaseRegistrar _registrar\n ) {\n oldNameWrapper = _oldNameWrapper;\n ens = _ens;\n registrar = _registrar;\n }\n\n event SetSubnodeRecord(\n bytes32 parentNode,\n string label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n );\n\n event WrapETH2LD(\n string label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n );\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n registrar.transferFrom(registrant, address(this), tokenId);\n registrar.reclaim(tokenId, address(this));\n require(\n registrant == msg.sender ||\n registrar.isApprovedForAll(registrant, msg.sender),\n \"Unauthorised\"\n );\n emit WrapETH2LD(label, wrappedOwner, fuses, expiry, resolver);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelhash));\n address owner = ens.owner(node);\n require(\n msg.sender == oldNameWrapper ||\n owner == msg.sender ||\n ens.isApprovedForAll(owner, msg.sender),\n \"Not owner/approved or previous nameWrapper controller\"\n );\n ens.setOwner(node, address(this));\n emit SetSubnodeRecord(\n parentNode,\n label,\n newOwner,\n resolver,\n ttl,\n fuses,\n expiry\n );\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(uint256 startPremium, uint256 elapsed)\n public\n pure\n returns (uint256)\n {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2**16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(uint256 fraction, uint256 premium)\n internal\n pure\n returns (uint256)\n {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "test/utils/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10**uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10**uint256(decimals()));\n }\n }\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(string memory name)\n public\n pure\n returns (bytes memory, bytes32)\n {\n return name.dnsEncodeName();\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 10000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/solcInputs/ad37cc3cd3f1925923b5003f9803ae69.json b/solidity/dns-contracts/deployments/goerli/solcInputs/ad37cc3cd3f1925923b5003f9803ae69.json new file mode 100644 index 0000000..7f5f250 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/solcInputs/ad37cc3cd3f1925923b5003f9803ae69.json @@ -0,0 +1,158 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1300 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/solcInputs/b8a92c9207ae2a5ea22df4d7303f97f4.json b/solidity/dns-contracts/deployments/goerli/solcInputs/b8a92c9207ae2a5ea22df4d7303f97f4.json new file mode 100644 index 0000000..068c6c5 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/solcInputs/b8a92c9207ae2a5ea22df4d7303f97f4.json @@ -0,0 +1,101 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n return functionStaticCall(target, data, gasleft());\n }\n\n /**\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @param gasLimit The gas limit to use for the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n uint256 gasLimit\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gasLimit,\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nerror ResolverNotContract();\n\nerror ResolverError(bytes returnData);\n\nerror HttpError(HttpErrorItem[] errors);\n\nstruct HttpErrorItem {\n uint16 status;\n string message;\n}\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct MulticallChecks {\n bool isCallback;\n bool hasExtendedResolver;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\nstruct Result {\n bool success;\n bytes returnData;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (Result[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (Result[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (Result[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (Result[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n if (!resolverAddress.isContract()) {\n revert ResolverNotContract();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory reverseResolvedData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n reverseResolvedData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (Result[] memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n Result[] memory results,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n Result memory result = results[0];\n\n if (!result.success) {\n revert ResolverError(result.returnData);\n }\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(result.returnData, (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n result.returnData,\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (Result[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data,\n bool isSafe\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n if (isSafe) {\n result = LowLevelCallUtils.functionStaticCall(target, data);\n } else {\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\n }\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _checkInterface(\n address resolver,\n bytes4 interfaceId\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _checkSafetyAndItem(\n bytes memory name,\n bytes memory item,\n address resolver,\n MulticallChecks memory multicallChecks\n ) internal view returns (bool, bytes memory) {\n if (!multicallChecks.isCallback) {\n if (multicallChecks.hasExtendedResolver) {\n return (\n true,\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\n );\n }\n return (_checkInterface(resolver, bytes4(item)), item);\n }\n return (true, item);\n }\n\n function _checkMulticall(\n MulticallData memory multicallData\n ) internal view returns (MulticallChecks memory) {\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _checkInterface(\n multicallData.resolver,\n type(IExtendedResolver).interfaceId\n );\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n return MulticallChecks(isCallback, hasExtendedResolver);\n }\n\n function _checkResolveSingle(Result memory result) internal pure {\n if (!result.success) {\n if (bytes4(result.returnData) == HttpError.selector) {\n bytes memory returnData = result.returnData;\n assembly {\n revert(add(returnData, 32), mload(returnData))\n }\n }\n revert ResolverError(result.returnData);\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (Result[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new Result[](length);\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n\n if (failure) {\n results[i] = Result(false, item);\n continue;\n }\n\n bool isSafe = false;\n (isSafe, item) = _checkSafetyAndItem(\n multicallData.name,\n item,\n multicallData.resolver,\n multicallChecks\n );\n\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(\n multicallData.resolver,\n item,\n isSafe\n );\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && multicallChecks.hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = Result(success, returnData);\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/solcInputs/df131fa07ebda91fa31150d094629ae8.json b/solidity/dns-contracts/deployments/goerli/solcInputs/df131fa07ebda91fa31150d094629ae8.json new file mode 100644 index 0000000..4c7d655 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/solcInputs/df131fa07ebda91fa31150d094629ae8.json @@ -0,0 +1,443 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC1271.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n *\n * _Available since v4.1._\n */\ninterface IERC1271 {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param hash Hash of the data to be signed\n * @param signature Signature byte array associated with _data\n */\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/SignatureChecker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\nimport \"../Address.sol\";\nimport \"../../interfaces/IERC1271.sol\";\n\n/**\n * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA\n * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like\n * Argent and Gnosis Safe.\n *\n * _Available since v4.1._\n */\nlibrary SignatureChecker {\n /**\n * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the\n * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.\n *\n * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\n * change through time. It could return true at block N and false at block N+1 (or the opposite).\n */\n function isValidSignatureNow(\n address signer,\n bytes32 hash,\n bytes memory signature\n ) internal view returns (bool) {\n (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\n if (error == ECDSA.RecoverError.NoError && recovered == signer) {\n return true;\n }\n\n (bool success, bytes memory result) = signer.staticcall(\n abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\n );\n return (success &&\n result.length == 32 &&\n abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (iter.name().compareNames(buf.buf) != 0) continue;\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(\n uint16 _expectedType,\n bytes memory _expectedName,\n uint32 _inception,\n uint64 _inserted,\n bytes memory _proof\n ) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if (_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(\n uint16 dnstype,\n bytes memory name\n ) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyExtendedDNSSECResolver is IExtendedDNSResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes memory /* name */,\n bytes memory /* data */,\n bytes memory context\n ) external view override returns (bytes memory) {\n return abi.encode(context);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyLegacyTextResolver is ITextResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(ITextResolver).interfaceId;\n }\n\n function text(\n bytes32 /* node */,\n string calldata key\n ) external view override returns (string memory) {\n return key;\n }\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver {\n using RRUtils for *;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, data)\n );\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query) = abi.decode(\n extraData,\n (bytes, bytes)\n );\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n IExtendedDNSResolver(dnsresolver).resolve(\n name,\n query,\n context\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return IExtendedResolver(dnsresolver).resolve(name, query);\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (bytes memory key, bytes memory value, uint256 nextOffset)\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = input.length;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n nextOffset = terminator + 1;\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256[3] memory P) {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (uint256 x, uint256 y, uint256 z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(\n uint256 x0,\n uint256 y0\n ) internal pure returns (bool isZero) {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(\n uint256 scalar\n ) internal pure returns (uint256, uint256) {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(\n bytes calldata,\n bytes calldata\n ) external pure override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input\n )\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n )\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(\n RRUtils.SignedSet memory rrset,\n uint16 typecovered\n ) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if (address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns (bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 {\n totallen := add(totallen, 64)\n }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for {\n let i := 0\n } lt(i, totallen) {\n i := add(i, 64)\n } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 {\n mstore8(add(scratch, sub(len, i)), 0x80)\n }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 {\n mstore(\n add(scratch, 32),\n or(mload(add(scratch, 32)), mul(len, 8))\n )\n }\n\n // Expand the 16 32-bit words into 80\n for {\n let j := 64\n } lt(j, 128) {\n j := add(j, 12)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 12))),\n mload(add(scratch, sub(j, 32)))\n ),\n xor(\n mload(add(scratch, sub(j, 56))),\n mload(add(scratch, sub(j, 64)))\n )\n )\n temp := or(\n and(\n mul(temp, 2),\n 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE\n ),\n and(\n div(temp, 0x80000000),\n 0x0000000100000001000000010000000100000001000000010000000100000001\n )\n )\n mstore(add(scratch, j), temp)\n }\n for {\n let j := 128\n } lt(j, 320) {\n j := add(j, 24)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 24))),\n mload(add(scratch, sub(j, 64)))\n ),\n xor(\n mload(add(scratch, sub(j, 112))),\n mload(add(scratch, sub(j, 128)))\n )\n )\n temp := or(\n and(\n mul(temp, 4),\n 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC\n ),\n and(\n div(temp, 0x40000000),\n 0x0000000300000003000000030000000300000003000000030000000300000003\n )\n )\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for {\n let j := 0\n } lt(j, 80) {\n j := add(j, 1)\n } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(\n div(x, 0x100000000000000000000),\n div(x, 0x10000000000)\n )\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := and(div(x, 0x10000000000), f)\n f := or(\n and(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n ),\n f\n )\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(\n div(\n x,\n 0x80000000000000000000000000000000000000000000000\n ),\n 0x1F\n )\n temp := or(\n and(\n div(x, 0x800000000000000000000000000000000000000),\n 0xFFFFFFE0\n ),\n temp\n )\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(\n div(\n mload(add(scratch, mul(j, 4))),\n 0x100000000000000000000000000000000000000000000000000000000\n ),\n temp\n )\n x := or(\n div(x, 0x10000000000),\n mul(temp, 0x10000000000000000000000000000000000000000)\n )\n x := or(\n and(\n x,\n 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF\n ),\n mul(\n or(\n and(div(x, 0x4000000000000), 0xC0000000),\n and(div(x, 0x400000000000000000000), 0x3FFFFFFF)\n ),\n 0x100000000000000000000\n )\n )\n }\n\n h := and(\n add(h, x),\n 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF\n )\n }\n ret := mul(\n or(\n or(\n or(\n or(\n and(\n div(h, 0x100000000),\n 0xFFFFFFFF00000000000000000000000000000000\n ),\n and(\n div(h, 0x1000000),\n 0xFFFFFFFF000000000000000000000000\n )\n ),\n and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)\n ),\n and(div(h, 0x100), 0xFFFFFFFF00000000)\n ),\n and(h, 0xFFFFFFFF)\n ),\n 0x1000000000000000000000000\n )\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, price.base, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/ILinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface ILinearPremiumPriceOracle {\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256);\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns (address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping(bytes32 => address) addresses;\n\n constructor() public {}\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Implements a dummy NameWrapper which returns the caller's address\n */\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ReverseClaimer\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimForAddrWithSignature(\n address addr,\n address owner,\n address resolver,\n address relayer,\n uint256 signatureExpiry,\n bytes calldata signature\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function setNameForAddrWithSignature(\n address addr,\n address owner,\n address resolver,\n address relayer,\n uint256 signatureExpiry,\n bytes calldata signature,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\nerror InvalidSignature();\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n using ECDSA for bytes32;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddrWithSignature(\n address addr,\n address owner,\n address resolver,\n address relayer,\n uint256 signatureExpiry,\n bytes memory signature\n ) public override returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n\n bytes32 hash = keccak256(\n abi.encodePacked(\n IReverseRegistrar.claimForAddrWithSignature.selector,\n addr,\n owner,\n resolver,\n relayer,\n signatureExpiry\n )\n );\n\n bytes32 message = hash.toEthSignedMessageHash();\n\n if (\n !SignatureChecker.isValidSignatureNow(addr, message, signature) ||\n relayer != msg.sender ||\n signatureExpiry < block.timestamp ||\n signatureExpiry > block.timestamp + 1 days\n ) {\n revert InvalidSignature();\n }\n\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddrWithSignature(\n address addr,\n address owner,\n address resolver,\n address relayer,\n uint256 signatureExpiry,\n bytes memory signature,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddrWithSignature(\n addr,\n owner,\n resolver,\n relayer,\n signatureExpiry,\n signature\n );\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/utils/DummyRevertResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ncontract DummyRevertResolver {\n function resolve(\n bytes calldata,\n bytes calldata\n ) external pure returns (bytes memory) {\n revert(\"Not Supported\");\n }\n\n function supportsInterface(bytes4) external pure returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/TestHexUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {HexUtils} from \"./HexUtils.sol\";\n\ncontract TestHexUtils {\n using HexUtils for *;\n\n function hexStringToBytes32(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes32, bool) {\n return name.hexStringToBytes32(idx, lastInx);\n }\n\n function hexToAddress(\n bytes calldata input,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (address, bool) {\n return input.hexToAddress(idx, lastInx);\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(\n string memory name\n ) public pure returns (bytes memory, bytes32) {\n return name.dnsEncodeName();\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (bytes[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes[] memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (bytes[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n result = LowLevelCallUtils.functionStaticCall(address(target), data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _hasExtendedResolver(\n address resolver\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(\n type(IExtendedResolver).interfaceId\n )\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (bytes[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _hasExtendedResolver(multicallData.resolver);\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = item;\n continue;\n }\n if (!isCallback && hasExtendedResolver) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = returnData;\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(\n name,\n wrappedOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable,\n ReverseClaimer\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE and set expiry to max */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the owner of a name\n * @param id Namehash of the name\n * @return operator Approved operator of a name\n */\n\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /**\n * @notice Approves an address for a name\n * @param to address to approve\n * @param tokenId name to approve\n */\n\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or operator of the owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or operator\n */\n\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Checks if owner/operator or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner/operator or approved\n */\n\n function canExtendSubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public returns (uint64 expiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // Set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (!_isWrapped(node)) {\n revert NameIsNotWrapped();\n }\n\n // this flag is used later, when checking fuses\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // Max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n address approved = getApproved(uint256(node));\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(parentNode, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /**\n * @notice Checks if a name is wrapped in a more gas efficient way\n * @param parentNode Namehash of the name\n * @param labelhash Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != ETH_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + }, + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {IMetadataService} from \"./IMetadataService.sol\";\n\ncontract StaticMetadataService is IMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external view override returns (bool) {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32, uint256) {\n return name.readLabel(offset);\n }\n\n function namehash(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32) {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\n \"\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n require(\n \"foo\".keccak(0, 3) ==\n bytes32(\n 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d\n ),\n \"Incorrect hash of 'foo'\"\n );\n require(\n \"foo\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\n \"hello\".equals(1, \"ello\") == true,\n \"Substring to string equality\"\n );\n require(\n \"hello\".equals(1, \"jello\", 1, 4) == true,\n \"Substring to substring equality\"\n );\n require(\n \"zhello\".equals(1, \"abchello\", 3) == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"0x0102030000\".equals(0, \"0x010203\") == false,\n \"Compare with offset and trailing bytes\"\n );\n }\n\n function testComparePartial() public pure {\n require(\n \"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true,\n \"Compare same length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true,\n \"Compare different length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true,\n \"Compare same with different offset\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 33\n ) ==\n 0 ==\n true,\n \"Compare different long strings same length smaller partial length which must be equal\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 34\n ) <\n 0 ==\n true,\n \"Compare long strings same length different partial length\"\n );\n require(\n \"0123456789012345012345678901234a\".compare(\n 0,\n 32,\n \"0123456789012345012345678901234b\",\n 0,\n 32\n ) <\n 0 ==\n true,\n \"Compare strings exactly 32 characters long\"\n );\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\n \"a\".compare(\"b\") < 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"b\".compare(\"a\") > 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"aa\".compare(\"ab\") < 0 == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"a\".compare(\"aa\") < 0 == true,\n \"Compare different value with different length\"\n );\n require(\n \"aa\".compare(\"a\") > 0 == true,\n \"Compare different value with different length\"\n );\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(\n longChar.compare(longChar) == 0 == true,\n \"Compares more than 32 bytes char\"\n );\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(\n longChar.compare(otherLongChar) < 0 == true,\n \"Compare long char with difference at start\"\n );\n }\n\n function testSubstring() public pure {\n require(\n keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")),\n \"Copy 0 bytes\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 4))) ==\n keccak256(bytes(\"hell\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(1, 4))) ==\n keccak256(bytes(\"ello\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 5))) ==\n keccak256(bytes(\"hello\")),\n \"Copy whole string\"\n );\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(\n bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) ==\n bytes32(\n 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000\n ),\n \"readBytes20\"\n );\n }\n\n function testReadBytes32() public pure {\n require(\n \"0123456789abcdef0123456789abcdef\".readBytes32(0) ==\n bytes32(\n 0x3031323334353637383961626364656630313233343536373839616263646566\n ),\n \"readBytes32\"\n );\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\n \"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")),\n \"Decode 'a'\"\n );\n require(\n \"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")),\n \"Decode 'aa'\"\n );\n require(\n \"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")),\n \"Decode 'aaa'\"\n );\n require(\n \"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")),\n \"Decode 'aaaa'\"\n );\n require(\n \"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa'\"\n );\n require(\n \"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa' lowercase\"\n );\n require(\n \"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet\"\n );\n require(\n \"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet lowercase\"\n );\n require(\n \"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\"\n .base32HexDecodeWord(0, 52) ==\n bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"),\n \"Decode 32*'a'\"\n );\n require(\n \" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\"\n .base32HexDecodeWord(1, 32) ==\n bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"),\n \"Decode real bytes32hex\"\n );\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex\"00\".nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex\"00\".labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex\"016100\".labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(\n hex\"016201610000\".labelCount(0) == 2,\n \"labelCount('b.a.') == 2\"\n );\n require(\n hex\"066574686c61620378797a00\".labelCount(6 + 1) == 1,\n \"nameLength('(bthlab).xyz.') == 6\"\n );\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes\n memory rrs = hex\"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101\";\n bytes[2] memory names = [bytes(hex\"016100\"), bytes(hex\"0162016100\")];\n bytes[2] memory rdatas = [bytes(hex\"74000001\"), bytes(hex\"c0a80101\")];\n uint i = 0;\n for (\n RRUtils.RRIterator memory iter = rrs.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(\n keccak256(iter.name()) == keccak256(names[i]),\n \"Name matches\"\n );\n require(\n keccak256(iter.rdata()) == keccak256(rdatas[i]),\n \"Rdata matches\"\n );\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex\"066274686c61620378797a00\";\n bytes memory ethLabXyz = hex\"066574686c61620378797a00\";\n bytes memory xyz = hex\"0378797a00\";\n bytes memory a_b_c = hex\"01610162016300\";\n bytes memory b_b_c = hex\"01620162016300\";\n bytes memory c = hex\"016300\";\n bytes memory d = hex\"016400\";\n bytes memory a_d_c = hex\"01610164016300\";\n bytes memory b_a_c = hex\"01620161016300\";\n bytes memory ab_c_d = hex\"0261620163016400\";\n bytes memory a_c_d = hex\"01610163016400\";\n bytes\n memory verylong1_eth = hex\"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n bytes\n memory verylong2_eth = hex\"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n\n require(\n hex\"0301616100\".compareNames(hex\"0302616200\") < 0,\n \"label lengths are correctly checked\"\n );\n require(\n a_b_c.compareNames(c) > 0,\n \"one name has a difference of >1 label to with the same root name\"\n );\n require(\n a_b_c.compareNames(d) < 0,\n \"one name has a difference of >1 label to with different root name\"\n );\n require(\n a_b_c.compareNames(a_d_c) < 0,\n \"two names start the same but have differences in later labels\"\n );\n require(\n a_b_c.compareNames(b_a_c) > 0,\n \"the first label sorts later, but the first label sorts earlier\"\n );\n require(\n ab_c_d.compareNames(a_c_d) > 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(\n a_b_c.compareNames(b_b_c) < 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(\n bthLabXyz.compareNames(ethLabXyz) < 0,\n \"bthLab.xyz comes before ethLab.xyz\"\n );\n require(\n bthLabXyz.compareNames(bthLabXyz) == 0,\n \"bthLab.xyz and bthLab.xyz are the same\"\n );\n require(\n ethLabXyz.compareNames(bthLabXyz) > 0,\n \"ethLab.xyz comes after bethLab.xyz\"\n );\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(\n verylong1_eth.compareNames(verylong2_eth) > 0,\n \"longa.vlong.eth comes after long.vlong.eth\"\n );\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(\n RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA),\n \"0x11111111 >= 0xAAAAAAAA\"\n );\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(\n hex\"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d\"\n .computeKeytag() == 19036,\n \"Invalid keytag\"\n );\n require(\n hex\"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf\"\n .computeKeytag() == 21693,\n \"Invalid keytag (2)\"\n );\n require(\n hex\"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3\"\n .computeKeytag() == 33630\n );\n require(\n hex\"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5\"\n .computeKeytag() == 20326,\n \"Invalid keytag (3)\"\n );\n }\n}\n" + }, + "test/registry/mocks/DummyResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyResolver {\n mapping(bytes32 => string) public name;\n\n function setName(bytes32 node, string memory _name) public {\n name[node] = _name;\n }\n}\n" + }, + "test/reverseRegistrar/mocks/MockReverseClaimerImplementer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../../../contracts/registry/ENS.sol\";\nimport {ReverseClaimer} from \"../../../contracts/reverseRegistrar/ReverseClaimer.sol\";\n\ncontract MockReverseClaimerImplementer is ReverseClaimer {\n constructor(ENS ens, address claimant) ReverseClaimer(ens, claimant) {}\n}\n" + }, + "test/utils/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n if (bytes4(extraData) == bytes4(keccak256(\"name(bytes32)\"))) {\n return abi.encode(\"offchain.test.eth\");\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "test/utils/mocks/LegacyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\ncontract LegacyResolver {\n function addr(bytes32 /* node */) public view returns (address) {\n return address(this);\n }\n}\n" + }, + "test/utils/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10 ** uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10 ** uint256(decimals()));\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1300 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/solcInputs/e0f6f00faee6ee60a1220d91a962cdaa.json b/solidity/dns-contracts/deployments/goerli/solcInputs/e0f6f00faee6ee60a1220d91a962cdaa.json new file mode 100644 index 0000000..4f86e27 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/solcInputs/e0f6f00faee6ee60a1220d91a962cdaa.json @@ -0,0 +1,365 @@ +{ + "language": "Solidity", + "sources": { + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(bytes memory name, bytes memory data)\n internal\n pure\n returns (address, bool)\n {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(bytes memory rdata, uint256 idx)\n internal\n pure\n returns (address, bool)\n {\n while (idx < rdata.length) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n if (len < 44) return (address(0x0), false);\n return hexToAddress(str, idx + 4);\n }\n\n function hexToAddress(bytes memory str, uint256 idx)\n internal\n pure\n returns (address, bool)\n {\n if (str.length - idx < 40) return (address(0x0), false);\n uint256 ret = 0;\n for (uint256 i = idx; i < idx + 40; i++) {\n ret <<= 4;\n uint256 x = str.readUint8(i);\n if (x >= 48 && x < 58) {\n ret |= x - 48;\n } else if (x >= 65 && x < 71) {\n ret |= x - 55;\n } else if (x >= 97 && x < 103) {\n ret |= x - 87;\n } else {\n return (address(0x0), false);\n }\n }\n return (address(uint160(ret)), true);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(RRSetWithSignature[] memory input)\n external\n view\n virtual\n returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(RRSetWithSignature[] memory input, uint256 now)\n public\n view\n virtual\n returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(bytes memory self, bytes memory other)\n internal\n pure\n returns (int256)\n {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest > 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2**(8 * (32 - shortest + idx)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length >= offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, bytes memory other)\n internal\n pure\n returns (bool)\n {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(bytes memory self, uint256 idx)\n internal\n pure\n returns (uint8 ret)\n {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(bytes memory self, uint256 idx)\n internal\n pure\n returns (uint16 ret)\n {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(bytes memory self, uint256 idx)\n internal\n pure\n returns (uint32 ret)\n {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(bytes memory self, uint256 idx)\n internal\n pure\n returns (bytes32 ret)\n {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(bytes memory self, uint256 idx)\n internal\n pure\n returns (bytes20 ret)\n {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(\n uint256 dest,\n uint256 src,\n uint256 len\n ) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256**(32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(bytes memory self, uint256 offset)\n internal\n pure\n returns (uint256)\n {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(bytes memory self, uint256 offset)\n internal\n pure\n returns (bytes memory ret)\n {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(bytes memory self, uint256 offset)\n internal\n pure\n returns (uint256)\n {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(bytes memory data)\n internal\n pure\n returns (SignedSet memory self)\n {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(SignedSet memory rrset)\n internal\n pure\n returns (RRIterator memory)\n {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(bytes memory self, uint256 offset)\n internal\n pure\n returns (RRIterator memory ret)\n {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(RRIterator memory iter)\n internal\n pure\n returns (bytes memory)\n {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function compareNames(bytes memory self, bytes memory other)\n internal\n pure\n returns (int256)\n {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(uint32 i1, uint32 i2)\n internal\n pure\n returns (bool)\n {\n return int32(i1) - int32(i2) >= 0;\n }\n\n function progress(bytes memory body, uint256 off)\n internal\n pure\n returns (uint256)\n {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\n// TODO: Record inception time of any claimed name, so old proofs can't be used to revert changes to a name.\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error StaleProof();\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewOracle(address oracle);\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n oracle = _dnssec;\n emit NewOracle(address(oracle));\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n require(\n msg.sender == owner,\n \"Only owner can call proveAndClaimWithResolver\"\n );\n if (addr != address(0)) {\n require(\n resolver != address(0),\n \"Cannot set addr if resolver is not set\"\n );\n // Set ourselves as the owner so we can set a record on the resolver\n ens.setSubnodeRecord(\n rootNode,\n labelHash,\n address(this),\n resolver,\n 0\n );\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n // Transfer the record to the owner\n ens.setOwner(node, owner);\n } else {\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n }\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n override\n returns (bool)\n {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input)\n internal\n returns (\n bytes32 parentNode,\n bytes32 labelHash,\n address addr\n )\n {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n // Parent name must be in the public suffix list.\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n require(\n suffixes.isPublicSuffix(parentName),\n \"Parent name must be a public suffix\"\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName, 0);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n (addr, ) = DNSClaimChecker.getOwnerAddress(name, data);\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain, uint256 offset)\n internal\n returns (bytes32 node)\n {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n require(\n owner == address(0) || owner == address(this),\n \"Cannot enable a name owned by someone else\"\n );\n if (owner != address(this)) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n } else {\n ens.setSubnodeOwner(parentNode, label, address(this));\n }\n }\n return node;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(bytes32 node, address owner)\n public\n virtual\n override\n authorised(node)\n {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(bytes32 node, address resolver)\n public\n virtual\n override\n authorised(node)\n {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(bytes32 node, uint64 ttl)\n public\n virtual\n override\n authorised(node)\n {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(address operator, bool approved)\n external\n virtual\n override\n {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node)\n public\n view\n virtual\n override\n returns (address)\n {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node)\n public\n view\n virtual\n override\n returns (address)\n {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(bytes32 node)\n public\n view\n virtual\n override\n returns (bool)\n {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(address owner, address operator)\n external\n view\n virtual\n override\n returns (bool)\n {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(bytes32 label, address owner)\n external\n onlyController\n {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(bytes32 node, address a)\n external\n virtual\n authorised(node)\n {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node)\n public\n view\n virtual\n override\n returns (address payable)\n {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(bytes32 node, uint256 coinType)\n public\n view\n virtual\n override\n returns (bytes memory)\n {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(bytes memory b)\n internal\n pure\n returns (address payable a)\n {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(address owner, address operator)\n external\n view\n returns (bool);\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(bytes32 node, uint256 coinType)\n external\n view\n returns (bytes memory);\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(RRSetWithSignature[] memory input)\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(RRSetWithSignature[] memory input, uint256 now)\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(RRUtils.SignedSet memory rrset, uint16 typecovered)\n internal\n pure\n returns (bytes memory name)\n {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (\n rrset.signerName.length > name.length ||\n !rrset.signerName.equals(\n 0,\n name,\n name.length - rrset.signerName.length\n )\n ) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n return\n algorithms[dnskey.algorithm].verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(bytes calldata data, bytes calldata hash)\n external\n pure\n virtual\n returns (bool);\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex'00'.nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex'0361626300'.nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex'0361626300'.nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex'00'.labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex'016100'.labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(hex'016201610000'.labelCount(0) == 2, \"labelCount('b.a.') == 2\");\n require(hex'066574686c61620378797a00'.labelCount(6 +1) == 1, \"nameLength('(bthlab).xyz.') == 6\");\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes memory rrs = hex'0161000001000100000e1000047400000101620161000001000100000e100004c0a80101';\n bytes[2] memory names = [bytes(hex'016100'), bytes(hex'0162016100')];\n bytes[2] memory rdatas = [bytes(hex'74000001'), bytes(hex'c0a80101')];\n uint i = 0;\n for(RRUtils.RRIterator memory iter = rrs.iterateRRs(0); !iter.done(); iter.next()) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(keccak256(iter.name()) == keccak256(names[i]), \"Name matches\");\n require(keccak256(iter.rdata()) == keccak256(rdatas[i]), \"Rdata matches\");\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex'066274686c61620378797a00';\n bytes memory ethLabXyz = hex'066574686c61620378797a00';\n bytes memory xyz = hex'0378797a00';\n bytes memory a_b_c = hex'01610162016300';\n bytes memory b_b_c = hex'01620162016300';\n bytes memory c = hex'016300';\n bytes memory d = hex'016400';\n bytes memory a_d_c = hex'01610164016300';\n bytes memory b_a_c = hex'01620161016300';\n bytes memory ab_c_d = hex'0261620163016400';\n bytes memory a_c_d = hex'01610163016400';\n\n require(hex'0301616100'.compareNames(hex'0302616200') < 0, \"label lengths are correctly checked\");\n require(a_b_c.compareNames(c) > 0, \"one name has a difference of >1 label to with the same root name\");\n require(a_b_c.compareNames(d) < 0, \"one name has a difference of >1 label to with different root name\");\n require(a_b_c.compareNames(a_d_c) < 0, \"two names start the same but have differences in later labels\");\n require(a_b_c.compareNames(b_a_c) > 0, \"the first label sorts later, but the first label sorts earlier\");\n require(ab_c_d.compareNames(a_c_d) > 0, \"two names where the first label on one is a prefix of the first label on the other\");\n require(a_b_c.compareNames(b_b_c) < 0, \"two names where the first label on one is a prefix of the first label on the other\");\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(bthLabXyz.compareNames(ethLabXyz) < 0, \"bthLab.xyz comes before ethLab.xyz\");\n require(bthLabXyz.compareNames(bthLabXyz) == 0, \"bthLab.xyz and bthLab.xyz are the same\");\n require(ethLabXyz.compareNames(bthLabXyz) > 0, \"ethLab.xyz comes after bethLab.xyz\");\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA), \"0x11111111 >= 0xAAAAAAAA\");\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(hex'0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d'.computeKeytag() == 19036, \"Invalid keytag\");\n require(hex'010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf'.computeKeytag() == 21693, \"Invalid keytag (2)\");\n require(hex'0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3'.computeKeytag() == 33630);\n require(hex'0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5'.computeKeytag() == 20326, \"Invalid keytag (3)\");\n }\n}" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\"\".keccak(0, 0) == bytes32(0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470), \"Incorrect hash of empty string\");\n require(\"foo\".keccak(0, 3) == bytes32(0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d), \"Incorrect hash of 'foo'\");\n require(\"foo\".keccak(0, 0) == bytes32(0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470), \"Incorrect hash of empty string\");\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\"hello\".equals(1, \"ello\") == true, \"Substring to string equality\");\n require(\"hello\".equals(1, \"jello\", 1, 4) == true, \"Substring to substring equality\");\n require(\"zhello\".equals(1, \"abchello\", 3) == true, \"Compare different value with multiple length\");\n }\n\n function testComparePartial() public pure {\n require(\"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true, \"Compare same length\");\n require(\"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true, \"Compare different length\");\n require(\"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true, \"Compare same with different offset\");\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\"a\".compare(\"b\") < 0 == true, \"Compare different value with same length\");\n require(\"b\".compare(\"a\") > 0 == true, \"Compare different value with same length\");\n require(\"aa\".compare(\"ab\") < 0 == true, \"Compare different value with multiple length\");\n require(\"a\".compare(\"aa\") < 0 == true, \"Compare different value with different length\");\n require(\"aa\".compare(\"a\") > 0 == true, \"Compare different value with different length\");\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(longChar.compare(longChar) == 0 == true, \"Compares more than 32 bytes char\");\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(longChar.compare(otherLongChar) < 0 == true, \"Compare long char with difference at start\");\n }\n\n function testSubstring() public pure {\n require(keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")), \"Copy 0 bytes\");\n require(keccak256(bytes(\"hello\".substring(0, 4))) == keccak256(bytes(\"hell\")), \"Copy substring\");\n require(keccak256(bytes(\"hello\".substring(1, 4))) == keccak256(bytes(\"ello\")), \"Copy substring\");\n require(keccak256(bytes(\"hello\".substring(0, 5))) == keccak256(bytes(\"hello\")), \"Copy whole string\");\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) == bytes32(0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000), \"readBytes20\");\n }\n\n function testReadBytes32() public pure {\n require(\"0123456789abcdef0123456789abcdef\".readBytes32(0) == bytes32(0x3031323334353637383961626364656630313233343536373839616263646566), \"readBytes32\");\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")), \"Decode 'a'\");\n require(\"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")), \"Decode 'aa'\");\n require(\"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")), \"Decode 'aaa'\");\n require(\"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")), \"Decode 'aaaa'\");\n require(\"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")), \"Decode 'aaaaa'\");\n require(\"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")), \"Decode 'aaaaa' lowercase\");\n require(\"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(0, 42) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")), \"Decode alphabet\");\n require(\"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(0, 42) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")), \"Decode alphabet lowercase\");\n require(\"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\".base32HexDecodeWord(0, 52) == bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"), \"Decode 32*'a'\");\n require(\" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\".base32HexDecodeWord(1, 32) == bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"), \"Decode real bytes32hex\");\n }\n}" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(bytes calldata data, bytes calldata hash)\n external\n pure\n override\n returns (bool)\n {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(bytes calldata data, bytes calldata hash)\n external\n pure\n override\n returns (bool)\n {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(bytes memory data)\n internal\n pure\n returns (uint256[2] memory)\n {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(bytes memory data)\n internal\n pure\n returns (uint256[2] memory)\n {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(uint256 x0, uint256 y0)\n internal\n pure\n returns (uint256[3] memory P)\n {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (\n uint256 x,\n uint256 y,\n uint256 z\n )\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(uint256 x0, uint256 y0)\n internal\n pure\n returns (bool isZero)\n {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n )\n internal\n pure\n returns (\n uint256 x1,\n uint256 y1,\n uint256 z1\n )\n {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n )\n internal\n pure\n returns (\n uint256 x2,\n uint256 y2,\n uint256 z2\n )\n {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n )\n private\n pure\n returns (\n uint256 x2,\n uint256 y2,\n uint256 z2\n )\n {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(uint256 x0, uint256 y0)\n internal\n pure\n returns (uint256, uint256)\n {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(uint256 scalar)\n internal\n pure\n returns (uint256, uint256)\n {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(bytes calldata, bytes calldata)\n external\n pure\n override\n returns (bool)\n {\n return true;\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(bytes calldata name)\n external\n view\n override\n returns (bool)\n {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(bytes calldata name)\n external\n view\n override\n returns (bool)\n {\n return suffixes[name];\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (\n bytes memory key,\n bytes memory value,\n uint256 nextOffset\n )\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = input.length;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n nextOffset = terminator + 1;\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(bytes32 node, bytes calldata data)\n external\n virtual\n authorised(node)\n {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(bytes32 node, bytes32 name)\n public\n view\n virtual\n returns (bool)\n {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(bytes32 node, bytes calldata hash)\n external\n virtual\n authorised(node)\n {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node)\n external\n view\n virtual\n override\n returns (bytes memory)\n {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\n\ninterface INameWrapper {\n function ownerOf(uint256 id) external view returns (address);\n}\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator)\n public\n view\n returns (bool)\n {\n return _operatorApprovals[account][operator];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return owner == msg.sender || isApprovedForAll(owner, msg.sender);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(bytes32 node, uint256 contentTypes)\n external\n view\n virtual\n override\n returns (uint256, bytes memory)\n {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(bytes32 node, bytes calldata hash)\n external\n virtual\n authorised(node)\n {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node)\n external\n view\n virtual\n override\n returns (bytes memory)\n {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][interfaceID] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(bytes32 node, bytes4 interfaceID)\n external\n view\n virtual\n override\n returns (address)\n {\n address implementer = versionable_interfaces[recordVersions[node]][node][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(bytes32 node, string calldata newName)\n external\n virtual\n authorised(node)\n {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node)\n external\n view\n virtual\n override\n returns (string memory)\n {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node)\n external\n view\n virtual\n override\n returns (bytes32 x, bytes32 y)\n {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(bytes32 node, string calldata key)\n external\n view\n virtual\n override\n returns (string memory)\n {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(bytes32 nodehash, bytes[] calldata data)\n internal\n returns (bytes[] memory results)\n {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(bytes32 nodehash, bytes[] calldata data)\n external\n returns (bytes[] memory results)\n {\n return _multicall(nodehash, data);\n }\n\n function multicall(bytes[] calldata data)\n public\n override\n returns (bytes[] memory results)\n {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(bytes32 node, uint256 contentTypes)\n external\n view\n returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(bytes32 node, bytes4 interfaceID)\n external\n view\n returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(bytes32 node, string calldata key)\n external\n view\n returns (string memory);\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(bytes[] calldata data)\n external\n returns (bytes[] memory results);\n\n function multicallWithNodeCheck(bytes32, bytes[] calldata data)\n external\n returns (bytes[] memory results);\n}\n" + }, + "test/utils/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata, /* name */\n bytes calldata data\n ) external view returns (bytes memory, address) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function resolveCallback(bytes calldata response, bytes calldata extraData)\n external\n view\n returns (bytes memory)\n {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n return abi.encode(address(this));\n }\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(bytes memory name, bytes memory data)\n external\n view\n returns (bytes memory, address);\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is IExtendedResolver, ERC165 {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n\n ENS public immutable registry;\n\n constructor(address _registry) {\n registry = ENS(_registry);\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(bytes calldata name, bytes memory data)\n external\n view\n override\n returns (bytes memory, address)\n {\n (Resolver resolver, ) = findResolver(name);\n if (address(resolver) == address(0)) {\n return (\"\", address(0));\n }\n\n try\n resolver.supportsInterface(type(IExtendedResolver).interfaceId)\n returns (bool supported) {\n if (supported) {\n return (\n callWithOffchainLookupPropagation(\n address(resolver),\n abi.encodeCall(IExtendedResolver.resolve, (name, data)),\n UniversalResolver.resolveCallback.selector\n ),\n address(resolver)\n );\n }\n } catch {}\n return (\n callWithOffchainLookupPropagation(\n address(resolver),\n data,\n UniversalResolver.resolveCallback.selector\n ),\n address(resolver)\n );\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(bytes calldata reverseName)\n external\n view\n returns (\n string memory,\n address,\n address,\n address\n )\n {\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = this.resolve(\n reverseName,\n abi.encodeCall(INameResolver.name, reverseName.namehash(0))\n );\n\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n (bytes memory resolvedData, address resolverAddress) = this.resolve(\n encodedName,\n abi.encodeCall(IAddrResolver.addr, namehash)\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @param callbackFunction The function ID of a function on this contract to use as an EIP 3668 callback.\n * This function's `extraData` argument will be passed `(address target, bytes4 innerCallback, bytes innerExtraData)`.\n * @return ret If `target` did not revert, contains the return data from the call to `target`.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data,\n bytes4 callbackFunction\n ) internal view returns (bytes memory ret) {\n bool result = LowLevelCallUtils.functionStaticCall(target, data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return LowLevelCallUtils.readReturnData(0, size);\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n if (bytes4(errorId) == OffchainLookup.selector) {\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n (\n address sender,\n string[] memory urls,\n bytes memory callData,\n bytes4 innerCallbackFunction,\n bytes memory extraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (sender == target) {\n revert OffchainLookup(\n address(this),\n urls,\n callData,\n callbackFunction,\n abi.encode(sender, innerCallbackFunction, extraData)\n );\n }\n }\n }\n\n LowLevelCallUtils.propagateRevert();\n }\n\n /**\n * @dev Callback function for `resolve`.\n * @param response Response data returned by the target address that invoked the inner `OffchainData` revert.\n * @param extraData Extra data encoded by `callWithOffchainLookupPropagation` to allow completing the request.\n */\n function resolveCallback(bytes calldata response, bytes calldata extraData)\n external\n view\n returns (bytes memory)\n {\n (\n address target,\n bytes4 innerCallbackFunction,\n bytes memory innerExtraData\n ) = abi.decode(extraData, (address, bytes4, bytes));\n return\n abi.decode(\n target.functionStaticCall(\n abi.encodeWithSelector(\n innerCallbackFunction,\n response,\n innerExtraData\n )\n ),\n (bytes)\n );\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return The Resolver responsible for this name, and the namehash of the full name.\n */\n function findResolver(bytes calldata name)\n public\n view\n returns (Resolver, bytes32)\n {\n (address resolver, bytes32 labelhash) = findResolver(name, 0);\n return (Resolver(resolver), labelhash);\n }\n\n function findResolver(bytes calldata name, uint256 offset)\n internal\n view\n returns (address, bytes32)\n {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0));\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash = keccak256(name[offset + 1:nextLabel]);\n (address parentresolver, bytes32 parentnode) = findResolver(\n name,\n nextLabel\n );\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node);\n }\n return (parentresolver, node);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(address target, bytes memory data)\n internal\n view\n returns (bool success)\n {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(uint256 offset, uint256 length)\n internal\n pure\n returns (bytes memory data)\n {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes calldata a\n ) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(bytes[] calldata data)\n external\n returns (bytes[] memory results);\n\n function multicallWithNodeCheck(bytes32 nodehash, bytes[] calldata data)\n external\n returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(string memory name)\n internal\n pure\n returns (bytes memory dnsName, bytes32 node)\n {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(bytes memory self, uint256 offset)\n internal\n pure\n returns (bytes32)\n {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(bytes memory self, uint256 idx)\n internal\n pure\n returns (bytes32 labelhash, uint256 newIdx)\n {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(bytes calldata name, uint256 offset)\n public\n pure\n returns (bytes32, uint256)\n {\n return name.readLabel(offset);\n }\n\n function namehash(bytes calldata name, uint256 offset)\n public\n pure\n returns (bytes32)\n {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n view\n override\n returns (bool)\n {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant PARENT_CANNOT_CONTROL = 64;\nuint32 constant CAN_DO_EVERYTHING = 0;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 _expiry,\n address resolver\n ) external returns (uint64 expiry);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint32 fuses,\n uint64 expiry\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration,\n uint32 fuses,\n uint64 expiry\n ) external returns (uint256 expires);\n\n function unwrap(\n bytes32 node,\n bytes32 label,\n address owner\n ) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function setFuses(bytes32 node, uint32 fuses)\n external\n returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function isTokenOwnerOrApproved(bytes32 node, address addr)\n external\n returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external returns (address owner);\n\n function getData(uint256 id)\n external\n returns (\n address,\n uint32,\n uint64\n );\n\n function allFusesBurned(bytes32 node, uint32 fuseMask)\n external\n view\n returns (bool);\n\n function isWrapped(bytes32 node) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC165, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, OperationProhibited} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror NameNotFound();\nerror IncompatibleParent();\nerror IncompatibleName(bytes name);\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable\n{\n using BytesUtils for bytes;\n ENS public immutable override ens;\n IBaseRegistrar public immutable override registrar;\n IMetadataService public override metadataService;\n mapping(bytes32 => bytes) public override names;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC1155Fuse, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(uint256 id)\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner)\n {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Label as a string of the .eth domain to wrap\n * @return address The owner of the name\n * @return uint32 Fuses of the name\n * @return uint64 Expiry of when the fuses expire for the name\n */\n\n function getData(uint256 id)\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (\n address,\n uint32,\n uint64\n )\n {\n return super.getData(id);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(IMetadataService _metadataService)\n public\n onlyOwner\n {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(uint256 tokenId) public view override returns (string memory) {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress)\n public\n onlyOwner\n {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or approved by the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!isTokenOwnerOrApproved(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or approved\n */\n\n function isTokenOwnerOrApproved(bytes32 node, address addr)\n public\n view\n override\n returns (bool)\n {\n address owner = ownerOf(uint256(node));\n return owner == addr || isApprovedForAll(owner, addr);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param fuses Initial fuses to set\n * @param expiry When the fuses will expire\n * @param resolver Resolver contract address\n * @return Normalised expiry of when the fuses expire\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public override returns (uint64) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n return _wrapETH2LD(label, wrappedOwner, fuses, expiry, resolver);\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param fuses Initial fuses to set\n * @param expiry When the fuses will expire\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint32 fuses,\n uint64 expiry\n ) external override onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(label, wrappedOwner, fuses, expiry, resolver);\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration,\n uint32 fuses,\n uint64 expiry\n ) external override onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n expires = registrar.renew(tokenId, duration);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n expiry = _normaliseExpiry(expiry, oldExpiry, uint64(expires));\n\n _setData(node, owner, oldFuses | fuses | PARENT_CANNOT_CONTROL, expiry);\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public override {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public override onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public override onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param fuses Fuses to burn (cannot burn PARENT_CANNOT_CONTROL)\n * @return New fuses\n */\n\n function setFuses(bytes32 node, uint32 fuses)\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n _checkForParentCannotControl(node, fuses);\n\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, expiry);\n return fuses;\n }\n\n /**\n * @notice Upgrades a .eth wrapped domain by calling the wrapETH2LD function of the upgradeContract\n * and burning the token of this contract\n * @dev Can be called by the owner of the name in this contract\n * @param label Label as a string of the .eth name to upgrade\n * @param wrappedOwner The owner of the wrapped name\n */\n\n function upgradeETH2LD(\n string calldata label,\n address wrappedOwner,\n address resolver\n ) public {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n (uint32 fuses, uint64 expiry) = _prepareUpgrade(node);\n\n upgradeContract.wrapETH2LD(\n label,\n wrappedOwner,\n fuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @notice Upgrades a non .eth domain of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * Requires upgraded Namewrapper to permit old Namewrapper to call `setSubnodeRecord` for all names\n * @param parentNode Namehash of the parent name\n * @param label Label as a string of the name to upgrade\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract for this name\n */\n\n function upgrade(\n bytes32 parentNode,\n string calldata label,\n address wrappedOwner,\n address resolver\n ) public {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(parentNode, labelhash);\n (uint32 fuses, uint64 expiry) = _prepareUpgrade(node);\n upgradeContract.setSubnodeRecord(\n parentNode,\n label,\n wrappedOwner,\n resolver,\n 0,\n fuses,\n expiry\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of. Can also be called by the owner of a .eth name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the fuses will expire\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n uint64 maxExpiry;\n (, uint32 parentFuses, uint64 parentExpiry) = getData(\n uint256(parentNode)\n );\n if (parentNode == ETH_NODE) {\n if (!isTokenOwnerOrApproved(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n // max expiry is set to the expiry on the registrar\n maxExpiry = uint64(registrar.nameExpires(uint256(labelhash)));\n } else {\n if (!isTokenOwnerOrApproved(parentNode, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n // max expiry is set to the expiry of the parent\n maxExpiry = parentExpiry;\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the fuses will expire\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n )\n public\n onlyTokenOwner(parentNode)\n canCallSetSubnodeOwner(parentNode, keccak256(bytes(label)))\n returns (bytes32 node)\n {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _addLabelAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n _addLabelSetFusesAndTransfer(\n parentNode,\n node,\n label,\n owner,\n fuses,\n expiry\n );\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the regsitry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry expiry date for the domain\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n )\n public\n onlyTokenOwner(parentNode)\n canCallSetSubnodeOwner(parentNode, keccak256(bytes(label)))\n returns (bytes32 node)\n {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _addLabelAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _addLabelSetFusesAndTransfer(\n parentNode,\n node,\n label,\n owner,\n fuses,\n expiry\n );\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n override\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n (address oldOwner, , ) = getData(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(bytes32 node, address resolver)\n public\n override\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_SET_RESOLVER)\n {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(bytes32 node, uint64 ttl)\n public\n override\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_SET_TTL)\n {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param node Namehash of the name to check\n * @param labelhash Labelhash of the name to check\n */\n\n modifier canCallSetSubnodeOwner(bytes32 node, bytes32 labelhash) {\n bytes32 subnode = _makeNode(node, labelhash);\n address owner = ens.owner(subnode);\n\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n (, uint32 subnodeFuses, ) = getData(uint256(subnode));\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n\n _;\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(bytes32 node, uint32 fuseMask)\n public\n view\n override\n returns (bool)\n {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped or not\n * @dev Both of these checks need to be true to be considered wrapped if checked without this contract\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view override returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public override returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) = abi.decode(data, (string, address, uint32, uint64, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n _wrapETH2LD(label, owner, fuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _canTransfer(uint32 fuses) internal pure override returns (bool) {\n return fuses & CANNOT_TRANSFER == 0;\n }\n\n function _makeNode(bytes32 node, bytes32 labelhash)\n private\n pure\n returns (bytes32)\n {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(string memory label, bytes memory name)\n internal\n pure\n returns (bytes memory ret)\n {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n address oldOwner = ownerOf(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n names[node] = name;\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _addLabelAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _prepareUpgrade(bytes32 node)\n private\n returns (uint32 fuses, uint64 expiry)\n {\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!isTokenOwnerOrApproved(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (, fuses, expiry) = getData(uint256(node));\n\n // burn token and fuse data\n _burn(uint256(node));\n }\n\n function _addLabelSetFusesAndTransfer(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n address oldOwner = ownerOf(uint256(node));\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, fuses, expiry);\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningPCC = fuses & PARENT_CANNOT_CONTROL ==\n PARENT_CANNOT_CONTROL;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningPCC && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _getETH2LDDataAndNormaliseExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n )\n internal\n view\n returns (\n address owner,\n uint32 fuses,\n uint64\n )\n {\n uint64 oldExpiry;\n (owner, fuses, oldExpiry) = getData(uint256(node));\n uint64 maxExpiry = uint64(registrar.nameExpires(uint256(labelhash)));\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n return (owner, fuses, expiry);\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) internal pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private returns (uint64) {\n // Mint a new ERC1155 token with fuses\n // Set PARENT_CANNOT_REPLACE to reflect wrapper + registrar control over the 2LD\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n uint32 oldFuses;\n\n (, oldFuses, expiry) = _getETH2LDDataAndNormaliseExpiry(\n node,\n labelhash,\n expiry\n );\n\n _addLabelAndWrap(\n ETH_NODE,\n node,\n label,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL,\n expiry\n );\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n return expiry;\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (owner == address(0x0) || owner == address(this)) {\n revert IncorrectTargetOwner(owner);\n }\n\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses, expiry);\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n if (\n fuses & ~PARENT_CANNOT_CONTROL != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkForParentCannotControl(bytes32 node, uint32 fuses)\n internal\n view\n {\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n // Only the parent can burn the PARENT_CANNOT_CONTROL fuse.\n revert Unauthorised(node, msg.sender);\n }\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _canTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nerror OperationProhibited(bytes32 node);\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC165, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id)\n public\n view\n virtual\n override\n returns (uint256)\n {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n (address owner, , ) = getData(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] memory accounts, uint256[] memory ids)\n public\n view\n virtual\n override\n returns (uint256[] memory)\n {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved)\n public\n virtual\n override\n {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator)\n public\n view\n virtual\n override\n returns (bool)\n {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(uint256 tokenId)\n public\n view\n virtual\n returns (\n address owner,\n uint32 fuses,\n uint64 expiry\n )\n {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n if (block.timestamp > expiry) {\n fuses = 0;\n } else {\n fuses = uint32(t >> 160);\n }\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiration) = getData(id);\n\n if (!_canTransfer(fuses)) {\n revert OperationProhibited(bytes32(id));\n }\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiration);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _canTransfer(uint32 fuses) internal virtual returns (bool);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses | oldFuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address owner, uint32 fuses, uint64 expiry) = getData(tokenId);\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, owner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n if (!_canTransfer(fuses)) {\n revert OperationProhibited(bytes32(id));\n }\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function setSubnodeRecord(\n bytes32 parentNode,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, _allowances[owner][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = _allowances[owner][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Spend `amount` form the allowance of `owner` toward `spender`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: balance query for the zero address\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"ERC721: owner query for nonexistent token\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n require(_exists(tokenId), \"ERC721Metadata: URI query for nonexistent token\");\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overriden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n require(_exists(tokenId), \"ERC721: approved query for nonexistent token\");\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n _safeTransfer(from, to, tokenId, _data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `_data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, _data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n require(_exists(tokenId), \"ERC721: operator query for nonexistent token\");\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, _data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Clear approvals\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits a {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits a {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param _data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"./SafeMath.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using SafeMath for *;\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n returns (bool)\n {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(uint256 expires, uint256 amount)\n external\n view\n returns (uint256)\n {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ReverseRegistrar} from \"../registry/ReverseRegistrar.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper\n ) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(string memory name, uint256 duration)\n public\n view\n override\n returns (IPriceOracle.Price memory price)\n {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint32 fuses,\n uint64 wrapperExpiry\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n resolver,\n data,\n secret,\n reverseRecord,\n fuses,\n wrapperExpiry\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint32 fuses,\n uint64 wrapperExpiry\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n fuses,\n wrapperExpiry\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n fuses,\n wrapperExpiry\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(string calldata name, uint256 duration)\n external\n payable\n override\n {\n _renew(name, duration, 0, 0);\n }\n\n function renewWithFuses(\n string calldata name,\n uint256 duration,\n uint32 fuses,\n uint64 wrapperExpiry\n ) external payable {\n bytes32 labelhash = keccak256(bytes(name));\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, labelhash));\n if (!nameWrapper.isTokenOwnerOrApproved(nodehash, msg.sender)) {\n revert Unauthorised(nodehash);\n }\n _renew(name, duration, fuses, wrapperExpiry);\n }\n\n function _renew(\n string calldata name,\n uint256 duration,\n uint32 fuses,\n uint64 wrapperExpiry\n ) internal {\n bytes32 labelhash = keccak256(bytes(name));\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, labelhash));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires;\n if (nameWrapper.isWrapped(nodehash)) {\n expires = nameWrapper.renew(\n tokenId,\n duration,\n fuses,\n wrapperExpiry\n );\n } else {\n expires = base.renew(tokenId, duration);\n }\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId)\n internal\n view\n override\n returns (bool)\n {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(uint256 tokenId)\n public\n view\n override(IERC721, ERC721)\n returns (address)\n {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(uint256 id, uint256 duration)\n external\n override\n live\n onlyController\n returns (uint256)\n {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n override(ERC721, IERC165)\n returns (bool)\n {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/registry/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(address owner, address resolver)\n public\n override\n returns (bytes32)\n {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(string memory, uint256)\n external\n returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint32,\n uint64\n ) external returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint32,\n uint64\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/registry/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(address owner, address resolver)\n external\n returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(string[] calldata names, uint256 duration)\n external\n view\n override\n returns (uint256 total)\n {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(string[] calldata names, uint256 duration)\n external\n payable\n override\n {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(string[] calldata names, uint256 duration)\n external\n view\n returns (uint256 total);\n\n function renewAll(string[] calldata names, uint256 duration)\n external\n payable;\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../INameWrapper.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\n\ncontract UpgradedNameWrapperMock {\n address public immutable oldNameWrapper;\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(\n address _oldNameWrapper,\n ENS _ens,\n IBaseRegistrar _registrar\n ) {\n oldNameWrapper = _oldNameWrapper;\n ens = _ens;\n registrar = _registrar;\n }\n\n event SetSubnodeRecord(\n bytes32 parentNode,\n string label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n );\n\n event WrapETH2LD(\n string label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n );\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n registrar.transferFrom(registrant, address(this), tokenId);\n registrar.reclaim(tokenId, address(this));\n require(\n registrant == msg.sender ||\n registrar.isApprovedForAll(registrant, msg.sender),\n \"Unauthorised\"\n );\n emit WrapETH2LD(label, wrappedOwner, fuses, expiry, resolver);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelhash));\n address owner = ens.owner(node);\n require(\n msg.sender == oldNameWrapper ||\n owner == msg.sender ||\n ens.isApprovedForAll(owner, msg.sender),\n \"Not owner/approved or previous nameWrapper controller\"\n );\n ens.setOwner(node, address(this));\n emit SetSubnodeRecord(\n parentNode,\n label,\n newOwner,\n resolver,\n ttl,\n fuses,\n expiry\n );\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(uint256 startPremium, uint256 elapsed)\n public\n pure\n returns (uint256)\n {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2**16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(uint256 fraction, uint256 premium)\n internal\n pure\n returns (uint256)\n {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "test/utils/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10**uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10**uint256(decimals()));\n }\n }\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(string memory name)\n public\n pure\n returns (bytes memory, bytes32)\n {\n return name.dnsEncodeName();\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 10000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/solcInputs/f42d02696184c2d4da5e160b6b05f526.json b/solidity/dns-contracts/deployments/goerli/solcInputs/f42d02696184c2d4da5e160b6b05f526.json new file mode 100644 index 0000000..fad1452 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/solcInputs/f42d02696184c2d4da5e160b6b05f526.json @@ -0,0 +1,104 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(address owner, address operator)\n external\n view\n returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(bytes32 node, uint256 contentTypes)\n external\n view\n returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(bytes32 node, uint256 coinType)\n external\n view\n returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(bytes memory name, bytes memory data)\n external\n view\n returns (bytes memory, address);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(bytes32 node, bytes4 interfaceID)\n external\n view\n returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(bytes32 node, string calldata key)\n external\n view\n returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes calldata a\n ) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(bytes[] calldata data)\n external\n returns (bytes[] memory results);\n\n function multicallWithNodeCheck(bytes32 nodehash, bytes[] calldata data)\n external\n returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(address target, bytes memory data)\n internal\n view\n returns (bool success)\n {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(uint256 offset, uint256 length)\n internal\n pure\n returns (bytes memory data)\n {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(string memory name)\n internal\n pure\n returns (bytes memory dnsName, bytes32 node)\n {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(OffchainLookupCallData[] memory data)\n external\n returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(bytes calldata name, bytes memory data)\n external\n view\n returns (bytes memory, address)\n {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(bytes calldata name, bytes[] memory data)\n external\n view\n returns (bytes[] memory, address)\n {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, ) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n return (results, address(0));\n }\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(bytes calldata reverseName)\n external\n view\n returns (\n string memory,\n address,\n address,\n address\n )\n {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(bytes calldata reverseName, string[] memory gateways)\n public\n view\n returns (\n string memory,\n address,\n address,\n address\n )\n {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n )\n internal\n view\n returns (\n string memory,\n address,\n address,\n address\n )\n {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(bytes calldata response, bytes calldata extraData)\n external\n view\n returns (bytes[] memory, address)\n {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(bytes calldata response, bytes calldata extraData)\n external\n view\n returns (\n string memory,\n address,\n address,\n address\n )\n {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (\n bytes[] memory,\n address,\n string[] memory,\n bytes memory\n )\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n result = LowLevelCallUtils.functionStaticCall(address(target), data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = revertData;\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return The Resolver responsible for this name, and the namehash of the full name.\n */\n function findResolver(bytes calldata name)\n public\n view\n returns (Resolver, bytes32)\n {\n (address resolver, bytes32 labelhash) = findResolver(name, 0);\n return (Resolver(resolver), labelhash);\n }\n\n function findResolver(bytes calldata name, uint256 offset)\n internal\n view\n returns (address, bytes32)\n {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0));\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash = keccak256(name[offset + 1:nextLabel]);\n (address parentresolver, bytes32 parentnode) = findResolver(\n name,\n nextLabel\n );\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node);\n }\n return (parentresolver, node);\n }\n\n function _hasExtendedResolver(\n address resolver\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface(\n type(IExtendedResolver).interfaceId\n )\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _multicall(MulticallData memory multicallData)\n internal\n view\n returns (bytes[] memory results)\n {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _hasExtendedResolver(multicallData.resolver);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = item;\n continue;\n }\n if (!isCallback && hasExtendedResolver) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = returnData;\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(bytes memory self, uint256 offset)\n internal\n pure\n returns (bytes32)\n {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(bytes memory self, uint256 idx)\n internal\n pure\n returns (bytes32 labelhash, uint256 newIdx)\n {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 2500 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/goerli/solcInputs/f9d64a49536bde12a455a58993d2532a.json b/solidity/dns-contracts/deployments/goerli/solcInputs/f9d64a49536bde12a455a58993d2532a.json new file mode 100644 index 0000000..6f21017 --- /dev/null +++ b/solidity/dns-contracts/deployments/goerli/solcInputs/f9d64a49536bde12a455a58993d2532a.json @@ -0,0 +1,398 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(bytes memory name, bytes memory data)\n internal\n pure\n returns (address, bool)\n {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(bytes memory rdata, uint256 idx)\n internal\n pure\n returns (address, bool)\n {\n while (idx < rdata.length) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n if (len < 44) return (address(0x0), false);\n return hexToAddress(str, idx + 4);\n }\n\n function hexToAddress(bytes memory str, uint256 idx)\n internal\n pure\n returns (address, bool)\n {\n if (str.length - idx < 40) return (address(0x0), false);\n uint256 ret = 0;\n for (uint256 i = idx; i < idx + 40; i++) {\n ret <<= 4;\n uint256 x = str.readUint8(i);\n if (x >= 48 && x < 58) {\n ret |= x - 48;\n } else if (x >= 65 && x < 71) {\n ret |= x - 55;\n } else if (x >= 97 && x < 103) {\n ret |= x - 87;\n } else {\n return (address(0x0), false);\n }\n }\n return (address(uint160(ret)), true);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\n// TODO: Record inception time of any claimed name, so old proofs can't be used to revert changes to a name.\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error StaleProof();\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewOracle(address oracle);\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n oracle = _dnssec;\n emit NewOracle(address(oracle));\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n require(\n msg.sender == owner,\n \"Only owner can call proveAndClaimWithResolver\"\n );\n if (addr != address(0)) {\n require(\n resolver != address(0),\n \"Cannot set addr if resolver is not set\"\n );\n // Set ourselves as the owner so we can set a record on the resolver\n ens.setSubnodeRecord(\n rootNode,\n labelHash,\n address(this),\n resolver,\n 0\n );\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n // Transfer the record to the owner\n ens.setOwner(node, owner);\n } else {\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n }\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n override\n returns (bool)\n {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input)\n internal\n returns (\n bytes32 parentNode,\n bytes32 labelHash,\n address addr\n )\n {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n // Parent name must be in the public suffix list.\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n require(\n suffixes.isPublicSuffix(parentName),\n \"Parent name must be a public suffix\"\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName, 0);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n (addr, ) = DNSClaimChecker.getOwnerAddress(name, data);\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain, uint256 offset)\n internal\n returns (bytes32 node)\n {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n require(\n owner == address(0) || owner == address(this),\n \"Cannot enable a name owned by someone else\"\n );\n if (owner != address(this)) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n } else {\n ens.setSubnodeOwner(parentNode, label, address(this));\n }\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(\n uint16 _expectedType,\n bytes memory _expectedName,\n uint32 _inception,\n uint64 _inserted,\n bytes memory _proof\n ) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if (_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(uint16 dnstype, bytes memory name)\n public\n view\n returns (\n uint32,\n uint64,\n bytes20\n )\n {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (\n bytes memory key,\n bytes memory value,\n uint256 nextOffset\n )\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = input.length;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n nextOffset = terminator + 1;\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(bytes calldata name)\n external\n view\n override\n returns (bool)\n {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(bytes calldata name)\n external\n view\n override\n returns (bool)\n {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(uint256 x0, uint256 y0)\n internal\n pure\n returns (uint256[3] memory P)\n {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (\n uint256 x,\n uint256 y,\n uint256 z\n )\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(uint256 x0, uint256 y0)\n internal\n pure\n returns (bool isZero)\n {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n )\n internal\n pure\n returns (\n uint256 x1,\n uint256 y1,\n uint256 z1\n )\n {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n )\n internal\n pure\n returns (\n uint256 x2,\n uint256 y2,\n uint256 z2\n )\n {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n )\n private\n pure\n returns (\n uint256 x2,\n uint256 y2,\n uint256 z2\n )\n {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(uint256 x0, uint256 y0)\n internal\n pure\n returns (uint256, uint256)\n {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(uint256 scalar)\n internal\n pure\n returns (uint256, uint256)\n {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(bytes memory data)\n internal\n pure\n returns (uint256[2] memory)\n {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(bytes memory data)\n internal\n pure\n returns (uint256[2] memory)\n {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(bytes memory self, bytes memory other)\n internal\n pure\n returns (int256)\n {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if(offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if(otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n \n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, bytes memory other)\n internal\n pure\n returns (bool)\n {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(bytes memory self, uint256 idx)\n internal\n pure\n returns (uint8 ret)\n {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(bytes memory self, uint256 idx)\n internal\n pure\n returns (uint16 ret)\n {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(bytes memory self, uint256 idx)\n internal\n pure\n returns (uint32 ret)\n {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(bytes memory self, uint256 idx)\n internal\n pure\n returns (bytes32 ret)\n {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(bytes memory self, uint256 idx)\n internal\n pure\n returns (bytes20 ret)\n {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(\n uint256 dest,\n uint256 src,\n uint256 len\n ) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256**(32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(bytes calldata data, bytes calldata hash)\n external\n pure\n virtual\n returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(bytes calldata, bytes calldata)\n external\n pure\n override\n returns (bool)\n {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(bytes calldata data, bytes calldata hash)\n external\n pure\n override\n returns (bool)\n {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(bytes calldata data, bytes calldata hash)\n external\n pure\n override\n returns (bool)\n {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(RRSetWithSignature[] memory input)\n external\n view\n virtual\n returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(RRSetWithSignature[] memory input, uint256 now)\n public\n view\n virtual\n returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(RRSetWithSignature[] memory input)\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(RRSetWithSignature[] memory input, uint256 now)\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(RRUtils.SignedSet memory rrset, uint16 typecovered)\n internal\n pure\n returns (bytes memory name)\n {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if(address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(bytes memory self, uint256 offset)\n internal\n pure\n returns (uint256)\n {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(bytes memory self, uint256 offset)\n internal\n pure\n returns (bytes memory ret)\n {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(bytes memory self, uint256 offset)\n internal\n pure\n returns (uint256)\n {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(bytes memory data)\n internal\n pure\n returns (SignedSet memory self)\n {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(SignedSet memory rrset)\n internal\n pure\n returns (RRIterator memory)\n {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(bytes memory self, uint256 offset)\n internal\n pure\n returns (RRIterator memory ret)\n {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(RRIterator memory iter)\n internal\n pure\n returns (bytes memory)\n {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(bytes memory self, bytes memory other) \n internal\n pure\n returns (bool)\n {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while(counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(bytes memory self, bytes memory other)\n internal\n pure\n returns (int256)\n {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(uint32 i1, uint32 i2)\n internal\n pure\n returns (bool)\n {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(bytes memory body, uint256 off)\n internal\n pure\n returns (uint256)\n {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns (bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 {\n totallen := add(totallen, 64)\n }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for {\n let i := 0\n } lt(i, totallen) {\n i := add(i, 64)\n } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 {\n mstore8(add(scratch, sub(len, i)), 0x80)\n }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 {\n mstore(\n add(scratch, 32),\n or(mload(add(scratch, 32)), mul(len, 8))\n )\n }\n\n // Expand the 16 32-bit words into 80\n for {\n let j := 64\n } lt(j, 128) {\n j := add(j, 12)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 12))),\n mload(add(scratch, sub(j, 32)))\n ),\n xor(\n mload(add(scratch, sub(j, 56))),\n mload(add(scratch, sub(j, 64)))\n )\n )\n temp := or(\n and(\n mul(temp, 2),\n 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE\n ),\n and(\n div(temp, 0x80000000),\n 0x0000000100000001000000010000000100000001000000010000000100000001\n )\n )\n mstore(add(scratch, j), temp)\n }\n for {\n let j := 128\n } lt(j, 320) {\n j := add(j, 24)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 24))),\n mload(add(scratch, sub(j, 64)))\n ),\n xor(\n mload(add(scratch, sub(j, 112))),\n mload(add(scratch, sub(j, 128)))\n )\n )\n temp := or(\n and(\n mul(temp, 4),\n 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC\n ),\n and(\n div(temp, 0x40000000),\n 0x0000000300000003000000030000000300000003000000030000000300000003\n )\n )\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for {\n let j := 0\n } lt(j, 80) {\n j := add(j, 1)\n } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(\n div(x, 0x100000000000000000000),\n div(x, 0x10000000000)\n )\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := and(div(x, 0x10000000000), f)\n f := or(\n and(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n ),\n f\n )\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(\n div(\n x,\n 0x80000000000000000000000000000000000000000000000\n ),\n 0x1F\n )\n temp := or(\n and(\n div(x, 0x800000000000000000000000000000000000000),\n 0xFFFFFFE0\n ),\n temp\n )\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(\n div(\n mload(add(scratch, mul(j, 4))),\n 0x100000000000000000000000000000000000000000000000000000000\n ),\n temp\n )\n x := or(\n div(x, 0x10000000000),\n mul(temp, 0x10000000000000000000000000000000000000000)\n )\n x := or(\n and(\n x,\n 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF\n ),\n mul(\n or(\n and(div(x, 0x4000000000000), 0xC0000000),\n and(div(x, 0x400000000000000000000), 0x3FFFFFFF)\n ),\n 0x100000000000000000000\n )\n )\n }\n\n h := and(\n add(h, x),\n 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF\n )\n }\n ret := mul(\n or(\n or(\n or(\n or(\n and(\n div(h, 0x100000000),\n 0xFFFFFFFF00000000000000000000000000000000\n ),\n and(\n div(h, 0x1000000),\n 0xFFFFFFFF000000000000000000000000\n )\n ),\n and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)\n ),\n and(div(h, 0x100), 0xFFFFFFFF00000000)\n ),\n and(h, 0xFFFFFFFF)\n ),\n 0x1000000000000000000000000\n )\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId)\n internal\n view\n override\n returns (bool)\n {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(uint256 tokenId)\n public\n view\n override(IERC721, ERC721)\n returns (address)\n {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(uint256 id, uint256 duration)\n external\n override\n live\n onlyController\n returns (uint256)\n {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n override(ERC721, IERC165)\n returns (bool)\n {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(string[] calldata names, uint256 duration)\n external\n view\n override\n returns (uint256 total)\n {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(string[] calldata names, uint256 duration)\n external\n payable\n override\n {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ReverseRegistrar} from \"../registry/ReverseRegistrar.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper\n ) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(string memory name, uint256 duration)\n public\n view\n override\n returns (IPriceOracle.Price memory price)\n {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(string calldata name, uint256 duration)\n external\n payable\n override\n {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(\n tokenId,\n duration\n );\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(uint256 startPremium, uint256 elapsed)\n public\n pure\n returns (uint256)\n {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2**16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(uint256 fraction, uint256 premium)\n internal\n pure\n returns (uint256)\n {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(string[] calldata names, uint256 duration)\n external\n view\n returns (uint256 total);\n\n function renewAll(string[] calldata names, uint256 duration)\n external\n payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(string memory, uint256)\n external\n view\n returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/ILinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface ILinearPremiumPriceOracle {\n function timeUntilPremium(uint256 expires, uint256 amount)\n external\n view\n returns (uint256);\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(uint256 expires, uint256 amount)\n external\n view\n returns (uint256)\n {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns (address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"./SafeMath.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using SafeMath for *;\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n returns (bool)\n {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping(bytes32 => address) addresses;\n\n constructor() public {}\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(address owner, address operator)\n external\n view\n returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(bytes32 node, address owner)\n public\n virtual\n override\n authorised(node)\n {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(bytes32 node, address resolver)\n public\n virtual\n override\n authorised(node)\n {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(bytes32 node, uint64 ttl)\n public\n virtual\n override\n authorised(node)\n {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(address operator, bool approved)\n external\n virtual\n override\n {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node)\n public\n view\n virtual\n override\n returns (address)\n {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node)\n public\n view\n virtual\n override\n returns (address)\n {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(bytes32 node)\n public\n view\n virtual\n override\n returns (bool)\n {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(address owner, address operator)\n external\n view\n virtual\n override\n returns (bool)\n {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(address owner, address resolver)\n external\n returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/registry/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(address owner, address resolver)\n public\n override\n returns (bytes32)\n {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(bytes[] calldata data)\n external\n returns (bytes[] memory results);\n\n function multicallWithNodeCheck(bytes32, bytes[] calldata data)\n external\n returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Implements a dummy NameWrapper which returns the caller's address\n */\ncontract DummyNameWrapper {\n function ownerOf(\n uint256 /* id */\n ) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(bytes32 nodehash, bytes[] calldata data)\n internal\n returns (bytes[] memory results)\n {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(bytes32 nodehash, bytes[] calldata data)\n external\n returns (bytes[] memory results)\n {\n return _multicall(nodehash, data);\n }\n\n function multicall(bytes[] calldata data)\n public\n override\n returns (bytes[] memory results)\n {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(bytes32 node, uint256 contentTypes)\n external\n view\n virtual\n override\n returns (uint256, bytes memory)\n {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(bytes32 node, address a)\n external\n virtual\n authorised(node)\n {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node)\n public\n view\n virtual\n override\n returns (address payable)\n {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(bytes32 node, uint256 coinType)\n public\n view\n virtual\n override\n returns (bytes memory)\n {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(bytes memory b)\n internal\n pure\n returns (address payable a)\n {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(bytes32 node, bytes calldata hash)\n external\n virtual\n authorised(node)\n {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node)\n external\n view\n virtual\n override\n returns (bytes memory)\n {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(bytes32 node, bytes calldata data)\n external\n virtual\n authorised(node)\n {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(bytes32 node, bytes32 name)\n public\n view\n virtual\n returns (bool)\n {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(bytes32 node, bytes calldata hash)\n external\n virtual\n authorised(node)\n {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node)\n external\n view\n virtual\n override\n returns (bytes memory)\n {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(bytes32 node, uint256 contentTypes)\n external\n view\n returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(bytes32 node, uint256 coinType)\n external\n view\n returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(bytes memory name, bytes memory data)\n external\n view\n returns (bytes memory, address);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(bytes32 node, bytes4 interfaceID)\n external\n view\n returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][interfaceID] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(bytes32 node, bytes4 interfaceID)\n external\n view\n virtual\n override\n returns (address)\n {\n address implementer = versionable_interfaces[recordVersions[node]][node][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(bytes32 node, string calldata key)\n external\n view\n returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(bytes32 node, string calldata newName)\n external\n virtual\n authorised(node)\n {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node)\n external\n view\n virtual\n override\n returns (string memory)\n {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node)\n external\n view\n virtual\n override\n returns (bytes32 x, bytes32 y)\n {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(bytes32 node, string calldata key)\n external\n view\n virtual\n override\n returns (string memory)\n {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\n\ninterface INameWrapper {\n function ownerOf(uint256 id) external view returns (address);\n}\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool))) private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator)\n public\n view\n returns (bool)\n {\n return _operatorApprovals[account][operator];\n }\n\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(\n msg.sender != delegate,\n \"Setting delegate status for self\"\n );\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(address owner, bytes32 node, address delegate)\n public\n view\n returns (bool)\n {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return owner == msg.sender || isApprovedForAll(owner, msg.sender) || \n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes calldata a\n ) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(bytes[] calldata data)\n external\n returns (bytes[] memory results);\n\n function multicallWithNodeCheck(bytes32 nodehash, bytes[] calldata data)\n external\n returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(bytes32 label, address owner)\n external\n onlyController\n {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(address target, bytes memory data)\n internal\n view\n returns (bool success)\n {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(uint256 offset, uint256 length)\n internal\n pure\n returns (bytes memory data)\n {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(string memory name)\n internal\n pure\n returns (bytes memory dnsName, bytes32 node)\n {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(string memory name)\n public\n pure\n returns (bytes memory, bytes32)\n {\n return name.dnsEncodeName();\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n address resolver;\n bool shouldEncode;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(OffchainLookupCallData[] memory data)\n external\n returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(bytes calldata name, bytes memory data)\n external\n view\n returns (bytes memory, address)\n {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(bytes calldata name, bytes[] memory data)\n external\n view\n returns (bytes[] memory, address)\n {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, ) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n return (results, address(0));\n }\n\n bool hasExtendedResolver = false;\n\n try\n resolver.supportsInterface(type(IExtendedResolver).interfaceId)\n returns (bool supported) {\n hasExtendedResolver = supported;\n } catch {}\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n resolverAddress,\n hasExtendedResolver,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(bytes calldata reverseName)\n external\n view\n returns (\n string memory,\n address,\n address,\n address\n )\n {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(bytes calldata reverseName, string[] memory gateways)\n public\n view\n returns (\n string memory,\n address,\n address,\n address\n )\n {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n )\n internal\n view\n returns (\n string memory,\n address,\n address,\n address\n )\n {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(bytes calldata response, bytes calldata extraData)\n external\n view\n returns (bytes[] memory, address)\n {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(bytes calldata response, bytes calldata extraData)\n external\n view\n returns (\n string memory,\n address,\n address,\n address\n )\n {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (\n bytes[] memory,\n address,\n string[] memory,\n bytes memory\n )\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n bytes[] memory responses;\n (multicallData.failures, responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (multicallData.failures[i]) {\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData\n )\n {\n bool result = LowLevelCallUtils.functionStaticCall(\n address(target),\n data\n );\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n if (bytes4(errorId) == OffchainLookup.selector) {\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData);\n }\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return The Resolver responsible for this name, and the namehash of the full name.\n */\n function findResolver(bytes calldata name)\n public\n view\n returns (Resolver, bytes32)\n {\n (address resolver, bytes32 labelhash) = findResolver(name, 0);\n return (Resolver(resolver), labelhash);\n }\n\n function findResolver(bytes calldata name, uint256 offset)\n internal\n view\n returns (address, bytes32)\n {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0));\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash = keccak256(name[offset + 1:nextLabel]);\n (address parentresolver, bytes32 parentnode) = findResolver(\n name,\n nextLabel\n );\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node);\n }\n return (parentresolver, node);\n }\n\n function _multicall(MulticallData memory multicallData)\n internal\n view\n returns (bytes[] memory results)\n {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool shouldDecode = multicallData.name.length == 0;\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory eData = multicallData.data[i];\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = multicallData.data[i];\n continue;\n }\n if (multicallData.shouldEncode) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (shouldDecode) {\n // if name is empty, this is a callback request so we should decode the result\n results[i] = abi.decode(returnData, (bytes));\n } else {\n results[i] = returnData;\n }\n extraDatas[i].data = eData;\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(bytes memory self, uint256 offset)\n internal\n pure\n returns (bytes32)\n {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(bytes memory self, uint256 idx)\n internal\n pure\n returns (bytes32 labelhash, uint256 newIdx)\n {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _preTransferCheck and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC165, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id)\n public\n view\n virtual\n override\n returns (uint256)\n {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] memory accounts, uint256[] memory ids)\n public\n view\n virtual\n override\n returns (uint256[] memory)\n {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved)\n public\n virtual\n override\n {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator)\n public\n view\n virtual\n override\n returns (bool)\n {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(uint256 tokenId)\n public\n view\n virtual\n returns (\n address owner,\n uint32 fuses,\n uint64 expiry\n )\n {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _preTransferCheck(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _preTransferCheck(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (bool);\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _preTransferCheck(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external;\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(uint256 labelHash, uint256 duration)\n external\n returns (uint256 expires);\n\n function unwrap(\n bytes32 node,\n bytes32 label,\n address owner\n ) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function setFuses(bytes32 node, uint16 ownerControlledFuses)\n external\n returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(bytes32 node, address addr) external returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external returns (address owner);\n\n function getData(uint256 id)\n external\n returns (\n address,\n uint32,\n uint64\n );\n\n function allFusesBurned(bytes32 node, uint32 fuseMask)\n external\n view\n returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function setSubnodeRecord(\n bytes32 parentNode,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../INameWrapper.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\n\ncontract UpgradedNameWrapperMock {\n address public immutable oldNameWrapper;\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(\n address _oldNameWrapper,\n ENS _ens,\n IBaseRegistrar _registrar\n ) {\n oldNameWrapper = _oldNameWrapper;\n ens = _ens;\n registrar = _registrar;\n }\n\n event SetSubnodeRecord(\n bytes32 parentNode,\n string label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n );\n\n event WrapETH2LD(\n string label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n );\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n registrar.transferFrom(registrant, address(this), tokenId);\n registrar.reclaim(tokenId, address(this));\n require(\n registrant == msg.sender ||\n registrar.isApprovedForAll(registrant, msg.sender),\n \"Unauthorised\"\n );\n emit WrapETH2LD(label, wrappedOwner, fuses, expiry, resolver);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelhash));\n address owner = ens.owner(node);\n require(\n msg.sender == oldNameWrapper ||\n owner == msg.sender ||\n ens.isApprovedForAll(owner, msg.sender),\n \"Not owner/approved or previous nameWrapper controller\"\n );\n ens.setOwner(node, address(this));\n emit SetSubnodeRecord(\n parentNode,\n label,\n newOwner,\n resolver,\n ttl,\n fuses,\n expiry\n );\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable\n{\n using BytesUtils for bytes;\n\n ENS public immutable override ens;\n IBaseRegistrar public immutable override registrar;\n IMetadataService public override metadataService;\n mapping(bytes32 => bytes) public override names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC1155Fuse, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(uint256 id)\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner)\n {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(uint256 id)\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (\n address owner,\n uint32 fuses,\n uint64 expiry\n )\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(IMetadataService _metadataService)\n public\n onlyOwner\n {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(uint256 tokenId) public view override returns (string memory) {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress)\n public\n onlyOwner\n {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or approved by the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or approved\n */\n\n function canModifyName(bytes32 node, address addr)\n public\n view\n override\n returns (bool)\n {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n (fuses & IS_DOT_ETH == 0 ||\n expiry - GRACE_PERIOD >= block.timestamp);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public override {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n _wrapETH2LD(label, wrappedOwner, ownerControlledFuses, resolver);\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external override onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(label, wrappedOwner, ownerControlledFuses, resolver);\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(uint256 tokenId, uint256 duration)\n external\n override\n onlyController\n returns (uint256 expires)\n {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this) ||\n ownerOf(uint256(node)) == address(0)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n (address owner, uint32 fuses, ) = getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public override {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public override onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public override onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return New fuses\n */\n\n function setFuses(bytes32 node, uint16 ownerControlledFuses)\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return ownerControlledFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n // this flag is used later, when checking fuses\n bool canModifyParentName = canModifyName(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canModifyParentName && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canModifyParentName && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a .eth wrapped domain by calling the wrapETH2LD function of the upgradeContract\n * and burning the token of this contract\n * @dev Can be called by the owner of the name in this contract\n * @param label Label as a string of the .eth name to upgrade\n * @param wrappedOwner The owner of the wrapped name\n */\n\n function upgradeETH2LD(\n string calldata label,\n address wrappedOwner,\n address resolver\n ) public {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n (address currentOwner, uint32 fuses, uint64 expiry) = _prepareUpgrade(\n node\n );\n\n if (wrappedOwner != currentOwner) {\n _preTransferCheck(uint256(node), fuses, expiry);\n }\n\n upgradeContract.wrapETH2LD(\n label,\n wrappedOwner,\n fuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @notice Upgrades a non .eth domain of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * Requires upgraded Namewrapper to permit old Namewrapper to call `setSubnodeRecord` for all names\n * @param parentNode Namehash of the parent name\n * @param label Label as a string of the name to upgrade\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract for this name\n */\n\n function upgrade(\n bytes32 parentNode,\n string calldata label,\n address wrappedOwner,\n address resolver\n ) public {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(parentNode, labelhash);\n (address currentOwner, uint32 fuses, uint64 expiry) = _prepareUpgrade(\n node\n );\n\n if (wrappedOwner != currentOwner) {\n _preTransferCheck(uint256(node), fuses, expiry);\n }\n\n upgradeContract.setSubnodeRecord(\n parentNode,\n label,\n wrappedOwner,\n resolver,\n 0,\n fuses,\n expiry\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of. Can also be called by the owner of a .eth name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the regsitry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n override\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(bytes32 node, address resolver)\n public\n override\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_SET_RESOLVER)\n {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(bytes32 node, uint64 ttl)\n public\n override\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_SET_TTL)\n {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(bytes32 parentNode, bytes32 subnode)\n internal\n view\n {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(bytes32 node, uint32 fuseMask)\n public\n view\n override\n returns (bool)\n {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n function isWrapped(bytes32 node) public view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public override returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n _wrapETH2LD(label, owner, ownerControlledFuses, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _preTransferCheck(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (bool) {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(bytes32 node, bytes32 labelhash)\n private\n pure\n returns (bytes32)\n {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(string memory label, bytes memory name)\n internal\n pure\n returns (bytes memory ret)\n {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _prepareUpgrade(bytes32 node)\n private\n returns (\n address owner,\n uint32 fuses,\n uint64 expiry\n )\n {\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (owner, fuses, expiry) = getData(uint256(node));\n\n _burn(uint256(node));\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) internal pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n uint64 expiry = uint64(registrar.nameExpires(uint256(labelhash))) +\n GRACE_PERIOD;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n ownerControlledFuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n}\n" + }, + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n view\n override\n returns (bool)\n {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(bytes calldata name, uint256 offset)\n public\n pure\n returns (bytes32, uint256)\n {\n return name.readLabel(offset);\n }\n\n function namehash(bytes calldata name, uint256 offset)\n public\n pure\n returns (bytes32)\n {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC165, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\"\".keccak(0, 0) == bytes32(0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470), \"Incorrect hash of empty string\");\n require(\"foo\".keccak(0, 3) == bytes32(0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d), \"Incorrect hash of 'foo'\");\n require(\"foo\".keccak(0, 0) == bytes32(0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470), \"Incorrect hash of empty string\");\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\"hello\".equals(1, \"ello\") == true, \"Substring to string equality\");\n require(\"hello\".equals(1, \"jello\", 1, 4) == true, \"Substring to substring equality\");\n require(\"zhello\".equals(1, \"abchello\", 3) == true, \"Compare different value with multiple length\");\n require(\"0x0102030000\".equals(0, \"0x010203\") == false, \"Compare with offset and trailing bytes\");\n }\n\n function testComparePartial() public pure {\n require(\"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true, \"Compare same length\");\n require(\"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true, \"Compare different length\");\n require(\"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true, \"Compare same with different offset\");\n require(\"01234567890123450123456789012345ab\".compare(0, 33, \"01234567890123450123456789012345aa\", 0, 33) == 0 == true, \"Compare different long strings same length smaller partial length which must be equal\");\n require(\"01234567890123450123456789012345ab\".compare(0, 33, \"01234567890123450123456789012345aa\", 0, 34) < 0 == true, \"Compare long strings same length different partial length\");\n require(\"0123456789012345012345678901234a\".compare(0, 32, \"0123456789012345012345678901234b\", 0, 32) < 0 == true, \"Compare strings exactly 32 characters long\");\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\"a\".compare(\"b\") < 0 == true, \"Compare different value with same length\");\n require(\"b\".compare(\"a\") > 0 == true, \"Compare different value with same length\");\n require(\"aa\".compare(\"ab\") < 0 == true, \"Compare different value with multiple length\");\n require(\"a\".compare(\"aa\") < 0 == true, \"Compare different value with different length\");\n require(\"aa\".compare(\"a\") > 0 == true, \"Compare different value with different length\");\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(longChar.compare(longChar) == 0 == true, \"Compares more than 32 bytes char\");\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(longChar.compare(otherLongChar) < 0 == true, \"Compare long char with difference at start\");\n }\n\n function testSubstring() public pure {\n require(keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")), \"Copy 0 bytes\");\n require(keccak256(bytes(\"hello\".substring(0, 4))) == keccak256(bytes(\"hell\")), \"Copy substring\");\n require(keccak256(bytes(\"hello\".substring(1, 4))) == keccak256(bytes(\"ello\")), \"Copy substring\");\n require(keccak256(bytes(\"hello\".substring(0, 5))) == keccak256(bytes(\"hello\")), \"Copy whole string\");\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) == bytes32(0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000), \"readBytes20\");\n }\n\n function testReadBytes32() public pure {\n require(\"0123456789abcdef0123456789abcdef\".readBytes32(0) == bytes32(0x3031323334353637383961626364656630313233343536373839616263646566), \"readBytes32\");\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")), \"Decode 'a'\");\n require(\"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")), \"Decode 'aa'\");\n require(\"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")), \"Decode 'aaa'\");\n require(\"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")), \"Decode 'aaaa'\");\n require(\"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")), \"Decode 'aaaaa'\");\n require(\"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")), \"Decode 'aaaaa' lowercase\");\n require(\"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(0, 42) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")), \"Decode alphabet\");\n require(\"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(0, 42) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")), \"Decode alphabet lowercase\");\n require(\"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\".base32HexDecodeWord(0, 52) == bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"), \"Decode 32*'a'\");\n require(\" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\".base32HexDecodeWord(1, 32) == bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"), \"Decode real bytes32hex\");\n }\n}" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex'00'.nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex'0361626300'.nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex'0361626300'.nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex'00'.labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex'016100'.labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(hex'016201610000'.labelCount(0) == 2, \"labelCount('b.a.') == 2\");\n require(hex'066574686c61620378797a00'.labelCount(6 +1) == 1, \"nameLength('(bthlab).xyz.') == 6\");\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes memory rrs = hex'0161000001000100000e1000047400000101620161000001000100000e100004c0a80101';\n bytes[2] memory names = [bytes(hex'016100'), bytes(hex'0162016100')];\n bytes[2] memory rdatas = [bytes(hex'74000001'), bytes(hex'c0a80101')];\n uint i = 0;\n for(RRUtils.RRIterator memory iter = rrs.iterateRRs(0); !iter.done(); iter.next()) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(keccak256(iter.name()) == keccak256(names[i]), \"Name matches\");\n require(keccak256(iter.rdata()) == keccak256(rdatas[i]), \"Rdata matches\");\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex'066274686c61620378797a00';\n bytes memory ethLabXyz = hex'066574686c61620378797a00';\n bytes memory xyz = hex'0378797a00';\n bytes memory a_b_c = hex'01610162016300';\n bytes memory b_b_c = hex'01620162016300';\n bytes memory c = hex'016300';\n bytes memory d = hex'016400';\n bytes memory a_d_c = hex'01610164016300';\n bytes memory b_a_c = hex'01620161016300';\n bytes memory ab_c_d = hex'0261620163016400';\n bytes memory a_c_d = hex'01610163016400';\n bytes memory verylong1_eth = hex'223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800';\n bytes memory verylong2_eth = hex'2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800';\n\n require(hex'0301616100'.compareNames(hex'0302616200') < 0, \"label lengths are correctly checked\");\n require(a_b_c.compareNames(c) > 0, \"one name has a difference of >1 label to with the same root name\");\n require(a_b_c.compareNames(d) < 0, \"one name has a difference of >1 label to with different root name\");\n require(a_b_c.compareNames(a_d_c) < 0, \"two names start the same but have differences in later labels\");\n require(a_b_c.compareNames(b_a_c) > 0, \"the first label sorts later, but the first label sorts earlier\");\n require(ab_c_d.compareNames(a_c_d) > 0, \"two names where the first label on one is a prefix of the first label on the other\");\n require(a_b_c.compareNames(b_b_c) < 0, \"two names where the first label on one is a prefix of the first label on the other\");\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(bthLabXyz.compareNames(ethLabXyz) < 0, \"bthLab.xyz comes before ethLab.xyz\");\n require(bthLabXyz.compareNames(bthLabXyz) == 0, \"bthLab.xyz and bthLab.xyz are the same\");\n require(ethLabXyz.compareNames(bthLabXyz) > 0, \"ethLab.xyz comes after bethLab.xyz\");\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(verylong1_eth.compareNames(verylong2_eth) > 0, \"longa.vlong.eth comes after long.vlong.eth\");\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA), \"0x11111111 >= 0xAAAAAAAA\");\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(hex'0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d'.computeKeytag() == 19036, \"Invalid keytag\");\n require(hex'010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf'.computeKeytag() == 21693, \"Invalid keytag (2)\");\n require(hex'0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3'.computeKeytag() == 33630);\n require(hex'0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5'.computeKeytag() == 20326, \"Invalid keytag (3)\");\n }\n}" + }, + "test/registry/mocks/DummyResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyResolver {\n\n mapping (bytes32 => string) public name;\n\n function setName(bytes32 node, string memory _name) public {\n name[node] = _name;\n }\n}\n" + }, + "test/utils/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata, /* name */\n bytes calldata data\n ) external view returns (bytes memory, address) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function resolveCallback(bytes calldata response, bytes calldata extraData)\n external\n view\n returns (bytes memory)\n {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n if (bytes4(extraData) == bytes4(keccak256(\"name(bytes32)\"))) {\n return abi.encode(\"offchain.test.eth\");\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "test/utils/mocks/LegacyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\ncontract LegacyResolver {\n function addr(bytes32 /* node */) public view returns(address) {\n return address(this);\n }\n}\n" + }, + "test/utils/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10**uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10**uint256(decimals()));\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 2500 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/.chainId b/solidity/dns-contracts/deployments/holesky/.chainId new file mode 100644 index 0000000..029d1a3 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/.chainId @@ -0,0 +1 @@ +17000 \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/.migrations.json b/solidity/dns-contracts/deployments/holesky/.migrations.json new file mode 100644 index 0000000..c3e369c --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/.migrations.json @@ -0,0 +1,8 @@ +{ + "ens": 1706105273, + "root": 1706105283, + "setupRoot": 1706126500, + "legacy-resolver": 1706280881, + "legacy-controller": 1706280916, + "bulk-renewal": 1706281169 +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/BaseRegistrarImplementation.json b/solidity/dns-contracts/deployments/holesky/BaseRegistrarImplementation.json new file mode 100644 index 0000000..1506ba4 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/BaseRegistrarImplementation.json @@ -0,0 +1,1013 @@ +{ + "address": "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_baseNode", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "ControllerAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "ControllerRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameMigrated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRenewed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "GRACE_PERIOD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "addController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "available", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "baseNode", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "nameExpires", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "reclaim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "register", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "registerOnly", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "removeController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xdb9bedd608455569ff4c343175dd4856cbd6b07aae9249185a08fed58a26d088", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85", + "transactionIndex": 13, + "gasUsed": "1878925", + "logsBloom": "0x00000000000000000000000000000000000000000000200000800000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000004001000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000", + "blockHash": "0xc4516ade859ed1471d7c6f00530c1fe298bbb23668c1162c49a8f74cbbf75bb1", + "transactionHash": "0xdb9bedd608455569ff4c343175dd4856cbd6b07aae9249185a08fed58a26d088", + "logs": [ + { + "transactionIndex": 13, + "blockNumber": 801686, + "transactionHash": "0xdb9bedd608455569ff4c343175dd4856cbd6b07aae9249185a08fed58a26d088", + "address": "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8" + ], + "data": "0x", + "logIndex": 1279, + "blockHash": "0xc4516ade859ed1471d7c6f00530c1fe298bbb23668c1162c49a8f74cbbf75bb1" + } + ], + "blockNumber": 801686, + "cumulativeGasUsed": "6597194", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae" + ], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_baseNode\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"ControllerAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"ControllerRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameMigrated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameRenewed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"GRACE_PERIOD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"addController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"available\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"baseNode\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"nameExpires\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"reclaim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"register\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"registerOnly\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"removeController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"renew\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"approve(address,uint256)\":{\"details\":\"See {IERC721-approve}.\"},\"balanceOf(address)\":{\"details\":\"See {IERC721-balanceOf}.\"},\"getApproved(uint256)\":{\"details\":\"See {IERC721-getApproved}.\"},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC721-isApprovedForAll}.\"},\"name()\":{\"details\":\"See {IERC721Metadata-name}.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"ownerOf(uint256)\":{\"details\":\"Gets the owner of the specified token ID. Names become unowned when their registration expires.\",\"params\":{\"tokenId\":\"uint256 ID of the token to query the owner of\"},\"returns\":{\"_0\":\"address currently marked as the owner of the given token ID\"}},\"reclaim(uint256,address)\":{\"details\":\"Reclaim ownership of a name in ENS, if you own it in the registrar.\"},\"register(uint256,address,uint256)\":{\"details\":\"Register a name.\",\"params\":{\"duration\":\"Duration in seconds for the registration.\",\"id\":\"The token ID (keccak256 of the label).\",\"owner\":\"The address that should own the registration.\"}},\"registerOnly(uint256,address,uint256)\":{\"details\":\"Register a name, without modifying the registry.\",\"params\":{\"duration\":\"Duration in seconds for the registration.\",\"id\":\"The token ID (keccak256 of the label).\",\"owner\":\"The address that should own the registration.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"safeTransferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-safeTransferFrom}.\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"details\":\"See {IERC721-safeTransferFrom}.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC721-setApprovalForAll}.\"},\"symbol()\":{\"details\":\"See {IERC721Metadata-symbol}.\"},\"tokenURI(uint256)\":{\"details\":\"See {IERC721Metadata-tokenURI}.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-transferFrom}.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/BaseRegistrarImplementation.sol\":\"BaseRegistrarImplementation\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/ERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721.sol\\\";\\nimport \\\"./IERC721Receiver.sol\\\";\\nimport \\\"./extensions/IERC721Metadata.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\nimport \\\"../../utils/Strings.sol\\\";\\nimport \\\"../../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\n * {ERC721Enumerable}.\\n */\\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\\n using Address for address;\\n using Strings for uint256;\\n\\n // Token name\\n string private _name;\\n\\n // Token symbol\\n string private _symbol;\\n\\n // Mapping from token ID to owner address\\n mapping(uint256 => address) private _owners;\\n\\n // Mapping owner address to token count\\n mapping(address => uint256) private _balances;\\n\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) private _tokenApprovals;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IERC721).interfaceId ||\\n interfaceId == type(IERC721Metadata).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721-balanceOf}.\\n */\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\n return _balances[owner];\\n }\\n\\n /**\\n * @dev See {IERC721-ownerOf}.\\n */\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\n address owner = _ownerOf(tokenId);\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n _requireMinted(tokenId);\\n\\n string memory baseURI = _baseURI();\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\n }\\n\\n /**\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\n * by default, can be overridden in child contracts.\\n */\\n function _baseURI() internal view virtual returns (string memory) {\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual override {\\n address owner = ERC721.ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\n _requireMinted(tokenId);\\n\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC721-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC721-isApprovedForAll}.\\n */\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[owner][operator];\\n }\\n\\n /**\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n _safeTransfer(from, to, tokenId, data);\\n }\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\n *\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\\n _transfer(from, to, tokenId);\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n }\\n\\n /**\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\n }\\n\\n /**\\n * @dev Returns whether `tokenId` exists.\\n *\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\n *\\n * Tokens start existing when they are minted (`_mint`),\\n * and stop existing when they are burned (`_burn`).\\n */\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\n return _ownerOf(tokenId) != address(0);\\n }\\n\\n /**\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\n address owner = ERC721.ownerOf(tokenId);\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\n }\\n\\n /**\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\n _safeMint(to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\n */\\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\\n _mint(to, tokenId);\\n require(\\n _checkOnERC721Received(address(0), to, tokenId, data),\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\n );\\n }\\n\\n /**\\n * @dev Mints `tokenId` and transfers it to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - `to` cannot be the zero address.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _mint(address to, uint256 tokenId) internal virtual {\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n _beforeTokenTransfer(address(0), to, tokenId, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _burn(uint256 tokenId) internal virtual {\\n address owner = ERC721.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\n }\\n\\n /**\\n * @dev Transfers `tokenId` from `from` to `to`.\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, tokenId, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Reverts if the `tokenId` has not been minted yet.\\n */\\n function _requireMinted(uint256 tokenId) internal view virtual {\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\n }\\n\\n /**\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\n * The call is not executed if the target address is not a contract.\\n *\\n * @param from address representing the previous owner of the given token ID\\n * @param to target address that will receive the tokens\\n * @param tokenId uint256 ID of the token to be transferred\\n * @param data bytes optional data to send along with the call\\n * @return bool whether the call correctly returned the expected magic value\\n */\\n function _checkOnERC721Received(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) private returns (bool) {\\n if (to.isContract()) {\\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721Receiver.onERC721Received.selector;\\n } catch (bytes memory reason) {\\n if (reason.length == 0) {\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n } else {\\n /// @solidity memory-safe-assembly\\n assembly {\\n revert(add(32, reason), mload(reason))\\n }\\n }\\n }\\n } else {\\n return true;\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\n }\\n}\\n\",\"keccak256\":\"0x2c309e7df9e05e6ce15bedfe74f3c61b467fc37e0fae9eab496acf5ea0bbd7ff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721Metadata is IERC721 {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/ethregistrar/BaseRegistrarImplementation.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/ERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\\n // A map of expiry times\\n mapping(uint256 => uint256) expiries;\\n // The ENS registry\\n ENS public ens;\\n // The namehash of the TLD this registrar owns (eg, .eth)\\n bytes32 public baseNode;\\n // A map of addresses that are authorised to register and renew names.\\n mapping(address => bool) public controllers;\\n uint256 public constant GRACE_PERIOD = 90 days;\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n bytes4 private constant ERC721_ID =\\n bytes4(\\n keccak256(\\\"balanceOf(address)\\\") ^\\n keccak256(\\\"ownerOf(uint256)\\\") ^\\n keccak256(\\\"approve(address,uint256)\\\") ^\\n keccak256(\\\"getApproved(uint256)\\\") ^\\n keccak256(\\\"setApprovalForAll(address,bool)\\\") ^\\n keccak256(\\\"isApprovedForAll(address,address)\\\") ^\\n keccak256(\\\"transferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256,bytes)\\\")\\n );\\n bytes4 private constant RECLAIM_ID =\\n bytes4(keccak256(\\\"reclaim(uint256,address)\\\"));\\n\\n /**\\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\\n * @dev Returns whether the given spender can transfer a given token ID\\n * @param spender address of the spender to query\\n * @param tokenId uint256 ID of the token to be transferred\\n * @return bool whether the msg.sender is approved for the given token ID,\\n * is an operator of the owner, or is the owner of the token\\n */\\n function _isApprovedOrOwner(\\n address spender,\\n uint256 tokenId\\n ) internal view override returns (bool) {\\n address owner = ownerOf(tokenId);\\n return (spender == owner ||\\n getApproved(tokenId) == spender ||\\n isApprovedForAll(owner, spender));\\n }\\n\\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\\\"\\\", \\\"\\\") {\\n ens = _ens;\\n baseNode = _baseNode;\\n }\\n\\n modifier live() {\\n require(ens.owner(baseNode) == address(this));\\n _;\\n }\\n\\n modifier onlyController() {\\n require(controllers[msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Gets the owner of the specified token ID. Names become unowned\\n * when their registration expires.\\n * @param tokenId uint256 ID of the token to query the owner of\\n * @return address currently marked as the owner of the given token ID\\n */\\n function ownerOf(\\n uint256 tokenId\\n ) public view override(IERC721, ERC721) returns (address) {\\n require(expiries[tokenId] > block.timestamp);\\n return super.ownerOf(tokenId);\\n }\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external override onlyOwner {\\n controllers[controller] = true;\\n emit ControllerAdded(controller);\\n }\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external override onlyOwner {\\n controllers[controller] = false;\\n emit ControllerRemoved(controller);\\n }\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external override onlyOwner {\\n ens.setResolver(baseNode, resolver);\\n }\\n\\n // Returns the expiration timestamp of the specified id.\\n function nameExpires(uint256 id) external view override returns (uint256) {\\n return expiries[id];\\n }\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) public view override returns (bool) {\\n // Not available if it's registered here or in its grace period.\\n return expiries[id] + GRACE_PERIOD < block.timestamp;\\n }\\n\\n /**\\n * @dev Register a name.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external override returns (uint256) {\\n return _register(id, owner, duration, true);\\n }\\n\\n /**\\n * @dev Register a name, without modifying the registry.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function registerOnly(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256) {\\n return _register(id, owner, duration, false);\\n }\\n\\n function _register(\\n uint256 id,\\n address owner,\\n uint256 duration,\\n bool updateRegistry\\n ) internal live onlyController returns (uint256) {\\n require(available(id));\\n require(\\n block.timestamp + duration + GRACE_PERIOD >\\n block.timestamp + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] = block.timestamp + duration;\\n if (_exists(id)) {\\n // Name was previously owned, and expired\\n _burn(id);\\n }\\n _mint(owner, id);\\n if (updateRegistry) {\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n emit NameRegistered(id, owner, block.timestamp + duration);\\n\\n return block.timestamp + duration;\\n }\\n\\n function renew(\\n uint256 id,\\n uint256 duration\\n ) external override live onlyController returns (uint256) {\\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\\n require(\\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] += duration;\\n emit NameRenewed(id, expiries[id]);\\n return expiries[id];\\n }\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external override live {\\n require(_isApprovedOrOwner(msg.sender, id));\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view override(ERC721, IERC165) returns (bool) {\\n return\\n interfaceID == INTERFACE_META_ID ||\\n interfaceID == ERC721_ID ||\\n interfaceID == RECLAIM_ID;\\n }\\n}\\n\",\"keccak256\":\"0xaee6eb36aead449d397b86a02e9c63bc46e3ef378d0a62bfd68beaae1150c9d0\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506040516200225538038062002255833981016040819052620000349162000109565b60408051602080820183526000808352835191820190935282815290916200005d8382620001ea565b5060016200006c8282620001ea565b5050506200008962000083620000b360201b60201c565b620000b7565b600880546001600160a01b0319166001600160a01b039390931692909217909155600955620002b6565b3390565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600080604083850312156200011d57600080fd5b82516001600160a01b03811681146200013557600080fd5b6020939093015192949293505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200017057607f821691505b6020821081036200019157634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620001e557600081815260208120601f850160051c81016020861015620001c05750805b601f850160051c820191505b81811015620001e157828155600101620001cc565b5050505b505050565b81516001600160401b0381111562000206576200020662000145565b6200021e816200021784546200015b565b8462000197565b602080601f8311600181146200025657600084156200023d5750858301515b600019600386901b1c1916600185901b178555620001e1565b600085815260208120601f198616915b82811015620002875788860151825594840194600190910190840162000266565b5085821015620002a65787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b611f8f80620002c66000396000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c806395d89b4111610104578063c87b56dd116100a2578063e985e9c511610071578063e985e9c5146103e0578063f2fde38b1461041c578063f6a74ed71461042f578063fca247ac1461044257600080fd5b8063c87b56dd14610381578063d6e4fa8614610394578063da8c229e146103b4578063ddf7fcb0146103d757600080fd5b8063a7fc7a07116100de578063a7fc7a071461033e578063b88d4fde14610351578063c1a287e214610364578063c475abff1461036e57600080fd5b806395d89b411461031057806396e494e814610318578063a22cb4651461032b57600080fd5b80633f15457f116101715780636352211e1161014b5780636352211e146102d157806370a08231146102e4578063715018a6146102f75780638da5cb5b146102ff57600080fd5b80633f15457f1461029857806342842e0e146102ab5780634e543b26146102be57600080fd5b8063095ea7b3116101ad578063095ea7b31461023c5780630e297b451461025157806323b872dd1461027257806328ed4f6c1461028557600080fd5b806301ffc9a7146101d457806306fdde03146101fc578063081812fc14610211575b600080fd5b6101e76101e2366004611b38565b610455565b60405190151581526020015b60405180910390f35b6102046104f2565b6040516101f39190611ba5565b61022461021f366004611bb8565b610584565b6040516001600160a01b0390911681526020016101f3565b61024f61024a366004611be6565b6105ab565b005b61026461025f366004611c12565b6106e1565b6040519081526020016101f3565b61024f610280366004611c4a565b6106f8565b61024f610293366004611c7a565b61077f565b600854610224906001600160a01b031681565b61024f6102b9366004611c4a565b610898565b61024f6102cc366004611caa565b6108b3565b6102246102df366004611bb8565b610941565b6102646102f2366004611caa565b610964565b61024f6109fe565b6006546001600160a01b0316610224565b610204610a12565b6101e7610326366004611bb8565b610a21565b61024f610339366004611cc7565b610a47565b61024f61034c366004611caa565b610a56565b61024f61035f366004611d10565b610aaa565b6102646276a70081565b61026461037c366004611df0565b610b38565b61020461038f366004611bb8565b610cc9565b6102646103a2366004611bb8565b60009081526007602052604090205490565b6101e76103c2366004611caa565b600a6020526000908152604090205460ff1681565b61026460095481565b6101e76103ee366004611e12565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61024f61042a366004611caa565b610d3d565b61024f61043d366004611caa565b610dcd565b610264610450366004611c12565b610e1e565b60006001600160e01b031982167f01ffc9a70000000000000000000000000000000000000000000000000000000014806104b857506001600160e01b031982167f80ac58cd00000000000000000000000000000000000000000000000000000000145b806104ec57506001600160e01b031982167f28ed4f6c00000000000000000000000000000000000000000000000000000000145b92915050565b60606000805461050190611e40565b80601f016020809104026020016040519081016040528092919081815260200182805461052d90611e40565b801561057a5780601f1061054f5761010080835404028352916020019161057a565b820191906000526020600020905b81548152906001019060200180831161055d57829003601f168201915b5050505050905090565b600061058f82610e2d565b506000908152600460205260409020546001600160a01b031690565b60006105b682610e91565b9050806001600160a01b0316836001600160a01b0316036106445760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b0382161480610660575061066081336103ee565b6106d25760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161063b565b6106dc8383610ef6565b505050565b60006106f08484846000610f71565b949350505050565b6107023382611181565b6107745760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f76656400000000000000000000000000000000000000606482015260840161063b565b6106dc8383836111fc565b6008546009546040516302571be360e01b8152600481019190915230916001600160a01b0316906302571be390602401602060405180830381865afa1580156107cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f09190611e7a565b6001600160a01b03161461080357600080fd5b61080d3383611181565b61081657600080fd5b6008546009546040516306ab592360e01b81526004810191909152602481018490526001600160a01b038381166044830152909116906306ab5923906064016020604051808303816000875af1158015610874573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106dc9190611e97565b6106dc83838360405180602001604052806000815250610aaa565b6108bb611402565b6008546009546040517f1896f70a00000000000000000000000000000000000000000000000000000000815260048101919091526001600160a01b03838116602483015290911690631896f70a90604401600060405180830381600087803b15801561092657600080fd5b505af115801561093a573d6000803e3d6000fd5b5050505050565b600081815260076020526040812054421061095b57600080fd5b6104ec82610e91565b60006001600160a01b0382166109e25760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e65720000000000000000000000000000000000000000000000606482015260840161063b565b506001600160a01b031660009081526003602052604090205490565b610a06611402565b610a10600061145c565b565b60606001805461050190611e40565b6000818152600760205260408120544290610a40906276a70090611eb0565b1092915050565b610a523383836114bb565b5050565b610a5e611402565b6001600160a01b0381166000818152600a6020526040808220805460ff19166001179055517f0a8bb31534c0ed46f380cb867bd5c803a189ced9a764e30b3a4991a9901d74749190a250565b610ab43383611181565b610b265760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f76656400000000000000000000000000000000000000606482015260840161063b565b610b3284848484611589565b50505050565b6008546009546040516302571be360e01b8152600481019190915260009130916001600160a01b03909116906302571be390602401602060405180830381865afa158015610b8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bae9190611e7a565b6001600160a01b031614610bc157600080fd5b336000908152600a602052604090205460ff16610bdd57600080fd5b6000838152600760205260409020544290610bfc906276a70090611eb0565b1015610c0757600080fd5b610c146276a70083611eb0565b6000848152600760205260409020546276a70090610c33908590611eb0565b610c3d9190611eb0565b11610c4757600080fd5b60008381526007602052604081208054849290610c65908490611eb0565b90915550506000838152600760205260409081902054905184917f9b87a00e30f1ac65d898f070f8a3488fe60517182d0a2098e1b4b93a54aa9bd691610cad91815260200190565b60405180910390a2505060009081526007602052604090205490565b6060610cd482610e2d565b6000610ceb60408051602081019091526000815290565b90506000815111610d0b5760405180602001604052806000815250610d36565b80610d1584611612565b604051602001610d26929190611ed1565b6040516020818303038152906040525b9392505050565b610d45611402565b6001600160a01b038116610dc15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161063b565b610dca8161145c565b50565b610dd5611402565b6001600160a01b0381166000818152600a6020526040808220805460ff19169055517f33d83959be2573f5453b12eb9d43b3499bc57d96bd2f067ba44803c859e811139190a250565b60006106f08484846001610f71565b6000818152600260205260409020546001600160a01b0316610dca5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161063b565b6000818152600260205260408120546001600160a01b0316806104ec5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161063b565b6000818152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091558190610f3882610e91565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6008546009546040516302571be360e01b8152600481019190915260009130916001600160a01b03909116906302571be390602401602060405180830381865afa158015610fc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe79190611e7a565b6001600160a01b031614610ffa57600080fd5b336000908152600a602052604090205460ff1661101657600080fd5b61101f85610a21565b61102857600080fd5b6110356276a70042611eb0565b6276a7006110438542611eb0565b61104d9190611eb0565b1161105757600080fd5b6110618342611eb0565b6000868152600760209081526040808320939093556002905220546001600160a01b03161561109357611093856116b2565b61109d8486611754565b8115611127576008546009546040516306ab592360e01b81526004810191909152602481018790526001600160a01b038681166044830152909116906306ab5923906064016020604051808303816000875af1158015611101573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111259190611e97565b505b6001600160a01b038416857fb3d987963d01b2f68493b4bdb130988f157ea43070d4ad840fee0466ed9370d961115d8642611eb0565b60405190815260200160405180910390a36111788342611eb0565b95945050505050565b60008061118d83610941565b9050806001600160a01b0316846001600160a01b031614806111c85750836001600160a01b03166111bd84610584565b6001600160a01b0316145b806106f057506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff166106f0565b826001600160a01b031661120f82610e91565b6001600160a01b0316146112735760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161063b565b6001600160a01b0382166112ee5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161063b565b826001600160a01b031661130182610e91565b6001600160a01b0316146113655760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161063b565b6000818152600460209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6006546001600160a01b03163314610a105760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161063b565b600680546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b03160361151c5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161063b565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6115948484846111fc565b6115a0848484846118ec565b610b325760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161063b565b6060600061161f83611a40565b600101905060008167ffffffffffffffff81111561163f5761163f611cfa565b6040519080825280601f01601f191660200182016040528015611669576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a850494508461167357509392505050565b60006116bd82610e91565b90506116c882610e91565b6000838152600460209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b0385168085526003845282852080546000190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6001600160a01b0382166117aa5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161063b565b6000818152600260205260409020546001600160a01b03161561180f5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161063b565b6000818152600260205260409020546001600160a01b0316156118745760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161063b565b6001600160a01b0382166000818152600360209081526040808320805460010190558483526002909152808220805473ffffffffffffffffffffffffffffffffffffffff19168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160a01b0384163b15611a3857604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611930903390899088908890600401611f00565b6020604051808303816000875af192505050801561196b575060408051601f3d908101601f1916820190925261196891810190611f3c565b60015b611a1e573d808015611999576040519150601f19603f3d011682016040523d82523d6000602084013e61199e565b606091505b508051600003611a165760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161063b565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506106f0565b5060016106f0565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310611a89577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310611ab5576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310611ad357662386f26fc10000830492506010015b6305f5e1008310611aeb576305f5e100830492506008015b6127108310611aff57612710830492506004015b60648310611b11576064830492506002015b600a83106104ec5760010192915050565b6001600160e01b031981168114610dca57600080fd5b600060208284031215611b4a57600080fd5b8135610d3681611b22565b60005b83811015611b70578181015183820152602001611b58565b50506000910152565b60008151808452611b91816020860160208601611b55565b601f01601f19169290920160200192915050565b602081526000610d366020830184611b79565b600060208284031215611bca57600080fd5b5035919050565b6001600160a01b0381168114610dca57600080fd5b60008060408385031215611bf957600080fd5b8235611c0481611bd1565b946020939093013593505050565b600080600060608486031215611c2757600080fd5b833592506020840135611c3981611bd1565b929592945050506040919091013590565b600080600060608486031215611c5f57600080fd5b8335611c6a81611bd1565b92506020840135611c3981611bd1565b60008060408385031215611c8d57600080fd5b823591506020830135611c9f81611bd1565b809150509250929050565b600060208284031215611cbc57600080fd5b8135610d3681611bd1565b60008060408385031215611cda57600080fd5b8235611ce581611bd1565b915060208301358015158114611c9f57600080fd5b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215611d2657600080fd5b8435611d3181611bd1565b93506020850135611d4181611bd1565b925060408501359150606085013567ffffffffffffffff80821115611d6557600080fd5b818701915087601f830112611d7957600080fd5b813581811115611d8b57611d8b611cfa565b604051601f8201601f19908116603f01168101908382118183101715611db357611db3611cfa565b816040528281528a6020848701011115611dcc57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215611e0357600080fd5b50508035926020909101359150565b60008060408385031215611e2557600080fd5b8235611e3081611bd1565b91506020830135611c9f81611bd1565b600181811c90821680611e5457607f821691505b602082108103611e7457634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611e8c57600080fd5b8151610d3681611bd1565b600060208284031215611ea957600080fd5b5051919050565b808201808211156104ec57634e487b7160e01b600052601160045260246000fd5b60008351611ee3818460208801611b55565b835190830190611ef7818360208801611b55565b01949350505050565b60006001600160a01b03808716835280861660208401525083604083015260806060830152611f326080830184611b79565b9695505050505050565b600060208284031215611f4e57600080fd5b8151610d3681611b2256fea26469706673582212208c07df29d25230f9c64787f8662397759693692551fde4e6289b85abb25e0f1d64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c806395d89b4111610104578063c87b56dd116100a2578063e985e9c511610071578063e985e9c5146103e0578063f2fde38b1461041c578063f6a74ed71461042f578063fca247ac1461044257600080fd5b8063c87b56dd14610381578063d6e4fa8614610394578063da8c229e146103b4578063ddf7fcb0146103d757600080fd5b8063a7fc7a07116100de578063a7fc7a071461033e578063b88d4fde14610351578063c1a287e214610364578063c475abff1461036e57600080fd5b806395d89b411461031057806396e494e814610318578063a22cb4651461032b57600080fd5b80633f15457f116101715780636352211e1161014b5780636352211e146102d157806370a08231146102e4578063715018a6146102f75780638da5cb5b146102ff57600080fd5b80633f15457f1461029857806342842e0e146102ab5780634e543b26146102be57600080fd5b8063095ea7b3116101ad578063095ea7b31461023c5780630e297b451461025157806323b872dd1461027257806328ed4f6c1461028557600080fd5b806301ffc9a7146101d457806306fdde03146101fc578063081812fc14610211575b600080fd5b6101e76101e2366004611b38565b610455565b60405190151581526020015b60405180910390f35b6102046104f2565b6040516101f39190611ba5565b61022461021f366004611bb8565b610584565b6040516001600160a01b0390911681526020016101f3565b61024f61024a366004611be6565b6105ab565b005b61026461025f366004611c12565b6106e1565b6040519081526020016101f3565b61024f610280366004611c4a565b6106f8565b61024f610293366004611c7a565b61077f565b600854610224906001600160a01b031681565b61024f6102b9366004611c4a565b610898565b61024f6102cc366004611caa565b6108b3565b6102246102df366004611bb8565b610941565b6102646102f2366004611caa565b610964565b61024f6109fe565b6006546001600160a01b0316610224565b610204610a12565b6101e7610326366004611bb8565b610a21565b61024f610339366004611cc7565b610a47565b61024f61034c366004611caa565b610a56565b61024f61035f366004611d10565b610aaa565b6102646276a70081565b61026461037c366004611df0565b610b38565b61020461038f366004611bb8565b610cc9565b6102646103a2366004611bb8565b60009081526007602052604090205490565b6101e76103c2366004611caa565b600a6020526000908152604090205460ff1681565b61026460095481565b6101e76103ee366004611e12565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61024f61042a366004611caa565b610d3d565b61024f61043d366004611caa565b610dcd565b610264610450366004611c12565b610e1e565b60006001600160e01b031982167f01ffc9a70000000000000000000000000000000000000000000000000000000014806104b857506001600160e01b031982167f80ac58cd00000000000000000000000000000000000000000000000000000000145b806104ec57506001600160e01b031982167f28ed4f6c00000000000000000000000000000000000000000000000000000000145b92915050565b60606000805461050190611e40565b80601f016020809104026020016040519081016040528092919081815260200182805461052d90611e40565b801561057a5780601f1061054f5761010080835404028352916020019161057a565b820191906000526020600020905b81548152906001019060200180831161055d57829003601f168201915b5050505050905090565b600061058f82610e2d565b506000908152600460205260409020546001600160a01b031690565b60006105b682610e91565b9050806001600160a01b0316836001600160a01b0316036106445760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b0382161480610660575061066081336103ee565b6106d25760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161063b565b6106dc8383610ef6565b505050565b60006106f08484846000610f71565b949350505050565b6107023382611181565b6107745760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f76656400000000000000000000000000000000000000606482015260840161063b565b6106dc8383836111fc565b6008546009546040516302571be360e01b8152600481019190915230916001600160a01b0316906302571be390602401602060405180830381865afa1580156107cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f09190611e7a565b6001600160a01b03161461080357600080fd5b61080d3383611181565b61081657600080fd5b6008546009546040516306ab592360e01b81526004810191909152602481018490526001600160a01b038381166044830152909116906306ab5923906064016020604051808303816000875af1158015610874573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106dc9190611e97565b6106dc83838360405180602001604052806000815250610aaa565b6108bb611402565b6008546009546040517f1896f70a00000000000000000000000000000000000000000000000000000000815260048101919091526001600160a01b03838116602483015290911690631896f70a90604401600060405180830381600087803b15801561092657600080fd5b505af115801561093a573d6000803e3d6000fd5b5050505050565b600081815260076020526040812054421061095b57600080fd5b6104ec82610e91565b60006001600160a01b0382166109e25760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e65720000000000000000000000000000000000000000000000606482015260840161063b565b506001600160a01b031660009081526003602052604090205490565b610a06611402565b610a10600061145c565b565b60606001805461050190611e40565b6000818152600760205260408120544290610a40906276a70090611eb0565b1092915050565b610a523383836114bb565b5050565b610a5e611402565b6001600160a01b0381166000818152600a6020526040808220805460ff19166001179055517f0a8bb31534c0ed46f380cb867bd5c803a189ced9a764e30b3a4991a9901d74749190a250565b610ab43383611181565b610b265760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f76656400000000000000000000000000000000000000606482015260840161063b565b610b3284848484611589565b50505050565b6008546009546040516302571be360e01b8152600481019190915260009130916001600160a01b03909116906302571be390602401602060405180830381865afa158015610b8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bae9190611e7a565b6001600160a01b031614610bc157600080fd5b336000908152600a602052604090205460ff16610bdd57600080fd5b6000838152600760205260409020544290610bfc906276a70090611eb0565b1015610c0757600080fd5b610c146276a70083611eb0565b6000848152600760205260409020546276a70090610c33908590611eb0565b610c3d9190611eb0565b11610c4757600080fd5b60008381526007602052604081208054849290610c65908490611eb0565b90915550506000838152600760205260409081902054905184917f9b87a00e30f1ac65d898f070f8a3488fe60517182d0a2098e1b4b93a54aa9bd691610cad91815260200190565b60405180910390a2505060009081526007602052604090205490565b6060610cd482610e2d565b6000610ceb60408051602081019091526000815290565b90506000815111610d0b5760405180602001604052806000815250610d36565b80610d1584611612565b604051602001610d26929190611ed1565b6040516020818303038152906040525b9392505050565b610d45611402565b6001600160a01b038116610dc15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161063b565b610dca8161145c565b50565b610dd5611402565b6001600160a01b0381166000818152600a6020526040808220805460ff19169055517f33d83959be2573f5453b12eb9d43b3499bc57d96bd2f067ba44803c859e811139190a250565b60006106f08484846001610f71565b6000818152600260205260409020546001600160a01b0316610dca5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161063b565b6000818152600260205260408120546001600160a01b0316806104ec5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161063b565b6000818152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091558190610f3882610e91565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6008546009546040516302571be360e01b8152600481019190915260009130916001600160a01b03909116906302571be390602401602060405180830381865afa158015610fc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe79190611e7a565b6001600160a01b031614610ffa57600080fd5b336000908152600a602052604090205460ff1661101657600080fd5b61101f85610a21565b61102857600080fd5b6110356276a70042611eb0565b6276a7006110438542611eb0565b61104d9190611eb0565b1161105757600080fd5b6110618342611eb0565b6000868152600760209081526040808320939093556002905220546001600160a01b03161561109357611093856116b2565b61109d8486611754565b8115611127576008546009546040516306ab592360e01b81526004810191909152602481018790526001600160a01b038681166044830152909116906306ab5923906064016020604051808303816000875af1158015611101573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111259190611e97565b505b6001600160a01b038416857fb3d987963d01b2f68493b4bdb130988f157ea43070d4ad840fee0466ed9370d961115d8642611eb0565b60405190815260200160405180910390a36111788342611eb0565b95945050505050565b60008061118d83610941565b9050806001600160a01b0316846001600160a01b031614806111c85750836001600160a01b03166111bd84610584565b6001600160a01b0316145b806106f057506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff166106f0565b826001600160a01b031661120f82610e91565b6001600160a01b0316146112735760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161063b565b6001600160a01b0382166112ee5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161063b565b826001600160a01b031661130182610e91565b6001600160a01b0316146113655760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161063b565b6000818152600460209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6006546001600160a01b03163314610a105760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161063b565b600680546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b03160361151c5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161063b565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6115948484846111fc565b6115a0848484846118ec565b610b325760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161063b565b6060600061161f83611a40565b600101905060008167ffffffffffffffff81111561163f5761163f611cfa565b6040519080825280601f01601f191660200182016040528015611669576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a850494508461167357509392505050565b60006116bd82610e91565b90506116c882610e91565b6000838152600460209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b0385168085526003845282852080546000190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6001600160a01b0382166117aa5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161063b565b6000818152600260205260409020546001600160a01b03161561180f5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161063b565b6000818152600260205260409020546001600160a01b0316156118745760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161063b565b6001600160a01b0382166000818152600360209081526040808320805460010190558483526002909152808220805473ffffffffffffffffffffffffffffffffffffffff19168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160a01b0384163b15611a3857604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611930903390899088908890600401611f00565b6020604051808303816000875af192505050801561196b575060408051601f3d908101601f1916820190925261196891810190611f3c565b60015b611a1e573d808015611999576040519150601f19603f3d011682016040523d82523d6000602084013e61199e565b606091505b508051600003611a165760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161063b565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506106f0565b5060016106f0565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310611a89577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310611ab5576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310611ad357662386f26fc10000830492506010015b6305f5e1008310611aeb576305f5e100830492506008015b6127108310611aff57612710830492506004015b60648310611b11576064830492506002015b600a83106104ec5760010192915050565b6001600160e01b031981168114610dca57600080fd5b600060208284031215611b4a57600080fd5b8135610d3681611b22565b60005b83811015611b70578181015183820152602001611b58565b50506000910152565b60008151808452611b91816020860160208601611b55565b601f01601f19169290920160200192915050565b602081526000610d366020830184611b79565b600060208284031215611bca57600080fd5b5035919050565b6001600160a01b0381168114610dca57600080fd5b60008060408385031215611bf957600080fd5b8235611c0481611bd1565b946020939093013593505050565b600080600060608486031215611c2757600080fd5b833592506020840135611c3981611bd1565b929592945050506040919091013590565b600080600060608486031215611c5f57600080fd5b8335611c6a81611bd1565b92506020840135611c3981611bd1565b60008060408385031215611c8d57600080fd5b823591506020830135611c9f81611bd1565b809150509250929050565b600060208284031215611cbc57600080fd5b8135610d3681611bd1565b60008060408385031215611cda57600080fd5b8235611ce581611bd1565b915060208301358015158114611c9f57600080fd5b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215611d2657600080fd5b8435611d3181611bd1565b93506020850135611d4181611bd1565b925060408501359150606085013567ffffffffffffffff80821115611d6557600080fd5b818701915087601f830112611d7957600080fd5b813581811115611d8b57611d8b611cfa565b604051601f8201601f19908116603f01168101908382118183101715611db357611db3611cfa565b816040528281528a6020848701011115611dcc57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215611e0357600080fd5b50508035926020909101359150565b60008060408385031215611e2557600080fd5b8235611e3081611bd1565b91506020830135611c9f81611bd1565b600181811c90821680611e5457607f821691505b602082108103611e7457634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611e8c57600080fd5b8151610d3681611bd1565b600060208284031215611ea957600080fd5b5051919050565b808201808211156104ec57634e487b7160e01b600052601160045260246000fd5b60008351611ee3818460208801611b55565b835190830190611ef7818360208801611b55565b01949350505050565b60006001600160a01b03808716835280861660208401525083604083015260806060830152611f326080830184611b79565b9695505050505050565b600060208284031215611f4e57600080fd5b8151610d3681611b2256fea26469706673582212208c07df29d25230f9c64787f8662397759693692551fde4e6289b85abb25e0f1d64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "approve(address,uint256)": { + "details": "See {IERC721-approve}." + }, + "balanceOf(address)": { + "details": "See {IERC721-balanceOf}." + }, + "getApproved(uint256)": { + "details": "See {IERC721-getApproved}." + }, + "isApprovedForAll(address,address)": { + "details": "See {IERC721-isApprovedForAll}." + }, + "name()": { + "details": "See {IERC721Metadata-name}." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "ownerOf(uint256)": { + "details": "Gets the owner of the specified token ID. Names become unowned when their registration expires.", + "params": { + "tokenId": "uint256 ID of the token to query the owner of" + }, + "returns": { + "_0": "address currently marked as the owner of the given token ID" + } + }, + "reclaim(uint256,address)": { + "details": "Reclaim ownership of a name in ENS, if you own it in the registrar." + }, + "register(uint256,address,uint256)": { + "details": "Register a name.", + "params": { + "duration": "Duration in seconds for the registration.", + "id": "The token ID (keccak256 of the label).", + "owner": "The address that should own the registration." + } + }, + "registerOnly(uint256,address,uint256)": { + "details": "Register a name, without modifying the registry.", + "params": { + "duration": "Duration in seconds for the registration.", + "id": "The token ID (keccak256 of the label).", + "owner": "The address that should own the registration." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "safeTransferFrom(address,address,uint256)": { + "details": "See {IERC721-safeTransferFrom}." + }, + "safeTransferFrom(address,address,uint256,bytes)": { + "details": "See {IERC721-safeTransferFrom}." + }, + "setApprovalForAll(address,bool)": { + "details": "See {IERC721-setApprovalForAll}." + }, + "symbol()": { + "details": "See {IERC721Metadata-symbol}." + }, + "tokenURI(uint256)": { + "details": "See {IERC721Metadata-tokenURI}." + }, + "transferFrom(address,address,uint256)": { + "details": "See {IERC721-transferFrom}." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 1443, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_name", + "offset": 0, + "slot": "0", + "type": "t_string_storage" + }, + { + "astId": 1445, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_symbol", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 1449, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_owners", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint256,t_address)" + }, + { + "astId": 1453, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_balances", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 1457, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_tokenApprovals", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_uint256,t_address)" + }, + { + "astId": 1463, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_operatorApprovals", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" + }, + { + "astId": 444, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_owner", + "offset": 0, + "slot": "6", + "type": "t_address" + }, + { + "astId": 11408, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "expiries", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 11411, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "ens", + "offset": 0, + "slot": "8", + "type": "t_contract(ENS)14770" + }, + { + "astId": 11413, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "baseNode", + "offset": 0, + "slot": "9", + "type": "t_bytes32" + }, + { + "astId": 11417, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "controllers", + "offset": 0, + "slot": "10", + "type": "t_mapping(t_address,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(ENS)14770": { + "encoding": "inplace", + "label": "contract ENS", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_address)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/DNSRegistrar.json b/solidity/dns-contracts/deployments/holesky/DNSRegistrar.json new file mode 100644 index 0000000..df530d4 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/DNSRegistrar.json @@ -0,0 +1,447 @@ +{ + "address": "0x458d278AEd4cE82BAeC384170f39198b01B8351c", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_previousRegistrar", + "type": "address" + }, + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "contract DNSSEC", + "name": "_dnssec", + "type": "address" + }, + { + "internalType": "contract PublicSuffixList", + "name": "_suffixes", + "type": "address" + }, + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "InvalidPublicSuffix", + "type": "error" + }, + { + "inputs": [], + "name": "NoOwnerRecordFound", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "offset", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "OffsetOutOfBoundsError", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "PermissionDenied", + "type": "error" + }, + { + "inputs": [], + "name": "PreconditionNotMet", + "type": "error" + }, + { + "inputs": [], + "name": "StaleProof", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "dnsname", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "inception", + "type": "uint32" + } + ], + "name": "Claim", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "suffixes", + "type": "address" + } + ], + "name": "NewPublicSuffixList", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "domain", + "type": "bytes" + } + ], + "name": "enableNode", + "outputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "inceptions", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract DNSSEC", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "previousRegistrar", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature[]", + "name": "input", + "type": "tuple[]" + } + ], + "name": "proveAndClaim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature[]", + "name": "input", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "proveAndClaimWithResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "resolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract PublicSuffixList", + "name": "_suffixes", + "type": "address" + } + ], + "name": "setPublicSuffixList", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "suffixes", + "outputs": [ + { + "internalType": "contract PublicSuffixList", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0xf05417d5b3b7c46b9d1c57b0536af5e7aafa509731aa3189dc719f34dc7724ad", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x458d278AEd4cE82BAeC384170f39198b01B8351c", + "transactionIndex": 8, + "gasUsed": "1957892", + "logsBloom": "0x00000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000008000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xf3aecbefa962672c53f66e11d3b4c7c376560e08315c920903268b0f6e600aa9", + "transactionHash": "0xf05417d5b3b7c46b9d1c57b0536af5e7aafa509731aa3189dc719f34dc7724ad", + "logs": [ + { + "transactionIndex": 8, + "blockNumber": 813931, + "transactionHash": "0xf05417d5b3b7c46b9d1c57b0536af5e7aafa509731aa3189dc719f34dc7724ad", + "address": "0x458d278AEd4cE82BAeC384170f39198b01B8351c", + "topics": [ + "0x9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba8" + ], + "data": "0x000000000000000000000000116c21e9b76db1f9f6605db52dd052896803d655", + "logIndex": 0, + "blockHash": "0xf3aecbefa962672c53f66e11d3b4c7c376560e08315c920903268b0f6e600aa9" + } + ], + "blockNumber": 813931, + "cumulativeGasUsed": "2125892", + "status": 1, + "byzantium": true + }, + "args": [ + "0x6810dbce73c67506f785a225f818b30d8f209aab", + "0x7CF33078a37Cee425F1ad149875eE1e4Bdf0aD9B", + "0x283af0b28c62c092c9727f1ee09c02ca627eb7f5", + "0x116C21e9b76DB1f9f6605Db52Dd052896803D655", + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "numDeployments": 2, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_previousRegistrar\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_resolver\",\"type\":\"address\"},{\"internalType\":\"contract DNSSEC\",\"name\":\"_dnssec\",\"type\":\"address\"},{\"internalType\":\"contract PublicSuffixList\",\"name\":\"_suffixes\",\"type\":\"address\"},{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"InvalidPublicSuffix\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoOwnerRecordFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"offset\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"OffsetOutOfBoundsError\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"PermissionDenied\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PreconditionNotMet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StaleProof\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"dnsname\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"inception\",\"type\":\"uint32\"}],\"name\":\"Claim\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"suffixes\",\"type\":\"address\"}],\"name\":\"NewPublicSuffixList\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"domain\",\"type\":\"bytes\"}],\"name\":\"enableNode\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"inceptions\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract DNSSEC\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"previousRegistrar\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature[]\",\"name\":\"input\",\"type\":\"tuple[]\"}],\"name\":\"proveAndClaim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature[]\",\"name\":\"input\",\"type\":\"tuple[]\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"proveAndClaimWithResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"resolver\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract PublicSuffixList\",\"name\":\"_suffixes\",\"type\":\"address\"}],\"name\":\"setPublicSuffixList\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"suffixes\",\"outputs\":[{\"internalType\":\"contract PublicSuffixList\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"An ENS registrar that allows the owner of a DNS name to claim the corresponding name in ENS.\",\"kind\":\"dev\",\"methods\":{\"proveAndClaim(bytes,(bytes,bytes)[])\":{\"details\":\"Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\",\"params\":{\"input\":\"A chain of signed DNS RRSETs ending with a text record.\",\"name\":\"The name to claim, in DNS wire format.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnsregistrar/DNSRegistrar.sol\":\"DNSRegistrar\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-2-Clause\\npragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for appending to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n let fpm := add(32, add(ptr, capacity))\\n if lt(fpm, ptr) {\\n revert(0, 0)\\n }\\n mstore(0x40, fpm)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n uint off = buf.buf.length;\\n uint newCapacity = off + len;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(newCapacity, buflen) {\\n mstore(bufptr, newCapacity)\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return append(buf, data, data.length);\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint offPlusOne = off + 1;\\n if (off >= buf.capacity) {\\n resize(buf, offPlusOne * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if gt(offPlusOne, mload(bufptr)) {\\n mstore(bufptr, offPlusOne)\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return append(buf, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return append(buf, data, 32);\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n return buf;\\n }\\n}\\n\",\"keccak256\":\"0xd6dd3b0b327288f8e1b711a609f4040fea602e2ad4bba9febdf2f33b4e56eb0c\",\"license\":\"BSD-2-Clause\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/dnsregistrar/DNSClaimChecker.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"../dnssec-oracle/DNSSEC.sol\\\";\\nimport \\\"../dnssec-oracle/BytesUtils.sol\\\";\\nimport \\\"../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"../utils/HexUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\nlibrary DNSClaimChecker {\\n using BytesUtils for bytes;\\n using HexUtils for bytes;\\n using RRUtils for *;\\n using Buffer for Buffer.buffer;\\n\\n uint16 constant CLASS_INET = 1;\\n uint16 constant TYPE_TXT = 16;\\n\\n function getOwnerAddress(\\n bytes memory name,\\n bytes memory data\\n ) internal pure returns (address, bool) {\\n // Add \\\"_ens.\\\" to the front of the name.\\n Buffer.buffer memory buf;\\n buf.init(name.length + 5);\\n buf.append(\\\"\\\\x04_ens\\\");\\n buf.append(name);\\n\\n for (\\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\\n !iter.done();\\n iter.next()\\n ) {\\n if (iter.name().compareNames(buf.buf) != 0) continue;\\n bool found;\\n address addr;\\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\\n if (found) {\\n return (addr, true);\\n }\\n }\\n\\n return (address(0x0), false);\\n }\\n\\n function parseRR(\\n bytes memory rdata,\\n uint256 idx,\\n uint256 endIdx\\n ) internal pure returns (address, bool) {\\n while (idx < endIdx) {\\n uint256 len = rdata.readUint8(idx);\\n idx += 1;\\n\\n bool found;\\n address addr;\\n (addr, found) = parseString(rdata, idx, len);\\n\\n if (found) return (addr, true);\\n idx += len;\\n }\\n\\n return (address(0x0), false);\\n }\\n\\n function parseString(\\n bytes memory str,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (address, bool) {\\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\\n return str.hexToAddress(idx + 4, idx + len);\\n }\\n}\\n\",\"keccak256\":\"0x8269236f2a421e278e3e9642d2a5c29545993e8a4586a2592067155822d59069\",\"license\":\"MIT\"},\"contracts/dnsregistrar/DNSRegistrar.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\nimport \\\"../dnssec-oracle/BytesUtils.sol\\\";\\nimport \\\"../dnssec-oracle/DNSSEC.sol\\\";\\nimport \\\"../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"../registry/ENSRegistry.sol\\\";\\nimport \\\"../root/Root.sol\\\";\\nimport \\\"../resolvers/profiles/AddrResolver.sol\\\";\\nimport \\\"./DNSClaimChecker.sol\\\";\\nimport \\\"./PublicSuffixList.sol\\\";\\nimport \\\"./IDNSRegistrar.sol\\\";\\n\\n/**\\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\\n * corresponding name in ENS.\\n */\\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\\n using BytesUtils for bytes;\\n using Buffer for Buffer.buffer;\\n using RRUtils for *;\\n\\n ENS public immutable ens;\\n DNSSEC public immutable oracle;\\n PublicSuffixList public suffixes;\\n address public immutable previousRegistrar;\\n address public immutable resolver;\\n // A mapping of the most recent signatures seen for each claimed domain.\\n mapping(bytes32 => uint32) public inceptions;\\n\\n error NoOwnerRecordFound();\\n error PermissionDenied(address caller, address owner);\\n error PreconditionNotMet();\\n error StaleProof();\\n error InvalidPublicSuffix(bytes name);\\n\\n struct OwnerRecord {\\n bytes name;\\n address owner;\\n address resolver;\\n uint64 ttl;\\n }\\n\\n event Claim(\\n bytes32 indexed node,\\n address indexed owner,\\n bytes dnsname,\\n uint32 inception\\n );\\n event NewPublicSuffixList(address suffixes);\\n\\n constructor(\\n address _previousRegistrar,\\n address _resolver,\\n DNSSEC _dnssec,\\n PublicSuffixList _suffixes,\\n ENS _ens\\n ) {\\n previousRegistrar = _previousRegistrar;\\n resolver = _resolver;\\n oracle = _dnssec;\\n suffixes = _suffixes;\\n emit NewPublicSuffixList(address(suffixes));\\n ens = _ens;\\n }\\n\\n /**\\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\\n */\\n modifier onlyOwner() {\\n Root root = Root(ens.owner(bytes32(0)));\\n address owner = root.owner();\\n require(msg.sender == owner);\\n _;\\n }\\n\\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\\n suffixes = _suffixes;\\n emit NewPublicSuffixList(address(suffixes));\\n }\\n\\n /**\\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\\n * @param name The name to claim, in DNS wire format.\\n * @param input A chain of signed DNS RRSETs ending with a text record.\\n */\\n function proveAndClaim(\\n bytes memory name,\\n DNSSEC.RRSetWithSignature[] memory input\\n ) public override {\\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\\n name,\\n input\\n );\\n ens.setSubnodeOwner(rootNode, labelHash, addr);\\n }\\n\\n function proveAndClaimWithResolver(\\n bytes memory name,\\n DNSSEC.RRSetWithSignature[] memory input,\\n address resolver,\\n address addr\\n ) public override {\\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\\n name,\\n input\\n );\\n if (msg.sender != owner) {\\n revert PermissionDenied(msg.sender, owner);\\n }\\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\\n if (addr != address(0)) {\\n if (resolver == address(0)) {\\n revert PreconditionNotMet();\\n }\\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\\n // Set the resolver record\\n AddrResolver(resolver).setAddr(node, addr);\\n }\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure override returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IDNSRegistrar).interfaceId;\\n }\\n\\n function _claim(\\n bytes memory name,\\n DNSSEC.RRSetWithSignature[] memory input\\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\\n\\n // Get the first label\\n uint256 labelLen = name.readUint8(0);\\n labelHash = name.keccak(1, labelLen);\\n\\n bytes memory parentName = name.substring(\\n labelLen + 1,\\n name.length - labelLen - 1\\n );\\n\\n // Make sure the parent name is enabled\\n parentNode = enableNode(parentName);\\n\\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\\n revert StaleProof();\\n }\\n inceptions[node] = inception;\\n\\n bool found;\\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\\n if (!found) {\\n revert NoOwnerRecordFound();\\n }\\n\\n emit Claim(node, addr, name, inception);\\n }\\n\\n function enableNode(bytes memory domain) public returns (bytes32 node) {\\n // Name must be in the public suffix list.\\n if (!suffixes.isPublicSuffix(domain)) {\\n revert InvalidPublicSuffix(domain);\\n }\\n return _enableNode(domain, 0);\\n }\\n\\n function _enableNode(\\n bytes memory domain,\\n uint256 offset\\n ) internal returns (bytes32 node) {\\n uint256 len = domain.readUint8(offset);\\n if (len == 0) {\\n return bytes32(0);\\n }\\n\\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\\n bytes32 label = domain.keccak(offset + 1, len);\\n node = keccak256(abi.encodePacked(parentNode, label));\\n address owner = ens.owner(node);\\n if (owner == address(0) || owner == previousRegistrar) {\\n if (parentNode == bytes32(0)) {\\n Root root = Root(ens.owner(bytes32(0)));\\n root.setSubnodeOwner(label, address(this));\\n ens.setResolver(node, resolver);\\n } else {\\n ens.setSubnodeRecord(\\n parentNode,\\n label,\\n address(this),\\n resolver,\\n 0\\n );\\n }\\n } else if (owner != address(this)) {\\n revert PreconditionNotMet();\\n }\\n return node;\\n }\\n}\\n\",\"keccak256\":\"0x9140c28eee7f8dff1cc0a2380e9b57db3203c8c0d187245ab3595f4e4cbdebce\",\"license\":\"MIT\"},\"contracts/dnsregistrar/IDNSRegistrar.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"../dnssec-oracle/DNSSEC.sol\\\";\\n\\ninterface IDNSRegistrar {\\n function proveAndClaim(\\n bytes memory name,\\n DNSSEC.RRSetWithSignature[] memory input\\n ) external;\\n\\n function proveAndClaimWithResolver(\\n bytes memory name,\\n DNSSEC.RRSetWithSignature[] memory input,\\n address resolver,\\n address addr\\n ) external;\\n}\\n\",\"keccak256\":\"0xcf6607fe4918cabb1c4c2130597dd9cc0f63492564b05de60496eb46873a73b7\",\"license\":\"MIT\"},\"contracts/dnsregistrar/PublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\ninterface PublicSuffixList {\\n function isPublicSuffix(bytes calldata name) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x12158ba8838ee2b1ebb0178a52d2f4d54dcc68282d569226e62afc2b0dccbbac\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/DNSSEC.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nabstract contract DNSSEC {\\n bytes public anchors;\\n\\n struct RRSetWithSignature {\\n bytes rrset;\\n bytes sig;\\n }\\n\\n event AlgorithmUpdated(uint8 id, address addr);\\n event DigestUpdated(uint8 id, address addr);\\n\\n function verifyRRSet(\\n RRSetWithSignature[] memory input\\n ) external view virtual returns (bytes memory rrs, uint32 inception);\\n\\n function verifyRRSet(\\n RRSetWithSignature[] memory input,\\n uint256 now\\n ) public view virtual returns (bytes memory rrs, uint32 inception);\\n}\\n\",\"keccak256\":\"0xee6a236a59e5db8418c98ee4640a91987d26533c02d305cc6c7a37a3ac4ee907\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n */\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint256 labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes memory ret) {\\n uint256 len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint256 labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint256 constant RRSIG_TYPE = 0;\\n uint256 constant RRSIG_ALGORITHM = 2;\\n uint256 constant RRSIG_LABELS = 3;\\n uint256 constant RRSIG_TTL = 4;\\n uint256 constant RRSIG_EXPIRATION = 8;\\n uint256 constant RRSIG_INCEPTION = 12;\\n uint256 constant RRSIG_KEY_TAG = 16;\\n uint256 constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(\\n bytes memory data\\n ) internal pure returns (SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(\\n RRSIG_SIGNER_NAME + self.signerName.length,\\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\\n );\\n }\\n\\n function rrs(\\n SignedSet memory rrset\\n ) internal pure returns (RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint256 offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint256 rdataOffset;\\n uint256 nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns (bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint256 rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.offset,\\n nameLength(iter.data, iter.offset)\\n );\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(\\n RRIterator memory iter\\n ) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.rdataOffset,\\n iter.nextOffset - iter.rdataOffset\\n );\\n }\\n\\n uint256 constant DNSKEY_FLAGS = 0;\\n uint256 constant DNSKEY_PROTOCOL = 2;\\n uint256 constant DNSKEY_ALGORITHM = 3;\\n uint256 constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(\\n offset + DNSKEY_PUBKEY,\\n length - DNSKEY_PUBKEY\\n );\\n }\\n\\n uint256 constant DS_KEY_TAG = 0;\\n uint256 constant DS_ALGORITHM = 2;\\n uint256 constant DS_DIGEST_TYPE = 3;\\n uint256 constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n function isSubdomainOf(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n uint256 off = 0;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n while (counts > othercounts) {\\n off = progress(self, off);\\n counts--;\\n }\\n\\n return self.equals(off, other, 0);\\n }\\n\\n function compareNames(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint256 off;\\n uint256 otheroff;\\n uint256 prevoff;\\n uint256 otherprevoff;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if (otheroff == 0) {\\n return 1;\\n }\\n\\n return\\n self.compare(\\n prevoff + 1,\\n self.readUint8(prevoff),\\n other,\\n otherprevoff + 1,\\n other.readUint8(otherprevoff)\\n );\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(\\n uint32 i1,\\n uint32 i2\\n ) internal pure returns (bool) {\\n unchecked {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n }\\n\\n function progress(\\n bytes memory body,\\n uint256 off\\n ) internal pure returns (uint256) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint256 ac1;\\n uint256 ac2;\\n for (uint256 i = 0; i < data.length + 31; i += 32) {\\n uint256 word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if (i + 32 > data.length) {\\n uint256 unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 +=\\n (word &\\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\\n 8;\\n ac2 += (word &\\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 =\\n (ac1 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac1 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac2 =\\n (ac2 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac2 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 =\\n (ac1 &\\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\\n 32);\\n ac1 =\\n (ac1 &\\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\\n 64);\\n ac1 =\\n (ac1 &\\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\\n (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4dd68a6efd7c38f6b0e95ca0c056ecb74f88583da650b1a8639e6e78be36fede\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/registry/ENSRegistry.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"./ENS.sol\\\";\\n\\n/**\\n * The ENS registry contract.\\n */\\ncontract ENSRegistry is ENS {\\n struct Record {\\n address owner;\\n address resolver;\\n uint64 ttl;\\n }\\n\\n mapping(bytes32 => Record) records;\\n mapping(address => mapping(address => bool)) operators;\\n\\n // Permits modifications only by the owner of the specified node.\\n modifier authorised(bytes32 node) {\\n address owner = records[node].owner;\\n require(owner == msg.sender || operators[owner][msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Constructs a new ENS registry.\\n */\\n constructor() public {\\n records[0x0].owner = msg.sender;\\n }\\n\\n /**\\n * @dev Sets the record for a node.\\n * @param node The node to update.\\n * @param owner The address of the new owner.\\n * @param resolver The address of the resolver.\\n * @param ttl The TTL in seconds.\\n */\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external virtual override {\\n setOwner(node, owner);\\n _setResolverAndTTL(node, resolver, ttl);\\n }\\n\\n /**\\n * @dev Sets the record for a subnode.\\n * @param node The parent node.\\n * @param label The hash of the label specifying the subnode.\\n * @param owner The address of the new owner.\\n * @param resolver The address of the resolver.\\n * @param ttl The TTL in seconds.\\n */\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external virtual override {\\n bytes32 subnode = setSubnodeOwner(node, label, owner);\\n _setResolverAndTTL(subnode, resolver, ttl);\\n }\\n\\n /**\\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\\n * @param node The node to transfer ownership of.\\n * @param owner The address of the new owner.\\n */\\n function setOwner(\\n bytes32 node,\\n address owner\\n ) public virtual override authorised(node) {\\n _setOwner(node, owner);\\n emit Transfer(node, owner);\\n }\\n\\n /**\\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\\n * @param node The parent node.\\n * @param label The hash of the label specifying the subnode.\\n * @param owner The address of the new owner.\\n */\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) public virtual override authorised(node) returns (bytes32) {\\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\\n _setOwner(subnode, owner);\\n emit NewOwner(node, label, owner);\\n return subnode;\\n }\\n\\n /**\\n * @dev Sets the resolver address for the specified node.\\n * @param node The node to update.\\n * @param resolver The address of the resolver.\\n */\\n function setResolver(\\n bytes32 node,\\n address resolver\\n ) public virtual override authorised(node) {\\n emit NewResolver(node, resolver);\\n records[node].resolver = resolver;\\n }\\n\\n /**\\n * @dev Sets the TTL for the specified node.\\n * @param node The node to update.\\n * @param ttl The TTL in seconds.\\n */\\n function setTTL(\\n bytes32 node,\\n uint64 ttl\\n ) public virtual override authorised(node) {\\n emit NewTTL(node, ttl);\\n records[node].ttl = ttl;\\n }\\n\\n /**\\n * @dev Enable or disable approval for a third party (\\\"operator\\\") to manage\\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\\n * @param operator Address to add to the set of authorized operators.\\n * @param approved True if the operator is approved, false to revoke approval.\\n */\\n function setApprovalForAll(\\n address operator,\\n bool approved\\n ) external virtual override {\\n operators[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev Returns the address that owns the specified node.\\n * @param node The specified node.\\n * @return address of the owner.\\n */\\n function owner(\\n bytes32 node\\n ) public view virtual override returns (address) {\\n address addr = records[node].owner;\\n if (addr == address(this)) {\\n return address(0x0);\\n }\\n\\n return addr;\\n }\\n\\n /**\\n * @dev Returns the address of the resolver for the specified node.\\n * @param node The specified node.\\n * @return address of the resolver.\\n */\\n function resolver(\\n bytes32 node\\n ) public view virtual override returns (address) {\\n return records[node].resolver;\\n }\\n\\n /**\\n * @dev Returns the TTL of a node, and any records associated with it.\\n * @param node The specified node.\\n * @return ttl of the node.\\n */\\n function ttl(bytes32 node) public view virtual override returns (uint64) {\\n return records[node].ttl;\\n }\\n\\n /**\\n * @dev Returns whether a record has been imported to the registry.\\n * @param node The specified node.\\n * @return Bool if record exists\\n */\\n function recordExists(\\n bytes32 node\\n ) public view virtual override returns (bool) {\\n return records[node].owner != address(0x0);\\n }\\n\\n /**\\n * @dev Query if an address is an authorized operator for another address.\\n * @param owner The address that owns the records.\\n * @param operator The address that acts on behalf of the owner.\\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\\n */\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view virtual override returns (bool) {\\n return operators[owner][operator];\\n }\\n\\n function _setOwner(bytes32 node, address owner) internal virtual {\\n records[node].owner = owner;\\n }\\n\\n function _setResolverAndTTL(\\n bytes32 node,\\n address resolver,\\n uint64 ttl\\n ) internal {\\n if (resolver != records[node].resolver) {\\n records[node].resolver = resolver;\\n emit NewResolver(node, resolver);\\n }\\n\\n if (ttl != records[node].ttl) {\\n records[node].ttl = ttl;\\n emit NewTTL(node, ttl);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa7a7a64fb980e521c991415e416fd4106a42f892479805e1daa51ecb0e2e5198\"},\"contracts/resolvers/ResolverBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"./profiles/IVersionableResolver.sol\\\";\\n\\nabstract contract ResolverBase is ERC165, IVersionableResolver {\\n mapping(bytes32 => uint64) public recordVersions;\\n\\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\\n\\n modifier authorised(bytes32 node) {\\n require(isAuthorised(node));\\n _;\\n }\\n\\n /**\\n * Increments the record version associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function clearRecords(bytes32 node) public virtual authorised(node) {\\n recordVersions[node]++;\\n emit VersionChanged(node, recordVersions[node]);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IVersionableResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x893049fffd6feee06d7acef1680f6e26505bedff62a9f7a17e921c0ba2f66307\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/AddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IAddrResolver.sol\\\";\\nimport \\\"./IAddressResolver.sol\\\";\\n\\nabstract contract AddrResolver is\\n IAddrResolver,\\n IAddressResolver,\\n ResolverBase\\n{\\n uint256 private constant COIN_TYPE_ETH = 60;\\n\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\\n\\n /**\\n * Sets the address associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param a The address to set.\\n */\\n function setAddr(\\n bytes32 node,\\n address a\\n ) external virtual authorised(node) {\\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\\n }\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(\\n bytes32 node\\n ) public view virtual override returns (address payable) {\\n bytes memory a = addr(node, COIN_TYPE_ETH);\\n if (a.length == 0) {\\n return payable(0);\\n }\\n return bytesToAddress(a);\\n }\\n\\n function setAddr(\\n bytes32 node,\\n uint256 coinType,\\n bytes memory a\\n ) public virtual authorised(node) {\\n emit AddressChanged(node, coinType, a);\\n if (coinType == COIN_TYPE_ETH) {\\n emit AddrChanged(node, bytesToAddress(a));\\n }\\n versionable_addresses[recordVersions[node]][node][coinType] = a;\\n }\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) public view virtual override returns (bytes memory) {\\n return versionable_addresses[recordVersions[node]][node][coinType];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IAddrResolver).interfaceId ||\\n interfaceID == type(IAddressResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function bytesToAddress(\\n bytes memory b\\n ) internal pure returns (address payable a) {\\n require(b.length == 20);\\n assembly {\\n a := div(mload(add(b, 32)), exp(256, 12))\\n }\\n }\\n\\n function addressToBytes(address a) internal pure returns (bytes memory b) {\\n b = new bytes(20);\\n assembly {\\n mstore(add(b, 32), mul(a, exp(256, 12)))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7f6ebb3144530a02db03379f33ade869c8408eceed36dfbd751aaff198735b55\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IVersionableResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IVersionableResolver {\\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\\n\\n function recordVersions(bytes32 node) external view returns (uint64);\\n}\\n\",\"keccak256\":\"0xd0d09596f20c57bafb2ffa8521a8c57120e9af6c6b194f9c689d4da56f91a57c\",\"license\":\"MIT\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"},\"contracts/root/Root.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"./Controllable.sol\\\";\\n\\ncontract Root is Ownable, Controllable {\\n bytes32 private constant ROOT_NODE = bytes32(0);\\n\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n\\n event TLDLocked(bytes32 indexed label);\\n\\n ENS public ens;\\n mapping(bytes32 => bool) public locked;\\n\\n constructor(ENS _ens) public {\\n ens = _ens;\\n }\\n\\n function setSubnodeOwner(\\n bytes32 label,\\n address owner\\n ) external onlyController {\\n require(!locked[label]);\\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\\n }\\n\\n function setResolver(address resolver) external onlyOwner {\\n ens.setResolver(ROOT_NODE, resolver);\\n }\\n\\n function lock(bytes32 label) external onlyOwner {\\n emit TLDLocked(label);\\n locked[label] = true;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return interfaceID == INTERFACE_META_ID;\\n }\\n}\\n\",\"keccak256\":\"0x469b281e1a9e1c3dad9c860a4ab3a7299a48355b0b0243713e0829193c39f50c\"},\"contracts/utils/HexUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary HexUtils {\\n /**\\n * @dev Attempts to parse bytes32 from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexStringToBytes32(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (bytes32 r, bool valid) {\\n uint256 hexLength = lastIdx - idx;\\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\\n revert(\\\"Invalid string length\\\");\\n }\\n valid = true;\\n assembly {\\n // check that the index to read to is not past the end of the string\\n if gt(lastIdx, mload(str)) {\\n revert(0, 0)\\n }\\n\\n function getHex(c) -> ascii {\\n // chars 48-57: 0-9\\n if and(gt(c, 47), lt(c, 58)) {\\n ascii := sub(c, 48)\\n leave\\n }\\n // chars 65-70: A-F\\n if and(gt(c, 64), lt(c, 71)) {\\n ascii := add(sub(c, 65), 10)\\n leave\\n }\\n // chars 97-102: a-f\\n if and(gt(c, 96), lt(c, 103)) {\\n ascii := add(sub(c, 97), 10)\\n leave\\n }\\n // invalid char\\n ascii := 0xff\\n }\\n\\n let ptr := add(str, 32)\\n for {\\n let i := idx\\n } lt(i, lastIdx) {\\n i := add(i, 2)\\n } {\\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\\n // if either byte is invalid, set invalid and break loop\\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\\n valid := false\\n break\\n }\\n let combined := or(shl(4, byte1), byte2)\\n r := or(shl(8, r), combined)\\n }\\n }\\n }\\n\\n /**\\n * @dev Attempts to parse an address from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexToAddress(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (address, bool) {\\n if (lastIdx - idx < 40) return (address(0x0), false);\\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\\n return (address(uint160(uint256(r))), valid);\\n }\\n}\\n\",\"keccak256\":\"0x4a8a9c72d6f3effb80b310faa6dc273e7adbc3b949df9c7a42e290e5b13519f3\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101006040523480156200001257600080fd5b50604051620023e1380380620023e18339810160408190526200003591620000c8565b6001600160a01b0385811660c05284811660e05283811660a052600080546001600160a01b03191691841691821790556040519081527f9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba89060200160405180910390a16001600160a01b0316608052506200014892505050565b6001600160a01b0381168114620000c557600080fd5b50565b600080600080600060a08688031215620000e157600080fd5b8551620000ee81620000af565b60208701519095506200010181620000af565b60408701519094506200011481620000af565b60608701519093506200012781620000af565b60808701519092506200013a81620000af565b809150509295509295909350565b60805160a05160c05160e051612213620001ce6000396000818160fb01528181610cde0152610d950152600081816102320152610b6301526000818161020b01526108020152600081816101c301528181610397015281816104f8015281816106b301528181610ae301528181610bba01528181610d060152610dc401526122136000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c806329d56630116100815780636f9512211161005b5780636f951221146101e55780637dc0d1d014610206578063ab14ec591461022d57600080fd5b806329d566301461019857806330349ebe146101ab5780633f15457f146101be57600080fd5b806306963218116100b257806306963218146101355780631ecfc4111461014a57806325916d411461015d57600080fd5b806301ffc9a7146100ce57806304f3bcec146100f6575b600080fd5b6100e16100dc366004611a75565b610254565b60405190151581526020015b60405180910390f35b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100ed565b610148610143366004611cb7565b6102ed565b005b610148610158366004611d40565b6104df565b61018361016b366004611d5d565b60016020526000908152604090205463ffffffff1681565b60405163ffffffff90911681526020016100ed565b6101486101a6366004611d76565b610656565b60005461011d906001600160a01b031681565b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b6101f86101f3366004611dda565b61072a565b6040519081526020016100ed565b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a70000000000000000000000000000000000000000000000000000000014806102e757507fffffffff0000000000000000000000000000000000000000000000000000000082167f2f43542800000000000000000000000000000000000000000000000000000000145b92915050565b60008060006102fc87876107f8565b91945092509050336001600160a01b0382161461035b576040517fe03f60240000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03821660248201526044015b60405180910390fd5b6040516305ef2c7f60e41b815260048101849052602481018390526001600160a01b0382811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156103db57600080fd5b505af11580156103ef573d6000803e3d6000fd5b505050506001600160a01b038416156104d6576001600160a01b03851661042957604051633c584f1360e21b815260040160405180910390fd5b604080516020810185905290810183905260009060600160408051808303601f190181529082905280516020909101207fd5fa2b00000000000000000000000000000000000000000000000000000000008252600482018190526001600160a01b03878116602484015290925087169063d5fa2b0090604401600060405180830381600087803b1580156104bc57600080fd5b505af11580156104d0573d6000803e3d6000fd5b50505050505b50505050505050565b6040516302571be360e01b8152600060048201819052907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610547573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056b9190611e0f565b90506000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d19190611e0f565b9050336001600160a01b038216146105e857600080fd5b600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0385169081179091556040519081527f9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba89060200160405180910390a1505050565b600080600061066585856107f8565b6040517f06ab592300000000000000000000000000000000000000000000000000000000815260048101849052602481018390526001600160a01b03828116604483015293965091945092507f0000000000000000000000000000000000000000000000000000000000000000909116906306ab5923906064016020604051808303816000875af11580156106fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107229190611e2c565b505050505050565b600080546040517f4f89059e0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690634f89059e90610774908590600401611e95565b602060405180830381865afa158015610791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b59190611ea8565b6107ed57816040517f396e24b80000000000000000000000000000000000000000000000000000000081526004016103529190611e95565b6102e7826000610a35565b60008060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bdf95fef876040518263ffffffff1660e01b815260040161084c9190611eca565b600060405180830381865afa158015610869573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108919190810190611f4f565b909250905060006108a28882610e58565b60ff1690506108b388600183610e7c565b945060006108e66108c5836001611ffc565b6001848c516108d4919061200f565b6108de919061200f565b8b9190610ea0565b90506108f18161072a565b965060008787604051602001610911929190918252602082015260400190565b60408051808303601f190181529181528151602092830120600081815260019093529082205490925063ffffffff16850360030b121561097d576040517f2dd6a7af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600160205260408120805463ffffffff191663ffffffff87161790556109a88b87610f22565b9097509050806109e4576040517f6260f6f800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b866001600160a01b0316827f87db02a0e483e2818060eddcbb3488ce44e35aff49a70d92c2aa6c8046cf01e28d88604051610a20929190612022565b60405180910390a35050505050509250925092565b600080610a428484610e58565b60ff16905080600003610a595750600090506102e7565b6000610a7985610a698487611ffc565b610a74906001611ffc565b610a35565b90506000610a93610a8b866001611ffc565b879085610e7c565b604080516020810185905290810182905290915060600160408051601f198184030181529082905280516020909101206302571be360e01b82526004820181905294506000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015610b2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4e9190611e0f565b90506001600160a01b0381161580610b9757507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b0316145b15610e255782610d6a576040516302571be360e01b8152600060048201819052907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d9190611e0f565b6040517f8cb8ecec000000000000000000000000000000000000000000000000000000008152600481018590523060248201529091506001600160a01b03821690638cb8ecec90604401600060405180830381600087803b158015610c9157600080fd5b505af1158015610ca5573d6000803e3d6000fd5b50506040517f1896f70a000000000000000000000000000000000000000000000000000000008152600481018990526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660248301527f0000000000000000000000000000000000000000000000000000000000000000169250631896f70a9150604401600060405180830381600087803b158015610d4c57600080fd5b505af1158015610d60573d6000803e3d6000fd5b5050505050610e4e565b6040516305ef2c7f60e41b815260048101849052602481018390523060448201526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b158015610e0857600080fd5b505af1158015610e1c573d6000803e3d6000fd5b50505050610e4e565b6001600160a01b0381163014610e4e57604051633c584f1360e21b815260040160405180910390fd5b5050505092915050565b6000828281518110610e6c57610e6c61204a565b016020015160f81c905092915050565b8251600090610e8b8385611ffc565b1115610e9657600080fd5b5091016020012090565b8251606090610eaf8385611ffc565b1115610eba57600080fd5b60008267ffffffffffffffff811115610ed557610ed5611ab7565b6040519080825280601f01601f191660200182016040528015610eff576020820181803683370190505b50905060208082019086860101610f17828287611030565b509095945050505050565b600080610f42604051806040016040528060608152602001600081525090565b610f5a85516005610f539190611ffc565b8290611086565b5060408051808201909152600581527f045f656e730000000000000000000000000000000000000000000000000000006020820152610f9a9082906110fd565b50610fa581866110fd565b506000610fb28582611125565b90505b8051516020820151101561101f578151610fd890610fd283611186565b906111a7565b60000361101157600080610ff5878460a001518560c00151611300565b92509050811561100e5794506001935061102992505050565b50505b61101a81611373565b610fb5565b5060008092509250505b9250929050565b602081106110685781518352611047602084611ffc565b9250611054602083611ffc565b915061106160208261200f565b9050611030565b905182516020929092036101000a6000190180199091169116179052565b6040805180820190915260608152600060208201526110a6602083612060565b156110ce576110b6602083612060565b6110c190602061200f565b6110cb9083611ffc565b91505b6020808401839052604051808552600081529081840101818110156110f257600080fd5b604052509192915050565b60408051808201909152606081526000602082015261111e8383845161145b565b9392505050565b6111736040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c081018290526102e781611373565b602081015181516060916102e79161119e9082611531565b84519190610ea0565b60006111b38383611593565b156111c0575060006102e7565b60008060008060006111d38860006115b1565b905060006111e28860006115b1565b90505b8082111561120e578593506111fa898761160e565b95508161120681612082565b9250506111e5565b8181111561123757849250611223888661160e565b94508061122f81612082565b91505061120e565b600082118015611250575061124e89878a88611632565b155b1561128557859350611262898761160e565b9550849250611271888661160e565b945061127e60018361200f565b9150611237565b8560000361129d5760001996505050505050506102e7565b846000036112b457600196505050505050506102e7565b6112f36112c2856001611ffc565b6112cc8b87610e58565b60ff168a6112db876001611ffc565b6112e58d89610e58565b8e949392919060ff16611667565b9998505050505050505050565b6000805b828410156113645760006113188686610e58565b60ff169050611328600186611ffc565b94506000806113388888856117e5565b9250905081156113505793506001925061136b915050565b61135a8388611ffc565b9650505050611304565b5060009050805b935093915050565b60c0810151602082018190528151511161138a5750565b600061139e82600001518360200151611531565b82602001516113ad9190611ffc565b82519091506113bc9082611839565b61ffff1660408301526113d0600282611ffc565b82519091506113df9082611839565b61ffff1660608301526113f3600282611ffc565b82519091506114029082611861565b63ffffffff166080830152611418600482611ffc565b825190915060009061142a9083611839565b61ffff16905061143b600283611ffc565b60a08401819052915061144e8183611ffc565b60c0909301929092525050565b604080518082019091526060815260006020820152825182111561147e57600080fd5b835151600061148d8483611ffc565b905085602001518111156114af576114af866114aa836002612099565b61188b565b8551805183820160200191600091808511156114c9578482525b505050602086015b6020861061150957805182526114e8602083611ffc565b91506114f5602082611ffc565b905061150260208761200f565b95506114d1565b51815160001960208890036101000a0190811690199190911617905250849150509392505050565b6000815b83518110611545576115456120b0565b60006115518583610e58565b60ff169050611561816001611ffc565b61156b9083611ffc565b91508060000361157b5750611581565b50611535565b61158b838261200f565b949350505050565b60008151835114801561111e575061111e83600084600087516118a8565b6000805b835183106115c5576115c56120b0565b60006115d18585610e58565b60ff1690506115e1816001611ffc565b6115eb9085611ffc565b9350806000036115fb575061111e565b611606600183611ffc565b9150506115b5565b600061161a8383610e58565b60ff16611628836001611ffc565b61111e9190611ffc565b600061164b8383848651611646919061200f565b610e7c565b61165d8686878951611646919061200f565b1495945050505050565b85516000906116768688611ffc565b11156116aa576116868587611ffc565b8751604051638a3c1cfb60e01b815260048101929092526024820152604401610352565b83516116b68385611ffc565b11156116ea576116c68284611ffc565b8451604051638a3c1cfb60e01b815260048101929092526024820152604401610352565b84808310156116f65750815b60208789018101908587010160005b838110156117ca578251825180821461179a5760006020611726858961200f565b106117345750600019611770565b600187611742866020611ffc565b61174c919061200f565b611757906008612099565b6117629060026121aa565b61176c919061200f565b1990505b60006117808383168584166121b6565b905080156117975797506117db9650505050505050565b50505b6117a5602086611ffc565b94506117b2602085611ffc565b935050506020816117c39190611ffc565b9050611705565b506117d585896121b6565b93505050505b9695505050505050565b6000806117f28585611861565b63ffffffff1663613d30781461180d5750600090508061136b565b61182d61181b856004611ffc565b6118258587611ffc565b8791906118cb565b91509150935093915050565b8151600090611849836002611ffc565b111561185457600080fd5b50016002015161ffff1690565b8151600090611871836004611ffc565b111561187c57600080fd5b50016004015163ffffffff1690565b81516118978383611086565b506118a283826110fd565b50505050565b60006118b5848484610e7c565b6118c0878785610e7c565b149695505050505050565b60008060286118da858561200f565b10156118eb5750600090508061136b565b6000806118f9878787611907565b909890975095505050505050565b60008080611915858561200f565b905080604014158015611929575080602814155b8061193e575061193a600282612060565b6001145b156119a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610352565b6001915085518411156119b757600080fd5b611a08565b6000603a8210602f831116156119d45750602f190190565b604782106040831116156119ea57506036190190565b60678210606083111615611a0057506056190190565b5060ff919050565b60208601855b85811015611a6a57611a258183015160001a6119bc565b611a376001830184015160001a6119bc565b60ff811460ff83141715611a5057600095505050611a6a565b60049190911b1760089590951b9490941793600201611a0e565b505050935093915050565b600060208284031215611a8757600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461111e57600080fd5b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715611af057611af0611ab7565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611b1f57611b1f611ab7565b604052919050565b600067ffffffffffffffff821115611b4157611b41611ab7565b50601f01601f191660200190565b600082601f830112611b6057600080fd5b8135611b73611b6e82611b27565b611af6565b818152846020838601011115611b8857600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112611bb657600080fd5b8135602067ffffffffffffffff80831115611bd357611bd3611ab7565b8260051b611be2838201611af6565b9384528581018301938381019088861115611bfc57600080fd5b84880192505b85831015611c9357823584811115611c1a5760008081fd5b88016040818b03601f1901811315611c325760008081fd5b611c3a611acd565b8783013587811115611c4c5760008081fd5b611c5a8d8a83870101611b4f565b825250908201359086821115611c705760008081fd5b611c7e8c8984860101611b4f565b81890152845250509184019190840190611c02565b98975050505050505050565b6001600160a01b0381168114611cb457600080fd5b50565b60008060008060808587031215611ccd57600080fd5b843567ffffffffffffffff80821115611ce557600080fd5b611cf188838901611b4f565b95506020870135915080821115611d0757600080fd5b50611d1487828801611ba5565b9350506040850135611d2581611c9f565b91506060850135611d3581611c9f565b939692955090935050565b600060208284031215611d5257600080fd5b813561111e81611c9f565b600060208284031215611d6f57600080fd5b5035919050565b60008060408385031215611d8957600080fd5b823567ffffffffffffffff80821115611da157600080fd5b611dad86838701611b4f565b93506020850135915080821115611dc357600080fd5b50611dd085828601611ba5565b9150509250929050565b600060208284031215611dec57600080fd5b813567ffffffffffffffff811115611e0357600080fd5b61158b84828501611b4f565b600060208284031215611e2157600080fd5b815161111e81611c9f565b600060208284031215611e3e57600080fd5b5051919050565b60005b83811015611e60578181015183820152602001611e48565b50506000910152565b60008151808452611e81816020860160208601611e45565b601f01601f19169290920160200192915050565b60208152600061111e6020830184611e69565b600060208284031215611eba57600080fd5b8151801515811461111e57600080fd5b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015611f4157888303603f1901855281518051878552611f1588860182611e69565b91890151858303868b0152919050611f2d8183611e69565b968901969450505090860190600101611ef1565b509098975050505050505050565b60008060408385031215611f6257600080fd5b825167ffffffffffffffff811115611f7957600080fd5b8301601f81018513611f8a57600080fd5b8051611f98611b6e82611b27565b818152866020838501011115611fad57600080fd5b611fbe826020830160208601611e45565b809450505050602083015163ffffffff81168114611fdb57600080fd5b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b808201808211156102e7576102e7611fe6565b818103818111156102e7576102e7611fe6565b6040815260006120356040830185611e69565b905063ffffffff831660208301529392505050565b634e487b7160e01b600052603260045260246000fd5b60008261207d57634e487b7160e01b600052601260045260246000fd5b500690565b60008161209157612091611fe6565b506000190190565b80820281158282048414176102e7576102e7611fe6565b634e487b7160e01b600052600160045260246000fd5b600181815b808511156121015781600019048211156120e7576120e7611fe6565b808516156120f457918102915b93841c93908002906120cb565b509250929050565b600082612118575060016102e7565b81612125575060006102e7565b816001811461213b576002811461214557612161565b60019150506102e7565b60ff84111561215657612156611fe6565b50506001821b6102e7565b5060208310610133831016604e8410600b8410161715612184575081810a6102e7565b61218e83836120c6565b80600019048211156121a2576121a2611fe6565b029392505050565b600061111e8383612109565b81810360008312801583831316838312821617156121d6576121d6611fe6565b509291505056fea26469706673582212204fd3172855fc29f1ee29f5099e32e8c1f163dcac07aa16324d9f13cbd4f6ee7164736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100c95760003560e01c806329d56630116100815780636f9512211161005b5780636f951221146101e55780637dc0d1d014610206578063ab14ec591461022d57600080fd5b806329d566301461019857806330349ebe146101ab5780633f15457f146101be57600080fd5b806306963218116100b257806306963218146101355780631ecfc4111461014a57806325916d411461015d57600080fd5b806301ffc9a7146100ce57806304f3bcec146100f6575b600080fd5b6100e16100dc366004611a75565b610254565b60405190151581526020015b60405180910390f35b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100ed565b610148610143366004611cb7565b6102ed565b005b610148610158366004611d40565b6104df565b61018361016b366004611d5d565b60016020526000908152604090205463ffffffff1681565b60405163ffffffff90911681526020016100ed565b6101486101a6366004611d76565b610656565b60005461011d906001600160a01b031681565b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b6101f86101f3366004611dda565b61072a565b6040519081526020016100ed565b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a70000000000000000000000000000000000000000000000000000000014806102e757507fffffffff0000000000000000000000000000000000000000000000000000000082167f2f43542800000000000000000000000000000000000000000000000000000000145b92915050565b60008060006102fc87876107f8565b91945092509050336001600160a01b0382161461035b576040517fe03f60240000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03821660248201526044015b60405180910390fd5b6040516305ef2c7f60e41b815260048101849052602481018390526001600160a01b0382811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156103db57600080fd5b505af11580156103ef573d6000803e3d6000fd5b505050506001600160a01b038416156104d6576001600160a01b03851661042957604051633c584f1360e21b815260040160405180910390fd5b604080516020810185905290810183905260009060600160408051808303601f190181529082905280516020909101207fd5fa2b00000000000000000000000000000000000000000000000000000000008252600482018190526001600160a01b03878116602484015290925087169063d5fa2b0090604401600060405180830381600087803b1580156104bc57600080fd5b505af11580156104d0573d6000803e3d6000fd5b50505050505b50505050505050565b6040516302571be360e01b8152600060048201819052907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610547573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056b9190611e0f565b90506000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d19190611e0f565b9050336001600160a01b038216146105e857600080fd5b600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0385169081179091556040519081527f9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba89060200160405180910390a1505050565b600080600061066585856107f8565b6040517f06ab592300000000000000000000000000000000000000000000000000000000815260048101849052602481018390526001600160a01b03828116604483015293965091945092507f0000000000000000000000000000000000000000000000000000000000000000909116906306ab5923906064016020604051808303816000875af11580156106fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107229190611e2c565b505050505050565b600080546040517f4f89059e0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690634f89059e90610774908590600401611e95565b602060405180830381865afa158015610791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b59190611ea8565b6107ed57816040517f396e24b80000000000000000000000000000000000000000000000000000000081526004016103529190611e95565b6102e7826000610a35565b60008060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bdf95fef876040518263ffffffff1660e01b815260040161084c9190611eca565b600060405180830381865afa158015610869573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108919190810190611f4f565b909250905060006108a28882610e58565b60ff1690506108b388600183610e7c565b945060006108e66108c5836001611ffc565b6001848c516108d4919061200f565b6108de919061200f565b8b9190610ea0565b90506108f18161072a565b965060008787604051602001610911929190918252602082015260400190565b60408051808303601f190181529181528151602092830120600081815260019093529082205490925063ffffffff16850360030b121561097d576040517f2dd6a7af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600160205260408120805463ffffffff191663ffffffff87161790556109a88b87610f22565b9097509050806109e4576040517f6260f6f800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b866001600160a01b0316827f87db02a0e483e2818060eddcbb3488ce44e35aff49a70d92c2aa6c8046cf01e28d88604051610a20929190612022565b60405180910390a35050505050509250925092565b600080610a428484610e58565b60ff16905080600003610a595750600090506102e7565b6000610a7985610a698487611ffc565b610a74906001611ffc565b610a35565b90506000610a93610a8b866001611ffc565b879085610e7c565b604080516020810185905290810182905290915060600160408051601f198184030181529082905280516020909101206302571be360e01b82526004820181905294506000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015610b2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4e9190611e0f565b90506001600160a01b0381161580610b9757507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b0316145b15610e255782610d6a576040516302571be360e01b8152600060048201819052907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d9190611e0f565b6040517f8cb8ecec000000000000000000000000000000000000000000000000000000008152600481018590523060248201529091506001600160a01b03821690638cb8ecec90604401600060405180830381600087803b158015610c9157600080fd5b505af1158015610ca5573d6000803e3d6000fd5b50506040517f1896f70a000000000000000000000000000000000000000000000000000000008152600481018990526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660248301527f0000000000000000000000000000000000000000000000000000000000000000169250631896f70a9150604401600060405180830381600087803b158015610d4c57600080fd5b505af1158015610d60573d6000803e3d6000fd5b5050505050610e4e565b6040516305ef2c7f60e41b815260048101849052602481018390523060448201526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b158015610e0857600080fd5b505af1158015610e1c573d6000803e3d6000fd5b50505050610e4e565b6001600160a01b0381163014610e4e57604051633c584f1360e21b815260040160405180910390fd5b5050505092915050565b6000828281518110610e6c57610e6c61204a565b016020015160f81c905092915050565b8251600090610e8b8385611ffc565b1115610e9657600080fd5b5091016020012090565b8251606090610eaf8385611ffc565b1115610eba57600080fd5b60008267ffffffffffffffff811115610ed557610ed5611ab7565b6040519080825280601f01601f191660200182016040528015610eff576020820181803683370190505b50905060208082019086860101610f17828287611030565b509095945050505050565b600080610f42604051806040016040528060608152602001600081525090565b610f5a85516005610f539190611ffc565b8290611086565b5060408051808201909152600581527f045f656e730000000000000000000000000000000000000000000000000000006020820152610f9a9082906110fd565b50610fa581866110fd565b506000610fb28582611125565b90505b8051516020820151101561101f578151610fd890610fd283611186565b906111a7565b60000361101157600080610ff5878460a001518560c00151611300565b92509050811561100e5794506001935061102992505050565b50505b61101a81611373565b610fb5565b5060008092509250505b9250929050565b602081106110685781518352611047602084611ffc565b9250611054602083611ffc565b915061106160208261200f565b9050611030565b905182516020929092036101000a6000190180199091169116179052565b6040805180820190915260608152600060208201526110a6602083612060565b156110ce576110b6602083612060565b6110c190602061200f565b6110cb9083611ffc565b91505b6020808401839052604051808552600081529081840101818110156110f257600080fd5b604052509192915050565b60408051808201909152606081526000602082015261111e8383845161145b565b9392505050565b6111736040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c081018290526102e781611373565b602081015181516060916102e79161119e9082611531565b84519190610ea0565b60006111b38383611593565b156111c0575060006102e7565b60008060008060006111d38860006115b1565b905060006111e28860006115b1565b90505b8082111561120e578593506111fa898761160e565b95508161120681612082565b9250506111e5565b8181111561123757849250611223888661160e565b94508061122f81612082565b91505061120e565b600082118015611250575061124e89878a88611632565b155b1561128557859350611262898761160e565b9550849250611271888661160e565b945061127e60018361200f565b9150611237565b8560000361129d5760001996505050505050506102e7565b846000036112b457600196505050505050506102e7565b6112f36112c2856001611ffc565b6112cc8b87610e58565b60ff168a6112db876001611ffc565b6112e58d89610e58565b8e949392919060ff16611667565b9998505050505050505050565b6000805b828410156113645760006113188686610e58565b60ff169050611328600186611ffc565b94506000806113388888856117e5565b9250905081156113505793506001925061136b915050565b61135a8388611ffc565b9650505050611304565b5060009050805b935093915050565b60c0810151602082018190528151511161138a5750565b600061139e82600001518360200151611531565b82602001516113ad9190611ffc565b82519091506113bc9082611839565b61ffff1660408301526113d0600282611ffc565b82519091506113df9082611839565b61ffff1660608301526113f3600282611ffc565b82519091506114029082611861565b63ffffffff166080830152611418600482611ffc565b825190915060009061142a9083611839565b61ffff16905061143b600283611ffc565b60a08401819052915061144e8183611ffc565b60c0909301929092525050565b604080518082019091526060815260006020820152825182111561147e57600080fd5b835151600061148d8483611ffc565b905085602001518111156114af576114af866114aa836002612099565b61188b565b8551805183820160200191600091808511156114c9578482525b505050602086015b6020861061150957805182526114e8602083611ffc565b91506114f5602082611ffc565b905061150260208761200f565b95506114d1565b51815160001960208890036101000a0190811690199190911617905250849150509392505050565b6000815b83518110611545576115456120b0565b60006115518583610e58565b60ff169050611561816001611ffc565b61156b9083611ffc565b91508060000361157b5750611581565b50611535565b61158b838261200f565b949350505050565b60008151835114801561111e575061111e83600084600087516118a8565b6000805b835183106115c5576115c56120b0565b60006115d18585610e58565b60ff1690506115e1816001611ffc565b6115eb9085611ffc565b9350806000036115fb575061111e565b611606600183611ffc565b9150506115b5565b600061161a8383610e58565b60ff16611628836001611ffc565b61111e9190611ffc565b600061164b8383848651611646919061200f565b610e7c565b61165d8686878951611646919061200f565b1495945050505050565b85516000906116768688611ffc565b11156116aa576116868587611ffc565b8751604051638a3c1cfb60e01b815260048101929092526024820152604401610352565b83516116b68385611ffc565b11156116ea576116c68284611ffc565b8451604051638a3c1cfb60e01b815260048101929092526024820152604401610352565b84808310156116f65750815b60208789018101908587010160005b838110156117ca578251825180821461179a5760006020611726858961200f565b106117345750600019611770565b600187611742866020611ffc565b61174c919061200f565b611757906008612099565b6117629060026121aa565b61176c919061200f565b1990505b60006117808383168584166121b6565b905080156117975797506117db9650505050505050565b50505b6117a5602086611ffc565b94506117b2602085611ffc565b935050506020816117c39190611ffc565b9050611705565b506117d585896121b6565b93505050505b9695505050505050565b6000806117f28585611861565b63ffffffff1663613d30781461180d5750600090508061136b565b61182d61181b856004611ffc565b6118258587611ffc565b8791906118cb565b91509150935093915050565b8151600090611849836002611ffc565b111561185457600080fd5b50016002015161ffff1690565b8151600090611871836004611ffc565b111561187c57600080fd5b50016004015163ffffffff1690565b81516118978383611086565b506118a283826110fd565b50505050565b60006118b5848484610e7c565b6118c0878785610e7c565b149695505050505050565b60008060286118da858561200f565b10156118eb5750600090508061136b565b6000806118f9878787611907565b909890975095505050505050565b60008080611915858561200f565b905080604014158015611929575080602814155b8061193e575061193a600282612060565b6001145b156119a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610352565b6001915085518411156119b757600080fd5b611a08565b6000603a8210602f831116156119d45750602f190190565b604782106040831116156119ea57506036190190565b60678210606083111615611a0057506056190190565b5060ff919050565b60208601855b85811015611a6a57611a258183015160001a6119bc565b611a376001830184015160001a6119bc565b60ff811460ff83141715611a5057600095505050611a6a565b60049190911b1760089590951b9490941793600201611a0e565b505050935093915050565b600060208284031215611a8757600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461111e57600080fd5b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715611af057611af0611ab7565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611b1f57611b1f611ab7565b604052919050565b600067ffffffffffffffff821115611b4157611b41611ab7565b50601f01601f191660200190565b600082601f830112611b6057600080fd5b8135611b73611b6e82611b27565b611af6565b818152846020838601011115611b8857600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112611bb657600080fd5b8135602067ffffffffffffffff80831115611bd357611bd3611ab7565b8260051b611be2838201611af6565b9384528581018301938381019088861115611bfc57600080fd5b84880192505b85831015611c9357823584811115611c1a5760008081fd5b88016040818b03601f1901811315611c325760008081fd5b611c3a611acd565b8783013587811115611c4c5760008081fd5b611c5a8d8a83870101611b4f565b825250908201359086821115611c705760008081fd5b611c7e8c8984860101611b4f565b81890152845250509184019190840190611c02565b98975050505050505050565b6001600160a01b0381168114611cb457600080fd5b50565b60008060008060808587031215611ccd57600080fd5b843567ffffffffffffffff80821115611ce557600080fd5b611cf188838901611b4f565b95506020870135915080821115611d0757600080fd5b50611d1487828801611ba5565b9350506040850135611d2581611c9f565b91506060850135611d3581611c9f565b939692955090935050565b600060208284031215611d5257600080fd5b813561111e81611c9f565b600060208284031215611d6f57600080fd5b5035919050565b60008060408385031215611d8957600080fd5b823567ffffffffffffffff80821115611da157600080fd5b611dad86838701611b4f565b93506020850135915080821115611dc357600080fd5b50611dd085828601611ba5565b9150509250929050565b600060208284031215611dec57600080fd5b813567ffffffffffffffff811115611e0357600080fd5b61158b84828501611b4f565b600060208284031215611e2157600080fd5b815161111e81611c9f565b600060208284031215611e3e57600080fd5b5051919050565b60005b83811015611e60578181015183820152602001611e48565b50506000910152565b60008151808452611e81816020860160208601611e45565b601f01601f19169290920160200192915050565b60208152600061111e6020830184611e69565b600060208284031215611eba57600080fd5b8151801515811461111e57600080fd5b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015611f4157888303603f1901855281518051878552611f1588860182611e69565b91890151858303868b0152919050611f2d8183611e69565b968901969450505090860190600101611ef1565b509098975050505050505050565b60008060408385031215611f6257600080fd5b825167ffffffffffffffff811115611f7957600080fd5b8301601f81018513611f8a57600080fd5b8051611f98611b6e82611b27565b818152866020838501011115611fad57600080fd5b611fbe826020830160208601611e45565b809450505050602083015163ffffffff81168114611fdb57600080fd5b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b808201808211156102e7576102e7611fe6565b818103818111156102e7576102e7611fe6565b6040815260006120356040830185611e69565b905063ffffffff831660208301529392505050565b634e487b7160e01b600052603260045260246000fd5b60008261207d57634e487b7160e01b600052601260045260246000fd5b500690565b60008161209157612091611fe6565b506000190190565b80820281158282048414176102e7576102e7611fe6565b634e487b7160e01b600052600160045260246000fd5b600181815b808511156121015781600019048211156120e7576120e7611fe6565b808516156120f457918102915b93841c93908002906120cb565b509250929050565b600082612118575060016102e7565b81612125575060006102e7565b816001811461213b576002811461214557612161565b60019150506102e7565b60ff84111561215657612156611fe6565b50506001821b6102e7565b5060208310610133831016604e8410600b8410161715612184575081810a6102e7565b61218e83836120c6565b80600019048211156121a2576121a2611fe6565b029392505050565b600061111e8383612109565b81810360008312801583831316838312821617156121d6576121d6611fe6565b509291505056fea26469706673582212204fd3172855fc29f1ee29f5099e32e8c1f163dcac07aa16324d9f13cbd4f6ee7164736f6c63430008110033", + "devdoc": { + "details": "An ENS registrar that allows the owner of a DNS name to claim the corresponding name in ENS.", + "kind": "dev", + "methods": { + "proveAndClaim(bytes,(bytes,bytes)[])": { + "details": "Submits proofs to the DNSSEC oracle, then claims a name using those proofs.", + "params": { + "input": "A chain of signed DNS RRSETs ending with a text record.", + "name": "The name to claim, in DNS wire format." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 4358, + "contract": "contracts/dnsregistrar/DNSRegistrar.sol:DNSRegistrar", + "label": "suffixes", + "offset": 0, + "slot": "0", + "type": "t_contract(PublicSuffixList)5847" + }, + { + "astId": 4366, + "contract": "contracts/dnsregistrar/DNSRegistrar.sol:DNSRegistrar", + "label": "inceptions", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_uint32)" + } + ], + "types": { + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(PublicSuffixList)5847": { + "encoding": "inplace", + "label": "contract PublicSuffixList", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes32,t_uint32)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint32)", + "numberOfBytes": "32", + "value": "t_uint32" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/DNSSECImpl.json b/solidity/dns-contracts/deployments/holesky/DNSSECImpl.json new file mode 100644 index 0000000..607abdf --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/DNSSECImpl.json @@ -0,0 +1,530 @@ +{ + "address": "0x283af0b28c62c092c9727f1ee09c02ca627eb7f5", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "_anchors", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "class", + "type": "uint16" + } + ], + "name": "InvalidClass", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "labelsExpected", + "type": "uint256" + } + ], + "name": "InvalidLabelCount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "proofType", + "type": "uint16" + } + ], + "name": "InvalidProofType", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidRRSet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "rrsetName", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signerName", + "type": "bytes" + } + ], + "name": "InvalidSignerName", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "signerName", + "type": "bytes" + } + ], + "name": "NoMatchingProof", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "signerName", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "proofName", + "type": "bytes" + } + ], + "name": "ProofNameMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "expiration", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "now", + "type": "uint32" + } + ], + "name": "SignatureExpired", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "inception", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "now", + "type": "uint32" + } + ], + "name": "SignatureNotValidYet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "rrsetType", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "sigType", + "type": "uint16" + } + ], + "name": "SignatureTypeMismatch", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "AlgorithmUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "DigestUpdated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "algorithms", + "outputs": [ + { + "internalType": "contract Algorithm", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "anchors", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "digests", + "outputs": [ + { + "internalType": "contract Digest", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "internalType": "contract Algorithm", + "name": "algo", + "type": "address" + } + ], + "name": "setAlgorithm", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "internalType": "contract Digest", + "name": "digest", + "type": "address" + } + ], + "name": "setDigest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature[]", + "name": "input", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "now", + "type": "uint256" + } + ], + "name": "verifyRRSet", + "outputs": [ + { + "internalType": "bytes", + "name": "rrs", + "type": "bytes" + }, + { + "internalType": "uint32", + "name": "inception", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature[]", + "name": "input", + "type": "tuple[]" + } + ], + "name": "verifyRRSet", + "outputs": [ + { + "internalType": "bytes", + "name": "rrs", + "type": "bytes" + }, + { + "internalType": "uint32", + "name": "inception", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xded63028a23889e108f86b26eb44c2ad5811510c056c6630934c4707e1a745e2", + "receipt": { + "to": null, + "from": "0x4fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8", + "contractAddress": "0x283af0b28c62c092c9727f1ee09c02ca627eb7f5", + "transactionIndex": "0xe", + "gasUsed": "0x1bf79b", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x3930101852cfc46a6c2964b6a1c125694af151007566c7a62d874e2c7aad51f7", + "transactionHash": "0xdc2c57ca3098b501ef3f7712cc8416386982abcc73d79fd36e8afcd177a71aa1", + "logs": [], + "blockNumber": "0xc3e0f", + "cumulativeGasUsed": "0x2d0a95", + "status": "0x1" + }, + "args": [ + "0x00002b000100000e1000244a5c080249aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb500002b000100000e1000244f660802e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d00002b000100000e10000404fefdfd" + ], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_anchors\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"class\",\"type\":\"uint16\"}],\"name\":\"InvalidClass\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"labelsExpected\",\"type\":\"uint256\"}],\"name\":\"InvalidLabelCount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"proofType\",\"type\":\"uint16\"}],\"name\":\"InvalidProofType\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRRSet\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"rrsetName\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signerName\",\"type\":\"bytes\"}],\"name\":\"InvalidSignerName\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signerName\",\"type\":\"bytes\"}],\"name\":\"NoMatchingProof\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signerName\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"proofName\",\"type\":\"bytes\"}],\"name\":\"ProofNameMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"expiration\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"now\",\"type\":\"uint32\"}],\"name\":\"SignatureExpired\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"inception\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"now\",\"type\":\"uint32\"}],\"name\":\"SignatureNotValidYet\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"rrsetType\",\"type\":\"uint16\"},{\"internalType\":\"uint16\",\"name\":\"sigType\",\"type\":\"uint16\"}],\"name\":\"SignatureTypeMismatch\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"AlgorithmUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"DigestUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"algorithms\",\"outputs\":[{\"internalType\":\"contract Algorithm\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"anchors\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"digests\",\"outputs\":[{\"internalType\":\"contract Digest\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"internalType\":\"contract Algorithm\",\"name\":\"algo\",\"type\":\"address\"}],\"name\":\"setAlgorithm\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"internalType\":\"contract Digest\",\"name\":\"digest\",\"type\":\"address\"}],\"name\":\"setDigest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature[]\",\"name\":\"input\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"now\",\"type\":\"uint256\"}],\"name\":\"verifyRRSet\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"rrs\",\"type\":\"bytes\"},{\"internalType\":\"uint32\",\"name\":\"inception\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature[]\",\"name\":\"input\",\"type\":\"tuple[]\"}],\"name\":\"verifyRRSet\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"rrs\",\"type\":\"bytes\"},{\"internalType\":\"uint32\",\"name\":\"inception\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_anchors\":\"The binary format RR entries for the root DS records.\"}},\"setAlgorithm(uint8,address)\":{\"details\":\"Sets the contract address for a signature verification algorithm. Callable only by the owner.\",\"params\":{\"algo\":\"The address of the algorithm contract.\",\"id\":\"The algorithm ID\"}},\"setDigest(uint8,address)\":{\"details\":\"Sets the contract address for a digest verification algorithm. Callable only by the owner.\",\"params\":{\"digest\":\"The address of the digest contract.\",\"id\":\"The digest ID\"}},\"verifyRRSet((bytes,bytes)[])\":{\"details\":\"Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain. Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\",\"params\":{\"input\":\"A list of signed RRSets.\"},\"returns\":{\"inception\":\"The inception time of the signed record set.\",\"rrs\":\"The RRData from the last RRSet in the chain.\"}},\"verifyRRSet((bytes,bytes)[],uint256)\":{\"details\":\"Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain. Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\",\"params\":{\"input\":\"A list of signed RRSets.\",\"now\":\"The Unix timestamp to validate the records at.\"},\"returns\":{\"inception\":\"The inception time of the signed record set.\",\"rrs\":\"The RRData from the last RRSet in the chain.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/DNSSECImpl.sol\":\"DNSSECImpl\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-2-Clause\\npragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for appending to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n let fpm := add(32, add(ptr, capacity))\\n if lt(fpm, ptr) {\\n revert(0, 0)\\n }\\n mstore(0x40, fpm)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n uint off = buf.buf.length;\\n uint newCapacity = off + len;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(newCapacity, buflen) {\\n mstore(bufptr, newCapacity)\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return append(buf, data, data.length);\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint offPlusOne = off + 1;\\n if (off >= buf.capacity) {\\n resize(buf, offPlusOne * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if gt(offPlusOne, mload(bufptr)) {\\n mstore(bufptr, offPlusOne)\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return append(buf, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return append(buf, data, 32);\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n return buf;\\n }\\n}\\n\",\"keccak256\":\"0xd6dd3b0b327288f8e1b711a609f4040fea602e2ad4bba9febdf2f33b4e56eb0c\",\"license\":\"BSD-2-Clause\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/DNSSEC.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nabstract contract DNSSEC {\\n bytes public anchors;\\n\\n struct RRSetWithSignature {\\n bytes rrset;\\n bytes sig;\\n }\\n\\n event AlgorithmUpdated(uint8 id, address addr);\\n event DigestUpdated(uint8 id, address addr);\\n\\n function verifyRRSet(\\n RRSetWithSignature[] memory input\\n ) external view virtual returns (bytes memory rrs, uint32 inception);\\n\\n function verifyRRSet(\\n RRSetWithSignature[] memory input,\\n uint256 now\\n ) public view virtual returns (bytes memory rrs, uint32 inception);\\n}\\n\",\"keccak256\":\"0xee6a236a59e5db8418c98ee4640a91987d26533c02d305cc6c7a37a3ac4ee907\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/DNSSECImpl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nimport \\\"./Owned.sol\\\";\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"./RRUtils.sol\\\";\\nimport \\\"./DNSSEC.sol\\\";\\nimport \\\"./algorithms/Algorithm.sol\\\";\\nimport \\\"./digests/Digest.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/*\\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\\n * - Proofs involving wildcard names will not validate.\\n * - TTLs on records are ignored, as data is not stored persistently.\\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\\n */\\ncontract DNSSECImpl is DNSSEC, Owned {\\n using Buffer for Buffer.buffer;\\n using BytesUtils for bytes;\\n using RRUtils for *;\\n\\n uint16 constant DNSCLASS_IN = 1;\\n\\n uint16 constant DNSTYPE_DS = 43;\\n uint16 constant DNSTYPE_DNSKEY = 48;\\n\\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\\n\\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\\n error SignatureNotValidYet(uint32 inception, uint32 now);\\n error SignatureExpired(uint32 expiration, uint32 now);\\n error InvalidClass(uint16 class);\\n error InvalidRRSet();\\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\\n error InvalidSignerName(bytes rrsetName, bytes signerName);\\n error InvalidProofType(uint16 proofType);\\n error ProofNameMismatch(bytes signerName, bytes proofName);\\n error NoMatchingProof(bytes signerName);\\n\\n mapping(uint8 => Algorithm) public algorithms;\\n mapping(uint8 => Digest) public digests;\\n\\n /**\\n * @dev Constructor.\\n * @param _anchors The binary format RR entries for the root DS records.\\n */\\n constructor(bytes memory _anchors) {\\n // Insert the 'trust anchors' - the key hashes that start the chain\\n // of trust for all other records.\\n anchors = _anchors;\\n }\\n\\n /**\\n * @dev Sets the contract address for a signature verification algorithm.\\n * Callable only by the owner.\\n * @param id The algorithm ID\\n * @param algo The address of the algorithm contract.\\n */\\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\\n algorithms[id] = algo;\\n emit AlgorithmUpdated(id, address(algo));\\n }\\n\\n /**\\n * @dev Sets the contract address for a digest verification algorithm.\\n * Callable only by the owner.\\n * @param id The digest ID\\n * @param digest The address of the digest contract.\\n */\\n function setDigest(uint8 id, Digest digest) public owner_only {\\n digests[id] = digest;\\n emit DigestUpdated(id, address(digest));\\n }\\n\\n /**\\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\\n * @param input A list of signed RRSets.\\n * @return rrs The RRData from the last RRSet in the chain.\\n * @return inception The inception time of the signed record set.\\n */\\n function verifyRRSet(\\n RRSetWithSignature[] memory input\\n )\\n external\\n view\\n virtual\\n override\\n returns (bytes memory rrs, uint32 inception)\\n {\\n return verifyRRSet(input, block.timestamp);\\n }\\n\\n /**\\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\\n * @param input A list of signed RRSets.\\n * @param now The Unix timestamp to validate the records at.\\n * @return rrs The RRData from the last RRSet in the chain.\\n * @return inception The inception time of the signed record set.\\n */\\n function verifyRRSet(\\n RRSetWithSignature[] memory input,\\n uint256 now\\n )\\n public\\n view\\n virtual\\n override\\n returns (bytes memory rrs, uint32 inception)\\n {\\n bytes memory proof = anchors;\\n for (uint256 i = 0; i < input.length; i++) {\\n RRUtils.SignedSet memory rrset = validateSignedSet(\\n input[i],\\n proof,\\n now\\n );\\n proof = rrset.data;\\n inception = rrset.inception;\\n }\\n return (proof, inception);\\n }\\n\\n /**\\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\\n *\\n * @param input The signed RR set. This is in the format described in section\\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\\n * data, followed by a series of canonicalised RR records that the signature\\n * applies to.\\n * @param proof The DNSKEY or DS to validate the signature against.\\n * @param now The current timestamp.\\n */\\n function validateSignedSet(\\n RRSetWithSignature memory input,\\n bytes memory proof,\\n uint256 now\\n ) internal view returns (RRUtils.SignedSet memory rrset) {\\n rrset = input.rrset.readSignedSet();\\n\\n // Do some basic checks on the RRs and extract the name\\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\\n if (name.labelCount(0) != rrset.labels) {\\n revert InvalidLabelCount(name, rrset.labels);\\n }\\n rrset.name = name;\\n\\n // All comparisons involving the Signature Expiration and\\n // Inception fields MUST use \\\"serial number arithmetic\\\", as\\n // defined in RFC 1982\\n\\n // o The validator's notion of the current time MUST be less than or\\n // equal to the time listed in the RRSIG RR's Expiration field.\\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\\n revert SignatureExpired(rrset.expiration, uint32(now));\\n }\\n\\n // o The validator's notion of the current time MUST be greater than or\\n // equal to the time listed in the RRSIG RR's Inception field.\\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\\n revert SignatureNotValidYet(rrset.inception, uint32(now));\\n }\\n\\n // Validate the signature\\n verifySignature(name, rrset, input, proof);\\n\\n return rrset;\\n }\\n\\n /**\\n * @dev Validates a set of RRs.\\n * @param rrset The RR set.\\n * @param typecovered The type covered by the RRSIG record.\\n */\\n function validateRRs(\\n RRUtils.SignedSet memory rrset,\\n uint16 typecovered\\n ) internal pure returns (bytes memory name) {\\n // Iterate over all the RRs\\n for (\\n RRUtils.RRIterator memory iter = rrset.rrs();\\n !iter.done();\\n iter.next()\\n ) {\\n // We only support class IN (Internet)\\n if (iter.class != DNSCLASS_IN) {\\n revert InvalidClass(iter.class);\\n }\\n\\n if (name.length == 0) {\\n name = iter.name();\\n } else {\\n // Name must be the same on all RRs. We do things this way to avoid copying the name\\n // repeatedly.\\n if (\\n name.length != iter.data.nameLength(iter.offset) ||\\n !name.equals(0, iter.data, iter.offset, name.length)\\n ) {\\n revert InvalidRRSet();\\n }\\n }\\n\\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\\n if (iter.dnstype != typecovered) {\\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\\n }\\n }\\n }\\n\\n /**\\n * @dev Performs signature verification.\\n *\\n * Throws or reverts if unable to verify the record.\\n *\\n * @param name The name of the RRSIG record, in DNS label-sequence format.\\n * @param data The original data to verify.\\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\\n */\\n function verifySignature(\\n bytes memory name,\\n RRUtils.SignedSet memory rrset,\\n RRSetWithSignature memory data,\\n bytes memory proof\\n ) internal view {\\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\\n // that contains the RRset.\\n if (!name.isSubdomainOf(rrset.signerName)) {\\n revert InvalidSignerName(name, rrset.signerName);\\n }\\n\\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\\n // Check the proof\\n if (proofRR.dnstype == DNSTYPE_DS) {\\n verifyWithDS(rrset, data, proofRR);\\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\\n verifyWithKnownKey(rrset, data, proofRR);\\n } else {\\n revert InvalidProofType(proofRR.dnstype);\\n }\\n }\\n\\n /**\\n * @dev Attempts to verify a signed RRSET against an already known public key.\\n * @param rrset The signed set to verify.\\n * @param data The original data the signed set was read from.\\n * @param proof The serialized DS or DNSKEY record to use as proof.\\n */\\n function verifyWithKnownKey(\\n RRUtils.SignedSet memory rrset,\\n RRSetWithSignature memory data,\\n RRUtils.RRIterator memory proof\\n ) internal view {\\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\\n for (; !proof.done(); proof.next()) {\\n bytes memory proofName = proof.name();\\n if (!proofName.equals(rrset.signerName)) {\\n revert ProofNameMismatch(rrset.signerName, proofName);\\n }\\n\\n bytes memory keyrdata = proof.rdata();\\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\\n 0,\\n keyrdata.length\\n );\\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\\n return;\\n }\\n }\\n revert NoMatchingProof(rrset.signerName);\\n }\\n\\n /**\\n * @dev Attempts to verify some data using a provided key and a signature.\\n * @param dnskey The dns key record to verify the signature with.\\n * @param rrset The signed RRSET being verified.\\n * @param data The original data `rrset` was decoded from.\\n * @return True iff the key verifies the signature.\\n */\\n function verifySignatureWithKey(\\n RRUtils.DNSKEY memory dnskey,\\n bytes memory keyrdata,\\n RRUtils.SignedSet memory rrset,\\n RRSetWithSignature memory data\\n ) internal view returns (bool) {\\n // TODO: Check key isn't expired, unless updating key itself\\n\\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\\n if (dnskey.protocol != 3) {\\n return false;\\n }\\n\\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\\n // the zone's apex DNSKEY RRset.\\n if (dnskey.algorithm != rrset.algorithm) {\\n return false;\\n }\\n uint16 computedkeytag = keyrdata.computeKeytag();\\n if (computedkeytag != rrset.keytag) {\\n return false;\\n }\\n\\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\\n // set.\\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\\n return false;\\n }\\n\\n Algorithm algorithm = algorithms[dnskey.algorithm];\\n if (address(algorithm) == address(0)) {\\n return false;\\n }\\n return algorithm.verify(keyrdata, data.rrset, data.sig);\\n }\\n\\n /**\\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\\n * that the record\\n * @param rrset The signed set to verify.\\n * @param data The original data the signed set was read from.\\n * @param proof The serialized DS or DNSKEY record to use as proof.\\n */\\n function verifyWithDS(\\n RRUtils.SignedSet memory rrset,\\n RRSetWithSignature memory data,\\n RRUtils.RRIterator memory proof\\n ) internal view {\\n uint256 proofOffset = proof.offset;\\n for (\\n RRUtils.RRIterator memory iter = rrset.rrs();\\n !iter.done();\\n iter.next()\\n ) {\\n if (iter.dnstype != DNSTYPE_DNSKEY) {\\n revert InvalidProofType(iter.dnstype);\\n }\\n\\n bytes memory keyrdata = iter.rdata();\\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\\n 0,\\n keyrdata.length\\n );\\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\\n // It's self-signed - look for a DS record to verify it.\\n if (\\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\\n ) {\\n return;\\n }\\n // Rewind proof iterator to the start for the next loop iteration.\\n proof.nextOffset = proofOffset;\\n proof.next();\\n }\\n }\\n revert NoMatchingProof(rrset.signerName);\\n }\\n\\n /**\\n * @dev Attempts to verify a key using DS records.\\n * @param keyname The DNS name of the key, in DNS label-sequence format.\\n * @param dsrrs The DS records to use in verification.\\n * @param dnskey The dnskey to verify.\\n * @param keyrdata The RDATA section of the key.\\n * @return True if a DS record verifies this key.\\n */\\n function verifyKeyWithDS(\\n bytes memory keyname,\\n RRUtils.RRIterator memory dsrrs,\\n RRUtils.DNSKEY memory dnskey,\\n bytes memory keyrdata\\n ) internal view returns (bool) {\\n uint16 keytag = keyrdata.computeKeytag();\\n for (; !dsrrs.done(); dsrrs.next()) {\\n bytes memory proofName = dsrrs.name();\\n if (!proofName.equals(keyname)) {\\n revert ProofNameMismatch(keyname, proofName);\\n }\\n\\n RRUtils.DS memory ds = dsrrs.data.readDS(\\n dsrrs.rdataOffset,\\n dsrrs.nextOffset - dsrrs.rdataOffset\\n );\\n if (ds.keytag != keytag) {\\n continue;\\n }\\n if (ds.algorithm != dnskey.algorithm) {\\n continue;\\n }\\n\\n Buffer.buffer memory buf;\\n buf.init(keyname.length + keyrdata.length);\\n buf.append(keyname);\\n buf.append(keyrdata);\\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\\n return true;\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Attempts to verify a DS record's hash value against some data.\\n * @param digesttype The digest ID from the DS record.\\n * @param data The data to digest.\\n * @param digest The digest data to check against.\\n * @return True iff the digest matches.\\n */\\n function verifyDSHash(\\n uint8 digesttype,\\n bytes memory data,\\n bytes memory digest\\n ) internal view returns (bool) {\\n if (address(digests[digesttype]) == address(0)) {\\n return false;\\n }\\n return digests[digesttype].verify(data, digest);\\n }\\n}\\n\",\"keccak256\":\"0x671fea3a3332453eecc08c082f264011aa8cfa99fb3c03adf73443843aed5128\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/Owned.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev Contract mixin for 'owned' contracts.\\n */\\ncontract Owned {\\n address public owner;\\n\\n modifier owner_only() {\\n require(msg.sender == owner);\\n _;\\n }\\n\\n constructor() public {\\n owner = msg.sender;\\n }\\n\\n function setOwner(address newOwner) public owner_only {\\n owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x49f57dcb9d79015f917e569b4318b766bee9920f72e11a1f5331eabebfc1eb24\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n */\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint256 labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes memory ret) {\\n uint256 len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint256 labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint256 constant RRSIG_TYPE = 0;\\n uint256 constant RRSIG_ALGORITHM = 2;\\n uint256 constant RRSIG_LABELS = 3;\\n uint256 constant RRSIG_TTL = 4;\\n uint256 constant RRSIG_EXPIRATION = 8;\\n uint256 constant RRSIG_INCEPTION = 12;\\n uint256 constant RRSIG_KEY_TAG = 16;\\n uint256 constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(\\n bytes memory data\\n ) internal pure returns (SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(\\n RRSIG_SIGNER_NAME + self.signerName.length,\\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\\n );\\n }\\n\\n function rrs(\\n SignedSet memory rrset\\n ) internal pure returns (RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint256 offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint256 rdataOffset;\\n uint256 nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns (bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint256 rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.offset,\\n nameLength(iter.data, iter.offset)\\n );\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(\\n RRIterator memory iter\\n ) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.rdataOffset,\\n iter.nextOffset - iter.rdataOffset\\n );\\n }\\n\\n uint256 constant DNSKEY_FLAGS = 0;\\n uint256 constant DNSKEY_PROTOCOL = 2;\\n uint256 constant DNSKEY_ALGORITHM = 3;\\n uint256 constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(\\n offset + DNSKEY_PUBKEY,\\n length - DNSKEY_PUBKEY\\n );\\n }\\n\\n uint256 constant DS_KEY_TAG = 0;\\n uint256 constant DS_ALGORITHM = 2;\\n uint256 constant DS_DIGEST_TYPE = 3;\\n uint256 constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n function isSubdomainOf(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n uint256 off = 0;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n while (counts > othercounts) {\\n off = progress(self, off);\\n counts--;\\n }\\n\\n return self.equals(off, other, 0);\\n }\\n\\n function compareNames(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint256 off;\\n uint256 otheroff;\\n uint256 prevoff;\\n uint256 otherprevoff;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if (otheroff == 0) {\\n return 1;\\n }\\n\\n return\\n self.compare(\\n prevoff + 1,\\n self.readUint8(prevoff),\\n other,\\n otherprevoff + 1,\\n other.readUint8(otherprevoff)\\n );\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(\\n uint32 i1,\\n uint32 i2\\n ) internal pure returns (bool) {\\n unchecked {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n }\\n\\n function progress(\\n bytes memory body,\\n uint256 off\\n ) internal pure returns (uint256) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint256 ac1;\\n uint256 ac2;\\n for (uint256 i = 0; i < data.length + 31; i += 32) {\\n uint256 word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if (i + 32 > data.length) {\\n uint256 unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 +=\\n (word &\\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\\n 8;\\n ac2 += (word &\\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 =\\n (ac1 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac1 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac2 =\\n (ac2 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac2 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 =\\n (ac1 &\\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\\n 32);\\n ac1 =\\n (ac1 &\\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\\n 64);\\n ac1 =\\n (ac1 &\\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\\n (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4dd68a6efd7c38f6b0e95ca0c056ecb74f88583da650b1a8639e6e78be36fede\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n */\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata signature\\n ) external view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xaf6825f9852c69f8e36540821d067b4550dd2263497af9d645309b6a0c457ba6\"},\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC digest.\\n */\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(\\n bytes calldata data,\\n bytes calldata hash\\n ) external pure virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x8ea926b2db0578c4ad7fce4582fc0f6f0f9efee8dca2085dbdb9984f18941e28\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506040516200205638038062002056833981016040819052620000349162000072565b600180546001600160a01b031916331790556000620000548282620001d6565b5050620002a2565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156200008657600080fd5b82516001600160401b03808211156200009e57600080fd5b818501915085601f830112620000b357600080fd5b815181811115620000c857620000c86200005c565b604051601f8201601f19908116603f01168101908382118183101715620000f357620000f36200005c565b8160405282815288868487010111156200010c57600080fd5b600093505b8284101562000130578484018601518185018701529285019262000111565b600086848301015280965050505050505092915050565b600181811c908216806200015c57607f821691505b6020821081036200017d57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620001d157600081815260208120601f850160051c81016020861015620001ac5750805b601f850160051c820191505b81811015620001cd57828155600101620001b8565b5050505b505050565b81516001600160401b03811115620001f257620001f26200005c565b6200020a8162000203845462000147565b8462000183565b602080601f831160018114620002425760008415620002295750858301515b600019600386901b1c1916600185901b178555620001cd565b600085815260208120601f198616915b82811015620002735788860151825594840194600190910190840162000252565b5085821015620002925787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b611da480620002b26000396000f3fe608060405234801561001057600080fd5b50600436106100a35760003560e01c806373cc48a61161007657806398d35f201161005b57806398d35f2014610161578063bdf95fef14610176578063c327deef1461018957600080fd5b806373cc48a61461010d5780638da5cb5b1461014e57600080fd5b8063020ed8d3146100a857806313af4035146100bd57806328e7677d146100d0578063440f3d42146100e3575b600080fd5b6100bb6100b6366004611871565b6101b2565b005b6100bb6100cb3660046118a8565b610241565b6100bb6100de366004611871565b610287565b6100f66100f1366004611a9f565b61030e565b604051610104929190611b2a565b60405180910390f35b61013661011b366004611b52565b6003602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610104565b600154610136906001600160a01b031681565b610169610400565b6040516101049190611b6d565b6100f6610184366004611b80565b61048e565b610136610197366004611b52565b6002602052600090815260409020546001600160a01b031681565b6001546001600160a01b031633146101c957600080fd5b60ff8216600081815260026020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386169081179091558251938452908301527ff73c3c226af96b7f1ba666a21b3ceaf2be3ee6a365e3178fd9cd1eaae0075aa891015b60405180910390a15050565b6001546001600160a01b0316331461025857600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001546001600160a01b0316331461029e57600080fd5b60ff8216600081815260036020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386169081179091558251938452908301527f2fcc274c3b72dd483ab201bfa87295e3817e8b9b10693219873b722ca1af00c79101610235565b60606000806000805461032090611bb5565b80601f016020809104026020016040519081016040528092919081815260200182805461034c90611bb5565b80156103995780601f1061036e57610100808354040283529160200191610399565b820191906000526020600020905b81548152906001019060200180831161037c57829003601f168201915b5050505050905060005b85518110156103f65760006103d28783815181106103c3576103c3611bef565b602002602001015184886104a5565b61010081015160a090910151945092508190506103ee81611c1b565b9150506103a3565b5091509250929050565b6000805461040d90611bb5565b80601f016020809104026020016040519081016040528092919081815260200182805461043990611bb5565b80156104865780601f1061045b57610100808354040283529160200191610486565b820191906000526020600020905b81548152906001019060200180831161046957829003601f168201915b505050505081565b6060600061049c834261030e565b91509150915091565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c082019290925260e081018290526101008101829052610120810191909152835161050390610647565b90506000610515828360000151610789565b604083015190915060ff1661052b8260006108e6565b14610573578082604001516040517fe861b2bd00000000000000000000000000000000000000000000000000000000815260040161056a929190611c34565b60405180910390fd5b6101208201819052608082015160009084900360030b12156105d75760808201516040517fa784f87e00000000000000000000000000000000000000000000000000000000815263ffffffff9182166004820152908416602482015260440161056a565b60a0820151600090840360030b12156106325760a08201516040517fbd41036a00000000000000000000000000000000000000000000000000000000815263ffffffff9182166004820152908416602482015260440161056a565b61063e8183878761094c565b505b9392505050565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e082018190526101008201819052610120820152906106a2908390610a16565b61ffff1681526106b3826002610a3e565b60ff1660208201526106c6826003610a3e565b60ff1660408201526106d9826004610a62565b63ffffffff90811660608301526106f5908390600890610a6216565b63ffffffff9081166080830152610711908390600c90610a6216565b63ffffffff90811660a083015261072d908390601090610a1616565b61ffff1660c0820152610741826012610a8c565b60e082018190525161077e90610758906012611c59565b8260e00151516012855161076c9190611c6c565b6107769190611c6c565b849190610aaf565b610100820152919050565b6060600061079684610b31565b90505b805151602082015110156108df57606081015161ffff166001146107f55760608101516040517f98a5f31a00000000000000000000000000000000000000000000000000000000815261ffff909116600482015260240161056a565b815160000361080e5761080781610b8f565b9150610878565b6020810151815161081e91610bb0565b8251141580610841575080516020820151835161083f928592600092610c0a565b155b15610878576040517fcbceee6f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8261ffff16816040015161ffff16146108d15760408082015190517fa6ff8a8a00000000000000000000000000000000000000000000000000000000815261ffff9182166004820152908416602482015260440161056a565b6108da81610c2d565b610799565b5092915050565b6000805b835183106108fa576108fa611c7f565b60006109068585610a3e565b60ff169050610916816001611c59565b6109209085611c59565b9350806000036109305750610943565b61093b600183611c59565b9150506108ea565b90505b92915050565b60e083015161095c908590610d15565b6109995760e08301516040517feaafc59b00000000000000000000000000000000000000000000000000000000815261056a918691600401611c95565b60006109a58282610d72565b9050602b61ffff16816040015161ffff16036109cb576109c6848483610dd3565b610a0f565b603061ffff16816040015161ffff16036109ea576109c6848483610ec0565b60408082015190516361529e8760e01b815261ffff909116600482015260240161056a565b5050505050565b8151600090610a26836002611c59565b1115610a3157600080fd5b50016002015161ffff1690565b6000828281518110610a5257610a52611bef565b016020015160f81c905092915050565b8151600090610a72836004611c59565b1115610a7d57600080fd5b50016004015163ffffffff1690565b60606000610a9a8484610bb0565b9050610aa7848483610aaf565b949350505050565b8251606090610abe8385611c59565b1115610ac957600080fd5b60008267ffffffffffffffff811115610ae457610ae46118c5565b6040519080825280601f01601f191660200182016040528015610b0e576020820181803683370190505b50905060208082019086860101610b26828287610f88565b509095945050505050565b610b7f6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b6109468261010001516000610d72565b6020810151815160609161094691610ba79082610bb0565b84519190610aaf565b6000815b83518110610bc457610bc4611c7f565b6000610bd08583610a3e565b60ff169050610be0816001611c59565b610bea9083611c59565b915080600003610bfa5750610c00565b50610bb4565b610aa78382611c6c565b6000610c17848484610fde565b610c22878785610fde565b149695505050505050565b60c08101516020820181905281515111610c445750565b6000610c5882600001518360200151610bb0565b8260200151610c679190611c59565b8251909150610c769082610a16565b61ffff166040830152610c8a600282611c59565b8251909150610c999082610a16565b61ffff166060830152610cad600282611c59565b8251909150610cbc9082610a62565b63ffffffff166080830152610cd2600482611c59565b8251909150600090610ce49083610a16565b61ffff169050610cf5600283611c59565b60a084018190529150610d088183611c59565b60c0909301929092525050565b60008080610d2385826108e6565b90506000610d328560006108e6565b90505b80821115610d5b57610d478684611002565b925081610d5381611cc3565b925050610d35565b610d688684876000611026565b9695505050505050565b610dc06040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261094681610c2d565b60208101516000610de385610b31565b90505b80515160208201511015610ea057604081015161ffff16603014610e295760408082015190516361529e8760e01b815261ffff909116600482015260240161056a565b6000610e348261105b565b90506000610e4f60008351846110779092919063ffffffff16565b9050610e5d81838989611115565b15610e9057610e728760e00151868385611254565b15610e805750505050505050565b60c08501849052610e9085610c2d565b5050610e9b81610c2d565b610de6565b508360e001516040516306cde0f360e01b815260040161056a9190611b6d565b80515160208201511015610f69576000610ed982610b8f565b9050610ef28460e001518261139190919063ffffffff16565b610f17578360e0015181604051636b80573f60e11b815260040161056a929190611c95565b6000610f228361105b565b90506000610f3d60008351846110779092919063ffffffff16565b9050610f4b81838888611115565b15610f5857505050505050565b505050610f6481610c2d565b610ec0565b8260e001516040516306cde0f360e01b815260040161056a9190611b6d565b60208110610fc05781518352610f9f602084611c59565b9250610fac602083611c59565b9150610fb9602082611c6c565b9050610f88565b905182516020929092036101000a6000190180199091169116179052565b8251600090610fed8385611c59565b1115610ff857600080fd5b5091016020012090565b600061100e8383610a3e565b60ff1661101c836001611c59565b6109439190611c59565b600061103f838384865161103a9190611c6c565b610fde565b611051868687895161103a9190611c6c565b1495945050505050565b60a081015160c082015160609161094691610ba7908290611c6c565b60408051608081018252600080825260208201819052918101919091526060808201526110af6110a8600085611c59565b8590610a16565b61ffff1681526110ca6110c3600285611c59565b8590610a3e565b60ff1660208201526110e06110c3600385611c59565b60ff1660408201526111096110f6600485611c59565b611101600485611c6c565b869190610aaf565b60608201529392505050565b6000846020015160ff1660031461112e57506000610aa7565b826020015160ff16856040015160ff161461114b57506000610aa7565b6000611156856113af565b90508360c0015161ffff168161ffff1614611175576000915050610aa7565b85516101001660000361118c576000915050610aa7565b60408087015160ff166000908152600260205220546001600160a01b0316806111ba57600092505050610aa7565b835160208501516040517fde8f50a10000000000000000000000000000000000000000000000000000000081526001600160a01b0384169263de8f50a192611208928b929190600401611cda565b602060405180830381865afa158015611225573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112499190611d13565b979650505050505050565b600080611260836113af565b90505b8451516020860151101561138557600061127c86610b8f565b90506112888188611391565b6112a9578681604051636b80573f60e11b815260040161056a929190611c95565b60a086015160c08701516000916112ce916112c5908290611c6c565b89519190611077565b90508261ffff16816000015161ffff16146112ea575050611377565b856040015160ff16816020015160ff1614611306575050611377565b60408051808201909152606081526000602082015261133386518a5161132c9190611c59565b82906115f3565b5061133e818a61166a565b50611349818761166a565b5061136182604001518260000151846060015161168b565b15611373576001945050505050610aa7565b5050505b61138085610c2d565b611263565b50600095945050505050565b60008151835114801561094357506109438360008460008751610c0a565b60006120008251111561141e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4c6f6e67206b657973206e6f74207065726d6974746564000000000000000000604482015260640161056a565b60008060005b8451601f0181101561149357600081602087010151905085518260200111156114595785518290036008026101000390811c901b5b7eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff600882901c81169490940193169190910190602001611424565b506010827fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff000016901c827dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff160191506010817fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff000016901c817dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff1601905080600883901b0191506020827fffffffff00000000ffffffff00000000ffffffff00000000ffffffff0000000016901c827bffffffff00000000ffffffff00000000ffffffff00000000ffffffff160191506040827fffffffffffffffff0000000000000000ffffffffffffffff000000000000000016901c8277ffffffffffffffff0000000000000000ffffffffffffffff16019150608082901c826fffffffffffffffffffffffffffffffff16019150601082901c61ffff16820191508192505050919050565b604080518082019091526060815260006020820152611613602083611d35565b1561163b57611623602083611d35565b61162e906020611c6c565b6116389083611c59565b91505b60208084018390526040518085526000815290818401018181101561165f57600080fd5b604052509192915050565b60408051808201909152606081526000602082015261094383838451611750565b60ff83166000908152600360205260408120546001600160a01b03166116b357506000610640565b60ff8416600090815260036020526040908190205490517ff7e83aee0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063f7e83aee9061170f9086908690600401611c95565b602060405180830381865afa15801561172c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa79190611d13565b604080518082019091526060815260006020820152825182111561177357600080fd5b83515160006117828483611c59565b905085602001518111156117a4576117a48661179f836002611d57565b611826565b8551805183820160200191600091808511156117be578482525b505050602086015b602086106117fe57805182526117dd602083611c59565b91506117ea602082611c59565b90506117f7602087611c6c565b95506117c6565b51815160001960208890036101000a0190811690199190911617905250849150509392505050565b815161183283836115f3565b5061183d838261166a565b50505050565b803560ff8116811461185457600080fd5b919050565b6001600160a01b038116811461186e57600080fd5b50565b6000806040838503121561188457600080fd5b61188d83611843565b9150602083013561189d81611859565b809150509250929050565b6000602082840312156118ba57600080fd5b813561094381611859565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156118fe576118fe6118c5565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561192d5761192d6118c5565b604052919050565b600082601f83011261194657600080fd5b813567ffffffffffffffff811115611960576119606118c5565b611973601f8201601f1916602001611904565b81815284602083860101111561198857600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f8301126119b657600080fd5b8135602067ffffffffffffffff808311156119d3576119d36118c5565b8260051b6119e2838201611904565b93845285810183019383810190888611156119fc57600080fd5b84880192505b85831015611a9357823584811115611a1a5760008081fd5b88016040818b03601f1901811315611a325760008081fd5b611a3a6118db565b8783013587811115611a4c5760008081fd5b611a5a8d8a83870101611935565b825250908201359086821115611a705760008081fd5b611a7e8c8984860101611935565b81890152845250509184019190840190611a02565b98975050505050505050565b60008060408385031215611ab257600080fd5b823567ffffffffffffffff811115611ac957600080fd5b611ad5858286016119a5565b95602094909401359450505050565b6000815180845260005b81811015611b0a57602081850181015186830182015201611aee565b506000602082860101526020601f19601f83011685010191505092915050565b604081526000611b3d6040830185611ae4565b905063ffffffff831660208301529392505050565b600060208284031215611b6457600080fd5b61094382611843565b6020815260006109436020830184611ae4565b600060208284031215611b9257600080fd5b813567ffffffffffffffff811115611ba957600080fd5b610aa7848285016119a5565b600181811c90821680611bc957607f821691505b602082108103611be957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c2d57611c2d611c05565b5060010190565b604081526000611c476040830185611ae4565b905060ff831660208301529392505050565b8082018082111561094657610946611c05565b8181038181111561094657610946611c05565b634e487b7160e01b600052600160045260246000fd5b604081526000611ca86040830185611ae4565b8281036020840152611cba8185611ae4565b95945050505050565b600081611cd257611cd2611c05565b506000190190565b606081526000611ced6060830186611ae4565b8281036020840152611cff8186611ae4565b90508281036040840152610d688185611ae4565b600060208284031215611d2557600080fd5b8151801515811461094357600080fd5b600082611d5257634e487b7160e01b600052601260045260246000fd5b500690565b808202811582820484141761094657610946611c0556fea2646970667358221220a36fa1213f53338776d2c9565e9a8b3482299a2c13495ac6aaeebf00585273ff64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a35760003560e01c806373cc48a61161007657806398d35f201161005b57806398d35f2014610161578063bdf95fef14610176578063c327deef1461018957600080fd5b806373cc48a61461010d5780638da5cb5b1461014e57600080fd5b8063020ed8d3146100a857806313af4035146100bd57806328e7677d146100d0578063440f3d42146100e3575b600080fd5b6100bb6100b6366004611871565b6101b2565b005b6100bb6100cb3660046118a8565b610241565b6100bb6100de366004611871565b610287565b6100f66100f1366004611a9f565b61030e565b604051610104929190611b2a565b60405180910390f35b61013661011b366004611b52565b6003602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610104565b600154610136906001600160a01b031681565b610169610400565b6040516101049190611b6d565b6100f6610184366004611b80565b61048e565b610136610197366004611b52565b6002602052600090815260409020546001600160a01b031681565b6001546001600160a01b031633146101c957600080fd5b60ff8216600081815260026020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386169081179091558251938452908301527ff73c3c226af96b7f1ba666a21b3ceaf2be3ee6a365e3178fd9cd1eaae0075aa891015b60405180910390a15050565b6001546001600160a01b0316331461025857600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001546001600160a01b0316331461029e57600080fd5b60ff8216600081815260036020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386169081179091558251938452908301527f2fcc274c3b72dd483ab201bfa87295e3817e8b9b10693219873b722ca1af00c79101610235565b60606000806000805461032090611bb5565b80601f016020809104026020016040519081016040528092919081815260200182805461034c90611bb5565b80156103995780601f1061036e57610100808354040283529160200191610399565b820191906000526020600020905b81548152906001019060200180831161037c57829003601f168201915b5050505050905060005b85518110156103f65760006103d28783815181106103c3576103c3611bef565b602002602001015184886104a5565b61010081015160a090910151945092508190506103ee81611c1b565b9150506103a3565b5091509250929050565b6000805461040d90611bb5565b80601f016020809104026020016040519081016040528092919081815260200182805461043990611bb5565b80156104865780601f1061045b57610100808354040283529160200191610486565b820191906000526020600020905b81548152906001019060200180831161046957829003601f168201915b505050505081565b6060600061049c834261030e565b91509150915091565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c082019290925260e081018290526101008101829052610120810191909152835161050390610647565b90506000610515828360000151610789565b604083015190915060ff1661052b8260006108e6565b14610573578082604001516040517fe861b2bd00000000000000000000000000000000000000000000000000000000815260040161056a929190611c34565b60405180910390fd5b6101208201819052608082015160009084900360030b12156105d75760808201516040517fa784f87e00000000000000000000000000000000000000000000000000000000815263ffffffff9182166004820152908416602482015260440161056a565b60a0820151600090840360030b12156106325760a08201516040517fbd41036a00000000000000000000000000000000000000000000000000000000815263ffffffff9182166004820152908416602482015260440161056a565b61063e8183878761094c565b505b9392505050565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e082018190526101008201819052610120820152906106a2908390610a16565b61ffff1681526106b3826002610a3e565b60ff1660208201526106c6826003610a3e565b60ff1660408201526106d9826004610a62565b63ffffffff90811660608301526106f5908390600890610a6216565b63ffffffff9081166080830152610711908390600c90610a6216565b63ffffffff90811660a083015261072d908390601090610a1616565b61ffff1660c0820152610741826012610a8c565b60e082018190525161077e90610758906012611c59565b8260e00151516012855161076c9190611c6c565b6107769190611c6c565b849190610aaf565b610100820152919050565b6060600061079684610b31565b90505b805151602082015110156108df57606081015161ffff166001146107f55760608101516040517f98a5f31a00000000000000000000000000000000000000000000000000000000815261ffff909116600482015260240161056a565b815160000361080e5761080781610b8f565b9150610878565b6020810151815161081e91610bb0565b8251141580610841575080516020820151835161083f928592600092610c0a565b155b15610878576040517fcbceee6f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8261ffff16816040015161ffff16146108d15760408082015190517fa6ff8a8a00000000000000000000000000000000000000000000000000000000815261ffff9182166004820152908416602482015260440161056a565b6108da81610c2d565b610799565b5092915050565b6000805b835183106108fa576108fa611c7f565b60006109068585610a3e565b60ff169050610916816001611c59565b6109209085611c59565b9350806000036109305750610943565b61093b600183611c59565b9150506108ea565b90505b92915050565b60e083015161095c908590610d15565b6109995760e08301516040517feaafc59b00000000000000000000000000000000000000000000000000000000815261056a918691600401611c95565b60006109a58282610d72565b9050602b61ffff16816040015161ffff16036109cb576109c6848483610dd3565b610a0f565b603061ffff16816040015161ffff16036109ea576109c6848483610ec0565b60408082015190516361529e8760e01b815261ffff909116600482015260240161056a565b5050505050565b8151600090610a26836002611c59565b1115610a3157600080fd5b50016002015161ffff1690565b6000828281518110610a5257610a52611bef565b016020015160f81c905092915050565b8151600090610a72836004611c59565b1115610a7d57600080fd5b50016004015163ffffffff1690565b60606000610a9a8484610bb0565b9050610aa7848483610aaf565b949350505050565b8251606090610abe8385611c59565b1115610ac957600080fd5b60008267ffffffffffffffff811115610ae457610ae46118c5565b6040519080825280601f01601f191660200182016040528015610b0e576020820181803683370190505b50905060208082019086860101610b26828287610f88565b509095945050505050565b610b7f6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b6109468261010001516000610d72565b6020810151815160609161094691610ba79082610bb0565b84519190610aaf565b6000815b83518110610bc457610bc4611c7f565b6000610bd08583610a3e565b60ff169050610be0816001611c59565b610bea9083611c59565b915080600003610bfa5750610c00565b50610bb4565b610aa78382611c6c565b6000610c17848484610fde565b610c22878785610fde565b149695505050505050565b60c08101516020820181905281515111610c445750565b6000610c5882600001518360200151610bb0565b8260200151610c679190611c59565b8251909150610c769082610a16565b61ffff166040830152610c8a600282611c59565b8251909150610c999082610a16565b61ffff166060830152610cad600282611c59565b8251909150610cbc9082610a62565b63ffffffff166080830152610cd2600482611c59565b8251909150600090610ce49083610a16565b61ffff169050610cf5600283611c59565b60a084018190529150610d088183611c59565b60c0909301929092525050565b60008080610d2385826108e6565b90506000610d328560006108e6565b90505b80821115610d5b57610d478684611002565b925081610d5381611cc3565b925050610d35565b610d688684876000611026565b9695505050505050565b610dc06040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261094681610c2d565b60208101516000610de385610b31565b90505b80515160208201511015610ea057604081015161ffff16603014610e295760408082015190516361529e8760e01b815261ffff909116600482015260240161056a565b6000610e348261105b565b90506000610e4f60008351846110779092919063ffffffff16565b9050610e5d81838989611115565b15610e9057610e728760e00151868385611254565b15610e805750505050505050565b60c08501849052610e9085610c2d565b5050610e9b81610c2d565b610de6565b508360e001516040516306cde0f360e01b815260040161056a9190611b6d565b80515160208201511015610f69576000610ed982610b8f565b9050610ef28460e001518261139190919063ffffffff16565b610f17578360e0015181604051636b80573f60e11b815260040161056a929190611c95565b6000610f228361105b565b90506000610f3d60008351846110779092919063ffffffff16565b9050610f4b81838888611115565b15610f5857505050505050565b505050610f6481610c2d565b610ec0565b8260e001516040516306cde0f360e01b815260040161056a9190611b6d565b60208110610fc05781518352610f9f602084611c59565b9250610fac602083611c59565b9150610fb9602082611c6c565b9050610f88565b905182516020929092036101000a6000190180199091169116179052565b8251600090610fed8385611c59565b1115610ff857600080fd5b5091016020012090565b600061100e8383610a3e565b60ff1661101c836001611c59565b6109439190611c59565b600061103f838384865161103a9190611c6c565b610fde565b611051868687895161103a9190611c6c565b1495945050505050565b60a081015160c082015160609161094691610ba7908290611c6c565b60408051608081018252600080825260208201819052918101919091526060808201526110af6110a8600085611c59565b8590610a16565b61ffff1681526110ca6110c3600285611c59565b8590610a3e565b60ff1660208201526110e06110c3600385611c59565b60ff1660408201526111096110f6600485611c59565b611101600485611c6c565b869190610aaf565b60608201529392505050565b6000846020015160ff1660031461112e57506000610aa7565b826020015160ff16856040015160ff161461114b57506000610aa7565b6000611156856113af565b90508360c0015161ffff168161ffff1614611175576000915050610aa7565b85516101001660000361118c576000915050610aa7565b60408087015160ff166000908152600260205220546001600160a01b0316806111ba57600092505050610aa7565b835160208501516040517fde8f50a10000000000000000000000000000000000000000000000000000000081526001600160a01b0384169263de8f50a192611208928b929190600401611cda565b602060405180830381865afa158015611225573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112499190611d13565b979650505050505050565b600080611260836113af565b90505b8451516020860151101561138557600061127c86610b8f565b90506112888188611391565b6112a9578681604051636b80573f60e11b815260040161056a929190611c95565b60a086015160c08701516000916112ce916112c5908290611c6c565b89519190611077565b90508261ffff16816000015161ffff16146112ea575050611377565b856040015160ff16816020015160ff1614611306575050611377565b60408051808201909152606081526000602082015261133386518a5161132c9190611c59565b82906115f3565b5061133e818a61166a565b50611349818761166a565b5061136182604001518260000151846060015161168b565b15611373576001945050505050610aa7565b5050505b61138085610c2d565b611263565b50600095945050505050565b60008151835114801561094357506109438360008460008751610c0a565b60006120008251111561141e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4c6f6e67206b657973206e6f74207065726d6974746564000000000000000000604482015260640161056a565b60008060005b8451601f0181101561149357600081602087010151905085518260200111156114595785518290036008026101000390811c901b5b7eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff600882901c81169490940193169190910190602001611424565b506010827fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff000016901c827dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff160191506010817fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff000016901c817dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff1601905080600883901b0191506020827fffffffff00000000ffffffff00000000ffffffff00000000ffffffff0000000016901c827bffffffff00000000ffffffff00000000ffffffff00000000ffffffff160191506040827fffffffffffffffff0000000000000000ffffffffffffffff000000000000000016901c8277ffffffffffffffff0000000000000000ffffffffffffffff16019150608082901c826fffffffffffffffffffffffffffffffff16019150601082901c61ffff16820191508192505050919050565b604080518082019091526060815260006020820152611613602083611d35565b1561163b57611623602083611d35565b61162e906020611c6c565b6116389083611c59565b91505b60208084018390526040518085526000815290818401018181101561165f57600080fd5b604052509192915050565b60408051808201909152606081526000602082015261094383838451611750565b60ff83166000908152600360205260408120546001600160a01b03166116b357506000610640565b60ff8416600090815260036020526040908190205490517ff7e83aee0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063f7e83aee9061170f9086908690600401611c95565b602060405180830381865afa15801561172c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa79190611d13565b604080518082019091526060815260006020820152825182111561177357600080fd5b83515160006117828483611c59565b905085602001518111156117a4576117a48661179f836002611d57565b611826565b8551805183820160200191600091808511156117be578482525b505050602086015b602086106117fe57805182526117dd602083611c59565b91506117ea602082611c59565b90506117f7602087611c6c565b95506117c6565b51815160001960208890036101000a0190811690199190911617905250849150509392505050565b815161183283836115f3565b5061183d838261166a565b50505050565b803560ff8116811461185457600080fd5b919050565b6001600160a01b038116811461186e57600080fd5b50565b6000806040838503121561188457600080fd5b61188d83611843565b9150602083013561189d81611859565b809150509250929050565b6000602082840312156118ba57600080fd5b813561094381611859565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156118fe576118fe6118c5565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561192d5761192d6118c5565b604052919050565b600082601f83011261194657600080fd5b813567ffffffffffffffff811115611960576119606118c5565b611973601f8201601f1916602001611904565b81815284602083860101111561198857600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f8301126119b657600080fd5b8135602067ffffffffffffffff808311156119d3576119d36118c5565b8260051b6119e2838201611904565b93845285810183019383810190888611156119fc57600080fd5b84880192505b85831015611a9357823584811115611a1a5760008081fd5b88016040818b03601f1901811315611a325760008081fd5b611a3a6118db565b8783013587811115611a4c5760008081fd5b611a5a8d8a83870101611935565b825250908201359086821115611a705760008081fd5b611a7e8c8984860101611935565b81890152845250509184019190840190611a02565b98975050505050505050565b60008060408385031215611ab257600080fd5b823567ffffffffffffffff811115611ac957600080fd5b611ad5858286016119a5565b95602094909401359450505050565b6000815180845260005b81811015611b0a57602081850181015186830182015201611aee565b506000602082860101526020601f19601f83011685010191505092915050565b604081526000611b3d6040830185611ae4565b905063ffffffff831660208301529392505050565b600060208284031215611b6457600080fd5b61094382611843565b6020815260006109436020830184611ae4565b600060208284031215611b9257600080fd5b813567ffffffffffffffff811115611ba957600080fd5b610aa7848285016119a5565b600181811c90821680611bc957607f821691505b602082108103611be957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c2d57611c2d611c05565b5060010190565b604081526000611c476040830185611ae4565b905060ff831660208301529392505050565b8082018082111561094657610946611c05565b8181038181111561094657610946611c05565b634e487b7160e01b600052600160045260246000fd5b604081526000611ca86040830185611ae4565b8281036020840152611cba8185611ae4565b95945050505050565b600081611cd257611cd2611c05565b506000190190565b606081526000611ced6060830186611ae4565b8281036020840152611cff8186611ae4565b90508281036040840152610d688185611ae4565b600060208284031215611d2557600080fd5b8151801515811461094357600080fd5b600082611d5257634e487b7160e01b600052601260045260246000fd5b500690565b808202811582820484141761094657610946611c0556fea2646970667358221220a36fa1213f53338776d2c9565e9a8b3482299a2c13495ac6aaeebf00585273ff64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "constructor": { + "details": "Constructor.", + "params": { + "_anchors": "The binary format RR entries for the root DS records." + } + }, + "setAlgorithm(uint8,address)": { + "details": "Sets the contract address for a signature verification algorithm. Callable only by the owner.", + "params": { + "algo": "The address of the algorithm contract.", + "id": "The algorithm ID" + } + }, + "setDigest(uint8,address)": { + "details": "Sets the contract address for a digest verification algorithm. Callable only by the owner.", + "params": { + "digest": "The address of the digest contract.", + "id": "The digest ID" + } + }, + "verifyRRSet((bytes,bytes)[])": { + "details": "Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain. Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.", + "params": { + "input": "A list of signed RRSets." + }, + "returns": { + "inception": "The inception time of the signed record set.", + "rrs": "The RRData from the last RRSet in the chain." + } + }, + "verifyRRSet((bytes,bytes)[],uint256)": { + "details": "Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain. Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.", + "params": { + "input": "A list of signed RRSets.", + "now": "The Unix timestamp to validate the records at." + }, + "returns": { + "inception": "The inception time of the signed record set.", + "rrs": "The RRData from the last RRSet in the chain." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 7305, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "anchors", + "offset": 0, + "slot": "0", + "type": "t_bytes_storage" + }, + { + "astId": 8282, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "owner", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 7437, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "algorithms", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint8,t_contract(Algorithm)9445)" + }, + { + "astId": 7442, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "digests", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint8,t_contract(Digest)11286)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(Algorithm)9445": { + "encoding": "inplace", + "label": "contract Algorithm", + "numberOfBytes": "20" + }, + "t_contract(Digest)11286": { + "encoding": "inplace", + "label": "contract Digest", + "numberOfBytes": "20" + }, + "t_mapping(t_uint8,t_contract(Algorithm)9445)": { + "encoding": "mapping", + "key": "t_uint8", + "label": "mapping(uint8 => contract Algorithm)", + "numberOfBytes": "32", + "value": "t_contract(Algorithm)9445" + }, + "t_mapping(t_uint8,t_contract(Digest)11286)": { + "encoding": "mapping", + "key": "t_uint8", + "label": "mapping(uint8 => contract Digest)", + "numberOfBytes": "32", + "value": "t_contract(Digest)11286" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/DummyAlgorithm.json b/solidity/dns-contracts/deployments/holesky/DummyAlgorithm.json new file mode 100644 index 0000000..c755763 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/DummyAlgorithm.json @@ -0,0 +1,71 @@ +{ + "address": "0xfc8965a60CE02dAA5174A09b7624972D409Dc714", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xeaddb5d036cf6ffeb2cedc2eca53f9e8eb72b401aca4f655eefe62cbedc5f7b5", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0xfc8965a60CE02dAA5174A09b7624972D409Dc714", + "transactionIndex": 60, + "gasUsed": "134217", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x22b55a177baaa1002cb2a6507dc64251cbe5e5dc096a6aadbd96ab795633e712", + "transactionHash": "0xeaddb5d036cf6ffeb2cedc2eca53f9e8eb72b401aca4f655eefe62cbedc5f7b5", + "logs": [], + "blockNumber": 801970, + "cumulativeGasUsed": "29607462", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements a dummy DNSSEC (signing) algorithm that approves all signatures, for testing.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol\":\"DummyAlgorithm\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n */\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata signature\\n ) external view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xaf6825f9852c69f8e36540821d067b4550dd2263497af9d645309b6a0c457ba6\"},\"contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\n\\n/**\\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\\n * signatures, for testing.\\n */\\ncontract DummyAlgorithm is Algorithm {\\n function verify(\\n bytes calldata,\\n bytes calldata,\\n bytes calldata\\n ) external view override returns (bool) {\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x0df474d4178b1659d2869aefe90ee6680b966d9432c5b28ef388134ea6d67b58\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610177806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004a61003e3660046100a7565b60019695505050505050565b604051901515815260200160405180910390f35b60008083601f84011261007057600080fd5b50813567ffffffffffffffff81111561008857600080fd5b6020830191508360208285010111156100a057600080fd5b9250929050565b600080600080600080606087890312156100c057600080fd5b863567ffffffffffffffff808211156100d857600080fd5b6100e48a838b0161005e565b909850965060208901359150808211156100fd57600080fd5b6101098a838b0161005e565b9096509450604089013591508082111561012257600080fd5b5061012f89828a0161005e565b979a969950949750929593949250505056fea26469706673582212201d6169f54d5644e6220fe6e528677b0fc01f94f6ab546738c10ff226848cce1b64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004a61003e3660046100a7565b60019695505050505050565b604051901515815260200160405180910390f35b60008083601f84011261007057600080fd5b50813567ffffffffffffffff81111561008857600080fd5b6020830191508360208285010111156100a057600080fd5b9250929050565b600080600080600080606087890312156100c057600080fd5b863567ffffffffffffffff808211156100d857600080fd5b6100e48a838b0161005e565b909850965060208901359150808211156100fd57600080fd5b6101098a838b0161005e565b9096509450604089013591508082111561012257600080fd5b5061012f89828a0161005e565b979a969950949750929593949250505056fea26469706673582212201d6169f54d5644e6220fe6e528677b0fc01f94f6ab546738c10ff226848cce1b64736f6c63430008110033", + "devdoc": { + "details": "Implements a dummy DNSSEC (signing) algorithm that approves all signatures, for testing.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/DummyDigest.json b/solidity/dns-contracts/deployments/holesky/DummyDigest.json new file mode 100644 index 0000000..9b8ffda --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/DummyDigest.json @@ -0,0 +1,66 @@ +{ + "address": "0x77Dc944f2423150af87217dBDAaBDD096AB06A75", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x61c6c3a2c90b50f6e408964208f8819c854b846daf84c9dc99c8f4c5aaf41eee", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x77Dc944f2423150af87217dBDAaBDD096AB06A75", + "transactionIndex": 10, + "gasUsed": "123877", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x73821c802214be3bb40485573189d2572f77cc15cc3914641177c130034e7eb3", + "transactionHash": "0x61c6c3a2c90b50f6e408964208f8819c854b846daf84c9dc99c8f4c5aaf41eee", + "logs": [], + "blockNumber": 802114, + "cumulativeGasUsed": "29642796", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements a dummy DNSSEC digest that approves all hashes, for testing.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/digests/DummyDigest.sol\":\"DummyDigest\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC digest.\\n */\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(\\n bytes calldata data,\\n bytes calldata hash\\n ) external pure virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x8ea926b2db0578c4ad7fce4582fc0f6f0f9efee8dca2085dbdb9984f18941e28\"},\"contracts/dnssec-oracle/digests/DummyDigest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Digest.sol\\\";\\n\\n/**\\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\\n */\\ncontract DummyDigest is Digest {\\n function verify(\\n bytes calldata,\\n bytes calldata\\n ) external pure override returns (bool) {\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x17c0c424aa79b138b918234d4d1c9b95bebad1e26e37c651628a61ef389d75e6\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610147806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004861003e3660046100a5565b6001949350505050565b604051901515815260200160405180910390f35b60008083601f84011261006e57600080fd5b50813567ffffffffffffffff81111561008657600080fd5b60208301915083602082850101111561009e57600080fd5b9250929050565b600080600080604085870312156100bb57600080fd5b843567ffffffffffffffff808211156100d357600080fd5b6100df8883890161005c565b909650945060208701359150808211156100f857600080fd5b506101058782880161005c565b9598949750955050505056fea2646970667358221220a959cf756a6d6f65fdf946b8ea188d413eae01a3fa027905c50b03b966d25ef764736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004861003e3660046100a5565b6001949350505050565b604051901515815260200160405180910390f35b60008083601f84011261006e57600080fd5b50813567ffffffffffffffff81111561008657600080fd5b60208301915083602082850101111561009e57600080fd5b9250929050565b600080600080604085870312156100bb57600080fd5b843567ffffffffffffffff808211156100d357600080fd5b6100df8883890161005c565b909650945060208701359150808211156100f857600080fd5b506101058782880161005c565b9598949750955050505056fea2646970667358221220a959cf756a6d6f65fdf946b8ea188d413eae01a3fa027905c50b03b966d25ef764736f6c63430008110033", + "devdoc": { + "details": "Implements a dummy DNSSEC digest that approves all hashes, for testing.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/DummyOracle.json b/solidity/dns-contracts/deployments/holesky/DummyOracle.json new file mode 100644 index 0000000..55d218a --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/DummyOracle.json @@ -0,0 +1,95 @@ +{ + "address": "0xb4CF1F7c766088Af09D950BaFC5455CD527F7d41", + "abi": [ + { + "inputs": [ + { + "internalType": "int256", + "name": "_value", + "type": "int256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "latestAnswer", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int256", + "name": "_value", + "type": "int256" + } + ], + "name": "set", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xb9eb6ebe27285a194dcdfc32cc0498c47aebfc932fc307b9bef01934befc977c", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0xb4CF1F7c766088Af09D950BaFC5455CD527F7d41", + "transactionIndex": 3, + "gasUsed": "114029", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x4bfd383ed1f4c3bbf55c0a3e10771f54efec8626725ae7f9b39e48c63d9c0c3f", + "transactionHash": "0xb9eb6ebe27285a194dcdfc32cc0498c47aebfc932fc307b9bef01934befc977c", + "logs": [], + "blockNumber": 814548, + "cumulativeGasUsed": "416689", + "status": 1, + "byzantium": true + }, + "args": [ + "160000000000" + ], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"_value\",\"type\":\"int256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"_value\",\"type\":\"int256\"}],\"name\":\"set\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/DummyOracle.sol\":\"DummyOracle\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/ethregistrar/DummyOracle.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ncontract DummyOracle {\\n int256 value;\\n\\n constructor(int256 _value) public {\\n set(_value);\\n }\\n\\n function set(int256 _value) public {\\n value = _value;\\n }\\n\\n function latestAnswer() public view returns (int256) {\\n return value;\\n }\\n}\\n\",\"keccak256\":\"0x8f0d88c42c074c3fb80710f7639cb455a582fa96629e26a974dd6a19c15678ff\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161011138038061011183398101604081905261002f9161003e565b61003881600055565b50610057565b60006020828403121561005057600080fd5b5051919050565b60ac806100656000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806350d25bcd146037578063e5c19b2d14604c575b600080fd5b60005460405190815260200160405180910390f35b605c6057366004605e565b600055565b005b600060208284031215606f57600080fd5b503591905056fea2646970667358221220c9677f45270b9ac03675a2089e9811608e10c406f30909f69dc2348311f7468264736f6c63430008110033", + "deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060325760003560e01c806350d25bcd146037578063e5c19b2d14604c575b600080fd5b60005460405190815260200160405180910390f35b605c6057366004605e565b600055565b005b600060208284031215606f57600080fd5b503591905056fea2646970667358221220c9677f45270b9ac03675a2089e9811608e10c406f30909f69dc2348311f7468264736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 12138, + "contract": "contracts/ethregistrar/DummyOracle.sol:DummyOracle", + "label": "value", + "offset": 0, + "slot": "0", + "type": "t_int256" + } + ], + "types": { + "t_int256": { + "encoding": "inplace", + "label": "int256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/ENSRegistry.json b/solidity/dns-contracts/deployments/holesky/ENSRegistry.json new file mode 100644 index 0000000..8efd11c --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/ENSRegistry.json @@ -0,0 +1,420 @@ +{ + "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_old", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NewOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "NewResolver", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "NewTTL", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "old", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "recordExists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "resolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "ttl", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x4ef5da3a7c793417f5bcaea90aede53198213d884dff022ce7040cef9bf4c273", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "transactionIndex": 51, + "gasUsed": "785195", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x90a3942636c2b46e5cf4de83e840ba08394786f951638874f7ecbbf0d12e076c", + "transactionHash": "0x4ef5da3a7c793417f5bcaea90aede53198213d884dff022ce7040cef9bf4c273", + "logs": [], + "blockNumber": 801613, + "cumulativeGasUsed": "29759259", + "status": 1, + "byzantium": true + }, + "args": [ + "0x94f523b8261B815b87EFfCf4d18E6aBeF18d6e4b" + ], + "numDeployments": 1, + "bytecode": "0x608060405234801561001057600080fd5b50604051610d2e380380610d2e83398101604081905261002f91610089565b60008080526020527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb58054336001600160a01b031991821617909155600280549091166001600160a01b03929092169190911790556100b9565b60006020828403121561009b57600080fd5b81516001600160a01b03811681146100b257600080fd5b9392505050565b610c66806100c86000396000f3fe608060405234801561001057600080fd5b50600436106100df5760003560e01c80635b0fc9c31161008c578063b83f866311610066578063b83f8663146101d5578063cf408823146101e8578063e985e9c5146101fb578063f79fe5381461024757600080fd5b80635b0fc9c31461019c5780635ef2c7f0146101af578063a22cb465146101c257600080fd5b806314ab9038116100bd57806314ab90381461014857806316a25cbd1461015d5780631896f70a1461018957600080fd5b80630178b8bf146100e457806302571be31461011457806306ab592314610127575b600080fd5b6100f76100f2366004610a07565b610272565b6040516001600160a01b0390911681526020015b60405180910390f35b6100f7610122366004610a07565b61033b565b61013a610135366004610a38565b6103aa565b60405190815260200161010b565b61015b610156366004610a87565b61047a565b005b61017061016b366004610a07565b610561565b60405167ffffffffffffffff909116815260200161010b565b61015b610197366004610ab7565b61062b565b61015b6101aa366004610ab7565b6106fd565b61015b6101bd366004610adc565b61079f565b61015b6101d0366004610b3b565b6107c1565b6002546100f7906001600160a01b031681565b61015b6101f6366004610b6e565b61082d565b610237610209366004610bc1565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b604051901515815260200161010b565b610237610255366004610a07565b6000908152602081905260409020546001600160a01b0316151590565b6000818152602081905260408120546001600160a01b031661031b576002546040517f0178b8bf000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b0390911690630178b8bf906024015b602060405180830381865afa1580156102f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103159190610bef565b92915050565b6000828152602081905260409020600101546001600160a01b0316610315565b6000818152602081905260408120546001600160a01b03166103a1576002546040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b03909116906302571be3906024016102d4565b61031582610848565b60008381526020819052604081205484906001600160a01b0316338114806103f557506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6103fe57600080fd5b604080516020808201899052818301889052825180830384018152606090920190925280519101206104308186610870565b6040516001600160a01b0386168152869088907fce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e829060200160405180910390a39695505050505050565b60008281526020819052604090205482906001600160a01b0316338114806104c557506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6104ce57600080fd5b60405167ffffffffffffffff8416815284907f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa689060200160405180910390a25050600091825260208290526040909120600101805467ffffffffffffffff909216600160a01b027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff909216919091179055565b6000818152602081905260408120546001600160a01b0316610603576002546040517f16a25cbd000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b03909116906316a25cbd90602401602060405180830381865afa1580156105df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103159190610c13565b600082815260208190526040902060010154600160a01b900467ffffffffffffffff16610315565b60008281526020819052604090205482906001600160a01b03163381148061067657506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61067f57600080fd5b6040516001600160a01b038416815284907f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a09060200160405180910390a25050600091825260208290526040909120600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909216919091179055565b60008281526020819052604090205482906001600160a01b03163381148061074857506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61075157600080fd5b61075b8484610870565b6040516001600160a01b038416815284907fd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d2669060200160405180910390a250505050565b60006107ac8686866103aa565b90506107b98184846108c0565b505050505050565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61083784846106fd565b6108428483836108c0565b50505050565b6000818152602081905260408120546001600160a01b03163081036103155750600092915050565b806001600160a01b0381166108825750305b6000838152602081905260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316179055505050565b505050565b6000838152602081905260409020600101546001600160a01b038381169116146109535760008381526020818152604091829020600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038616908117909155915191825284917f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0910160405180910390a25b60008381526020819052604090206001015467ffffffffffffffff828116600160a01b90920416146108bb576000838152602081815260409182902060010180547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff16600160a01b67ffffffffffffffff861690810291909117909155915191825284917f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa68910160405180910390a2505050565b600060208284031215610a1957600080fd5b5035919050565b6001600160a01b0381168114610a3557600080fd5b50565b600080600060608486031215610a4d57600080fd5b83359250602084013591506040840135610a6681610a20565b809150509250925092565b67ffffffffffffffff81168114610a3557600080fd5b60008060408385031215610a9a57600080fd5b823591506020830135610aac81610a71565b809150509250929050565b60008060408385031215610aca57600080fd5b823591506020830135610aac81610a20565b600080600080600060a08688031215610af457600080fd5b85359450602086013593506040860135610b0d81610a20565b92506060860135610b1d81610a20565b91506080860135610b2d81610a71565b809150509295509295909350565b60008060408385031215610b4e57600080fd5b8235610b5981610a20565b915060208301358015158114610aac57600080fd5b60008060008060808587031215610b8457600080fd5b843593506020850135610b9681610a20565b92506040850135610ba681610a20565b91506060850135610bb681610a71565b939692955090935050565b60008060408385031215610bd457600080fd5b8235610bdf81610a20565b91506020830135610aac81610a20565b600060208284031215610c0157600080fd5b8151610c0c81610a20565b9392505050565b600060208284031215610c2557600080fd5b8151610c0c81610a7156fea2646970667358221220602a5f4a314db4aef3f176e28ab1017f44cfb4e7aa60f7627e57c7caebf27aba64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100df5760003560e01c80635b0fc9c31161008c578063b83f866311610066578063b83f8663146101d5578063cf408823146101e8578063e985e9c5146101fb578063f79fe5381461024757600080fd5b80635b0fc9c31461019c5780635ef2c7f0146101af578063a22cb465146101c257600080fd5b806314ab9038116100bd57806314ab90381461014857806316a25cbd1461015d5780631896f70a1461018957600080fd5b80630178b8bf146100e457806302571be31461011457806306ab592314610127575b600080fd5b6100f76100f2366004610a07565b610272565b6040516001600160a01b0390911681526020015b60405180910390f35b6100f7610122366004610a07565b61033b565b61013a610135366004610a38565b6103aa565b60405190815260200161010b565b61015b610156366004610a87565b61047a565b005b61017061016b366004610a07565b610561565b60405167ffffffffffffffff909116815260200161010b565b61015b610197366004610ab7565b61062b565b61015b6101aa366004610ab7565b6106fd565b61015b6101bd366004610adc565b61079f565b61015b6101d0366004610b3b565b6107c1565b6002546100f7906001600160a01b031681565b61015b6101f6366004610b6e565b61082d565b610237610209366004610bc1565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b604051901515815260200161010b565b610237610255366004610a07565b6000908152602081905260409020546001600160a01b0316151590565b6000818152602081905260408120546001600160a01b031661031b576002546040517f0178b8bf000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b0390911690630178b8bf906024015b602060405180830381865afa1580156102f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103159190610bef565b92915050565b6000828152602081905260409020600101546001600160a01b0316610315565b6000818152602081905260408120546001600160a01b03166103a1576002546040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b03909116906302571be3906024016102d4565b61031582610848565b60008381526020819052604081205484906001600160a01b0316338114806103f557506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6103fe57600080fd5b604080516020808201899052818301889052825180830384018152606090920190925280519101206104308186610870565b6040516001600160a01b0386168152869088907fce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e829060200160405180910390a39695505050505050565b60008281526020819052604090205482906001600160a01b0316338114806104c557506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6104ce57600080fd5b60405167ffffffffffffffff8416815284907f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa689060200160405180910390a25050600091825260208290526040909120600101805467ffffffffffffffff909216600160a01b027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff909216919091179055565b6000818152602081905260408120546001600160a01b0316610603576002546040517f16a25cbd000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b03909116906316a25cbd90602401602060405180830381865afa1580156105df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103159190610c13565b600082815260208190526040902060010154600160a01b900467ffffffffffffffff16610315565b60008281526020819052604090205482906001600160a01b03163381148061067657506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61067f57600080fd5b6040516001600160a01b038416815284907f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a09060200160405180910390a25050600091825260208290526040909120600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909216919091179055565b60008281526020819052604090205482906001600160a01b03163381148061074857506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61075157600080fd5b61075b8484610870565b6040516001600160a01b038416815284907fd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d2669060200160405180910390a250505050565b60006107ac8686866103aa565b90506107b98184846108c0565b505050505050565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61083784846106fd565b6108428483836108c0565b50505050565b6000818152602081905260408120546001600160a01b03163081036103155750600092915050565b806001600160a01b0381166108825750305b6000838152602081905260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316179055505050565b505050565b6000838152602081905260409020600101546001600160a01b038381169116146109535760008381526020818152604091829020600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038616908117909155915191825284917f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0910160405180910390a25b60008381526020819052604090206001015467ffffffffffffffff828116600160a01b90920416146108bb576000838152602081815260409182902060010180547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff16600160a01b67ffffffffffffffff861690810291909117909155915191825284917f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa68910160405180910390a2505050565b600060208284031215610a1957600080fd5b5035919050565b6001600160a01b0381168114610a3557600080fd5b50565b600080600060608486031215610a4d57600080fd5b83359250602084013591506040840135610a6681610a20565b809150509250925092565b67ffffffffffffffff81168114610a3557600080fd5b60008060408385031215610a9a57600080fd5b823591506020830135610aac81610a71565b809150509250929050565b60008060408385031215610aca57600080fd5b823591506020830135610aac81610a20565b600080600080600060a08688031215610af457600080fd5b85359450602086013593506040860135610b0d81610a20565b92506060860135610b1d81610a20565b91506080860135610b2d81610a71565b809150509295509295909350565b60008060408385031215610b4e57600080fd5b8235610b5981610a20565b915060208301358015158114610aac57600080fd5b60008060008060808587031215610b8457600080fd5b843593506020850135610b9681610a20565b92506040850135610ba681610a20565b91506060850135610bb681610a71565b939692955090935050565b60008060408385031215610bd457600080fd5b8235610bdf81610a20565b91506020830135610aac81610a20565b600060208284031215610c0157600080fd5b8151610c0c81610a20565b9392505050565b600060208284031215610c2557600080fd5b8151610c0c81610a7156fea2646970667358221220602a5f4a314db4aef3f176e28ab1017f44cfb4e7aa60f7627e57c7caebf27aba64736f6c63430008110033" +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/ETHRegistrarController.json b/solidity/dns-contracts/deployments/holesky/ETHRegistrarController.json new file mode 100644 index 0000000..53da233 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/ETHRegistrarController.json @@ -0,0 +1,755 @@ +{ + "address": "0x179Be112b24Ad4cFC392eF8924DfA08C20Ad8583", + "abi": [ + { + "inputs": [ + { + "internalType": "contract BaseRegistrarImplementation", + "name": "_base", + "type": "address" + }, + { + "internalType": "contract IPriceOracle", + "name": "_prices", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minCommitmentAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxCommitmentAge", + "type": "uint256" + }, + { + "internalType": "contract ReverseRegistrar", + "name": "_reverseRegistrar", + "type": "address" + }, + { + "internalType": "contract INameWrapper", + "name": "_nameWrapper", + "type": "address" + }, + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "CommitmentTooNew", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "CommitmentTooOld", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "DurationTooShort", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientValue", + "type": "error" + }, + { + "inputs": [], + "name": "MaxCommitmentAgeTooHigh", + "type": "error" + }, + { + "inputs": [], + "name": "MaxCommitmentAgeTooLow", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameNotAvailable", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverRequiredWhenDataSupplied", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverRequiredWhenReverseRecord", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "UnexpiredCommitmentExists", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "baseCost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "premium", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRenewed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "MIN_REGISTRATION_DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "available", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "commit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "commitments", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "bool", + "name": "reverseRecord", + "type": "bool" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "name": "makeCommitment", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "maxCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nameWrapper", + "outputs": [ + { + "internalType": "contract INameWrapper", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "prices", + "outputs": [ + { + "internalType": "contract IPriceOracle", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "recoverFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "bool", + "name": "reverseRecord", + "type": "bool" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "rentPrice", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "base", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "premium", + "type": "uint256" + } + ], + "internalType": "struct IPriceOracle.Price", + "name": "price", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "reverseRegistrar", + "outputs": [ + { + "internalType": "contract ReverseRegistrar", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "valid", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xc3b42186465d97428da863552de238228e5f32c260c4ffdb687ae6e8a9b3c3ab", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x179Be112b24Ad4cFC392eF8924DfA08C20Ad8583", + "transactionIndex": 3, + "gasUsed": "1788758", + "logsBloom": "0x00000000000000000080000000000800000000000000200000800000000001000000000000000000000000000000000000000000000010000008000000000000000000000000000100000000008000000001000020001000000000001000000000000000020002000000000000000808000000000000000800000000000000400000010000000000000000000000000000000000000000200000000000020000000000040000040000000011000000000000000000000000008000040000000000000000000000000000000020005040000000000000000000004000000020000000000000000000000000000100000000000000001000000000000000000000", + "blockHash": "0xe5c1c8e22c2ac3055b388daa41890d6c574181cda9de78e14ace4a23a40e5f19", + "transactionHash": "0xc3b42186465d97428da863552de238228e5f32c260c4ffdb687ae6e8a9b3c3ab", + "logs": [ + { + "transactionIndex": 3, + "blockNumber": 815359, + "transactionHash": "0xc3b42186465d97428da863552de238228e5f32c260c4ffdb687ae6e8a9b3c3ab", + "address": "0x179Be112b24Ad4cFC392eF8924DfA08C20Ad8583", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0xe5c1c8e22c2ac3055b388daa41890d6c574181cda9de78e14ace4a23a40e5f19" + }, + { + "transactionIndex": 3, + "blockNumber": 815359, + "transactionHash": "0xc3b42186465d97428da863552de238228e5f32c260c4ffdb687ae6e8a9b3c3ab", + "address": "0x132AC0B116a73add4225029D1951A9A707Ef673f", + "topics": [ + "0x6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e92", + "0x000000000000000000000000179be112b24ad4cfc392ef8924dfa08c20ad8583", + "0xfecbbae19247a9edce5d5e48a4b7dea02d7e22031a6ecc74c2f2c7e9896402c7" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0xe5c1c8e22c2ac3055b388daa41890d6c574181cda9de78e14ace4a23a40e5f19" + }, + { + "transactionIndex": 3, + "blockNumber": 815359, + "transactionHash": "0xc3b42186465d97428da863552de238228e5f32c260c4ffdb687ae6e8a9b3c3ab", + "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "topics": [ + "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", + "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2", + "0xa3f97d0e52bf0f29d4a92b0fefa0befb4ba7007ee73a42d251a014f72add9624" + ], + "data": "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8", + "logIndex": 2, + "blockHash": "0xe5c1c8e22c2ac3055b388daa41890d6c574181cda9de78e14ace4a23a40e5f19" + } + ], + "blockNumber": 815359, + "cumulativeGasUsed": "1851758", + "status": 1, + "byzantium": true + }, + "args": [ + "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85", + "0x0EF1aF80c24B681991d675176D9c07d8C9236B9a", + 60, + 86400, + "0x132AC0B116a73add4225029D1951A9A707Ef673f", + "0xab50971078225D365994dc1Edcb9b7FD72Bb4862", + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract BaseRegistrarImplementation\",\"name\":\"_base\",\"type\":\"address\"},{\"internalType\":\"contract IPriceOracle\",\"name\":\"_prices\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_minCommitmentAge\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxCommitmentAge\",\"type\":\"uint256\"},{\"internalType\":\"contract ReverseRegistrar\",\"name\":\"_reverseRegistrar\",\"type\":\"address\"},{\"internalType\":\"contract INameWrapper\",\"name\":\"_nameWrapper\",\"type\":\"address\"},{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"CommitmentTooNew\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"CommitmentTooOld\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"DurationTooShort\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxCommitmentAgeTooHigh\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxCommitmentAgeTooLow\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NameNotAvailable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverRequiredWhenDataSupplied\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverRequiredWhenReverseRecord\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"UnexpiredCommitmentExists\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"baseCost\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameRenewed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MIN_REGISTRATION_DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"available\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"commit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"commitments\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"bool\",\"name\":\"reverseRecord\",\"type\":\"bool\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"name\":\"makeCommitment\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxCommitmentAge\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minCommitmentAge\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nameWrapper\",\"outputs\":[{\"internalType\":\"contract INameWrapper\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"prices\",\"outputs\":[{\"internalType\":\"contract IPriceOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"recoverFunds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"bool\",\"name\":\"reverseRecord\",\"type\":\"bool\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"renew\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"rentPrice\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"base\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"}],\"internalType\":\"struct IPriceOracle.Price\",\"name\":\"price\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"reverseRegistrar\",\"outputs\":[{\"internalType\":\"contract ReverseRegistrar\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"valid\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"A registrar controller for registering and renewing names at fixed cost.\",\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"recoverFunds(address,address,uint256)\":{\"details\":\"The contract is Ownable and only the owner can call the recover function.\",\"params\":{\"_amount\":\"The amount of tokens to recover.\",\"_to\":\"The address to send the tokens to.\",\"_token\":\"The address of the ERC20 token to recover\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"recoverFunds(address,address,uint256)\":{\"notice\":\"Recover ERC20 tokens sent to the contract by mistake.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/ETHRegistrarController.sol\":\"ETHRegistrarController\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/ERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721.sol\\\";\\nimport \\\"./IERC721Receiver.sol\\\";\\nimport \\\"./extensions/IERC721Metadata.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\nimport \\\"../../utils/Strings.sol\\\";\\nimport \\\"../../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\n * {ERC721Enumerable}.\\n */\\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\\n using Address for address;\\n using Strings for uint256;\\n\\n // Token name\\n string private _name;\\n\\n // Token symbol\\n string private _symbol;\\n\\n // Mapping from token ID to owner address\\n mapping(uint256 => address) private _owners;\\n\\n // Mapping owner address to token count\\n mapping(address => uint256) private _balances;\\n\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) private _tokenApprovals;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IERC721).interfaceId ||\\n interfaceId == type(IERC721Metadata).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721-balanceOf}.\\n */\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\n return _balances[owner];\\n }\\n\\n /**\\n * @dev See {IERC721-ownerOf}.\\n */\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\n address owner = _ownerOf(tokenId);\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n _requireMinted(tokenId);\\n\\n string memory baseURI = _baseURI();\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\n }\\n\\n /**\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\n * by default, can be overridden in child contracts.\\n */\\n function _baseURI() internal view virtual returns (string memory) {\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual override {\\n address owner = ERC721.ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\n _requireMinted(tokenId);\\n\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC721-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC721-isApprovedForAll}.\\n */\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[owner][operator];\\n }\\n\\n /**\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n _safeTransfer(from, to, tokenId, data);\\n }\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\n *\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\\n _transfer(from, to, tokenId);\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n }\\n\\n /**\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\n }\\n\\n /**\\n * @dev Returns whether `tokenId` exists.\\n *\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\n *\\n * Tokens start existing when they are minted (`_mint`),\\n * and stop existing when they are burned (`_burn`).\\n */\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\n return _ownerOf(tokenId) != address(0);\\n }\\n\\n /**\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\n address owner = ERC721.ownerOf(tokenId);\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\n }\\n\\n /**\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\n _safeMint(to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\n */\\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\\n _mint(to, tokenId);\\n require(\\n _checkOnERC721Received(address(0), to, tokenId, data),\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\n );\\n }\\n\\n /**\\n * @dev Mints `tokenId` and transfers it to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - `to` cannot be the zero address.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _mint(address to, uint256 tokenId) internal virtual {\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n _beforeTokenTransfer(address(0), to, tokenId, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _burn(uint256 tokenId) internal virtual {\\n address owner = ERC721.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\n }\\n\\n /**\\n * @dev Transfers `tokenId` from `from` to `to`.\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, tokenId, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Reverts if the `tokenId` has not been minted yet.\\n */\\n function _requireMinted(uint256 tokenId) internal view virtual {\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\n }\\n\\n /**\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\n * The call is not executed if the target address is not a contract.\\n *\\n * @param from address representing the previous owner of the given token ID\\n * @param to target address that will receive the tokens\\n * @param tokenId uint256 ID of the token to be transferred\\n * @param data bytes optional data to send along with the call\\n * @return bool whether the call correctly returned the expected magic value\\n */\\n function _checkOnERC721Received(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) private returns (bool) {\\n if (to.isContract()) {\\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721Receiver.onERC721Received.selector;\\n } catch (bytes memory reason) {\\n if (reason.length == 0) {\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n } else {\\n /// @solidity memory-safe-assembly\\n assembly {\\n revert(add(32, reason), mload(reason))\\n }\\n }\\n }\\n } else {\\n return true;\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\n }\\n}\\n\",\"keccak256\":\"0x2c309e7df9e05e6ce15bedfe74f3c61b467fc37e0fae9eab496acf5ea0bbd7ff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721Metadata is IERC721 {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/ethregistrar/BaseRegistrarImplementation.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/ERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\\n // A map of expiry times\\n mapping(uint256 => uint256) expiries;\\n // The ENS registry\\n ENS public ens;\\n // The namehash of the TLD this registrar owns (eg, .eth)\\n bytes32 public baseNode;\\n // A map of addresses that are authorised to register and renew names.\\n mapping(address => bool) public controllers;\\n uint256 public constant GRACE_PERIOD = 90 days;\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n bytes4 private constant ERC721_ID =\\n bytes4(\\n keccak256(\\\"balanceOf(address)\\\") ^\\n keccak256(\\\"ownerOf(uint256)\\\") ^\\n keccak256(\\\"approve(address,uint256)\\\") ^\\n keccak256(\\\"getApproved(uint256)\\\") ^\\n keccak256(\\\"setApprovalForAll(address,bool)\\\") ^\\n keccak256(\\\"isApprovedForAll(address,address)\\\") ^\\n keccak256(\\\"transferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256,bytes)\\\")\\n );\\n bytes4 private constant RECLAIM_ID =\\n bytes4(keccak256(\\\"reclaim(uint256,address)\\\"));\\n\\n /**\\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\\n * @dev Returns whether the given spender can transfer a given token ID\\n * @param spender address of the spender to query\\n * @param tokenId uint256 ID of the token to be transferred\\n * @return bool whether the msg.sender is approved for the given token ID,\\n * is an operator of the owner, or is the owner of the token\\n */\\n function _isApprovedOrOwner(\\n address spender,\\n uint256 tokenId\\n ) internal view override returns (bool) {\\n address owner = ownerOf(tokenId);\\n return (spender == owner ||\\n getApproved(tokenId) == spender ||\\n isApprovedForAll(owner, spender));\\n }\\n\\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\\\"\\\", \\\"\\\") {\\n ens = _ens;\\n baseNode = _baseNode;\\n }\\n\\n modifier live() {\\n require(ens.owner(baseNode) == address(this));\\n _;\\n }\\n\\n modifier onlyController() {\\n require(controllers[msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Gets the owner of the specified token ID. Names become unowned\\n * when their registration expires.\\n * @param tokenId uint256 ID of the token to query the owner of\\n * @return address currently marked as the owner of the given token ID\\n */\\n function ownerOf(\\n uint256 tokenId\\n ) public view override(IERC721, ERC721) returns (address) {\\n require(expiries[tokenId] > block.timestamp);\\n return super.ownerOf(tokenId);\\n }\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external override onlyOwner {\\n controllers[controller] = true;\\n emit ControllerAdded(controller);\\n }\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external override onlyOwner {\\n controllers[controller] = false;\\n emit ControllerRemoved(controller);\\n }\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external override onlyOwner {\\n ens.setResolver(baseNode, resolver);\\n }\\n\\n // Returns the expiration timestamp of the specified id.\\n function nameExpires(uint256 id) external view override returns (uint256) {\\n return expiries[id];\\n }\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) public view override returns (bool) {\\n // Not available if it's registered here or in its grace period.\\n return expiries[id] + GRACE_PERIOD < block.timestamp;\\n }\\n\\n /**\\n * @dev Register a name.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external override returns (uint256) {\\n return _register(id, owner, duration, true);\\n }\\n\\n /**\\n * @dev Register a name, without modifying the registry.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function registerOnly(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256) {\\n return _register(id, owner, duration, false);\\n }\\n\\n function _register(\\n uint256 id,\\n address owner,\\n uint256 duration,\\n bool updateRegistry\\n ) internal live onlyController returns (uint256) {\\n require(available(id));\\n require(\\n block.timestamp + duration + GRACE_PERIOD >\\n block.timestamp + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] = block.timestamp + duration;\\n if (_exists(id)) {\\n // Name was previously owned, and expired\\n _burn(id);\\n }\\n _mint(owner, id);\\n if (updateRegistry) {\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n emit NameRegistered(id, owner, block.timestamp + duration);\\n\\n return block.timestamp + duration;\\n }\\n\\n function renew(\\n uint256 id,\\n uint256 duration\\n ) external override live onlyController returns (uint256) {\\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\\n require(\\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] += duration;\\n emit NameRenewed(id, expiries[id]);\\n return expiries[id];\\n }\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external override live {\\n require(_isApprovedOrOwner(msg.sender, id));\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view override(ERC721, IERC165) returns (bool) {\\n return\\n interfaceID == INTERFACE_META_ID ||\\n interfaceID == ERC721_ID ||\\n interfaceID == RECLAIM_ID;\\n }\\n}\\n\",\"keccak256\":\"0xaee6eb36aead449d397b86a02e9c63bc46e3ef378d0a62bfd68beaae1150c9d0\"},\"contracts/ethregistrar/ETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport {BaseRegistrarImplementation} from \\\"./BaseRegistrarImplementation.sol\\\";\\nimport {StringUtils} from \\\"./StringUtils.sol\\\";\\nimport {Resolver} from \\\"../resolvers/Resolver.sol\\\";\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {ReverseRegistrar} from \\\"../reverseRegistrar/ReverseRegistrar.sol\\\";\\nimport {ReverseClaimer} from \\\"../reverseRegistrar/ReverseClaimer.sol\\\";\\nimport {IETHRegistrarController, IPriceOracle} from \\\"./IETHRegistrarController.sol\\\";\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {INameWrapper} from \\\"../wrapper/INameWrapper.sol\\\";\\nimport {ERC20Recoverable} from \\\"../utils/ERC20Recoverable.sol\\\";\\n\\nerror CommitmentTooNew(bytes32 commitment);\\nerror CommitmentTooOld(bytes32 commitment);\\nerror NameNotAvailable(string name);\\nerror DurationTooShort(uint256 duration);\\nerror ResolverRequiredWhenDataSupplied();\\nerror ResolverRequiredWhenReverseRecord();\\nerror UnexpiredCommitmentExists(bytes32 commitment);\\nerror InsufficientValue();\\nerror Unauthorised(bytes32 node);\\nerror MaxCommitmentAgeTooLow();\\nerror MaxCommitmentAgeTooHigh();\\n\\n/**\\n * @dev A registrar controller for registering and renewing names at fixed cost.\\n */\\ncontract ETHRegistrarController is\\n Ownable,\\n IETHRegistrarController,\\n IERC165,\\n ERC20Recoverable,\\n ReverseClaimer\\n{\\n using StringUtils for *;\\n using Address for address;\\n\\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\\n bytes32 private constant ETH_NODE =\\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\\n uint64 private constant MAX_EXPIRY = type(uint64).max;\\n BaseRegistrarImplementation immutable base;\\n IPriceOracle public immutable prices;\\n uint256 public immutable minCommitmentAge;\\n uint256 public immutable maxCommitmentAge;\\n ReverseRegistrar public immutable reverseRegistrar;\\n INameWrapper public immutable nameWrapper;\\n\\n mapping(bytes32 => uint256) public commitments;\\n\\n event NameRegistered(\\n string name,\\n bytes32 indexed label,\\n address indexed owner,\\n uint256 baseCost,\\n uint256 premium,\\n uint256 expires\\n );\\n event NameRenewed(\\n string name,\\n bytes32 indexed label,\\n uint256 cost,\\n uint256 expires\\n );\\n\\n constructor(\\n BaseRegistrarImplementation _base,\\n IPriceOracle _prices,\\n uint256 _minCommitmentAge,\\n uint256 _maxCommitmentAge,\\n ReverseRegistrar _reverseRegistrar,\\n INameWrapper _nameWrapper,\\n ENS _ens\\n ) ReverseClaimer(_ens, msg.sender) {\\n if (_maxCommitmentAge <= _minCommitmentAge) {\\n revert MaxCommitmentAgeTooLow();\\n }\\n\\n if (_maxCommitmentAge > block.timestamp) {\\n revert MaxCommitmentAgeTooHigh();\\n }\\n\\n base = _base;\\n prices = _prices;\\n minCommitmentAge = _minCommitmentAge;\\n maxCommitmentAge = _maxCommitmentAge;\\n reverseRegistrar = _reverseRegistrar;\\n nameWrapper = _nameWrapper;\\n }\\n\\n function rentPrice(\\n string memory name,\\n uint256 duration\\n ) public view override returns (IPriceOracle.Price memory price) {\\n bytes32 label = keccak256(bytes(name));\\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\\n }\\n\\n function valid(string memory name) public pure returns (bool) {\\n return name.strlen() >= 3;\\n }\\n\\n function available(string memory name) public view override returns (bool) {\\n bytes32 label = keccak256(bytes(name));\\n return valid(name) && base.available(uint256(label));\\n }\\n\\n function makeCommitment(\\n string memory name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] calldata data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses\\n ) public pure override returns (bytes32) {\\n bytes32 label = keccak256(bytes(name));\\n if (resolver == address(0) && reverseRecord == true) {\\n revert ResolverRequiredWhenReverseRecord();\\n }\\n if (data.length > 0 && resolver == address(0)) {\\n revert ResolverRequiredWhenDataSupplied();\\n }\\n return\\n keccak256(\\n abi.encode(\\n label,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses\\n )\\n );\\n }\\n\\n function commit(bytes32 commitment) public override {\\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\\n revert UnexpiredCommitmentExists(commitment);\\n }\\n commitments[commitment] = block.timestamp;\\n }\\n\\n function register(\\n string calldata name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] calldata data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses\\n ) public payable override {\\n IPriceOracle.Price memory price = rentPrice(name, duration);\\n if (msg.value < price.base + price.premium) {\\n revert InsufficientValue();\\n }\\n\\n _consumeCommitment(\\n name,\\n duration,\\n makeCommitment(\\n name,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses\\n )\\n );\\n\\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\\n name,\\n owner,\\n duration,\\n resolver,\\n ownerControlledFuses\\n );\\n\\n if (data.length > 0) {\\n _setRecords(resolver, keccak256(bytes(name)), data);\\n }\\n\\n if (reverseRecord) {\\n _setReverseRecord(name, resolver, msg.sender);\\n }\\n\\n emit NameRegistered(\\n name,\\n keccak256(bytes(name)),\\n owner,\\n price.base,\\n price.premium,\\n expires\\n );\\n\\n if (msg.value > (price.base + price.premium)) {\\n payable(msg.sender).transfer(\\n msg.value - (price.base + price.premium)\\n );\\n }\\n }\\n\\n function renew(\\n string calldata name,\\n uint256 duration\\n ) external payable override {\\n bytes32 labelhash = keccak256(bytes(name));\\n uint256 tokenId = uint256(labelhash);\\n IPriceOracle.Price memory price = rentPrice(name, duration);\\n if (msg.value < price.base) {\\n revert InsufficientValue();\\n }\\n uint256 expires = nameWrapper.renew(tokenId, duration);\\n\\n if (msg.value > price.base) {\\n payable(msg.sender).transfer(msg.value - price.base);\\n }\\n\\n emit NameRenewed(name, labelhash, msg.value, expires);\\n }\\n\\n function withdraw() public {\\n payable(owner()).transfer(address(this).balance);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IETHRegistrarController).interfaceId;\\n }\\n\\n /* Internal functions */\\n\\n function _consumeCommitment(\\n string memory name,\\n uint256 duration,\\n bytes32 commitment\\n ) internal {\\n // Require an old enough commitment.\\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\\n revert CommitmentTooNew(commitment);\\n }\\n\\n // If the commitment is too old, or the name is registered, stop\\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\\n revert CommitmentTooOld(commitment);\\n }\\n if (!available(name)) {\\n revert NameNotAvailable(name);\\n }\\n\\n delete (commitments[commitment]);\\n\\n if (duration < MIN_REGISTRATION_DURATION) {\\n revert DurationTooShort(duration);\\n }\\n }\\n\\n function _setRecords(\\n address resolverAddress,\\n bytes32 label,\\n bytes[] calldata data\\n ) internal {\\n // use hardcoded .eth namehash\\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\\n Resolver resolver = Resolver(resolverAddress);\\n resolver.multicallWithNodeCheck(nodehash, data);\\n }\\n\\n function _setReverseRecord(\\n string memory name,\\n address resolver,\\n address owner\\n ) internal {\\n reverseRegistrar.setNameForAddr(\\n msg.sender,\\n owner,\\n resolver,\\n string.concat(name, \\\".eth\\\")\\n );\\n }\\n}\\n\",\"keccak256\":\"0xa468b713926937c454ec621ca381d581ab3b06bd437df3e21d53bbade216ef51\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/ethregistrar/IETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./IPriceOracle.sol\\\";\\n\\ninterface IETHRegistrarController {\\n function rentPrice(\\n string memory,\\n uint256\\n ) external view returns (IPriceOracle.Price memory);\\n\\n function available(string memory) external returns (bool);\\n\\n function makeCommitment(\\n string memory,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16\\n ) external pure returns (bytes32);\\n\\n function commit(bytes32) external;\\n\\n function register(\\n string calldata,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16\\n ) external payable;\\n\\n function renew(string calldata, uint256) external payable;\\n}\\n\",\"keccak256\":\"0x54575cc2e4245c0ba79e42a58086335ec0522f4cbeb8c92d71b886593c97060e\",\"license\":\"MIT\"},\"contracts/ethregistrar/IPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\ninterface IPriceOracle {\\n struct Price {\\n uint256 base;\\n uint256 premium;\\n }\\n\\n /**\\n * @dev Returns the price to register or renew a name.\\n * @param name The name being registered or renewed.\\n * @param expires When the name presently expires (0 if this is a new registration).\\n * @param duration How long the name is being registered or extended for, in seconds.\\n * @return base premium tuple of base price + premium price\\n */\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (Price calldata);\\n}\\n\",\"keccak256\":\"0x1ec537b4c7f9cc40363b39dcc7ade8c29bf94662e6b01d38e681487637bd577e\",\"license\":\"MIT\"},\"contracts/ethregistrar/StringUtils.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary StringUtils {\\n /**\\n * @dev Returns the length of a given string\\n *\\n * @param s The string to measure the length of\\n * @return The length of the input string\\n */\\n function strlen(string memory s) internal pure returns (uint256) {\\n uint256 len;\\n uint256 i = 0;\\n uint256 bytelength = bytes(s).length;\\n for (len = 0; i < bytelength; len++) {\\n bytes1 b = bytes(s)[i];\\n if (b < 0x80) {\\n i += 1;\\n } else if (b < 0xE0) {\\n i += 2;\\n } else if (b < 0xF0) {\\n i += 3;\\n } else if (b < 0xF8) {\\n i += 4;\\n } else if (b < 0xFC) {\\n i += 5;\\n } else {\\n i += 6;\\n }\\n }\\n return len;\\n }\\n}\\n\",\"keccak256\":\"0x4cc8363a850dc9130c433ee50e7c97e29a45ae5d9bd0808205ac7134b34f24e4\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/resolvers/Resolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"./profiles/IABIResolver.sol\\\";\\nimport \\\"./profiles/IAddressResolver.sol\\\";\\nimport \\\"./profiles/IAddrResolver.sol\\\";\\nimport \\\"./profiles/IContentHashResolver.sol\\\";\\nimport \\\"./profiles/IDNSRecordResolver.sol\\\";\\nimport \\\"./profiles/IDNSZoneResolver.sol\\\";\\nimport \\\"./profiles/IInterfaceResolver.sol\\\";\\nimport \\\"./profiles/INameResolver.sol\\\";\\nimport \\\"./profiles/IPubkeyResolver.sol\\\";\\nimport \\\"./profiles/ITextResolver.sol\\\";\\nimport \\\"./profiles/IExtendedResolver.sol\\\";\\n\\n/**\\n * A generic resolver interface which includes all the functions including the ones deprecated\\n */\\ninterface Resolver is\\n IERC165,\\n IABIResolver,\\n IAddressResolver,\\n IAddrResolver,\\n IContentHashResolver,\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n IInterfaceResolver,\\n INameResolver,\\n IPubkeyResolver,\\n ITextResolver,\\n IExtendedResolver\\n{\\n /* Deprecated events */\\n event ContentChanged(bytes32 indexed node, bytes32 hash);\\n\\n function setApprovalForAll(address, bool) external;\\n\\n function approve(bytes32 node, address delegate, bool approved) external;\\n\\n function isApprovedForAll(address account, address operator) external;\\n\\n function isApprovedFor(\\n address owner,\\n bytes32 node,\\n address delegate\\n ) external;\\n\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external;\\n\\n function setAddr(bytes32 node, address addr) external;\\n\\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\\n\\n function setContenthash(bytes32 node, bytes calldata hash) external;\\n\\n function setDnsrr(bytes32 node, bytes calldata data) external;\\n\\n function setName(bytes32 node, string calldata _name) external;\\n\\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\\n\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external;\\n\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external;\\n\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n /* Deprecated functions */\\n function content(bytes32 node) external view returns (bytes32);\\n\\n function multihash(bytes32 node) external view returns (bytes memory);\\n\\n function setContent(bytes32 node, bytes32 hash) external;\\n\\n function setMultihash(bytes32 node, bytes calldata hash) external;\\n}\\n\",\"keccak256\":\"0xfc77ab6b7c59c3ebfe1c720bdebf9b08c2488ff7ac9501a9aa056c5d6d5b50c5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseClaimer.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\n\\ncontract ReverseClaimer {\\n bytes32 constant ADDR_REVERSE_NODE =\\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n constructor(ENS ens, address claimant) {\\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\\n ens.owner(ADDR_REVERSE_NODE)\\n );\\n reverseRegistrar.claim(claimant);\\n }\\n}\\n\",\"keccak256\":\"0x78a28627241535b595f6fff476a1fa7acc90c80684fe7784734920fc8af6fc22\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/ReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IReverseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"../root/Controllable.sol\\\";\\n\\nabstract contract NameResolver {\\n function setName(bytes32 node, string memory name) public virtual;\\n}\\n\\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\\n\\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n// namehash('addr.reverse')\\n\\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\\n ENS public immutable ens;\\n NameResolver public defaultResolver;\\n\\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\\n event DefaultResolverChanged(NameResolver indexed resolver);\\n\\n /**\\n * @dev Constructor\\n * @param ensAddr The address of the ENS registry.\\n */\\n constructor(ENS ensAddr) {\\n ens = ensAddr;\\n\\n // Assign ownership of the reverse record to our deployer\\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\\n ensAddr.owner(ADDR_REVERSE_NODE)\\n );\\n if (address(oldRegistrar) != address(0x0)) {\\n oldRegistrar.claim(msg.sender);\\n }\\n }\\n\\n modifier authorised(address addr) {\\n require(\\n addr == msg.sender ||\\n controllers[msg.sender] ||\\n ens.isApprovedForAll(addr, msg.sender) ||\\n ownsContract(addr),\\n \\\"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\\\"\\n );\\n _;\\n }\\n\\n function setDefaultResolver(address resolver) public override onlyOwner {\\n require(\\n address(resolver) != address(0),\\n \\\"ReverseRegistrar: Resolver address must not be 0\\\"\\n );\\n defaultResolver = NameResolver(resolver);\\n emit DefaultResolverChanged(NameResolver(resolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claim(address owner) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, address(defaultResolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param addr The reverse record to set\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The resolver of the reverse node\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) public override authorised(addr) returns (bytes32) {\\n bytes32 labelHash = sha3HexAddress(addr);\\n bytes32 reverseNode = keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\\n );\\n emit ReverseClaimed(addr, reverseNode);\\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\\n return reverseNode;\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, resolver);\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the calling account. First updates the resolver to the default reverse\\n * resolver if necessary.\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setName(string memory name) public override returns (bytes32) {\\n return\\n setNameForAddr(\\n msg.sender,\\n msg.sender,\\n address(defaultResolver),\\n name\\n );\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the account provided. Updates the resolver to a designated resolver\\n * Only callable by controllers and authorised users\\n * @param addr The reverse record to set\\n * @param owner The owner of the reverse node\\n * @param resolver The resolver of the reverse node\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) public override returns (bytes32) {\\n bytes32 node = claimForAddr(addr, owner, resolver);\\n NameResolver(resolver).setName(node, name);\\n return node;\\n }\\n\\n /**\\n * @dev Returns the node hash for a given account's reverse records.\\n * @param addr The address to hash\\n * @return The ENS node hash.\\n */\\n function node(address addr) public pure override returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\\n );\\n }\\n\\n /**\\n * @dev An optimised function to compute the sha3 of the lower-case\\n * hexadecimal representation of an Ethereum address.\\n * @param addr The address to hash\\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\\n * input address.\\n */\\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\\n assembly {\\n for {\\n let i := 40\\n } gt(i, 0) {\\n\\n } {\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n }\\n\\n ret := keccak256(0, 40)\\n }\\n }\\n\\n function ownsContract(address addr) internal view returns (bool) {\\n try Ownable(addr).owner() returns (address owner) {\\n return owner == msg.sender;\\n } catch {\\n return false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd57d28e5791b4b44650a00f5ef6c725af53698ec33faeeaa3591f0dbd939559a\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"},\"contracts/utils/ERC20Recoverable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\\n */\\n\\ncontract ERC20Recoverable is Ownable {\\n /**\\n @notice Recover ERC20 tokens sent to the contract by mistake.\\n @dev The contract is Ownable and only the owner can call the recover function.\\n @param _to The address to send the tokens to.\\n@param _token The address of the ERC20 token to recover\\n @param _amount The amount of tokens to recover.\\n */\\n function recoverFunds(\\n address _token,\\n address _to,\\n uint256 _amount\\n ) external onlyOwner {\\n IERC20(_token).transfer(_to, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x793a38091e1f81499a29ddba82c2b2f3cdd07071b81a832886e8e02a45ff352a\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_ETH = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x70310eb67146d7290731c31841399640ac3b6a949eadc6598bc150123d185c57\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101406040523480156200001257600080fd5b50604051620021a0380380620021a0833981016040819052620000359162000222565b80336200004281620001b9565b6040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e260048201526000906001600160a01b038416906302571be390602401602060405180830381865afa158015620000aa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000d09190620002b6565b604051630f41a04d60e11b81526001600160a01b03848116600483015291925090821690631e83409a906024016020604051808303816000875af11580156200011d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001439190620002dd565b5050505084841162000168576040516307cb550760e31b815260040160405180910390fd5b428411156200018a57604051630b4319e560e21b815260040160405180910390fd5b506001600160a01b0395861660805293851660a05260c09290925260e0528216610100521661012052620002f7565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200021f57600080fd5b50565b600080600080600080600060e0888a0312156200023e57600080fd5b87516200024b8162000209565b60208901519097506200025e8162000209565b8096505060408801519450606088015193506080880151620002808162000209565b60a0890151909350620002938162000209565b60c0890151909250620002a68162000209565b8091505092959891949750929550565b600060208284031215620002c957600080fd5b8151620002d68162000209565b9392505050565b600060208284031215620002f057600080fd5b5051919050565b60805160a05160c05160e0516101005161012051611e216200037f60003960008181610375015281816108300152610c2501526000818161023801526112300152600081816103dc01528181610e0301526110570152600081816103030152610fe00152600081816104100152610a4a015260008181610a7f0152610d720152611e216000f3fe60806040526004361061015f5760003560e01c80638d839ffe116100c0578063aeb8ce9b11610074578063d3419bf311610059578063d3419bf3146103fe578063f14fcbc814610432578063f2fde38b1461045257600080fd5b8063aeb8ce9b146103aa578063ce1e09c0146103ca57600080fd5b80639791c097116100a55780639791c09714610343578063a8e5fbc014610363578063acf1a8411461039757600080fd5b80638d839ffe146102f15780638da5cb5b1461032557600080fd5b806374694a2b11610117578063839df945116100fc578063839df9451461027257806383e7f6ff1461029f5780638a95b09f146102da57600080fd5b806374694a2b14610213578063808698531461022657600080fd5b80635d3590d5116101485780635d3590d5146101b057806365a69dcf146101d0578063715018a6146101fe57600080fd5b806301ffc9a7146101645780633ccfd60b14610199575b600080fd5b34801561017057600080fd5b5061018461017f366004611471565b610472565b60405190151581526020015b60405180910390f35b3480156101a557600080fd5b506101ae61050b565b005b3480156101bc57600080fd5b506101ae6101cb3660046114cf565b610548565b3480156101dc57600080fd5b506101f06101eb36600461163c565b6105e2565b604051908152602001610190565b34801561020a57600080fd5b506101ae6106d0565b6101ae61022136600461173f565b6106e4565b34801561023257600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610190565b34801561027e57600080fd5b506101f061028d366004611809565b60016020526000908152604090205481565b3480156102ab57600080fd5b506102bf6102ba366004611822565b610a00565b60408051825181526020928301519281019290925201610190565b3480156102e657600080fd5b506101f06224ea0081565b3480156102fd57600080fd5b506101f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561033157600080fd5b506000546001600160a01b031661025a565b34801561034f57600080fd5b5061018461035e366004611867565b610b53565b34801561036f57600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b6101ae6103a536600461189c565b610b68565b3480156103b657600080fd5b506101846103c5366004611867565b610d29565b3480156103d657600080fd5b506101f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561040a57600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b34801561043e57600080fd5b506101ae61044d366004611809565b610dec565b34801561045e57600080fd5b506101ae61046d3660046118e8565b610e7a565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061050557507fffffffff0000000000000000000000000000000000000000000000000000000082167f612e8c0900000000000000000000000000000000000000000000000000000000145b92915050565b600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015610545573d6000803e3d6000fd5b50565b610550610f07565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af11580156105b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dc9190611903565b50505050565b885160208a01206000906001600160a01b03871615801561060557506001841515145b1561063c576040517f406d917600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b841580159061065257506001600160a01b038716155b15610689576040517fd3f605c400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808a8a8a8a8a8a8a8a6040516020016106aa999897969594939291906119db565b604051602081830303815290604052805190602001209150509998505050505050505050565b6106d8610f07565b6106e26000610f61565b565b60006107278b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c9250610a00915050565b6020810151815191925061073a91611a53565b34101561075a5760405163044044a560e21b815260040160405180910390fd5b6107fd8b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050896107f88e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d8d8d8d8d8d8d8d6105e2565b610fc9565b6040517fa40149820000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a40149829061086f908f908f908f908f908e908b90600401611a66565b6020604051808303816000875af115801561088e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b29190611ab0565b905084156108dd576108dd878d8d6040516108ce929190611ac9565b6040518091039020888861114b565b8315610926576109268c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508b925033915061122e9050565b896001600160a01b03168c8c604051610940929190611ac9565b60405180910390207f69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf278e8e8660000151876020015187604051610987959493929190611ad9565b60405180910390a3602082015182516109a09190611a53565b3411156109f2576020820151825133916108fc916109be9190611a53565b6109c89034611b0a565b6040518115909202916000818181858888f193505050501580156109f0573d6000803e3d6000fd5b505b505050505050505050505050565b6040805180820190915260008082526020820152825160208401206040517fd6e4fa86000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03908116916350e9a7159187917f00000000000000000000000000000000000000000000000000000000000000009091169063d6e4fa8690602401602060405180830381865afa158015610ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aec9190611ab0565b866040518463ffffffff1660e01b8152600401610b0b93929190611b6d565b6040805180830381865afa158015610b27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4b9190611b92565b949350505050565b60006003610b60836112e2565b101592915050565b60008383604051610b7a929190611ac9565b604080519182900382206020601f870181900481028401810190925285835292508291600091610bc791908890889081908401838280828437600092019190915250889250610a00915050565b8051909150341015610bec5760405163044044a560e21b815260040160405180910390fd5b6040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101839052602481018590526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c475abff906044016020604051808303816000875af1158015610c76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9a9190611ab0565b8251909150341115610ce257815133906108fc90610cb89034611b0a565b6040518115909202916000818181858888f19350505050158015610ce0573d6000803e3d6000fd5b505b837f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae88883485604051610d189493929190611be1565b60405180910390a250505050505050565b80516020820120600090610d3c83610b53565b8015610de557506040517f96e494e8000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906396e494e890602401602060405180830381865afa158015610dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de59190611903565b9392505050565b6000818152600160205260409020544290610e28907f000000000000000000000000000000000000000000000000000000000000000090611a53565b10610e67576040517f0a059d71000000000000000000000000000000000000000000000000000000008152600481018290526024015b60405180910390fd5b6000908152600160205260409020429055565b610e82610f07565b6001600160a01b038116610efe5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610e5e565b61054581610f61565b6000546001600160a01b031633146106e25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610e5e565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000818152600160205260409020544290611005907f000000000000000000000000000000000000000000000000000000000000000090611a53565b1115611040576040517f5320bcf900000000000000000000000000000000000000000000000000000000815260048101829052602401610e5e565b600081815260016020526040902054429061107c907f000000000000000000000000000000000000000000000000000000000000000090611a53565b116110b6576040517fcb7690d700000000000000000000000000000000000000000000000000000000815260048101829052602401610e5e565b6110bf83610d29565b6110f757826040517f477707e8000000000000000000000000000000000000000000000000000000008152600401610e5e9190611c08565b6000818152600160205260408120556224ea00821015611146576040517f9a71997b00000000000000000000000000000000000000000000000000000000815260048101839052602401610e5e565b505050565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301869052825180830384018152606083019384905280519101207fe32954eb0000000000000000000000000000000000000000000000000000000090925285906001600160a01b0382169063e32954eb906111de90859088908890606401611c1b565b6000604051808303816000875af11580156111fd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112259190810190611c3e565b50505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637a806d6b338385876040516020016112719190611d3d565b6040516020818303038152906040526040518563ffffffff1660e01b815260040161129f9493929190611d7e565b6020604051808303816000875af11580156112be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dc9190611ab0565b8051600090819081905b8082101561146857600085838151811061130857611308611dbc565b01602001516001600160f81b03191690507f80000000000000000000000000000000000000000000000000000000000000008110156113535761134c600184611a53565b9250611455565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156113905761134c600284611a53565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156113cd5761134c600384611a53565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561140a5761134c600484611a53565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156114475761134c600584611a53565b611452600684611a53565b92505b508261146081611dd2565b9350506112ec565b50909392505050565b60006020828403121561148357600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610de557600080fd5b80356001600160a01b03811681146114ca57600080fd5b919050565b6000806000606084860312156114e457600080fd5b6114ed846114b3565b92506114fb602085016114b3565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561154a5761154a61150b565b604052919050565b600067ffffffffffffffff82111561156c5761156c61150b565b50601f01601f191660200190565b600082601f83011261158b57600080fd5b813561159e61159982611552565b611521565b8181528460208386010111156115b357600080fd5b816020850160208301376000918101602001919091529392505050565b60008083601f8401126115e257600080fd5b50813567ffffffffffffffff8111156115fa57600080fd5b6020830191508360208260051b850101111561161557600080fd5b9250929050565b801515811461054557600080fd5b803561ffff811681146114ca57600080fd5b60008060008060008060008060006101008a8c03121561165b57600080fd5b893567ffffffffffffffff8082111561167357600080fd5b61167f8d838e0161157a565b9a5061168d60208d016114b3565b995060408c0135985060608c013597506116a960808d016114b3565b965060a08c01359150808211156116bf57600080fd5b506116cc8c828d016115d0565b90955093505060c08a01356116e08161161c565b91506116ee60e08b0161162a565b90509295985092959850929598565b60008083601f84011261170f57600080fd5b50813567ffffffffffffffff81111561172757600080fd5b60208301915083602082850101111561161557600080fd5b6000806000806000806000806000806101008b8d03121561175f57600080fd5b8a3567ffffffffffffffff8082111561177757600080fd5b6117838e838f016116fd565b909c509a508a915061179760208e016114b3565b995060408d0135985060608d013597506117b360808e016114b3565b965060a08d01359150808211156117c957600080fd5b506117d68d828e016115d0565b90955093505060c08b01356117ea8161161c565b91506117f860e08c0161162a565b90509295989b9194979a5092959850565b60006020828403121561181b57600080fd5b5035919050565b6000806040838503121561183557600080fd5b823567ffffffffffffffff81111561184c57600080fd5b6118588582860161157a565b95602094909401359450505050565b60006020828403121561187957600080fd5b813567ffffffffffffffff81111561189057600080fd5b610b4b8482850161157a565b6000806000604084860312156118b157600080fd5b833567ffffffffffffffff8111156118c857600080fd5b6118d4868287016116fd565b909790965060209590950135949350505050565b6000602082840312156118fa57600080fd5b610de5826114b3565b60006020828403121561191557600080fd5b8151610de58161161c565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b81835260006020808501808196508560051b810191508460005b878110156119ce5782840389528135601e1988360301811261198457600080fd5b8701858101903567ffffffffffffffff8111156119a057600080fd5b8036038213156119af57600080fd5b6119ba868284611920565b9a87019a9550505090840190600101611963565b5091979650505050505050565b60006101008b83526001600160a01b03808c1660208501528a60408501528960608501528089166080850152508060a0840152611a1b8184018789611949565b94151560c0840152505061ffff9190911660e090910152979650505050505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561050557610505611a3d565b60a081526000611a7a60a08301888a611920565b90506001600160a01b03808716602084015285604084015280851660608401525061ffff83166080830152979650505050505050565b600060208284031215611ac257600080fd5b5051919050565b8183823760009101908152919050565b608081526000611aed608083018789611920565b602083019590955250604081019290925260609091015292915050565b8181038181111561050557610505611a3d565b60005b83811015611b38578181015183820152602001611b20565b50506000910152565b60008151808452611b59816020860160208601611b1d565b601f01601f19169290920160200192915050565b606081526000611b806060830186611b41565b60208301949094525060400152919050565b600060408284031215611ba457600080fd5b6040516040810181811067ffffffffffffffff82111715611bc757611bc761150b565b604052825181526020928301519281019290925250919050565b606081526000611bf5606083018688611920565b6020830194909452506040015292915050565b602081526000610de56020830184611b41565b838152604060208201526000611c35604083018486611949565b95945050505050565b60006020808385031215611c5157600080fd5b825167ffffffffffffffff80821115611c6957600080fd5b818501915085601f830112611c7d57600080fd5b815181811115611c8f57611c8f61150b565b8060051b611c9e858201611521565b9182528381018501918581019089841115611cb857600080fd5b86860192505b83831015611d3057825185811115611cd65760008081fd5b8601603f81018b13611ce85760008081fd5b878101516040611cfa61159983611552565b8281528d82848601011115611d0f5760008081fd5b611d1e838c8301848701611b1d565b85525050509186019190860190611cbe565b9998505050505050505050565b60008251611d4f818460208701611b1d565b7f2e65746800000000000000000000000000000000000000000000000000000000920191825250600401919050565b60006001600160a01b038087168352808616602084015280851660408401525060806060830152611db26080830184611b41565b9695505050505050565b634e487b7160e01b600052603260045260246000fd5b600060018201611de457611de4611a3d565b506001019056fea264697066735822122016ca1cd856ad2357249d15690b7e1cab209e2c6e77ae0753d0bbeef794c21cb264736f6c63430008110033", + "deployedBytecode": "0x60806040526004361061015f5760003560e01c80638d839ffe116100c0578063aeb8ce9b11610074578063d3419bf311610059578063d3419bf3146103fe578063f14fcbc814610432578063f2fde38b1461045257600080fd5b8063aeb8ce9b146103aa578063ce1e09c0146103ca57600080fd5b80639791c097116100a55780639791c09714610343578063a8e5fbc014610363578063acf1a8411461039757600080fd5b80638d839ffe146102f15780638da5cb5b1461032557600080fd5b806374694a2b11610117578063839df945116100fc578063839df9451461027257806383e7f6ff1461029f5780638a95b09f146102da57600080fd5b806374694a2b14610213578063808698531461022657600080fd5b80635d3590d5116101485780635d3590d5146101b057806365a69dcf146101d0578063715018a6146101fe57600080fd5b806301ffc9a7146101645780633ccfd60b14610199575b600080fd5b34801561017057600080fd5b5061018461017f366004611471565b610472565b60405190151581526020015b60405180910390f35b3480156101a557600080fd5b506101ae61050b565b005b3480156101bc57600080fd5b506101ae6101cb3660046114cf565b610548565b3480156101dc57600080fd5b506101f06101eb36600461163c565b6105e2565b604051908152602001610190565b34801561020a57600080fd5b506101ae6106d0565b6101ae61022136600461173f565b6106e4565b34801561023257600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610190565b34801561027e57600080fd5b506101f061028d366004611809565b60016020526000908152604090205481565b3480156102ab57600080fd5b506102bf6102ba366004611822565b610a00565b60408051825181526020928301519281019290925201610190565b3480156102e657600080fd5b506101f06224ea0081565b3480156102fd57600080fd5b506101f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561033157600080fd5b506000546001600160a01b031661025a565b34801561034f57600080fd5b5061018461035e366004611867565b610b53565b34801561036f57600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b6101ae6103a536600461189c565b610b68565b3480156103b657600080fd5b506101846103c5366004611867565b610d29565b3480156103d657600080fd5b506101f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561040a57600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b34801561043e57600080fd5b506101ae61044d366004611809565b610dec565b34801561045e57600080fd5b506101ae61046d3660046118e8565b610e7a565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061050557507fffffffff0000000000000000000000000000000000000000000000000000000082167f612e8c0900000000000000000000000000000000000000000000000000000000145b92915050565b600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015610545573d6000803e3d6000fd5b50565b610550610f07565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af11580156105b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dc9190611903565b50505050565b885160208a01206000906001600160a01b03871615801561060557506001841515145b1561063c576040517f406d917600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b841580159061065257506001600160a01b038716155b15610689576040517fd3f605c400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808a8a8a8a8a8a8a8a6040516020016106aa999897969594939291906119db565b604051602081830303815290604052805190602001209150509998505050505050505050565b6106d8610f07565b6106e26000610f61565b565b60006107278b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c9250610a00915050565b6020810151815191925061073a91611a53565b34101561075a5760405163044044a560e21b815260040160405180910390fd5b6107fd8b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050896107f88e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d8d8d8d8d8d8d8d6105e2565b610fc9565b6040517fa40149820000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a40149829061086f908f908f908f908f908e908b90600401611a66565b6020604051808303816000875af115801561088e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b29190611ab0565b905084156108dd576108dd878d8d6040516108ce929190611ac9565b6040518091039020888861114b565b8315610926576109268c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508b925033915061122e9050565b896001600160a01b03168c8c604051610940929190611ac9565b60405180910390207f69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf278e8e8660000151876020015187604051610987959493929190611ad9565b60405180910390a3602082015182516109a09190611a53565b3411156109f2576020820151825133916108fc916109be9190611a53565b6109c89034611b0a565b6040518115909202916000818181858888f193505050501580156109f0573d6000803e3d6000fd5b505b505050505050505050505050565b6040805180820190915260008082526020820152825160208401206040517fd6e4fa86000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03908116916350e9a7159187917f00000000000000000000000000000000000000000000000000000000000000009091169063d6e4fa8690602401602060405180830381865afa158015610ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aec9190611ab0565b866040518463ffffffff1660e01b8152600401610b0b93929190611b6d565b6040805180830381865afa158015610b27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4b9190611b92565b949350505050565b60006003610b60836112e2565b101592915050565b60008383604051610b7a929190611ac9565b604080519182900382206020601f870181900481028401810190925285835292508291600091610bc791908890889081908401838280828437600092019190915250889250610a00915050565b8051909150341015610bec5760405163044044a560e21b815260040160405180910390fd5b6040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101839052602481018590526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c475abff906044016020604051808303816000875af1158015610c76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9a9190611ab0565b8251909150341115610ce257815133906108fc90610cb89034611b0a565b6040518115909202916000818181858888f19350505050158015610ce0573d6000803e3d6000fd5b505b837f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae88883485604051610d189493929190611be1565b60405180910390a250505050505050565b80516020820120600090610d3c83610b53565b8015610de557506040517f96e494e8000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906396e494e890602401602060405180830381865afa158015610dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de59190611903565b9392505050565b6000818152600160205260409020544290610e28907f000000000000000000000000000000000000000000000000000000000000000090611a53565b10610e67576040517f0a059d71000000000000000000000000000000000000000000000000000000008152600481018290526024015b60405180910390fd5b6000908152600160205260409020429055565b610e82610f07565b6001600160a01b038116610efe5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610e5e565b61054581610f61565b6000546001600160a01b031633146106e25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610e5e565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000818152600160205260409020544290611005907f000000000000000000000000000000000000000000000000000000000000000090611a53565b1115611040576040517f5320bcf900000000000000000000000000000000000000000000000000000000815260048101829052602401610e5e565b600081815260016020526040902054429061107c907f000000000000000000000000000000000000000000000000000000000000000090611a53565b116110b6576040517fcb7690d700000000000000000000000000000000000000000000000000000000815260048101829052602401610e5e565b6110bf83610d29565b6110f757826040517f477707e8000000000000000000000000000000000000000000000000000000008152600401610e5e9190611c08565b6000818152600160205260408120556224ea00821015611146576040517f9a71997b00000000000000000000000000000000000000000000000000000000815260048101839052602401610e5e565b505050565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301869052825180830384018152606083019384905280519101207fe32954eb0000000000000000000000000000000000000000000000000000000090925285906001600160a01b0382169063e32954eb906111de90859088908890606401611c1b565b6000604051808303816000875af11580156111fd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112259190810190611c3e565b50505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637a806d6b338385876040516020016112719190611d3d565b6040516020818303038152906040526040518563ffffffff1660e01b815260040161129f9493929190611d7e565b6020604051808303816000875af11580156112be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dc9190611ab0565b8051600090819081905b8082101561146857600085838151811061130857611308611dbc565b01602001516001600160f81b03191690507f80000000000000000000000000000000000000000000000000000000000000008110156113535761134c600184611a53565b9250611455565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156113905761134c600284611a53565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156113cd5761134c600384611a53565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561140a5761134c600484611a53565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156114475761134c600584611a53565b611452600684611a53565b92505b508261146081611dd2565b9350506112ec565b50909392505050565b60006020828403121561148357600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610de557600080fd5b80356001600160a01b03811681146114ca57600080fd5b919050565b6000806000606084860312156114e457600080fd5b6114ed846114b3565b92506114fb602085016114b3565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561154a5761154a61150b565b604052919050565b600067ffffffffffffffff82111561156c5761156c61150b565b50601f01601f191660200190565b600082601f83011261158b57600080fd5b813561159e61159982611552565b611521565b8181528460208386010111156115b357600080fd5b816020850160208301376000918101602001919091529392505050565b60008083601f8401126115e257600080fd5b50813567ffffffffffffffff8111156115fa57600080fd5b6020830191508360208260051b850101111561161557600080fd5b9250929050565b801515811461054557600080fd5b803561ffff811681146114ca57600080fd5b60008060008060008060008060006101008a8c03121561165b57600080fd5b893567ffffffffffffffff8082111561167357600080fd5b61167f8d838e0161157a565b9a5061168d60208d016114b3565b995060408c0135985060608c013597506116a960808d016114b3565b965060a08c01359150808211156116bf57600080fd5b506116cc8c828d016115d0565b90955093505060c08a01356116e08161161c565b91506116ee60e08b0161162a565b90509295985092959850929598565b60008083601f84011261170f57600080fd5b50813567ffffffffffffffff81111561172757600080fd5b60208301915083602082850101111561161557600080fd5b6000806000806000806000806000806101008b8d03121561175f57600080fd5b8a3567ffffffffffffffff8082111561177757600080fd5b6117838e838f016116fd565b909c509a508a915061179760208e016114b3565b995060408d0135985060608d013597506117b360808e016114b3565b965060a08d01359150808211156117c957600080fd5b506117d68d828e016115d0565b90955093505060c08b01356117ea8161161c565b91506117f860e08c0161162a565b90509295989b9194979a5092959850565b60006020828403121561181b57600080fd5b5035919050565b6000806040838503121561183557600080fd5b823567ffffffffffffffff81111561184c57600080fd5b6118588582860161157a565b95602094909401359450505050565b60006020828403121561187957600080fd5b813567ffffffffffffffff81111561189057600080fd5b610b4b8482850161157a565b6000806000604084860312156118b157600080fd5b833567ffffffffffffffff8111156118c857600080fd5b6118d4868287016116fd565b909790965060209590950135949350505050565b6000602082840312156118fa57600080fd5b610de5826114b3565b60006020828403121561191557600080fd5b8151610de58161161c565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b81835260006020808501808196508560051b810191508460005b878110156119ce5782840389528135601e1988360301811261198457600080fd5b8701858101903567ffffffffffffffff8111156119a057600080fd5b8036038213156119af57600080fd5b6119ba868284611920565b9a87019a9550505090840190600101611963565b5091979650505050505050565b60006101008b83526001600160a01b03808c1660208501528a60408501528960608501528089166080850152508060a0840152611a1b8184018789611949565b94151560c0840152505061ffff9190911660e090910152979650505050505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561050557610505611a3d565b60a081526000611a7a60a08301888a611920565b90506001600160a01b03808716602084015285604084015280851660608401525061ffff83166080830152979650505050505050565b600060208284031215611ac257600080fd5b5051919050565b8183823760009101908152919050565b608081526000611aed608083018789611920565b602083019590955250604081019290925260609091015292915050565b8181038181111561050557610505611a3d565b60005b83811015611b38578181015183820152602001611b20565b50506000910152565b60008151808452611b59816020860160208601611b1d565b601f01601f19169290920160200192915050565b606081526000611b806060830186611b41565b60208301949094525060400152919050565b600060408284031215611ba457600080fd5b6040516040810181811067ffffffffffffffff82111715611bc757611bc761150b565b604052825181526020928301519281019290925250919050565b606081526000611bf5606083018688611920565b6020830194909452506040015292915050565b602081526000610de56020830184611b41565b838152604060208201526000611c35604083018486611949565b95945050505050565b60006020808385031215611c5157600080fd5b825167ffffffffffffffff80821115611c6957600080fd5b818501915085601f830112611c7d57600080fd5b815181811115611c8f57611c8f61150b565b8060051b611c9e858201611521565b9182528381018501918581019089841115611cb857600080fd5b86860192505b83831015611d3057825185811115611cd65760008081fd5b8601603f81018b13611ce85760008081fd5b878101516040611cfa61159983611552565b8281528d82848601011115611d0f5760008081fd5b611d1e838c8301848701611b1d565b85525050509186019190860190611cbe565b9998505050505050505050565b60008251611d4f818460208701611b1d565b7f2e65746800000000000000000000000000000000000000000000000000000000920191825250600401919050565b60006001600160a01b038087168352808616602084015280851660408401525060806060830152611db26080830184611b41565b9695505050505050565b634e487b7160e01b600052603260045260246000fd5b600060018201611de457611de4611a3d565b506001019056fea264697066735822122016ca1cd856ad2357249d15690b7e1cab209e2c6e77ae0753d0bbeef794c21cb264736f6c63430008110033", + "devdoc": { + "details": "A registrar controller for registering and renewing names at fixed cost.", + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "recoverFunds(address,address,uint256)": { + "details": "The contract is Ownable and only the owner can call the recover function.", + "params": { + "_amount": "The amount of tokens to recover.", + "_to": "The address to send the tokens to.", + "_token": "The address of the ERC20 token to recover" + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "recoverFunds(address,address,uint256)": { + "notice": "Recover ERC20 tokens sent to the contract by mistake." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 444, + "contract": "contracts/ethregistrar/ETHRegistrarController.sol:ETHRegistrarController", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 12277, + "contract": "contracts/ethregistrar/ETHRegistrarController.sol:ETHRegistrarController", + "label": "commitments", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_uint256)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_uint256)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/ExponentialPremiumPriceOracle.json b/solidity/dns-contracts/deployments/holesky/ExponentialPremiumPriceOracle.json new file mode 100644 index 0000000..9e05a5b --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/ExponentialPremiumPriceOracle.json @@ -0,0 +1,304 @@ +{ + "address": "0x0EF1aF80c24B681991d675176D9c07d8C9236B9a", + "abi": [ + { + "inputs": [ + { + "internalType": "contract AggregatorInterface", + "name": "_usdOracle", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "_rentPrices", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "_startPremium", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalDays", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256[]", + "name": "prices", + "type": "uint256[]" + } + ], + "name": "RentPriceChanged", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "startPremium", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "elapsed", + "type": "uint256" + } + ], + "name": "decayedPremium", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "premium", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "price", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "base", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "premium", + "type": "uint256" + } + ], + "internalType": "struct IPriceOracle.Price", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price1Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price2Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price3Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price4Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price5Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "usdOracle", + "outputs": [ + { + "internalType": "contract AggregatorInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x0ec6899305fd7bd18ea0eee42fb0b662f263458b17d7fe54b7b9e808ace3ebf3", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x0EF1aF80c24B681991d675176D9c07d8C9236B9a", + "transactionIndex": 2, + "gasUsed": "814878", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xa2c596944d2f88a00173ada73cb619e0f6a0a9abeb7c874dfa59f2eae56c01de", + "transactionHash": "0x0ec6899305fd7bd18ea0eee42fb0b662f263458b17d7fe54b7b9e808ace3ebf3", + "logs": [], + "blockNumber": 814549, + "cumulativeGasUsed": "882150", + "status": 1, + "byzantium": true + }, + "args": [ + "0xb4CF1F7c766088Af09D950BaFC5455CD527F7d41", + [ + 0, + 0, + "20294266869609", + "5073566717402", + "158548959919" + ], + "100000000000000000000000000", + 21 + ], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract AggregatorInterface\",\"name\":\"_usdOracle\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"_rentPrices\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_startPremium\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalDays\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"prices\",\"type\":\"uint256[]\"}],\"name\":\"RentPriceChanged\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"startPremium\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"elapsed\",\"type\":\"uint256\"}],\"name\":\"decayedPremium\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"premium\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"price\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"base\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"}],\"internalType\":\"struct IPriceOracle.Price\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price1Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price2Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price3Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price4Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price5Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"usdOracle\",\"outputs\":[{\"internalType\":\"contract AggregatorInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"decayedPremium(uint256,uint256)\":{\"details\":\"Returns the premium price at current time elapsed\",\"params\":{\"elapsed\":\"time past since expiry\",\"startPremium\":\"starting price\"}},\"premium(string,uint256,uint256)\":{\"details\":\"Returns the pricing premium in wei.\"},\"price(string,uint256,uint256)\":{\"details\":\"Returns the price to register or renew a name.\",\"params\":{\"duration\":\"How long the name is being registered or extended for, in seconds.\",\"expires\":\"When the name presently expires (0 if this is a new registration).\",\"name\":\"The name being registered or renewed.\"},\"returns\":{\"_0\":\"base premium tuple of base price + premium price\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/ExponentialPremiumPriceOracle.sol\":\"ExponentialPremiumPriceOracle\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/ethregistrar/ExponentialPremiumPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./StablePriceOracle.sol\\\";\\n\\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\\n uint256 constant GRACE_PERIOD = 90 days;\\n uint256 immutable startPremium;\\n uint256 immutable endValue;\\n\\n constructor(\\n AggregatorInterface _usdOracle,\\n uint256[] memory _rentPrices,\\n uint256 _startPremium,\\n uint256 totalDays\\n ) StablePriceOracle(_usdOracle, _rentPrices) {\\n startPremium = _startPremium;\\n endValue = _startPremium >> totalDays;\\n }\\n\\n uint256 constant PRECISION = 1e18;\\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\\n uint256 constant bit3 = 999957694548431104;\\n uint256 constant bit4 = 999915390886613504;\\n uint256 constant bit5 = 999830788931929088;\\n uint256 constant bit6 = 999661606496243712;\\n uint256 constant bit7 = 999323327502650752;\\n uint256 constant bit8 = 998647112890970240;\\n uint256 constant bit9 = 997296056085470080;\\n uint256 constant bit10 = 994599423483633152;\\n uint256 constant bit11 = 989228013193975424;\\n uint256 constant bit12 = 978572062087700096;\\n uint256 constant bit13 = 957603280698573696;\\n uint256 constant bit14 = 917004043204671232;\\n uint256 constant bit15 = 840896415253714560;\\n uint256 constant bit16 = 707106781186547584;\\n\\n /**\\n * @dev Returns the pricing premium in internal base units.\\n */\\n function _premium(\\n string memory,\\n uint256 expires,\\n uint256\\n ) internal view override returns (uint256) {\\n expires = expires + GRACE_PERIOD;\\n if (expires > block.timestamp) {\\n return 0;\\n }\\n\\n uint256 elapsed = block.timestamp - expires;\\n uint256 premium = decayedPremium(startPremium, elapsed);\\n if (premium >= endValue) {\\n return premium - endValue;\\n }\\n return 0;\\n }\\n\\n /**\\n * @dev Returns the premium price at current time elapsed\\n * @param startPremium starting price\\n * @param elapsed time past since expiry\\n */\\n function decayedPremium(\\n uint256 startPremium,\\n uint256 elapsed\\n ) public pure returns (uint256) {\\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\\n uint256 intDays = daysPast / PRECISION;\\n uint256 premium = startPremium >> intDays;\\n uint256 partDay = (daysPast - intDays * PRECISION);\\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\\n uint256 totalPremium = addFractionalPremium(fraction, premium);\\n return totalPremium;\\n }\\n\\n function addFractionalPremium(\\n uint256 fraction,\\n uint256 premium\\n ) internal pure returns (uint256) {\\n if (fraction & (1 << 0) != 0) {\\n premium = (premium * bit1) / PRECISION;\\n }\\n if (fraction & (1 << 1) != 0) {\\n premium = (premium * bit2) / PRECISION;\\n }\\n if (fraction & (1 << 2) != 0) {\\n premium = (premium * bit3) / PRECISION;\\n }\\n if (fraction & (1 << 3) != 0) {\\n premium = (premium * bit4) / PRECISION;\\n }\\n if (fraction & (1 << 4) != 0) {\\n premium = (premium * bit5) / PRECISION;\\n }\\n if (fraction & (1 << 5) != 0) {\\n premium = (premium * bit6) / PRECISION;\\n }\\n if (fraction & (1 << 6) != 0) {\\n premium = (premium * bit7) / PRECISION;\\n }\\n if (fraction & (1 << 7) != 0) {\\n premium = (premium * bit8) / PRECISION;\\n }\\n if (fraction & (1 << 8) != 0) {\\n premium = (premium * bit9) / PRECISION;\\n }\\n if (fraction & (1 << 9) != 0) {\\n premium = (premium * bit10) / PRECISION;\\n }\\n if (fraction & (1 << 10) != 0) {\\n premium = (premium * bit11) / PRECISION;\\n }\\n if (fraction & (1 << 11) != 0) {\\n premium = (premium * bit12) / PRECISION;\\n }\\n if (fraction & (1 << 12) != 0) {\\n premium = (premium * bit13) / PRECISION;\\n }\\n if (fraction & (1 << 13) != 0) {\\n premium = (premium * bit14) / PRECISION;\\n }\\n if (fraction & (1 << 14) != 0) {\\n premium = (premium * bit15) / PRECISION;\\n }\\n if (fraction & (1 << 15) != 0) {\\n premium = (premium * bit16) / PRECISION;\\n }\\n return premium;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x09149a39e7660d65873e5160971cf0904630b266cbec4f02721dad0aad28320b\",\"license\":\"MIT\"},\"contracts/ethregistrar/IPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\ninterface IPriceOracle {\\n struct Price {\\n uint256 base;\\n uint256 premium;\\n }\\n\\n /**\\n * @dev Returns the price to register or renew a name.\\n * @param name The name being registered or renewed.\\n * @param expires When the name presently expires (0 if this is a new registration).\\n * @param duration How long the name is being registered or extended for, in seconds.\\n * @return base premium tuple of base price + premium price\\n */\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (Price calldata);\\n}\\n\",\"keccak256\":\"0x1ec537b4c7f9cc40363b39dcc7ade8c29bf94662e6b01d38e681487637bd577e\",\"license\":\"MIT\"},\"contracts/ethregistrar/StablePriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./IPriceOracle.sol\\\";\\nimport \\\"./StringUtils.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\ninterface AggregatorInterface {\\n function latestAnswer() external view returns (int256);\\n}\\n\\n// StablePriceOracle sets a price in USD, based on an oracle.\\ncontract StablePriceOracle is IPriceOracle {\\n using StringUtils for *;\\n\\n // Rent in base price units by length\\n uint256 public immutable price1Letter;\\n uint256 public immutable price2Letter;\\n uint256 public immutable price3Letter;\\n uint256 public immutable price4Letter;\\n uint256 public immutable price5Letter;\\n\\n // Oracle address\\n AggregatorInterface public immutable usdOracle;\\n\\n event RentPriceChanged(uint256[] prices);\\n\\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\\n usdOracle = _usdOracle;\\n price1Letter = _rentPrices[0];\\n price2Letter = _rentPrices[1];\\n price3Letter = _rentPrices[2];\\n price4Letter = _rentPrices[3];\\n price5Letter = _rentPrices[4];\\n }\\n\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view override returns (IPriceOracle.Price memory) {\\n uint256 len = name.strlen();\\n uint256 basePrice;\\n\\n if (len >= 5) {\\n basePrice = price5Letter * duration;\\n } else if (len == 4) {\\n basePrice = price4Letter * duration;\\n } else if (len == 3) {\\n basePrice = price3Letter * duration;\\n } else if (len == 2) {\\n basePrice = price2Letter * duration;\\n } else {\\n basePrice = price1Letter * duration;\\n }\\n\\n return\\n IPriceOracle.Price({\\n base: attoUSDToWei(basePrice),\\n premium: attoUSDToWei(_premium(name, expires, duration))\\n });\\n }\\n\\n /**\\n * @dev Returns the pricing premium in wei.\\n */\\n function premium(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (uint256) {\\n return attoUSDToWei(_premium(name, expires, duration));\\n }\\n\\n /**\\n * @dev Returns the pricing premium in internal base units.\\n */\\n function _premium(\\n string memory name,\\n uint256 expires,\\n uint256 duration\\n ) internal view virtual returns (uint256) {\\n return 0;\\n }\\n\\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\\n return (amount * 1e8) / ethPrice;\\n }\\n\\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\\n return (amount * ethPrice) / 1e8;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IPriceOracle).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0x23a3d1eb3021080f20eb5f6af941b2d29a5d252a0a6119ba74f595da9c1ae1d6\",\"license\":\"MIT\"},\"contracts/ethregistrar/StringUtils.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary StringUtils {\\n /**\\n * @dev Returns the length of a given string\\n *\\n * @param s The string to measure the length of\\n * @return The length of the input string\\n */\\n function strlen(string memory s) internal pure returns (uint256) {\\n uint256 len;\\n uint256 i = 0;\\n uint256 bytelength = bytes(s).length;\\n for (len = 0; i < bytelength; len++) {\\n bytes1 b = bytes(s)[i];\\n if (b < 0x80) {\\n i += 1;\\n } else if (b < 0xE0) {\\n i += 2;\\n } else if (b < 0xF0) {\\n i += 3;\\n } else if (b < 0xF8) {\\n i += 4;\\n } else if (b < 0xFC) {\\n i += 5;\\n } else {\\n i += 6;\\n }\\n }\\n return len;\\n }\\n}\\n\",\"keccak256\":\"0x4cc8363a850dc9130c433ee50e7c97e29a45ae5d9bd0808205ac7134b34f24e4\"}},\"version\":1}", + "bytecode": "0x6101806040523480156200001257600080fd5b50604051620010863803806200108683398101604081905262000035916200012c565b6001600160a01b0384166101205282518490849081906000906200005d576200005d62000227565b6020026020010151608081815250508060018151811062000082576200008262000227565b602002602001015160a0818152505080600281518110620000a757620000a762000227565b602002602001015160c0818152505080600381518110620000cc57620000cc62000227565b602002602001015160e0818152505080600481518110620000f157620000f162000227565b60209081029190910101516101005250506101408290521c61016052506200023d9050565b634e487b7160e01b600052604160045260246000fd5b600080600080608085870312156200014357600080fd5b84516001600160a01b03811681146200015b57600080fd5b602086810151919550906001600160401b03808211156200017b57600080fd5b818801915088601f8301126200019057600080fd5b815181811115620001a557620001a562000116565b8060051b604051601f19603f83011681018181108582111715620001cd57620001cd62000116565b60405291825284820192508381018501918b831115620001ec57600080fd5b938501935b828510156200020c57845184529385019392850192620001f1565b60408b01516060909b0151999c909b50975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60805160a05160c05160e05161010051610120516101405161016051610db3620002d3600039600081816108590152610883015260006108300152600081816101c7015261074b01526000818161015301526102d401526000818161023a015261030d01526000818161018d015261033f015260008181610213015261037101526000818160f0015261039b0152610db36000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c8063a200e15311610076578063c8a4271f1161005b578063c8a4271f146101c2578063cd5d2c741461020e578063d820ed421461023557600080fd5b8063a200e15314610188578063a34e3596146101af57600080fd5b806350e9a715116100a757806350e9a7151461012057806359b6b86c1461014e57806359e1777c1461017557600080fd5b806301ffc9a7146100c35780632c0fd74c146100eb575b600080fd5b6100d66100d1366004610bdd565b61025c565b60405190151581526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016100e2565b61013361012e366004610c1f565b61026d565b604080518251815260209283015192810192909252016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b610112610183366004610c9e565b610433565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101126101bd366004610c1f565b6104ce565b6101e97f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b60006102678261051f565b92915050565b604080518082019091526000808252602082015260006102c286868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506105b792505050565b90506000600582106102ff576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b90506103c2565b81600403610331576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b81600303610363576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b81600203610395576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b6103bf847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b90505b60405180604001604052806103d683610746565b81526020016104266104218a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92508b91506107fa9050565b610746565b9052979650505050505050565b6000806201518061044c670de0b6b3a764000085610cd6565b6104569190610ced565b9050600061046c670de0b6b3a764000083610ced565b905084811c6000610485670de0b6b3a764000084610cd6565b61048f9085610d0f565b90506000670de0b6b3a76400006104a98362010000610cd6565b6104b39190610ced565b905060006104c182856108bd565b9998505050505050505050565b600061051661042186868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508892508791506107fa9050565b95945050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061026757507fffffffff0000000000000000000000000000000000000000000000000000000082167f50e9a715000000000000000000000000000000000000000000000000000000001492915050565b8051600090819081905b8082101561073d5760008583815181106105dd576105dd610d22565b01602001516001600160f81b03191690507f800000000000000000000000000000000000000000000000000000000000000081101561062857610621600184610d38565b925061072a565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561066557610621600284610d38565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156106a257610621600384610d38565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156106df57610621600484610d38565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561071c57610621600584610d38565b610727600684610d38565b92505b508261073581610d4b565b9350506105c1565b50909392505050565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d89190610d64565b9050806107e9846305f5e100610cd6565b6107f39190610ced565b9392505050565b60006108096276a70084610d38565b92504283111561081b575060006107f3565b60006108278442610d0f565b905060006108557f000000000000000000000000000000000000000000000000000000000000000083610433565b90507f000000000000000000000000000000000000000000000000000000000000000081106108b1576108a87f000000000000000000000000000000000000000000000000000000000000000082610d0f565b925050506107f3565b50600095945050505050565b600060018316156108f057670de0b6b3a76400006108e3670de0ad151d09418084610cd6565b6108ed9190610ced565b91505b600283161561092157670de0b6b3a7640000610914670de0a3769959680084610cd6565b61091e9190610ced565b91505b600483161561095257670de0b6b3a7640000610945670de09039a5fa510084610cd6565b61094f9190610ced565b91505b600883161561098357670de0b6b3a7640000610976670de069c00f3e120084610cd6565b6109809190610ced565b91505b60108316156109b457670de0b6b3a76400006109a7670de01cce21c9440084610cd6565b6109b19190610ced565b91505b60208316156109e557670de0b6b3a76400006109d8670ddf82ef46ce100084610cd6565b6109e29190610ced565b91505b6040831615610a1657670de0b6b3a7640000610a09670dde4f458f8e8d8084610cd6565b610a139190610ced565b91505b6080831615610a4757670de0b6b3a7640000610a3a670ddbe84213d5f08084610cd6565b610a449190610ced565b91505b610100831615610a7957670de0b6b3a7640000610a6c670dd71b7aa6df5b8084610cd6565b610a769190610ced565b91505b610200831615610aab57670de0b6b3a7640000610a9e670dcd86e7f28cde0084610cd6565b610aa89190610ced565b91505b610400831615610add57670de0b6b3a7640000610ad0670dba71a3084ad68084610cd6565b610ada9190610ced565b91505b610800831615610b0f57670de0b6b3a7640000610b02670d94961b13dbde8084610cd6565b610b0c9190610ced565b91505b611000831615610b4157670de0b6b3a7640000610b34670d4a171c35c9838084610cd6565b610b3e9190610ced565b91505b612000831615610b7357670de0b6b3a7640000610b66670cb9da519ccfb70084610cd6565b610b709190610ced565b91505b614000831615610ba557670de0b6b3a7640000610b98670bab76d59c18d68084610cd6565b610ba29190610ced565b91505b618000831615610bd757670de0b6b3a7640000610bca6709d025defee4df8084610cd6565b610bd49190610ced565b91505b50919050565b600060208284031215610bef57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146107f357600080fd5b60008060008060608587031215610c3557600080fd5b843567ffffffffffffffff80821115610c4d57600080fd5b818701915087601f830112610c6157600080fd5b813581811115610c7057600080fd5b886020828501011115610c8257600080fd5b6020928301999098509187013596604001359550909350505050565b60008060408385031215610cb157600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761026757610267610cc0565b600082610d0a57634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561026757610267610cc0565b634e487b7160e01b600052603260045260246000fd5b8082018082111561026757610267610cc0565b600060018201610d5d57610d5d610cc0565b5060010190565b600060208284031215610d7657600080fd5b505191905056fea264697066735822122051a48e18aef8695be8be5df1855004d2f37cdbb5ac151ecfafa24bbbbb272ee664736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100be5760003560e01c8063a200e15311610076578063c8a4271f1161005b578063c8a4271f146101c2578063cd5d2c741461020e578063d820ed421461023557600080fd5b8063a200e15314610188578063a34e3596146101af57600080fd5b806350e9a715116100a757806350e9a7151461012057806359b6b86c1461014e57806359e1777c1461017557600080fd5b806301ffc9a7146100c35780632c0fd74c146100eb575b600080fd5b6100d66100d1366004610bdd565b61025c565b60405190151581526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016100e2565b61013361012e366004610c1f565b61026d565b604080518251815260209283015192810192909252016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b610112610183366004610c9e565b610433565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101126101bd366004610c1f565b6104ce565b6101e97f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b60006102678261051f565b92915050565b604080518082019091526000808252602082015260006102c286868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506105b792505050565b90506000600582106102ff576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b90506103c2565b81600403610331576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b81600303610363576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b81600203610395576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b6103bf847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b90505b60405180604001604052806103d683610746565b81526020016104266104218a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92508b91506107fa9050565b610746565b9052979650505050505050565b6000806201518061044c670de0b6b3a764000085610cd6565b6104569190610ced565b9050600061046c670de0b6b3a764000083610ced565b905084811c6000610485670de0b6b3a764000084610cd6565b61048f9085610d0f565b90506000670de0b6b3a76400006104a98362010000610cd6565b6104b39190610ced565b905060006104c182856108bd565b9998505050505050505050565b600061051661042186868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508892508791506107fa9050565b95945050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061026757507fffffffff0000000000000000000000000000000000000000000000000000000082167f50e9a715000000000000000000000000000000000000000000000000000000001492915050565b8051600090819081905b8082101561073d5760008583815181106105dd576105dd610d22565b01602001516001600160f81b03191690507f800000000000000000000000000000000000000000000000000000000000000081101561062857610621600184610d38565b925061072a565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561066557610621600284610d38565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156106a257610621600384610d38565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156106df57610621600484610d38565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561071c57610621600584610d38565b610727600684610d38565b92505b508261073581610d4b565b9350506105c1565b50909392505050565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d89190610d64565b9050806107e9846305f5e100610cd6565b6107f39190610ced565b9392505050565b60006108096276a70084610d38565b92504283111561081b575060006107f3565b60006108278442610d0f565b905060006108557f000000000000000000000000000000000000000000000000000000000000000083610433565b90507f000000000000000000000000000000000000000000000000000000000000000081106108b1576108a87f000000000000000000000000000000000000000000000000000000000000000082610d0f565b925050506107f3565b50600095945050505050565b600060018316156108f057670de0b6b3a76400006108e3670de0ad151d09418084610cd6565b6108ed9190610ced565b91505b600283161561092157670de0b6b3a7640000610914670de0a3769959680084610cd6565b61091e9190610ced565b91505b600483161561095257670de0b6b3a7640000610945670de09039a5fa510084610cd6565b61094f9190610ced565b91505b600883161561098357670de0b6b3a7640000610976670de069c00f3e120084610cd6565b6109809190610ced565b91505b60108316156109b457670de0b6b3a76400006109a7670de01cce21c9440084610cd6565b6109b19190610ced565b91505b60208316156109e557670de0b6b3a76400006109d8670ddf82ef46ce100084610cd6565b6109e29190610ced565b91505b6040831615610a1657670de0b6b3a7640000610a09670dde4f458f8e8d8084610cd6565b610a139190610ced565b91505b6080831615610a4757670de0b6b3a7640000610a3a670ddbe84213d5f08084610cd6565b610a449190610ced565b91505b610100831615610a7957670de0b6b3a7640000610a6c670dd71b7aa6df5b8084610cd6565b610a769190610ced565b91505b610200831615610aab57670de0b6b3a7640000610a9e670dcd86e7f28cde0084610cd6565b610aa89190610ced565b91505b610400831615610add57670de0b6b3a7640000610ad0670dba71a3084ad68084610cd6565b610ada9190610ced565b91505b610800831615610b0f57670de0b6b3a7640000610b02670d94961b13dbde8084610cd6565b610b0c9190610ced565b91505b611000831615610b4157670de0b6b3a7640000610b34670d4a171c35c9838084610cd6565b610b3e9190610ced565b91505b612000831615610b7357670de0b6b3a7640000610b66670cb9da519ccfb70084610cd6565b610b709190610ced565b91505b614000831615610ba557670de0b6b3a7640000610b98670bab76d59c18d68084610cd6565b610ba29190610ced565b91505b618000831615610bd757670de0b6b3a7640000610bca6709d025defee4df8084610cd6565b610bd49190610ced565b91505b50919050565b600060208284031215610bef57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146107f357600080fd5b60008060008060608587031215610c3557600080fd5b843567ffffffffffffffff80821115610c4d57600080fd5b818701915087601f830112610c6157600080fd5b813581811115610c7057600080fd5b886020828501011115610c8257600080fd5b6020928301999098509187013596604001359550909350505050565b60008060408385031215610cb157600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761026757610267610cc0565b600082610d0a57634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561026757610267610cc0565b634e487b7160e01b600052603260045260246000fd5b8082018082111561026757610267610cc0565b600060018201610d5d57610d5d610cc0565b5060010190565b600060208284031215610d7657600080fd5b505191905056fea264697066735822122051a48e18aef8695be8be5df1855004d2f37cdbb5ac151ecfafa24bbbbb272ee664736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "decayedPremium(uint256,uint256)": { + "details": "Returns the premium price at current time elapsed", + "params": { + "elapsed": "time past since expiry", + "startPremium": "starting price" + } + }, + "premium(string,uint256,uint256)": { + "details": "Returns the pricing premium in wei." + }, + "price(string,uint256,uint256)": { + "details": "Returns the price to register or renew a name.", + "params": { + "duration": "How long the name is being registered or extended for, in seconds.", + "expires": "When the name presently expires (0 if this is a new registration).", + "name": "The name being registered or renewed." + }, + "returns": { + "_0": "base premium tuple of base price + premium price" + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/ExtendedDNSResolver.json b/solidity/dns-contracts/deployments/holesky/ExtendedDNSResolver.json new file mode 100644 index 0000000..36f4093 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/ExtendedDNSResolver.json @@ -0,0 +1,103 @@ +{ + "address": "0xB0c003d54e7c5a30C0dF72c0D43Df5876d457618", + "abi": [ + { + "inputs": [], + "name": "InvalidAddressFormat", + "type": "error" + }, + { + "inputs": [], + "name": "NotImplemented", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "context", + "type": "bytes" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xb9ee088a23e19d5ca6467185be6b3a501281464c49b95905e42e112f378990ab", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0xB0c003d54e7c5a30C0dF72c0D43Df5876d457618", + "transactionIndex": 0, + "gasUsed": "422726", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xfebe2adc07542ed473d210419b18bb7ffc91bd2f3089feececa32795585c6e76", + "transactionHash": "0xb9ee088a23e19d5ca6467185be6b3a501281464c49b95905e42e112f378990ab", + "logs": [], + "blockNumber": 815379, + "cumulativeGasUsed": "422726", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"InvalidAddressFormat\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotImplemented\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"context\",\"type\":\"bytes\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/resolvers/profiles/ExtendedDNSResolver.sol\":\"ExtendedDNSResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ExtendedDNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"../../resolvers/profiles/IExtendedDNSResolver.sol\\\";\\nimport \\\"../../resolvers/profiles/IAddressResolver.sol\\\";\\nimport \\\"../../resolvers/profiles/IAddrResolver.sol\\\";\\nimport \\\"../../utils/HexUtils.sol\\\";\\n\\ncontract ExtendedDNSResolver is IExtendedDNSResolver, IERC165 {\\n using HexUtils for *;\\n\\n uint256 private constant COIN_TYPE_ETH = 60;\\n\\n error NotImplemented();\\n error InvalidAddressFormat();\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) external view virtual override returns (bool) {\\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\\n }\\n\\n function resolve(\\n bytes calldata /* name */,\\n bytes calldata data,\\n bytes calldata context\\n ) external pure override returns (bytes memory) {\\n bytes4 selector = bytes4(data);\\n if (\\n selector == IAddrResolver.addr.selector ||\\n selector == IAddressResolver.addr.selector\\n ) {\\n if (selector == IAddressResolver.addr.selector) {\\n (, uint256 coinType) = abi.decode(data[4:], (bytes32, uint256));\\n if (coinType != COIN_TYPE_ETH) return abi.encode(\\\"\\\");\\n }\\n (address record, bool valid) = context.hexToAddress(\\n 2,\\n context.length\\n );\\n if (!valid) revert InvalidAddressFormat();\\n return abi.encode(record);\\n }\\n revert NotImplemented();\\n }\\n}\\n\",\"keccak256\":\"0xe49059d038b1e57513359d5fc05f44e7697bd0d1ccb5a979173e2cac429756ed\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedDNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedDNSResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data,\\n bytes memory context\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x541f8799c34ff9e7035d09f06ae0f0f8a16b6065e9b60a15670b957321630f72\",\"license\":\"MIT\"},\"contracts/utils/HexUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary HexUtils {\\n /**\\n * @dev Attempts to parse bytes32 from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexStringToBytes32(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (bytes32 r, bool valid) {\\n uint256 hexLength = lastIdx - idx;\\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\\n revert(\\\"Invalid string length\\\");\\n }\\n valid = true;\\n assembly {\\n // check that the index to read to is not past the end of the string\\n if gt(lastIdx, mload(str)) {\\n revert(0, 0)\\n }\\n\\n function getHex(c) -> ascii {\\n // chars 48-57: 0-9\\n if and(gt(c, 47), lt(c, 58)) {\\n ascii := sub(c, 48)\\n leave\\n }\\n // chars 65-70: A-F\\n if and(gt(c, 64), lt(c, 71)) {\\n ascii := add(sub(c, 65), 10)\\n leave\\n }\\n // chars 97-102: a-f\\n if and(gt(c, 96), lt(c, 103)) {\\n ascii := add(sub(c, 97), 10)\\n leave\\n }\\n // invalid char\\n ascii := 0xff\\n }\\n\\n let ptr := add(str, 32)\\n for {\\n let i := idx\\n } lt(i, lastIdx) {\\n i := add(i, 2)\\n } {\\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\\n // if either byte is invalid, set invalid and break loop\\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\\n valid := false\\n break\\n }\\n let combined := or(shl(4, byte1), byte2)\\n r := or(shl(8, r), combined)\\n }\\n }\\n }\\n\\n /**\\n * @dev Attempts to parse an address from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexToAddress(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (address, bool) {\\n if (lastIdx - idx < 40) return (address(0x0), false);\\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\\n return (address(uint160(uint256(r))), valid);\\n }\\n}\\n\",\"keccak256\":\"0x4a8a9c72d6f3effb80b310faa6dc273e7adbc3b949df9c7a42e290e5b13519f3\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506106ba806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806301ffc9a71461003b5780638ef98a7e1461008d575b600080fd5b61007861004936600461045d565b6001600160e01b0319167f8ef98a7e000000000000000000000000000000000000000000000000000000001490565b60405190151581526020015b60405180910390f35b6100a061009b3660046104d7565b6100ad565b6040516100849190610571565b606060006100bb85876105bf565b90506001600160e01b031981167f3b3b57de00000000000000000000000000000000000000000000000000000000148061011e57506001600160e01b031981167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b15610271577f0e3481fa000000000000000000000000000000000000000000000000000000006001600160e01b03198216016101b0576000610163866004818a6105ef565b8101906101709190610619565b915050603c81146101ae5760405160200161019690602080825260009082015260400190565b604051602081830303815290604052925050506102a3565b505b6000806101fc60028787905088888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506102ad9050565b9150915080610237576040517fc9e47ee500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff841660208201520160405160208183030381529060405293505050506102a3565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9695505050505050565b60008060286102bc858561063b565b10156102cd575060009050806102e3565b6000806102db8787876102eb565b909450925050505b935093915050565b600080806102f9858561063b565b90508060401415801561030d575080602814155b80610322575061031e600282610662565b6001145b1561038d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f496e76616c696420737472696e67206c656e6774680000000000000000000000604482015260640160405180910390fd5b60019150855184111561039f57600080fd5b6103f0565b6000603a8210602f831116156103bc5750602f190190565b604782106040831116156103d257506036190190565b606782106060831116156103e857506056190190565b5060ff919050565b60208601855b858110156104525761040d8183015160001a6103a4565b61041f6001830184015160001a6103a4565b60ff811460ff8314171561043857600095505050610452565b60049190911b1760089590951b94909417936002016103f6565b505050935093915050565b60006020828403121561046f57600080fd5b81356001600160e01b03198116811461048757600080fd5b9392505050565b60008083601f8401126104a057600080fd5b50813567ffffffffffffffff8111156104b857600080fd5b6020830191508360208285010111156104d057600080fd5b9250929050565b600080600080600080606087890312156104f057600080fd5b863567ffffffffffffffff8082111561050857600080fd5b6105148a838b0161048e565b9098509650602089013591508082111561052d57600080fd5b6105398a838b0161048e565b9096509450604089013591508082111561055257600080fd5b5061055f89828a0161048e565b979a9699509497509295939492505050565b600060208083528351808285015260005b8181101561059e57858101830151858201604001528201610582565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160e01b031981358181169160048510156105e75780818660040360031b1b83161692505b505092915050565b600080858511156105ff57600080fd5b8386111561060c57600080fd5b5050820193919092039150565b6000806040838503121561062c57600080fd5b50508035926020909101359150565b8181038181111561065c57634e487b7160e01b600052601160045260246000fd5b92915050565b60008261067f57634e487b7160e01b600052601260045260246000fd5b50069056fea264697066735822122048092a531a20e262efce54779239b612bcaff145bb48f1dae6c4641143e50c4164736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806301ffc9a71461003b5780638ef98a7e1461008d575b600080fd5b61007861004936600461045d565b6001600160e01b0319167f8ef98a7e000000000000000000000000000000000000000000000000000000001490565b60405190151581526020015b60405180910390f35b6100a061009b3660046104d7565b6100ad565b6040516100849190610571565b606060006100bb85876105bf565b90506001600160e01b031981167f3b3b57de00000000000000000000000000000000000000000000000000000000148061011e57506001600160e01b031981167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b15610271577f0e3481fa000000000000000000000000000000000000000000000000000000006001600160e01b03198216016101b0576000610163866004818a6105ef565b8101906101709190610619565b915050603c81146101ae5760405160200161019690602080825260009082015260400190565b604051602081830303815290604052925050506102a3565b505b6000806101fc60028787905088888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506102ad9050565b9150915080610237576040517fc9e47ee500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff841660208201520160405160208183030381529060405293505050506102a3565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9695505050505050565b60008060286102bc858561063b565b10156102cd575060009050806102e3565b6000806102db8787876102eb565b909450925050505b935093915050565b600080806102f9858561063b565b90508060401415801561030d575080602814155b80610322575061031e600282610662565b6001145b1561038d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f496e76616c696420737472696e67206c656e6774680000000000000000000000604482015260640160405180910390fd5b60019150855184111561039f57600080fd5b6103f0565b6000603a8210602f831116156103bc5750602f190190565b604782106040831116156103d257506036190190565b606782106060831116156103e857506056190190565b5060ff919050565b60208601855b858110156104525761040d8183015160001a6103a4565b61041f6001830184015160001a6103a4565b60ff811460ff8314171561043857600095505050610452565b60049190911b1760089590951b94909417936002016103f6565b505050935093915050565b60006020828403121561046f57600080fd5b81356001600160e01b03198116811461048757600080fd5b9392505050565b60008083601f8401126104a057600080fd5b50813567ffffffffffffffff8111156104b857600080fd5b6020830191508360208285010111156104d057600080fd5b9250929050565b600080600080600080606087890312156104f057600080fd5b863567ffffffffffffffff8082111561050857600080fd5b6105148a838b0161048e565b9098509650602089013591508082111561052d57600080fd5b6105398a838b0161048e565b9096509450604089013591508082111561055257600080fd5b5061055f89828a0161048e565b979a9699509497509295939492505050565b600060208083528351808285015260005b8181101561059e57858101830151858201604001528201610582565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160e01b031981358181169160048510156105e75780818660040360031b1b83161692505b505092915050565b600080858511156105ff57600080fd5b8386111561060c57600080fd5b5050820193919092039150565b6000806040838503121561062c57600080fd5b50508035926020909101359150565b8181038181111561065c57634e487b7160e01b600052601160045260246000fd5b92915050565b60008261067f57634e487b7160e01b600052601260045260246000fd5b50069056fea264697066735822122048092a531a20e262efce54779239b612bcaff145bb48f1dae6c4641143e50c4164736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "supportsInterface(bytes4)": { + "details": "Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/LegacyENSRegistry.json b/solidity/dns-contracts/deployments/holesky/LegacyENSRegistry.json new file mode 100644 index 0000000..866418b --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/LegacyENSRegistry.json @@ -0,0 +1,399 @@ +{ + "address": "0x94f523b8261B815b87EFfCf4d18E6aBeF18d6e4b", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NewOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "NewResolver", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "NewTTL", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "recordExists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "resolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "ttl", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xde595581f6398d20b05d0c7e9ac2779ce6e75688a1a8bd7dadeff708ed1e9a96", + "receipt": { + "to": null, + "from": "0x0F32b753aFc8ABad9Ca6fE589F707755f4df2353", + "contractAddress": "0x94f523b8261B815b87EFfCf4d18E6aBeF18d6e4b", + "transactionIndex": 13, + "gasUsed": "643649", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x01a18f7e0812029c77d14faee2cefa4cd7b18912f6a9272b4e48db5a4b37746a", + "transactionHash": "0xde595581f6398d20b05d0c7e9ac2779ce6e75688a1a8bd7dadeff708ed1e9a96", + "logs": [], + "blockNumber": 801536, + "cumulativeGasUsed": "29817834", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "bytecode": "0x608060405234801561001057600080fd5b5060008080526020527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb580546001600160a01b03191633179055610a43806100596000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c80635b0fc9c311610081578063cf4088231161005b578063cf40882314610204578063e985e9c514610217578063f79fe5381461026357600080fd5b80635b0fc9c3146101cb5780635ef2c7f0146101de578063a22cb465146101f157600080fd5b806314ab9038116100b257806314ab90381461015657806316a25cbd1461016b5780631896f70a146101b857600080fd5b80630178b8bf146100d957806302571be31461012257806306ab592314610135575b600080fd5b6101056100e7366004610832565b6000908152602081905260409020600101546001600160a01b031690565b6040516001600160a01b0390911681526020015b60405180910390f35b610105610130366004610832565b61028e565b610148610143366004610867565b6102bc565b604051908152602001610119565b6101696101643660046108b4565b6103bc565b005b61019f610179366004610832565b600090815260208190526040902060010154600160a01b900467ffffffffffffffff1690565b60405167ffffffffffffffff9091168152602001610119565b6101696101c63660046108e0565b6104a3565b6101696101d93660046108e0565b610575565b6101696101ec366004610903565b610641565b6101696101ff36600461095a565b610663565b610169610212366004610996565b6106cf565b6102536102253660046109e3565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b6040519015158152602001610119565b610253610271366004610832565b6000908152602081905260409020546001600160a01b0316151590565b6000818152602081905260408120546001600160a01b03163081036102b65750600092915050565b92915050565b60008381526020819052604081205484906001600160a01b03163381148061030757506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61031057600080fd5b604080516020810188905290810186905260009060600160408051601f1981840301815291815281516020928301206000818152928390529120805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03881617905590506040516001600160a01b0386168152869088907fce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e829060200160405180910390a39695505050505050565b60008281526020819052604090205482906001600160a01b03163381148061040757506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61041057600080fd5b60405167ffffffffffffffff8416815284907f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa689060200160405180910390a25050600091825260208290526040909120600101805467ffffffffffffffff909216600160a01b027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff909216919091179055565b60008281526020819052604090205482906001600160a01b0316338114806104ee57506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6104f757600080fd5b6040516001600160a01b038416815284907f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a09060200160405180910390a25050600091825260208290526040909120600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909216919091179055565b60008281526020819052604090205482906001600160a01b0316338114806105c057506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6105c957600080fd5b6000848152602081905260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385161790556040516001600160a01b038416815284907fd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d2669060200160405180910390a250505050565b600061064e8686866102bc565b905061065b8184846106ea565b505050505050565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6106d98484610575565b6106e48483836106ea565b50505050565b6000838152602081905260409020600101546001600160a01b0383811691161461077d5760008381526020818152604091829020600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038616908117909155915191825284917f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0910160405180910390a25b60008381526020819052604090206001015467ffffffffffffffff828116600160a01b909204161461082d576000838152602081815260409182902060010180547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff16600160a01b67ffffffffffffffff861690810291909117909155915191825284917f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa68910160405180910390a25b505050565b60006020828403121561084457600080fd5b5035919050565b80356001600160a01b038116811461086257600080fd5b919050565b60008060006060848603121561087c57600080fd5b83359250602084013591506108936040850161084b565b90509250925092565b803567ffffffffffffffff8116811461086257600080fd5b600080604083850312156108c757600080fd5b823591506108d76020840161089c565b90509250929050565b600080604083850312156108f357600080fd5b823591506108d76020840161084b565b600080600080600060a0868803121561091b57600080fd5b85359450602086013593506109326040870161084b565b92506109406060870161084b565b915061094e6080870161089c565b90509295509295909350565b6000806040838503121561096d57600080fd5b6109768361084b565b91506020830135801515811461098b57600080fd5b809150509250929050565b600080600080608085870312156109ac57600080fd5b843593506109bc6020860161084b565b92506109ca6040860161084b565b91506109d86060860161089c565b905092959194509250565b600080604083850312156109f657600080fd5b6109ff8361084b565b91506108d76020840161084b56fea264697066735822122077b2e963ccd038f34ccd990487d962cebf8be244a9dcab9c3af4099662a96cbc64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100d45760003560e01c80635b0fc9c311610081578063cf4088231161005b578063cf40882314610204578063e985e9c514610217578063f79fe5381461026357600080fd5b80635b0fc9c3146101cb5780635ef2c7f0146101de578063a22cb465146101f157600080fd5b806314ab9038116100b257806314ab90381461015657806316a25cbd1461016b5780631896f70a146101b857600080fd5b80630178b8bf146100d957806302571be31461012257806306ab592314610135575b600080fd5b6101056100e7366004610832565b6000908152602081905260409020600101546001600160a01b031690565b6040516001600160a01b0390911681526020015b60405180910390f35b610105610130366004610832565b61028e565b610148610143366004610867565b6102bc565b604051908152602001610119565b6101696101643660046108b4565b6103bc565b005b61019f610179366004610832565b600090815260208190526040902060010154600160a01b900467ffffffffffffffff1690565b60405167ffffffffffffffff9091168152602001610119565b6101696101c63660046108e0565b6104a3565b6101696101d93660046108e0565b610575565b6101696101ec366004610903565b610641565b6101696101ff36600461095a565b610663565b610169610212366004610996565b6106cf565b6102536102253660046109e3565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b6040519015158152602001610119565b610253610271366004610832565b6000908152602081905260409020546001600160a01b0316151590565b6000818152602081905260408120546001600160a01b03163081036102b65750600092915050565b92915050565b60008381526020819052604081205484906001600160a01b03163381148061030757506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61031057600080fd5b604080516020810188905290810186905260009060600160408051601f1981840301815291815281516020928301206000818152928390529120805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03881617905590506040516001600160a01b0386168152869088907fce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e829060200160405180910390a39695505050505050565b60008281526020819052604090205482906001600160a01b03163381148061040757506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61041057600080fd5b60405167ffffffffffffffff8416815284907f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa689060200160405180910390a25050600091825260208290526040909120600101805467ffffffffffffffff909216600160a01b027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff909216919091179055565b60008281526020819052604090205482906001600160a01b0316338114806104ee57506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6104f757600080fd5b6040516001600160a01b038416815284907f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a09060200160405180910390a25050600091825260208290526040909120600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909216919091179055565b60008281526020819052604090205482906001600160a01b0316338114806105c057506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6105c957600080fd5b6000848152602081905260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385161790556040516001600160a01b038416815284907fd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d2669060200160405180910390a250505050565b600061064e8686866102bc565b905061065b8184846106ea565b505050505050565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6106d98484610575565b6106e48483836106ea565b50505050565b6000838152602081905260409020600101546001600160a01b0383811691161461077d5760008381526020818152604091829020600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038616908117909155915191825284917f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0910160405180910390a25b60008381526020819052604090206001015467ffffffffffffffff828116600160a01b909204161461082d576000838152602081815260409182902060010180547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff16600160a01b67ffffffffffffffff861690810291909117909155915191825284917f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa68910160405180910390a25b505050565b60006020828403121561084457600080fd5b5035919050565b80356001600160a01b038116811461086257600080fd5b919050565b60008060006060848603121561087c57600080fd5b83359250602084013591506108936040850161084b565b90509250925092565b803567ffffffffffffffff8116811461086257600080fd5b600080604083850312156108c757600080fd5b823591506108d76020840161089c565b90509250929050565b600080604083850312156108f357600080fd5b823591506108d76020840161084b565b600080600080600060a0868803121561091b57600080fd5b85359450602086013593506109326040870161084b565b92506109406060870161084b565b915061094e6080870161089c565b90509295509295909350565b6000806040838503121561096d57600080fd5b6109768361084b565b91506020830135801515811461098b57600080fd5b809150509250929050565b600080600080608085870312156109ac57600080fd5b843593506109bc6020860161084b565b92506109ca6040860161084b565b91506109d86060860161089c565b905092959194509250565b600080604083850312156109f657600080fd5b6109ff8361084b565b91506108d76020840161084b56fea264697066735822122077b2e963ccd038f34ccd990487d962cebf8be244a9dcab9c3af4099662a96cbc64736f6c63430008110033" +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/LegacyETHRegistrarController.json b/solidity/dns-contracts/deployments/holesky/LegacyETHRegistrarController.json new file mode 100644 index 0000000..a968b3e --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/LegacyETHRegistrarController.json @@ -0,0 +1,602 @@ +{ + "address": "0xf13fC748601fDc5afA255e9D9166EB43f603a903", + "abi": [ + { + "inputs": [ + { + "internalType": "contract BaseRegistrar", + "name": "_base", + "type": "address" + }, + { + "internalType": "contract PriceOracle", + "name": "_prices", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minCommitmentAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxCommitmentAge", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRenewed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oracle", + "type": "address" + } + ], + "name": "NewPriceOracle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "MIN_REGISTRATION_DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "available", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "commit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "commitments", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + } + ], + "name": "makeCommitment", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "makeCommitmentWithConfig", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "maxCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "minCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + } + ], + "name": "register", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "registerWithConfig", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "rentPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_minCommitmentAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxCommitmentAge", + "type": "uint256" + } + ], + "name": "setCommitmentAges", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract PriceOracle", + "name": "_prices", + "type": "address" + } + ], + "name": "setPriceOracle", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "valid", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "withdraw", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xd698f08d890396d498068f25b0de8f3b2d2e057b4b011aaeaa2419dec12d53de", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0xf13fC748601fDc5afA255e9D9166EB43f603a903", + "transactionIndex": 4, + "gasUsed": "1854573", + "logsBloom": "0x00000000000000000000000000000000000000000000200000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000001008000000000000000000000000000000000000000000000000000020000000000000040000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x43249fd2e32a2fd40e84a739ef730e5c2daeeb60993a09bbc6dc07d15a287162", + "transactionHash": "0xd698f08d890396d498068f25b0de8f3b2d2e057b4b011aaeaa2419dec12d53de", + "logs": [ + { + "transactionIndex": 4, + "blockNumber": 815355, + "transactionHash": "0xd698f08d890396d498068f25b0de8f3b2d2e057b4b011aaeaa2419dec12d53de", + "address": "0xf13fC748601fDc5afA255e9D9166EB43f603a903", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x43249fd2e32a2fd40e84a739ef730e5c2daeeb60993a09bbc6dc07d15a287162" + } + ], + "blockNumber": 815355, + "cumulativeGasUsed": "1938573", + "status": 1, + "byzantium": true + }, + "args": [ + "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85", + "0x0EF1aF80c24B681991d675176D9c07d8C9236B9a", + 60, + 86400 + ], + "numDeployments": 1, + "bytecode": "0x608060405234801561001057600080fd5b50604051611f8c380380611f8c8339818101604052608081101561003357600080fd5b5080516020820151604080840151606090940151600080546001600160a01b031916331780825592519495939491926001600160a01b0316917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a381811161009d57600080fd5b600180546001600160a01b039586166001600160a01b0319918216179091556002805494909516931692909217909255600391909155600455611ea7806100e56000396000f3fe60806040526004361061016a5760003560e01c80638d839ffe116100cb578063aeb8ce9b1161007f578063f2fde38b11610059578063f2fde38b1461075f578063f49826be1461079f578063f7a169631461086d5761016a565b8063aeb8ce9b1461066d578063ce1e09c014610720578063f14fcbc8146107355761016a565b80638f32d59b116100b05780638f32d59b146105355780639791c0971461054a578063acf1a841146105fd5761016a565b80638d839ffe146104e25780638da5cb5b146104f75761016a565b80637e3244791161012257806383e7f6ff1161010757806383e7f6ff1461038657806385f6d1551461043b5780638a95b09f146104cd5761016a565b80637e3244791461032c578063839df9451461035c5761016a565b80633d86c52f116101535780633d86c52f146101e6578063530e784f146102d7578063715018a6146103175761016a565b806301ffc9a71461016f5780633ccfd60b146101cf575b600080fd5b34801561017b57600080fd5b506101bb6004803603602081101561019257600080fd5b50357fffffffff0000000000000000000000000000000000000000000000000000000016610944565b604080519115158252519081900360200190f35b3480156101db57600080fd5b506101e4610b63565b005b3480156101f257600080fd5b506102c5600480360360a081101561020957600080fd5b81019060208101813564010000000081111561022457600080fd5b82018360208201111561023657600080fd5b8035906020019184600183028401116401000000008311171561025857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff83358116945060208401359360408101358216935060600135169050610ba3565b60408051918252519081900360200190f35b3480156102e357600080fd5b506101e4600480360360208110156102fa57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610cdf565b34801561032357600080fd5b506101e4610d65565b34801561033857600080fd5b506101e46004803603604081101561034f57600080fd5b5080359060200135610de5565b34801561036857600080fd5b506102c56004803603602081101561037f57600080fd5b5035610e01565b34801561039257600080fd5b506102c5600480360360408110156103a957600080fd5b8101906020810181356401000000008111156103c457600080fd5b8201836020820111156103d657600080fd5b803590602001918460018302840111640100000000831117156103f857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610e13915050565b6101e46004803603608081101561045157600080fd5b81019060208101813564010000000081111561046c57600080fd5b82018360208201111561047e57600080fd5b803590602001918460018302840111640100000000831117156104a057600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff8135169060208101359060400135610fc3565b3480156104d957600080fd5b506102c561100e565b3480156104ee57600080fd5b506102c5611015565b34801561050357600080fd5b5061050c61101b565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561054157600080fd5b506101bb611037565b34801561055657600080fd5b506101bb6004803603602081101561056d57600080fd5b81019060208101813564010000000081111561058857600080fd5b82018360208201111561059a57600080fd5b803590602001918460018302840111640100000000831117156105bc57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611055945050505050565b6101e46004803603604081101561061357600080fd5b81019060208101813564010000000081111561062e57600080fd5b82018360208201111561064057600080fd5b8035906020019184600183028401116401000000008311171561066257600080fd5b91935091503561106a565b34801561067957600080fd5b506101bb6004803603602081101561069057600080fd5b8101906020810181356401000000008111156106ab57600080fd5b8201836020820111156106bd57600080fd5b803590602001918460018302840111640100000000831117156106df57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611252945050505050565b34801561072c57600080fd5b506102c5611312565b34801561074157600080fd5b506101e46004803603602081101561075857600080fd5b5035611318565b34801561076b57600080fd5b506101e46004803603602081101561078257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661134a565b3480156107ab57600080fd5b506102c5600480360360608110156107c257600080fd5b8101906020810181356401000000008111156107dd57600080fd5b8201836020820111156107ef57600080fd5b8035906020019184600183028401116401000000008311171561081157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff8335169350505060200135611364565b6101e4600480360360c081101561088357600080fd5b81019060208101813564010000000081111561089e57600080fd5b8201836020820111156108b057600080fd5b803590602001918460018302840111640100000000831117156108d257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff83358116945060208401359360408101359350606081013582169250608001351661137c565b604080517f737570706f727473496e74657266616365286279746573342900000000000000815290519081900360190190206000907fffffffff0000000000000000000000000000000000000000000000000000000083811691161480610ae75750604080517f72656e657728737472696e672c75696e743235362900000000000000000000008152905190819003601501812090806028611de38239604080519182900360280182207f636f6d6d697428627974657333322900000000000000000000000000000000008352905191829003600f01822090925090806026611e0b82396026019050604051809103902060405180807f617661696c61626c6528737472696e67290000000000000000000000000000008152506011019050604051809103902060405180807f72656e74507269636528737472696e672c75696e7432353629000000000000008152506019019050604051809103902018181818187bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610b5d57506040518080611da36040913960408051918290030181209150806042611e31823960420190506040518091039020187bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b92915050565b610b6b611037565b610b7457600080fd5b60405133904780156108fc02916000818181858888f19350505050158015610ba0573d6000803e3d6000fd5b50565b8451602086012060009073ffffffffffffffffffffffffffffffffffffffff8416158015610be5575073ffffffffffffffffffffffffffffffffffffffff8316155b15610c4857604080516020808201939093527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089901b1681830152605480820188905282518083039091018152607490910190915280519101209050610cd6565b73ffffffffffffffffffffffffffffffffffffffff8416610c6857600080fd5b604080516020808201939093527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b82168385015287811b8216605484015286901b166068820152607c80820188905282518083039091018152609c909101909152805191012090505b95945050505050565b610ce7611037565b610cf057600080fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691909117918290556040519116907ff261845a790fe29bbd6631e2ca4a5bdc83e6eed7c3271d9590d97287e00e912390600090a250565b610d6d611037565b610d7657600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b610ded611037565b610df657600080fd5b600391909155600455565b60056020526000908152604090205481565b8151602080840191909120600254600154604080517fd6e4fa8600000000000000000000000000000000000000000000000000000000815260048101859052905160009573ffffffffffffffffffffffffffffffffffffffff948516946350e9a715948a9491169263d6e4fa8692602480840193919291829003018186803b158015610e9e57600080fd5b505afa158015610eb2573d6000803e3d6000fd5b505050506040513d6020811015610ec857600080fd5b50516040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152602481018290526044810188905260606004820190815283516064830152835189928291608490910190602087019080838360005b83811015610f43578181015183820152602001610f2b565b50505050905090810190601f168015610f705780820380516001836020036101000a031916815260200191505b5094505050505060206040518083038186803b158015610f8f57600080fd5b505afa158015610fa3573d6000803e3d6000fd5b505050506040513d6020811015610fb957600080fd5b5051949350505050565b61100785858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508893508792508691508061137c565b5050505050565b6224ea0081565b60035481565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60005473ffffffffffffffffffffffffffffffffffffffff16331490565b6000600361106283611a7c565b101592915050565b60006110ad84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869250610e13915050565b9050803410156110bc57600080fd5b6000848460405180838380828437604080519390910183900383206001547fc475abff00000000000000000000000000000000000000000000000000000000855260048501829052602485018b905291519097506000965073ffffffffffffffffffffffffffffffffffffffff909116945063c475abff93506044808401936020935082900301818787803b15801561115457600080fd5b505af1158015611168573d6000803e3d6000fd5b505050506040513d602081101561117e57600080fd5b50519050348310156111bb5760405133903485900380156108fc02916000818181858888f193505050501580156111b9573d6000803e3d6000fd5b505b817f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae8787868560405180806020018481526020018381526020018281038252868682818152602001925080828437600083820152604051601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690920182900397509095505050505050a2505050505050565b8051602082012060009061126583611055565b801561130b5750600154604080517f96e494e800000000000000000000000000000000000000000000000000000000815260048101849052905173ffffffffffffffffffffffffffffffffffffffff909216916396e494e891602480820192602092909190829003018186803b1580156112de57600080fd5b505afa1580156112f2573d6000803e3d6000fd5b505050506040513d602081101561130857600080fd5b50515b9392505050565b60045481565b6004546000828152600560205260409020544291011061133757600080fd5b6000908152600560205260409020429055565b611352611037565b61135b57600080fd5b610ba081611c68565b6000611374848484600080610ba3565b949350505050565b600061138b8787868686610ba3565b9050600061139a888784611d15565b885160208a012090915080600073ffffffffffffffffffffffffffffffffffffffff8716156118a257600154604080517ffca247ac00000000000000000000000000000000000000000000000000000000815260048101859052306024820152604481018c9052905173ffffffffffffffffffffffffffffffffffffffff9092169163fca247ac916064808201926020929091908290030181600087803b15801561144457600080fd5b505af1158015611458573d6000803e3d6000fd5b505050506040513d602081101561146e57600080fd5b5051600154604080517fddf7fcb0000000000000000000000000000000000000000000000000000000008152905192935060009273ffffffffffffffffffffffffffffffffffffffff9092169163ddf7fcb091600480820192602092909190829003018186803b1580156114e157600080fd5b505afa1580156114f5573d6000803e3d6000fd5b505050506040513d602081101561150b57600080fd5b505160408051602081810193909352808201879052815180820383018152606082018084528151918501919091206001547f3f15457f00000000000000000000000000000000000000000000000000000000909252925192945073ffffffffffffffffffffffffffffffffffffffff1692633f15457f92606480840193829003018186803b15801561159c57600080fd5b505afa1580156115b0573d6000803e3d6000fd5b505050506040513d60208110156115c657600080fd5b5051604080517f1896f70a0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8b8116602483015291519190921691631896f70a91604480830192600092919082900301818387803b15801561164057600080fd5b505af1158015611654573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff871615611714578773ffffffffffffffffffffffffffffffffffffffff1663d5fa2b0082896040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050600060405180830381600087803b1580156116fb57600080fd5b505af115801561170f573d6000803e3d6000fd5b505050505b600154604080517f28ed4f6c0000000000000000000000000000000000000000000000000000000081526004810186905273ffffffffffffffffffffffffffffffffffffffff8e81166024830152915191909216916328ed4f6c91604480830192600092919082900301818387803b15801561178f57600080fd5b505af11580156117a3573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd308d866040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561188457600080fd5b505af1158015611898573d6000803e3d6000fd5b5050505050611975565b73ffffffffffffffffffffffffffffffffffffffff8616156118c357600080fd5b600154604080517ffca247ac0000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff8d81166024830152604482018d90529151919092169163fca247ac9160648083019260209291908290030181600087803b15801561194657600080fd5b505af115801561195a573d6000803e3d6000fd5b505050506040513d602081101561197057600080fd5b505190505b8973ffffffffffffffffffffffffffffffffffffffff16837fca6abbe9d7f11422cb6ca7629fbf6fe9efb1c621f71ce8f02b9f2a230097404f8d87856040518080602001848152602001838152602001828103825285818151815260200191508051906020019080838360005b838110156119fa5781810151838201526020016119e2565b50505050905090810190601f168015611a275780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a383341115611a6f5760405133903486900380156108fc02916000818181858888f19350505050158015611a6d573d6000803e3d6000fd5b505b5050505050505050505050565b8051600090819081905b80821015611c5f576000858381518110611a9c57fe5b01602001517fff000000000000000000000000000000000000000000000000000000000000001690507f8000000000000000000000000000000000000000000000000000000000000000811015611af857600183019250611c53565b7fe0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611b4d57600283019250611c53565b7ff0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611ba257600383019250611c53565b7ff8000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611bf757600483019250611c53565b7ffc000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611c4c57600583019250611c53565b6006830192505b50600190920191611a86565b50909392505050565b73ffffffffffffffffffffffffffffffffffffffff8116611c8857600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60035460008281526005602052604081205490914291011115611d3757600080fd5b60045460008381526005602052604090205442910111611d5657600080fd5b611d5f84611252565b611d6857600080fd5b6000828152600560205260408120819055611d838585610e13565b90506224ea00841015611d9557600080fd5b8034101561137457600080fdfe6d616b65436f6d6d69746d656e7457697468436f6e66696728737472696e672c616464726573732c627974657333322c616464726573732c6164647265737329726567697374657228737472696e672c616464726573732c75696e743235362c62797465733332296d616b65436f6d6d69746d656e7428737472696e672c616464726573732c6279746573333229726567697374657257697468436f6e66696728737472696e672c616464726573732c75696e743235362c627974657333322c616464726573732c6164647265737329a265627a7a7231582053a253c3d59287a7d8afcbca61f9a34825e2003361654c7f2350c82db76d3db764736f6c63430005110032", + "deployedBytecode": "0x60806040526004361061016a5760003560e01c80638d839ffe116100cb578063aeb8ce9b1161007f578063f2fde38b11610059578063f2fde38b1461075f578063f49826be1461079f578063f7a169631461086d5761016a565b8063aeb8ce9b1461066d578063ce1e09c014610720578063f14fcbc8146107355761016a565b80638f32d59b116100b05780638f32d59b146105355780639791c0971461054a578063acf1a841146105fd5761016a565b80638d839ffe146104e25780638da5cb5b146104f75761016a565b80637e3244791161012257806383e7f6ff1161010757806383e7f6ff1461038657806385f6d1551461043b5780638a95b09f146104cd5761016a565b80637e3244791461032c578063839df9451461035c5761016a565b80633d86c52f116101535780633d86c52f146101e6578063530e784f146102d7578063715018a6146103175761016a565b806301ffc9a71461016f5780633ccfd60b146101cf575b600080fd5b34801561017b57600080fd5b506101bb6004803603602081101561019257600080fd5b50357fffffffff0000000000000000000000000000000000000000000000000000000016610944565b604080519115158252519081900360200190f35b3480156101db57600080fd5b506101e4610b63565b005b3480156101f257600080fd5b506102c5600480360360a081101561020957600080fd5b81019060208101813564010000000081111561022457600080fd5b82018360208201111561023657600080fd5b8035906020019184600183028401116401000000008311171561025857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff83358116945060208401359360408101358216935060600135169050610ba3565b60408051918252519081900360200190f35b3480156102e357600080fd5b506101e4600480360360208110156102fa57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610cdf565b34801561032357600080fd5b506101e4610d65565b34801561033857600080fd5b506101e46004803603604081101561034f57600080fd5b5080359060200135610de5565b34801561036857600080fd5b506102c56004803603602081101561037f57600080fd5b5035610e01565b34801561039257600080fd5b506102c5600480360360408110156103a957600080fd5b8101906020810181356401000000008111156103c457600080fd5b8201836020820111156103d657600080fd5b803590602001918460018302840111640100000000831117156103f857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610e13915050565b6101e46004803603608081101561045157600080fd5b81019060208101813564010000000081111561046c57600080fd5b82018360208201111561047e57600080fd5b803590602001918460018302840111640100000000831117156104a057600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff8135169060208101359060400135610fc3565b3480156104d957600080fd5b506102c561100e565b3480156104ee57600080fd5b506102c5611015565b34801561050357600080fd5b5061050c61101b565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561054157600080fd5b506101bb611037565b34801561055657600080fd5b506101bb6004803603602081101561056d57600080fd5b81019060208101813564010000000081111561058857600080fd5b82018360208201111561059a57600080fd5b803590602001918460018302840111640100000000831117156105bc57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611055945050505050565b6101e46004803603604081101561061357600080fd5b81019060208101813564010000000081111561062e57600080fd5b82018360208201111561064057600080fd5b8035906020019184600183028401116401000000008311171561066257600080fd5b91935091503561106a565b34801561067957600080fd5b506101bb6004803603602081101561069057600080fd5b8101906020810181356401000000008111156106ab57600080fd5b8201836020820111156106bd57600080fd5b803590602001918460018302840111640100000000831117156106df57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611252945050505050565b34801561072c57600080fd5b506102c5611312565b34801561074157600080fd5b506101e46004803603602081101561075857600080fd5b5035611318565b34801561076b57600080fd5b506101e46004803603602081101561078257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661134a565b3480156107ab57600080fd5b506102c5600480360360608110156107c257600080fd5b8101906020810181356401000000008111156107dd57600080fd5b8201836020820111156107ef57600080fd5b8035906020019184600183028401116401000000008311171561081157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff8335169350505060200135611364565b6101e4600480360360c081101561088357600080fd5b81019060208101813564010000000081111561089e57600080fd5b8201836020820111156108b057600080fd5b803590602001918460018302840111640100000000831117156108d257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff83358116945060208401359360408101359350606081013582169250608001351661137c565b604080517f737570706f727473496e74657266616365286279746573342900000000000000815290519081900360190190206000907fffffffff0000000000000000000000000000000000000000000000000000000083811691161480610ae75750604080517f72656e657728737472696e672c75696e743235362900000000000000000000008152905190819003601501812090806028611de38239604080519182900360280182207f636f6d6d697428627974657333322900000000000000000000000000000000008352905191829003600f01822090925090806026611e0b82396026019050604051809103902060405180807f617661696c61626c6528737472696e67290000000000000000000000000000008152506011019050604051809103902060405180807f72656e74507269636528737472696e672c75696e7432353629000000000000008152506019019050604051809103902018181818187bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610b5d57506040518080611da36040913960408051918290030181209150806042611e31823960420190506040518091039020187bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b92915050565b610b6b611037565b610b7457600080fd5b60405133904780156108fc02916000818181858888f19350505050158015610ba0573d6000803e3d6000fd5b50565b8451602086012060009073ffffffffffffffffffffffffffffffffffffffff8416158015610be5575073ffffffffffffffffffffffffffffffffffffffff8316155b15610c4857604080516020808201939093527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089901b1681830152605480820188905282518083039091018152607490910190915280519101209050610cd6565b73ffffffffffffffffffffffffffffffffffffffff8416610c6857600080fd5b604080516020808201939093527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b82168385015287811b8216605484015286901b166068820152607c80820188905282518083039091018152609c909101909152805191012090505b95945050505050565b610ce7611037565b610cf057600080fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691909117918290556040519116907ff261845a790fe29bbd6631e2ca4a5bdc83e6eed7c3271d9590d97287e00e912390600090a250565b610d6d611037565b610d7657600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b610ded611037565b610df657600080fd5b600391909155600455565b60056020526000908152604090205481565b8151602080840191909120600254600154604080517fd6e4fa8600000000000000000000000000000000000000000000000000000000815260048101859052905160009573ffffffffffffffffffffffffffffffffffffffff948516946350e9a715948a9491169263d6e4fa8692602480840193919291829003018186803b158015610e9e57600080fd5b505afa158015610eb2573d6000803e3d6000fd5b505050506040513d6020811015610ec857600080fd5b50516040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152602481018290526044810188905260606004820190815283516064830152835189928291608490910190602087019080838360005b83811015610f43578181015183820152602001610f2b565b50505050905090810190601f168015610f705780820380516001836020036101000a031916815260200191505b5094505050505060206040518083038186803b158015610f8f57600080fd5b505afa158015610fa3573d6000803e3d6000fd5b505050506040513d6020811015610fb957600080fd5b5051949350505050565b61100785858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508893508792508691508061137c565b5050505050565b6224ea0081565b60035481565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60005473ffffffffffffffffffffffffffffffffffffffff16331490565b6000600361106283611a7c565b101592915050565b60006110ad84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869250610e13915050565b9050803410156110bc57600080fd5b6000848460405180838380828437604080519390910183900383206001547fc475abff00000000000000000000000000000000000000000000000000000000855260048501829052602485018b905291519097506000965073ffffffffffffffffffffffffffffffffffffffff909116945063c475abff93506044808401936020935082900301818787803b15801561115457600080fd5b505af1158015611168573d6000803e3d6000fd5b505050506040513d602081101561117e57600080fd5b50519050348310156111bb5760405133903485900380156108fc02916000818181858888f193505050501580156111b9573d6000803e3d6000fd5b505b817f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae8787868560405180806020018481526020018381526020018281038252868682818152602001925080828437600083820152604051601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690920182900397509095505050505050a2505050505050565b8051602082012060009061126583611055565b801561130b5750600154604080517f96e494e800000000000000000000000000000000000000000000000000000000815260048101849052905173ffffffffffffffffffffffffffffffffffffffff909216916396e494e891602480820192602092909190829003018186803b1580156112de57600080fd5b505afa1580156112f2573d6000803e3d6000fd5b505050506040513d602081101561130857600080fd5b50515b9392505050565b60045481565b6004546000828152600560205260409020544291011061133757600080fd5b6000908152600560205260409020429055565b611352611037565b61135b57600080fd5b610ba081611c68565b6000611374848484600080610ba3565b949350505050565b600061138b8787868686610ba3565b9050600061139a888784611d15565b885160208a012090915080600073ffffffffffffffffffffffffffffffffffffffff8716156118a257600154604080517ffca247ac00000000000000000000000000000000000000000000000000000000815260048101859052306024820152604481018c9052905173ffffffffffffffffffffffffffffffffffffffff9092169163fca247ac916064808201926020929091908290030181600087803b15801561144457600080fd5b505af1158015611458573d6000803e3d6000fd5b505050506040513d602081101561146e57600080fd5b5051600154604080517fddf7fcb0000000000000000000000000000000000000000000000000000000008152905192935060009273ffffffffffffffffffffffffffffffffffffffff9092169163ddf7fcb091600480820192602092909190829003018186803b1580156114e157600080fd5b505afa1580156114f5573d6000803e3d6000fd5b505050506040513d602081101561150b57600080fd5b505160408051602081810193909352808201879052815180820383018152606082018084528151918501919091206001547f3f15457f00000000000000000000000000000000000000000000000000000000909252925192945073ffffffffffffffffffffffffffffffffffffffff1692633f15457f92606480840193829003018186803b15801561159c57600080fd5b505afa1580156115b0573d6000803e3d6000fd5b505050506040513d60208110156115c657600080fd5b5051604080517f1896f70a0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8b8116602483015291519190921691631896f70a91604480830192600092919082900301818387803b15801561164057600080fd5b505af1158015611654573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff871615611714578773ffffffffffffffffffffffffffffffffffffffff1663d5fa2b0082896040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050600060405180830381600087803b1580156116fb57600080fd5b505af115801561170f573d6000803e3d6000fd5b505050505b600154604080517f28ed4f6c0000000000000000000000000000000000000000000000000000000081526004810186905273ffffffffffffffffffffffffffffffffffffffff8e81166024830152915191909216916328ed4f6c91604480830192600092919082900301818387803b15801561178f57600080fd5b505af11580156117a3573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd308d866040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561188457600080fd5b505af1158015611898573d6000803e3d6000fd5b5050505050611975565b73ffffffffffffffffffffffffffffffffffffffff8616156118c357600080fd5b600154604080517ffca247ac0000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff8d81166024830152604482018d90529151919092169163fca247ac9160648083019260209291908290030181600087803b15801561194657600080fd5b505af115801561195a573d6000803e3d6000fd5b505050506040513d602081101561197057600080fd5b505190505b8973ffffffffffffffffffffffffffffffffffffffff16837fca6abbe9d7f11422cb6ca7629fbf6fe9efb1c621f71ce8f02b9f2a230097404f8d87856040518080602001848152602001838152602001828103825285818151815260200191508051906020019080838360005b838110156119fa5781810151838201526020016119e2565b50505050905090810190601f168015611a275780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a383341115611a6f5760405133903486900380156108fc02916000818181858888f19350505050158015611a6d573d6000803e3d6000fd5b505b5050505050505050505050565b8051600090819081905b80821015611c5f576000858381518110611a9c57fe5b01602001517fff000000000000000000000000000000000000000000000000000000000000001690507f8000000000000000000000000000000000000000000000000000000000000000811015611af857600183019250611c53565b7fe0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611b4d57600283019250611c53565b7ff0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611ba257600383019250611c53565b7ff8000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611bf757600483019250611c53565b7ffc000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611c4c57600583019250611c53565b6006830192505b50600190920191611a86565b50909392505050565b73ffffffffffffffffffffffffffffffffffffffff8116611c8857600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60035460008281526005602052604081205490914291011115611d3757600080fd5b60045460008381526005602052604090205442910111611d5657600080fd5b611d5f84611252565b611d6857600080fd5b6000828152600560205260408120819055611d838585610e13565b90506224ea00841015611d9557600080fd5b8034101561137457600080fdfe6d616b65436f6d6d69746d656e7457697468436f6e66696728737472696e672c616464726573732c627974657333322c616464726573732c6164647265737329726567697374657228737472696e672c616464726573732c75696e743235362c62797465733332296d616b65436f6d6d69746d656e7428737472696e672c616464726573732c6279746573333229726567697374657257697468436f6e66696728737472696e672c616464726573732c75696e743235362c627974657333322c616464726573732c6164647265737329a265627a7a7231582053a253c3d59287a7d8afcbca61f9a34825e2003361654c7f2350c82db76d3db764736f6c63430005110032" +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/LegacyPublicResolver.json b/solidity/dns-contracts/deployments/holesky/LegacyPublicResolver.json new file mode 100644 index 0000000..c4e2b3d --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/LegacyPublicResolver.json @@ -0,0 +1,888 @@ +{ + "address": "0xc5e43b622b5e6C379a984E9BdB34E9A545564fA5", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + } + ], + "name": "ABIChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "AddrChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isAuthorised", + "type": "bool" + } + ], + "name": "AuthorisationChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "ContenthashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "record", + "type": "bytes" + } + ], + "name": "DNSRecordChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "DNSRecordDeleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "DNSZoneCleared", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "InterfaceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "PubkeyChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "string", + "name": "indexedKey", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "TextChanged", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentTypes", + "type": "uint256" + } + ], + "name": "ABI", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "authorisations", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "clearDNSZone", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "contenthash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "dnsRecord", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + } + ], + "name": "hasDNSRecords", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "interfaceImplementer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "pubkey", + "outputs": [ + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setABI", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "a", + "type": "bytes" + } + ], + "name": "setAddr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "setAddr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bool", + "name": "isAuthorised", + "type": "bool" + } + ], + "name": "setAuthorisation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setContenthash", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setDNSRecords", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "setInterface", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "setPubkey", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "setText", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "text", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x45d883d0a1cb03706a6e3ce5b737021c65591a9266d03fac1ef7495c81e9951e", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0xc5e43b622b5e6C379a984E9BdB34E9A545564fA5", + "transactionIndex": 2, + "gasUsed": "2382812", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xf4d4b66454a76b014890484d4d681e0f3e2cdb162a29a4d4d5358bf076919db2", + "transactionHash": "0x45d883d0a1cb03706a6e3ce5b737021c65591a9266d03fac1ef7495c81e9951e", + "logs": [], + "blockNumber": 815354, + "cumulativeGasUsed": "2424812", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "numDeployments": 1, + "bytecode": "0x60806040523480156200001157600080fd5b5060405162002abe38038062002abe83398101604081905262000034916200006d565b600a80546001600160a01b0319166001600160a01b0392909216919091179055620000d6565b80516200006781620000bc565b92915050565b6000602082840312156200008057600080fd5b60006200008e84846200005a565b949350505050565b60006200006782620000b0565b6000620000678262000096565b6001600160a01b031690565b620000c781620000a3565b8114620000d357600080fd5b50565b6129d880620000e66000396000f3fe608060405234801561001057600080fd5b50600436106101985760003560e01c8063691f3431116100e3578063bc1c58d11161008c578063e59d895d11610066578063e59d895d14610387578063f1cb7e061461039a578063f86bc879146103ad57610198565b8063bc1c58d114610340578063c869023314610353578063d5fa2b001461037457610198565b8063a8fa5682116100bd578063a8fa5682146102fa578063ac9650d81461030d578063ad5780af1461032d57610198565b8063691f3431146102c157806377372213146102d45780638b95dd71146102e757610198565b8063304e6ade116101455780634cbf6ba41161011f5780634cbf6ba41461027b57806359d1d43c1461028e578063623195b0146102ae57610198565b8063304e6ade146102425780633b3b57de146102555780633e9ce7941461026857610198565b8063124a319c11610176578063124a319c146101ee5780632203ab561461020e57806329cd62ea1461022f57610198565b806301ffc9a71461019d5780630af179d7146101c657806310f13a8c146101db575b600080fd5b6101b06101ab366004612504565b6103c0565b6040516101bd9190612730565b60405180910390f35b6101d96101d4366004612364565b61041e565b005b6101d96101e93660046123ba565b61060b565b6102016101fc366004612302565b6106b8565b6040516101bd9190612703565b61022161021c36600461224c565b6109f7565b6040516101bd9291906127f3565b6101d961023d36600461227c565b610b16565b6101d9610250366004612364565b610b96565b610201610263366004612164565b610bf5565b6101d9610276366004612209565b610c2a565b6101b061028936600461224c565b610ccf565b6102a161029c366004612364565b610d01565b6040516101bd9190612787565b6101d96102bc366004612441565b610dc3565b6102a16102cf366004612164565b610e3e565b6101d96102e2366004612364565b610edf565b6101d96102f53660046124a9565b610f3e565b6102a16103083660046122bf565b611003565b61032061031b366004612122565b611090565b6040516101bd919061271f565b6101d961033b366004612164565b6111d4565b6102a161034e366004612164565b611227565b610366610361366004612164565b61128f565b6040516101bd92919061274c565b6101d9610382366004612182565b6112a9565b6101d9610395366004612332565b6112d0565b6102a16103a836600461224c565b61139d565b6101b06103bb3660046121bc565b611446565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f59d1d43c00000000000000000000000000000000000000000000000000000000148061041657506104168261146c565b90505b919050565b82610428816114c2565b61043157600080fd5b60008060608082610440611e30565b61048a60008a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505063ffffffff6115d1169050565b90505b610496816115ec565b6105ae5761ffff86166104ee57806040015195506104b3816115fa565b9350836040516020016104c691906126ec565b6040516020818303038152906040528051906020012091506104e781611621565b92506105a0565b60606104f9826115fa565b9050816040015161ffff168761ffff161415806105235750610521858263ffffffff61164216565b155b1561059e576105778b86898d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505050602087015189518c918290039015611660565b81604001519650816020015195508094508480519060200120925061059b82611621565b93505b505b6105a9816118c7565b61048d565b50825115610600576106008984878b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505088518b9250828f03915015611660565b505050505050505050565b84610615816114c2565b61061e57600080fd5b82826009600089815260200190815260200160002087876040516106439291906126df565b90815260405190819003602001902061065d929091611e7b565b50848460405161066e9291906126df565b6040518091039020867fd8c9334b1a9c2f9da342a0a2b32629c1a229b6445dad78947f674b44444a755087876040516106a8929190612775565b60405180910390a3505050505050565b60008281526006602090815260408083207fffffffff000000000000000000000000000000000000000000000000000000008516845290915281205473ffffffffffffffffffffffffffffffffffffffff1680156107175790506109f1565b600061072285610bf5565b905073ffffffffffffffffffffffffffffffffffffffff811661074a576000925050506109f1565b600060608273ffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b60405160240161077d9190612767565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a700000000000000000000000000000000000000000000000000000000179052516107fe91906126ec565b600060405180830381855afa9150503d8060008114610839576040519150601f19603f3d011682016040523d82523d6000602084013e61083e565b606091505b5091509150811580610851575060208151105b8061088d575080601f8151811061086457fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b1561089f5760009450505050506109f1565b8273ffffffffffffffffffffffffffffffffffffffff16866040516024016108c79190612767565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001790525161094891906126ec565b600060405180830381855afa9150503d8060008114610983576040519150601f19603f3d011682016040523d82523d6000602084013e610988565b606091505b50909250905081158061099c575060208151105b806109d8575080601f815181106109af57fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109ea5760009450505050506109f1565b5090925050505b92915050565b600082815260208190526040812060609060015b848111610af85780851615801590610a4357506000818152602083905260409020546002600019610100600184161502019091160415155b15610af0576000818152602083815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845284939192839190830182828015610ade5780601f10610ab357610100808354040283529160200191610ade565b820191906000526020600020905b815481529060010190602001808311610ac157829003601f168201915b50505050509050935093505050610b0f565b60011b610a0b565b505060408051602081019091526000808252925090505b9250929050565b82610b20816114c2565b610b2957600080fd5b6040805180820182528481526020808201858152600088815260089092529083902091518255516001909101555184907f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4690610b88908690869061274c565b60405180910390a250505050565b82610ba0816114c2565b610ba957600080fd5b6000848152600260205260409020610bc2908484611e7b565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610b88929190612775565b60006060610c0483603c61139d565b9050805160001415610c1a576000915050610419565b610c238161199a565b9392505050565b6000838152600b602090815260408083203380855290835281842073ffffffffffffffffffffffffffffffffffffffff871680865293529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515151790555190919085907fe1c5610a6e0cbe10764ecd182adcef1ec338dc4e199c99c32ce98f38e12791df90610cc2908690612730565b60405180910390a4505050565b600091825260056020908152604080842060038352818520548552825280842092845291905290205461ffff16151590565b6060600960008581526020019081526020016000208383604051610d269291906126df565b9081526040805160209281900383018120805460026001821615610100026000190190911604601f81018590048502830185019093528282529092909190830182828015610db55780601f10610d8a57610100808354040283529160200191610db5565b820191906000526020600020905b815481529060010190602001808311610d9857829003601f168201915b505050505090509392505050565b83610dcd816114c2565b610dd657600080fd5b6000198401841615610de757600080fd5b6000858152602081815260408083208784529091529020610e09908484611e7b565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b60008181526007602090815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610ed35780601f10610ea857610100808354040283529160200191610ed3565b820191906000526020600020905b815481529060010190602001808311610eb657829003601f168201915b50505050509050919050565b82610ee9816114c2565b610ef257600080fd5b6000848152600760205260409020610f0b908484611e7b565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610b88929190612775565b82610f48816114c2565b610f5157600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af7528484604051610f839291906127f3565b60405180910390a2603c831415610fd557837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd2610fbf8461199a565b604051610fcc9190612711565b60405180910390a25b600084815260016020908152604080832086845282529091208351610ffc92850190611f17565b5050505050565b6000838152600460209081526040808320600383528184205484528252808320858452825280832061ffff8516845282529182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610db55780601f10610d8a57610100808354040283529160200191610db5565b6040805182815260208084028201019091526060908280156110c657816020015b60608152602001906001900390816110b15790505b50905060005b828110156111cd5760006060308686858181106110e557fe5b6020028201905080357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe13684900301811261111f57600080fd5b9091016020810191503567ffffffffffffffff81111561113e57600080fd5b3681900382131561114e57600080fd5b60405161115c9291906126df565b600060405180830381855af49150503d8060008114611197576040519150601f19603f3d011682016040523d82523d6000602084013e61119c565b606091505b5091509150816111ab57600080fd5b808484815181106111b857fe5b602090810291909101015250506001016110cc565b5092915050565b806111de816114c2565b6111e757600080fd5b600082815260036020526040808220805460010190555183917fb757169b8492ca2f1c6619d9d76ce22803035c3b1d5f6930dffe7b127c1a198391a25050565b600081815260026020818152604092839020805484516001821615610100026000190190911693909304601f81018390048302840183019094528383526060939091830182828015610ed35780601f10610ea857610100808354040283529160200191610ed3565b600090815260086020526040902080546001909101549091565b816112b3816114c2565b6112bc57600080fd5b6112cb83603c6102f5856119c2565b505050565b826112da816114c2565b6112e357600080fd5b60008481526006602090815260408083207fffffffff00000000000000000000000000000000000000000000000000000000871680855292529182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616179055905185907f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa9061138f908690612703565b60405180910390a350505050565b600082815260016020818152604080842085855282529283902080548451600294821615610100026000190190911693909304601f810183900483028401830190945283835260609390918301828280156114395780601f1061140e57610100808354040283529160200191611439565b820191906000526020600020905b81548152906001019060200180831161141c57829003601f168201915b5050505050905092915050565b600b60209081526000938452604080852082529284528284209052825290205460ff1681565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fc86902330000000000000000000000000000000000000000000000000000000014806104165750610416826119fb565b600a546040517f02571be3000000000000000000000000000000000000000000000000000000008152600091829173ffffffffffffffffffffffffffffffffffffffff909116906302571be39061151d90869060040161273e565b60206040518083038186803b15801561153557600080fd5b505afa158015611549573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061156d91908101906120fc565b905073ffffffffffffffffffffffffffffffffffffffff8116331480610c2357506000838152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452825280832033845290915290205460ff16915050919050565b6115d9611e30565b82815260c081018290526109f1816118c7565b805151602090910151101590565b60208101518151606091610416916116129082611a51565b8451919063ffffffff611a9816565b60a081015160c082015182516060926104169281900363ffffffff611a9816565b600081518351148015610c235750610c238360008460008751611afa565b600087815260036020908152604090912054875191880191909120606061168e87878763ffffffff611a9816565b905083156117a85760008a81526004602090815260408083208684528252808320858452825280832061ffff8c16845290915290205460026000196101006001841615020190911604156117335760008a81526005602090815260408083208684528252808320858452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000811661ffff918216600019019091161790555b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c168452909152812061176991611f85565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a60405161179b929190612798565b60405180910390a26118bb565b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c168452909152902054600260001961010060018416150201909116046118425760008a815260056020908152604080832086845282528083208584529091529020805461ffff808216600101167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00009091161790555b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c1684528252909120825161187d92840190611f17565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a846040516118b2939291906127b8565b60405180910390a25b50505050505050505050565b60c081015160208201819052815151116118e057611997565b60006118f482600001518360200151611a51565b602083015183519101915061190f908263ffffffff611b1d16565b61ffff166040830152815160029190910190611931908263ffffffff611b1d16565b61ffff166060830152815160029190910190611953908263ffffffff611b3d16565b63ffffffff908116608084015282516004929092019160009161197991908490611b1d16565b600283810160a086015261ffff9190911690920190910160c0830152505b50565b600081516014146119aa57600080fd5b50602001516c01000000000000000000000000900490565b6040805160148082528183019092526060916020820181803883395050506c010000000000000000000000009290920260208301525090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f691f3431000000000000000000000000000000000000000000000000000000001480610416575061041682611b5f565b6000815b83518110611a5f57fe5b6000611a71858363ffffffff611bc416565b60ff1691820160010191905080611a885750611a8e565b50611a55565b9190910392915050565b606083518284011115611aaa57600080fd5b6060826040519080825280601f01601f191660200182016040528015611ad7576020820181803883390190505b50905060208082019086860101611aef828287611be2565b509095945050505050565b6000611b07848484611c3e565b611b12878785611c3e565b149695505050505050565b60008251826002011115611b3057600080fd5b50016002015161ffff1690565b60008251826004011115611b5057600080fd5b50016004015163ffffffff1690565b6000604051611b6d906126f8565b60405180910390207bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610416575061041682611c5a565b6000828281518110611bd257fe5b016020015160f81c905092915050565b5b60208110611c205781518352602092830192909101907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001611be3565b905182516020929092036101000a6000190180199091169116179052565b600083518284011115611c5057600080fd5b5091016020012090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fa8fa568200000000000000000000000000000000000000000000000000000000148061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167fbc1c58d100000000000000000000000000000000000000000000000000000000148061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167f3b3b57de000000000000000000000000000000000000000000000000000000001480611d8f57507fffffffff0000000000000000000000000000000000000000000000000000000082167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167f2203ab5600000000000000000000000000000000000000000000000000000000148061041657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610416565b6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611eda578280017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00823516178555611f07565b82800160010185558215611f07579182015b82811115611f07578235825591602001919060010190611eec565b50611f13929150611fc5565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611f5857805160ff1916838001178555611f07565b82800160010185558215611f07579182015b82811115611f07578251825591602001919060010190611f6a565b50805460018160011615610100020316600290046000825580601f10611fab5750611997565b601f01602090049060005260206000209081019061199791905b611fdf91905b80821115611f135760008155600101611fcb565b90565b80356109f18161295d565b80516109f18161295d565b60008083601f84011261200a57600080fd5b50813567ffffffffffffffff81111561202257600080fd5b602083019150836020820283011115610b0f57600080fd5b80356109f181612971565b80356109f18161297a565b80356109f181612983565b60008083601f84011261206d57600080fd5b50813567ffffffffffffffff81111561208557600080fd5b602083019150836001820283011115610b0f57600080fd5b600082601f8301126120ae57600080fd5b81356120c16120bc8261283a565b612813565b915080825260208301602083018583830111156120dd57600080fd5b6120e88382846128f9565b50505092915050565b80356109f18161298c565b60006020828403121561210e57600080fd5b600061211a8484611fed565b949350505050565b6000806020838503121561213557600080fd5b823567ffffffffffffffff81111561214c57600080fd5b61215885828601611ff8565b92509250509250929050565b60006020828403121561217657600080fd5b600061211a8484612045565b6000806040838503121561219557600080fd5b60006121a18585612045565b92505060206121b285828601611fe2565b9150509250929050565b6000806000606084860312156121d157600080fd5b60006121dd8686612045565b93505060206121ee86828701611fe2565b92505060406121ff86828701611fe2565b9150509250925092565b60008060006060848603121561221e57600080fd5b600061222a8686612045565b935050602061223b86828701611fe2565b92505060406121ff8682870161203a565b6000806040838503121561225f57600080fd5b600061226b8585612045565b92505060206121b285828601612045565b60008060006060848603121561229157600080fd5b600061229d8686612045565b93505060206122ae86828701612045565b92505060406121ff86828701612045565b6000806000606084860312156122d457600080fd5b60006122e08686612045565b93505060206122f186828701612045565b92505060406121ff868287016120f1565b6000806040838503121561231557600080fd5b60006123218585612045565b92505060206121b285828601612050565b60008060006060848603121561234757600080fd5b60006123538686612045565b93505060206121ee86828701612050565b60008060006040848603121561237957600080fd5b60006123858686612045565b935050602084013567ffffffffffffffff8111156123a257600080fd5b6123ae8682870161205b565b92509250509250925092565b6000806000806000606086880312156123d257600080fd5b60006123de8888612045565b955050602086013567ffffffffffffffff8111156123fb57600080fd5b6124078882890161205b565b9450945050604086013567ffffffffffffffff81111561242657600080fd5b6124328882890161205b565b92509250509295509295909350565b6000806000806060858703121561245757600080fd5b60006124638787612045565b945050602061247487828801612045565b935050604085013567ffffffffffffffff81111561249157600080fd5b61249d8782880161205b565b95989497509550505050565b6000806000606084860312156124be57600080fd5b60006124ca8686612045565b93505060206124db86828701612045565b925050604084013567ffffffffffffffff8111156124f857600080fd5b6121ff8682870161209d565b60006020828403121561251657600080fd5b600061211a8484612050565b6000610c23838361261a565b612537816128e8565b82525050565b61253781612893565b600061255182612886565b61255b818561288a565b93508360208202850161256d85612880565b8060005b858110156125a7578484038952815161258a8582612522565b945061259583612880565b60209a909a0199925050600101612571565b5091979650505050505050565b6125378161289e565b61253781611fdf565b612537816128a3565b60006125db838561288a565b93506125e88385846128f9565b6125f183612935565b9093019392505050565b60006126078385610419565b93506126148385846128f9565b50500190565b600061262582612886565b61262f818561288a565b935061263f818560208601612905565b6125f181612935565b600061265382612886565b61265d8185610419565b935061266d818560208601612905565b9290920192915050565b6000612684602483610419565b7f696e74657266616365496d706c656d656e74657228627974657333322c62797481527f6573342900000000000000000000000000000000000000000000000000000000602082015260240192915050565b612537816128c8565b600061211a8284866125fb565b6000610c238284612648565b60006109f182612677565b602081016109f1828461253d565b602081016109f1828461252e565b60208082528101610c238184612546565b602081016109f182846125b4565b602081016109f182846125bd565b6040810161275a82856125bd565b610c2360208301846125bd565b602081016109f182846125c6565b6020808252810161211a8184866125cf565b60208082528101610c23818461261a565b604080825281016127a9818561261a565b9050610c2360208301846126d6565b606080825281016127c9818661261a565b90506127d860208301856126d6565b81810360408301526127ea818461261a565b95945050505050565b6040810161280182856125bd565b818103602083015261211a818461261a565b60405181810167ffffffffffffffff8111828210171561283257600080fd5b604052919050565b600067ffffffffffffffff82111561285157600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b90815260200190565b6000610416826128cf565b151590565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b61ffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b600061041682600061041682612893565b82818337506000910152565b60005b83811015612920578181015183820152602001612908565b8381111561292f576000848401525b50505050565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b61296681612893565b811461199757600080fd5b6129668161289e565b61296681611fdf565b612966816128a3565b612966816128c856fea365627a7a7231582082927c55ed80cd2c2b4af3ecca0340c755f0257fadbdd76a4c4b6458f1c8eefc6c6578706572696d656e74616cf564736f6c63430005110040", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101985760003560e01c8063691f3431116100e3578063bc1c58d11161008c578063e59d895d11610066578063e59d895d14610387578063f1cb7e061461039a578063f86bc879146103ad57610198565b8063bc1c58d114610340578063c869023314610353578063d5fa2b001461037457610198565b8063a8fa5682116100bd578063a8fa5682146102fa578063ac9650d81461030d578063ad5780af1461032d57610198565b8063691f3431146102c157806377372213146102d45780638b95dd71146102e757610198565b8063304e6ade116101455780634cbf6ba41161011f5780634cbf6ba41461027b57806359d1d43c1461028e578063623195b0146102ae57610198565b8063304e6ade146102425780633b3b57de146102555780633e9ce7941461026857610198565b8063124a319c11610176578063124a319c146101ee5780632203ab561461020e57806329cd62ea1461022f57610198565b806301ffc9a71461019d5780630af179d7146101c657806310f13a8c146101db575b600080fd5b6101b06101ab366004612504565b6103c0565b6040516101bd9190612730565b60405180910390f35b6101d96101d4366004612364565b61041e565b005b6101d96101e93660046123ba565b61060b565b6102016101fc366004612302565b6106b8565b6040516101bd9190612703565b61022161021c36600461224c565b6109f7565b6040516101bd9291906127f3565b6101d961023d36600461227c565b610b16565b6101d9610250366004612364565b610b96565b610201610263366004612164565b610bf5565b6101d9610276366004612209565b610c2a565b6101b061028936600461224c565b610ccf565b6102a161029c366004612364565b610d01565b6040516101bd9190612787565b6101d96102bc366004612441565b610dc3565b6102a16102cf366004612164565b610e3e565b6101d96102e2366004612364565b610edf565b6101d96102f53660046124a9565b610f3e565b6102a16103083660046122bf565b611003565b61032061031b366004612122565b611090565b6040516101bd919061271f565b6101d961033b366004612164565b6111d4565b6102a161034e366004612164565b611227565b610366610361366004612164565b61128f565b6040516101bd92919061274c565b6101d9610382366004612182565b6112a9565b6101d9610395366004612332565b6112d0565b6102a16103a836600461224c565b61139d565b6101b06103bb3660046121bc565b611446565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f59d1d43c00000000000000000000000000000000000000000000000000000000148061041657506104168261146c565b90505b919050565b82610428816114c2565b61043157600080fd5b60008060608082610440611e30565b61048a60008a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505063ffffffff6115d1169050565b90505b610496816115ec565b6105ae5761ffff86166104ee57806040015195506104b3816115fa565b9350836040516020016104c691906126ec565b6040516020818303038152906040528051906020012091506104e781611621565b92506105a0565b60606104f9826115fa565b9050816040015161ffff168761ffff161415806105235750610521858263ffffffff61164216565b155b1561059e576105778b86898d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505050602087015189518c918290039015611660565b81604001519650816020015195508094508480519060200120925061059b82611621565b93505b505b6105a9816118c7565b61048d565b50825115610600576106008984878b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505088518b9250828f03915015611660565b505050505050505050565b84610615816114c2565b61061e57600080fd5b82826009600089815260200190815260200160002087876040516106439291906126df565b90815260405190819003602001902061065d929091611e7b565b50848460405161066e9291906126df565b6040518091039020867fd8c9334b1a9c2f9da342a0a2b32629c1a229b6445dad78947f674b44444a755087876040516106a8929190612775565b60405180910390a3505050505050565b60008281526006602090815260408083207fffffffff000000000000000000000000000000000000000000000000000000008516845290915281205473ffffffffffffffffffffffffffffffffffffffff1680156107175790506109f1565b600061072285610bf5565b905073ffffffffffffffffffffffffffffffffffffffff811661074a576000925050506109f1565b600060608273ffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b60405160240161077d9190612767565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a700000000000000000000000000000000000000000000000000000000179052516107fe91906126ec565b600060405180830381855afa9150503d8060008114610839576040519150601f19603f3d011682016040523d82523d6000602084013e61083e565b606091505b5091509150811580610851575060208151105b8061088d575080601f8151811061086457fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b1561089f5760009450505050506109f1565b8273ffffffffffffffffffffffffffffffffffffffff16866040516024016108c79190612767565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001790525161094891906126ec565b600060405180830381855afa9150503d8060008114610983576040519150601f19603f3d011682016040523d82523d6000602084013e610988565b606091505b50909250905081158061099c575060208151105b806109d8575080601f815181106109af57fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109ea5760009450505050506109f1565b5090925050505b92915050565b600082815260208190526040812060609060015b848111610af85780851615801590610a4357506000818152602083905260409020546002600019610100600184161502019091160415155b15610af0576000818152602083815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845284939192839190830182828015610ade5780601f10610ab357610100808354040283529160200191610ade565b820191906000526020600020905b815481529060010190602001808311610ac157829003601f168201915b50505050509050935093505050610b0f565b60011b610a0b565b505060408051602081019091526000808252925090505b9250929050565b82610b20816114c2565b610b2957600080fd5b6040805180820182528481526020808201858152600088815260089092529083902091518255516001909101555184907f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4690610b88908690869061274c565b60405180910390a250505050565b82610ba0816114c2565b610ba957600080fd5b6000848152600260205260409020610bc2908484611e7b565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610b88929190612775565b60006060610c0483603c61139d565b9050805160001415610c1a576000915050610419565b610c238161199a565b9392505050565b6000838152600b602090815260408083203380855290835281842073ffffffffffffffffffffffffffffffffffffffff871680865293529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515151790555190919085907fe1c5610a6e0cbe10764ecd182adcef1ec338dc4e199c99c32ce98f38e12791df90610cc2908690612730565b60405180910390a4505050565b600091825260056020908152604080842060038352818520548552825280842092845291905290205461ffff16151590565b6060600960008581526020019081526020016000208383604051610d269291906126df565b9081526040805160209281900383018120805460026001821615610100026000190190911604601f81018590048502830185019093528282529092909190830182828015610db55780601f10610d8a57610100808354040283529160200191610db5565b820191906000526020600020905b815481529060010190602001808311610d9857829003601f168201915b505050505090509392505050565b83610dcd816114c2565b610dd657600080fd5b6000198401841615610de757600080fd5b6000858152602081815260408083208784529091529020610e09908484611e7b565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b60008181526007602090815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610ed35780601f10610ea857610100808354040283529160200191610ed3565b820191906000526020600020905b815481529060010190602001808311610eb657829003601f168201915b50505050509050919050565b82610ee9816114c2565b610ef257600080fd5b6000848152600760205260409020610f0b908484611e7b565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610b88929190612775565b82610f48816114c2565b610f5157600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af7528484604051610f839291906127f3565b60405180910390a2603c831415610fd557837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd2610fbf8461199a565b604051610fcc9190612711565b60405180910390a25b600084815260016020908152604080832086845282529091208351610ffc92850190611f17565b5050505050565b6000838152600460209081526040808320600383528184205484528252808320858452825280832061ffff8516845282529182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610db55780601f10610d8a57610100808354040283529160200191610db5565b6040805182815260208084028201019091526060908280156110c657816020015b60608152602001906001900390816110b15790505b50905060005b828110156111cd5760006060308686858181106110e557fe5b6020028201905080357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe13684900301811261111f57600080fd5b9091016020810191503567ffffffffffffffff81111561113e57600080fd5b3681900382131561114e57600080fd5b60405161115c9291906126df565b600060405180830381855af49150503d8060008114611197576040519150601f19603f3d011682016040523d82523d6000602084013e61119c565b606091505b5091509150816111ab57600080fd5b808484815181106111b857fe5b602090810291909101015250506001016110cc565b5092915050565b806111de816114c2565b6111e757600080fd5b600082815260036020526040808220805460010190555183917fb757169b8492ca2f1c6619d9d76ce22803035c3b1d5f6930dffe7b127c1a198391a25050565b600081815260026020818152604092839020805484516001821615610100026000190190911693909304601f81018390048302840183019094528383526060939091830182828015610ed35780601f10610ea857610100808354040283529160200191610ed3565b600090815260086020526040902080546001909101549091565b816112b3816114c2565b6112bc57600080fd5b6112cb83603c6102f5856119c2565b505050565b826112da816114c2565b6112e357600080fd5b60008481526006602090815260408083207fffffffff00000000000000000000000000000000000000000000000000000000871680855292529182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616179055905185907f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa9061138f908690612703565b60405180910390a350505050565b600082815260016020818152604080842085855282529283902080548451600294821615610100026000190190911693909304601f810183900483028401830190945283835260609390918301828280156114395780601f1061140e57610100808354040283529160200191611439565b820191906000526020600020905b81548152906001019060200180831161141c57829003601f168201915b5050505050905092915050565b600b60209081526000938452604080852082529284528284209052825290205460ff1681565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fc86902330000000000000000000000000000000000000000000000000000000014806104165750610416826119fb565b600a546040517f02571be3000000000000000000000000000000000000000000000000000000008152600091829173ffffffffffffffffffffffffffffffffffffffff909116906302571be39061151d90869060040161273e565b60206040518083038186803b15801561153557600080fd5b505afa158015611549573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061156d91908101906120fc565b905073ffffffffffffffffffffffffffffffffffffffff8116331480610c2357506000838152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452825280832033845290915290205460ff16915050919050565b6115d9611e30565b82815260c081018290526109f1816118c7565b805151602090910151101590565b60208101518151606091610416916116129082611a51565b8451919063ffffffff611a9816565b60a081015160c082015182516060926104169281900363ffffffff611a9816565b600081518351148015610c235750610c238360008460008751611afa565b600087815260036020908152604090912054875191880191909120606061168e87878763ffffffff611a9816565b905083156117a85760008a81526004602090815260408083208684528252808320858452825280832061ffff8c16845290915290205460026000196101006001841615020190911604156117335760008a81526005602090815260408083208684528252808320858452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000811661ffff918216600019019091161790555b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c168452909152812061176991611f85565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a60405161179b929190612798565b60405180910390a26118bb565b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c168452909152902054600260001961010060018416150201909116046118425760008a815260056020908152604080832086845282528083208584529091529020805461ffff808216600101167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00009091161790555b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c1684528252909120825161187d92840190611f17565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a846040516118b2939291906127b8565b60405180910390a25b50505050505050505050565b60c081015160208201819052815151116118e057611997565b60006118f482600001518360200151611a51565b602083015183519101915061190f908263ffffffff611b1d16565b61ffff166040830152815160029190910190611931908263ffffffff611b1d16565b61ffff166060830152815160029190910190611953908263ffffffff611b3d16565b63ffffffff908116608084015282516004929092019160009161197991908490611b1d16565b600283810160a086015261ffff9190911690920190910160c0830152505b50565b600081516014146119aa57600080fd5b50602001516c01000000000000000000000000900490565b6040805160148082528183019092526060916020820181803883395050506c010000000000000000000000009290920260208301525090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f691f3431000000000000000000000000000000000000000000000000000000001480610416575061041682611b5f565b6000815b83518110611a5f57fe5b6000611a71858363ffffffff611bc416565b60ff1691820160010191905080611a885750611a8e565b50611a55565b9190910392915050565b606083518284011115611aaa57600080fd5b6060826040519080825280601f01601f191660200182016040528015611ad7576020820181803883390190505b50905060208082019086860101611aef828287611be2565b509095945050505050565b6000611b07848484611c3e565b611b12878785611c3e565b149695505050505050565b60008251826002011115611b3057600080fd5b50016002015161ffff1690565b60008251826004011115611b5057600080fd5b50016004015163ffffffff1690565b6000604051611b6d906126f8565b60405180910390207bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610416575061041682611c5a565b6000828281518110611bd257fe5b016020015160f81c905092915050565b5b60208110611c205781518352602092830192909101907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001611be3565b905182516020929092036101000a6000190180199091169116179052565b600083518284011115611c5057600080fd5b5091016020012090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fa8fa568200000000000000000000000000000000000000000000000000000000148061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167fbc1c58d100000000000000000000000000000000000000000000000000000000148061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167f3b3b57de000000000000000000000000000000000000000000000000000000001480611d8f57507fffffffff0000000000000000000000000000000000000000000000000000000082167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167f2203ab5600000000000000000000000000000000000000000000000000000000148061041657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610416565b6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611eda578280017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00823516178555611f07565b82800160010185558215611f07579182015b82811115611f07578235825591602001919060010190611eec565b50611f13929150611fc5565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611f5857805160ff1916838001178555611f07565b82800160010185558215611f07579182015b82811115611f07578251825591602001919060010190611f6a565b50805460018160011615610100020316600290046000825580601f10611fab5750611997565b601f01602090049060005260206000209081019061199791905b611fdf91905b80821115611f135760008155600101611fcb565b90565b80356109f18161295d565b80516109f18161295d565b60008083601f84011261200a57600080fd5b50813567ffffffffffffffff81111561202257600080fd5b602083019150836020820283011115610b0f57600080fd5b80356109f181612971565b80356109f18161297a565b80356109f181612983565b60008083601f84011261206d57600080fd5b50813567ffffffffffffffff81111561208557600080fd5b602083019150836001820283011115610b0f57600080fd5b600082601f8301126120ae57600080fd5b81356120c16120bc8261283a565b612813565b915080825260208301602083018583830111156120dd57600080fd5b6120e88382846128f9565b50505092915050565b80356109f18161298c565b60006020828403121561210e57600080fd5b600061211a8484611fed565b949350505050565b6000806020838503121561213557600080fd5b823567ffffffffffffffff81111561214c57600080fd5b61215885828601611ff8565b92509250509250929050565b60006020828403121561217657600080fd5b600061211a8484612045565b6000806040838503121561219557600080fd5b60006121a18585612045565b92505060206121b285828601611fe2565b9150509250929050565b6000806000606084860312156121d157600080fd5b60006121dd8686612045565b93505060206121ee86828701611fe2565b92505060406121ff86828701611fe2565b9150509250925092565b60008060006060848603121561221e57600080fd5b600061222a8686612045565b935050602061223b86828701611fe2565b92505060406121ff8682870161203a565b6000806040838503121561225f57600080fd5b600061226b8585612045565b92505060206121b285828601612045565b60008060006060848603121561229157600080fd5b600061229d8686612045565b93505060206122ae86828701612045565b92505060406121ff86828701612045565b6000806000606084860312156122d457600080fd5b60006122e08686612045565b93505060206122f186828701612045565b92505060406121ff868287016120f1565b6000806040838503121561231557600080fd5b60006123218585612045565b92505060206121b285828601612050565b60008060006060848603121561234757600080fd5b60006123538686612045565b93505060206121ee86828701612050565b60008060006040848603121561237957600080fd5b60006123858686612045565b935050602084013567ffffffffffffffff8111156123a257600080fd5b6123ae8682870161205b565b92509250509250925092565b6000806000806000606086880312156123d257600080fd5b60006123de8888612045565b955050602086013567ffffffffffffffff8111156123fb57600080fd5b6124078882890161205b565b9450945050604086013567ffffffffffffffff81111561242657600080fd5b6124328882890161205b565b92509250509295509295909350565b6000806000806060858703121561245757600080fd5b60006124638787612045565b945050602061247487828801612045565b935050604085013567ffffffffffffffff81111561249157600080fd5b61249d8782880161205b565b95989497509550505050565b6000806000606084860312156124be57600080fd5b60006124ca8686612045565b93505060206124db86828701612045565b925050604084013567ffffffffffffffff8111156124f857600080fd5b6121ff8682870161209d565b60006020828403121561251657600080fd5b600061211a8484612050565b6000610c23838361261a565b612537816128e8565b82525050565b61253781612893565b600061255182612886565b61255b818561288a565b93508360208202850161256d85612880565b8060005b858110156125a7578484038952815161258a8582612522565b945061259583612880565b60209a909a0199925050600101612571565b5091979650505050505050565b6125378161289e565b61253781611fdf565b612537816128a3565b60006125db838561288a565b93506125e88385846128f9565b6125f183612935565b9093019392505050565b60006126078385610419565b93506126148385846128f9565b50500190565b600061262582612886565b61262f818561288a565b935061263f818560208601612905565b6125f181612935565b600061265382612886565b61265d8185610419565b935061266d818560208601612905565b9290920192915050565b6000612684602483610419565b7f696e74657266616365496d706c656d656e74657228627974657333322c62797481527f6573342900000000000000000000000000000000000000000000000000000000602082015260240192915050565b612537816128c8565b600061211a8284866125fb565b6000610c238284612648565b60006109f182612677565b602081016109f1828461253d565b602081016109f1828461252e565b60208082528101610c238184612546565b602081016109f182846125b4565b602081016109f182846125bd565b6040810161275a82856125bd565b610c2360208301846125bd565b602081016109f182846125c6565b6020808252810161211a8184866125cf565b60208082528101610c23818461261a565b604080825281016127a9818561261a565b9050610c2360208301846126d6565b606080825281016127c9818661261a565b90506127d860208301856126d6565b81810360408301526127ea818461261a565b95945050505050565b6040810161280182856125bd565b818103602083015261211a818461261a565b60405181810167ffffffffffffffff8111828210171561283257600080fd5b604052919050565b600067ffffffffffffffff82111561285157600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b90815260200190565b6000610416826128cf565b151590565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b61ffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b600061041682600061041682612893565b82818337506000910152565b60005b83811015612920578181015183820152602001612908565b8381111561292f576000848401525b50505050565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b61296681612893565b811461199757600080fd5b6129668161289e565b61296681611fdf565b612966816128a3565b612966816128c856fea365627a7a7231582082927c55ed80cd2c2b4af3ecca0340c755f0257fadbdd76a4c4b6458f1c8eefc6c6578706572696d656e74616cf564736f6c63430005110040" +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/NameWrapper.json b/solidity/dns-contracts/deployments/holesky/NameWrapper.json new file mode 100644 index 0000000..d23c260 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/NameWrapper.json @@ -0,0 +1,2026 @@ +{ + "address": "0xab50971078225D365994dc1Edcb9b7FD72Bb4862", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract IBaseRegistrar", + "name": "_registrar", + "type": "address" + }, + { + "internalType": "contract IMetadataService", + "name": "_metadataService", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "CannotUpgrade", + "type": "error" + }, + { + "inputs": [], + "name": "IncompatibleParent", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "IncorrectTargetOwner", + "type": "error" + }, + { + "inputs": [], + "name": "IncorrectTokenType", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "labelHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "expectedLabelhash", + "type": "bytes32" + } + ], + "name": "LabelMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + } + ], + "name": "LabelTooLong", + "type": "error" + }, + { + "inputs": [], + "name": "LabelTooShort", + "type": "error" + }, + { + "inputs": [], + "name": "NameIsNotWrapped", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "OperationProhibited", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "Unauthorised", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "ControllerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "ExpiryExtended", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + } + ], + "name": "FusesSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NameUnwrapped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "NameWrapped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + } + ], + "name": "TransferBatch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "TransferSingle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "value", + "type": "string" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "URI", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "_tokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint32", + "name": "fuseMask", + "type": "uint32" + } + ], + "name": "allFusesBurned", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "accounts", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + } + ], + "name": "balanceOfBatch", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "canExtendSubnames", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "canModifyName", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "extendExpiry", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "getData", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + } + ], + "name": "isWrapped", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "isWrapped", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "metadataService", + "outputs": [ + { + "internalType": "contract IMetadataService", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "names", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "recoverFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "name": "registerAndWrapETH2LD", + "outputs": [ + { + "internalType": "uint256", + "name": "registrarExpiry", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "registrar", + "outputs": [ + { + "internalType": "contract IBaseRegistrar", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [ + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeBatchTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setChildFuses", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "name": "setFuses", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IMetadataService", + "name": "_metadataService", + "type": "address" + } + ], + "name": "setMetadataService", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setSubnodeOwner", + "outputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract INameWrapperUpgrade", + "name": "_upgradeAddress", + "type": "address" + } + ], + "name": "setUpgradeContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "unwrap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "unwrapETH2LD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "upgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "upgradeContract", + "outputs": [ + { + "internalType": "contract INameWrapperUpgrade", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "uri", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "wrap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "wrapETH2LD", + "outputs": [ + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x3942e780969b7907a94592d03169d218591c46e524c57baebc3549b47e182f81", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0xab50971078225D365994dc1Edcb9b7FD72Bb4862", + "transactionIndex": 3, + "gasUsed": "5487372", + "logsBloom": "0x00000000000000000000000000000800000000000000200000800000000000000000000000000000000000480000000000000000000010000008008000000000000000000000000000000000008000004001000000000000000000008000000000000000020002000000000000000800004000000000000000000000000000400000010000000080000000000000080000000000000000200000000000000000000000000000040000000011000000000000000000000000008000240000000000000000000000000000000000005040000100000000000000000040000020000000000000000000000000000100000000000000001000000000000400000000", + "blockHash": "0xf3d1cf46280afcd46726d8455164e5bc10e92b1d8ac5b47f1de53e11fabe0894", + "transactionHash": "0x3942e780969b7907a94592d03169d218591c46e524c57baebc3549b47e182f81", + "logs": [ + { + "transactionIndex": 3, + "blockNumber": 815127, + "transactionHash": "0x3942e780969b7907a94592d03169d218591c46e524c57baebc3549b47e182f81", + "address": "0xab50971078225D365994dc1Edcb9b7FD72Bb4862", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0xf3d1cf46280afcd46726d8455164e5bc10e92b1d8ac5b47f1de53e11fabe0894" + }, + { + "transactionIndex": 3, + "blockNumber": 815127, + "transactionHash": "0x3942e780969b7907a94592d03169d218591c46e524c57baebc3549b47e182f81", + "address": "0x132AC0B116a73add4225029D1951A9A707Ef673f", + "topics": [ + "0x6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e92", + "0x000000000000000000000000ab50971078225d365994dc1edcb9b7fd72bb4862", + "0x31f8f81550006646785a89a48de2d7ca3f683e9fd8380a8f2c90f90267caad1b" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0xf3d1cf46280afcd46726d8455164e5bc10e92b1d8ac5b47f1de53e11fabe0894" + }, + { + "transactionIndex": 3, + "blockNumber": 815127, + "transactionHash": "0x3942e780969b7907a94592d03169d218591c46e524c57baebc3549b47e182f81", + "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "topics": [ + "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", + "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2", + "0x51487304868e2cbb16c0111b610036e90e85a66a94ca308ce3d61707102c900e" + ], + "data": "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8", + "logIndex": 2, + "blockHash": "0xf3d1cf46280afcd46726d8455164e5bc10e92b1d8ac5b47f1de53e11fabe0894" + } + ], + "blockNumber": 815127, + "cumulativeGasUsed": "5550372", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85", + "0x14872c16523CAc7BFbFf19ACb88611CcC823FD68" + ], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"_registrar\",\"type\":\"address\"},{\"internalType\":\"contract IMetadataService\",\"name\":\"_metadataService\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CannotUpgrade\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncompatibleParent\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"IncorrectTargetOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncorrectTokenType\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"labelHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"expectedLabelhash\",\"type\":\"bytes32\"}],\"name\":\"LabelMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"}],\"name\":\"LabelTooLong\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LabelTooShort\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NameIsNotWrapped\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"OperationProhibited\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"Unauthorised\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"}],\"name\":\"ControllerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"ExpiryExtended\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"}],\"name\":\"FusesSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"NameUnwrapped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"NameWrapped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"name\":\"TransferBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"TransferSingle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"URI\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"_tokens\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"fuseMask\",\"type\":\"uint32\"}],\"name\":\"allFusesBurned\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"balanceOfBatch\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"canExtendSubnames\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"canModifyName\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"extendExpiry\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getData\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"}],\"name\":\"isWrapped\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"isWrapped\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"metadataService\",\"outputs\":[{\"internalType\":\"contract IMetadataService\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"names\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"onERC721Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"recoverFunds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"name\":\"registerAndWrapETH2LD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"registrarExpiry\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"registrar\",\"outputs\":[{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"renew\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeBatchTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setChildFuses\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"name\":\"setFuses\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IMetadataService\",\"name\":\"_metadataService\",\"type\":\"address\"}],\"name\":\"setMetadataService\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"}],\"name\":\"setRecord\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setSubnodeOwner\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setSubnodeRecord\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"}],\"name\":\"setTTL\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract INameWrapperUpgrade\",\"name\":\"_upgradeAddress\",\"type\":\"address\"}],\"name\":\"setUpgradeContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"unwrap\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"registrant\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"unwrapETH2LD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"upgrade\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"upgradeContract\",\"outputs\":[{\"internalType\":\"contract INameWrapperUpgrade\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"wrap\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"wrapETH2LD\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"allFusesBurned(bytes32,uint32)\":{\"params\":{\"fuseMask\":\"The fuses you want to check\",\"node\":\"Namehash of the name\"},\"returns\":{\"_0\":\"Boolean of whether or not all the selected fuses are burned\"}},\"approve(address,uint256)\":{\"params\":{\"to\":\"address to approve\",\"tokenId\":\"name to approve\"}},\"balanceOf(address,uint256)\":{\"details\":\"See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address.\"},\"balanceOfBatch(address[],uint256[])\":{\"details\":\"See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length.\"},\"canExtendSubnames(bytes32,address)\":{\"params\":{\"addr\":\"which address to check permissions for\",\"node\":\"namehash of the name to check\"},\"returns\":{\"_0\":\"whether or not is owner/operator or approved\"}},\"canModifyName(bytes32,address)\":{\"params\":{\"addr\":\"which address to check permissions for\",\"node\":\"namehash of the name to check\"},\"returns\":{\"_0\":\"whether or not is owner or operator\"}},\"extendExpiry(bytes32,bytes32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"labelhash\":\"Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\",\"parentNode\":\"Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\"},\"returns\":{\"_0\":\"New expiry\"}},\"getApproved(uint256)\":{\"params\":{\"id\":\"Namehash of the name\"},\"returns\":{\"operator\":\"Approved operator of a name\"}},\"getData(uint256)\":{\"params\":{\"id\":\"Namehash of the name\"},\"returns\":{\"expiry\":\"Expiry of the name\",\"fuses\":\"Fuses of the name\",\"owner\":\"Owner of the name\"}},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC1155-isApprovedForAll}.\"},\"isWrapped(bytes32)\":{\"params\":{\"node\":\"Namehash of the name\"},\"returns\":{\"_0\":\"Boolean of whether or not the name is wrapped\"}},\"isWrapped(bytes32,bytes32)\":{\"params\":{\"labelhash\":\"Namehash of the name\",\"parentNode\":\"Namehash of the name\"},\"returns\":{\"_0\":\"Boolean of whether or not the name is wrapped\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"ownerOf(uint256)\":{\"params\":{\"id\":\"Label as a string of the .eth domain to wrap\"},\"returns\":{\"owner\":\"The owner of the name\"}},\"recoverFunds(address,address,uint256)\":{\"details\":\"The contract is Ownable and only the owner can call the recover function.\",\"params\":{\"_amount\":\"The amount of tokens to recover.\",\"_to\":\"The address to send the tokens to.\",\"_token\":\"The address of the ERC20 token to recover\"}},\"registerAndWrapETH2LD(string,address,uint256,address,uint16)\":{\"details\":\"Registers a new .eth second-level domain and wraps it. Only callable by authorised controllers.\",\"params\":{\"duration\":\"The duration, in seconds, to register the name for.\",\"label\":\"The label to register (Eg, 'foo' for 'foo.eth').\",\"ownerControlledFuses\":\"Initial owner-controlled fuses to set\",\"resolver\":\"The resolver address to set on the ENS registry (optional).\",\"wrappedOwner\":\"The owner of the wrapped name.\"},\"returns\":{\"registrarExpiry\":\"The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\"}},\"renew(uint256,uint256)\":{\"details\":\"Only callable by authorised controllers.\",\"params\":{\"duration\":\"The number of seconds to renew the name for.\",\"tokenId\":\"The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\"},\"returns\":{\"expires\":\"The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)\":{\"details\":\"See {IERC1155-safeBatchTransferFrom}.\"},\"safeTransferFrom(address,address,uint256,uint256,bytes)\":{\"details\":\"See {IERC1155-safeTransferFrom}.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC1155-setApprovalForAll}.\"},\"setChildFuses(bytes32,bytes32,uint32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"fuses\":\"Fuses to burn\",\"labelhash\":\"Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\",\"parentNode\":\"Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\"}},\"setFuses(bytes32,uint16)\":{\"params\":{\"node\":\"Namehash of the name\",\"ownerControlledFuses\":\"Owner-controlled fuses to burn\"},\"returns\":{\"_0\":\"Old fuses\"}},\"setMetadataService(address)\":{\"params\":{\"_metadataService\":\"The new metadata service\"}},\"setRecord(bytes32,address,address,uint64)\":{\"params\":{\"node\":\"Namehash of the name to set a record for\",\"owner\":\"New owner in the registry\",\"resolver\":\"Resolver contract\",\"ttl\":\"Time to live in the registry\"}},\"setResolver(bytes32,address)\":{\"params\":{\"node\":\"namehash of the name\",\"resolver\":\"the resolver contract\"}},\"setSubnodeOwner(bytes32,string,address,uint32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"fuses\":\"Initial fuses for the wrapped subdomain\",\"label\":\"Label of the subdomain as a string\",\"owner\":\"New owner in the wrapper\",\"parentNode\":\"Parent namehash of the subdomain\"},\"returns\":{\"node\":\"Namehash of the subdomain\"}},\"setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"fuses\":\"initial fuses for the wrapped subdomain\",\"label\":\"label of the subdomain as a string\",\"owner\":\"new owner in the wrapper\",\"parentNode\":\"parent namehash of the subdomain\",\"resolver\":\"resolver contract in the registry\",\"ttl\":\"ttl in the registry\"},\"returns\":{\"node\":\"Namehash of the subdomain\"}},\"setTTL(bytes32,uint64)\":{\"params\":{\"node\":\"Namehash of the name\",\"ttl\":\"TTL in the registry\"}},\"setUpgradeContract(address)\":{\"details\":\"The default value of upgradeContract is the 0 address. Use the 0 address at any time to make the contract not upgradable.\",\"params\":{\"_upgradeAddress\":\"address of an upgraded contract\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"unwrap(bytes32,bytes32,address)\":{\"details\":\"Can be called by the owner in the wrapper or an authorised caller in the wrapper\",\"params\":{\"controller\":\"Sets the owner in the registry to this address\",\"labelhash\":\"Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\",\"parentNode\":\"Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\"}},\"unwrapETH2LD(bytes32,address,address)\":{\"details\":\"Can be called by the owner in the wrapper or an authorised caller in the wrapper\",\"params\":{\"controller\":\"Sets the owner in the registry to this address\",\"labelhash\":\"Labelhash of the .eth domain\",\"registrant\":\"Sets the owner in the .eth registrar to this address\"}},\"upgrade(bytes,bytes)\":{\"details\":\"Can be called by the owner or an authorised caller\",\"params\":{\"extraData\":\"Extra data to pass to the upgrade contract\",\"name\":\"The name to upgrade, in DNS format\"}},\"uri(uint256)\":{\"params\":{\"tokenId\":\"The id of the token\"},\"returns\":{\"_0\":\"string uri of the metadata service\"}},\"wrap(bytes,address,address)\":{\"details\":\"Can be called by the owner in the registry or an authorised caller in the registry\",\"params\":{\"name\":\"The name to wrap, in DNS format\",\"resolver\":\"Resolver contract\",\"wrappedOwner\":\"Owner of the name in this contract\"}},\"wrapETH2LD(string,address,uint16,address)\":{\"details\":\"Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\",\"params\":{\"label\":\"Label as a string of the .eth domain to wrap\",\"ownerControlledFuses\":\"Initial owner-controlled fuses to set\",\"resolver\":\"Resolver contract address\",\"wrappedOwner\":\"Owner of the name in this contract\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"allFusesBurned(bytes32,uint32)\":{\"notice\":\"Checks all Fuses in the mask are burned for the node\"},\"approve(address,uint256)\":{\"notice\":\"Approves an address for a name\"},\"canExtendSubnames(bytes32,address)\":{\"notice\":\"Checks if owner/operator or approved by owner\"},\"canModifyName(bytes32,address)\":{\"notice\":\"Checks if owner or operator of the owner\"},\"extendExpiry(bytes32,bytes32,uint64)\":{\"notice\":\"Extends expiry for a name\"},\"getApproved(uint256)\":{\"notice\":\"Gets the owner of a name\"},\"getData(uint256)\":{\"notice\":\"Gets the data for a name\"},\"isWrapped(bytes32)\":{\"notice\":\"Checks if a name is wrapped\"},\"isWrapped(bytes32,bytes32)\":{\"notice\":\"Checks if a name is wrapped in a more gas efficient way\"},\"ownerOf(uint256)\":{\"notice\":\"Gets the owner of a name\"},\"recoverFunds(address,address,uint256)\":{\"notice\":\"Recover ERC20 tokens sent to the contract by mistake.\"},\"renew(uint256,uint256)\":{\"notice\":\"Renews a .eth second-level domain.\"},\"setChildFuses(bytes32,bytes32,uint32,uint64)\":{\"notice\":\"Sets fuses of a name that you own the parent of\"},\"setFuses(bytes32,uint16)\":{\"notice\":\"Sets fuses of a name\"},\"setMetadataService(address)\":{\"notice\":\"Set the metadata service. Only the owner can do this\"},\"setRecord(bytes32,address,address,uint64)\":{\"notice\":\"Sets records for the name in the ENS Registry\"},\"setResolver(bytes32,address)\":{\"notice\":\"Sets resolver contract in the registry\"},\"setSubnodeOwner(bytes32,string,address,uint32,uint64)\":{\"notice\":\"Sets the subdomain owner in the registry and then wraps the subdomain\"},\"setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)\":{\"notice\":\"Sets the subdomain owner in the registry with records and then wraps the subdomain\"},\"setTTL(bytes32,uint64)\":{\"notice\":\"Sets TTL in the registry\"},\"setUpgradeContract(address)\":{\"notice\":\"Set the address of the upgradeContract of the contract. only admin can do this\"},\"unwrap(bytes32,bytes32,address)\":{\"notice\":\"Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\"},\"unwrapETH2LD(bytes32,address,address)\":{\"notice\":\"Unwraps a .eth domain. e.g. vitalik.eth\"},\"upgrade(bytes,bytes)\":{\"notice\":\"Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\"},\"uri(uint256)\":{\"notice\":\"Get the metadata uri\"},\"wrap(bytes,address,address)\":{\"notice\":\"Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\"},\"wrapETH2LD(string,address,uint16,address)\":{\"notice\":\"Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/wrapper/NameWrapper.sol\":\"NameWrapper\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\ninterface IERC1155Receiver is IERC165 {\\n /**\\n * @dev Handles the receipt of a single ERC1155 token type. This function is\\n * called at the end of a `safeTransferFrom` after the balance has been updated.\\n *\\n * NOTE: To accept the transfer, this must return\\n * `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))`\\n * (i.e. 0xf23a6e61, or its own function selector).\\n *\\n * @param operator The address which initiated the transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param id The ID of the token being transferred\\n * @param value The amount of tokens being transferred\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155Received(\\n address operator,\\n address from,\\n uint256 id,\\n uint256 value,\\n bytes calldata data\\n ) external returns (bytes4);\\n\\n /**\\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\\n * is called at the end of a `safeBatchTransferFrom` after the balances have\\n * been updated.\\n *\\n * NOTE: To accept the transfer(s), this must return\\n * `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))`\\n * (i.e. 0xbc197c81, or its own function selector).\\n *\\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xeb373f1fdc7b755c6a750123a9b9e3a8a02c1470042fd6505d875000a80bde0b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC1155.sol\\\";\\n\\n/**\\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155MetadataURI is IERC1155 {\\n /**\\n * @dev Returns the URI for token type `id`.\\n *\\n * If the `\\\\{id\\\\}` substring is present in the URI, it must be replaced by\\n * clients with the actual token type ID.\\n */\\n function uri(uint256 id) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xa66d18b9a85458d28fc3304717964502ae36f7f8a2ff35bc83f6f85d74b03574\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseClaimer.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\n\\ncontract ReverseClaimer {\\n bytes32 constant ADDR_REVERSE_NODE =\\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n constructor(ENS ens, address claimant) {\\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\\n ens.owner(ADDR_REVERSE_NODE)\\n );\\n reverseRegistrar.claim(claimant);\\n }\\n}\\n\",\"keccak256\":\"0x78a28627241535b595f6fff476a1fa7acc90c80684fe7784734920fc8af6fc22\",\"license\":\"MIT\"},\"contracts/utils/ERC20Recoverable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\\n */\\n\\ncontract ERC20Recoverable is Ownable {\\n /**\\n @notice Recover ERC20 tokens sent to the contract by mistake.\\n @dev The contract is Ownable and only the owner can call the recover function.\\n @param _to The address to send the tokens to.\\n@param _token The address of the ERC20 token to recover\\n @param _amount The amount of tokens to recover.\\n */\\n function recoverFunds(\\n address _token,\\n address _to,\\n uint256 _amount\\n ) external onlyOwner {\\n IERC20(_token).transfer(_to, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x793a38091e1f81499a29ddba82c2b2f3cdd07071b81a832886e8e02a45ff352a\",\"license\":\"MIT\"},\"contracts/wrapper/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes32) {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n}\\n\",\"keccak256\":\"0xf862cd86d749158a554e3cb517efa9097331ec0cf7225117f21e96fb50c67edb\",\"license\":\"MIT\"},\"contracts/wrapper/Controllable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool active);\\n\\n function setController(address controller, bool active) public onlyOwner {\\n controllers[controller] = active;\\n emit ControllerChanged(controller, active);\\n }\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x9a9191656a82eda6763cda29ce893ddbfddb6c43559ff3b90c00a184e14e1fa1\",\"license\":\"MIT\"},\"contracts/wrapper/ERC1155Fuse.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\\n\\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\\n using Address for address;\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(\\n address indexed owner,\\n address indexed approved,\\n uint256 indexed tokenId\\n );\\n mapping(uint256 => uint256) public _tokens;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) internal _tokenApprovals;\\n\\n /**************************************************************************\\n * ERC721 methods\\n *************************************************************************/\\n\\n function ownerOf(uint256 id) public view virtual returns (address) {\\n (address owner, , ) = getData(id);\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual {\\n address owner = ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(\\n uint256 tokenId\\n ) public view virtual returns (address) {\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IERC1155).interfaceId ||\\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(\\n address account,\\n uint256 id\\n ) public view virtual override returns (uint256) {\\n require(\\n account != address(0),\\n \\\"ERC1155: balance query for the zero address\\\"\\n );\\n address owner = ownerOf(id);\\n if (owner == account) {\\n return 1;\\n }\\n return 0;\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOfBatch}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] memory accounts,\\n uint256[] memory ids\\n ) public view virtual override returns (uint256[] memory) {\\n require(\\n accounts.length == ids.length,\\n \\\"ERC1155: accounts and ids length mismatch\\\"\\n );\\n\\n uint256[] memory batchBalances = new uint256[](accounts.length);\\n\\n for (uint256 i = 0; i < accounts.length; ++i) {\\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\\n }\\n\\n return batchBalances;\\n }\\n\\n /**\\n * @dev See {IERC1155-setApprovalForAll}.\\n */\\n function setApprovalForAll(\\n address operator,\\n bool approved\\n ) public virtual override {\\n require(\\n msg.sender != operator,\\n \\\"ERC1155: setting approval status for self\\\"\\n );\\n\\n _operatorApprovals[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC1155-isApprovedForAll}.\\n */\\n function isApprovedForAll(\\n address account,\\n address operator\\n ) public view virtual override returns (bool) {\\n return _operatorApprovals[account][operator];\\n }\\n\\n /**\\n * @dev Returns the Name's owner address and fuses\\n */\\n function getData(\\n uint256 tokenId\\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\\n uint256 t = _tokens[tokenId];\\n owner = address(uint160(t));\\n expiry = uint64(t >> 192);\\n fuses = uint32(t >> 160);\\n }\\n\\n /**\\n * @dev See {IERC1155-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) public virtual override {\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n require(\\n from == msg.sender || isApprovedForAll(from, msg.sender),\\n \\\"ERC1155: caller is not owner nor approved\\\"\\n );\\n\\n _transfer(from, to, id, amount, data);\\n }\\n\\n /**\\n * @dev See {IERC1155-safeBatchTransferFrom}.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) public virtual override {\\n require(\\n ids.length == amounts.length,\\n \\\"ERC1155: ids and amounts length mismatch\\\"\\n );\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n require(\\n from == msg.sender || isApprovedForAll(from, msg.sender),\\n \\\"ERC1155: transfer caller is not owner nor approved\\\"\\n );\\n\\n for (uint256 i = 0; i < ids.length; ++i) {\\n uint256 id = ids[i];\\n uint256 amount = amounts[i];\\n\\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\\n\\n _beforeTransfer(id, fuses, expiry);\\n\\n require(\\n amount == 1 && oldOwner == from,\\n \\\"ERC1155: insufficient balance for transfer\\\"\\n );\\n _setData(id, to, fuses, expiry);\\n }\\n\\n emit TransferBatch(msg.sender, from, to, ids, amounts);\\n\\n _doSafeBatchTransferAcceptanceCheck(\\n msg.sender,\\n from,\\n to,\\n ids,\\n amounts,\\n data\\n );\\n }\\n\\n /**************************************************************************\\n * Internal/private methods\\n *************************************************************************/\\n\\n /**\\n * @dev Sets the Name's owner address and fuses\\n */\\n function _setData(\\n uint256 tokenId,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual {\\n _tokens[tokenId] =\\n uint256(uint160(owner)) |\\n (uint256(fuses) << 160) |\\n (uint256(expiry) << 192);\\n }\\n\\n function _beforeTransfer(\\n uint256 id,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual;\\n\\n function _clearOwnerAndFuses(\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual returns (address, uint32);\\n\\n function _mint(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual {\\n uint256 tokenId = uint256(node);\\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n\\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\\n oldFuses;\\n\\n if (oldExpiry > expiry) {\\n expiry = oldExpiry;\\n }\\n\\n if (oldExpiry >= block.timestamp) {\\n fuses = fuses | parentControlledFuses;\\n }\\n\\n require(oldOwner == address(0), \\\"ERC1155: mint of existing token\\\");\\n require(owner != address(0), \\\"ERC1155: mint to the zero address\\\");\\n require(\\n owner != address(this),\\n \\\"ERC1155: newOwner cannot be the NameWrapper contract\\\"\\n );\\n\\n _setData(tokenId, owner, fuses, expiry);\\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\\n _doSafeTransferAcceptanceCheck(\\n msg.sender,\\n address(0),\\n owner,\\n tokenId,\\n 1,\\n \\\"\\\"\\n );\\n }\\n\\n function _burn(uint256 tokenId) internal virtual {\\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\\n tokenId\\n );\\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n // Fuses and expiry are kept on burn\\n _setData(tokenId, address(0x0), fuses, expiry);\\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\\n }\\n\\n function _transfer(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) internal {\\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\\n\\n _beforeTransfer(id, fuses, expiry);\\n\\n require(\\n amount == 1 && oldOwner == from,\\n \\\"ERC1155: insufficient balance for transfer\\\"\\n );\\n\\n if (oldOwner == to) {\\n return;\\n }\\n\\n _setData(id, to, fuses, expiry);\\n\\n emit TransferSingle(msg.sender, from, to, id, amount);\\n\\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\\n }\\n\\n function _doSafeTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try\\n IERC1155Receiver(to).onERC1155Received(\\n operator,\\n from,\\n id,\\n amount,\\n data\\n )\\n returns (bytes4 response) {\\n if (\\n response != IERC1155Receiver(to).onERC1155Received.selector\\n ) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n function _doSafeBatchTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try\\n IERC1155Receiver(to).onERC1155BatchReceived(\\n operator,\\n from,\\n ids,\\n amounts,\\n data\\n )\\n returns (bytes4 response) {\\n if (\\n response !=\\n IERC1155Receiver(to).onERC1155BatchReceived.selector\\n ) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n /* ERC721 internal functions */\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ownerOf(tokenId), to, tokenId);\\n }\\n}\\n\",\"keccak256\":\"0xfbbd36e7f5df0fe7a8e9199783af99ac61ab24122e4a9fdb072bbd4cd676a88b\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_ETH = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x70310eb67146d7290731c31841399640ac3b6a949eadc6598bc150123d185c57\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"},\"contracts/wrapper/NameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \\\"./ERC1155Fuse.sol\\\";\\nimport {Controllable} from \\\"./Controllable.sol\\\";\\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \\\"./INameWrapper.sol\\\";\\nimport {INameWrapperUpgrade} from \\\"./INameWrapperUpgrade.sol\\\";\\nimport {IMetadataService} from \\\"./IMetadataService.sol\\\";\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\nimport {ReverseClaimer} from \\\"../reverseRegistrar/ReverseClaimer.sol\\\";\\nimport {IBaseRegistrar} from \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport {IERC721Receiver} from \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {BytesUtils} from \\\"./BytesUtils.sol\\\";\\nimport {ERC20Recoverable} from \\\"../utils/ERC20Recoverable.sol\\\";\\n\\nerror Unauthorised(bytes32 node, address addr);\\nerror IncompatibleParent();\\nerror IncorrectTokenType();\\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\\nerror LabelTooShort();\\nerror LabelTooLong(string label);\\nerror IncorrectTargetOwner(address owner);\\nerror CannotUpgrade();\\nerror OperationProhibited(bytes32 node);\\nerror NameIsNotWrapped();\\nerror NameIsStillExpired();\\n\\ncontract NameWrapper is\\n Ownable,\\n ERC1155Fuse,\\n INameWrapper,\\n Controllable,\\n IERC721Receiver,\\n ERC20Recoverable,\\n ReverseClaimer\\n{\\n using BytesUtils for bytes;\\n\\n ENS public immutable ens;\\n IBaseRegistrar public immutable registrar;\\n IMetadataService public metadataService;\\n mapping(bytes32 => bytes) public names;\\n string public constant name = \\\"NameWrapper\\\";\\n\\n uint64 private constant GRACE_PERIOD = 90 days;\\n bytes32 private constant ETH_NODE =\\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\\n bytes32 private constant ETH_LABELHASH =\\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\\n bytes32 private constant ROOT_NODE =\\n 0x0000000000000000000000000000000000000000000000000000000000000000;\\n\\n INameWrapperUpgrade public upgradeContract;\\n uint64 private constant MAX_EXPIRY = type(uint64).max;\\n\\n constructor(\\n ENS _ens,\\n IBaseRegistrar _registrar,\\n IMetadataService _metadataService\\n ) ReverseClaimer(_ens, msg.sender) {\\n ens = _ens;\\n registrar = _registrar;\\n metadataService = _metadataService;\\n\\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE and set expiry to max */\\n\\n _setData(\\n uint256(ETH_NODE),\\n address(0),\\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\\n MAX_EXPIRY\\n );\\n _setData(\\n uint256(ROOT_NODE),\\n address(0),\\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\\n MAX_EXPIRY\\n );\\n names[ROOT_NODE] = \\\"\\\\x00\\\";\\n names[ETH_NODE] = \\\"\\\\x03eth\\\\x00\\\";\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\\n return\\n interfaceId == type(INameWrapper).interfaceId ||\\n interfaceId == type(IERC721Receiver).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /* ERC1155 Fuse */\\n\\n /**\\n * @notice Gets the owner of a name\\n * @param id Label as a string of the .eth domain to wrap\\n * @return owner The owner of the name\\n */\\n\\n function ownerOf(\\n uint256 id\\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\\n return super.ownerOf(id);\\n }\\n\\n /**\\n * @notice Gets the owner of a name\\n * @param id Namehash of the name\\n * @return operator Approved operator of a name\\n */\\n\\n function getApproved(\\n uint256 id\\n )\\n public\\n view\\n override(ERC1155Fuse, INameWrapper)\\n returns (address operator)\\n {\\n address owner = ownerOf(id);\\n if (owner == address(0)) {\\n return address(0);\\n }\\n return super.getApproved(id);\\n }\\n\\n /**\\n * @notice Approves an address for a name\\n * @param to address to approve\\n * @param tokenId name to approve\\n */\\n\\n function approve(\\n address to,\\n uint256 tokenId\\n ) public override(ERC1155Fuse, INameWrapper) {\\n (, uint32 fuses, ) = getData(tokenId);\\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\\n revert OperationProhibited(bytes32(tokenId));\\n }\\n super.approve(to, tokenId);\\n }\\n\\n /**\\n * @notice Gets the data for a name\\n * @param id Namehash of the name\\n * @return owner Owner of the name\\n * @return fuses Fuses of the name\\n * @return expiry Expiry of the name\\n */\\n\\n function getData(\\n uint256 id\\n )\\n public\\n view\\n override(ERC1155Fuse, INameWrapper)\\n returns (address owner, uint32 fuses, uint64 expiry)\\n {\\n (owner, fuses, expiry) = super.getData(id);\\n\\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\\n }\\n\\n /* Metadata service */\\n\\n /**\\n * @notice Set the metadata service. Only the owner can do this\\n * @param _metadataService The new metadata service\\n */\\n\\n function setMetadataService(\\n IMetadataService _metadataService\\n ) public onlyOwner {\\n metadataService = _metadataService;\\n }\\n\\n /**\\n * @notice Get the metadata uri\\n * @param tokenId The id of the token\\n * @return string uri of the metadata service\\n */\\n\\n function uri(\\n uint256 tokenId\\n )\\n public\\n view\\n override(INameWrapper, IERC1155MetadataURI)\\n returns (string memory)\\n {\\n return metadataService.uri(tokenId);\\n }\\n\\n /**\\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\\n * to make the contract not upgradable.\\n * @param _upgradeAddress address of an upgraded contract\\n */\\n\\n function setUpgradeContract(\\n INameWrapperUpgrade _upgradeAddress\\n ) public onlyOwner {\\n if (address(upgradeContract) != address(0)) {\\n registrar.setApprovalForAll(address(upgradeContract), false);\\n ens.setApprovalForAll(address(upgradeContract), false);\\n }\\n\\n upgradeContract = _upgradeAddress;\\n\\n if (address(upgradeContract) != address(0)) {\\n registrar.setApprovalForAll(address(upgradeContract), true);\\n ens.setApprovalForAll(address(upgradeContract), true);\\n }\\n }\\n\\n /**\\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\\n * @param node namehash of the name to check\\n */\\n\\n modifier onlyTokenOwner(bytes32 node) {\\n if (!canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n _;\\n }\\n\\n /**\\n * @notice Checks if owner or operator of the owner\\n * @param node namehash of the name to check\\n * @param addr which address to check permissions for\\n * @return whether or not is owner or operator\\n */\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) public view returns (bool) {\\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\\n return\\n (owner == addr || isApprovedForAll(owner, addr)) &&\\n !_isETH2LDInGracePeriod(fuses, expiry);\\n }\\n\\n /**\\n * @notice Checks if owner/operator or approved by owner\\n * @param node namehash of the name to check\\n * @param addr which address to check permissions for\\n * @return whether or not is owner/operator or approved\\n */\\n\\n function canExtendSubnames(\\n bytes32 node,\\n address addr\\n ) public view returns (bool) {\\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\\n return\\n (owner == addr ||\\n isApprovedForAll(owner, addr) ||\\n getApproved(uint256(node)) == addr) &&\\n !_isETH2LDInGracePeriod(fuses, expiry);\\n }\\n\\n /**\\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\\n * @param label Label as a string of the .eth domain to wrap\\n * @param wrappedOwner Owner of the name in this contract\\n * @param ownerControlledFuses Initial owner-controlled fuses to set\\n * @param resolver Resolver contract address\\n */\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) public returns (uint64 expiry) {\\n uint256 tokenId = uint256(keccak256(bytes(label)));\\n address registrant = registrar.ownerOf(tokenId);\\n if (\\n registrant != msg.sender &&\\n !registrar.isApprovedForAll(registrant, msg.sender)\\n ) {\\n revert Unauthorised(\\n _makeNode(ETH_NODE, bytes32(tokenId)),\\n msg.sender\\n );\\n }\\n\\n // transfer the token from the user to this contract\\n registrar.transferFrom(registrant, address(this), tokenId);\\n\\n // transfer the ens record back to the new owner (this contract)\\n registrar.reclaim(tokenId, address(this));\\n\\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\\n\\n _wrapETH2LD(\\n label,\\n wrappedOwner,\\n ownerControlledFuses,\\n expiry,\\n resolver\\n );\\n }\\n\\n /**\\n * @dev Registers a new .eth second-level domain and wraps it.\\n * Only callable by authorised controllers.\\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\\n * @param wrappedOwner The owner of the wrapped name.\\n * @param duration The duration, in seconds, to register the name for.\\n * @param resolver The resolver address to set on the ENS registry (optional).\\n * @param ownerControlledFuses Initial owner-controlled fuses to set\\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\\n */\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external onlyController returns (uint256 registrarExpiry) {\\n uint256 tokenId = uint256(keccak256(bytes(label)));\\n registrarExpiry = registrar.register(tokenId, address(this), duration);\\n _wrapETH2LD(\\n label,\\n wrappedOwner,\\n ownerControlledFuses,\\n uint64(registrarExpiry) + GRACE_PERIOD,\\n resolver\\n );\\n }\\n\\n /**\\n * @notice Renews a .eth second-level domain.\\n * @dev Only callable by authorised controllers.\\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\\n * @param duration The number of seconds to renew the name for.\\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\\n */\\n\\n function renew(\\n uint256 tokenId,\\n uint256 duration\\n ) external onlyController returns (uint256 expires) {\\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\\n\\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\\n\\n // Do not set anything in wrapper if name is not wrapped\\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\\n if (\\n registrarOwner != address(this) ||\\n ens.owner(node) != address(this)\\n ) {\\n return registrarExpiry;\\n }\\n } catch {\\n return registrarExpiry;\\n }\\n\\n // Set expiry in Wrapper\\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\\n\\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\\n _setData(node, owner, fuses, expiry);\\n\\n return registrarExpiry;\\n }\\n\\n /**\\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\\n * @param name The name to wrap, in DNS format\\n * @param wrappedOwner Owner of the name in this contract\\n * @param resolver Resolver contract\\n */\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) public {\\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\\n bytes32 parentNode = name.namehash(offset);\\n bytes32 node = _makeNode(parentNode, labelhash);\\n\\n names[node] = name;\\n\\n if (parentNode == ETH_NODE) {\\n revert IncompatibleParent();\\n }\\n\\n address owner = ens.owner(node);\\n\\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n if (resolver != address(0)) {\\n ens.setResolver(node, resolver);\\n }\\n\\n ens.setOwner(node, address(this));\\n\\n _wrap(node, name, wrappedOwner, 0, 0);\\n }\\n\\n /**\\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\\n * @param labelhash Labelhash of the .eth domain\\n * @param registrant Sets the owner in the .eth registrar to this address\\n * @param controller Sets the owner in the registry to this address\\n */\\n\\n function unwrapETH2LD(\\n bytes32 labelhash,\\n address registrant,\\n address controller\\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\\n if (registrant == address(this)) {\\n revert IncorrectTargetOwner(registrant);\\n }\\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\\n registrar.safeTransferFrom(\\n address(this),\\n registrant,\\n uint256(labelhash)\\n );\\n }\\n\\n /**\\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\\n * @param controller Sets the owner in the registry to this address\\n */\\n\\n function unwrap(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n address controller\\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\\n if (parentNode == ETH_NODE) {\\n revert IncompatibleParent();\\n }\\n if (controller == address(0x0) || controller == address(this)) {\\n revert IncorrectTargetOwner(controller);\\n }\\n _unwrap(_makeNode(parentNode, labelhash), controller);\\n }\\n\\n /**\\n * @notice Sets fuses of a name\\n * @param node Namehash of the name\\n * @param ownerControlledFuses Owner-controlled fuses to burn\\n * @return Old fuses\\n */\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n )\\n public\\n onlyTokenOwner(node)\\n operationAllowed(node, CANNOT_BURN_FUSES)\\n returns (uint32)\\n {\\n // owner protected by onlyTokenOwner\\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\\n uint256(node)\\n );\\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\\n return oldFuses;\\n }\\n\\n /**\\n * @notice Extends expiry for a name\\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\\n * @param expiry When the name will expire in seconds since the Unix epoch\\n * @return New expiry\\n */\\n\\n function extendExpiry(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint64 expiry\\n ) public returns (uint64) {\\n bytes32 node = _makeNode(parentNode, labelhash);\\n\\n if (!_isWrapped(node)) {\\n revert NameIsNotWrapped();\\n }\\n\\n // this flag is used later, when checking fuses\\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\\n // only allow the owner of the name or owner of the parent name\\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n\\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\\n revert OperationProhibited(node);\\n }\\n\\n // Max expiry is set to the expiry of the parent\\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\\n\\n _setData(node, owner, fuses, expiry);\\n emit ExpiryExtended(node, expiry);\\n return expiry;\\n }\\n\\n /**\\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\\n * @dev Can be called by the owner or an authorised caller\\n * @param name The name to upgrade, in DNS format\\n * @param extraData Extra data to pass to the upgrade contract\\n */\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) public {\\n bytes32 node = name.namehash(0);\\n\\n if (address(upgradeContract) == address(0)) {\\n revert CannotUpgrade();\\n }\\n\\n if (!canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\\n uint256(node)\\n );\\n\\n address approved = getApproved(uint256(node));\\n\\n _burn(uint256(node));\\n\\n upgradeContract.wrapFromUpgrade(\\n name,\\n currentOwner,\\n fuses,\\n expiry,\\n approved,\\n extraData\\n );\\n }\\n\\n /** \\n /* @notice Sets fuses of a name that you own the parent of\\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\\n * @param fuses Fuses to burn\\n * @param expiry When the name will expire in seconds since the Unix epoch\\n */\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) public {\\n bytes32 node = _makeNode(parentNode, labelhash);\\n _checkFusesAreSettable(node, fuses);\\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n if (owner == address(0) || ens.owner(node) != address(this)) {\\n revert NameIsNotWrapped();\\n }\\n // max expiry is set to the expiry of the parent\\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\\n if (parentNode == ROOT_NODE) {\\n if (!canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n } else {\\n if (!canModifyName(parentNode, msg.sender)) {\\n revert Unauthorised(parentNode, msg.sender);\\n }\\n }\\n\\n _checkParentFuses(node, fuses, parentFuses);\\n\\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\\n\\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\\n if (\\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\\n oldFuses | fuses != oldFuses\\n ) {\\n revert OperationProhibited(node);\\n }\\n fuses |= oldFuses;\\n _setFuses(node, owner, fuses, oldExpiry, expiry);\\n }\\n\\n /**\\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\\n * @param parentNode Parent namehash of the subdomain\\n * @param label Label of the subdomain as a string\\n * @param owner New owner in the wrapper\\n * @param fuses Initial fuses for the wrapped subdomain\\n * @param expiry When the name will expire in seconds since the Unix epoch\\n * @return node Namehash of the subdomain\\n */\\n\\n function setSubnodeOwner(\\n bytes32 parentNode,\\n string calldata label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\\n bytes32 labelhash = keccak256(bytes(label));\\n node = _makeNode(parentNode, labelhash);\\n _checkCanCallSetSubnodeOwner(parentNode, node);\\n _checkFusesAreSettable(node, fuses);\\n bytes memory name = _saveLabel(parentNode, node, label);\\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\\n\\n if (!_isWrapped(node)) {\\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\\n _wrap(node, name, owner, fuses, expiry);\\n } else {\\n _updateName(parentNode, node, label, owner, fuses, expiry);\\n }\\n }\\n\\n /**\\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\\n * @param parentNode parent namehash of the subdomain\\n * @param label label of the subdomain as a string\\n * @param owner new owner in the wrapper\\n * @param resolver resolver contract in the registry\\n * @param ttl ttl in the registry\\n * @param fuses initial fuses for the wrapped subdomain\\n * @param expiry When the name will expire in seconds since the Unix epoch\\n * @return node Namehash of the subdomain\\n */\\n\\n function setSubnodeRecord(\\n bytes32 parentNode,\\n string memory label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\\n bytes32 labelhash = keccak256(bytes(label));\\n node = _makeNode(parentNode, labelhash);\\n _checkCanCallSetSubnodeOwner(parentNode, node);\\n _checkFusesAreSettable(node, fuses);\\n _saveLabel(parentNode, node, label);\\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\\n if (!_isWrapped(node)) {\\n ens.setSubnodeRecord(\\n parentNode,\\n labelhash,\\n address(this),\\n resolver,\\n ttl\\n );\\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\\n } else {\\n ens.setSubnodeRecord(\\n parentNode,\\n labelhash,\\n address(this),\\n resolver,\\n ttl\\n );\\n _updateName(parentNode, node, label, owner, fuses, expiry);\\n }\\n }\\n\\n /**\\n * @notice Sets records for the name in the ENS Registry\\n * @param node Namehash of the name to set a record for\\n * @param owner New owner in the registry\\n * @param resolver Resolver contract\\n * @param ttl Time to live in the registry\\n */\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n )\\n public\\n onlyTokenOwner(node)\\n operationAllowed(\\n node,\\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\\n )\\n {\\n ens.setRecord(node, address(this), resolver, ttl);\\n if (owner == address(0)) {\\n (, uint32 fuses, ) = getData(uint256(node));\\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\\n revert IncorrectTargetOwner(owner);\\n }\\n _unwrap(node, address(0));\\n } else {\\n address oldOwner = ownerOf(uint256(node));\\n _transfer(oldOwner, owner, uint256(node), 1, \\\"\\\");\\n }\\n }\\n\\n /**\\n * @notice Sets resolver contract in the registry\\n * @param node namehash of the name\\n * @param resolver the resolver contract\\n */\\n\\n function setResolver(\\n bytes32 node,\\n address resolver\\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\\n ens.setResolver(node, resolver);\\n }\\n\\n /**\\n * @notice Sets TTL in the registry\\n * @param node Namehash of the name\\n * @param ttl TTL in the registry\\n */\\n\\n function setTTL(\\n bytes32 node,\\n uint64 ttl\\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\\n ens.setTTL(node, ttl);\\n }\\n\\n /**\\n * @dev Allows an operation only if none of the specified fuses are burned.\\n * @param node The namehash of the name to check fuses on.\\n * @param fuseMask A bitmask of fuses that must not be burned.\\n */\\n\\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\\n (, uint32 fuses, ) = getData(uint256(node));\\n if (fuses & fuseMask != 0) {\\n revert OperationProhibited(node);\\n }\\n _;\\n }\\n\\n /**\\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\\n * replacing a subdomain. If either conditions are true, then it is possible to call\\n * setSubnodeOwner\\n * @param parentNode Namehash of the parent name to check\\n * @param subnode Namehash of the subname to check\\n */\\n\\n function _checkCanCallSetSubnodeOwner(\\n bytes32 parentNode,\\n bytes32 subnode\\n ) internal view {\\n (\\n address subnodeOwner,\\n uint32 subnodeFuses,\\n uint64 subnodeExpiry\\n ) = getData(uint256(subnode));\\n\\n // check if the registry owner is 0 and expired\\n // check if the wrapper owner is 0 and expired\\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\\n bool expired = subnodeExpiry < block.timestamp;\\n if (\\n expired &&\\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\\n (subnodeOwner == address(0) ||\\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\\n ens.owner(subnode) == address(0))\\n ) {\\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\\n revert OperationProhibited(subnode);\\n }\\n } else {\\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\\n revert OperationProhibited(subnode);\\n }\\n }\\n }\\n\\n /**\\n * @notice Checks all Fuses in the mask are burned for the node\\n * @param node Namehash of the name\\n * @param fuseMask The fuses you want to check\\n * @return Boolean of whether or not all the selected fuses are burned\\n */\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) public view returns (bool) {\\n (, uint32 fuses, ) = getData(uint256(node));\\n return fuses & fuseMask == fuseMask;\\n }\\n\\n /**\\n * @notice Checks if a name is wrapped\\n * @param node Namehash of the name\\n * @return Boolean of whether or not the name is wrapped\\n */\\n\\n function isWrapped(bytes32 node) public view returns (bool) {\\n bytes memory name = names[node];\\n if (name.length == 0) {\\n return false;\\n }\\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\\n bytes32 parentNode = name.namehash(offset);\\n return isWrapped(parentNode, labelhash);\\n }\\n\\n /**\\n * @notice Checks if a name is wrapped in a more gas efficient way\\n * @param parentNode Namehash of the name\\n * @param labelhash Namehash of the name\\n * @return Boolean of whether or not the name is wrapped\\n */\\n\\n function isWrapped(\\n bytes32 parentNode,\\n bytes32 labelhash\\n ) public view returns (bool) {\\n bytes32 node = _makeNode(parentNode, labelhash);\\n bool wrapped = _isWrapped(node);\\n if (parentNode != ETH_NODE) {\\n return wrapped;\\n }\\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\\n return owner == address(this);\\n } catch {\\n return false;\\n }\\n }\\n\\n function onERC721Received(\\n address to,\\n address,\\n uint256 tokenId,\\n bytes calldata data\\n ) public returns (bytes4) {\\n //check if it's the eth registrar ERC721\\n if (msg.sender != address(registrar)) {\\n revert IncorrectTokenType();\\n }\\n\\n (\\n string memory label,\\n address owner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) = abi.decode(data, (string, address, uint16, address));\\n\\n bytes32 labelhash = bytes32(tokenId);\\n bytes32 labelhashFromData = keccak256(bytes(label));\\n\\n if (labelhashFromData != labelhash) {\\n revert LabelMismatch(labelhashFromData, labelhash);\\n }\\n\\n // transfer the ens record back to the new owner (this contract)\\n registrar.reclaim(uint256(labelhash), address(this));\\n\\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\\n\\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\\n\\n return IERC721Receiver(to).onERC721Received.selector;\\n }\\n\\n /***** Internal functions */\\n\\n function _beforeTransfer(\\n uint256 id,\\n uint32 fuses,\\n uint64 expiry\\n ) internal override {\\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\\n expiry -= GRACE_PERIOD;\\n }\\n\\n if (expiry < block.timestamp) {\\n // Transferable if the name was not emancipated\\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\\n revert(\\\"ERC1155: insufficient balance for transfer\\\");\\n }\\n } else {\\n // Transferable if CANNOT_TRANSFER is unburned\\n if (fuses & CANNOT_TRANSFER != 0) {\\n revert OperationProhibited(bytes32(id));\\n }\\n }\\n\\n // delete token approval if CANNOT_APPROVE has not been burnt\\n if (fuses & CANNOT_APPROVE == 0) {\\n delete _tokenApprovals[id];\\n }\\n }\\n\\n function _clearOwnerAndFuses(\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal view override returns (address, uint32) {\\n if (expiry < block.timestamp) {\\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\\n owner = address(0);\\n }\\n fuses = 0;\\n }\\n\\n return (owner, fuses);\\n }\\n\\n function _makeNode(\\n bytes32 node,\\n bytes32 labelhash\\n ) private pure returns (bytes32) {\\n return keccak256(abi.encodePacked(node, labelhash));\\n }\\n\\n function _addLabel(\\n string memory label,\\n bytes memory name\\n ) internal pure returns (bytes memory ret) {\\n if (bytes(label).length < 1) {\\n revert LabelTooShort();\\n }\\n if (bytes(label).length > 255) {\\n revert LabelTooLong(label);\\n }\\n return abi.encodePacked(uint8(bytes(label).length), label, name);\\n }\\n\\n function _mint(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal override {\\n _canFusesBeBurned(node, fuses);\\n (address oldOwner, , ) = super.getData(uint256(node));\\n if (oldOwner != address(0)) {\\n // burn and unwrap old token of old owner\\n _burn(uint256(node));\\n emit NameUnwrapped(node, address(0));\\n }\\n super._mint(node, owner, fuses, expiry);\\n }\\n\\n function _wrap(\\n bytes32 node,\\n bytes memory name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n _mint(node, wrappedOwner, fuses, expiry);\\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\\n }\\n\\n function _storeNameAndWrap(\\n bytes32 parentNode,\\n bytes32 node,\\n string memory label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n bytes memory name = _addLabel(label, names[parentNode]);\\n _wrap(node, name, owner, fuses, expiry);\\n }\\n\\n function _saveLabel(\\n bytes32 parentNode,\\n bytes32 node,\\n string memory label\\n ) internal returns (bytes memory) {\\n bytes memory name = _addLabel(label, names[parentNode]);\\n names[node] = name;\\n return name;\\n }\\n\\n function _updateName(\\n bytes32 parentNode,\\n bytes32 node,\\n string memory label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n bytes memory name = _addLabel(label, names[parentNode]);\\n if (names[node].length == 0) {\\n names[node] = name;\\n }\\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\\n if (owner == address(0)) {\\n _unwrap(node, address(0));\\n } else {\\n _transfer(oldOwner, owner, uint256(node), 1, \\\"\\\");\\n }\\n }\\n\\n // wrapper function for stack limit\\n function _checkParentFusesAndExpiry(\\n bytes32 parentNode,\\n bytes32 node,\\n uint32 fuses,\\n uint64 expiry\\n ) internal view returns (uint64) {\\n (, , uint64 oldExpiry) = getData(uint256(node));\\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\\n _checkParentFuses(node, fuses, parentFuses);\\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\\n }\\n\\n function _checkParentFuses(\\n bytes32 node,\\n uint32 fuses,\\n uint32 parentFuses\\n ) internal pure {\\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\\n 0;\\n\\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\\n\\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\\n revert OperationProhibited(node);\\n }\\n }\\n\\n function _normaliseExpiry(\\n uint64 expiry,\\n uint64 oldExpiry,\\n uint64 maxExpiry\\n ) private pure returns (uint64) {\\n // Expiry cannot be more than maximum allowed\\n // .eth names will check registrar, non .eth check parent\\n if (expiry > maxExpiry) {\\n expiry = maxExpiry;\\n }\\n // Expiry cannot be less than old expiry\\n if (expiry < oldExpiry) {\\n expiry = oldExpiry;\\n }\\n\\n return expiry;\\n }\\n\\n function _wrapETH2LD(\\n string memory label,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address resolver\\n ) private {\\n bytes32 labelhash = keccak256(bytes(label));\\n bytes32 node = _makeNode(ETH_NODE, labelhash);\\n // hardcode dns-encoded eth string for gas savings\\n bytes memory name = _addLabel(label, \\\"\\\\x03eth\\\\x00\\\");\\n names[node] = name;\\n\\n _wrap(\\n node,\\n name,\\n wrappedOwner,\\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\\n expiry\\n );\\n\\n if (resolver != address(0)) {\\n ens.setResolver(node, resolver);\\n }\\n }\\n\\n function _unwrap(bytes32 node, address owner) private {\\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\\n revert OperationProhibited(node);\\n }\\n\\n // Burn token and fuse data\\n _burn(uint256(node));\\n ens.setOwner(node, owner);\\n\\n emit NameUnwrapped(node, owner);\\n }\\n\\n function _setFuses(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 oldExpiry,\\n uint64 expiry\\n ) internal {\\n _setData(node, owner, fuses, expiry);\\n emit FusesSet(node, fuses);\\n if (expiry > oldExpiry) {\\n emit ExpiryExtended(node, expiry);\\n }\\n }\\n\\n function _setData(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n _canFusesBeBurned(node, fuses);\\n super._setData(uint256(node), owner, fuses, expiry);\\n }\\n\\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\\n if (\\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\\n ) {\\n revert OperationProhibited(node);\\n }\\n }\\n\\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\\n // Cannot directly burn other non-user settable fuses\\n revert OperationProhibited(node);\\n }\\n }\\n\\n function _isWrapped(bytes32 node) internal view returns (bool) {\\n return\\n ownerOf(uint256(node)) != address(0) &&\\n ens.owner(node) == address(this);\\n }\\n\\n function _isETH2LDInGracePeriod(\\n uint32 fuses,\\n uint64 expiry\\n ) internal view returns (bool) {\\n return\\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\\n expiry - GRACE_PERIOD < block.timestamp;\\n }\\n}\\n\",\"keccak256\":\"0x91ee0a58d8ecf132c4e7fba9a25bbf45bbfc3634f2024b30a6a2eea4a151ed0c\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c06040523480156200001157600080fd5b5060405162006502380380620065028339810160408190526200003491620002f8565b823362000041816200028f565b6040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e260048201526000906001600160a01b038416906302571be390602401602060405180830381865afa158015620000a9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000cf91906200034c565b604051630f41a04d60e11b81526001600160a01b03848116600483015291925090821690631e83409a906024016020604051808303816000875af11580156200011c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000142919062000373565b505050506001600160a01b0383811660805282811660a052600580546001600160a01b031916918316919091179055600163fffeffff60a01b03197fafa26c20e8b3d9a2853d642cfe1021dae26242ffedfac91c97aab212c1a4b93b8190557fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb4955604080518082019091526001815260006020808301829052908052600690527f54cdd369e4e8a8515e52ca72ec816c2101831ad1f18bf44102ed171459c9b4f89062000210908262000432565b506040805180820190915260058152626cae8d60e31b6020808301919091527f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae600052600690527ffb9e8e321b8a5ec48f12a7b41f22c6e595d761285c9eb19d8dda7c99edf1b54f9062000285908262000432565b50505050620004fe565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114620002f557600080fd5b50565b6000806000606084860312156200030e57600080fd5b83516200031b81620002df565b60208501519093506200032e81620002df565b60408501519092506200034181620002df565b809150509250925092565b6000602082840312156200035f57600080fd5b81516200036c81620002df565b9392505050565b6000602082840312156200038657600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620003b857607f821691505b602082108103620003d957634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200042d57600081815260208120601f850160051c81016020861015620004085750805b601f850160051c820191505b81811015620004295782815560010162000414565b5050505b505050565b81516001600160401b038111156200044e576200044e6200038d565b62000466816200045f8454620003a3565b84620003df565b602080601f8311600181146200049e5760008415620004855750858301515b600019600386901b1c1916600185901b17855562000429565b600085815260208120601f198616915b82811015620004cf57888601518255948401946001909101908401620004ae565b5085821015620004ee5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a051615ef76200060b6000396000818161050601528181610c1501528181610cef01528181610d7901528181611c6601528181611cfc01528181611daa01528181611ecc01528181611f4201528181611fc20152818161224401528181612380015281816124b2015281816126970152818161271d0152612f5201526000818161055301528181610b9b01528181610ed70152818161108b0152818161113d015281816115550152818161240501528181612537015281816127c8015281816129bf01528181612ccd0152818161317d0152818161322b015281816132f40152818161336d015281816139ca01528181613ae501528181613d4d015261438d0152615ef76000f3fe608060405234801561001057600080fd5b506004361061031f5760003560e01c80636352211e116101a7578063c93ab3fd116100ee578063e985e9c511610097578063f242432a11610071578063f242432a146107d7578063f2fde38b146107ea578063fd0cd0d9146107fd57600080fd5b8063e985e9c514610768578063eb8ae530146107a4578063ed70554d146107b757600080fd5b8063d9a50c12116100c8578063d9a50c121461071f578063da8c229e14610732578063e0dba60f1461075557600080fd5b8063c93ab3fd146106e6578063cf408823146106f9578063d8c9921a1461070c57600080fd5b8063a22cb46511610150578063b6bcad261161012a578063b6bcad26146106ad578063c475abff146106c0578063c658e086146106d357600080fd5b8063a22cb46514610674578063a401498214610687578063adf4960a1461069a57600080fd5b80638b4dfa75116101815780638b4dfa751461063d5780638cf8b41e146106505780638da5cb5b1461066357600080fd5b80636352211e146105f65780636e5d6ad214610609578063715018a61461063557600080fd5b80631f4e15041161026b5780633f15457f116102145780634e1273f4116101ee5780634e1273f4146105b057806353095467146105d05780635d3590d5146105e357600080fd5b80633f15457f1461054e578063402906fc1461057557806341415eab1461059d57600080fd5b80632b20e397116102455780632b20e397146105015780632eb2c2d61461052857806333c69ea91461053b57600080fd5b80631f4e1504146104c857806320c38e2b146104db57806324c1af44146104ee57600080fd5b80630e4cd725116102cd578063150b7a02116102a7578063150b7a02146104765780631534e177146104a25780631896f70a146104b557600080fd5b80630e4cd7251461043d5780630e89341c1461045057806314ab90381461046357600080fd5b806306fdde03116102fe57806306fdde03146103b4578063081812fc146103fd578063095ea7b31461042857600080fd5b8062fdd58e146103245780630178fe3f1461034a57806301ffc9a714610391575b600080fd5b610337610332366004614d26565b610810565b6040519081526020015b60405180910390f35b61035d610358366004614d52565b6108cf565b604080516001600160a01b03909416845263ffffffff909216602084015267ffffffffffffffff1690820152606001610341565b6103a461039f366004614d81565b6108ff565b6040519015158152602001610341565b6103f06040518060400160405280600b81526020017f4e616d655772617070657200000000000000000000000000000000000000000081525081565b6040516103419190614dee565b61041061040b366004614d52565b610958565b6040516001600160a01b039091168152602001610341565b61043b610436366004614d26565b61099d565b005b6103a461044b366004614e01565b6109e3565b6103f061045e366004614d52565b610a7d565b61043b610471366004614e4e565b610aef565b610489610484366004614ec3565b610c08565b6040516001600160e01b03199091168152602001610341565b61043b6104b0366004614f36565b610e1a565b61043b6104c3366004614e01565b610e44565b600754610410906001600160a01b031681565b6103f06104e9366004614d52565b610f06565b6103376104fc36600461502e565b610fa0565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b61043b610536366004615156565b6111b4565b61043b610549366004615204565b6114de565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b61058861058336600461525c565b6116d3565b60405163ffffffff9091168152602001610341565b6103a46105ab366004614e01565b611775565b6105c36105be36600461527f565b6117d2565b604051610341919061537d565b600554610410906001600160a01b031681565b61043b6105f1366004615390565b611910565b610410610604366004614d52565b6119aa565b61061c6106173660046153d1565b6119b5565b60405167ffffffffffffffff9091168152602001610341565b61043b611b0a565b61043b61064b366004615406565b611b1e565b61061c61065e366004615448565b611cc8565b6000546001600160a01b0316610410565b61043b6106823660046154d1565b612094565b6103376106953660046154ff565b61217e565b6103a46106a8366004615580565b612319565b61043b6106bb366004614f36565b61233e565b6103376106ce3660046155a3565b612596565b6103376106e13660046155c5565b61288d565b61043b6106f4366004615638565b612a9a565b61043b6107073660046156a4565b612c0b565b61043b61071a3660046156dc565b612dc4565b6103a461072d3660046155a3565b612ed4565b6103a4610740366004614f36565b60046020526000908152604090205460ff1681565b61043b6107633660046154d1565b612fe1565b6103a461077636600461570a565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b61043b6107b2366004615738565b613049565b6103376107c5366004614d52565b60016020526000908152604090205481565b61043b6107e53660046157a0565b613414565b61043b6107f8366004614f36565b613531565b6103a461080b366004614d52565b6135be565b60006001600160a01b0383166108935760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084015b60405180910390fd5b600061089e836119aa565b9050836001600160a01b0316816001600160a01b0316036108c35760019150506108c9565b60009150505b92915050565b60008181526001602052604090205460a081901c60c082901c6108f3838383613696565b90959094509092509050565b60006001600160e01b031982167fd82c42d800000000000000000000000000000000000000000000000000000000148061094957506001600160e01b03198216630a85bd0160e11b145b806108c957506108c9826136cd565b600080610964836119aa565b90506001600160a01b03811661097d5750600092915050565b6000838152600360205260409020546001600160a01b03165b9392505050565b60006109a8826108cf565b50915050603f1960408216016109d45760405163a2a7201360e01b81526004810183905260240161088a565b6109de838361374f565b505050565b60008080806109f1866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a3c57506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff165b80610a6057506001600160a01b038516610a5587610958565b6001600160a01b0316145b8015610a735750610a718282613899565b155b9695505050505050565b6005546040516303a24d0760e21b8152600481018390526060916001600160a01b031690630e89341c90602401600060405180830381865afa158015610ac7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108c99190810190615809565b81610afa8133611775565b610b205760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260106000610b2e836108cf565b5091505063ffffffff8282161615610b5c5760405163a2a7201360e01b81526004810184905260240161088a565b6040517f14ab90380000000000000000000000000000000000000000000000000000000081526004810187905267ffffffffffffffff861660248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906314ab9038906044015b600060405180830381600087803b158015610be857600080fd5b505af1158015610bfc573d6000803e3d6000fd5b50505050505050505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610c6c576040517f1931a53800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080610c7d86880188615881565b83516020850120939750919550935091508890808214610cd3576040517fc65c3ccc000000000000000000000000000000000000000000000000000000008152600481018290526024810183905260440161088a565b604051630a3b53db60e21b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906328ed4f6c90604401600060405180830381600087803b158015610d3b57600080fd5b505af1158015610d4f573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018d9052600092506276a70091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d6e4fa8690602401602060405180830381865afa158015610dc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de491906158e9565b610dee9190615918565b9050610e0187878761ffff1684886138ca565b50630a85bd0160e11b9c9b505050505050505050505050565b610e22613a30565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b81610e4f8133611775565b610e755760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260086000610e83836108cf565b5091505063ffffffff8282161615610eb15760405163a2a7201360e01b81526004810184905260240161088a565b604051630c4b7b8560e11b8152600481018790526001600160a01b0386811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401610bce565b60066020526000908152604090208054610f1f90615940565b80601f0160208091040260200160405190810160405280929190818152602001828054610f4b90615940565b8015610f985780601f10610f6d57610100808354040283529160200191610f98565b820191906000526020600020905b815481529060010190602001808311610f7b57829003601f168201915b505050505081565b600087610fad8133611775565b610fd35760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8751602089012061100b8a82604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506110178a84613a8a565b6110218386613bc9565b61102c8a848b613bfc565b506110398a848787613cc9565b935061104483613d0f565b6110fa576040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156110cf57600080fd5b505af11580156110e3573d6000803e3d6000fd5b505050506110f58a848b8b8989613dc8565b6111a7565b6040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561118157600080fd5b505af1158015611195573d6000803e3d6000fd5b505050506111a78a848b8b8989613dff565b5050979650505050505050565b815183511461122b5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060448201527f6d69736d61746368000000000000000000000000000000000000000000000000606482015260840161088a565b6001600160a01b03841661128f5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b0385163314806112c957506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b61133b5760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000606482015260840161088a565b60005b835181101561147157600084828151811061135b5761135b61597a565b6020026020010151905060008483815181106113795761137961597a565b602002602001015190506000806000611391856108cf565b9250925092506113a2858383613ec3565b8360011480156113c357508a6001600160a01b0316836001600160a01b0316145b6114225760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b60008581526001602052604090206001600160a01b038b1663ffffffff60a01b60a085901b16176001600160c01b031960c084901b1617905550505050508061146a90615990565b905061133e565b50836001600160a01b0316856001600160a01b0316336001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516114c19291906159a9565b60405180910390a46114d7338686868686613fb0565b5050505050565b604080516020808201879052818301869052825180830384018152606090920190925280519101206115108184613bc9565b6000808061151d846108cf565b919450925090506001600160a01b03831615806115cc57506040516302571be360e01b81526004810185905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa15801561159c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c091906159d7565b6001600160a01b031614155b156115ea57604051635374b59960e01b815260040160405180910390fd5b6000806115f68a6108cf565b90935091508a90506116375761160c8633611775565b6116325760405163168ab55d60e31b81526004810187905233602482015260440161088a565b611667565b6116418a33611775565b6116675760405163168ab55d60e31b8152600481018b905233602482015260440161088a565b611672868984614155565b61167d878483614190565b9650620100008416158015906116a157508363ffffffff1688851763ffffffff1614155b156116c25760405163a2a7201360e01b81526004810187905260240161088a565b96831796610bfc86868a868b6141da565b6000826116e08133611775565b6117065760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8360026000611714836108cf565b5091505063ffffffff82821616156117425760405163a2a7201360e01b81526004810184905260240161088a565b6000808061174f8a6108cf565b9250925092506117688a84848c61ffff161784856141da565b5098975050505050505050565b6000808080611783866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a6057506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff16610a60565b6060815183511461184b5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d617463680000000000000000000000000000000000000000000000606482015260840161088a565b6000835167ffffffffffffffff81111561186757611867614f53565b604051908082528060200260200182016040528015611890578160200160208202803683370190505b50905060005b8451811015611908576118db8582815181106118b4576118b461597a565b60200260200101518583815181106118ce576118ce61597a565b6020026020010151610810565b8282815181106118ed576118ed61597a565b602090810291909101015261190181615990565b9050611896565b509392505050565b611918613a30565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015611980573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a491906159f4565b50505050565b60006108c982614284565b604080516020808201869052818301859052825180830384018152606090920190925280519101206000906119e981613d0f565b611a0657604051635374b59960e01b815260040160405180910390fd5b6000611a1286336109e3565b905080158015611a295750611a278233611775565b155b15611a505760405163168ab55d60e31b81526004810183905233602482015260440161088a565b60008080611a5d856108cf565b92509250925083158015611a745750620400008216155b15611a955760405163a2a7201360e01b81526004810186905260240161088a565b6000611aa08a6108cf565b92505050611aaf888383614190565b9750611abd8685858b61429a565b60405167ffffffffffffffff8916815286907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b1329060200160405180910390a2509598975050505050505050565b611b12613a30565b611b1c60006142e2565b565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830186905282518083038401815260609092019092528051910120611b728133611775565b611b985760405163168ab55d60e31b81526004810182905233602482015260440161088a565b306001600160a01b03841603611bcc57604051632ca49b0d60e11b81526001600160a01b038416600482015260240161088a565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830187905282518083038401815260609092019092528051910120611c21905b83614332565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038481166024830152604482018690527f000000000000000000000000000000000000000000000000000000000000000016906342842e0e90606401600060405180830381600087803b158015611caa57600080fd5b505af1158015611cbe573d6000803e3d6000fd5b5050505050505050565b6000808686604051611cdb929190615a11565b6040519081900381206331a9108f60e11b82526004820181905291506000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611d4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6f91906159d7565b90506001600160a01b0381163314801590611e17575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015611df1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e1591906159f4565b155b15611e8757604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae6020808301919091528183018590528251808303840181526060830193849052805191012063168ab55d60e31b909252606481019190915233608482015260a40161088a565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152306024830152604482018490527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90606401600060405180830381600087803b158015611f1057600080fd5b505af1158015611f24573d6000803e3d6000fd5b5050604051630a3b53db60e21b8152600481018590523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506328ed4f6c9150604401600060405180830381600087803b158015611f9057600080fd5b505af1158015611fa4573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018590526276a70092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316915063d6e4fa8690602401602060405180830381865afa158015612012573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203691906158e9565b6120409190615918565b925061208988888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff881686886138ca565b505095945050505050565b6001600160a01b03821633036121125760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c660000000000000000000000000000000000000000000000606482015260840161088a565b3360008181526002602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b3360009081526004602052604081205460ff166121ee5760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f604482015267373a3937b63632b960c11b606482015260840161088a565b60008787604051612200929190615a11565b6040519081900381207ffca247ac000000000000000000000000000000000000000000000000000000008252600482018190523060248301526044820187905291507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fca247ac906064016020604051808303816000875af1158015612295573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b991906158e9565b915061230e88888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff86166123086276a70087615918565b886138ca565b509695505050505050565b600080612325846108cf565b50841663ffffffff908116908516149250505092915050565b612346613a30565b6007546001600160a01b0316156124665760075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156123c657600080fd5b505af11580156123da573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561244d57600080fd5b505af1158015612461573d6000803e3d6000fd5b505050505b600780546001600160a01b0319166001600160a01b038316908117909155156125935760075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156124f857600080fd5b505af115801561250c573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561257f57600080fd5b505af11580156114d7573d6000803e3d6000fd5b50565b3360009081526004602052604081205460ff166126065760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f604482015267373a3937b63632b960c11b606482015260840161088a565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301869052825180830384018152606090920190925280519101206000906040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101869052602481018590529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c475abff906044016020604051808303816000875af11580156126e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061270491906158e9565b6040516331a9108f60e11b8152600481018790529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa925050508015612788575060408051601f3d908101601f19168201909252612785918101906159d7565b60015b6127955791506108c99050565b6001600160a01b0381163014158061283f57506040516302571be360e01b81526004810184905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa15801561280f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061283391906159d7565b6001600160a01b031614155b1561284e575091506108c99050565b50600061285e6276a70083615918565b60008481526001602052604090205490915060a081901c6128818583838661429a565b50919695505050505050565b60008661289a8133611775565b6128c05760405163168ab55d60e31b81526004810182905233602482015260440161088a565b600087876040516128d2929190615a11565b6040518091039020905061290d8982604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506129198984613a8a565b6129238386613bc9565b60006129668a858b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613bfc92505050565b90506129748a858888613cc9565b945061297f84613d0f565b612a47576040517f06ab5923000000000000000000000000000000000000000000000000000000008152600481018b9052602481018390523060448201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906306ab5923906064016020604051808303816000875af1158015612a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a3491906158e9565b50612a428482898989614424565b612a8d565b612a8d8a858b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d92508c91508b9050613dff565b5050509695505050505050565b6000612ae0600086868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506144669050565b6007549091506001600160a01b0316612b25576040517f24c1d6d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612b2f8133611775565b612b555760405163168ab55d60e31b81526004810182905233602482015260440161088a565b60008080612b62846108cf565b919450925090506000612b7485610958565b9050612b7f85614525565b600760009054906101000a90046001600160a01b03166001600160a01b0316639198c2768a8a878787878e8e6040518963ffffffff1660e01b8152600401612bce989796959493929190615a4a565b600060405180830381600087803b158015612be857600080fd5b505af1158015612bfc573d6000803e3d6000fd5b50505050505050505050505050565b83612c168133611775565b612c3c5760405163168ab55d60e31b81526004810182905233602482015260440161088a565b84601c6000612c4a836108cf565b5091505063ffffffff8282161615612c785760405163a2a7201360e01b81526004810184905260240161088a565b6040517fcf408823000000000000000000000000000000000000000000000000000000008152600481018990523060248201526001600160a01b03878116604483015267ffffffffffffffff871660648301527f0000000000000000000000000000000000000000000000000000000000000000169063cf40882390608401600060405180830381600087803b158015612d1157600080fd5b505af1158015612d25573d6000803e3d6000fd5b5050506001600160a01b0388169050612d8c576000612d43896108cf565b509150506201ffff1962020000821601612d7b57604051632ca49b0d60e11b81526001600160a01b038916600482015260240161088a565b612d86896000614332565b50611cbe565b6000612d97896119aa565b9050612db981898b60001c6001604051806020016040528060008152506145e7565b505050505050505050565b60408051602080820186905281830185905282518083038401815260609092019092528051910120612df68133611775565b612e1c5760405163168ab55d60e31b81526004810182905233602482015260440161088a565b7f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b528401612e5c5760405163615a470360e01b815260040160405180910390fd5b6001600160a01b0382161580612e7a57506001600160a01b03821630145b15612ea357604051632ca49b0d60e11b81526001600160a01b038316600482015260240161088a565b604080516020808201879052818301869052825180830384018152606090920190925280519101206119a490611c1b565b604080516020808201859052818301849052825180830384018152606090920190925280519101206000906000612f0a82613d0f565b90507f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae8514612f3c5791506108c99050565b6040516331a9108f60e11b8152600481018590527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa925050508015612fbd575060408051601f3d908101601f19168201909252612fba918101906159d7565b60015b612fcc576000925050506108c9565b6001600160a01b0316301492506108c9915050565b612fe9613a30565b6001600160a01b038216600081815260046020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf8791015b60405180910390a25050565b600080613090600087878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506147399050565b9150915060006130d98288888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506144669050565b604080516020808201849052818301879052825180830384018152606090920190925280519101209091506000906000818152600660205260409020909150613123888a83615af9565b507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b5282016131645760405163615a470360e01b815260040160405180910390fd5b6040516302571be360e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa1580156131cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131f091906159d7565b90506001600160a01b0381163314801590613298575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015613272573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061329691906159f4565b155b156132bf5760405163168ab55d60e31b81526004810183905233602482015260440161088a565b6001600160a01b0386161561335157604051630c4b7b8560e11b8152600481018390526001600160a01b0387811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b15801561333857600080fd5b505af115801561334c573d6000803e3d6000fd5b505050505b604051635b0fc9c360e01b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635b0fc9c390604401600060405180830381600087803b1580156133b957600080fd5b505af11580156133cd573d6000803e3d6000fd5b50505050612db9828a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508d93509150819050614424565b6001600160a01b0384166134785760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b0385163314806134b257506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b6135245760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201527f20617070726f7665640000000000000000000000000000000000000000000000606482015260840161088a565b6114d785858585856145e7565b613539613a30565b6001600160a01b0381166135b55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161088a565b612593816142e2565b600081815260066020526040812080548291906135da90615940565b80601f016020809104026020016040519081016040528092919081815260200182805461360690615940565b80156136535780601f1061362857610100808354040283529160200191613653565b820191906000526020600020905b81548152906001019060200180831161363657829003601f168201915b50505050509050805160000361366c5750600092915050565b6000806136798382614739565b9092509050600061368a8483614466565b9050610a738184612ed4565b600080428367ffffffffffffffff1610156136c45761ffff19620100008516016136bf57600094505b600093505b50929391925050565b60006001600160e01b031982167fd9b67a2600000000000000000000000000000000000000000000000000000000148061371757506001600160e01b031982166303a24d0760e21b145b806108c957507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146108c9565b600061375a826119aa565b9050806001600160a01b0316836001600160a01b0316036137e35760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f7200000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b336001600160a01b038216148061381d57506001600160a01b038116600090815260026020908152604080832033845290915290205460ff165b61388f5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161088a565b6109de83836147f0565b6000620200008381161480156109965750426138b86276a70084615bb9565b67ffffffffffffffff16109392505050565b8451602086012060006139247f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae83604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b90506000613967886040518060400160405280600581526020017f036574680000000000000000000000000000000000000000000000000000000081525061485e565b60008381526006602052604090209091506139828282615bda565b50613995828289620300008a1789614424565b6001600160a01b03841615611cbe57604051630c4b7b8560e11b8152600481018390526001600160a01b0385811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b158015613a0e57600080fd5b505af1158015613a22573d6000803e3d6000fd5b505050505050505050505050565b6000546001600160a01b03163314611b1c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161088a565b60008080613a97846108cf565b919450925090504267ffffffffffffffff821610808015613b5b57506001600160a01b0384161580613b5b57506040516302571be360e01b8152600481018690526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b5091906159d7565b6001600160a01b0316145b15613b9a576000613b6b876108cf565b509150506020811615613b945760405163a2a7201360e01b81526004810187905260240161088a565b50613bc1565b62010000831615613bc15760405163a2a7201360e01b81526004810186905260240161088a565b505050505050565b63fffdffff81811763ffffffff1614613bf85760405163a2a7201360e01b81526004810183905260240161088a565b5050565b60606000613ca583600660008881526020019081526020016000208054613c2290615940565b80601f0160208091040260200160405190810160405280929190818152602001828054613c4e90615940565b8015613c9b5780601f10613c7057610100808354040283529160200191613c9b565b820191906000526020600020905b815481529060010190602001808311613c7e57829003601f168201915b505050505061485e565b6000858152600660205260409020909150613cc08282615bda565b50949350505050565b600080613cd5856108cf565b92505050600080613ce88860001c6108cf565b9250925050613cf8878784614155565b613d03858483614190565b98975050505050505050565b600080613d1b836119aa565b6001600160a01b0316141580156108c957506040516302571be360e01b81526004810183905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613d94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613db891906159d7565b6001600160a01b03161492915050565b60008681526006602052604081208054613de7918791613c2290615940565b9050613df68682868686614424565b50505050505050565b60008080613e0c886108cf565b9250925092506000613e3688600660008d81526020019081526020016000208054613c2290615940565b60008a8152600660205260409020805491925090613e5390615940565b9050600003613e76576000898152600660205260409020613e748282615bda565b505b613e85898588861785896141da565b6001600160a01b038716613ea357613e9e896000614332565b610bfc565b610bfc84888b60001c6001604051806020016040528060008152506145e7565b6201ffff1962020000831601613ee357613ee06276a70082615bb9565b90505b428167ffffffffffffffff161015613f605762010000821615613f5b5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b613f85565b6004821615613f855760405163a2a7201360e01b81526004810184905260240161088a565b604082166000036109de575050600090815260036020526040902080546001600160a01b0319169055565b6001600160a01b0384163b15613bc15760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190613ff49089908990889088908890600401615c9a565b6020604051808303816000875af192505050801561402f575060408051601f3d908101601f1916820190925261402c91810190615cec565b60015b6140e45761403b615d09565b806308c379a003614074575061404f615d25565b8061405a5750614076565b8060405162461bcd60e51b815260040161088a9190614dee565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560448201527f526563656976657220696d706c656d656e746572000000000000000000000000606482015260840161088a565b6001600160e01b0319811663bc197c8160e01b14613df65760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161088a565b63ffff0000821615801590600183161590829061416f5750805b156114d75760405163a2a7201360e01b81526004810186905260240161088a565b60008167ffffffffffffffff168467ffffffffffffffff1611156141b2578193505b8267ffffffffffffffff168467ffffffffffffffff1610156141d2578293505b509192915050565b6141e68585858461429a565b60405163ffffffff8416815285907f39873f00c80f4f94b7bd1594aebcf650f003545b74824d57ddf4939e3ff3a34b9060200160405180910390a28167ffffffffffffffff168167ffffffffffffffff1611156114d75760405167ffffffffffffffff8216815285907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b132906020015b60405180910390a25050505050565b600080614290836108cf565b5090949350505050565b6142a48483614907565b60008481526001602052604090206001600160a01b03841663ffffffff60a01b60a085901b16176001600160c01b031960c084901b161790556119a4565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61433d826001612319565b1561435e5760405163a2a7201360e01b81526004810183905260240161088a565b61436782614525565b604051635b0fc9c360e01b8152600481018390526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b1580156143d157600080fd5b505af11580156143e5573d6000803e3d6000fd5b50506040516001600160a01b03841681528492507fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c4915060200161303d565b61443085848484614940565b847f8ce7013e8abebc55c3890a68f5a27c67c3f7efa64e584de5fb22363c606fd340858585856040516142759493929190615daf565b60008060006144758585614739565b9092509050816144e7576001855161448d9190615df7565b84146144db5760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d65000000604482015260640161088a565b50600091506108c99050565b6144f18582614466565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b60008181526001602052604090205460a081901c60c082901c614549838383613696565b600086815260036020908152604080832080546001600160a01b03191690556001909152902063ffffffff60a01b60a083901b166001600160c01b031960c086901b1617905592506145989050565b60408051858152600160208201526000916001600160a01b0386169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a450505050565b60008060006145f5866108cf565b925092509250614606868383613ec3565b8460011480156146275750876001600160a01b0316836001600160a01b0316145b6146865760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b866001600160a01b0316836001600160a01b0316036146a7575050506114d7565b60008681526001602052604090206001600160a01b03881663ffffffff60a01b60a085901b16176001600160c01b031960c084901b1617905560408051878152602081018790526001600160a01b03808a1692908b169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611cbe3389898989896149b4565b6000808351831061478c5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e64730000604482015260640161088a565b60008484815181106147a0576147a061597a565b016020015160f81c905080156147cc576147c5856147bf866001615e0a565b83614ab0565b92506147d1565b600092505b6147db8185615e0a565b6147e6906001615e0a565b9150509250929050565b600081815260036020526040902080546001600160a01b0319166001600160a01b0384169081179091558190614825826119aa565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b606060018351101561489c576040517f280dacb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60ff835111156148da57826040517fe3ba295f00000000000000000000000000000000000000000000000000000000815260040161088a9190614dee565b825183836040516020016148f093929190615e1d565b604051602081830303815290604052905092915050565b61ffff81161580159061491f57506201000181811614155b15613bf85760405163a2a7201360e01b81526004810183905260240161088a565b61494a8483614907565b6000848152600160205260409020546001600160a01b038116156149a85761497185614525565b6040516000815285907fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49060200160405180910390a25b6114d785858585614ad4565b6001600160a01b0384163b15613bc15760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906149f89089908990889088908890600401615e7e565b6020604051808303816000875af1925050508015614a33575060408051601f3d908101601f19168201909252614a3091810190615cec565b60015b614a3f5761403b615d09565b6001600160e01b0319811663f23a6e6160e01b14613df65760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161088a565b8251600090614abf8385615e0a565b1115614aca57600080fd5b5091016020012090565b8360008080614ae2846108cf565b9194509250905063ffff0000821667ffffffffffffffff8087169083161115614b09578195505b428267ffffffffffffffff1610614b1f57958617955b6001600160a01b03841615614b765760405162461bcd60e51b815260206004820152601f60248201527f455243313135353a206d696e74206f66206578697374696e6720746f6b656e00604482015260640161088a565b6001600160a01b038816614bf25760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b306001600160a01b03891603614c705760405162461bcd60e51b815260206004820152603460248201527f455243313135353a206e65774f776e65722063616e6e6f74206265207468652060448201527f4e616d655772617070657220636f6e7472616374000000000000000000000000606482015260840161088a565b60008581526001602052604090206001600160a01b03891663ffffffff60a01b60a08a901b16176001600160c01b031960c089901b1617905560408051868152600160208201526001600160a01b038a169160009133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4612db93360008a886001604051806020016040528060008152506149b4565b6001600160a01b038116811461259357600080fd5b60008060408385031215614d3957600080fd5b8235614d4481614d11565b946020939093013593505050565b600060208284031215614d6457600080fd5b5035919050565b6001600160e01b03198116811461259357600080fd5b600060208284031215614d9357600080fd5b813561099681614d6b565b60005b83811015614db9578181015183820152602001614da1565b50506000910152565b60008151808452614dda816020860160208601614d9e565b601f01601f19169290920160200192915050565b6020815260006109966020830184614dc2565b60008060408385031215614e1457600080fd5b823591506020830135614e2681614d11565b809150509250929050565b803567ffffffffffffffff81168114614e4957600080fd5b919050565b60008060408385031215614e6157600080fd5b82359150614e7160208401614e31565b90509250929050565b60008083601f840112614e8c57600080fd5b50813567ffffffffffffffff811115614ea457600080fd5b602083019150836020828501011115614ebc57600080fd5b9250929050565b600080600080600060808688031215614edb57600080fd5b8535614ee681614d11565b94506020860135614ef681614d11565b935060408601359250606086013567ffffffffffffffff811115614f1957600080fd5b614f2588828901614e7a565b969995985093965092949392505050565b600060208284031215614f4857600080fd5b813561099681614d11565b634e487b7160e01b600052604160045260246000fd5b601f8201601f1916810167ffffffffffffffff81118282101715614f8f57614f8f614f53565b6040525050565b600067ffffffffffffffff821115614fb057614fb0614f53565b50601f01601f191660200190565b600082601f830112614fcf57600080fd5b8135614fda81614f96565b604051614fe78282614f69565b828152856020848701011115614ffc57600080fd5b82602086016020830137600092810160200192909252509392505050565b803563ffffffff81168114614e4957600080fd5b600080600080600080600060e0888a03121561504957600080fd5b87359650602088013567ffffffffffffffff81111561506757600080fd5b6150738a828b01614fbe565b965050604088013561508481614d11565b9450606088013561509481614d11565b93506150a260808901614e31565b92506150b060a0890161501a565b91506150be60c08901614e31565b905092959891949750929550565b600067ffffffffffffffff8211156150e6576150e6614f53565b5060051b60200190565b600082601f83011261510157600080fd5b8135602061510e826150cc565b60405161511b8282614f69565b83815260059390931b850182019282810191508684111561513b57600080fd5b8286015b8481101561230e578035835291830191830161513f565b600080600080600060a0868803121561516e57600080fd5b853561517981614d11565b9450602086013561518981614d11565b9350604086013567ffffffffffffffff808211156151a657600080fd5b6151b289838a016150f0565b945060608801359150808211156151c857600080fd5b6151d489838a016150f0565b935060808801359150808211156151ea57600080fd5b506151f788828901614fbe565b9150509295509295909350565b6000806000806080858703121561521a57600080fd5b84359350602085013592506152316040860161501a565b915061523f60608601614e31565b905092959194509250565b803561ffff81168114614e4957600080fd5b6000806040838503121561526f57600080fd5b82359150614e716020840161524a565b6000806040838503121561529257600080fd5b823567ffffffffffffffff808211156152aa57600080fd5b818501915085601f8301126152be57600080fd5b813560206152cb826150cc565b6040516152d88282614f69565b83815260059390931b85018201928281019150898411156152f857600080fd5b948201945b8386101561531f57853561531081614d11565b825294820194908201906152fd565b9650508601359250508082111561533557600080fd5b506147e6858286016150f0565b600081518084526020808501945080840160005b8381101561537257815187529582019590820190600101615356565b509495945050505050565b6020815260006109966020830184615342565b6000806000606084860312156153a557600080fd5b83356153b081614d11565b925060208401356153c081614d11565b929592945050506040919091013590565b6000806000606084860312156153e657600080fd5b83359250602084013591506153fd60408501614e31565b90509250925092565b60008060006060848603121561541b57600080fd5b83359250602084013561542d81614d11565b9150604084013561543d81614d11565b809150509250925092565b60008060008060006080868803121561546057600080fd5b853567ffffffffffffffff81111561547757600080fd5b61548388828901614e7a565b909650945050602086013561549781614d11565b92506154a56040870161524a565b915060608601356154b581614d11565b809150509295509295909350565b801515811461259357600080fd5b600080604083850312156154e457600080fd5b82356154ef81614d11565b91506020830135614e26816154c3565b60008060008060008060a0878903121561551857600080fd5b863567ffffffffffffffff81111561552f57600080fd5b61553b89828a01614e7a565b909750955050602087013561554f81614d11565b935060408701359250606087013561556681614d11565b91506155746080880161524a565b90509295509295509295565b6000806040838503121561559357600080fd5b82359150614e716020840161501a565b600080604083850312156155b657600080fd5b50508035926020909101359150565b60008060008060008060a087890312156155de57600080fd5b86359550602087013567ffffffffffffffff8111156155fc57600080fd5b61560889828a01614e7a565b909650945050604087013561561c81614d11565b925061562a6060880161501a565b915061557460808801614e31565b6000806000806040858703121561564e57600080fd5b843567ffffffffffffffff8082111561566657600080fd5b61567288838901614e7a565b9096509450602087013591508082111561568b57600080fd5b5061569887828801614e7a565b95989497509550505050565b600080600080608085870312156156ba57600080fd5b8435935060208501356156cc81614d11565b9250604085013561523181614d11565b6000806000606084860312156156f157600080fd5b8335925060208401359150604084013561543d81614d11565b6000806040838503121561571d57600080fd5b823561572881614d11565b91506020830135614e2681614d11565b6000806000806060858703121561574e57600080fd5b843567ffffffffffffffff81111561576557600080fd5b61577187828801614e7a565b909550935050602085013561578581614d11565b9150604085013561579581614d11565b939692955090935050565b600080600080600060a086880312156157b857600080fd5b85356157c381614d11565b945060208601356157d381614d11565b93506040860135925060608601359150608086013567ffffffffffffffff8111156157fd57600080fd5b6151f788828901614fbe565b60006020828403121561581b57600080fd5b815167ffffffffffffffff81111561583257600080fd5b8201601f8101841361584357600080fd5b805161584e81614f96565b60405161585b8282614f69565b82815286602084860101111561587057600080fd5b610a73836020830160208701614d9e565b6000806000806080858703121561589757600080fd5b843567ffffffffffffffff8111156158ae57600080fd5b6158ba87828801614fbe565b94505060208501356158cb81614d11565b92506158d96040860161524a565b9150606085013561579581614d11565b6000602082840312156158fb57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b67ffffffffffffffff81811683821601908082111561593957615939615902565b5092915050565b600181811c9082168061595457607f821691505b60208210810361597457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b6000600182016159a2576159a2615902565b5060010190565b6040815260006159bc6040830185615342565b82810360208401526159ce8185615342565b95945050505050565b6000602082840312156159e957600080fd5b815161099681614d11565b600060208284031215615a0657600080fd5b8151610996816154c3565b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60c081526000615a5e60c083018a8c615a21565b6001600160a01b03898116602085015263ffffffff8916604085015267ffffffffffffffff881660608501528616608084015282810360a0840152615aa4818587615a21565b9b9a5050505050505050505050565b601f8211156109de57600081815260208120601f850160051c81016020861015615ada5750805b601f850160051c820191505b81811015613bc157828155600101615ae6565b67ffffffffffffffff831115615b1157615b11614f53565b615b2583615b1f8354615940565b83615ab3565b6000601f841160018114615b595760008515615b415750838201355b600019600387901b1c1916600186901b1783556114d7565b600083815260209020601f19861690835b82811015615b8a5786850135825560209485019460019092019101615b6a565b5086821015615ba75760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b67ffffffffffffffff82811682821603908082111561593957615939615902565b815167ffffffffffffffff811115615bf457615bf4614f53565b615c0881615c028454615940565b84615ab3565b602080601f831160018114615c3d5760008415615c255750858301515b600019600386901b1c1916600185901b178555613bc1565b600085815260208120601f198616915b82811015615c6c57888601518255948401946001909101908401615c4d565b5085821015615c8a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006001600160a01b03808816835280871660208401525060a06040830152615cc660a0830186615342565b8281036060840152615cd88186615342565b90508281036080840152613d038185614dc2565b600060208284031215615cfe57600080fd5b815161099681614d6b565b600060033d1115615d225760046000803e5060005160e01c5b90565b600060443d1015615d335790565b6040516003193d81016004833e81513d67ffffffffffffffff8160248401118184111715615d6357505050505090565b8285019150815181811115615d7b5750505050505090565b843d8701016020828501011115615d955750505050505090565b615da460208286010187614f69565b509095945050505050565b608081526000615dc26080830187614dc2565b6001600160a01b039590951660208301525063ffffffff92909216604083015267ffffffffffffffff16606090910152919050565b818103818111156108c9576108c9615902565b808201808211156108c9576108c9615902565b7fff000000000000000000000000000000000000000000000000000000000000008460f81b16815260008351615e5a816001850160208801614d9e565b835190830190615e71816001840160208801614d9e565b0160010195945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152615eb660a0830184614dc2565b97965050505050505056fea2646970667358221220c4c2207f520e30264918f3720d95620e1049bac8262a757e0d0842a9f93d907364736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061031f5760003560e01c80636352211e116101a7578063c93ab3fd116100ee578063e985e9c511610097578063f242432a11610071578063f242432a146107d7578063f2fde38b146107ea578063fd0cd0d9146107fd57600080fd5b8063e985e9c514610768578063eb8ae530146107a4578063ed70554d146107b757600080fd5b8063d9a50c12116100c8578063d9a50c121461071f578063da8c229e14610732578063e0dba60f1461075557600080fd5b8063c93ab3fd146106e6578063cf408823146106f9578063d8c9921a1461070c57600080fd5b8063a22cb46511610150578063b6bcad261161012a578063b6bcad26146106ad578063c475abff146106c0578063c658e086146106d357600080fd5b8063a22cb46514610674578063a401498214610687578063adf4960a1461069a57600080fd5b80638b4dfa75116101815780638b4dfa751461063d5780638cf8b41e146106505780638da5cb5b1461066357600080fd5b80636352211e146105f65780636e5d6ad214610609578063715018a61461063557600080fd5b80631f4e15041161026b5780633f15457f116102145780634e1273f4116101ee5780634e1273f4146105b057806353095467146105d05780635d3590d5146105e357600080fd5b80633f15457f1461054e578063402906fc1461057557806341415eab1461059d57600080fd5b80632b20e397116102455780632b20e397146105015780632eb2c2d61461052857806333c69ea91461053b57600080fd5b80631f4e1504146104c857806320c38e2b146104db57806324c1af44146104ee57600080fd5b80630e4cd725116102cd578063150b7a02116102a7578063150b7a02146104765780631534e177146104a25780631896f70a146104b557600080fd5b80630e4cd7251461043d5780630e89341c1461045057806314ab90381461046357600080fd5b806306fdde03116102fe57806306fdde03146103b4578063081812fc146103fd578063095ea7b31461042857600080fd5b8062fdd58e146103245780630178fe3f1461034a57806301ffc9a714610391575b600080fd5b610337610332366004614d26565b610810565b6040519081526020015b60405180910390f35b61035d610358366004614d52565b6108cf565b604080516001600160a01b03909416845263ffffffff909216602084015267ffffffffffffffff1690820152606001610341565b6103a461039f366004614d81565b6108ff565b6040519015158152602001610341565b6103f06040518060400160405280600b81526020017f4e616d655772617070657200000000000000000000000000000000000000000081525081565b6040516103419190614dee565b61041061040b366004614d52565b610958565b6040516001600160a01b039091168152602001610341565b61043b610436366004614d26565b61099d565b005b6103a461044b366004614e01565b6109e3565b6103f061045e366004614d52565b610a7d565b61043b610471366004614e4e565b610aef565b610489610484366004614ec3565b610c08565b6040516001600160e01b03199091168152602001610341565b61043b6104b0366004614f36565b610e1a565b61043b6104c3366004614e01565b610e44565b600754610410906001600160a01b031681565b6103f06104e9366004614d52565b610f06565b6103376104fc36600461502e565b610fa0565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b61043b610536366004615156565b6111b4565b61043b610549366004615204565b6114de565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b61058861058336600461525c565b6116d3565b60405163ffffffff9091168152602001610341565b6103a46105ab366004614e01565b611775565b6105c36105be36600461527f565b6117d2565b604051610341919061537d565b600554610410906001600160a01b031681565b61043b6105f1366004615390565b611910565b610410610604366004614d52565b6119aa565b61061c6106173660046153d1565b6119b5565b60405167ffffffffffffffff9091168152602001610341565b61043b611b0a565b61043b61064b366004615406565b611b1e565b61061c61065e366004615448565b611cc8565b6000546001600160a01b0316610410565b61043b6106823660046154d1565b612094565b6103376106953660046154ff565b61217e565b6103a46106a8366004615580565b612319565b61043b6106bb366004614f36565b61233e565b6103376106ce3660046155a3565b612596565b6103376106e13660046155c5565b61288d565b61043b6106f4366004615638565b612a9a565b61043b6107073660046156a4565b612c0b565b61043b61071a3660046156dc565b612dc4565b6103a461072d3660046155a3565b612ed4565b6103a4610740366004614f36565b60046020526000908152604090205460ff1681565b61043b6107633660046154d1565b612fe1565b6103a461077636600461570a565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b61043b6107b2366004615738565b613049565b6103376107c5366004614d52565b60016020526000908152604090205481565b61043b6107e53660046157a0565b613414565b61043b6107f8366004614f36565b613531565b6103a461080b366004614d52565b6135be565b60006001600160a01b0383166108935760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084015b60405180910390fd5b600061089e836119aa565b9050836001600160a01b0316816001600160a01b0316036108c35760019150506108c9565b60009150505b92915050565b60008181526001602052604090205460a081901c60c082901c6108f3838383613696565b90959094509092509050565b60006001600160e01b031982167fd82c42d800000000000000000000000000000000000000000000000000000000148061094957506001600160e01b03198216630a85bd0160e11b145b806108c957506108c9826136cd565b600080610964836119aa565b90506001600160a01b03811661097d5750600092915050565b6000838152600360205260409020546001600160a01b03165b9392505050565b60006109a8826108cf565b50915050603f1960408216016109d45760405163a2a7201360e01b81526004810183905260240161088a565b6109de838361374f565b505050565b60008080806109f1866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a3c57506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff165b80610a6057506001600160a01b038516610a5587610958565b6001600160a01b0316145b8015610a735750610a718282613899565b155b9695505050505050565b6005546040516303a24d0760e21b8152600481018390526060916001600160a01b031690630e89341c90602401600060405180830381865afa158015610ac7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108c99190810190615809565b81610afa8133611775565b610b205760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260106000610b2e836108cf565b5091505063ffffffff8282161615610b5c5760405163a2a7201360e01b81526004810184905260240161088a565b6040517f14ab90380000000000000000000000000000000000000000000000000000000081526004810187905267ffffffffffffffff861660248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906314ab9038906044015b600060405180830381600087803b158015610be857600080fd5b505af1158015610bfc573d6000803e3d6000fd5b50505050505050505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610c6c576040517f1931a53800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080610c7d86880188615881565b83516020850120939750919550935091508890808214610cd3576040517fc65c3ccc000000000000000000000000000000000000000000000000000000008152600481018290526024810183905260440161088a565b604051630a3b53db60e21b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906328ed4f6c90604401600060405180830381600087803b158015610d3b57600080fd5b505af1158015610d4f573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018d9052600092506276a70091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d6e4fa8690602401602060405180830381865afa158015610dc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de491906158e9565b610dee9190615918565b9050610e0187878761ffff1684886138ca565b50630a85bd0160e11b9c9b505050505050505050505050565b610e22613a30565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b81610e4f8133611775565b610e755760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260086000610e83836108cf565b5091505063ffffffff8282161615610eb15760405163a2a7201360e01b81526004810184905260240161088a565b604051630c4b7b8560e11b8152600481018790526001600160a01b0386811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401610bce565b60066020526000908152604090208054610f1f90615940565b80601f0160208091040260200160405190810160405280929190818152602001828054610f4b90615940565b8015610f985780601f10610f6d57610100808354040283529160200191610f98565b820191906000526020600020905b815481529060010190602001808311610f7b57829003601f168201915b505050505081565b600087610fad8133611775565b610fd35760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8751602089012061100b8a82604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506110178a84613a8a565b6110218386613bc9565b61102c8a848b613bfc565b506110398a848787613cc9565b935061104483613d0f565b6110fa576040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156110cf57600080fd5b505af11580156110e3573d6000803e3d6000fd5b505050506110f58a848b8b8989613dc8565b6111a7565b6040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561118157600080fd5b505af1158015611195573d6000803e3d6000fd5b505050506111a78a848b8b8989613dff565b5050979650505050505050565b815183511461122b5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060448201527f6d69736d61746368000000000000000000000000000000000000000000000000606482015260840161088a565b6001600160a01b03841661128f5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b0385163314806112c957506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b61133b5760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000606482015260840161088a565b60005b835181101561147157600084828151811061135b5761135b61597a565b6020026020010151905060008483815181106113795761137961597a565b602002602001015190506000806000611391856108cf565b9250925092506113a2858383613ec3565b8360011480156113c357508a6001600160a01b0316836001600160a01b0316145b6114225760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b60008581526001602052604090206001600160a01b038b1663ffffffff60a01b60a085901b16176001600160c01b031960c084901b1617905550505050508061146a90615990565b905061133e565b50836001600160a01b0316856001600160a01b0316336001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516114c19291906159a9565b60405180910390a46114d7338686868686613fb0565b5050505050565b604080516020808201879052818301869052825180830384018152606090920190925280519101206115108184613bc9565b6000808061151d846108cf565b919450925090506001600160a01b03831615806115cc57506040516302571be360e01b81526004810185905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa15801561159c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c091906159d7565b6001600160a01b031614155b156115ea57604051635374b59960e01b815260040160405180910390fd5b6000806115f68a6108cf565b90935091508a90506116375761160c8633611775565b6116325760405163168ab55d60e31b81526004810187905233602482015260440161088a565b611667565b6116418a33611775565b6116675760405163168ab55d60e31b8152600481018b905233602482015260440161088a565b611672868984614155565b61167d878483614190565b9650620100008416158015906116a157508363ffffffff1688851763ffffffff1614155b156116c25760405163a2a7201360e01b81526004810187905260240161088a565b96831796610bfc86868a868b6141da565b6000826116e08133611775565b6117065760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8360026000611714836108cf565b5091505063ffffffff82821616156117425760405163a2a7201360e01b81526004810184905260240161088a565b6000808061174f8a6108cf565b9250925092506117688a84848c61ffff161784856141da565b5098975050505050505050565b6000808080611783866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a6057506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff16610a60565b6060815183511461184b5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d617463680000000000000000000000000000000000000000000000606482015260840161088a565b6000835167ffffffffffffffff81111561186757611867614f53565b604051908082528060200260200182016040528015611890578160200160208202803683370190505b50905060005b8451811015611908576118db8582815181106118b4576118b461597a565b60200260200101518583815181106118ce576118ce61597a565b6020026020010151610810565b8282815181106118ed576118ed61597a565b602090810291909101015261190181615990565b9050611896565b509392505050565b611918613a30565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015611980573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a491906159f4565b50505050565b60006108c982614284565b604080516020808201869052818301859052825180830384018152606090920190925280519101206000906119e981613d0f565b611a0657604051635374b59960e01b815260040160405180910390fd5b6000611a1286336109e3565b905080158015611a295750611a278233611775565b155b15611a505760405163168ab55d60e31b81526004810183905233602482015260440161088a565b60008080611a5d856108cf565b92509250925083158015611a745750620400008216155b15611a955760405163a2a7201360e01b81526004810186905260240161088a565b6000611aa08a6108cf565b92505050611aaf888383614190565b9750611abd8685858b61429a565b60405167ffffffffffffffff8916815286907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b1329060200160405180910390a2509598975050505050505050565b611b12613a30565b611b1c60006142e2565b565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830186905282518083038401815260609092019092528051910120611b728133611775565b611b985760405163168ab55d60e31b81526004810182905233602482015260440161088a565b306001600160a01b03841603611bcc57604051632ca49b0d60e11b81526001600160a01b038416600482015260240161088a565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830187905282518083038401815260609092019092528051910120611c21905b83614332565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038481166024830152604482018690527f000000000000000000000000000000000000000000000000000000000000000016906342842e0e90606401600060405180830381600087803b158015611caa57600080fd5b505af1158015611cbe573d6000803e3d6000fd5b5050505050505050565b6000808686604051611cdb929190615a11565b6040519081900381206331a9108f60e11b82526004820181905291506000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611d4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6f91906159d7565b90506001600160a01b0381163314801590611e17575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015611df1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e1591906159f4565b155b15611e8757604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae6020808301919091528183018590528251808303840181526060830193849052805191012063168ab55d60e31b909252606481019190915233608482015260a40161088a565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152306024830152604482018490527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90606401600060405180830381600087803b158015611f1057600080fd5b505af1158015611f24573d6000803e3d6000fd5b5050604051630a3b53db60e21b8152600481018590523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506328ed4f6c9150604401600060405180830381600087803b158015611f9057600080fd5b505af1158015611fa4573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018590526276a70092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316915063d6e4fa8690602401602060405180830381865afa158015612012573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203691906158e9565b6120409190615918565b925061208988888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff881686886138ca565b505095945050505050565b6001600160a01b03821633036121125760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c660000000000000000000000000000000000000000000000606482015260840161088a565b3360008181526002602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b3360009081526004602052604081205460ff166121ee5760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f604482015267373a3937b63632b960c11b606482015260840161088a565b60008787604051612200929190615a11565b6040519081900381207ffca247ac000000000000000000000000000000000000000000000000000000008252600482018190523060248301526044820187905291507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fca247ac906064016020604051808303816000875af1158015612295573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b991906158e9565b915061230e88888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff86166123086276a70087615918565b886138ca565b509695505050505050565b600080612325846108cf565b50841663ffffffff908116908516149250505092915050565b612346613a30565b6007546001600160a01b0316156124665760075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156123c657600080fd5b505af11580156123da573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561244d57600080fd5b505af1158015612461573d6000803e3d6000fd5b505050505b600780546001600160a01b0319166001600160a01b038316908117909155156125935760075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156124f857600080fd5b505af115801561250c573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561257f57600080fd5b505af11580156114d7573d6000803e3d6000fd5b50565b3360009081526004602052604081205460ff166126065760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f604482015267373a3937b63632b960c11b606482015260840161088a565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301869052825180830384018152606090920190925280519101206000906040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101869052602481018590529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c475abff906044016020604051808303816000875af11580156126e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061270491906158e9565b6040516331a9108f60e11b8152600481018790529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa925050508015612788575060408051601f3d908101601f19168201909252612785918101906159d7565b60015b6127955791506108c99050565b6001600160a01b0381163014158061283f57506040516302571be360e01b81526004810184905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa15801561280f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061283391906159d7565b6001600160a01b031614155b1561284e575091506108c99050565b50600061285e6276a70083615918565b60008481526001602052604090205490915060a081901c6128818583838661429a565b50919695505050505050565b60008661289a8133611775565b6128c05760405163168ab55d60e31b81526004810182905233602482015260440161088a565b600087876040516128d2929190615a11565b6040518091039020905061290d8982604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506129198984613a8a565b6129238386613bc9565b60006129668a858b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613bfc92505050565b90506129748a858888613cc9565b945061297f84613d0f565b612a47576040517f06ab5923000000000000000000000000000000000000000000000000000000008152600481018b9052602481018390523060448201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906306ab5923906064016020604051808303816000875af1158015612a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a3491906158e9565b50612a428482898989614424565b612a8d565b612a8d8a858b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d92508c91508b9050613dff565b5050509695505050505050565b6000612ae0600086868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506144669050565b6007549091506001600160a01b0316612b25576040517f24c1d6d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612b2f8133611775565b612b555760405163168ab55d60e31b81526004810182905233602482015260440161088a565b60008080612b62846108cf565b919450925090506000612b7485610958565b9050612b7f85614525565b600760009054906101000a90046001600160a01b03166001600160a01b0316639198c2768a8a878787878e8e6040518963ffffffff1660e01b8152600401612bce989796959493929190615a4a565b600060405180830381600087803b158015612be857600080fd5b505af1158015612bfc573d6000803e3d6000fd5b50505050505050505050505050565b83612c168133611775565b612c3c5760405163168ab55d60e31b81526004810182905233602482015260440161088a565b84601c6000612c4a836108cf565b5091505063ffffffff8282161615612c785760405163a2a7201360e01b81526004810184905260240161088a565b6040517fcf408823000000000000000000000000000000000000000000000000000000008152600481018990523060248201526001600160a01b03878116604483015267ffffffffffffffff871660648301527f0000000000000000000000000000000000000000000000000000000000000000169063cf40882390608401600060405180830381600087803b158015612d1157600080fd5b505af1158015612d25573d6000803e3d6000fd5b5050506001600160a01b0388169050612d8c576000612d43896108cf565b509150506201ffff1962020000821601612d7b57604051632ca49b0d60e11b81526001600160a01b038916600482015260240161088a565b612d86896000614332565b50611cbe565b6000612d97896119aa565b9050612db981898b60001c6001604051806020016040528060008152506145e7565b505050505050505050565b60408051602080820186905281830185905282518083038401815260609092019092528051910120612df68133611775565b612e1c5760405163168ab55d60e31b81526004810182905233602482015260440161088a565b7f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b528401612e5c5760405163615a470360e01b815260040160405180910390fd5b6001600160a01b0382161580612e7a57506001600160a01b03821630145b15612ea357604051632ca49b0d60e11b81526001600160a01b038316600482015260240161088a565b604080516020808201879052818301869052825180830384018152606090920190925280519101206119a490611c1b565b604080516020808201859052818301849052825180830384018152606090920190925280519101206000906000612f0a82613d0f565b90507f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae8514612f3c5791506108c99050565b6040516331a9108f60e11b8152600481018590527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa925050508015612fbd575060408051601f3d908101601f19168201909252612fba918101906159d7565b60015b612fcc576000925050506108c9565b6001600160a01b0316301492506108c9915050565b612fe9613a30565b6001600160a01b038216600081815260046020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf8791015b60405180910390a25050565b600080613090600087878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506147399050565b9150915060006130d98288888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506144669050565b604080516020808201849052818301879052825180830384018152606090920190925280519101209091506000906000818152600660205260409020909150613123888a83615af9565b507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b5282016131645760405163615a470360e01b815260040160405180910390fd5b6040516302571be360e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa1580156131cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131f091906159d7565b90506001600160a01b0381163314801590613298575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015613272573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061329691906159f4565b155b156132bf5760405163168ab55d60e31b81526004810183905233602482015260440161088a565b6001600160a01b0386161561335157604051630c4b7b8560e11b8152600481018390526001600160a01b0387811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b15801561333857600080fd5b505af115801561334c573d6000803e3d6000fd5b505050505b604051635b0fc9c360e01b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635b0fc9c390604401600060405180830381600087803b1580156133b957600080fd5b505af11580156133cd573d6000803e3d6000fd5b50505050612db9828a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508d93509150819050614424565b6001600160a01b0384166134785760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b0385163314806134b257506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b6135245760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201527f20617070726f7665640000000000000000000000000000000000000000000000606482015260840161088a565b6114d785858585856145e7565b613539613a30565b6001600160a01b0381166135b55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161088a565b612593816142e2565b600081815260066020526040812080548291906135da90615940565b80601f016020809104026020016040519081016040528092919081815260200182805461360690615940565b80156136535780601f1061362857610100808354040283529160200191613653565b820191906000526020600020905b81548152906001019060200180831161363657829003601f168201915b50505050509050805160000361366c5750600092915050565b6000806136798382614739565b9092509050600061368a8483614466565b9050610a738184612ed4565b600080428367ffffffffffffffff1610156136c45761ffff19620100008516016136bf57600094505b600093505b50929391925050565b60006001600160e01b031982167fd9b67a2600000000000000000000000000000000000000000000000000000000148061371757506001600160e01b031982166303a24d0760e21b145b806108c957507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146108c9565b600061375a826119aa565b9050806001600160a01b0316836001600160a01b0316036137e35760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f7200000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b336001600160a01b038216148061381d57506001600160a01b038116600090815260026020908152604080832033845290915290205460ff165b61388f5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161088a565b6109de83836147f0565b6000620200008381161480156109965750426138b86276a70084615bb9565b67ffffffffffffffff16109392505050565b8451602086012060006139247f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae83604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b90506000613967886040518060400160405280600581526020017f036574680000000000000000000000000000000000000000000000000000000081525061485e565b60008381526006602052604090209091506139828282615bda565b50613995828289620300008a1789614424565b6001600160a01b03841615611cbe57604051630c4b7b8560e11b8152600481018390526001600160a01b0385811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b158015613a0e57600080fd5b505af1158015613a22573d6000803e3d6000fd5b505050505050505050505050565b6000546001600160a01b03163314611b1c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161088a565b60008080613a97846108cf565b919450925090504267ffffffffffffffff821610808015613b5b57506001600160a01b0384161580613b5b57506040516302571be360e01b8152600481018690526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b5091906159d7565b6001600160a01b0316145b15613b9a576000613b6b876108cf565b509150506020811615613b945760405163a2a7201360e01b81526004810187905260240161088a565b50613bc1565b62010000831615613bc15760405163a2a7201360e01b81526004810186905260240161088a565b505050505050565b63fffdffff81811763ffffffff1614613bf85760405163a2a7201360e01b81526004810183905260240161088a565b5050565b60606000613ca583600660008881526020019081526020016000208054613c2290615940565b80601f0160208091040260200160405190810160405280929190818152602001828054613c4e90615940565b8015613c9b5780601f10613c7057610100808354040283529160200191613c9b565b820191906000526020600020905b815481529060010190602001808311613c7e57829003601f168201915b505050505061485e565b6000858152600660205260409020909150613cc08282615bda565b50949350505050565b600080613cd5856108cf565b92505050600080613ce88860001c6108cf565b9250925050613cf8878784614155565b613d03858483614190565b98975050505050505050565b600080613d1b836119aa565b6001600160a01b0316141580156108c957506040516302571be360e01b81526004810183905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613d94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613db891906159d7565b6001600160a01b03161492915050565b60008681526006602052604081208054613de7918791613c2290615940565b9050613df68682868686614424565b50505050505050565b60008080613e0c886108cf565b9250925092506000613e3688600660008d81526020019081526020016000208054613c2290615940565b60008a8152600660205260409020805491925090613e5390615940565b9050600003613e76576000898152600660205260409020613e748282615bda565b505b613e85898588861785896141da565b6001600160a01b038716613ea357613e9e896000614332565b610bfc565b610bfc84888b60001c6001604051806020016040528060008152506145e7565b6201ffff1962020000831601613ee357613ee06276a70082615bb9565b90505b428167ffffffffffffffff161015613f605762010000821615613f5b5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b613f85565b6004821615613f855760405163a2a7201360e01b81526004810184905260240161088a565b604082166000036109de575050600090815260036020526040902080546001600160a01b0319169055565b6001600160a01b0384163b15613bc15760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190613ff49089908990889088908890600401615c9a565b6020604051808303816000875af192505050801561402f575060408051601f3d908101601f1916820190925261402c91810190615cec565b60015b6140e45761403b615d09565b806308c379a003614074575061404f615d25565b8061405a5750614076565b8060405162461bcd60e51b815260040161088a9190614dee565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560448201527f526563656976657220696d706c656d656e746572000000000000000000000000606482015260840161088a565b6001600160e01b0319811663bc197c8160e01b14613df65760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161088a565b63ffff0000821615801590600183161590829061416f5750805b156114d75760405163a2a7201360e01b81526004810186905260240161088a565b60008167ffffffffffffffff168467ffffffffffffffff1611156141b2578193505b8267ffffffffffffffff168467ffffffffffffffff1610156141d2578293505b509192915050565b6141e68585858461429a565b60405163ffffffff8416815285907f39873f00c80f4f94b7bd1594aebcf650f003545b74824d57ddf4939e3ff3a34b9060200160405180910390a28167ffffffffffffffff168167ffffffffffffffff1611156114d75760405167ffffffffffffffff8216815285907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b132906020015b60405180910390a25050505050565b600080614290836108cf565b5090949350505050565b6142a48483614907565b60008481526001602052604090206001600160a01b03841663ffffffff60a01b60a085901b16176001600160c01b031960c084901b161790556119a4565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61433d826001612319565b1561435e5760405163a2a7201360e01b81526004810183905260240161088a565b61436782614525565b604051635b0fc9c360e01b8152600481018390526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b1580156143d157600080fd5b505af11580156143e5573d6000803e3d6000fd5b50506040516001600160a01b03841681528492507fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c4915060200161303d565b61443085848484614940565b847f8ce7013e8abebc55c3890a68f5a27c67c3f7efa64e584de5fb22363c606fd340858585856040516142759493929190615daf565b60008060006144758585614739565b9092509050816144e7576001855161448d9190615df7565b84146144db5760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d65000000604482015260640161088a565b50600091506108c99050565b6144f18582614466565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b60008181526001602052604090205460a081901c60c082901c614549838383613696565b600086815260036020908152604080832080546001600160a01b03191690556001909152902063ffffffff60a01b60a083901b166001600160c01b031960c086901b1617905592506145989050565b60408051858152600160208201526000916001600160a01b0386169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a450505050565b60008060006145f5866108cf565b925092509250614606868383613ec3565b8460011480156146275750876001600160a01b0316836001600160a01b0316145b6146865760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b866001600160a01b0316836001600160a01b0316036146a7575050506114d7565b60008681526001602052604090206001600160a01b03881663ffffffff60a01b60a085901b16176001600160c01b031960c084901b1617905560408051878152602081018790526001600160a01b03808a1692908b169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611cbe3389898989896149b4565b6000808351831061478c5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e64730000604482015260640161088a565b60008484815181106147a0576147a061597a565b016020015160f81c905080156147cc576147c5856147bf866001615e0a565b83614ab0565b92506147d1565b600092505b6147db8185615e0a565b6147e6906001615e0a565b9150509250929050565b600081815260036020526040902080546001600160a01b0319166001600160a01b0384169081179091558190614825826119aa565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b606060018351101561489c576040517f280dacb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60ff835111156148da57826040517fe3ba295f00000000000000000000000000000000000000000000000000000000815260040161088a9190614dee565b825183836040516020016148f093929190615e1d565b604051602081830303815290604052905092915050565b61ffff81161580159061491f57506201000181811614155b15613bf85760405163a2a7201360e01b81526004810183905260240161088a565b61494a8483614907565b6000848152600160205260409020546001600160a01b038116156149a85761497185614525565b6040516000815285907fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49060200160405180910390a25b6114d785858585614ad4565b6001600160a01b0384163b15613bc15760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906149f89089908990889088908890600401615e7e565b6020604051808303816000875af1925050508015614a33575060408051601f3d908101601f19168201909252614a3091810190615cec565b60015b614a3f5761403b615d09565b6001600160e01b0319811663f23a6e6160e01b14613df65760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161088a565b8251600090614abf8385615e0a565b1115614aca57600080fd5b5091016020012090565b8360008080614ae2846108cf565b9194509250905063ffff0000821667ffffffffffffffff8087169083161115614b09578195505b428267ffffffffffffffff1610614b1f57958617955b6001600160a01b03841615614b765760405162461bcd60e51b815260206004820152601f60248201527f455243313135353a206d696e74206f66206578697374696e6720746f6b656e00604482015260640161088a565b6001600160a01b038816614bf25760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b306001600160a01b03891603614c705760405162461bcd60e51b815260206004820152603460248201527f455243313135353a206e65774f776e65722063616e6e6f74206265207468652060448201527f4e616d655772617070657220636f6e7472616374000000000000000000000000606482015260840161088a565b60008581526001602052604090206001600160a01b03891663ffffffff60a01b60a08a901b16176001600160c01b031960c089901b1617905560408051868152600160208201526001600160a01b038a169160009133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4612db93360008a886001604051806020016040528060008152506149b4565b6001600160a01b038116811461259357600080fd5b60008060408385031215614d3957600080fd5b8235614d4481614d11565b946020939093013593505050565b600060208284031215614d6457600080fd5b5035919050565b6001600160e01b03198116811461259357600080fd5b600060208284031215614d9357600080fd5b813561099681614d6b565b60005b83811015614db9578181015183820152602001614da1565b50506000910152565b60008151808452614dda816020860160208601614d9e565b601f01601f19169290920160200192915050565b6020815260006109966020830184614dc2565b60008060408385031215614e1457600080fd5b823591506020830135614e2681614d11565b809150509250929050565b803567ffffffffffffffff81168114614e4957600080fd5b919050565b60008060408385031215614e6157600080fd5b82359150614e7160208401614e31565b90509250929050565b60008083601f840112614e8c57600080fd5b50813567ffffffffffffffff811115614ea457600080fd5b602083019150836020828501011115614ebc57600080fd5b9250929050565b600080600080600060808688031215614edb57600080fd5b8535614ee681614d11565b94506020860135614ef681614d11565b935060408601359250606086013567ffffffffffffffff811115614f1957600080fd5b614f2588828901614e7a565b969995985093965092949392505050565b600060208284031215614f4857600080fd5b813561099681614d11565b634e487b7160e01b600052604160045260246000fd5b601f8201601f1916810167ffffffffffffffff81118282101715614f8f57614f8f614f53565b6040525050565b600067ffffffffffffffff821115614fb057614fb0614f53565b50601f01601f191660200190565b600082601f830112614fcf57600080fd5b8135614fda81614f96565b604051614fe78282614f69565b828152856020848701011115614ffc57600080fd5b82602086016020830137600092810160200192909252509392505050565b803563ffffffff81168114614e4957600080fd5b600080600080600080600060e0888a03121561504957600080fd5b87359650602088013567ffffffffffffffff81111561506757600080fd5b6150738a828b01614fbe565b965050604088013561508481614d11565b9450606088013561509481614d11565b93506150a260808901614e31565b92506150b060a0890161501a565b91506150be60c08901614e31565b905092959891949750929550565b600067ffffffffffffffff8211156150e6576150e6614f53565b5060051b60200190565b600082601f83011261510157600080fd5b8135602061510e826150cc565b60405161511b8282614f69565b83815260059390931b850182019282810191508684111561513b57600080fd5b8286015b8481101561230e578035835291830191830161513f565b600080600080600060a0868803121561516e57600080fd5b853561517981614d11565b9450602086013561518981614d11565b9350604086013567ffffffffffffffff808211156151a657600080fd5b6151b289838a016150f0565b945060608801359150808211156151c857600080fd5b6151d489838a016150f0565b935060808801359150808211156151ea57600080fd5b506151f788828901614fbe565b9150509295509295909350565b6000806000806080858703121561521a57600080fd5b84359350602085013592506152316040860161501a565b915061523f60608601614e31565b905092959194509250565b803561ffff81168114614e4957600080fd5b6000806040838503121561526f57600080fd5b82359150614e716020840161524a565b6000806040838503121561529257600080fd5b823567ffffffffffffffff808211156152aa57600080fd5b818501915085601f8301126152be57600080fd5b813560206152cb826150cc565b6040516152d88282614f69565b83815260059390931b85018201928281019150898411156152f857600080fd5b948201945b8386101561531f57853561531081614d11565b825294820194908201906152fd565b9650508601359250508082111561533557600080fd5b506147e6858286016150f0565b600081518084526020808501945080840160005b8381101561537257815187529582019590820190600101615356565b509495945050505050565b6020815260006109966020830184615342565b6000806000606084860312156153a557600080fd5b83356153b081614d11565b925060208401356153c081614d11565b929592945050506040919091013590565b6000806000606084860312156153e657600080fd5b83359250602084013591506153fd60408501614e31565b90509250925092565b60008060006060848603121561541b57600080fd5b83359250602084013561542d81614d11565b9150604084013561543d81614d11565b809150509250925092565b60008060008060006080868803121561546057600080fd5b853567ffffffffffffffff81111561547757600080fd5b61548388828901614e7a565b909650945050602086013561549781614d11565b92506154a56040870161524a565b915060608601356154b581614d11565b809150509295509295909350565b801515811461259357600080fd5b600080604083850312156154e457600080fd5b82356154ef81614d11565b91506020830135614e26816154c3565b60008060008060008060a0878903121561551857600080fd5b863567ffffffffffffffff81111561552f57600080fd5b61553b89828a01614e7a565b909750955050602087013561554f81614d11565b935060408701359250606087013561556681614d11565b91506155746080880161524a565b90509295509295509295565b6000806040838503121561559357600080fd5b82359150614e716020840161501a565b600080604083850312156155b657600080fd5b50508035926020909101359150565b60008060008060008060a087890312156155de57600080fd5b86359550602087013567ffffffffffffffff8111156155fc57600080fd5b61560889828a01614e7a565b909650945050604087013561561c81614d11565b925061562a6060880161501a565b915061557460808801614e31565b6000806000806040858703121561564e57600080fd5b843567ffffffffffffffff8082111561566657600080fd5b61567288838901614e7a565b9096509450602087013591508082111561568b57600080fd5b5061569887828801614e7a565b95989497509550505050565b600080600080608085870312156156ba57600080fd5b8435935060208501356156cc81614d11565b9250604085013561523181614d11565b6000806000606084860312156156f157600080fd5b8335925060208401359150604084013561543d81614d11565b6000806040838503121561571d57600080fd5b823561572881614d11565b91506020830135614e2681614d11565b6000806000806060858703121561574e57600080fd5b843567ffffffffffffffff81111561576557600080fd5b61577187828801614e7a565b909550935050602085013561578581614d11565b9150604085013561579581614d11565b939692955090935050565b600080600080600060a086880312156157b857600080fd5b85356157c381614d11565b945060208601356157d381614d11565b93506040860135925060608601359150608086013567ffffffffffffffff8111156157fd57600080fd5b6151f788828901614fbe565b60006020828403121561581b57600080fd5b815167ffffffffffffffff81111561583257600080fd5b8201601f8101841361584357600080fd5b805161584e81614f96565b60405161585b8282614f69565b82815286602084860101111561587057600080fd5b610a73836020830160208701614d9e565b6000806000806080858703121561589757600080fd5b843567ffffffffffffffff8111156158ae57600080fd5b6158ba87828801614fbe565b94505060208501356158cb81614d11565b92506158d96040860161524a565b9150606085013561579581614d11565b6000602082840312156158fb57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b67ffffffffffffffff81811683821601908082111561593957615939615902565b5092915050565b600181811c9082168061595457607f821691505b60208210810361597457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b6000600182016159a2576159a2615902565b5060010190565b6040815260006159bc6040830185615342565b82810360208401526159ce8185615342565b95945050505050565b6000602082840312156159e957600080fd5b815161099681614d11565b600060208284031215615a0657600080fd5b8151610996816154c3565b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60c081526000615a5e60c083018a8c615a21565b6001600160a01b03898116602085015263ffffffff8916604085015267ffffffffffffffff881660608501528616608084015282810360a0840152615aa4818587615a21565b9b9a5050505050505050505050565b601f8211156109de57600081815260208120601f850160051c81016020861015615ada5750805b601f850160051c820191505b81811015613bc157828155600101615ae6565b67ffffffffffffffff831115615b1157615b11614f53565b615b2583615b1f8354615940565b83615ab3565b6000601f841160018114615b595760008515615b415750838201355b600019600387901b1c1916600186901b1783556114d7565b600083815260209020601f19861690835b82811015615b8a5786850135825560209485019460019092019101615b6a565b5086821015615ba75760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b67ffffffffffffffff82811682821603908082111561593957615939615902565b815167ffffffffffffffff811115615bf457615bf4614f53565b615c0881615c028454615940565b84615ab3565b602080601f831160018114615c3d5760008415615c255750858301515b600019600386901b1c1916600185901b178555613bc1565b600085815260208120601f198616915b82811015615c6c57888601518255948401946001909101908401615c4d565b5085821015615c8a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006001600160a01b03808816835280871660208401525060a06040830152615cc660a0830186615342565b8281036060840152615cd88186615342565b90508281036080840152613d038185614dc2565b600060208284031215615cfe57600080fd5b815161099681614d6b565b600060033d1115615d225760046000803e5060005160e01c5b90565b600060443d1015615d335790565b6040516003193d81016004833e81513d67ffffffffffffffff8160248401118184111715615d6357505050505090565b8285019150815181811115615d7b5750505050505090565b843d8701016020828501011115615d955750505050505090565b615da460208286010187614f69565b509095945050505050565b608081526000615dc26080830187614dc2565b6001600160a01b039590951660208301525063ffffffff92909216604083015267ffffffffffffffff16606090910152919050565b818103818111156108c9576108c9615902565b808201808211156108c9576108c9615902565b7fff000000000000000000000000000000000000000000000000000000000000008460f81b16815260008351615e5a816001850160208801614d9e565b835190830190615e71816001840160208801614d9e565b0160010195945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152615eb660a0830184614dc2565b97965050505050505056fea2646970667358221220c4c2207f520e30264918f3720d95620e1049bac8262a757e0d0842a9f93d907364736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "allFusesBurned(bytes32,uint32)": { + "params": { + "fuseMask": "The fuses you want to check", + "node": "Namehash of the name" + }, + "returns": { + "_0": "Boolean of whether or not all the selected fuses are burned" + } + }, + "approve(address,uint256)": { + "params": { + "to": "address to approve", + "tokenId": "name to approve" + } + }, + "balanceOf(address,uint256)": { + "details": "See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address." + }, + "balanceOfBatch(address[],uint256[])": { + "details": "See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length." + }, + "canExtendSubnames(bytes32,address)": { + "params": { + "addr": "which address to check permissions for", + "node": "namehash of the name to check" + }, + "returns": { + "_0": "whether or not is owner/operator or approved" + } + }, + "canModifyName(bytes32,address)": { + "params": { + "addr": "which address to check permissions for", + "node": "namehash of the name to check" + }, + "returns": { + "_0": "whether or not is owner or operator" + } + }, + "extendExpiry(bytes32,bytes32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "labelhash": "Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')", + "parentNode": "Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')" + }, + "returns": { + "_0": "New expiry" + } + }, + "getApproved(uint256)": { + "params": { + "id": "Namehash of the name" + }, + "returns": { + "operator": "Approved operator of a name" + } + }, + "getData(uint256)": { + "params": { + "id": "Namehash of the name" + }, + "returns": { + "expiry": "Expiry of the name", + "fuses": "Fuses of the name", + "owner": "Owner of the name" + } + }, + "isApprovedForAll(address,address)": { + "details": "See {IERC1155-isApprovedForAll}." + }, + "isWrapped(bytes32)": { + "params": { + "node": "Namehash of the name" + }, + "returns": { + "_0": "Boolean of whether or not the name is wrapped" + } + }, + "isWrapped(bytes32,bytes32)": { + "params": { + "labelhash": "Namehash of the name", + "parentNode": "Namehash of the name" + }, + "returns": { + "_0": "Boolean of whether or not the name is wrapped" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "ownerOf(uint256)": { + "params": { + "id": "Label as a string of the .eth domain to wrap" + }, + "returns": { + "owner": "The owner of the name" + } + }, + "recoverFunds(address,address,uint256)": { + "details": "The contract is Ownable and only the owner can call the recover function.", + "params": { + "_amount": "The amount of tokens to recover.", + "_to": "The address to send the tokens to.", + "_token": "The address of the ERC20 token to recover" + } + }, + "registerAndWrapETH2LD(string,address,uint256,address,uint16)": { + "details": "Registers a new .eth second-level domain and wraps it. Only callable by authorised controllers.", + "params": { + "duration": "The duration, in seconds, to register the name for.", + "label": "The label to register (Eg, 'foo' for 'foo.eth').", + "ownerControlledFuses": "Initial owner-controlled fuses to set", + "resolver": "The resolver address to set on the ENS registry (optional).", + "wrappedOwner": "The owner of the wrapped name." + }, + "returns": { + "registrarExpiry": "The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch." + } + }, + "renew(uint256,uint256)": { + "details": "Only callable by authorised controllers.", + "params": { + "duration": "The number of seconds to renew the name for.", + "tokenId": "The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth')." + }, + "returns": { + "expires": "The expiry date of the name on the .eth registrar, in seconds since the Unix epoch." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)": { + "details": "See {IERC1155-safeBatchTransferFrom}." + }, + "safeTransferFrom(address,address,uint256,uint256,bytes)": { + "details": "See {IERC1155-safeTransferFrom}." + }, + "setApprovalForAll(address,bool)": { + "details": "See {IERC1155-setApprovalForAll}." + }, + "setChildFuses(bytes32,bytes32,uint32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "fuses": "Fuses to burn", + "labelhash": "Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')", + "parentNode": "Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')" + } + }, + "setFuses(bytes32,uint16)": { + "params": { + "node": "Namehash of the name", + "ownerControlledFuses": "Owner-controlled fuses to burn" + }, + "returns": { + "_0": "Old fuses" + } + }, + "setMetadataService(address)": { + "params": { + "_metadataService": "The new metadata service" + } + }, + "setRecord(bytes32,address,address,uint64)": { + "params": { + "node": "Namehash of the name to set a record for", + "owner": "New owner in the registry", + "resolver": "Resolver contract", + "ttl": "Time to live in the registry" + } + }, + "setResolver(bytes32,address)": { + "params": { + "node": "namehash of the name", + "resolver": "the resolver contract" + } + }, + "setSubnodeOwner(bytes32,string,address,uint32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "fuses": "Initial fuses for the wrapped subdomain", + "label": "Label of the subdomain as a string", + "owner": "New owner in the wrapper", + "parentNode": "Parent namehash of the subdomain" + }, + "returns": { + "node": "Namehash of the subdomain" + } + }, + "setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "fuses": "initial fuses for the wrapped subdomain", + "label": "label of the subdomain as a string", + "owner": "new owner in the wrapper", + "parentNode": "parent namehash of the subdomain", + "resolver": "resolver contract in the registry", + "ttl": "ttl in the registry" + }, + "returns": { + "node": "Namehash of the subdomain" + } + }, + "setTTL(bytes32,uint64)": { + "params": { + "node": "Namehash of the name", + "ttl": "TTL in the registry" + } + }, + "setUpgradeContract(address)": { + "details": "The default value of upgradeContract is the 0 address. Use the 0 address at any time to make the contract not upgradable.", + "params": { + "_upgradeAddress": "address of an upgraded contract" + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "unwrap(bytes32,bytes32,address)": { + "details": "Can be called by the owner in the wrapper or an authorised caller in the wrapper", + "params": { + "controller": "Sets the owner in the registry to this address", + "labelhash": "Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')", + "parentNode": "Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')" + } + }, + "unwrapETH2LD(bytes32,address,address)": { + "details": "Can be called by the owner in the wrapper or an authorised caller in the wrapper", + "params": { + "controller": "Sets the owner in the registry to this address", + "labelhash": "Labelhash of the .eth domain", + "registrant": "Sets the owner in the .eth registrar to this address" + } + }, + "upgrade(bytes,bytes)": { + "details": "Can be called by the owner or an authorised caller", + "params": { + "extraData": "Extra data to pass to the upgrade contract", + "name": "The name to upgrade, in DNS format" + } + }, + "uri(uint256)": { + "params": { + "tokenId": "The id of the token" + }, + "returns": { + "_0": "string uri of the metadata service" + } + }, + "wrap(bytes,address,address)": { + "details": "Can be called by the owner in the registry or an authorised caller in the registry", + "params": { + "name": "The name to wrap, in DNS format", + "resolver": "Resolver contract", + "wrappedOwner": "Owner of the name in this contract" + } + }, + "wrapETH2LD(string,address,uint16,address)": { + "details": "Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar", + "params": { + "label": "Label as a string of the .eth domain to wrap", + "ownerControlledFuses": "Initial owner-controlled fuses to set", + "resolver": "Resolver contract address", + "wrappedOwner": "Owner of the name in this contract" + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "allFusesBurned(bytes32,uint32)": { + "notice": "Checks all Fuses in the mask are burned for the node" + }, + "approve(address,uint256)": { + "notice": "Approves an address for a name" + }, + "canExtendSubnames(bytes32,address)": { + "notice": "Checks if owner/operator or approved by owner" + }, + "canModifyName(bytes32,address)": { + "notice": "Checks if owner or operator of the owner" + }, + "extendExpiry(bytes32,bytes32,uint64)": { + "notice": "Extends expiry for a name" + }, + "getApproved(uint256)": { + "notice": "Gets the owner of a name" + }, + "getData(uint256)": { + "notice": "Gets the data for a name" + }, + "isWrapped(bytes32)": { + "notice": "Checks if a name is wrapped" + }, + "isWrapped(bytes32,bytes32)": { + "notice": "Checks if a name is wrapped in a more gas efficient way" + }, + "ownerOf(uint256)": { + "notice": "Gets the owner of a name" + }, + "recoverFunds(address,address,uint256)": { + "notice": "Recover ERC20 tokens sent to the contract by mistake." + }, + "renew(uint256,uint256)": { + "notice": "Renews a .eth second-level domain." + }, + "setChildFuses(bytes32,bytes32,uint32,uint64)": { + "notice": "Sets fuses of a name that you own the parent of" + }, + "setFuses(bytes32,uint16)": { + "notice": "Sets fuses of a name" + }, + "setMetadataService(address)": { + "notice": "Set the metadata service. Only the owner can do this" + }, + "setRecord(bytes32,address,address,uint64)": { + "notice": "Sets records for the name in the ENS Registry" + }, + "setResolver(bytes32,address)": { + "notice": "Sets resolver contract in the registry" + }, + "setSubnodeOwner(bytes32,string,address,uint32,uint64)": { + "notice": "Sets the subdomain owner in the registry and then wraps the subdomain" + }, + "setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)": { + "notice": "Sets the subdomain owner in the registry with records and then wraps the subdomain" + }, + "setTTL(bytes32,uint64)": { + "notice": "Sets TTL in the registry" + }, + "setUpgradeContract(address)": { + "notice": "Set the address of the upgradeContract of the contract. only admin can do this" + }, + "unwrap(bytes32,bytes32,address)": { + "notice": "Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain" + }, + "unwrapETH2LD(bytes32,address,address)": { + "notice": "Unwraps a .eth domain. e.g. vitalik.eth" + }, + "upgrade(bytes,bytes)": { + "notice": "Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain" + }, + "uri(uint256)": { + "notice": "Get the metadata uri" + }, + "wrap(bytes,address,address)": { + "notice": "Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain" + }, + "wrapETH2LD(string,address,uint16,address)": { + "notice": "Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 444, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 21208, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_tokens", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 21214, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_operatorApprovals", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" + }, + { + "astId": 21218, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_tokenApprovals", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_address)" + }, + { + "astId": 21139, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "controllers", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 22680, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "metadataService", + "offset": 0, + "slot": "5", + "type": "t_contract(IMetadataService)22182" + }, + { + "astId": 22684, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "names", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_bytes32,t_bytes_storage)" + }, + { + "astId": 22702, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "upgradeContract", + "offset": 0, + "slot": "7", + "type": "t_contract(INameWrapperUpgrade)22574" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(IMetadataService)22182": { + "encoding": "inplace", + "label": "contract IMetadataService", + "numberOfBytes": "20" + }, + "t_contract(INameWrapperUpgrade)22574": { + "encoding": "inplace", + "label": "contract INameWrapperUpgrade", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_bytes32,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint256,t_address)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/OffchainDNSResolver.json b/solidity/dns-contracts/deployments/holesky/OffchainDNSResolver.json new file mode 100644 index 0000000..0d5945c --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/OffchainDNSResolver.json @@ -0,0 +1,238 @@ +{ + "address": "0x7CF33078a37Cee425F1ad149875eE1e4Bdf0aD9B", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract DNSSEC", + "name": "_oracle", + "type": "address" + }, + { + "internalType": "string", + "name": "_gatewayURL", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "CouldNotResolve", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidOperation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "string[]", + "name": "urls", + "type": "string[]" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes4", + "name": "callbackFunction", + "type": "bytes4" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "OffchainLookup", + "type": "error" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gatewayURL", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract DNSSEC", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "response", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "resolveCallback", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0xf314922a9857afabdd2b7c01589beda29aeef5dfbb42a570f3b6dc4038d59842", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x7CF33078a37Cee425F1ad149875eE1e4Bdf0aD9B", + "transactionIndex": 12, + "gasUsed": "1863489", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x7b35ed86c206bc5d6221fcd7a30371b4989a820722ea82acd1337e60780e1c74", + "transactionHash": "0xf314922a9857afabdd2b7c01589beda29aeef5dfbb42a570f3b6dc4038d59842", + "logs": [], + "blockNumber": 802353, + "cumulativeGasUsed": "28561929", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0x283af0b28c62c092c9727f1ee09c02ca627eb7f5", + "https://dnssec-oracle.ens.domains/" + ], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract DNSSEC\",\"name\":\"_oracle\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_gatewayURL\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"CouldNotResolve\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidOperation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"string[]\",\"name\":\"urls\",\"type\":\"string[]\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes4\",\"name\":\"callbackFunction\",\"type\":\"bytes4\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"OffchainLookup\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gatewayURL\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract DNSSEC\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"response\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"resolveCallback\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnsregistrar/OffchainDNSResolver.sol\":\"OffchainDNSResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-2-Clause\\npragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for appending to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n let fpm := add(32, add(ptr, capacity))\\n if lt(fpm, ptr) {\\n revert(0, 0)\\n }\\n mstore(0x40, fpm)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n uint off = buf.buf.length;\\n uint newCapacity = off + len;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(newCapacity, buflen) {\\n mstore(bufptr, newCapacity)\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return append(buf, data, data.length);\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint offPlusOne = off + 1;\\n if (off >= buf.capacity) {\\n resize(buf, offPlusOne * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if gt(offPlusOne, mload(bufptr)) {\\n mstore(bufptr, offPlusOne)\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return append(buf, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return append(buf, data, 32);\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n return buf;\\n }\\n}\\n\",\"keccak256\":\"0xd6dd3b0b327288f8e1b711a609f4040fea602e2ad4bba9febdf2f33b4e56eb0c\",\"license\":\"BSD-2-Clause\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/dnsregistrar/OffchainDNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"../../contracts/resolvers/profiles/IAddrResolver.sol\\\";\\nimport \\\"../../contracts/resolvers/profiles/IExtendedResolver.sol\\\";\\nimport \\\"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"../dnssec-oracle/BytesUtils.sol\\\";\\nimport \\\"../dnssec-oracle/DNSSEC.sol\\\";\\nimport \\\"../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"../registry/ENSRegistry.sol\\\";\\nimport \\\"../utils/HexUtils.sol\\\";\\n\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {LowLevelCallUtils} from \\\"../utils/LowLevelCallUtils.sol\\\";\\n\\nerror InvalidOperation();\\nerror OffchainLookup(\\n address sender,\\n string[] urls,\\n bytes callData,\\n bytes4 callbackFunction,\\n bytes extraData\\n);\\n\\ninterface IDNSGateway {\\n function resolve(\\n bytes memory name,\\n uint16 qtype\\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\\n}\\n\\nuint16 constant CLASS_INET = 1;\\nuint16 constant TYPE_TXT = 16;\\n\\ncontract OffchainDNSResolver is IExtendedResolver, IERC165 {\\n using RRUtils for *;\\n using Address for address;\\n using BytesUtils for bytes;\\n using HexUtils for bytes;\\n\\n ENS public immutable ens;\\n DNSSEC public immutable oracle;\\n string public gatewayURL;\\n\\n error CouldNotResolve(bytes name);\\n\\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\\n ens = _ens;\\n oracle = _oracle;\\n gatewayURL = _gatewayURL;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) external pure override returns (bool) {\\n return interfaceId == type(IExtendedResolver).interfaceId;\\n }\\n\\n function resolve(\\n bytes calldata name,\\n bytes calldata data\\n ) external view returns (bytes memory) {\\n revertWithDefaultOffchainLookup(name, data);\\n }\\n\\n function resolveCallback(\\n bytes calldata response,\\n bytes calldata extraData\\n ) external view returns (bytes memory) {\\n (bytes memory name, bytes memory query, bytes4 selector) = abi.decode(\\n extraData,\\n (bytes, bytes, bytes4)\\n );\\n\\n if (selector != bytes4(0)) {\\n (bytes memory targetData, address targetResolver) = abi.decode(\\n query,\\n (bytes, address)\\n );\\n return\\n callWithOffchainLookupPropagation(\\n targetResolver,\\n name,\\n query,\\n abi.encodeWithSelector(\\n selector,\\n response,\\n abi.encode(targetData, address(this))\\n )\\n );\\n }\\n\\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\\n response,\\n (DNSSEC.RRSetWithSignature[])\\n );\\n\\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\\n for (\\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\\n !iter.done();\\n iter.next()\\n ) {\\n // Ignore records with wrong name, type, or class\\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\\n if (\\n !rrname.equals(name) ||\\n iter.class != CLASS_INET ||\\n iter.dnstype != TYPE_TXT\\n ) {\\n continue;\\n }\\n\\n // Look for a valid ENS-DNS TXT record\\n (address dnsresolver, bytes memory context) = parseRR(\\n iter.data,\\n iter.rdataOffset,\\n iter.nextOffset\\n );\\n\\n // If we found a valid record, try to resolve it\\n if (dnsresolver != address(0)) {\\n if (\\n IERC165(dnsresolver).supportsInterface(\\n IExtendedDNSResolver.resolve.selector\\n )\\n ) {\\n return\\n callWithOffchainLookupPropagation(\\n dnsresolver,\\n name,\\n query,\\n abi.encodeCall(\\n IExtendedDNSResolver.resolve,\\n (name, query, context)\\n )\\n );\\n } else if (\\n IERC165(dnsresolver).supportsInterface(\\n IExtendedResolver.resolve.selector\\n )\\n ) {\\n return\\n callWithOffchainLookupPropagation(\\n dnsresolver,\\n name,\\n query,\\n abi.encodeCall(\\n IExtendedResolver.resolve,\\n (name, query)\\n )\\n );\\n } else {\\n (bool ok, bytes memory ret) = address(dnsresolver)\\n .staticcall(query);\\n if (ok) {\\n return ret;\\n } else {\\n revert CouldNotResolve(name);\\n }\\n }\\n }\\n }\\n\\n // No valid records; revert.\\n revert CouldNotResolve(name);\\n }\\n\\n function parseRR(\\n bytes memory data,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal view returns (address, bytes memory) {\\n bytes memory txt = readTXT(data, idx, lastIdx);\\n\\n // Must start with the magic word\\n if (txt.length < 5 || !txt.equals(0, \\\"ENS1 \\\", 0, 5)) {\\n return (address(0), \\\"\\\");\\n }\\n\\n // Parse the name or address\\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \\\" \\\");\\n if (lastTxtIdx > txt.length) {\\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\\n return (dnsResolver, \\\"\\\");\\n } else {\\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\\n return (\\n dnsResolver,\\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\\n );\\n }\\n }\\n\\n function readTXT(\\n bytes memory data,\\n uint256 startIdx,\\n uint256 lastIdx\\n ) internal pure returns (bytes memory) {\\n // TODO: Concatenate multiple text fields\\n uint256 fieldLength = data.readUint8(startIdx);\\n assert(startIdx + fieldLength < lastIdx);\\n return data.substring(startIdx + 1, fieldLength);\\n }\\n\\n function parseAndResolve(\\n bytes memory nameOrAddress,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal view returns (address) {\\n if (nameOrAddress[idx] == \\\"0\\\" && nameOrAddress[idx + 1] == \\\"x\\\") {\\n (address ret, bool valid) = nameOrAddress.hexToAddress(\\n idx + 2,\\n lastIdx\\n );\\n if (valid) {\\n return ret;\\n }\\n }\\n return resolveName(nameOrAddress, idx, lastIdx);\\n }\\n\\n function resolveName(\\n bytes memory name,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal view returns (address) {\\n bytes32 node = textNamehash(name, idx, lastIdx);\\n address resolver = ens.resolver(node);\\n if (resolver == address(0)) {\\n return address(0);\\n }\\n return IAddrResolver(resolver).addr(node);\\n }\\n\\n /**\\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\\n * @param name Name to hash\\n * @param idx Index to start at\\n * @param lastIdx Index to end at\\n */\\n function textNamehash(\\n bytes memory name,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal view returns (bytes32) {\\n uint256 separator = name.find(idx, name.length - idx, bytes1(\\\".\\\"));\\n bytes32 parentNode = bytes32(0);\\n if (separator < lastIdx) {\\n parentNode = textNamehash(name, separator + 1, lastIdx);\\n } else {\\n separator = lastIdx;\\n }\\n return\\n keccak256(\\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\\n );\\n }\\n\\n function callWithOffchainLookupPropagation(\\n address target,\\n bytes memory name,\\n bytes memory innerdata,\\n bytes memory data\\n ) internal view returns (bytes memory) {\\n if (!target.isContract()) {\\n revertWithDefaultOffchainLookup(name, innerdata);\\n }\\n\\n bool result = LowLevelCallUtils.functionStaticCall(\\n address(target),\\n data\\n );\\n uint256 size = LowLevelCallUtils.returnDataSize();\\n if (result) {\\n bytes memory returnData = LowLevelCallUtils.readReturnData(0, size);\\n return abi.decode(returnData, (bytes));\\n }\\n // Failure\\n if (size >= 4) {\\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\\n if (bytes4(errorId) == OffchainLookup.selector) {\\n // Offchain lookup. Decode the revert message and create our own that nests it.\\n bytes memory revertData = LowLevelCallUtils.readReturnData(\\n 4,\\n size - 4\\n );\\n handleOffchainLookupError(revertData, target, name);\\n }\\n }\\n LowLevelCallUtils.propagateRevert();\\n }\\n\\n function revertWithDefaultOffchainLookup(\\n bytes memory name,\\n bytes memory data\\n ) internal view {\\n string[] memory urls = new string[](1);\\n urls[0] = gatewayURL;\\n\\n revert OffchainLookup(\\n address(this),\\n urls,\\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\\n OffchainDNSResolver.resolveCallback.selector,\\n abi.encode(name, data, bytes4(0))\\n );\\n }\\n\\n function handleOffchainLookupError(\\n bytes memory returnData,\\n address target,\\n bytes memory name\\n ) internal view {\\n (\\n address sender,\\n string[] memory urls,\\n bytes memory callData,\\n bytes4 innerCallbackFunction,\\n bytes memory extraData\\n ) = abi.decode(returnData, (address, string[], bytes, bytes4, bytes));\\n\\n if (sender != target) {\\n revert InvalidOperation();\\n }\\n\\n revert OffchainLookup(\\n address(this),\\n urls,\\n callData,\\n OffchainDNSResolver.resolveCallback.selector,\\n abi.encode(name, extraData, innerCallbackFunction)\\n );\\n }\\n}\\n\",\"keccak256\":\"0xdd7f8c44e6e73d5c90a942e8059296c5781cd4e2257623aa1eeb5fd3e60aec85\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/DNSSEC.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nabstract contract DNSSEC {\\n bytes public anchors;\\n\\n struct RRSetWithSignature {\\n bytes rrset;\\n bytes sig;\\n }\\n\\n event AlgorithmUpdated(uint8 id, address addr);\\n event DigestUpdated(uint8 id, address addr);\\n\\n function verifyRRSet(\\n RRSetWithSignature[] memory input\\n ) external view virtual returns (bytes memory rrs, uint32 inception);\\n\\n function verifyRRSet(\\n RRSetWithSignature[] memory input,\\n uint256 now\\n ) public view virtual returns (bytes memory rrs, uint32 inception);\\n}\\n\",\"keccak256\":\"0xee6a236a59e5db8418c98ee4640a91987d26533c02d305cc6c7a37a3ac4ee907\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n */\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint256 labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes memory ret) {\\n uint256 len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint256 labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint256 constant RRSIG_TYPE = 0;\\n uint256 constant RRSIG_ALGORITHM = 2;\\n uint256 constant RRSIG_LABELS = 3;\\n uint256 constant RRSIG_TTL = 4;\\n uint256 constant RRSIG_EXPIRATION = 8;\\n uint256 constant RRSIG_INCEPTION = 12;\\n uint256 constant RRSIG_KEY_TAG = 16;\\n uint256 constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(\\n bytes memory data\\n ) internal pure returns (SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(\\n RRSIG_SIGNER_NAME + self.signerName.length,\\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\\n );\\n }\\n\\n function rrs(\\n SignedSet memory rrset\\n ) internal pure returns (RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint256 offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint256 rdataOffset;\\n uint256 nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns (bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint256 rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.offset,\\n nameLength(iter.data, iter.offset)\\n );\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(\\n RRIterator memory iter\\n ) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.rdataOffset,\\n iter.nextOffset - iter.rdataOffset\\n );\\n }\\n\\n uint256 constant DNSKEY_FLAGS = 0;\\n uint256 constant DNSKEY_PROTOCOL = 2;\\n uint256 constant DNSKEY_ALGORITHM = 3;\\n uint256 constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(\\n offset + DNSKEY_PUBKEY,\\n length - DNSKEY_PUBKEY\\n );\\n }\\n\\n uint256 constant DS_KEY_TAG = 0;\\n uint256 constant DS_ALGORITHM = 2;\\n uint256 constant DS_DIGEST_TYPE = 3;\\n uint256 constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n function isSubdomainOf(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n uint256 off = 0;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n while (counts > othercounts) {\\n off = progress(self, off);\\n counts--;\\n }\\n\\n return self.equals(off, other, 0);\\n }\\n\\n function compareNames(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint256 off;\\n uint256 otheroff;\\n uint256 prevoff;\\n uint256 otherprevoff;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if (otheroff == 0) {\\n return 1;\\n }\\n\\n return\\n self.compare(\\n prevoff + 1,\\n self.readUint8(prevoff),\\n other,\\n otherprevoff + 1,\\n other.readUint8(otherprevoff)\\n );\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(\\n uint32 i1,\\n uint32 i2\\n ) internal pure returns (bool) {\\n unchecked {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n }\\n\\n function progress(\\n bytes memory body,\\n uint256 off\\n ) internal pure returns (uint256) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint256 ac1;\\n uint256 ac2;\\n for (uint256 i = 0; i < data.length + 31; i += 32) {\\n uint256 word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if (i + 32 > data.length) {\\n uint256 unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 +=\\n (word &\\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\\n 8;\\n ac2 += (word &\\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 =\\n (ac1 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac1 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac2 =\\n (ac2 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac2 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 =\\n (ac1 &\\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\\n 32);\\n ac1 =\\n (ac1 &\\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\\n 64);\\n ac1 =\\n (ac1 &\\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\\n (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4dd68a6efd7c38f6b0e95ca0c056ecb74f88583da650b1a8639e6e78be36fede\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/registry/ENSRegistry.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"./ENS.sol\\\";\\n\\n/**\\n * The ENS registry contract.\\n */\\ncontract ENSRegistry is ENS {\\n struct Record {\\n address owner;\\n address resolver;\\n uint64 ttl;\\n }\\n\\n mapping(bytes32 => Record) records;\\n mapping(address => mapping(address => bool)) operators;\\n\\n // Permits modifications only by the owner of the specified node.\\n modifier authorised(bytes32 node) {\\n address owner = records[node].owner;\\n require(owner == msg.sender || operators[owner][msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Constructs a new ENS registry.\\n */\\n constructor() public {\\n records[0x0].owner = msg.sender;\\n }\\n\\n /**\\n * @dev Sets the record for a node.\\n * @param node The node to update.\\n * @param owner The address of the new owner.\\n * @param resolver The address of the resolver.\\n * @param ttl The TTL in seconds.\\n */\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external virtual override {\\n setOwner(node, owner);\\n _setResolverAndTTL(node, resolver, ttl);\\n }\\n\\n /**\\n * @dev Sets the record for a subnode.\\n * @param node The parent node.\\n * @param label The hash of the label specifying the subnode.\\n * @param owner The address of the new owner.\\n * @param resolver The address of the resolver.\\n * @param ttl The TTL in seconds.\\n */\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external virtual override {\\n bytes32 subnode = setSubnodeOwner(node, label, owner);\\n _setResolverAndTTL(subnode, resolver, ttl);\\n }\\n\\n /**\\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\\n * @param node The node to transfer ownership of.\\n * @param owner The address of the new owner.\\n */\\n function setOwner(\\n bytes32 node,\\n address owner\\n ) public virtual override authorised(node) {\\n _setOwner(node, owner);\\n emit Transfer(node, owner);\\n }\\n\\n /**\\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\\n * @param node The parent node.\\n * @param label The hash of the label specifying the subnode.\\n * @param owner The address of the new owner.\\n */\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) public virtual override authorised(node) returns (bytes32) {\\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\\n _setOwner(subnode, owner);\\n emit NewOwner(node, label, owner);\\n return subnode;\\n }\\n\\n /**\\n * @dev Sets the resolver address for the specified node.\\n * @param node The node to update.\\n * @param resolver The address of the resolver.\\n */\\n function setResolver(\\n bytes32 node,\\n address resolver\\n ) public virtual override authorised(node) {\\n emit NewResolver(node, resolver);\\n records[node].resolver = resolver;\\n }\\n\\n /**\\n * @dev Sets the TTL for the specified node.\\n * @param node The node to update.\\n * @param ttl The TTL in seconds.\\n */\\n function setTTL(\\n bytes32 node,\\n uint64 ttl\\n ) public virtual override authorised(node) {\\n emit NewTTL(node, ttl);\\n records[node].ttl = ttl;\\n }\\n\\n /**\\n * @dev Enable or disable approval for a third party (\\\"operator\\\") to manage\\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\\n * @param operator Address to add to the set of authorized operators.\\n * @param approved True if the operator is approved, false to revoke approval.\\n */\\n function setApprovalForAll(\\n address operator,\\n bool approved\\n ) external virtual override {\\n operators[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev Returns the address that owns the specified node.\\n * @param node The specified node.\\n * @return address of the owner.\\n */\\n function owner(\\n bytes32 node\\n ) public view virtual override returns (address) {\\n address addr = records[node].owner;\\n if (addr == address(this)) {\\n return address(0x0);\\n }\\n\\n return addr;\\n }\\n\\n /**\\n * @dev Returns the address of the resolver for the specified node.\\n * @param node The specified node.\\n * @return address of the resolver.\\n */\\n function resolver(\\n bytes32 node\\n ) public view virtual override returns (address) {\\n return records[node].resolver;\\n }\\n\\n /**\\n * @dev Returns the TTL of a node, and any records associated with it.\\n * @param node The specified node.\\n * @return ttl of the node.\\n */\\n function ttl(bytes32 node) public view virtual override returns (uint64) {\\n return records[node].ttl;\\n }\\n\\n /**\\n * @dev Returns whether a record has been imported to the registry.\\n * @param node The specified node.\\n * @return Bool if record exists\\n */\\n function recordExists(\\n bytes32 node\\n ) public view virtual override returns (bool) {\\n return records[node].owner != address(0x0);\\n }\\n\\n /**\\n * @dev Query if an address is an authorized operator for another address.\\n * @param owner The address that owns the records.\\n * @param operator The address that acts on behalf of the owner.\\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\\n */\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view virtual override returns (bool) {\\n return operators[owner][operator];\\n }\\n\\n function _setOwner(bytes32 node, address owner) internal virtual {\\n records[node].owner = owner;\\n }\\n\\n function _setResolverAndTTL(\\n bytes32 node,\\n address resolver,\\n uint64 ttl\\n ) internal {\\n if (resolver != records[node].resolver) {\\n records[node].resolver = resolver;\\n emit NewResolver(node, resolver);\\n }\\n\\n if (ttl != records[node].ttl) {\\n records[node].ttl = ttl;\\n emit NewTTL(node, ttl);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa7a7a64fb980e521c991415e416fd4106a42f892479805e1daa51ecb0e2e5198\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedDNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedDNSResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data,\\n bytes memory context\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x541f8799c34ff9e7035d09f06ae0f0f8a16b6065e9b60a15670b957321630f72\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"contracts/utils/HexUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary HexUtils {\\n /**\\n * @dev Attempts to parse bytes32 from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexStringToBytes32(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (bytes32 r, bool valid) {\\n uint256 hexLength = lastIdx - idx;\\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\\n revert(\\\"Invalid string length\\\");\\n }\\n valid = true;\\n assembly {\\n // check that the index to read to is not past the end of the string\\n if gt(lastIdx, mload(str)) {\\n revert(0, 0)\\n }\\n\\n function getHex(c) -> ascii {\\n // chars 48-57: 0-9\\n if and(gt(c, 47), lt(c, 58)) {\\n ascii := sub(c, 48)\\n leave\\n }\\n // chars 65-70: A-F\\n if and(gt(c, 64), lt(c, 71)) {\\n ascii := add(sub(c, 65), 10)\\n leave\\n }\\n // chars 97-102: a-f\\n if and(gt(c, 96), lt(c, 103)) {\\n ascii := add(sub(c, 97), 10)\\n leave\\n }\\n // invalid char\\n ascii := 0xff\\n }\\n\\n let ptr := add(str, 32)\\n for {\\n let i := idx\\n } lt(i, lastIdx) {\\n i := add(i, 2)\\n } {\\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\\n // if either byte is invalid, set invalid and break loop\\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\\n valid := false\\n break\\n }\\n let combined := or(shl(4, byte1), byte2)\\n r := or(shl(8, r), combined)\\n }\\n }\\n }\\n\\n /**\\n * @dev Attempts to parse an address from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexToAddress(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (address, bool) {\\n if (lastIdx - idx < 40) return (address(0x0), false);\\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\\n return (address(uint160(uint256(r))), valid);\\n }\\n}\\n\",\"keccak256\":\"0x4a8a9c72d6f3effb80b310faa6dc273e7adbc3b949df9c7a42e290e5b13519f3\",\"license\":\"MIT\"},\"contracts/utils/LowLevelCallUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.13;\\n\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nlibrary LowLevelCallUtils {\\n using Address for address;\\n\\n /**\\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\\n * `returnDataSize` and `readReturnData`.\\n * @param target The address to staticcall.\\n * @param data The data to pass to the call.\\n * @return success True if the call succeeded, or false if it reverts.\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data\\n ) internal view returns (bool success) {\\n return functionStaticCall(target, data, gasleft());\\n }\\n\\n /**\\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\\n * `returnDataSize` and `readReturnData`.\\n * @param target The address to staticcall.\\n * @param data The data to pass to the call.\\n * @param gasLimit The gas limit to use for the call.\\n * @return success True if the call succeeded, or false if it reverts.\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n uint256 gasLimit\\n ) internal view returns (bool success) {\\n require(\\n target.isContract(),\\n \\\"LowLevelCallUtils: static call to non-contract\\\"\\n );\\n assembly {\\n success := staticcall(\\n gasLimit,\\n target,\\n add(data, 32),\\n mload(data),\\n 0,\\n 0\\n )\\n }\\n }\\n\\n /**\\n * @dev Returns the size of the return data of the most recent external call.\\n */\\n function returnDataSize() internal pure returns (uint256 len) {\\n assembly {\\n len := returndatasize()\\n }\\n }\\n\\n /**\\n * @dev Reads return data from the most recent external call.\\n * @param offset Offset into the return data.\\n * @param length Number of bytes to return.\\n */\\n function readReturnData(\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (bytes memory data) {\\n data = new bytes(length);\\n assembly {\\n returndatacopy(add(data, 32), offset, length)\\n }\\n }\\n\\n /**\\n * @dev Reverts with the return data from the most recent external call.\\n */\\n function propagateRevert() internal pure {\\n assembly {\\n returndatacopy(0, 0, returndatasize())\\n revert(0, returndatasize())\\n }\\n }\\n}\\n\",\"keccak256\":\"0xba30d0a44a6a2f1557e4913108b25d8b36cb40a54f44ac98086465d6bf77c5e6\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c06040523480156200001157600080fd5b50604051620022823803806200228283398101604081905262000034916200008e565b6001600160a01b03808416608052821660a05260006200005582826200021d565b50505050620002e9565b6001600160a01b03811681146200007557600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215620000a457600080fd5b8351620000b1816200005f565b80935050602080850151620000c6816200005f565b60408601519093506001600160401b0380821115620000e457600080fd5b818701915087601f830112620000f957600080fd5b8151818111156200010e576200010e62000078565b604051601f8201601f19908116603f0116810190838211818310171562000139576200013962000078565b816040528281528a868487010111156200015257600080fd5b600093505b8284101562000176578484018601518185018701529285019262000157565b60008684830101528096505050505050509250925092565b600181811c90821680620001a357607f821691505b602082108103620001c457634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200021857600081815260208120601f850160051c81016020861015620001f35750805b601f850160051c820191505b818110156200021457828155600101620001ff565b5050505b505050565b81516001600160401b0381111562000239576200023962000078565b62000251816200024a84546200018e565b84620001ca565b602080601f831160018114620002895760008415620002705750858301515b600019600386901b1c1916600185901b17855562000214565b600085815260208120601f198616915b82811015620002ba5788860151825594840194600190910190840162000299565b5085821015620002d95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a051611f666200031c60003960008181610109015261033201526000818160b501526111e30152611f666000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c80637dc0d1d0116100505780637dc0d1d0146101045780639061b9231461012b578063b4a858011461013e57600080fd5b806301ffc9a7146100775780633f15457f146100b057806352539968146100ef575b600080fd5b61009b610085366004611515565b6001600160e01b031916639061b92360e01b1490565b60405190151581526020015b60405180910390f35b6100d77f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a7565b6100f7610151565b6040516100a79190611582565b6100d77f000000000000000000000000000000000000000000000000000000000000000081565b6100f76101393660046115de565b6101df565b6100f761014c3660046115de565b61025c565b6000805461015e9061164a565b80601f016020809104026020016040519081016040528092919081815260200182805461018a9061164a565b80156101d75780601f106101ac576101008083540402835291602001916101d7565b820191906000526020600020905b8154815290600101906020018083116101ba57829003601f168201915b505050505081565b606061025485858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f890181900481028201810190925287815292508791508690819084018382808284376000920191909152506106b792505050565b949350505050565b60606000808061026e85870187611772565b919450925090506001600160e01b031981161561031e576000808380602001905181019061029c919061184f565b91509150610312818686868e8e88306040516020016102bc9291906118a1565b60408051601f19818403018152908290526102db9392916024016118cc565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610848565b95505050505050610254565b600061032c888a018a61192e565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bdf95fef836040518263ffffffff1660e01b815260040161037c9190611a3a565b600060405180830381865afa158015610399573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103c19190810190611abf565b50905060006103d08282610916565b90505b8051516020820151101561069b5760006103f58260000151836020015161097d565b90506104018188610998565b15806104165750606082015161ffff16600114155b8061042a5750604082015161ffff16601014155b15610435575061068d565b60008061044f84600001518560a001518660c001516109bd565b90925090506001600160a01b03821615610689576040516301ffc9a760e01b815263477cc53f60e11b60048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa1580156104ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d29190611b0f565b1561053157610521828a8a8c8c866040516024016104f293929190611b31565b60408051601f198184030181529190526020810180516001600160e01b031663477cc53f60e11b179052610848565b9950505050505050505050610254565b6040516301ffc9a760e01b8152639061b92360e01b60048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa15801561057c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a09190611b0f565b156105ed57610521828a8a8c8c6040516024016105be929190611b6a565b60408051601f198184030181529190526020810180516001600160e01b0316639061b92360e01b179052610848565b600080836001600160a01b03168a6040516106089190611b8f565b600060405180830381855afa9150503d8060008114610643576040519150601f19603f3d011682016040523d82523d6000602084013e610648565b606091505b50915091508115610665579a506102549950505050505050505050565b8a6040516314d3b60360e11b81526004016106809190611582565b60405180910390fd5b5050505b61069681610b05565b6103d3565b50846040516314d3b60360e11b81526004016106809190611582565b604080516001808252818301909252600091816020015b60608152602001906001900390816106ce579050509050600080546106f29061164a565b80601f016020809104026020016040519081016040528092919081815260200182805461071e9061164a565b801561076b5780601f106107405761010080835404028352916020019161076b565b820191906000526020600020905b81548152906001019060200180831161074e57829003601f168201915b50505050508160008151811061078357610783611bab565b602002602001018190525030818460106040516024016107a4929190611bc1565b60408051601f19818403018152918152602080830180516001600160e01b03167f31b137b90000000000000000000000000000000000000000000000000000000017905290517fb4a85801000000000000000000000000000000000000000000000000000000009161081d918991899160009101611be7565b60408051601f1981840301815290829052630556f18360e41b82526106809594939291600401611c27565b60606001600160a01b0385163b6108635761086384846106b7565b600061086f8684610bed565b90503d81156108a5576000610885600083610bfa565b90508080602001905181019061089b9190611cd3565b9350505050610254565b600481106109045760006108bb60006004610bfa565b9050630556f18360e41b6108ce82611d08565b6001600160e01b031916036109025760006108f360046108ee8186611d56565b610bfa565b9050610900818a8a610c4f565b505b505b61090c610ce0565b5050949350505050565b6109646040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261097781610b05565b92915050565b6060600061098b8484610cea565b9050610254848483610d44565b6000815183511480156109b657506109b68360008460008751610dc6565b9392505050565b6000606060006109ce868686610de9565b9050600581511080610a2357506040805180820190915260058082527f454e5331200000000000000000000000000000000000000000000000000000006020830152610a21918391600091908290610dc6565b155b15610a41575050604080516020810190915260008082529150610afd565b6000610a7e6005808451610a559190611d56565b8491907f2000000000000000000000000000000000000000000000000000000000000000610e33565b90508151811115610ab5576000610a988360058551610ecf565b6040805160208101909152600081529095509350610afd92505050565b6000610ac383600584610ecf565b905080610af5610ad4846001611d69565b6001858751610ae39190611d56565b610aed9190611d56565b869190610d44565b945094505050505b935093915050565b60c08101516020820181905281515111610b1c5750565b6000610b3082600001518360200151610cea565b8260200151610b3f9190611d69565b8251909150610b4e9082610fd9565b61ffff166040830152610b62600282611d69565b8251909150610b719082610fd9565b61ffff166060830152610b85600282611d69565b8251909150610b949082611001565b63ffffffff166080830152610baa600482611d69565b8251909150600090610bbc9083610fd9565b61ffff169050610bcd600283611d69565b60a084018190529150610be08183611d69565b60c0909301929092525050565b60006109b683835a61102b565b60608167ffffffffffffffff811115610c1557610c15611684565b6040519080825280601f01601f191660200182016040528015610c3f576020820181803683370190505b5090508183602083013e92915050565b600080600080600087806020019051810190610c6b9190611d8c565b94509450945094509450866001600160a01b0316856001600160a01b031614610cc0576040517f398d4d3200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b30848463b4a8580160e01b89858760405160200161081d93929190611be7565b3d6000803e3d6000fd5b6000815b83518110610cfe57610cfe611ec2565b6000610d0a85836110be565b60ff169050610d1a816001611d69565b610d249083611d69565b915080600003610d345750610d3a565b50610cee565b6102548382611d56565b8251606090610d538385611d69565b1115610d5e57600080fd5b60008267ffffffffffffffff811115610d7957610d79611684565b6040519080825280601f01601f191660200182016040528015610da3576020820181803683370190505b50905060208082019086860101610dbb8282876110e2565b509095945050505050565b6000610dd3848484611138565b610dde878785611138565b149695505050505050565b60606000610df785856110be565b60ff16905082610e078286611d69565b10610e1457610e14611ec2565b610e2a610e22856001611d69565b869083610d44565b95945050505050565b6000835b610e418486611d69565b811015610ec257827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916868281518110610e7d57610e7d611bab565b01602001517fff000000000000000000000000000000000000000000000000000000000000001603610eb0579050610254565b80610eba81611ed8565b915050610e37565b5060001995945050505050565b6000838381518110610ee357610ee3611bab565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f3000000000000000000000000000000000000000000000000000000000000000148015610f9b575083610f40846001611d69565b81518110610f5057610f50611bab565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f7800000000000000000000000000000000000000000000000000000000000000145b15610fce57600080610fb9610fb1866002611d69565b87908661115c565b915091508015610fcb575090506109b6565b50505b610254848484611198565b8151600090610fe9836002611d69565b1115610ff457600080fd5b50016002015161ffff1690565b8151600090611011836004611d69565b111561101c57600080fd5b50016004015163ffffffff1690565b60006001600160a01b0384163b6110aa5760405162461bcd60e51b815260206004820152602e60248201527f4c6f774c6576656c43616c6c5574696c733a207374617469632063616c6c207460448201527f6f206e6f6e2d636f6e74726163740000000000000000000000000000000000006064820152608401610680565b6000808451602086018786fa949350505050565b60008282815181106110d2576110d2611bab565b016020015160f81c905092915050565b6020811061111a57815183526110f9602084611d69565b9250611106602083611d69565b9150611113602082611d56565b90506110e2565b905182516020929092036101000a6000190180199091169116179052565b82516000906111478385611d69565b111561115257600080fd5b5091016020012090565b600080602861116b8585611d56565b101561117c57506000905080610afd565b60008061118a8787876112f5565b909890975095505050505050565b6000806111a6858585611449565b6040517f0178b8bf000000000000000000000000000000000000000000000000000000008152600481018290529091506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630178b8bf90602401602060405180830381865afa15801561122a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124e9190611ef1565b90506001600160a01b038116611269576000925050506109b6565b6040517f3b3b57de000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b03821690633b3b57de90602401602060405180830381865afa1580156112c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112eb9190611ef1565b9695505050505050565b600080806113038585611d56565b905080604014158015611317575080602814155b8061132c5750611328600282611f0e565b6001145b156113795760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610680565b60019150855184111561138b57600080fd5b6113dc565b6000603a8210602f831116156113a85750602f190190565b604782106040831116156113be57506036190190565b606782106060831116156113d457506056190190565b5060ff919050565b60208601855b8581101561143e576113f98183015160001a611390565b61140b6001830184015160001a611390565b60ff811460ff831417156114245760009550505061143e565b60049190911b1760089590951b94909417936002016113e2565b505050935093915050565b6000806114868485875161145d9190611d56565b8791907f2e00000000000000000000000000000000000000000000000000000000000000610e33565b90506000838210156114ae576114a7866114a1846001611d69565b86611449565b90506114b2565b8391505b806114c9866114c18186611d56565b899190611138565b60408051602081019390935282015260600160405160208183030381529060405280519060200120925050509392505050565b6001600160e01b03198116811461151257600080fd5b50565b60006020828403121561152757600080fd5b81356109b6816114fc565b60005b8381101561154d578181015183820152602001611535565b50506000910152565b6000815180845261156e816020860160208601611532565b601f01601f19169290920160200192915050565b6020815260006109b66020830184611556565b60008083601f8401126115a757600080fd5b50813567ffffffffffffffff8111156115bf57600080fd5b6020830191508360208285010111156115d757600080fd5b9250929050565b600080600080604085870312156115f457600080fd5b843567ffffffffffffffff8082111561160c57600080fd5b61161888838901611595565b9096509450602087013591508082111561163157600080fd5b5061163e87828801611595565b95989497509550505050565b600181811c9082168061165e57607f821691505b60208210810361167e57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156116bd576116bd611684565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156116ec576116ec611684565b604052919050565b600067ffffffffffffffff82111561170e5761170e611684565b50601f01601f191660200190565b600082601f83011261172d57600080fd5b813561174061173b826116f4565b6116c3565b81815284602083860101111561175557600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561178757600080fd5b833567ffffffffffffffff8082111561179f57600080fd5b6117ab8783880161171c565b945060208601359150808211156117c157600080fd5b506117ce8682870161171c565b92505060408401356117df816114fc565b809150509250925092565b60006117f861173b846116f4565b905082815283838301111561180c57600080fd5b6109b6836020830184611532565b600082601f83011261182b57600080fd5b6109b6838351602085016117ea565b6001600160a01b038116811461151257600080fd5b6000806040838503121561186257600080fd5b825167ffffffffffffffff81111561187957600080fd5b6118858582860161181a565b92505060208301516118968161183a565b809150509250929050565b6040815260006118b46040830185611556565b90506001600160a01b03831660208301529392505050565b60408152826040820152828460608301376000606084830101526000601f19601f850116820160608382030160208401526112eb6060820185611556565b600067ffffffffffffffff82111561192457611924611684565b5060051b60200190565b6000602080838503121561194157600080fd5b823567ffffffffffffffff8082111561195957600080fd5b818501915085601f83011261196d57600080fd5b813561197b61173b8261190a565b81815260059190911b8301840190848101908883111561199a57600080fd5b8585015b83811015611a2d578035858111156119b65760008081fd5b86016040818c03601f19018113156119ce5760008081fd5b6119d661169a565b89830135888111156119e85760008081fd5b6119f68e8c8387010161171c565b825250908201359087821115611a0c5760008081fd5b611a1a8d8b8486010161171c565b818b01528552505091860191860161199e565b5098975050505050505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015611ab157888303603f1901855281518051878552611a8588860182611556565b91890151858303868b0152919050611a9d8183611556565b968901969450505090860190600101611a61565b509098975050505050505050565b60008060408385031215611ad257600080fd5b825167ffffffffffffffff811115611ae957600080fd5b611af58582860161181a565b925050602083015163ffffffff8116811461189657600080fd5b600060208284031215611b2157600080fd5b815180151581146109b657600080fd5b606081526000611b446060830186611556565b8281036020840152611b568186611556565b905082810360408401526112eb8185611556565b604081526000611b7d6040830185611556565b8281036020840152610e2a8185611556565b60008251611ba1818460208701611532565b9190910192915050565b634e487b7160e01b600052603260045260246000fd5b604081526000611bd46040830185611556565b905061ffff831660208301529392505050565b606081526000611bfa6060830186611556565b8281036020840152611c0c8186611556565b9150506001600160e01b031983166040830152949350505050565b600060a082016001600160a01b0388168352602060a08185015281885180845260c08601915060c08160051b8701019350828a0160005b82811015611c8c5760bf19888703018452611c7a868351611556565b95509284019290840190600101611c5e565b50505050508281036040840152611ca38187611556565b6001600160e01b03198616606085015290508281036080840152611cc78185611556565b98975050505050505050565b600060208284031215611ce557600080fd5b815167ffffffffffffffff811115611cfc57600080fd5b6102548482850161181a565b6000815160208301516001600160e01b031980821693506004831015611d385780818460040360031b1b83161693505b505050919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561097757610977611d40565b8082018082111561097757610977611d40565b8051611d87816114fc565b919050565b600080600080600060a08688031215611da457600080fd5b8551611daf8161183a565b8095505060208087015167ffffffffffffffff80821115611dcf57600080fd5b818901915089601f830112611de357600080fd5b8151611df161173b8261190a565b81815260059190911b8301840190848101908c831115611e1057600080fd5b8585015b83811015611e5d57805185811115611e2c5760008081fd5b8601603f81018f13611e3e5760008081fd5b611e4f8f89830151604084016117ea565b845250918601918601611e14565b5060408c01519099509450505080831115611e7757600080fd5b611e838a848b0161181a565b9550611e9160608a01611d7c565b94506080890151925080831115611ea757600080fd5b5050611eb58882890161181a565b9150509295509295909350565b634e487b7160e01b600052600160045260246000fd5b600060018201611eea57611eea611d40565b5060010190565b600060208284031215611f0357600080fd5b81516109b68161183a565b600082611f2b57634e487b7160e01b600052601260045260246000fd5b50069056fea2646970667358221220a6b1ec9be70b3dbb868f1e75c7c182e951e8835e70eea129a73423bd87f98aff64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100725760003560e01c80637dc0d1d0116100505780637dc0d1d0146101045780639061b9231461012b578063b4a858011461013e57600080fd5b806301ffc9a7146100775780633f15457f146100b057806352539968146100ef575b600080fd5b61009b610085366004611515565b6001600160e01b031916639061b92360e01b1490565b60405190151581526020015b60405180910390f35b6100d77f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a7565b6100f7610151565b6040516100a79190611582565b6100d77f000000000000000000000000000000000000000000000000000000000000000081565b6100f76101393660046115de565b6101df565b6100f761014c3660046115de565b61025c565b6000805461015e9061164a565b80601f016020809104026020016040519081016040528092919081815260200182805461018a9061164a565b80156101d75780601f106101ac576101008083540402835291602001916101d7565b820191906000526020600020905b8154815290600101906020018083116101ba57829003601f168201915b505050505081565b606061025485858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f890181900481028201810190925287815292508791508690819084018382808284376000920191909152506106b792505050565b949350505050565b60606000808061026e85870187611772565b919450925090506001600160e01b031981161561031e576000808380602001905181019061029c919061184f565b91509150610312818686868e8e88306040516020016102bc9291906118a1565b60408051601f19818403018152908290526102db9392916024016118cc565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610848565b95505050505050610254565b600061032c888a018a61192e565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bdf95fef836040518263ffffffff1660e01b815260040161037c9190611a3a565b600060405180830381865afa158015610399573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103c19190810190611abf565b50905060006103d08282610916565b90505b8051516020820151101561069b5760006103f58260000151836020015161097d565b90506104018188610998565b15806104165750606082015161ffff16600114155b8061042a5750604082015161ffff16601014155b15610435575061068d565b60008061044f84600001518560a001518660c001516109bd565b90925090506001600160a01b03821615610689576040516301ffc9a760e01b815263477cc53f60e11b60048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa1580156104ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d29190611b0f565b1561053157610521828a8a8c8c866040516024016104f293929190611b31565b60408051601f198184030181529190526020810180516001600160e01b031663477cc53f60e11b179052610848565b9950505050505050505050610254565b6040516301ffc9a760e01b8152639061b92360e01b60048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa15801561057c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a09190611b0f565b156105ed57610521828a8a8c8c6040516024016105be929190611b6a565b60408051601f198184030181529190526020810180516001600160e01b0316639061b92360e01b179052610848565b600080836001600160a01b03168a6040516106089190611b8f565b600060405180830381855afa9150503d8060008114610643576040519150601f19603f3d011682016040523d82523d6000602084013e610648565b606091505b50915091508115610665579a506102549950505050505050505050565b8a6040516314d3b60360e11b81526004016106809190611582565b60405180910390fd5b5050505b61069681610b05565b6103d3565b50846040516314d3b60360e11b81526004016106809190611582565b604080516001808252818301909252600091816020015b60608152602001906001900390816106ce579050509050600080546106f29061164a565b80601f016020809104026020016040519081016040528092919081815260200182805461071e9061164a565b801561076b5780601f106107405761010080835404028352916020019161076b565b820191906000526020600020905b81548152906001019060200180831161074e57829003601f168201915b50505050508160008151811061078357610783611bab565b602002602001018190525030818460106040516024016107a4929190611bc1565b60408051601f19818403018152918152602080830180516001600160e01b03167f31b137b90000000000000000000000000000000000000000000000000000000017905290517fb4a85801000000000000000000000000000000000000000000000000000000009161081d918991899160009101611be7565b60408051601f1981840301815290829052630556f18360e41b82526106809594939291600401611c27565b60606001600160a01b0385163b6108635761086384846106b7565b600061086f8684610bed565b90503d81156108a5576000610885600083610bfa565b90508080602001905181019061089b9190611cd3565b9350505050610254565b600481106109045760006108bb60006004610bfa565b9050630556f18360e41b6108ce82611d08565b6001600160e01b031916036109025760006108f360046108ee8186611d56565b610bfa565b9050610900818a8a610c4f565b505b505b61090c610ce0565b5050949350505050565b6109646040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261097781610b05565b92915050565b6060600061098b8484610cea565b9050610254848483610d44565b6000815183511480156109b657506109b68360008460008751610dc6565b9392505050565b6000606060006109ce868686610de9565b9050600581511080610a2357506040805180820190915260058082527f454e5331200000000000000000000000000000000000000000000000000000006020830152610a21918391600091908290610dc6565b155b15610a41575050604080516020810190915260008082529150610afd565b6000610a7e6005808451610a559190611d56565b8491907f2000000000000000000000000000000000000000000000000000000000000000610e33565b90508151811115610ab5576000610a988360058551610ecf565b6040805160208101909152600081529095509350610afd92505050565b6000610ac383600584610ecf565b905080610af5610ad4846001611d69565b6001858751610ae39190611d56565b610aed9190611d56565b869190610d44565b945094505050505b935093915050565b60c08101516020820181905281515111610b1c5750565b6000610b3082600001518360200151610cea565b8260200151610b3f9190611d69565b8251909150610b4e9082610fd9565b61ffff166040830152610b62600282611d69565b8251909150610b719082610fd9565b61ffff166060830152610b85600282611d69565b8251909150610b949082611001565b63ffffffff166080830152610baa600482611d69565b8251909150600090610bbc9083610fd9565b61ffff169050610bcd600283611d69565b60a084018190529150610be08183611d69565b60c0909301929092525050565b60006109b683835a61102b565b60608167ffffffffffffffff811115610c1557610c15611684565b6040519080825280601f01601f191660200182016040528015610c3f576020820181803683370190505b5090508183602083013e92915050565b600080600080600087806020019051810190610c6b9190611d8c565b94509450945094509450866001600160a01b0316856001600160a01b031614610cc0576040517f398d4d3200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b30848463b4a8580160e01b89858760405160200161081d93929190611be7565b3d6000803e3d6000fd5b6000815b83518110610cfe57610cfe611ec2565b6000610d0a85836110be565b60ff169050610d1a816001611d69565b610d249083611d69565b915080600003610d345750610d3a565b50610cee565b6102548382611d56565b8251606090610d538385611d69565b1115610d5e57600080fd5b60008267ffffffffffffffff811115610d7957610d79611684565b6040519080825280601f01601f191660200182016040528015610da3576020820181803683370190505b50905060208082019086860101610dbb8282876110e2565b509095945050505050565b6000610dd3848484611138565b610dde878785611138565b149695505050505050565b60606000610df785856110be565b60ff16905082610e078286611d69565b10610e1457610e14611ec2565b610e2a610e22856001611d69565b869083610d44565b95945050505050565b6000835b610e418486611d69565b811015610ec257827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916868281518110610e7d57610e7d611bab565b01602001517fff000000000000000000000000000000000000000000000000000000000000001603610eb0579050610254565b80610eba81611ed8565b915050610e37565b5060001995945050505050565b6000838381518110610ee357610ee3611bab565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f3000000000000000000000000000000000000000000000000000000000000000148015610f9b575083610f40846001611d69565b81518110610f5057610f50611bab565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f7800000000000000000000000000000000000000000000000000000000000000145b15610fce57600080610fb9610fb1866002611d69565b87908661115c565b915091508015610fcb575090506109b6565b50505b610254848484611198565b8151600090610fe9836002611d69565b1115610ff457600080fd5b50016002015161ffff1690565b8151600090611011836004611d69565b111561101c57600080fd5b50016004015163ffffffff1690565b60006001600160a01b0384163b6110aa5760405162461bcd60e51b815260206004820152602e60248201527f4c6f774c6576656c43616c6c5574696c733a207374617469632063616c6c207460448201527f6f206e6f6e2d636f6e74726163740000000000000000000000000000000000006064820152608401610680565b6000808451602086018786fa949350505050565b60008282815181106110d2576110d2611bab565b016020015160f81c905092915050565b6020811061111a57815183526110f9602084611d69565b9250611106602083611d69565b9150611113602082611d56565b90506110e2565b905182516020929092036101000a6000190180199091169116179052565b82516000906111478385611d69565b111561115257600080fd5b5091016020012090565b600080602861116b8585611d56565b101561117c57506000905080610afd565b60008061118a8787876112f5565b909890975095505050505050565b6000806111a6858585611449565b6040517f0178b8bf000000000000000000000000000000000000000000000000000000008152600481018290529091506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630178b8bf90602401602060405180830381865afa15801561122a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124e9190611ef1565b90506001600160a01b038116611269576000925050506109b6565b6040517f3b3b57de000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b03821690633b3b57de90602401602060405180830381865afa1580156112c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112eb9190611ef1565b9695505050505050565b600080806113038585611d56565b905080604014158015611317575080602814155b8061132c5750611328600282611f0e565b6001145b156113795760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610680565b60019150855184111561138b57600080fd5b6113dc565b6000603a8210602f831116156113a85750602f190190565b604782106040831116156113be57506036190190565b606782106060831116156113d457506056190190565b5060ff919050565b60208601855b8581101561143e576113f98183015160001a611390565b61140b6001830184015160001a611390565b60ff811460ff831417156114245760009550505061143e565b60049190911b1760089590951b94909417936002016113e2565b505050935093915050565b6000806114868485875161145d9190611d56565b8791907f2e00000000000000000000000000000000000000000000000000000000000000610e33565b90506000838210156114ae576114a7866114a1846001611d69565b86611449565b90506114b2565b8391505b806114c9866114c18186611d56565b899190611138565b60408051602081019390935282015260600160405160208183030381529060405280519060200120925050509392505050565b6001600160e01b03198116811461151257600080fd5b50565b60006020828403121561152757600080fd5b81356109b6816114fc565b60005b8381101561154d578181015183820152602001611535565b50506000910152565b6000815180845261156e816020860160208601611532565b601f01601f19169290920160200192915050565b6020815260006109b66020830184611556565b60008083601f8401126115a757600080fd5b50813567ffffffffffffffff8111156115bf57600080fd5b6020830191508360208285010111156115d757600080fd5b9250929050565b600080600080604085870312156115f457600080fd5b843567ffffffffffffffff8082111561160c57600080fd5b61161888838901611595565b9096509450602087013591508082111561163157600080fd5b5061163e87828801611595565b95989497509550505050565b600181811c9082168061165e57607f821691505b60208210810361167e57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156116bd576116bd611684565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156116ec576116ec611684565b604052919050565b600067ffffffffffffffff82111561170e5761170e611684565b50601f01601f191660200190565b600082601f83011261172d57600080fd5b813561174061173b826116f4565b6116c3565b81815284602083860101111561175557600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561178757600080fd5b833567ffffffffffffffff8082111561179f57600080fd5b6117ab8783880161171c565b945060208601359150808211156117c157600080fd5b506117ce8682870161171c565b92505060408401356117df816114fc565b809150509250925092565b60006117f861173b846116f4565b905082815283838301111561180c57600080fd5b6109b6836020830184611532565b600082601f83011261182b57600080fd5b6109b6838351602085016117ea565b6001600160a01b038116811461151257600080fd5b6000806040838503121561186257600080fd5b825167ffffffffffffffff81111561187957600080fd5b6118858582860161181a565b92505060208301516118968161183a565b809150509250929050565b6040815260006118b46040830185611556565b90506001600160a01b03831660208301529392505050565b60408152826040820152828460608301376000606084830101526000601f19601f850116820160608382030160208401526112eb6060820185611556565b600067ffffffffffffffff82111561192457611924611684565b5060051b60200190565b6000602080838503121561194157600080fd5b823567ffffffffffffffff8082111561195957600080fd5b818501915085601f83011261196d57600080fd5b813561197b61173b8261190a565b81815260059190911b8301840190848101908883111561199a57600080fd5b8585015b83811015611a2d578035858111156119b65760008081fd5b86016040818c03601f19018113156119ce5760008081fd5b6119d661169a565b89830135888111156119e85760008081fd5b6119f68e8c8387010161171c565b825250908201359087821115611a0c5760008081fd5b611a1a8d8b8486010161171c565b818b01528552505091860191860161199e565b5098975050505050505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015611ab157888303603f1901855281518051878552611a8588860182611556565b91890151858303868b0152919050611a9d8183611556565b968901969450505090860190600101611a61565b509098975050505050505050565b60008060408385031215611ad257600080fd5b825167ffffffffffffffff811115611ae957600080fd5b611af58582860161181a565b925050602083015163ffffffff8116811461189657600080fd5b600060208284031215611b2157600080fd5b815180151581146109b657600080fd5b606081526000611b446060830186611556565b8281036020840152611b568186611556565b905082810360408401526112eb8185611556565b604081526000611b7d6040830185611556565b8281036020840152610e2a8185611556565b60008251611ba1818460208701611532565b9190910192915050565b634e487b7160e01b600052603260045260246000fd5b604081526000611bd46040830185611556565b905061ffff831660208301529392505050565b606081526000611bfa6060830186611556565b8281036020840152611c0c8186611556565b9150506001600160e01b031983166040830152949350505050565b600060a082016001600160a01b0388168352602060a08185015281885180845260c08601915060c08160051b8701019350828a0160005b82811015611c8c5760bf19888703018452611c7a868351611556565b95509284019290840190600101611c5e565b50505050508281036040840152611ca38187611556565b6001600160e01b03198616606085015290508281036080840152611cc78185611556565b98975050505050505050565b600060208284031215611ce557600080fd5b815167ffffffffffffffff811115611cfc57600080fd5b6102548482850161181a565b6000815160208301516001600160e01b031980821693506004831015611d385780818460040360031b1b83161693505b505050919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561097757610977611d40565b8082018082111561097757610977611d40565b8051611d87816114fc565b919050565b600080600080600060a08688031215611da457600080fd5b8551611daf8161183a565b8095505060208087015167ffffffffffffffff80821115611dcf57600080fd5b818901915089601f830112611de357600080fd5b8151611df161173b8261190a565b81815260059190911b8301840190848101908c831115611e1057600080fd5b8585015b83811015611e5d57805185811115611e2c5760008081fd5b8601603f81018f13611e3e5760008081fd5b611e4f8f89830151604084016117ea565b845250918601918601611e14565b5060408c01519099509450505080831115611e7757600080fd5b611e838a848b0161181a565b9550611e9160608a01611d7c565b94506080890151925080831115611ea757600080fd5b5050611eb58882890161181a565b9150509295509295909350565b634e487b7160e01b600052600160045260246000fd5b600060018201611eea57611eea611d40565b5060010190565b600060208284031215611f0357600080fd5b81516109b68161183a565b600082611f2b57634e487b7160e01b600052601260045260246000fd5b50069056fea2646970667358221220a6b1ec9be70b3dbb868f1e75c7c182e951e8835e70eea129a73423bd87f98aff64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "supportsInterface(bytes4)": { + "details": "Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 5020, + "contract": "contracts/dnsregistrar/OffchainDNSResolver.sol:OffchainDNSResolver", + "label": "gatewayURL", + "offset": 0, + "slot": "0", + "type": "t_string_storage" + } + ], + "types": { + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/OwnedResolver.json b/solidity/dns-contracts/deployments/holesky/OwnedResolver.json new file mode 100644 index 0000000..6ee0c25 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/OwnedResolver.json @@ -0,0 +1,1470 @@ +{ + "address": "0x64e189018847f4E66dF730BD59c8945c4345dc3a", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + } + ], + "name": "ABIChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "AddrChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "ContenthashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "record", + "type": "bytes" + } + ], + "name": "DNSRecordChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "DNSRecordDeleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "lastzonehash", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "zonehash", + "type": "bytes" + } + ], + "name": "DNSZonehashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "InterfaceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "PubkeyChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "string", + "name": "indexedKey", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "TextChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "newVersion", + "type": "uint64" + } + ], + "name": "VersionChanged", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentTypes", + "type": "uint256" + } + ], + "name": "ABI", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "clearRecords", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "contenthash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "dnsRecord", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + } + ], + "name": "hasDNSRecords", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "interfaceImplementer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "pubkey", + "outputs": [ + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "recordVersions", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setABI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "a", + "type": "bytes" + } + ], + "name": "setAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "setAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setContenthash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setDNSRecords", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "setInterface", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "newName", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "setPubkey", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "setText", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setZonehash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "text", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "zonehash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x0c196cb17739f1ccac5ac52a5c8d5f20c7ec00b15131928ca10660d6a9034e78", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x64e189018847f4E66dF730BD59c8945c4345dc3a", + "transactionIndex": 1, + "gasUsed": "2349764", + "logsBloom": "0x00000000000000000000000000000000000000000000200000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000010000000020000000000000000000800000000000000000000000000000000440000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000040000000000000000000000000000000000000040000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x9229e50e8ff03cd950b31a8cc44c89bba73050bcffa94113b543beee27940cfe", + "transactionHash": "0x0c196cb17739f1ccac5ac52a5c8d5f20c7ec00b15131928ca10660d6a9034e78", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 815111, + "transactionHash": "0x0c196cb17739f1ccac5ac52a5c8d5f20c7ec00b15131928ca10660d6a9034e78", + "address": "0x64e189018847f4E66dF730BD59c8945c4345dc3a", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8" + ], + "data": "0x", + "logIndex": 600, + "blockHash": "0x9229e50e8ff03cd950b31a8cc44c89bba73050bcffa94113b543beee27940cfe" + } + ], + "blockNumber": 815111, + "cumulativeGasUsed": "26073994", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"}],\"name\":\"ABIChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"AddrChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"newAddress\",\"type\":\"bytes\"}],\"name\":\"AddressChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"ContenthashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"record\",\"type\":\"bytes\"}],\"name\":\"DNSRecordChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"DNSRecordDeleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"lastzonehash\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"zonehash\",\"type\":\"bytes\"}],\"name\":\"DNSZonehashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"InterfaceChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NameChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"PubkeyChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"indexedKey\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"TextChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"newVersion\",\"type\":\"uint64\"}],\"name\":\"VersionChanged\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentTypes\",\"type\":\"uint256\"}],\"name\":\"ABI\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"clearRecords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"contenthash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"dnsRecord\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"hasDNSRecords\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"interfaceImplementer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"pubkey\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"recordVersions\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setABI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"a\",\"type\":\"bytes\"}],\"name\":\"setAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"setAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setContenthash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setDNSRecords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"setInterface\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"newName\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"setPubkey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"setText\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setZonehash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"}],\"name\":\"text\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"zonehash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"ABI(bytes32,uint256)\":{\"params\":{\"contentTypes\":\"A bitwise OR of the ABI formats accepted by the caller.\",\"node\":\"The ENS node to query\"},\"returns\":{\"_0\":\"contentType The content type of the return value\",\"_1\":\"data The ABI data\"}},\"addr(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated address.\"}},\"clearRecords(bytes32)\":{\"params\":{\"node\":\"The node to update.\"}},\"contenthash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated contenthash.\"}},\"dnsRecord(bytes32,bytes32,uint16)\":{\"params\":{\"name\":\"the keccak-256 hash of the fully-qualified name for which to fetch the record\",\"node\":\"the namehash of the node for which to fetch the record\",\"resource\":\"the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\"},\"returns\":{\"_0\":\"the DNS record in wire format if present, otherwise empty\"}},\"hasDNSRecords(bytes32,bytes32)\":{\"params\":{\"name\":\"the namehash of the node for which to check the records\",\"node\":\"the namehash of the node for which to check the records\"}},\"interfaceImplementer(bytes32,bytes4)\":{\"params\":{\"interfaceID\":\"The EIP 165 interface ID to check for.\",\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The address that implements this interface, or 0 if the interface is unsupported.\"}},\"name(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated name.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pubkey(bytes32)\":{\"params\":{\"node\":\"The ENS node to query\"},\"returns\":{\"x\":\"The X coordinate of the curve point for the public key.\",\"y\":\"The Y coordinate of the curve point for the public key.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"setABI(bytes32,uint256,bytes)\":{\"params\":{\"contentType\":\"The content type of the ABI\",\"data\":\"The ABI data.\",\"node\":\"The node to update.\"}},\"setAddr(bytes32,address)\":{\"params\":{\"a\":\"The address to set.\",\"node\":\"The node to update.\"}},\"setContenthash(bytes32,bytes)\":{\"params\":{\"hash\":\"The contenthash to set\",\"node\":\"The node to update.\"}},\"setDNSRecords(bytes32,bytes)\":{\"params\":{\"data\":\"the DNS wire format records to set\",\"node\":\"the namehash of the node for which to set the records\"}},\"setInterface(bytes32,bytes4,address)\":{\"params\":{\"implementer\":\"The address of a contract that implements this interface for this node.\",\"interfaceID\":\"The EIP 165 interface ID.\",\"node\":\"The node to update.\"}},\"setName(bytes32,string)\":{\"params\":{\"node\":\"The node to update.\"}},\"setPubkey(bytes32,bytes32,bytes32)\":{\"params\":{\"node\":\"The ENS node to query\",\"x\":\"the X coordinate of the curve point for the public key.\",\"y\":\"the Y coordinate of the curve point for the public key.\"}},\"setText(bytes32,string,string)\":{\"params\":{\"key\":\"The key to set.\",\"node\":\"The node to update.\",\"value\":\"The text data value to set.\"}},\"setZonehash(bytes32,bytes)\":{\"params\":{\"hash\":\"The zonehash to set\",\"node\":\"The node to update.\"}},\"text(bytes32,string)\":{\"params\":{\"key\":\"The text data key to query.\",\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated text data.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"zonehash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated contenthash.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"ABI(bytes32,uint256)\":{\"notice\":\"Returns the ABI associated with an ENS node. Defined in EIP205.\"},\"addr(bytes32)\":{\"notice\":\"Returns the address associated with an ENS node.\"},\"clearRecords(bytes32)\":{\"notice\":\"Increments the record version associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"contenthash(bytes32)\":{\"notice\":\"Returns the contenthash associated with an ENS node.\"},\"dnsRecord(bytes32,bytes32,uint16)\":{\"notice\":\"Obtain a DNS record.\"},\"hasDNSRecords(bytes32,bytes32)\":{\"notice\":\"Check if a given node has records.\"},\"interfaceImplementer(bytes32,bytes4)\":{\"notice\":\"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.\"},\"name(bytes32)\":{\"notice\":\"Returns the name associated with an ENS node, for reverse records. Defined in EIP181.\"},\"pubkey(bytes32)\":{\"notice\":\"Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619.\"},\"setABI(bytes32,uint256,bytes)\":{\"notice\":\"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.\"},\"setAddr(bytes32,address)\":{\"notice\":\"Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setContenthash(bytes32,bytes)\":{\"notice\":\"Sets the contenthash associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setDNSRecords(bytes32,bytes)\":{\"notice\":\"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.\"},\"setInterface(bytes32,bytes4,address)\":{\"notice\":\"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.\"},\"setName(bytes32,string)\":{\"notice\":\"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.\"},\"setPubkey(bytes32,bytes32,bytes32)\":{\"notice\":\"Sets the SECP256k1 public key associated with an ENS node.\"},\"setText(bytes32,string,string)\":{\"notice\":\"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.\"},\"setZonehash(bytes32,bytes)\":{\"notice\":\"setZonehash sets the hash for the zone. May only be called by the owner of that node in the ENS registry.\"},\"text(bytes32,string)\":{\"notice\":\"Returns the text data associated with an ENS node and key.\"},\"zonehash(bytes32)\":{\"notice\":\"zonehash obtains the hash for the zone.\"}},\"notice\":\"A simple resolver anyone can use; only allows the owner of a node to set its address.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/resolvers/OwnedResolver.sol\":\"OwnedResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-2-Clause\\npragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for appending to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n let fpm := add(32, add(ptr, capacity))\\n if lt(fpm, ptr) {\\n revert(0, 0)\\n }\\n mstore(0x40, fpm)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n uint off = buf.buf.length;\\n uint newCapacity = off + len;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(newCapacity, buflen) {\\n mstore(bufptr, newCapacity)\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return append(buf, data, data.length);\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint offPlusOne = off + 1;\\n if (off >= buf.capacity) {\\n resize(buf, offPlusOne * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if gt(offPlusOne, mload(bufptr)) {\\n mstore(bufptr, offPlusOne)\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return append(buf, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return append(buf, data, 32);\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n return buf;\\n }\\n}\\n\",\"keccak256\":\"0xd6dd3b0b327288f8e1b711a609f4040fea602e2ad4bba9febdf2f33b4e56eb0c\",\"license\":\"BSD-2-Clause\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n */\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint256 labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes memory ret) {\\n uint256 len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint256 labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint256 constant RRSIG_TYPE = 0;\\n uint256 constant RRSIG_ALGORITHM = 2;\\n uint256 constant RRSIG_LABELS = 3;\\n uint256 constant RRSIG_TTL = 4;\\n uint256 constant RRSIG_EXPIRATION = 8;\\n uint256 constant RRSIG_INCEPTION = 12;\\n uint256 constant RRSIG_KEY_TAG = 16;\\n uint256 constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(\\n bytes memory data\\n ) internal pure returns (SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(\\n RRSIG_SIGNER_NAME + self.signerName.length,\\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\\n );\\n }\\n\\n function rrs(\\n SignedSet memory rrset\\n ) internal pure returns (RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint256 offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint256 rdataOffset;\\n uint256 nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns (bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint256 rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.offset,\\n nameLength(iter.data, iter.offset)\\n );\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(\\n RRIterator memory iter\\n ) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.rdataOffset,\\n iter.nextOffset - iter.rdataOffset\\n );\\n }\\n\\n uint256 constant DNSKEY_FLAGS = 0;\\n uint256 constant DNSKEY_PROTOCOL = 2;\\n uint256 constant DNSKEY_ALGORITHM = 3;\\n uint256 constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(\\n offset + DNSKEY_PUBKEY,\\n length - DNSKEY_PUBKEY\\n );\\n }\\n\\n uint256 constant DS_KEY_TAG = 0;\\n uint256 constant DS_ALGORITHM = 2;\\n uint256 constant DS_DIGEST_TYPE = 3;\\n uint256 constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n function isSubdomainOf(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n uint256 off = 0;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n while (counts > othercounts) {\\n off = progress(self, off);\\n counts--;\\n }\\n\\n return self.equals(off, other, 0);\\n }\\n\\n function compareNames(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint256 off;\\n uint256 otheroff;\\n uint256 prevoff;\\n uint256 otherprevoff;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if (otheroff == 0) {\\n return 1;\\n }\\n\\n return\\n self.compare(\\n prevoff + 1,\\n self.readUint8(prevoff),\\n other,\\n otherprevoff + 1,\\n other.readUint8(otherprevoff)\\n );\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(\\n uint32 i1,\\n uint32 i2\\n ) internal pure returns (bool) {\\n unchecked {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n }\\n\\n function progress(\\n bytes memory body,\\n uint256 off\\n ) internal pure returns (uint256) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint256 ac1;\\n uint256 ac2;\\n for (uint256 i = 0; i < data.length + 31; i += 32) {\\n uint256 word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if (i + 32 > data.length) {\\n uint256 unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 +=\\n (word &\\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\\n 8;\\n ac2 += (word &\\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 =\\n (ac1 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac1 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac2 =\\n (ac2 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac2 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 =\\n (ac1 &\\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\\n 32);\\n ac1 =\\n (ac1 &\\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\\n 64);\\n ac1 =\\n (ac1 &\\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\\n (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4dd68a6efd7c38f6b0e95ca0c056ecb74f88583da650b1a8639e6e78be36fede\"},\"contracts/resolvers/OwnedResolver.sol\":{\"content\":\"pragma solidity >=0.8.4;\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"./profiles/ABIResolver.sol\\\";\\nimport \\\"./profiles/AddrResolver.sol\\\";\\nimport \\\"./profiles/ContentHashResolver.sol\\\";\\nimport \\\"./profiles/DNSResolver.sol\\\";\\nimport \\\"./profiles/InterfaceResolver.sol\\\";\\nimport \\\"./profiles/NameResolver.sol\\\";\\nimport \\\"./profiles/PubkeyResolver.sol\\\";\\nimport \\\"./profiles/TextResolver.sol\\\";\\nimport \\\"./profiles/ExtendedResolver.sol\\\";\\n\\n/**\\n * A simple resolver anyone can use; only allows the owner of a node to set its\\n * address.\\n */\\ncontract OwnedResolver is\\n Ownable,\\n ABIResolver,\\n AddrResolver,\\n ContentHashResolver,\\n DNSResolver,\\n InterfaceResolver,\\n NameResolver,\\n PubkeyResolver,\\n TextResolver,\\n ExtendedResolver\\n{\\n function isAuthorised(bytes32) internal view override returns (bool) {\\n return msg.sender == owner();\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n )\\n public\\n view\\n virtual\\n override(\\n ABIResolver,\\n AddrResolver,\\n ContentHashResolver,\\n DNSResolver,\\n InterfaceResolver,\\n NameResolver,\\n PubkeyResolver,\\n TextResolver\\n )\\n returns (bool)\\n {\\n return super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x598216380f029db0101c75ebb00a7ccc04bd26c738537238d7f67d9e35603e8b\"},\"contracts/resolvers/ResolverBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"./profiles/IVersionableResolver.sol\\\";\\n\\nabstract contract ResolverBase is ERC165, IVersionableResolver {\\n mapping(bytes32 => uint64) public recordVersions;\\n\\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\\n\\n modifier authorised(bytes32 node) {\\n require(isAuthorised(node));\\n _;\\n }\\n\\n /**\\n * Increments the record version associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function clearRecords(bytes32 node) public virtual authorised(node) {\\n recordVersions[node]++;\\n emit VersionChanged(node, recordVersions[node]);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IVersionableResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x893049fffd6feee06d7acef1680f6e26505bedff62a9f7a17e921c0ba2f66307\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"./IABIResolver.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\n\\nabstract contract ABIResolver is IABIResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\\n\\n /**\\n * Sets the ABI associated with an ENS node.\\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\\n * the empty string.\\n * @param node The node to update.\\n * @param contentType The content type of the ABI\\n * @param data The ABI data.\\n */\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external virtual authorised(node) {\\n // Content types must be powers of 2\\n require(((contentType - 1) & contentType) == 0);\\n\\n versionable_abis[recordVersions[node]][node][contentType] = data;\\n emit ABIChanged(node, contentType);\\n }\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view virtual override returns (uint256, bytes memory) {\\n mapping(uint256 => bytes) storage abiset = versionable_abis[\\n recordVersions[node]\\n ][node];\\n\\n for (\\n uint256 contentType = 1;\\n contentType <= contentTypes;\\n contentType <<= 1\\n ) {\\n if (\\n (contentType & contentTypes) != 0 &&\\n abiset[contentType].length > 0\\n ) {\\n return (contentType, abiset[contentType]);\\n }\\n }\\n\\n return (0, bytes(\\\"\\\"));\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IABIResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x2da96d7750786afe3be019fc6ff768e2d98a5e61d360bd92d8d7bc3c7c1dcc27\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/AddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IAddrResolver.sol\\\";\\nimport \\\"./IAddressResolver.sol\\\";\\n\\nabstract contract AddrResolver is\\n IAddrResolver,\\n IAddressResolver,\\n ResolverBase\\n{\\n uint256 private constant COIN_TYPE_ETH = 60;\\n\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\\n\\n /**\\n * Sets the address associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param a The address to set.\\n */\\n function setAddr(\\n bytes32 node,\\n address a\\n ) external virtual authorised(node) {\\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\\n }\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(\\n bytes32 node\\n ) public view virtual override returns (address payable) {\\n bytes memory a = addr(node, COIN_TYPE_ETH);\\n if (a.length == 0) {\\n return payable(0);\\n }\\n return bytesToAddress(a);\\n }\\n\\n function setAddr(\\n bytes32 node,\\n uint256 coinType,\\n bytes memory a\\n ) public virtual authorised(node) {\\n emit AddressChanged(node, coinType, a);\\n if (coinType == COIN_TYPE_ETH) {\\n emit AddrChanged(node, bytesToAddress(a));\\n }\\n versionable_addresses[recordVersions[node]][node][coinType] = a;\\n }\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) public view virtual override returns (bytes memory) {\\n return versionable_addresses[recordVersions[node]][node][coinType];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IAddrResolver).interfaceId ||\\n interfaceID == type(IAddressResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function bytesToAddress(\\n bytes memory b\\n ) internal pure returns (address payable a) {\\n require(b.length == 20);\\n assembly {\\n a := div(mload(add(b, 32)), exp(256, 12))\\n }\\n }\\n\\n function addressToBytes(address a) internal pure returns (bytes memory b) {\\n b = new bytes(20);\\n assembly {\\n mstore(add(b, 32), mul(a, exp(256, 12)))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7f6ebb3144530a02db03379f33ade869c8408eceed36dfbd751aaff198735b55\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IContentHashResolver.sol\\\";\\n\\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\\n\\n /**\\n * Sets the contenthash associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param hash The contenthash to set\\n */\\n function setContenthash(\\n bytes32 node,\\n bytes calldata hash\\n ) external virtual authorised(node) {\\n versionable_hashes[recordVersions[node]][node] = hash;\\n emit ContenthashChanged(node, hash);\\n }\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(\\n bytes32 node\\n ) external view virtual override returns (bytes memory) {\\n return versionable_hashes[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IContentHashResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xc9755bfb77985375ded880ecab5af41f2b9e8280f30d3e523fe5042ea59f93ea\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/DNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"../../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"./IDNSRecordResolver.sol\\\";\\nimport \\\"./IDNSZoneResolver.sol\\\";\\n\\nabstract contract DNSResolver is\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n ResolverBase\\n{\\n using RRUtils for *;\\n using BytesUtils for bytes;\\n\\n // Zone hashes for the domains.\\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\\n // resource containing a single zonefile.\\n // node => contenthash\\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\\n\\n // The records themselves. Stored as binary RRSETs\\n // node => version => name => resource => data\\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\\n private versionable_records;\\n\\n // Count of number of entries for a given name. Required for DNS resolvers\\n // when resolving wildcards.\\n // node => version => name => number of records\\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\\n private versionable_nameEntriesCount;\\n\\n /**\\n * Set one or more DNS records. Records are supplied in wire-format.\\n * Records with the same node/name/resource must be supplied one after the\\n * other to ensure the data is updated correctly. For example, if the data\\n * was supplied:\\n * a.example.com IN A 1.2.3.4\\n * a.example.com IN A 5.6.7.8\\n * www.example.com IN CNAME a.example.com.\\n * then this would store the two A records for a.example.com correctly as a\\n * single RRSET, however if the data was supplied:\\n * a.example.com IN A 1.2.3.4\\n * www.example.com IN CNAME a.example.com.\\n * a.example.com IN A 5.6.7.8\\n * then this would store the first A record, the CNAME, then the second A\\n * record which would overwrite the first.\\n *\\n * @param node the namehash of the node for which to set the records\\n * @param data the DNS wire format records to set\\n */\\n function setDNSRecords(\\n bytes32 node,\\n bytes calldata data\\n ) external virtual authorised(node) {\\n uint16 resource = 0;\\n uint256 offset = 0;\\n bytes memory name;\\n bytes memory value;\\n bytes32 nameHash;\\n uint64 version = recordVersions[node];\\n // Iterate over the data to add the resource records\\n for (\\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\\n !iter.done();\\n iter.next()\\n ) {\\n if (resource == 0) {\\n resource = iter.dnstype;\\n name = iter.name();\\n nameHash = keccak256(abi.encodePacked(name));\\n value = bytes(iter.rdata());\\n } else {\\n bytes memory newName = iter.name();\\n if (resource != iter.dnstype || !name.equals(newName)) {\\n setDNSRRSet(\\n node,\\n name,\\n resource,\\n data,\\n offset,\\n iter.offset - offset,\\n value.length == 0,\\n version\\n );\\n resource = iter.dnstype;\\n offset = iter.offset;\\n name = newName;\\n nameHash = keccak256(name);\\n value = bytes(iter.rdata());\\n }\\n }\\n }\\n if (name.length > 0) {\\n setDNSRRSet(\\n node,\\n name,\\n resource,\\n data,\\n offset,\\n data.length - offset,\\n value.length == 0,\\n version\\n );\\n }\\n }\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) public view virtual override returns (bytes memory) {\\n return versionable_records[recordVersions[node]][node][name][resource];\\n }\\n\\n /**\\n * Check if a given node has records.\\n * @param node the namehash of the node for which to check the records\\n * @param name the namehash of the node for which to check the records\\n */\\n function hasDNSRecords(\\n bytes32 node,\\n bytes32 name\\n ) public view virtual returns (bool) {\\n return (versionable_nameEntriesCount[recordVersions[node]][node][\\n name\\n ] != 0);\\n }\\n\\n /**\\n * setZonehash sets the hash for the zone.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param hash The zonehash to set\\n */\\n function setZonehash(\\n bytes32 node,\\n bytes calldata hash\\n ) external virtual authorised(node) {\\n uint64 currentRecordVersion = recordVersions[node];\\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\\n node\\n ];\\n versionable_zonehashes[currentRecordVersion][node] = hash;\\n emit DNSZonehashChanged(node, oldhash, hash);\\n }\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(\\n bytes32 node\\n ) external view virtual override returns (bytes memory) {\\n return versionable_zonehashes[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IDNSRecordResolver).interfaceId ||\\n interfaceID == type(IDNSZoneResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function setDNSRRSet(\\n bytes32 node,\\n bytes memory name,\\n uint16 resource,\\n bytes memory data,\\n uint256 offset,\\n uint256 size,\\n bool deleteRecord,\\n uint64 version\\n ) private {\\n bytes32 nameHash = keccak256(name);\\n bytes memory rrData = data.substring(offset, size);\\n if (deleteRecord) {\\n if (\\n versionable_records[version][node][nameHash][resource].length !=\\n 0\\n ) {\\n versionable_nameEntriesCount[version][node][nameHash]--;\\n }\\n delete (versionable_records[version][node][nameHash][resource]);\\n emit DNSRecordDeleted(node, name, resource);\\n } else {\\n if (\\n versionable_records[version][node][nameHash][resource].length ==\\n 0\\n ) {\\n versionable_nameEntriesCount[version][node][nameHash]++;\\n }\\n versionable_records[version][node][nameHash][resource] = rrData;\\n emit DNSRecordChanged(node, name, resource, rrData);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7233e4d2edca222ce6e1cdb07adf127ab52ecaea599fa5369971a7b28dbc59ac\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ncontract ExtendedResolver {\\n function resolve(\\n bytes memory /* name */,\\n bytes memory data\\n ) external view returns (bytes memory) {\\n (bool success, bytes memory result) = address(this).staticcall(data);\\n if (success) {\\n return result;\\n } else {\\n // Revert with the reason provided by the call\\n assembly {\\n revert(add(result, 0x20), mload(result))\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd0e5c93ac9f4d21a0278282e2a32a9c5606a0053ce4781773b7faade57a4a54e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IVersionableResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IVersionableResolver {\\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\\n\\n function recordVersions(bytes32 node) external view returns (uint64);\\n}\\n\",\"keccak256\":\"0xd0d09596f20c57bafb2ffa8521a8c57120e9af6c6b194f9c689d4da56f91a57c\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/InterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./AddrResolver.sol\\\";\\nimport \\\"./IInterfaceResolver.sol\\\";\\n\\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\\n\\n /**\\n * Sets an interface associated with a name.\\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\\n * @param node The node to update.\\n * @param interfaceID The EIP 165 interface ID.\\n * @param implementer The address of a contract that implements this interface for this node.\\n */\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external virtual authorised(node) {\\n versionable_interfaces[recordVersions[node]][node][\\n interfaceID\\n ] = implementer;\\n emit InterfaceChanged(node, interfaceID, implementer);\\n }\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view virtual override returns (address) {\\n address implementer = versionable_interfaces[recordVersions[node]][\\n node\\n ][interfaceID];\\n if (implementer != address(0)) {\\n return implementer;\\n }\\n\\n address a = addr(node);\\n if (a == address(0)) {\\n return address(0);\\n }\\n\\n (bool success, bytes memory returnData) = a.staticcall(\\n abi.encodeWithSignature(\\n \\\"supportsInterface(bytes4)\\\",\\n type(IERC165).interfaceId\\n )\\n );\\n if (!success || returnData.length < 32 || returnData[31] == 0) {\\n // EIP 165 not supported by target\\n return address(0);\\n }\\n\\n (success, returnData) = a.staticcall(\\n abi.encodeWithSignature(\\\"supportsInterface(bytes4)\\\", interfaceID)\\n );\\n if (!success || returnData.length < 32 || returnData[31] == 0) {\\n // Specified interface not supported by target\\n return address(0);\\n }\\n\\n return a;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IInterfaceResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x820ec60183e7a49a4ee399cf4708acb776725c8e4ad275d1f316c152eace0a59\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/NameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./INameResolver.sol\\\";\\n\\nabstract contract NameResolver is INameResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\\n\\n /**\\n * Sets the name associated with an ENS node, for reverse records.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function setName(\\n bytes32 node,\\n string calldata newName\\n ) external virtual authorised(node) {\\n versionable_names[recordVersions[node]][node] = newName;\\n emit NameChanged(node, newName);\\n }\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(\\n bytes32 node\\n ) external view virtual override returns (string memory) {\\n return versionable_names[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(INameResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x52d0bbb8f9dd33fae471ef2f5f6b3118b221954e5bb7ba724885d4562e75b8e2\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/PubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IPubkeyResolver.sol\\\";\\n\\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\\n struct PublicKey {\\n bytes32 x;\\n bytes32 y;\\n }\\n\\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\\n\\n /**\\n * Sets the SECP256k1 public key associated with an ENS node.\\n * @param node The ENS node to query\\n * @param x the X coordinate of the curve point for the public key.\\n * @param y the Y coordinate of the curve point for the public key.\\n */\\n function setPubkey(\\n bytes32 node,\\n bytes32 x,\\n bytes32 y\\n ) external virtual authorised(node) {\\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\\n emit PubkeyChanged(node, x, y);\\n }\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(\\n bytes32 node\\n ) external view virtual override returns (bytes32 x, bytes32 y) {\\n uint64 currentRecordVersion = recordVersions[node];\\n return (\\n versionable_pubkeys[currentRecordVersion][node].x,\\n versionable_pubkeys[currentRecordVersion][node].y\\n );\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IPubkeyResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x1a1f10a0e40520c998a9296fc81c092c81521e05a784e9bd9ee44cc4c62c8c78\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/TextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./ITextResolver.sol\\\";\\n\\nabstract contract TextResolver is ITextResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\\n\\n /**\\n * Sets the text data associated with an ENS node and key.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param key The key to set.\\n * @param value The text data value to set.\\n */\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external virtual authorised(node) {\\n versionable_texts[recordVersions[node]][node][key] = value;\\n emit TextChanged(node, key, key, value);\\n }\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view virtual override returns (string memory) {\\n return versionable_texts[recordVersions[node]][node][key];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(ITextResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xf9bedd807add38136779d84083ac2fa4f8c92d017c9e1a72fbc9003fa5074379\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61292b8061007e6000396000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c8063715018a6116100f9578063c869023311610097578063d700ff3311610071578063d700ff3314610450578063e59d895d14610493578063f1cb7e06146104a6578063f2fde38b146104b957600080fd5b8063c8690233146103d0578063ce3decdc1461042a578063d5fa2b001461043d57600080fd5b80638da5cb5b116100d35780638da5cb5b146103865780639061b92314610397578063a8fa5682146103aa578063bc1c58d1146103bd57600080fd5b8063715018a61461035857806377372213146103605780638b95dd711461037357600080fd5b80633603d7581161016657806359d1d43c1161014057806359d1d43c146102ff5780635c98042b1461031f578063623195b014610332578063691f34311461034557600080fd5b80633603d7581461028b5780633b3b57de1461029e5780634cbf6ba4146102b157600080fd5b8063124a319c116101a2578063124a319c146102195780632203ab561461024457806329cd62ea14610265578063304e6ade1461027857600080fd5b806301ffc9a7146101c95780630af179d7146101f157806310f13a8c14610206575b600080fd5b6101dc6101d736600461205c565b6104cc565b60405190151581526020015b60405180910390f35b6102046101ff3660046120b9565b6104dd565b005b610204610214366004612105565b6106ef565b61022c61022736600461217f565b6107c4565b6040516001600160a01b0390911681526020016101e8565b6102576102523660046121ab565b610a72565b6040516101e892919061221d565b610204610273366004612236565b610baa565b6102046102863660046120b9565b610c52565b610204610299366004612262565b610cd6565b61022c6102ac366004612262565b610d81565b6101dc6102bf3660046121ab565b60008281526001602090815260408083205467ffffffffffffffff1683526007825280832094835293815283822092825291909152205461ffff16151590565b61031261030d3660046120b9565b610db3565b6040516101e8919061227b565b61031261032d366004612262565b610e95565b61020461034036600461228e565b610f56565b610312610353366004612262565b610ffb565b610204611037565b61020461036e3660046120b9565b61104b565b610204610381366004612384565b6110cf565b6000546001600160a01b031661022c565b6103126103a53660046123d4565b6111b7565b6103126103b8366004612438565b611230565b6103126103cb366004612262565b611280565b6104156103de366004612262565b60008181526001602081815260408084205467ffffffffffffffff168452600a825280842094845293905291902080549101549091565b604080519283526020830191909152016101e8565b6102046104383660046120b9565b6112bc565b61020461044b36600461248f565b611407565b61047a61045e366004612262565b60016020526000908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016101e8565b6102046104a13660046124b2565b611434565b6103126104b43660046121ab565b6114f0565b6102046104c73660046124ee565b6115ba565b60006104d78261164f565b92915050565b60005483906001600160a01b031633146104f657600080fd5b6000848152600160209081526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff90911691839161055e9183918d908d9081908401838280828437600092019190915250929392505061168d9050565b90505b80515160208201511015610688578661ffff166000036105c6578060400151965061058b816116ee565b94508460405160200161059e9190612509565b6040516020818303038152906040528051906020012092506105bf8161170f565b935061067a565b60006105d1826116ee565b9050816040015161ffff168861ffff161415806105f557506105f3868261172b565b155b15610678576106518c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d915061064890829061253b565b8b51158a611749565b8160400151975081602001519650809550858051906020012093506106758261170f565b94505b505b610683816119b6565b610561565b508351156106e3576106e38a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92506106da91508290508f61253b565b89511588611749565b50505050505050505050565b60005485906001600160a01b0316331461070857600080fd5b60008681526001602090815260408083205467ffffffffffffffff168352600b82528083208984529091529081902090518491849161074a908990899061254e565b908152602001604051809103902091826107659291906125e6565b50848460405161077692919061254e565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516107b494939291906126cf565b60405180910390a3505050505050565b60008281526001602090815260408083205467ffffffffffffffff1683526008825280832085845282528083206001600160e01b0319851684529091528120546001600160a01b0316801561081a5790506104d7565b600061082585610d81565b90506001600160a01b038116610840576000925050506104d7565b6040516301ffc9a760e01b602482015260009081906001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516108ad9190612509565b600060405180830381855afa9150503d80600081146108e8576040519150601f19603f3d011682016040523d82523d6000602084013e6108ed565b606091505b5091509150811580610900575060208151105b80610942575080601f8151811061091957610919612701565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109545760009450505050506104d7565b6040516001600160e01b0319871660248201526001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516109bf9190612509565b600060405180830381855afa9150503d80600081146109fa576040519150601f19603f3d011682016040523d82523d6000602084013e6109ff565b606091505b509092509050811580610a13575060208151105b80610a55575080601f81518110610a2c57610a2c612701565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610a675760009450505050506104d7565b509095945050505050565b60008281526001602081815260408084205467ffffffffffffffff1684526002825280842086855290915282206060915b848111610b8a5780851615801590610ad3575060008181526020839052604081208054610acf9061255e565b9050115b15610b825780826000838152602001908152602001600020808054610af79061255e565b80601f0160208091040260200160405190810160405280929190818152602001828054610b239061255e565b8015610b705780601f10610b4557610100808354040283529160200191610b70565b820191906000526020600020905b815481529060010190602001808311610b5357829003601f168201915b50505050509050935093505050610ba3565b60011b610aa3565b5060006040518060200160405280600081525092509250505b9250929050565b60005483906001600160a01b03163314610bc357600080fd5b6040805180820182528481526020808201858152600088815260018084528582205467ffffffffffffffff168252600a84528582208a835290935284902092518355519101555184907f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4690610c449086908690918252602082015260400190565b60405180910390a250505050565b60005483906001600160a01b03163314610c6b57600080fd5b60008481526001602090815260408083205467ffffffffffffffff168352600482528083208784529091529020610ca38385836125e6565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610c44929190612717565b60005481906001600160a01b03163314610cef57600080fd5b6000828152600160205260408120805467ffffffffffffffff1691610d138361272b565b82546101009290920a67ffffffffffffffff8181021990931691831602179091556000848152600160209081526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610d8f83603c6114f0565b90508051600003610da35750600092915050565b610dac81611a9e565b9392505050565b60008381526001602090815260408083205467ffffffffffffffff168352600b825280832086845290915290819020905160609190610df5908590859061254e565b90815260200160405180910390208054610e0e9061255e565b80601f0160208091040260200160405190810160405280929190818152602001828054610e3a9061255e565b8015610e875780601f10610e5c57610100808354040283529160200191610e87565b820191906000526020600020905b815481529060010190602001808311610e6a57829003601f168201915b505050505090509392505050565b60008181526001602090815260408083205467ffffffffffffffff168352600582528083208484529091529020805460609190610ed19061255e565b80601f0160208091040260200160405190810160405280929190818152602001828054610efd9061255e565b8015610f4a5780601f10610f1f57610100808354040283529160200191610f4a565b820191906000526020600020905b815481529060010190602001808311610f2d57829003601f168201915b50505050509050919050565b60005484906001600160a01b03163314610f6f57600080fd5b83610f7b60018261253b565b1615610f8657600080fd5b60008581526001602090815260408083205467ffffffffffffffff1683526002825280832088845282528083208784529091529020610fc68385836125e6565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b60008181526001602090815260408083205467ffffffffffffffff168352600982528083208484529091529020805460609190610ed19061255e565b61103f611ac6565b6110496000611b20565b565b60005483906001600160a01b0316331461106457600080fd5b60008481526001602090815260408083205467ffffffffffffffff16835260098252808320878452909152902061109c8385836125e6565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610c44929190612717565b60005483906001600160a01b031633146110e857600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af752848460405161111a92919061221d565b60405180910390a2603c830361117157837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd261115584611a9e565b6040516001600160a01b03909116815260200160405180910390a25b60008481526001602090815260408083205467ffffffffffffffff16835260038252808320878452825280832086845290915290206111b08382612752565b5050505050565b6060600080306001600160a01b0316846040516111d49190612509565b600060405180830381855afa9150503d806000811461120f576040519150601f19603f3d011682016040523d82523d6000602084013e611214565b606091505b509150915081156112285791506104d79050565b805160208201fd5b60008381526001602090815260408083205467ffffffffffffffff168352600682528083208684528252808320858452825280832061ffff851684529091529020805460609190610e0e9061255e565b60008181526001602090815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610ed19061255e565b60005483906001600160a01b031633146112d557600080fd5b60008481526001602090815260408083205467ffffffffffffffff1680845260058352818420888552909252822080549192916113119061255e565b80601f016020809104026020016040519081016040528092919081815260200182805461133d9061255e565b801561138a5780601f1061135f5761010080835404028352916020019161138a565b820191906000526020600020905b81548152906001019060200180831161136d57829003601f168201915b5050505067ffffffffffffffff841660009081526005602090815260408083208b845290915290209192506113c290508587836125e6565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f858287876040516113f793929190612812565b60405180910390a2505050505050565b60005482906001600160a01b0316331461142057600080fd5b61142f83603c61038185611b7d565b505050565b60005483906001600160a01b0316331461144d57600080fd5b60008481526001602090815260408083205467ffffffffffffffff1683526008825280832087845282528083206001600160e01b0319871680855290835292819020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b60008281526001602090815260408083205467ffffffffffffffff16835260038252808320858452825280832084845290915290208054606091906115349061255e565b80601f01602080910402602001604051908101604052809291908181526020018280546115609061255e565b80156115ad5780601f10611582576101008083540402835291602001916115ad565b820191906000526020600020905b81548152906001019060200180831161159057829003601f168201915b5050505050905092915050565b6115c2611ac6565b6001600160a01b0381166116435760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61164c81611b20565b50565b60006001600160e01b031982167f59d1d43c0000000000000000000000000000000000000000000000000000000014806104d757506104d782611bb6565b6116db6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c081018290526104d7816119b6565b602081015181516060916104d7916117069082611bf4565b84519190611c56565b60a081015160c08201516060916104d79161170690829061253b565b600081518351148015610dac5750610dac8360008460008751611ccd565b86516020880120600061175d878787611c56565b905083156118875767ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152902080546117a89061255e565b1590506118075767ffffffffffffffff831660009081526007602090815260408083208d845282528083208584529091528120805461ffff16916117eb83612842565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152812061184891611ff1565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a60405161187a929190612860565b60405180910390a26106e3565b67ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152902080546118ca9061255e565b905060000361192b5767ffffffffffffffff831660009081526007602090815260408083208d845282528083208584529091528120805461ffff169161190f83612886565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152902061196d8282612752565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a846040516119a29392919061289d565b60405180910390a250505050505050505050565b60c081015160208201819052815151116119cd5750565b60006119e182600001518360200151611bf4565b82602001516119f091906128cc565b82519091506119ff9082611cf0565b61ffff166040830152611a136002826128cc565b8251909150611a229082611cf0565b61ffff166060830152611a366002826128cc565b8251909150611a459082611d18565b63ffffffff166080830152611a5b6004826128cc565b8251909150600090611a6d9083611cf0565b61ffff169050611a7e6002836128cc565b60a084018190529150611a9181836128cc565b60c0909301929092525050565b60008151601414611aae57600080fd5b50602001516c01000000000000000000000000900490565b6000546001600160a01b031633146110495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161163a565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60006001600160e01b031982167fc86902330000000000000000000000000000000000000000000000000000000014806104d757506104d782611d42565b6000815b83518110611c0857611c086128df565b6000611c148583611d80565b60ff169050611c248160016128cc565b611c2e90836128cc565b915080600003611c3e5750611c44565b50611bf8565b611c4e838261253b565b949350505050565b8251606090611c6583856128cc565b1115611c7057600080fd5b60008267ffffffffffffffff811115611c8b57611c8b6122e1565b6040519080825280601f01601f191660200182016040528015611cb5576020820181803683370190505b50905060208082019086860101610a67828287611da4565b6000611cda848484611dfa565b611ce5878785611dfa565b149695505050505050565b8151600090611d008360026128cc565b1115611d0b57600080fd5b50016002015161ffff1690565b8151600090611d288360046128cc565b1115611d3357600080fd5b50016004015163ffffffff1690565b60006001600160e01b031982167f691f34310000000000000000000000000000000000000000000000000000000014806104d757506104d782611e1e565b6000828281518110611d9457611d94612701565b016020015160f81c905092915050565b60208110611ddc5781518352611dbb6020846128cc565b9250611dc86020836128cc565b9150611dd560208261253b565b9050611da4565b905182516020929092036101000a6000190180199091169116179052565b8251600090611e0983856128cc565b1115611e1457600080fd5b5091016020012090565b60006001600160e01b031982167f124a319c0000000000000000000000000000000000000000000000000000000014806104d757506104d78260006001600160e01b031982167fa8fa5682000000000000000000000000000000000000000000000000000000001480611eba57506001600160e01b031982167f5c98042b00000000000000000000000000000000000000000000000000000000145b806104d757506104d78260006001600160e01b031982167fbc1c58d10000000000000000000000000000000000000000000000000000000014806104d757506104d78260006001600160e01b031982167f3b3b57de000000000000000000000000000000000000000000000000000000001480611f6057506001600160e01b031982167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b806104d757506104d78260006001600160e01b031982167f2203ab560000000000000000000000000000000000000000000000000000000014806104d757506104d78260006001600160e01b031982167fd700ff330000000000000000000000000000000000000000000000000000000014806104d757506301ffc9a760e01b6001600160e01b03198316146104d7565b508054611ffd9061255e565b6000825580601f1061200d575050565b601f01602090049060005260206000209081019061164c91905b8082111561203b5760008155600101612027565b5090565b80356001600160e01b03198116811461205757600080fd5b919050565b60006020828403121561206e57600080fd5b610dac8261203f565b60008083601f84011261208957600080fd5b50813567ffffffffffffffff8111156120a157600080fd5b602083019150836020828501011115610ba357600080fd5b6000806000604084860312156120ce57600080fd5b83359250602084013567ffffffffffffffff8111156120ec57600080fd5b6120f886828701612077565b9497909650939450505050565b60008060008060006060868803121561211d57600080fd5b85359450602086013567ffffffffffffffff8082111561213c57600080fd5b61214889838a01612077565b9096509450604088013591508082111561216157600080fd5b5061216e88828901612077565b969995985093965092949392505050565b6000806040838503121561219257600080fd5b823591506121a26020840161203f565b90509250929050565b600080604083850312156121be57600080fd5b50508035926020909101359150565b60005b838110156121e85781810151838201526020016121d0565b50506000910152565b600081518084526122098160208601602086016121cd565b601f01601f19169290920160200192915050565b828152604060208201526000611c4e60408301846121f1565b60008060006060848603121561224b57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561227457600080fd5b5035919050565b602081526000610dac60208301846121f1565b600080600080606085870312156122a457600080fd5b8435935060208501359250604085013567ffffffffffffffff8111156122c957600080fd5b6122d587828801612077565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261230857600080fd5b813567ffffffffffffffff80821115612323576123236122e1565b604051601f8301601f19908116603f0116810190828211818310171561234b5761234b6122e1565b8160405283815286602085880101111561236457600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561239957600080fd5b8335925060208401359150604084013567ffffffffffffffff8111156123be57600080fd5b6123ca868287016122f7565b9150509250925092565b600080604083850312156123e757600080fd5b823567ffffffffffffffff808211156123ff57600080fd5b61240b868387016122f7565b9350602085013591508082111561242157600080fd5b5061242e858286016122f7565b9150509250929050565b60008060006060848603121561244d57600080fd5b8335925060208401359150604084013561ffff8116811461246d57600080fd5b809150509250925092565b80356001600160a01b038116811461205757600080fd5b600080604083850312156124a257600080fd5b823591506121a260208401612478565b6000806000606084860312156124c757600080fd5b833592506124d76020850161203f565b91506124e560408501612478565b90509250925092565b60006020828403121561250057600080fd5b610dac82612478565b6000825161251b8184602087016121cd565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b818103818111156104d7576104d7612525565b8183823760009101908152919050565b600181811c9082168061257257607f821691505b60208210810361259257634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561142f57600081815260208120601f850160051c810160208610156125bf5750805b601f850160051c820191505b818110156125de578281556001016125cb565b505050505050565b67ffffffffffffffff8311156125fe576125fe6122e1565b6126128361260c835461255e565b83612598565b6000601f841160018114612646576000851561262e5750838201355b600019600387901b1c1916600186901b1783556111b0565b600083815260209020601f19861690835b828110156126775786850135825560209485019460019092019101612657565b50868210156126945760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6040815260006126e36040830186886126a6565b82810360208401526126f68185876126a6565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b602081526000611c4e6020830184866126a6565b600067ffffffffffffffff80831681810361274857612748612525565b6001019392505050565b815167ffffffffffffffff81111561276c5761276c6122e1565b6127808161277a845461255e565b84612598565b602080601f8311600181146127b5576000841561279d5750858301515b600019600386901b1c1916600185901b1785556125de565b600085815260208120601f198616915b828110156127e4578886015182559484019460019091019084016127c5565b50858210156128025787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60408152600061282560408301866121f1565b82810360208401526128388185876126a6565b9695505050505050565b600061ffff82168061285657612856612525565b6000190192915050565b60408152600061287360408301856121f1565b905061ffff831660208301529392505050565b600061ffff80831681810361274857612748612525565b6060815260006128b060608301866121f1565b61ffff85166020840152828103604084015261283881856121f1565b808201808211156104d7576104d7612525565b634e487b7160e01b600052600160045260246000fdfea26469706673582212200e874f1a1a9d13ec53acda9805a38302d106a71218c75e896a2ee08693ddecef64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101c45760003560e01c8063715018a6116100f9578063c869023311610097578063d700ff3311610071578063d700ff3314610450578063e59d895d14610493578063f1cb7e06146104a6578063f2fde38b146104b957600080fd5b8063c8690233146103d0578063ce3decdc1461042a578063d5fa2b001461043d57600080fd5b80638da5cb5b116100d35780638da5cb5b146103865780639061b92314610397578063a8fa5682146103aa578063bc1c58d1146103bd57600080fd5b8063715018a61461035857806377372213146103605780638b95dd711461037357600080fd5b80633603d7581161016657806359d1d43c1161014057806359d1d43c146102ff5780635c98042b1461031f578063623195b014610332578063691f34311461034557600080fd5b80633603d7581461028b5780633b3b57de1461029e5780634cbf6ba4146102b157600080fd5b8063124a319c116101a2578063124a319c146102195780632203ab561461024457806329cd62ea14610265578063304e6ade1461027857600080fd5b806301ffc9a7146101c95780630af179d7146101f157806310f13a8c14610206575b600080fd5b6101dc6101d736600461205c565b6104cc565b60405190151581526020015b60405180910390f35b6102046101ff3660046120b9565b6104dd565b005b610204610214366004612105565b6106ef565b61022c61022736600461217f565b6107c4565b6040516001600160a01b0390911681526020016101e8565b6102576102523660046121ab565b610a72565b6040516101e892919061221d565b610204610273366004612236565b610baa565b6102046102863660046120b9565b610c52565b610204610299366004612262565b610cd6565b61022c6102ac366004612262565b610d81565b6101dc6102bf3660046121ab565b60008281526001602090815260408083205467ffffffffffffffff1683526007825280832094835293815283822092825291909152205461ffff16151590565b61031261030d3660046120b9565b610db3565b6040516101e8919061227b565b61031261032d366004612262565b610e95565b61020461034036600461228e565b610f56565b610312610353366004612262565b610ffb565b610204611037565b61020461036e3660046120b9565b61104b565b610204610381366004612384565b6110cf565b6000546001600160a01b031661022c565b6103126103a53660046123d4565b6111b7565b6103126103b8366004612438565b611230565b6103126103cb366004612262565b611280565b6104156103de366004612262565b60008181526001602081815260408084205467ffffffffffffffff168452600a825280842094845293905291902080549101549091565b604080519283526020830191909152016101e8565b6102046104383660046120b9565b6112bc565b61020461044b36600461248f565b611407565b61047a61045e366004612262565b60016020526000908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016101e8565b6102046104a13660046124b2565b611434565b6103126104b43660046121ab565b6114f0565b6102046104c73660046124ee565b6115ba565b60006104d78261164f565b92915050565b60005483906001600160a01b031633146104f657600080fd5b6000848152600160209081526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff90911691839161055e9183918d908d9081908401838280828437600092019190915250929392505061168d9050565b90505b80515160208201511015610688578661ffff166000036105c6578060400151965061058b816116ee565b94508460405160200161059e9190612509565b6040516020818303038152906040528051906020012092506105bf8161170f565b935061067a565b60006105d1826116ee565b9050816040015161ffff168861ffff161415806105f557506105f3868261172b565b155b15610678576106518c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d915061064890829061253b565b8b51158a611749565b8160400151975081602001519650809550858051906020012093506106758261170f565b94505b505b610683816119b6565b610561565b508351156106e3576106e38a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92506106da91508290508f61253b565b89511588611749565b50505050505050505050565b60005485906001600160a01b0316331461070857600080fd5b60008681526001602090815260408083205467ffffffffffffffff168352600b82528083208984529091529081902090518491849161074a908990899061254e565b908152602001604051809103902091826107659291906125e6565b50848460405161077692919061254e565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516107b494939291906126cf565b60405180910390a3505050505050565b60008281526001602090815260408083205467ffffffffffffffff1683526008825280832085845282528083206001600160e01b0319851684529091528120546001600160a01b0316801561081a5790506104d7565b600061082585610d81565b90506001600160a01b038116610840576000925050506104d7565b6040516301ffc9a760e01b602482015260009081906001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516108ad9190612509565b600060405180830381855afa9150503d80600081146108e8576040519150601f19603f3d011682016040523d82523d6000602084013e6108ed565b606091505b5091509150811580610900575060208151105b80610942575080601f8151811061091957610919612701565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109545760009450505050506104d7565b6040516001600160e01b0319871660248201526001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516109bf9190612509565b600060405180830381855afa9150503d80600081146109fa576040519150601f19603f3d011682016040523d82523d6000602084013e6109ff565b606091505b509092509050811580610a13575060208151105b80610a55575080601f81518110610a2c57610a2c612701565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610a675760009450505050506104d7565b509095945050505050565b60008281526001602081815260408084205467ffffffffffffffff1684526002825280842086855290915282206060915b848111610b8a5780851615801590610ad3575060008181526020839052604081208054610acf9061255e565b9050115b15610b825780826000838152602001908152602001600020808054610af79061255e565b80601f0160208091040260200160405190810160405280929190818152602001828054610b239061255e565b8015610b705780601f10610b4557610100808354040283529160200191610b70565b820191906000526020600020905b815481529060010190602001808311610b5357829003601f168201915b50505050509050935093505050610ba3565b60011b610aa3565b5060006040518060200160405280600081525092509250505b9250929050565b60005483906001600160a01b03163314610bc357600080fd5b6040805180820182528481526020808201858152600088815260018084528582205467ffffffffffffffff168252600a84528582208a835290935284902092518355519101555184907f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4690610c449086908690918252602082015260400190565b60405180910390a250505050565b60005483906001600160a01b03163314610c6b57600080fd5b60008481526001602090815260408083205467ffffffffffffffff168352600482528083208784529091529020610ca38385836125e6565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610c44929190612717565b60005481906001600160a01b03163314610cef57600080fd5b6000828152600160205260408120805467ffffffffffffffff1691610d138361272b565b82546101009290920a67ffffffffffffffff8181021990931691831602179091556000848152600160209081526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610d8f83603c6114f0565b90508051600003610da35750600092915050565b610dac81611a9e565b9392505050565b60008381526001602090815260408083205467ffffffffffffffff168352600b825280832086845290915290819020905160609190610df5908590859061254e565b90815260200160405180910390208054610e0e9061255e565b80601f0160208091040260200160405190810160405280929190818152602001828054610e3a9061255e565b8015610e875780601f10610e5c57610100808354040283529160200191610e87565b820191906000526020600020905b815481529060010190602001808311610e6a57829003601f168201915b505050505090509392505050565b60008181526001602090815260408083205467ffffffffffffffff168352600582528083208484529091529020805460609190610ed19061255e565b80601f0160208091040260200160405190810160405280929190818152602001828054610efd9061255e565b8015610f4a5780601f10610f1f57610100808354040283529160200191610f4a565b820191906000526020600020905b815481529060010190602001808311610f2d57829003601f168201915b50505050509050919050565b60005484906001600160a01b03163314610f6f57600080fd5b83610f7b60018261253b565b1615610f8657600080fd5b60008581526001602090815260408083205467ffffffffffffffff1683526002825280832088845282528083208784529091529020610fc68385836125e6565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b60008181526001602090815260408083205467ffffffffffffffff168352600982528083208484529091529020805460609190610ed19061255e565b61103f611ac6565b6110496000611b20565b565b60005483906001600160a01b0316331461106457600080fd5b60008481526001602090815260408083205467ffffffffffffffff16835260098252808320878452909152902061109c8385836125e6565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610c44929190612717565b60005483906001600160a01b031633146110e857600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af752848460405161111a92919061221d565b60405180910390a2603c830361117157837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd261115584611a9e565b6040516001600160a01b03909116815260200160405180910390a25b60008481526001602090815260408083205467ffffffffffffffff16835260038252808320878452825280832086845290915290206111b08382612752565b5050505050565b6060600080306001600160a01b0316846040516111d49190612509565b600060405180830381855afa9150503d806000811461120f576040519150601f19603f3d011682016040523d82523d6000602084013e611214565b606091505b509150915081156112285791506104d79050565b805160208201fd5b60008381526001602090815260408083205467ffffffffffffffff168352600682528083208684528252808320858452825280832061ffff851684529091529020805460609190610e0e9061255e565b60008181526001602090815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610ed19061255e565b60005483906001600160a01b031633146112d557600080fd5b60008481526001602090815260408083205467ffffffffffffffff1680845260058352818420888552909252822080549192916113119061255e565b80601f016020809104026020016040519081016040528092919081815260200182805461133d9061255e565b801561138a5780601f1061135f5761010080835404028352916020019161138a565b820191906000526020600020905b81548152906001019060200180831161136d57829003601f168201915b5050505067ffffffffffffffff841660009081526005602090815260408083208b845290915290209192506113c290508587836125e6565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f858287876040516113f793929190612812565b60405180910390a2505050505050565b60005482906001600160a01b0316331461142057600080fd5b61142f83603c61038185611b7d565b505050565b60005483906001600160a01b0316331461144d57600080fd5b60008481526001602090815260408083205467ffffffffffffffff1683526008825280832087845282528083206001600160e01b0319871680855290835292819020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b60008281526001602090815260408083205467ffffffffffffffff16835260038252808320858452825280832084845290915290208054606091906115349061255e565b80601f01602080910402602001604051908101604052809291908181526020018280546115609061255e565b80156115ad5780601f10611582576101008083540402835291602001916115ad565b820191906000526020600020905b81548152906001019060200180831161159057829003601f168201915b5050505050905092915050565b6115c2611ac6565b6001600160a01b0381166116435760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61164c81611b20565b50565b60006001600160e01b031982167f59d1d43c0000000000000000000000000000000000000000000000000000000014806104d757506104d782611bb6565b6116db6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c081018290526104d7816119b6565b602081015181516060916104d7916117069082611bf4565b84519190611c56565b60a081015160c08201516060916104d79161170690829061253b565b600081518351148015610dac5750610dac8360008460008751611ccd565b86516020880120600061175d878787611c56565b905083156118875767ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152902080546117a89061255e565b1590506118075767ffffffffffffffff831660009081526007602090815260408083208d845282528083208584529091528120805461ffff16916117eb83612842565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152812061184891611ff1565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a60405161187a929190612860565b60405180910390a26106e3565b67ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152902080546118ca9061255e565b905060000361192b5767ffffffffffffffff831660009081526007602090815260408083208d845282528083208584529091528120805461ffff169161190f83612886565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152902061196d8282612752565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a846040516119a29392919061289d565b60405180910390a250505050505050505050565b60c081015160208201819052815151116119cd5750565b60006119e182600001518360200151611bf4565b82602001516119f091906128cc565b82519091506119ff9082611cf0565b61ffff166040830152611a136002826128cc565b8251909150611a229082611cf0565b61ffff166060830152611a366002826128cc565b8251909150611a459082611d18565b63ffffffff166080830152611a5b6004826128cc565b8251909150600090611a6d9083611cf0565b61ffff169050611a7e6002836128cc565b60a084018190529150611a9181836128cc565b60c0909301929092525050565b60008151601414611aae57600080fd5b50602001516c01000000000000000000000000900490565b6000546001600160a01b031633146110495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161163a565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60006001600160e01b031982167fc86902330000000000000000000000000000000000000000000000000000000014806104d757506104d782611d42565b6000815b83518110611c0857611c086128df565b6000611c148583611d80565b60ff169050611c248160016128cc565b611c2e90836128cc565b915080600003611c3e5750611c44565b50611bf8565b611c4e838261253b565b949350505050565b8251606090611c6583856128cc565b1115611c7057600080fd5b60008267ffffffffffffffff811115611c8b57611c8b6122e1565b6040519080825280601f01601f191660200182016040528015611cb5576020820181803683370190505b50905060208082019086860101610a67828287611da4565b6000611cda848484611dfa565b611ce5878785611dfa565b149695505050505050565b8151600090611d008360026128cc565b1115611d0b57600080fd5b50016002015161ffff1690565b8151600090611d288360046128cc565b1115611d3357600080fd5b50016004015163ffffffff1690565b60006001600160e01b031982167f691f34310000000000000000000000000000000000000000000000000000000014806104d757506104d782611e1e565b6000828281518110611d9457611d94612701565b016020015160f81c905092915050565b60208110611ddc5781518352611dbb6020846128cc565b9250611dc86020836128cc565b9150611dd560208261253b565b9050611da4565b905182516020929092036101000a6000190180199091169116179052565b8251600090611e0983856128cc565b1115611e1457600080fd5b5091016020012090565b60006001600160e01b031982167f124a319c0000000000000000000000000000000000000000000000000000000014806104d757506104d78260006001600160e01b031982167fa8fa5682000000000000000000000000000000000000000000000000000000001480611eba57506001600160e01b031982167f5c98042b00000000000000000000000000000000000000000000000000000000145b806104d757506104d78260006001600160e01b031982167fbc1c58d10000000000000000000000000000000000000000000000000000000014806104d757506104d78260006001600160e01b031982167f3b3b57de000000000000000000000000000000000000000000000000000000001480611f6057506001600160e01b031982167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b806104d757506104d78260006001600160e01b031982167f2203ab560000000000000000000000000000000000000000000000000000000014806104d757506104d78260006001600160e01b031982167fd700ff330000000000000000000000000000000000000000000000000000000014806104d757506301ffc9a760e01b6001600160e01b03198316146104d7565b508054611ffd9061255e565b6000825580601f1061200d575050565b601f01602090049060005260206000209081019061164c91905b8082111561203b5760008155600101612027565b5090565b80356001600160e01b03198116811461205757600080fd5b919050565b60006020828403121561206e57600080fd5b610dac8261203f565b60008083601f84011261208957600080fd5b50813567ffffffffffffffff8111156120a157600080fd5b602083019150836020828501011115610ba357600080fd5b6000806000604084860312156120ce57600080fd5b83359250602084013567ffffffffffffffff8111156120ec57600080fd5b6120f886828701612077565b9497909650939450505050565b60008060008060006060868803121561211d57600080fd5b85359450602086013567ffffffffffffffff8082111561213c57600080fd5b61214889838a01612077565b9096509450604088013591508082111561216157600080fd5b5061216e88828901612077565b969995985093965092949392505050565b6000806040838503121561219257600080fd5b823591506121a26020840161203f565b90509250929050565b600080604083850312156121be57600080fd5b50508035926020909101359150565b60005b838110156121e85781810151838201526020016121d0565b50506000910152565b600081518084526122098160208601602086016121cd565b601f01601f19169290920160200192915050565b828152604060208201526000611c4e60408301846121f1565b60008060006060848603121561224b57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561227457600080fd5b5035919050565b602081526000610dac60208301846121f1565b600080600080606085870312156122a457600080fd5b8435935060208501359250604085013567ffffffffffffffff8111156122c957600080fd5b6122d587828801612077565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261230857600080fd5b813567ffffffffffffffff80821115612323576123236122e1565b604051601f8301601f19908116603f0116810190828211818310171561234b5761234b6122e1565b8160405283815286602085880101111561236457600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561239957600080fd5b8335925060208401359150604084013567ffffffffffffffff8111156123be57600080fd5b6123ca868287016122f7565b9150509250925092565b600080604083850312156123e757600080fd5b823567ffffffffffffffff808211156123ff57600080fd5b61240b868387016122f7565b9350602085013591508082111561242157600080fd5b5061242e858286016122f7565b9150509250929050565b60008060006060848603121561244d57600080fd5b8335925060208401359150604084013561ffff8116811461246d57600080fd5b809150509250925092565b80356001600160a01b038116811461205757600080fd5b600080604083850312156124a257600080fd5b823591506121a260208401612478565b6000806000606084860312156124c757600080fd5b833592506124d76020850161203f565b91506124e560408501612478565b90509250925092565b60006020828403121561250057600080fd5b610dac82612478565b6000825161251b8184602087016121cd565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b818103818111156104d7576104d7612525565b8183823760009101908152919050565b600181811c9082168061257257607f821691505b60208210810361259257634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561142f57600081815260208120601f850160051c810160208610156125bf5750805b601f850160051c820191505b818110156125de578281556001016125cb565b505050505050565b67ffffffffffffffff8311156125fe576125fe6122e1565b6126128361260c835461255e565b83612598565b6000601f841160018114612646576000851561262e5750838201355b600019600387901b1c1916600186901b1783556111b0565b600083815260209020601f19861690835b828110156126775786850135825560209485019460019092019101612657565b50868210156126945760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6040815260006126e36040830186886126a6565b82810360208401526126f68185876126a6565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b602081526000611c4e6020830184866126a6565b600067ffffffffffffffff80831681810361274857612748612525565b6001019392505050565b815167ffffffffffffffff81111561276c5761276c6122e1565b6127808161277a845461255e565b84612598565b602080601f8311600181146127b5576000841561279d5750858301515b600019600386901b1c1916600185901b1785556125de565b600085815260208120601f198616915b828110156127e4578886015182559484019460019091019084016127c5565b50858210156128025787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60408152600061282560408301866121f1565b82810360208401526128388185876126a6565b9695505050505050565b600061ffff82168061285657612856612525565b6000190192915050565b60408152600061287360408301856121f1565b905061ffff831660208301529392505050565b600061ffff80831681810361274857612748612525565b6060815260006128b060608301866121f1565b61ffff85166020840152828103604084015261283881856121f1565b808201808211156104d7576104d7612525565b634e487b7160e01b600052600160045260246000fdfea26469706673582212200e874f1a1a9d13ec53acda9805a38302d106a71218c75e896a2ee08693ddecef64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "ABI(bytes32,uint256)": { + "params": { + "contentTypes": "A bitwise OR of the ABI formats accepted by the caller.", + "node": "The ENS node to query" + }, + "returns": { + "_0": "contentType The content type of the return value", + "_1": "data The ABI data" + } + }, + "addr(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated address." + } + }, + "clearRecords(bytes32)": { + "params": { + "node": "The node to update." + } + }, + "contenthash(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated contenthash." + } + }, + "dnsRecord(bytes32,bytes32,uint16)": { + "params": { + "name": "the keccak-256 hash of the fully-qualified name for which to fetch the record", + "node": "the namehash of the node for which to fetch the record", + "resource": "the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types" + }, + "returns": { + "_0": "the DNS record in wire format if present, otherwise empty" + } + }, + "hasDNSRecords(bytes32,bytes32)": { + "params": { + "name": "the namehash of the node for which to check the records", + "node": "the namehash of the node for which to check the records" + } + }, + "interfaceImplementer(bytes32,bytes4)": { + "params": { + "interfaceID": "The EIP 165 interface ID to check for.", + "node": "The ENS node to query." + }, + "returns": { + "_0": "The address that implements this interface, or 0 if the interface is unsupported." + } + }, + "name(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated name." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pubkey(bytes32)": { + "params": { + "node": "The ENS node to query" + }, + "returns": { + "x": "The X coordinate of the curve point for the public key.", + "y": "The Y coordinate of the curve point for the public key." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "setABI(bytes32,uint256,bytes)": { + "params": { + "contentType": "The content type of the ABI", + "data": "The ABI data.", + "node": "The node to update." + } + }, + "setAddr(bytes32,address)": { + "params": { + "a": "The address to set.", + "node": "The node to update." + } + }, + "setContenthash(bytes32,bytes)": { + "params": { + "hash": "The contenthash to set", + "node": "The node to update." + } + }, + "setDNSRecords(bytes32,bytes)": { + "params": { + "data": "the DNS wire format records to set", + "node": "the namehash of the node for which to set the records" + } + }, + "setInterface(bytes32,bytes4,address)": { + "params": { + "implementer": "The address of a contract that implements this interface for this node.", + "interfaceID": "The EIP 165 interface ID.", + "node": "The node to update." + } + }, + "setName(bytes32,string)": { + "params": { + "node": "The node to update." + } + }, + "setPubkey(bytes32,bytes32,bytes32)": { + "params": { + "node": "The ENS node to query", + "x": "the X coordinate of the curve point for the public key.", + "y": "the Y coordinate of the curve point for the public key." + } + }, + "setText(bytes32,string,string)": { + "params": { + "key": "The key to set.", + "node": "The node to update.", + "value": "The text data value to set." + } + }, + "setZonehash(bytes32,bytes)": { + "params": { + "hash": "The zonehash to set", + "node": "The node to update." + } + }, + "text(bytes32,string)": { + "params": { + "key": "The text data key to query.", + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated text data." + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "zonehash(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated contenthash." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "ABI(bytes32,uint256)": { + "notice": "Returns the ABI associated with an ENS node. Defined in EIP205." + }, + "addr(bytes32)": { + "notice": "Returns the address associated with an ENS node." + }, + "clearRecords(bytes32)": { + "notice": "Increments the record version associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "contenthash(bytes32)": { + "notice": "Returns the contenthash associated with an ENS node." + }, + "dnsRecord(bytes32,bytes32,uint16)": { + "notice": "Obtain a DNS record." + }, + "hasDNSRecords(bytes32,bytes32)": { + "notice": "Check if a given node has records." + }, + "interfaceImplementer(bytes32,bytes4)": { + "notice": "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." + }, + "name(bytes32)": { + "notice": "Returns the name associated with an ENS node, for reverse records. Defined in EIP181." + }, + "pubkey(bytes32)": { + "notice": "Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619." + }, + "setABI(bytes32,uint256,bytes)": { + "notice": "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." + }, + "setAddr(bytes32,address)": { + "notice": "Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "setContenthash(bytes32,bytes)": { + "notice": "Sets the contenthash associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "setDNSRecords(bytes32,bytes)": { + "notice": "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." + }, + "setInterface(bytes32,bytes4,address)": { + "notice": "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." + }, + "setName(bytes32,string)": { + "notice": "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." + }, + "setPubkey(bytes32,bytes32,bytes32)": { + "notice": "Sets the SECP256k1 public key associated with an ENS node." + }, + "setText(bytes32,string,string)": { + "notice": "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." + }, + "setZonehash(bytes32,bytes)": { + "notice": "setZonehash sets the hash for the zone. May only be called by the owner of that node in the ENS registry." + }, + "text(bytes32,string)": { + "notice": "Returns the text data associated with an ENS node and key." + }, + "zonehash(bytes32)": { + "notice": "zonehash obtains the hash for the zone." + } + }, + "notice": "A simple resolver anyone can use; only allows the owner of a node to set its address.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 444, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 16255, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "recordVersions", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_uint64)" + }, + { + "astId": 16349, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_abis", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))" + }, + { + "astId": 16503, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_addresses", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))" + }, + { + "astId": 16694, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_hashes", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))" + }, + { + "astId": 16784, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_zonehashes", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))" + }, + { + "astId": 16794, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_records", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))))" + }, + { + "astId": 16802, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_nameEntriesCount", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16)))" + }, + { + "astId": 17665, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_interfaces", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes4,t_address)))" + }, + { + "astId": 17857, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_names", + "offset": 0, + "slot": "9", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_string_storage))" + }, + { + "astId": 17944, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_pubkeys", + "offset": 0, + "slot": "10", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_struct(PublicKey)17937_storage))" + }, + { + "astId": 18047, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_texts", + "offset": 0, + "slot": "11", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage)))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes4": { + "encoding": "inplace", + "label": "bytes4", + "numberOfBytes": "4" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage)))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes32 => uint16))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_uint16)" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes4,t_address))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes4 => address))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes4,t_address)" + }, + "t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(string => string))", + "numberOfBytes": "32", + "value": "t_mapping(t_string_memory_ptr,t_string_storage)" + }, + "t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint16 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint16,t_bytes_storage)" + }, + "t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint256 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_bytes_storage)" + }, + "t_mapping(t_bytes32,t_string_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_bytes32,t_struct(PublicKey)17937_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct PubkeyResolver.PublicKey)", + "numberOfBytes": "32", + "value": "t_struct(PublicKey)17937_storage" + }, + "t_mapping(t_bytes32,t_uint16)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint16)", + "numberOfBytes": "32", + "value": "t_uint16" + }, + "t_mapping(t_bytes32,t_uint64)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint64)", + "numberOfBytes": "32", + "value": "t_uint64" + }, + "t_mapping(t_bytes4,t_address)": { + "encoding": "mapping", + "key": "t_bytes4", + "label": "mapping(bytes4 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_string_memory_ptr,t_string_storage)": { + "encoding": "mapping", + "key": "t_string_memory_ptr", + "label": "mapping(string => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_uint16,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint256,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_bytes_storage)" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage)))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes4,t_address)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes4,t_address))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(string => string)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_string_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => string))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_string_storage)" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_struct(PublicKey)17937_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => struct PubkeyResolver.PublicKey))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_struct(PublicKey)17937_storage)" + }, + "t_string_memory_ptr": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(PublicKey)17937_storage": { + "encoding": "inplace", + "label": "struct PubkeyResolver.PublicKey", + "members": [ + { + "astId": 17934, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "x", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 17936, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "y", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint16": { + "encoding": "inplace", + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint64": { + "encoding": "inplace", + "label": "uint64", + "numberOfBytes": "8" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/P256SHA256Algorithm.json b/solidity/dns-contracts/deployments/holesky/P256SHA256Algorithm.json new file mode 100644 index 0000000..31e1eaf --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/P256SHA256Algorithm.json @@ -0,0 +1,81 @@ +{ + "address": "0xa280c9d9482df1d80b7d9046774c8d84ec58b1f8", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "key", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x3e4ef1a2b124c3f92f51f87ee220d3d8a97334597dcd0f17c6735655e41adc46", + "receipt": { + "to": null, + "from": "0x4fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8", + "contractAddress": "0xa280c9d9482df1d80b7d9046774c8d84ec58b1f8", + "transactionIndex": "0x2b", + "gasUsed": "0xdacde", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x049cf16a6bb1f42be35ad31965404c5bb41008e02d12f0a2dfa785a607b23461", + "transactionHash": "0x40d373eb7e41ef885d86497c81f63ee70e0c453adfc503fc30ec79988d5e37fa", + "logs": [], + "blockNumber": "0xc3cb0", + "cumulativeGasUsed": "0x1c936ad", + "status": "0x1" + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"verify(bytes,bytes,bytes)\":{\"details\":\"Verifies a signature.\",\"params\":{\"data\":\"The signed data to verify.\",\"key\":\"The public key to verify with.\",\"signature\":\"The signature to verify.\"},\"returns\":{\"_0\":\"True iff the signature is valid.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol\":\"P256SHA256Algorithm\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n */\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata signature\\n ) external view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xaf6825f9852c69f8e36540821d067b4550dd2263497af9d645309b6a0c457ba6\"},\"contracts/dnssec-oracle/algorithms/EllipticCurve.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @title EllipticCurve\\n *\\n * @author Tilman Drerup;\\n *\\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\\n *\\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\\n * (https://github.com/orbs-network/elliptic-curve-solidity)\\n *\\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\\n *\\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\\n * condition 'rs[1] > lowSmax' in validateSignature().\\n */\\ncontract EllipticCurve {\\n // Set parameters for curve.\\n uint256 constant a =\\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\\n uint256 constant b =\\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\\n uint256 constant gx =\\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\\n uint256 constant gy =\\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\\n uint256 constant p =\\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\\n uint256 constant n =\\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\\n\\n uint256 constant lowSmax =\\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\\n\\n /**\\n * @dev Inverse of u in the field of modulo m.\\n */\\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\\n unchecked {\\n if (u == 0 || u == m || m == 0) return 0;\\n if (u > m) u = u % m;\\n\\n int256 t1;\\n int256 t2 = 1;\\n uint256 r1 = m;\\n uint256 r2 = u;\\n uint256 q;\\n\\n while (r2 != 0) {\\n q = r1 / r2;\\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\\n }\\n\\n if (t1 < 0) return (m - uint256(-t1));\\n\\n return uint256(t1);\\n }\\n }\\n\\n /**\\n * @dev Transform affine coordinates into projective coordinates.\\n */\\n function toProjectivePoint(\\n uint256 x0,\\n uint256 y0\\n ) internal pure returns (uint256[3] memory P) {\\n P[2] = addmod(0, 1, p);\\n P[0] = mulmod(x0, P[2], p);\\n P[1] = mulmod(y0, P[2], p);\\n }\\n\\n /**\\n * @dev Add two points in affine coordinates and return projective point.\\n */\\n function addAndReturnProjectivePoint(\\n uint256 x1,\\n uint256 y1,\\n uint256 x2,\\n uint256 y2\\n ) internal pure returns (uint256[3] memory P) {\\n uint256 x;\\n uint256 y;\\n (x, y) = add(x1, y1, x2, y2);\\n P = toProjectivePoint(x, y);\\n }\\n\\n /**\\n * @dev Transform from projective to affine coordinates.\\n */\\n function toAffinePoint(\\n uint256 x0,\\n uint256 y0,\\n uint256 z0\\n ) internal pure returns (uint256 x1, uint256 y1) {\\n uint256 z0Inv;\\n z0Inv = inverseMod(z0, p);\\n x1 = mulmod(x0, z0Inv, p);\\n y1 = mulmod(y0, z0Inv, p);\\n }\\n\\n /**\\n * @dev Return the zero curve in projective coordinates.\\n */\\n function zeroProj()\\n internal\\n pure\\n returns (uint256 x, uint256 y, uint256 z)\\n {\\n return (0, 1, 0);\\n }\\n\\n /**\\n * @dev Return the zero curve in affine coordinates.\\n */\\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\\n return (0, 0);\\n }\\n\\n /**\\n * @dev Check if the curve is the zero curve.\\n */\\n function isZeroCurve(\\n uint256 x0,\\n uint256 y0\\n ) internal pure returns (bool isZero) {\\n if (x0 == 0 && y0 == 0) {\\n return true;\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Check if a point in affine coordinates is on the curve.\\n */\\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\\n if (0 == x || x == p || 0 == y || y == p) {\\n return false;\\n }\\n\\n uint256 LHS = mulmod(y, y, p); // y^2\\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\\n\\n if (a != 0) {\\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\\n }\\n if (b != 0) {\\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\\n }\\n\\n return LHS == RHS;\\n }\\n\\n /**\\n * @dev Double an elliptic curve point in projective coordinates. See\\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\\n */\\n function twiceProj(\\n uint256 x0,\\n uint256 y0,\\n uint256 z0\\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\\n uint256 t;\\n uint256 u;\\n uint256 v;\\n uint256 w;\\n\\n if (isZeroCurve(x0, y0)) {\\n return zeroProj();\\n }\\n\\n u = mulmod(y0, z0, p);\\n u = mulmod(u, 2, p);\\n\\n v = mulmod(u, x0, p);\\n v = mulmod(v, y0, p);\\n v = mulmod(v, 2, p);\\n\\n x0 = mulmod(x0, x0, p);\\n t = mulmod(x0, 3, p);\\n\\n z0 = mulmod(z0, z0, p);\\n z0 = mulmod(z0, a, p);\\n t = addmod(t, z0, p);\\n\\n w = mulmod(t, t, p);\\n x0 = mulmod(2, v, p);\\n w = addmod(w, p - x0, p);\\n\\n x0 = addmod(v, p - w, p);\\n x0 = mulmod(t, x0, p);\\n y0 = mulmod(y0, u, p);\\n y0 = mulmod(y0, y0, p);\\n y0 = mulmod(2, y0, p);\\n y1 = addmod(x0, p - y0, p);\\n\\n x1 = mulmod(u, w, p);\\n\\n z1 = mulmod(u, u, p);\\n z1 = mulmod(z1, u, p);\\n }\\n\\n /**\\n * @dev Add two elliptic curve points in projective coordinates. See\\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\\n */\\n function addProj(\\n uint256 x0,\\n uint256 y0,\\n uint256 z0,\\n uint256 x1,\\n uint256 y1,\\n uint256 z1\\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\\n uint256 t0;\\n uint256 t1;\\n uint256 u0;\\n uint256 u1;\\n\\n if (isZeroCurve(x0, y0)) {\\n return (x1, y1, z1);\\n } else if (isZeroCurve(x1, y1)) {\\n return (x0, y0, z0);\\n }\\n\\n t0 = mulmod(y0, z1, p);\\n t1 = mulmod(y1, z0, p);\\n\\n u0 = mulmod(x0, z1, p);\\n u1 = mulmod(x1, z0, p);\\n\\n if (u0 == u1) {\\n if (t0 == t1) {\\n return twiceProj(x0, y0, z0);\\n } else {\\n return zeroProj();\\n }\\n }\\n\\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\\n }\\n\\n /**\\n * @dev Helper function that splits addProj to avoid too many local variables.\\n */\\n function addProj2(\\n uint256 v,\\n uint256 u0,\\n uint256 u1,\\n uint256 t1,\\n uint256 t0\\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\\n uint256 u;\\n uint256 u2;\\n uint256 u3;\\n uint256 w;\\n uint256 t;\\n\\n t = addmod(t0, p - t1, p);\\n u = addmod(u0, p - u1, p);\\n u2 = mulmod(u, u, p);\\n\\n w = mulmod(t, t, p);\\n w = mulmod(w, v, p);\\n u1 = addmod(u1, u0, p);\\n u1 = mulmod(u1, u2, p);\\n w = addmod(w, p - u1, p);\\n\\n x2 = mulmod(u, w, p);\\n\\n u3 = mulmod(u2, u, p);\\n u0 = mulmod(u0, u2, p);\\n u0 = addmod(u0, p - w, p);\\n t = mulmod(t, u0, p);\\n t0 = mulmod(t0, u3, p);\\n\\n y2 = addmod(t, p - t0, p);\\n\\n z2 = mulmod(u3, v, p);\\n }\\n\\n /**\\n * @dev Add two elliptic curve points in affine coordinates.\\n */\\n function add(\\n uint256 x0,\\n uint256 y0,\\n uint256 x1,\\n uint256 y1\\n ) internal pure returns (uint256, uint256) {\\n uint256 z0;\\n\\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\\n\\n return toAffinePoint(x0, y0, z0);\\n }\\n\\n /**\\n * @dev Double an elliptic curve point in affine coordinates.\\n */\\n function twice(\\n uint256 x0,\\n uint256 y0\\n ) internal pure returns (uint256, uint256) {\\n uint256 z0;\\n\\n (x0, y0, z0) = twiceProj(x0, y0, 1);\\n\\n return toAffinePoint(x0, y0, z0);\\n }\\n\\n /**\\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\\n */\\n function multiplyPowerBase2(\\n uint256 x0,\\n uint256 y0,\\n uint256 exp\\n ) internal pure returns (uint256, uint256) {\\n uint256 base2X = x0;\\n uint256 base2Y = y0;\\n uint256 base2Z = 1;\\n\\n for (uint256 i = 0; i < exp; i++) {\\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\\n }\\n\\n return toAffinePoint(base2X, base2Y, base2Z);\\n }\\n\\n /**\\n * @dev Multiply an elliptic curve point by a scalar.\\n */\\n function multiplyScalar(\\n uint256 x0,\\n uint256 y0,\\n uint256 scalar\\n ) internal pure returns (uint256 x1, uint256 y1) {\\n if (scalar == 0) {\\n return zeroAffine();\\n } else if (scalar == 1) {\\n return (x0, y0);\\n } else if (scalar == 2) {\\n return twice(x0, y0);\\n }\\n\\n uint256 base2X = x0;\\n uint256 base2Y = y0;\\n uint256 base2Z = 1;\\n uint256 z1 = 1;\\n x1 = x0;\\n y1 = y0;\\n\\n if (scalar % 2 == 0) {\\n x1 = y1 = 0;\\n }\\n\\n scalar = scalar >> 1;\\n\\n while (scalar > 0) {\\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\\n\\n if (scalar % 2 == 1) {\\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\\n }\\n\\n scalar = scalar >> 1;\\n }\\n\\n return toAffinePoint(x1, y1, z1);\\n }\\n\\n /**\\n * @dev Multiply the curve's generator point by a scalar.\\n */\\n function multipleGeneratorByScalar(\\n uint256 scalar\\n ) internal pure returns (uint256, uint256) {\\n return multiplyScalar(gx, gy, scalar);\\n }\\n\\n /**\\n * @dev Validate combination of message, signature, and public key.\\n */\\n function validateSignature(\\n bytes32 message,\\n uint256[2] memory rs,\\n uint256[2] memory Q\\n ) internal pure returns (bool) {\\n // To disambiguate between public key solutions, include comment below.\\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\\n // || rs[1] > lowSmax)\\n return false;\\n }\\n if (!isOnCurve(Q[0], Q[1])) {\\n return false;\\n }\\n\\n uint256 x1;\\n uint256 x2;\\n uint256 y1;\\n uint256 y2;\\n\\n uint256 sInv = inverseMod(rs[1], n);\\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\\n\\n if (P[2] == 0) {\\n return false;\\n }\\n\\n uint256 Px = inverseMod(P[2], p);\\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\\n\\n return Px % n == rs[0];\\n }\\n}\\n\",\"keccak256\":\"0xdee968ffbfcb9a05b7ed7845e2c55f438f5e09a80fc6024c751a1718137e1838\"},\"contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\nimport \\\"./EllipticCurve.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\n\\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\\n using BytesUtils for *;\\n\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata signature\\n ) external view override returns (bool) {\\n return\\n validateSignature(\\n sha256(data),\\n parseSignature(signature),\\n parseKey(key)\\n );\\n }\\n\\n function parseSignature(\\n bytes memory data\\n ) internal pure returns (uint256[2] memory) {\\n require(data.length == 64, \\\"Invalid p256 signature length\\\");\\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\\n }\\n\\n function parseKey(\\n bytes memory data\\n ) internal pure returns (uint256[2] memory) {\\n require(data.length == 68, \\\"Invalid p256 key length\\\");\\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\\n }\\n}\\n\",\"keccak256\":\"0x406e394eb659ee8c75345b9d3795e0061de2bd6567dd8035e76a19588850f0ea\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610f41806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e366004610dd4565b610057565b604051901515815260200160405180910390f35b60006101316002868660405161006e929190610e6e565b602060405180830381855afa15801561008b573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906100ae9190610e7e565b6100ed85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061013c92505050565b61012c8a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101cb92505050565b61024a565b979650505050505050565b610144610d56565b815160401461019a5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642070323536207369676e6174757265206c656e67746800000060448201526064015b60405180910390fd5b60408051808201909152806101b0846000610445565b81526020908101906101c3908590610445565b905292915050565b6101d3610d56565b81516044146102245760405162461bcd60e51b815260206004820152601760248201527f496e76616c69642070323536206b6579206c656e6774680000000000000000006044820152606401610191565b604080518082019091528061023a846004610445565b81526020016101c3846024610445565b8151600090158061027c575082517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc63255111155b8061028957506020830151155b156102965750600061043e565b815160208301516102a79190610469565b6102b35750600061043e565b6000808080806102ea88600160200201517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551610565565b905061035a7f6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c2967f4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f57fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551848d096105ff565b885160208a01518b5193985091955061039a929091907fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551908590096105ff565b909450915060006103ad868587866106cf565b60408101519091506000036103cb576000965050505050505061043e565b60006103ec8260026020020151600160601b63ffffffff60c01b0319610565565b9050600160601b63ffffffff60c01b0319808283098351098a519091506104337fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc63255183610ead565b149750505050505050505b9392505050565b8151600090610455836020610ee5565b111561046057600080fd5b50016020015190565b60008215806104855750600160601b63ffffffff60c01b031983145b8061048e575081155b806104a65750600160601b63ffffffff60c01b031982145b156104b35750600061055f565b6000600160601b63ffffffff60c01b031983840990506000600160601b63ffffffff60c01b031985600160601b63ffffffff60c01b0319878809099050600160601b63ffffffff60c01b0319807fffffffff00000001000000000000000000000000fffffffffffffffffffffffc870982089050600160601b63ffffffff60c01b03197f5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b820890501490505b92915050565b600082158061057357508183145b8061057c575081155b156105895750600061055f565b818311156105a4578183816105a0576105a0610e97565b0692505b600060018385835b81156105db578183816105c1576105c1610e97565b9495940485810290940393919283830290039190506105ac565b60008512156105f357505050908301915061055f9050565b50929695505050505050565b60008082600003610617576000805b915091506106c7565b826001036106295750839050826106c7565b8260020361063b5761060e85856106f5565b50839050828181600180610650600288610ead565b60000361065f57600094508495505b600187901c96505b86156106b357610678848484610725565b9195509350915061068a600288610ead565b6001036106a75761069f848484898986610983565b919750955090505b600187901c9650610667565b6106be868683610a88565b95509550505050505b935093915050565b6106d7610d74565b6000806106e687878787610ad8565b90925090506101318282610b0d565b600080600061070685856001610725565b91965094509050610718858583610a88565b92509250505b9250929050565b600080600080600080600061073a8a8a610b66565b156107535760006001819650965096505050505061097a565b600160601b63ffffffff60c01b0319888a099250600160601b63ffffffff60c01b0319600284099250600160601b63ffffffff60c01b03198a84099150600160601b63ffffffff60c01b03198983099150600160601b63ffffffff60c01b0319600283099150600160601b63ffffffff60c01b03198a8b099950600160601b63ffffffff60c01b031960038b099350600160601b63ffffffff60c01b03198889099750600160601b63ffffffff60c01b03197fffffffff00000001000000000000000000000000fffffffffffffffffffffffc89099750600160601b63ffffffff60c01b03198885089350600160601b63ffffffff60c01b03198485099050600160601b63ffffffff60c01b0319826002099950600160601b63ffffffff60c01b031961088e8b600160601b63ffffffff60c01b0319610ef8565b82089050600160601b63ffffffff60c01b03196108b982600160601b63ffffffff60c01b0319610ef8565b83089950600160601b63ffffffff60c01b03198a85099950600160601b63ffffffff60c01b0319838a099850600160601b63ffffffff60c01b0319898a099850600160601b63ffffffff60c01b0319896002099850600160601b63ffffffff60c01b03196109358a600160601b63ffffffff60c01b0319610ef8565b8b089550600160601b63ffffffff60c01b03198184099650600160601b63ffffffff60c01b03198384099450600160601b63ffffffff60c01b03198386099450505050505b93509350939050565b60008060008060008060006109988d8d610b66565b156109af5789898996509650965050505050610a7c565b6109b98a8a610b66565b156109d0578c8c8c96509650965050505050610a7c565b600160601b63ffffffff60c01b0319888d099350600160601b63ffffffff60c01b03198b8a099250600160601b63ffffffff60c01b0319888e099150600160601b63ffffffff60c01b03198b8b099050808203610a5257828403610a4857610a398d8d8d610725565b96509650965050505050610a7c565b6000600181610a39565b610a70600160601b63ffffffff60c01b0319898d0983838688610b8a565b91985096509450505050505b96509650969350505050565b6000806000610aa584600160601b63ffffffff60c01b0319610565565b9050600160601b63ffffffff60c01b03198187099250600160601b63ffffffff60c01b0319818609915050935093915050565b6000806000610aed8787600188886001610983565b91985096509050610aff878783610a88565b925092505094509492505050565b610b15610d74565b600160601b63ffffffff60c01b0319600160000860408201819052600160601b63ffffffff60c01b031990840981526040810151600160601b63ffffffff60c01b0319908309602082015292915050565b600082158015610b74575081155b15610b815750600161055f565b50600092915050565b600080808080808080600160601b63ffffffff60c01b0319610bba8b600160601b63ffffffff60c01b0319610ef8565b8a089050600160601b63ffffffff60c01b0319610be58c600160601b63ffffffff60c01b0319610ef8565b8d089450600160601b63ffffffff60c01b03198586099350600160601b63ffffffff60c01b03198182099150600160601b63ffffffff60c01b03198d83099150600160601b63ffffffff60c01b03198c8c089a50600160601b63ffffffff60c01b0319848c099a50600160601b63ffffffff60c01b0319610c748c600160601b63ffffffff60c01b0319610ef8565b83089150600160601b63ffffffff60c01b03198286099750600160601b63ffffffff60c01b03198585099250600160601b63ffffffff60c01b0319848d099b50600160601b63ffffffff60c01b0319610cdb83600160601b63ffffffff60c01b0319610ef8565b8d089b50600160601b63ffffffff60c01b03198c82099050600160601b63ffffffff60c01b0319838a099850600160601b63ffffffff60c01b0319610d2e8a600160601b63ffffffff60c01b0319610ef8565b82089650600160601b63ffffffff60c01b03198d840995505050505050955095509592505050565b60405180604001604052806002906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60008083601f840112610da457600080fd5b50813567ffffffffffffffff811115610dbc57600080fd5b60208301915083602082850101111561071e57600080fd5b60008060008060008060608789031215610ded57600080fd5b863567ffffffffffffffff80821115610e0557600080fd5b610e118a838b01610d92565b90985096506020890135915080821115610e2a57600080fd5b610e368a838b01610d92565b90965094506040890135915080821115610e4f57600080fd5b50610e5c89828a01610d92565b979a9699509497509295939492505050565b8183823760009101908152919050565b600060208284031215610e9057600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b600082610eca57634e487b7160e01b600052601260045260246000fd5b500690565b634e487b7160e01b600052601160045260246000fd5b8082018082111561055f5761055f610ecf565b8181038181111561055f5761055f610ecf56fea26469706673582212200a7cdc61343825b33e51ff653c60245b511afc3bf209bfd7831b5eded2744b1c64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e366004610dd4565b610057565b604051901515815260200160405180910390f35b60006101316002868660405161006e929190610e6e565b602060405180830381855afa15801561008b573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906100ae9190610e7e565b6100ed85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061013c92505050565b61012c8a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101cb92505050565b61024a565b979650505050505050565b610144610d56565b815160401461019a5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642070323536207369676e6174757265206c656e67746800000060448201526064015b60405180910390fd5b60408051808201909152806101b0846000610445565b81526020908101906101c3908590610445565b905292915050565b6101d3610d56565b81516044146102245760405162461bcd60e51b815260206004820152601760248201527f496e76616c69642070323536206b6579206c656e6774680000000000000000006044820152606401610191565b604080518082019091528061023a846004610445565b81526020016101c3846024610445565b8151600090158061027c575082517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc63255111155b8061028957506020830151155b156102965750600061043e565b815160208301516102a79190610469565b6102b35750600061043e565b6000808080806102ea88600160200201517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551610565565b905061035a7f6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c2967f4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f57fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551848d096105ff565b885160208a01518b5193985091955061039a929091907fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551908590096105ff565b909450915060006103ad868587866106cf565b60408101519091506000036103cb576000965050505050505061043e565b60006103ec8260026020020151600160601b63ffffffff60c01b0319610565565b9050600160601b63ffffffff60c01b0319808283098351098a519091506104337fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc63255183610ead565b149750505050505050505b9392505050565b8151600090610455836020610ee5565b111561046057600080fd5b50016020015190565b60008215806104855750600160601b63ffffffff60c01b031983145b8061048e575081155b806104a65750600160601b63ffffffff60c01b031982145b156104b35750600061055f565b6000600160601b63ffffffff60c01b031983840990506000600160601b63ffffffff60c01b031985600160601b63ffffffff60c01b0319878809099050600160601b63ffffffff60c01b0319807fffffffff00000001000000000000000000000000fffffffffffffffffffffffc870982089050600160601b63ffffffff60c01b03197f5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b820890501490505b92915050565b600082158061057357508183145b8061057c575081155b156105895750600061055f565b818311156105a4578183816105a0576105a0610e97565b0692505b600060018385835b81156105db578183816105c1576105c1610e97565b9495940485810290940393919283830290039190506105ac565b60008512156105f357505050908301915061055f9050565b50929695505050505050565b60008082600003610617576000805b915091506106c7565b826001036106295750839050826106c7565b8260020361063b5761060e85856106f5565b50839050828181600180610650600288610ead565b60000361065f57600094508495505b600187901c96505b86156106b357610678848484610725565b9195509350915061068a600288610ead565b6001036106a75761069f848484898986610983565b919750955090505b600187901c9650610667565b6106be868683610a88565b95509550505050505b935093915050565b6106d7610d74565b6000806106e687878787610ad8565b90925090506101318282610b0d565b600080600061070685856001610725565b91965094509050610718858583610a88565b92509250505b9250929050565b600080600080600080600061073a8a8a610b66565b156107535760006001819650965096505050505061097a565b600160601b63ffffffff60c01b0319888a099250600160601b63ffffffff60c01b0319600284099250600160601b63ffffffff60c01b03198a84099150600160601b63ffffffff60c01b03198983099150600160601b63ffffffff60c01b0319600283099150600160601b63ffffffff60c01b03198a8b099950600160601b63ffffffff60c01b031960038b099350600160601b63ffffffff60c01b03198889099750600160601b63ffffffff60c01b03197fffffffff00000001000000000000000000000000fffffffffffffffffffffffc89099750600160601b63ffffffff60c01b03198885089350600160601b63ffffffff60c01b03198485099050600160601b63ffffffff60c01b0319826002099950600160601b63ffffffff60c01b031961088e8b600160601b63ffffffff60c01b0319610ef8565b82089050600160601b63ffffffff60c01b03196108b982600160601b63ffffffff60c01b0319610ef8565b83089950600160601b63ffffffff60c01b03198a85099950600160601b63ffffffff60c01b0319838a099850600160601b63ffffffff60c01b0319898a099850600160601b63ffffffff60c01b0319896002099850600160601b63ffffffff60c01b03196109358a600160601b63ffffffff60c01b0319610ef8565b8b089550600160601b63ffffffff60c01b03198184099650600160601b63ffffffff60c01b03198384099450600160601b63ffffffff60c01b03198386099450505050505b93509350939050565b60008060008060008060006109988d8d610b66565b156109af5789898996509650965050505050610a7c565b6109b98a8a610b66565b156109d0578c8c8c96509650965050505050610a7c565b600160601b63ffffffff60c01b0319888d099350600160601b63ffffffff60c01b03198b8a099250600160601b63ffffffff60c01b0319888e099150600160601b63ffffffff60c01b03198b8b099050808203610a5257828403610a4857610a398d8d8d610725565b96509650965050505050610a7c565b6000600181610a39565b610a70600160601b63ffffffff60c01b0319898d0983838688610b8a565b91985096509450505050505b96509650969350505050565b6000806000610aa584600160601b63ffffffff60c01b0319610565565b9050600160601b63ffffffff60c01b03198187099250600160601b63ffffffff60c01b0319818609915050935093915050565b6000806000610aed8787600188886001610983565b91985096509050610aff878783610a88565b925092505094509492505050565b610b15610d74565b600160601b63ffffffff60c01b0319600160000860408201819052600160601b63ffffffff60c01b031990840981526040810151600160601b63ffffffff60c01b0319908309602082015292915050565b600082158015610b74575081155b15610b815750600161055f565b50600092915050565b600080808080808080600160601b63ffffffff60c01b0319610bba8b600160601b63ffffffff60c01b0319610ef8565b8a089050600160601b63ffffffff60c01b0319610be58c600160601b63ffffffff60c01b0319610ef8565b8d089450600160601b63ffffffff60c01b03198586099350600160601b63ffffffff60c01b03198182099150600160601b63ffffffff60c01b03198d83099150600160601b63ffffffff60c01b03198c8c089a50600160601b63ffffffff60c01b0319848c099a50600160601b63ffffffff60c01b0319610c748c600160601b63ffffffff60c01b0319610ef8565b83089150600160601b63ffffffff60c01b03198286099750600160601b63ffffffff60c01b03198585099250600160601b63ffffffff60c01b0319848d099b50600160601b63ffffffff60c01b0319610cdb83600160601b63ffffffff60c01b0319610ef8565b8d089b50600160601b63ffffffff60c01b03198c82099050600160601b63ffffffff60c01b0319838a099850600160601b63ffffffff60c01b0319610d2e8a600160601b63ffffffff60c01b0319610ef8565b82089650600160601b63ffffffff60c01b03198d840995505050505050955095509592505050565b60405180604001604052806002906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60008083601f840112610da457600080fd5b50813567ffffffffffffffff811115610dbc57600080fd5b60208301915083602082850101111561071e57600080fd5b60008060008060008060608789031215610ded57600080fd5b863567ffffffffffffffff80821115610e0557600080fd5b610e118a838b01610d92565b90985096506020890135915080821115610e2a57600080fd5b610e368a838b01610d92565b90965094506040890135915080821115610e4f57600080fd5b50610e5c89828a01610d92565b979a9699509497509295939492505050565b8183823760009101908152919050565b600060208284031215610e9057600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b600082610eca57634e487b7160e01b600052601260045260246000fd5b500690565b634e487b7160e01b600052601160045260246000fd5b8082018082111561055f5761055f610ecf565b8181038181111561055f5761055f610ecf56fea26469706673582212200a7cdc61343825b33e51ff653c60245b511afc3bf209bfd7831b5eded2744b1c64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "verify(bytes,bytes,bytes)": { + "details": "Verifies a signature.", + "params": { + "data": "The signed data to verify.", + "key": "The public key to verify with.", + "signature": "The signature to verify." + }, + "returns": { + "_0": "True iff the signature is valid." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/PublicResolver.json b/solidity/dns-contracts/deployments/holesky/PublicResolver.json new file mode 100644 index 0000000..b3abe7d --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/PublicResolver.json @@ -0,0 +1,1676 @@ +{ + "address": "0x9010A27463717360cAD99CEA8bD39b8705CCA238", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract INameWrapper", + "name": "wrapperAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_trustedETHController", + "type": "address" + }, + { + "internalType": "address", + "name": "_trustedReverseRegistrar", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + } + ], + "name": "ABIChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "AddrChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "Approved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "ContenthashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "record", + "type": "bytes" + } + ], + "name": "DNSRecordChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "DNSRecordDeleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "lastzonehash", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "zonehash", + "type": "bytes" + } + ], + "name": "DNSZonehashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "InterfaceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "PubkeyChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "string", + "name": "indexedKey", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "TextChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "newVersion", + "type": "uint64" + } + ], + "name": "VersionChanged", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentTypes", + "type": "uint256" + } + ], + "name": "ABI", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "clearRecords", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "contenthash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "dnsRecord", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + } + ], + "name": "hasDNSRecords", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "interfaceImplementer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "delegate", + "type": "address" + } + ], + "name": "isApprovedFor", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "nodehash", + "type": "bytes32" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicallWithNodeCheck", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "pubkey", + "outputs": [ + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "recordVersions", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setABI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "a", + "type": "bytes" + } + ], + "name": "setAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "setAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setContenthash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setDNSRecords", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "setInterface", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "newName", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "setPubkey", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "setText", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setZonehash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "text", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "zonehash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x7d5444788b23aee8a527b4c00a00a4a27a2a6961a5ade8fac69b4bb7d720e965", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x9010A27463717360cAD99CEA8bD39b8705CCA238", + "transactionIndex": 1, + "gasUsed": "2764163", + "logsBloom": "0x00000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000010000008000000000000000000000000000004000000008000000000000000000000000000000000000008000200000002000000000000000000000000000000000001000000000000000000010000000000000000000000000000000000000000200000000000000000000000000000040000000010000000000100000080000000008080040000000000000000020000200000000000005000000000000000000000000000000000000000000000000000000000000100000000000000001000000000000000000000", + "blockHash": "0x1ba5126b43bf107baba9adc7df5e6c7c80c6a3e2eb8b243b6c867cae101c19b8", + "transactionHash": "0x7d5444788b23aee8a527b4c00a00a4a27a2a6961a5ade8fac69b4bb7d720e965", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 815380, + "transactionHash": "0x7d5444788b23aee8a527b4c00a00a4a27a2a6961a5ade8fac69b4bb7d720e965", + "address": "0x132AC0B116a73add4225029D1951A9A707Ef673f", + "topics": [ + "0x6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e92", + "0x0000000000000000000000009010a27463717360cad99cea8bd39b8705cca238", + "0x190c5c8f3576005a6720ff5b2ba90ca928f59db46f5df0a95dfbf4486e626f55" + ], + "data": "0x", + "logIndex": 600, + "blockHash": "0x1ba5126b43bf107baba9adc7df5e6c7c80c6a3e2eb8b243b6c867cae101c19b8" + }, + { + "transactionIndex": 1, + "blockNumber": 815380, + "transactionHash": "0x7d5444788b23aee8a527b4c00a00a4a27a2a6961a5ade8fac69b4bb7d720e965", + "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "topics": [ + "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", + "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2", + "0xe726b727b7eb3be33cdf5bdea0ba8744babddbb13aae23885ba4bb20223c6b57" + ], + "data": "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8", + "logIndex": 601, + "blockHash": "0x1ba5126b43bf107baba9adc7df5e6c7c80c6a3e2eb8b243b6c867cae101c19b8" + } + ], + "blockNumber": 815380, + "cumulativeGasUsed": "26488393", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0xab50971078225D365994dc1Edcb9b7FD72Bb4862", + "0x179Be112b24Ad4cFC392eF8924DfA08C20Ad8583", + "0x132AC0B116a73add4225029D1951A9A707Ef673f" + ], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract INameWrapper\",\"name\":\"wrapperAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_trustedETHController\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_trustedReverseRegistrar\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"}],\"name\":\"ABIChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"AddrChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"newAddress\",\"type\":\"bytes\"}],\"name\":\"AddressChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"Approved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"ContenthashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"record\",\"type\":\"bytes\"}],\"name\":\"DNSRecordChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"DNSRecordDeleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"lastzonehash\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"zonehash\",\"type\":\"bytes\"}],\"name\":\"DNSZonehashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"InterfaceChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NameChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"PubkeyChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"indexedKey\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"TextChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"newVersion\",\"type\":\"uint64\"}],\"name\":\"VersionChanged\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentTypes\",\"type\":\"uint256\"}],\"name\":\"ABI\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"clearRecords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"contenthash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"dnsRecord\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"hasDNSRecords\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"interfaceImplementer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"}],\"name\":\"isApprovedFor\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nodehash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicallWithNodeCheck\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"pubkey\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"recordVersions\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setABI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"a\",\"type\":\"bytes\"}],\"name\":\"setAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"setAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setContenthash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setDNSRecords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"setInterface\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"newName\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"setPubkey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"setText\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setZonehash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"}],\"name\":\"text\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"zonehash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"ABI(bytes32,uint256)\":{\"params\":{\"contentTypes\":\"A bitwise OR of the ABI formats accepted by the caller.\",\"node\":\"The ENS node to query\"},\"returns\":{\"_0\":\"contentType The content type of the return value\",\"_1\":\"data The ABI data\"}},\"addr(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated address.\"}},\"approve(bytes32,address,bool)\":{\"details\":\"Approve a delegate to be able to updated records on a node.\"},\"clearRecords(bytes32)\":{\"params\":{\"node\":\"The node to update.\"}},\"contenthash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated contenthash.\"}},\"dnsRecord(bytes32,bytes32,uint16)\":{\"params\":{\"name\":\"the keccak-256 hash of the fully-qualified name for which to fetch the record\",\"node\":\"the namehash of the node for which to fetch the record\",\"resource\":\"the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\"},\"returns\":{\"_0\":\"the DNS record in wire format if present, otherwise empty\"}},\"hasDNSRecords(bytes32,bytes32)\":{\"params\":{\"name\":\"the namehash of the node for which to check the records\",\"node\":\"the namehash of the node for which to check the records\"}},\"interfaceImplementer(bytes32,bytes4)\":{\"params\":{\"interfaceID\":\"The EIP 165 interface ID to check for.\",\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The address that implements this interface, or 0 if the interface is unsupported.\"}},\"isApprovedFor(address,bytes32,address)\":{\"details\":\"Check to see if the delegate has been approved by the owner for the node.\"},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC1155-isApprovedForAll}.\"},\"name(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated name.\"}},\"pubkey(bytes32)\":{\"params\":{\"node\":\"The ENS node to query\"},\"returns\":{\"x\":\"The X coordinate of the curve point for the public key.\",\"y\":\"The Y coordinate of the curve point for the public key.\"}},\"setABI(bytes32,uint256,bytes)\":{\"params\":{\"contentType\":\"The content type of the ABI\",\"data\":\"The ABI data.\",\"node\":\"The node to update.\"}},\"setAddr(bytes32,address)\":{\"params\":{\"a\":\"The address to set.\",\"node\":\"The node to update.\"}},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC1155-setApprovalForAll}.\"},\"setContenthash(bytes32,bytes)\":{\"params\":{\"hash\":\"The contenthash to set\",\"node\":\"The node to update.\"}},\"setDNSRecords(bytes32,bytes)\":{\"params\":{\"data\":\"the DNS wire format records to set\",\"node\":\"the namehash of the node for which to set the records\"}},\"setInterface(bytes32,bytes4,address)\":{\"params\":{\"implementer\":\"The address of a contract that implements this interface for this node.\",\"interfaceID\":\"The EIP 165 interface ID.\",\"node\":\"The node to update.\"}},\"setName(bytes32,string)\":{\"params\":{\"node\":\"The node to update.\"}},\"setPubkey(bytes32,bytes32,bytes32)\":{\"params\":{\"node\":\"The ENS node to query\",\"x\":\"the X coordinate of the curve point for the public key.\",\"y\":\"the Y coordinate of the curve point for the public key.\"}},\"setText(bytes32,string,string)\":{\"params\":{\"key\":\"The key to set.\",\"node\":\"The node to update.\",\"value\":\"The text data value to set.\"}},\"setZonehash(bytes32,bytes)\":{\"params\":{\"hash\":\"The zonehash to set\",\"node\":\"The node to update.\"}},\"text(bytes32,string)\":{\"params\":{\"key\":\"The text data key to query.\",\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated text data.\"}},\"zonehash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated contenthash.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"ABI(bytes32,uint256)\":{\"notice\":\"Returns the ABI associated with an ENS node. Defined in EIP205.\"},\"addr(bytes32)\":{\"notice\":\"Returns the address associated with an ENS node.\"},\"clearRecords(bytes32)\":{\"notice\":\"Increments the record version associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"contenthash(bytes32)\":{\"notice\":\"Returns the contenthash associated with an ENS node.\"},\"dnsRecord(bytes32,bytes32,uint16)\":{\"notice\":\"Obtain a DNS record.\"},\"hasDNSRecords(bytes32,bytes32)\":{\"notice\":\"Check if a given node has records.\"},\"interfaceImplementer(bytes32,bytes4)\":{\"notice\":\"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.\"},\"name(bytes32)\":{\"notice\":\"Returns the name associated with an ENS node, for reverse records. Defined in EIP181.\"},\"pubkey(bytes32)\":{\"notice\":\"Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619.\"},\"setABI(bytes32,uint256,bytes)\":{\"notice\":\"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.\"},\"setAddr(bytes32,address)\":{\"notice\":\"Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setContenthash(bytes32,bytes)\":{\"notice\":\"Sets the contenthash associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setDNSRecords(bytes32,bytes)\":{\"notice\":\"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.\"},\"setInterface(bytes32,bytes4,address)\":{\"notice\":\"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.\"},\"setName(bytes32,string)\":{\"notice\":\"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.\"},\"setPubkey(bytes32,bytes32,bytes32)\":{\"notice\":\"Sets the SECP256k1 public key associated with an ENS node.\"},\"setText(bytes32,string,string)\":{\"notice\":\"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.\"},\"setZonehash(bytes32,bytes)\":{\"notice\":\"setZonehash sets the hash for the zone. May only be called by the owner of that node in the ENS registry.\"},\"text(bytes32,string)\":{\"notice\":\"Returns the text data associated with an ENS node and key.\"},\"zonehash(bytes32)\":{\"notice\":\"zonehash obtains the hash for the zone.\"}},\"notice\":\"A simple resolver anyone can use; only allows the owner of a node to set its address.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/resolvers/PublicResolver.sol\":\"PublicResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-2-Clause\\npragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for appending to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n let fpm := add(32, add(ptr, capacity))\\n if lt(fpm, ptr) {\\n revert(0, 0)\\n }\\n mstore(0x40, fpm)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n uint off = buf.buf.length;\\n uint newCapacity = off + len;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(newCapacity, buflen) {\\n mstore(bufptr, newCapacity)\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return append(buf, data, data.length);\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint offPlusOne = off + 1;\\n if (off >= buf.capacity) {\\n resize(buf, offPlusOne * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if gt(offPlusOne, mload(bufptr)) {\\n mstore(bufptr, offPlusOne)\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return append(buf, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return append(buf, data, 32);\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n return buf;\\n }\\n}\\n\",\"keccak256\":\"0xd6dd3b0b327288f8e1b711a609f4040fea602e2ad4bba9febdf2f33b4e56eb0c\",\"license\":\"BSD-2-Clause\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n */\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint256 labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes memory ret) {\\n uint256 len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint256 labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint256 constant RRSIG_TYPE = 0;\\n uint256 constant RRSIG_ALGORITHM = 2;\\n uint256 constant RRSIG_LABELS = 3;\\n uint256 constant RRSIG_TTL = 4;\\n uint256 constant RRSIG_EXPIRATION = 8;\\n uint256 constant RRSIG_INCEPTION = 12;\\n uint256 constant RRSIG_KEY_TAG = 16;\\n uint256 constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(\\n bytes memory data\\n ) internal pure returns (SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(\\n RRSIG_SIGNER_NAME + self.signerName.length,\\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\\n );\\n }\\n\\n function rrs(\\n SignedSet memory rrset\\n ) internal pure returns (RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint256 offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint256 rdataOffset;\\n uint256 nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns (bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint256 rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.offset,\\n nameLength(iter.data, iter.offset)\\n );\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(\\n RRIterator memory iter\\n ) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.rdataOffset,\\n iter.nextOffset - iter.rdataOffset\\n );\\n }\\n\\n uint256 constant DNSKEY_FLAGS = 0;\\n uint256 constant DNSKEY_PROTOCOL = 2;\\n uint256 constant DNSKEY_ALGORITHM = 3;\\n uint256 constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(\\n offset + DNSKEY_PUBKEY,\\n length - DNSKEY_PUBKEY\\n );\\n }\\n\\n uint256 constant DS_KEY_TAG = 0;\\n uint256 constant DS_ALGORITHM = 2;\\n uint256 constant DS_DIGEST_TYPE = 3;\\n uint256 constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n function isSubdomainOf(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n uint256 off = 0;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n while (counts > othercounts) {\\n off = progress(self, off);\\n counts--;\\n }\\n\\n return self.equals(off, other, 0);\\n }\\n\\n function compareNames(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint256 off;\\n uint256 otheroff;\\n uint256 prevoff;\\n uint256 otherprevoff;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if (otheroff == 0) {\\n return 1;\\n }\\n\\n return\\n self.compare(\\n prevoff + 1,\\n self.readUint8(prevoff),\\n other,\\n otherprevoff + 1,\\n other.readUint8(otherprevoff)\\n );\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(\\n uint32 i1,\\n uint32 i2\\n ) internal pure returns (bool) {\\n unchecked {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n }\\n\\n function progress(\\n bytes memory body,\\n uint256 off\\n ) internal pure returns (uint256) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint256 ac1;\\n uint256 ac2;\\n for (uint256 i = 0; i < data.length + 31; i += 32) {\\n uint256 word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if (i + 32 > data.length) {\\n uint256 unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 +=\\n (word &\\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\\n 8;\\n ac2 += (word &\\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 =\\n (ac1 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac1 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac2 =\\n (ac2 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac2 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 =\\n (ac1 &\\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\\n 32);\\n ac1 =\\n (ac1 &\\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\\n 64);\\n ac1 =\\n (ac1 &\\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\\n (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4dd68a6efd7c38f6b0e95ca0c056ecb74f88583da650b1a8639e6e78be36fede\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/resolvers/IMulticallable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IMulticallable {\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n}\\n\",\"keccak256\":\"0x0334202e20bb11995997083d05963f5e8e7ed6194cba494e7f9371ab7bf4e2c3\",\"license\":\"MIT\"},\"contracts/resolvers/Multicallable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"./IMulticallable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nabstract contract Multicallable is IMulticallable, ERC165 {\\n function _multicall(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) internal returns (bytes[] memory results) {\\n results = new bytes[](data.length);\\n for (uint256 i = 0; i < data.length; i++) {\\n if (nodehash != bytes32(0)) {\\n bytes32 txNamehash = bytes32(data[i][4:36]);\\n require(\\n txNamehash == nodehash,\\n \\\"multicall: All records must have a matching namehash\\\"\\n );\\n }\\n (bool success, bytes memory result) = address(this).delegatecall(\\n data[i]\\n );\\n require(success);\\n results[i] = result;\\n }\\n return results;\\n }\\n\\n // This function provides an extra security check when called\\n // from priviledged contracts (such as EthRegistrarController)\\n // that can set records on behalf of the node owners\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results) {\\n return _multicall(nodehash, data);\\n }\\n\\n function multicall(\\n bytes[] calldata data\\n ) public override returns (bytes[] memory results) {\\n return _multicall(bytes32(0), data);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IMulticallable).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x1063a9dd3b94ba304624d5ec6deb43c1916640758ae970eece4d4e3ef8b2fcb1\",\"license\":\"MIT\"},\"contracts/resolvers/PublicResolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./profiles/ABIResolver.sol\\\";\\nimport \\\"./profiles/AddrResolver.sol\\\";\\nimport \\\"./profiles/ContentHashResolver.sol\\\";\\nimport \\\"./profiles/DNSResolver.sol\\\";\\nimport \\\"./profiles/InterfaceResolver.sol\\\";\\nimport \\\"./profiles/NameResolver.sol\\\";\\nimport \\\"./profiles/PubkeyResolver.sol\\\";\\nimport \\\"./profiles/TextResolver.sol\\\";\\nimport \\\"./Multicallable.sol\\\";\\nimport {ReverseClaimer} from \\\"../reverseRegistrar/ReverseClaimer.sol\\\";\\nimport {INameWrapper} from \\\"../wrapper/INameWrapper.sol\\\";\\n\\n/**\\n * A simple resolver anyone can use; only allows the owner of a node to set its\\n * address.\\n */\\ncontract PublicResolver is\\n Multicallable,\\n ABIResolver,\\n AddrResolver,\\n ContentHashResolver,\\n DNSResolver,\\n InterfaceResolver,\\n NameResolver,\\n PubkeyResolver,\\n TextResolver,\\n ReverseClaimer\\n{\\n ENS immutable ens;\\n INameWrapper immutable nameWrapper;\\n address immutable trustedETHController;\\n address immutable trustedReverseRegistrar;\\n\\n /**\\n * A mapping of operators. An address that is authorised for an address\\n * may make any changes to the name that the owner could, but may not update\\n * the set of authorisations.\\n * (owner, operator) => approved\\n */\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * A mapping of delegates. A delegate that is authorised by an owner\\n * for a name may make changes to the name's resolver, but may not update\\n * the set of token approvals.\\n * (owner, name, delegate) => approved\\n */\\n mapping(address => mapping(bytes32 => mapping(address => bool)))\\n private _tokenApprovals;\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n // Logged when a delegate is approved or an approval is revoked.\\n event Approved(\\n address owner,\\n bytes32 indexed node,\\n address indexed delegate,\\n bool indexed approved\\n );\\n\\n constructor(\\n ENS _ens,\\n INameWrapper wrapperAddress,\\n address _trustedETHController,\\n address _trustedReverseRegistrar\\n ) ReverseClaimer(_ens, msg.sender) {\\n ens = _ens;\\n nameWrapper = wrapperAddress;\\n trustedETHController = _trustedETHController;\\n trustedReverseRegistrar = _trustedReverseRegistrar;\\n }\\n\\n /**\\n * @dev See {IERC1155-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) external {\\n require(\\n msg.sender != operator,\\n \\\"ERC1155: setting approval status for self\\\"\\n );\\n\\n _operatorApprovals[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC1155-isApprovedForAll}.\\n */\\n function isApprovedForAll(\\n address account,\\n address operator\\n ) public view returns (bool) {\\n return _operatorApprovals[account][operator];\\n }\\n\\n /**\\n * @dev Approve a delegate to be able to updated records on a node.\\n */\\n function approve(bytes32 node, address delegate, bool approved) external {\\n require(msg.sender != delegate, \\\"Setting delegate status for self\\\");\\n\\n _tokenApprovals[msg.sender][node][delegate] = approved;\\n emit Approved(msg.sender, node, delegate, approved);\\n }\\n\\n /**\\n * @dev Check to see if the delegate has been approved by the owner for the node.\\n */\\n function isApprovedFor(\\n address owner,\\n bytes32 node,\\n address delegate\\n ) public view returns (bool) {\\n return _tokenApprovals[owner][node][delegate];\\n }\\n\\n function isAuthorised(bytes32 node) internal view override returns (bool) {\\n if (\\n msg.sender == trustedETHController ||\\n msg.sender == trustedReverseRegistrar\\n ) {\\n return true;\\n }\\n address owner = ens.owner(node);\\n if (owner == address(nameWrapper)) {\\n owner = nameWrapper.ownerOf(uint256(node));\\n }\\n return\\n owner == msg.sender ||\\n isApprovedForAll(owner, msg.sender) ||\\n isApprovedFor(owner, node, msg.sender);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n )\\n public\\n view\\n override(\\n Multicallable,\\n ABIResolver,\\n AddrResolver,\\n ContentHashResolver,\\n DNSResolver,\\n InterfaceResolver,\\n NameResolver,\\n PubkeyResolver,\\n TextResolver\\n )\\n returns (bool)\\n {\\n return super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x24c839eb7118da8eea65d07401cc26bad0444a3e651b2cb19749c43065bd24de\",\"license\":\"MIT\"},\"contracts/resolvers/ResolverBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"./profiles/IVersionableResolver.sol\\\";\\n\\nabstract contract ResolverBase is ERC165, IVersionableResolver {\\n mapping(bytes32 => uint64) public recordVersions;\\n\\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\\n\\n modifier authorised(bytes32 node) {\\n require(isAuthorised(node));\\n _;\\n }\\n\\n /**\\n * Increments the record version associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function clearRecords(bytes32 node) public virtual authorised(node) {\\n recordVersions[node]++;\\n emit VersionChanged(node, recordVersions[node]);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IVersionableResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x893049fffd6feee06d7acef1680f6e26505bedff62a9f7a17e921c0ba2f66307\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"./IABIResolver.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\n\\nabstract contract ABIResolver is IABIResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\\n\\n /**\\n * Sets the ABI associated with an ENS node.\\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\\n * the empty string.\\n * @param node The node to update.\\n * @param contentType The content type of the ABI\\n * @param data The ABI data.\\n */\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external virtual authorised(node) {\\n // Content types must be powers of 2\\n require(((contentType - 1) & contentType) == 0);\\n\\n versionable_abis[recordVersions[node]][node][contentType] = data;\\n emit ABIChanged(node, contentType);\\n }\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view virtual override returns (uint256, bytes memory) {\\n mapping(uint256 => bytes) storage abiset = versionable_abis[\\n recordVersions[node]\\n ][node];\\n\\n for (\\n uint256 contentType = 1;\\n contentType <= contentTypes;\\n contentType <<= 1\\n ) {\\n if (\\n (contentType & contentTypes) != 0 &&\\n abiset[contentType].length > 0\\n ) {\\n return (contentType, abiset[contentType]);\\n }\\n }\\n\\n return (0, bytes(\\\"\\\"));\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IABIResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x2da96d7750786afe3be019fc6ff768e2d98a5e61d360bd92d8d7bc3c7c1dcc27\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/AddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IAddrResolver.sol\\\";\\nimport \\\"./IAddressResolver.sol\\\";\\n\\nabstract contract AddrResolver is\\n IAddrResolver,\\n IAddressResolver,\\n ResolverBase\\n{\\n uint256 private constant COIN_TYPE_ETH = 60;\\n\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\\n\\n /**\\n * Sets the address associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param a The address to set.\\n */\\n function setAddr(\\n bytes32 node,\\n address a\\n ) external virtual authorised(node) {\\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\\n }\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(\\n bytes32 node\\n ) public view virtual override returns (address payable) {\\n bytes memory a = addr(node, COIN_TYPE_ETH);\\n if (a.length == 0) {\\n return payable(0);\\n }\\n return bytesToAddress(a);\\n }\\n\\n function setAddr(\\n bytes32 node,\\n uint256 coinType,\\n bytes memory a\\n ) public virtual authorised(node) {\\n emit AddressChanged(node, coinType, a);\\n if (coinType == COIN_TYPE_ETH) {\\n emit AddrChanged(node, bytesToAddress(a));\\n }\\n versionable_addresses[recordVersions[node]][node][coinType] = a;\\n }\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) public view virtual override returns (bytes memory) {\\n return versionable_addresses[recordVersions[node]][node][coinType];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IAddrResolver).interfaceId ||\\n interfaceID == type(IAddressResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function bytesToAddress(\\n bytes memory b\\n ) internal pure returns (address payable a) {\\n require(b.length == 20);\\n assembly {\\n a := div(mload(add(b, 32)), exp(256, 12))\\n }\\n }\\n\\n function addressToBytes(address a) internal pure returns (bytes memory b) {\\n b = new bytes(20);\\n assembly {\\n mstore(add(b, 32), mul(a, exp(256, 12)))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7f6ebb3144530a02db03379f33ade869c8408eceed36dfbd751aaff198735b55\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IContentHashResolver.sol\\\";\\n\\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\\n\\n /**\\n * Sets the contenthash associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param hash The contenthash to set\\n */\\n function setContenthash(\\n bytes32 node,\\n bytes calldata hash\\n ) external virtual authorised(node) {\\n versionable_hashes[recordVersions[node]][node] = hash;\\n emit ContenthashChanged(node, hash);\\n }\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(\\n bytes32 node\\n ) external view virtual override returns (bytes memory) {\\n return versionable_hashes[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IContentHashResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xc9755bfb77985375ded880ecab5af41f2b9e8280f30d3e523fe5042ea59f93ea\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/DNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"../../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"./IDNSRecordResolver.sol\\\";\\nimport \\\"./IDNSZoneResolver.sol\\\";\\n\\nabstract contract DNSResolver is\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n ResolverBase\\n{\\n using RRUtils for *;\\n using BytesUtils for bytes;\\n\\n // Zone hashes for the domains.\\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\\n // resource containing a single zonefile.\\n // node => contenthash\\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\\n\\n // The records themselves. Stored as binary RRSETs\\n // node => version => name => resource => data\\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\\n private versionable_records;\\n\\n // Count of number of entries for a given name. Required for DNS resolvers\\n // when resolving wildcards.\\n // node => version => name => number of records\\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\\n private versionable_nameEntriesCount;\\n\\n /**\\n * Set one or more DNS records. Records are supplied in wire-format.\\n * Records with the same node/name/resource must be supplied one after the\\n * other to ensure the data is updated correctly. For example, if the data\\n * was supplied:\\n * a.example.com IN A 1.2.3.4\\n * a.example.com IN A 5.6.7.8\\n * www.example.com IN CNAME a.example.com.\\n * then this would store the two A records for a.example.com correctly as a\\n * single RRSET, however if the data was supplied:\\n * a.example.com IN A 1.2.3.4\\n * www.example.com IN CNAME a.example.com.\\n * a.example.com IN A 5.6.7.8\\n * then this would store the first A record, the CNAME, then the second A\\n * record which would overwrite the first.\\n *\\n * @param node the namehash of the node for which to set the records\\n * @param data the DNS wire format records to set\\n */\\n function setDNSRecords(\\n bytes32 node,\\n bytes calldata data\\n ) external virtual authorised(node) {\\n uint16 resource = 0;\\n uint256 offset = 0;\\n bytes memory name;\\n bytes memory value;\\n bytes32 nameHash;\\n uint64 version = recordVersions[node];\\n // Iterate over the data to add the resource records\\n for (\\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\\n !iter.done();\\n iter.next()\\n ) {\\n if (resource == 0) {\\n resource = iter.dnstype;\\n name = iter.name();\\n nameHash = keccak256(abi.encodePacked(name));\\n value = bytes(iter.rdata());\\n } else {\\n bytes memory newName = iter.name();\\n if (resource != iter.dnstype || !name.equals(newName)) {\\n setDNSRRSet(\\n node,\\n name,\\n resource,\\n data,\\n offset,\\n iter.offset - offset,\\n value.length == 0,\\n version\\n );\\n resource = iter.dnstype;\\n offset = iter.offset;\\n name = newName;\\n nameHash = keccak256(name);\\n value = bytes(iter.rdata());\\n }\\n }\\n }\\n if (name.length > 0) {\\n setDNSRRSet(\\n node,\\n name,\\n resource,\\n data,\\n offset,\\n data.length - offset,\\n value.length == 0,\\n version\\n );\\n }\\n }\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) public view virtual override returns (bytes memory) {\\n return versionable_records[recordVersions[node]][node][name][resource];\\n }\\n\\n /**\\n * Check if a given node has records.\\n * @param node the namehash of the node for which to check the records\\n * @param name the namehash of the node for which to check the records\\n */\\n function hasDNSRecords(\\n bytes32 node,\\n bytes32 name\\n ) public view virtual returns (bool) {\\n return (versionable_nameEntriesCount[recordVersions[node]][node][\\n name\\n ] != 0);\\n }\\n\\n /**\\n * setZonehash sets the hash for the zone.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param hash The zonehash to set\\n */\\n function setZonehash(\\n bytes32 node,\\n bytes calldata hash\\n ) external virtual authorised(node) {\\n uint64 currentRecordVersion = recordVersions[node];\\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\\n node\\n ];\\n versionable_zonehashes[currentRecordVersion][node] = hash;\\n emit DNSZonehashChanged(node, oldhash, hash);\\n }\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(\\n bytes32 node\\n ) external view virtual override returns (bytes memory) {\\n return versionable_zonehashes[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IDNSRecordResolver).interfaceId ||\\n interfaceID == type(IDNSZoneResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function setDNSRRSet(\\n bytes32 node,\\n bytes memory name,\\n uint16 resource,\\n bytes memory data,\\n uint256 offset,\\n uint256 size,\\n bool deleteRecord,\\n uint64 version\\n ) private {\\n bytes32 nameHash = keccak256(name);\\n bytes memory rrData = data.substring(offset, size);\\n if (deleteRecord) {\\n if (\\n versionable_records[version][node][nameHash][resource].length !=\\n 0\\n ) {\\n versionable_nameEntriesCount[version][node][nameHash]--;\\n }\\n delete (versionable_records[version][node][nameHash][resource]);\\n emit DNSRecordDeleted(node, name, resource);\\n } else {\\n if (\\n versionable_records[version][node][nameHash][resource].length ==\\n 0\\n ) {\\n versionable_nameEntriesCount[version][node][nameHash]++;\\n }\\n versionable_records[version][node][nameHash][resource] = rrData;\\n emit DNSRecordChanged(node, name, resource, rrData);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7233e4d2edca222ce6e1cdb07adf127ab52ecaea599fa5369971a7b28dbc59ac\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IVersionableResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IVersionableResolver {\\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\\n\\n function recordVersions(bytes32 node) external view returns (uint64);\\n}\\n\",\"keccak256\":\"0xd0d09596f20c57bafb2ffa8521a8c57120e9af6c6b194f9c689d4da56f91a57c\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/InterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./AddrResolver.sol\\\";\\nimport \\\"./IInterfaceResolver.sol\\\";\\n\\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\\n\\n /**\\n * Sets an interface associated with a name.\\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\\n * @param node The node to update.\\n * @param interfaceID The EIP 165 interface ID.\\n * @param implementer The address of a contract that implements this interface for this node.\\n */\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external virtual authorised(node) {\\n versionable_interfaces[recordVersions[node]][node][\\n interfaceID\\n ] = implementer;\\n emit InterfaceChanged(node, interfaceID, implementer);\\n }\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view virtual override returns (address) {\\n address implementer = versionable_interfaces[recordVersions[node]][\\n node\\n ][interfaceID];\\n if (implementer != address(0)) {\\n return implementer;\\n }\\n\\n address a = addr(node);\\n if (a == address(0)) {\\n return address(0);\\n }\\n\\n (bool success, bytes memory returnData) = a.staticcall(\\n abi.encodeWithSignature(\\n \\\"supportsInterface(bytes4)\\\",\\n type(IERC165).interfaceId\\n )\\n );\\n if (!success || returnData.length < 32 || returnData[31] == 0) {\\n // EIP 165 not supported by target\\n return address(0);\\n }\\n\\n (success, returnData) = a.staticcall(\\n abi.encodeWithSignature(\\\"supportsInterface(bytes4)\\\", interfaceID)\\n );\\n if (!success || returnData.length < 32 || returnData[31] == 0) {\\n // Specified interface not supported by target\\n return address(0);\\n }\\n\\n return a;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IInterfaceResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x820ec60183e7a49a4ee399cf4708acb776725c8e4ad275d1f316c152eace0a59\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/NameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./INameResolver.sol\\\";\\n\\nabstract contract NameResolver is INameResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\\n\\n /**\\n * Sets the name associated with an ENS node, for reverse records.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function setName(\\n bytes32 node,\\n string calldata newName\\n ) external virtual authorised(node) {\\n versionable_names[recordVersions[node]][node] = newName;\\n emit NameChanged(node, newName);\\n }\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(\\n bytes32 node\\n ) external view virtual override returns (string memory) {\\n return versionable_names[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(INameResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x52d0bbb8f9dd33fae471ef2f5f6b3118b221954e5bb7ba724885d4562e75b8e2\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/PubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IPubkeyResolver.sol\\\";\\n\\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\\n struct PublicKey {\\n bytes32 x;\\n bytes32 y;\\n }\\n\\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\\n\\n /**\\n * Sets the SECP256k1 public key associated with an ENS node.\\n * @param node The ENS node to query\\n * @param x the X coordinate of the curve point for the public key.\\n * @param y the Y coordinate of the curve point for the public key.\\n */\\n function setPubkey(\\n bytes32 node,\\n bytes32 x,\\n bytes32 y\\n ) external virtual authorised(node) {\\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\\n emit PubkeyChanged(node, x, y);\\n }\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(\\n bytes32 node\\n ) external view virtual override returns (bytes32 x, bytes32 y) {\\n uint64 currentRecordVersion = recordVersions[node];\\n return (\\n versionable_pubkeys[currentRecordVersion][node].x,\\n versionable_pubkeys[currentRecordVersion][node].y\\n );\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IPubkeyResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x1a1f10a0e40520c998a9296fc81c092c81521e05a784e9bd9ee44cc4c62c8c78\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/TextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./ITextResolver.sol\\\";\\n\\nabstract contract TextResolver is ITextResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\\n\\n /**\\n * Sets the text data associated with an ENS node and key.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param key The key to set.\\n * @param value The text data value to set.\\n */\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external virtual authorised(node) {\\n versionable_texts[recordVersions[node]][node][key] = value;\\n emit TextChanged(node, key, key, value);\\n }\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view virtual override returns (string memory) {\\n return versionable_texts[recordVersions[node]][node][key];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(ITextResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xf9bedd807add38136779d84083ac2fa4f8c92d017c9e1a72fbc9003fa5074379\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseClaimer.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\n\\ncontract ReverseClaimer {\\n bytes32 constant ADDR_REVERSE_NODE =\\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n constructor(ENS ens, address claimant) {\\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\\n ens.owner(ADDR_REVERSE_NODE)\\n );\\n reverseRegistrar.claim(claimant);\\n }\\n}\\n\",\"keccak256\":\"0x78a28627241535b595f6fff476a1fa7acc90c80684fe7784734920fc8af6fc22\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_ETH = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x70310eb67146d7290731c31841399640ac3b6a949eadc6598bc150123d185c57\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101006040523480156200001257600080fd5b50604051620032943803806200329483398101604081905262000035916200017a565b6040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152849033906000906001600160a01b038416906302571be390602401602060405180830381865afa158015620000a1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000c79190620001e2565b604051630f41a04d60e11b81526001600160a01b03848116600483015291925090821690631e83409a906024016020604051808303816000875af115801562000114573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200013a919062000209565b5050506001600160a01b039485166080525091831660a052821660c0521660e05262000223565b6001600160a01b03811681146200017757600080fd5b50565b600080600080608085870312156200019157600080fd5b84516200019e8162000161565b6020860151909450620001b18162000161565b6040860151909350620001c48162000161565b6060860151909250620001d78162000161565b939692955090935050565b600060208284031215620001f557600080fd5b8151620002028162000161565b9392505050565b6000602082840312156200021c57600080fd5b5051919050565b60805160a05160c05160e0516130306200026460003960006117d7015260006117a50152600081816118af01526119150152600061183801526130306000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c80638b95dd7111610104578063c8690233116100a2578063e32954eb11610071578063e32954eb14610504578063e59d895d14610517578063e985e9c51461052a578063f1cb7e061461056657600080fd5b8063c869023314610442578063ce3decdc1461049b578063d5fa2b00146104ae578063d700ff33146104c157600080fd5b8063a8fa5682116100de578063a8fa5682146103b8578063a9784b3e146103cb578063ac9650d81461040f578063bc1c58d11461042f57600080fd5b80638b95dd711461037f578063a22cb46514610392578063a4b91a01146103a557600080fd5b80633603d7581161017c5780635c98042b1161014b5780635c98042b14610333578063623195b014610346578063691f343114610359578063773722131461036c57600080fd5b80633603d758146102a15780633b3b57de146102b45780634cbf6ba4146102c757806359d1d43c1461031357600080fd5b8063124a319c116101b8578063124a319c1461022f5780632203ab561461025a57806329cd62ea1461027b578063304e6ade1461028e57600080fd5b806301ffc9a7146101df5780630af179d71461020757806310f13a8c1461021c575b600080fd5b6101f26101ed366004612529565b610579565b60405190151581526020015b60405180910390f35b61021a610215366004612586565b61058a565b005b61021a61022a3660046125d2565b610794565b61024261023d36600461264c565b610861565b6040516001600160a01b0390911681526020016101fe565b61026d610268366004612678565b610b0d565b6040516101fe9291906126ea565b61021a610289366004612703565b610c44565b61021a61029c366004612586565b610cdf565b61021a6102af36600461272f565b610d5b565b6102426102c236600461272f565b610dfe565b6101f26102d5366004612678565b6000828152602081815260408083205467ffffffffffffffff1683526006825280832094835293815283822092825291909152205461ffff16151590565b610326610321366004612586565b610e30565b6040516101fe9190612748565b61032661034136600461272f565b610f10565b61021a61035436600461275b565b610fcf565b61032661036736600461272f565b61106c565b61021a61037a366004612586565b6110a6565b61021a61038d3660046127c4565b611122565b61021a6103a03660046128ad565b611202565b61021a6103b33660046128d9565b6112f1565b6103266103c6366004612917565b6113be565b6101f26103d9366004612957565b6001600160a01b039283166000908152600c60209081526040808320948352938152838220929094168152925290205460ff1690565b61042261041d3660046129d3565b61140c565b6040516101fe9190612a15565b61032661043d36600461272f565b61141a565b61048661045036600461272f565b6000818152602081815260408083205467ffffffffffffffff168352600982528083209383529290522080546001909101549091565b604080519283526020830191909152016101fe565b61021a6104a9366004612586565b611454565b61021a6104bc366004612a77565b611597565b6104eb6104cf36600461272f565b60006020819052908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016101fe565b610422610512366004612aa7565b6115be565b61021a610525366004612ae6565b6115d3565b6101f2610538366004612b1b565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b610326610574366004612678565b611692565b60006105848261175a565b92915050565b8261059481611798565b61059d57600080fd5b600084815260208181526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff9091169183916106039183918d908d908190840183828082843760009201919091525092939250506119ff9050565b90505b8051516020820151101561072d578661ffff1660000361066b578060400151965061063081611a60565b9450846040516020016106439190612b49565b60405160208183030381529060405280519060200120925061066481611a81565b935061071f565b600061067682611a60565b9050816040015161ffff168861ffff1614158061069a57506106988682611a9d565b155b1561071d576106f68c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d91506106ed908290612b7b565b8b51158a611abb565b81604001519750816020015196508095508580519060200120935061071a82611a81565b94505b505b61072881611d28565b610606565b50835115610788576107888a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c925061077f91508290508f612b7b565b89511588611abb565b50505050505050505050565b8461079e81611798565b6107a757600080fd5b6000868152602081815260408083205467ffffffffffffffff168352600a8252808320898452909152908190209051849184916107e79089908990612b8e565b90815260200160405180910390209182610802929190612c26565b508484604051610813929190612b8e565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516108519493929190612d0f565b60405180910390a3505050505050565b6000828152602081815260408083205467ffffffffffffffff1683526007825280832085845282528083206001600160e01b0319851684529091528120546001600160a01b031680156108b5579050610584565b60006108c085610dfe565b90506001600160a01b0381166108db57600092505050610584565b6040516301ffc9a760e01b602482015260009081906001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516109489190612b49565b600060405180830381855afa9150503d8060008114610983576040519150601f19603f3d011682016040523d82523d6000602084013e610988565b606091505b509150915081158061099b575060208151105b806109dd575080601f815181106109b4576109b4612d41565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109ef576000945050505050610584565b6040516001600160e01b0319871660248201526001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b17905251610a5a9190612b49565b600060405180830381855afa9150503d8060008114610a95576040519150601f19603f3d011682016040523d82523d6000602084013e610a9a565b606091505b509092509050811580610aae575060208151105b80610af0575080601f81518110610ac757610ac7612d41565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610b02576000945050505050610584565b509095945050505050565b6000828152602081815260408083205467ffffffffffffffff168352600180835281842086855290925282206060915b848111610c245780851615801590610b6d575060008181526020839052604081208054610b6990612b9e565b9050115b15610c1c5780826000838152602001908152602001600020808054610b9190612b9e565b80601f0160208091040260200160405190810160405280929190818152602001828054610bbd90612b9e565b8015610c0a5780601f10610bdf57610100808354040283529160200191610c0a565b820191906000526020600020905b815481529060010190602001808311610bed57829003601f168201915b50505050509050935093505050610c3d565b60011b610b3d565b5060006040518060200160405280600081525092509250505b9250929050565b82610c4e81611798565b610c5757600080fd5b604080518082018252848152602080820185815260008881528083528481205467ffffffffffffffff1681526009835284812089825283528490209251835551600190920191909155815185815290810184905285917f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4691015b60405180910390a250505050565b82610ce981611798565b610cf257600080fd5b6000848152602081815260408083205467ffffffffffffffff168352600382528083208784529091529020610d28838583612c26565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610cd1929190612d57565b80610d6581611798565b610d6e57600080fd5b6000828152602081905260408120805467ffffffffffffffff1691610d9283612d6b565b82546101009290920a67ffffffffffffffff818102199093169183160217909155600084815260208181526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610e0c83603c611692565b90508051600003610e205750600092915050565b610e2981611e10565b9392505050565b6000838152602081815260408083205467ffffffffffffffff168352600a825280832086845290915290819020905160609190610e709085908590612b8e565b90815260200160405180910390208054610e8990612b9e565b80601f0160208091040260200160405190810160405280929190818152602001828054610eb590612b9e565b8015610f025780601f10610ed757610100808354040283529160200191610f02565b820191906000526020600020905b815481529060010190602001808311610ee557829003601f168201915b505050505090509392505050565b6000818152602081815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610f4a90612b9e565b80601f0160208091040260200160405190810160405280929190818152602001828054610f7690612b9e565b8015610fc35780601f10610f9857610100808354040283529160200191610fc3565b820191906000526020600020905b815481529060010190602001808311610fa657829003601f168201915b50505050509050919050565b83610fd981611798565b610fe257600080fd5b83610fee600182612b7b565b1615610ff957600080fd5b6000858152602081815260408083205467ffffffffffffffff1683526001825280832088845282528083208784529091529020611037838583612c26565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b6000818152602081815260408083205467ffffffffffffffff168352600882528083208484529091529020805460609190610f4a90612b9e565b826110b081611798565b6110b957600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526008825280832087845290915290206110ef838583612c26565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610cd1929190612d57565b8261112c81611798565b61113557600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af75284846040516111679291906126ea565b60405180910390a2603c83036111be57837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd26111a284611e10565b6040516001600160a01b03909116815260200160405180910390a25b6000848152602081815260408083205467ffffffffffffffff16835260028252808320878452825280832086845290915290206111fb8382612d92565b5050505050565b6001600160a01b03821633036112855760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336000818152600b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6001600160a01b03821633036113495760405162461bcd60e51b815260206004820181905260248201527f53657474696e672064656c65676174652073746174757320666f722073656c66604482015260640161127c565b336000818152600c6020908152604080832087845282528083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519384529286917ff0ddb3b04746704017f9aa8bd728fcc2c1d11675041205350018915f5e4750a0910160405180910390a4505050565b6000838152602081815260408083205467ffffffffffffffff168352600582528083208684528252808320858452825280832061ffff851684529091529020805460609190610e8990612b9e565b6060610e2960008484611e38565b6000818152602081815260408083205467ffffffffffffffff168352600382528083208484529091529020805460609190610f4a90612b9e565b8261145e81611798565b61146757600080fd5b6000848152602081815260408083205467ffffffffffffffff1680845260048352818420888552909252822080549192916114a190612b9e565b80601f01602080910402602001604051908101604052809291908181526020018280546114cd90612b9e565b801561151a5780601f106114ef5761010080835404028352916020019161151a565b820191906000526020600020905b8154815290600101906020018083116114fd57829003601f168201915b5050505067ffffffffffffffff841660009081526004602090815260408083208b845290915290209192506115529050858783612c26565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f8582878760405161158793929190612e52565b60405180910390a2505050505050565b816115a181611798565b6115aa57600080fd5b6115b983603c61038d85612011565b505050565b60606115cb848484611e38565b949350505050565b826115dd81611798565b6115e657600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526007825280832087845282528083206001600160e01b031987168085529083529281902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b6000828152602081815260408083205467ffffffffffffffff16835260028252808320858452825280832084845290915290208054606091906116d490612b9e565b80601f016020809104026020016040519081016040528092919081815260200182805461170090612b9e565b801561174d5780601f106117225761010080835404028352916020019161174d565b820191906000526020600020905b81548152906001019060200180831161173057829003601f168201915b5050505050905092915050565b60006001600160e01b031982167f59d1d43c00000000000000000000000000000000000000000000000000000000148061058457506105848261204a565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806117f95750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b1561180657506001919050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015611887573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ab9190612e82565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b03160361198b576040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611964573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119889190612e82565b90505b6001600160a01b0381163314806119c557506001600160a01b0381166000908152600b6020908152604080832033845290915290205460ff165b80610e2957506001600160a01b0381166000908152600c60209081526040808320868452825280832033845290915290205460ff16610e29565b611a4d6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261058481611d28565b6020810151815160609161058491611a789082612088565b845191906120e2565b60a081015160c082015160609161058491611a78908290612b7b565b600081518351148015610e295750610e298360008460008751612159565b865160208801206000611acf8787876120e2565b90508315611bf95767ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611b1a90612b9e565b159050611b795767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611b5d83612e9f565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091528120611bba916124b6565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a604051611bec929190612ebd565b60405180910390a2610788565b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611c3c90612b9e565b9050600003611c9d5767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611c8183612ee3565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091529020611cdf8282612d92565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a84604051611d1493929190612efa565b60405180910390a250505050505050505050565b60c08101516020820181905281515111611d3f5750565b6000611d5382600001518360200151612088565b8260200151611d629190612f29565b8251909150611d71908261217c565b61ffff166040830152611d85600282612f29565b8251909150611d94908261217c565b61ffff166060830152611da8600282612f29565b8251909150611db790826121a4565b63ffffffff166080830152611dcd600482612f29565b8251909150600090611ddf908361217c565b61ffff169050611df0600283612f29565b60a084018190529150611e038183612f29565b60c0909301929092525050565b60008151601414611e2057600080fd5b50602001516c01000000000000000000000000900490565b60608167ffffffffffffffff811115611e5357611e536127ae565b604051908082528060200260200182016040528015611e8657816020015b6060815260200190600190039081611e715790505b50905060005b82811015612009578415611f51576000848483818110611eae57611eae612d41565b9050602002810190611ec09190612f3c565b611ecf91602491600491612f83565b611ed891612fad565b9050858114611f4f5760405162461bcd60e51b815260206004820152603460248201527f6d756c746963616c6c3a20416c6c207265636f726473206d757374206861766560448201527f2061206d61746368696e67206e616d6568617368000000000000000000000000606482015260840161127c565b505b60008030868685818110611f6757611f67612d41565b9050602002810190611f799190612f3c565b604051611f87929190612b8e565b600060405180830381855af49150503d8060008114611fc2576040519150601f19603f3d011682016040523d82523d6000602084013e611fc7565b606091505b509150915081611fd657600080fd5b80848481518110611fe957611fe9612d41565b60200260200101819052505050808061200190612fcb565b915050611e8c565b509392505050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60006001600160e01b031982167fc86902330000000000000000000000000000000000000000000000000000000014806105845750610584826121ce565b6000815b8351811061209c5761209c612fe4565b60006120a8858361220c565b60ff1690506120b8816001612f29565b6120c29083612f29565b9150806000036120d257506120d8565b5061208c565b6115cb8382612b7b565b82516060906120f18385612f29565b11156120fc57600080fd5b60008267ffffffffffffffff811115612117576121176127ae565b6040519080825280601f01601f191660200182016040528015612141576020820181803683370190505b50905060208082019086860101610b02828287612230565b6000612166848484612286565b612171878785612286565b149695505050505050565b815160009061218c836002612f29565b111561219757600080fd5b50016002015161ffff1690565b81516000906121b4836004612f29565b11156121bf57600080fd5b50016004015163ffffffff1690565b60006001600160e01b031982167f691f34310000000000000000000000000000000000000000000000000000000014806105845750610584826122aa565b600082828151811061222057612220612d41565b016020015160f81c905092915050565b602081106122685781518352612247602084612f29565b9250612254602083612f29565b9150612261602082612b7b565b9050612230565b905182516020929092036101000a6000190180199091169116179052565b82516000906122958385612f29565b11156122a057600080fd5b5091016020012090565b60006001600160e01b031982167f124a319c00000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167fa8fa568200000000000000000000000000000000000000000000000000000000148061234657506001600160e01b031982167f5c98042b00000000000000000000000000000000000000000000000000000000145b8061058457506105848260006001600160e01b031982167fbc1c58d100000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167f3b3b57de0000000000000000000000000000000000000000000000000000000014806123ec57506001600160e01b031982167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061058457506105848260006001600160e01b031982167f2203ab5600000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167fd700ff3300000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167f4fbf043300000000000000000000000000000000000000000000000000000000148061058457506301ffc9a760e01b6001600160e01b0319831614610584565b5080546124c290612b9e565b6000825580601f106124d2575050565b601f0160209004906000526020600020908101906124f091906124f3565b50565b5b8082111561250857600081556001016124f4565b5090565b80356001600160e01b03198116811461252457600080fd5b919050565b60006020828403121561253b57600080fd5b610e298261250c565b60008083601f84011261255657600080fd5b50813567ffffffffffffffff81111561256e57600080fd5b602083019150836020828501011115610c3d57600080fd5b60008060006040848603121561259b57600080fd5b83359250602084013567ffffffffffffffff8111156125b957600080fd5b6125c586828701612544565b9497909650939450505050565b6000806000806000606086880312156125ea57600080fd5b85359450602086013567ffffffffffffffff8082111561260957600080fd5b61261589838a01612544565b9096509450604088013591508082111561262e57600080fd5b5061263b88828901612544565b969995985093965092949392505050565b6000806040838503121561265f57600080fd5b8235915061266f6020840161250c565b90509250929050565b6000806040838503121561268b57600080fd5b50508035926020909101359150565b60005b838110156126b557818101518382015260200161269d565b50506000910152565b600081518084526126d681602086016020860161269a565b601f01601f19169290920160200192915050565b8281526040602082015260006115cb60408301846126be565b60008060006060848603121561271857600080fd5b505081359360208301359350604090920135919050565b60006020828403121561274157600080fd5b5035919050565b602081526000610e2960208301846126be565b6000806000806060858703121561277157600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561279657600080fd5b6127a287828801612544565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b6000806000606084860312156127d957600080fd5b8335925060208401359150604084013567ffffffffffffffff808211156127ff57600080fd5b818601915086601f83011261281357600080fd5b813581811115612825576128256127ae565b604051601f8201601f19908116603f0116810190838211818310171561284d5761284d6127ae565b8160405282815289602084870101111561286657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b6001600160a01b03811681146124f057600080fd5b8035801515811461252457600080fd5b600080604083850312156128c057600080fd5b82356128cb81612888565b915061266f6020840161289d565b6000806000606084860312156128ee57600080fd5b83359250602084013561290081612888565b915061290e6040850161289d565b90509250925092565b60008060006060848603121561292c57600080fd5b8335925060208401359150604084013561ffff8116811461294c57600080fd5b809150509250925092565b60008060006060848603121561296c57600080fd5b833561297781612888565b925060208401359150604084013561294c81612888565b60008083601f8401126129a057600080fd5b50813567ffffffffffffffff8111156129b857600080fd5b6020830191508360208260051b8501011115610c3d57600080fd5b600080602083850312156129e657600080fd5b823567ffffffffffffffff8111156129fd57600080fd5b612a098582860161298e565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612a6a57603f19888603018452612a588583516126be565b94509285019290850190600101612a3c565b5092979650505050505050565b60008060408385031215612a8a57600080fd5b823591506020830135612a9c81612888565b809150509250929050565b600080600060408486031215612abc57600080fd5b83359250602084013567ffffffffffffffff811115612ada57600080fd5b6125c58682870161298e565b600080600060608486031215612afb57600080fd5b83359250612b0b6020850161250c565b9150604084013561294c81612888565b60008060408385031215612b2e57600080fd5b8235612b3981612888565b91506020830135612a9c81612888565b60008251612b5b81846020870161269a565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561058457610584612b65565b8183823760009101908152919050565b600181811c90821680612bb257607f821691505b602082108103612bd257634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156115b957600081815260208120601f850160051c81016020861015612bff5750805b601f850160051c820191505b81811015612c1e57828155600101612c0b565b505050505050565b67ffffffffffffffff831115612c3e57612c3e6127ae565b612c5283612c4c8354612b9e565b83612bd8565b6000601f841160018114612c865760008515612c6e5750838201355b600019600387901b1c1916600186901b1783556111fb565b600083815260209020601f19861690835b82811015612cb75786850135825560209485019460019092019101612c97565b5086821015612cd45760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b604081526000612d23604083018688612ce6565b8281036020840152612d36818587612ce6565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b6020815260006115cb602083018486612ce6565b600067ffffffffffffffff808316818103612d8857612d88612b65565b6001019392505050565b815167ffffffffffffffff811115612dac57612dac6127ae565b612dc081612dba8454612b9e565b84612bd8565b602080601f831160018114612df55760008415612ddd5750858301515b600019600386901b1c1916600185901b178555612c1e565b600085815260208120601f198616915b82811015612e2457888601518255948401946001909101908401612e05565b5085821015612e425787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000612e6560408301866126be565b8281036020840152612e78818587612ce6565b9695505050505050565b600060208284031215612e9457600080fd5b8151610e2981612888565b600061ffff821680612eb357612eb3612b65565b6000190192915050565b604081526000612ed060408301856126be565b905061ffff831660208301529392505050565b600061ffff808316818103612d8857612d88612b65565b606081526000612f0d60608301866126be565b61ffff851660208401528281036040840152612e7881856126be565b8082018082111561058457610584612b65565b6000808335601e19843603018112612f5357600080fd5b83018035915067ffffffffffffffff821115612f6e57600080fd5b602001915036819003821315610c3d57600080fd5b60008085851115612f9357600080fd5b83861115612fa057600080fd5b5050820193919092039150565b8035602083101561058457600019602084900360031b1b1692915050565b600060018201612fdd57612fdd612b65565b5060010190565b634e487b7160e01b600052600160045260246000fdfea26469706673582212204086793f4b09836980854816811f0a2cc25c9fb68c8db7afd380b363dcc4731564736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101da5760003560e01c80638b95dd7111610104578063c8690233116100a2578063e32954eb11610071578063e32954eb14610504578063e59d895d14610517578063e985e9c51461052a578063f1cb7e061461056657600080fd5b8063c869023314610442578063ce3decdc1461049b578063d5fa2b00146104ae578063d700ff33146104c157600080fd5b8063a8fa5682116100de578063a8fa5682146103b8578063a9784b3e146103cb578063ac9650d81461040f578063bc1c58d11461042f57600080fd5b80638b95dd711461037f578063a22cb46514610392578063a4b91a01146103a557600080fd5b80633603d7581161017c5780635c98042b1161014b5780635c98042b14610333578063623195b014610346578063691f343114610359578063773722131461036c57600080fd5b80633603d758146102a15780633b3b57de146102b45780634cbf6ba4146102c757806359d1d43c1461031357600080fd5b8063124a319c116101b8578063124a319c1461022f5780632203ab561461025a57806329cd62ea1461027b578063304e6ade1461028e57600080fd5b806301ffc9a7146101df5780630af179d71461020757806310f13a8c1461021c575b600080fd5b6101f26101ed366004612529565b610579565b60405190151581526020015b60405180910390f35b61021a610215366004612586565b61058a565b005b61021a61022a3660046125d2565b610794565b61024261023d36600461264c565b610861565b6040516001600160a01b0390911681526020016101fe565b61026d610268366004612678565b610b0d565b6040516101fe9291906126ea565b61021a610289366004612703565b610c44565b61021a61029c366004612586565b610cdf565b61021a6102af36600461272f565b610d5b565b6102426102c236600461272f565b610dfe565b6101f26102d5366004612678565b6000828152602081815260408083205467ffffffffffffffff1683526006825280832094835293815283822092825291909152205461ffff16151590565b610326610321366004612586565b610e30565b6040516101fe9190612748565b61032661034136600461272f565b610f10565b61021a61035436600461275b565b610fcf565b61032661036736600461272f565b61106c565b61021a61037a366004612586565b6110a6565b61021a61038d3660046127c4565b611122565b61021a6103a03660046128ad565b611202565b61021a6103b33660046128d9565b6112f1565b6103266103c6366004612917565b6113be565b6101f26103d9366004612957565b6001600160a01b039283166000908152600c60209081526040808320948352938152838220929094168152925290205460ff1690565b61042261041d3660046129d3565b61140c565b6040516101fe9190612a15565b61032661043d36600461272f565b61141a565b61048661045036600461272f565b6000818152602081815260408083205467ffffffffffffffff168352600982528083209383529290522080546001909101549091565b604080519283526020830191909152016101fe565b61021a6104a9366004612586565b611454565b61021a6104bc366004612a77565b611597565b6104eb6104cf36600461272f565b60006020819052908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016101fe565b610422610512366004612aa7565b6115be565b61021a610525366004612ae6565b6115d3565b6101f2610538366004612b1b565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b610326610574366004612678565b611692565b60006105848261175a565b92915050565b8261059481611798565b61059d57600080fd5b600084815260208181526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff9091169183916106039183918d908d908190840183828082843760009201919091525092939250506119ff9050565b90505b8051516020820151101561072d578661ffff1660000361066b578060400151965061063081611a60565b9450846040516020016106439190612b49565b60405160208183030381529060405280519060200120925061066481611a81565b935061071f565b600061067682611a60565b9050816040015161ffff168861ffff1614158061069a57506106988682611a9d565b155b1561071d576106f68c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d91506106ed908290612b7b565b8b51158a611abb565b81604001519750816020015196508095508580519060200120935061071a82611a81565b94505b505b61072881611d28565b610606565b50835115610788576107888a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c925061077f91508290508f612b7b565b89511588611abb565b50505050505050505050565b8461079e81611798565b6107a757600080fd5b6000868152602081815260408083205467ffffffffffffffff168352600a8252808320898452909152908190209051849184916107e79089908990612b8e565b90815260200160405180910390209182610802929190612c26565b508484604051610813929190612b8e565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516108519493929190612d0f565b60405180910390a3505050505050565b6000828152602081815260408083205467ffffffffffffffff1683526007825280832085845282528083206001600160e01b0319851684529091528120546001600160a01b031680156108b5579050610584565b60006108c085610dfe565b90506001600160a01b0381166108db57600092505050610584565b6040516301ffc9a760e01b602482015260009081906001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516109489190612b49565b600060405180830381855afa9150503d8060008114610983576040519150601f19603f3d011682016040523d82523d6000602084013e610988565b606091505b509150915081158061099b575060208151105b806109dd575080601f815181106109b4576109b4612d41565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109ef576000945050505050610584565b6040516001600160e01b0319871660248201526001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b17905251610a5a9190612b49565b600060405180830381855afa9150503d8060008114610a95576040519150601f19603f3d011682016040523d82523d6000602084013e610a9a565b606091505b509092509050811580610aae575060208151105b80610af0575080601f81518110610ac757610ac7612d41565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610b02576000945050505050610584565b509095945050505050565b6000828152602081815260408083205467ffffffffffffffff168352600180835281842086855290925282206060915b848111610c245780851615801590610b6d575060008181526020839052604081208054610b6990612b9e565b9050115b15610c1c5780826000838152602001908152602001600020808054610b9190612b9e565b80601f0160208091040260200160405190810160405280929190818152602001828054610bbd90612b9e565b8015610c0a5780601f10610bdf57610100808354040283529160200191610c0a565b820191906000526020600020905b815481529060010190602001808311610bed57829003601f168201915b50505050509050935093505050610c3d565b60011b610b3d565b5060006040518060200160405280600081525092509250505b9250929050565b82610c4e81611798565b610c5757600080fd5b604080518082018252848152602080820185815260008881528083528481205467ffffffffffffffff1681526009835284812089825283528490209251835551600190920191909155815185815290810184905285917f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4691015b60405180910390a250505050565b82610ce981611798565b610cf257600080fd5b6000848152602081815260408083205467ffffffffffffffff168352600382528083208784529091529020610d28838583612c26565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610cd1929190612d57565b80610d6581611798565b610d6e57600080fd5b6000828152602081905260408120805467ffffffffffffffff1691610d9283612d6b565b82546101009290920a67ffffffffffffffff818102199093169183160217909155600084815260208181526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610e0c83603c611692565b90508051600003610e205750600092915050565b610e2981611e10565b9392505050565b6000838152602081815260408083205467ffffffffffffffff168352600a825280832086845290915290819020905160609190610e709085908590612b8e565b90815260200160405180910390208054610e8990612b9e565b80601f0160208091040260200160405190810160405280929190818152602001828054610eb590612b9e565b8015610f025780601f10610ed757610100808354040283529160200191610f02565b820191906000526020600020905b815481529060010190602001808311610ee557829003601f168201915b505050505090509392505050565b6000818152602081815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610f4a90612b9e565b80601f0160208091040260200160405190810160405280929190818152602001828054610f7690612b9e565b8015610fc35780601f10610f9857610100808354040283529160200191610fc3565b820191906000526020600020905b815481529060010190602001808311610fa657829003601f168201915b50505050509050919050565b83610fd981611798565b610fe257600080fd5b83610fee600182612b7b565b1615610ff957600080fd5b6000858152602081815260408083205467ffffffffffffffff1683526001825280832088845282528083208784529091529020611037838583612c26565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b6000818152602081815260408083205467ffffffffffffffff168352600882528083208484529091529020805460609190610f4a90612b9e565b826110b081611798565b6110b957600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526008825280832087845290915290206110ef838583612c26565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610cd1929190612d57565b8261112c81611798565b61113557600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af75284846040516111679291906126ea565b60405180910390a2603c83036111be57837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd26111a284611e10565b6040516001600160a01b03909116815260200160405180910390a25b6000848152602081815260408083205467ffffffffffffffff16835260028252808320878452825280832086845290915290206111fb8382612d92565b5050505050565b6001600160a01b03821633036112855760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336000818152600b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6001600160a01b03821633036113495760405162461bcd60e51b815260206004820181905260248201527f53657474696e672064656c65676174652073746174757320666f722073656c66604482015260640161127c565b336000818152600c6020908152604080832087845282528083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519384529286917ff0ddb3b04746704017f9aa8bd728fcc2c1d11675041205350018915f5e4750a0910160405180910390a4505050565b6000838152602081815260408083205467ffffffffffffffff168352600582528083208684528252808320858452825280832061ffff851684529091529020805460609190610e8990612b9e565b6060610e2960008484611e38565b6000818152602081815260408083205467ffffffffffffffff168352600382528083208484529091529020805460609190610f4a90612b9e565b8261145e81611798565b61146757600080fd5b6000848152602081815260408083205467ffffffffffffffff1680845260048352818420888552909252822080549192916114a190612b9e565b80601f01602080910402602001604051908101604052809291908181526020018280546114cd90612b9e565b801561151a5780601f106114ef5761010080835404028352916020019161151a565b820191906000526020600020905b8154815290600101906020018083116114fd57829003601f168201915b5050505067ffffffffffffffff841660009081526004602090815260408083208b845290915290209192506115529050858783612c26565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f8582878760405161158793929190612e52565b60405180910390a2505050505050565b816115a181611798565b6115aa57600080fd5b6115b983603c61038d85612011565b505050565b60606115cb848484611e38565b949350505050565b826115dd81611798565b6115e657600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526007825280832087845282528083206001600160e01b031987168085529083529281902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b6000828152602081815260408083205467ffffffffffffffff16835260028252808320858452825280832084845290915290208054606091906116d490612b9e565b80601f016020809104026020016040519081016040528092919081815260200182805461170090612b9e565b801561174d5780601f106117225761010080835404028352916020019161174d565b820191906000526020600020905b81548152906001019060200180831161173057829003601f168201915b5050505050905092915050565b60006001600160e01b031982167f59d1d43c00000000000000000000000000000000000000000000000000000000148061058457506105848261204a565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806117f95750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b1561180657506001919050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015611887573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ab9190612e82565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b03160361198b576040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611964573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119889190612e82565b90505b6001600160a01b0381163314806119c557506001600160a01b0381166000908152600b6020908152604080832033845290915290205460ff165b80610e2957506001600160a01b0381166000908152600c60209081526040808320868452825280832033845290915290205460ff16610e29565b611a4d6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261058481611d28565b6020810151815160609161058491611a789082612088565b845191906120e2565b60a081015160c082015160609161058491611a78908290612b7b565b600081518351148015610e295750610e298360008460008751612159565b865160208801206000611acf8787876120e2565b90508315611bf95767ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611b1a90612b9e565b159050611b795767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611b5d83612e9f565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091528120611bba916124b6565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a604051611bec929190612ebd565b60405180910390a2610788565b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611c3c90612b9e565b9050600003611c9d5767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611c8183612ee3565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091529020611cdf8282612d92565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a84604051611d1493929190612efa565b60405180910390a250505050505050505050565b60c08101516020820181905281515111611d3f5750565b6000611d5382600001518360200151612088565b8260200151611d629190612f29565b8251909150611d71908261217c565b61ffff166040830152611d85600282612f29565b8251909150611d94908261217c565b61ffff166060830152611da8600282612f29565b8251909150611db790826121a4565b63ffffffff166080830152611dcd600482612f29565b8251909150600090611ddf908361217c565b61ffff169050611df0600283612f29565b60a084018190529150611e038183612f29565b60c0909301929092525050565b60008151601414611e2057600080fd5b50602001516c01000000000000000000000000900490565b60608167ffffffffffffffff811115611e5357611e536127ae565b604051908082528060200260200182016040528015611e8657816020015b6060815260200190600190039081611e715790505b50905060005b82811015612009578415611f51576000848483818110611eae57611eae612d41565b9050602002810190611ec09190612f3c565b611ecf91602491600491612f83565b611ed891612fad565b9050858114611f4f5760405162461bcd60e51b815260206004820152603460248201527f6d756c746963616c6c3a20416c6c207265636f726473206d757374206861766560448201527f2061206d61746368696e67206e616d6568617368000000000000000000000000606482015260840161127c565b505b60008030868685818110611f6757611f67612d41565b9050602002810190611f799190612f3c565b604051611f87929190612b8e565b600060405180830381855af49150503d8060008114611fc2576040519150601f19603f3d011682016040523d82523d6000602084013e611fc7565b606091505b509150915081611fd657600080fd5b80848481518110611fe957611fe9612d41565b60200260200101819052505050808061200190612fcb565b915050611e8c565b509392505050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60006001600160e01b031982167fc86902330000000000000000000000000000000000000000000000000000000014806105845750610584826121ce565b6000815b8351811061209c5761209c612fe4565b60006120a8858361220c565b60ff1690506120b8816001612f29565b6120c29083612f29565b9150806000036120d257506120d8565b5061208c565b6115cb8382612b7b565b82516060906120f18385612f29565b11156120fc57600080fd5b60008267ffffffffffffffff811115612117576121176127ae565b6040519080825280601f01601f191660200182016040528015612141576020820181803683370190505b50905060208082019086860101610b02828287612230565b6000612166848484612286565b612171878785612286565b149695505050505050565b815160009061218c836002612f29565b111561219757600080fd5b50016002015161ffff1690565b81516000906121b4836004612f29565b11156121bf57600080fd5b50016004015163ffffffff1690565b60006001600160e01b031982167f691f34310000000000000000000000000000000000000000000000000000000014806105845750610584826122aa565b600082828151811061222057612220612d41565b016020015160f81c905092915050565b602081106122685781518352612247602084612f29565b9250612254602083612f29565b9150612261602082612b7b565b9050612230565b905182516020929092036101000a6000190180199091169116179052565b82516000906122958385612f29565b11156122a057600080fd5b5091016020012090565b60006001600160e01b031982167f124a319c00000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167fa8fa568200000000000000000000000000000000000000000000000000000000148061234657506001600160e01b031982167f5c98042b00000000000000000000000000000000000000000000000000000000145b8061058457506105848260006001600160e01b031982167fbc1c58d100000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167f3b3b57de0000000000000000000000000000000000000000000000000000000014806123ec57506001600160e01b031982167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061058457506105848260006001600160e01b031982167f2203ab5600000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167fd700ff3300000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167f4fbf043300000000000000000000000000000000000000000000000000000000148061058457506301ffc9a760e01b6001600160e01b0319831614610584565b5080546124c290612b9e565b6000825580601f106124d2575050565b601f0160209004906000526020600020908101906124f091906124f3565b50565b5b8082111561250857600081556001016124f4565b5090565b80356001600160e01b03198116811461252457600080fd5b919050565b60006020828403121561253b57600080fd5b610e298261250c565b60008083601f84011261255657600080fd5b50813567ffffffffffffffff81111561256e57600080fd5b602083019150836020828501011115610c3d57600080fd5b60008060006040848603121561259b57600080fd5b83359250602084013567ffffffffffffffff8111156125b957600080fd5b6125c586828701612544565b9497909650939450505050565b6000806000806000606086880312156125ea57600080fd5b85359450602086013567ffffffffffffffff8082111561260957600080fd5b61261589838a01612544565b9096509450604088013591508082111561262e57600080fd5b5061263b88828901612544565b969995985093965092949392505050565b6000806040838503121561265f57600080fd5b8235915061266f6020840161250c565b90509250929050565b6000806040838503121561268b57600080fd5b50508035926020909101359150565b60005b838110156126b557818101518382015260200161269d565b50506000910152565b600081518084526126d681602086016020860161269a565b601f01601f19169290920160200192915050565b8281526040602082015260006115cb60408301846126be565b60008060006060848603121561271857600080fd5b505081359360208301359350604090920135919050565b60006020828403121561274157600080fd5b5035919050565b602081526000610e2960208301846126be565b6000806000806060858703121561277157600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561279657600080fd5b6127a287828801612544565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b6000806000606084860312156127d957600080fd5b8335925060208401359150604084013567ffffffffffffffff808211156127ff57600080fd5b818601915086601f83011261281357600080fd5b813581811115612825576128256127ae565b604051601f8201601f19908116603f0116810190838211818310171561284d5761284d6127ae565b8160405282815289602084870101111561286657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b6001600160a01b03811681146124f057600080fd5b8035801515811461252457600080fd5b600080604083850312156128c057600080fd5b82356128cb81612888565b915061266f6020840161289d565b6000806000606084860312156128ee57600080fd5b83359250602084013561290081612888565b915061290e6040850161289d565b90509250925092565b60008060006060848603121561292c57600080fd5b8335925060208401359150604084013561ffff8116811461294c57600080fd5b809150509250925092565b60008060006060848603121561296c57600080fd5b833561297781612888565b925060208401359150604084013561294c81612888565b60008083601f8401126129a057600080fd5b50813567ffffffffffffffff8111156129b857600080fd5b6020830191508360208260051b8501011115610c3d57600080fd5b600080602083850312156129e657600080fd5b823567ffffffffffffffff8111156129fd57600080fd5b612a098582860161298e565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612a6a57603f19888603018452612a588583516126be565b94509285019290850190600101612a3c565b5092979650505050505050565b60008060408385031215612a8a57600080fd5b823591506020830135612a9c81612888565b809150509250929050565b600080600060408486031215612abc57600080fd5b83359250602084013567ffffffffffffffff811115612ada57600080fd5b6125c58682870161298e565b600080600060608486031215612afb57600080fd5b83359250612b0b6020850161250c565b9150604084013561294c81612888565b60008060408385031215612b2e57600080fd5b8235612b3981612888565b91506020830135612a9c81612888565b60008251612b5b81846020870161269a565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561058457610584612b65565b8183823760009101908152919050565b600181811c90821680612bb257607f821691505b602082108103612bd257634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156115b957600081815260208120601f850160051c81016020861015612bff5750805b601f850160051c820191505b81811015612c1e57828155600101612c0b565b505050505050565b67ffffffffffffffff831115612c3e57612c3e6127ae565b612c5283612c4c8354612b9e565b83612bd8565b6000601f841160018114612c865760008515612c6e5750838201355b600019600387901b1c1916600186901b1783556111fb565b600083815260209020601f19861690835b82811015612cb75786850135825560209485019460019092019101612c97565b5086821015612cd45760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b604081526000612d23604083018688612ce6565b8281036020840152612d36818587612ce6565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b6020815260006115cb602083018486612ce6565b600067ffffffffffffffff808316818103612d8857612d88612b65565b6001019392505050565b815167ffffffffffffffff811115612dac57612dac6127ae565b612dc081612dba8454612b9e565b84612bd8565b602080601f831160018114612df55760008415612ddd5750858301515b600019600386901b1c1916600185901b178555612c1e565b600085815260208120601f198616915b82811015612e2457888601518255948401946001909101908401612e05565b5085821015612e425787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000612e6560408301866126be565b8281036020840152612e78818587612ce6565b9695505050505050565b600060208284031215612e9457600080fd5b8151610e2981612888565b600061ffff821680612eb357612eb3612b65565b6000190192915050565b604081526000612ed060408301856126be565b905061ffff831660208301529392505050565b600061ffff808316818103612d8857612d88612b65565b606081526000612f0d60608301866126be565b61ffff851660208401528281036040840152612e7881856126be565b8082018082111561058457610584612b65565b6000808335601e19843603018112612f5357600080fd5b83018035915067ffffffffffffffff821115612f6e57600080fd5b602001915036819003821315610c3d57600080fd5b60008085851115612f9357600080fd5b83861115612fa057600080fd5b5050820193919092039150565b8035602083101561058457600019602084900360031b1b1692915050565b600060018201612fdd57612fdd612b65565b5060010190565b634e487b7160e01b600052600160045260246000fdfea26469706673582212204086793f4b09836980854816811f0a2cc25c9fb68c8db7afd380b363dcc4731564736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "ABI(bytes32,uint256)": { + "params": { + "contentTypes": "A bitwise OR of the ABI formats accepted by the caller.", + "node": "The ENS node to query" + }, + "returns": { + "_0": "contentType The content type of the return value", + "_1": "data The ABI data" + } + }, + "addr(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated address." + } + }, + "approve(bytes32,address,bool)": { + "details": "Approve a delegate to be able to updated records on a node." + }, + "clearRecords(bytes32)": { + "params": { + "node": "The node to update." + } + }, + "contenthash(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated contenthash." + } + }, + "dnsRecord(bytes32,bytes32,uint16)": { + "params": { + "name": "the keccak-256 hash of the fully-qualified name for which to fetch the record", + "node": "the namehash of the node for which to fetch the record", + "resource": "the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types" + }, + "returns": { + "_0": "the DNS record in wire format if present, otherwise empty" + } + }, + "hasDNSRecords(bytes32,bytes32)": { + "params": { + "name": "the namehash of the node for which to check the records", + "node": "the namehash of the node for which to check the records" + } + }, + "interfaceImplementer(bytes32,bytes4)": { + "params": { + "interfaceID": "The EIP 165 interface ID to check for.", + "node": "The ENS node to query." + }, + "returns": { + "_0": "The address that implements this interface, or 0 if the interface is unsupported." + } + }, + "isApprovedFor(address,bytes32,address)": { + "details": "Check to see if the delegate has been approved by the owner for the node." + }, + "isApprovedForAll(address,address)": { + "details": "See {IERC1155-isApprovedForAll}." + }, + "name(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated name." + } + }, + "pubkey(bytes32)": { + "params": { + "node": "The ENS node to query" + }, + "returns": { + "x": "The X coordinate of the curve point for the public key.", + "y": "The Y coordinate of the curve point for the public key." + } + }, + "setABI(bytes32,uint256,bytes)": { + "params": { + "contentType": "The content type of the ABI", + "data": "The ABI data.", + "node": "The node to update." + } + }, + "setAddr(bytes32,address)": { + "params": { + "a": "The address to set.", + "node": "The node to update." + } + }, + "setApprovalForAll(address,bool)": { + "details": "See {IERC1155-setApprovalForAll}." + }, + "setContenthash(bytes32,bytes)": { + "params": { + "hash": "The contenthash to set", + "node": "The node to update." + } + }, + "setDNSRecords(bytes32,bytes)": { + "params": { + "data": "the DNS wire format records to set", + "node": "the namehash of the node for which to set the records" + } + }, + "setInterface(bytes32,bytes4,address)": { + "params": { + "implementer": "The address of a contract that implements this interface for this node.", + "interfaceID": "The EIP 165 interface ID.", + "node": "The node to update." + } + }, + "setName(bytes32,string)": { + "params": { + "node": "The node to update." + } + }, + "setPubkey(bytes32,bytes32,bytes32)": { + "params": { + "node": "The ENS node to query", + "x": "the X coordinate of the curve point for the public key.", + "y": "the Y coordinate of the curve point for the public key." + } + }, + "setText(bytes32,string,string)": { + "params": { + "key": "The key to set.", + "node": "The node to update.", + "value": "The text data value to set." + } + }, + "setZonehash(bytes32,bytes)": { + "params": { + "hash": "The zonehash to set", + "node": "The node to update." + } + }, + "text(bytes32,string)": { + "params": { + "key": "The text data key to query.", + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated text data." + } + }, + "zonehash(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated contenthash." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "ABI(bytes32,uint256)": { + "notice": "Returns the ABI associated with an ENS node. Defined in EIP205." + }, + "addr(bytes32)": { + "notice": "Returns the address associated with an ENS node." + }, + "clearRecords(bytes32)": { + "notice": "Increments the record version associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "contenthash(bytes32)": { + "notice": "Returns the contenthash associated with an ENS node." + }, + "dnsRecord(bytes32,bytes32,uint16)": { + "notice": "Obtain a DNS record." + }, + "hasDNSRecords(bytes32,bytes32)": { + "notice": "Check if a given node has records." + }, + "interfaceImplementer(bytes32,bytes4)": { + "notice": "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." + }, + "name(bytes32)": { + "notice": "Returns the name associated with an ENS node, for reverse records. Defined in EIP181." + }, + "pubkey(bytes32)": { + "notice": "Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619." + }, + "setABI(bytes32,uint256,bytes)": { + "notice": "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." + }, + "setAddr(bytes32,address)": { + "notice": "Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "setContenthash(bytes32,bytes)": { + "notice": "Sets the contenthash associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "setDNSRecords(bytes32,bytes)": { + "notice": "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." + }, + "setInterface(bytes32,bytes4,address)": { + "notice": "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." + }, + "setName(bytes32,string)": { + "notice": "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." + }, + "setPubkey(bytes32,bytes32,bytes32)": { + "notice": "Sets the SECP256k1 public key associated with an ENS node." + }, + "setText(bytes32,string,string)": { + "notice": "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." + }, + "setZonehash(bytes32,bytes)": { + "notice": "setZonehash sets the hash for the zone. May only be called by the owner of that node in the ENS registry." + }, + "text(bytes32,string)": { + "notice": "Returns the text data associated with an ENS node and key." + }, + "zonehash(bytes32)": { + "notice": "zonehash obtains the hash for the zone." + } + }, + "notice": "A simple resolver anyone can use; only allows the owner of a node to set its address.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 16255, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "recordVersions", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_bytes32,t_uint64)" + }, + { + "astId": 16349, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_abis", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))" + }, + { + "astId": 16503, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_addresses", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))" + }, + { + "astId": 16694, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_hashes", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))" + }, + { + "astId": 16784, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_zonehashes", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))" + }, + { + "astId": 16794, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_records", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))))" + }, + { + "astId": 16802, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_nameEntriesCount", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16)))" + }, + { + "astId": 17665, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_interfaces", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes4,t_address)))" + }, + { + "astId": 17857, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_names", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_string_storage))" + }, + { + "astId": 17944, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_pubkeys", + "offset": 0, + "slot": "9", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_struct(PublicKey)17937_storage))" + }, + { + "astId": 18047, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_texts", + "offset": 0, + "slot": "10", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage)))" + }, + { + "astId": 15784, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "_operatorApprovals", + "offset": 0, + "slot": "11", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" + }, + { + "astId": 15793, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "_tokenApprovals", + "offset": 0, + "slot": "12", + "type": "t_mapping(t_address,t_mapping(t_bytes32,t_mapping(t_address,t_bool)))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes4": { + "encoding": "inplace", + "label": "bytes4", + "numberOfBytes": "4" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_address,t_mapping(t_bytes32,t_mapping(t_address,t_bool)))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(bytes32 => mapping(address => bool)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_address,t_bool))" + }, + "t_mapping(t_bytes32,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_bytes32,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage)))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes32 => uint16))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_uint16)" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes4,t_address))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes4 => address))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes4,t_address)" + }, + "t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(string => string))", + "numberOfBytes": "32", + "value": "t_mapping(t_string_memory_ptr,t_string_storage)" + }, + "t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint16 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint16,t_bytes_storage)" + }, + "t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint256 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_bytes_storage)" + }, + "t_mapping(t_bytes32,t_string_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_bytes32,t_struct(PublicKey)17937_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct PubkeyResolver.PublicKey)", + "numberOfBytes": "32", + "value": "t_struct(PublicKey)17937_storage" + }, + "t_mapping(t_bytes32,t_uint16)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint16)", + "numberOfBytes": "32", + "value": "t_uint16" + }, + "t_mapping(t_bytes32,t_uint64)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint64)", + "numberOfBytes": "32", + "value": "t_uint64" + }, + "t_mapping(t_bytes4,t_address)": { + "encoding": "mapping", + "key": "t_bytes4", + "label": "mapping(bytes4 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_string_memory_ptr,t_string_storage)": { + "encoding": "mapping", + "key": "t_string_memory_ptr", + "label": "mapping(string => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_uint16,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint256,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_bytes_storage)" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage)))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes4,t_address)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes4,t_address))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(string => string)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_string_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => string))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_string_storage)" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_struct(PublicKey)17937_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => struct PubkeyResolver.PublicKey))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_struct(PublicKey)17937_storage)" + }, + "t_string_memory_ptr": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(PublicKey)17937_storage": { + "encoding": "inplace", + "label": "struct PubkeyResolver.PublicKey", + "members": [ + { + "astId": 17934, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "x", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 17936, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "y", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint16": { + "encoding": "inplace", + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint64": { + "encoding": "inplace", + "label": "uint64", + "numberOfBytes": "8" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/RSASHA1Algorithm.json b/solidity/dns-contracts/deployments/holesky/RSASHA1Algorithm.json new file mode 100644 index 0000000..44eb4b6 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/RSASHA1Algorithm.json @@ -0,0 +1,71 @@ +{ + "address": "0x8c1aD59b31506150B2E78c0f7418f782e0A4BD3f", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "key", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x192fab5a7b0f3cea6e6c55875fa816d04a80ea1fd7cabf2a7286c9634b0694f0", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x8c1aD59b31506150B2E78c0f7418f782e0A4BD3f", + "transactionIndex": 40, + "gasUsed": "695194", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x6baccef386a7b765b0eb699a8b0e03d181e95f7c62b5c483dad12d4ca22bb019", + "transactionHash": "0x192fab5a7b0f3cea6e6c55875fa816d04a80ea1fd7cabf2a7286c9634b0694f0", + "logs": [], + "blockNumber": 801763, + "cumulativeGasUsed": "29968223", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC RSASHA1 algorithm.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol\":\"RSASHA1Algorithm\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/solsha1/contracts/SHA1.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary SHA1 {\\n event Debug(bytes32 x);\\n\\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\\n assembly {\\n // Get a safe scratch location\\n let scratch := mload(0x40)\\n\\n // Get the data length, and point data at the first byte\\n let len := mload(data)\\n data := add(data, 32)\\n\\n // Find the length after padding\\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\\n switch lt(sub(totallen, len), 9)\\n case 1 { totallen := add(totallen, 64) }\\n\\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\\n\\n function readword(ptr, off, count) -> result {\\n result := 0\\n if lt(off, count) {\\n result := mload(add(ptr, off))\\n count := sub(count, off)\\n if lt(count, 32) {\\n let mask := not(sub(exp(256, sub(32, count)), 1))\\n result := and(result, mask)\\n }\\n }\\n }\\n\\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\\n mstore(scratch, readword(data, i, len))\\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\\n\\n // If we loaded the last byte, store the terminator byte\\n switch lt(sub(len, i), 64)\\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\\n\\n // If this is the last block, store the length\\n switch eq(i, sub(totallen, 64))\\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\\n\\n // Expand the 16 32-bit words into 80\\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\\n mstore(add(scratch, j), temp)\\n }\\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\\n mstore(add(scratch, j), temp)\\n }\\n\\n let x := h\\n let f := 0\\n let k := 0\\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\\n switch div(j, 20)\\n case 0 {\\n // f = d xor (b and (c xor d))\\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\\n f := and(div(x, 0x1000000000000000000000000000000), f)\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x5A827999\\n }\\n case 1{\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x6ED9EBA1\\n }\\n case 2 {\\n // f = (b and c) or (d and (b or c))\\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := and(div(x, 0x10000000000), f)\\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\\n k := 0x8F1BBCDC\\n }\\n case 3 {\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0xCA62C1D6\\n }\\n // temp = (a leftrotate 5) + f + e + k + w[i]\\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\\n temp := add(f, temp)\\n temp := add(and(x, 0xFFFFFFFF), temp)\\n temp := add(k, temp)\\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\\n }\\n\\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\\n }\\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x746d9b85de197afbc13182cbe4ba4f7917f19594e07c655d6a0c85fdf7460a8a\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n */\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata signature\\n ) external view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xaf6825f9852c69f8e36540821d067b4550dd2263497af9d645309b6a0c457ba6\"},\"contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary ModexpPrecompile {\\n /**\\n * @dev Computes (base ^ exponent) % modulus over big numbers.\\n */\\n function modexp(\\n bytes memory base,\\n bytes memory exponent,\\n bytes memory modulus\\n ) internal view returns (bool success, bytes memory output) {\\n bytes memory input = abi.encodePacked(\\n uint256(base.length),\\n uint256(exponent.length),\\n uint256(modulus.length),\\n base,\\n exponent,\\n modulus\\n );\\n\\n output = new bytes(modulus.length);\\n\\n assembly {\\n success := staticcall(\\n gas(),\\n 5,\\n add(input, 32),\\n mload(input),\\n add(output, 32),\\n mload(modulus)\\n )\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb3d46284534eb99061d4c79968c2d0420b63a6649d118ef2ea3608396b85de3f\"},\"contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./RSAVerify.sol\\\";\\nimport \\\"@ensdomains/solsha1/contracts/SHA1.sol\\\";\\n\\n/**\\n * @dev Implements the DNSSEC RSASHA1 algorithm.\\n */\\ncontract RSASHA1Algorithm is Algorithm {\\n using BytesUtils for *;\\n\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata sig\\n ) external view override returns (bool) {\\n bytes memory exponent;\\n bytes memory modulus;\\n\\n uint16 exponentLen = uint16(key.readUint8(4));\\n if (exponentLen != 0) {\\n exponent = key.substring(5, exponentLen);\\n modulus = key.substring(\\n exponentLen + 5,\\n key.length - exponentLen - 5\\n );\\n } else {\\n exponentLen = key.readUint16(5);\\n exponent = key.substring(7, exponentLen);\\n modulus = key.substring(\\n exponentLen + 7,\\n key.length - exponentLen - 7\\n );\\n }\\n\\n // Recover the message from the signature\\n bool ok;\\n bytes memory result;\\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\\n\\n // Verify it ends with the hash of our data\\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\\n }\\n}\\n\",\"keccak256\":\"0x5dee71f5a212ef48761ab4154fd68fb738eaefe145ee6c3a30d0ed6c63782b55\"},\"contracts/dnssec-oracle/algorithms/RSAVerify.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./ModexpPrecompile.sol\\\";\\n\\nlibrary RSAVerify {\\n /**\\n * @dev Recovers the input data from an RSA signature, returning the result in S.\\n * @param N The RSA public modulus.\\n * @param E The RSA public exponent.\\n * @param S The signature to recover.\\n * @return True if the recovery succeeded.\\n */\\n function rsarecover(\\n bytes memory N,\\n bytes memory E,\\n bytes memory S\\n ) internal view returns (bool, bytes memory) {\\n return ModexpPrecompile.modexp(S, E, N);\\n }\\n}\\n\",\"keccak256\":\"0xb386daa80070f79399a2cb97a534f31660161ccd50662fabcf63e26cce064506\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610bac806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e3660046109e6565b610057565b604051901515815260200160405180910390f35b600060608060006100a260048b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506103009050565b60ff169050801561016e576100f760058261ffff168c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103259050565b9250610167610107826005610a96565b61ffff9081169060059061011d9085168d610ab8565b6101279190610ab8565b8c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103259050565b9150610227565b6101b260058b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506103a99050565b90506101fe60078261ffff168c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103259050565b925061022461020e826007610a96565b61ffff9081169060079061011d9085168d610ab8565b91505b6000606061026c84868a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103d192505050565b90925090508180156102f057506102916014825161028a9190610ab8565b82906103ec565b6bffffffffffffffffffffffff19166102df8b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061041f92505050565b6bffffffffffffffffffffffff1916145b9c9b505050505050505050505050565b600082828151811061031457610314610acb565b016020015160f81c90505b92915050565b82516060906103348385610ae1565b111561033f57600080fd5b60008267ffffffffffffffff81111561035a5761035a610af4565b6040519080825280601f01601f191660200182016040528015610384576020820181803683370190505b5090506020808201908686010161039c8282876108b0565b50909150505b9392505050565b81516000906103b9836002610ae1565b11156103c457600080fd5b50016002015161ffff1690565b600060606103e0838587610906565b91509150935093915050565b81516000906103fc836014610ae1565b111561040757600080fd5b5001602001516bffffffffffffffffffffffff191690565b60006040518251602084019350604067ffffffffffffffc060018301160160098282031060018103610452576040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f06104a4565b6000838310156103a2575080820151928290039260208410156103a25760001960208590036101000a0119169392505050565b60005b82811015610830576104ba848289610471565b85526104ca846020830189610471565b6020860152604081850310600181036104e65760808286038701535b506040830381146001810361050357602086018051600887021790525b5060405b608081101561058b57858101603f19810151603719820151601f19830151600b198401516002911891909218189081027ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe1663800000009091047c010000000100000001000000010000000100000001000000010000000116179052600c01610507565b5060805b61014081101561061457858101607f19810151606f19820151603f198301516017198401516004911891909218189081027ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc1663400000009091047c03000000030000000300000003000000030000000300000003000000031617905260180161058f565b508160008060005b60508110156108065760148104801561064c576001811461067c57600281146106aa57600381146106dd57610707565b6501000000000085046a010000000000000000000086048118600160781b870416189350635a8279999250610707565b650100000000008504600160781b86046a0100000000000000000000870418189350636ed9eba19250610707565b6a01000000000000000000008504600160781b8604818117650100000000008804169116179350638f1bbcdc9250610707565b650100000000008504600160781b86046a010000000000000000000087041818935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c015104019050740100000000000000000000000000000000000000008102650100000000008604179450506a0100000000000000000000633fffffff6a040000000000000000000086041663c00000006604000000000000870416170277ffffffff00ffffffff000000000000ffffffff00ffffffff851617935060018101905061061c565b5050509190910177ffffffff00ffffffff00ffffffff00ffffffff00ffffffff16906040016104a7565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b602081106108e857815183526108c7602084610ae1565b92506108d4602083610ae1565b91506108e1602082610ab8565b90506108b0565b905182516020929092036101000a6000190180199091169116179052565b60006060600085518551855188888860405160200161092a96959493929190610b3a565b6040516020818303038152906040529050835167ffffffffffffffff81111561095557610955610af4565b6040519080825280601f01601f19166020018201604052801561097f576020820181803683370190505b50915083516020830182516020840160055afa925050935093915050565b60008083601f8401126109af57600080fd5b50813567ffffffffffffffff8111156109c757600080fd5b6020830191508360208285010111156109df57600080fd5b9250929050565b600080600080600080606087890312156109ff57600080fd5b863567ffffffffffffffff80821115610a1757600080fd5b610a238a838b0161099d565b90985096506020890135915080821115610a3c57600080fd5b610a488a838b0161099d565b90965094506040890135915080821115610a6157600080fd5b50610a6e89828a0161099d565b979a9699509497509295939492505050565b634e487b7160e01b600052601160045260246000fd5b61ffff818116838216019080821115610ab157610ab1610a80565b5092915050565b8181038181111561031f5761031f610a80565b634e487b7160e01b600052603260045260246000fd5b8082018082111561031f5761031f610a80565b634e487b7160e01b600052604160045260246000fd5b6000815160005b81811015610b2b5760208185018101518683015201610b11565b50600093019283525090919050565b8681528560208201528460408201526000610b6a610b64610b5e6060850188610b0a565b86610b0a565b84610b0a565b9897505050505050505056fea26469706673582212207857b7c8a67e5fd64e3ccb8e7b2e6fbd8ac879a5659d7498b1bc12aeeba36c9764736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e3660046109e6565b610057565b604051901515815260200160405180910390f35b600060608060006100a260048b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506103009050565b60ff169050801561016e576100f760058261ffff168c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103259050565b9250610167610107826005610a96565b61ffff9081169060059061011d9085168d610ab8565b6101279190610ab8565b8c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103259050565b9150610227565b6101b260058b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506103a99050565b90506101fe60078261ffff168c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103259050565b925061022461020e826007610a96565b61ffff9081169060079061011d9085168d610ab8565b91505b6000606061026c84868a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103d192505050565b90925090508180156102f057506102916014825161028a9190610ab8565b82906103ec565b6bffffffffffffffffffffffff19166102df8b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061041f92505050565b6bffffffffffffffffffffffff1916145b9c9b505050505050505050505050565b600082828151811061031457610314610acb565b016020015160f81c90505b92915050565b82516060906103348385610ae1565b111561033f57600080fd5b60008267ffffffffffffffff81111561035a5761035a610af4565b6040519080825280601f01601f191660200182016040528015610384576020820181803683370190505b5090506020808201908686010161039c8282876108b0565b50909150505b9392505050565b81516000906103b9836002610ae1565b11156103c457600080fd5b50016002015161ffff1690565b600060606103e0838587610906565b91509150935093915050565b81516000906103fc836014610ae1565b111561040757600080fd5b5001602001516bffffffffffffffffffffffff191690565b60006040518251602084019350604067ffffffffffffffc060018301160160098282031060018103610452576040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f06104a4565b6000838310156103a2575080820151928290039260208410156103a25760001960208590036101000a0119169392505050565b60005b82811015610830576104ba848289610471565b85526104ca846020830189610471565b6020860152604081850310600181036104e65760808286038701535b506040830381146001810361050357602086018051600887021790525b5060405b608081101561058b57858101603f19810151603719820151601f19830151600b198401516002911891909218189081027ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe1663800000009091047c010000000100000001000000010000000100000001000000010000000116179052600c01610507565b5060805b61014081101561061457858101607f19810151606f19820151603f198301516017198401516004911891909218189081027ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc1663400000009091047c03000000030000000300000003000000030000000300000003000000031617905260180161058f565b508160008060005b60508110156108065760148104801561064c576001811461067c57600281146106aa57600381146106dd57610707565b6501000000000085046a010000000000000000000086048118600160781b870416189350635a8279999250610707565b650100000000008504600160781b86046a0100000000000000000000870418189350636ed9eba19250610707565b6a01000000000000000000008504600160781b8604818117650100000000008804169116179350638f1bbcdc9250610707565b650100000000008504600160781b86046a010000000000000000000087041818935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c015104019050740100000000000000000000000000000000000000008102650100000000008604179450506a0100000000000000000000633fffffff6a040000000000000000000086041663c00000006604000000000000870416170277ffffffff00ffffffff000000000000ffffffff00ffffffff851617935060018101905061061c565b5050509190910177ffffffff00ffffffff00ffffffff00ffffffff00ffffffff16906040016104a7565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b602081106108e857815183526108c7602084610ae1565b92506108d4602083610ae1565b91506108e1602082610ab8565b90506108b0565b905182516020929092036101000a6000190180199091169116179052565b60006060600085518551855188888860405160200161092a96959493929190610b3a565b6040516020818303038152906040529050835167ffffffffffffffff81111561095557610955610af4565b6040519080825280601f01601f19166020018201604052801561097f576020820181803683370190505b50915083516020830182516020840160055afa925050935093915050565b60008083601f8401126109af57600080fd5b50813567ffffffffffffffff8111156109c757600080fd5b6020830191508360208285010111156109df57600080fd5b9250929050565b600080600080600080606087890312156109ff57600080fd5b863567ffffffffffffffff80821115610a1757600080fd5b610a238a838b0161099d565b90985096506020890135915080821115610a3c57600080fd5b610a488a838b0161099d565b90965094506040890135915080821115610a6157600080fd5b50610a6e89828a0161099d565b979a9699509497509295939492505050565b634e487b7160e01b600052601160045260246000fd5b61ffff818116838216019080821115610ab157610ab1610a80565b5092915050565b8181038181111561031f5761031f610a80565b634e487b7160e01b600052603260045260246000fd5b8082018082111561031f5761031f610a80565b634e487b7160e01b600052604160045260246000fd5b6000815160005b81811015610b2b5760208185018101518683015201610b11565b50600093019283525090919050565b8681528560208201528460408201526000610b6a610b64610b5e6060850188610b0a565b86610b0a565b84610b0a565b9897505050505050505056fea26469706673582212207857b7c8a67e5fd64e3ccb8e7b2e6fbd8ac879a5659d7498b1bc12aeeba36c9764736f6c63430008110033", + "devdoc": { + "details": "Implements the DNSSEC RSASHA1 algorithm.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/RSASHA256Algorithm.json b/solidity/dns-contracts/deployments/holesky/RSASHA256Algorithm.json new file mode 100644 index 0000000..13dd423 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/RSASHA256Algorithm.json @@ -0,0 +1,71 @@ +{ + "address": "0xCbc8cb72762831792b52DD07Eba32d88409642D5", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "key", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x9f488966f75f20e881d3d8076e77e3185fd613892142e186653d9fa8da839dda", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0xCbc8cb72762831792b52DD07Eba32d88409642D5", + "transactionIndex": 75, + "gasUsed": "448967", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x1fe0d6cb317d1ab21da4f393c7fa11495b354496d9dab79a24ef2012384303a6", + "transactionHash": "0x9f488966f75f20e881d3d8076e77e3185fd613892142e186653d9fa8da839dda", + "logs": [], + "blockNumber": 801784, + "cumulativeGasUsed": "29472266", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC RSASHA256 algorithm.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol\":\"RSASHA256Algorithm\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n */\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata signature\\n ) external view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xaf6825f9852c69f8e36540821d067b4550dd2263497af9d645309b6a0c457ba6\"},\"contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary ModexpPrecompile {\\n /**\\n * @dev Computes (base ^ exponent) % modulus over big numbers.\\n */\\n function modexp(\\n bytes memory base,\\n bytes memory exponent,\\n bytes memory modulus\\n ) internal view returns (bool success, bytes memory output) {\\n bytes memory input = abi.encodePacked(\\n uint256(base.length),\\n uint256(exponent.length),\\n uint256(modulus.length),\\n base,\\n exponent,\\n modulus\\n );\\n\\n output = new bytes(modulus.length);\\n\\n assembly {\\n success := staticcall(\\n gas(),\\n 5,\\n add(input, 32),\\n mload(input),\\n add(output, 32),\\n mload(modulus)\\n )\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb3d46284534eb99061d4c79968c2d0420b63a6649d118ef2ea3608396b85de3f\"},\"contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./RSAVerify.sol\\\";\\n\\n/**\\n * @dev Implements the DNSSEC RSASHA256 algorithm.\\n */\\ncontract RSASHA256Algorithm is Algorithm {\\n using BytesUtils for *;\\n\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata sig\\n ) external view override returns (bool) {\\n bytes memory exponent;\\n bytes memory modulus;\\n\\n uint16 exponentLen = uint16(key.readUint8(4));\\n if (exponentLen != 0) {\\n exponent = key.substring(5, exponentLen);\\n modulus = key.substring(\\n exponentLen + 5,\\n key.length - exponentLen - 5\\n );\\n } else {\\n exponentLen = key.readUint16(5);\\n exponent = key.substring(7, exponentLen);\\n modulus = key.substring(\\n exponentLen + 7,\\n key.length - exponentLen - 7\\n );\\n }\\n\\n // Recover the message from the signature\\n bool ok;\\n bytes memory result;\\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\\n\\n // Verify it ends with the hash of our data\\n return ok && sha256(data) == result.readBytes32(result.length - 32);\\n }\\n}\\n\",\"keccak256\":\"0x1d6ba44f41e957f9c53e6e5b88150cbb6c9f46e9da196502984ee0a53e9ac5a9\"},\"contracts/dnssec-oracle/algorithms/RSAVerify.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./ModexpPrecompile.sol\\\";\\n\\nlibrary RSAVerify {\\n /**\\n * @dev Recovers the input data from an RSA signature, returning the result in S.\\n * @param N The RSA public modulus.\\n * @param E The RSA public exponent.\\n * @param S The signature to recover.\\n * @return True if the recovery succeeded.\\n */\\n function rsarecover(\\n bytes memory N,\\n bytes memory E,\\n bytes memory S\\n ) internal view returns (bool, bytes memory) {\\n return ModexpPrecompile.modexp(S, E, N);\\n }\\n}\\n\",\"keccak256\":\"0xb386daa80070f79399a2cb97a534f31660161ccd50662fabcf63e26cce064506\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610728806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e366004610539565b610057565b604051901515815260200160405180910390f35b600060608060006100a260048b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506102f59050565b60ff169050801561016e576100f760058261ffff168c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061031a9050565b92506101676101078260056105e9565b61ffff9081169060059061011d9085168d61060b565b610127919061060b565b8c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061031a9050565b9150610227565b6101b260058b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061039c9050565b90506101fe60078261ffff168c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061031a9050565b925061022461020e8260076105e9565b61ffff9081169060079061011d9085168d61060b565b91505b6000606061026c84868a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103c492505050565b90925090508180156102e557506102916020825161028a919061060b565b82906103df565b60028b8b6040516102a392919061061e565b602060405180830381855afa1580156102c0573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906102e3919061062e565b145b9c9b505050505050505050505050565b600082828151811061030957610309610647565b016020015160f81c90505b92915050565b8251606090610329838561065d565b111561033457600080fd5b60008267ffffffffffffffff81111561034f5761034f610670565b6040519080825280601f01601f191660200182016040528015610379576020820181803683370190505b50905060208082019086860101610391828287610403565b509095945050505050565b81516000906103ac83600261065d565b11156103b757600080fd5b50016002015161ffff1690565b600060606103d3838587610459565b91509150935093915050565b81516000906103ef83602061065d565b11156103fa57600080fd5b50016020015190565b6020811061043b578151835261041a60208461065d565b925061042760208361065d565b915061043460208261060b565b9050610403565b905182516020929092036101000a6000190180199091169116179052565b60006060600085518551855188888860405160200161047d969594939291906106b6565b6040516020818303038152906040529050835167ffffffffffffffff8111156104a8576104a8610670565b6040519080825280601f01601f1916602001820160405280156104d2576020820181803683370190505b50915083516020830182516020840160055afa925050935093915050565b60008083601f84011261050257600080fd5b50813567ffffffffffffffff81111561051a57600080fd5b60208301915083602082850101111561053257600080fd5b9250929050565b6000806000806000806060878903121561055257600080fd5b863567ffffffffffffffff8082111561056a57600080fd5b6105768a838b016104f0565b9098509650602089013591508082111561058f57600080fd5b61059b8a838b016104f0565b909650945060408901359150808211156105b457600080fd5b506105c189828a016104f0565b979a9699509497509295939492505050565b634e487b7160e01b600052601160045260246000fd5b61ffff818116838216019080821115610604576106046105d3565b5092915050565b81810381811115610314576103146105d3565b8183823760009101908152919050565b60006020828403121561064057600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b80820180821115610314576103146105d3565b634e487b7160e01b600052604160045260246000fd5b6000815160005b818110156106a7576020818501810151868301520161068d565b50600093019283525090919050565b86815285602082015284604082015260006106e66106e06106da6060850188610686565b86610686565b84610686565b9897505050505050505056fea264697066735822122081d54f6872821586c976d8d9aa106e2ea811afa445a713b0da099f753dd8e48364736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e366004610539565b610057565b604051901515815260200160405180910390f35b600060608060006100a260048b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506102f59050565b60ff169050801561016e576100f760058261ffff168c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061031a9050565b92506101676101078260056105e9565b61ffff9081169060059061011d9085168d61060b565b610127919061060b565b8c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061031a9050565b9150610227565b6101b260058b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061039c9050565b90506101fe60078261ffff168c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061031a9050565b925061022461020e8260076105e9565b61ffff9081169060079061011d9085168d61060b565b91505b6000606061026c84868a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103c492505050565b90925090508180156102e557506102916020825161028a919061060b565b82906103df565b60028b8b6040516102a392919061061e565b602060405180830381855afa1580156102c0573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906102e3919061062e565b145b9c9b505050505050505050505050565b600082828151811061030957610309610647565b016020015160f81c90505b92915050565b8251606090610329838561065d565b111561033457600080fd5b60008267ffffffffffffffff81111561034f5761034f610670565b6040519080825280601f01601f191660200182016040528015610379576020820181803683370190505b50905060208082019086860101610391828287610403565b509095945050505050565b81516000906103ac83600261065d565b11156103b757600080fd5b50016002015161ffff1690565b600060606103d3838587610459565b91509150935093915050565b81516000906103ef83602061065d565b11156103fa57600080fd5b50016020015190565b6020811061043b578151835261041a60208461065d565b925061042760208361065d565b915061043460208261060b565b9050610403565b905182516020929092036101000a6000190180199091169116179052565b60006060600085518551855188888860405160200161047d969594939291906106b6565b6040516020818303038152906040529050835167ffffffffffffffff8111156104a8576104a8610670565b6040519080825280601f01601f1916602001820160405280156104d2576020820181803683370190505b50915083516020830182516020840160055afa925050935093915050565b60008083601f84011261050257600080fd5b50813567ffffffffffffffff81111561051a57600080fd5b60208301915083602082850101111561053257600080fd5b9250929050565b6000806000806000806060878903121561055257600080fd5b863567ffffffffffffffff8082111561056a57600080fd5b6105768a838b016104f0565b9098509650602089013591508082111561058f57600080fd5b61059b8a838b016104f0565b909650945060408901359150808211156105b457600080fd5b506105c189828a016104f0565b979a9699509497509295939492505050565b634e487b7160e01b600052601160045260246000fd5b61ffff818116838216019080821115610604576106046105d3565b5092915050565b81810381811115610314576103146105d3565b8183823760009101908152919050565b60006020828403121561064057600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b80820180821115610314576103146105d3565b634e487b7160e01b600052604160045260246000fd5b6000815160005b818110156106a7576020818501810151868301520161068d565b50600093019283525090919050565b86815285602082015284604082015260006106e66106e06106da6060850188610686565b86610686565b84610686565b9897505050505050505056fea264697066735822122081d54f6872821586c976d8d9aa106e2ea811afa445a713b0da099f753dd8e48364736f6c63430008110033", + "devdoc": { + "details": "Implements the DNSSEC RSASHA256 algorithm.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/ReverseRegistrar.json b/solidity/dns-contracts/deployments/holesky/ReverseRegistrar.json new file mode 100644 index 0000000..562a151 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/ReverseRegistrar.json @@ -0,0 +1,516 @@ +{ + "address": "0x132AC0B116a73add4225029D1951A9A707Ef673f", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "ensAddr", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "ControllerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract NameResolver", + "name": "resolver", + "type": "address" + } + ], + "name": "DefaultResolverChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "ReverseClaimed", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "claim", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "claimForAddr", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "claimWithResolver", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "defaultResolver", + "outputs": [ + { + "internalType": "contract NameResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "node", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setDefaultResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "setName", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "setNameForAddr", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xacaf9395cf9248d931d6c5188bca9b35be7c91e7b696aa6fd1c89fddc2d868c7", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x132AC0B116a73add4225029D1951A9A707Ef673f", + "transactionIndex": 1, + "gasUsed": "825844", + "logsBloom": "0x00000000000000000000000000000800000000000000200000800000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000001000000000000000000000000000000000000020002000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x03bb6d95d7348a02c01f3b4117551b1cdcc2907993d9454678d477e7750ca3c1", + "transactionHash": "0xacaf9395cf9248d931d6c5188bca9b35be7c91e7b696aa6fd1c89fddc2d868c7", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 814551, + "transactionHash": "0xacaf9395cf9248d931d6c5188bca9b35be7c91e7b696aa6fd1c89fddc2d868c7", + "address": "0x132AC0B116a73add4225029D1951A9A707Ef673f", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0x03bb6d95d7348a02c01f3b4117551b1cdcc2907993d9454678d477e7750ca3c1" + } + ], + "blockNumber": 814551, + "cumulativeGasUsed": "899641", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"ensAddr\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"ControllerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract NameResolver\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"DefaultResolverChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"ReverseClaimed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"claimForAddr\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"claimWithResolver\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"defaultResolver\",\"outputs\":[{\"internalType\":\"contract NameResolver\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"node\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setDefaultResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"setNameForAddr\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"claim(address)\":{\"details\":\"Transfers ownership of the reverse ENS record associated with the calling account.\",\"params\":{\"owner\":\"The address to set as the owner of the reverse record in ENS.\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"claimForAddr(address,address,address)\":{\"details\":\"Transfers ownership of the reverse ENS record associated with the calling account.\",\"params\":{\"addr\":\"The reverse record to set\",\"owner\":\"The address to set as the owner of the reverse record in ENS.\",\"resolver\":\"The resolver of the reverse node\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"claimWithResolver(address,address)\":{\"details\":\"Transfers ownership of the reverse ENS record associated with the calling account.\",\"params\":{\"owner\":\"The address to set as the owner of the reverse record in ENS.\",\"resolver\":\"The address of the resolver to set; 0 to leave unchanged.\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"constructor\":{\"details\":\"Constructor\",\"params\":{\"ensAddr\":\"The address of the ENS registry.\"}},\"node(address)\":{\"details\":\"Returns the node hash for a given account's reverse records.\",\"params\":{\"addr\":\"The address to hash\"},\"returns\":{\"_0\":\"The ENS node hash.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"setName(string)\":{\"details\":\"Sets the `name()` record for the reverse ENS record associated with the calling account. First updates the resolver to the default reverse resolver if necessary.\",\"params\":{\"name\":\"The name to set for this address.\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"setNameForAddr(address,address,address,string)\":{\"details\":\"Sets the `name()` record for the reverse ENS record associated with the account provided. Updates the resolver to a designated resolver Only callable by controllers and authorised users\",\"params\":{\"addr\":\"The reverse record to set\",\"name\":\"The name to set for this address.\",\"owner\":\"The owner of the reverse node\",\"resolver\":\"The resolver of the reverse node\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/reverseRegistrar/ReverseRegistrar.sol\":\"ReverseRegistrar\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IReverseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"../root/Controllable.sol\\\";\\n\\nabstract contract NameResolver {\\n function setName(bytes32 node, string memory name) public virtual;\\n}\\n\\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\\n\\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n// namehash('addr.reverse')\\n\\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\\n ENS public immutable ens;\\n NameResolver public defaultResolver;\\n\\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\\n event DefaultResolverChanged(NameResolver indexed resolver);\\n\\n /**\\n * @dev Constructor\\n * @param ensAddr The address of the ENS registry.\\n */\\n constructor(ENS ensAddr) {\\n ens = ensAddr;\\n\\n // Assign ownership of the reverse record to our deployer\\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\\n ensAddr.owner(ADDR_REVERSE_NODE)\\n );\\n if (address(oldRegistrar) != address(0x0)) {\\n oldRegistrar.claim(msg.sender);\\n }\\n }\\n\\n modifier authorised(address addr) {\\n require(\\n addr == msg.sender ||\\n controllers[msg.sender] ||\\n ens.isApprovedForAll(addr, msg.sender) ||\\n ownsContract(addr),\\n \\\"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\\\"\\n );\\n _;\\n }\\n\\n function setDefaultResolver(address resolver) public override onlyOwner {\\n require(\\n address(resolver) != address(0),\\n \\\"ReverseRegistrar: Resolver address must not be 0\\\"\\n );\\n defaultResolver = NameResolver(resolver);\\n emit DefaultResolverChanged(NameResolver(resolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claim(address owner) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, address(defaultResolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param addr The reverse record to set\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The resolver of the reverse node\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) public override authorised(addr) returns (bytes32) {\\n bytes32 labelHash = sha3HexAddress(addr);\\n bytes32 reverseNode = keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\\n );\\n emit ReverseClaimed(addr, reverseNode);\\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\\n return reverseNode;\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, resolver);\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the calling account. First updates the resolver to the default reverse\\n * resolver if necessary.\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setName(string memory name) public override returns (bytes32) {\\n return\\n setNameForAddr(\\n msg.sender,\\n msg.sender,\\n address(defaultResolver),\\n name\\n );\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the account provided. Updates the resolver to a designated resolver\\n * Only callable by controllers and authorised users\\n * @param addr The reverse record to set\\n * @param owner The owner of the reverse node\\n * @param resolver The resolver of the reverse node\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) public override returns (bytes32) {\\n bytes32 node = claimForAddr(addr, owner, resolver);\\n NameResolver(resolver).setName(node, name);\\n return node;\\n }\\n\\n /**\\n * @dev Returns the node hash for a given account's reverse records.\\n * @param addr The address to hash\\n * @return The ENS node hash.\\n */\\n function node(address addr) public pure override returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\\n );\\n }\\n\\n /**\\n * @dev An optimised function to compute the sha3 of the lower-case\\n * hexadecimal representation of an Ethereum address.\\n * @param addr The address to hash\\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\\n * input address.\\n */\\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\\n assembly {\\n for {\\n let i := 40\\n } gt(i, 0) {\\n\\n } {\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n }\\n\\n ret := keccak256(0, 40)\\n }\\n }\\n\\n function ownsContract(address addr) internal view returns (bool) {\\n try Ownable(addr).owner() returns (address owner) {\\n return owner == msg.sender;\\n } catch {\\n return false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd57d28e5791b4b44650a00f5ef6c725af53698ec33faeeaa3591f0dbd939559a\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"}},\"version\":1}", + "bytecode": "0x60a060405234801561001057600080fd5b5060405162000f5338038062000f53833981016040819052610031916101b6565b61003a3361014e565b6001600160a01b03811660808190526040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152600091906302571be390602401602060405180830381865afa1580156100a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ca91906101b6565b90506001600160a01b0381161561014757604051630f41a04d60e11b81523360048201526001600160a01b03821690631e83409a906024016020604051808303816000875af1158015610121573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061014591906101da565b505b50506101f3565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146101b357600080fd5b50565b6000602082840312156101c857600080fd5b81516101d38161019e565b9392505050565b6000602082840312156101ec57600080fd5b5051919050565b608051610d366200021d6000396000818161012d015281816102f001526105070152610d366000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063c66485b211610066578063c66485b2146101e1578063da8c229e146101f4578063e0dba60f14610227578063f2fde38b1461023a57600080fd5b80638da5cb5b146101aa578063bffbe61c146101bb578063c47f0027146101ce57600080fd5b806365669631116100c85780636566963114610167578063715018a61461017a5780637a806d6b14610184578063828eab0e1461019757600080fd5b80630f5a5466146100ef5780631e83409a146101155780633f15457f14610128575b600080fd5b6101026100fd366004610a25565b61024d565b6040519081526020015b60405180910390f35b610102610123366004610a5e565b610261565b61014f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b610102610175366004610a7b565b610283565b61018261056e565b005b610102610192366004610b82565b610582565b60025461014f906001600160a01b031681565b6000546001600160a01b031661014f565b6101026101c9366004610a5e565b610616565b6101026101dc366004610bf7565b610671565b6101826101ef366004610a5e565b61068e565b610217610202366004610a5e565b60016020526000908152604090205460ff1681565b604051901515815260200161010c565b610182610235366004610c42565b610769565b610182610248366004610a5e565b6107d0565b600061025a338484610283565b9392505050565b60025460009061027d90339084906001600160a01b0316610283565b92915050565b6000836001600160a01b0381163314806102ac57503360009081526001602052604090205460ff165b8061035b57506040517fe985e9c50000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610337573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035b9190610c70565b8061036a575061036a81610860565b6104075760405162461bcd60e51b815260206004820152605b60248201527f526576657273655265676973747261723a2043616c6c6572206973206e6f742060448201527f6120636f6e74726f6c6c6572206f7220617574686f726973656420627920616460648201527f6472657373206f7220746865206164647265737320697473656c660000000000608482015260a4015b60405180910390fd5b6000610412866108d9565b604080517f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2602080830191909152818301849052825180830384018152606090920192839052815191012091925081906001600160a01b038916907f6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e9290600090a36040517f5ef2c7f00000000000000000000000000000000000000000000000000000000081527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152602481018390526001600160a01b0387811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561054b57600080fd5b505af115801561055f573d6000803e3d6000fd5b50929998505050505050505050565b610576610959565b61058060006109b3565b565b600080610590868686610283565b6040517f773722130000000000000000000000000000000000000000000000000000000081529091506001600160a01b038516906377372213906105da9084908790600401610c8d565b600060405180830381600087803b1580156105f457600080fd5b505af1158015610608573d6000803e3d6000fd5b509298975050505050505050565b60007f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2610642836108d9565b604080516020810193909352820152606001604051602081830303815290604052805190602001209050919050565b60025460009061027d90339081906001600160a01b031685610582565b610696610959565b6001600160a01b0381166107125760405162461bcd60e51b815260206004820152603060248201527f526576657273655265676973747261723a205265736f6c76657220616464726560448201527f7373206d757374206e6f7420626520300000000000000000000000000000000060648201526084016103fe565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517feae17a84d9eb83d8c8eb317f9e7d64857bc363fa51674d996c023f4340c577cf90600090a250565b610771610959565b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b6107d8610959565b6001600160a01b0381166108545760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103fe565b61085d816109b3565b50565b6000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156108bc575060408051601f3d908101601f191682019092526108b991810190610ce3565b60015b6108c857506000919050565b6001600160a01b0316331492915050565b600060285b801561094d57600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a8153601090920491600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a81536010830492506108de565b50506028600020919050565b6000546001600160a01b031633146105805760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103fe565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461085d57600080fd5b60008060408385031215610a3857600080fd5b8235610a4381610a10565b91506020830135610a5381610a10565b809150509250929050565b600060208284031215610a7057600080fd5b813561025a81610a10565b600080600060608486031215610a9057600080fd5b8335610a9b81610a10565b92506020840135610aab81610a10565b91506040840135610abb81610a10565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112610b0657600080fd5b813567ffffffffffffffff80821115610b2157610b21610ac6565b604051601f8301601f19908116603f01168101908282118183101715610b4957610b49610ac6565b81604052838152866020858801011115610b6257600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060808587031215610b9857600080fd5b8435610ba381610a10565b93506020850135610bb381610a10565b92506040850135610bc381610a10565b9150606085013567ffffffffffffffff811115610bdf57600080fd5b610beb87828801610af5565b91505092959194509250565b600060208284031215610c0957600080fd5b813567ffffffffffffffff811115610c2057600080fd5b610c2c84828501610af5565b949350505050565b801515811461085d57600080fd5b60008060408385031215610c5557600080fd5b8235610c6081610a10565b91506020830135610a5381610c34565b600060208284031215610c8257600080fd5b815161025a81610c34565b82815260006020604081840152835180604085015260005b81811015610cc157858101830151858201606001528201610ca5565b506000606082860101526060601f19601f830116850101925050509392505050565b600060208284031215610cf557600080fd5b815161025a81610a1056fea2646970667358221220daae2d891af11b235f016443111e7af5d0e35047fc15f99c70bd6412d181638564736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063c66485b211610066578063c66485b2146101e1578063da8c229e146101f4578063e0dba60f14610227578063f2fde38b1461023a57600080fd5b80638da5cb5b146101aa578063bffbe61c146101bb578063c47f0027146101ce57600080fd5b806365669631116100c85780636566963114610167578063715018a61461017a5780637a806d6b14610184578063828eab0e1461019757600080fd5b80630f5a5466146100ef5780631e83409a146101155780633f15457f14610128575b600080fd5b6101026100fd366004610a25565b61024d565b6040519081526020015b60405180910390f35b610102610123366004610a5e565b610261565b61014f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b610102610175366004610a7b565b610283565b61018261056e565b005b610102610192366004610b82565b610582565b60025461014f906001600160a01b031681565b6000546001600160a01b031661014f565b6101026101c9366004610a5e565b610616565b6101026101dc366004610bf7565b610671565b6101826101ef366004610a5e565b61068e565b610217610202366004610a5e565b60016020526000908152604090205460ff1681565b604051901515815260200161010c565b610182610235366004610c42565b610769565b610182610248366004610a5e565b6107d0565b600061025a338484610283565b9392505050565b60025460009061027d90339084906001600160a01b0316610283565b92915050565b6000836001600160a01b0381163314806102ac57503360009081526001602052604090205460ff165b8061035b57506040517fe985e9c50000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610337573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035b9190610c70565b8061036a575061036a81610860565b6104075760405162461bcd60e51b815260206004820152605b60248201527f526576657273655265676973747261723a2043616c6c6572206973206e6f742060448201527f6120636f6e74726f6c6c6572206f7220617574686f726973656420627920616460648201527f6472657373206f7220746865206164647265737320697473656c660000000000608482015260a4015b60405180910390fd5b6000610412866108d9565b604080517f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2602080830191909152818301849052825180830384018152606090920192839052815191012091925081906001600160a01b038916907f6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e9290600090a36040517f5ef2c7f00000000000000000000000000000000000000000000000000000000081527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152602481018390526001600160a01b0387811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561054b57600080fd5b505af115801561055f573d6000803e3d6000fd5b50929998505050505050505050565b610576610959565b61058060006109b3565b565b600080610590868686610283565b6040517f773722130000000000000000000000000000000000000000000000000000000081529091506001600160a01b038516906377372213906105da9084908790600401610c8d565b600060405180830381600087803b1580156105f457600080fd5b505af1158015610608573d6000803e3d6000fd5b509298975050505050505050565b60007f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2610642836108d9565b604080516020810193909352820152606001604051602081830303815290604052805190602001209050919050565b60025460009061027d90339081906001600160a01b031685610582565b610696610959565b6001600160a01b0381166107125760405162461bcd60e51b815260206004820152603060248201527f526576657273655265676973747261723a205265736f6c76657220616464726560448201527f7373206d757374206e6f7420626520300000000000000000000000000000000060648201526084016103fe565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517feae17a84d9eb83d8c8eb317f9e7d64857bc363fa51674d996c023f4340c577cf90600090a250565b610771610959565b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b6107d8610959565b6001600160a01b0381166108545760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103fe565b61085d816109b3565b50565b6000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156108bc575060408051601f3d908101601f191682019092526108b991810190610ce3565b60015b6108c857506000919050565b6001600160a01b0316331492915050565b600060285b801561094d57600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a8153601090920491600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a81536010830492506108de565b50506028600020919050565b6000546001600160a01b031633146105805760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103fe565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461085d57600080fd5b60008060408385031215610a3857600080fd5b8235610a4381610a10565b91506020830135610a5381610a10565b809150509250929050565b600060208284031215610a7057600080fd5b813561025a81610a10565b600080600060608486031215610a9057600080fd5b8335610a9b81610a10565b92506020840135610aab81610a10565b91506040840135610abb81610a10565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112610b0657600080fd5b813567ffffffffffffffff80821115610b2157610b21610ac6565b604051601f8301601f19908116603f01168101908282118183101715610b4957610b49610ac6565b81604052838152866020858801011115610b6257600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060808587031215610b9857600080fd5b8435610ba381610a10565b93506020850135610bb381610a10565b92506040850135610bc381610a10565b9150606085013567ffffffffffffffff811115610bdf57600080fd5b610beb87828801610af5565b91505092959194509250565b600060208284031215610c0957600080fd5b813567ffffffffffffffff811115610c2057600080fd5b610c2c84828501610af5565b949350505050565b801515811461085d57600080fd5b60008060408385031215610c5557600080fd5b8235610c6081610a10565b91506020830135610a5381610c34565b600060208284031215610c8257600080fd5b815161025a81610c34565b82815260006020604081840152835180604085015260005b81811015610cc157858101830151858201606001528201610ca5565b506000606082860101526060601f19601f830116850101925050509392505050565b600060208284031215610cf557600080fd5b815161025a81610a1056fea2646970667358221220daae2d891af11b235f016443111e7af5d0e35047fc15f99c70bd6412d181638564736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "claim(address)": { + "details": "Transfers ownership of the reverse ENS record associated with the calling account.", + "params": { + "owner": "The address to set as the owner of the reverse record in ENS." + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "claimForAddr(address,address,address)": { + "details": "Transfers ownership of the reverse ENS record associated with the calling account.", + "params": { + "addr": "The reverse record to set", + "owner": "The address to set as the owner of the reverse record in ENS.", + "resolver": "The resolver of the reverse node" + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "claimWithResolver(address,address)": { + "details": "Transfers ownership of the reverse ENS record associated with the calling account.", + "params": { + "owner": "The address to set as the owner of the reverse record in ENS.", + "resolver": "The address of the resolver to set; 0 to leave unchanged." + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "constructor": { + "details": "Constructor", + "params": { + "ensAddr": "The address of the ENS registry." + } + }, + "node(address)": { + "details": "Returns the node hash for a given account's reverse records.", + "params": { + "addr": "The address to hash" + }, + "returns": { + "_0": "The ENS node hash." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "setName(string)": { + "details": "Sets the `name()` record for the reverse ENS record associated with the calling account. First updates the resolver to the default reverse resolver if necessary.", + "params": { + "name": "The name to set for this address." + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "setNameForAddr(address,address,address,string)": { + "details": "Sets the `name()` record for the reverse ENS record associated with the account provided. Updates the resolver to a designated resolver Only callable by controllers and authorised users", + "params": { + "addr": "The reverse record to set", + "name": "The name to set for this address.", + "owner": "The owner of the reverse node", + "resolver": "The resolver of the reverse node" + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 444, + "contract": "contracts/reverseRegistrar/ReverseRegistrar.sol:ReverseRegistrar", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 18581, + "contract": "contracts/reverseRegistrar/ReverseRegistrar.sol:ReverseRegistrar", + "label": "controllers", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 18253, + "contract": "contracts/reverseRegistrar/ReverseRegistrar.sol:ReverseRegistrar", + "label": "defaultResolver", + "offset": 0, + "slot": "2", + "type": "t_contract(NameResolver)18235" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(NameResolver)18235": { + "encoding": "inplace", + "label": "contract NameResolver", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/Root.json b/solidity/dns-contracts/deployments/holesky/Root.json new file mode 100644 index 0000000..f8eb66c --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/Root.json @@ -0,0 +1,363 @@ +{ + "address": "0xDaaF96c344f63131acadD0Ea35170E7892d3dfBA", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "ControllerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + } + ], + "name": "TLDLocked", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + } + ], + "name": "lock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "locked", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xb2cd100356aa78625978cb383b116b6b2ccf43d882fb52db6621f52863d180ff", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0xDaaF96c344f63131acadD0Ea35170E7892d3dfBA", + "transactionIndex": 8, + "gasUsed": "506765", + "logsBloom": "0x00000000000000000000000000000000000000000000200000800000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000001000000000000000000000002000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x222955866c2d4fce3fa3d88e4934031893508e285a8334991abba2e4d1ec6813", + "transactionHash": "0xb2cd100356aa78625978cb383b116b6b2ccf43d882fb52db6621f52863d180ff", + "logs": [ + { + "transactionIndex": 8, + "blockNumber": 801685, + "transactionHash": "0xb2cd100356aa78625978cb383b116b6b2ccf43d882fb52db6621f52863d180ff", + "address": "0xDaaF96c344f63131acadD0Ea35170E7892d3dfBA", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8" + ], + "data": "0x", + "logIndex": 1004, + "blockHash": "0x222955866c2d4fce3fa3d88e4934031893508e285a8334991abba2e4d1ec6813" + } + ], + "blockNumber": 801685, + "cumulativeGasUsed": "3564640", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"ControllerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"}],\"name\":\"TLDLocked\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"}],\"name\":\"lock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"locked\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setSubnodeOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/root/Root.sol\":\"Root\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"},\"contracts/root/Root.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"./Controllable.sol\\\";\\n\\ncontract Root is Ownable, Controllable {\\n bytes32 private constant ROOT_NODE = bytes32(0);\\n\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n\\n event TLDLocked(bytes32 indexed label);\\n\\n ENS public ens;\\n mapping(bytes32 => bool) public locked;\\n\\n constructor(ENS _ens) public {\\n ens = _ens;\\n }\\n\\n function setSubnodeOwner(\\n bytes32 label,\\n address owner\\n ) external onlyController {\\n require(!locked[label]);\\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\\n }\\n\\n function setResolver(address resolver) external onlyOwner {\\n ens.setResolver(ROOT_NODE, resolver);\\n }\\n\\n function lock(bytes32 label) external onlyOwner {\\n emit TLDLocked(label);\\n locked[label] = true;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return interfaceID == INTERFACE_META_ID;\\n }\\n}\\n\",\"keccak256\":\"0x469b281e1a9e1c3dad9c860a4ab3a7299a48355b0b0243713e0829193c39f50c\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161084638038061084683398101604081905261002f916100ad565b6100383361005d565b600280546001600160a01b0319166001600160a01b03929092169190911790556100dd565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100bf57600080fd5b81516001600160a01b03811681146100d657600080fd5b9392505050565b61075a806100ec6000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80638cb8ecec11610081578063da8c229e1161005b578063da8c229e146101da578063e0dba60f146101fd578063f2fde38b1461021057600080fd5b80638cb8ecec146101935780638da5cb5b146101a6578063cbe9e764146101b757600080fd5b80633f15457f116100b25780633f15457f1461014d5780634e543b2614610178578063715018a61461018b57600080fd5b806301670ba9146100ce57806301ffc9a7146100e3575b600080fd5b6100e16100dc36600461060a565b610223565b005b6101386100f1366004610623565b7fffffffff00000000000000000000000000000000000000000000000000000000167f01ffc9a7000000000000000000000000000000000000000000000000000000001490565b60405190151581526020015b60405180910390f35b600254610160906001600160a01b031681565b6040516001600160a01b039091168152602001610144565b6100e1610186366004610688565b610271565b6100e16102fb565b6100e16101a13660046106a3565b61030f565b6000546001600160a01b0316610160565b6101386101c536600461060a565b60036020526000908152604090205460ff1681565b6101386101e8366004610688565b60016020526000908152604090205460ff1681565b6100e161020b3660046106cf565b610451565b6100e161021e366004610688565b6104b8565b61022b610548565b60405181907f1764176cfa565853ba1ded547a830a9f9bff95231ef6fd228b3ddd617577756990600090a26000908152600360205260409020805460ff19166001179055565b610279610548565b6002546040517f1896f70a000000000000000000000000000000000000000000000000000000008152600060048201526001600160a01b03838116602483015290911690631896f70a90604401600060405180830381600087803b1580156102e057600080fd5b505af11580156102f4573d6000803e3d6000fd5b5050505050565b610303610548565b61030d60006105a2565b565b3360009081526001602052604090205460ff166103995760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f60448201527f6e74726f6c6c657200000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60008281526003602052604090205460ff16156103b557600080fd5b6002546040517f06ab592300000000000000000000000000000000000000000000000000000000815260006004820152602481018490526001600160a01b038381166044830152909116906306ab5923906064016020604051808303816000875af1158015610428573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044c919061070b565b505050565b610459610548565b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b6104c0610548565b6001600160a01b03811661053c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610390565b610545816105a2565b50565b6000546001600160a01b0316331461030d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610390565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561061c57600080fd5b5035919050565b60006020828403121561063557600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461066557600080fd5b9392505050565b80356001600160a01b038116811461068357600080fd5b919050565b60006020828403121561069a57600080fd5b6106658261066c565b600080604083850312156106b657600080fd5b823591506106c66020840161066c565b90509250929050565b600080604083850312156106e257600080fd5b6106eb8361066c565b91506020830135801515811461070057600080fd5b809150509250929050565b60006020828403121561071d57600080fd5b505191905056fea264697066735822122076050508cd0bcb6e4498c5754bb4f07340bd419620d1e8fea884be8dedd1520c64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100c95760003560e01c80638cb8ecec11610081578063da8c229e1161005b578063da8c229e146101da578063e0dba60f146101fd578063f2fde38b1461021057600080fd5b80638cb8ecec146101935780638da5cb5b146101a6578063cbe9e764146101b757600080fd5b80633f15457f116100b25780633f15457f1461014d5780634e543b2614610178578063715018a61461018b57600080fd5b806301670ba9146100ce57806301ffc9a7146100e3575b600080fd5b6100e16100dc36600461060a565b610223565b005b6101386100f1366004610623565b7fffffffff00000000000000000000000000000000000000000000000000000000167f01ffc9a7000000000000000000000000000000000000000000000000000000001490565b60405190151581526020015b60405180910390f35b600254610160906001600160a01b031681565b6040516001600160a01b039091168152602001610144565b6100e1610186366004610688565b610271565b6100e16102fb565b6100e16101a13660046106a3565b61030f565b6000546001600160a01b0316610160565b6101386101c536600461060a565b60036020526000908152604090205460ff1681565b6101386101e8366004610688565b60016020526000908152604090205460ff1681565b6100e161020b3660046106cf565b610451565b6100e161021e366004610688565b6104b8565b61022b610548565b60405181907f1764176cfa565853ba1ded547a830a9f9bff95231ef6fd228b3ddd617577756990600090a26000908152600360205260409020805460ff19166001179055565b610279610548565b6002546040517f1896f70a000000000000000000000000000000000000000000000000000000008152600060048201526001600160a01b03838116602483015290911690631896f70a90604401600060405180830381600087803b1580156102e057600080fd5b505af11580156102f4573d6000803e3d6000fd5b5050505050565b610303610548565b61030d60006105a2565b565b3360009081526001602052604090205460ff166103995760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f60448201527f6e74726f6c6c657200000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60008281526003602052604090205460ff16156103b557600080fd5b6002546040517f06ab592300000000000000000000000000000000000000000000000000000000815260006004820152602481018490526001600160a01b038381166044830152909116906306ab5923906064016020604051808303816000875af1158015610428573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044c919061070b565b505050565b610459610548565b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b6104c0610548565b6001600160a01b03811661053c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610390565b610545816105a2565b50565b6000546001600160a01b0316331461030d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610390565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561061c57600080fd5b5035919050565b60006020828403121561063557600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461066557600080fd5b9392505050565b80356001600160a01b038116811461068357600080fd5b919050565b60006020828403121561069a57600080fd5b6106658261066c565b600080604083850312156106b657600080fd5b823591506106c66020840161066c565b90509250929050565b600080604083850312156106e257600080fd5b6106eb8361066c565b91506020830135801515811461070057600080fd5b809150509250929050565b60006020828403121561071d57600080fd5b505191905056fea264697066735822122076050508cd0bcb6e4498c5754bb4f07340bd419620d1e8fea884be8dedd1520c64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 444, + "contract": "contracts/root/Root.sol:Root", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 18581, + "contract": "contracts/root/Root.sol:Root", + "label": "controllers", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 18711, + "contract": "contracts/root/Root.sol:Root", + "label": "ens", + "offset": 0, + "slot": "2", + "type": "t_contract(ENS)14770" + }, + { + "astId": 18715, + "contract": "contracts/root/Root.sol:Root", + "label": "locked", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_bytes32,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(ENS)14770": { + "encoding": "inplace", + "label": "contract ENS", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_bytes32,t_bool)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/SHA1Digest.json b/solidity/dns-contracts/deployments/holesky/SHA1Digest.json new file mode 100644 index 0000000..3e9e0d0 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/SHA1Digest.json @@ -0,0 +1,76 @@ +{ + "address": "0xe65d8aaf34cb91087d1598e0a15b582f57f217d9", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0xd031c1f24b8c81da0993584975102598144a644dd290bce14d6253766e67f604", + "receipt": { + "to": null, + "from": "0x4fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8", + "contractAddress": "0xe65d8aaf34cb91087d1598e0a15b582f57f217d9", + "transactionIndex": "0xa", + "gasUsed": "0x702b8", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x28db8dbc8999e9dc5bd38ef6e4f6a10764bfa6947fa5a73177886b02839f9285", + "transactionHash": "0x9600b52595dd81b7114169eccc3eb1bc3a051fb1d6ceb3c068752052e64f2cef", + "logs": [], + "blockNumber": "0xc3d38", + "cumulativeGasUsed": "0x285533", + "status": "0x1" + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC SHA1 digest.\",\"kind\":\"dev\",\"methods\":{\"verify(bytes,bytes)\":{\"details\":\"Verifies a cryptographic hash.\",\"params\":{\"data\":\"The data to hash.\",\"hash\":\"The hash to compare to.\"},\"returns\":{\"_0\":\"True iff the hashed data matches the provided hash value.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/digests/SHA1Digest.sol\":\"SHA1Digest\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/solsha1/contracts/SHA1.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary SHA1 {\\n event Debug(bytes32 x);\\n\\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\\n assembly {\\n // Get a safe scratch location\\n let scratch := mload(0x40)\\n\\n // Get the data length, and point data at the first byte\\n let len := mload(data)\\n data := add(data, 32)\\n\\n // Find the length after padding\\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\\n switch lt(sub(totallen, len), 9)\\n case 1 { totallen := add(totallen, 64) }\\n\\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\\n\\n function readword(ptr, off, count) -> result {\\n result := 0\\n if lt(off, count) {\\n result := mload(add(ptr, off))\\n count := sub(count, off)\\n if lt(count, 32) {\\n let mask := not(sub(exp(256, sub(32, count)), 1))\\n result := and(result, mask)\\n }\\n }\\n }\\n\\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\\n mstore(scratch, readword(data, i, len))\\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\\n\\n // If we loaded the last byte, store the terminator byte\\n switch lt(sub(len, i), 64)\\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\\n\\n // If this is the last block, store the length\\n switch eq(i, sub(totallen, 64))\\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\\n\\n // Expand the 16 32-bit words into 80\\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\\n mstore(add(scratch, j), temp)\\n }\\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\\n mstore(add(scratch, j), temp)\\n }\\n\\n let x := h\\n let f := 0\\n let k := 0\\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\\n switch div(j, 20)\\n case 0 {\\n // f = d xor (b and (c xor d))\\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\\n f := and(div(x, 0x1000000000000000000000000000000), f)\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x5A827999\\n }\\n case 1{\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x6ED9EBA1\\n }\\n case 2 {\\n // f = (b and c) or (d and (b or c))\\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := and(div(x, 0x10000000000), f)\\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\\n k := 0x8F1BBCDC\\n }\\n case 3 {\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0xCA62C1D6\\n }\\n // temp = (a leftrotate 5) + f + e + k + w[i]\\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\\n temp := add(f, temp)\\n temp := add(and(x, 0xFFFFFFFF), temp)\\n temp := add(k, temp)\\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\\n }\\n\\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\\n }\\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x746d9b85de197afbc13182cbe4ba4f7917f19594e07c655d6a0c85fdf7460a8a\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC digest.\\n */\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(\\n bytes calldata data,\\n bytes calldata hash\\n ) external pure virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x8ea926b2db0578c4ad7fce4582fc0f6f0f9efee8dca2085dbdb9984f18941e28\"},\"contracts/dnssec-oracle/digests/SHA1Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Digest.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"@ensdomains/solsha1/contracts/SHA1.sol\\\";\\n\\n/**\\n * @dev Implements the DNSSEC SHA1 digest.\\n */\\ncontract SHA1Digest is Digest {\\n using BytesUtils for *;\\n\\n function verify(\\n bytes calldata data,\\n bytes calldata hash\\n ) external pure override returns (bool) {\\n require(hash.length == 20, \\\"Invalid sha1 hash length\\\");\\n bytes32 expected = hash.readBytes20(0);\\n bytes20 computed = SHA1.sha1(data);\\n return expected == computed;\\n }\\n}\\n\",\"keccak256\":\"0x56f4e188f9c5ea120354ff4d00555c3b76b5837be00a1564fed608e22a7dc8aa\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061076c806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004361003e36600461068a565b610057565b604051901515815260200160405180910390f35b6000601482146100c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e76616c696420736861312068617368206c656e6774680000000000000000604482015260640160405180910390fd5b600061010d600085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061017c9050565b6bffffffffffffffffffffffff19169050600061015f87878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101af92505050565b6bffffffffffffffffffffffff1916919091149695505050505050565b815160009061018c8360146106f6565b111561019757600080fd5b5001602001516bffffffffffffffffffffffff191690565b60006040518251602084019350604067ffffffffffffffc0600183011601600982820310600181036101e2576040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f0610235565b60008383101561022e5750808201519282900392602084101561022e5760001960208590036101000a0119165b9392505050565b60005b828110156105c15761024b848289610201565b855261025b846020830189610201565b6020860152604081850310600181036102775760808286038701535b506040830381146001810361029457602086018051600887021790525b5060405b608081101561031c57858101603f19810151603719820151601f19830151600b198401516002911891909218189081027ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe1663800000009091047c010000000100000001000000010000000100000001000000010000000116179052600c01610298565b5060805b6101408110156103a557858101607f19810151606f19820151603f198301516017198401516004911891909218189081027ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc1663400000009091047c030000000300000003000000030000000300000003000000030000000316179052601801610320565b508160008060005b6050811015610597576014810480156103dd576001811461040d576002811461043b576003811461046e57610498565b6501000000000085046a010000000000000000000086048118600160781b870416189350635a8279999250610498565b650100000000008504600160781b86046a0100000000000000000000870418189350636ed9eba19250610498565b6a01000000000000000000008504600160781b8604818117650100000000008804169116179350638f1bbcdc9250610498565b650100000000008504600160781b86046a010000000000000000000087041818935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c015104019050740100000000000000000000000000000000000000008102650100000000008604179450506a0100000000000000000000633fffffff6a040000000000000000000086041663c00000006604000000000000870416170277ffffffff00ffffffff000000000000ffffffff00ffffffff85161793506001810190506103ad565b5050509190910177ffffffff00ffffffff00ffffffff00ffffffff00ffffffff1690604001610238565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b60008083601f84011261065357600080fd5b50813567ffffffffffffffff81111561066b57600080fd5b60208301915083602082850101111561068357600080fd5b9250929050565b600080600080604085870312156106a057600080fd5b843567ffffffffffffffff808211156106b857600080fd5b6106c488838901610641565b909650945060208701359150808211156106dd57600080fd5b506106ea87828801610641565b95989497509550505050565b80820180821115610730577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea26469706673582212201eb056a89a6b6b67ba5acc9d1d278299eadfc218cf0f5baba761aa60461f441964736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004361003e36600461068a565b610057565b604051901515815260200160405180910390f35b6000601482146100c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e76616c696420736861312068617368206c656e6774680000000000000000604482015260640160405180910390fd5b600061010d600085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061017c9050565b6bffffffffffffffffffffffff19169050600061015f87878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101af92505050565b6bffffffffffffffffffffffff1916919091149695505050505050565b815160009061018c8360146106f6565b111561019757600080fd5b5001602001516bffffffffffffffffffffffff191690565b60006040518251602084019350604067ffffffffffffffc0600183011601600982820310600181036101e2576040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f0610235565b60008383101561022e5750808201519282900392602084101561022e5760001960208590036101000a0119165b9392505050565b60005b828110156105c15761024b848289610201565b855261025b846020830189610201565b6020860152604081850310600181036102775760808286038701535b506040830381146001810361029457602086018051600887021790525b5060405b608081101561031c57858101603f19810151603719820151601f19830151600b198401516002911891909218189081027ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe1663800000009091047c010000000100000001000000010000000100000001000000010000000116179052600c01610298565b5060805b6101408110156103a557858101607f19810151606f19820151603f198301516017198401516004911891909218189081027ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc1663400000009091047c030000000300000003000000030000000300000003000000030000000316179052601801610320565b508160008060005b6050811015610597576014810480156103dd576001811461040d576002811461043b576003811461046e57610498565b6501000000000085046a010000000000000000000086048118600160781b870416189350635a8279999250610498565b650100000000008504600160781b86046a0100000000000000000000870418189350636ed9eba19250610498565b6a01000000000000000000008504600160781b8604818117650100000000008804169116179350638f1bbcdc9250610498565b650100000000008504600160781b86046a010000000000000000000087041818935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c015104019050740100000000000000000000000000000000000000008102650100000000008604179450506a0100000000000000000000633fffffff6a040000000000000000000086041663c00000006604000000000000870416170277ffffffff00ffffffff000000000000ffffffff00ffffffff85161793506001810190506103ad565b5050509190910177ffffffff00ffffffff00ffffffff00ffffffff00ffffffff1690604001610238565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b60008083601f84011261065357600080fd5b50813567ffffffffffffffff81111561066b57600080fd5b60208301915083602082850101111561068357600080fd5b9250929050565b600080600080604085870312156106a057600080fd5b843567ffffffffffffffff808211156106b857600080fd5b6106c488838901610641565b909650945060208701359150808211156106dd57600080fd5b506106ea87828801610641565b95989497509550505050565b80820180821115610730577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea26469706673582212201eb056a89a6b6b67ba5acc9d1d278299eadfc218cf0f5baba761aa60461f441964736f6c63430008110033", + "devdoc": { + "details": "Implements the DNSSEC SHA1 digest.", + "kind": "dev", + "methods": { + "verify(bytes,bytes)": { + "details": "Verifies a cryptographic hash.", + "params": { + "data": "The data to hash.", + "hash": "The hash to compare to." + }, + "returns": { + "_0": "True iff the hashed data matches the provided hash value." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/SHA256Digest.json b/solidity/dns-contracts/deployments/holesky/SHA256Digest.json new file mode 100644 index 0000000..e535740 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/SHA256Digest.json @@ -0,0 +1,77 @@ +{ + "address": "0x60C7C2A24b5e86C38639Fd1586917a8FEF66a56d", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0xe99c4eba9bc5f54079d8ea3014dc515edf89f85709472fa07b8f7402cfaec505", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x60C7C2A24b5e86C38639Fd1586917a8FEF66a56d", + "transactionIndex": 10, + "gasUsed": "211310", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x3adabaac858929473b06f5d570efed309ddc51bfc11bf5d26a895b56370519f7", + "transactionHash": "0xe99c4eba9bc5f54079d8ea3014dc515edf89f85709472fa07b8f7402cfaec505", + "logs": [], + "blockNumber": 802107, + "cumulativeGasUsed": "920464", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC SHA256 digest.\",\"kind\":\"dev\",\"methods\":{\"verify(bytes,bytes)\":{\"details\":\"Verifies a cryptographic hash.\",\"params\":{\"data\":\"The data to hash.\",\"hash\":\"The hash to compare to.\"},\"returns\":{\"_0\":\"True iff the hashed data matches the provided hash value.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/digests/SHA256Digest.sol\":\"SHA256Digest\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC digest.\\n */\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(\\n bytes calldata data,\\n bytes calldata hash\\n ) external pure virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x8ea926b2db0578c4ad7fce4582fc0f6f0f9efee8dca2085dbdb9984f18941e28\"},\"contracts/dnssec-oracle/digests/SHA256Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Digest.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\n\\n/**\\n * @dev Implements the DNSSEC SHA256 digest.\\n */\\ncontract SHA256Digest is Digest {\\n using BytesUtils for *;\\n\\n function verify(\\n bytes calldata data,\\n bytes calldata hash\\n ) external pure override returns (bool) {\\n require(hash.length == 32, \\\"Invalid sha256 hash length\\\");\\n return sha256(data) == hash.readBytes32(0);\\n }\\n}\\n\",\"keccak256\":\"0x0531c6764434ea17d967f079ed2299b1f83606e891dbdaa92500d43ef64cf126\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506102df806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004361003e3660046101d4565b610057565b604051901515815260200160405180910390f35b6000602082146100c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f496e76616c6964207368613235362068617368206c656e677468000000000000604482015260640160405180910390fd5b61010b600084848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506101679050565b6002868660405161011d929190610240565b602060405180830381855afa15801561013a573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061015d9190610250565b1495945050505050565b8151600090610177836020610269565b111561018257600080fd5b50016020015190565b60008083601f84011261019d57600080fd5b50813567ffffffffffffffff8111156101b557600080fd5b6020830191508360208285010111156101cd57600080fd5b9250929050565b600080600080604085870312156101ea57600080fd5b843567ffffffffffffffff8082111561020257600080fd5b61020e8883890161018b565b9096509450602087013591508082111561022757600080fd5b506102348782880161018b565b95989497509550505050565b8183823760009101908152919050565b60006020828403121561026257600080fd5b5051919050565b808201808211156102a3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea26469706673582212202348aaafc43a5bd6086d9011d799efff422cd74c984a03fe13c85cc4d45e842b64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004361003e3660046101d4565b610057565b604051901515815260200160405180910390f35b6000602082146100c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f496e76616c6964207368613235362068617368206c656e677468000000000000604482015260640160405180910390fd5b61010b600084848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506101679050565b6002868660405161011d929190610240565b602060405180830381855afa15801561013a573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061015d9190610250565b1495945050505050565b8151600090610177836020610269565b111561018257600080fd5b50016020015190565b60008083601f84011261019d57600080fd5b50813567ffffffffffffffff8111156101b557600080fd5b6020830191508360208285010111156101cd57600080fd5b9250929050565b600080600080604085870312156101ea57600080fd5b843567ffffffffffffffff8082111561020257600080fd5b61020e8883890161018b565b9096509450602087013591508082111561022757600080fd5b506102348782880161018b565b95989497509550505050565b8183823760009101908152919050565b60006020828403121561026257600080fd5b5051919050565b808201808211156102a3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea26469706673582212202348aaafc43a5bd6086d9011d799efff422cd74c984a03fe13c85cc4d45e842b64736f6c63430008110033", + "devdoc": { + "details": "Implements the DNSSEC SHA256 digest.", + "kind": "dev", + "methods": { + "verify(bytes,bytes)": { + "details": "Verifies a cryptographic hash.", + "params": { + "data": "The data to hash.", + "hash": "The hash to compare to." + }, + "returns": { + "_0": "True iff the hashed data matches the provided hash value." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/SimplePublicSuffixList.json b/solidity/dns-contracts/deployments/holesky/SimplePublicSuffixList.json new file mode 100644 index 0000000..f8ef4a5 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/SimplePublicSuffixList.json @@ -0,0 +1,190 @@ +{ + "address": "0x116C21e9b76DB1f9f6605Db52Dd052896803D655", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "suffix", + "type": "bytes" + } + ], + "name": "SuffixAdded", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "names", + "type": "bytes[]" + } + ], + "name": "addPublicSuffixes", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "isPublicSuffix", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x66b78caf1ce7e3ada69ac5ecb97c06ef61a31b323318bb2ba74762fcacffa144", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x116C21e9b76DB1f9f6605Db52Dd052896803D655", + "transactionIndex": 48, + "gasUsed": "383265", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xf453e32601e70387acf5b437068c90464b232ac4bc5bcbe411dae74b2b840f42", + "transactionHash": "0x66b78caf1ce7e3ada69ac5ecb97c06ef61a31b323318bb2ba74762fcacffa144", + "logs": [], + "blockNumber": 802373, + "cumulativeGasUsed": "29675076", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"SuffixAdded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"names\",\"type\":\"bytes[]\"}],\"name\":\"addPublicSuffixes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"isPublicSuffix\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnsregistrar/SimplePublicSuffixList.sol\":\"SimplePublicSuffixList\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/dnsregistrar/PublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\ninterface PublicSuffixList {\\n function isPublicSuffix(bytes calldata name) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x12158ba8838ee2b1ebb0178a52d2f4d54dcc68282d569226e62afc2b0dccbbac\"},\"contracts/dnsregistrar/SimplePublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nimport \\\"../root/Ownable.sol\\\";\\nimport \\\"./PublicSuffixList.sol\\\";\\n\\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\\n mapping(bytes => bool) suffixes;\\n\\n event SuffixAdded(bytes suffix);\\n\\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\\n for (uint256 i = 0; i < names.length; i++) {\\n suffixes[names[i]] = true;\\n emit SuffixAdded(names[i]);\\n }\\n }\\n\\n function isPublicSuffix(\\n bytes calldata name\\n ) external view override returns (bool) {\\n return suffixes[name];\\n }\\n}\\n\",\"keccak256\":\"0x0cafa3192dc3731329cf74678829cc1bf578c3db2492a829417c0301fd09f3a2\"},\"contracts/root/Ownable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\ncontract Ownable {\\n address public owner;\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n modifier onlyOwner() {\\n require(isOwner(msg.sender));\\n _;\\n }\\n\\n constructor() public {\\n owner = msg.sender;\\n }\\n\\n function transferOwnership(address newOwner) public onlyOwner {\\n emit OwnershipTransferred(owner, newOwner);\\n owner = newOwner;\\n }\\n\\n function isOwner(address addr) public view returns (bool) {\\n return owner == addr;\\n }\\n}\\n\",\"keccak256\":\"0xd06845ede20815e1a6d5b36fec21d7b90ea24390f24a9b31e4220c90b2ff3252\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50600080546001600160a01b03191633179055610592806100326000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80636329cdfc116100505780636329cdfc146100b65780638da5cb5b146100cb578063f2fde38b146100f657600080fd5b80632f54bf6e1461006c5780634f89059e146100a3575b600080fd5b61008e61007a36600461029a565b6000546001600160a01b0390811691161490565b60405190151581526020015b60405180910390f35b61008e6100b13660046102ca565b610109565b6100c96100c4366004610383565b610138565b005b6000546100de906001600160a01b031681565b6040516001600160a01b03909116815260200161009a565b6100c961010436600461029a565b610210565b60006001838360405161011d92919061049c565b9081526040519081900360200190205460ff16905092915050565b6000546001600160a01b0316331461014f57600080fd5b60005b815181101561020c57600180838381518110610170576101706104ac565b602002602001015160405161018591906104e6565b908152602001604051809103902060006101000a81548160ff0219169083151502179055507f7cad7c0907646b87ae240d676052692501082856f06ba8e2589e239a77453b098282815181106101dd576101dd6104ac565b60200260200101516040516101f29190610502565b60405180910390a18061020481610535565b915050610152565b5050565b6000546001600160a01b0316331461022757600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6000602082840312156102ac57600080fd5b81356001600160a01b03811681146102c357600080fd5b9392505050565b600080602083850312156102dd57600080fd5b823567ffffffffffffffff808211156102f557600080fd5b818501915085601f83011261030957600080fd5b81358181111561031857600080fd5b86602082850101111561032a57600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561037b5761037b61033c565b604052919050565b6000602080838503121561039657600080fd5b823567ffffffffffffffff808211156103ae57600080fd5b8185019150601f86818401126103c357600080fd5b8235828111156103d5576103d561033c565b8060051b6103e4868201610352565b918252848101860191868101908a8411156103fe57600080fd5b87870192505b8383101561048e5782358681111561041c5760008081fd5b8701603f81018c1361042e5760008081fd5b888101356040888211156104445761044461033c565b610455828901601f19168c01610352565b8281528e8284860101111561046a5760008081fd5b828285018d83013760009281018c0192909252508352509187019190870190610404565b9a9950505050505050505050565b8183823760009101908152919050565b634e487b7160e01b600052603260045260246000fd5b60005b838110156104dd5781810151838201526020016104c5565b50506000910152565b600082516104f88184602087016104c2565b9190910192915050565b60208152600082518060208401526105218160408501602087016104c2565b601f01601f19169190910160400192915050565b60006001820161055557634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220c01b7cf9f606016ad0718eed2ea7820c75cfc73137245ea92220d234e7703dc264736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100675760003560e01c80636329cdfc116100505780636329cdfc146100b65780638da5cb5b146100cb578063f2fde38b146100f657600080fd5b80632f54bf6e1461006c5780634f89059e146100a3575b600080fd5b61008e61007a36600461029a565b6000546001600160a01b0390811691161490565b60405190151581526020015b60405180910390f35b61008e6100b13660046102ca565b610109565b6100c96100c4366004610383565b610138565b005b6000546100de906001600160a01b031681565b6040516001600160a01b03909116815260200161009a565b6100c961010436600461029a565b610210565b60006001838360405161011d92919061049c565b9081526040519081900360200190205460ff16905092915050565b6000546001600160a01b0316331461014f57600080fd5b60005b815181101561020c57600180838381518110610170576101706104ac565b602002602001015160405161018591906104e6565b908152602001604051809103902060006101000a81548160ff0219169083151502179055507f7cad7c0907646b87ae240d676052692501082856f06ba8e2589e239a77453b098282815181106101dd576101dd6104ac565b60200260200101516040516101f29190610502565b60405180910390a18061020481610535565b915050610152565b5050565b6000546001600160a01b0316331461022757600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6000602082840312156102ac57600080fd5b81356001600160a01b03811681146102c357600080fd5b9392505050565b600080602083850312156102dd57600080fd5b823567ffffffffffffffff808211156102f557600080fd5b818501915085601f83011261030957600080fd5b81358181111561031857600080fd5b86602082850101111561032a57600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561037b5761037b61033c565b604052919050565b6000602080838503121561039657600080fd5b823567ffffffffffffffff808211156103ae57600080fd5b8185019150601f86818401126103c357600080fd5b8235828111156103d5576103d561033c565b8060051b6103e4868201610352565b918252848101860191868101908a8411156103fe57600080fd5b87870192505b8383101561048e5782358681111561041c5760008081fd5b8701603f81018c1361042e5760008081fd5b888101356040888211156104445761044461033c565b610455828901601f19168c01610352565b8281528e8284860101111561046a5760008081fd5b828285018d83013760009281018c0192909252508352509187019190870190610404565b9a9950505050505050505050565b8183823760009101908152919050565b634e487b7160e01b600052603260045260246000fd5b60005b838110156104dd5781810151838201526020016104c5565b50506000910152565b600082516104f88184602087016104c2565b9190910192915050565b60208152600082518060208401526105218160408501602087016104c2565b601f01601f19169190910160400192915050565b60006001820161055557634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220c01b7cf9f606016ad0718eed2ea7820c75cfc73137245ea92220d234e7703dc264736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 18625, + "contract": "contracts/dnsregistrar/SimplePublicSuffixList.sol:SimplePublicSuffixList", + "label": "owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 5974, + "contract": "contracts/dnsregistrar/SimplePublicSuffixList.sol:SimplePublicSuffixList", + "label": "suffixes", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes_memory_ptr,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes_memory_ptr": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes_memory_ptr,t_bool)": { + "encoding": "mapping", + "key": "t_bytes_memory_ptr", + "label": "mapping(bytes => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/StaticBulkRenewal.json b/solidity/dns-contracts/deployments/holesky/StaticBulkRenewal.json new file mode 100644 index 0000000..0c17905 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/StaticBulkRenewal.json @@ -0,0 +1,130 @@ +{ + "address": "0xbc4cfB363F948E64Cd73Da6438F64CB37E2e33d1", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ETHRegistrarController", + "name": "_controller", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "names", + "type": "string[]" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renewAll", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "names", + "type": "string[]" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "rentPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "total", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x3d166ea22eeb80c6ef3952b7c35e58333e1f9206afa2dcd7ceb0e81bc92b783c", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0xbc4cfB363F948E64Cd73Da6438F64CB37E2e33d1", + "transactionIndex": 3, + "gasUsed": "396872", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x91b90ca5afd81f5f5676193f183a96dd20ee62a73e3a447a67b3de076f2c67bd", + "transactionHash": "0x3d166ea22eeb80c6ef3952b7c35e58333e1f9206afa2dcd7ceb0e81bc92b783c", + "logs": [], + "blockNumber": 815368, + "cumulativeGasUsed": "459872", + "status": 1, + "byzantium": true + }, + "args": [ + "0x179Be112b24Ad4cFC392eF8924DfA08C20Ad8583" + ], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ETHRegistrarController\",\"name\":\"_controller\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"names\",\"type\":\"string[]\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"renewAll\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"names\",\"type\":\"string[]\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"rentPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/StaticBulkRenewal.sol\":\"StaticBulkRenewal\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/ERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721.sol\\\";\\nimport \\\"./IERC721Receiver.sol\\\";\\nimport \\\"./extensions/IERC721Metadata.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\nimport \\\"../../utils/Strings.sol\\\";\\nimport \\\"../../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\n * {ERC721Enumerable}.\\n */\\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\\n using Address for address;\\n using Strings for uint256;\\n\\n // Token name\\n string private _name;\\n\\n // Token symbol\\n string private _symbol;\\n\\n // Mapping from token ID to owner address\\n mapping(uint256 => address) private _owners;\\n\\n // Mapping owner address to token count\\n mapping(address => uint256) private _balances;\\n\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) private _tokenApprovals;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IERC721).interfaceId ||\\n interfaceId == type(IERC721Metadata).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721-balanceOf}.\\n */\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\n return _balances[owner];\\n }\\n\\n /**\\n * @dev See {IERC721-ownerOf}.\\n */\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\n address owner = _ownerOf(tokenId);\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n _requireMinted(tokenId);\\n\\n string memory baseURI = _baseURI();\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\n }\\n\\n /**\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\n * by default, can be overridden in child contracts.\\n */\\n function _baseURI() internal view virtual returns (string memory) {\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual override {\\n address owner = ERC721.ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\n _requireMinted(tokenId);\\n\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC721-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC721-isApprovedForAll}.\\n */\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[owner][operator];\\n }\\n\\n /**\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n _safeTransfer(from, to, tokenId, data);\\n }\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\n *\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\\n _transfer(from, to, tokenId);\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n }\\n\\n /**\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\n }\\n\\n /**\\n * @dev Returns whether `tokenId` exists.\\n *\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\n *\\n * Tokens start existing when they are minted (`_mint`),\\n * and stop existing when they are burned (`_burn`).\\n */\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\n return _ownerOf(tokenId) != address(0);\\n }\\n\\n /**\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\n address owner = ERC721.ownerOf(tokenId);\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\n }\\n\\n /**\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\n _safeMint(to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\n */\\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\\n _mint(to, tokenId);\\n require(\\n _checkOnERC721Received(address(0), to, tokenId, data),\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\n );\\n }\\n\\n /**\\n * @dev Mints `tokenId` and transfers it to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - `to` cannot be the zero address.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _mint(address to, uint256 tokenId) internal virtual {\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n _beforeTokenTransfer(address(0), to, tokenId, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _burn(uint256 tokenId) internal virtual {\\n address owner = ERC721.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\n }\\n\\n /**\\n * @dev Transfers `tokenId` from `from` to `to`.\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, tokenId, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Reverts if the `tokenId` has not been minted yet.\\n */\\n function _requireMinted(uint256 tokenId) internal view virtual {\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\n }\\n\\n /**\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\n * The call is not executed if the target address is not a contract.\\n *\\n * @param from address representing the previous owner of the given token ID\\n * @param to target address that will receive the tokens\\n * @param tokenId uint256 ID of the token to be transferred\\n * @param data bytes optional data to send along with the call\\n * @return bool whether the call correctly returned the expected magic value\\n */\\n function _checkOnERC721Received(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) private returns (bool) {\\n if (to.isContract()) {\\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721Receiver.onERC721Received.selector;\\n } catch (bytes memory reason) {\\n if (reason.length == 0) {\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n } else {\\n /// @solidity memory-safe-assembly\\n assembly {\\n revert(add(32, reason), mload(reason))\\n }\\n }\\n }\\n } else {\\n return true;\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\n }\\n}\\n\",\"keccak256\":\"0x2c309e7df9e05e6ce15bedfe74f3c61b467fc37e0fae9eab496acf5ea0bbd7ff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721Metadata is IERC721 {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/ethregistrar/BaseRegistrarImplementation.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/ERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\\n // A map of expiry times\\n mapping(uint256 => uint256) expiries;\\n // The ENS registry\\n ENS public ens;\\n // The namehash of the TLD this registrar owns (eg, .eth)\\n bytes32 public baseNode;\\n // A map of addresses that are authorised to register and renew names.\\n mapping(address => bool) public controllers;\\n uint256 public constant GRACE_PERIOD = 90 days;\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n bytes4 private constant ERC721_ID =\\n bytes4(\\n keccak256(\\\"balanceOf(address)\\\") ^\\n keccak256(\\\"ownerOf(uint256)\\\") ^\\n keccak256(\\\"approve(address,uint256)\\\") ^\\n keccak256(\\\"getApproved(uint256)\\\") ^\\n keccak256(\\\"setApprovalForAll(address,bool)\\\") ^\\n keccak256(\\\"isApprovedForAll(address,address)\\\") ^\\n keccak256(\\\"transferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256,bytes)\\\")\\n );\\n bytes4 private constant RECLAIM_ID =\\n bytes4(keccak256(\\\"reclaim(uint256,address)\\\"));\\n\\n /**\\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\\n * @dev Returns whether the given spender can transfer a given token ID\\n * @param spender address of the spender to query\\n * @param tokenId uint256 ID of the token to be transferred\\n * @return bool whether the msg.sender is approved for the given token ID,\\n * is an operator of the owner, or is the owner of the token\\n */\\n function _isApprovedOrOwner(\\n address spender,\\n uint256 tokenId\\n ) internal view override returns (bool) {\\n address owner = ownerOf(tokenId);\\n return (spender == owner ||\\n getApproved(tokenId) == spender ||\\n isApprovedForAll(owner, spender));\\n }\\n\\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\\\"\\\", \\\"\\\") {\\n ens = _ens;\\n baseNode = _baseNode;\\n }\\n\\n modifier live() {\\n require(ens.owner(baseNode) == address(this));\\n _;\\n }\\n\\n modifier onlyController() {\\n require(controllers[msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Gets the owner of the specified token ID. Names become unowned\\n * when their registration expires.\\n * @param tokenId uint256 ID of the token to query the owner of\\n * @return address currently marked as the owner of the given token ID\\n */\\n function ownerOf(\\n uint256 tokenId\\n ) public view override(IERC721, ERC721) returns (address) {\\n require(expiries[tokenId] > block.timestamp);\\n return super.ownerOf(tokenId);\\n }\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external override onlyOwner {\\n controllers[controller] = true;\\n emit ControllerAdded(controller);\\n }\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external override onlyOwner {\\n controllers[controller] = false;\\n emit ControllerRemoved(controller);\\n }\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external override onlyOwner {\\n ens.setResolver(baseNode, resolver);\\n }\\n\\n // Returns the expiration timestamp of the specified id.\\n function nameExpires(uint256 id) external view override returns (uint256) {\\n return expiries[id];\\n }\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) public view override returns (bool) {\\n // Not available if it's registered here or in its grace period.\\n return expiries[id] + GRACE_PERIOD < block.timestamp;\\n }\\n\\n /**\\n * @dev Register a name.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external override returns (uint256) {\\n return _register(id, owner, duration, true);\\n }\\n\\n /**\\n * @dev Register a name, without modifying the registry.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function registerOnly(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256) {\\n return _register(id, owner, duration, false);\\n }\\n\\n function _register(\\n uint256 id,\\n address owner,\\n uint256 duration,\\n bool updateRegistry\\n ) internal live onlyController returns (uint256) {\\n require(available(id));\\n require(\\n block.timestamp + duration + GRACE_PERIOD >\\n block.timestamp + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] = block.timestamp + duration;\\n if (_exists(id)) {\\n // Name was previously owned, and expired\\n _burn(id);\\n }\\n _mint(owner, id);\\n if (updateRegistry) {\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n emit NameRegistered(id, owner, block.timestamp + duration);\\n\\n return block.timestamp + duration;\\n }\\n\\n function renew(\\n uint256 id,\\n uint256 duration\\n ) external override live onlyController returns (uint256) {\\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\\n require(\\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] += duration;\\n emit NameRenewed(id, expiries[id]);\\n return expiries[id];\\n }\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external override live {\\n require(_isApprovedOrOwner(msg.sender, id));\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view override(ERC721, IERC165) returns (bool) {\\n return\\n interfaceID == INTERFACE_META_ID ||\\n interfaceID == ERC721_ID ||\\n interfaceID == RECLAIM_ID;\\n }\\n}\\n\",\"keccak256\":\"0xaee6eb36aead449d397b86a02e9c63bc46e3ef378d0a62bfd68beaae1150c9d0\"},\"contracts/ethregistrar/ETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport {BaseRegistrarImplementation} from \\\"./BaseRegistrarImplementation.sol\\\";\\nimport {StringUtils} from \\\"./StringUtils.sol\\\";\\nimport {Resolver} from \\\"../resolvers/Resolver.sol\\\";\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {ReverseRegistrar} from \\\"../reverseRegistrar/ReverseRegistrar.sol\\\";\\nimport {ReverseClaimer} from \\\"../reverseRegistrar/ReverseClaimer.sol\\\";\\nimport {IETHRegistrarController, IPriceOracle} from \\\"./IETHRegistrarController.sol\\\";\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {INameWrapper} from \\\"../wrapper/INameWrapper.sol\\\";\\nimport {ERC20Recoverable} from \\\"../utils/ERC20Recoverable.sol\\\";\\n\\nerror CommitmentTooNew(bytes32 commitment);\\nerror CommitmentTooOld(bytes32 commitment);\\nerror NameNotAvailable(string name);\\nerror DurationTooShort(uint256 duration);\\nerror ResolverRequiredWhenDataSupplied();\\nerror ResolverRequiredWhenReverseRecord();\\nerror UnexpiredCommitmentExists(bytes32 commitment);\\nerror InsufficientValue();\\nerror Unauthorised(bytes32 node);\\nerror MaxCommitmentAgeTooLow();\\nerror MaxCommitmentAgeTooHigh();\\n\\n/**\\n * @dev A registrar controller for registering and renewing names at fixed cost.\\n */\\ncontract ETHRegistrarController is\\n Ownable,\\n IETHRegistrarController,\\n IERC165,\\n ERC20Recoverable,\\n ReverseClaimer\\n{\\n using StringUtils for *;\\n using Address for address;\\n\\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\\n bytes32 private constant ETH_NODE =\\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\\n uint64 private constant MAX_EXPIRY = type(uint64).max;\\n BaseRegistrarImplementation immutable base;\\n IPriceOracle public immutable prices;\\n uint256 public immutable minCommitmentAge;\\n uint256 public immutable maxCommitmentAge;\\n ReverseRegistrar public immutable reverseRegistrar;\\n INameWrapper public immutable nameWrapper;\\n\\n mapping(bytes32 => uint256) public commitments;\\n\\n event NameRegistered(\\n string name,\\n bytes32 indexed label,\\n address indexed owner,\\n uint256 baseCost,\\n uint256 premium,\\n uint256 expires\\n );\\n event NameRenewed(\\n string name,\\n bytes32 indexed label,\\n uint256 cost,\\n uint256 expires\\n );\\n\\n constructor(\\n BaseRegistrarImplementation _base,\\n IPriceOracle _prices,\\n uint256 _minCommitmentAge,\\n uint256 _maxCommitmentAge,\\n ReverseRegistrar _reverseRegistrar,\\n INameWrapper _nameWrapper,\\n ENS _ens\\n ) ReverseClaimer(_ens, msg.sender) {\\n if (_maxCommitmentAge <= _minCommitmentAge) {\\n revert MaxCommitmentAgeTooLow();\\n }\\n\\n if (_maxCommitmentAge > block.timestamp) {\\n revert MaxCommitmentAgeTooHigh();\\n }\\n\\n base = _base;\\n prices = _prices;\\n minCommitmentAge = _minCommitmentAge;\\n maxCommitmentAge = _maxCommitmentAge;\\n reverseRegistrar = _reverseRegistrar;\\n nameWrapper = _nameWrapper;\\n }\\n\\n function rentPrice(\\n string memory name,\\n uint256 duration\\n ) public view override returns (IPriceOracle.Price memory price) {\\n bytes32 label = keccak256(bytes(name));\\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\\n }\\n\\n function valid(string memory name) public pure returns (bool) {\\n return name.strlen() >= 3;\\n }\\n\\n function available(string memory name) public view override returns (bool) {\\n bytes32 label = keccak256(bytes(name));\\n return valid(name) && base.available(uint256(label));\\n }\\n\\n function makeCommitment(\\n string memory name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] calldata data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses\\n ) public pure override returns (bytes32) {\\n bytes32 label = keccak256(bytes(name));\\n if (resolver == address(0) && reverseRecord == true) {\\n revert ResolverRequiredWhenReverseRecord();\\n }\\n if (data.length > 0 && resolver == address(0)) {\\n revert ResolverRequiredWhenDataSupplied();\\n }\\n return\\n keccak256(\\n abi.encode(\\n label,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses\\n )\\n );\\n }\\n\\n function commit(bytes32 commitment) public override {\\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\\n revert UnexpiredCommitmentExists(commitment);\\n }\\n commitments[commitment] = block.timestamp;\\n }\\n\\n function register(\\n string calldata name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] calldata data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses\\n ) public payable override {\\n IPriceOracle.Price memory price = rentPrice(name, duration);\\n if (msg.value < price.base + price.premium) {\\n revert InsufficientValue();\\n }\\n\\n _consumeCommitment(\\n name,\\n duration,\\n makeCommitment(\\n name,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses\\n )\\n );\\n\\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\\n name,\\n owner,\\n duration,\\n resolver,\\n ownerControlledFuses\\n );\\n\\n if (data.length > 0) {\\n _setRecords(resolver, keccak256(bytes(name)), data);\\n }\\n\\n if (reverseRecord) {\\n _setReverseRecord(name, resolver, msg.sender);\\n }\\n\\n emit NameRegistered(\\n name,\\n keccak256(bytes(name)),\\n owner,\\n price.base,\\n price.premium,\\n expires\\n );\\n\\n if (msg.value > (price.base + price.premium)) {\\n payable(msg.sender).transfer(\\n msg.value - (price.base + price.premium)\\n );\\n }\\n }\\n\\n function renew(\\n string calldata name,\\n uint256 duration\\n ) external payable override {\\n bytes32 labelhash = keccak256(bytes(name));\\n uint256 tokenId = uint256(labelhash);\\n IPriceOracle.Price memory price = rentPrice(name, duration);\\n if (msg.value < price.base) {\\n revert InsufficientValue();\\n }\\n uint256 expires = nameWrapper.renew(tokenId, duration);\\n\\n if (msg.value > price.base) {\\n payable(msg.sender).transfer(msg.value - price.base);\\n }\\n\\n emit NameRenewed(name, labelhash, msg.value, expires);\\n }\\n\\n function withdraw() public {\\n payable(owner()).transfer(address(this).balance);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IETHRegistrarController).interfaceId;\\n }\\n\\n /* Internal functions */\\n\\n function _consumeCommitment(\\n string memory name,\\n uint256 duration,\\n bytes32 commitment\\n ) internal {\\n // Require an old enough commitment.\\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\\n revert CommitmentTooNew(commitment);\\n }\\n\\n // If the commitment is too old, or the name is registered, stop\\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\\n revert CommitmentTooOld(commitment);\\n }\\n if (!available(name)) {\\n revert NameNotAvailable(name);\\n }\\n\\n delete (commitments[commitment]);\\n\\n if (duration < MIN_REGISTRATION_DURATION) {\\n revert DurationTooShort(duration);\\n }\\n }\\n\\n function _setRecords(\\n address resolverAddress,\\n bytes32 label,\\n bytes[] calldata data\\n ) internal {\\n // use hardcoded .eth namehash\\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\\n Resolver resolver = Resolver(resolverAddress);\\n resolver.multicallWithNodeCheck(nodehash, data);\\n }\\n\\n function _setReverseRecord(\\n string memory name,\\n address resolver,\\n address owner\\n ) internal {\\n reverseRegistrar.setNameForAddr(\\n msg.sender,\\n owner,\\n resolver,\\n string.concat(name, \\\".eth\\\")\\n );\\n }\\n}\\n\",\"keccak256\":\"0xa468b713926937c454ec621ca381d581ab3b06bd437df3e21d53bbade216ef51\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/ethregistrar/IBulkRenewal.sol\":{\"content\":\"interface IBulkRenewal {\\n function rentPrice(\\n string[] calldata names,\\n uint256 duration\\n ) external view returns (uint256 total);\\n\\n function renewAll(\\n string[] calldata names,\\n uint256 duration\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x45d72e0464af5165831210496cd293cc7ceeb7307f2bdad679f64613a6bcf029\"},\"contracts/ethregistrar/IETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./IPriceOracle.sol\\\";\\n\\ninterface IETHRegistrarController {\\n function rentPrice(\\n string memory,\\n uint256\\n ) external view returns (IPriceOracle.Price memory);\\n\\n function available(string memory) external returns (bool);\\n\\n function makeCommitment(\\n string memory,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16\\n ) external pure returns (bytes32);\\n\\n function commit(bytes32) external;\\n\\n function register(\\n string calldata,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16\\n ) external payable;\\n\\n function renew(string calldata, uint256) external payable;\\n}\\n\",\"keccak256\":\"0x54575cc2e4245c0ba79e42a58086335ec0522f4cbeb8c92d71b886593c97060e\",\"license\":\"MIT\"},\"contracts/ethregistrar/IPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\ninterface IPriceOracle {\\n struct Price {\\n uint256 base;\\n uint256 premium;\\n }\\n\\n /**\\n * @dev Returns the price to register or renew a name.\\n * @param name The name being registered or renewed.\\n * @param expires When the name presently expires (0 if this is a new registration).\\n * @param duration How long the name is being registered or extended for, in seconds.\\n * @return base premium tuple of base price + premium price\\n */\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (Price calldata);\\n}\\n\",\"keccak256\":\"0x1ec537b4c7f9cc40363b39dcc7ade8c29bf94662e6b01d38e681487637bd577e\",\"license\":\"MIT\"},\"contracts/ethregistrar/StaticBulkRenewal.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./ETHRegistrarController.sol\\\";\\nimport \\\"./IBulkRenewal.sol\\\";\\nimport \\\"./IPriceOracle.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\ncontract StaticBulkRenewal is IBulkRenewal {\\n ETHRegistrarController controller;\\n\\n constructor(ETHRegistrarController _controller) {\\n controller = _controller;\\n }\\n\\n function rentPrice(\\n string[] calldata names,\\n uint256 duration\\n ) external view override returns (uint256 total) {\\n uint256 length = names.length;\\n for (uint256 i = 0; i < length; ) {\\n IPriceOracle.Price memory price = controller.rentPrice(\\n names[i],\\n duration\\n );\\n unchecked {\\n ++i;\\n total += (price.base + price.premium);\\n }\\n }\\n }\\n\\n function renewAll(\\n string[] calldata names,\\n uint256 duration\\n ) external payable override {\\n uint256 length = names.length;\\n uint256 total;\\n for (uint256 i = 0; i < length; ) {\\n IPriceOracle.Price memory price = controller.rentPrice(\\n names[i],\\n duration\\n );\\n uint256 totalPrice = price.base + price.premium;\\n controller.renew{value: totalPrice}(names[i], duration);\\n unchecked {\\n ++i;\\n total += totalPrice;\\n }\\n }\\n // Send any excess funds back\\n payable(msg.sender).transfer(address(this).balance);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IBulkRenewal).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xa4c30f4d395dec3d252e8b9e46710fe38038cfdc3e33a3bdd0ea54e046e91f48\",\"license\":\"MIT\"},\"contracts/ethregistrar/StringUtils.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary StringUtils {\\n /**\\n * @dev Returns the length of a given string\\n *\\n * @param s The string to measure the length of\\n * @return The length of the input string\\n */\\n function strlen(string memory s) internal pure returns (uint256) {\\n uint256 len;\\n uint256 i = 0;\\n uint256 bytelength = bytes(s).length;\\n for (len = 0; i < bytelength; len++) {\\n bytes1 b = bytes(s)[i];\\n if (b < 0x80) {\\n i += 1;\\n } else if (b < 0xE0) {\\n i += 2;\\n } else if (b < 0xF0) {\\n i += 3;\\n } else if (b < 0xF8) {\\n i += 4;\\n } else if (b < 0xFC) {\\n i += 5;\\n } else {\\n i += 6;\\n }\\n }\\n return len;\\n }\\n}\\n\",\"keccak256\":\"0x4cc8363a850dc9130c433ee50e7c97e29a45ae5d9bd0808205ac7134b34f24e4\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/resolvers/Resolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"./profiles/IABIResolver.sol\\\";\\nimport \\\"./profiles/IAddressResolver.sol\\\";\\nimport \\\"./profiles/IAddrResolver.sol\\\";\\nimport \\\"./profiles/IContentHashResolver.sol\\\";\\nimport \\\"./profiles/IDNSRecordResolver.sol\\\";\\nimport \\\"./profiles/IDNSZoneResolver.sol\\\";\\nimport \\\"./profiles/IInterfaceResolver.sol\\\";\\nimport \\\"./profiles/INameResolver.sol\\\";\\nimport \\\"./profiles/IPubkeyResolver.sol\\\";\\nimport \\\"./profiles/ITextResolver.sol\\\";\\nimport \\\"./profiles/IExtendedResolver.sol\\\";\\n\\n/**\\n * A generic resolver interface which includes all the functions including the ones deprecated\\n */\\ninterface Resolver is\\n IERC165,\\n IABIResolver,\\n IAddressResolver,\\n IAddrResolver,\\n IContentHashResolver,\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n IInterfaceResolver,\\n INameResolver,\\n IPubkeyResolver,\\n ITextResolver,\\n IExtendedResolver\\n{\\n /* Deprecated events */\\n event ContentChanged(bytes32 indexed node, bytes32 hash);\\n\\n function setApprovalForAll(address, bool) external;\\n\\n function approve(bytes32 node, address delegate, bool approved) external;\\n\\n function isApprovedForAll(address account, address operator) external;\\n\\n function isApprovedFor(\\n address owner,\\n bytes32 node,\\n address delegate\\n ) external;\\n\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external;\\n\\n function setAddr(bytes32 node, address addr) external;\\n\\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\\n\\n function setContenthash(bytes32 node, bytes calldata hash) external;\\n\\n function setDnsrr(bytes32 node, bytes calldata data) external;\\n\\n function setName(bytes32 node, string calldata _name) external;\\n\\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\\n\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external;\\n\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external;\\n\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n /* Deprecated functions */\\n function content(bytes32 node) external view returns (bytes32);\\n\\n function multihash(bytes32 node) external view returns (bytes memory);\\n\\n function setContent(bytes32 node, bytes32 hash) external;\\n\\n function setMultihash(bytes32 node, bytes calldata hash) external;\\n}\\n\",\"keccak256\":\"0xfc77ab6b7c59c3ebfe1c720bdebf9b08c2488ff7ac9501a9aa056c5d6d5b50c5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseClaimer.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\n\\ncontract ReverseClaimer {\\n bytes32 constant ADDR_REVERSE_NODE =\\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n constructor(ENS ens, address claimant) {\\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\\n ens.owner(ADDR_REVERSE_NODE)\\n );\\n reverseRegistrar.claim(claimant);\\n }\\n}\\n\",\"keccak256\":\"0x78a28627241535b595f6fff476a1fa7acc90c80684fe7784734920fc8af6fc22\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/ReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IReverseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"../root/Controllable.sol\\\";\\n\\nabstract contract NameResolver {\\n function setName(bytes32 node, string memory name) public virtual;\\n}\\n\\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\\n\\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n// namehash('addr.reverse')\\n\\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\\n ENS public immutable ens;\\n NameResolver public defaultResolver;\\n\\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\\n event DefaultResolverChanged(NameResolver indexed resolver);\\n\\n /**\\n * @dev Constructor\\n * @param ensAddr The address of the ENS registry.\\n */\\n constructor(ENS ensAddr) {\\n ens = ensAddr;\\n\\n // Assign ownership of the reverse record to our deployer\\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\\n ensAddr.owner(ADDR_REVERSE_NODE)\\n );\\n if (address(oldRegistrar) != address(0x0)) {\\n oldRegistrar.claim(msg.sender);\\n }\\n }\\n\\n modifier authorised(address addr) {\\n require(\\n addr == msg.sender ||\\n controllers[msg.sender] ||\\n ens.isApprovedForAll(addr, msg.sender) ||\\n ownsContract(addr),\\n \\\"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\\\"\\n );\\n _;\\n }\\n\\n function setDefaultResolver(address resolver) public override onlyOwner {\\n require(\\n address(resolver) != address(0),\\n \\\"ReverseRegistrar: Resolver address must not be 0\\\"\\n );\\n defaultResolver = NameResolver(resolver);\\n emit DefaultResolverChanged(NameResolver(resolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claim(address owner) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, address(defaultResolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param addr The reverse record to set\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The resolver of the reverse node\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) public override authorised(addr) returns (bytes32) {\\n bytes32 labelHash = sha3HexAddress(addr);\\n bytes32 reverseNode = keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\\n );\\n emit ReverseClaimed(addr, reverseNode);\\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\\n return reverseNode;\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, resolver);\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the calling account. First updates the resolver to the default reverse\\n * resolver if necessary.\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setName(string memory name) public override returns (bytes32) {\\n return\\n setNameForAddr(\\n msg.sender,\\n msg.sender,\\n address(defaultResolver),\\n name\\n );\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the account provided. Updates the resolver to a designated resolver\\n * Only callable by controllers and authorised users\\n * @param addr The reverse record to set\\n * @param owner The owner of the reverse node\\n * @param resolver The resolver of the reverse node\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) public override returns (bytes32) {\\n bytes32 node = claimForAddr(addr, owner, resolver);\\n NameResolver(resolver).setName(node, name);\\n return node;\\n }\\n\\n /**\\n * @dev Returns the node hash for a given account's reverse records.\\n * @param addr The address to hash\\n * @return The ENS node hash.\\n */\\n function node(address addr) public pure override returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\\n );\\n }\\n\\n /**\\n * @dev An optimised function to compute the sha3 of the lower-case\\n * hexadecimal representation of an Ethereum address.\\n * @param addr The address to hash\\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\\n * input address.\\n */\\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\\n assembly {\\n for {\\n let i := 40\\n } gt(i, 0) {\\n\\n } {\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n }\\n\\n ret := keccak256(0, 40)\\n }\\n }\\n\\n function ownsContract(address addr) internal view returns (bool) {\\n try Ownable(addr).owner() returns (address owner) {\\n return owner == msg.sender;\\n } catch {\\n return false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd57d28e5791b4b44650a00f5ef6c725af53698ec33faeeaa3591f0dbd939559a\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"},\"contracts/utils/ERC20Recoverable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\\n */\\n\\ncontract ERC20Recoverable is Ownable {\\n /**\\n @notice Recover ERC20 tokens sent to the contract by mistake.\\n @dev The contract is Ownable and only the owner can call the recover function.\\n @param _to The address to send the tokens to.\\n@param _token The address of the ERC20 token to recover\\n @param _amount The amount of tokens to recover.\\n */\\n function recoverFunds(\\n address _token,\\n address _to,\\n uint256 _amount\\n ) external onlyOwner {\\n IERC20(_token).transfer(_to, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x793a38091e1f81499a29ddba82c2b2f3cdd07071b81a832886e8e02a45ff352a\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_ETH = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x70310eb67146d7290731c31841399640ac3b6a949eadc6598bc150123d185c57\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161066138038061066183398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b6105ce806100936000396000f3fe6080604052600436106100345760003560e01c806301ffc9a7146100395780633971d4671461006e578063e8d6dbb41461009c575b600080fd5b34801561004557600080fd5b506100596100543660046103b9565b6100b1565b60405190151581526020015b60405180910390f35b34801561007a57600080fd5b5061008e610089366004610402565b61014a565b604051908152602001610065565b6100af6100aa366004610402565b610218565b005b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061014457507fffffffff0000000000000000000000000000000000000000000000000000000082167fd1a70fd300000000000000000000000000000000000000000000000000000000145b92915050565b600082815b8181101561020f576000805473ffffffffffffffffffffffffffffffffffffffff166383e7f6ff8888858181106101885761018861047d565b905060200281019061019a9190610493565b886040518463ffffffff1660e01b81526004016101b9939291906104e1565b6040805180830381865afa1580156101d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f9919061051a565b602081015190510193909301925060010161014f565b50509392505050565b816000805b82811015610384576000805473ffffffffffffffffffffffffffffffffffffffff166383e7f6ff8888858181106102565761025661047d565b90506020028101906102689190610493565b886040518463ffffffff1660e01b8152600401610287939291906104e1565b6040805180830381865afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c7919061051a565b90506000816020015182600001516102df9190610577565b60005490915073ffffffffffffffffffffffffffffffffffffffff1663acf1a841828a8a878181106103135761031361047d565b90506020028101906103259190610493565b8a6040518563ffffffff1660e01b8152600401610344939291906104e1565b6000604051808303818588803b15801561035d57600080fd5b505af1158015610371573d6000803e3d6000fd5b505050919094019350505060010161021d565b5060405133904780156108fc02916000818181858888f193505050501580156103b1573d6000803e3d6000fd5b505050505050565b6000602082840312156103cb57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146103fb57600080fd5b9392505050565b60008060006040848603121561041757600080fd5b833567ffffffffffffffff8082111561042f57600080fd5b818601915086601f83011261044357600080fd5b81358181111561045257600080fd5b8760208260051b850101111561046757600080fd5b6020928301989097509590910135949350505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126104aa57600080fd5b83018035915067ffffffffffffffff8211156104c557600080fd5b6020019150368190038213156104da57600080fd5b9250929050565b604081528260408201528284606083013760006060848301015260006060601f19601f8601168301019050826020830152949350505050565b60006040828403121561052c57600080fd5b6040516040810181811067ffffffffffffffff8211171561055d57634e487b7160e01b600052604160045260246000fd5b604052825181526020928301519281019290925250919050565b8082018082111561014457634e487b7160e01b600052601160045260246000fdfea26469706673582212206ed5315a41bde821c30c69fba2d37b6813d22ebfa8f1975210e640c9d5359ed764736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106100345760003560e01c806301ffc9a7146100395780633971d4671461006e578063e8d6dbb41461009c575b600080fd5b34801561004557600080fd5b506100596100543660046103b9565b6100b1565b60405190151581526020015b60405180910390f35b34801561007a57600080fd5b5061008e610089366004610402565b61014a565b604051908152602001610065565b6100af6100aa366004610402565b610218565b005b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061014457507fffffffff0000000000000000000000000000000000000000000000000000000082167fd1a70fd300000000000000000000000000000000000000000000000000000000145b92915050565b600082815b8181101561020f576000805473ffffffffffffffffffffffffffffffffffffffff166383e7f6ff8888858181106101885761018861047d565b905060200281019061019a9190610493565b886040518463ffffffff1660e01b81526004016101b9939291906104e1565b6040805180830381865afa1580156101d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f9919061051a565b602081015190510193909301925060010161014f565b50509392505050565b816000805b82811015610384576000805473ffffffffffffffffffffffffffffffffffffffff166383e7f6ff8888858181106102565761025661047d565b90506020028101906102689190610493565b886040518463ffffffff1660e01b8152600401610287939291906104e1565b6040805180830381865afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c7919061051a565b90506000816020015182600001516102df9190610577565b60005490915073ffffffffffffffffffffffffffffffffffffffff1663acf1a841828a8a878181106103135761031361047d565b90506020028101906103259190610493565b8a6040518563ffffffff1660e01b8152600401610344939291906104e1565b6000604051808303818588803b15801561035d57600080fd5b505af1158015610371573d6000803e3d6000fd5b505050919094019350505060010161021d565b5060405133904780156108fc02916000818181858888f193505050501580156103b1573d6000803e3d6000fd5b505050505050565b6000602082840312156103cb57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146103fb57600080fd5b9392505050565b60008060006040848603121561041757600080fd5b833567ffffffffffffffff8082111561042f57600080fd5b818601915086601f83011261044357600080fd5b81358181111561045257600080fd5b8760208260051b850101111561046757600080fd5b6020928301989097509590910135949350505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126104aa57600080fd5b83018035915067ffffffffffffffff8211156104c557600080fd5b6020019150368190038213156104da57600080fd5b9250929050565b604081528260408201528284606083013760006060848301015260006060601f19601f8601168301019050826020830152949350505050565b60006040828403121561052c57600080fd5b6040516040810181811067ffffffffffffffff8211171561055d57634e487b7160e01b600052604160045260246000fd5b604052825181526020928301519281019290925250919050565b8082018082111561014457634e487b7160e01b600052601160045260246000fdfea26469706673582212206ed5315a41bde821c30c69fba2d37b6813d22ebfa8f1975210e640c9d5359ed764736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 14288, + "contract": "contracts/ethregistrar/StaticBulkRenewal.sol:StaticBulkRenewal", + "label": "controller", + "offset": 0, + "slot": "0", + "type": "t_contract(ETHRegistrarController)12942" + } + ], + "types": { + "t_contract(ETHRegistrarController)12942": { + "encoding": "inplace", + "label": "contract ETHRegistrarController", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/StaticMetadataService.json b/solidity/dns-contracts/deployments/holesky/StaticMetadataService.json new file mode 100644 index 0000000..a2ad4e9 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/StaticMetadataService.json @@ -0,0 +1,88 @@ +{ + "address": "0x14872c16523CAc7BFbFf19ACb88611CcC823FD68", + "abi": [ + { + "inputs": [ + { + "internalType": "string", + "name": "_metaDataUri", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "uri", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x899fc1bbc71cc5e0f3023cb7e53d28dbe4c3a054fe3178b423c8b1ba18b5d199", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x14872c16523CAc7BFbFf19ACb88611CcC823FD68", + "transactionIndex": 2, + "gasUsed": "233826", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xedaac4470c673df0235ef90ac8d5be82b2e07e7612aa1f63ae7eb62706380e2b", + "transactionHash": "0x899fc1bbc71cc5e0f3023cb7e53d28dbe4c3a054fe3178b423c8b1ba18b5d199", + "logs": [], + "blockNumber": 814550, + "cumulativeGasUsed": "275826", + "status": 1, + "byzantium": true + }, + "args": [ + "ens-metadata-service.appspot.com/name/0x{id}" + ], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_metaDataUri\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/wrapper/StaticMetadataService.sol\":\"StaticMetadataService\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/wrapper/StaticMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ncontract StaticMetadataService {\\n string private _uri;\\n\\n constructor(string memory _metaDataUri) {\\n _uri = _metaDataUri;\\n }\\n\\n function uri(uint256) public view returns (string memory) {\\n return _uri;\\n }\\n}\\n\",\"keccak256\":\"0x28aad4cb829118de64965e06af8e785e6b2efa5207859d2efc63e404c26cfea3\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161045538038061045583398101604081905261002f91610058565b600061003b82826101aa565b5050610269565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561006b57600080fd5b82516001600160401b038082111561008257600080fd5b818501915085601f83011261009657600080fd5b8151818111156100a8576100a8610042565b604051601f8201601f19908116603f011681019083821181831017156100d0576100d0610042565b8160405282815288868487010111156100e857600080fd5b600093505b8284101561010a57848401860151818501870152928501926100ed565b600086848301015280965050505050505092915050565b600181811c9082168061013557607f821691505b60208210810361015557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156101a557600081815260208120601f850160051c810160208610156101825750805b601f850160051c820191505b818110156101a15782815560010161018e565b5050505b505050565b81516001600160401b038111156101c3576101c3610042565b6101d7816101d18454610121565b8461015b565b602080601f83116001811461020c57600084156101f45750858301515b600019600386901b1c1916600185901b1785556101a1565b600085815260208120601f198616915b8281101561023b5788860151825594840194600190910190840161021c565b50858210156102595787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6101dd806102786000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80630e89341c14610030575b600080fd5b61004361003e3660046100ed565b610059565b6040516100509190610106565b60405180910390f35b60606000805461006890610154565b80601f016020809104026020016040519081016040528092919081815260200182805461009490610154565b80156100e15780601f106100b6576101008083540402835291602001916100e1565b820191906000526020600020905b8154815290600101906020018083116100c457829003601f168201915b50505050509050919050565b6000602082840312156100ff57600080fd5b5035919050565b600060208083528351808285015260005b8181101561013357858101830151858201604001528201610117565b506000604082860101526040601f19601f8301168501019250505092915050565b600181811c9082168061016857607f821691505b6020821081036101a1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea2646970667358221220dee5977a2693f04a6202db215bcb6c19eee7b94993ae966733d3658597220ef964736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80630e89341c14610030575b600080fd5b61004361003e3660046100ed565b610059565b6040516100509190610106565b60405180910390f35b60606000805461006890610154565b80601f016020809104026020016040519081016040528092919081815260200182805461009490610154565b80156100e15780601f106100b6576101008083540402835291602001916100e1565b820191906000526020600020905b8154815290600101906020018083116100c457829003601f168201915b50505050509050919050565b6000602082840312156100ff57600080fd5b5035919050565b600060208083528351808285015260005b8181101561013357858101830151858201604001528201610117565b506000604082860101526040601f19601f8301168501019250505092915050565b600181811c9082168061016857607f821691505b6020821081036101a1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea2646970667358221220dee5977a2693f04a6202db215bcb6c19eee7b94993ae966733d3658597220ef964736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 25524, + "contract": "contracts/wrapper/StaticMetadataService.sol:StaticMetadataService", + "label": "_uri", + "offset": 0, + "slot": "0", + "type": "t_string_storage" + } + ], + "types": { + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/TestUnwrap.json b/solidity/dns-contracts/deployments/holesky/TestUnwrap.json new file mode 100644 index 0000000..8651e1f --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/TestUnwrap.json @@ -0,0 +1,349 @@ +{ + "address": "0x2D96374e816a3bF862666eFc0794EE656580889f", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract IBaseRegistrar", + "name": "_registrar", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "approvedWrapper", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "registrar", + "outputs": [ + { + "internalType": "contract IBaseRegistrar", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "newOwner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "wrapper", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setWrapperApproval", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "wrapETH2LD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + }, + { + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "wrapFromUpgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x3be0c9e3bbc76ba40356154aed5990f3a7fed4fbd743585f1ba8332a6f47c443", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x2D96374e816a3bF862666eFc0794EE656580889f", + "transactionIndex": 4, + "gasUsed": "970609", + "logsBloom": "0x00000000000000000000000000000000000000000000200000800000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000041000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000020000000000000000000000000000000000000000000800000000000000000000000", + "blockHash": "0xfbb082d9d93244cedfbe39aae4a1e7c146d2d4534e7e02218c52bf5d0109e83a", + "transactionHash": "0x3be0c9e3bbc76ba40356154aed5990f3a7fed4fbd743585f1ba8332a6f47c443", + "logs": [ + { + "transactionIndex": 4, + "blockNumber": 815353, + "transactionHash": "0x3be0c9e3bbc76ba40356154aed5990f3a7fed4fbd743585f1ba8332a6f47c443", + "address": "0x2D96374e816a3bF862666eFc0794EE656580889f", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0xfbb082d9d93244cedfbe39aae4a1e7c146d2d4534e7e02218c52bf5d0109e83a" + } + ], + "blockNumber": 815353, + "cumulativeGasUsed": "1054609", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85" + ], + "numDeployments": 1, + "solcInputHash": "2286d90f0970dc1d34ef122ce5b9cee1", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"_registrar\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"approvedWrapper\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"registrar\",\"outputs\":[{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setSubnodeRecord\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"wrapper\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setWrapperApproval\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"wrapETH2LD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"wrapFromUpgrade\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/wrapper/mocks/TestUnwrap.sol\":\"TestUnwrap\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/wrapper/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes32) {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n}\\n\",\"keccak256\":\"0xf862cd86d749158a554e3cb517efa9097331ec0cf7225117f21e96fb50c67edb\",\"license\":\"MIT\"},\"contracts/wrapper/mocks/TestUnwrap.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\nimport \\\"../../registry/ENS.sol\\\";\\nimport \\\"../../ethregistrar/IBaseRegistrar.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {BytesUtils} from \\\"../BytesUtils.sol\\\";\\n\\ncontract TestUnwrap is Ownable {\\n using BytesUtils for bytes;\\n\\n bytes32 private constant ETH_NODE =\\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\\n\\n ENS public immutable ens;\\n IBaseRegistrar public immutable registrar;\\n mapping(address => bool) public approvedWrapper;\\n\\n constructor(ENS _ens, IBaseRegistrar _registrar) {\\n ens = _ens;\\n registrar = _registrar;\\n }\\n\\n function setWrapperApproval(\\n address wrapper,\\n bool approved\\n ) public onlyOwner {\\n approvedWrapper[wrapper] = approved;\\n }\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address resolver\\n ) public {\\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\\n }\\n\\n function setSubnodeRecord(\\n bytes32 parentNode,\\n string memory label,\\n address newOwner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) public {\\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\\n _unwrapSubnode(node, newOwner, msg.sender);\\n }\\n\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) public {\\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\\n bytes32 parentNode = name.namehash(offset);\\n bytes32 node = _makeNode(parentNode, labelhash);\\n\\n if (parentNode == ETH_NODE) {\\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\\n } else {\\n _unwrapSubnode(node, wrappedOwner, msg.sender);\\n }\\n }\\n\\n function _unwrapETH2LD(\\n bytes32 labelhash,\\n address wrappedOwner,\\n address sender\\n ) private {\\n uint256 tokenId = uint256(labelhash);\\n address registrant = registrar.ownerOf(tokenId);\\n\\n require(\\n approvedWrapper[sender] &&\\n sender == registrant &&\\n registrar.isApprovedForAll(registrant, address(this)),\\n \\\"Unauthorised\\\"\\n );\\n\\n registrar.reclaim(tokenId, wrappedOwner);\\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\\n }\\n\\n function _unwrapSubnode(\\n bytes32 node,\\n address newOwner,\\n address sender\\n ) private {\\n address owner = ens.owner(node);\\n\\n require(\\n approvedWrapper[sender] &&\\n owner == sender &&\\n ens.isApprovedForAll(owner, address(this)),\\n \\\"Unauthorised\\\"\\n );\\n\\n ens.setOwner(node, newOwner);\\n }\\n\\n function _makeNode(\\n bytes32 node,\\n bytes32 labelhash\\n ) private pure returns (bytes32) {\\n return keccak256(abi.encodePacked(node, labelhash));\\n }\\n}\\n\",\"keccak256\":\"0x738180fe6f0caae045c82df1d5a7088d07ebbf299c5c8b402a3cf04079980014\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c060405234801561001057600080fd5b5060405161117238038061117283398101604081905261002f916100b7565b6100383361004f565b6001600160a01b039182166080521660a0526100f1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146100b457600080fd5b50565b600080604083850312156100ca57600080fd5b82516100d58161009f565b60208401519092506100e68161009f565b809150509250929050565b60805160a05161102c6101466000396000818160f0015281816108f1015281816109cc01528181610ac20152610b63015260008181610134015281816104b6015281816105910152610687015261102c6000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80638da5cb5b11610076578063c6d6d7c11161005b578063c6d6d7c114610182578063f2fde38b146101b5578063f9547a9e146101c857600080fd5b80638da5cb5b1461015e5780639198c2761461016f57600080fd5b80632b20e397116100a75780632b20e397146100eb5780633f15457f1461012f578063715018a61461015657600080fd5b80630cc17365146100c357806324c1af44146100d8575b600080fd5b6100d66100d1366004610c1f565b6101db565b005b6100d66100e6366004610c9a565b61020e565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6100d6610238565b6000546001600160a01b0316610112565b6100d661017d366004610df1565b61024c565b6101a5610190366004610eac565b60016020526000908152604090205460ff1681565b6040519015158152602001610126565b6100d66101c3366004610eac565b61033c565b6100d66101d6366004610ed0565b6103d1565b6101e36103fb565b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b6000610221888880519060200120610455565b905061022e818733610484565b5050505050505050565b6102406103fb565b61024a60006106df565b565b60008061029360008b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506107479050565b9150915060006102dc828c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506107fe9050565b905060006102ea8285610455565b90507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b5282016103235761031e848b336108bd565b61032e565b61032e818b33610484565b505050505050505050505050565b6103446103fb565b6001600160a01b0381166103c55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6103ce816106df565b50565b6103f386866040516103e4929190610f5a565b604051809103902085336108bd565b505050505050565b6000546001600160a01b0316331461024a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103bc565b604080516020808201859052818301849052825180830384018152606090920190925280519101205b92915050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018490526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610505573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105299190610f6a565b6001600160a01b03831660009081526001602052604090205490915060ff1680156105655750816001600160a01b0316816001600160a01b0316145b80156105fc575060405163e985e9c560e01b81526001600160a01b0382811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa1580156105d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fc9190610f87565b6106485760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f7269736564000000000000000000000000000000000000000060448201526064016103bc565b6040517f5b0fc9c3000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b0384811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b1580156106cb57600080fd5b505af115801561022e573d6000803e3d6000fd5b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000808351831061079a5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e6473000060448201526064016103bc565b60008484815181106107ae576107ae610fa4565b016020015160f81c905080156107da576107d3856107cd866001610fd0565b83610bc8565b92506107df565b600092505b6107e98185610fd0565b6107f4906001610fd0565b9150509250929050565b600080600061080d8585610747565b90925090508161087f57600185516108259190610fe3565b84146108735760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d6500000060448201526064016103bc565b506000915061047e9050565b61088985826107fe565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b6040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810184905283906000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015610940573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109649190610f6a565b6001600160a01b03841660009081526001602052604090205490915060ff1680156109a05750806001600160a01b0316836001600160a01b0316145b8015610a37575060405163e985e9c560e01b81526001600160a01b0382811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610a13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a379190610f87565b610a835760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f7269736564000000000000000000000000000000000000000060448201526064016103bc565b6040517f28ed4f6c000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b0385811660248301527f000000000000000000000000000000000000000000000000000000000000000016906328ed4f6c90604401600060405180830381600087803b158015610b0657600080fd5b505af1158015610b1a573d6000803e3d6000fd5b50506040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528781166024830152604482018690527f00000000000000000000000000000000000000000000000000000000000000001692506323b872dd9150606401600060405180830381600087803b158015610ba957600080fd5b505af1158015610bbd573d6000803e3d6000fd5b505050505050505050565b8251600090610bd78385610fd0565b1115610be257600080fd5b5091016020012090565b6001600160a01b03811681146103ce57600080fd5b8035610c0c81610bec565b919050565b80151581146103ce57600080fd5b60008060408385031215610c3257600080fd5b8235610c3d81610bec565b91506020830135610c4d81610c11565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b803567ffffffffffffffff81168114610c0c57600080fd5b803563ffffffff81168114610c0c57600080fd5b600080600080600080600060e0888a031215610cb557600080fd5b87359650602088013567ffffffffffffffff80821115610cd457600080fd5b818a0191508a601f830112610ce857600080fd5b813581811115610cfa57610cfa610c58565b604051601f8201601f19908116603f01168101908382118183101715610d2257610d22610c58565b816040528281528d6020848701011115610d3b57600080fd5b82602086016020830137600060208483010152809a505050505050610d6260408901610c01565b9450610d7060608901610c01565b9350610d7e60808901610c6e565b9250610d8c60a08901610c86565b9150610d9a60c08901610c6e565b905092959891949750929550565b60008083601f840112610dba57600080fd5b50813567ffffffffffffffff811115610dd257600080fd5b602083019150836020828501011115610dea57600080fd5b9250929050565b60008060008060008060008060c0898b031215610e0d57600080fd5b883567ffffffffffffffff80821115610e2557600080fd5b610e318c838d01610da8565b909a50985060208b01359150610e4682610bec565b819750610e5560408c01610c86565b9650610e6360608c01610c6e565b955060808b01359150610e7582610bec565b90935060a08a01359080821115610e8b57600080fd5b50610e988b828c01610da8565b999c989b5096995094979396929594505050565b600060208284031215610ebe57600080fd5b8135610ec981610bec565b9392505050565b60008060008060008060a08789031215610ee957600080fd5b863567ffffffffffffffff811115610f0057600080fd5b610f0c89828a01610da8565b9097509550506020870135610f2081610bec565b9350610f2e60408801610c86565b9250610f3c60608801610c6e565b91506080870135610f4c81610bec565b809150509295509295509295565b8183823760009101908152919050565b600060208284031215610f7c57600080fd5b8151610ec981610bec565b600060208284031215610f9957600080fd5b8151610ec981610c11565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561047e5761047e610fba565b8181038181111561047e5761047e610fba56fea26469706673582212203f243b3fb6a0d0e66614aad914e5496f6cebe71ce003be40f2251a1feb201b6a64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100be5760003560e01c80638da5cb5b11610076578063c6d6d7c11161005b578063c6d6d7c114610182578063f2fde38b146101b5578063f9547a9e146101c857600080fd5b80638da5cb5b1461015e5780639198c2761461016f57600080fd5b80632b20e397116100a75780632b20e397146100eb5780633f15457f1461012f578063715018a61461015657600080fd5b80630cc17365146100c357806324c1af44146100d8575b600080fd5b6100d66100d1366004610c1f565b6101db565b005b6100d66100e6366004610c9a565b61020e565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6100d6610238565b6000546001600160a01b0316610112565b6100d661017d366004610df1565b61024c565b6101a5610190366004610eac565b60016020526000908152604090205460ff1681565b6040519015158152602001610126565b6100d66101c3366004610eac565b61033c565b6100d66101d6366004610ed0565b6103d1565b6101e36103fb565b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b6000610221888880519060200120610455565b905061022e818733610484565b5050505050505050565b6102406103fb565b61024a60006106df565b565b60008061029360008b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506107479050565b9150915060006102dc828c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506107fe9050565b905060006102ea8285610455565b90507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b5282016103235761031e848b336108bd565b61032e565b61032e818b33610484565b505050505050505050505050565b6103446103fb565b6001600160a01b0381166103c55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6103ce816106df565b50565b6103f386866040516103e4929190610f5a565b604051809103902085336108bd565b505050505050565b6000546001600160a01b0316331461024a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103bc565b604080516020808201859052818301849052825180830384018152606090920190925280519101205b92915050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018490526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610505573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105299190610f6a565b6001600160a01b03831660009081526001602052604090205490915060ff1680156105655750816001600160a01b0316816001600160a01b0316145b80156105fc575060405163e985e9c560e01b81526001600160a01b0382811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa1580156105d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fc9190610f87565b6106485760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f7269736564000000000000000000000000000000000000000060448201526064016103bc565b6040517f5b0fc9c3000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b0384811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b1580156106cb57600080fd5b505af115801561022e573d6000803e3d6000fd5b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000808351831061079a5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e6473000060448201526064016103bc565b60008484815181106107ae576107ae610fa4565b016020015160f81c905080156107da576107d3856107cd866001610fd0565b83610bc8565b92506107df565b600092505b6107e98185610fd0565b6107f4906001610fd0565b9150509250929050565b600080600061080d8585610747565b90925090508161087f57600185516108259190610fe3565b84146108735760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d6500000060448201526064016103bc565b506000915061047e9050565b61088985826107fe565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b6040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810184905283906000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015610940573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109649190610f6a565b6001600160a01b03841660009081526001602052604090205490915060ff1680156109a05750806001600160a01b0316836001600160a01b0316145b8015610a37575060405163e985e9c560e01b81526001600160a01b0382811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610a13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a379190610f87565b610a835760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f7269736564000000000000000000000000000000000000000060448201526064016103bc565b6040517f28ed4f6c000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b0385811660248301527f000000000000000000000000000000000000000000000000000000000000000016906328ed4f6c90604401600060405180830381600087803b158015610b0657600080fd5b505af1158015610b1a573d6000803e3d6000fd5b50506040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528781166024830152604482018690527f00000000000000000000000000000000000000000000000000000000000000001692506323b872dd9150606401600060405180830381600087803b158015610ba957600080fd5b505af1158015610bbd573d6000803e3d6000fd5b505050505050505050565b8251600090610bd78385610fd0565b1115610be257600080fd5b5091016020012090565b6001600160a01b03811681146103ce57600080fd5b8035610c0c81610bec565b919050565b80151581146103ce57600080fd5b60008060408385031215610c3257600080fd5b8235610c3d81610bec565b91506020830135610c4d81610c11565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b803567ffffffffffffffff81168114610c0c57600080fd5b803563ffffffff81168114610c0c57600080fd5b600080600080600080600060e0888a031215610cb557600080fd5b87359650602088013567ffffffffffffffff80821115610cd457600080fd5b818a0191508a601f830112610ce857600080fd5b813581811115610cfa57610cfa610c58565b604051601f8201601f19908116603f01168101908382118183101715610d2257610d22610c58565b816040528281528d6020848701011115610d3b57600080fd5b82602086016020830137600060208483010152809a505050505050610d6260408901610c01565b9450610d7060608901610c01565b9350610d7e60808901610c6e565b9250610d8c60a08901610c86565b9150610d9a60c08901610c6e565b905092959891949750929550565b60008083601f840112610dba57600080fd5b50813567ffffffffffffffff811115610dd257600080fd5b602083019150836020828501011115610dea57600080fd5b9250929050565b60008060008060008060008060c0898b031215610e0d57600080fd5b883567ffffffffffffffff80821115610e2557600080fd5b610e318c838d01610da8565b909a50985060208b01359150610e4682610bec565b819750610e5560408c01610c86565b9650610e6360608c01610c6e565b955060808b01359150610e7582610bec565b90935060a08a01359080821115610e8b57600080fd5b50610e988b828c01610da8565b999c989b5096995094979396929594505050565b600060208284031215610ebe57600080fd5b8135610ec981610bec565b9392505050565b60008060008060008060a08789031215610ee957600080fd5b863567ffffffffffffffff811115610f0057600080fd5b610f0c89828a01610da8565b9097509550506020870135610f2081610bec565b9350610f2e60408801610c86565b9250610f3c60608801610c6e565b91506080870135610f4c81610bec565b809150509295509295509295565b8183823760009101908152919050565b600060208284031215610f7c57600080fd5b8151610ec981610bec565b600060208284031215610f9957600080fd5b8151610ec981610c11565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561047e5761047e610fba565b8181038181111561047e5761047e610fba56fea26469706673582212203f243b3fb6a0d0e66614aad914e5496f6cebe71ce003be40f2251a1feb201b6a64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 444, + "contract": "contracts/wrapper/mocks/TestUnwrap.sol:TestUnwrap", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 25710, + "contract": "contracts/wrapper/mocks/TestUnwrap.sol:TestUnwrap", + "label": "approvedWrapper", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/UniversalResolver.json b/solidity/dns-contracts/deployments/holesky/UniversalResolver.json new file mode 100644 index 0000000..db08712 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/UniversalResolver.json @@ -0,0 +1,733 @@ +{ + "address": "0xa6ac935d4971e3cd133b950ae053becd16fe7f3b", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_registry", + "type": "address" + }, + { + "internalType": "string[]", + "name": "_urls", + "type": "string[]" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "string[]", + "name": "urls", + "type": "string[]" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes4", + "name": "callbackFunction", + "type": "bytes4" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "OffchainLookup", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "name": "ResolverError", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverNotContract", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverNotFound", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverWildcardNotSupported", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "string[]", + "name": "gateways", + "type": "string[]" + }, + { + "internalType": "bytes4", + "name": "callbackFunction", + "type": "bytes4" + }, + { + "internalType": "bytes", + "name": "metaData", + "type": "bytes" + } + ], + "name": "_resolveSingle", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "batchGatewayURLs", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "findResolver", + "outputs": [ + { + "internalType": "contract Resolver", + "name": "", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "registry", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "string[]", + "name": "gateways", + "type": "string[]" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "resolve", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "internalType": "struct Result[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "string[]", + "name": "gateways", + "type": "string[]" + } + ], + "name": "resolve", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "internalType": "struct Result[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "response", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "resolveCallback", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "internalType": "struct Result[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "response", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "resolveSingleCallback", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "reverseName", + "type": "bytes" + }, + { + "internalType": "string[]", + "name": "gateways", + "type": "string[]" + } + ], + "name": "reverse", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "reverseName", + "type": "bytes" + } + ], + "name": "reverse", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "response", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "reverseCallback", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "_urls", + "type": "string[]" + } + ], + "name": "setGatewayURLs", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xb980e95b4e6f861b8a385ef2d56da794c3b9ca4c2b0b431a960236520a69695e", + "receipt": { + "to": null, + "from": "0x69420f05a11f617b4b74ffe2e04b2d300dfa556f", + "contractAddress": "0xa6ac935d4971e3cd133b950ae053becd16fe7f3b", + "transactionIndex": "0x7", + "gasUsed": "0x2fe6fe", + "logsBloom": "0x00000000010000000000000000000000000000000000000200800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040800000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000040000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x46d110b455deb881ff400a506d42de71555bed49c210c6199e20714e625103f3", + "transactionHash": "0x3636f532779d76cd00117069e327819a854d9b5e7d97abe442ac19ba68187836", + "logs": [ + { + "address": "0xa6ac935d4971e3cd133b950ae053becd16fe7f3b", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000069420f05a11f617b4b74ffe2e04b2d300dfa556f" + ], + "data": "0x", + "blockNumber": "0xedaac", + "transactionHash": "0x3636f532779d76cd00117069e327819a854d9b5e7d97abe442ac19ba68187836", + "transactionIndex": "0x7", + "blockHash": "0x46d110b455deb881ff400a506d42de71555bed49c210c6199e20714e625103f3", + "logIndex": "0x10", + "removed": false + } + ], + "blockNumber": "0xedaac", + "cumulativeGasUsed": "0x3afca3", + "status": "0x1" + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + [ + "https://ccip-v2.ens.xyz" + ] + ], + "numDeployments": 2, + "solcInputHash": "49f758ec505ff69b72f3179ac11d7cfc", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_registry\",\"type\":\"address\"},{\"internalType\":\"string[]\",\"name\":\"_urls\",\"type\":\"string[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"string[]\",\"name\":\"urls\",\"type\":\"string[]\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes4\",\"name\":\"callbackFunction\",\"type\":\"bytes4\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"OffchainLookup\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"name\":\"ResolverError\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverNotContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverWildcardNotSupported\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string[]\",\"name\":\"gateways\",\"type\":\"string[]\"},{\"internalType\":\"bytes4\",\"name\":\"callbackFunction\",\"type\":\"bytes4\"},{\"internalType\":\"bytes\",\"name\":\"metaData\",\"type\":\"bytes\"}],\"name\":\"_resolveSingle\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"batchGatewayURLs\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"findResolver\",\"outputs\":[{\"internalType\":\"contract Resolver\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"registry\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string[]\",\"name\":\"gateways\",\"type\":\"string[]\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"resolve\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"internalType\":\"struct Result[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"string[]\",\"name\":\"gateways\",\"type\":\"string[]\"}],\"name\":\"resolve\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"internalType\":\"struct Result[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"response\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"resolveCallback\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"internalType\":\"struct Result[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"response\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"resolveSingleCallback\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"reverseName\",\"type\":\"bytes\"},{\"internalType\":\"string[]\",\"name\":\"gateways\",\"type\":\"string[]\"}],\"name\":\"reverse\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"reverseName\",\"type\":\"bytes\"}],\"name\":\"reverse\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"response\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"reverseCallback\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"_urls\",\"type\":\"string[]\"}],\"name\":\"setGatewayURLs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"findResolver(bytes)\":{\"details\":\"Finds a resolver by recursively querying the registry, starting at the longest name and progressively removing labels until it finds a result.\",\"params\":{\"name\":\"The name to resolve, in DNS-encoded and normalised form.\"},\"returns\":{\"_0\":\"resolver The Resolver responsible for this name.\",\"_1\":\"namehash The namehash of the full name.\",\"_2\":\"finalOffset The offset of the first label with a resolver.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"resolve(bytes,bytes)\":{\"details\":\"Performs ENS name resolution for the supplied name and resolution data.\",\"params\":{\"data\":\"The resolution data, as specified in ENSIP-10.\",\"name\":\"The name to resolve, in normalised and DNS-encoded form.\"},\"returns\":{\"_0\":\"The result of resolving the name.\"}},\"reverse(bytes,string[])\":{\"details\":\"Performs ENS name reverse resolution for the supplied reverse name.\",\"params\":{\"reverseName\":\"The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\"},\"returns\":{\"_0\":\"The resolved name, the resolved address, the reverse resolver address, and the resolver address.\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"The Universal Resolver is a contract that handles the work of resolving a name entirely onchain, making it possible to make a single smart contract call to resolve an ENS name.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/utils/UniversalResolver.sol\":\"UniversalResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/resolvers/Resolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"./profiles/IABIResolver.sol\\\";\\nimport \\\"./profiles/IAddressResolver.sol\\\";\\nimport \\\"./profiles/IAddrResolver.sol\\\";\\nimport \\\"./profiles/IContentHashResolver.sol\\\";\\nimport \\\"./profiles/IDNSRecordResolver.sol\\\";\\nimport \\\"./profiles/IDNSZoneResolver.sol\\\";\\nimport \\\"./profiles/IInterfaceResolver.sol\\\";\\nimport \\\"./profiles/INameResolver.sol\\\";\\nimport \\\"./profiles/IPubkeyResolver.sol\\\";\\nimport \\\"./profiles/ITextResolver.sol\\\";\\nimport \\\"./profiles/IExtendedResolver.sol\\\";\\n\\n/**\\n * A generic resolver interface which includes all the functions including the ones deprecated\\n */\\ninterface Resolver is\\n IERC165,\\n IABIResolver,\\n IAddressResolver,\\n IAddrResolver,\\n IContentHashResolver,\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n IInterfaceResolver,\\n INameResolver,\\n IPubkeyResolver,\\n ITextResolver,\\n IExtendedResolver\\n{\\n /* Deprecated events */\\n event ContentChanged(bytes32 indexed node, bytes32 hash);\\n\\n function setApprovalForAll(address, bool) external;\\n\\n function approve(bytes32 node, address delegate, bool approved) external;\\n\\n function isApprovedForAll(address account, address operator) external;\\n\\n function isApprovedFor(\\n address owner,\\n bytes32 node,\\n address delegate\\n ) external;\\n\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external;\\n\\n function setAddr(bytes32 node, address addr) external;\\n\\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\\n\\n function setContenthash(bytes32 node, bytes calldata hash) external;\\n\\n function setDnsrr(bytes32 node, bytes calldata data) external;\\n\\n function setName(bytes32 node, string calldata _name) external;\\n\\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\\n\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external;\\n\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external;\\n\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n /* Deprecated functions */\\n function content(bytes32 node) external view returns (bytes32);\\n\\n function multihash(bytes32 node) external view returns (bytes memory);\\n\\n function setContent(bytes32 node, bytes32 hash) external;\\n\\n function setMultihash(bytes32 node, bytes calldata hash) external;\\n}\\n\",\"keccak256\":\"0xfc77ab6b7c59c3ebfe1c720bdebf9b08c2488ff7ac9501a9aa056c5d6d5b50c5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/utils/HexUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary HexUtils {\\n /**\\n * @dev Attempts to parse bytes32 from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexStringToBytes32(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (bytes32 r, bool valid) {\\n uint256 hexLength = lastIdx - idx;\\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\\n revert(\\\"Invalid string length\\\");\\n }\\n valid = true;\\n assembly {\\n // check that the index to read to is not past the end of the string\\n if gt(lastIdx, mload(str)) {\\n revert(0, 0)\\n }\\n\\n function getHex(c) -> ascii {\\n // chars 48-57: 0-9\\n if and(gt(c, 47), lt(c, 58)) {\\n ascii := sub(c, 48)\\n leave\\n }\\n // chars 65-70: A-F\\n if and(gt(c, 64), lt(c, 71)) {\\n ascii := add(sub(c, 65), 10)\\n leave\\n }\\n // chars 97-102: a-f\\n if and(gt(c, 96), lt(c, 103)) {\\n ascii := add(sub(c, 97), 10)\\n leave\\n }\\n // invalid char\\n ascii := 0xff\\n }\\n\\n let ptr := add(str, 32)\\n for {\\n let i := idx\\n } lt(i, lastIdx) {\\n i := add(i, 2)\\n } {\\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\\n // if either byte is invalid, set invalid and break loop\\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\\n valid := false\\n break\\n }\\n let combined := or(shl(4, byte1), byte2)\\n r := or(shl(8, r), combined)\\n }\\n }\\n }\\n\\n /**\\n * @dev Attempts to parse an address from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexToAddress(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (address, bool) {\\n if (lastIdx - idx < 40) return (address(0x0), false);\\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\\n return (address(uint160(uint256(r))), valid);\\n }\\n}\\n\",\"keccak256\":\"0x4a8a9c72d6f3effb80b310faa6dc273e7adbc3b949df9c7a42e290e5b13519f3\",\"license\":\"MIT\"},\"contracts/utils/LowLevelCallUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.13;\\n\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nlibrary LowLevelCallUtils {\\n using Address for address;\\n\\n /**\\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\\n * `returnDataSize` and `readReturnData`.\\n * @param target The address to staticcall.\\n * @param data The data to pass to the call.\\n * @return success True if the call succeeded, or false if it reverts.\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data\\n ) internal view returns (bool success) {\\n return functionStaticCall(target, data, gasleft());\\n }\\n\\n /**\\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\\n * `returnDataSize` and `readReturnData`.\\n * @param target The address to staticcall.\\n * @param data The data to pass to the call.\\n * @param gasLimit The gas limit to use for the call.\\n * @return success True if the call succeeded, or false if it reverts.\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n uint256 gasLimit\\n ) internal view returns (bool success) {\\n require(\\n target.isContract(),\\n \\\"LowLevelCallUtils: static call to non-contract\\\"\\n );\\n assembly {\\n success := staticcall(\\n gasLimit,\\n target,\\n add(data, 32),\\n mload(data),\\n 0,\\n 0\\n )\\n }\\n }\\n\\n /**\\n * @dev Returns the size of the return data of the most recent external call.\\n */\\n function returnDataSize() internal pure returns (uint256 len) {\\n assembly {\\n len := returndatasize()\\n }\\n }\\n\\n /**\\n * @dev Reads return data from the most recent external call.\\n * @param offset Offset into the return data.\\n * @param length Number of bytes to return.\\n */\\n function readReturnData(\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (bytes memory data) {\\n data = new bytes(length);\\n assembly {\\n returndatacopy(add(data, 32), offset, length)\\n }\\n }\\n\\n /**\\n * @dev Reverts with the return data from the most recent external call.\\n */\\n function propagateRevert() internal pure {\\n assembly {\\n returndatacopy(0, 0, returndatasize())\\n revert(0, returndatasize())\\n }\\n }\\n}\\n\",\"keccak256\":\"0xba30d0a44a6a2f1557e4913108b25d8b36cb40a54f44ac98086465d6bf77c5e6\",\"license\":\"MIT\"},\"contracts/utils/NameEncoder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.13;\\n\\nimport {BytesUtils} from \\\"../wrapper/BytesUtils.sol\\\";\\n\\nlibrary NameEncoder {\\n using BytesUtils for bytes;\\n\\n function dnsEncodeName(\\n string memory name\\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\\n uint8 labelLength = 0;\\n bytes memory bytesName = bytes(name);\\n uint256 length = bytesName.length;\\n dnsName = new bytes(length + 2);\\n node = 0;\\n if (length == 0) {\\n dnsName[0] = 0;\\n return (dnsName, node);\\n }\\n\\n // use unchecked to save gas since we check for an underflow\\n // and we check for the length before the loop\\n unchecked {\\n for (uint256 i = length - 1; i >= 0; i--) {\\n if (bytesName[i] == \\\".\\\") {\\n dnsName[i + 1] = bytes1(labelLength);\\n node = keccak256(\\n abi.encodePacked(\\n node,\\n bytesName.keccak(i + 1, labelLength)\\n )\\n );\\n labelLength = 0;\\n } else {\\n labelLength += 1;\\n dnsName[i + 1] = bytesName[i];\\n }\\n if (i == 0) {\\n break;\\n }\\n }\\n }\\n\\n node = keccak256(\\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\\n );\\n\\n dnsName[0] = bytes1(labelLength);\\n return (dnsName, node);\\n }\\n}\\n\",\"keccak256\":\"0x63fd5f360cef8c9b8b8cfdff20d3f0e955b4c8ac7dfac758788223c61678aad1\",\"license\":\"MIT\"},\"contracts/utils/UniversalResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ERC165} from \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {LowLevelCallUtils} from \\\"./LowLevelCallUtils.sol\\\";\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IExtendedResolver} from \\\"../resolvers/profiles/IExtendedResolver.sol\\\";\\nimport {Resolver, INameResolver, IAddrResolver} from \\\"../resolvers/Resolver.sol\\\";\\nimport {NameEncoder} from \\\"./NameEncoder.sol\\\";\\nimport {BytesUtils} from \\\"../wrapper/BytesUtils.sol\\\";\\nimport {HexUtils} from \\\"./HexUtils.sol\\\";\\n\\nerror OffchainLookup(\\n address sender,\\n string[] urls,\\n bytes callData,\\n bytes4 callbackFunction,\\n bytes extraData\\n);\\n\\nerror ResolverNotFound();\\n\\nerror ResolverWildcardNotSupported();\\n\\nerror ResolverNotContract();\\n\\nerror ResolverError(bytes returnData);\\n\\nerror HttpError(HttpErrorItem[] errors);\\n\\nstruct HttpErrorItem {\\n uint16 status;\\n string message;\\n}\\n\\nstruct MulticallData {\\n bytes name;\\n bytes[] data;\\n string[] gateways;\\n bytes4 callbackFunction;\\n bool isWildcard;\\n address resolver;\\n bytes metaData;\\n bool[] failures;\\n}\\n\\nstruct MulticallChecks {\\n bool isCallback;\\n bool hasExtendedResolver;\\n}\\n\\nstruct OffchainLookupCallData {\\n address sender;\\n string[] urls;\\n bytes callData;\\n}\\n\\nstruct OffchainLookupExtraData {\\n bytes4 callbackFunction;\\n bytes data;\\n}\\n\\nstruct Result {\\n bool success;\\n bytes returnData;\\n}\\n\\ninterface BatchGateway {\\n function query(\\n OffchainLookupCallData[] memory data\\n ) external returns (bool[] memory failures, bytes[] memory responses);\\n}\\n\\n/**\\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\\n * making it possible to make a single smart contract call to resolve an ENS name.\\n */\\ncontract UniversalResolver is ERC165, Ownable {\\n using Address for address;\\n using NameEncoder for string;\\n using BytesUtils for bytes;\\n using HexUtils for bytes;\\n\\n string[] public batchGatewayURLs;\\n ENS public immutable registry;\\n\\n constructor(address _registry, string[] memory _urls) {\\n registry = ENS(_registry);\\n batchGatewayURLs = _urls;\\n }\\n\\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\\n batchGatewayURLs = _urls;\\n }\\n\\n /**\\n * @dev Performs ENS name resolution for the supplied name and resolution data.\\n * @param name The name to resolve, in normalised and DNS-encoded form.\\n * @param data The resolution data, as specified in ENSIP-10.\\n * @return The result of resolving the name.\\n */\\n function resolve(\\n bytes calldata name,\\n bytes memory data\\n ) external view returns (bytes memory, address) {\\n return\\n _resolveSingle(\\n name,\\n data,\\n batchGatewayURLs,\\n this.resolveSingleCallback.selector,\\n \\\"\\\"\\n );\\n }\\n\\n function resolve(\\n bytes calldata name,\\n bytes[] memory data\\n ) external view returns (Result[] memory, address) {\\n return resolve(name, data, batchGatewayURLs);\\n }\\n\\n function resolve(\\n bytes calldata name,\\n bytes memory data,\\n string[] memory gateways\\n ) external view returns (bytes memory, address) {\\n return\\n _resolveSingle(\\n name,\\n data,\\n gateways,\\n this.resolveSingleCallback.selector,\\n \\\"\\\"\\n );\\n }\\n\\n function resolve(\\n bytes calldata name,\\n bytes[] memory data,\\n string[] memory gateways\\n ) public view returns (Result[] memory, address) {\\n return\\n _resolve(name, data, gateways, this.resolveCallback.selector, \\\"\\\");\\n }\\n\\n function _resolveSingle(\\n bytes calldata name,\\n bytes memory data,\\n string[] memory gateways,\\n bytes4 callbackFunction,\\n bytes memory metaData\\n ) public view returns (bytes memory, address) {\\n bytes[] memory dataArr = new bytes[](1);\\n dataArr[0] = data;\\n (Result[] memory results, address resolver) = _resolve(\\n name,\\n dataArr,\\n gateways,\\n callbackFunction,\\n metaData\\n );\\n\\n Result memory result = results[0];\\n\\n _checkResolveSingle(result);\\n\\n return (result.returnData, resolver);\\n }\\n\\n function _resolve(\\n bytes calldata name,\\n bytes[] memory data,\\n string[] memory gateways,\\n bytes4 callbackFunction,\\n bytes memory metaData\\n ) internal view returns (Result[] memory results, address resolverAddress) {\\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\\n resolverAddress = address(resolver);\\n if (resolverAddress == address(0)) {\\n revert ResolverNotFound();\\n }\\n\\n if (!resolverAddress.isContract()) {\\n revert ResolverNotContract();\\n }\\n\\n bool isWildcard = finalOffset != 0;\\n\\n results = _multicall(\\n MulticallData(\\n name,\\n data,\\n gateways,\\n callbackFunction,\\n isWildcard,\\n resolverAddress,\\n metaData,\\n new bool[](data.length)\\n )\\n );\\n }\\n\\n function reverse(\\n bytes calldata reverseName\\n ) external view returns (string memory, address, address, address) {\\n return reverse(reverseName, batchGatewayURLs);\\n }\\n\\n /**\\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\\n */\\n function reverse(\\n bytes calldata reverseName,\\n string[] memory gateways\\n ) public view returns (string memory, address, address, address) {\\n bytes memory encodedCall = abi.encodeCall(\\n INameResolver.name,\\n reverseName.namehash(0)\\n );\\n (\\n bytes memory reverseResolvedData,\\n address reverseResolverAddress\\n ) = _resolveSingle(\\n reverseName,\\n encodedCall,\\n gateways,\\n this.reverseCallback.selector,\\n \\\"\\\"\\n );\\n\\n return\\n getForwardDataFromReverse(\\n reverseResolvedData,\\n reverseResolverAddress,\\n gateways\\n );\\n }\\n\\n function getForwardDataFromReverse(\\n bytes memory resolvedReverseData,\\n address reverseResolverAddress,\\n string[] memory gateways\\n ) internal view returns (string memory, address, address, address) {\\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\\n\\n (bytes memory encodedName, bytes32 namehash) = resolvedName\\n .dnsEncodeName();\\n\\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\\n bytes memory metaData = abi.encode(\\n resolvedName,\\n reverseResolverAddress\\n );\\n (bytes memory resolvedData, address resolverAddress) = this\\n ._resolveSingle(\\n encodedName,\\n encodedCall,\\n gateways,\\n this.reverseCallback.selector,\\n metaData\\n );\\n\\n address resolvedAddress = abi.decode(resolvedData, (address));\\n\\n return (\\n resolvedName,\\n resolvedAddress,\\n reverseResolverAddress,\\n resolverAddress\\n );\\n }\\n\\n function resolveSingleCallback(\\n bytes calldata response,\\n bytes calldata extraData\\n ) external view returns (bytes memory, address) {\\n (Result[] memory results, address resolver, , ) = _resolveCallback(\\n response,\\n extraData,\\n this.resolveSingleCallback.selector\\n );\\n Result memory result = results[0];\\n\\n _checkResolveSingle(result);\\n\\n return (result.returnData, resolver);\\n }\\n\\n function resolveCallback(\\n bytes calldata response,\\n bytes calldata extraData\\n ) external view returns (Result[] memory, address) {\\n (Result[] memory results, address resolver, , ) = _resolveCallback(\\n response,\\n extraData,\\n this.resolveCallback.selector\\n );\\n return (results, resolver);\\n }\\n\\n function reverseCallback(\\n bytes calldata response,\\n bytes calldata extraData\\n ) external view returns (string memory, address, address, address) {\\n (\\n Result[] memory results,\\n address resolverAddress,\\n string[] memory gateways,\\n bytes memory metaData\\n ) = _resolveCallback(\\n response,\\n extraData,\\n this.reverseCallback.selector\\n );\\n\\n Result memory result = results[0];\\n\\n _checkResolveSingle(result);\\n\\n if (metaData.length > 0) {\\n (string memory resolvedName, address reverseResolverAddress) = abi\\n .decode(metaData, (string, address));\\n address resolvedAddress = abi.decode(result.returnData, (address));\\n return (\\n resolvedName,\\n resolvedAddress,\\n reverseResolverAddress,\\n resolverAddress\\n );\\n }\\n\\n return\\n getForwardDataFromReverse(\\n result.returnData,\\n resolverAddress,\\n gateways\\n );\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override returns (bool) {\\n return\\n interfaceId == type(IExtendedResolver).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n function _resolveCallback(\\n bytes calldata response,\\n bytes calldata extraData,\\n bytes4 callbackFunction\\n )\\n internal\\n view\\n returns (Result[] memory, address, string[] memory, bytes memory)\\n {\\n MulticallData memory multicallData;\\n multicallData.callbackFunction = callbackFunction;\\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\\n response,\\n (bool[], bytes[])\\n );\\n OffchainLookupExtraData[] memory extraDatas;\\n (\\n multicallData.isWildcard,\\n multicallData.resolver,\\n multicallData.gateways,\\n multicallData.metaData,\\n extraDatas\\n ) = abi.decode(\\n extraData,\\n (bool, address, string[], bytes, OffchainLookupExtraData[])\\n );\\n require(responses.length <= extraDatas.length);\\n multicallData.data = new bytes[](extraDatas.length);\\n multicallData.failures = new bool[](extraDatas.length);\\n uint256 offchainCount = 0;\\n for (uint256 i = 0; i < extraDatas.length; i++) {\\n if (extraDatas[i].callbackFunction == bytes4(0)) {\\n // This call did not require an offchain lookup; use the previous input data.\\n multicallData.data[i] = extraDatas[i].data;\\n } else {\\n if (failures[offchainCount]) {\\n multicallData.failures[i] = true;\\n multicallData.data[i] = responses[offchainCount];\\n } else {\\n multicallData.data[i] = abi.encodeWithSelector(\\n extraDatas[i].callbackFunction,\\n responses[offchainCount],\\n extraDatas[i].data\\n );\\n }\\n offchainCount = offchainCount + 1;\\n }\\n }\\n\\n return (\\n _multicall(multicallData),\\n multicallData.resolver,\\n multicallData.gateways,\\n multicallData.metaData\\n );\\n }\\n\\n /**\\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\\n * the error with the data necessary to continue the request where it left off.\\n * @param target The address to call.\\n * @param data The data to call `target` with.\\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\\n * @return result Whether the call succeeded.\\n */\\n function callWithOffchainLookupPropagation(\\n address target,\\n bytes memory data,\\n bool isSafe\\n )\\n internal\\n view\\n returns (\\n bool offchain,\\n bytes memory returnData,\\n OffchainLookupExtraData memory extraData,\\n bool result\\n )\\n {\\n if (isSafe) {\\n result = LowLevelCallUtils.functionStaticCall(target, data);\\n } else {\\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\\n }\\n uint256 size = LowLevelCallUtils.returnDataSize();\\n\\n if (result) {\\n return (\\n false,\\n LowLevelCallUtils.readReturnData(0, size),\\n extraData,\\n true\\n );\\n }\\n\\n // Failure\\n if (size >= 4) {\\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\\n // Offchain lookup. Decode the revert message and create our own that nests it.\\n bytes memory revertData = LowLevelCallUtils.readReturnData(\\n 4,\\n size - 4\\n );\\n if (bytes4(errorId) == OffchainLookup.selector) {\\n (\\n address wrappedSender,\\n string[] memory wrappedUrls,\\n bytes memory wrappedCallData,\\n bytes4 wrappedCallbackFunction,\\n bytes memory wrappedExtraData\\n ) = abi.decode(\\n revertData,\\n (address, string[], bytes, bytes4, bytes)\\n );\\n if (wrappedSender == target) {\\n returnData = abi.encode(\\n OffchainLookupCallData(\\n wrappedSender,\\n wrappedUrls,\\n wrappedCallData\\n )\\n );\\n extraData = OffchainLookupExtraData(\\n wrappedCallbackFunction,\\n wrappedExtraData\\n );\\n return (true, returnData, extraData, false);\\n }\\n } else {\\n returnData = bytes.concat(errorId, revertData);\\n return (false, returnData, extraData, false);\\n }\\n }\\n }\\n\\n /**\\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\\n * removing labels until it finds a result.\\n * @param name The name to resolve, in DNS-encoded and normalised form.\\n * @return resolver The Resolver responsible for this name.\\n * @return namehash The namehash of the full name.\\n * @return finalOffset The offset of the first label with a resolver.\\n */\\n function findResolver(\\n bytes calldata name\\n ) public view returns (Resolver, bytes32, uint256) {\\n (\\n address resolver,\\n bytes32 namehash,\\n uint256 finalOffset\\n ) = findResolver(name, 0);\\n return (Resolver(resolver), namehash, finalOffset);\\n }\\n\\n function findResolver(\\n bytes calldata name,\\n uint256 offset\\n ) internal view returns (address, bytes32, uint256) {\\n uint256 labelLength = uint256(uint8(name[offset]));\\n if (labelLength == 0) {\\n return (address(0), bytes32(0), offset);\\n }\\n uint256 nextLabel = offset + labelLength + 1;\\n bytes32 labelHash;\\n if (\\n labelLength == 66 &&\\n // 0x5b == '['\\n name[offset + 1] == 0x5b &&\\n // 0x5d == ']'\\n name[nextLabel - 1] == 0x5d\\n ) {\\n // Encrypted label\\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\\n .hexStringToBytes32(0, 64);\\n } else {\\n labelHash = keccak256(name[offset + 1:nextLabel]);\\n }\\n (\\n address parentresolver,\\n bytes32 parentnode,\\n uint256 parentoffset\\n ) = findResolver(name, nextLabel);\\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\\n address resolver = registry.resolver(node);\\n if (resolver != address(0)) {\\n return (resolver, node, offset);\\n }\\n return (parentresolver, node, parentoffset);\\n }\\n\\n function _checkInterface(\\n address resolver,\\n bytes4 interfaceId\\n ) internal view returns (bool) {\\n try\\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\\n returns (bool supported) {\\n return supported;\\n } catch {\\n return false;\\n }\\n }\\n\\n function _checkSafetyAndItem(\\n bytes memory name,\\n bytes memory item,\\n address resolver,\\n MulticallChecks memory multicallChecks\\n ) internal view returns (bool, bytes memory) {\\n if (!multicallChecks.isCallback) {\\n if (multicallChecks.hasExtendedResolver) {\\n return (\\n true,\\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\\n );\\n }\\n return (_checkInterface(resolver, bytes4(item)), item);\\n }\\n return (true, item);\\n }\\n\\n function _checkMulticall(\\n MulticallData memory multicallData\\n ) internal view returns (MulticallChecks memory) {\\n bool isCallback = multicallData.name.length == 0;\\n bool hasExtendedResolver = _checkInterface(\\n multicallData.resolver,\\n type(IExtendedResolver).interfaceId\\n );\\n\\n if (multicallData.isWildcard && !hasExtendedResolver) {\\n revert ResolverWildcardNotSupported();\\n }\\n\\n return MulticallChecks(isCallback, hasExtendedResolver);\\n }\\n\\n function _checkResolveSingle(Result memory result) internal pure {\\n if (!result.success) {\\n if (bytes4(result.returnData) == HttpError.selector) {\\n bytes memory returnData = result.returnData;\\n assembly {\\n revert(add(returnData, 32), mload(returnData))\\n }\\n }\\n revert ResolverError(result.returnData);\\n }\\n }\\n\\n function _multicall(\\n MulticallData memory multicallData\\n ) internal view returns (Result[] memory results) {\\n uint256 length = multicallData.data.length;\\n uint256 offchainCount = 0;\\n OffchainLookupCallData[]\\n memory callDatas = new OffchainLookupCallData[](length);\\n OffchainLookupExtraData[]\\n memory extraDatas = new OffchainLookupExtraData[](length);\\n results = new Result[](length);\\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\\n\\n for (uint256 i = 0; i < length; i++) {\\n bytes memory item = multicallData.data[i];\\n bool failure = multicallData.failures[i];\\n\\n if (failure) {\\n results[i] = Result(false, item);\\n continue;\\n }\\n\\n bool isSafe = false;\\n (isSafe, item) = _checkSafetyAndItem(\\n multicallData.name,\\n item,\\n multicallData.resolver,\\n multicallChecks\\n );\\n\\n (\\n bool offchain,\\n bytes memory returnData,\\n OffchainLookupExtraData memory extraData,\\n bool success\\n ) = callWithOffchainLookupPropagation(\\n multicallData.resolver,\\n item,\\n isSafe\\n );\\n\\n if (offchain) {\\n callDatas[offchainCount] = abi.decode(\\n returnData,\\n (OffchainLookupCallData)\\n );\\n extraDatas[i] = extraData;\\n offchainCount += 1;\\n continue;\\n }\\n\\n if (success && multicallChecks.hasExtendedResolver) {\\n // if this is a successful resolve() call, unwrap the result\\n returnData = abi.decode(returnData, (bytes));\\n }\\n results[i] = Result(success, returnData);\\n extraDatas[i].data = item;\\n }\\n\\n if (offchainCount == 0) {\\n return results;\\n }\\n\\n // Trim callDatas if offchain data exists\\n assembly {\\n mstore(callDatas, offchainCount)\\n }\\n\\n revert OffchainLookup(\\n address(this),\\n multicallData.gateways,\\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\\n multicallData.callbackFunction,\\n abi.encode(\\n multicallData.isWildcard,\\n multicallData.resolver,\\n multicallData.gateways,\\n multicallData.metaData,\\n extraDatas\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x2a03a3a94a411b599690e58634c2c5695561cbe4a16fae60cbfefa872a6c2f7b\",\"license\":\"MIT\"},\"contracts/wrapper/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes32) {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n}\\n\",\"keccak256\":\"0xf862cd86d749158a554e3cb517efa9097331ec0cf7225117f21e96fb50c67edb\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040523480156200001157600080fd5b5060405162003b0f38038062003b0f8339810160408190526200003491620001da565b6200003f336200006a565b6001600160a01b038216608052805162000061906001906020840190620000ba565b5050506200049c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b82805482825590600052602060002090810192821562000105579160200282015b82811115620001055782518290620000f49082620003d0565b5091602001919060010190620000db565b506200011392915062000117565b5090565b80821115620001135760006200012e828262000138565b5060010162000117565b508054620001469062000341565b6000825580601f1062000157575050565b601f0160209004906000526020600020908101906200017791906200017a565b50565b5b808211156200011357600081556001016200017b565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620001d257620001d262000191565b604052919050565b6000806040808486031215620001ef57600080fd5b83516001600160a01b03811681146200020757600080fd5b602085810151919450906001600160401b03808211156200022757600080fd5b8187019150601f88818401126200023d57600080fd5b82518281111562000252576200025262000191565b8060051b62000263868201620001a7565b918252848101860191868101908c8411156200027e57600080fd5b87870192505b838310156200032e578251868111156200029e5760008081fd5b8701603f81018e13620002b15760008081fd5b8881015187811115620002c857620002c862000191565b620002db818801601f19168b01620001a7565b8181528f8c838501011115620002f15760008081fd5b60005b8281101562000311578381018d01518282018d01528b01620002f4565b5060009181018b0191909152835250918701919087019062000284565b8099505050505050505050509250929050565b600181811c908216806200035657607f821691505b6020821081036200037757634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003cb57600081815260208120601f850160051c81016020861015620003a65750805b601f850160051c820191505b81811015620003c757828155600101620003b2565b5050505b505050565b81516001600160401b03811115620003ec57620003ec62000191565b6200040481620003fd845462000341565b846200037d565b602080601f8311600181146200043c5760008415620004235750858301515b600019600386901b1c1916600185901b178555620003c7565b600085815260208120601f198616915b828110156200046d578886015182559484019460019091019084016200044c565b50858210156200048c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b608051613650620004bf600039600081816101ea01526114fc01526136506000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c80638e5ea8df116100b2578063b241d0d311610081578063e0a8541211610066578063e0a85412146102ec578063ec11c823146102ff578063f2fde38b1461031257600080fd5b8063b241d0d3146102c6578063b4a85801146102d957600080fd5b80638e5ea8df146102485780639061b9231461025b578063a1cbcbaf1461026e578063a6b16419146102a657600080fd5b8063715018a6116101095780637b103999116100ee5780637b103999146101e55780638da5cb5b146102245780638e25a0f31461023557600080fd5b8063715018a6146101c857806376286c00146101d257600080fd5b806301ffc9a71461013b5780630667cfea14610163578063206c74c9146101845780636dc4fb73146101a5575b600080fd5b61014e6101493660046123d3565b610325565b60405190151581526020015b60405180910390f35b6101766101713660046125f3565b61035c565b60405161015a9291906126d1565b61019761019236600461277c565b610392565b60405161015a9291906127e5565b6101b86101b336600461286e565b61047f565b60405161015a94939291906128da565b6101d0610547565b005b6101976101e0366004612916565b61055b565b61020c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161015a565b6000546001600160a01b031661020c565b610176610243366004612975565b610583565b6101d0610256366004612a3b565b610626565b610176610269366004612a78565b610645565b61028161027c366004612ad7565b61073e565b604080516001600160a01b03909416845260208401929092529082015260600161015a565b6102b96102b4366004612b19565b610764565b60405161015a9190612b32565b6101b86102d4366004612b45565b610810565b6101976102e736600461286e565b610902565b6101766102fa36600461286e565b610946565b6101b861030d366004612ad7565b6109b8565b6101d0610320366004612bb9565b610aab565b60006001600160e01b03198216639061b92360e01b148061035657506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060006103848686868663e0a8541260e01b60405180602001604052806000815250610583565b915091505b94509492505050565b606060006104738585856001805480602002602001604051908101604052809291908181526020016000905b8282101561046a5783829060005260206000200180546103dd90612bd6565b80601f016020809104026020016040519081016040528092919081815260200182805461040990612bd6565b80156104565780601f1061042b57610100808354040283529160200191610456565b820191906000526020600020905b81548152906001019060200180831161043957829003601f168201915b5050505050815260200190600101906103be565b5050505061055b565b91509150935093915050565b6060600080808080808061049d8c8c8c8c636dc4fb7360e01b610b40565b93509350935093506000846000815181106104ba576104ba612c10565b602002602001015190506104cd81610ec6565b81511561051f57600080838060200190518101906104eb9190612c6b565b91509150600083602001518060200190518101906105099190612cbd565b929b50919950975093955061053c945050505050565b61052e81602001518585610f51565b985098509850985050505050505b945094509450949050565b61054f6110b2565b610559600061110c565b565b606060006103848686868663b4a8580160e01b60405180602001604052806000815250611174565b6040805160018082528183019092526060916000918291816020015b606081526020019060019003908161059f57905050905086816000815181106105ca576105ca612c10565b60200260200101819052506000806105e68b8b858b8b8b611174565b915091506000826000815181106105ff576105ff612c10565b6020026020010151905061061281610ec6565b602001519b909a5098505050505050505050565b61062e6110b2565b8051610641906001906020840190612300565b5050565b606060006104738585856001805480602002602001604051908101604052809291908181526020016000905b8282101561071d57838290600052602060002001805461069090612bd6565b80601f01602080910402602001604051908101604052809291908181526020018280546106bc90612bd6565b80156107095780601f106106de57610100808354040283529160200191610709565b820191906000526020600020905b8154815290600101906020018083116106ec57829003601f168201915b505050505081526020019060010190610671565b5050505063e0a8541260e01b60405180602001604052806000815250610583565b600080600080600080610753888860006112f5565b919750955093505050509250925092565b6001818154811061077457600080fd5b90600052602060002001600091509050805461078f90612bd6565b80601f01602080910402602001604051908101604052809291908181526020018280546107bb90612bd6565b80156108085780601f106107dd57610100808354040283529160200191610808565b820191906000526020600020905b8154815290600101906020018083116107eb57829003601f168201915b505050505081565b606060008060008061085c600089898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506115a39050565b60405160240161086e91815260200190565b60408051601f19818403018152918152602080830180516001600160e01b03167f691f3431000000000000000000000000000000000000000000000000000000001790528151908101909152600080825291925081906108de908b908b9086908c90636dc4fb7360e01b90610583565b915091506108ed82828a610f51565b96509650965096505050505b93509350935093565b606060008080610935888888887fb4a8580100000000000000000000000000000000000000000000000000000000610b40565b50919a909950975050505050505050565b606060008080610979888888887fe0a8541200000000000000000000000000000000000000000000000000000000610b40565b50509150915060008260008151811061099457610994612c10565b602002602001015190506109a781610ec6565b602001519890975095505050505050565b60606000806000610a9b86866001805480602002602001604051908101604052809291908181526020016000905b82821015610a92578382906000526020600020018054610a0590612bd6565b80601f0160208091040260200160405190810160405280929190818152602001828054610a3190612bd6565b8015610a7e5780601f10610a5357610100808354040283529160200191610a7e565b820191906000526020600020905b815481529060010190602001808311610a6157829003601f168201915b5050505050815260200190600101906109e6565b50505050610810565b9299919850965090945092505050565b610ab36110b2565b6001600160a01b038116610b345760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610b3d8161110c565b50565b60606000606080610ba460405180610100016040528060608152602001606081526020016060815260200160006001600160e01b031916815260200160001515815260200160006001600160a01b0316815260200160608152602001606081525090565b6001600160e01b031986166060820152600080610bc38b8d018d612ce8565b90925090506060610bd68a8c018c612da0565b60c089019190915260408801919091526001600160a01b0390911660a08701529015156080860152805183519192501015610c1057600080fd5b805167ffffffffffffffff811115610c2a57610c2a612439565b604051908082528060200260200182016040528015610c5d57816020015b6060815260200190600190039081610c485790505b506020850152805167ffffffffffffffff811115610c7d57610c7d612439565b604051908082528060200260200182016040528015610ca6578160200160208202803683370190505b5060e08501526000805b8251811015610e94578251600090849083908110610cd057610cd0612c10565b6020026020010151600001516001600160e01b03191603610d2f57828181518110610cfd57610cfd612c10565b60200260200101516020015186602001518281518110610d1f57610d1f612c10565b6020026020010181905250610e82565b848281518110610d4157610d41612c10565b602002602001015115610db85760018660e001518281518110610d6657610d66612c10565b602002602001019015159081151581525050838281518110610d8a57610d8a612c10565b602002602001015186602001518281518110610da857610da8612c10565b6020026020010181905250610e74565b828181518110610dca57610dca612c10565b602002602001015160000151848381518110610de857610de8612c10565b6020026020010151848381518110610e0257610e02612c10565b602002602001015160200151604051602401610e1f929190612f24565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b03838183161783525050505086602001518281518110610e6857610e68612c10565b60200260200101819052505b610e7f826001612f68565b91505b80610e8c81612f7b565b915050610cb0565b50610e9e85611662565b8560a0015186604001518760c001519850985098509850505050505095509550955095915050565b8051610b3d5760208101517fca7a4e750000000000000000000000000000000000000000000000000000000090610efc90612f94565b6001600160e01b03191603610f1957602080820151805190918201fd5b80602001516040517f95c0c752000000000000000000000000000000000000000000000000000000008152600401610b2b9190612b32565b606060008060008087806020019051810190610f6d9190612fcc565b9050600080610f7b83611a50565b91509150600081604051602401610f9491815260200190565b60408051601f19818403018152918152602080830180516001600160e01b03167f3b3b57de000000000000000000000000000000000000000000000000000000001790529051919250600091610fee9187918e91016126d1565b6040516020818303038152906040529050600080306001600160a01b0316638e25a0f387868f636dc4fb7360e01b886040518663ffffffff1660e01b815260040161103d959493929190613056565b600060405180830381865afa15801561105a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110829190810190612c6b565b9150915060008280602001905181019061109c9190612cbd565b979f979e50909b50959950505050505050505050565b6000546001600160a01b031633146105595760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b2b565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606060008060006111858a8a61073e565b919450849350909150506001600160a01b0382166111cf576040517f7199966d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0383163b611210576040517f4981ac0500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516101206020601f8d01819004028201810190925261010081018b8152831515926112e5929182918f908f9081908501838280828437600092019190915250505090825250602081018c9052604081018b90526001600160e01b03198a16606082015283151560808201526001600160a01b03871660a082015260c081018990528b5160e09091019067ffffffffffffffff8111156112b4576112b4612439565b6040519080825280602002602001820160405280156112dd578160200160208202803683370190505b509052611662565b9450505050965096945050505050565b60008060008086868681811061130d5761130d612c10565b919091013560f81c915050600081900361133157506000925082915083905061159a565b600061133d8287612f68565b611348906001612f68565b9050600082604214801561138e57508888611364896001612f68565b81811061137357611373612c10565b9050013560f81c60f81b6001600160f81b031916605b60f81b145b80156113cc575088886113a26001856130bf565b8181106113b1576113b1612c10565b9050013560f81c60f81b6001600160f81b031916605d60f81b145b156114445761143c600060408b8b6113e58c6002612f68565b906113f16001896130bf565b926113fe939291906130d2565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929493925050611c799050565b509050611476565b8888611451896001612f68565b61145d928592906130d2565b60405161146b9291906130fc565b604051809103902090505b60008060006114868c8c876112f5565b925092509250600082856040516020016114aa929190918252602082015260400190565b60408051601f198184030181529082905280516020909101207f0178b8bf0000000000000000000000000000000000000000000000000000000082526004820181905291506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630178b8bf90602401602060405180830381865afa158015611543573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115679190612cbd565b90506001600160a01b0381161561158b579950975089965061159a95505050505050565b50929850919650909450505050505b93509350939050565b60008060006115b28585611dcd565b90925090508161162457600185516115ca91906130bf565b84146116185760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d650000006044820152606401610b2b565b50600091506103569050565b61162e85826115a3565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b6020810151516060906000808267ffffffffffffffff81111561168757611687612439565b6040519080825280602002602001820160405280156116e557816020015b6116d2604051806060016040528060006001600160a01b0316815260200160608152602001606081525090565b8152602001906001900390816116a55790505b50905060008367ffffffffffffffff81111561170357611703612439565b60405190808252806020026020018201604052801561174957816020015b6040805180820190915260008152606060208201528152602001906001900390816117215790505b5090508367ffffffffffffffff81111561176557611765612439565b6040519080825280602002602001820160405280156117ab57816020015b6040805180820190915260008152606060208201528152602001906001900390816117835790505b50945060006117b987611e84565b905060005b8581101561198f576000886020015182815181106117de576117de612c10565b6020026020010151905060008960e00151838151811061180057611800612c10565b60200260200101519050801561184c5760405180604001604052806000151581526020018381525089848151811061183a5761183a612c10565b6020026020010181905250505061197d565b60006118628b60000151848d60a0015188611f1b565b809450819250505060008060008061187f8f60a001518887611fa3565b935093509350935083156118f557828060200190518101906118a1919061318c565b8b8d815181106118b3576118b3612c10565b6020026020010181905250818a89815181106118d1576118d1612c10565b60209081029190910101526118e760018d612f68565b9b505050505050505061197d565b808015611903575088602001515b1561191f578280602001905181019061191c9190612fcc565b92505b60405180604001604052808215158152602001848152508e898151811061194857611948612c10565b6020026020010181905250868a898151811061196657611966612c10565b602002602001015160200181905250505050505050505b8061198781612f7b565b9150506117be565b50836000036119a2575050505050919050565b83835230876040015163a780bab660e01b856040516024016119c49190613287565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b03838183161783525050505089606001518a608001518b60a001518c604001518d60c0015189604051602001611a259594939291906132e9565b60408051601f1981840301815290829052630556f18360e41b8252610b2b95949392916004016133a6565b805160609060009081908490611a67816002612f68565b67ffffffffffffffff811115611a7f57611a7f612439565b6040519080825280601f01601f191660200182016040528015611aa9576020820181803683370190505b50945060009350808403611aee57600060f81b85600081518110611acf57611acf612c10565b60200101906001600160f81b031916908160001a905350505050915091565b60001981015b828181518110611b0657611b06612c10565b01602001517fff00000000000000000000000000000000000000000000000000000000000000167f2e0000000000000000000000000000000000000000000000000000000000000003611bc8578360f81b868260010181518110611b6c57611b6c612c10565b60200101906001600160f81b031916908160001a90535084611b95846001840160ff881661215b565b60408051602081019390935282015260600160405160208183030381529060405280519060200120945060009350611c18565b600184019350828181518110611be057611be0612c10565b602001015160f81c60f81b868260010181518110611c0057611c00612c10565b60200101906001600160f81b031916908160001a9053505b8015611c275760001901611af4565b5083611c3883600060ff871661215b565b6040805160208101939093528201526060016040516020818303038152906040528051906020012093508260f81b85600081518110611acf57611acf612c10565b60008080611c8785856130bf565b905080604014158015611c9b575080602814155b80611cb05750611cac6002826133da565b6001145b15611cfd5760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610b2b565b600191508551841115611d0f57600080fd5b611d60565b6000603a8210602f83111615611d2c5750602f190190565b60478210604083111615611d4257506036190190565b60678210606083111615611d5857506056190190565b5060ff919050565b60208601855b85811015611dc257611d7d8183015160001a611d14565b611d8f6001830184015160001a611d14565b60ff811460ff83141715611da857600095505050611dc2565b60049190911b1760089590951b9490941793600201611d66565b505050935093915050565b60008083518310611e205760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e647300006044820152606401610b2b565b6000848481518110611e3457611e34612c10565b016020015160f81c90508015611e6057611e5985611e53866001612f68565b8361215b565b9250611e65565b600092505b611e6f8185612f68565b611e7a906001612f68565b9150509250929050565b604080518082019091526000808252602082015281515160a0830151901590600090611eb790639061b92360e01b61217f565b905083608001518015611ec8575080155b15611eff576040517f82c2c72800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805180820190915291151582521515602082015292915050565b600060608260000151611f9757826020015115611f7b5760018686604051602401611f47929190612f24565b60408051601f198184030181529190526020810180516001600160e01b0316639061b92360e01b1790529092509050610389565b611f8d84611f8887612f94565b61217f565b8591509150610389565b50600195939450505050565b604080518082019091526000808252606060208301819052909160008415611fd657611fcf8787612204565b9050611fe6565b611fe3878761c350612218565b90505b3d811561200a576000611ffa6000836122ab565b9095509350600191506108f99050565b60048110612151576000612020600060046122ab565b90506000612038600461203381866130bf565b6122ab565b9050630556f18360e41b61204b83612f94565b6001600160e01b031916036121195760008060008060008580602001905181019061207691906133fc565b945094509450945094508e6001600160a01b0316856001600160a01b03160361210f576040518060600160405280866001600160a01b03168152602001858152602001848152506040516020016120cd91906134ac565b60408051601f198184030181528282019091526001600160e01b03199093168152602081019190915260019b509099509750600096506108f995505050505050565b505050505061214e565b818160405160200161212c9291906134bf565b60408051601f198184030181529190526000975095508693506108f992505050565b50505b5093509350935093565b825160009061216a8385612f68565b111561217557600080fd5b5091016020012090565b6040516301ffc9a760e01b81526001600160e01b0319821660048201526000906001600160a01b038416906301ffc9a79061c350906024016020604051808303818786fa935050505080156121f1575060408051601f3d908101601f191682019092526121ee918101906134ee565b60015b6121fd57506000610356565b9050610356565b600061221183835a612218565b9392505050565b60006001600160a01b0384163b6122975760405162461bcd60e51b815260206004820152602e60248201527f4c6f774c6576656c43616c6c5574696c733a207374617469632063616c6c207460448201527f6f206e6f6e2d636f6e74726163740000000000000000000000000000000000006064820152608401610b2b565b6000808451602086018786fa949350505050565b60608167ffffffffffffffff8111156122c6576122c6612439565b6040519080825280601f01601f1916602001820160405280156122f0576020820181803683370190505b5090508183602083013e92915050565b828054828255906000526020600020908101928215612346579160200282015b828111156123465782518290612336908261355a565b5091602001919060010190612320565b50612352929150612356565b5090565b8082111561235257600061236a8282612373565b50600101612356565b50805461237f90612bd6565b6000825580601f1061238f575050565b601f016020900490600052602060002090810190610b3d91905b8082111561235257600081556001016123a9565b6001600160e01b031981168114610b3d57600080fd5b6000602082840312156123e557600080fd5b8135612211816123bd565b60008083601f84011261240257600080fd5b50813567ffffffffffffffff81111561241a57600080fd5b60208301915083602082850101111561243257600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561247257612472612439565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156124a1576124a1612439565b604052919050565b600067ffffffffffffffff8211156124c3576124c3612439565b50601f01601f191660200190565b60006124e46124df846124a9565b612478565b90508281528383830111156124f857600080fd5b828260208301376000602084830101529392505050565b600082601f83011261252057600080fd5b612211838335602085016124d1565b600067ffffffffffffffff82111561254957612549612439565b5060051b60200190565b600082601f83011261256457600080fd5b813560206125746124df8361252f565b82815260059290921b8401810191818101908684111561259357600080fd5b8286015b848110156125e857803567ffffffffffffffff8111156125b75760008081fd5b8701603f810189136125c95760008081fd5b6125da8986830135604084016124d1565b845250918301918301612597565b509695505050505050565b6000806000806060858703121561260957600080fd5b843567ffffffffffffffff8082111561262157600080fd5b61262d888389016123f0565b9096509450602087013591508082111561264657600080fd5b6126528883890161250f565b9350604087013591508082111561266857600080fd5b5061267587828801612553565b91505092959194509250565b60005b8381101561269c578181015183820152602001612684565b50506000910152565b600081518084526126bd816020860160208601612681565b601f01601f19169290920160200192915050565b6040815260006126e460408301856126a5565b90506001600160a01b03831660208301529392505050565b600082601f83011261270d57600080fd5b8135602061271d6124df8361252f565b82815260059290921b8401810191818101908684111561273c57600080fd5b8286015b848110156125e857803567ffffffffffffffff8111156127605760008081fd5b61276e8986838b010161250f565b845250918301918301612740565b60008060006040848603121561279157600080fd5b833567ffffffffffffffff808211156127a957600080fd5b6127b5878388016123f0565b909550935060208601359150808211156127ce57600080fd5b506127db868287016126fc565b9150509250925092565b6000604080830181845280865180835260608601915060608160051b8701019250602080890160005b8381101561284f57888603605f19018552815180511515875283015183870188905261283c888801826126a5565b965050938201939082019060010161280e565b50508395506001600160a01b0388168188015250505050509392505050565b6000806000806040858703121561288457600080fd5b843567ffffffffffffffff8082111561289c57600080fd5b6128a8888389016123f0565b909650945060208701359150808211156128c157600080fd5b506128ce878288016123f0565b95989497509550505050565b6080815260006128ed60808301876126a5565b6001600160a01b0395861660208401529385166040830152509216606090920191909152919050565b6000806000806060858703121561292c57600080fd5b843567ffffffffffffffff8082111561294457600080fd5b612950888389016123f0565b9096509450602087013591508082111561296957600080fd5b612652888389016126fc565b60008060008060008060a0878903121561298e57600080fd5b863567ffffffffffffffff808211156129a657600080fd5b6129b28a838b016123f0565b909850965060208901359150808211156129cb57600080fd5b6129d78a838b0161250f565b955060408901359150808211156129ed57600080fd5b6129f98a838b01612553565b945060608901359150612a0b826123bd565b90925060808801359080821115612a2157600080fd5b50612a2e89828a0161250f565b9150509295509295509295565b600060208284031215612a4d57600080fd5b813567ffffffffffffffff811115612a6457600080fd5b612a7084828501612553565b949350505050565b600080600060408486031215612a8d57600080fd5b833567ffffffffffffffff80821115612aa557600080fd5b612ab1878388016123f0565b90955093506020860135915080821115612aca57600080fd5b506127db8682870161250f565b60008060208385031215612aea57600080fd5b823567ffffffffffffffff811115612b0157600080fd5b612b0d858286016123f0565b90969095509350505050565b600060208284031215612b2b57600080fd5b5035919050565b60208152600061221160208301846126a5565b600080600060408486031215612b5a57600080fd5b833567ffffffffffffffff80821115612b7257600080fd5b612b7e878388016123f0565b90955093506020860135915080821115612b9757600080fd5b506127db86828701612553565b6001600160a01b0381168114610b3d57600080fd5b600060208284031215612bcb57600080fd5b813561221181612ba4565b600181811c90821680612bea57607f821691505b602082108103612c0a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b600082601f830112612c3757600080fd5b8151612c456124df826124a9565b818152846020838601011115612c5a57600080fd5b612a70826020830160208701612681565b60008060408385031215612c7e57600080fd5b825167ffffffffffffffff811115612c9557600080fd5b612ca185828601612c26565b9250506020830151612cb281612ba4565b809150509250929050565b600060208284031215612ccf57600080fd5b815161221181612ba4565b8015158114610b3d57600080fd5b60008060408385031215612cfb57600080fd5b823567ffffffffffffffff80821115612d1357600080fd5b818501915085601f830112612d2757600080fd5b81356020612d376124df8361252f565b82815260059290921b84018101918181019089841115612d5657600080fd5b948201945b83861015612d7d578535612d6e81612cda565b82529482019490820190612d5b565b96505086013592505080821115612d9357600080fd5b50611e7a858286016126fc565b600080600080600060a08688031215612db857600080fd5b612dc28635612cda565b85359450612dd36020870135612ba4565b6020860135935067ffffffffffffffff8060408801351115612df457600080fd5b612e048860408901358901612553565b93508060608801351115612e1757600080fd5b612e27886060890135890161250f565b92508060808801351115612e3a57600080fd5b6080870135870188601f820112612e5057600080fd5b612e5d6124df823561252f565b81358082526020808301929160051b8401018b1015612e7b57600080fd5b602083015b6020843560051b850101811015612f12578481351115612e9f57600080fd5b803584016040818e03601f19011215612eb757600080fd5b612ebf61244f565b612ecc60208301356123bd565b602082013581528660408301351115612ee457600080fd5b612ef78e6020604085013585010161250f565b60208201528085525050602083019250602081019050612e80565b50809450505050509295509295909350565b604081526000612f3760408301856126a5565b8281036020840152612f4981856126a5565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561035657610356612f52565b600060018201612f8d57612f8d612f52565b5060010190565b6000815160208301516001600160e01b031980821693506004831015612fc45780818460040360031b1b83161693505b505050919050565b600060208284031215612fde57600080fd5b815167ffffffffffffffff811115612ff557600080fd5b612a7084828501612c26565b600081518084526020808501808196508360051b8101915082860160005b858110156130495782840389526130378483516126a5565b9885019893509084019060010161301f565b5091979650505050505050565b60a08152600061306960a08301886126a5565b828103602084015261307b81886126a5565b9050828103604084015261308f8187613001565b90506001600160e01b03198516606084015282810360808401526130b381856126a5565b98975050505050505050565b8181038181111561035657610356612f52565b600080858511156130e257600080fd5b838611156130ef57600080fd5b5050820193919092039150565b8183823760009101908152919050565b600082601f83011261311d57600080fd5b8151602061312d6124df8361252f565b82815260059290921b8401810191818101908684111561314c57600080fd5b8286015b848110156125e857805167ffffffffffffffff8111156131705760008081fd5b61317e8986838b0101612c26565b845250918301918301613150565b60006020828403121561319e57600080fd5b815167ffffffffffffffff808211156131b657600080fd5b90830190606082860312156131ca57600080fd5b6040516060810181811083821117156131e5576131e5612439565b60405282516131f381612ba4565b815260208301518281111561320757600080fd5b6132138782860161310c565b60208301525060408301518281111561322b57600080fd5b61323787828601612c26565b60408301525095945050505050565b6001600160a01b038151168252600060208201516060602085015261326e6060850182613001565b905060408301518482036040860152612f4982826126a5565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156132dc57603f198886030184526132ca858351613246565b945092850192908501906001016132ae565b5092979650505050505050565b8515158152600060206001600160a01b03871681840152604060a08185015261331560a0850188613001565b848103606086015261332781886126a5565b905084810360808601528086518083528483019150848160051b84010185890160005b8381101561339357858303601f19018552815180516001600160e01b0319168452880151888401889052613380888501826126a5565b958901959350509087019060010161334a565b50909d9c50505050505050505050505050565b6001600160a01b038616815260a0602082015260006133c860a0830187613001565b828103604084015261308f81876126a5565b6000826133f757634e487b7160e01b600052601260045260246000fd5b500690565b600080600080600060a0868803121561341457600080fd5b855161341f81612ba4565b602087015190955067ffffffffffffffff8082111561343d57600080fd5b61344989838a0161310c565b9550604088015191508082111561345f57600080fd5b61346b89838a01612c26565b94506060880151915061347d826123bd565b60808801519193508082111561349257600080fd5b5061349f88828901612c26565b9150509295509295909350565b6020815260006122116020830184613246565b600083516134d1818460208801612681565b8351908301906134e5818360208801612681565b01949350505050565b60006020828403121561350057600080fd5b815161221181612cda565b601f82111561355557600081815260208120601f850160051c810160208610156135325750805b601f850160051c820191505b818110156135515782815560010161353e565b5050505b505050565b815167ffffffffffffffff81111561357457613574612439565b613588816135828454612bd6565b8461350b565b602080601f8311600181146135bd57600084156135a55750858301515b600019600386901b1c1916600185901b178555613551565b600085815260208120601f198616915b828110156135ec578886015182559484019460019091019084016135cd565b508582101561360a5787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fea2646970667358221220e80dfb43e469138d4ae0942cde3bd29b693f1811b97ac87db578fe698aaae86764736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101365760003560e01c80638e5ea8df116100b2578063b241d0d311610081578063e0a8541211610066578063e0a85412146102ec578063ec11c823146102ff578063f2fde38b1461031257600080fd5b8063b241d0d3146102c6578063b4a85801146102d957600080fd5b80638e5ea8df146102485780639061b9231461025b578063a1cbcbaf1461026e578063a6b16419146102a657600080fd5b8063715018a6116101095780637b103999116100ee5780637b103999146101e55780638da5cb5b146102245780638e25a0f31461023557600080fd5b8063715018a6146101c857806376286c00146101d257600080fd5b806301ffc9a71461013b5780630667cfea14610163578063206c74c9146101845780636dc4fb73146101a5575b600080fd5b61014e6101493660046123d3565b610325565b60405190151581526020015b60405180910390f35b6101766101713660046125f3565b61035c565b60405161015a9291906126d1565b61019761019236600461277c565b610392565b60405161015a9291906127e5565b6101b86101b336600461286e565b61047f565b60405161015a94939291906128da565b6101d0610547565b005b6101976101e0366004612916565b61055b565b61020c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161015a565b6000546001600160a01b031661020c565b610176610243366004612975565b610583565b6101d0610256366004612a3b565b610626565b610176610269366004612a78565b610645565b61028161027c366004612ad7565b61073e565b604080516001600160a01b03909416845260208401929092529082015260600161015a565b6102b96102b4366004612b19565b610764565b60405161015a9190612b32565b6101b86102d4366004612b45565b610810565b6101976102e736600461286e565b610902565b6101766102fa36600461286e565b610946565b6101b861030d366004612ad7565b6109b8565b6101d0610320366004612bb9565b610aab565b60006001600160e01b03198216639061b92360e01b148061035657506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060006103848686868663e0a8541260e01b60405180602001604052806000815250610583565b915091505b94509492505050565b606060006104738585856001805480602002602001604051908101604052809291908181526020016000905b8282101561046a5783829060005260206000200180546103dd90612bd6565b80601f016020809104026020016040519081016040528092919081815260200182805461040990612bd6565b80156104565780601f1061042b57610100808354040283529160200191610456565b820191906000526020600020905b81548152906001019060200180831161043957829003601f168201915b5050505050815260200190600101906103be565b5050505061055b565b91509150935093915050565b6060600080808080808061049d8c8c8c8c636dc4fb7360e01b610b40565b93509350935093506000846000815181106104ba576104ba612c10565b602002602001015190506104cd81610ec6565b81511561051f57600080838060200190518101906104eb9190612c6b565b91509150600083602001518060200190518101906105099190612cbd565b929b50919950975093955061053c945050505050565b61052e81602001518585610f51565b985098509850985050505050505b945094509450949050565b61054f6110b2565b610559600061110c565b565b606060006103848686868663b4a8580160e01b60405180602001604052806000815250611174565b6040805160018082528183019092526060916000918291816020015b606081526020019060019003908161059f57905050905086816000815181106105ca576105ca612c10565b60200260200101819052506000806105e68b8b858b8b8b611174565b915091506000826000815181106105ff576105ff612c10565b6020026020010151905061061281610ec6565b602001519b909a5098505050505050505050565b61062e6110b2565b8051610641906001906020840190612300565b5050565b606060006104738585856001805480602002602001604051908101604052809291908181526020016000905b8282101561071d57838290600052602060002001805461069090612bd6565b80601f01602080910402602001604051908101604052809291908181526020018280546106bc90612bd6565b80156107095780601f106106de57610100808354040283529160200191610709565b820191906000526020600020905b8154815290600101906020018083116106ec57829003601f168201915b505050505081526020019060010190610671565b5050505063e0a8541260e01b60405180602001604052806000815250610583565b600080600080600080610753888860006112f5565b919750955093505050509250925092565b6001818154811061077457600080fd5b90600052602060002001600091509050805461078f90612bd6565b80601f01602080910402602001604051908101604052809291908181526020018280546107bb90612bd6565b80156108085780601f106107dd57610100808354040283529160200191610808565b820191906000526020600020905b8154815290600101906020018083116107eb57829003601f168201915b505050505081565b606060008060008061085c600089898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506115a39050565b60405160240161086e91815260200190565b60408051601f19818403018152918152602080830180516001600160e01b03167f691f3431000000000000000000000000000000000000000000000000000000001790528151908101909152600080825291925081906108de908b908b9086908c90636dc4fb7360e01b90610583565b915091506108ed82828a610f51565b96509650965096505050505b93509350935093565b606060008080610935888888887fb4a8580100000000000000000000000000000000000000000000000000000000610b40565b50919a909950975050505050505050565b606060008080610979888888887fe0a8541200000000000000000000000000000000000000000000000000000000610b40565b50509150915060008260008151811061099457610994612c10565b602002602001015190506109a781610ec6565b602001519890975095505050505050565b60606000806000610a9b86866001805480602002602001604051908101604052809291908181526020016000905b82821015610a92578382906000526020600020018054610a0590612bd6565b80601f0160208091040260200160405190810160405280929190818152602001828054610a3190612bd6565b8015610a7e5780601f10610a5357610100808354040283529160200191610a7e565b820191906000526020600020905b815481529060010190602001808311610a6157829003601f168201915b5050505050815260200190600101906109e6565b50505050610810565b9299919850965090945092505050565b610ab36110b2565b6001600160a01b038116610b345760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610b3d8161110c565b50565b60606000606080610ba460405180610100016040528060608152602001606081526020016060815260200160006001600160e01b031916815260200160001515815260200160006001600160a01b0316815260200160608152602001606081525090565b6001600160e01b031986166060820152600080610bc38b8d018d612ce8565b90925090506060610bd68a8c018c612da0565b60c089019190915260408801919091526001600160a01b0390911660a08701529015156080860152805183519192501015610c1057600080fd5b805167ffffffffffffffff811115610c2a57610c2a612439565b604051908082528060200260200182016040528015610c5d57816020015b6060815260200190600190039081610c485790505b506020850152805167ffffffffffffffff811115610c7d57610c7d612439565b604051908082528060200260200182016040528015610ca6578160200160208202803683370190505b5060e08501526000805b8251811015610e94578251600090849083908110610cd057610cd0612c10565b6020026020010151600001516001600160e01b03191603610d2f57828181518110610cfd57610cfd612c10565b60200260200101516020015186602001518281518110610d1f57610d1f612c10565b6020026020010181905250610e82565b848281518110610d4157610d41612c10565b602002602001015115610db85760018660e001518281518110610d6657610d66612c10565b602002602001019015159081151581525050838281518110610d8a57610d8a612c10565b602002602001015186602001518281518110610da857610da8612c10565b6020026020010181905250610e74565b828181518110610dca57610dca612c10565b602002602001015160000151848381518110610de857610de8612c10565b6020026020010151848381518110610e0257610e02612c10565b602002602001015160200151604051602401610e1f929190612f24565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b03838183161783525050505086602001518281518110610e6857610e68612c10565b60200260200101819052505b610e7f826001612f68565b91505b80610e8c81612f7b565b915050610cb0565b50610e9e85611662565b8560a0015186604001518760c001519850985098509850505050505095509550955095915050565b8051610b3d5760208101517fca7a4e750000000000000000000000000000000000000000000000000000000090610efc90612f94565b6001600160e01b03191603610f1957602080820151805190918201fd5b80602001516040517f95c0c752000000000000000000000000000000000000000000000000000000008152600401610b2b9190612b32565b606060008060008087806020019051810190610f6d9190612fcc565b9050600080610f7b83611a50565b91509150600081604051602401610f9491815260200190565b60408051601f19818403018152918152602080830180516001600160e01b03167f3b3b57de000000000000000000000000000000000000000000000000000000001790529051919250600091610fee9187918e91016126d1565b6040516020818303038152906040529050600080306001600160a01b0316638e25a0f387868f636dc4fb7360e01b886040518663ffffffff1660e01b815260040161103d959493929190613056565b600060405180830381865afa15801561105a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110829190810190612c6b565b9150915060008280602001905181019061109c9190612cbd565b979f979e50909b50959950505050505050505050565b6000546001600160a01b031633146105595760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b2b565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606060008060006111858a8a61073e565b919450849350909150506001600160a01b0382166111cf576040517f7199966d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0383163b611210576040517f4981ac0500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516101206020601f8d01819004028201810190925261010081018b8152831515926112e5929182918f908f9081908501838280828437600092019190915250505090825250602081018c9052604081018b90526001600160e01b03198a16606082015283151560808201526001600160a01b03871660a082015260c081018990528b5160e09091019067ffffffffffffffff8111156112b4576112b4612439565b6040519080825280602002602001820160405280156112dd578160200160208202803683370190505b509052611662565b9450505050965096945050505050565b60008060008086868681811061130d5761130d612c10565b919091013560f81c915050600081900361133157506000925082915083905061159a565b600061133d8287612f68565b611348906001612f68565b9050600082604214801561138e57508888611364896001612f68565b81811061137357611373612c10565b9050013560f81c60f81b6001600160f81b031916605b60f81b145b80156113cc575088886113a26001856130bf565b8181106113b1576113b1612c10565b9050013560f81c60f81b6001600160f81b031916605d60f81b145b156114445761143c600060408b8b6113e58c6002612f68565b906113f16001896130bf565b926113fe939291906130d2565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929493925050611c799050565b509050611476565b8888611451896001612f68565b61145d928592906130d2565b60405161146b9291906130fc565b604051809103902090505b60008060006114868c8c876112f5565b925092509250600082856040516020016114aa929190918252602082015260400190565b60408051601f198184030181529082905280516020909101207f0178b8bf0000000000000000000000000000000000000000000000000000000082526004820181905291506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630178b8bf90602401602060405180830381865afa158015611543573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115679190612cbd565b90506001600160a01b0381161561158b579950975089965061159a95505050505050565b50929850919650909450505050505b93509350939050565b60008060006115b28585611dcd565b90925090508161162457600185516115ca91906130bf565b84146116185760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d650000006044820152606401610b2b565b50600091506103569050565b61162e85826115a3565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b6020810151516060906000808267ffffffffffffffff81111561168757611687612439565b6040519080825280602002602001820160405280156116e557816020015b6116d2604051806060016040528060006001600160a01b0316815260200160608152602001606081525090565b8152602001906001900390816116a55790505b50905060008367ffffffffffffffff81111561170357611703612439565b60405190808252806020026020018201604052801561174957816020015b6040805180820190915260008152606060208201528152602001906001900390816117215790505b5090508367ffffffffffffffff81111561176557611765612439565b6040519080825280602002602001820160405280156117ab57816020015b6040805180820190915260008152606060208201528152602001906001900390816117835790505b50945060006117b987611e84565b905060005b8581101561198f576000886020015182815181106117de576117de612c10565b6020026020010151905060008960e00151838151811061180057611800612c10565b60200260200101519050801561184c5760405180604001604052806000151581526020018381525089848151811061183a5761183a612c10565b6020026020010181905250505061197d565b60006118628b60000151848d60a0015188611f1b565b809450819250505060008060008061187f8f60a001518887611fa3565b935093509350935083156118f557828060200190518101906118a1919061318c565b8b8d815181106118b3576118b3612c10565b6020026020010181905250818a89815181106118d1576118d1612c10565b60209081029190910101526118e760018d612f68565b9b505050505050505061197d565b808015611903575088602001515b1561191f578280602001905181019061191c9190612fcc565b92505b60405180604001604052808215158152602001848152508e898151811061194857611948612c10565b6020026020010181905250868a898151811061196657611966612c10565b602002602001015160200181905250505050505050505b8061198781612f7b565b9150506117be565b50836000036119a2575050505050919050565b83835230876040015163a780bab660e01b856040516024016119c49190613287565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b03838183161783525050505089606001518a608001518b60a001518c604001518d60c0015189604051602001611a259594939291906132e9565b60408051601f1981840301815290829052630556f18360e41b8252610b2b95949392916004016133a6565b805160609060009081908490611a67816002612f68565b67ffffffffffffffff811115611a7f57611a7f612439565b6040519080825280601f01601f191660200182016040528015611aa9576020820181803683370190505b50945060009350808403611aee57600060f81b85600081518110611acf57611acf612c10565b60200101906001600160f81b031916908160001a905350505050915091565b60001981015b828181518110611b0657611b06612c10565b01602001517fff00000000000000000000000000000000000000000000000000000000000000167f2e0000000000000000000000000000000000000000000000000000000000000003611bc8578360f81b868260010181518110611b6c57611b6c612c10565b60200101906001600160f81b031916908160001a90535084611b95846001840160ff881661215b565b60408051602081019390935282015260600160405160208183030381529060405280519060200120945060009350611c18565b600184019350828181518110611be057611be0612c10565b602001015160f81c60f81b868260010181518110611c0057611c00612c10565b60200101906001600160f81b031916908160001a9053505b8015611c275760001901611af4565b5083611c3883600060ff871661215b565b6040805160208101939093528201526060016040516020818303038152906040528051906020012093508260f81b85600081518110611acf57611acf612c10565b60008080611c8785856130bf565b905080604014158015611c9b575080602814155b80611cb05750611cac6002826133da565b6001145b15611cfd5760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610b2b565b600191508551841115611d0f57600080fd5b611d60565b6000603a8210602f83111615611d2c5750602f190190565b60478210604083111615611d4257506036190190565b60678210606083111615611d5857506056190190565b5060ff919050565b60208601855b85811015611dc257611d7d8183015160001a611d14565b611d8f6001830184015160001a611d14565b60ff811460ff83141715611da857600095505050611dc2565b60049190911b1760089590951b9490941793600201611d66565b505050935093915050565b60008083518310611e205760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e647300006044820152606401610b2b565b6000848481518110611e3457611e34612c10565b016020015160f81c90508015611e6057611e5985611e53866001612f68565b8361215b565b9250611e65565b600092505b611e6f8185612f68565b611e7a906001612f68565b9150509250929050565b604080518082019091526000808252602082015281515160a0830151901590600090611eb790639061b92360e01b61217f565b905083608001518015611ec8575080155b15611eff576040517f82c2c72800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805180820190915291151582521515602082015292915050565b600060608260000151611f9757826020015115611f7b5760018686604051602401611f47929190612f24565b60408051601f198184030181529190526020810180516001600160e01b0316639061b92360e01b1790529092509050610389565b611f8d84611f8887612f94565b61217f565b8591509150610389565b50600195939450505050565b604080518082019091526000808252606060208301819052909160008415611fd657611fcf8787612204565b9050611fe6565b611fe3878761c350612218565b90505b3d811561200a576000611ffa6000836122ab565b9095509350600191506108f99050565b60048110612151576000612020600060046122ab565b90506000612038600461203381866130bf565b6122ab565b9050630556f18360e41b61204b83612f94565b6001600160e01b031916036121195760008060008060008580602001905181019061207691906133fc565b945094509450945094508e6001600160a01b0316856001600160a01b03160361210f576040518060600160405280866001600160a01b03168152602001858152602001848152506040516020016120cd91906134ac565b60408051601f198184030181528282019091526001600160e01b03199093168152602081019190915260019b509099509750600096506108f995505050505050565b505050505061214e565b818160405160200161212c9291906134bf565b60408051601f198184030181529190526000975095508693506108f992505050565b50505b5093509350935093565b825160009061216a8385612f68565b111561217557600080fd5b5091016020012090565b6040516301ffc9a760e01b81526001600160e01b0319821660048201526000906001600160a01b038416906301ffc9a79061c350906024016020604051808303818786fa935050505080156121f1575060408051601f3d908101601f191682019092526121ee918101906134ee565b60015b6121fd57506000610356565b9050610356565b600061221183835a612218565b9392505050565b60006001600160a01b0384163b6122975760405162461bcd60e51b815260206004820152602e60248201527f4c6f774c6576656c43616c6c5574696c733a207374617469632063616c6c207460448201527f6f206e6f6e2d636f6e74726163740000000000000000000000000000000000006064820152608401610b2b565b6000808451602086018786fa949350505050565b60608167ffffffffffffffff8111156122c6576122c6612439565b6040519080825280601f01601f1916602001820160405280156122f0576020820181803683370190505b5090508183602083013e92915050565b828054828255906000526020600020908101928215612346579160200282015b828111156123465782518290612336908261355a565b5091602001919060010190612320565b50612352929150612356565b5090565b8082111561235257600061236a8282612373565b50600101612356565b50805461237f90612bd6565b6000825580601f1061238f575050565b601f016020900490600052602060002090810190610b3d91905b8082111561235257600081556001016123a9565b6001600160e01b031981168114610b3d57600080fd5b6000602082840312156123e557600080fd5b8135612211816123bd565b60008083601f84011261240257600080fd5b50813567ffffffffffffffff81111561241a57600080fd5b60208301915083602082850101111561243257600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561247257612472612439565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156124a1576124a1612439565b604052919050565b600067ffffffffffffffff8211156124c3576124c3612439565b50601f01601f191660200190565b60006124e46124df846124a9565b612478565b90508281528383830111156124f857600080fd5b828260208301376000602084830101529392505050565b600082601f83011261252057600080fd5b612211838335602085016124d1565b600067ffffffffffffffff82111561254957612549612439565b5060051b60200190565b600082601f83011261256457600080fd5b813560206125746124df8361252f565b82815260059290921b8401810191818101908684111561259357600080fd5b8286015b848110156125e857803567ffffffffffffffff8111156125b75760008081fd5b8701603f810189136125c95760008081fd5b6125da8986830135604084016124d1565b845250918301918301612597565b509695505050505050565b6000806000806060858703121561260957600080fd5b843567ffffffffffffffff8082111561262157600080fd5b61262d888389016123f0565b9096509450602087013591508082111561264657600080fd5b6126528883890161250f565b9350604087013591508082111561266857600080fd5b5061267587828801612553565b91505092959194509250565b60005b8381101561269c578181015183820152602001612684565b50506000910152565b600081518084526126bd816020860160208601612681565b601f01601f19169290920160200192915050565b6040815260006126e460408301856126a5565b90506001600160a01b03831660208301529392505050565b600082601f83011261270d57600080fd5b8135602061271d6124df8361252f565b82815260059290921b8401810191818101908684111561273c57600080fd5b8286015b848110156125e857803567ffffffffffffffff8111156127605760008081fd5b61276e8986838b010161250f565b845250918301918301612740565b60008060006040848603121561279157600080fd5b833567ffffffffffffffff808211156127a957600080fd5b6127b5878388016123f0565b909550935060208601359150808211156127ce57600080fd5b506127db868287016126fc565b9150509250925092565b6000604080830181845280865180835260608601915060608160051b8701019250602080890160005b8381101561284f57888603605f19018552815180511515875283015183870188905261283c888801826126a5565b965050938201939082019060010161280e565b50508395506001600160a01b0388168188015250505050509392505050565b6000806000806040858703121561288457600080fd5b843567ffffffffffffffff8082111561289c57600080fd5b6128a8888389016123f0565b909650945060208701359150808211156128c157600080fd5b506128ce878288016123f0565b95989497509550505050565b6080815260006128ed60808301876126a5565b6001600160a01b0395861660208401529385166040830152509216606090920191909152919050565b6000806000806060858703121561292c57600080fd5b843567ffffffffffffffff8082111561294457600080fd5b612950888389016123f0565b9096509450602087013591508082111561296957600080fd5b612652888389016126fc565b60008060008060008060a0878903121561298e57600080fd5b863567ffffffffffffffff808211156129a657600080fd5b6129b28a838b016123f0565b909850965060208901359150808211156129cb57600080fd5b6129d78a838b0161250f565b955060408901359150808211156129ed57600080fd5b6129f98a838b01612553565b945060608901359150612a0b826123bd565b90925060808801359080821115612a2157600080fd5b50612a2e89828a0161250f565b9150509295509295509295565b600060208284031215612a4d57600080fd5b813567ffffffffffffffff811115612a6457600080fd5b612a7084828501612553565b949350505050565b600080600060408486031215612a8d57600080fd5b833567ffffffffffffffff80821115612aa557600080fd5b612ab1878388016123f0565b90955093506020860135915080821115612aca57600080fd5b506127db8682870161250f565b60008060208385031215612aea57600080fd5b823567ffffffffffffffff811115612b0157600080fd5b612b0d858286016123f0565b90969095509350505050565b600060208284031215612b2b57600080fd5b5035919050565b60208152600061221160208301846126a5565b600080600060408486031215612b5a57600080fd5b833567ffffffffffffffff80821115612b7257600080fd5b612b7e878388016123f0565b90955093506020860135915080821115612b9757600080fd5b506127db86828701612553565b6001600160a01b0381168114610b3d57600080fd5b600060208284031215612bcb57600080fd5b813561221181612ba4565b600181811c90821680612bea57607f821691505b602082108103612c0a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b600082601f830112612c3757600080fd5b8151612c456124df826124a9565b818152846020838601011115612c5a57600080fd5b612a70826020830160208701612681565b60008060408385031215612c7e57600080fd5b825167ffffffffffffffff811115612c9557600080fd5b612ca185828601612c26565b9250506020830151612cb281612ba4565b809150509250929050565b600060208284031215612ccf57600080fd5b815161221181612ba4565b8015158114610b3d57600080fd5b60008060408385031215612cfb57600080fd5b823567ffffffffffffffff80821115612d1357600080fd5b818501915085601f830112612d2757600080fd5b81356020612d376124df8361252f565b82815260059290921b84018101918181019089841115612d5657600080fd5b948201945b83861015612d7d578535612d6e81612cda565b82529482019490820190612d5b565b96505086013592505080821115612d9357600080fd5b50611e7a858286016126fc565b600080600080600060a08688031215612db857600080fd5b612dc28635612cda565b85359450612dd36020870135612ba4565b6020860135935067ffffffffffffffff8060408801351115612df457600080fd5b612e048860408901358901612553565b93508060608801351115612e1757600080fd5b612e27886060890135890161250f565b92508060808801351115612e3a57600080fd5b6080870135870188601f820112612e5057600080fd5b612e5d6124df823561252f565b81358082526020808301929160051b8401018b1015612e7b57600080fd5b602083015b6020843560051b850101811015612f12578481351115612e9f57600080fd5b803584016040818e03601f19011215612eb757600080fd5b612ebf61244f565b612ecc60208301356123bd565b602082013581528660408301351115612ee457600080fd5b612ef78e6020604085013585010161250f565b60208201528085525050602083019250602081019050612e80565b50809450505050509295509295909350565b604081526000612f3760408301856126a5565b8281036020840152612f4981856126a5565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561035657610356612f52565b600060018201612f8d57612f8d612f52565b5060010190565b6000815160208301516001600160e01b031980821693506004831015612fc45780818460040360031b1b83161693505b505050919050565b600060208284031215612fde57600080fd5b815167ffffffffffffffff811115612ff557600080fd5b612a7084828501612c26565b600081518084526020808501808196508360051b8101915082860160005b858110156130495782840389526130378483516126a5565b9885019893509084019060010161301f565b5091979650505050505050565b60a08152600061306960a08301886126a5565b828103602084015261307b81886126a5565b9050828103604084015261308f8187613001565b90506001600160e01b03198516606084015282810360808401526130b381856126a5565b98975050505050505050565b8181038181111561035657610356612f52565b600080858511156130e257600080fd5b838611156130ef57600080fd5b5050820193919092039150565b8183823760009101908152919050565b600082601f83011261311d57600080fd5b8151602061312d6124df8361252f565b82815260059290921b8401810191818101908684111561314c57600080fd5b8286015b848110156125e857805167ffffffffffffffff8111156131705760008081fd5b61317e8986838b0101612c26565b845250918301918301613150565b60006020828403121561319e57600080fd5b815167ffffffffffffffff808211156131b657600080fd5b90830190606082860312156131ca57600080fd5b6040516060810181811083821117156131e5576131e5612439565b60405282516131f381612ba4565b815260208301518281111561320757600080fd5b6132138782860161310c565b60208301525060408301518281111561322b57600080fd5b61323787828601612c26565b60408301525095945050505050565b6001600160a01b038151168252600060208201516060602085015261326e6060850182613001565b905060408301518482036040860152612f4982826126a5565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156132dc57603f198886030184526132ca858351613246565b945092850192908501906001016132ae565b5092979650505050505050565b8515158152600060206001600160a01b03871681840152604060a08185015261331560a0850188613001565b848103606086015261332781886126a5565b905084810360808601528086518083528483019150848160051b84010185890160005b8381101561339357858303601f19018552815180516001600160e01b0319168452880151888401889052613380888501826126a5565b958901959350509087019060010161334a565b50909d9c50505050505050505050505050565b6001600160a01b038616815260a0602082015260006133c860a0830187613001565b828103604084015261308f81876126a5565b6000826133f757634e487b7160e01b600052601260045260246000fd5b500690565b600080600080600060a0868803121561341457600080fd5b855161341f81612ba4565b602087015190955067ffffffffffffffff8082111561343d57600080fd5b61344989838a0161310c565b9550604088015191508082111561345f57600080fd5b61346b89838a01612c26565b94506060880151915061347d826123bd565b60808801519193508082111561349257600080fd5b5061349f88828901612c26565b9150509295509295909350565b6020815260006122116020830184613246565b600083516134d1818460208801612681565b8351908301906134e5818360208801612681565b01949350505050565b60006020828403121561350057600080fd5b815161221181612cda565b601f82111561355557600081815260208120601f850160051c810160208610156135325750805b601f850160051c820191505b818110156135515782815560010161353e565b5050505b505050565b815167ffffffffffffffff81111561357457613574612439565b613588816135828454612bd6565b8461350b565b602080601f8311600181146135bd57600084156135a55750858301515b600019600386901b1c1916600185901b178555613551565b600085815260208120601f198616915b828110156135ec578886015182559484019460019091019084016135cd565b508582101561360a5787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fea2646970667358221220e80dfb43e469138d4ae0942cde3bd29b693f1811b97ac87db578fe698aaae86764736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "findResolver(bytes)": { + "details": "Finds a resolver by recursively querying the registry, starting at the longest name and progressively removing labels until it finds a result.", + "params": { + "name": "The name to resolve, in DNS-encoded and normalised form." + }, + "returns": { + "_0": "resolver The Resolver responsible for this name.", + "_1": "namehash The namehash of the full name.", + "_2": "finalOffset The offset of the first label with a resolver." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "resolve(bytes,bytes)": { + "details": "Performs ENS name resolution for the supplied name and resolution data.", + "params": { + "data": "The resolution data, as specified in ENSIP-10.", + "name": "The name to resolve, in normalised and DNS-encoded form." + }, + "returns": { + "_0": "The result of resolving the name." + } + }, + "reverse(bytes,string[])": { + "details": "Performs ENS name reverse resolution for the supplied reverse name.", + "params": { + "reverseName": "The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse" + }, + "returns": { + "_0": "The resolved name, the resolved address, the reverse resolver address, and the resolver address." + } + }, + "supportsInterface(bytes4)": { + "details": "See {IERC165-supportsInterface}." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "notice": "The Universal Resolver is a contract that handles the work of resolving a name entirely onchain, making it possible to make a single smart contract call to resolve an ENS name.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 7, + "contract": "contracts/utils/UniversalResolver.sol:UniversalResolver", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 1537, + "contract": "contracts/utils/UniversalResolver.sol:UniversalResolver", + "label": "batchGatewayURLs", + "offset": 0, + "slot": "1", + "type": "t_array(t_string_storage)dyn_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_string_storage)dyn_storage": { + "base": "t_string_storage", + "encoding": "dynamic_array", + "label": "string[]", + "numberOfBytes": "32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/solcInputs/2286d90f0970dc1d34ef122ce5b9cee1.json b/solidity/dns-contracts/deployments/holesky/solcInputs/2286d90f0970dc1d34ef122ce5b9cee1.json new file mode 100644 index 0000000..3dda390 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/solcInputs/2286d90f0970dc1d34ef122ce5b9cee1.json @@ -0,0 +1,449 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (iter.name().compareNames(buf.buf) != 0) continue;\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(\n uint16 _expectedType,\n bytes memory _expectedName,\n uint32 _inception,\n uint64 _inserted,\n bytes memory _proof\n ) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if (_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(\n uint16 dnstype,\n bytes memory name\n ) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyExtendedDNSSECResolver is IExtendedDNSResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes memory /* name */,\n bytes memory /* data */,\n bytes memory context\n ) external view override returns (bytes memory) {\n return abi.encode(context);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyLegacyTextResolver is ITextResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(ITextResolver).interfaceId;\n }\n\n function text(\n bytes32 /* node */,\n string calldata key\n ) external view override returns (string memory) {\n return key;\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyNonCCIPAwareResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../OffchainDNSResolver.sol\";\nimport \"../../resolvers/profiles/IExtendedResolver.sol\";\n\ncontract DummyNonCCIPAwareResolver is IExtendedResolver, ERC165 {\n OffchainDNSResolver dnsResolver;\n\n constructor(OffchainDNSResolver _dnsResolver) {\n dnsResolver = _dnsResolver;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(dnsResolver),\n urls,\n data,\n OffchainDNSResolver.resolveCallback.selector,\n data\n );\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyParser.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../dnssec-oracle/BytesUtils.sol\";\nimport \"../RecordParser.sol\";\n\ncontract DummyParser {\n using BytesUtils for bytes;\n\n // parse data in format: name;key1=value1 key2=value2;url\n function parseData(\n bytes memory data,\n uint256 kvCount\n )\n external\n pure\n returns (\n string memory name,\n string[] memory keys,\n string[] memory values,\n string memory url\n )\n {\n uint256 len = data.length;\n // retrieve name\n uint256 sep1 = data.find(0, len, \";\");\n name = string(data.substring(0, sep1));\n\n // retrieve url\n uint256 sep2 = data.find(sep1 + 1, len - sep1, \";\");\n url = string(data.substring(sep2 + 1, len - sep2 - 1));\n\n keys = new string[](kvCount);\n values = new string[](kvCount);\n // retrieve keys and values\n uint256 offset = sep1 + 1;\n for (uint256 i; i < kvCount && offset < len; i++) {\n (\n bytes memory key,\n bytes memory val,\n uint256 nextOffset\n ) = RecordParser.readKeyValue(data, offset, sep2 - offset);\n keys[i] = string(key);\n values[i] = string(val);\n offset = nextOffset;\n }\n }\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"../utils/LowLevelCallUtils.sol\";\n\nerror InvalidOperation();\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver, IERC165 {\n using RRUtils for *;\n using Address for address;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedResolver).interfaceId;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n revertWithDefaultOffchainLookup(name, data);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query, bytes4 selector) = abi.decode(\n extraData,\n (bytes, bytes, bytes4)\n );\n\n if (selector != bytes4(0)) {\n (bytes memory targetData, address targetResolver) = abi.decode(\n query,\n (bytes, address)\n );\n return\n callWithOffchainLookupPropagation(\n targetResolver,\n name,\n query,\n abi.encodeWithSelector(\n selector,\n response,\n abi.encode(targetData, address(this))\n )\n );\n }\n\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n callWithOffchainLookupPropagation(\n dnsresolver,\n name,\n query,\n abi.encodeCall(\n IExtendedDNSResolver.resolve,\n (name, query, context)\n )\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return\n callWithOffchainLookupPropagation(\n dnsresolver,\n name,\n query,\n abi.encodeCall(\n IExtendedResolver.resolve,\n (name, query)\n )\n );\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory name,\n bytes memory innerdata,\n bytes memory data\n ) internal view returns (bytes memory) {\n if (!target.isContract()) {\n revertWithDefaultOffchainLookup(name, innerdata);\n }\n\n bool result = LowLevelCallUtils.functionStaticCall(\n address(target),\n data\n );\n uint256 size = LowLevelCallUtils.returnDataSize();\n if (result) {\n bytes memory returnData = LowLevelCallUtils.readReturnData(0, size);\n return abi.decode(returnData, (bytes));\n }\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n if (bytes4(errorId) == OffchainLookup.selector) {\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n handleOffchainLookupError(revertData, target, name);\n }\n }\n LowLevelCallUtils.propagateRevert();\n }\n\n function revertWithDefaultOffchainLookup(\n bytes memory name,\n bytes memory data\n ) internal view {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, data, bytes4(0))\n );\n }\n\n function handleOffchainLookupError(\n bytes memory returnData,\n address target,\n bytes memory name\n ) internal view {\n (\n address sender,\n string[] memory urls,\n bytes memory callData,\n bytes4 innerCallbackFunction,\n bytes memory extraData\n ) = abi.decode(returnData, (address, string[], bytes, bytes4, bytes));\n\n if (sender != target) {\n revert InvalidOperation();\n }\n\n revert OffchainLookup(\n address(this),\n urls,\n callData,\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, extraData, innerCallbackFunction)\n );\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (bytes memory key, bytes memory value, uint256 nextOffset)\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = len + offset;\n nextOffset = terminator;\n } else {\n nextOffset = terminator + 1;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n event SuffixAdded(bytes suffix);\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n emit SuffixAdded(names[i]);\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256[3] memory P) {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (uint256 x, uint256 y, uint256 z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(\n uint256 x0,\n uint256 y0\n ) internal pure returns (bool isZero) {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(\n uint256 scalar\n ) internal pure returns (uint256, uint256) {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(\n bytes calldata,\n bytes calldata\n ) external pure override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input\n )\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n )\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(\n RRUtils.SignedSet memory rrset,\n uint16 typecovered\n ) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if (address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns (bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 {\n totallen := add(totallen, 64)\n }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for {\n let i := 0\n } lt(i, totallen) {\n i := add(i, 64)\n } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 {\n mstore8(add(scratch, sub(len, i)), 0x80)\n }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 {\n mstore(\n add(scratch, 32),\n or(mload(add(scratch, 32)), mul(len, 8))\n )\n }\n\n // Expand the 16 32-bit words into 80\n for {\n let j := 64\n } lt(j, 128) {\n j := add(j, 12)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 12))),\n mload(add(scratch, sub(j, 32)))\n ),\n xor(\n mload(add(scratch, sub(j, 56))),\n mload(add(scratch, sub(j, 64)))\n )\n )\n temp := or(\n and(\n mul(temp, 2),\n 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE\n ),\n and(\n div(temp, 0x80000000),\n 0x0000000100000001000000010000000100000001000000010000000100000001\n )\n )\n mstore(add(scratch, j), temp)\n }\n for {\n let j := 128\n } lt(j, 320) {\n j := add(j, 24)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 24))),\n mload(add(scratch, sub(j, 64)))\n ),\n xor(\n mload(add(scratch, sub(j, 112))),\n mload(add(scratch, sub(j, 128)))\n )\n )\n temp := or(\n and(\n mul(temp, 4),\n 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC\n ),\n and(\n div(temp, 0x40000000),\n 0x0000000300000003000000030000000300000003000000030000000300000003\n )\n )\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for {\n let j := 0\n } lt(j, 80) {\n j := add(j, 1)\n } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(\n div(x, 0x100000000000000000000),\n div(x, 0x10000000000)\n )\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := and(div(x, 0x10000000000), f)\n f := or(\n and(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n ),\n f\n )\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(\n div(\n x,\n 0x80000000000000000000000000000000000000000000000\n ),\n 0x1F\n )\n temp := or(\n and(\n div(x, 0x800000000000000000000000000000000000000),\n 0xFFFFFFE0\n ),\n temp\n )\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(\n div(\n mload(add(scratch, mul(j, 4))),\n 0x100000000000000000000000000000000000000000000000000000000\n ),\n temp\n )\n x := or(\n div(x, 0x10000000000),\n mul(temp, 0x10000000000000000000000000000000000000000)\n )\n x := or(\n and(\n x,\n 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF\n ),\n mul(\n or(\n and(div(x, 0x4000000000000), 0xC0000000),\n and(div(x, 0x400000000000000000000), 0x3FFFFFFF)\n ),\n 0x100000000000000000000\n )\n )\n }\n\n h := and(\n add(h, x),\n 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF\n )\n }\n ret := mul(\n or(\n or(\n or(\n or(\n and(\n div(h, 0x100000000),\n 0xFFFFFFFF00000000000000000000000000000000\n ),\n and(\n div(h, 0x1000000),\n 0xFFFFFFFF000000000000000000000000\n )\n ),\n and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)\n ),\n and(div(h, 0x100), 0xFFFFFFFF00000000)\n ),\n and(h, 0xFFFFFFFF)\n ),\n 0x1000000000000000000000000\n )\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror ResolverRequiredWhenReverseRecord();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (resolver == address(0) && reverseRecord == true) {\n revert ResolverRequiredWhenReverseRecord();\n }\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/ILinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface ILinearPremiumPriceOracle {\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256);\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns (address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping(bytes32 => address) addresses;\n\n constructor() public {}\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Implements a dummy NameWrapper which returns the caller's address\n */\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"../../resolvers/profiles/IAddressResolver.sol\";\nimport \"../../resolvers/profiles/IAddrResolver.sol\";\nimport \"../../utils/HexUtils.sol\";\n\ncontract ExtendedDNSResolver is IExtendedDNSResolver, IERC165 {\n using HexUtils for *;\n\n uint256 private constant COIN_TYPE_ETH = 60;\n\n error NotImplemented();\n error InvalidAddressFormat();\n\n function supportsInterface(\n bytes4 interfaceId\n ) external view virtual override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data,\n bytes calldata context\n ) external pure override returns (bytes memory) {\n bytes4 selector = bytes4(data);\n if (\n selector == IAddrResolver.addr.selector ||\n selector == IAddressResolver.addr.selector\n ) {\n if (selector == IAddressResolver.addr.selector) {\n (, uint256 coinType) = abi.decode(data[4:], (bytes32, uint256));\n if (coinType != COIN_TYPE_ETH) return abi.encode(\"\");\n }\n (address record, bool valid) = context.hexToAddress(\n 2,\n context.length\n );\n if (!valid) revert InvalidAddressFormat();\n return abi.encode(record);\n }\n revert NotImplemented();\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ReverseClaimer\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/utils/DummyRevertResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ncontract DummyRevertResolver {\n function resolve(\n bytes calldata,\n bytes calldata\n ) external pure returns (bytes memory) {\n revert(\"Not Supported\");\n }\n\n function supportsInterface(bytes4) external pure returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n uint256 hexLength = lastIdx - idx;\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\n revert(\"Invalid string length\");\n }\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n return functionStaticCall(target, data, gasleft());\n }\n\n /**\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @param gasLimit The gas limit to use for the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n uint256 gasLimit\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gasLimit,\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/TestHexUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {HexUtils} from \"./HexUtils.sol\";\n\ncontract TestHexUtils {\n using HexUtils for *;\n\n function hexStringToBytes32(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes32, bool) {\n return name.hexStringToBytes32(idx, lastInx);\n }\n\n function hexToAddress(\n bytes calldata input,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (address, bool) {\n return input.hexToAddress(idx, lastInx);\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(\n string memory name\n ) public pure returns (bytes memory, bytes32) {\n return name.dnsEncodeName();\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nerror ResolverNotContract();\n\nerror ResolverError(bytes returnData);\n\nerror HttpError(HttpErrorItem[] errors);\n\nstruct HttpErrorItem {\n uint16 status;\n string message;\n}\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct MulticallChecks {\n bool isCallback;\n bool hasExtendedResolver;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\nstruct Result {\n bool success;\n bytes returnData;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (Result[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (Result[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (Result[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (Result[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n if (!resolverAddress.isContract()) {\n revert ResolverNotContract();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory reverseResolvedData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n reverseResolvedData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (Result[] memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n Result[] memory results,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n Result memory result = results[0];\n\n if (!result.success) {\n revert ResolverError(result.returnData);\n }\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(result.returnData, (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n result.returnData,\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (Result[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data,\n bool isSafe\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n if (isSafe) {\n result = LowLevelCallUtils.functionStaticCall(target, data);\n } else {\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\n }\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _checkInterface(\n address resolver,\n bytes4 interfaceId\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _checkSafetyAndItem(\n bytes memory name,\n bytes memory item,\n address resolver,\n MulticallChecks memory multicallChecks\n ) internal view returns (bool, bytes memory) {\n if (!multicallChecks.isCallback) {\n if (multicallChecks.hasExtendedResolver) {\n return (\n true,\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\n );\n }\n return (_checkInterface(resolver, bytes4(item)), item);\n }\n return (true, item);\n }\n\n function _checkMulticall(\n MulticallData memory multicallData\n ) internal view returns (MulticallChecks memory) {\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _checkInterface(\n multicallData.resolver,\n type(IExtendedResolver).interfaceId\n );\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n return MulticallChecks(isCallback, hasExtendedResolver);\n }\n\n function _checkResolveSingle(Result memory result) internal pure {\n if (!result.success) {\n if (bytes4(result.returnData) == HttpError.selector) {\n bytes memory returnData = result.returnData;\n assembly {\n revert(add(returnData, 32), mload(returnData))\n }\n }\n revert ResolverError(result.returnData);\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (Result[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new Result[](length);\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n\n if (failure) {\n results[i] = Result(false, item);\n continue;\n }\n\n bool isSafe = false;\n (isSafe, item) = _checkSafetyAndItem(\n multicallData.name,\n item,\n multicallData.resolver,\n multicallChecks\n );\n\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(\n multicallData.resolver,\n item,\n isSafe\n );\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && multicallChecks.hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = Result(success, returnData);\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(\n name,\n wrappedOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable,\n ReverseClaimer\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE and set expiry to max */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the owner of a name\n * @param id Namehash of the name\n * @return operator Approved operator of a name\n */\n\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /**\n * @notice Approves an address for a name\n * @param to address to approve\n * @param tokenId name to approve\n */\n\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or operator of the owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or operator\n */\n\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Checks if owner/operator or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner/operator or approved\n */\n\n function canExtendSubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public returns (uint64 expiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // Set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (!_isWrapped(node)) {\n revert NameIsNotWrapped();\n }\n\n // this flag is used later, when checking fuses\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // Max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n address approved = getApproved(uint256(node));\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(parentNode, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /**\n * @notice Checks if a name is wrapped in a more gas efficient way\n * @param parentNode Namehash of the name\n * @param labelhash Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != ETH_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + }, + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external view override returns (bool) {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32, uint256) {\n return name.readLabel(offset);\n }\n\n function namehash(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32) {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\n \"\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n require(\n \"foo\".keccak(0, 3) ==\n bytes32(\n 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d\n ),\n \"Incorrect hash of 'foo'\"\n );\n require(\n \"foo\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\n \"hello\".equals(1, \"ello\") == true,\n \"Substring to string equality\"\n );\n require(\n \"hello\".equals(1, \"jello\", 1, 4) == true,\n \"Substring to substring equality\"\n );\n require(\n \"zhello\".equals(1, \"abchello\", 3) == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"0x0102030000\".equals(0, \"0x010203\") == false,\n \"Compare with offset and trailing bytes\"\n );\n }\n\n function testComparePartial() public pure {\n require(\n \"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true,\n \"Compare same length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true,\n \"Compare different length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true,\n \"Compare same with different offset\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 33\n ) ==\n 0 ==\n true,\n \"Compare different long strings same length smaller partial length which must be equal\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 34\n ) <\n 0 ==\n true,\n \"Compare long strings same length different partial length\"\n );\n require(\n \"0123456789012345012345678901234a\".compare(\n 0,\n 32,\n \"0123456789012345012345678901234b\",\n 0,\n 32\n ) <\n 0 ==\n true,\n \"Compare strings exactly 32 characters long\"\n );\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\n \"a\".compare(\"b\") < 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"b\".compare(\"a\") > 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"aa\".compare(\"ab\") < 0 == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"a\".compare(\"aa\") < 0 == true,\n \"Compare different value with different length\"\n );\n require(\n \"aa\".compare(\"a\") > 0 == true,\n \"Compare different value with different length\"\n );\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(\n longChar.compare(longChar) == 0 == true,\n \"Compares more than 32 bytes char\"\n );\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(\n longChar.compare(otherLongChar) < 0 == true,\n \"Compare long char with difference at start\"\n );\n }\n\n function testSubstring() public pure {\n require(\n keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")),\n \"Copy 0 bytes\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 4))) ==\n keccak256(bytes(\"hell\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(1, 4))) ==\n keccak256(bytes(\"ello\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 5))) ==\n keccak256(bytes(\"hello\")),\n \"Copy whole string\"\n );\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(\n bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) ==\n bytes32(\n 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000\n ),\n \"readBytes20\"\n );\n }\n\n function testReadBytes32() public pure {\n require(\n \"0123456789abcdef0123456789abcdef\".readBytes32(0) ==\n bytes32(\n 0x3031323334353637383961626364656630313233343536373839616263646566\n ),\n \"readBytes32\"\n );\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\n \"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")),\n \"Decode 'a'\"\n );\n require(\n \"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")),\n \"Decode 'aa'\"\n );\n require(\n \"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")),\n \"Decode 'aaa'\"\n );\n require(\n \"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")),\n \"Decode 'aaaa'\"\n );\n require(\n \"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa'\"\n );\n require(\n \"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa' lowercase\"\n );\n require(\n \"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet\"\n );\n require(\n \"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet lowercase\"\n );\n require(\n \"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\"\n .base32HexDecodeWord(0, 52) ==\n bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"),\n \"Decode 32*'a'\"\n );\n require(\n \" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\"\n .base32HexDecodeWord(1, 32) ==\n bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"),\n \"Decode real bytes32hex\"\n );\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex\"00\".nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex\"00\".labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex\"016100\".labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(\n hex\"016201610000\".labelCount(0) == 2,\n \"labelCount('b.a.') == 2\"\n );\n require(\n hex\"066574686c61620378797a00\".labelCount(6 + 1) == 1,\n \"nameLength('(bthlab).xyz.') == 6\"\n );\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes\n memory rrs = hex\"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101\";\n bytes[2] memory names = [bytes(hex\"016100\"), bytes(hex\"0162016100\")];\n bytes[2] memory rdatas = [bytes(hex\"74000001\"), bytes(hex\"c0a80101\")];\n uint i = 0;\n for (\n RRUtils.RRIterator memory iter = rrs.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(\n keccak256(iter.name()) == keccak256(names[i]),\n \"Name matches\"\n );\n require(\n keccak256(iter.rdata()) == keccak256(rdatas[i]),\n \"Rdata matches\"\n );\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex\"066274686c61620378797a00\";\n bytes memory ethLabXyz = hex\"066574686c61620378797a00\";\n bytes memory xyz = hex\"0378797a00\";\n bytes memory a_b_c = hex\"01610162016300\";\n bytes memory b_b_c = hex\"01620162016300\";\n bytes memory c = hex\"016300\";\n bytes memory d = hex\"016400\";\n bytes memory a_d_c = hex\"01610164016300\";\n bytes memory b_a_c = hex\"01620161016300\";\n bytes memory ab_c_d = hex\"0261620163016400\";\n bytes memory a_c_d = hex\"01610163016400\";\n bytes\n memory verylong1_eth = hex\"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n bytes\n memory verylong2_eth = hex\"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n\n require(\n hex\"0301616100\".compareNames(hex\"0302616200\") < 0,\n \"label lengths are correctly checked\"\n );\n require(\n a_b_c.compareNames(c) > 0,\n \"one name has a difference of >1 label to with the same root name\"\n );\n require(\n a_b_c.compareNames(d) < 0,\n \"one name has a difference of >1 label to with different root name\"\n );\n require(\n a_b_c.compareNames(a_d_c) < 0,\n \"two names start the same but have differences in later labels\"\n );\n require(\n a_b_c.compareNames(b_a_c) > 0,\n \"the first label sorts later, but the first label sorts earlier\"\n );\n require(\n ab_c_d.compareNames(a_c_d) > 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(\n a_b_c.compareNames(b_b_c) < 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(\n bthLabXyz.compareNames(ethLabXyz) < 0,\n \"bthLab.xyz comes before ethLab.xyz\"\n );\n require(\n bthLabXyz.compareNames(bthLabXyz) == 0,\n \"bthLab.xyz and bthLab.xyz are the same\"\n );\n require(\n ethLabXyz.compareNames(bthLabXyz) > 0,\n \"ethLab.xyz comes after bethLab.xyz\"\n );\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(\n verylong1_eth.compareNames(verylong2_eth) > 0,\n \"longa.vlong.eth comes after long.vlong.eth\"\n );\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(\n RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA),\n \"0x11111111 >= 0xAAAAAAAA\"\n );\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(\n hex\"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d\"\n .computeKeytag() == 19036,\n \"Invalid keytag\"\n );\n require(\n hex\"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf\"\n .computeKeytag() == 21693,\n \"Invalid keytag (2)\"\n );\n require(\n hex\"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3\"\n .computeKeytag() == 33630\n );\n require(\n hex\"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5\"\n .computeKeytag() == 20326,\n \"Invalid keytag (3)\"\n );\n }\n}\n" + }, + "test/registry/mocks/DummyResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyResolver {\n mapping(bytes32 => string) public name;\n\n function setName(bytes32 node, string memory _name) public {\n name[node] = _name;\n }\n}\n" + }, + "test/reverseRegistrar/mocks/MockReverseClaimerImplementer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../../../contracts/registry/ENS.sol\";\nimport {ReverseClaimer} from \"../../../contracts/reverseRegistrar/ReverseClaimer.sol\";\n\ncontract MockReverseClaimerImplementer is ReverseClaimer {\n constructor(ENS ens, address claimant) ReverseClaimer(ens, claimant) {}\n}\n" + }, + "test/utils/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n if (bytes4(extraData) == bytes4(keccak256(\"name(bytes32)\"))) {\n return abi.encode(\"offchain.test.eth\");\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "test/utils/mocks/LegacyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\ncontract LegacyResolver {\n function addr(bytes32 /* node */) public view returns (address) {\n return address(this);\n }\n}\n" + }, + "test/utils/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10 ** uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10 ** uint256(decimals()));\n }\n }\n}\n" + }, + "test/utils/mocks/MockOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract MockOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n MockOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (, bytes memory callData, ) = abi.decode(\n extraData,\n (bytes, bytes, bytes4)\n );\n if (bytes4(callData) == bytes4(keccak256(\"addr(bytes32)\"))) {\n (bytes memory result, , ) = abi.decode(\n response,\n (bytes, uint64, bytes)\n );\n return result;\n }\n return abi.encode(address(this));\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/holesky/solcInputs/49f758ec505ff69b72f3179ac11d7cfc.json b/solidity/dns-contracts/deployments/holesky/solcInputs/49f758ec505ff69b72f3179ac11d7cfc.json new file mode 100644 index 0000000..51bd823 --- /dev/null +++ b/solidity/dns-contracts/deployments/holesky/solcInputs/49f758ec505ff69b72f3179ac11d7cfc.json @@ -0,0 +1,101 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n uint256 hexLength = lastIdx - idx;\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\n revert(\"Invalid string length\");\n }\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n return functionStaticCall(target, data, gasleft());\n }\n\n /**\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @param gasLimit The gas limit to use for the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n uint256 gasLimit\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gasLimit,\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nerror ResolverNotContract();\n\nerror ResolverError(bytes returnData);\n\nerror HttpError(HttpErrorItem[] errors);\n\nstruct HttpErrorItem {\n uint16 status;\n string message;\n}\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct MulticallChecks {\n bool isCallback;\n bool hasExtendedResolver;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\nstruct Result {\n bool success;\n bytes returnData;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (Result[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (Result[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (Result[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (Result[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n if (!resolverAddress.isContract()) {\n revert ResolverNotContract();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory reverseResolvedData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n reverseResolvedData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (Result[] memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n Result[] memory results,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(result.returnData, (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n result.returnData,\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (Result[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data,\n bool isSafe\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n if (isSafe) {\n result = LowLevelCallUtils.functionStaticCall(target, data);\n } else {\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\n }\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _checkInterface(\n address resolver,\n bytes4 interfaceId\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _checkSafetyAndItem(\n bytes memory name,\n bytes memory item,\n address resolver,\n MulticallChecks memory multicallChecks\n ) internal view returns (bool, bytes memory) {\n if (!multicallChecks.isCallback) {\n if (multicallChecks.hasExtendedResolver) {\n return (\n true,\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\n );\n }\n return (_checkInterface(resolver, bytes4(item)), item);\n }\n return (true, item);\n }\n\n function _checkMulticall(\n MulticallData memory multicallData\n ) internal view returns (MulticallChecks memory) {\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _checkInterface(\n multicallData.resolver,\n type(IExtendedResolver).interfaceId\n );\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n return MulticallChecks(isCallback, hasExtendedResolver);\n }\n\n function _checkResolveSingle(Result memory result) internal pure {\n if (!result.success) {\n if (bytes4(result.returnData) == HttpError.selector) {\n bytes memory returnData = result.returnData;\n assembly {\n revert(add(returnData, 32), mload(returnData))\n }\n }\n revert ResolverError(result.returnData);\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (Result[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new Result[](length);\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n\n if (failure) {\n results[i] = Result(false, item);\n continue;\n }\n\n bool isSafe = false;\n (isSafe, item) = _checkSafetyAndItem(\n multicallData.name,\n item,\n multicallData.resolver,\n multicallChecks\n );\n\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(\n multicallData.resolver,\n item,\n isSafe\n );\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && multicallChecks.hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = Result(success, returnData);\n extraDatas[i].data = item;\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/.chainId b/solidity/dns-contracts/deployments/mainnet/.chainId new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/.chainId @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/.migrations.json b/solidity/dns-contracts/deployments/mainnet/.migrations.json new file mode 100644 index 0000000..05607de --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/.migrations.json @@ -0,0 +1,5 @@ +{ + "ens": 1626404011, + "root": 1580387832, + "setupRoot": 1580387832 +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/BaseRegistrarImplementation.json b/solidity/dns-contracts/deployments/mainnet/BaseRegistrarImplementation.json new file mode 100644 index 0000000..48df272 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/BaseRegistrarImplementation.json @@ -0,0 +1,756 @@ +{ + "address": "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_baseNode", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "ControllerAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "ControllerRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameMigrated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRenewed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "GRACE_PERIOD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "addController", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "available", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "baseNode", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "nameExpires", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "reclaim", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "register", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "registerOnly", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "removeController", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ] +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/DNSRegistrar.json b/solidity/dns-contracts/deployments/mainnet/DNSRegistrar.json new file mode 100644 index 0000000..d6492a1 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/DNSRegistrar.json @@ -0,0 +1,447 @@ +{ + "address": "0xB32cB5677a7C971689228EC835800432B339bA2B", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_previousRegistrar", + "type": "address" + }, + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "contract DNSSEC", + "name": "_dnssec", + "type": "address" + }, + { + "internalType": "contract PublicSuffixList", + "name": "_suffixes", + "type": "address" + }, + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "InvalidPublicSuffix", + "type": "error" + }, + { + "inputs": [], + "name": "NoOwnerRecordFound", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "offset", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "OffsetOutOfBoundsError", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "PermissionDenied", + "type": "error" + }, + { + "inputs": [], + "name": "PreconditionNotMet", + "type": "error" + }, + { + "inputs": [], + "name": "StaleProof", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "dnsname", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "inception", + "type": "uint32" + } + ], + "name": "Claim", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "suffixes", + "type": "address" + } + ], + "name": "NewPublicSuffixList", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "domain", + "type": "bytes" + } + ], + "name": "enableNode", + "outputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "inceptions", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract DNSSEC", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "previousRegistrar", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature[]", + "name": "input", + "type": "tuple[]" + } + ], + "name": "proveAndClaim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature[]", + "name": "input", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "proveAndClaimWithResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "resolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract PublicSuffixList", + "name": "_suffixes", + "type": "address" + } + ], + "name": "setPublicSuffixList", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "suffixes", + "outputs": [ + { + "internalType": "contract PublicSuffixList", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x5ddb98103acbe8b5a68ac1b7e45abbddda5dff8ff2b65c5ed26e36cf34bec43e", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0xB32cB5677a7C971689228EC835800432B339bA2B", + "transactionIndex": 32, + "gasUsed": "1957892", + "logsBloom": "0x00080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000100000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x68fbaf4525e996d170cc181078aae224e20e0729313fdc879f53409a20572b74", + "transactionHash": "0x5ddb98103acbe8b5a68ac1b7e45abbddda5dff8ff2b65c5ed26e36cf34bec43e", + "logs": [ + { + "transactionIndex": 32, + "blockNumber": 19027588, + "transactionHash": "0x5ddb98103acbe8b5a68ac1b7e45abbddda5dff8ff2b65c5ed26e36cf34bec43e", + "address": "0xB32cB5677a7C971689228EC835800432B339bA2B", + "topics": [ + "0x9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba8" + ], + "data": "0x000000000000000000000000823bda9ca8c47d072376ecd595530c8fb2faa3ed", + "logIndex": 104, + "blockHash": "0x68fbaf4525e996d170cc181078aae224e20e0729313fdc879f53409a20572b74" + } + ], + "blockNumber": 19027588, + "cumulativeGasUsed": "5118017", + "status": 1, + "byzantium": true + }, + "args": [ + "0x58774bb8acd458a640af0b88238369a167546ef2", + "0xF142B308cF687d4358410a4cB885513b30A42025", + "0x0fc3152971714E5ed7723FAFa650F86A4BaF30C5", + "0x823BDa9cA8c47d072376eCD595530c8fb2fAa3ED", + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "numDeployments": 7, + "solcInputHash": "a57ee6145a733d774c1e1946fd5c16b8", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_previousRegistrar\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_resolver\",\"type\":\"address\"},{\"internalType\":\"contract DNSSEC\",\"name\":\"_dnssec\",\"type\":\"address\"},{\"internalType\":\"contract PublicSuffixList\",\"name\":\"_suffixes\",\"type\":\"address\"},{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"InvalidPublicSuffix\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoOwnerRecordFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"offset\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"OffsetOutOfBoundsError\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"PermissionDenied\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PreconditionNotMet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StaleProof\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"dnsname\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"inception\",\"type\":\"uint32\"}],\"name\":\"Claim\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"suffixes\",\"type\":\"address\"}],\"name\":\"NewPublicSuffixList\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"domain\",\"type\":\"bytes\"}],\"name\":\"enableNode\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"inceptions\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract DNSSEC\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"previousRegistrar\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature[]\",\"name\":\"input\",\"type\":\"tuple[]\"}],\"name\":\"proveAndClaim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature[]\",\"name\":\"input\",\"type\":\"tuple[]\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"proveAndClaimWithResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"resolver\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract PublicSuffixList\",\"name\":\"_suffixes\",\"type\":\"address\"}],\"name\":\"setPublicSuffixList\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"suffixes\",\"outputs\":[{\"internalType\":\"contract PublicSuffixList\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"An ENS registrar that allows the owner of a DNS name to claim the corresponding name in ENS.\",\"kind\":\"dev\",\"methods\":{\"proveAndClaim(bytes,(bytes,bytes)[])\":{\"details\":\"Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\",\"params\":{\"input\":\"A chain of signed DNS RRSETs ending with a text record.\",\"name\":\"The name to claim, in DNS wire format.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnsregistrar/DNSRegistrar.sol\":\"DNSRegistrar\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-2-Clause\\npragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for appending to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n let fpm := add(32, add(ptr, capacity))\\n if lt(fpm, ptr) {\\n revert(0, 0)\\n }\\n mstore(0x40, fpm)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n uint off = buf.buf.length;\\n uint newCapacity = off + len;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(newCapacity, buflen) {\\n mstore(bufptr, newCapacity)\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return append(buf, data, data.length);\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint offPlusOne = off + 1;\\n if (off >= buf.capacity) {\\n resize(buf, offPlusOne * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if gt(offPlusOne, mload(bufptr)) {\\n mstore(bufptr, offPlusOne)\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return append(buf, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return append(buf, data, 32);\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n return buf;\\n }\\n}\\n\",\"keccak256\":\"0xd6dd3b0b327288f8e1b711a609f4040fea602e2ad4bba9febdf2f33b4e56eb0c\",\"license\":\"BSD-2-Clause\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/dnsregistrar/DNSClaimChecker.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"../dnssec-oracle/DNSSEC.sol\\\";\\nimport \\\"../dnssec-oracle/BytesUtils.sol\\\";\\nimport \\\"../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"../utils/HexUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\nlibrary DNSClaimChecker {\\n using BytesUtils for bytes;\\n using HexUtils for bytes;\\n using RRUtils for *;\\n using Buffer for Buffer.buffer;\\n\\n uint16 constant CLASS_INET = 1;\\n uint16 constant TYPE_TXT = 16;\\n\\n function getOwnerAddress(\\n bytes memory name,\\n bytes memory data\\n ) internal pure returns (address, bool) {\\n // Add \\\"_ens.\\\" to the front of the name.\\n Buffer.buffer memory buf;\\n buf.init(name.length + 5);\\n buf.append(\\\"\\\\x04_ens\\\");\\n buf.append(name);\\n\\n for (\\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\\n !iter.done();\\n iter.next()\\n ) {\\n if (iter.name().compareNames(buf.buf) != 0) continue;\\n bool found;\\n address addr;\\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\\n if (found) {\\n return (addr, true);\\n }\\n }\\n\\n return (address(0x0), false);\\n }\\n\\n function parseRR(\\n bytes memory rdata,\\n uint256 idx,\\n uint256 endIdx\\n ) internal pure returns (address, bool) {\\n while (idx < endIdx) {\\n uint256 len = rdata.readUint8(idx);\\n idx += 1;\\n\\n bool found;\\n address addr;\\n (addr, found) = parseString(rdata, idx, len);\\n\\n if (found) return (addr, true);\\n idx += len;\\n }\\n\\n return (address(0x0), false);\\n }\\n\\n function parseString(\\n bytes memory str,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (address, bool) {\\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\\n return str.hexToAddress(idx + 4, idx + len);\\n }\\n}\\n\",\"keccak256\":\"0x8269236f2a421e278e3e9642d2a5c29545993e8a4586a2592067155822d59069\",\"license\":\"MIT\"},\"contracts/dnsregistrar/DNSRegistrar.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\nimport \\\"../dnssec-oracle/BytesUtils.sol\\\";\\nimport \\\"../dnssec-oracle/DNSSEC.sol\\\";\\nimport \\\"../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"../registry/ENSRegistry.sol\\\";\\nimport \\\"../root/Root.sol\\\";\\nimport \\\"../resolvers/profiles/AddrResolver.sol\\\";\\nimport \\\"./DNSClaimChecker.sol\\\";\\nimport \\\"./PublicSuffixList.sol\\\";\\nimport \\\"./IDNSRegistrar.sol\\\";\\n\\n/**\\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\\n * corresponding name in ENS.\\n */\\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\\n using BytesUtils for bytes;\\n using Buffer for Buffer.buffer;\\n using RRUtils for *;\\n\\n ENS public immutable ens;\\n DNSSEC public immutable oracle;\\n PublicSuffixList public suffixes;\\n address public immutable previousRegistrar;\\n address public immutable resolver;\\n // A mapping of the most recent signatures seen for each claimed domain.\\n mapping(bytes32 => uint32) public inceptions;\\n\\n error NoOwnerRecordFound();\\n error PermissionDenied(address caller, address owner);\\n error PreconditionNotMet();\\n error StaleProof();\\n error InvalidPublicSuffix(bytes name);\\n\\n struct OwnerRecord {\\n bytes name;\\n address owner;\\n address resolver;\\n uint64 ttl;\\n }\\n\\n event Claim(\\n bytes32 indexed node,\\n address indexed owner,\\n bytes dnsname,\\n uint32 inception\\n );\\n event NewPublicSuffixList(address suffixes);\\n\\n constructor(\\n address _previousRegistrar,\\n address _resolver,\\n DNSSEC _dnssec,\\n PublicSuffixList _suffixes,\\n ENS _ens\\n ) {\\n previousRegistrar = _previousRegistrar;\\n resolver = _resolver;\\n oracle = _dnssec;\\n suffixes = _suffixes;\\n emit NewPublicSuffixList(address(suffixes));\\n ens = _ens;\\n }\\n\\n /**\\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\\n */\\n modifier onlyOwner() {\\n Root root = Root(ens.owner(bytes32(0)));\\n address owner = root.owner();\\n require(msg.sender == owner);\\n _;\\n }\\n\\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\\n suffixes = _suffixes;\\n emit NewPublicSuffixList(address(suffixes));\\n }\\n\\n /**\\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\\n * @param name The name to claim, in DNS wire format.\\n * @param input A chain of signed DNS RRSETs ending with a text record.\\n */\\n function proveAndClaim(\\n bytes memory name,\\n DNSSEC.RRSetWithSignature[] memory input\\n ) public override {\\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\\n name,\\n input\\n );\\n ens.setSubnodeOwner(rootNode, labelHash, addr);\\n }\\n\\n function proveAndClaimWithResolver(\\n bytes memory name,\\n DNSSEC.RRSetWithSignature[] memory input,\\n address resolver,\\n address addr\\n ) public override {\\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\\n name,\\n input\\n );\\n if (msg.sender != owner) {\\n revert PermissionDenied(msg.sender, owner);\\n }\\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\\n if (addr != address(0)) {\\n if (resolver == address(0)) {\\n revert PreconditionNotMet();\\n }\\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\\n // Set the resolver record\\n AddrResolver(resolver).setAddr(node, addr);\\n }\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure override returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IDNSRegistrar).interfaceId;\\n }\\n\\n function _claim(\\n bytes memory name,\\n DNSSEC.RRSetWithSignature[] memory input\\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\\n\\n // Get the first label\\n uint256 labelLen = name.readUint8(0);\\n labelHash = name.keccak(1, labelLen);\\n\\n bytes memory parentName = name.substring(\\n labelLen + 1,\\n name.length - labelLen - 1\\n );\\n\\n // Make sure the parent name is enabled\\n parentNode = enableNode(parentName);\\n\\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\\n revert StaleProof();\\n }\\n inceptions[node] = inception;\\n\\n bool found;\\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\\n if (!found) {\\n revert NoOwnerRecordFound();\\n }\\n\\n emit Claim(node, addr, name, inception);\\n }\\n\\n function enableNode(bytes memory domain) public returns (bytes32 node) {\\n // Name must be in the public suffix list.\\n if (!suffixes.isPublicSuffix(domain)) {\\n revert InvalidPublicSuffix(domain);\\n }\\n return _enableNode(domain, 0);\\n }\\n\\n function _enableNode(\\n bytes memory domain,\\n uint256 offset\\n ) internal returns (bytes32 node) {\\n uint256 len = domain.readUint8(offset);\\n if (len == 0) {\\n return bytes32(0);\\n }\\n\\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\\n bytes32 label = domain.keccak(offset + 1, len);\\n node = keccak256(abi.encodePacked(parentNode, label));\\n address owner = ens.owner(node);\\n if (owner == address(0) || owner == previousRegistrar) {\\n if (parentNode == bytes32(0)) {\\n Root root = Root(ens.owner(bytes32(0)));\\n root.setSubnodeOwner(label, address(this));\\n ens.setResolver(node, resolver);\\n } else {\\n ens.setSubnodeRecord(\\n parentNode,\\n label,\\n address(this),\\n resolver,\\n 0\\n );\\n }\\n } else if (owner != address(this)) {\\n revert PreconditionNotMet();\\n }\\n return node;\\n }\\n}\\n\",\"keccak256\":\"0x9140c28eee7f8dff1cc0a2380e9b57db3203c8c0d187245ab3595f4e4cbdebce\",\"license\":\"MIT\"},\"contracts/dnsregistrar/IDNSRegistrar.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"../dnssec-oracle/DNSSEC.sol\\\";\\n\\ninterface IDNSRegistrar {\\n function proveAndClaim(\\n bytes memory name,\\n DNSSEC.RRSetWithSignature[] memory input\\n ) external;\\n\\n function proveAndClaimWithResolver(\\n bytes memory name,\\n DNSSEC.RRSetWithSignature[] memory input,\\n address resolver,\\n address addr\\n ) external;\\n}\\n\",\"keccak256\":\"0xcf6607fe4918cabb1c4c2130597dd9cc0f63492564b05de60496eb46873a73b7\",\"license\":\"MIT\"},\"contracts/dnsregistrar/PublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\ninterface PublicSuffixList {\\n function isPublicSuffix(bytes calldata name) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x12158ba8838ee2b1ebb0178a52d2f4d54dcc68282d569226e62afc2b0dccbbac\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/DNSSEC.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nabstract contract DNSSEC {\\n bytes public anchors;\\n\\n struct RRSetWithSignature {\\n bytes rrset;\\n bytes sig;\\n }\\n\\n event AlgorithmUpdated(uint8 id, address addr);\\n event DigestUpdated(uint8 id, address addr);\\n\\n function verifyRRSet(\\n RRSetWithSignature[] memory input\\n ) external view virtual returns (bytes memory rrs, uint32 inception);\\n\\n function verifyRRSet(\\n RRSetWithSignature[] memory input,\\n uint256 now\\n ) public view virtual returns (bytes memory rrs, uint32 inception);\\n}\\n\",\"keccak256\":\"0xee6a236a59e5db8418c98ee4640a91987d26533c02d305cc6c7a37a3ac4ee907\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n */\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint256 labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes memory ret) {\\n uint256 len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint256 labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint256 constant RRSIG_TYPE = 0;\\n uint256 constant RRSIG_ALGORITHM = 2;\\n uint256 constant RRSIG_LABELS = 3;\\n uint256 constant RRSIG_TTL = 4;\\n uint256 constant RRSIG_EXPIRATION = 8;\\n uint256 constant RRSIG_INCEPTION = 12;\\n uint256 constant RRSIG_KEY_TAG = 16;\\n uint256 constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(\\n bytes memory data\\n ) internal pure returns (SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(\\n RRSIG_SIGNER_NAME + self.signerName.length,\\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\\n );\\n }\\n\\n function rrs(\\n SignedSet memory rrset\\n ) internal pure returns (RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint256 offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint256 rdataOffset;\\n uint256 nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns (bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint256 rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.offset,\\n nameLength(iter.data, iter.offset)\\n );\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(\\n RRIterator memory iter\\n ) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.rdataOffset,\\n iter.nextOffset - iter.rdataOffset\\n );\\n }\\n\\n uint256 constant DNSKEY_FLAGS = 0;\\n uint256 constant DNSKEY_PROTOCOL = 2;\\n uint256 constant DNSKEY_ALGORITHM = 3;\\n uint256 constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(\\n offset + DNSKEY_PUBKEY,\\n length - DNSKEY_PUBKEY\\n );\\n }\\n\\n uint256 constant DS_KEY_TAG = 0;\\n uint256 constant DS_ALGORITHM = 2;\\n uint256 constant DS_DIGEST_TYPE = 3;\\n uint256 constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n function isSubdomainOf(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n uint256 off = 0;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n while (counts > othercounts) {\\n off = progress(self, off);\\n counts--;\\n }\\n\\n return self.equals(off, other, 0);\\n }\\n\\n function compareNames(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint256 off;\\n uint256 otheroff;\\n uint256 prevoff;\\n uint256 otherprevoff;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if (otheroff == 0) {\\n return 1;\\n }\\n\\n return\\n self.compare(\\n prevoff + 1,\\n self.readUint8(prevoff),\\n other,\\n otherprevoff + 1,\\n other.readUint8(otherprevoff)\\n );\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(\\n uint32 i1,\\n uint32 i2\\n ) internal pure returns (bool) {\\n unchecked {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n }\\n\\n function progress(\\n bytes memory body,\\n uint256 off\\n ) internal pure returns (uint256) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint256 ac1;\\n uint256 ac2;\\n for (uint256 i = 0; i < data.length + 31; i += 32) {\\n uint256 word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if (i + 32 > data.length) {\\n uint256 unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 +=\\n (word &\\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\\n 8;\\n ac2 += (word &\\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 =\\n (ac1 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac1 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac2 =\\n (ac2 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac2 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 =\\n (ac1 &\\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\\n 32);\\n ac1 =\\n (ac1 &\\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\\n 64);\\n ac1 =\\n (ac1 &\\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\\n (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4dd68a6efd7c38f6b0e95ca0c056ecb74f88583da650b1a8639e6e78be36fede\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/registry/ENSRegistry.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"./ENS.sol\\\";\\n\\n/**\\n * The ENS registry contract.\\n */\\ncontract ENSRegistry is ENS {\\n struct Record {\\n address owner;\\n address resolver;\\n uint64 ttl;\\n }\\n\\n mapping(bytes32 => Record) records;\\n mapping(address => mapping(address => bool)) operators;\\n\\n // Permits modifications only by the owner of the specified node.\\n modifier authorised(bytes32 node) {\\n address owner = records[node].owner;\\n require(owner == msg.sender || operators[owner][msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Constructs a new ENS registry.\\n */\\n constructor() public {\\n records[0x0].owner = msg.sender;\\n }\\n\\n /**\\n * @dev Sets the record for a node.\\n * @param node The node to update.\\n * @param owner The address of the new owner.\\n * @param resolver The address of the resolver.\\n * @param ttl The TTL in seconds.\\n */\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external virtual override {\\n setOwner(node, owner);\\n _setResolverAndTTL(node, resolver, ttl);\\n }\\n\\n /**\\n * @dev Sets the record for a subnode.\\n * @param node The parent node.\\n * @param label The hash of the label specifying the subnode.\\n * @param owner The address of the new owner.\\n * @param resolver The address of the resolver.\\n * @param ttl The TTL in seconds.\\n */\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external virtual override {\\n bytes32 subnode = setSubnodeOwner(node, label, owner);\\n _setResolverAndTTL(subnode, resolver, ttl);\\n }\\n\\n /**\\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\\n * @param node The node to transfer ownership of.\\n * @param owner The address of the new owner.\\n */\\n function setOwner(\\n bytes32 node,\\n address owner\\n ) public virtual override authorised(node) {\\n _setOwner(node, owner);\\n emit Transfer(node, owner);\\n }\\n\\n /**\\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\\n * @param node The parent node.\\n * @param label The hash of the label specifying the subnode.\\n * @param owner The address of the new owner.\\n */\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) public virtual override authorised(node) returns (bytes32) {\\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\\n _setOwner(subnode, owner);\\n emit NewOwner(node, label, owner);\\n return subnode;\\n }\\n\\n /**\\n * @dev Sets the resolver address for the specified node.\\n * @param node The node to update.\\n * @param resolver The address of the resolver.\\n */\\n function setResolver(\\n bytes32 node,\\n address resolver\\n ) public virtual override authorised(node) {\\n emit NewResolver(node, resolver);\\n records[node].resolver = resolver;\\n }\\n\\n /**\\n * @dev Sets the TTL for the specified node.\\n * @param node The node to update.\\n * @param ttl The TTL in seconds.\\n */\\n function setTTL(\\n bytes32 node,\\n uint64 ttl\\n ) public virtual override authorised(node) {\\n emit NewTTL(node, ttl);\\n records[node].ttl = ttl;\\n }\\n\\n /**\\n * @dev Enable or disable approval for a third party (\\\"operator\\\") to manage\\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\\n * @param operator Address to add to the set of authorized operators.\\n * @param approved True if the operator is approved, false to revoke approval.\\n */\\n function setApprovalForAll(\\n address operator,\\n bool approved\\n ) external virtual override {\\n operators[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev Returns the address that owns the specified node.\\n * @param node The specified node.\\n * @return address of the owner.\\n */\\n function owner(\\n bytes32 node\\n ) public view virtual override returns (address) {\\n address addr = records[node].owner;\\n if (addr == address(this)) {\\n return address(0x0);\\n }\\n\\n return addr;\\n }\\n\\n /**\\n * @dev Returns the address of the resolver for the specified node.\\n * @param node The specified node.\\n * @return address of the resolver.\\n */\\n function resolver(\\n bytes32 node\\n ) public view virtual override returns (address) {\\n return records[node].resolver;\\n }\\n\\n /**\\n * @dev Returns the TTL of a node, and any records associated with it.\\n * @param node The specified node.\\n * @return ttl of the node.\\n */\\n function ttl(bytes32 node) public view virtual override returns (uint64) {\\n return records[node].ttl;\\n }\\n\\n /**\\n * @dev Returns whether a record has been imported to the registry.\\n * @param node The specified node.\\n * @return Bool if record exists\\n */\\n function recordExists(\\n bytes32 node\\n ) public view virtual override returns (bool) {\\n return records[node].owner != address(0x0);\\n }\\n\\n /**\\n * @dev Query if an address is an authorized operator for another address.\\n * @param owner The address that owns the records.\\n * @param operator The address that acts on behalf of the owner.\\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\\n */\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view virtual override returns (bool) {\\n return operators[owner][operator];\\n }\\n\\n function _setOwner(bytes32 node, address owner) internal virtual {\\n records[node].owner = owner;\\n }\\n\\n function _setResolverAndTTL(\\n bytes32 node,\\n address resolver,\\n uint64 ttl\\n ) internal {\\n if (resolver != records[node].resolver) {\\n records[node].resolver = resolver;\\n emit NewResolver(node, resolver);\\n }\\n\\n if (ttl != records[node].ttl) {\\n records[node].ttl = ttl;\\n emit NewTTL(node, ttl);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa7a7a64fb980e521c991415e416fd4106a42f892479805e1daa51ecb0e2e5198\"},\"contracts/resolvers/ResolverBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"./profiles/IVersionableResolver.sol\\\";\\n\\nabstract contract ResolverBase is ERC165, IVersionableResolver {\\n mapping(bytes32 => uint64) public recordVersions;\\n\\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\\n\\n modifier authorised(bytes32 node) {\\n require(isAuthorised(node));\\n _;\\n }\\n\\n /**\\n * Increments the record version associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function clearRecords(bytes32 node) public virtual authorised(node) {\\n recordVersions[node]++;\\n emit VersionChanged(node, recordVersions[node]);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IVersionableResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x893049fffd6feee06d7acef1680f6e26505bedff62a9f7a17e921c0ba2f66307\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/AddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IAddrResolver.sol\\\";\\nimport \\\"./IAddressResolver.sol\\\";\\n\\nabstract contract AddrResolver is\\n IAddrResolver,\\n IAddressResolver,\\n ResolverBase\\n{\\n uint256 private constant COIN_TYPE_ETH = 60;\\n\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\\n\\n /**\\n * Sets the address associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param a The address to set.\\n */\\n function setAddr(\\n bytes32 node,\\n address a\\n ) external virtual authorised(node) {\\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\\n }\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(\\n bytes32 node\\n ) public view virtual override returns (address payable) {\\n bytes memory a = addr(node, COIN_TYPE_ETH);\\n if (a.length == 0) {\\n return payable(0);\\n }\\n return bytesToAddress(a);\\n }\\n\\n function setAddr(\\n bytes32 node,\\n uint256 coinType,\\n bytes memory a\\n ) public virtual authorised(node) {\\n emit AddressChanged(node, coinType, a);\\n if (coinType == COIN_TYPE_ETH) {\\n emit AddrChanged(node, bytesToAddress(a));\\n }\\n versionable_addresses[recordVersions[node]][node][coinType] = a;\\n }\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) public view virtual override returns (bytes memory) {\\n return versionable_addresses[recordVersions[node]][node][coinType];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IAddrResolver).interfaceId ||\\n interfaceID == type(IAddressResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function bytesToAddress(\\n bytes memory b\\n ) internal pure returns (address payable a) {\\n require(b.length == 20);\\n assembly {\\n a := div(mload(add(b, 32)), exp(256, 12))\\n }\\n }\\n\\n function addressToBytes(address a) internal pure returns (bytes memory b) {\\n b = new bytes(20);\\n assembly {\\n mstore(add(b, 32), mul(a, exp(256, 12)))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7f6ebb3144530a02db03379f33ade869c8408eceed36dfbd751aaff198735b55\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IVersionableResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IVersionableResolver {\\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\\n\\n function recordVersions(bytes32 node) external view returns (uint64);\\n}\\n\",\"keccak256\":\"0xd0d09596f20c57bafb2ffa8521a8c57120e9af6c6b194f9c689d4da56f91a57c\",\"license\":\"MIT\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"},\"contracts/root/Root.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"./Controllable.sol\\\";\\n\\ncontract Root is Ownable, Controllable {\\n bytes32 private constant ROOT_NODE = bytes32(0);\\n\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n\\n event TLDLocked(bytes32 indexed label);\\n\\n ENS public ens;\\n mapping(bytes32 => bool) public locked;\\n\\n constructor(ENS _ens) public {\\n ens = _ens;\\n }\\n\\n function setSubnodeOwner(\\n bytes32 label,\\n address owner\\n ) external onlyController {\\n require(!locked[label]);\\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\\n }\\n\\n function setResolver(address resolver) external onlyOwner {\\n ens.setResolver(ROOT_NODE, resolver);\\n }\\n\\n function lock(bytes32 label) external onlyOwner {\\n emit TLDLocked(label);\\n locked[label] = true;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return interfaceID == INTERFACE_META_ID;\\n }\\n}\\n\",\"keccak256\":\"0x469b281e1a9e1c3dad9c860a4ab3a7299a48355b0b0243713e0829193c39f50c\"},\"contracts/utils/HexUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary HexUtils {\\n /**\\n * @dev Attempts to parse bytes32 from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexStringToBytes32(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (bytes32 r, bool valid) {\\n uint256 hexLength = lastIdx - idx;\\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\\n revert(\\\"Invalid string length\\\");\\n }\\n valid = true;\\n assembly {\\n // check that the index to read to is not past the end of the string\\n if gt(lastIdx, mload(str)) {\\n revert(0, 0)\\n }\\n\\n function getHex(c) -> ascii {\\n // chars 48-57: 0-9\\n if and(gt(c, 47), lt(c, 58)) {\\n ascii := sub(c, 48)\\n leave\\n }\\n // chars 65-70: A-F\\n if and(gt(c, 64), lt(c, 71)) {\\n ascii := add(sub(c, 65), 10)\\n leave\\n }\\n // chars 97-102: a-f\\n if and(gt(c, 96), lt(c, 103)) {\\n ascii := add(sub(c, 97), 10)\\n leave\\n }\\n // invalid char\\n ascii := 0xff\\n }\\n\\n let ptr := add(str, 32)\\n for {\\n let i := idx\\n } lt(i, lastIdx) {\\n i := add(i, 2)\\n } {\\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\\n // if either byte is invalid, set invalid and break loop\\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\\n valid := false\\n break\\n }\\n let combined := or(shl(4, byte1), byte2)\\n r := or(shl(8, r), combined)\\n }\\n }\\n }\\n\\n /**\\n * @dev Attempts to parse an address from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexToAddress(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (address, bool) {\\n if (lastIdx - idx < 40) return (address(0x0), false);\\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\\n return (address(uint160(uint256(r))), valid);\\n }\\n}\\n\",\"keccak256\":\"0x4a8a9c72d6f3effb80b310faa6dc273e7adbc3b949df9c7a42e290e5b13519f3\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101006040523480156200001257600080fd5b50604051620023e1380380620023e18339810160408190526200003591620000c8565b6001600160a01b0385811660c05284811660e05283811660a052600080546001600160a01b03191691841691821790556040519081527f9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba89060200160405180910390a16001600160a01b0316608052506200014892505050565b6001600160a01b0381168114620000c557600080fd5b50565b600080600080600060a08688031215620000e157600080fd5b8551620000ee81620000af565b60208701519095506200010181620000af565b60408701519094506200011481620000af565b60608701519093506200012781620000af565b60808701519092506200013a81620000af565b809150509295509295909350565b60805160a05160c05160e051612213620001ce6000396000818160fb01528181610cde0152610d950152600081816102320152610b6301526000818161020b01526108020152600081816101c301528181610397015281816104f8015281816106b301528181610ae301528181610bba01528181610d060152610dc401526122136000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c806329d56630116100815780636f9512211161005b5780636f951221146101e55780637dc0d1d014610206578063ab14ec591461022d57600080fd5b806329d566301461019857806330349ebe146101ab5780633f15457f146101be57600080fd5b806306963218116100b257806306963218146101355780631ecfc4111461014a57806325916d411461015d57600080fd5b806301ffc9a7146100ce57806304f3bcec146100f6575b600080fd5b6100e16100dc366004611a75565b610254565b60405190151581526020015b60405180910390f35b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100ed565b610148610143366004611cb7565b6102ed565b005b610148610158366004611d40565b6104df565b61018361016b366004611d5d565b60016020526000908152604090205463ffffffff1681565b60405163ffffffff90911681526020016100ed565b6101486101a6366004611d76565b610656565b60005461011d906001600160a01b031681565b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b6101f86101f3366004611dda565b61072a565b6040519081526020016100ed565b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a70000000000000000000000000000000000000000000000000000000014806102e757507fffffffff0000000000000000000000000000000000000000000000000000000082167f2f43542800000000000000000000000000000000000000000000000000000000145b92915050565b60008060006102fc87876107f8565b91945092509050336001600160a01b0382161461035b576040517fe03f60240000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03821660248201526044015b60405180910390fd5b6040516305ef2c7f60e41b815260048101849052602481018390526001600160a01b0382811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156103db57600080fd5b505af11580156103ef573d6000803e3d6000fd5b505050506001600160a01b038416156104d6576001600160a01b03851661042957604051633c584f1360e21b815260040160405180910390fd5b604080516020810185905290810183905260009060600160408051808303601f190181529082905280516020909101207fd5fa2b00000000000000000000000000000000000000000000000000000000008252600482018190526001600160a01b03878116602484015290925087169063d5fa2b0090604401600060405180830381600087803b1580156104bc57600080fd5b505af11580156104d0573d6000803e3d6000fd5b50505050505b50505050505050565b6040516302571be360e01b8152600060048201819052907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610547573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056b9190611e0f565b90506000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d19190611e0f565b9050336001600160a01b038216146105e857600080fd5b600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0385169081179091556040519081527f9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba89060200160405180910390a1505050565b600080600061066585856107f8565b6040517f06ab592300000000000000000000000000000000000000000000000000000000815260048101849052602481018390526001600160a01b03828116604483015293965091945092507f0000000000000000000000000000000000000000000000000000000000000000909116906306ab5923906064016020604051808303816000875af11580156106fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107229190611e2c565b505050505050565b600080546040517f4f89059e0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690634f89059e90610774908590600401611e95565b602060405180830381865afa158015610791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b59190611ea8565b6107ed57816040517f396e24b80000000000000000000000000000000000000000000000000000000081526004016103529190611e95565b6102e7826000610a35565b60008060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bdf95fef876040518263ffffffff1660e01b815260040161084c9190611eca565b600060405180830381865afa158015610869573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108919190810190611f4f565b909250905060006108a28882610e58565b60ff1690506108b388600183610e7c565b945060006108e66108c5836001611ffc565b6001848c516108d4919061200f565b6108de919061200f565b8b9190610ea0565b90506108f18161072a565b965060008787604051602001610911929190918252602082015260400190565b60408051808303601f190181529181528151602092830120600081815260019093529082205490925063ffffffff16850360030b121561097d576040517f2dd6a7af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600160205260408120805463ffffffff191663ffffffff87161790556109a88b87610f22565b9097509050806109e4576040517f6260f6f800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b866001600160a01b0316827f87db02a0e483e2818060eddcbb3488ce44e35aff49a70d92c2aa6c8046cf01e28d88604051610a20929190612022565b60405180910390a35050505050509250925092565b600080610a428484610e58565b60ff16905080600003610a595750600090506102e7565b6000610a7985610a698487611ffc565b610a74906001611ffc565b610a35565b90506000610a93610a8b866001611ffc565b879085610e7c565b604080516020810185905290810182905290915060600160408051601f198184030181529082905280516020909101206302571be360e01b82526004820181905294506000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015610b2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4e9190611e0f565b90506001600160a01b0381161580610b9757507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b0316145b15610e255782610d6a576040516302571be360e01b8152600060048201819052907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d9190611e0f565b6040517f8cb8ecec000000000000000000000000000000000000000000000000000000008152600481018590523060248201529091506001600160a01b03821690638cb8ecec90604401600060405180830381600087803b158015610c9157600080fd5b505af1158015610ca5573d6000803e3d6000fd5b50506040517f1896f70a000000000000000000000000000000000000000000000000000000008152600481018990526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660248301527f0000000000000000000000000000000000000000000000000000000000000000169250631896f70a9150604401600060405180830381600087803b158015610d4c57600080fd5b505af1158015610d60573d6000803e3d6000fd5b5050505050610e4e565b6040516305ef2c7f60e41b815260048101849052602481018390523060448201526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b158015610e0857600080fd5b505af1158015610e1c573d6000803e3d6000fd5b50505050610e4e565b6001600160a01b0381163014610e4e57604051633c584f1360e21b815260040160405180910390fd5b5050505092915050565b6000828281518110610e6c57610e6c61204a565b016020015160f81c905092915050565b8251600090610e8b8385611ffc565b1115610e9657600080fd5b5091016020012090565b8251606090610eaf8385611ffc565b1115610eba57600080fd5b60008267ffffffffffffffff811115610ed557610ed5611ab7565b6040519080825280601f01601f191660200182016040528015610eff576020820181803683370190505b50905060208082019086860101610f17828287611030565b509095945050505050565b600080610f42604051806040016040528060608152602001600081525090565b610f5a85516005610f539190611ffc565b8290611086565b5060408051808201909152600581527f045f656e730000000000000000000000000000000000000000000000000000006020820152610f9a9082906110fd565b50610fa581866110fd565b506000610fb28582611125565b90505b8051516020820151101561101f578151610fd890610fd283611186565b906111a7565b60000361101157600080610ff5878460a001518560c00151611300565b92509050811561100e5794506001935061102992505050565b50505b61101a81611373565b610fb5565b5060008092509250505b9250929050565b602081106110685781518352611047602084611ffc565b9250611054602083611ffc565b915061106160208261200f565b9050611030565b905182516020929092036101000a6000190180199091169116179052565b6040805180820190915260608152600060208201526110a6602083612060565b156110ce576110b6602083612060565b6110c190602061200f565b6110cb9083611ffc565b91505b6020808401839052604051808552600081529081840101818110156110f257600080fd5b604052509192915050565b60408051808201909152606081526000602082015261111e8383845161145b565b9392505050565b6111736040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c081018290526102e781611373565b602081015181516060916102e79161119e9082611531565b84519190610ea0565b60006111b38383611593565b156111c0575060006102e7565b60008060008060006111d38860006115b1565b905060006111e28860006115b1565b90505b8082111561120e578593506111fa898761160e565b95508161120681612082565b9250506111e5565b8181111561123757849250611223888661160e565b94508061122f81612082565b91505061120e565b600082118015611250575061124e89878a88611632565b155b1561128557859350611262898761160e565b9550849250611271888661160e565b945061127e60018361200f565b9150611237565b8560000361129d5760001996505050505050506102e7565b846000036112b457600196505050505050506102e7565b6112f36112c2856001611ffc565b6112cc8b87610e58565b60ff168a6112db876001611ffc565b6112e58d89610e58565b8e949392919060ff16611667565b9998505050505050505050565b6000805b828410156113645760006113188686610e58565b60ff169050611328600186611ffc565b94506000806113388888856117e5565b9250905081156113505793506001925061136b915050565b61135a8388611ffc565b9650505050611304565b5060009050805b935093915050565b60c0810151602082018190528151511161138a5750565b600061139e82600001518360200151611531565b82602001516113ad9190611ffc565b82519091506113bc9082611839565b61ffff1660408301526113d0600282611ffc565b82519091506113df9082611839565b61ffff1660608301526113f3600282611ffc565b82519091506114029082611861565b63ffffffff166080830152611418600482611ffc565b825190915060009061142a9083611839565b61ffff16905061143b600283611ffc565b60a08401819052915061144e8183611ffc565b60c0909301929092525050565b604080518082019091526060815260006020820152825182111561147e57600080fd5b835151600061148d8483611ffc565b905085602001518111156114af576114af866114aa836002612099565b61188b565b8551805183820160200191600091808511156114c9578482525b505050602086015b6020861061150957805182526114e8602083611ffc565b91506114f5602082611ffc565b905061150260208761200f565b95506114d1565b51815160001960208890036101000a0190811690199190911617905250849150509392505050565b6000815b83518110611545576115456120b0565b60006115518583610e58565b60ff169050611561816001611ffc565b61156b9083611ffc565b91508060000361157b5750611581565b50611535565b61158b838261200f565b949350505050565b60008151835114801561111e575061111e83600084600087516118a8565b6000805b835183106115c5576115c56120b0565b60006115d18585610e58565b60ff1690506115e1816001611ffc565b6115eb9085611ffc565b9350806000036115fb575061111e565b611606600183611ffc565b9150506115b5565b600061161a8383610e58565b60ff16611628836001611ffc565b61111e9190611ffc565b600061164b8383848651611646919061200f565b610e7c565b61165d8686878951611646919061200f565b1495945050505050565b85516000906116768688611ffc565b11156116aa576116868587611ffc565b8751604051638a3c1cfb60e01b815260048101929092526024820152604401610352565b83516116b68385611ffc565b11156116ea576116c68284611ffc565b8451604051638a3c1cfb60e01b815260048101929092526024820152604401610352565b84808310156116f65750815b60208789018101908587010160005b838110156117ca578251825180821461179a5760006020611726858961200f565b106117345750600019611770565b600187611742866020611ffc565b61174c919061200f565b611757906008612099565b6117629060026121aa565b61176c919061200f565b1990505b60006117808383168584166121b6565b905080156117975797506117db9650505050505050565b50505b6117a5602086611ffc565b94506117b2602085611ffc565b935050506020816117c39190611ffc565b9050611705565b506117d585896121b6565b93505050505b9695505050505050565b6000806117f28585611861565b63ffffffff1663613d30781461180d5750600090508061136b565b61182d61181b856004611ffc565b6118258587611ffc565b8791906118cb565b91509150935093915050565b8151600090611849836002611ffc565b111561185457600080fd5b50016002015161ffff1690565b8151600090611871836004611ffc565b111561187c57600080fd5b50016004015163ffffffff1690565b81516118978383611086565b506118a283826110fd565b50505050565b60006118b5848484610e7c565b6118c0878785610e7c565b149695505050505050565b60008060286118da858561200f565b10156118eb5750600090508061136b565b6000806118f9878787611907565b909890975095505050505050565b60008080611915858561200f565b905080604014158015611929575080602814155b8061193e575061193a600282612060565b6001145b156119a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610352565b6001915085518411156119b757600080fd5b611a08565b6000603a8210602f831116156119d45750602f190190565b604782106040831116156119ea57506036190190565b60678210606083111615611a0057506056190190565b5060ff919050565b60208601855b85811015611a6a57611a258183015160001a6119bc565b611a376001830184015160001a6119bc565b60ff811460ff83141715611a5057600095505050611a6a565b60049190911b1760089590951b9490941793600201611a0e565b505050935093915050565b600060208284031215611a8757600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461111e57600080fd5b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715611af057611af0611ab7565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611b1f57611b1f611ab7565b604052919050565b600067ffffffffffffffff821115611b4157611b41611ab7565b50601f01601f191660200190565b600082601f830112611b6057600080fd5b8135611b73611b6e82611b27565b611af6565b818152846020838601011115611b8857600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112611bb657600080fd5b8135602067ffffffffffffffff80831115611bd357611bd3611ab7565b8260051b611be2838201611af6565b9384528581018301938381019088861115611bfc57600080fd5b84880192505b85831015611c9357823584811115611c1a5760008081fd5b88016040818b03601f1901811315611c325760008081fd5b611c3a611acd565b8783013587811115611c4c5760008081fd5b611c5a8d8a83870101611b4f565b825250908201359086821115611c705760008081fd5b611c7e8c8984860101611b4f565b81890152845250509184019190840190611c02565b98975050505050505050565b6001600160a01b0381168114611cb457600080fd5b50565b60008060008060808587031215611ccd57600080fd5b843567ffffffffffffffff80821115611ce557600080fd5b611cf188838901611b4f565b95506020870135915080821115611d0757600080fd5b50611d1487828801611ba5565b9350506040850135611d2581611c9f565b91506060850135611d3581611c9f565b939692955090935050565b600060208284031215611d5257600080fd5b813561111e81611c9f565b600060208284031215611d6f57600080fd5b5035919050565b60008060408385031215611d8957600080fd5b823567ffffffffffffffff80821115611da157600080fd5b611dad86838701611b4f565b93506020850135915080821115611dc357600080fd5b50611dd085828601611ba5565b9150509250929050565b600060208284031215611dec57600080fd5b813567ffffffffffffffff811115611e0357600080fd5b61158b84828501611b4f565b600060208284031215611e2157600080fd5b815161111e81611c9f565b600060208284031215611e3e57600080fd5b5051919050565b60005b83811015611e60578181015183820152602001611e48565b50506000910152565b60008151808452611e81816020860160208601611e45565b601f01601f19169290920160200192915050565b60208152600061111e6020830184611e69565b600060208284031215611eba57600080fd5b8151801515811461111e57600080fd5b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015611f4157888303603f1901855281518051878552611f1588860182611e69565b91890151858303868b0152919050611f2d8183611e69565b968901969450505090860190600101611ef1565b509098975050505050505050565b60008060408385031215611f6257600080fd5b825167ffffffffffffffff811115611f7957600080fd5b8301601f81018513611f8a57600080fd5b8051611f98611b6e82611b27565b818152866020838501011115611fad57600080fd5b611fbe826020830160208601611e45565b809450505050602083015163ffffffff81168114611fdb57600080fd5b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b808201808211156102e7576102e7611fe6565b818103818111156102e7576102e7611fe6565b6040815260006120356040830185611e69565b905063ffffffff831660208301529392505050565b634e487b7160e01b600052603260045260246000fd5b60008261207d57634e487b7160e01b600052601260045260246000fd5b500690565b60008161209157612091611fe6565b506000190190565b80820281158282048414176102e7576102e7611fe6565b634e487b7160e01b600052600160045260246000fd5b600181815b808511156121015781600019048211156120e7576120e7611fe6565b808516156120f457918102915b93841c93908002906120cb565b509250929050565b600082612118575060016102e7565b81612125575060006102e7565b816001811461213b576002811461214557612161565b60019150506102e7565b60ff84111561215657612156611fe6565b50506001821b6102e7565b5060208310610133831016604e8410600b8410161715612184575081810a6102e7565b61218e83836120c6565b80600019048211156121a2576121a2611fe6565b029392505050565b600061111e8383612109565b81810360008312801583831316838312821617156121d6576121d6611fe6565b509291505056fea2646970667358221220cfdfb6d1279817f31cba3a4d94621dfc051060fc2ac60424bd477a23a28c37d164736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100c95760003560e01c806329d56630116100815780636f9512211161005b5780636f951221146101e55780637dc0d1d014610206578063ab14ec591461022d57600080fd5b806329d566301461019857806330349ebe146101ab5780633f15457f146101be57600080fd5b806306963218116100b257806306963218146101355780631ecfc4111461014a57806325916d411461015d57600080fd5b806301ffc9a7146100ce57806304f3bcec146100f6575b600080fd5b6100e16100dc366004611a75565b610254565b60405190151581526020015b60405180910390f35b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100ed565b610148610143366004611cb7565b6102ed565b005b610148610158366004611d40565b6104df565b61018361016b366004611d5d565b60016020526000908152604090205463ffffffff1681565b60405163ffffffff90911681526020016100ed565b6101486101a6366004611d76565b610656565b60005461011d906001600160a01b031681565b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b6101f86101f3366004611dda565b61072a565b6040519081526020016100ed565b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a70000000000000000000000000000000000000000000000000000000014806102e757507fffffffff0000000000000000000000000000000000000000000000000000000082167f2f43542800000000000000000000000000000000000000000000000000000000145b92915050565b60008060006102fc87876107f8565b91945092509050336001600160a01b0382161461035b576040517fe03f60240000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03821660248201526044015b60405180910390fd5b6040516305ef2c7f60e41b815260048101849052602481018390526001600160a01b0382811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156103db57600080fd5b505af11580156103ef573d6000803e3d6000fd5b505050506001600160a01b038416156104d6576001600160a01b03851661042957604051633c584f1360e21b815260040160405180910390fd5b604080516020810185905290810183905260009060600160408051808303601f190181529082905280516020909101207fd5fa2b00000000000000000000000000000000000000000000000000000000008252600482018190526001600160a01b03878116602484015290925087169063d5fa2b0090604401600060405180830381600087803b1580156104bc57600080fd5b505af11580156104d0573d6000803e3d6000fd5b50505050505b50505050505050565b6040516302571be360e01b8152600060048201819052907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610547573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056b9190611e0f565b90506000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d19190611e0f565b9050336001600160a01b038216146105e857600080fd5b600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0385169081179091556040519081527f9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba89060200160405180910390a1505050565b600080600061066585856107f8565b6040517f06ab592300000000000000000000000000000000000000000000000000000000815260048101849052602481018390526001600160a01b03828116604483015293965091945092507f0000000000000000000000000000000000000000000000000000000000000000909116906306ab5923906064016020604051808303816000875af11580156106fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107229190611e2c565b505050505050565b600080546040517f4f89059e0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690634f89059e90610774908590600401611e95565b602060405180830381865afa158015610791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b59190611ea8565b6107ed57816040517f396e24b80000000000000000000000000000000000000000000000000000000081526004016103529190611e95565b6102e7826000610a35565b60008060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bdf95fef876040518263ffffffff1660e01b815260040161084c9190611eca565b600060405180830381865afa158015610869573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108919190810190611f4f565b909250905060006108a28882610e58565b60ff1690506108b388600183610e7c565b945060006108e66108c5836001611ffc565b6001848c516108d4919061200f565b6108de919061200f565b8b9190610ea0565b90506108f18161072a565b965060008787604051602001610911929190918252602082015260400190565b60408051808303601f190181529181528151602092830120600081815260019093529082205490925063ffffffff16850360030b121561097d576040517f2dd6a7af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600160205260408120805463ffffffff191663ffffffff87161790556109a88b87610f22565b9097509050806109e4576040517f6260f6f800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b866001600160a01b0316827f87db02a0e483e2818060eddcbb3488ce44e35aff49a70d92c2aa6c8046cf01e28d88604051610a20929190612022565b60405180910390a35050505050509250925092565b600080610a428484610e58565b60ff16905080600003610a595750600090506102e7565b6000610a7985610a698487611ffc565b610a74906001611ffc565b610a35565b90506000610a93610a8b866001611ffc565b879085610e7c565b604080516020810185905290810182905290915060600160408051601f198184030181529082905280516020909101206302571be360e01b82526004820181905294506000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015610b2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4e9190611e0f565b90506001600160a01b0381161580610b9757507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b0316145b15610e255782610d6a576040516302571be360e01b8152600060048201819052907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d9190611e0f565b6040517f8cb8ecec000000000000000000000000000000000000000000000000000000008152600481018590523060248201529091506001600160a01b03821690638cb8ecec90604401600060405180830381600087803b158015610c9157600080fd5b505af1158015610ca5573d6000803e3d6000fd5b50506040517f1896f70a000000000000000000000000000000000000000000000000000000008152600481018990526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660248301527f0000000000000000000000000000000000000000000000000000000000000000169250631896f70a9150604401600060405180830381600087803b158015610d4c57600080fd5b505af1158015610d60573d6000803e3d6000fd5b5050505050610e4e565b6040516305ef2c7f60e41b815260048101849052602481018390523060448201526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b158015610e0857600080fd5b505af1158015610e1c573d6000803e3d6000fd5b50505050610e4e565b6001600160a01b0381163014610e4e57604051633c584f1360e21b815260040160405180910390fd5b5050505092915050565b6000828281518110610e6c57610e6c61204a565b016020015160f81c905092915050565b8251600090610e8b8385611ffc565b1115610e9657600080fd5b5091016020012090565b8251606090610eaf8385611ffc565b1115610eba57600080fd5b60008267ffffffffffffffff811115610ed557610ed5611ab7565b6040519080825280601f01601f191660200182016040528015610eff576020820181803683370190505b50905060208082019086860101610f17828287611030565b509095945050505050565b600080610f42604051806040016040528060608152602001600081525090565b610f5a85516005610f539190611ffc565b8290611086565b5060408051808201909152600581527f045f656e730000000000000000000000000000000000000000000000000000006020820152610f9a9082906110fd565b50610fa581866110fd565b506000610fb28582611125565b90505b8051516020820151101561101f578151610fd890610fd283611186565b906111a7565b60000361101157600080610ff5878460a001518560c00151611300565b92509050811561100e5794506001935061102992505050565b50505b61101a81611373565b610fb5565b5060008092509250505b9250929050565b602081106110685781518352611047602084611ffc565b9250611054602083611ffc565b915061106160208261200f565b9050611030565b905182516020929092036101000a6000190180199091169116179052565b6040805180820190915260608152600060208201526110a6602083612060565b156110ce576110b6602083612060565b6110c190602061200f565b6110cb9083611ffc565b91505b6020808401839052604051808552600081529081840101818110156110f257600080fd5b604052509192915050565b60408051808201909152606081526000602082015261111e8383845161145b565b9392505050565b6111736040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c081018290526102e781611373565b602081015181516060916102e79161119e9082611531565b84519190610ea0565b60006111b38383611593565b156111c0575060006102e7565b60008060008060006111d38860006115b1565b905060006111e28860006115b1565b90505b8082111561120e578593506111fa898761160e565b95508161120681612082565b9250506111e5565b8181111561123757849250611223888661160e565b94508061122f81612082565b91505061120e565b600082118015611250575061124e89878a88611632565b155b1561128557859350611262898761160e565b9550849250611271888661160e565b945061127e60018361200f565b9150611237565b8560000361129d5760001996505050505050506102e7565b846000036112b457600196505050505050506102e7565b6112f36112c2856001611ffc565b6112cc8b87610e58565b60ff168a6112db876001611ffc565b6112e58d89610e58565b8e949392919060ff16611667565b9998505050505050505050565b6000805b828410156113645760006113188686610e58565b60ff169050611328600186611ffc565b94506000806113388888856117e5565b9250905081156113505793506001925061136b915050565b61135a8388611ffc565b9650505050611304565b5060009050805b935093915050565b60c0810151602082018190528151511161138a5750565b600061139e82600001518360200151611531565b82602001516113ad9190611ffc565b82519091506113bc9082611839565b61ffff1660408301526113d0600282611ffc565b82519091506113df9082611839565b61ffff1660608301526113f3600282611ffc565b82519091506114029082611861565b63ffffffff166080830152611418600482611ffc565b825190915060009061142a9083611839565b61ffff16905061143b600283611ffc565b60a08401819052915061144e8183611ffc565b60c0909301929092525050565b604080518082019091526060815260006020820152825182111561147e57600080fd5b835151600061148d8483611ffc565b905085602001518111156114af576114af866114aa836002612099565b61188b565b8551805183820160200191600091808511156114c9578482525b505050602086015b6020861061150957805182526114e8602083611ffc565b91506114f5602082611ffc565b905061150260208761200f565b95506114d1565b51815160001960208890036101000a0190811690199190911617905250849150509392505050565b6000815b83518110611545576115456120b0565b60006115518583610e58565b60ff169050611561816001611ffc565b61156b9083611ffc565b91508060000361157b5750611581565b50611535565b61158b838261200f565b949350505050565b60008151835114801561111e575061111e83600084600087516118a8565b6000805b835183106115c5576115c56120b0565b60006115d18585610e58565b60ff1690506115e1816001611ffc565b6115eb9085611ffc565b9350806000036115fb575061111e565b611606600183611ffc565b9150506115b5565b600061161a8383610e58565b60ff16611628836001611ffc565b61111e9190611ffc565b600061164b8383848651611646919061200f565b610e7c565b61165d8686878951611646919061200f565b1495945050505050565b85516000906116768688611ffc565b11156116aa576116868587611ffc565b8751604051638a3c1cfb60e01b815260048101929092526024820152604401610352565b83516116b68385611ffc565b11156116ea576116c68284611ffc565b8451604051638a3c1cfb60e01b815260048101929092526024820152604401610352565b84808310156116f65750815b60208789018101908587010160005b838110156117ca578251825180821461179a5760006020611726858961200f565b106117345750600019611770565b600187611742866020611ffc565b61174c919061200f565b611757906008612099565b6117629060026121aa565b61176c919061200f565b1990505b60006117808383168584166121b6565b905080156117975797506117db9650505050505050565b50505b6117a5602086611ffc565b94506117b2602085611ffc565b935050506020816117c39190611ffc565b9050611705565b506117d585896121b6565b93505050505b9695505050505050565b6000806117f28585611861565b63ffffffff1663613d30781461180d5750600090508061136b565b61182d61181b856004611ffc565b6118258587611ffc565b8791906118cb565b91509150935093915050565b8151600090611849836002611ffc565b111561185457600080fd5b50016002015161ffff1690565b8151600090611871836004611ffc565b111561187c57600080fd5b50016004015163ffffffff1690565b81516118978383611086565b506118a283826110fd565b50505050565b60006118b5848484610e7c565b6118c0878785610e7c565b149695505050505050565b60008060286118da858561200f565b10156118eb5750600090508061136b565b6000806118f9878787611907565b909890975095505050505050565b60008080611915858561200f565b905080604014158015611929575080602814155b8061193e575061193a600282612060565b6001145b156119a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610352565b6001915085518411156119b757600080fd5b611a08565b6000603a8210602f831116156119d45750602f190190565b604782106040831116156119ea57506036190190565b60678210606083111615611a0057506056190190565b5060ff919050565b60208601855b85811015611a6a57611a258183015160001a6119bc565b611a376001830184015160001a6119bc565b60ff811460ff83141715611a5057600095505050611a6a565b60049190911b1760089590951b9490941793600201611a0e565b505050935093915050565b600060208284031215611a8757600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461111e57600080fd5b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715611af057611af0611ab7565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611b1f57611b1f611ab7565b604052919050565b600067ffffffffffffffff821115611b4157611b41611ab7565b50601f01601f191660200190565b600082601f830112611b6057600080fd5b8135611b73611b6e82611b27565b611af6565b818152846020838601011115611b8857600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112611bb657600080fd5b8135602067ffffffffffffffff80831115611bd357611bd3611ab7565b8260051b611be2838201611af6565b9384528581018301938381019088861115611bfc57600080fd5b84880192505b85831015611c9357823584811115611c1a5760008081fd5b88016040818b03601f1901811315611c325760008081fd5b611c3a611acd565b8783013587811115611c4c5760008081fd5b611c5a8d8a83870101611b4f565b825250908201359086821115611c705760008081fd5b611c7e8c8984860101611b4f565b81890152845250509184019190840190611c02565b98975050505050505050565b6001600160a01b0381168114611cb457600080fd5b50565b60008060008060808587031215611ccd57600080fd5b843567ffffffffffffffff80821115611ce557600080fd5b611cf188838901611b4f565b95506020870135915080821115611d0757600080fd5b50611d1487828801611ba5565b9350506040850135611d2581611c9f565b91506060850135611d3581611c9f565b939692955090935050565b600060208284031215611d5257600080fd5b813561111e81611c9f565b600060208284031215611d6f57600080fd5b5035919050565b60008060408385031215611d8957600080fd5b823567ffffffffffffffff80821115611da157600080fd5b611dad86838701611b4f565b93506020850135915080821115611dc357600080fd5b50611dd085828601611ba5565b9150509250929050565b600060208284031215611dec57600080fd5b813567ffffffffffffffff811115611e0357600080fd5b61158b84828501611b4f565b600060208284031215611e2157600080fd5b815161111e81611c9f565b600060208284031215611e3e57600080fd5b5051919050565b60005b83811015611e60578181015183820152602001611e48565b50506000910152565b60008151808452611e81816020860160208601611e45565b601f01601f19169290920160200192915050565b60208152600061111e6020830184611e69565b600060208284031215611eba57600080fd5b8151801515811461111e57600080fd5b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015611f4157888303603f1901855281518051878552611f1588860182611e69565b91890151858303868b0152919050611f2d8183611e69565b968901969450505090860190600101611ef1565b509098975050505050505050565b60008060408385031215611f6257600080fd5b825167ffffffffffffffff811115611f7957600080fd5b8301601f81018513611f8a57600080fd5b8051611f98611b6e82611b27565b818152866020838501011115611fad57600080fd5b611fbe826020830160208601611e45565b809450505050602083015163ffffffff81168114611fdb57600080fd5b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b808201808211156102e7576102e7611fe6565b818103818111156102e7576102e7611fe6565b6040815260006120356040830185611e69565b905063ffffffff831660208301529392505050565b634e487b7160e01b600052603260045260246000fd5b60008261207d57634e487b7160e01b600052601260045260246000fd5b500690565b60008161209157612091611fe6565b506000190190565b80820281158282048414176102e7576102e7611fe6565b634e487b7160e01b600052600160045260246000fd5b600181815b808511156121015781600019048211156120e7576120e7611fe6565b808516156120f457918102915b93841c93908002906120cb565b509250929050565b600082612118575060016102e7565b81612125575060006102e7565b816001811461213b576002811461214557612161565b60019150506102e7565b60ff84111561215657612156611fe6565b50506001821b6102e7565b5060208310610133831016604e8410600b8410161715612184575081810a6102e7565b61218e83836120c6565b80600019048211156121a2576121a2611fe6565b029392505050565b600061111e8383612109565b81810360008312801583831316838312821617156121d6576121d6611fe6565b509291505056fea2646970667358221220cfdfb6d1279817f31cba3a4d94621dfc051060fc2ac60424bd477a23a28c37d164736f6c63430008110033", + "devdoc": { + "details": "An ENS registrar that allows the owner of a DNS name to claim the corresponding name in ENS.", + "kind": "dev", + "methods": { + "proveAndClaim(bytes,(bytes,bytes)[])": { + "details": "Submits proofs to the DNSSEC oracle, then claims a name using those proofs.", + "params": { + "input": "A chain of signed DNS RRSETs ending with a text record.", + "name": "The name to claim, in DNS wire format." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 4216, + "contract": "contracts/dnsregistrar/DNSRegistrar.sol:DNSRegistrar", + "label": "suffixes", + "offset": 0, + "slot": "0", + "type": "t_contract(PublicSuffixList)5705" + }, + { + "astId": 4224, + "contract": "contracts/dnsregistrar/DNSRegistrar.sol:DNSRegistrar", + "label": "inceptions", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_uint32)" + } + ], + "types": { + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(PublicSuffixList)5705": { + "encoding": "inplace", + "label": "contract PublicSuffixList", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes32,t_uint32)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint32)", + "numberOfBytes": "32", + "value": "t_uint32" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/DNSSECImpl.json b/solidity/dns-contracts/deployments/mainnet/DNSSECImpl.json new file mode 100644 index 0000000..d09b2cc --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/DNSSECImpl.json @@ -0,0 +1,531 @@ +{ + "address": "0x0fc3152971714E5ed7723FAFa650F86A4BaF30C5", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "_anchors", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "class", + "type": "uint16" + } + ], + "name": "InvalidClass", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "labelsExpected", + "type": "uint256" + } + ], + "name": "InvalidLabelCount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "proofType", + "type": "uint16" + } + ], + "name": "InvalidProofType", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidRRSet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "rrsetName", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signerName", + "type": "bytes" + } + ], + "name": "InvalidSignerName", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "signerName", + "type": "bytes" + } + ], + "name": "NoMatchingProof", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "signerName", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "proofName", + "type": "bytes" + } + ], + "name": "ProofNameMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "expiration", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "now", + "type": "uint32" + } + ], + "name": "SignatureExpired", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "inception", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "now", + "type": "uint32" + } + ], + "name": "SignatureNotValidYet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "rrsetType", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "sigType", + "type": "uint16" + } + ], + "name": "SignatureTypeMismatch", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "AlgorithmUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "DigestUpdated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "algorithms", + "outputs": [ + { + "internalType": "contract Algorithm", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "anchors", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "digests", + "outputs": [ + { + "internalType": "contract Digest", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "internalType": "contract Algorithm", + "name": "algo", + "type": "address" + } + ], + "name": "setAlgorithm", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "internalType": "contract Digest", + "name": "digest", + "type": "address" + } + ], + "name": "setDigest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature[]", + "name": "input", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "now", + "type": "uint256" + } + ], + "name": "verifyRRSet", + "outputs": [ + { + "internalType": "bytes", + "name": "rrs", + "type": "bytes" + }, + { + "internalType": "uint32", + "name": "inception", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature[]", + "name": "input", + "type": "tuple[]" + } + ], + "name": "verifyRRSet", + "outputs": [ + { + "internalType": "bytes", + "name": "rrs", + "type": "bytes" + }, + { + "internalType": "uint32", + "name": "inception", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xdd7b4a053abdb2548cf1814c34bb7bb8bc4c04fd40fca8ddaa9a5fa49c3dec39", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0x0fc3152971714E5ed7723FAFa650F86A4BaF30C5", + "transactionIndex": 34, + "gasUsed": "1810348", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xbd9e84737ca6669373a58feee7d18fbd6d17510a2b0efe542f5cf635a063fb9d", + "transactionHash": "0xdd7b4a053abdb2548cf1814c34bb7bb8bc4c04fd40fca8ddaa9a5fa49c3dec39", + "logs": [], + "blockNumber": 19020686, + "cumulativeGasUsed": "6427787", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00002b000100000e1000244a5c080249aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb500002b000100000e1000244f660802e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d" + ], + "numDeployments": 2, + "solcInputHash": "dd9e022689821cffaeb04b9ddbda87ae", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_anchors\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"class\",\"type\":\"uint16\"}],\"name\":\"InvalidClass\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"labelsExpected\",\"type\":\"uint256\"}],\"name\":\"InvalidLabelCount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"proofType\",\"type\":\"uint16\"}],\"name\":\"InvalidProofType\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRRSet\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"rrsetName\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signerName\",\"type\":\"bytes\"}],\"name\":\"InvalidSignerName\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signerName\",\"type\":\"bytes\"}],\"name\":\"NoMatchingProof\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signerName\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"proofName\",\"type\":\"bytes\"}],\"name\":\"ProofNameMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"expiration\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"now\",\"type\":\"uint32\"}],\"name\":\"SignatureExpired\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"inception\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"now\",\"type\":\"uint32\"}],\"name\":\"SignatureNotValidYet\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"rrsetType\",\"type\":\"uint16\"},{\"internalType\":\"uint16\",\"name\":\"sigType\",\"type\":\"uint16\"}],\"name\":\"SignatureTypeMismatch\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"AlgorithmUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"DigestUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"algorithms\",\"outputs\":[{\"internalType\":\"contract Algorithm\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"anchors\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"digests\",\"outputs\":[{\"internalType\":\"contract Digest\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"internalType\":\"contract Algorithm\",\"name\":\"algo\",\"type\":\"address\"}],\"name\":\"setAlgorithm\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"internalType\":\"contract Digest\",\"name\":\"digest\",\"type\":\"address\"}],\"name\":\"setDigest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature[]\",\"name\":\"input\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"now\",\"type\":\"uint256\"}],\"name\":\"verifyRRSet\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"rrs\",\"type\":\"bytes\"},{\"internalType\":\"uint32\",\"name\":\"inception\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature[]\",\"name\":\"input\",\"type\":\"tuple[]\"}],\"name\":\"verifyRRSet\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"rrs\",\"type\":\"bytes\"},{\"internalType\":\"uint32\",\"name\":\"inception\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_anchors\":\"The binary format RR entries for the root DS records.\"}},\"setAlgorithm(uint8,address)\":{\"details\":\"Sets the contract address for a signature verification algorithm. Callable only by the owner.\",\"params\":{\"algo\":\"The address of the algorithm contract.\",\"id\":\"The algorithm ID\"}},\"setDigest(uint8,address)\":{\"details\":\"Sets the contract address for a digest verification algorithm. Callable only by the owner.\",\"params\":{\"digest\":\"The address of the digest contract.\",\"id\":\"The digest ID\"}},\"verifyRRSet((bytes,bytes)[])\":{\"details\":\"Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain. Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\",\"params\":{\"input\":\"A list of signed RRSets.\"},\"returns\":{\"inception\":\"The inception time of the signed record set.\",\"rrs\":\"The RRData from the last RRSet in the chain.\"}},\"verifyRRSet((bytes,bytes)[],uint256)\":{\"details\":\"Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain. Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\",\"params\":{\"input\":\"A list of signed RRSets.\",\"now\":\"The Unix timestamp to validate the records at.\"},\"returns\":{\"inception\":\"The inception time of the signed record set.\",\"rrs\":\"The RRData from the last RRSet in the chain.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/DNSSECImpl.sol\":\"DNSSECImpl\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-2-Clause\\npragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for appending to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n let fpm := add(32, add(ptr, capacity))\\n if lt(fpm, ptr) {\\n revert(0, 0)\\n }\\n mstore(0x40, fpm)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n uint off = buf.buf.length;\\n uint newCapacity = off + len;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(newCapacity, buflen) {\\n mstore(bufptr, newCapacity)\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return append(buf, data, data.length);\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint offPlusOne = off + 1;\\n if (off >= buf.capacity) {\\n resize(buf, offPlusOne * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if gt(offPlusOne, mload(bufptr)) {\\n mstore(bufptr, offPlusOne)\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return append(buf, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return append(buf, data, 32);\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n return buf;\\n }\\n}\\n\",\"keccak256\":\"0xd6dd3b0b327288f8e1b711a609f4040fea602e2ad4bba9febdf2f33b4e56eb0c\",\"license\":\"BSD-2-Clause\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/DNSSEC.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nabstract contract DNSSEC {\\n bytes public anchors;\\n\\n struct RRSetWithSignature {\\n bytes rrset;\\n bytes sig;\\n }\\n\\n event AlgorithmUpdated(uint8 id, address addr);\\n event DigestUpdated(uint8 id, address addr);\\n\\n function verifyRRSet(\\n RRSetWithSignature[] memory input\\n ) external view virtual returns (bytes memory rrs, uint32 inception);\\n\\n function verifyRRSet(\\n RRSetWithSignature[] memory input,\\n uint256 now\\n ) public view virtual returns (bytes memory rrs, uint32 inception);\\n}\\n\",\"keccak256\":\"0xee6a236a59e5db8418c98ee4640a91987d26533c02d305cc6c7a37a3ac4ee907\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/DNSSECImpl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nimport \\\"./Owned.sol\\\";\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"./RRUtils.sol\\\";\\nimport \\\"./DNSSEC.sol\\\";\\nimport \\\"./algorithms/Algorithm.sol\\\";\\nimport \\\"./digests/Digest.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/*\\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\\n * - Proofs involving wildcard names will not validate.\\n * - TTLs on records are ignored, as data is not stored persistently.\\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\\n */\\ncontract DNSSECImpl is DNSSEC, Owned {\\n using Buffer for Buffer.buffer;\\n using BytesUtils for bytes;\\n using RRUtils for *;\\n\\n uint16 constant DNSCLASS_IN = 1;\\n\\n uint16 constant DNSTYPE_DS = 43;\\n uint16 constant DNSTYPE_DNSKEY = 48;\\n\\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\\n\\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\\n error SignatureNotValidYet(uint32 inception, uint32 now);\\n error SignatureExpired(uint32 expiration, uint32 now);\\n error InvalidClass(uint16 class);\\n error InvalidRRSet();\\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\\n error InvalidSignerName(bytes rrsetName, bytes signerName);\\n error InvalidProofType(uint16 proofType);\\n error ProofNameMismatch(bytes signerName, bytes proofName);\\n error NoMatchingProof(bytes signerName);\\n\\n mapping(uint8 => Algorithm) public algorithms;\\n mapping(uint8 => Digest) public digests;\\n\\n /**\\n * @dev Constructor.\\n * @param _anchors The binary format RR entries for the root DS records.\\n */\\n constructor(bytes memory _anchors) {\\n // Insert the 'trust anchors' - the key hashes that start the chain\\n // of trust for all other records.\\n anchors = _anchors;\\n }\\n\\n /**\\n * @dev Sets the contract address for a signature verification algorithm.\\n * Callable only by the owner.\\n * @param id The algorithm ID\\n * @param algo The address of the algorithm contract.\\n */\\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\\n algorithms[id] = algo;\\n emit AlgorithmUpdated(id, address(algo));\\n }\\n\\n /**\\n * @dev Sets the contract address for a digest verification algorithm.\\n * Callable only by the owner.\\n * @param id The digest ID\\n * @param digest The address of the digest contract.\\n */\\n function setDigest(uint8 id, Digest digest) public owner_only {\\n digests[id] = digest;\\n emit DigestUpdated(id, address(digest));\\n }\\n\\n /**\\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\\n * @param input A list of signed RRSets.\\n * @return rrs The RRData from the last RRSet in the chain.\\n * @return inception The inception time of the signed record set.\\n */\\n function verifyRRSet(\\n RRSetWithSignature[] memory input\\n )\\n external\\n view\\n virtual\\n override\\n returns (bytes memory rrs, uint32 inception)\\n {\\n return verifyRRSet(input, block.timestamp);\\n }\\n\\n /**\\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\\n * @param input A list of signed RRSets.\\n * @param now The Unix timestamp to validate the records at.\\n * @return rrs The RRData from the last RRSet in the chain.\\n * @return inception The inception time of the signed record set.\\n */\\n function verifyRRSet(\\n RRSetWithSignature[] memory input,\\n uint256 now\\n )\\n public\\n view\\n virtual\\n override\\n returns (bytes memory rrs, uint32 inception)\\n {\\n bytes memory proof = anchors;\\n for (uint256 i = 0; i < input.length; i++) {\\n RRUtils.SignedSet memory rrset = validateSignedSet(\\n input[i],\\n proof,\\n now\\n );\\n proof = rrset.data;\\n inception = rrset.inception;\\n }\\n return (proof, inception);\\n }\\n\\n /**\\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\\n *\\n * @param input The signed RR set. This is in the format described in section\\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\\n * data, followed by a series of canonicalised RR records that the signature\\n * applies to.\\n * @param proof The DNSKEY or DS to validate the signature against.\\n * @param now The current timestamp.\\n */\\n function validateSignedSet(\\n RRSetWithSignature memory input,\\n bytes memory proof,\\n uint256 now\\n ) internal view returns (RRUtils.SignedSet memory rrset) {\\n rrset = input.rrset.readSignedSet();\\n\\n // Do some basic checks on the RRs and extract the name\\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\\n if (name.labelCount(0) != rrset.labels) {\\n revert InvalidLabelCount(name, rrset.labels);\\n }\\n rrset.name = name;\\n\\n // All comparisons involving the Signature Expiration and\\n // Inception fields MUST use \\\"serial number arithmetic\\\", as\\n // defined in RFC 1982\\n\\n // o The validator's notion of the current time MUST be less than or\\n // equal to the time listed in the RRSIG RR's Expiration field.\\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\\n revert SignatureExpired(rrset.expiration, uint32(now));\\n }\\n\\n // o The validator's notion of the current time MUST be greater than or\\n // equal to the time listed in the RRSIG RR's Inception field.\\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\\n revert SignatureNotValidYet(rrset.inception, uint32(now));\\n }\\n\\n // Validate the signature\\n verifySignature(name, rrset, input, proof);\\n\\n return rrset;\\n }\\n\\n /**\\n * @dev Validates a set of RRs.\\n * @param rrset The RR set.\\n * @param typecovered The type covered by the RRSIG record.\\n */\\n function validateRRs(\\n RRUtils.SignedSet memory rrset,\\n uint16 typecovered\\n ) internal pure returns (bytes memory name) {\\n // Iterate over all the RRs\\n for (\\n RRUtils.RRIterator memory iter = rrset.rrs();\\n !iter.done();\\n iter.next()\\n ) {\\n // We only support class IN (Internet)\\n if (iter.class != DNSCLASS_IN) {\\n revert InvalidClass(iter.class);\\n }\\n\\n if (name.length == 0) {\\n name = iter.name();\\n } else {\\n // Name must be the same on all RRs. We do things this way to avoid copying the name\\n // repeatedly.\\n if (\\n name.length != iter.data.nameLength(iter.offset) ||\\n !name.equals(0, iter.data, iter.offset, name.length)\\n ) {\\n revert InvalidRRSet();\\n }\\n }\\n\\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\\n if (iter.dnstype != typecovered) {\\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\\n }\\n }\\n }\\n\\n /**\\n * @dev Performs signature verification.\\n *\\n * Throws or reverts if unable to verify the record.\\n *\\n * @param name The name of the RRSIG record, in DNS label-sequence format.\\n * @param data The original data to verify.\\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\\n */\\n function verifySignature(\\n bytes memory name,\\n RRUtils.SignedSet memory rrset,\\n RRSetWithSignature memory data,\\n bytes memory proof\\n ) internal view {\\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\\n // that contains the RRset.\\n if (!name.isSubdomainOf(rrset.signerName)) {\\n revert InvalidSignerName(name, rrset.signerName);\\n }\\n\\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\\n // Check the proof\\n if (proofRR.dnstype == DNSTYPE_DS) {\\n verifyWithDS(rrset, data, proofRR);\\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\\n verifyWithKnownKey(rrset, data, proofRR);\\n } else {\\n revert InvalidProofType(proofRR.dnstype);\\n }\\n }\\n\\n /**\\n * @dev Attempts to verify a signed RRSET against an already known public key.\\n * @param rrset The signed set to verify.\\n * @param data The original data the signed set was read from.\\n * @param proof The serialized DS or DNSKEY record to use as proof.\\n */\\n function verifyWithKnownKey(\\n RRUtils.SignedSet memory rrset,\\n RRSetWithSignature memory data,\\n RRUtils.RRIterator memory proof\\n ) internal view {\\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\\n for (; !proof.done(); proof.next()) {\\n bytes memory proofName = proof.name();\\n if (!proofName.equals(rrset.signerName)) {\\n revert ProofNameMismatch(rrset.signerName, proofName);\\n }\\n\\n bytes memory keyrdata = proof.rdata();\\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\\n 0,\\n keyrdata.length\\n );\\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\\n return;\\n }\\n }\\n revert NoMatchingProof(rrset.signerName);\\n }\\n\\n /**\\n * @dev Attempts to verify some data using a provided key and a signature.\\n * @param dnskey The dns key record to verify the signature with.\\n * @param rrset The signed RRSET being verified.\\n * @param data The original data `rrset` was decoded from.\\n * @return True iff the key verifies the signature.\\n */\\n function verifySignatureWithKey(\\n RRUtils.DNSKEY memory dnskey,\\n bytes memory keyrdata,\\n RRUtils.SignedSet memory rrset,\\n RRSetWithSignature memory data\\n ) internal view returns (bool) {\\n // TODO: Check key isn't expired, unless updating key itself\\n\\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\\n if (dnskey.protocol != 3) {\\n return false;\\n }\\n\\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\\n // the zone's apex DNSKEY RRset.\\n if (dnskey.algorithm != rrset.algorithm) {\\n return false;\\n }\\n uint16 computedkeytag = keyrdata.computeKeytag();\\n if (computedkeytag != rrset.keytag) {\\n return false;\\n }\\n\\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\\n // set.\\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\\n return false;\\n }\\n\\n Algorithm algorithm = algorithms[dnskey.algorithm];\\n if (address(algorithm) == address(0)) {\\n return false;\\n }\\n return algorithm.verify(keyrdata, data.rrset, data.sig);\\n }\\n\\n /**\\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\\n * that the record\\n * @param rrset The signed set to verify.\\n * @param data The original data the signed set was read from.\\n * @param proof The serialized DS or DNSKEY record to use as proof.\\n */\\n function verifyWithDS(\\n RRUtils.SignedSet memory rrset,\\n RRSetWithSignature memory data,\\n RRUtils.RRIterator memory proof\\n ) internal view {\\n uint256 proofOffset = proof.offset;\\n for (\\n RRUtils.RRIterator memory iter = rrset.rrs();\\n !iter.done();\\n iter.next()\\n ) {\\n if (iter.dnstype != DNSTYPE_DNSKEY) {\\n revert InvalidProofType(iter.dnstype);\\n }\\n\\n bytes memory keyrdata = iter.rdata();\\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\\n 0,\\n keyrdata.length\\n );\\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\\n // It's self-signed - look for a DS record to verify it.\\n if (\\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\\n ) {\\n return;\\n }\\n // Rewind proof iterator to the start for the next loop iteration.\\n proof.nextOffset = proofOffset;\\n proof.next();\\n }\\n }\\n revert NoMatchingProof(rrset.signerName);\\n }\\n\\n /**\\n * @dev Attempts to verify a key using DS records.\\n * @param keyname The DNS name of the key, in DNS label-sequence format.\\n * @param dsrrs The DS records to use in verification.\\n * @param dnskey The dnskey to verify.\\n * @param keyrdata The RDATA section of the key.\\n * @return True if a DS record verifies this key.\\n */\\n function verifyKeyWithDS(\\n bytes memory keyname,\\n RRUtils.RRIterator memory dsrrs,\\n RRUtils.DNSKEY memory dnskey,\\n bytes memory keyrdata\\n ) internal view returns (bool) {\\n uint16 keytag = keyrdata.computeKeytag();\\n for (; !dsrrs.done(); dsrrs.next()) {\\n bytes memory proofName = dsrrs.name();\\n if (!proofName.equals(keyname)) {\\n revert ProofNameMismatch(keyname, proofName);\\n }\\n\\n RRUtils.DS memory ds = dsrrs.data.readDS(\\n dsrrs.rdataOffset,\\n dsrrs.nextOffset - dsrrs.rdataOffset\\n );\\n if (ds.keytag != keytag) {\\n continue;\\n }\\n if (ds.algorithm != dnskey.algorithm) {\\n continue;\\n }\\n\\n Buffer.buffer memory buf;\\n buf.init(keyname.length + keyrdata.length);\\n buf.append(keyname);\\n buf.append(keyrdata);\\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\\n return true;\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Attempts to verify a DS record's hash value against some data.\\n * @param digesttype The digest ID from the DS record.\\n * @param data The data to digest.\\n * @param digest The digest data to check against.\\n * @return True iff the digest matches.\\n */\\n function verifyDSHash(\\n uint8 digesttype,\\n bytes memory data,\\n bytes memory digest\\n ) internal view returns (bool) {\\n if (address(digests[digesttype]) == address(0)) {\\n return false;\\n }\\n return digests[digesttype].verify(data, digest);\\n }\\n}\\n\",\"keccak256\":\"0x671fea3a3332453eecc08c082f264011aa8cfa99fb3c03adf73443843aed5128\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/Owned.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev Contract mixin for 'owned' contracts.\\n */\\ncontract Owned {\\n address public owner;\\n\\n modifier owner_only() {\\n require(msg.sender == owner);\\n _;\\n }\\n\\n constructor() public {\\n owner = msg.sender;\\n }\\n\\n function setOwner(address newOwner) public owner_only {\\n owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x49f57dcb9d79015f917e569b4318b766bee9920f72e11a1f5331eabebfc1eb24\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n */\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint256 labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes memory ret) {\\n uint256 len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint256 labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint256 constant RRSIG_TYPE = 0;\\n uint256 constant RRSIG_ALGORITHM = 2;\\n uint256 constant RRSIG_LABELS = 3;\\n uint256 constant RRSIG_TTL = 4;\\n uint256 constant RRSIG_EXPIRATION = 8;\\n uint256 constant RRSIG_INCEPTION = 12;\\n uint256 constant RRSIG_KEY_TAG = 16;\\n uint256 constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(\\n bytes memory data\\n ) internal pure returns (SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(\\n RRSIG_SIGNER_NAME + self.signerName.length,\\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\\n );\\n }\\n\\n function rrs(\\n SignedSet memory rrset\\n ) internal pure returns (RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint256 offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint256 rdataOffset;\\n uint256 nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns (bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint256 rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.offset,\\n nameLength(iter.data, iter.offset)\\n );\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(\\n RRIterator memory iter\\n ) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.rdataOffset,\\n iter.nextOffset - iter.rdataOffset\\n );\\n }\\n\\n uint256 constant DNSKEY_FLAGS = 0;\\n uint256 constant DNSKEY_PROTOCOL = 2;\\n uint256 constant DNSKEY_ALGORITHM = 3;\\n uint256 constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(\\n offset + DNSKEY_PUBKEY,\\n length - DNSKEY_PUBKEY\\n );\\n }\\n\\n uint256 constant DS_KEY_TAG = 0;\\n uint256 constant DS_ALGORITHM = 2;\\n uint256 constant DS_DIGEST_TYPE = 3;\\n uint256 constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n function isSubdomainOf(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n uint256 off = 0;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n while (counts > othercounts) {\\n off = progress(self, off);\\n counts--;\\n }\\n\\n return self.equals(off, other, 0);\\n }\\n\\n function compareNames(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint256 off;\\n uint256 otheroff;\\n uint256 prevoff;\\n uint256 otherprevoff;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if (otheroff == 0) {\\n return 1;\\n }\\n\\n return\\n self.compare(\\n prevoff + 1,\\n self.readUint8(prevoff),\\n other,\\n otherprevoff + 1,\\n other.readUint8(otherprevoff)\\n );\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(\\n uint32 i1,\\n uint32 i2\\n ) internal pure returns (bool) {\\n unchecked {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n }\\n\\n function progress(\\n bytes memory body,\\n uint256 off\\n ) internal pure returns (uint256) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint256 ac1;\\n uint256 ac2;\\n for (uint256 i = 0; i < data.length + 31; i += 32) {\\n uint256 word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if (i + 32 > data.length) {\\n uint256 unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 +=\\n (word &\\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\\n 8;\\n ac2 += (word &\\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 =\\n (ac1 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac1 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac2 =\\n (ac2 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac2 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 =\\n (ac1 &\\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\\n 32);\\n ac1 =\\n (ac1 &\\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\\n 64);\\n ac1 =\\n (ac1 &\\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\\n (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4dd68a6efd7c38f6b0e95ca0c056ecb74f88583da650b1a8639e6e78be36fede\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n */\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata signature\\n ) external view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xaf6825f9852c69f8e36540821d067b4550dd2263497af9d645309b6a0c457ba6\"},\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC digest.\\n */\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(\\n bytes calldata data,\\n bytes calldata hash\\n ) external pure virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x8ea926b2db0578c4ad7fce4582fc0f6f0f9efee8dca2085dbdb9984f18941e28\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506040516200205638038062002056833981016040819052620000349162000072565b600180546001600160a01b031916331790556000620000548282620001d6565b5050620002a2565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156200008657600080fd5b82516001600160401b03808211156200009e57600080fd5b818501915085601f830112620000b357600080fd5b815181811115620000c857620000c86200005c565b604051601f8201601f19908116603f01168101908382118183101715620000f357620000f36200005c565b8160405282815288868487010111156200010c57600080fd5b600093505b8284101562000130578484018601518185018701529285019262000111565b600086848301015280965050505050505092915050565b600181811c908216806200015c57607f821691505b6020821081036200017d57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620001d157600081815260208120601f850160051c81016020861015620001ac5750805b601f850160051c820191505b81811015620001cd57828155600101620001b8565b5050505b505050565b81516001600160401b03811115620001f257620001f26200005c565b6200020a8162000203845462000147565b8462000183565b602080601f831160018114620002425760008415620002295750858301515b600019600386901b1c1916600185901b178555620001cd565b600085815260208120601f198616915b82811015620002735788860151825594840194600190910190840162000252565b5085821015620002925787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b611da480620002b26000396000f3fe608060405234801561001057600080fd5b50600436106100a35760003560e01c806373cc48a61161007657806398d35f201161005b57806398d35f2014610161578063bdf95fef14610176578063c327deef1461018957600080fd5b806373cc48a61461010d5780638da5cb5b1461014e57600080fd5b8063020ed8d3146100a857806313af4035146100bd57806328e7677d146100d0578063440f3d42146100e3575b600080fd5b6100bb6100b6366004611871565b6101b2565b005b6100bb6100cb3660046118a8565b610241565b6100bb6100de366004611871565b610287565b6100f66100f1366004611a9f565b61030e565b604051610104929190611b2a565b60405180910390f35b61013661011b366004611b52565b6003602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610104565b600154610136906001600160a01b031681565b610169610400565b6040516101049190611b6d565b6100f6610184366004611b80565b61048e565b610136610197366004611b52565b6002602052600090815260409020546001600160a01b031681565b6001546001600160a01b031633146101c957600080fd5b60ff8216600081815260026020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386169081179091558251938452908301527ff73c3c226af96b7f1ba666a21b3ceaf2be3ee6a365e3178fd9cd1eaae0075aa891015b60405180910390a15050565b6001546001600160a01b0316331461025857600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001546001600160a01b0316331461029e57600080fd5b60ff8216600081815260036020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386169081179091558251938452908301527f2fcc274c3b72dd483ab201bfa87295e3817e8b9b10693219873b722ca1af00c79101610235565b60606000806000805461032090611bb5565b80601f016020809104026020016040519081016040528092919081815260200182805461034c90611bb5565b80156103995780601f1061036e57610100808354040283529160200191610399565b820191906000526020600020905b81548152906001019060200180831161037c57829003601f168201915b5050505050905060005b85518110156103f65760006103d28783815181106103c3576103c3611bef565b602002602001015184886104a5565b61010081015160a090910151945092508190506103ee81611c1b565b9150506103a3565b5091509250929050565b6000805461040d90611bb5565b80601f016020809104026020016040519081016040528092919081815260200182805461043990611bb5565b80156104865780601f1061045b57610100808354040283529160200191610486565b820191906000526020600020905b81548152906001019060200180831161046957829003601f168201915b505050505081565b6060600061049c834261030e565b91509150915091565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c082019290925260e081018290526101008101829052610120810191909152835161050390610647565b90506000610515828360000151610789565b604083015190915060ff1661052b8260006108e6565b14610573578082604001516040517fe861b2bd00000000000000000000000000000000000000000000000000000000815260040161056a929190611c34565b60405180910390fd5b6101208201819052608082015160009084900360030b12156105d75760808201516040517fa784f87e00000000000000000000000000000000000000000000000000000000815263ffffffff9182166004820152908416602482015260440161056a565b60a0820151600090840360030b12156106325760a08201516040517fbd41036a00000000000000000000000000000000000000000000000000000000815263ffffffff9182166004820152908416602482015260440161056a565b61063e8183878761094c565b505b9392505050565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e082018190526101008201819052610120820152906106a2908390610a16565b61ffff1681526106b3826002610a3e565b60ff1660208201526106c6826003610a3e565b60ff1660408201526106d9826004610a62565b63ffffffff90811660608301526106f5908390600890610a6216565b63ffffffff9081166080830152610711908390600c90610a6216565b63ffffffff90811660a083015261072d908390601090610a1616565b61ffff1660c0820152610741826012610a8c565b60e082018190525161077e90610758906012611c59565b8260e00151516012855161076c9190611c6c565b6107769190611c6c565b849190610aaf565b610100820152919050565b6060600061079684610b31565b90505b805151602082015110156108df57606081015161ffff166001146107f55760608101516040517f98a5f31a00000000000000000000000000000000000000000000000000000000815261ffff909116600482015260240161056a565b815160000361080e5761080781610b8f565b9150610878565b6020810151815161081e91610bb0565b8251141580610841575080516020820151835161083f928592600092610c0a565b155b15610878576040517fcbceee6f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8261ffff16816040015161ffff16146108d15760408082015190517fa6ff8a8a00000000000000000000000000000000000000000000000000000000815261ffff9182166004820152908416602482015260440161056a565b6108da81610c2d565b610799565b5092915050565b6000805b835183106108fa576108fa611c7f565b60006109068585610a3e565b60ff169050610916816001611c59565b6109209085611c59565b9350806000036109305750610943565b61093b600183611c59565b9150506108ea565b90505b92915050565b60e083015161095c908590610d15565b6109995760e08301516040517feaafc59b00000000000000000000000000000000000000000000000000000000815261056a918691600401611c95565b60006109a58282610d72565b9050602b61ffff16816040015161ffff16036109cb576109c6848483610dd3565b610a0f565b603061ffff16816040015161ffff16036109ea576109c6848483610ec0565b60408082015190516361529e8760e01b815261ffff909116600482015260240161056a565b5050505050565b8151600090610a26836002611c59565b1115610a3157600080fd5b50016002015161ffff1690565b6000828281518110610a5257610a52611bef565b016020015160f81c905092915050565b8151600090610a72836004611c59565b1115610a7d57600080fd5b50016004015163ffffffff1690565b60606000610a9a8484610bb0565b9050610aa7848483610aaf565b949350505050565b8251606090610abe8385611c59565b1115610ac957600080fd5b60008267ffffffffffffffff811115610ae457610ae46118c5565b6040519080825280601f01601f191660200182016040528015610b0e576020820181803683370190505b50905060208082019086860101610b26828287610f88565b509095945050505050565b610b7f6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b6109468261010001516000610d72565b6020810151815160609161094691610ba79082610bb0565b84519190610aaf565b6000815b83518110610bc457610bc4611c7f565b6000610bd08583610a3e565b60ff169050610be0816001611c59565b610bea9083611c59565b915080600003610bfa5750610c00565b50610bb4565b610aa78382611c6c565b6000610c17848484610fde565b610c22878785610fde565b149695505050505050565b60c08101516020820181905281515111610c445750565b6000610c5882600001518360200151610bb0565b8260200151610c679190611c59565b8251909150610c769082610a16565b61ffff166040830152610c8a600282611c59565b8251909150610c999082610a16565b61ffff166060830152610cad600282611c59565b8251909150610cbc9082610a62565b63ffffffff166080830152610cd2600482611c59565b8251909150600090610ce49083610a16565b61ffff169050610cf5600283611c59565b60a084018190529150610d088183611c59565b60c0909301929092525050565b60008080610d2385826108e6565b90506000610d328560006108e6565b90505b80821115610d5b57610d478684611002565b925081610d5381611cc3565b925050610d35565b610d688684876000611026565b9695505050505050565b610dc06040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261094681610c2d565b60208101516000610de385610b31565b90505b80515160208201511015610ea057604081015161ffff16603014610e295760408082015190516361529e8760e01b815261ffff909116600482015260240161056a565b6000610e348261105b565b90506000610e4f60008351846110779092919063ffffffff16565b9050610e5d81838989611115565b15610e9057610e728760e00151868385611254565b15610e805750505050505050565b60c08501849052610e9085610c2d565b5050610e9b81610c2d565b610de6565b508360e001516040516306cde0f360e01b815260040161056a9190611b6d565b80515160208201511015610f69576000610ed982610b8f565b9050610ef28460e001518261139190919063ffffffff16565b610f17578360e0015181604051636b80573f60e11b815260040161056a929190611c95565b6000610f228361105b565b90506000610f3d60008351846110779092919063ffffffff16565b9050610f4b81838888611115565b15610f5857505050505050565b505050610f6481610c2d565b610ec0565b8260e001516040516306cde0f360e01b815260040161056a9190611b6d565b60208110610fc05781518352610f9f602084611c59565b9250610fac602083611c59565b9150610fb9602082611c6c565b9050610f88565b905182516020929092036101000a6000190180199091169116179052565b8251600090610fed8385611c59565b1115610ff857600080fd5b5091016020012090565b600061100e8383610a3e565b60ff1661101c836001611c59565b6109439190611c59565b600061103f838384865161103a9190611c6c565b610fde565b611051868687895161103a9190611c6c565b1495945050505050565b60a081015160c082015160609161094691610ba7908290611c6c565b60408051608081018252600080825260208201819052918101919091526060808201526110af6110a8600085611c59565b8590610a16565b61ffff1681526110ca6110c3600285611c59565b8590610a3e565b60ff1660208201526110e06110c3600385611c59565b60ff1660408201526111096110f6600485611c59565b611101600485611c6c565b869190610aaf565b60608201529392505050565b6000846020015160ff1660031461112e57506000610aa7565b826020015160ff16856040015160ff161461114b57506000610aa7565b6000611156856113af565b90508360c0015161ffff168161ffff1614611175576000915050610aa7565b85516101001660000361118c576000915050610aa7565b60408087015160ff166000908152600260205220546001600160a01b0316806111ba57600092505050610aa7565b835160208501516040517fde8f50a10000000000000000000000000000000000000000000000000000000081526001600160a01b0384169263de8f50a192611208928b929190600401611cda565b602060405180830381865afa158015611225573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112499190611d13565b979650505050505050565b600080611260836113af565b90505b8451516020860151101561138557600061127c86610b8f565b90506112888188611391565b6112a9578681604051636b80573f60e11b815260040161056a929190611c95565b60a086015160c08701516000916112ce916112c5908290611c6c565b89519190611077565b90508261ffff16816000015161ffff16146112ea575050611377565b856040015160ff16816020015160ff1614611306575050611377565b60408051808201909152606081526000602082015261133386518a5161132c9190611c59565b82906115f3565b5061133e818a61166a565b50611349818761166a565b5061136182604001518260000151846060015161168b565b15611373576001945050505050610aa7565b5050505b61138085610c2d565b611263565b50600095945050505050565b60008151835114801561094357506109438360008460008751610c0a565b60006120008251111561141e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4c6f6e67206b657973206e6f74207065726d6974746564000000000000000000604482015260640161056a565b60008060005b8451601f0181101561149357600081602087010151905085518260200111156114595785518290036008026101000390811c901b5b7eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff600882901c81169490940193169190910190602001611424565b506010827fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff000016901c827dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff160191506010817fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff000016901c817dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff1601905080600883901b0191506020827fffffffff00000000ffffffff00000000ffffffff00000000ffffffff0000000016901c827bffffffff00000000ffffffff00000000ffffffff00000000ffffffff160191506040827fffffffffffffffff0000000000000000ffffffffffffffff000000000000000016901c8277ffffffffffffffff0000000000000000ffffffffffffffff16019150608082901c826fffffffffffffffffffffffffffffffff16019150601082901c61ffff16820191508192505050919050565b604080518082019091526060815260006020820152611613602083611d35565b1561163b57611623602083611d35565b61162e906020611c6c565b6116389083611c59565b91505b60208084018390526040518085526000815290818401018181101561165f57600080fd5b604052509192915050565b60408051808201909152606081526000602082015261094383838451611750565b60ff83166000908152600360205260408120546001600160a01b03166116b357506000610640565b60ff8416600090815260036020526040908190205490517ff7e83aee0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063f7e83aee9061170f9086908690600401611c95565b602060405180830381865afa15801561172c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa79190611d13565b604080518082019091526060815260006020820152825182111561177357600080fd5b83515160006117828483611c59565b905085602001518111156117a4576117a48661179f836002611d57565b611826565b8551805183820160200191600091808511156117be578482525b505050602086015b602086106117fe57805182526117dd602083611c59565b91506117ea602082611c59565b90506117f7602087611c6c565b95506117c6565b51815160001960208890036101000a0190811690199190911617905250849150509392505050565b815161183283836115f3565b5061183d838261166a565b50505050565b803560ff8116811461185457600080fd5b919050565b6001600160a01b038116811461186e57600080fd5b50565b6000806040838503121561188457600080fd5b61188d83611843565b9150602083013561189d81611859565b809150509250929050565b6000602082840312156118ba57600080fd5b813561094381611859565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156118fe576118fe6118c5565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561192d5761192d6118c5565b604052919050565b600082601f83011261194657600080fd5b813567ffffffffffffffff811115611960576119606118c5565b611973601f8201601f1916602001611904565b81815284602083860101111561198857600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f8301126119b657600080fd5b8135602067ffffffffffffffff808311156119d3576119d36118c5565b8260051b6119e2838201611904565b93845285810183019383810190888611156119fc57600080fd5b84880192505b85831015611a9357823584811115611a1a5760008081fd5b88016040818b03601f1901811315611a325760008081fd5b611a3a6118db565b8783013587811115611a4c5760008081fd5b611a5a8d8a83870101611935565b825250908201359086821115611a705760008081fd5b611a7e8c8984860101611935565b81890152845250509184019190840190611a02565b98975050505050505050565b60008060408385031215611ab257600080fd5b823567ffffffffffffffff811115611ac957600080fd5b611ad5858286016119a5565b95602094909401359450505050565b6000815180845260005b81811015611b0a57602081850181015186830182015201611aee565b506000602082860101526020601f19601f83011685010191505092915050565b604081526000611b3d6040830185611ae4565b905063ffffffff831660208301529392505050565b600060208284031215611b6457600080fd5b61094382611843565b6020815260006109436020830184611ae4565b600060208284031215611b9257600080fd5b813567ffffffffffffffff811115611ba957600080fd5b610aa7848285016119a5565b600181811c90821680611bc957607f821691505b602082108103611be957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c2d57611c2d611c05565b5060010190565b604081526000611c476040830185611ae4565b905060ff831660208301529392505050565b8082018082111561094657610946611c05565b8181038181111561094657610946611c05565b634e487b7160e01b600052600160045260246000fd5b604081526000611ca86040830185611ae4565b8281036020840152611cba8185611ae4565b95945050505050565b600081611cd257611cd2611c05565b506000190190565b606081526000611ced6060830186611ae4565b8281036020840152611cff8186611ae4565b90508281036040840152610d688185611ae4565b600060208284031215611d2557600080fd5b8151801515811461094357600080fd5b600082611d5257634e487b7160e01b600052601260045260246000fd5b500690565b808202811582820484141761094657610946611c0556fea2646970667358221220a36fa1213f53338776d2c9565e9a8b3482299a2c13495ac6aaeebf00585273ff64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a35760003560e01c806373cc48a61161007657806398d35f201161005b57806398d35f2014610161578063bdf95fef14610176578063c327deef1461018957600080fd5b806373cc48a61461010d5780638da5cb5b1461014e57600080fd5b8063020ed8d3146100a857806313af4035146100bd57806328e7677d146100d0578063440f3d42146100e3575b600080fd5b6100bb6100b6366004611871565b6101b2565b005b6100bb6100cb3660046118a8565b610241565b6100bb6100de366004611871565b610287565b6100f66100f1366004611a9f565b61030e565b604051610104929190611b2a565b60405180910390f35b61013661011b366004611b52565b6003602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610104565b600154610136906001600160a01b031681565b610169610400565b6040516101049190611b6d565b6100f6610184366004611b80565b61048e565b610136610197366004611b52565b6002602052600090815260409020546001600160a01b031681565b6001546001600160a01b031633146101c957600080fd5b60ff8216600081815260026020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386169081179091558251938452908301527ff73c3c226af96b7f1ba666a21b3ceaf2be3ee6a365e3178fd9cd1eaae0075aa891015b60405180910390a15050565b6001546001600160a01b0316331461025857600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001546001600160a01b0316331461029e57600080fd5b60ff8216600081815260036020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386169081179091558251938452908301527f2fcc274c3b72dd483ab201bfa87295e3817e8b9b10693219873b722ca1af00c79101610235565b60606000806000805461032090611bb5565b80601f016020809104026020016040519081016040528092919081815260200182805461034c90611bb5565b80156103995780601f1061036e57610100808354040283529160200191610399565b820191906000526020600020905b81548152906001019060200180831161037c57829003601f168201915b5050505050905060005b85518110156103f65760006103d28783815181106103c3576103c3611bef565b602002602001015184886104a5565b61010081015160a090910151945092508190506103ee81611c1b565b9150506103a3565b5091509250929050565b6000805461040d90611bb5565b80601f016020809104026020016040519081016040528092919081815260200182805461043990611bb5565b80156104865780601f1061045b57610100808354040283529160200191610486565b820191906000526020600020905b81548152906001019060200180831161046957829003601f168201915b505050505081565b6060600061049c834261030e565b91509150915091565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c082019290925260e081018290526101008101829052610120810191909152835161050390610647565b90506000610515828360000151610789565b604083015190915060ff1661052b8260006108e6565b14610573578082604001516040517fe861b2bd00000000000000000000000000000000000000000000000000000000815260040161056a929190611c34565b60405180910390fd5b6101208201819052608082015160009084900360030b12156105d75760808201516040517fa784f87e00000000000000000000000000000000000000000000000000000000815263ffffffff9182166004820152908416602482015260440161056a565b60a0820151600090840360030b12156106325760a08201516040517fbd41036a00000000000000000000000000000000000000000000000000000000815263ffffffff9182166004820152908416602482015260440161056a565b61063e8183878761094c565b505b9392505050565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e082018190526101008201819052610120820152906106a2908390610a16565b61ffff1681526106b3826002610a3e565b60ff1660208201526106c6826003610a3e565b60ff1660408201526106d9826004610a62565b63ffffffff90811660608301526106f5908390600890610a6216565b63ffffffff9081166080830152610711908390600c90610a6216565b63ffffffff90811660a083015261072d908390601090610a1616565b61ffff1660c0820152610741826012610a8c565b60e082018190525161077e90610758906012611c59565b8260e00151516012855161076c9190611c6c565b6107769190611c6c565b849190610aaf565b610100820152919050565b6060600061079684610b31565b90505b805151602082015110156108df57606081015161ffff166001146107f55760608101516040517f98a5f31a00000000000000000000000000000000000000000000000000000000815261ffff909116600482015260240161056a565b815160000361080e5761080781610b8f565b9150610878565b6020810151815161081e91610bb0565b8251141580610841575080516020820151835161083f928592600092610c0a565b155b15610878576040517fcbceee6f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8261ffff16816040015161ffff16146108d15760408082015190517fa6ff8a8a00000000000000000000000000000000000000000000000000000000815261ffff9182166004820152908416602482015260440161056a565b6108da81610c2d565b610799565b5092915050565b6000805b835183106108fa576108fa611c7f565b60006109068585610a3e565b60ff169050610916816001611c59565b6109209085611c59565b9350806000036109305750610943565b61093b600183611c59565b9150506108ea565b90505b92915050565b60e083015161095c908590610d15565b6109995760e08301516040517feaafc59b00000000000000000000000000000000000000000000000000000000815261056a918691600401611c95565b60006109a58282610d72565b9050602b61ffff16816040015161ffff16036109cb576109c6848483610dd3565b610a0f565b603061ffff16816040015161ffff16036109ea576109c6848483610ec0565b60408082015190516361529e8760e01b815261ffff909116600482015260240161056a565b5050505050565b8151600090610a26836002611c59565b1115610a3157600080fd5b50016002015161ffff1690565b6000828281518110610a5257610a52611bef565b016020015160f81c905092915050565b8151600090610a72836004611c59565b1115610a7d57600080fd5b50016004015163ffffffff1690565b60606000610a9a8484610bb0565b9050610aa7848483610aaf565b949350505050565b8251606090610abe8385611c59565b1115610ac957600080fd5b60008267ffffffffffffffff811115610ae457610ae46118c5565b6040519080825280601f01601f191660200182016040528015610b0e576020820181803683370190505b50905060208082019086860101610b26828287610f88565b509095945050505050565b610b7f6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b6109468261010001516000610d72565b6020810151815160609161094691610ba79082610bb0565b84519190610aaf565b6000815b83518110610bc457610bc4611c7f565b6000610bd08583610a3e565b60ff169050610be0816001611c59565b610bea9083611c59565b915080600003610bfa5750610c00565b50610bb4565b610aa78382611c6c565b6000610c17848484610fde565b610c22878785610fde565b149695505050505050565b60c08101516020820181905281515111610c445750565b6000610c5882600001518360200151610bb0565b8260200151610c679190611c59565b8251909150610c769082610a16565b61ffff166040830152610c8a600282611c59565b8251909150610c999082610a16565b61ffff166060830152610cad600282611c59565b8251909150610cbc9082610a62565b63ffffffff166080830152610cd2600482611c59565b8251909150600090610ce49083610a16565b61ffff169050610cf5600283611c59565b60a084018190529150610d088183611c59565b60c0909301929092525050565b60008080610d2385826108e6565b90506000610d328560006108e6565b90505b80821115610d5b57610d478684611002565b925081610d5381611cc3565b925050610d35565b610d688684876000611026565b9695505050505050565b610dc06040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261094681610c2d565b60208101516000610de385610b31565b90505b80515160208201511015610ea057604081015161ffff16603014610e295760408082015190516361529e8760e01b815261ffff909116600482015260240161056a565b6000610e348261105b565b90506000610e4f60008351846110779092919063ffffffff16565b9050610e5d81838989611115565b15610e9057610e728760e00151868385611254565b15610e805750505050505050565b60c08501849052610e9085610c2d565b5050610e9b81610c2d565b610de6565b508360e001516040516306cde0f360e01b815260040161056a9190611b6d565b80515160208201511015610f69576000610ed982610b8f565b9050610ef28460e001518261139190919063ffffffff16565b610f17578360e0015181604051636b80573f60e11b815260040161056a929190611c95565b6000610f228361105b565b90506000610f3d60008351846110779092919063ffffffff16565b9050610f4b81838888611115565b15610f5857505050505050565b505050610f6481610c2d565b610ec0565b8260e001516040516306cde0f360e01b815260040161056a9190611b6d565b60208110610fc05781518352610f9f602084611c59565b9250610fac602083611c59565b9150610fb9602082611c6c565b9050610f88565b905182516020929092036101000a6000190180199091169116179052565b8251600090610fed8385611c59565b1115610ff857600080fd5b5091016020012090565b600061100e8383610a3e565b60ff1661101c836001611c59565b6109439190611c59565b600061103f838384865161103a9190611c6c565b610fde565b611051868687895161103a9190611c6c565b1495945050505050565b60a081015160c082015160609161094691610ba7908290611c6c565b60408051608081018252600080825260208201819052918101919091526060808201526110af6110a8600085611c59565b8590610a16565b61ffff1681526110ca6110c3600285611c59565b8590610a3e565b60ff1660208201526110e06110c3600385611c59565b60ff1660408201526111096110f6600485611c59565b611101600485611c6c565b869190610aaf565b60608201529392505050565b6000846020015160ff1660031461112e57506000610aa7565b826020015160ff16856040015160ff161461114b57506000610aa7565b6000611156856113af565b90508360c0015161ffff168161ffff1614611175576000915050610aa7565b85516101001660000361118c576000915050610aa7565b60408087015160ff166000908152600260205220546001600160a01b0316806111ba57600092505050610aa7565b835160208501516040517fde8f50a10000000000000000000000000000000000000000000000000000000081526001600160a01b0384169263de8f50a192611208928b929190600401611cda565b602060405180830381865afa158015611225573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112499190611d13565b979650505050505050565b600080611260836113af565b90505b8451516020860151101561138557600061127c86610b8f565b90506112888188611391565b6112a9578681604051636b80573f60e11b815260040161056a929190611c95565b60a086015160c08701516000916112ce916112c5908290611c6c565b89519190611077565b90508261ffff16816000015161ffff16146112ea575050611377565b856040015160ff16816020015160ff1614611306575050611377565b60408051808201909152606081526000602082015261133386518a5161132c9190611c59565b82906115f3565b5061133e818a61166a565b50611349818761166a565b5061136182604001518260000151846060015161168b565b15611373576001945050505050610aa7565b5050505b61138085610c2d565b611263565b50600095945050505050565b60008151835114801561094357506109438360008460008751610c0a565b60006120008251111561141e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4c6f6e67206b657973206e6f74207065726d6974746564000000000000000000604482015260640161056a565b60008060005b8451601f0181101561149357600081602087010151905085518260200111156114595785518290036008026101000390811c901b5b7eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff600882901c81169490940193169190910190602001611424565b506010827fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff000016901c827dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff160191506010817fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff000016901c817dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff1601905080600883901b0191506020827fffffffff00000000ffffffff00000000ffffffff00000000ffffffff0000000016901c827bffffffff00000000ffffffff00000000ffffffff00000000ffffffff160191506040827fffffffffffffffff0000000000000000ffffffffffffffff000000000000000016901c8277ffffffffffffffff0000000000000000ffffffffffffffff16019150608082901c826fffffffffffffffffffffffffffffffff16019150601082901c61ffff16820191508192505050919050565b604080518082019091526060815260006020820152611613602083611d35565b1561163b57611623602083611d35565b61162e906020611c6c565b6116389083611c59565b91505b60208084018390526040518085526000815290818401018181101561165f57600080fd5b604052509192915050565b60408051808201909152606081526000602082015261094383838451611750565b60ff83166000908152600360205260408120546001600160a01b03166116b357506000610640565b60ff8416600090815260036020526040908190205490517ff7e83aee0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063f7e83aee9061170f9086908690600401611c95565b602060405180830381865afa15801561172c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa79190611d13565b604080518082019091526060815260006020820152825182111561177357600080fd5b83515160006117828483611c59565b905085602001518111156117a4576117a48661179f836002611d57565b611826565b8551805183820160200191600091808511156117be578482525b505050602086015b602086106117fe57805182526117dd602083611c59565b91506117ea602082611c59565b90506117f7602087611c6c565b95506117c6565b51815160001960208890036101000a0190811690199190911617905250849150509392505050565b815161183283836115f3565b5061183d838261166a565b50505050565b803560ff8116811461185457600080fd5b919050565b6001600160a01b038116811461186e57600080fd5b50565b6000806040838503121561188457600080fd5b61188d83611843565b9150602083013561189d81611859565b809150509250929050565b6000602082840312156118ba57600080fd5b813561094381611859565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156118fe576118fe6118c5565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561192d5761192d6118c5565b604052919050565b600082601f83011261194657600080fd5b813567ffffffffffffffff811115611960576119606118c5565b611973601f8201601f1916602001611904565b81815284602083860101111561198857600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f8301126119b657600080fd5b8135602067ffffffffffffffff808311156119d3576119d36118c5565b8260051b6119e2838201611904565b93845285810183019383810190888611156119fc57600080fd5b84880192505b85831015611a9357823584811115611a1a5760008081fd5b88016040818b03601f1901811315611a325760008081fd5b611a3a6118db565b8783013587811115611a4c5760008081fd5b611a5a8d8a83870101611935565b825250908201359086821115611a705760008081fd5b611a7e8c8984860101611935565b81890152845250509184019190840190611a02565b98975050505050505050565b60008060408385031215611ab257600080fd5b823567ffffffffffffffff811115611ac957600080fd5b611ad5858286016119a5565b95602094909401359450505050565b6000815180845260005b81811015611b0a57602081850181015186830182015201611aee565b506000602082860101526020601f19601f83011685010191505092915050565b604081526000611b3d6040830185611ae4565b905063ffffffff831660208301529392505050565b600060208284031215611b6457600080fd5b61094382611843565b6020815260006109436020830184611ae4565b600060208284031215611b9257600080fd5b813567ffffffffffffffff811115611ba957600080fd5b610aa7848285016119a5565b600181811c90821680611bc957607f821691505b602082108103611be957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c2d57611c2d611c05565b5060010190565b604081526000611c476040830185611ae4565b905060ff831660208301529392505050565b8082018082111561094657610946611c05565b8181038181111561094657610946611c05565b634e487b7160e01b600052600160045260246000fd5b604081526000611ca86040830185611ae4565b8281036020840152611cba8185611ae4565b95945050505050565b600081611cd257611cd2611c05565b506000190190565b606081526000611ced6060830186611ae4565b8281036020840152611cff8186611ae4565b90508281036040840152610d688185611ae4565b600060208284031215611d2557600080fd5b8151801515811461094357600080fd5b600082611d5257634e487b7160e01b600052601260045260246000fd5b500690565b808202811582820484141761094657610946611c0556fea2646970667358221220a36fa1213f53338776d2c9565e9a8b3482299a2c13495ac6aaeebf00585273ff64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "constructor": { + "details": "Constructor.", + "params": { + "_anchors": "The binary format RR entries for the root DS records." + } + }, + "setAlgorithm(uint8,address)": { + "details": "Sets the contract address for a signature verification algorithm. Callable only by the owner.", + "params": { + "algo": "The address of the algorithm contract.", + "id": "The algorithm ID" + } + }, + "setDigest(uint8,address)": { + "details": "Sets the contract address for a digest verification algorithm. Callable only by the owner.", + "params": { + "digest": "The address of the digest contract.", + "id": "The digest ID" + } + }, + "verifyRRSet((bytes,bytes)[])": { + "details": "Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain. Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.", + "params": { + "input": "A list of signed RRSets." + }, + "returns": { + "inception": "The inception time of the signed record set.", + "rrs": "The RRData from the last RRSet in the chain." + } + }, + "verifyRRSet((bytes,bytes)[],uint256)": { + "details": "Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain. Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.", + "params": { + "input": "A list of signed RRSets.", + "now": "The Unix timestamp to validate the records at." + }, + "returns": { + "inception": "The inception time of the signed record set.", + "rrs": "The RRData from the last RRSet in the chain." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 7153, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "anchors", + "offset": 0, + "slot": "0", + "type": "t_bytes_storage" + }, + { + "astId": 8130, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "owner", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 7285, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "algorithms", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint8,t_contract(Algorithm)9293)" + }, + { + "astId": 7290, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "digests", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint8,t_contract(Digest)11134)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(Algorithm)9293": { + "encoding": "inplace", + "label": "contract Algorithm", + "numberOfBytes": "20" + }, + "t_contract(Digest)11134": { + "encoding": "inplace", + "label": "contract Digest", + "numberOfBytes": "20" + }, + "t_mapping(t_uint8,t_contract(Algorithm)9293)": { + "encoding": "mapping", + "key": "t_uint8", + "label": "mapping(uint8 => contract Algorithm)", + "numberOfBytes": "32", + "value": "t_contract(Algorithm)9293" + }, + "t_mapping(t_uint8,t_contract(Digest)11134)": { + "encoding": "mapping", + "key": "t_uint8", + "label": "mapping(uint8 => contract Digest)", + "numberOfBytes": "32", + "value": "t_contract(Digest)11134" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/DefaultReverseResolver.json b/solidity/dns-contracts/deployments/mainnet/DefaultReverseResolver.json new file mode 100644 index 0000000..9868de6 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/DefaultReverseResolver.json @@ -0,0 +1,73 @@ +{ + "address": "0xA2C122BE93b0074270ebeE7f6b7292C7deB45047", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "ensAddr", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "constant": true, + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ] +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/ENSRegistry.json b/solidity/dns-contracts/deployments/mainnet/ENSRegistry.json new file mode 100644 index 0000000..4b2f5ae --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/ENSRegistry.json @@ -0,0 +1,425 @@ +{ + "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_old", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NewOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "NewResolver", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "NewTTL", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "old", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "recordExists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "resolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setRecord", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "ttl", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ] +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/ETHRegistrarController.json b/solidity/dns-contracts/deployments/mainnet/ETHRegistrarController.json new file mode 100644 index 0000000..261d56f --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/ETHRegistrarController.json @@ -0,0 +1,736 @@ +{ + "address": "0x253553366Da8546fC250F225fe3d25d0C782303b", + "abi": [ + { + "inputs": [ + { + "internalType": "contract BaseRegistrarImplementation", + "name": "_base", + "type": "address" + }, + { + "internalType": "contract IPriceOracle", + "name": "_prices", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minCommitmentAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxCommitmentAge", + "type": "uint256" + }, + { + "internalType": "contract ReverseRegistrar", + "name": "_reverseRegistrar", + "type": "address" + }, + { + "internalType": "contract INameWrapper", + "name": "_nameWrapper", + "type": "address" + }, + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "CommitmentTooNew", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "CommitmentTooOld", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "DurationTooShort", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientValue", + "type": "error" + }, + { + "inputs": [], + "name": "MaxCommitmentAgeTooHigh", + "type": "error" + }, + { + "inputs": [], + "name": "MaxCommitmentAgeTooLow", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameNotAvailable", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverRequiredWhenDataSupplied", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "UnexpiredCommitmentExists", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "baseCost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "premium", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRenewed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "MIN_REGISTRATION_DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "available", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "commit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "commitments", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "bool", + "name": "reverseRecord", + "type": "bool" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "name": "makeCommitment", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "maxCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nameWrapper", + "outputs": [ + { + "internalType": "contract INameWrapper", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "prices", + "outputs": [ + { + "internalType": "contract IPriceOracle", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "recoverFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "bool", + "name": "reverseRecord", + "type": "bool" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "rentPrice", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "base", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "premium", + "type": "uint256" + } + ], + "internalType": "struct IPriceOracle.Price", + "name": "price", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "reverseRegistrar", + "outputs": [ + { + "internalType": "contract ReverseRegistrar", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "valid", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xd4c3af572220ed3391cd22e5703a335b99590272a8d76f9678a75f2b98d1815e", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0x253553366Da8546fC250F225fe3d25d0C782303b", + "transactionIndex": 75, + "gasUsed": "1776258", + "logsBloom": "0x00000000000000000000000008000000000000000000000000810000000000000000000000000000000000000000000000000000000010000000000000000000000004000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000001000000000000000000400000011000000000000010000000000000000000000000000000000000000000000000000000040000000000000004000000000000000000008000040000000000000000000000008000000000005000000000020000000000000000000020000000000000000000000000000100000000000000001000000000000000000000", + "blockHash": "0x5265c70299327fa9d06f7acab60ee27c4c5c1a3d0f0831cb25224a304c516768", + "transactionHash": "0xd4c3af572220ed3391cd22e5703a335b99590272a8d76f9678a75f2b98d1815e", + "logs": [ + { + "transactionIndex": 75, + "blockNumber": 16925618, + "transactionHash": "0xd4c3af572220ed3391cd22e5703a335b99590272a8d76f9678a75f2b98d1815e", + "address": "0x253553366Da8546fC250F225fe3d25d0C782303b", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000904dac3347ea47d208f3fd67402d039a3b99859" + ], + "data": "0x", + "logIndex": 118, + "blockHash": "0x5265c70299327fa9d06f7acab60ee27c4c5c1a3d0f0831cb25224a304c516768" + }, + { + "transactionIndex": 75, + "blockNumber": 16925618, + "transactionHash": "0xd4c3af572220ed3391cd22e5703a335b99590272a8d76f9678a75f2b98d1815e", + "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "topics": [ + "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", + "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2", + "0x818432674e37a69789e6ae256396e23de2a71d427f7360270fa8b057d8144381" + ], + "data": "0x0000000000000000000000000904dac3347ea47d208f3fd67402d039a3b99859", + "logIndex": 119, + "blockHash": "0x5265c70299327fa9d06f7acab60ee27c4c5c1a3d0f0831cb25224a304c516768" + } + ], + "blockNumber": 16925618, + "cumulativeGasUsed": "6857009", + "status": 1, + "byzantium": true + }, + "args": [ + "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85", + "0x7542565191d074cE84fBfA92cAE13AcB84788CA9", + 60, + 86400, + "0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb", + "0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401", + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "numDeployments": 1, + "solcInputHash": "1834f6cfd464e3a85d236ff981ae4c0e", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract BaseRegistrarImplementation\",\"name\":\"_base\",\"type\":\"address\"},{\"internalType\":\"contract IPriceOracle\",\"name\":\"_prices\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_minCommitmentAge\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxCommitmentAge\",\"type\":\"uint256\"},{\"internalType\":\"contract ReverseRegistrar\",\"name\":\"_reverseRegistrar\",\"type\":\"address\"},{\"internalType\":\"contract INameWrapper\",\"name\":\"_nameWrapper\",\"type\":\"address\"},{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"CommitmentTooNew\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"CommitmentTooOld\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"DurationTooShort\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxCommitmentAgeTooHigh\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxCommitmentAgeTooLow\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NameNotAvailable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverRequiredWhenDataSupplied\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"UnexpiredCommitmentExists\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"baseCost\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameRenewed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MIN_REGISTRATION_DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"available\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"commit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"commitments\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"bool\",\"name\":\"reverseRecord\",\"type\":\"bool\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"name\":\"makeCommitment\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxCommitmentAge\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minCommitmentAge\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nameWrapper\",\"outputs\":[{\"internalType\":\"contract INameWrapper\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"prices\",\"outputs\":[{\"internalType\":\"contract IPriceOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"recoverFunds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"bool\",\"name\":\"reverseRecord\",\"type\":\"bool\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"renew\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"rentPrice\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"base\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"}],\"internalType\":\"struct IPriceOracle.Price\",\"name\":\"price\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"reverseRegistrar\",\"outputs\":[{\"internalType\":\"contract ReverseRegistrar\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"valid\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"A registrar controller for registering and renewing names at fixed cost.\",\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"recoverFunds(address,address,uint256)\":{\"details\":\"The contract is Ownable and only the owner can call the recover function.\",\"params\":{\"_amount\":\"The amount of tokens to recover.\",\"_to\":\"The address to send the tokens to.\",\"_token\":\"The address of the ERC20 token to recover\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"recoverFunds(address,address,uint256)\":{\"notice\":\"Recover ERC20 tokens sent to the contract by mistake.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/ETHRegistrarController.sol\":\"ETHRegistrarController\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1300},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6392f2cfe3a5ee802227fe7a2dfd47096d881aec89bddd214b35c5b46d3cd941\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/ERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721.sol\\\";\\nimport \\\"./IERC721Receiver.sol\\\";\\nimport \\\"./extensions/IERC721Metadata.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\nimport \\\"../../utils/Strings.sol\\\";\\nimport \\\"../../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\n * {ERC721Enumerable}.\\n */\\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\\n using Address for address;\\n using Strings for uint256;\\n\\n // Token name\\n string private _name;\\n\\n // Token symbol\\n string private _symbol;\\n\\n // Mapping from token ID to owner address\\n mapping(uint256 => address) private _owners;\\n\\n // Mapping owner address to token count\\n mapping(address => uint256) private _balances;\\n\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) private _tokenApprovals;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IERC721).interfaceId ||\\n interfaceId == type(IERC721Metadata).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721-balanceOf}.\\n */\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\n return _balances[owner];\\n }\\n\\n /**\\n * @dev See {IERC721-ownerOf}.\\n */\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\n address owner = _ownerOf(tokenId);\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n _requireMinted(tokenId);\\n\\n string memory baseURI = _baseURI();\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\n }\\n\\n /**\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\n * by default, can be overridden in child contracts.\\n */\\n function _baseURI() internal view virtual returns (string memory) {\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual override {\\n address owner = ERC721.ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\n _requireMinted(tokenId);\\n\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC721-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC721-isApprovedForAll}.\\n */\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[owner][operator];\\n }\\n\\n /**\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n _safeTransfer(from, to, tokenId, data);\\n }\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\n *\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeTransfer(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) internal virtual {\\n _transfer(from, to, tokenId);\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n }\\n\\n /**\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\n }\\n\\n /**\\n * @dev Returns whether `tokenId` exists.\\n *\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\n *\\n * Tokens start existing when they are minted (`_mint`),\\n * and stop existing when they are burned (`_burn`).\\n */\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\n return _ownerOf(tokenId) != address(0);\\n }\\n\\n /**\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\n address owner = ERC721.ownerOf(tokenId);\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\n }\\n\\n /**\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\n _safeMint(to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\n */\\n function _safeMint(\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) internal virtual {\\n _mint(to, tokenId);\\n require(\\n _checkOnERC721Received(address(0), to, tokenId, data),\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\n );\\n }\\n\\n /**\\n * @dev Mints `tokenId` and transfers it to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - `to` cannot be the zero address.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _mint(address to, uint256 tokenId) internal virtual {\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n _beforeTokenTransfer(address(0), to, tokenId, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _burn(uint256 tokenId) internal virtual {\\n address owner = ERC721.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\n }\\n\\n /**\\n * @dev Transfers `tokenId` from `from` to `to`.\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _transfer(\\n address from,\\n address to,\\n uint256 tokenId\\n ) internal virtual {\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, tokenId, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(\\n address owner,\\n address operator,\\n bool approved\\n ) internal virtual {\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Reverts if the `tokenId` has not been minted yet.\\n */\\n function _requireMinted(uint256 tokenId) internal view virtual {\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\n }\\n\\n /**\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\n * The call is not executed if the target address is not a contract.\\n *\\n * @param from address representing the previous owner of the given token ID\\n * @param to target address that will receive the tokens\\n * @param tokenId uint256 ID of the token to be transferred\\n * @param data bytes optional data to send along with the call\\n * @return bool whether the call correctly returned the expected magic value\\n */\\n function _checkOnERC721Received(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) private returns (bool) {\\n if (to.isContract()) {\\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721Receiver.onERC721Received.selector;\\n } catch (bytes memory reason) {\\n if (reason.length == 0) {\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n } else {\\n /// @solidity memory-safe-assembly\\n assembly {\\n revert(add(32, reason), mload(reason))\\n }\\n }\\n }\\n } else {\\n return true;\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256, /* firstTokenId */\\n uint256 batchSize\\n ) internal virtual {\\n if (batchSize > 1) {\\n if (from != address(0)) {\\n _balances[from] -= batchSize;\\n }\\n if (to != address(0)) {\\n _balances[to] += batchSize;\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 firstTokenId,\\n uint256 batchSize\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0xd89f3585b211fc9e3408384a4c4efdc3a93b2f877a3821046fa01c219d35be1b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xab28a56179c1db258c9bf5235b382698cb650debecb51b23d12be9e241374b68\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721Metadata is IERC721 {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\"},\"contracts/ethregistrar/BaseRegistrarImplementation.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/ERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\\n // A map of expiry times\\n mapping(uint256 => uint256) expiries;\\n // The ENS registry\\n ENS public ens;\\n // The namehash of the TLD this registrar owns (eg, .eth)\\n bytes32 public baseNode;\\n // A map of addresses that are authorised to register and renew names.\\n mapping(address => bool) public controllers;\\n uint256 public constant GRACE_PERIOD = 90 days;\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n bytes4 private constant ERC721_ID =\\n bytes4(\\n keccak256(\\\"balanceOf(address)\\\") ^\\n keccak256(\\\"ownerOf(uint256)\\\") ^\\n keccak256(\\\"approve(address,uint256)\\\") ^\\n keccak256(\\\"getApproved(uint256)\\\") ^\\n keccak256(\\\"setApprovalForAll(address,bool)\\\") ^\\n keccak256(\\\"isApprovedForAll(address,address)\\\") ^\\n keccak256(\\\"transferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256,bytes)\\\")\\n );\\n bytes4 private constant RECLAIM_ID =\\n bytes4(keccak256(\\\"reclaim(uint256,address)\\\"));\\n\\n /**\\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\\n * @dev Returns whether the given spender can transfer a given token ID\\n * @param spender address of the spender to query\\n * @param tokenId uint256 ID of the token to be transferred\\n * @return bool whether the msg.sender is approved for the given token ID,\\n * is an operator of the owner, or is the owner of the token\\n */\\n function _isApprovedOrOwner(\\n address spender,\\n uint256 tokenId\\n ) internal view override returns (bool) {\\n address owner = ownerOf(tokenId);\\n return (spender == owner ||\\n getApproved(tokenId) == spender ||\\n isApprovedForAll(owner, spender));\\n }\\n\\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\\\"\\\", \\\"\\\") {\\n ens = _ens;\\n baseNode = _baseNode;\\n }\\n\\n modifier live() {\\n require(ens.owner(baseNode) == address(this));\\n _;\\n }\\n\\n modifier onlyController() {\\n require(controllers[msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Gets the owner of the specified token ID. Names become unowned\\n * when their registration expires.\\n * @param tokenId uint256 ID of the token to query the owner of\\n * @return address currently marked as the owner of the given token ID\\n */\\n function ownerOf(\\n uint256 tokenId\\n ) public view override(IERC721, ERC721) returns (address) {\\n require(expiries[tokenId] > block.timestamp);\\n return super.ownerOf(tokenId);\\n }\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external override onlyOwner {\\n controllers[controller] = true;\\n emit ControllerAdded(controller);\\n }\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external override onlyOwner {\\n controllers[controller] = false;\\n emit ControllerRemoved(controller);\\n }\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external override onlyOwner {\\n ens.setResolver(baseNode, resolver);\\n }\\n\\n // Returns the expiration timestamp of the specified id.\\n function nameExpires(uint256 id) external view override returns (uint256) {\\n return expiries[id];\\n }\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) public view override returns (bool) {\\n // Not available if it's registered here or in its grace period.\\n return expiries[id] + GRACE_PERIOD < block.timestamp;\\n }\\n\\n /**\\n * @dev Register a name.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external override returns (uint256) {\\n return _register(id, owner, duration, true);\\n }\\n\\n /**\\n * @dev Register a name, without modifying the registry.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function registerOnly(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256) {\\n return _register(id, owner, duration, false);\\n }\\n\\n function _register(\\n uint256 id,\\n address owner,\\n uint256 duration,\\n bool updateRegistry\\n ) internal live onlyController returns (uint256) {\\n require(available(id));\\n require(\\n block.timestamp + duration + GRACE_PERIOD >\\n block.timestamp + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] = block.timestamp + duration;\\n if (_exists(id)) {\\n // Name was previously owned, and expired\\n _burn(id);\\n }\\n _mint(owner, id);\\n if (updateRegistry) {\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n emit NameRegistered(id, owner, block.timestamp + duration);\\n\\n return block.timestamp + duration;\\n }\\n\\n function renew(\\n uint256 id,\\n uint256 duration\\n ) external override live onlyController returns (uint256) {\\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\\n require(\\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] += duration;\\n emit NameRenewed(id, expiries[id]);\\n return expiries[id];\\n }\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external override live {\\n require(_isApprovedOrOwner(msg.sender, id));\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view override(ERC721, IERC165) returns (bool) {\\n return\\n interfaceID == INTERFACE_META_ID ||\\n interfaceID == ERC721_ID ||\\n interfaceID == RECLAIM_ID;\\n }\\n}\\n\",\"keccak256\":\"0xaee6eb36aead449d397b86a02e9c63bc46e3ef378d0a62bfd68beaae1150c9d0\"},\"contracts/ethregistrar/ETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport {BaseRegistrarImplementation} from \\\"./BaseRegistrarImplementation.sol\\\";\\nimport {StringUtils} from \\\"./StringUtils.sol\\\";\\nimport {Resolver} from \\\"../resolvers/Resolver.sol\\\";\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {ReverseRegistrar} from \\\"../reverseRegistrar/ReverseRegistrar.sol\\\";\\nimport {ReverseClaimer} from \\\"../reverseRegistrar/ReverseClaimer.sol\\\";\\nimport {IETHRegistrarController, IPriceOracle} from \\\"./IETHRegistrarController.sol\\\";\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {INameWrapper} from \\\"../wrapper/INameWrapper.sol\\\";\\nimport {ERC20Recoverable} from \\\"../utils/ERC20Recoverable.sol\\\";\\n\\nerror CommitmentTooNew(bytes32 commitment);\\nerror CommitmentTooOld(bytes32 commitment);\\nerror NameNotAvailable(string name);\\nerror DurationTooShort(uint256 duration);\\nerror ResolverRequiredWhenDataSupplied();\\nerror UnexpiredCommitmentExists(bytes32 commitment);\\nerror InsufficientValue();\\nerror Unauthorised(bytes32 node);\\nerror MaxCommitmentAgeTooLow();\\nerror MaxCommitmentAgeTooHigh();\\n\\n/**\\n * @dev A registrar controller for registering and renewing names at fixed cost.\\n */\\ncontract ETHRegistrarController is\\n Ownable,\\n IETHRegistrarController,\\n IERC165,\\n ERC20Recoverable,\\n ReverseClaimer\\n{\\n using StringUtils for *;\\n using Address for address;\\n\\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\\n bytes32 private constant ETH_NODE =\\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\\n uint64 private constant MAX_EXPIRY = type(uint64).max;\\n BaseRegistrarImplementation immutable base;\\n IPriceOracle public immutable prices;\\n uint256 public immutable minCommitmentAge;\\n uint256 public immutable maxCommitmentAge;\\n ReverseRegistrar public immutable reverseRegistrar;\\n INameWrapper public immutable nameWrapper;\\n\\n mapping(bytes32 => uint256) public commitments;\\n\\n event NameRegistered(\\n string name,\\n bytes32 indexed label,\\n address indexed owner,\\n uint256 baseCost,\\n uint256 premium,\\n uint256 expires\\n );\\n event NameRenewed(\\n string name,\\n bytes32 indexed label,\\n uint256 cost,\\n uint256 expires\\n );\\n\\n constructor(\\n BaseRegistrarImplementation _base,\\n IPriceOracle _prices,\\n uint256 _minCommitmentAge,\\n uint256 _maxCommitmentAge,\\n ReverseRegistrar _reverseRegistrar,\\n INameWrapper _nameWrapper,\\n ENS _ens\\n ) ReverseClaimer(_ens, msg.sender) {\\n if (_maxCommitmentAge <= _minCommitmentAge) {\\n revert MaxCommitmentAgeTooLow();\\n }\\n\\n if (_maxCommitmentAge > block.timestamp) {\\n revert MaxCommitmentAgeTooHigh();\\n }\\n\\n base = _base;\\n prices = _prices;\\n minCommitmentAge = _minCommitmentAge;\\n maxCommitmentAge = _maxCommitmentAge;\\n reverseRegistrar = _reverseRegistrar;\\n nameWrapper = _nameWrapper;\\n }\\n\\n function rentPrice(\\n string memory name,\\n uint256 duration\\n ) public view override returns (IPriceOracle.Price memory price) {\\n bytes32 label = keccak256(bytes(name));\\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\\n }\\n\\n function valid(string memory name) public pure returns (bool) {\\n return name.strlen() >= 3;\\n }\\n\\n function available(string memory name) public view override returns (bool) {\\n bytes32 label = keccak256(bytes(name));\\n return valid(name) && base.available(uint256(label));\\n }\\n\\n function makeCommitment(\\n string memory name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] calldata data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses\\n ) public pure override returns (bytes32) {\\n bytes32 label = keccak256(bytes(name));\\n if (data.length > 0 && resolver == address(0)) {\\n revert ResolverRequiredWhenDataSupplied();\\n }\\n return\\n keccak256(\\n abi.encode(\\n label,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses\\n )\\n );\\n }\\n\\n function commit(bytes32 commitment) public override {\\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\\n revert UnexpiredCommitmentExists(commitment);\\n }\\n commitments[commitment] = block.timestamp;\\n }\\n\\n function register(\\n string calldata name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] calldata data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses\\n ) public payable override {\\n IPriceOracle.Price memory price = rentPrice(name, duration);\\n if (msg.value < price.base + price.premium) {\\n revert InsufficientValue();\\n }\\n\\n _consumeCommitment(\\n name,\\n duration,\\n makeCommitment(\\n name,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses\\n )\\n );\\n\\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\\n name,\\n owner,\\n duration,\\n resolver,\\n ownerControlledFuses\\n );\\n\\n if (data.length > 0) {\\n _setRecords(resolver, keccak256(bytes(name)), data);\\n }\\n\\n if (reverseRecord) {\\n _setReverseRecord(name, resolver, msg.sender);\\n }\\n\\n emit NameRegistered(\\n name,\\n keccak256(bytes(name)),\\n owner,\\n price.base,\\n price.premium,\\n expires\\n );\\n\\n if (msg.value > (price.base + price.premium)) {\\n payable(msg.sender).transfer(\\n msg.value - (price.base + price.premium)\\n );\\n }\\n }\\n\\n function renew(\\n string calldata name,\\n uint256 duration\\n ) external payable override {\\n bytes32 labelhash = keccak256(bytes(name));\\n uint256 tokenId = uint256(labelhash);\\n IPriceOracle.Price memory price = rentPrice(name, duration);\\n if (msg.value < price.base) {\\n revert InsufficientValue();\\n }\\n uint256 expires = nameWrapper.renew(tokenId, duration);\\n\\n if (msg.value > price.base) {\\n payable(msg.sender).transfer(msg.value - price.base);\\n }\\n\\n emit NameRenewed(name, labelhash, msg.value, expires);\\n }\\n\\n function withdraw() public {\\n payable(owner()).transfer(address(this).balance);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IETHRegistrarController).interfaceId;\\n }\\n\\n /* Internal functions */\\n\\n function _consumeCommitment(\\n string memory name,\\n uint256 duration,\\n bytes32 commitment\\n ) internal {\\n // Require an old enough commitment.\\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\\n revert CommitmentTooNew(commitment);\\n }\\n\\n // If the commitment is too old, or the name is registered, stop\\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\\n revert CommitmentTooOld(commitment);\\n }\\n if (!available(name)) {\\n revert NameNotAvailable(name);\\n }\\n\\n delete (commitments[commitment]);\\n\\n if (duration < MIN_REGISTRATION_DURATION) {\\n revert DurationTooShort(duration);\\n }\\n }\\n\\n function _setRecords(\\n address resolverAddress,\\n bytes32 label,\\n bytes[] calldata data\\n ) internal {\\n // use hardcoded .eth namehash\\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\\n Resolver resolver = Resolver(resolverAddress);\\n resolver.multicallWithNodeCheck(nodehash, data);\\n }\\n\\n function _setReverseRecord(\\n string memory name,\\n address resolver,\\n address owner\\n ) internal {\\n reverseRegistrar.setNameForAddr(\\n msg.sender,\\n owner,\\n resolver,\\n string.concat(name, \\\".eth\\\")\\n );\\n }\\n}\\n\",\"keccak256\":\"0x2ba2cab655f9128ae5c803540b8712be9bdfee1a28b9623a06c02c2435d0ce8b\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x9ac51351ff72d73083aed62b7cdad4c07e9d1eb68401d7fd8457bdd828f2c6fe\"},\"contracts/ethregistrar/IETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./IPriceOracle.sol\\\";\\n\\ninterface IETHRegistrarController {\\n function rentPrice(\\n string memory,\\n uint256\\n ) external view returns (IPriceOracle.Price memory);\\n\\n function available(string memory) external returns (bool);\\n\\n function makeCommitment(\\n string memory,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16\\n ) external pure returns (bytes32);\\n\\n function commit(bytes32) external;\\n\\n function register(\\n string calldata,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16\\n ) external payable;\\n\\n function renew(string calldata, uint256) external payable;\\n}\\n\",\"keccak256\":\"0x54575cc2e4245c0ba79e42a58086335ec0522f4cbeb8c92d71b886593c97060e\",\"license\":\"MIT\"},\"contracts/ethregistrar/IPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\ninterface IPriceOracle {\\n struct Price {\\n uint256 base;\\n uint256 premium;\\n }\\n\\n /**\\n * @dev Returns the price to register or renew a name.\\n * @param name The name being registered or renewed.\\n * @param expires When the name presently expires (0 if this is a new registration).\\n * @param duration How long the name is being registered or extended for, in seconds.\\n * @return base premium tuple of base price + premium price\\n */\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (Price calldata);\\n}\\n\",\"keccak256\":\"0x1ec537b4c7f9cc40363b39dcc7ade8c29bf94662e6b01d38e681487637bd577e\",\"license\":\"MIT\"},\"contracts/ethregistrar/StringUtils.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary StringUtils {\\n /**\\n * @dev Returns the length of a given string\\n *\\n * @param s The string to measure the length of\\n * @return The length of the input string\\n */\\n function strlen(string memory s) internal pure returns (uint256) {\\n uint256 len;\\n uint256 i = 0;\\n uint256 bytelength = bytes(s).length;\\n for (len = 0; i < bytelength; len++) {\\n bytes1 b = bytes(s)[i];\\n if (b < 0x80) {\\n i += 1;\\n } else if (b < 0xE0) {\\n i += 2;\\n } else if (b < 0xF0) {\\n i += 3;\\n } else if (b < 0xF8) {\\n i += 4;\\n } else if (b < 0xFC) {\\n i += 5;\\n } else {\\n i += 6;\\n }\\n }\\n return len;\\n }\\n}\\n\",\"keccak256\":\"0x4cc8363a850dc9130c433ee50e7c97e29a45ae5d9bd0808205ac7134b34f24e4\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/resolvers/Resolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"./profiles/IABIResolver.sol\\\";\\nimport \\\"./profiles/IAddressResolver.sol\\\";\\nimport \\\"./profiles/IAddrResolver.sol\\\";\\nimport \\\"./profiles/IContentHashResolver.sol\\\";\\nimport \\\"./profiles/IDNSRecordResolver.sol\\\";\\nimport \\\"./profiles/IDNSZoneResolver.sol\\\";\\nimport \\\"./profiles/IInterfaceResolver.sol\\\";\\nimport \\\"./profiles/INameResolver.sol\\\";\\nimport \\\"./profiles/IPubkeyResolver.sol\\\";\\nimport \\\"./profiles/ITextResolver.sol\\\";\\nimport \\\"./profiles/IExtendedResolver.sol\\\";\\n\\n/**\\n * A generic resolver interface which includes all the functions including the ones deprecated\\n */\\ninterface Resolver is\\n IERC165,\\n IABIResolver,\\n IAddressResolver,\\n IAddrResolver,\\n IContentHashResolver,\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n IInterfaceResolver,\\n INameResolver,\\n IPubkeyResolver,\\n ITextResolver,\\n IExtendedResolver\\n{\\n /* Deprecated events */\\n event ContentChanged(bytes32 indexed node, bytes32 hash);\\n\\n function setApprovalForAll(address, bool) external;\\n\\n function approve(bytes32 node, address delegate, bool approved) external;\\n\\n function isApprovedForAll(address account, address operator) external;\\n\\n function isApprovedFor(\\n address owner,\\n bytes32 node,\\n address delegate\\n ) external;\\n\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external;\\n\\n function setAddr(bytes32 node, address addr) external;\\n\\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\\n\\n function setContenthash(bytes32 node, bytes calldata hash) external;\\n\\n function setDnsrr(bytes32 node, bytes calldata data) external;\\n\\n function setName(bytes32 node, string calldata _name) external;\\n\\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\\n\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external;\\n\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external;\\n\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n /* Deprecated functions */\\n function content(bytes32 node) external view returns (bytes32);\\n\\n function multihash(bytes32 node) external view returns (bytes memory);\\n\\n function setContent(bytes32 node, bytes32 hash) external;\\n\\n function setMultihash(bytes32 node, bytes calldata hash) external;\\n}\\n\",\"keccak256\":\"0xfc77ab6b7c59c3ebfe1c720bdebf9b08c2488ff7ac9501a9aa056c5d6d5b50c5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseClaimer.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\n\\ncontract ReverseClaimer {\\n bytes32 constant ADDR_REVERSE_NODE =\\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n constructor(ENS ens, address claimant) {\\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\\n ens.owner(ADDR_REVERSE_NODE)\\n );\\n reverseRegistrar.claim(claimant);\\n }\\n}\\n\",\"keccak256\":\"0x78a28627241535b595f6fff476a1fa7acc90c80684fe7784734920fc8af6fc22\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/ReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IReverseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"../root/Controllable.sol\\\";\\n\\nabstract contract NameResolver {\\n function setName(bytes32 node, string memory name) public virtual;\\n}\\n\\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\\n\\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n// namehash('addr.reverse')\\n\\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\\n ENS public immutable ens;\\n NameResolver public defaultResolver;\\n\\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\\n event DefaultResolverChanged(NameResolver indexed resolver);\\n\\n /**\\n * @dev Constructor\\n * @param ensAddr The address of the ENS registry.\\n */\\n constructor(ENS ensAddr) {\\n ens = ensAddr;\\n\\n // Assign ownership of the reverse record to our deployer\\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\\n ensAddr.owner(ADDR_REVERSE_NODE)\\n );\\n if (address(oldRegistrar) != address(0x0)) {\\n oldRegistrar.claim(msg.sender);\\n }\\n }\\n\\n modifier authorised(address addr) {\\n require(\\n addr == msg.sender ||\\n controllers[msg.sender] ||\\n ens.isApprovedForAll(addr, msg.sender) ||\\n ownsContract(addr),\\n \\\"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\\\"\\n );\\n _;\\n }\\n\\n function setDefaultResolver(address resolver) public override onlyOwner {\\n require(\\n address(resolver) != address(0),\\n \\\"ReverseRegistrar: Resolver address must not be 0\\\"\\n );\\n defaultResolver = NameResolver(resolver);\\n emit DefaultResolverChanged(NameResolver(resolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claim(address owner) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, address(defaultResolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param addr The reverse record to set\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The resolver of the reverse node\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) public override authorised(addr) returns (bytes32) {\\n bytes32 labelHash = sha3HexAddress(addr);\\n bytes32 reverseNode = keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\\n );\\n emit ReverseClaimed(addr, reverseNode);\\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\\n return reverseNode;\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, resolver);\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the calling account. First updates the resolver to the default reverse\\n * resolver if necessary.\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setName(string memory name) public override returns (bytes32) {\\n return\\n setNameForAddr(\\n msg.sender,\\n msg.sender,\\n address(defaultResolver),\\n name\\n );\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the account provided. Updates the resolver to a designated resolver\\n * Only callable by controllers and authorised users\\n * @param addr The reverse record to set\\n * @param owner The owner of the reverse node\\n * @param resolver The resolver of the reverse node\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) public override returns (bytes32) {\\n bytes32 node = claimForAddr(addr, owner, resolver);\\n NameResolver(resolver).setName(node, name);\\n return node;\\n }\\n\\n /**\\n * @dev Returns the node hash for a given account's reverse records.\\n * @param addr The address to hash\\n * @return The ENS node hash.\\n */\\n function node(address addr) public pure override returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\\n );\\n }\\n\\n /**\\n * @dev An optimised function to compute the sha3 of the lower-case\\n * hexadecimal representation of an Ethereum address.\\n * @param addr The address to hash\\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\\n * input address.\\n */\\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\\n assembly {\\n for {\\n let i := 40\\n } gt(i, 0) {\\n\\n } {\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n }\\n\\n ret := keccak256(0, 40)\\n }\\n }\\n\\n function ownsContract(address addr) internal view returns (bool) {\\n try Ownable(addr).owner() returns (address owner) {\\n return owner == msg.sender;\\n } catch {\\n return false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd57d28e5791b4b44650a00f5ef6c725af53698ec33faeeaa3591f0dbd939559a\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"},\"contracts/utils/ERC20Recoverable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\\n */\\n\\ncontract ERC20Recoverable is Ownable {\\n /**\\n @notice Recover ERC20 tokens sent to the contract by mistake.\\n @dev The contract is Ownable and only the owner can call the recover function.\\n @param _to The address to send the tokens to.\\n@param _token The address of the ERC20 token to recover\\n @param _amount The amount of tokens to recover.\\n */\\n function recoverFunds(\\n address _token,\\n address _to,\\n uint256 _amount\\n ) external onlyOwner {\\n IERC20(_token).transfer(_to, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x793a38091e1f81499a29ddba82c2b2f3cdd07071b81a832886e8e02a45ff352a\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_ETH = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x70310eb67146d7290731c31841399640ac3b6a949eadc6598bc150123d185c57\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101406040523480156200001257600080fd5b506040516200215038038062002150833981016040819052620000359162000222565b80336200004281620001b9565b6040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e260048201526000906001600160a01b038416906302571be390602401602060405180830381865afa158015620000aa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000d09190620002b6565b604051630f41a04d60e11b81526001600160a01b03848116600483015291925090821690631e83409a906024016020604051808303816000875af11580156200011d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001439190620002dd565b5050505084841162000168576040516307cb550760e31b815260040160405180910390fd5b428411156200018a57604051630b4319e560e21b815260040160405180910390fd5b506001600160a01b0395861660805293851660a05260c09290925260e0528216610100521661012052620002f7565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200021f57600080fd5b50565b600080600080600080600060e0888a0312156200023e57600080fd5b87516200024b8162000209565b60208901519097506200025e8162000209565b8096505060408801519450606088015193506080880151620002808162000209565b60a0890151909350620002938162000209565b60c0890151909250620002a68162000209565b8091505092959891949750929550565b600060208284031215620002c957600080fd5b8151620002d68162000209565b9392505050565b600060208284031215620002f057600080fd5b5051919050565b60805160a05160c05160e0516101005161012051611dd16200037f60003960008181610375015281816107e00152610bd501526000818161023801526111e00152600081816103dc01528181610db301526110070152600081816103030152610f9001526000818161041001526109fa015260008181610a2f0152610d220152611dd16000f3fe60806040526004361061015f5760003560e01c80638d839ffe116100c0578063aeb8ce9b11610074578063d3419bf311610059578063d3419bf3146103fe578063f14fcbc814610432578063f2fde38b1461045257600080fd5b8063aeb8ce9b146103aa578063ce1e09c0146103ca57600080fd5b80639791c097116100a55780639791c09714610343578063a8e5fbc014610363578063acf1a8411461039757600080fd5b80638d839ffe146102f15780638da5cb5b1461032557600080fd5b806374694a2b11610117578063839df945116100fc578063839df9451461027257806383e7f6ff1461029f5780638a95b09f146102da57600080fd5b806374694a2b14610213578063808698531461022657600080fd5b80635d3590d5116101485780635d3590d5146101b057806365a69dcf146101d0578063715018a6146101fe57600080fd5b806301ffc9a7146101645780633ccfd60b14610199575b600080fd5b34801561017057600080fd5b5061018461017f366004611421565b610472565b60405190151581526020015b60405180910390f35b3480156101a557600080fd5b506101ae61050b565b005b3480156101bc57600080fd5b506101ae6101cb36600461147f565b610548565b3480156101dc57600080fd5b506101f06101eb3660046115ec565b6105e2565b604051908152602001610190565b34801561020a57600080fd5b506101ae610680565b6101ae6102213660046116ef565b610694565b34801561023257600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610190565b34801561027e57600080fd5b506101f061028d3660046117b9565b60016020526000908152604090205481565b3480156102ab57600080fd5b506102bf6102ba3660046117d2565b6109b0565b60408051825181526020928301519281019290925201610190565b3480156102e657600080fd5b506101f06224ea0081565b3480156102fd57600080fd5b506101f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561033157600080fd5b506000546001600160a01b031661025a565b34801561034f57600080fd5b5061018461035e366004611817565b610b03565b34801561036f57600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b6101ae6103a536600461184c565b610b18565b3480156103b657600080fd5b506101846103c5366004611817565b610cd9565b3480156103d657600080fd5b506101f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561040a57600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b34801561043e57600080fd5b506101ae61044d3660046117b9565b610d9c565b34801561045e57600080fd5b506101ae61046d366004611898565b610e2a565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061050557507fffffffff0000000000000000000000000000000000000000000000000000000082167f612e8c0900000000000000000000000000000000000000000000000000000000145b92915050565b600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015610545573d6000803e3d6000fd5b50565b610550610eb7565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af11580156105b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dc91906118b3565b50505050565b885160208a0120600090841580159061060257506001600160a01b038716155b15610639576040517fd3f605c400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808a8a8a8a8a8a8a8a60405160200161065a9998979695949392919061198b565b604051602081830303815290604052805190602001209150509998505050505050505050565b610688610eb7565b6106926000610f11565b565b60006106d78b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92506109b0915050565b602081015181519192506106ea91611a03565b34101561070a5760405163044044a560e21b815260040160405180910390fd5b6107ad8b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050896107a88e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d8d8d8d8d8d8d8d6105e2565b610f79565b6040517fa40149820000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a40149829061081f908f908f908f908f908e908b90600401611a16565b6020604051808303816000875af115801561083e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108629190611a60565b9050841561088d5761088d878d8d60405161087e929190611a79565b604051809103902088886110fb565b83156108d6576108d68c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508b92503391506111de9050565b896001600160a01b03168c8c6040516108f0929190611a79565b60405180910390207f69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf278e8e8660000151876020015187604051610937959493929190611a89565b60405180910390a3602082015182516109509190611a03565b3411156109a2576020820151825133916108fc9161096e9190611a03565b6109789034611aba565b6040518115909202916000818181858888f193505050501580156109a0573d6000803e3d6000fd5b505b505050505050505050505050565b6040805180820190915260008082526020820152825160208401206040517fd6e4fa86000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03908116916350e9a7159187917f00000000000000000000000000000000000000000000000000000000000000009091169063d6e4fa8690602401602060405180830381865afa158015610a78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9c9190611a60565b866040518463ffffffff1660e01b8152600401610abb93929190611b1d565b6040805180830381865afa158015610ad7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afb9190611b42565b949350505050565b60006003610b1083611292565b101592915050565b60008383604051610b2a929190611a79565b604080519182900382206020601f870181900481028401810190925285835292508291600091610b77919088908890819084018382808284376000920191909152508892506109b0915050565b8051909150341015610b9c5760405163044044a560e21b815260040160405180910390fd5b6040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101839052602481018590526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c475abff906044016020604051808303816000875af1158015610c26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4a9190611a60565b8251909150341115610c9257815133906108fc90610c689034611aba565b6040518115909202916000818181858888f19350505050158015610c90573d6000803e3d6000fd5b505b837f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae88883485604051610cc89493929190611b91565b60405180910390a250505050505050565b80516020820120600090610cec83610b03565b8015610d9557506040517f96e494e8000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906396e494e890602401602060405180830381865afa158015610d71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9591906118b3565b9392505050565b6000818152600160205260409020544290610dd8907f000000000000000000000000000000000000000000000000000000000000000090611a03565b10610e17576040517f0a059d71000000000000000000000000000000000000000000000000000000008152600481018290526024015b60405180910390fd5b6000908152600160205260409020429055565b610e32610eb7565b6001600160a01b038116610eae5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610e0e565b61054581610f11565b6000546001600160a01b031633146106925760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610e0e565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000818152600160205260409020544290610fb5907f000000000000000000000000000000000000000000000000000000000000000090611a03565b1115610ff0576040517f5320bcf900000000000000000000000000000000000000000000000000000000815260048101829052602401610e0e565b600081815260016020526040902054429061102c907f000000000000000000000000000000000000000000000000000000000000000090611a03565b11611066576040517fcb7690d700000000000000000000000000000000000000000000000000000000815260048101829052602401610e0e565b61106f83610cd9565b6110a757826040517f477707e8000000000000000000000000000000000000000000000000000000008152600401610e0e9190611bb8565b6000818152600160205260408120556224ea008210156110f6576040517f9a71997b00000000000000000000000000000000000000000000000000000000815260048101839052602401610e0e565b505050565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301869052825180830384018152606083019384905280519101207fe32954eb0000000000000000000000000000000000000000000000000000000090925285906001600160a01b0382169063e32954eb9061118e90859088908890606401611bcb565b6000604051808303816000875af11580156111ad573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111d59190810190611bee565b50505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637a806d6b338385876040516020016112219190611ced565b6040516020818303038152906040526040518563ffffffff1660e01b815260040161124f9493929190611d2e565b6020604051808303816000875af115801561126e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dc9190611a60565b8051600090819081905b808210156114185760008583815181106112b8576112b8611d6c565b01602001516001600160f81b03191690507f8000000000000000000000000000000000000000000000000000000000000000811015611303576112fc600184611a03565b9250611405565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015611340576112fc600284611a03565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561137d576112fc600384611a03565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156113ba576112fc600484611a03565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156113f7576112fc600584611a03565b611402600684611a03565b92505b508261141081611d82565b93505061129c565b50909392505050565b60006020828403121561143357600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610d9557600080fd5b80356001600160a01b038116811461147a57600080fd5b919050565b60008060006060848603121561149457600080fd5b61149d84611463565b92506114ab60208501611463565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156114fa576114fa6114bb565b604052919050565b600067ffffffffffffffff82111561151c5761151c6114bb565b50601f01601f191660200190565b600082601f83011261153b57600080fd5b813561154e61154982611502565b6114d1565b81815284602083860101111561156357600080fd5b816020850160208301376000918101602001919091529392505050565b60008083601f84011261159257600080fd5b50813567ffffffffffffffff8111156115aa57600080fd5b6020830191508360208260051b85010111156115c557600080fd5b9250929050565b801515811461054557600080fd5b803561ffff8116811461147a57600080fd5b60008060008060008060008060006101008a8c03121561160b57600080fd5b893567ffffffffffffffff8082111561162357600080fd5b61162f8d838e0161152a565b9a5061163d60208d01611463565b995060408c0135985060608c0135975061165960808d01611463565b965060a08c013591508082111561166f57600080fd5b5061167c8c828d01611580565b90955093505060c08a0135611690816115cc565b915061169e60e08b016115da565b90509295985092959850929598565b60008083601f8401126116bf57600080fd5b50813567ffffffffffffffff8111156116d757600080fd5b6020830191508360208285010111156115c557600080fd5b6000806000806000806000806000806101008b8d03121561170f57600080fd5b8a3567ffffffffffffffff8082111561172757600080fd5b6117338e838f016116ad565b909c509a508a915061174760208e01611463565b995060408d0135985060608d0135975061176360808e01611463565b965060a08d013591508082111561177957600080fd5b506117868d828e01611580565b90955093505060c08b013561179a816115cc565b91506117a860e08c016115da565b90509295989b9194979a5092959850565b6000602082840312156117cb57600080fd5b5035919050565b600080604083850312156117e557600080fd5b823567ffffffffffffffff8111156117fc57600080fd5b6118088582860161152a565b95602094909401359450505050565b60006020828403121561182957600080fd5b813567ffffffffffffffff81111561184057600080fd5b610afb8482850161152a565b60008060006040848603121561186157600080fd5b833567ffffffffffffffff81111561187857600080fd5b611884868287016116ad565b909790965060209590950135949350505050565b6000602082840312156118aa57600080fd5b610d9582611463565b6000602082840312156118c557600080fd5b8151610d95816115cc565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b81835260006020808501808196508560051b810191508460005b8781101561197e5782840389528135601e1988360301811261193457600080fd5b8701858101903567ffffffffffffffff81111561195057600080fd5b80360382131561195f57600080fd5b61196a8682846118d0565b9a87019a9550505090840190600101611913565b5091979650505050505050565b60006101008b83526001600160a01b03808c1660208501528a60408501528960608501528089166080850152508060a08401526119cb81840187896118f9565b94151560c0840152505061ffff9190911660e090910152979650505050505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610505576105056119ed565b60a081526000611a2a60a08301888a6118d0565b90506001600160a01b03808716602084015285604084015280851660608401525061ffff83166080830152979650505050505050565b600060208284031215611a7257600080fd5b5051919050565b8183823760009101908152919050565b608081526000611a9d6080830187896118d0565b602083019590955250604081019290925260609091015292915050565b81810381811115610505576105056119ed565b60005b83811015611ae8578181015183820152602001611ad0565b50506000910152565b60008151808452611b09816020860160208601611acd565b601f01601f19169290920160200192915050565b606081526000611b306060830186611af1565b60208301949094525060400152919050565b600060408284031215611b5457600080fd5b6040516040810181811067ffffffffffffffff82111715611b7757611b776114bb565b604052825181526020928301519281019290925250919050565b606081526000611ba56060830186886118d0565b6020830194909452506040015292915050565b602081526000610d956020830184611af1565b838152604060208201526000611be56040830184866118f9565b95945050505050565b60006020808385031215611c0157600080fd5b825167ffffffffffffffff80821115611c1957600080fd5b818501915085601f830112611c2d57600080fd5b815181811115611c3f57611c3f6114bb565b8060051b611c4e8582016114d1565b9182528381018501918581019089841115611c6857600080fd5b86860192505b83831015611ce057825185811115611c865760008081fd5b8601603f81018b13611c985760008081fd5b878101516040611caa61154983611502565b8281528d82848601011115611cbf5760008081fd5b611cce838c8301848701611acd565b85525050509186019190860190611c6e565b9998505050505050505050565b60008251611cff818460208701611acd565b7f2e65746800000000000000000000000000000000000000000000000000000000920191825250600401919050565b60006001600160a01b038087168352808616602084015280851660408401525060806060830152611d626080830184611af1565b9695505050505050565b634e487b7160e01b600052603260045260246000fd5b600060018201611d9457611d946119ed565b506001019056fea2646970667358221220ee0123f9799574860117212f1063a9d587f5b66a8026fd746099b0706d5a5e7c64736f6c63430008110033", + "deployedBytecode": "0x60806040526004361061015f5760003560e01c80638d839ffe116100c0578063aeb8ce9b11610074578063d3419bf311610059578063d3419bf3146103fe578063f14fcbc814610432578063f2fde38b1461045257600080fd5b8063aeb8ce9b146103aa578063ce1e09c0146103ca57600080fd5b80639791c097116100a55780639791c09714610343578063a8e5fbc014610363578063acf1a8411461039757600080fd5b80638d839ffe146102f15780638da5cb5b1461032557600080fd5b806374694a2b11610117578063839df945116100fc578063839df9451461027257806383e7f6ff1461029f5780638a95b09f146102da57600080fd5b806374694a2b14610213578063808698531461022657600080fd5b80635d3590d5116101485780635d3590d5146101b057806365a69dcf146101d0578063715018a6146101fe57600080fd5b806301ffc9a7146101645780633ccfd60b14610199575b600080fd5b34801561017057600080fd5b5061018461017f366004611421565b610472565b60405190151581526020015b60405180910390f35b3480156101a557600080fd5b506101ae61050b565b005b3480156101bc57600080fd5b506101ae6101cb36600461147f565b610548565b3480156101dc57600080fd5b506101f06101eb3660046115ec565b6105e2565b604051908152602001610190565b34801561020a57600080fd5b506101ae610680565b6101ae6102213660046116ef565b610694565b34801561023257600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610190565b34801561027e57600080fd5b506101f061028d3660046117b9565b60016020526000908152604090205481565b3480156102ab57600080fd5b506102bf6102ba3660046117d2565b6109b0565b60408051825181526020928301519281019290925201610190565b3480156102e657600080fd5b506101f06224ea0081565b3480156102fd57600080fd5b506101f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561033157600080fd5b506000546001600160a01b031661025a565b34801561034f57600080fd5b5061018461035e366004611817565b610b03565b34801561036f57600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b6101ae6103a536600461184c565b610b18565b3480156103b657600080fd5b506101846103c5366004611817565b610cd9565b3480156103d657600080fd5b506101f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561040a57600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b34801561043e57600080fd5b506101ae61044d3660046117b9565b610d9c565b34801561045e57600080fd5b506101ae61046d366004611898565b610e2a565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061050557507fffffffff0000000000000000000000000000000000000000000000000000000082167f612e8c0900000000000000000000000000000000000000000000000000000000145b92915050565b600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015610545573d6000803e3d6000fd5b50565b610550610eb7565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af11580156105b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dc91906118b3565b50505050565b885160208a0120600090841580159061060257506001600160a01b038716155b15610639576040517fd3f605c400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808a8a8a8a8a8a8a8a60405160200161065a9998979695949392919061198b565b604051602081830303815290604052805190602001209150509998505050505050505050565b610688610eb7565b6106926000610f11565b565b60006106d78b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92506109b0915050565b602081015181519192506106ea91611a03565b34101561070a5760405163044044a560e21b815260040160405180910390fd5b6107ad8b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050896107a88e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d8d8d8d8d8d8d8d6105e2565b610f79565b6040517fa40149820000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a40149829061081f908f908f908f908f908e908b90600401611a16565b6020604051808303816000875af115801561083e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108629190611a60565b9050841561088d5761088d878d8d60405161087e929190611a79565b604051809103902088886110fb565b83156108d6576108d68c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508b92503391506111de9050565b896001600160a01b03168c8c6040516108f0929190611a79565b60405180910390207f69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf278e8e8660000151876020015187604051610937959493929190611a89565b60405180910390a3602082015182516109509190611a03565b3411156109a2576020820151825133916108fc9161096e9190611a03565b6109789034611aba565b6040518115909202916000818181858888f193505050501580156109a0573d6000803e3d6000fd5b505b505050505050505050505050565b6040805180820190915260008082526020820152825160208401206040517fd6e4fa86000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03908116916350e9a7159187917f00000000000000000000000000000000000000000000000000000000000000009091169063d6e4fa8690602401602060405180830381865afa158015610a78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9c9190611a60565b866040518463ffffffff1660e01b8152600401610abb93929190611b1d565b6040805180830381865afa158015610ad7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afb9190611b42565b949350505050565b60006003610b1083611292565b101592915050565b60008383604051610b2a929190611a79565b604080519182900382206020601f870181900481028401810190925285835292508291600091610b77919088908890819084018382808284376000920191909152508892506109b0915050565b8051909150341015610b9c5760405163044044a560e21b815260040160405180910390fd5b6040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101839052602481018590526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c475abff906044016020604051808303816000875af1158015610c26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4a9190611a60565b8251909150341115610c9257815133906108fc90610c689034611aba565b6040518115909202916000818181858888f19350505050158015610c90573d6000803e3d6000fd5b505b837f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae88883485604051610cc89493929190611b91565b60405180910390a250505050505050565b80516020820120600090610cec83610b03565b8015610d9557506040517f96e494e8000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906396e494e890602401602060405180830381865afa158015610d71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9591906118b3565b9392505050565b6000818152600160205260409020544290610dd8907f000000000000000000000000000000000000000000000000000000000000000090611a03565b10610e17576040517f0a059d71000000000000000000000000000000000000000000000000000000008152600481018290526024015b60405180910390fd5b6000908152600160205260409020429055565b610e32610eb7565b6001600160a01b038116610eae5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610e0e565b61054581610f11565b6000546001600160a01b031633146106925760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610e0e565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000818152600160205260409020544290610fb5907f000000000000000000000000000000000000000000000000000000000000000090611a03565b1115610ff0576040517f5320bcf900000000000000000000000000000000000000000000000000000000815260048101829052602401610e0e565b600081815260016020526040902054429061102c907f000000000000000000000000000000000000000000000000000000000000000090611a03565b11611066576040517fcb7690d700000000000000000000000000000000000000000000000000000000815260048101829052602401610e0e565b61106f83610cd9565b6110a757826040517f477707e8000000000000000000000000000000000000000000000000000000008152600401610e0e9190611bb8565b6000818152600160205260408120556224ea008210156110f6576040517f9a71997b00000000000000000000000000000000000000000000000000000000815260048101839052602401610e0e565b505050565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301869052825180830384018152606083019384905280519101207fe32954eb0000000000000000000000000000000000000000000000000000000090925285906001600160a01b0382169063e32954eb9061118e90859088908890606401611bcb565b6000604051808303816000875af11580156111ad573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111d59190810190611bee565b50505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637a806d6b338385876040516020016112219190611ced565b6040516020818303038152906040526040518563ffffffff1660e01b815260040161124f9493929190611d2e565b6020604051808303816000875af115801561126e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dc9190611a60565b8051600090819081905b808210156114185760008583815181106112b8576112b8611d6c565b01602001516001600160f81b03191690507f8000000000000000000000000000000000000000000000000000000000000000811015611303576112fc600184611a03565b9250611405565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015611340576112fc600284611a03565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561137d576112fc600384611a03565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156113ba576112fc600484611a03565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156113f7576112fc600584611a03565b611402600684611a03565b92505b508261141081611d82565b93505061129c565b50909392505050565b60006020828403121561143357600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610d9557600080fd5b80356001600160a01b038116811461147a57600080fd5b919050565b60008060006060848603121561149457600080fd5b61149d84611463565b92506114ab60208501611463565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156114fa576114fa6114bb565b604052919050565b600067ffffffffffffffff82111561151c5761151c6114bb565b50601f01601f191660200190565b600082601f83011261153b57600080fd5b813561154e61154982611502565b6114d1565b81815284602083860101111561156357600080fd5b816020850160208301376000918101602001919091529392505050565b60008083601f84011261159257600080fd5b50813567ffffffffffffffff8111156115aa57600080fd5b6020830191508360208260051b85010111156115c557600080fd5b9250929050565b801515811461054557600080fd5b803561ffff8116811461147a57600080fd5b60008060008060008060008060006101008a8c03121561160b57600080fd5b893567ffffffffffffffff8082111561162357600080fd5b61162f8d838e0161152a565b9a5061163d60208d01611463565b995060408c0135985060608c0135975061165960808d01611463565b965060a08c013591508082111561166f57600080fd5b5061167c8c828d01611580565b90955093505060c08a0135611690816115cc565b915061169e60e08b016115da565b90509295985092959850929598565b60008083601f8401126116bf57600080fd5b50813567ffffffffffffffff8111156116d757600080fd5b6020830191508360208285010111156115c557600080fd5b6000806000806000806000806000806101008b8d03121561170f57600080fd5b8a3567ffffffffffffffff8082111561172757600080fd5b6117338e838f016116ad565b909c509a508a915061174760208e01611463565b995060408d0135985060608d0135975061176360808e01611463565b965060a08d013591508082111561177957600080fd5b506117868d828e01611580565b90955093505060c08b013561179a816115cc565b91506117a860e08c016115da565b90509295989b9194979a5092959850565b6000602082840312156117cb57600080fd5b5035919050565b600080604083850312156117e557600080fd5b823567ffffffffffffffff8111156117fc57600080fd5b6118088582860161152a565b95602094909401359450505050565b60006020828403121561182957600080fd5b813567ffffffffffffffff81111561184057600080fd5b610afb8482850161152a565b60008060006040848603121561186157600080fd5b833567ffffffffffffffff81111561187857600080fd5b611884868287016116ad565b909790965060209590950135949350505050565b6000602082840312156118aa57600080fd5b610d9582611463565b6000602082840312156118c557600080fd5b8151610d95816115cc565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b81835260006020808501808196508560051b810191508460005b8781101561197e5782840389528135601e1988360301811261193457600080fd5b8701858101903567ffffffffffffffff81111561195057600080fd5b80360382131561195f57600080fd5b61196a8682846118d0565b9a87019a9550505090840190600101611913565b5091979650505050505050565b60006101008b83526001600160a01b03808c1660208501528a60408501528960608501528089166080850152508060a08401526119cb81840187896118f9565b94151560c0840152505061ffff9190911660e090910152979650505050505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610505576105056119ed565b60a081526000611a2a60a08301888a6118d0565b90506001600160a01b03808716602084015285604084015280851660608401525061ffff83166080830152979650505050505050565b600060208284031215611a7257600080fd5b5051919050565b8183823760009101908152919050565b608081526000611a9d6080830187896118d0565b602083019590955250604081019290925260609091015292915050565b81810381811115610505576105056119ed565b60005b83811015611ae8578181015183820152602001611ad0565b50506000910152565b60008151808452611b09816020860160208601611acd565b601f01601f19169290920160200192915050565b606081526000611b306060830186611af1565b60208301949094525060400152919050565b600060408284031215611b5457600080fd5b6040516040810181811067ffffffffffffffff82111715611b7757611b776114bb565b604052825181526020928301519281019290925250919050565b606081526000611ba56060830186886118d0565b6020830194909452506040015292915050565b602081526000610d956020830184611af1565b838152604060208201526000611be56040830184866118f9565b95945050505050565b60006020808385031215611c0157600080fd5b825167ffffffffffffffff80821115611c1957600080fd5b818501915085601f830112611c2d57600080fd5b815181811115611c3f57611c3f6114bb565b8060051b611c4e8582016114d1565b9182528381018501918581019089841115611c6857600080fd5b86860192505b83831015611ce057825185811115611c865760008081fd5b8601603f81018b13611c985760008081fd5b878101516040611caa61154983611502565b8281528d82848601011115611cbf5760008081fd5b611cce838c8301848701611acd565b85525050509186019190860190611c6e565b9998505050505050505050565b60008251611cff818460208701611acd565b7f2e65746800000000000000000000000000000000000000000000000000000000920191825250600401919050565b60006001600160a01b038087168352808616602084015280851660408401525060806060830152611d626080830184611af1565b9695505050505050565b634e487b7160e01b600052603260045260246000fd5b600060018201611d9457611d946119ed565b506001019056fea2646970667358221220ee0123f9799574860117212f1063a9d587f5b66a8026fd746099b0706d5a5e7c64736f6c63430008110033", + "devdoc": { + "details": "A registrar controller for registering and renewing names at fixed cost.", + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "recoverFunds(address,address,uint256)": { + "details": "The contract is Ownable and only the owner can call the recover function.", + "params": { + "_amount": "The amount of tokens to recover.", + "_to": "The address to send the tokens to.", + "_token": "The address of the ERC20 token to recover" + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "recoverFunds(address,address,uint256)": { + "notice": "Recover ERC20 tokens sent to the contract by mistake." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 7, + "contract": "contracts/ethregistrar/ETHRegistrarController.sol:ETHRegistrarController", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 3696, + "contract": "contracts/ethregistrar/ETHRegistrarController.sol:ETHRegistrarController", + "label": "commitments", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_uint256)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_uint256)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/ExponentialPremiumPriceOracle.json b/solidity/dns-contracts/deployments/mainnet/ExponentialPremiumPriceOracle.json new file mode 100644 index 0000000..1f9d535 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/ExponentialPremiumPriceOracle.json @@ -0,0 +1,304 @@ +{ + "address": "0x7542565191d074cE84fBfA92cAE13AcB84788CA9", + "abi": [ + { + "inputs": [ + { + "internalType": "contract AggregatorInterface", + "name": "_usdOracle", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "_rentPrices", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "_startPremium", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalDays", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256[]", + "name": "prices", + "type": "uint256[]" + } + ], + "name": "RentPriceChanged", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "startPremium", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "elapsed", + "type": "uint256" + } + ], + "name": "decayedPremium", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "premium", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "price", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "base", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "premium", + "type": "uint256" + } + ], + "internalType": "struct IPriceOracle.Price", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price1Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price2Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price3Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price4Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price5Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "usdOracle", + "outputs": [ + { + "internalType": "contract AggregatorInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x43313ffb3a380740b97684cb86870c2f4997fdbce0cd5f43e2968e5386da6a49", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0x7542565191d074cE84fBfA92cAE13AcB84788CA9", + "transactionIndex": 120, + "gasUsed": "814592", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xc77b9fab0d14a3f99d522035a8b503722d7f09b1e391227192314df0808c42e5", + "transactionHash": "0x43313ffb3a380740b97684cb86870c2f4997fdbce0cd5f43e2968e5386da6a49", + "logs": [], + "blockNumber": 16925617, + "cumulativeGasUsed": "9210515", + "status": 1, + "byzantium": true + }, + "args": [ + "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419", + [ + 0, + 0, + "20294266869609", + "5073566717402", + "158548959919" + ], + "100000000000000000000000000", + 21 + ], + "numDeployments": 1, + "solcInputHash": "3fa59c31b7672c86eff32031f5a10f8a", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract AggregatorInterface\",\"name\":\"_usdOracle\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"_rentPrices\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_startPremium\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalDays\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"prices\",\"type\":\"uint256[]\"}],\"name\":\"RentPriceChanged\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"startPremium\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"elapsed\",\"type\":\"uint256\"}],\"name\":\"decayedPremium\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"premium\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"price\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"base\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"}],\"internalType\":\"struct IPriceOracle.Price\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price1Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price2Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price3Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price4Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price5Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"usdOracle\",\"outputs\":[{\"internalType\":\"contract AggregatorInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"decayedPremium(uint256,uint256)\":{\"details\":\"Returns the premium price at current time elapsed\",\"params\":{\"elapsed\":\"time past since expiry\",\"startPremium\":\"starting price\"}},\"premium(string,uint256,uint256)\":{\"details\":\"Returns the pricing premium in wei.\"},\"price(string,uint256,uint256)\":{\"details\":\"Returns the price to register or renew a name.\",\"params\":{\"duration\":\"How long the name is being registered or extended for, in seconds.\",\"expires\":\"When the name presently expires (0 if this is a new registration).\",\"name\":\"The name being registered or renewed.\"},\"returns\":{\"_0\":\"base premium tuple of base price + premium price\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/ExponentialPremiumPriceOracle.sol\":\"ExponentialPremiumPriceOracle\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1300},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/ethregistrar/ExponentialPremiumPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./StablePriceOracle.sol\\\";\\n\\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\\n uint256 constant GRACE_PERIOD = 90 days;\\n uint256 immutable startPremium;\\n uint256 immutable endValue;\\n\\n constructor(\\n AggregatorInterface _usdOracle,\\n uint256[] memory _rentPrices,\\n uint256 _startPremium,\\n uint256 totalDays\\n ) StablePriceOracle(_usdOracle, _rentPrices) {\\n startPremium = _startPremium;\\n endValue = _startPremium >> totalDays;\\n }\\n\\n uint256 constant PRECISION = 1e18;\\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\\n uint256 constant bit3 = 999957694548431104;\\n uint256 constant bit4 = 999915390886613504;\\n uint256 constant bit5 = 999830788931929088;\\n uint256 constant bit6 = 999661606496243712;\\n uint256 constant bit7 = 999323327502650752;\\n uint256 constant bit8 = 998647112890970240;\\n uint256 constant bit9 = 997296056085470080;\\n uint256 constant bit10 = 994599423483633152;\\n uint256 constant bit11 = 989228013193975424;\\n uint256 constant bit12 = 978572062087700096;\\n uint256 constant bit13 = 957603280698573696;\\n uint256 constant bit14 = 917004043204671232;\\n uint256 constant bit15 = 840896415253714560;\\n uint256 constant bit16 = 707106781186547584;\\n\\n /**\\n * @dev Returns the pricing premium in internal base units.\\n */\\n function _premium(\\n string memory,\\n uint256 expires,\\n uint256\\n ) internal view override returns (uint256) {\\n expires = expires + GRACE_PERIOD;\\n if (expires > block.timestamp) {\\n return 0;\\n }\\n\\n uint256 elapsed = block.timestamp - expires;\\n uint256 premium = decayedPremium(startPremium, elapsed);\\n if (premium >= endValue) {\\n return premium - endValue;\\n }\\n return 0;\\n }\\n\\n /**\\n * @dev Returns the premium price at current time elapsed\\n * @param startPremium starting price\\n * @param elapsed time past since expiry\\n */\\n function decayedPremium(\\n uint256 startPremium,\\n uint256 elapsed\\n ) public pure returns (uint256) {\\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\\n uint256 intDays = daysPast / PRECISION;\\n uint256 premium = startPremium >> intDays;\\n uint256 partDay = (daysPast - intDays * PRECISION);\\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\\n uint256 totalPremium = addFractionalPremium(fraction, premium);\\n return totalPremium;\\n }\\n\\n function addFractionalPremium(\\n uint256 fraction,\\n uint256 premium\\n ) internal pure returns (uint256) {\\n if (fraction & (1 << 0) != 0) {\\n premium = (premium * bit1) / PRECISION;\\n }\\n if (fraction & (1 << 1) != 0) {\\n premium = (premium * bit2) / PRECISION;\\n }\\n if (fraction & (1 << 2) != 0) {\\n premium = (premium * bit3) / PRECISION;\\n }\\n if (fraction & (1 << 3) != 0) {\\n premium = (premium * bit4) / PRECISION;\\n }\\n if (fraction & (1 << 4) != 0) {\\n premium = (premium * bit5) / PRECISION;\\n }\\n if (fraction & (1 << 5) != 0) {\\n premium = (premium * bit6) / PRECISION;\\n }\\n if (fraction & (1 << 6) != 0) {\\n premium = (premium * bit7) / PRECISION;\\n }\\n if (fraction & (1 << 7) != 0) {\\n premium = (premium * bit8) / PRECISION;\\n }\\n if (fraction & (1 << 8) != 0) {\\n premium = (premium * bit9) / PRECISION;\\n }\\n if (fraction & (1 << 9) != 0) {\\n premium = (premium * bit10) / PRECISION;\\n }\\n if (fraction & (1 << 10) != 0) {\\n premium = (premium * bit11) / PRECISION;\\n }\\n if (fraction & (1 << 11) != 0) {\\n premium = (premium * bit12) / PRECISION;\\n }\\n if (fraction & (1 << 12) != 0) {\\n premium = (premium * bit13) / PRECISION;\\n }\\n if (fraction & (1 << 13) != 0) {\\n premium = (premium * bit14) / PRECISION;\\n }\\n if (fraction & (1 << 14) != 0) {\\n premium = (premium * bit15) / PRECISION;\\n }\\n if (fraction & (1 << 15) != 0) {\\n premium = (premium * bit16) / PRECISION;\\n }\\n return premium;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x09149a39e7660d65873e5160971cf0904630b266cbec4f02721dad0aad28320b\",\"license\":\"MIT\"},\"contracts/ethregistrar/IPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\ninterface IPriceOracle {\\n struct Price {\\n uint256 base;\\n uint256 premium;\\n }\\n\\n /**\\n * @dev Returns the price to register or renew a name.\\n * @param name The name being registered or renewed.\\n * @param expires When the name presently expires (0 if this is a new registration).\\n * @param duration How long the name is being registered or extended for, in seconds.\\n * @return base premium tuple of base price + premium price\\n */\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (Price calldata);\\n}\\n\",\"keccak256\":\"0x1ec537b4c7f9cc40363b39dcc7ade8c29bf94662e6b01d38e681487637bd577e\",\"license\":\"MIT\"},\"contracts/ethregistrar/StablePriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./IPriceOracle.sol\\\";\\nimport \\\"./StringUtils.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\ninterface AggregatorInterface {\\n function latestAnswer() external view returns (int256);\\n}\\n\\n// StablePriceOracle sets a price in USD, based on an oracle.\\ncontract StablePriceOracle is IPriceOracle {\\n using StringUtils for *;\\n\\n // Rent in base price units by length\\n uint256 public immutable price1Letter;\\n uint256 public immutable price2Letter;\\n uint256 public immutable price3Letter;\\n uint256 public immutable price4Letter;\\n uint256 public immutable price5Letter;\\n\\n // Oracle address\\n AggregatorInterface public immutable usdOracle;\\n\\n event RentPriceChanged(uint256[] prices);\\n\\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\\n usdOracle = _usdOracle;\\n price1Letter = _rentPrices[0];\\n price2Letter = _rentPrices[1];\\n price3Letter = _rentPrices[2];\\n price4Letter = _rentPrices[3];\\n price5Letter = _rentPrices[4];\\n }\\n\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view override returns (IPriceOracle.Price memory) {\\n uint256 len = name.strlen();\\n uint256 basePrice;\\n\\n if (len >= 5) {\\n basePrice = price5Letter * duration;\\n } else if (len == 4) {\\n basePrice = price4Letter * duration;\\n } else if (len == 3) {\\n basePrice = price3Letter * duration;\\n } else if (len == 2) {\\n basePrice = price2Letter * duration;\\n } else {\\n basePrice = price1Letter * duration;\\n }\\n\\n return\\n IPriceOracle.Price({\\n base: attoUSDToWei(basePrice),\\n premium: attoUSDToWei(_premium(name, expires, duration))\\n });\\n }\\n\\n /**\\n * @dev Returns the pricing premium in wei.\\n */\\n function premium(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (uint256) {\\n return attoUSDToWei(_premium(name, expires, duration));\\n }\\n\\n /**\\n * @dev Returns the pricing premium in internal base units.\\n */\\n function _premium(\\n string memory name,\\n uint256 expires,\\n uint256 duration\\n ) internal view virtual returns (uint256) {\\n return 0;\\n }\\n\\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\\n return (amount * 1e8) / ethPrice;\\n }\\n\\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\\n return (amount * ethPrice) / 1e8;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IPriceOracle).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0x23a3d1eb3021080f20eb5f6af941b2d29a5d252a0a6119ba74f595da9c1ae1d6\",\"license\":\"MIT\"},\"contracts/ethregistrar/StringUtils.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary StringUtils {\\n /**\\n * @dev Returns the length of a given string\\n *\\n * @param s The string to measure the length of\\n * @return The length of the input string\\n */\\n function strlen(string memory s) internal pure returns (uint256) {\\n uint256 len;\\n uint256 i = 0;\\n uint256 bytelength = bytes(s).length;\\n for (len = 0; i < bytelength; len++) {\\n bytes1 b = bytes(s)[i];\\n if (b < 0x80) {\\n i += 1;\\n } else if (b < 0xE0) {\\n i += 2;\\n } else if (b < 0xF0) {\\n i += 3;\\n } else if (b < 0xF8) {\\n i += 4;\\n } else if (b < 0xFC) {\\n i += 5;\\n } else {\\n i += 6;\\n }\\n }\\n return len;\\n }\\n}\\n\",\"keccak256\":\"0x4cc8363a850dc9130c433ee50e7c97e29a45ae5d9bd0808205ac7134b34f24e4\"}},\"version\":1}", + "bytecode": "0x6101806040523480156200001257600080fd5b50604051620010863803806200108683398101604081905262000035916200012c565b6001600160a01b0384166101205282518490849081906000906200005d576200005d62000227565b6020026020010151608081815250508060018151811062000082576200008262000227565b602002602001015160a0818152505080600281518110620000a757620000a762000227565b602002602001015160c0818152505080600381518110620000cc57620000cc62000227565b602002602001015160e0818152505080600481518110620000f157620000f162000227565b60209081029190910101516101005250506101408290521c61016052506200023d9050565b634e487b7160e01b600052604160045260246000fd5b600080600080608085870312156200014357600080fd5b84516001600160a01b03811681146200015b57600080fd5b602086810151919550906001600160401b03808211156200017b57600080fd5b818801915088601f8301126200019057600080fd5b815181811115620001a557620001a562000116565b8060051b604051601f19603f83011681018181108582111715620001cd57620001cd62000116565b60405291825284820192508381018501918b831115620001ec57600080fd5b938501935b828510156200020c57845184529385019392850192620001f1565b60408b01516060909b0151999c909b50975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60805160a05160c05160e05161010051610120516101405161016051610db3620002d3600039600081816108590152610883015260006108300152600081816101c7015261074b01526000818161015301526102d401526000818161023a015261030d01526000818161018d015261033f015260008181610213015261037101526000818160f0015261039b0152610db36000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c8063a200e15311610076578063c8a4271f1161005b578063c8a4271f146101c2578063cd5d2c741461020e578063d820ed421461023557600080fd5b8063a200e15314610188578063a34e3596146101af57600080fd5b806350e9a715116100a757806350e9a7151461012057806359b6b86c1461014e57806359e1777c1461017557600080fd5b806301ffc9a7146100c35780632c0fd74c146100eb575b600080fd5b6100d66100d1366004610bdd565b61025c565b60405190151581526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016100e2565b61013361012e366004610c1f565b61026d565b604080518251815260209283015192810192909252016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b610112610183366004610c9e565b610433565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101126101bd366004610c1f565b6104ce565b6101e97f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b60006102678261051f565b92915050565b604080518082019091526000808252602082015260006102c286868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506105b792505050565b90506000600582106102ff576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b90506103c2565b81600403610331576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b81600303610363576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b81600203610395576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b6103bf847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b90505b60405180604001604052806103d683610746565b81526020016104266104218a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92508b91506107fa9050565b610746565b9052979650505050505050565b6000806201518061044c670de0b6b3a764000085610cd6565b6104569190610ced565b9050600061046c670de0b6b3a764000083610ced565b905084811c6000610485670de0b6b3a764000084610cd6565b61048f9085610d0f565b90506000670de0b6b3a76400006104a98362010000610cd6565b6104b39190610ced565b905060006104c182856108bd565b9998505050505050505050565b600061051661042186868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508892508791506107fa9050565b95945050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061026757507fffffffff0000000000000000000000000000000000000000000000000000000082167f50e9a715000000000000000000000000000000000000000000000000000000001492915050565b8051600090819081905b8082101561073d5760008583815181106105dd576105dd610d22565b01602001516001600160f81b03191690507f800000000000000000000000000000000000000000000000000000000000000081101561062857610621600184610d38565b925061072a565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561066557610621600284610d38565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156106a257610621600384610d38565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156106df57610621600484610d38565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561071c57610621600584610d38565b610727600684610d38565b92505b508261073581610d4b565b9350506105c1565b50909392505050565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d89190610d64565b9050806107e9846305f5e100610cd6565b6107f39190610ced565b9392505050565b60006108096276a70084610d38565b92504283111561081b575060006107f3565b60006108278442610d0f565b905060006108557f000000000000000000000000000000000000000000000000000000000000000083610433565b90507f000000000000000000000000000000000000000000000000000000000000000081106108b1576108a87f000000000000000000000000000000000000000000000000000000000000000082610d0f565b925050506107f3565b50600095945050505050565b600060018316156108f057670de0b6b3a76400006108e3670de0ad151d09418084610cd6565b6108ed9190610ced565b91505b600283161561092157670de0b6b3a7640000610914670de0a3769959680084610cd6565b61091e9190610ced565b91505b600483161561095257670de0b6b3a7640000610945670de09039a5fa510084610cd6565b61094f9190610ced565b91505b600883161561098357670de0b6b3a7640000610976670de069c00f3e120084610cd6565b6109809190610ced565b91505b60108316156109b457670de0b6b3a76400006109a7670de01cce21c9440084610cd6565b6109b19190610ced565b91505b60208316156109e557670de0b6b3a76400006109d8670ddf82ef46ce100084610cd6565b6109e29190610ced565b91505b6040831615610a1657670de0b6b3a7640000610a09670dde4f458f8e8d8084610cd6565b610a139190610ced565b91505b6080831615610a4757670de0b6b3a7640000610a3a670ddbe84213d5f08084610cd6565b610a449190610ced565b91505b610100831615610a7957670de0b6b3a7640000610a6c670dd71b7aa6df5b8084610cd6565b610a769190610ced565b91505b610200831615610aab57670de0b6b3a7640000610a9e670dcd86e7f28cde0084610cd6565b610aa89190610ced565b91505b610400831615610add57670de0b6b3a7640000610ad0670dba71a3084ad68084610cd6565b610ada9190610ced565b91505b610800831615610b0f57670de0b6b3a7640000610b02670d94961b13dbde8084610cd6565b610b0c9190610ced565b91505b611000831615610b4157670de0b6b3a7640000610b34670d4a171c35c9838084610cd6565b610b3e9190610ced565b91505b612000831615610b7357670de0b6b3a7640000610b66670cb9da519ccfb70084610cd6565b610b709190610ced565b91505b614000831615610ba557670de0b6b3a7640000610b98670bab76d59c18d68084610cd6565b610ba29190610ced565b91505b618000831615610bd757670de0b6b3a7640000610bca6709d025defee4df8084610cd6565b610bd49190610ced565b91505b50919050565b600060208284031215610bef57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146107f357600080fd5b60008060008060608587031215610c3557600080fd5b843567ffffffffffffffff80821115610c4d57600080fd5b818701915087601f830112610c6157600080fd5b813581811115610c7057600080fd5b886020828501011115610c8257600080fd5b6020928301999098509187013596604001359550909350505050565b60008060408385031215610cb157600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761026757610267610cc0565b600082610d0a57634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561026757610267610cc0565b634e487b7160e01b600052603260045260246000fd5b8082018082111561026757610267610cc0565b600060018201610d5d57610d5d610cc0565b5060010190565b600060208284031215610d7657600080fd5b505191905056fea26469706673582212202f367baa7e38083ab11fe6251d0dac4c55d4d507b0208df054acbe0c97eb6baf64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100be5760003560e01c8063a200e15311610076578063c8a4271f1161005b578063c8a4271f146101c2578063cd5d2c741461020e578063d820ed421461023557600080fd5b8063a200e15314610188578063a34e3596146101af57600080fd5b806350e9a715116100a757806350e9a7151461012057806359b6b86c1461014e57806359e1777c1461017557600080fd5b806301ffc9a7146100c35780632c0fd74c146100eb575b600080fd5b6100d66100d1366004610bdd565b61025c565b60405190151581526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016100e2565b61013361012e366004610c1f565b61026d565b604080518251815260209283015192810192909252016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b610112610183366004610c9e565b610433565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101126101bd366004610c1f565b6104ce565b6101e97f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b60006102678261051f565b92915050565b604080518082019091526000808252602082015260006102c286868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506105b792505050565b90506000600582106102ff576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b90506103c2565b81600403610331576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b81600303610363576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b81600203610395576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b6103bf847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b90505b60405180604001604052806103d683610746565b81526020016104266104218a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92508b91506107fa9050565b610746565b9052979650505050505050565b6000806201518061044c670de0b6b3a764000085610cd6565b6104569190610ced565b9050600061046c670de0b6b3a764000083610ced565b905084811c6000610485670de0b6b3a764000084610cd6565b61048f9085610d0f565b90506000670de0b6b3a76400006104a98362010000610cd6565b6104b39190610ced565b905060006104c182856108bd565b9998505050505050505050565b600061051661042186868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508892508791506107fa9050565b95945050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061026757507fffffffff0000000000000000000000000000000000000000000000000000000082167f50e9a715000000000000000000000000000000000000000000000000000000001492915050565b8051600090819081905b8082101561073d5760008583815181106105dd576105dd610d22565b01602001516001600160f81b03191690507f800000000000000000000000000000000000000000000000000000000000000081101561062857610621600184610d38565b925061072a565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561066557610621600284610d38565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156106a257610621600384610d38565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156106df57610621600484610d38565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561071c57610621600584610d38565b610727600684610d38565b92505b508261073581610d4b565b9350506105c1565b50909392505050565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d89190610d64565b9050806107e9846305f5e100610cd6565b6107f39190610ced565b9392505050565b60006108096276a70084610d38565b92504283111561081b575060006107f3565b60006108278442610d0f565b905060006108557f000000000000000000000000000000000000000000000000000000000000000083610433565b90507f000000000000000000000000000000000000000000000000000000000000000081106108b1576108a87f000000000000000000000000000000000000000000000000000000000000000082610d0f565b925050506107f3565b50600095945050505050565b600060018316156108f057670de0b6b3a76400006108e3670de0ad151d09418084610cd6565b6108ed9190610ced565b91505b600283161561092157670de0b6b3a7640000610914670de0a3769959680084610cd6565b61091e9190610ced565b91505b600483161561095257670de0b6b3a7640000610945670de09039a5fa510084610cd6565b61094f9190610ced565b91505b600883161561098357670de0b6b3a7640000610976670de069c00f3e120084610cd6565b6109809190610ced565b91505b60108316156109b457670de0b6b3a76400006109a7670de01cce21c9440084610cd6565b6109b19190610ced565b91505b60208316156109e557670de0b6b3a76400006109d8670ddf82ef46ce100084610cd6565b6109e29190610ced565b91505b6040831615610a1657670de0b6b3a7640000610a09670dde4f458f8e8d8084610cd6565b610a139190610ced565b91505b6080831615610a4757670de0b6b3a7640000610a3a670ddbe84213d5f08084610cd6565b610a449190610ced565b91505b610100831615610a7957670de0b6b3a7640000610a6c670dd71b7aa6df5b8084610cd6565b610a769190610ced565b91505b610200831615610aab57670de0b6b3a7640000610a9e670dcd86e7f28cde0084610cd6565b610aa89190610ced565b91505b610400831615610add57670de0b6b3a7640000610ad0670dba71a3084ad68084610cd6565b610ada9190610ced565b91505b610800831615610b0f57670de0b6b3a7640000610b02670d94961b13dbde8084610cd6565b610b0c9190610ced565b91505b611000831615610b4157670de0b6b3a7640000610b34670d4a171c35c9838084610cd6565b610b3e9190610ced565b91505b612000831615610b7357670de0b6b3a7640000610b66670cb9da519ccfb70084610cd6565b610b709190610ced565b91505b614000831615610ba557670de0b6b3a7640000610b98670bab76d59c18d68084610cd6565b610ba29190610ced565b91505b618000831615610bd757670de0b6b3a7640000610bca6709d025defee4df8084610cd6565b610bd49190610ced565b91505b50919050565b600060208284031215610bef57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146107f357600080fd5b60008060008060608587031215610c3557600080fd5b843567ffffffffffffffff80821115610c4d57600080fd5b818701915087601f830112610c6157600080fd5b813581811115610c7057600080fd5b886020828501011115610c8257600080fd5b6020928301999098509187013596604001359550909350505050565b60008060408385031215610cb157600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761026757610267610cc0565b600082610d0a57634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561026757610267610cc0565b634e487b7160e01b600052603260045260246000fd5b8082018082111561026757610267610cc0565b600060018201610d5d57610d5d610cc0565b5060010190565b600060208284031215610d7657600080fd5b505191905056fea26469706673582212202f367baa7e38083ab11fe6251d0dac4c55d4d507b0208df054acbe0c97eb6baf64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "decayedPremium(uint256,uint256)": { + "details": "Returns the premium price at current time elapsed", + "params": { + "elapsed": "time past since expiry", + "startPremium": "starting price" + } + }, + "premium(string,uint256,uint256)": { + "details": "Returns the pricing premium in wei." + }, + "price(string,uint256,uint256)": { + "details": "Returns the price to register or renew a name.", + "params": { + "duration": "How long the name is being registered or extended for, in seconds.", + "expires": "When the name presently expires (0 if this is a new registration).", + "name": "The name being registered or renewed." + }, + "returns": { + "_0": "base premium tuple of base price + premium price" + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/ExtendedDNSResolver.json b/solidity/dns-contracts/deployments/mainnet/ExtendedDNSResolver.json new file mode 100644 index 0000000..9f284b5 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/ExtendedDNSResolver.json @@ -0,0 +1,110 @@ +{ + "address": "0x08769D484a7Cd9c4A98E928D9E270221F3E8578c", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "addr", + "type": "bytes" + } + ], + "name": "InvalidAddressFormat", + "type": "error" + }, + { + "inputs": [], + "name": "NotImplemented", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "context", + "type": "bytes" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x073a2781e7de2952710c167993a7900eb4c2c3838aeea1640666744aa7452dc8", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0x08769D484a7Cd9c4A98E928D9E270221F3E8578c", + "transactionIndex": 98, + "gasUsed": "1116071", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xa2aa6d335649626902472977466df67c0a08f739bc0fe0bef2ff7d5d900c4bfc", + "transactionHash": "0x073a2781e7de2952710c167993a7900eb4c2c3838aeea1640666744aa7452dc8", + "logs": [], + "blockNumber": 20426738, + "cumulativeGasUsed": "11217248", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 2, + "solcInputHash": "96d118177ae253bdd3815d2757c11cd9", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"addr\",\"type\":\"bytes\"}],\"name\":\"InvalidAddressFormat\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotImplemented\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"context\",\"type\":\"bytes\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Resolves names on ENS by interpreting record data stored in a DNS TXT record. This resolver implements the IExtendedDNSResolver interface, meaning that when a DNS name specifies it as the resolver via a TXT record, this resolver's resolve() method is invoked, and is passed any additional information from that text record. This resolver implements a simple text parser allowing a variety of records to be specified in text, which will then be used to resolve the name in ENS. To use this, set a TXT record on your DNS name in the following format: ENS1
For example: ENS1 2.dnsname.ens.eth a[60]=0x1234... The record data consists of a series of key=value pairs, separated by spaces. Keys may have an optional argument in square brackets, and values may be either unquoted - in which case they may not contain spaces - or single-quoted. Single quotes in a quoted value may be backslash-escaped. \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510 \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2534\\u2500\\u2524\\\" \\\"\\u2502\\u25c4\\u2500\\u2534\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u2502 ^\\u2500\\u2534\\u2500\\u25ba\\u2502key\\u251c\\u2500\\u252c\\u2500\\u25ba\\u2502\\\"[\\\"\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502arg\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502\\\"]\\\"\\u251c\\u2500\\u252c\\u2500\\u25ba\\u2502\\\"=\\\"\\u251c\\u2500\\u252c\\u2500\\u25ba\\u2502\\\"'\\\"\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502quoted_value\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502\\\"'\\\"\\u251c\\u2500\\u253c\\u2500$ \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u25ba\\u2502unquoted_value\\u251c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518 Record types: - a[] - Specifies how an `addr()` request should be resolved for the specified `coinType`. Ethereum has `coinType` 60. The value must be 0x-prefixed hexadecimal, and will be returned unmodified; this means that non-EVM addresses will need to be translated into binary format and then encoded in hex. Examples: - a[60]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7 - a[0]=0x00149010587f8364b964fcaa70687216b53bd2cbd798 - a[e] - Specifies how an `addr()` request should be resolved for the specified `chainId`. The value must be 0x-prefixed hexadecimal. When encoding an address for an EVM-based cryptocurrency that uses a chainId instead of a coinType, this syntax *must* be used in place of the coin type - eg, Optimism is `a[e10]`, not `a[2147483658]`. A list of supported cryptocurrencies for both syntaxes can be found here: https://github.com/ensdomains/address-encoder/blob/master/docs/supported-cryptocurrencies.md Example: - a[e10]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7 - t[] - Specifies how a `text()` request should be resolved for the specified `key`. Examples: - t[com.twitter]=nicksdjohnson - t[url]='https://ens.domains/' - t[note]='I\\\\'m great'\",\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/resolvers/profiles/ExtendedDNSResolver.sol\":\"ExtendedDNSResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ExtendedDNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"../../resolvers/profiles/IExtendedDNSResolver.sol\\\";\\nimport \\\"../../resolvers/profiles/IAddressResolver.sol\\\";\\nimport \\\"../../resolvers/profiles/IAddrResolver.sol\\\";\\nimport \\\"../../resolvers/profiles/ITextResolver.sol\\\";\\nimport \\\"../../utils/HexUtils.sol\\\";\\nimport \\\"../../utils/BytesUtils.sol\\\";\\n\\n/**\\n * @dev Resolves names on ENS by interpreting record data stored in a DNS TXT record.\\n * This resolver implements the IExtendedDNSResolver interface, meaning that when\\n * a DNS name specifies it as the resolver via a TXT record, this resolver's\\n * resolve() method is invoked, and is passed any additional information from that\\n * text record. This resolver implements a simple text parser allowing a variety\\n * of records to be specified in text, which will then be used to resolve the name\\n * in ENS.\\n *\\n * To use this, set a TXT record on your DNS name in the following format:\\n * ENS1
\\n *\\n * For example:\\n * ENS1 2.dnsname.ens.eth a[60]=0x1234...\\n *\\n * The record data consists of a series of key=value pairs, separated by spaces. Keys\\n * may have an optional argument in square brackets, and values may be either unquoted\\n * - in which case they may not contain spaces - or single-quoted. Single quotes in\\n * a quoted value may be backslash-escaped.\\n *\\n *\\n * \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510\\n * \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u2502\\n * \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2534\\u2500\\u2524\\\" \\\"\\u2502\\u25c4\\u2500\\u2534\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510\\n * \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502\\n * \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u2502\\n * ^\\u2500\\u2534\\u2500\\u25ba\\u2502key\\u251c\\u2500\\u252c\\u2500\\u25ba\\u2502\\\"[\\\"\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502arg\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502\\\"]\\\"\\u251c\\u2500\\u252c\\u2500\\u25ba\\u2502\\\"=\\\"\\u251c\\u2500\\u252c\\u2500\\u25ba\\u2502\\\"'\\\"\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502quoted_value\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502\\\"'\\\"\\u251c\\u2500\\u253c\\u2500$\\n * \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502\\n * \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510 \\u2502\\n * \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u25ba\\u2502unquoted_value\\u251c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518\\n * \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518\\n *\\n * Record types:\\n * - a[] - Specifies how an `addr()` request should be resolved for the specified\\n * `coinType`. Ethereum has `coinType` 60. The value must be 0x-prefixed hexadecimal, and will\\n * be returned unmodified; this means that non-EVM addresses will need to be translated\\n * into binary format and then encoded in hex.\\n * Examples:\\n * - a[60]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7\\n * - a[0]=0x00149010587f8364b964fcaa70687216b53bd2cbd798\\n * - a[e] - Specifies how an `addr()` request should be resolved for the specified\\n * `chainId`. The value must be 0x-prefixed hexadecimal. When encoding an address for an\\n * EVM-based cryptocurrency that uses a chainId instead of a coinType, this syntax *must*\\n * be used in place of the coin type - eg, Optimism is `a[e10]`, not `a[2147483658]`.\\n * A list of supported cryptocurrencies for both syntaxes can be found here:\\n * https://github.com/ensdomains/address-encoder/blob/master/docs/supported-cryptocurrencies.md\\n * Example:\\n * - a[e10]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7\\n * - t[] - Specifies how a `text()` request should be resolved for the specified `key`.\\n * Examples:\\n * - t[com.twitter]=nicksdjohnson\\n * - t[url]='https://ens.domains/'\\n * - t[note]='I\\\\'m great'\\n */\\ncontract ExtendedDNSResolver is IExtendedDNSResolver, IERC165 {\\n using HexUtils for *;\\n using BytesUtils for *;\\n using Strings for *;\\n\\n uint256 private constant COIN_TYPE_ETH = 60;\\n\\n error NotImplemented();\\n error InvalidAddressFormat(bytes addr);\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) external view virtual override returns (bool) {\\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\\n }\\n\\n function resolve(\\n bytes calldata /* name */,\\n bytes calldata data,\\n bytes calldata context\\n ) external pure override returns (bytes memory) {\\n bytes4 selector = bytes4(data);\\n if (selector == IAddrResolver.addr.selector) {\\n return _resolveAddr(context);\\n } else if (selector == IAddressResolver.addr.selector) {\\n return _resolveAddress(data, context);\\n } else if (selector == ITextResolver.text.selector) {\\n return _resolveText(data, context);\\n }\\n revert NotImplemented();\\n }\\n\\n function _resolveAddress(\\n bytes calldata data,\\n bytes calldata context\\n ) internal pure returns (bytes memory) {\\n (, uint256 coinType) = abi.decode(data[4:], (bytes32, uint256));\\n bytes memory value;\\n // Per https://docs.ens.domains/ensip/11#specification\\n if (coinType & 0x80000000 != 0) {\\n value = _findValue(\\n context,\\n bytes.concat(\\n \\\"a[e\\\",\\n bytes((coinType & 0x7fffffff).toString()),\\n \\\"]=\\\"\\n )\\n );\\n } else {\\n value = _findValue(\\n context,\\n bytes.concat(\\\"a[\\\", bytes(coinType.toString()), \\\"]=\\\")\\n );\\n }\\n if (value.length == 0) {\\n return value;\\n }\\n (bytes memory record, bool valid) = value.hexToBytes(2, value.length);\\n if (!valid) revert InvalidAddressFormat(value);\\n return record;\\n }\\n\\n function _resolveAddr(\\n bytes calldata context\\n ) internal pure returns (bytes memory) {\\n bytes memory value = _findValue(context, \\\"a[60]=\\\");\\n if (value.length == 0) {\\n return value;\\n }\\n (bytes memory record, bool valid) = value.hexToBytes(2, value.length);\\n if (!valid) revert InvalidAddressFormat(value);\\n return record;\\n }\\n\\n function _resolveText(\\n bytes calldata data,\\n bytes calldata context\\n ) internal pure returns (bytes memory) {\\n (, string memory key) = abi.decode(data[4:], (bytes32, string));\\n bytes memory value = _findValue(\\n context,\\n bytes.concat(\\\"t[\\\", bytes(key), \\\"]=\\\")\\n );\\n return value;\\n }\\n\\n uint256 constant STATE_START = 0;\\n uint256 constant STATE_IGNORED_KEY = 1;\\n uint256 constant STATE_IGNORED_KEY_ARG = 2;\\n uint256 constant STATE_VALUE = 3;\\n uint256 constant STATE_QUOTED_VALUE = 4;\\n uint256 constant STATE_UNQUOTED_VALUE = 5;\\n uint256 constant STATE_IGNORED_VALUE = 6;\\n uint256 constant STATE_IGNORED_QUOTED_VALUE = 7;\\n uint256 constant STATE_IGNORED_UNQUOTED_VALUE = 8;\\n\\n /**\\n * @dev Implements a DFA to parse the text record, looking for an entry\\n * matching `key`.\\n * @param data The text record to parse.\\n * @param key The exact key to search for.\\n * @return value The value if found, or an empty string if `key` does not exist.\\n */\\n function _findValue(\\n bytes memory data,\\n bytes memory key\\n ) internal pure returns (bytes memory value) {\\n // Here we use a simple state machine to parse the text record. We\\n // process characters one at a time; each character can trigger a\\n // transition to a new state, or terminate the DFA and return a value.\\n // For states that expect to process a number of tokens, we use\\n // inner loops for efficiency reasons, to avoid the need to go\\n // through the outer loop and switch statement for every character.\\n uint256 state = STATE_START;\\n uint256 len = data.length;\\n for (uint256 i = 0; i < len; ) {\\n if (state == STATE_START) {\\n // Look for a matching key.\\n if (data.equals(i, key, 0, key.length)) {\\n i += key.length;\\n state = STATE_VALUE;\\n } else {\\n state = STATE_IGNORED_KEY;\\n }\\n } else if (state == STATE_IGNORED_KEY) {\\n for (; i < len; i++) {\\n if (data[i] == \\\"=\\\") {\\n state = STATE_IGNORED_VALUE;\\n i += 1;\\n break;\\n } else if (data[i] == \\\"[\\\") {\\n state = STATE_IGNORED_KEY_ARG;\\n i += 1;\\n break;\\n }\\n }\\n } else if (state == STATE_IGNORED_KEY_ARG) {\\n for (; i < len; i++) {\\n if (data[i] == \\\"]\\\") {\\n state = STATE_IGNORED_VALUE;\\n i += 1;\\n if (data[i] == \\\"=\\\") {\\n i += 1;\\n }\\n break;\\n }\\n }\\n } else if (state == STATE_VALUE) {\\n if (data[i] == \\\"'\\\") {\\n state = STATE_QUOTED_VALUE;\\n i += 1;\\n } else {\\n state = STATE_UNQUOTED_VALUE;\\n }\\n } else if (state == STATE_QUOTED_VALUE) {\\n uint256 start = i;\\n uint256 valueLen = 0;\\n bool escaped = false;\\n for (; i < len; i++) {\\n if (escaped) {\\n data[start + valueLen] = data[i];\\n valueLen += 1;\\n escaped = false;\\n } else {\\n if (data[i] == \\\"\\\\\\\\\\\") {\\n escaped = true;\\n } else if (data[i] == \\\"'\\\") {\\n return data.substring(start, valueLen);\\n } else {\\n data[start + valueLen] = data[i];\\n valueLen += 1;\\n }\\n }\\n }\\n } else if (state == STATE_UNQUOTED_VALUE) {\\n uint256 start = i;\\n for (; i < len; i++) {\\n if (data[i] == \\\" \\\") {\\n return data.substring(start, i - start);\\n }\\n }\\n return data.substring(start, len - start);\\n } else if (state == STATE_IGNORED_VALUE) {\\n if (data[i] == \\\"'\\\") {\\n state = STATE_IGNORED_QUOTED_VALUE;\\n i += 1;\\n } else {\\n state = STATE_IGNORED_UNQUOTED_VALUE;\\n }\\n } else if (state == STATE_IGNORED_QUOTED_VALUE) {\\n bool escaped = false;\\n for (; i < len; i++) {\\n if (escaped) {\\n escaped = false;\\n } else {\\n if (data[i] == \\\"\\\\\\\\\\\") {\\n escaped = true;\\n } else if (data[i] == \\\"'\\\") {\\n i += 1;\\n while (data[i] == \\\" \\\") {\\n i += 1;\\n }\\n state = STATE_START;\\n break;\\n }\\n }\\n }\\n } else {\\n assert(state == STATE_IGNORED_UNQUOTED_VALUE);\\n for (; i < len; i++) {\\n if (data[i] == \\\" \\\") {\\n while (data[i] == \\\" \\\") {\\n i += 1;\\n }\\n state = STATE_START;\\n break;\\n }\\n }\\n }\\n }\\n return \\\"\\\";\\n }\\n}\\n\",\"keccak256\":\"0xb8954b152d8fb29cd7239e33d0c17c3dfb52ff7cd6d4c060bb72e62b0ae8e197\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedDNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedDNSResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data,\\n bytes memory context\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x541f8799c34ff9e7035d09f06ae0f0f8a16b6065e9b60a15670b957321630f72\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/utils/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes32) {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0xc566a3569af880a096a9bfb2fbb77060ef7aecde1a205dc26446a58877412060\",\"license\":\"MIT\"},\"contracts/utils/HexUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary HexUtils {\\n /**\\n * @dev Attempts to parse bytes32 from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexStringToBytes32(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (bytes32, bool) {\\n require(lastIdx - idx <= 64);\\n (bytes memory r, bool valid) = hexToBytes(str, idx, lastIdx);\\n if (!valid) {\\n return (bytes32(0), false);\\n }\\n bytes32 ret;\\n assembly {\\n ret := shr(mul(4, sub(64, sub(lastIdx, idx))), mload(add(r, 32)))\\n }\\n return (ret, true);\\n }\\n\\n function hexToBytes(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (bytes memory r, bool valid) {\\n uint256 hexLength = lastIdx - idx;\\n if (hexLength % 2 == 1) {\\n revert(\\\"Invalid string length\\\");\\n }\\n r = new bytes(hexLength / 2);\\n valid = true;\\n assembly {\\n // check that the index to read to is not past the end of the string\\n if gt(lastIdx, mload(str)) {\\n revert(0, 0)\\n }\\n\\n function getHex(c) -> ascii {\\n // chars 48-57: 0-9\\n if and(gt(c, 47), lt(c, 58)) {\\n ascii := sub(c, 48)\\n leave\\n }\\n // chars 65-70: A-F\\n if and(gt(c, 64), lt(c, 71)) {\\n ascii := add(sub(c, 65), 10)\\n leave\\n }\\n // chars 97-102: a-f\\n if and(gt(c, 96), lt(c, 103)) {\\n ascii := add(sub(c, 97), 10)\\n leave\\n }\\n // invalid char\\n ascii := 0xff\\n }\\n\\n let ptr := add(str, 32)\\n for {\\n let i := idx\\n } lt(i, lastIdx) {\\n i := add(i, 2)\\n } {\\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\\n // if either byte is invalid, set invalid and break loop\\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\\n valid := false\\n break\\n }\\n let combined := or(shl(4, byte1), byte2)\\n mstore8(add(add(r, 32), div(sub(i, idx), 2)), combined)\\n }\\n }\\n }\\n\\n /**\\n * @dev Attempts to parse an address from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexToAddress(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (address, bool) {\\n if (lastIdx - idx < 40) return (address(0x0), false);\\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\\n return (address(uint160(uint256(r))), valid);\\n }\\n\\n /**\\n * @dev Attempts to convert an address to a hex string\\n * @param addr The _addr to parse\\n */\\n function addressToHex(address addr) internal pure returns (string memory) {\\n bytes memory hexString = new bytes(40);\\n for (uint i = 0; i < 20; i++) {\\n bytes1 byteValue = bytes1(uint8(uint160(addr) >> (8 * (19 - i))));\\n bytes1 highNibble = bytes1(uint8(byteValue) / 16);\\n bytes1 lowNibble = bytes1(\\n uint8(byteValue) - 16 * uint8(highNibble)\\n );\\n hexString[2 * i] = _nibbleToHexChar(highNibble);\\n hexString[2 * i + 1] = _nibbleToHexChar(lowNibble);\\n }\\n return string(hexString);\\n }\\n\\n function _nibbleToHexChar(\\n bytes1 nibble\\n ) internal pure returns (bytes1 hexChar) {\\n if (uint8(nibble) < 10) return bytes1(uint8(nibble) + 0x30);\\n else return bytes1(uint8(nibble) + 0x57);\\n }\\n}\\n\",\"keccak256\":\"0xd6a9ab6d19632f634ee0f29173278fb4ba1d90fbbb470e779d76f278a8a2b90d\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061134e806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806301ffc9a71461003b5780638ef98a7e1461008d575b600080fd5b610078610049366004610ec7565b6001600160e01b0319167f8ef98a7e000000000000000000000000000000000000000000000000000000001490565b60405190151581526020015b60405180910390f35b6100a061009b366004610f41565b6100ad565b6040516100849190610fff565b606060006100bb8587611032565b90507fc4c4a822000000000000000000000000000000000000000000000000000000006001600160e01b0319821601610100576100f884846101b6565b9150506101ac565b7f0e3481fa000000000000000000000000000000000000000000000000000000006001600160e01b031982160161013d576100f886868686610292565b7fa62e2bc4000000000000000000000000000000000000000000000000000000006001600160e01b031982160161017a576100f8868686866103ed565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9695505050505050565b6060600061022e84848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060408051808201909152600681527f615b36305d3d0000000000000000000000000000000000000000000000000000602082015291506104659050565b9050805160000361024057905061028c565b60008061025a6002845185610a7e9092919063ffffffff16565b91509150806102875782604051630f79e00960e21b815260040161027e9190610fff565b60405180910390fd5b509150505b92915050565b606060006102a38560048189611062565b8101906102b0919061108c565b9150506060816380000000166000146103375761033085858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061030c92505050637fffffff8516610c26565b60405160200161031c91906110ae565b604051602081830303815290604052610465565b905061038f565b61038c85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061037c9250869150610c269050565b60405160200161031c91906110ff565b90505b80516000036103a15791506103e59050565b6000806103bb6002845185610a7e9092919063ffffffff16565b91509150806103df5782604051630f79e00960e21b815260040161027e9190610fff565b50925050505b949350505050565b606060006103fe8560048189611062565b81019061040b9190611166565b915050600061045a85858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060405161031c9250869150602001611221565b979650505050505050565b8151606090600090815b81811015610a6557826104b557845161049090879083908890600090610cc6565b156104ac5784516104a1908261126f565b90506003925061046f565b6001925061046f565b60018303610574575b8181101561056f578581815181106104d8576104d8611282565b01602001516001600160f81b031916603d60f81b03610507576006925061050060018261126f565b905061046f565b85818151811061051957610519611282565b01602001516001600160f81b0319167f5b000000000000000000000000000000000000000000000000000000000000000361055d576002925061050060018261126f565b8061056781611298565b9150506104be565b61046f565b60028303610625575b8181101561056f5785818151811061059757610597611282565b01602001516001600160f81b0319167f5d000000000000000000000000000000000000000000000000000000000000000361061357600692506105db60018261126f565b90508581815181106105ef576105ef611282565b01602001516001600160f81b031916603d60f81b0361056f5761050060018261126f565b8061061d81611298565b91505061057d565b600383036106705785818151811061063f5761063f611282565b01602001516001600160f81b031916602760f81b03610667576004925061050060018261126f565b6005925061046f565b6004830361081557806000805b8484101561080d57801561070c5788848151811061069d5761069d611282565b01602001516001600160f81b031916896106b7848661126f565b815181106106c7576106c7611282565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061070160018361126f565b9150600090506107fb565b88848151811061071e5761071e611282565b01602001516001600160f81b031916601760fa1b0361073f575060016107fb565b88848151811061075157610751611282565b01602001516001600160f81b031916602760f81b0361078257610775898484610ce9565b965050505050505061028c565b88848151811061079457610794611282565b01602001516001600160f81b031916896107ae848661126f565b815181106107be576107be611282565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506107f860018361126f565b91505b8361080581611298565b94505061067d565b50505061046f565b6005830361089357805b828210156108855786828151811061083957610839611282565b01602001516001600160f81b031916600160fd1b03610873576108688161086081856112b1565b899190610ce9565b94505050505061028c565b8161087d81611298565b92505061081f565b6108688161086081866112b1565b600683036108de578581815181106108ad576108ad611282565b01602001516001600160f81b031916602760f81b036108d5576007925061050060018261126f565b6008925061046f565b600783036109c95760005b828210156109c35780156108ff575060006109b1565b86828151811061091157610911611282565b01602001516001600160f81b031916601760fa1b03610932575060016109b1565b86828151811061094457610944611282565b01602001516001600160f81b031916602760f81b036109b15761096860018361126f565b91505b86828151811061097d5761097d611282565b01602001516001600160f81b031916600160fd1b036109a8576109a160018361126f565b915061096b565b600093506109c3565b816109bb81611298565b9250506108e9565b5061046f565b600883146109d9576109d96112c4565b8181101561056f578581815181106109f3576109f3611282565b01602001516001600160f81b031916600160fd1b03610a53575b858181518110610a1f57610a1f611282565b01602001516001600160f81b031916600160fd1b03610a4a57610a4360018261126f565b9050610a0d565b6000925061046f565b80610a5d81611298565b9150506109d9565b5050604080516020810190915260008152949350505050565b6060600080610a8d85856112b1565b9050610a9a6002826112f0565b600103610b03576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f496e76616c696420737472696e67206c656e6774680000000000000000000000604482015260640161027e565b610b0e600282611304565b67ffffffffffffffff811115610b2657610b26611150565b6040519080825280601f01601f191660200182016040528015610b50576020820181803683370190505b509250600191508551841115610b6557600080fd5b610bb6565b6000603a8210602f83111615610b825750602f190190565b60478210604083111615610b9857506036190190565b60678210606083111615610bae57506056190190565b5060ff919050565b60208601855b85811015610c1b57610bd38183015160001a610b6a565b610be56001830184015160001a610b6a565b60ff811460ff83141715610bfe57600095505050610c1b565b60049190911b178060028984030487016020015350600201610bbc565b505050935093915050565b60606000610c3383610d6b565b600101905060008167ffffffffffffffff811115610c5357610c53611150565b6040519080825280601f01601f191660200182016040528015610c7d576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084610c8757509392505050565b6000610cd3848484610e4d565b610cde878785610e4d565b149695505050505050565b8251606090610cf8838561126f565b1115610d0357600080fd5b60008267ffffffffffffffff811115610d1e57610d1e611150565b6040519080825280601f01601f191660200182016040528015610d48576020820181803683370190505b50905060208082019086860101610d60828287610e71565b509095945050505050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310610db4577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310610de0576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610dfe57662386f26fc10000830492506010015b6305f5e1008310610e16576305f5e100830492506008015b6127108310610e2a57612710830492506004015b60648310610e3c576064830492506002015b600a831061028c5760010192915050565b8251600090610e5c838561126f565b1115610e6757600080fd5b5091016020012090565b60208110610ea95781518352610e8860208461126f565b9250610e9560208361126f565b9150610ea26020826112b1565b9050610e71565b905182516020929092036101000a6000190180199091169116179052565b600060208284031215610ed957600080fd5b81356001600160e01b031981168114610ef157600080fd5b9392505050565b60008083601f840112610f0a57600080fd5b50813567ffffffffffffffff811115610f2257600080fd5b602083019150836020828501011115610f3a57600080fd5b9250929050565b60008060008060008060608789031215610f5a57600080fd5b863567ffffffffffffffff80821115610f7257600080fd5b610f7e8a838b01610ef8565b90985096506020890135915080821115610f9757600080fd5b610fa38a838b01610ef8565b90965094506040890135915080821115610fbc57600080fd5b50610fc989828a01610ef8565b979a9699509497509295939492505050565b60005b83811015610ff6578181015183820152602001610fde565b50506000910152565b602081526000825180602084015261101e816040850160208701610fdb565b601f01601f19169190910160400192915050565b6001600160e01b0319813581811691600485101561105a5780818660040360031b1b83161692505b505092915050565b6000808585111561107257600080fd5b8386111561107f57600080fd5b5050820193919092039150565b6000806040838503121561109f57600080fd5b50508035926020909101359150565b7f615b6500000000000000000000000000000000000000000000000000000000008152600082516110e6816003850160208701610fdb565b615d3d60f01b6003939091019283015250600501919050565b7f615b000000000000000000000000000000000000000000000000000000000000815260008251611137816002850160208701610fdb565b615d3d60f01b6002939091019283015250600401919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561117957600080fd5b82359150602083013567ffffffffffffffff8082111561119857600080fd5b818501915085601f8301126111ac57600080fd5b8135818111156111be576111be611150565b604051601f8201601f19908116603f011681019083821181831017156111e6576111e6611150565b816040528281528860208487010111156111ff57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b7f745b000000000000000000000000000000000000000000000000000000000000815260008251611137816002850160208701610fdb565b634e487b7160e01b600052601160045260246000fd5b8082018082111561028c5761028c611259565b634e487b7160e01b600052603260045260246000fd5b6000600182016112aa576112aa611259565b5060010190565b8181038181111561028c5761028c611259565b634e487b7160e01b600052600160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6000826112ff576112ff6112da565b500690565b600082611313576113136112da565b50049056fea26469706673582212203572cfc5fcb1ebedbb66aca92142c81b01bd1363a5a1c1b46d18a861668d369764736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806301ffc9a71461003b5780638ef98a7e1461008d575b600080fd5b610078610049366004610ec7565b6001600160e01b0319167f8ef98a7e000000000000000000000000000000000000000000000000000000001490565b60405190151581526020015b60405180910390f35b6100a061009b366004610f41565b6100ad565b6040516100849190610fff565b606060006100bb8587611032565b90507fc4c4a822000000000000000000000000000000000000000000000000000000006001600160e01b0319821601610100576100f884846101b6565b9150506101ac565b7f0e3481fa000000000000000000000000000000000000000000000000000000006001600160e01b031982160161013d576100f886868686610292565b7fa62e2bc4000000000000000000000000000000000000000000000000000000006001600160e01b031982160161017a576100f8868686866103ed565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9695505050505050565b6060600061022e84848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060408051808201909152600681527f615b36305d3d0000000000000000000000000000000000000000000000000000602082015291506104659050565b9050805160000361024057905061028c565b60008061025a6002845185610a7e9092919063ffffffff16565b91509150806102875782604051630f79e00960e21b815260040161027e9190610fff565b60405180910390fd5b509150505b92915050565b606060006102a38560048189611062565b8101906102b0919061108c565b9150506060816380000000166000146103375761033085858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061030c92505050637fffffff8516610c26565b60405160200161031c91906110ae565b604051602081830303815290604052610465565b905061038f565b61038c85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061037c9250869150610c269050565b60405160200161031c91906110ff565b90505b80516000036103a15791506103e59050565b6000806103bb6002845185610a7e9092919063ffffffff16565b91509150806103df5782604051630f79e00960e21b815260040161027e9190610fff565b50925050505b949350505050565b606060006103fe8560048189611062565b81019061040b9190611166565b915050600061045a85858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060405161031c9250869150602001611221565b979650505050505050565b8151606090600090815b81811015610a6557826104b557845161049090879083908890600090610cc6565b156104ac5784516104a1908261126f565b90506003925061046f565b6001925061046f565b60018303610574575b8181101561056f578581815181106104d8576104d8611282565b01602001516001600160f81b031916603d60f81b03610507576006925061050060018261126f565b905061046f565b85818151811061051957610519611282565b01602001516001600160f81b0319167f5b000000000000000000000000000000000000000000000000000000000000000361055d576002925061050060018261126f565b8061056781611298565b9150506104be565b61046f565b60028303610625575b8181101561056f5785818151811061059757610597611282565b01602001516001600160f81b0319167f5d000000000000000000000000000000000000000000000000000000000000000361061357600692506105db60018261126f565b90508581815181106105ef576105ef611282565b01602001516001600160f81b031916603d60f81b0361056f5761050060018261126f565b8061061d81611298565b91505061057d565b600383036106705785818151811061063f5761063f611282565b01602001516001600160f81b031916602760f81b03610667576004925061050060018261126f565b6005925061046f565b6004830361081557806000805b8484101561080d57801561070c5788848151811061069d5761069d611282565b01602001516001600160f81b031916896106b7848661126f565b815181106106c7576106c7611282565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061070160018361126f565b9150600090506107fb565b88848151811061071e5761071e611282565b01602001516001600160f81b031916601760fa1b0361073f575060016107fb565b88848151811061075157610751611282565b01602001516001600160f81b031916602760f81b0361078257610775898484610ce9565b965050505050505061028c565b88848151811061079457610794611282565b01602001516001600160f81b031916896107ae848661126f565b815181106107be576107be611282565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506107f860018361126f565b91505b8361080581611298565b94505061067d565b50505061046f565b6005830361089357805b828210156108855786828151811061083957610839611282565b01602001516001600160f81b031916600160fd1b03610873576108688161086081856112b1565b899190610ce9565b94505050505061028c565b8161087d81611298565b92505061081f565b6108688161086081866112b1565b600683036108de578581815181106108ad576108ad611282565b01602001516001600160f81b031916602760f81b036108d5576007925061050060018261126f565b6008925061046f565b600783036109c95760005b828210156109c35780156108ff575060006109b1565b86828151811061091157610911611282565b01602001516001600160f81b031916601760fa1b03610932575060016109b1565b86828151811061094457610944611282565b01602001516001600160f81b031916602760f81b036109b15761096860018361126f565b91505b86828151811061097d5761097d611282565b01602001516001600160f81b031916600160fd1b036109a8576109a160018361126f565b915061096b565b600093506109c3565b816109bb81611298565b9250506108e9565b5061046f565b600883146109d9576109d96112c4565b8181101561056f578581815181106109f3576109f3611282565b01602001516001600160f81b031916600160fd1b03610a53575b858181518110610a1f57610a1f611282565b01602001516001600160f81b031916600160fd1b03610a4a57610a4360018261126f565b9050610a0d565b6000925061046f565b80610a5d81611298565b9150506109d9565b5050604080516020810190915260008152949350505050565b6060600080610a8d85856112b1565b9050610a9a6002826112f0565b600103610b03576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f496e76616c696420737472696e67206c656e6774680000000000000000000000604482015260640161027e565b610b0e600282611304565b67ffffffffffffffff811115610b2657610b26611150565b6040519080825280601f01601f191660200182016040528015610b50576020820181803683370190505b509250600191508551841115610b6557600080fd5b610bb6565b6000603a8210602f83111615610b825750602f190190565b60478210604083111615610b9857506036190190565b60678210606083111615610bae57506056190190565b5060ff919050565b60208601855b85811015610c1b57610bd38183015160001a610b6a565b610be56001830184015160001a610b6a565b60ff811460ff83141715610bfe57600095505050610c1b565b60049190911b178060028984030487016020015350600201610bbc565b505050935093915050565b60606000610c3383610d6b565b600101905060008167ffffffffffffffff811115610c5357610c53611150565b6040519080825280601f01601f191660200182016040528015610c7d576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084610c8757509392505050565b6000610cd3848484610e4d565b610cde878785610e4d565b149695505050505050565b8251606090610cf8838561126f565b1115610d0357600080fd5b60008267ffffffffffffffff811115610d1e57610d1e611150565b6040519080825280601f01601f191660200182016040528015610d48576020820181803683370190505b50905060208082019086860101610d60828287610e71565b509095945050505050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310610db4577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310610de0576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610dfe57662386f26fc10000830492506010015b6305f5e1008310610e16576305f5e100830492506008015b6127108310610e2a57612710830492506004015b60648310610e3c576064830492506002015b600a831061028c5760010192915050565b8251600090610e5c838561126f565b1115610e6757600080fd5b5091016020012090565b60208110610ea95781518352610e8860208461126f565b9250610e9560208361126f565b9150610ea26020826112b1565b9050610e71565b905182516020929092036101000a6000190180199091169116179052565b600060208284031215610ed957600080fd5b81356001600160e01b031981168114610ef157600080fd5b9392505050565b60008083601f840112610f0a57600080fd5b50813567ffffffffffffffff811115610f2257600080fd5b602083019150836020828501011115610f3a57600080fd5b9250929050565b60008060008060008060608789031215610f5a57600080fd5b863567ffffffffffffffff80821115610f7257600080fd5b610f7e8a838b01610ef8565b90985096506020890135915080821115610f9757600080fd5b610fa38a838b01610ef8565b90965094506040890135915080821115610fbc57600080fd5b50610fc989828a01610ef8565b979a9699509497509295939492505050565b60005b83811015610ff6578181015183820152602001610fde565b50506000910152565b602081526000825180602084015261101e816040850160208701610fdb565b601f01601f19169190910160400192915050565b6001600160e01b0319813581811691600485101561105a5780818660040360031b1b83161692505b505092915050565b6000808585111561107257600080fd5b8386111561107f57600080fd5b5050820193919092039150565b6000806040838503121561109f57600080fd5b50508035926020909101359150565b7f615b6500000000000000000000000000000000000000000000000000000000008152600082516110e6816003850160208701610fdb565b615d3d60f01b6003939091019283015250600501919050565b7f615b000000000000000000000000000000000000000000000000000000000000815260008251611137816002850160208701610fdb565b615d3d60f01b6002939091019283015250600401919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561117957600080fd5b82359150602083013567ffffffffffffffff8082111561119857600080fd5b818501915085601f8301126111ac57600080fd5b8135818111156111be576111be611150565b604051601f8201601f19908116603f011681019083821181831017156111e6576111e6611150565b816040528281528860208487010111156111ff57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b7f745b000000000000000000000000000000000000000000000000000000000000815260008251611137816002850160208701610fdb565b634e487b7160e01b600052601160045260246000fd5b8082018082111561028c5761028c611259565b634e487b7160e01b600052603260045260246000fd5b6000600182016112aa576112aa611259565b5060010190565b8181038181111561028c5761028c611259565b634e487b7160e01b600052600160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6000826112ff576112ff6112da565b500690565b600082611313576113136112da565b50049056fea26469706673582212203572cfc5fcb1ebedbb66aca92142c81b01bd1363a5a1c1b46d18a861668d369764736f6c63430008110033", + "devdoc": { + "details": "Resolves names on ENS by interpreting record data stored in a DNS TXT record. This resolver implements the IExtendedDNSResolver interface, meaning that when a DNS name specifies it as the resolver via a TXT record, this resolver's resolve() method is invoked, and is passed any additional information from that text record. This resolver implements a simple text parser allowing a variety of records to be specified in text, which will then be used to resolve the name in ENS. To use this, set a TXT record on your DNS name in the following format: ENS1
For example: ENS1 2.dnsname.ens.eth a[60]=0x1234... The record data consists of a series of key=value pairs, separated by spaces. Keys may have an optional argument in square brackets, and values may be either unquoted - in which case they may not contain spaces - or single-quoted. Single quotes in a quoted value may be backslash-escaped. ┌────────┐ │ ┌───┐ │ ┌──────────────────────────────┴─┤\" \"│◄─┴────────────────────────────────────────┐ │ └───┘ │ │ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌────────────┐ ┌───┐ │ ^─┴─►│key├─┬─►│\"[\"├───►│arg├───►│\"]\"├─┬─►│\"=\"├─┬─►│\"'\"├───►│quoted_value├───►│\"'\"├─┼─$ └───┘ │ └───┘ └───┘ └───┘ │ └───┘ │ └───┘ └────────────┘ └───┘ │ └──────────────────────────┘ │ ┌──────────────┐ │ └─────────►│unquoted_value├─────────┘ └──────────────┘ Record types: - a[] - Specifies how an `addr()` request should be resolved for the specified `coinType`. Ethereum has `coinType` 60. The value must be 0x-prefixed hexadecimal, and will be returned unmodified; this means that non-EVM addresses will need to be translated into binary format and then encoded in hex. Examples: - a[60]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7 - a[0]=0x00149010587f8364b964fcaa70687216b53bd2cbd798 - a[e] - Specifies how an `addr()` request should be resolved for the specified `chainId`. The value must be 0x-prefixed hexadecimal. When encoding an address for an EVM-based cryptocurrency that uses a chainId instead of a coinType, this syntax *must* be used in place of the coin type - eg, Optimism is `a[e10]`, not `a[2147483658]`. A list of supported cryptocurrencies for both syntaxes can be found here: https://github.com/ensdomains/address-encoder/blob/master/docs/supported-cryptocurrencies.md Example: - a[e10]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7 - t[] - Specifies how a `text()` request should be resolved for the specified `key`. Examples: - t[com.twitter]=nicksdjohnson - t[url]='https://ens.domains/' - t[note]='I\\'m great'", + "kind": "dev", + "methods": { + "supportsInterface(bytes4)": { + "details": "Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/NameWrapper.json b/solidity/dns-contracts/deployments/mainnet/NameWrapper.json new file mode 100644 index 0000000..02bf85b --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/NameWrapper.json @@ -0,0 +1,2012 @@ +{ + "address": "0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract IBaseRegistrar", + "name": "_registrar", + "type": "address" + }, + { + "internalType": "contract IMetadataService", + "name": "_metadataService", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "CannotUpgrade", + "type": "error" + }, + { + "inputs": [], + "name": "IncompatibleParent", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "IncorrectTargetOwner", + "type": "error" + }, + { + "inputs": [], + "name": "IncorrectTokenType", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "labelHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "expectedLabelhash", + "type": "bytes32" + } + ], + "name": "LabelMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + } + ], + "name": "LabelTooLong", + "type": "error" + }, + { + "inputs": [], + "name": "LabelTooShort", + "type": "error" + }, + { + "inputs": [], + "name": "NameIsNotWrapped", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "OperationProhibited", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "Unauthorised", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "ControllerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "ExpiryExtended", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + } + ], + "name": "FusesSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NameUnwrapped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "NameWrapped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + } + ], + "name": "TransferBatch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "TransferSingle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "value", + "type": "string" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "URI", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "_tokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint32", + "name": "fuseMask", + "type": "uint32" + } + ], + "name": "allFusesBurned", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "accounts", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + } + ], + "name": "balanceOfBatch", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "canExtendSubnames", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "canModifyName", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "extendExpiry", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "getData", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + } + ], + "name": "isWrapped", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "isWrapped", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "metadataService", + "outputs": [ + { + "internalType": "contract IMetadataService", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "names", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "recoverFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "name": "registerAndWrapETH2LD", + "outputs": [ + { + "internalType": "uint256", + "name": "registrarExpiry", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "registrar", + "outputs": [ + { + "internalType": "contract IBaseRegistrar", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [ + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeBatchTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setChildFuses", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "name": "setFuses", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IMetadataService", + "name": "_metadataService", + "type": "address" + } + ], + "name": "setMetadataService", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setSubnodeOwner", + "outputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract INameWrapperUpgrade", + "name": "_upgradeAddress", + "type": "address" + } + ], + "name": "setUpgradeContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "unwrap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "unwrapETH2LD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "upgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "upgradeContract", + "outputs": [ + { + "internalType": "contract INameWrapperUpgrade", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "uri", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "wrap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "wrapETH2LD", + "outputs": [ + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x72f81eb3c1feea020d06c0692ce9116f846a9e1bb5cdf27085d09721ec6367c3", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401", + "transactionIndex": 104, + "gasUsed": "5507592", + "logsBloom": "0x00000000000000000000000008000000000000000000000000800000008000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000001000800000000000000000000000000000000020080000000000000000800000000000001000000000000000000400000010000000000000000000000000000000000000000000000000000000000000000000000040000000000000004000000000000000000008000040000000000000000000000000000000000005000000800000000000000000000000021000080000000000000000000000100000000000000001000000000000000000000", + "blockHash": "0x64144d7c7e62384d0e713fdb4e4e81cd506790d12d48d2843b5bebc37e91f82c", + "transactionHash": "0x72f81eb3c1feea020d06c0692ce9116f846a9e1bb5cdf27085d09721ec6367c3", + "logs": [ + { + "transactionIndex": 104, + "blockNumber": 16925608, + "transactionHash": "0x72f81eb3c1feea020d06c0692ce9116f846a9e1bb5cdf27085d09721ec6367c3", + "address": "0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000904dac3347ea47d208f3fd67402d039a3b99859" + ], + "data": "0x", + "logIndex": 140, + "blockHash": "0x64144d7c7e62384d0e713fdb4e4e81cd506790d12d48d2843b5bebc37e91f82c" + }, + { + "transactionIndex": 104, + "blockNumber": 16925608, + "transactionHash": "0x72f81eb3c1feea020d06c0692ce9116f846a9e1bb5cdf27085d09721ec6367c3", + "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "topics": [ + "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", + "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2", + "0xb9f9912f021b305f108f4d8839790dacd37d0f99dad3e495b94aa4c087cda4d0" + ], + "data": "0x0000000000000000000000000904dac3347ea47d208f3fd67402d039a3b99859", + "logIndex": 141, + "blockHash": "0x64144d7c7e62384d0e713fdb4e4e81cd506790d12d48d2843b5bebc37e91f82c" + } + ], + "blockNumber": 16925608, + "cumulativeGasUsed": "11700651", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85", + "0x3A368e3D5F19aF3DE594A9fC2CFfc6e256a616c7" + ], + "numDeployments": 1, + "solcInputHash": "3fa59c31b7672c86eff32031f5a10f8a", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"_registrar\",\"type\":\"address\"},{\"internalType\":\"contract IMetadataService\",\"name\":\"_metadataService\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CannotUpgrade\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncompatibleParent\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"IncorrectTargetOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncorrectTokenType\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"labelHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"expectedLabelhash\",\"type\":\"bytes32\"}],\"name\":\"LabelMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"}],\"name\":\"LabelTooLong\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LabelTooShort\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NameIsNotWrapped\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"OperationProhibited\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"Unauthorised\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"}],\"name\":\"ControllerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"ExpiryExtended\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"}],\"name\":\"FusesSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"NameUnwrapped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"NameWrapped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"name\":\"TransferBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"TransferSingle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"URI\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"_tokens\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"fuseMask\",\"type\":\"uint32\"}],\"name\":\"allFusesBurned\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"balanceOfBatch\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"canExtendSubnames\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"canModifyName\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"extendExpiry\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getData\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"}],\"name\":\"isWrapped\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"isWrapped\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"metadataService\",\"outputs\":[{\"internalType\":\"contract IMetadataService\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"names\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"onERC721Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"recoverFunds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"name\":\"registerAndWrapETH2LD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"registrarExpiry\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"registrar\",\"outputs\":[{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"renew\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeBatchTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setChildFuses\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"name\":\"setFuses\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IMetadataService\",\"name\":\"_metadataService\",\"type\":\"address\"}],\"name\":\"setMetadataService\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"}],\"name\":\"setRecord\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setSubnodeOwner\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setSubnodeRecord\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"}],\"name\":\"setTTL\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract INameWrapperUpgrade\",\"name\":\"_upgradeAddress\",\"type\":\"address\"}],\"name\":\"setUpgradeContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"unwrap\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"registrant\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"unwrapETH2LD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"upgrade\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"upgradeContract\",\"outputs\":[{\"internalType\":\"contract INameWrapperUpgrade\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"wrap\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"wrapETH2LD\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"allFusesBurned(bytes32,uint32)\":{\"params\":{\"fuseMask\":\"The fuses you want to check\",\"node\":\"Namehash of the name\"},\"returns\":{\"_0\":\"Boolean of whether or not all the selected fuses are burned\"}},\"approve(address,uint256)\":{\"params\":{\"to\":\"address to approve\",\"tokenId\":\"name to approve\"}},\"balanceOf(address,uint256)\":{\"details\":\"See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address.\"},\"balanceOfBatch(address[],uint256[])\":{\"details\":\"See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length.\"},\"canExtendSubnames(bytes32,address)\":{\"params\":{\"addr\":\"which address to check permissions for\",\"node\":\"namehash of the name to check\"},\"returns\":{\"_0\":\"whether or not is owner/operator or approved\"}},\"canModifyName(bytes32,address)\":{\"params\":{\"addr\":\"which address to check permissions for\",\"node\":\"namehash of the name to check\"},\"returns\":{\"_0\":\"whether or not is owner or operator\"}},\"extendExpiry(bytes32,bytes32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"labelhash\":\"Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\",\"parentNode\":\"Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\"},\"returns\":{\"_0\":\"New expiry\"}},\"getApproved(uint256)\":{\"params\":{\"id\":\"Namehash of the name\"},\"returns\":{\"operator\":\"Approved operator of a name\"}},\"getData(uint256)\":{\"params\":{\"id\":\"Namehash of the name\"},\"returns\":{\"expiry\":\"Expiry of the name\",\"fuses\":\"Fuses of the name\",\"owner\":\"Owner of the name\"}},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC1155-isApprovedForAll}.\"},\"isWrapped(bytes32)\":{\"params\":{\"node\":\"Namehash of the name\"},\"returns\":{\"_0\":\"Boolean of whether or not the name is wrapped\"}},\"isWrapped(bytes32,bytes32)\":{\"params\":{\"labelhash\":\"Namehash of the name\",\"parentNode\":\"Namehash of the name\"},\"returns\":{\"_0\":\"Boolean of whether or not the name is wrapped\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"ownerOf(uint256)\":{\"params\":{\"id\":\"Label as a string of the .eth domain to wrap\"},\"returns\":{\"owner\":\"The owner of the name\"}},\"recoverFunds(address,address,uint256)\":{\"details\":\"The contract is Ownable and only the owner can call the recover function.\",\"params\":{\"_amount\":\"The amount of tokens to recover.\",\"_to\":\"The address to send the tokens to.\",\"_token\":\"The address of the ERC20 token to recover\"}},\"registerAndWrapETH2LD(string,address,uint256,address,uint16)\":{\"details\":\"Registers a new .eth second-level domain and wraps it. Only callable by authorised controllers.\",\"params\":{\"duration\":\"The duration, in seconds, to register the name for.\",\"label\":\"The label to register (Eg, 'foo' for 'foo.eth').\",\"ownerControlledFuses\":\"Initial owner-controlled fuses to set\",\"resolver\":\"The resolver address to set on the ENS registry (optional).\",\"wrappedOwner\":\"The owner of the wrapped name.\"},\"returns\":{\"registrarExpiry\":\"The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\"}},\"renew(uint256,uint256)\":{\"details\":\"Only callable by authorised controllers.\",\"params\":{\"duration\":\"The number of seconds to renew the name for.\",\"tokenId\":\"The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\"},\"returns\":{\"expires\":\"The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)\":{\"details\":\"See {IERC1155-safeBatchTransferFrom}.\"},\"safeTransferFrom(address,address,uint256,uint256,bytes)\":{\"details\":\"See {IERC1155-safeTransferFrom}.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC1155-setApprovalForAll}.\"},\"setChildFuses(bytes32,bytes32,uint32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"fuses\":\"Fuses to burn\",\"labelhash\":\"Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\",\"parentNode\":\"Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\"}},\"setFuses(bytes32,uint16)\":{\"params\":{\"node\":\"Namehash of the name\",\"ownerControlledFuses\":\"Owner-controlled fuses to burn\"},\"returns\":{\"_0\":\"Old fuses\"}},\"setMetadataService(address)\":{\"params\":{\"_metadataService\":\"The new metadata service\"}},\"setRecord(bytes32,address,address,uint64)\":{\"params\":{\"node\":\"Namehash of the name to set a record for\",\"owner\":\"New owner in the registry\",\"resolver\":\"Resolver contract\",\"ttl\":\"Time to live in the registry\"}},\"setResolver(bytes32,address)\":{\"params\":{\"node\":\"namehash of the name\",\"resolver\":\"the resolver contract\"}},\"setSubnodeOwner(bytes32,string,address,uint32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"fuses\":\"Initial fuses for the wrapped subdomain\",\"label\":\"Label of the subdomain as a string\",\"owner\":\"New owner in the wrapper\",\"parentNode\":\"Parent namehash of the subdomain\"},\"returns\":{\"node\":\"Namehash of the subdomain\"}},\"setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"fuses\":\"initial fuses for the wrapped subdomain\",\"label\":\"label of the subdomain as a string\",\"owner\":\"new owner in the wrapper\",\"parentNode\":\"parent namehash of the subdomain\",\"resolver\":\"resolver contract in the registry\",\"ttl\":\"ttl in the registry\"},\"returns\":{\"node\":\"Namehash of the subdomain\"}},\"setTTL(bytes32,uint64)\":{\"params\":{\"node\":\"Namehash of the name\",\"ttl\":\"TTL in the registry\"}},\"setUpgradeContract(address)\":{\"details\":\"The default value of upgradeContract is the 0 address. Use the 0 address at any time to make the contract not upgradable.\",\"params\":{\"_upgradeAddress\":\"address of an upgraded contract\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"unwrap(bytes32,bytes32,address)\":{\"details\":\"Can be called by the owner in the wrapper or an authorised caller in the wrapper\",\"params\":{\"controller\":\"Sets the owner in the registry to this address\",\"labelhash\":\"Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\",\"parentNode\":\"Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\"}},\"unwrapETH2LD(bytes32,address,address)\":{\"details\":\"Can be called by the owner in the wrapper or an authorised caller in the wrapper\",\"params\":{\"controller\":\"Sets the owner in the registry to this address\",\"labelhash\":\"Labelhash of the .eth domain\",\"registrant\":\"Sets the owner in the .eth registrar to this address\"}},\"upgrade(bytes,bytes)\":{\"details\":\"Can be called by the owner or an authorised caller\",\"params\":{\"extraData\":\"Extra data to pass to the upgrade contract\",\"name\":\"The name to upgrade, in DNS format\"}},\"uri(uint256)\":{\"params\":{\"tokenId\":\"The id of the token\"},\"returns\":{\"_0\":\"string uri of the metadata service\"}},\"wrap(bytes,address,address)\":{\"details\":\"Can be called by the owner in the registry or an authorised caller in the registry\",\"params\":{\"name\":\"The name to wrap, in DNS format\",\"resolver\":\"Resolver contract\",\"wrappedOwner\":\"Owner of the name in this contract\"}},\"wrapETH2LD(string,address,uint16,address)\":{\"details\":\"Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\",\"params\":{\"label\":\"Label as a string of the .eth domain to wrap\",\"ownerControlledFuses\":\"Initial owner-controlled fuses to set\",\"resolver\":\"Resolver contract address\",\"wrappedOwner\":\"Owner of the name in this contract\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"allFusesBurned(bytes32,uint32)\":{\"notice\":\"Checks all Fuses in the mask are burned for the node\"},\"approve(address,uint256)\":{\"notice\":\"Approves an address for a name\"},\"canExtendSubnames(bytes32,address)\":{\"notice\":\"Checks if owner/operator or approved by owner\"},\"canModifyName(bytes32,address)\":{\"notice\":\"Checks if owner or operator of the owner\"},\"extendExpiry(bytes32,bytes32,uint64)\":{\"notice\":\"Extends expiry for a name\"},\"getApproved(uint256)\":{\"notice\":\"Gets the owner of a name\"},\"getData(uint256)\":{\"notice\":\"Gets the data for a name\"},\"isWrapped(bytes32)\":{\"notice\":\"Checks if a name is wrapped\"},\"isWrapped(bytes32,bytes32)\":{\"notice\":\"Checks if a name is wrapped in a more gas efficient way\"},\"ownerOf(uint256)\":{\"notice\":\"Gets the owner of a name\"},\"recoverFunds(address,address,uint256)\":{\"notice\":\"Recover ERC20 tokens sent to the contract by mistake.\"},\"renew(uint256,uint256)\":{\"notice\":\"Renews a .eth second-level domain.\"},\"setChildFuses(bytes32,bytes32,uint32,uint64)\":{\"notice\":\"Sets fuses of a name that you own the parent of\"},\"setFuses(bytes32,uint16)\":{\"notice\":\"Sets fuses of a name\"},\"setMetadataService(address)\":{\"notice\":\"Set the metadata service. Only the owner can do this\"},\"setRecord(bytes32,address,address,uint64)\":{\"notice\":\"Sets records for the name in the ENS Registry\"},\"setResolver(bytes32,address)\":{\"notice\":\"Sets resolver contract in the registry\"},\"setSubnodeOwner(bytes32,string,address,uint32,uint64)\":{\"notice\":\"Sets the subdomain owner in the registry and then wraps the subdomain\"},\"setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)\":{\"notice\":\"Sets the subdomain owner in the registry with records and then wraps the subdomain\"},\"setTTL(bytes32,uint64)\":{\"notice\":\"Sets TTL in the registry\"},\"setUpgradeContract(address)\":{\"notice\":\"Set the address of the upgradeContract of the contract. only admin can do this\"},\"unwrap(bytes32,bytes32,address)\":{\"notice\":\"Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\"},\"unwrapETH2LD(bytes32,address,address)\":{\"notice\":\"Unwraps a .eth domain. e.g. vitalik.eth\"},\"upgrade(bytes,bytes)\":{\"notice\":\"Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\"},\"uri(uint256)\":{\"notice\":\"Get the metadata uri\"},\"wrap(bytes,address,address)\":{\"notice\":\"Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\"},\"wrapETH2LD(string,address,uint16,address)\":{\"notice\":\"Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/wrapper/NameWrapper.sol\":\"NameWrapper\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1300},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6392f2cfe3a5ee802227fe7a2dfd47096d881aec89bddd214b35c5b46d3cd941\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\ninterface IERC1155Receiver is IERC165 {\\n /**\\n * @dev Handles the receipt of a single ERC1155 token type. This function is\\n * called at the end of a `safeTransferFrom` after the balance has been updated.\\n *\\n * NOTE: To accept the transfer, this must return\\n * `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))`\\n * (i.e. 0xf23a6e61, or its own function selector).\\n *\\n * @param operator The address which initiated the transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param id The ID of the token being transferred\\n * @param value The amount of tokens being transferred\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155Received(\\n address operator,\\n address from,\\n uint256 id,\\n uint256 value,\\n bytes calldata data\\n ) external returns (bytes4);\\n\\n /**\\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\\n * is called at the end of a `safeBatchTransferFrom` after the balances have\\n * been updated.\\n *\\n * NOTE: To accept the transfer(s), this must return\\n * `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))`\\n * (i.e. 0xbc197c81, or its own function selector).\\n *\\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xeb373f1fdc7b755c6a750123a9b9e3a8a02c1470042fd6505d875000a80bde0b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC1155.sol\\\";\\n\\n/**\\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155MetadataURI is IERC1155 {\\n /**\\n * @dev Returns the URI for token type `id`.\\n *\\n * If the `\\\\{id\\\\}` substring is present in the URI, it must be replaced by\\n * clients with the actual token type ID.\\n */\\n function uri(uint256 id) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xa66d18b9a85458d28fc3304717964502ae36f7f8a2ff35bc83f6f85d74b03574\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xab28a56179c1db258c9bf5235b382698cb650debecb51b23d12be9e241374b68\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x9ac51351ff72d73083aed62b7cdad4c07e9d1eb68401d7fd8457bdd828f2c6fe\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseClaimer.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\n\\ncontract ReverseClaimer {\\n bytes32 constant ADDR_REVERSE_NODE =\\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n constructor(ENS ens, address claimant) {\\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\\n ens.owner(ADDR_REVERSE_NODE)\\n );\\n reverseRegistrar.claim(claimant);\\n }\\n}\\n\",\"keccak256\":\"0x78a28627241535b595f6fff476a1fa7acc90c80684fe7784734920fc8af6fc22\",\"license\":\"MIT\"},\"contracts/utils/ERC20Recoverable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\\n */\\n\\ncontract ERC20Recoverable is Ownable {\\n /**\\n @notice Recover ERC20 tokens sent to the contract by mistake.\\n @dev The contract is Ownable and only the owner can call the recover function.\\n @param _to The address to send the tokens to.\\n@param _token The address of the ERC20 token to recover\\n @param _amount The amount of tokens to recover.\\n */\\n function recoverFunds(\\n address _token,\\n address _to,\\n uint256 _amount\\n ) external onlyOwner {\\n IERC20(_token).transfer(_to, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x793a38091e1f81499a29ddba82c2b2f3cdd07071b81a832886e8e02a45ff352a\",\"license\":\"MIT\"},\"contracts/wrapper/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes32) {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n}\\n\",\"keccak256\":\"0xf862cd86d749158a554e3cb517efa9097331ec0cf7225117f21e96fb50c67edb\",\"license\":\"MIT\"},\"contracts/wrapper/Controllable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool active);\\n\\n function setController(address controller, bool active) public onlyOwner {\\n controllers[controller] = active;\\n emit ControllerChanged(controller, active);\\n }\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x9a9191656a82eda6763cda29ce893ddbfddb6c43559ff3b90c00a184e14e1fa1\",\"license\":\"MIT\"},\"contracts/wrapper/ERC1155Fuse.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\\n\\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\\n using Address for address;\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(\\n address indexed owner,\\n address indexed approved,\\n uint256 indexed tokenId\\n );\\n mapping(uint256 => uint256) public _tokens;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) internal _tokenApprovals;\\n\\n /**************************************************************************\\n * ERC721 methods\\n *************************************************************************/\\n\\n function ownerOf(uint256 id) public view virtual returns (address) {\\n (address owner, , ) = getData(id);\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual {\\n address owner = ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(\\n uint256 tokenId\\n ) public view virtual returns (address) {\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IERC1155).interfaceId ||\\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(\\n address account,\\n uint256 id\\n ) public view virtual override returns (uint256) {\\n require(\\n account != address(0),\\n \\\"ERC1155: balance query for the zero address\\\"\\n );\\n address owner = ownerOf(id);\\n if (owner == account) {\\n return 1;\\n }\\n return 0;\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOfBatch}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] memory accounts,\\n uint256[] memory ids\\n ) public view virtual override returns (uint256[] memory) {\\n require(\\n accounts.length == ids.length,\\n \\\"ERC1155: accounts and ids length mismatch\\\"\\n );\\n\\n uint256[] memory batchBalances = new uint256[](accounts.length);\\n\\n for (uint256 i = 0; i < accounts.length; ++i) {\\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\\n }\\n\\n return batchBalances;\\n }\\n\\n /**\\n * @dev See {IERC1155-setApprovalForAll}.\\n */\\n function setApprovalForAll(\\n address operator,\\n bool approved\\n ) public virtual override {\\n require(\\n msg.sender != operator,\\n \\\"ERC1155: setting approval status for self\\\"\\n );\\n\\n _operatorApprovals[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC1155-isApprovedForAll}.\\n */\\n function isApprovedForAll(\\n address account,\\n address operator\\n ) public view virtual override returns (bool) {\\n return _operatorApprovals[account][operator];\\n }\\n\\n /**\\n * @dev Returns the Name's owner address and fuses\\n */\\n function getData(\\n uint256 tokenId\\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\\n uint256 t = _tokens[tokenId];\\n owner = address(uint160(t));\\n expiry = uint64(t >> 192);\\n fuses = uint32(t >> 160);\\n }\\n\\n /**\\n * @dev See {IERC1155-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) public virtual override {\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n require(\\n from == msg.sender || isApprovedForAll(from, msg.sender),\\n \\\"ERC1155: caller is not owner nor approved\\\"\\n );\\n\\n _transfer(from, to, id, amount, data);\\n }\\n\\n /**\\n * @dev See {IERC1155-safeBatchTransferFrom}.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) public virtual override {\\n require(\\n ids.length == amounts.length,\\n \\\"ERC1155: ids and amounts length mismatch\\\"\\n );\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n require(\\n from == msg.sender || isApprovedForAll(from, msg.sender),\\n \\\"ERC1155: transfer caller is not owner nor approved\\\"\\n );\\n\\n for (uint256 i = 0; i < ids.length; ++i) {\\n uint256 id = ids[i];\\n uint256 amount = amounts[i];\\n\\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\\n\\n _beforeTransfer(id, fuses, expiry);\\n\\n require(\\n amount == 1 && oldOwner == from,\\n \\\"ERC1155: insufficient balance for transfer\\\"\\n );\\n _setData(id, to, fuses, expiry);\\n }\\n\\n emit TransferBatch(msg.sender, from, to, ids, amounts);\\n\\n _doSafeBatchTransferAcceptanceCheck(\\n msg.sender,\\n from,\\n to,\\n ids,\\n amounts,\\n data\\n );\\n }\\n\\n /**************************************************************************\\n * Internal/private methods\\n *************************************************************************/\\n\\n /**\\n * @dev Sets the Name's owner address and fuses\\n */\\n function _setData(\\n uint256 tokenId,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual {\\n _tokens[tokenId] =\\n uint256(uint160(owner)) |\\n (uint256(fuses) << 160) |\\n (uint256(expiry) << 192);\\n }\\n\\n function _beforeTransfer(\\n uint256 id,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual;\\n\\n function _clearOwnerAndFuses(\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual returns (address, uint32);\\n\\n function _mint(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual {\\n uint256 tokenId = uint256(node);\\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n\\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\\n oldFuses;\\n\\n if (oldExpiry > expiry) {\\n expiry = oldExpiry;\\n }\\n\\n if (oldExpiry >= block.timestamp) {\\n fuses = fuses | parentControlledFuses;\\n }\\n\\n require(oldOwner == address(0), \\\"ERC1155: mint of existing token\\\");\\n require(owner != address(0), \\\"ERC1155: mint to the zero address\\\");\\n require(\\n owner != address(this),\\n \\\"ERC1155: newOwner cannot be the NameWrapper contract\\\"\\n );\\n\\n _setData(tokenId, owner, fuses, expiry);\\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\\n _doSafeTransferAcceptanceCheck(\\n msg.sender,\\n address(0),\\n owner,\\n tokenId,\\n 1,\\n \\\"\\\"\\n );\\n }\\n\\n function _burn(uint256 tokenId) internal virtual {\\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\\n tokenId\\n );\\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n // Fuses and expiry are kept on burn\\n _setData(tokenId, address(0x0), fuses, expiry);\\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\\n }\\n\\n function _transfer(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) internal {\\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\\n\\n _beforeTransfer(id, fuses, expiry);\\n\\n require(\\n amount == 1 && oldOwner == from,\\n \\\"ERC1155: insufficient balance for transfer\\\"\\n );\\n\\n if (oldOwner == to) {\\n return;\\n }\\n\\n _setData(id, to, fuses, expiry);\\n\\n emit TransferSingle(msg.sender, from, to, id, amount);\\n\\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\\n }\\n\\n function _doSafeTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try\\n IERC1155Receiver(to).onERC1155Received(\\n operator,\\n from,\\n id,\\n amount,\\n data\\n )\\n returns (bytes4 response) {\\n if (\\n response != IERC1155Receiver(to).onERC1155Received.selector\\n ) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n function _doSafeBatchTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try\\n IERC1155Receiver(to).onERC1155BatchReceived(\\n operator,\\n from,\\n ids,\\n amounts,\\n data\\n )\\n returns (bytes4 response) {\\n if (\\n response !=\\n IERC1155Receiver(to).onERC1155BatchReceived.selector\\n ) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n /* ERC721 internal functions */\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ownerOf(tokenId), to, tokenId);\\n }\\n}\\n\",\"keccak256\":\"0xfbbd36e7f5df0fe7a8e9199783af99ac61ab24122e4a9fdb072bbd4cd676a88b\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_ETH = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x70310eb67146d7290731c31841399640ac3b6a949eadc6598bc150123d185c57\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"},\"contracts/wrapper/NameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \\\"./ERC1155Fuse.sol\\\";\\nimport {Controllable} from \\\"./Controllable.sol\\\";\\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \\\"./INameWrapper.sol\\\";\\nimport {INameWrapperUpgrade} from \\\"./INameWrapperUpgrade.sol\\\";\\nimport {IMetadataService} from \\\"./IMetadataService.sol\\\";\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\nimport {ReverseClaimer} from \\\"../reverseRegistrar/ReverseClaimer.sol\\\";\\nimport {IBaseRegistrar} from \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport {IERC721Receiver} from \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {BytesUtils} from \\\"./BytesUtils.sol\\\";\\nimport {ERC20Recoverable} from \\\"../utils/ERC20Recoverable.sol\\\";\\n\\nerror Unauthorised(bytes32 node, address addr);\\nerror IncompatibleParent();\\nerror IncorrectTokenType();\\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\\nerror LabelTooShort();\\nerror LabelTooLong(string label);\\nerror IncorrectTargetOwner(address owner);\\nerror CannotUpgrade();\\nerror OperationProhibited(bytes32 node);\\nerror NameIsNotWrapped();\\nerror NameIsStillExpired();\\n\\ncontract NameWrapper is\\n Ownable,\\n ERC1155Fuse,\\n INameWrapper,\\n Controllable,\\n IERC721Receiver,\\n ERC20Recoverable,\\n ReverseClaimer\\n{\\n using BytesUtils for bytes;\\n\\n ENS public immutable ens;\\n IBaseRegistrar public immutable registrar;\\n IMetadataService public metadataService;\\n mapping(bytes32 => bytes) public names;\\n string public constant name = \\\"NameWrapper\\\";\\n\\n uint64 private constant GRACE_PERIOD = 90 days;\\n bytes32 private constant ETH_NODE =\\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\\n bytes32 private constant ETH_LABELHASH =\\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\\n bytes32 private constant ROOT_NODE =\\n 0x0000000000000000000000000000000000000000000000000000000000000000;\\n\\n INameWrapperUpgrade public upgradeContract;\\n uint64 private constant MAX_EXPIRY = type(uint64).max;\\n\\n constructor(\\n ENS _ens,\\n IBaseRegistrar _registrar,\\n IMetadataService _metadataService\\n ) ReverseClaimer(_ens, msg.sender) {\\n ens = _ens;\\n registrar = _registrar;\\n metadataService = _metadataService;\\n\\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE and set expiry to max */\\n\\n _setData(\\n uint256(ETH_NODE),\\n address(0),\\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\\n MAX_EXPIRY\\n );\\n _setData(\\n uint256(ROOT_NODE),\\n address(0),\\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\\n MAX_EXPIRY\\n );\\n names[ROOT_NODE] = \\\"\\\\x00\\\";\\n names[ETH_NODE] = \\\"\\\\x03eth\\\\x00\\\";\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\\n return\\n interfaceId == type(INameWrapper).interfaceId ||\\n interfaceId == type(IERC721Receiver).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /* ERC1155 Fuse */\\n\\n /**\\n * @notice Gets the owner of a name\\n * @param id Label as a string of the .eth domain to wrap\\n * @return owner The owner of the name\\n */\\n\\n function ownerOf(\\n uint256 id\\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\\n return super.ownerOf(id);\\n }\\n\\n /**\\n * @notice Gets the owner of a name\\n * @param id Namehash of the name\\n * @return operator Approved operator of a name\\n */\\n\\n function getApproved(\\n uint256 id\\n )\\n public\\n view\\n override(ERC1155Fuse, INameWrapper)\\n returns (address operator)\\n {\\n address owner = ownerOf(id);\\n if (owner == address(0)) {\\n return address(0);\\n }\\n return super.getApproved(id);\\n }\\n\\n /**\\n * @notice Approves an address for a name\\n * @param to address to approve\\n * @param tokenId name to approve\\n */\\n\\n function approve(\\n address to,\\n uint256 tokenId\\n ) public override(ERC1155Fuse, INameWrapper) {\\n (, uint32 fuses, ) = getData(tokenId);\\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\\n revert OperationProhibited(bytes32(tokenId));\\n }\\n super.approve(to, tokenId);\\n }\\n\\n /**\\n * @notice Gets the data for a name\\n * @param id Namehash of the name\\n * @return owner Owner of the name\\n * @return fuses Fuses of the name\\n * @return expiry Expiry of the name\\n */\\n\\n function getData(\\n uint256 id\\n )\\n public\\n view\\n override(ERC1155Fuse, INameWrapper)\\n returns (address owner, uint32 fuses, uint64 expiry)\\n {\\n (owner, fuses, expiry) = super.getData(id);\\n\\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\\n }\\n\\n /* Metadata service */\\n\\n /**\\n * @notice Set the metadata service. Only the owner can do this\\n * @param _metadataService The new metadata service\\n */\\n\\n function setMetadataService(\\n IMetadataService _metadataService\\n ) public onlyOwner {\\n metadataService = _metadataService;\\n }\\n\\n /**\\n * @notice Get the metadata uri\\n * @param tokenId The id of the token\\n * @return string uri of the metadata service\\n */\\n\\n function uri(\\n uint256 tokenId\\n )\\n public\\n view\\n override(INameWrapper, IERC1155MetadataURI)\\n returns (string memory)\\n {\\n return metadataService.uri(tokenId);\\n }\\n\\n /**\\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\\n * to make the contract not upgradable.\\n * @param _upgradeAddress address of an upgraded contract\\n */\\n\\n function setUpgradeContract(\\n INameWrapperUpgrade _upgradeAddress\\n ) public onlyOwner {\\n if (address(upgradeContract) != address(0)) {\\n registrar.setApprovalForAll(address(upgradeContract), false);\\n ens.setApprovalForAll(address(upgradeContract), false);\\n }\\n\\n upgradeContract = _upgradeAddress;\\n\\n if (address(upgradeContract) != address(0)) {\\n registrar.setApprovalForAll(address(upgradeContract), true);\\n ens.setApprovalForAll(address(upgradeContract), true);\\n }\\n }\\n\\n /**\\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\\n * @param node namehash of the name to check\\n */\\n\\n modifier onlyTokenOwner(bytes32 node) {\\n if (!canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n _;\\n }\\n\\n /**\\n * @notice Checks if owner or operator of the owner\\n * @param node namehash of the name to check\\n * @param addr which address to check permissions for\\n * @return whether or not is owner or operator\\n */\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) public view returns (bool) {\\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\\n return\\n (owner == addr || isApprovedForAll(owner, addr)) &&\\n !_isETH2LDInGracePeriod(fuses, expiry);\\n }\\n\\n /**\\n * @notice Checks if owner/operator or approved by owner\\n * @param node namehash of the name to check\\n * @param addr which address to check permissions for\\n * @return whether or not is owner/operator or approved\\n */\\n\\n function canExtendSubnames(\\n bytes32 node,\\n address addr\\n ) public view returns (bool) {\\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\\n return\\n (owner == addr ||\\n isApprovedForAll(owner, addr) ||\\n getApproved(uint256(node)) == addr) &&\\n !_isETH2LDInGracePeriod(fuses, expiry);\\n }\\n\\n /**\\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\\n * @param label Label as a string of the .eth domain to wrap\\n * @param wrappedOwner Owner of the name in this contract\\n * @param ownerControlledFuses Initial owner-controlled fuses to set\\n * @param resolver Resolver contract address\\n */\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) public returns (uint64 expiry) {\\n uint256 tokenId = uint256(keccak256(bytes(label)));\\n address registrant = registrar.ownerOf(tokenId);\\n if (\\n registrant != msg.sender &&\\n !registrar.isApprovedForAll(registrant, msg.sender)\\n ) {\\n revert Unauthorised(\\n _makeNode(ETH_NODE, bytes32(tokenId)),\\n msg.sender\\n );\\n }\\n\\n // transfer the token from the user to this contract\\n registrar.transferFrom(registrant, address(this), tokenId);\\n\\n // transfer the ens record back to the new owner (this contract)\\n registrar.reclaim(tokenId, address(this));\\n\\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\\n\\n _wrapETH2LD(\\n label,\\n wrappedOwner,\\n ownerControlledFuses,\\n expiry,\\n resolver\\n );\\n }\\n\\n /**\\n * @dev Registers a new .eth second-level domain and wraps it.\\n * Only callable by authorised controllers.\\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\\n * @param wrappedOwner The owner of the wrapped name.\\n * @param duration The duration, in seconds, to register the name for.\\n * @param resolver The resolver address to set on the ENS registry (optional).\\n * @param ownerControlledFuses Initial owner-controlled fuses to set\\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\\n */\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external onlyController returns (uint256 registrarExpiry) {\\n uint256 tokenId = uint256(keccak256(bytes(label)));\\n registrarExpiry = registrar.register(tokenId, address(this), duration);\\n _wrapETH2LD(\\n label,\\n wrappedOwner,\\n ownerControlledFuses,\\n uint64(registrarExpiry) + GRACE_PERIOD,\\n resolver\\n );\\n }\\n\\n /**\\n * @notice Renews a .eth second-level domain.\\n * @dev Only callable by authorised controllers.\\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\\n * @param duration The number of seconds to renew the name for.\\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\\n */\\n\\n function renew(\\n uint256 tokenId,\\n uint256 duration\\n ) external onlyController returns (uint256 expires) {\\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\\n\\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\\n\\n // Do not set anything in wrapper if name is not wrapped\\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\\n if (\\n registrarOwner != address(this) ||\\n ens.owner(node) != address(this)\\n ) {\\n return registrarExpiry;\\n }\\n } catch {\\n return registrarExpiry;\\n }\\n\\n // Set expiry in Wrapper\\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\\n\\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\\n _setData(node, owner, fuses, expiry);\\n\\n return registrarExpiry;\\n }\\n\\n /**\\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\\n * @param name The name to wrap, in DNS format\\n * @param wrappedOwner Owner of the name in this contract\\n * @param resolver Resolver contract\\n */\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) public {\\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\\n bytes32 parentNode = name.namehash(offset);\\n bytes32 node = _makeNode(parentNode, labelhash);\\n\\n names[node] = name;\\n\\n if (parentNode == ETH_NODE) {\\n revert IncompatibleParent();\\n }\\n\\n address owner = ens.owner(node);\\n\\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n if (resolver != address(0)) {\\n ens.setResolver(node, resolver);\\n }\\n\\n ens.setOwner(node, address(this));\\n\\n _wrap(node, name, wrappedOwner, 0, 0);\\n }\\n\\n /**\\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\\n * @param labelhash Labelhash of the .eth domain\\n * @param registrant Sets the owner in the .eth registrar to this address\\n * @param controller Sets the owner in the registry to this address\\n */\\n\\n function unwrapETH2LD(\\n bytes32 labelhash,\\n address registrant,\\n address controller\\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\\n if (registrant == address(this)) {\\n revert IncorrectTargetOwner(registrant);\\n }\\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\\n registrar.safeTransferFrom(\\n address(this),\\n registrant,\\n uint256(labelhash)\\n );\\n }\\n\\n /**\\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\\n * @param controller Sets the owner in the registry to this address\\n */\\n\\n function unwrap(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n address controller\\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\\n if (parentNode == ETH_NODE) {\\n revert IncompatibleParent();\\n }\\n if (controller == address(0x0) || controller == address(this)) {\\n revert IncorrectTargetOwner(controller);\\n }\\n _unwrap(_makeNode(parentNode, labelhash), controller);\\n }\\n\\n /**\\n * @notice Sets fuses of a name\\n * @param node Namehash of the name\\n * @param ownerControlledFuses Owner-controlled fuses to burn\\n * @return Old fuses\\n */\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n )\\n public\\n onlyTokenOwner(node)\\n operationAllowed(node, CANNOT_BURN_FUSES)\\n returns (uint32)\\n {\\n // owner protected by onlyTokenOwner\\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\\n uint256(node)\\n );\\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\\n return oldFuses;\\n }\\n\\n /**\\n * @notice Extends expiry for a name\\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\\n * @param expiry When the name will expire in seconds since the Unix epoch\\n * @return New expiry\\n */\\n\\n function extendExpiry(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint64 expiry\\n ) public returns (uint64) {\\n bytes32 node = _makeNode(parentNode, labelhash);\\n\\n if (!_isWrapped(node)) {\\n revert NameIsNotWrapped();\\n }\\n\\n // this flag is used later, when checking fuses\\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\\n // only allow the owner of the name or owner of the parent name\\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n\\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\\n revert OperationProhibited(node);\\n }\\n\\n // Max expiry is set to the expiry of the parent\\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\\n\\n _setData(node, owner, fuses, expiry);\\n emit ExpiryExtended(node, expiry);\\n return expiry;\\n }\\n\\n /**\\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\\n * @dev Can be called by the owner or an authorised caller\\n * @param name The name to upgrade, in DNS format\\n * @param extraData Extra data to pass to the upgrade contract\\n */\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) public {\\n bytes32 node = name.namehash(0);\\n\\n if (address(upgradeContract) == address(0)) {\\n revert CannotUpgrade();\\n }\\n\\n if (!canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\\n uint256(node)\\n );\\n\\n address approved = getApproved(uint256(node));\\n\\n _burn(uint256(node));\\n\\n upgradeContract.wrapFromUpgrade(\\n name,\\n currentOwner,\\n fuses,\\n expiry,\\n approved,\\n extraData\\n );\\n }\\n\\n /** \\n /* @notice Sets fuses of a name that you own the parent of\\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\\n * @param fuses Fuses to burn\\n * @param expiry When the name will expire in seconds since the Unix epoch\\n */\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) public {\\n bytes32 node = _makeNode(parentNode, labelhash);\\n _checkFusesAreSettable(node, fuses);\\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n if (owner == address(0) || ens.owner(node) != address(this)) {\\n revert NameIsNotWrapped();\\n }\\n // max expiry is set to the expiry of the parent\\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\\n if (parentNode == ROOT_NODE) {\\n if (!canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n } else {\\n if (!canModifyName(parentNode, msg.sender)) {\\n revert Unauthorised(parentNode, msg.sender);\\n }\\n }\\n\\n _checkParentFuses(node, fuses, parentFuses);\\n\\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\\n\\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\\n if (\\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\\n oldFuses | fuses != oldFuses\\n ) {\\n revert OperationProhibited(node);\\n }\\n fuses |= oldFuses;\\n _setFuses(node, owner, fuses, oldExpiry, expiry);\\n }\\n\\n /**\\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\\n * @param parentNode Parent namehash of the subdomain\\n * @param label Label of the subdomain as a string\\n * @param owner New owner in the wrapper\\n * @param fuses Initial fuses for the wrapped subdomain\\n * @param expiry When the name will expire in seconds since the Unix epoch\\n * @return node Namehash of the subdomain\\n */\\n\\n function setSubnodeOwner(\\n bytes32 parentNode,\\n string calldata label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\\n bytes32 labelhash = keccak256(bytes(label));\\n node = _makeNode(parentNode, labelhash);\\n _checkCanCallSetSubnodeOwner(parentNode, node);\\n _checkFusesAreSettable(node, fuses);\\n bytes memory name = _saveLabel(parentNode, node, label);\\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\\n\\n if (!_isWrapped(node)) {\\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\\n _wrap(node, name, owner, fuses, expiry);\\n } else {\\n _updateName(parentNode, node, label, owner, fuses, expiry);\\n }\\n }\\n\\n /**\\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\\n * @param parentNode parent namehash of the subdomain\\n * @param label label of the subdomain as a string\\n * @param owner new owner in the wrapper\\n * @param resolver resolver contract in the registry\\n * @param ttl ttl in the registry\\n * @param fuses initial fuses for the wrapped subdomain\\n * @param expiry When the name will expire in seconds since the Unix epoch\\n * @return node Namehash of the subdomain\\n */\\n\\n function setSubnodeRecord(\\n bytes32 parentNode,\\n string memory label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\\n bytes32 labelhash = keccak256(bytes(label));\\n node = _makeNode(parentNode, labelhash);\\n _checkCanCallSetSubnodeOwner(parentNode, node);\\n _checkFusesAreSettable(node, fuses);\\n _saveLabel(parentNode, node, label);\\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\\n if (!_isWrapped(node)) {\\n ens.setSubnodeRecord(\\n parentNode,\\n labelhash,\\n address(this),\\n resolver,\\n ttl\\n );\\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\\n } else {\\n ens.setSubnodeRecord(\\n parentNode,\\n labelhash,\\n address(this),\\n resolver,\\n ttl\\n );\\n _updateName(parentNode, node, label, owner, fuses, expiry);\\n }\\n }\\n\\n /**\\n * @notice Sets records for the name in the ENS Registry\\n * @param node Namehash of the name to set a record for\\n * @param owner New owner in the registry\\n * @param resolver Resolver contract\\n * @param ttl Time to live in the registry\\n */\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n )\\n public\\n onlyTokenOwner(node)\\n operationAllowed(\\n node,\\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\\n )\\n {\\n ens.setRecord(node, address(this), resolver, ttl);\\n if (owner == address(0)) {\\n (, uint32 fuses, ) = getData(uint256(node));\\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\\n revert IncorrectTargetOwner(owner);\\n }\\n _unwrap(node, address(0));\\n } else {\\n address oldOwner = ownerOf(uint256(node));\\n _transfer(oldOwner, owner, uint256(node), 1, \\\"\\\");\\n }\\n }\\n\\n /**\\n * @notice Sets resolver contract in the registry\\n * @param node namehash of the name\\n * @param resolver the resolver contract\\n */\\n\\n function setResolver(\\n bytes32 node,\\n address resolver\\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\\n ens.setResolver(node, resolver);\\n }\\n\\n /**\\n * @notice Sets TTL in the registry\\n * @param node Namehash of the name\\n * @param ttl TTL in the registry\\n */\\n\\n function setTTL(\\n bytes32 node,\\n uint64 ttl\\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\\n ens.setTTL(node, ttl);\\n }\\n\\n /**\\n * @dev Allows an operation only if none of the specified fuses are burned.\\n * @param node The namehash of the name to check fuses on.\\n * @param fuseMask A bitmask of fuses that must not be burned.\\n */\\n\\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\\n (, uint32 fuses, ) = getData(uint256(node));\\n if (fuses & fuseMask != 0) {\\n revert OperationProhibited(node);\\n }\\n _;\\n }\\n\\n /**\\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\\n * replacing a subdomain. If either conditions are true, then it is possible to call\\n * setSubnodeOwner\\n * @param parentNode Namehash of the parent name to check\\n * @param subnode Namehash of the subname to check\\n */\\n\\n function _checkCanCallSetSubnodeOwner(\\n bytes32 parentNode,\\n bytes32 subnode\\n ) internal view {\\n (\\n address subnodeOwner,\\n uint32 subnodeFuses,\\n uint64 subnodeExpiry\\n ) = getData(uint256(subnode));\\n\\n // check if the registry owner is 0 and expired\\n // check if the wrapper owner is 0 and expired\\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\\n bool expired = subnodeExpiry < block.timestamp;\\n if (\\n expired &&\\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\\n (subnodeOwner == address(0) ||\\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\\n ens.owner(subnode) == address(0))\\n ) {\\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\\n revert OperationProhibited(subnode);\\n }\\n } else {\\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\\n revert OperationProhibited(subnode);\\n }\\n }\\n }\\n\\n /**\\n * @notice Checks all Fuses in the mask are burned for the node\\n * @param node Namehash of the name\\n * @param fuseMask The fuses you want to check\\n * @return Boolean of whether or not all the selected fuses are burned\\n */\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) public view returns (bool) {\\n (, uint32 fuses, ) = getData(uint256(node));\\n return fuses & fuseMask == fuseMask;\\n }\\n\\n /**\\n * @notice Checks if a name is wrapped\\n * @param node Namehash of the name\\n * @return Boolean of whether or not the name is wrapped\\n */\\n\\n function isWrapped(bytes32 node) public view returns (bool) {\\n bytes memory name = names[node];\\n if (name.length == 0) {\\n return false;\\n }\\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\\n bytes32 parentNode = name.namehash(offset);\\n return isWrapped(parentNode, labelhash);\\n }\\n\\n /**\\n * @notice Checks if a name is wrapped in a more gas efficient way\\n * @param parentNode Namehash of the name\\n * @param labelhash Namehash of the name\\n * @return Boolean of whether or not the name is wrapped\\n */\\n\\n function isWrapped(\\n bytes32 parentNode,\\n bytes32 labelhash\\n ) public view returns (bool) {\\n bytes32 node = _makeNode(parentNode, labelhash);\\n bool wrapped = _isWrapped(node);\\n if (parentNode != ETH_NODE) {\\n return wrapped;\\n }\\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\\n return owner == address(this);\\n } catch {\\n return false;\\n }\\n }\\n\\n function onERC721Received(\\n address to,\\n address,\\n uint256 tokenId,\\n bytes calldata data\\n ) public returns (bytes4) {\\n //check if it's the eth registrar ERC721\\n if (msg.sender != address(registrar)) {\\n revert IncorrectTokenType();\\n }\\n\\n (\\n string memory label,\\n address owner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) = abi.decode(data, (string, address, uint16, address));\\n\\n bytes32 labelhash = bytes32(tokenId);\\n bytes32 labelhashFromData = keccak256(bytes(label));\\n\\n if (labelhashFromData != labelhash) {\\n revert LabelMismatch(labelhashFromData, labelhash);\\n }\\n\\n // transfer the ens record back to the new owner (this contract)\\n registrar.reclaim(uint256(labelhash), address(this));\\n\\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\\n\\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\\n\\n return IERC721Receiver(to).onERC721Received.selector;\\n }\\n\\n /***** Internal functions */\\n\\n function _beforeTransfer(\\n uint256 id,\\n uint32 fuses,\\n uint64 expiry\\n ) internal override {\\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\\n expiry -= GRACE_PERIOD;\\n }\\n\\n if (expiry < block.timestamp) {\\n // Transferable if the name was not emancipated\\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\\n revert(\\\"ERC1155: insufficient balance for transfer\\\");\\n }\\n } else {\\n // Transferable if CANNOT_TRANSFER is unburned\\n if (fuses & CANNOT_TRANSFER != 0) {\\n revert OperationProhibited(bytes32(id));\\n }\\n }\\n\\n // delete token approval if CANNOT_APPROVE has not been burnt\\n if (fuses & CANNOT_APPROVE == 0) {\\n delete _tokenApprovals[id];\\n }\\n }\\n\\n function _clearOwnerAndFuses(\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal view override returns (address, uint32) {\\n if (expiry < block.timestamp) {\\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\\n owner = address(0);\\n }\\n fuses = 0;\\n }\\n\\n return (owner, fuses);\\n }\\n\\n function _makeNode(\\n bytes32 node,\\n bytes32 labelhash\\n ) private pure returns (bytes32) {\\n return keccak256(abi.encodePacked(node, labelhash));\\n }\\n\\n function _addLabel(\\n string memory label,\\n bytes memory name\\n ) internal pure returns (bytes memory ret) {\\n if (bytes(label).length < 1) {\\n revert LabelTooShort();\\n }\\n if (bytes(label).length > 255) {\\n revert LabelTooLong(label);\\n }\\n return abi.encodePacked(uint8(bytes(label).length), label, name);\\n }\\n\\n function _mint(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal override {\\n _canFusesBeBurned(node, fuses);\\n (address oldOwner, , ) = super.getData(uint256(node));\\n if (oldOwner != address(0)) {\\n // burn and unwrap old token of old owner\\n _burn(uint256(node));\\n emit NameUnwrapped(node, address(0));\\n }\\n super._mint(node, owner, fuses, expiry);\\n }\\n\\n function _wrap(\\n bytes32 node,\\n bytes memory name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n _mint(node, wrappedOwner, fuses, expiry);\\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\\n }\\n\\n function _storeNameAndWrap(\\n bytes32 parentNode,\\n bytes32 node,\\n string memory label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n bytes memory name = _addLabel(label, names[parentNode]);\\n _wrap(node, name, owner, fuses, expiry);\\n }\\n\\n function _saveLabel(\\n bytes32 parentNode,\\n bytes32 node,\\n string memory label\\n ) internal returns (bytes memory) {\\n bytes memory name = _addLabel(label, names[parentNode]);\\n names[node] = name;\\n return name;\\n }\\n\\n function _updateName(\\n bytes32 parentNode,\\n bytes32 node,\\n string memory label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n bytes memory name = _addLabel(label, names[parentNode]);\\n if (names[node].length == 0) {\\n names[node] = name;\\n }\\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\\n if (owner == address(0)) {\\n _unwrap(node, address(0));\\n } else {\\n _transfer(oldOwner, owner, uint256(node), 1, \\\"\\\");\\n }\\n }\\n\\n // wrapper function for stack limit\\n function _checkParentFusesAndExpiry(\\n bytes32 parentNode,\\n bytes32 node,\\n uint32 fuses,\\n uint64 expiry\\n ) internal view returns (uint64) {\\n (, , uint64 oldExpiry) = getData(uint256(node));\\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\\n _checkParentFuses(node, fuses, parentFuses);\\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\\n }\\n\\n function _checkParentFuses(\\n bytes32 node,\\n uint32 fuses,\\n uint32 parentFuses\\n ) internal pure {\\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\\n 0;\\n\\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\\n\\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\\n revert OperationProhibited(node);\\n }\\n }\\n\\n function _normaliseExpiry(\\n uint64 expiry,\\n uint64 oldExpiry,\\n uint64 maxExpiry\\n ) private pure returns (uint64) {\\n // Expiry cannot be more than maximum allowed\\n // .eth names will check registrar, non .eth check parent\\n if (expiry > maxExpiry) {\\n expiry = maxExpiry;\\n }\\n // Expiry cannot be less than old expiry\\n if (expiry < oldExpiry) {\\n expiry = oldExpiry;\\n }\\n\\n return expiry;\\n }\\n\\n function _wrapETH2LD(\\n string memory label,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address resolver\\n ) private {\\n bytes32 labelhash = keccak256(bytes(label));\\n bytes32 node = _makeNode(ETH_NODE, labelhash);\\n // hardcode dns-encoded eth string for gas savings\\n bytes memory name = _addLabel(label, \\\"\\\\x03eth\\\\x00\\\");\\n names[node] = name;\\n\\n _wrap(\\n node,\\n name,\\n wrappedOwner,\\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\\n expiry\\n );\\n\\n if (resolver != address(0)) {\\n ens.setResolver(node, resolver);\\n }\\n }\\n\\n function _unwrap(bytes32 node, address owner) private {\\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\\n revert OperationProhibited(node);\\n }\\n\\n // Burn token and fuse data\\n _burn(uint256(node));\\n ens.setOwner(node, owner);\\n\\n emit NameUnwrapped(node, owner);\\n }\\n\\n function _setFuses(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 oldExpiry,\\n uint64 expiry\\n ) internal {\\n _setData(node, owner, fuses, expiry);\\n emit FusesSet(node, fuses);\\n if (expiry > oldExpiry) {\\n emit ExpiryExtended(node, expiry);\\n }\\n }\\n\\n function _setData(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n _canFusesBeBurned(node, fuses);\\n super._setData(uint256(node), owner, fuses, expiry);\\n }\\n\\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\\n if (\\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\\n ) {\\n revert OperationProhibited(node);\\n }\\n }\\n\\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\\n // Cannot directly burn other non-user settable fuses\\n revert OperationProhibited(node);\\n }\\n }\\n\\n function _isWrapped(bytes32 node) internal view returns (bool) {\\n return\\n ownerOf(uint256(node)) != address(0) &&\\n ens.owner(node) == address(this);\\n }\\n\\n function _isETH2LDInGracePeriod(\\n uint32 fuses,\\n uint64 expiry\\n ) internal view returns (bool) {\\n return\\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\\n expiry - GRACE_PERIOD < block.timestamp;\\n }\\n}\\n\",\"keccak256\":\"0x91ee0a58d8ecf132c4e7fba9a25bbf45bbfc3634f2024b30a6a2eea4a151ed0c\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c06040523480156200001157600080fd5b5060405162006550380380620065508339810160408190526200003491620002f8565b823362000041816200028f565b6040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e260048201526000906001600160a01b038416906302571be390602401602060405180830381865afa158015620000a9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000cf91906200034c565b604051630f41a04d60e11b81526001600160a01b03848116600483015291925090821690631e83409a906024016020604051808303816000875af11580156200011c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000142919062000373565b505050506001600160a01b0383811660805282811660a052600580546001600160a01b031916918316919091179055600163fffeffff60a01b03197fafa26c20e8b3d9a2853d642cfe1021dae26242ffedfac91c97aab212c1a4b93b8190557fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb4955604080518082019091526001815260006020808301829052908052600690527f54cdd369e4e8a8515e52ca72ec816c2101831ad1f18bf44102ed171459c9b4f89062000210908262000432565b506040805180820190915260058152626cae8d60e31b6020808301919091527f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae600052600690527ffb9e8e321b8a5ec48f12a7b41f22c6e595d761285c9eb19d8dda7c99edf1b54f9062000285908262000432565b50505050620004fe565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114620002f557600080fd5b50565b6000806000606084860312156200030e57600080fd5b83516200031b81620002df565b60208501519093506200032e81620002df565b60408501519092506200034181620002df565b809150509250925092565b6000602082840312156200035f57600080fd5b81516200036c81620002df565b9392505050565b6000602082840312156200038657600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620003b857607f821691505b602082108103620003d957634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200042d57600081815260208120601f850160051c81016020861015620004085750805b601f850160051c820191505b81811015620004295782815560010162000414565b5050505b505050565b81516001600160401b038111156200044e576200044e6200038d565b62000466816200045f8454620003a3565b84620003df565b602080601f8311600181146200049e5760008415620004855750858301515b600019600386901b1c1916600185901b17855562000429565b600085815260208120601f198616915b82811015620004cf57888601518255948401946001909101908401620004ae565b5085821015620004ee5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a051615f456200060b6000396000818161050601528181610c1501528181610cef01528181610d7901528181611c7301528181611d0901528181611db701528181611ed901528181611f4f01528181611fcf015281816122510152818161238d015281816124cc015281816126b1015281816127370152612f6c01526000818161055301528181610b9b01528181610ee4015281816110980152818161114a015281816115620152818161241201528181612551015281816127e2015281816129d901528181612ce701528181613197015281816132450152818161330e01528181613387015281816139e401528181613aff01528181613d6701526143c10152615f456000f3fe608060405234801561001057600080fd5b506004361061031f5760003560e01c80636352211e116101a7578063c93ab3fd116100ee578063e985e9c511610097578063f242432a11610071578063f242432a146107d7578063f2fde38b146107ea578063fd0cd0d9146107fd57600080fd5b8063e985e9c514610768578063eb8ae530146107a4578063ed70554d146107b757600080fd5b8063d9a50c12116100c8578063d9a50c121461071f578063da8c229e14610732578063e0dba60f1461075557600080fd5b8063c93ab3fd146106e6578063cf408823146106f9578063d8c9921a1461070c57600080fd5b8063a22cb46511610150578063b6bcad261161012a578063b6bcad26146106ad578063c475abff146106c0578063c658e086146106d357600080fd5b8063a22cb46514610674578063a401498214610687578063adf4960a1461069a57600080fd5b80638b4dfa75116101815780638b4dfa751461063d5780638cf8b41e146106505780638da5cb5b1461066357600080fd5b80636352211e146105f65780636e5d6ad214610609578063715018a61461063557600080fd5b80631f4e15041161026b5780633f15457f116102145780634e1273f4116101ee5780634e1273f4146105b057806353095467146105d05780635d3590d5146105e357600080fd5b80633f15457f1461054e578063402906fc1461057557806341415eab1461059d57600080fd5b80632b20e397116102455780632b20e397146105015780632eb2c2d61461052857806333c69ea91461053b57600080fd5b80631f4e1504146104c857806320c38e2b146104db57806324c1af44146104ee57600080fd5b80630e4cd725116102cd578063150b7a02116102a7578063150b7a02146104765780631534e177146104a25780631896f70a146104b557600080fd5b80630e4cd7251461043d5780630e89341c1461045057806314ab90381461046357600080fd5b806306fdde03116102fe57806306fdde03146103b4578063081812fc146103fd578063095ea7b31461042857600080fd5b8062fdd58e146103245780630178fe3f1461034a57806301ffc9a714610391575b600080fd5b610337610332366004614d74565b610810565b6040519081526020015b60405180910390f35b61035d610358366004614da0565b6108cf565b604080516001600160a01b03909416845263ffffffff909216602084015267ffffffffffffffff1690820152606001610341565b6103a461039f366004614dcf565b6108ff565b6040519015158152602001610341565b6103f06040518060400160405280600b81526020017f4e616d655772617070657200000000000000000000000000000000000000000081525081565b6040516103419190614e3c565b61041061040b366004614da0565b610958565b6040516001600160a01b039091168152602001610341565b61043b610436366004614d74565b61099d565b005b6103a461044b366004614e4f565b6109e3565b6103f061045e366004614da0565b610a7d565b61043b610471366004614e9c565b610aef565b610489610484366004614f11565b610c08565b6040516001600160e01b03199091168152602001610341565b61043b6104b0366004614f84565b610e1a565b61043b6104c3366004614e4f565b610e51565b600754610410906001600160a01b031681565b6103f06104e9366004614da0565b610f13565b6103376104fc36600461507c565b610fad565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b61043b6105363660046151a4565b6111c1565b61043b610549366004615252565b6114eb565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b6105886105833660046152aa565b6116e0565b60405163ffffffff9091168152602001610341565b6103a46105ab366004614e4f565b611782565b6105c36105be3660046152cd565b6117df565b60405161034191906153cb565b600554610410906001600160a01b031681565b61043b6105f13660046153de565b61191d565b610410610604366004614da0565b6119b7565b61061c61061736600461541f565b6119c2565b60405167ffffffffffffffff9091168152602001610341565b61043b611b17565b61043b61064b366004615454565b611b2b565b61061c61065e366004615496565b611cd5565b6000546001600160a01b0316610410565b61043b61068236600461551f565b6120a1565b61033761069536600461554d565b61218b565b6103a46106a83660046155ce565b612326565b61043b6106bb366004614f84565b61234b565b6103376106ce3660046155f1565b6125b0565b6103376106e1366004615613565b6128a7565b61043b6106f4366004615686565b612ab4565b61043b6107073660046156f2565b612c25565b61043b61071a36600461572a565b612dde565b6103a461072d3660046155f1565b612eee565b6103a4610740366004614f84565b60046020526000908152604090205460ff1681565b61043b61076336600461551f565b612ffb565b6103a4610776366004615758565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b61043b6107b2366004615786565b613063565b6103376107c5366004614da0565b60016020526000908152604090205481565b61043b6107e53660046157ee565b61342e565b61043b6107f8366004614f84565b61354b565b6103a461080b366004614da0565b6135d8565b60006001600160a01b0383166108935760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084015b60405180910390fd5b600061089e836119b7565b9050836001600160a01b0316816001600160a01b0316036108c35760019150506108c9565b60009150505b92915050565b60008181526001602052604090205460a081901c60c082901c6108f38383836136b0565b90959094509092509050565b60006001600160e01b031982167fd82c42d800000000000000000000000000000000000000000000000000000000148061094957506001600160e01b03198216630a85bd0160e11b145b806108c957506108c9826136e7565b600080610964836119b7565b90506001600160a01b03811661097d5750600092915050565b6000838152600360205260409020546001600160a01b03165b9392505050565b60006109a8826108cf565b50915050603f1960408216016109d45760405163a2a7201360e01b81526004810183905260240161088a565b6109de8383613769565b505050565b60008080806109f1866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a3c57506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff165b80610a6057506001600160a01b038516610a5587610958565b6001600160a01b0316145b8015610a735750610a7182826138b3565b155b9695505050505050565b6005546040516303a24d0760e21b8152600481018390526060916001600160a01b031690630e89341c90602401600060405180830381865afa158015610ac7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108c99190810190615857565b81610afa8133611782565b610b205760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260106000610b2e836108cf565b5091505063ffffffff8282161615610b5c5760405163a2a7201360e01b81526004810184905260240161088a565b6040517f14ab90380000000000000000000000000000000000000000000000000000000081526004810187905267ffffffffffffffff861660248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906314ab9038906044015b600060405180830381600087803b158015610be857600080fd5b505af1158015610bfc573d6000803e3d6000fd5b50505050505050505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610c6c576040517f1931a53800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080610c7d868801886158cf565b83516020850120939750919550935091508890808214610cd3576040517fc65c3ccc000000000000000000000000000000000000000000000000000000008152600481018290526024810183905260440161088a565b604051630a3b53db60e21b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906328ed4f6c90604401600060405180830381600087803b158015610d3b57600080fd5b505af1158015610d4f573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018d9052600092506276a70091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d6e4fa8690602401602060405180830381865afa158015610dc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de49190615937565b610dee9190615966565b9050610e0187878761ffff1684886138e4565b50630a85bd0160e11b9c9b505050505050505050505050565b610e22613a4a565b6005805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b81610e5c8133611782565b610e825760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260086000610e90836108cf565b5091505063ffffffff8282161615610ebe5760405163a2a7201360e01b81526004810184905260240161088a565b604051630c4b7b8560e11b8152600481018790526001600160a01b0386811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401610bce565b60066020526000908152604090208054610f2c9061598e565b80601f0160208091040260200160405190810160405280929190818152602001828054610f589061598e565b8015610fa55780601f10610f7a57610100808354040283529160200191610fa5565b820191906000526020600020905b815481529060010190602001808311610f8857829003601f168201915b505050505081565b600087610fba8133611782565b610fe05760405163168ab55d60e31b81526004810182905233602482015260440161088a565b875160208901206110188a82604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506110248a84613aa4565b61102e8386613be3565b6110398a848b613c16565b506110468a848787613ce3565b935061105183613d29565b611107576040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156110dc57600080fd5b505af11580156110f0573d6000803e3d6000fd5b505050506111028a848b8b8989613de2565b6111b4565b6040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561118e57600080fd5b505af11580156111a2573d6000803e3d6000fd5b505050506111b48a848b8b8989613e19565b5050979650505050505050565b81518351146112385760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060448201527f6d69736d61746368000000000000000000000000000000000000000000000000606482015260840161088a565b6001600160a01b03841661129c5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b0385163314806112d657506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b6113485760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000606482015260840161088a565b60005b835181101561147e576000848281518110611368576113686159c8565b602002602001015190506000848381518110611386576113866159c8565b60200260200101519050600080600061139e856108cf565b9250925092506113af858383613edd565b8360011480156113d057508a6001600160a01b0316836001600160a01b0316145b61142f5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b60008581526001602052604090206001600160a01b038b1663ffffffff60a01b60a085901b16176001600160c01b031960c084901b16179055505050505080611477906159de565b905061134b565b50836001600160a01b0316856001600160a01b0316336001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516114ce9291906159f7565b60405180910390a46114e4338686868686613fd7565b5050505050565b6040805160208082018790528183018690528251808303840181526060909201909252805191012061151d8184613be3565b6000808061152a846108cf565b919450925090506001600160a01b03831615806115d957506040516302571be360e01b81526004810185905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa1580156115a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115cd9190615a25565b6001600160a01b031614155b156115f757604051635374b59960e01b815260040160405180910390fd5b6000806116038a6108cf565b90935091508a9050611644576116198633611782565b61163f5760405163168ab55d60e31b81526004810187905233602482015260440161088a565b611674565b61164e8a33611782565b6116745760405163168ab55d60e31b8152600481018b905233602482015260440161088a565b61167f86898461417c565b61168a8784836141b7565b9650620100008416158015906116ae57508363ffffffff1688851763ffffffff1614155b156116cf5760405163a2a7201360e01b81526004810187905260240161088a565b96831796610bfc86868a868b614201565b6000826116ed8133611782565b6117135760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8360026000611721836108cf565b5091505063ffffffff828216161561174f5760405163a2a7201360e01b81526004810184905260240161088a565b6000808061175c8a6108cf565b9250925092506117758a84848c61ffff16178485614201565b5098975050505050505050565b6000808080611790866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a6057506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff16610a60565b606081518351146118585760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d617463680000000000000000000000000000000000000000000000606482015260840161088a565b6000835167ffffffffffffffff81111561187457611874614fa1565b60405190808252806020026020018201604052801561189d578160200160208202803683370190505b50905060005b8451811015611915576118e88582815181106118c1576118c16159c8565b60200260200101518583815181106118db576118db6159c8565b6020026020010151610810565b8282815181106118fa576118fa6159c8565b602090810291909101015261190e816159de565b90506118a3565b509392505050565b611925613a4a565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af115801561198d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119b19190615a42565b50505050565b60006108c9826142ab565b604080516020808201869052818301859052825180830384018152606090920190925280519101206000906119f681613d29565b611a1357604051635374b59960e01b815260040160405180910390fd5b6000611a1f86336109e3565b905080158015611a365750611a348233611782565b155b15611a5d5760405163168ab55d60e31b81526004810183905233602482015260440161088a565b60008080611a6a856108cf565b92509250925083158015611a815750620400008216155b15611aa25760405163a2a7201360e01b81526004810186905260240161088a565b6000611aad8a6108cf565b92505050611abc8883836141b7565b9750611aca8685858b6142c1565b60405167ffffffffffffffff8916815286907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b1329060200160405180910390a2509598975050505050505050565b611b1f613a4a565b611b296000614309565b565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830186905282518083038401815260609092019092528051910120611b7f8133611782565b611ba55760405163168ab55d60e31b81526004810182905233602482015260440161088a565b306001600160a01b03841603611bd957604051632ca49b0d60e11b81526001600160a01b038416600482015260240161088a565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830187905282518083038401815260609092019092528051910120611c2e905b83614366565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038481166024830152604482018690527f000000000000000000000000000000000000000000000000000000000000000016906342842e0e90606401600060405180830381600087803b158015611cb757600080fd5b505af1158015611ccb573d6000803e3d6000fd5b5050505050505050565b6000808686604051611ce8929190615a5f565b6040519081900381206331a9108f60e11b82526004820181905291506000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611d58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7c9190615a25565b90506001600160a01b0381163314801590611e24575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015611dfe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e229190615a42565b155b15611e9457604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae6020808301919091528183018590528251808303840181526060830193849052805191012063168ab55d60e31b909252606481019190915233608482015260a40161088a565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152306024830152604482018490527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90606401600060405180830381600087803b158015611f1d57600080fd5b505af1158015611f31573d6000803e3d6000fd5b5050604051630a3b53db60e21b8152600481018590523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506328ed4f6c9150604401600060405180830381600087803b158015611f9d57600080fd5b505af1158015611fb1573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018590526276a70092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316915063d6e4fa8690602401602060405180830381865afa15801561201f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120439190615937565b61204d9190615966565b925061209688888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff881686886138e4565b505095945050505050565b6001600160a01b038216330361211f5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c660000000000000000000000000000000000000000000000606482015260840161088a565b3360008181526002602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b3360009081526004602052604081205460ff166121fb5760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f604482015267373a3937b63632b960c11b606482015260840161088a565b6000878760405161220d929190615a5f565b6040519081900381207ffca247ac000000000000000000000000000000000000000000000000000000008252600482018190523060248301526044820187905291507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fca247ac906064016020604051808303816000875af11580156122a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122c69190615937565b915061231b88888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff86166123156276a70087615966565b886138e4565b509695505050505050565b600080612332846108cf565b50841663ffffffff908116908516149250505092915050565b612353613a4a565b6007546001600160a01b0316156124735760075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156123d357600080fd5b505af11580156123e7573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561245a57600080fd5b505af115801561246e573d6000803e3d6000fd5b505050505b6007805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316908117909155156125ad5760075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b15801561251257600080fd5b505af1158015612526573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561259957600080fd5b505af11580156114e4573d6000803e3d6000fd5b50565b3360009081526004602052604081205460ff166126205760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f604482015267373a3937b63632b960c11b606482015260840161088a565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301869052825180830384018152606090920190925280519101206000906040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101869052602481018590529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c475abff906044016020604051808303816000875af11580156126fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061271e9190615937565b6040516331a9108f60e11b8152600481018790529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa9250505080156127a2575060408051601f3d908101601f1916820190925261279f91810190615a25565b60015b6127af5791506108c99050565b6001600160a01b0381163014158061285957506040516302571be360e01b81526004810184905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015612829573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061284d9190615a25565b6001600160a01b031614155b15612868575091506108c99050565b5060006128786276a70083615966565b60008481526001602052604090205490915060a081901c61289b858383866142c1565b50919695505050505050565b6000866128b48133611782565b6128da5760405163168ab55d60e31b81526004810182905233602482015260440161088a565b600087876040516128ec929190615a5f565b604051809103902090506129278982604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506129338984613aa4565b61293d8386613be3565b60006129808a858b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613c1692505050565b905061298e8a858888613ce3565b945061299984613d29565b612a61576040517f06ab5923000000000000000000000000000000000000000000000000000000008152600481018b9052602481018390523060448201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906306ab5923906064016020604051808303816000875af1158015612a2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a4e9190615937565b50612a5c8482898989614458565b612aa7565b612aa78a858b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d92508c91508b9050613e19565b5050509695505050505050565b6000612afa600086868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061449a9050565b6007549091506001600160a01b0316612b3f576040517f24c1d6d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612b498133611782565b612b6f5760405163168ab55d60e31b81526004810182905233602482015260440161088a565b60008080612b7c846108cf565b919450925090506000612b8e85610958565b9050612b9985614559565b600760009054906101000a90046001600160a01b03166001600160a01b0316639198c2768a8a878787878e8e6040518963ffffffff1660e01b8152600401612be8989796959493929190615a98565b600060405180830381600087803b158015612c0257600080fd5b505af1158015612c16573d6000803e3d6000fd5b50505050505050505050505050565b83612c308133611782565b612c565760405163168ab55d60e31b81526004810182905233602482015260440161088a565b84601c6000612c64836108cf565b5091505063ffffffff8282161615612c925760405163a2a7201360e01b81526004810184905260240161088a565b6040517fcf408823000000000000000000000000000000000000000000000000000000008152600481018990523060248201526001600160a01b03878116604483015267ffffffffffffffff871660648301527f0000000000000000000000000000000000000000000000000000000000000000169063cf40882390608401600060405180830381600087803b158015612d2b57600080fd5b505af1158015612d3f573d6000803e3d6000fd5b5050506001600160a01b0388169050612da6576000612d5d896108cf565b509150506201ffff1962020000821601612d9557604051632ca49b0d60e11b81526001600160a01b038916600482015260240161088a565b612da0896000614366565b50611ccb565b6000612db1896119b7565b9050612dd381898b60001c600160405180602001604052806000815250614628565b505050505050505050565b60408051602080820186905281830185905282518083038401815260609092019092528051910120612e108133611782565b612e365760405163168ab55d60e31b81526004810182905233602482015260440161088a565b7f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b528401612e765760405163615a470360e01b815260040160405180910390fd5b6001600160a01b0382161580612e9457506001600160a01b03821630145b15612ebd57604051632ca49b0d60e11b81526001600160a01b038316600482015260240161088a565b604080516020808201879052818301869052825180830384018152606090920190925280519101206119b190611c28565b604080516020808201859052818301849052825180830384018152606090920190925280519101206000906000612f2482613d29565b90507f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae8514612f565791506108c99050565b6040516331a9108f60e11b8152600481018590527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa925050508015612fd7575060408051601f3d908101601f19168201909252612fd491810190615a25565b60015b612fe6576000925050506108c9565b6001600160a01b0316301492506108c9915050565b613003613a4a565b6001600160a01b038216600081815260046020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf8791015b60405180910390a25050565b6000806130aa600087878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061477a9050565b9150915060006130f38288888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061449a9050565b60408051602080820184905281830187905282518083038401815260609092019092528051910120909150600090600081815260066020526040902090915061313d888a83615b47565b507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b52820161317e5760405163615a470360e01b815260040160405180910390fd5b6040516302571be360e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa1580156131e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061320a9190615a25565b90506001600160a01b03811633148015906132b2575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa15801561328c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132b09190615a42565b155b156132d95760405163168ab55d60e31b81526004810183905233602482015260440161088a565b6001600160a01b0386161561336b57604051630c4b7b8560e11b8152600481018390526001600160a01b0387811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b15801561335257600080fd5b505af1158015613366573d6000803e3d6000fd5b505050505b604051635b0fc9c360e01b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635b0fc9c390604401600060405180830381600087803b1580156133d357600080fd5b505af11580156133e7573d6000803e3d6000fd5b50505050612dd3828a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508d93509150819050614458565b6001600160a01b0384166134925760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b0385163314806134cc57506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b61353e5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201527f20617070726f7665640000000000000000000000000000000000000000000000606482015260840161088a565b6114e48585858585614628565b613553613a4a565b6001600160a01b0381166135cf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161088a565b6125ad81614309565b600081815260066020526040812080548291906135f49061598e565b80601f01602080910402602001604051908101604052809291908181526020018280546136209061598e565b801561366d5780601f106136425761010080835404028352916020019161366d565b820191906000526020600020905b81548152906001019060200180831161365057829003601f168201915b5050505050905080516000036136865750600092915050565b600080613693838261477a565b909250905060006136a4848361449a565b9050610a738184612eee565b600080428367ffffffffffffffff1610156136de5761ffff19620100008516016136d957600094505b600093505b50929391925050565b60006001600160e01b031982167fd9b67a2600000000000000000000000000000000000000000000000000000000148061373157506001600160e01b031982166303a24d0760e21b145b806108c957507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146108c9565b6000613774826119b7565b9050806001600160a01b0316836001600160a01b0316036137fd5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f7200000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b336001600160a01b038216148061383757506001600160a01b038116600090815260026020908152604080832033845290915290205460ff165b6138a95760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161088a565b6109de8383614831565b6000620200008381161480156109965750426138d26276a70084615c07565b67ffffffffffffffff16109392505050565b84516020860120600061393e7f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae83604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b90506000613981886040518060400160405280600581526020017f03657468000000000000000000000000000000000000000000000000000000008152506148ac565b600083815260066020526040902090915061399c8282615c28565b506139af828289620300008a1789614458565b6001600160a01b03841615611ccb57604051630c4b7b8560e11b8152600481018390526001600160a01b0385811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b158015613a2857600080fd5b505af1158015613a3c573d6000803e3d6000fd5b505050505050505050505050565b6000546001600160a01b03163314611b295760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161088a565b60008080613ab1846108cf565b919450925090504267ffffffffffffffff821610808015613b7557506001600160a01b0384161580613b7557506040516302571be360e01b8152600481018690526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613b46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b6a9190615a25565b6001600160a01b0316145b15613bb4576000613b85876108cf565b509150506020811615613bae5760405163a2a7201360e01b81526004810187905260240161088a565b50613bdb565b62010000831615613bdb5760405163a2a7201360e01b81526004810186905260240161088a565b505050505050565b63fffdffff81811763ffffffff1614613c125760405163a2a7201360e01b81526004810183905260240161088a565b5050565b60606000613cbf83600660008881526020019081526020016000208054613c3c9061598e565b80601f0160208091040260200160405190810160405280929190818152602001828054613c689061598e565b8015613cb55780601f10613c8a57610100808354040283529160200191613cb5565b820191906000526020600020905b815481529060010190602001808311613c9857829003601f168201915b50505050506148ac565b6000858152600660205260409020909150613cda8282615c28565b50949350505050565b600080613cef856108cf565b92505050600080613d028860001c6108cf565b9250925050613d1287878461417c565b613d1d8584836141b7565b98975050505050505050565b600080613d35836119b7565b6001600160a01b0316141580156108c957506040516302571be360e01b81526004810183905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613dae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dd29190615a25565b6001600160a01b03161492915050565b60008681526006602052604081208054613e01918791613c3c9061598e565b9050613e108682868686614458565b50505050505050565b60008080613e26886108cf565b9250925092506000613e5088600660008d81526020019081526020016000208054613c3c9061598e565b60008a8152600660205260409020805491925090613e6d9061598e565b9050600003613e90576000898152600660205260409020613e8e8282615c28565b505b613e9f89858886178589614201565b6001600160a01b038716613ebd57613eb8896000614366565b610bfc565b610bfc84888b60001c600160405180602001604052806000815250614628565b6201ffff1962020000831601613efd57613efa6276a70082615c07565b90505b428167ffffffffffffffff161015613f7a5762010000821615613f755760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b613f9f565b6004821615613f9f5760405163a2a7201360e01b81526004810184905260240161088a565b604082166000036109de5750506000908152600360205260409020805473ffffffffffffffffffffffffffffffffffffffff19169055565b6001600160a01b0384163b15613bdb5760405163bc197c8160e01b81526001600160a01b0385169063bc197c819061401b9089908990889088908890600401615ce8565b6020604051808303816000875af1925050508015614056575060408051601f3d908101601f1916820190925261405391810190615d3a565b60015b61410b57614062615d57565b806308c379a00361409b5750614076615d73565b80614081575061409d565b8060405162461bcd60e51b815260040161088a9190614e3c565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560448201527f526563656976657220696d706c656d656e746572000000000000000000000000606482015260840161088a565b6001600160e01b0319811663bc197c8160e01b14613e105760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161088a565b63ffff000082161580159060018316159082906141965750805b156114e45760405163a2a7201360e01b81526004810186905260240161088a565b60008167ffffffffffffffff168467ffffffffffffffff1611156141d9578193505b8267ffffffffffffffff168467ffffffffffffffff1610156141f9578293505b509192915050565b61420d858585846142c1565b60405163ffffffff8416815285907f39873f00c80f4f94b7bd1594aebcf650f003545b74824d57ddf4939e3ff3a34b9060200160405180910390a28167ffffffffffffffff168167ffffffffffffffff1611156114e45760405167ffffffffffffffff8216815285907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b132906020015b60405180910390a25050505050565b6000806142b7836108cf565b5090949350505050565b6142cb8483614955565b60008481526001602052604090206001600160a01b03841663ffffffff60a01b60a085901b16176001600160c01b031960c084901b161790556119b1565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b614371826001612326565b156143925760405163a2a7201360e01b81526004810183905260240161088a565b61439b82614559565b604051635b0fc9c360e01b8152600481018390526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b15801561440557600080fd5b505af1158015614419573d6000803e3d6000fd5b50506040516001600160a01b03841681528492507fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49150602001613057565b6144648584848461498e565b847f8ce7013e8abebc55c3890a68f5a27c67c3f7efa64e584de5fb22363c606fd3408585858560405161429c9493929190615dfd565b60008060006144a9858561477a565b90925090508161451b57600185516144c19190615e45565b841461450f5760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d65000000604482015260640161088a565b50600091506108c99050565b614525858261449a565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b60008181526001602052604090205460a081901c60c082901c61457d8383836136b0565b6000868152600360209081526040808320805473ffffffffffffffffffffffffffffffffffffffff191690556001909152902063ffffffff60a01b60a083901b166001600160c01b031960c086901b1617905592506145d99050565b60408051858152600160208201526000916001600160a01b0386169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a450505050565b6000806000614636866108cf565b925092509250614647868383613edd565b8460011480156146685750876001600160a01b0316836001600160a01b0316145b6146c75760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b866001600160a01b0316836001600160a01b0316036146e8575050506114e4565b60008681526001602052604090206001600160a01b03881663ffffffff60a01b60a085901b16176001600160c01b031960c084901b1617905560408051878152602081018790526001600160a01b03808a1692908b169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611ccb338989898989614a02565b600080835183106147cd5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e64730000604482015260640161088a565b60008484815181106147e1576147e16159c8565b016020015160f81c9050801561480d5761480685614800866001615e58565b83614afe565b9250614812565b600092505b61481c8185615e58565b614827906001615e58565b9150509250929050565b6000818152600360205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091558190614873826119b7565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60606001835110156148ea576040517f280dacb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60ff8351111561492857826040517fe3ba295f00000000000000000000000000000000000000000000000000000000815260040161088a9190614e3c565b8251838360405160200161493e93929190615e6b565b604051602081830303815290604052905092915050565b61ffff81161580159061496d57506201000181811614155b15613c125760405163a2a7201360e01b81526004810183905260240161088a565b6149988483614955565b6000848152600160205260409020546001600160a01b038116156149f6576149bf85614559565b6040516000815285907fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49060200160405180910390a25b6114e485858585614b22565b6001600160a01b0384163b15613bdb5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190614a469089908990889088908890600401615ecc565b6020604051808303816000875af1925050508015614a81575060408051601f3d908101601f19168201909252614a7e91810190615d3a565b60015b614a8d57614062615d57565b6001600160e01b0319811663f23a6e6160e01b14613e105760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161088a565b8251600090614b0d8385615e58565b1115614b1857600080fd5b5091016020012090565b8360008080614b30846108cf565b9194509250905063ffff0000821667ffffffffffffffff8087169083161115614b57578195505b428267ffffffffffffffff1610614b6d57958617955b6001600160a01b03841615614bc45760405162461bcd60e51b815260206004820152601f60248201527f455243313135353a206d696e74206f66206578697374696e6720746f6b656e00604482015260640161088a565b6001600160a01b038816614c405760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b306001600160a01b03891603614cbe5760405162461bcd60e51b815260206004820152603460248201527f455243313135353a206e65774f776e65722063616e6e6f74206265207468652060448201527f4e616d655772617070657220636f6e7472616374000000000000000000000000606482015260840161088a565b60008581526001602052604090206001600160a01b03891663ffffffff60a01b60a08a901b16176001600160c01b031960c089901b1617905560408051868152600160208201526001600160a01b038a169160009133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4612dd33360008a88600160405180602001604052806000815250614a02565b6001600160a01b03811681146125ad57600080fd5b60008060408385031215614d8757600080fd5b8235614d9281614d5f565b946020939093013593505050565b600060208284031215614db257600080fd5b5035919050565b6001600160e01b0319811681146125ad57600080fd5b600060208284031215614de157600080fd5b813561099681614db9565b60005b83811015614e07578181015183820152602001614def565b50506000910152565b60008151808452614e28816020860160208601614dec565b601f01601f19169290920160200192915050565b6020815260006109966020830184614e10565b60008060408385031215614e6257600080fd5b823591506020830135614e7481614d5f565b809150509250929050565b803567ffffffffffffffff81168114614e9757600080fd5b919050565b60008060408385031215614eaf57600080fd5b82359150614ebf60208401614e7f565b90509250929050565b60008083601f840112614eda57600080fd5b50813567ffffffffffffffff811115614ef257600080fd5b602083019150836020828501011115614f0a57600080fd5b9250929050565b600080600080600060808688031215614f2957600080fd5b8535614f3481614d5f565b94506020860135614f4481614d5f565b935060408601359250606086013567ffffffffffffffff811115614f6757600080fd5b614f7388828901614ec8565b969995985093965092949392505050565b600060208284031215614f9657600080fd5b813561099681614d5f565b634e487b7160e01b600052604160045260246000fd5b601f8201601f1916810167ffffffffffffffff81118282101715614fdd57614fdd614fa1565b6040525050565b600067ffffffffffffffff821115614ffe57614ffe614fa1565b50601f01601f191660200190565b600082601f83011261501d57600080fd5b813561502881614fe4565b6040516150358282614fb7565b82815285602084870101111561504a57600080fd5b82602086016020830137600092810160200192909252509392505050565b803563ffffffff81168114614e9757600080fd5b600080600080600080600060e0888a03121561509757600080fd5b87359650602088013567ffffffffffffffff8111156150b557600080fd5b6150c18a828b0161500c565b96505060408801356150d281614d5f565b945060608801356150e281614d5f565b93506150f060808901614e7f565b92506150fe60a08901615068565b915061510c60c08901614e7f565b905092959891949750929550565b600067ffffffffffffffff82111561513457615134614fa1565b5060051b60200190565b600082601f83011261514f57600080fd5b8135602061515c8261511a565b6040516151698282614fb7565b83815260059390931b850182019282810191508684111561518957600080fd5b8286015b8481101561231b578035835291830191830161518d565b600080600080600060a086880312156151bc57600080fd5b85356151c781614d5f565b945060208601356151d781614d5f565b9350604086013567ffffffffffffffff808211156151f457600080fd5b61520089838a0161513e565b9450606088013591508082111561521657600080fd5b61522289838a0161513e565b9350608088013591508082111561523857600080fd5b506152458882890161500c565b9150509295509295909350565b6000806000806080858703121561526857600080fd5b843593506020850135925061527f60408601615068565b915061528d60608601614e7f565b905092959194509250565b803561ffff81168114614e9757600080fd5b600080604083850312156152bd57600080fd5b82359150614ebf60208401615298565b600080604083850312156152e057600080fd5b823567ffffffffffffffff808211156152f857600080fd5b818501915085601f83011261530c57600080fd5b813560206153198261511a565b6040516153268282614fb7565b83815260059390931b850182019282810191508984111561534657600080fd5b948201945b8386101561536d57853561535e81614d5f565b8252948201949082019061534b565b9650508601359250508082111561538357600080fd5b506148278582860161513e565b600081518084526020808501945080840160005b838110156153c0578151875295820195908201906001016153a4565b509495945050505050565b6020815260006109966020830184615390565b6000806000606084860312156153f357600080fd5b83356153fe81614d5f565b9250602084013561540e81614d5f565b929592945050506040919091013590565b60008060006060848603121561543457600080fd5b833592506020840135915061544b60408501614e7f565b90509250925092565b60008060006060848603121561546957600080fd5b83359250602084013561547b81614d5f565b9150604084013561548b81614d5f565b809150509250925092565b6000806000806000608086880312156154ae57600080fd5b853567ffffffffffffffff8111156154c557600080fd5b6154d188828901614ec8565b90965094505060208601356154e581614d5f565b92506154f360408701615298565b9150606086013561550381614d5f565b809150509295509295909350565b80151581146125ad57600080fd5b6000806040838503121561553257600080fd5b823561553d81614d5f565b91506020830135614e7481615511565b60008060008060008060a0878903121561556657600080fd5b863567ffffffffffffffff81111561557d57600080fd5b61558989828a01614ec8565b909750955050602087013561559d81614d5f565b93506040870135925060608701356155b481614d5f565b91506155c260808801615298565b90509295509295509295565b600080604083850312156155e157600080fd5b82359150614ebf60208401615068565b6000806040838503121561560457600080fd5b50508035926020909101359150565b60008060008060008060a0878903121561562c57600080fd5b86359550602087013567ffffffffffffffff81111561564a57600080fd5b61565689828a01614ec8565b909650945050604087013561566a81614d5f565b925061567860608801615068565b91506155c260808801614e7f565b6000806000806040858703121561569c57600080fd5b843567ffffffffffffffff808211156156b457600080fd5b6156c088838901614ec8565b909650945060208701359150808211156156d957600080fd5b506156e687828801614ec8565b95989497509550505050565b6000806000806080858703121561570857600080fd5b84359350602085013561571a81614d5f565b9250604085013561527f81614d5f565b60008060006060848603121561573f57600080fd5b8335925060208401359150604084013561548b81614d5f565b6000806040838503121561576b57600080fd5b823561577681614d5f565b91506020830135614e7481614d5f565b6000806000806060858703121561579c57600080fd5b843567ffffffffffffffff8111156157b357600080fd5b6157bf87828801614ec8565b90955093505060208501356157d381614d5f565b915060408501356157e381614d5f565b939692955090935050565b600080600080600060a0868803121561580657600080fd5b853561581181614d5f565b9450602086013561582181614d5f565b93506040860135925060608601359150608086013567ffffffffffffffff81111561584b57600080fd5b6152458882890161500c565b60006020828403121561586957600080fd5b815167ffffffffffffffff81111561588057600080fd5b8201601f8101841361589157600080fd5b805161589c81614fe4565b6040516158a98282614fb7565b8281528660208486010111156158be57600080fd5b610a73836020830160208701614dec565b600080600080608085870312156158e557600080fd5b843567ffffffffffffffff8111156158fc57600080fd5b6159088782880161500c565b945050602085013561591981614d5f565b925061592760408601615298565b915060608501356157e381614d5f565b60006020828403121561594957600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b67ffffffffffffffff81811683821601908082111561598757615987615950565b5092915050565b600181811c908216806159a257607f821691505b6020821081036159c257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b6000600182016159f0576159f0615950565b5060010190565b604081526000615a0a6040830185615390565b8281036020840152615a1c8185615390565b95945050505050565b600060208284031215615a3757600080fd5b815161099681614d5f565b600060208284031215615a5457600080fd5b815161099681615511565b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60c081526000615aac60c083018a8c615a6f565b6001600160a01b03898116602085015263ffffffff8916604085015267ffffffffffffffff881660608501528616608084015282810360a0840152615af2818587615a6f565b9b9a5050505050505050505050565b601f8211156109de57600081815260208120601f850160051c81016020861015615b285750805b601f850160051c820191505b81811015613bdb57828155600101615b34565b67ffffffffffffffff831115615b5f57615b5f614fa1565b615b7383615b6d835461598e565b83615b01565b6000601f841160018114615ba75760008515615b8f5750838201355b600019600387901b1c1916600186901b1783556114e4565b600083815260209020601f19861690835b82811015615bd85786850135825560209485019460019092019101615bb8565b5086821015615bf55760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b67ffffffffffffffff82811682821603908082111561598757615987615950565b815167ffffffffffffffff811115615c4257615c42614fa1565b615c5681615c50845461598e565b84615b01565b602080601f831160018114615c8b5760008415615c735750858301515b600019600386901b1c1916600185901b178555613bdb565b600085815260208120601f198616915b82811015615cba57888601518255948401946001909101908401615c9b565b5085821015615cd85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006001600160a01b03808816835280871660208401525060a06040830152615d1460a0830186615390565b8281036060840152615d268186615390565b90508281036080840152613d1d8185614e10565b600060208284031215615d4c57600080fd5b815161099681614db9565b600060033d1115615d705760046000803e5060005160e01c5b90565b600060443d1015615d815790565b6040516003193d81016004833e81513d67ffffffffffffffff8160248401118184111715615db157505050505090565b8285019150815181811115615dc95750505050505090565b843d8701016020828501011115615de35750505050505090565b615df260208286010187614fb7565b509095945050505050565b608081526000615e106080830187614e10565b6001600160a01b039590951660208301525063ffffffff92909216604083015267ffffffffffffffff16606090910152919050565b818103818111156108c9576108c9615950565b808201808211156108c9576108c9615950565b7fff000000000000000000000000000000000000000000000000000000000000008460f81b16815260008351615ea8816001850160208801614dec565b835190830190615ebf816001840160208801614dec565b0160010195945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152615f0460a0830184614e10565b97965050505050505056fea26469706673582212203420d6b763d82b1b590fea45d804e16953e66816411da10be7022bec2bfbbe2064736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061031f5760003560e01c80636352211e116101a7578063c93ab3fd116100ee578063e985e9c511610097578063f242432a11610071578063f242432a146107d7578063f2fde38b146107ea578063fd0cd0d9146107fd57600080fd5b8063e985e9c514610768578063eb8ae530146107a4578063ed70554d146107b757600080fd5b8063d9a50c12116100c8578063d9a50c121461071f578063da8c229e14610732578063e0dba60f1461075557600080fd5b8063c93ab3fd146106e6578063cf408823146106f9578063d8c9921a1461070c57600080fd5b8063a22cb46511610150578063b6bcad261161012a578063b6bcad26146106ad578063c475abff146106c0578063c658e086146106d357600080fd5b8063a22cb46514610674578063a401498214610687578063adf4960a1461069a57600080fd5b80638b4dfa75116101815780638b4dfa751461063d5780638cf8b41e146106505780638da5cb5b1461066357600080fd5b80636352211e146105f65780636e5d6ad214610609578063715018a61461063557600080fd5b80631f4e15041161026b5780633f15457f116102145780634e1273f4116101ee5780634e1273f4146105b057806353095467146105d05780635d3590d5146105e357600080fd5b80633f15457f1461054e578063402906fc1461057557806341415eab1461059d57600080fd5b80632b20e397116102455780632b20e397146105015780632eb2c2d61461052857806333c69ea91461053b57600080fd5b80631f4e1504146104c857806320c38e2b146104db57806324c1af44146104ee57600080fd5b80630e4cd725116102cd578063150b7a02116102a7578063150b7a02146104765780631534e177146104a25780631896f70a146104b557600080fd5b80630e4cd7251461043d5780630e89341c1461045057806314ab90381461046357600080fd5b806306fdde03116102fe57806306fdde03146103b4578063081812fc146103fd578063095ea7b31461042857600080fd5b8062fdd58e146103245780630178fe3f1461034a57806301ffc9a714610391575b600080fd5b610337610332366004614d74565b610810565b6040519081526020015b60405180910390f35b61035d610358366004614da0565b6108cf565b604080516001600160a01b03909416845263ffffffff909216602084015267ffffffffffffffff1690820152606001610341565b6103a461039f366004614dcf565b6108ff565b6040519015158152602001610341565b6103f06040518060400160405280600b81526020017f4e616d655772617070657200000000000000000000000000000000000000000081525081565b6040516103419190614e3c565b61041061040b366004614da0565b610958565b6040516001600160a01b039091168152602001610341565b61043b610436366004614d74565b61099d565b005b6103a461044b366004614e4f565b6109e3565b6103f061045e366004614da0565b610a7d565b61043b610471366004614e9c565b610aef565b610489610484366004614f11565b610c08565b6040516001600160e01b03199091168152602001610341565b61043b6104b0366004614f84565b610e1a565b61043b6104c3366004614e4f565b610e51565b600754610410906001600160a01b031681565b6103f06104e9366004614da0565b610f13565b6103376104fc36600461507c565b610fad565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b61043b6105363660046151a4565b6111c1565b61043b610549366004615252565b6114eb565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b6105886105833660046152aa565b6116e0565b60405163ffffffff9091168152602001610341565b6103a46105ab366004614e4f565b611782565b6105c36105be3660046152cd565b6117df565b60405161034191906153cb565b600554610410906001600160a01b031681565b61043b6105f13660046153de565b61191d565b610410610604366004614da0565b6119b7565b61061c61061736600461541f565b6119c2565b60405167ffffffffffffffff9091168152602001610341565b61043b611b17565b61043b61064b366004615454565b611b2b565b61061c61065e366004615496565b611cd5565b6000546001600160a01b0316610410565b61043b61068236600461551f565b6120a1565b61033761069536600461554d565b61218b565b6103a46106a83660046155ce565b612326565b61043b6106bb366004614f84565b61234b565b6103376106ce3660046155f1565b6125b0565b6103376106e1366004615613565b6128a7565b61043b6106f4366004615686565b612ab4565b61043b6107073660046156f2565b612c25565b61043b61071a36600461572a565b612dde565b6103a461072d3660046155f1565b612eee565b6103a4610740366004614f84565b60046020526000908152604090205460ff1681565b61043b61076336600461551f565b612ffb565b6103a4610776366004615758565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b61043b6107b2366004615786565b613063565b6103376107c5366004614da0565b60016020526000908152604090205481565b61043b6107e53660046157ee565b61342e565b61043b6107f8366004614f84565b61354b565b6103a461080b366004614da0565b6135d8565b60006001600160a01b0383166108935760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084015b60405180910390fd5b600061089e836119b7565b9050836001600160a01b0316816001600160a01b0316036108c35760019150506108c9565b60009150505b92915050565b60008181526001602052604090205460a081901c60c082901c6108f38383836136b0565b90959094509092509050565b60006001600160e01b031982167fd82c42d800000000000000000000000000000000000000000000000000000000148061094957506001600160e01b03198216630a85bd0160e11b145b806108c957506108c9826136e7565b600080610964836119b7565b90506001600160a01b03811661097d5750600092915050565b6000838152600360205260409020546001600160a01b03165b9392505050565b60006109a8826108cf565b50915050603f1960408216016109d45760405163a2a7201360e01b81526004810183905260240161088a565b6109de8383613769565b505050565b60008080806109f1866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a3c57506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff165b80610a6057506001600160a01b038516610a5587610958565b6001600160a01b0316145b8015610a735750610a7182826138b3565b155b9695505050505050565b6005546040516303a24d0760e21b8152600481018390526060916001600160a01b031690630e89341c90602401600060405180830381865afa158015610ac7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108c99190810190615857565b81610afa8133611782565b610b205760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260106000610b2e836108cf565b5091505063ffffffff8282161615610b5c5760405163a2a7201360e01b81526004810184905260240161088a565b6040517f14ab90380000000000000000000000000000000000000000000000000000000081526004810187905267ffffffffffffffff861660248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906314ab9038906044015b600060405180830381600087803b158015610be857600080fd5b505af1158015610bfc573d6000803e3d6000fd5b50505050505050505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610c6c576040517f1931a53800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080610c7d868801886158cf565b83516020850120939750919550935091508890808214610cd3576040517fc65c3ccc000000000000000000000000000000000000000000000000000000008152600481018290526024810183905260440161088a565b604051630a3b53db60e21b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906328ed4f6c90604401600060405180830381600087803b158015610d3b57600080fd5b505af1158015610d4f573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018d9052600092506276a70091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d6e4fa8690602401602060405180830381865afa158015610dc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de49190615937565b610dee9190615966565b9050610e0187878761ffff1684886138e4565b50630a85bd0160e11b9c9b505050505050505050505050565b610e22613a4a565b6005805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b81610e5c8133611782565b610e825760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260086000610e90836108cf565b5091505063ffffffff8282161615610ebe5760405163a2a7201360e01b81526004810184905260240161088a565b604051630c4b7b8560e11b8152600481018790526001600160a01b0386811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401610bce565b60066020526000908152604090208054610f2c9061598e565b80601f0160208091040260200160405190810160405280929190818152602001828054610f589061598e565b8015610fa55780601f10610f7a57610100808354040283529160200191610fa5565b820191906000526020600020905b815481529060010190602001808311610f8857829003601f168201915b505050505081565b600087610fba8133611782565b610fe05760405163168ab55d60e31b81526004810182905233602482015260440161088a565b875160208901206110188a82604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506110248a84613aa4565b61102e8386613be3565b6110398a848b613c16565b506110468a848787613ce3565b935061105183613d29565b611107576040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156110dc57600080fd5b505af11580156110f0573d6000803e3d6000fd5b505050506111028a848b8b8989613de2565b6111b4565b6040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561118e57600080fd5b505af11580156111a2573d6000803e3d6000fd5b505050506111b48a848b8b8989613e19565b5050979650505050505050565b81518351146112385760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060448201527f6d69736d61746368000000000000000000000000000000000000000000000000606482015260840161088a565b6001600160a01b03841661129c5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b0385163314806112d657506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b6113485760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000606482015260840161088a565b60005b835181101561147e576000848281518110611368576113686159c8565b602002602001015190506000848381518110611386576113866159c8565b60200260200101519050600080600061139e856108cf565b9250925092506113af858383613edd565b8360011480156113d057508a6001600160a01b0316836001600160a01b0316145b61142f5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b60008581526001602052604090206001600160a01b038b1663ffffffff60a01b60a085901b16176001600160c01b031960c084901b16179055505050505080611477906159de565b905061134b565b50836001600160a01b0316856001600160a01b0316336001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516114ce9291906159f7565b60405180910390a46114e4338686868686613fd7565b5050505050565b6040805160208082018790528183018690528251808303840181526060909201909252805191012061151d8184613be3565b6000808061152a846108cf565b919450925090506001600160a01b03831615806115d957506040516302571be360e01b81526004810185905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa1580156115a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115cd9190615a25565b6001600160a01b031614155b156115f757604051635374b59960e01b815260040160405180910390fd5b6000806116038a6108cf565b90935091508a9050611644576116198633611782565b61163f5760405163168ab55d60e31b81526004810187905233602482015260440161088a565b611674565b61164e8a33611782565b6116745760405163168ab55d60e31b8152600481018b905233602482015260440161088a565b61167f86898461417c565b61168a8784836141b7565b9650620100008416158015906116ae57508363ffffffff1688851763ffffffff1614155b156116cf5760405163a2a7201360e01b81526004810187905260240161088a565b96831796610bfc86868a868b614201565b6000826116ed8133611782565b6117135760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8360026000611721836108cf565b5091505063ffffffff828216161561174f5760405163a2a7201360e01b81526004810184905260240161088a565b6000808061175c8a6108cf565b9250925092506117758a84848c61ffff16178485614201565b5098975050505050505050565b6000808080611790866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a6057506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff16610a60565b606081518351146118585760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d617463680000000000000000000000000000000000000000000000606482015260840161088a565b6000835167ffffffffffffffff81111561187457611874614fa1565b60405190808252806020026020018201604052801561189d578160200160208202803683370190505b50905060005b8451811015611915576118e88582815181106118c1576118c16159c8565b60200260200101518583815181106118db576118db6159c8565b6020026020010151610810565b8282815181106118fa576118fa6159c8565b602090810291909101015261190e816159de565b90506118a3565b509392505050565b611925613a4a565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af115801561198d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119b19190615a42565b50505050565b60006108c9826142ab565b604080516020808201869052818301859052825180830384018152606090920190925280519101206000906119f681613d29565b611a1357604051635374b59960e01b815260040160405180910390fd5b6000611a1f86336109e3565b905080158015611a365750611a348233611782565b155b15611a5d5760405163168ab55d60e31b81526004810183905233602482015260440161088a565b60008080611a6a856108cf565b92509250925083158015611a815750620400008216155b15611aa25760405163a2a7201360e01b81526004810186905260240161088a565b6000611aad8a6108cf565b92505050611abc8883836141b7565b9750611aca8685858b6142c1565b60405167ffffffffffffffff8916815286907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b1329060200160405180910390a2509598975050505050505050565b611b1f613a4a565b611b296000614309565b565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830186905282518083038401815260609092019092528051910120611b7f8133611782565b611ba55760405163168ab55d60e31b81526004810182905233602482015260440161088a565b306001600160a01b03841603611bd957604051632ca49b0d60e11b81526001600160a01b038416600482015260240161088a565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830187905282518083038401815260609092019092528051910120611c2e905b83614366565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038481166024830152604482018690527f000000000000000000000000000000000000000000000000000000000000000016906342842e0e90606401600060405180830381600087803b158015611cb757600080fd5b505af1158015611ccb573d6000803e3d6000fd5b5050505050505050565b6000808686604051611ce8929190615a5f565b6040519081900381206331a9108f60e11b82526004820181905291506000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611d58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7c9190615a25565b90506001600160a01b0381163314801590611e24575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015611dfe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e229190615a42565b155b15611e9457604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae6020808301919091528183018590528251808303840181526060830193849052805191012063168ab55d60e31b909252606481019190915233608482015260a40161088a565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152306024830152604482018490527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90606401600060405180830381600087803b158015611f1d57600080fd5b505af1158015611f31573d6000803e3d6000fd5b5050604051630a3b53db60e21b8152600481018590523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506328ed4f6c9150604401600060405180830381600087803b158015611f9d57600080fd5b505af1158015611fb1573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018590526276a70092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316915063d6e4fa8690602401602060405180830381865afa15801561201f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120439190615937565b61204d9190615966565b925061209688888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff881686886138e4565b505095945050505050565b6001600160a01b038216330361211f5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c660000000000000000000000000000000000000000000000606482015260840161088a565b3360008181526002602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b3360009081526004602052604081205460ff166121fb5760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f604482015267373a3937b63632b960c11b606482015260840161088a565b6000878760405161220d929190615a5f565b6040519081900381207ffca247ac000000000000000000000000000000000000000000000000000000008252600482018190523060248301526044820187905291507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fca247ac906064016020604051808303816000875af11580156122a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122c69190615937565b915061231b88888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff86166123156276a70087615966565b886138e4565b509695505050505050565b600080612332846108cf565b50841663ffffffff908116908516149250505092915050565b612353613a4a565b6007546001600160a01b0316156124735760075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156123d357600080fd5b505af11580156123e7573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561245a57600080fd5b505af115801561246e573d6000803e3d6000fd5b505050505b6007805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316908117909155156125ad5760075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b15801561251257600080fd5b505af1158015612526573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561259957600080fd5b505af11580156114e4573d6000803e3d6000fd5b50565b3360009081526004602052604081205460ff166126205760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f604482015267373a3937b63632b960c11b606482015260840161088a565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301869052825180830384018152606090920190925280519101206000906040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101869052602481018590529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c475abff906044016020604051808303816000875af11580156126fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061271e9190615937565b6040516331a9108f60e11b8152600481018790529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa9250505080156127a2575060408051601f3d908101601f1916820190925261279f91810190615a25565b60015b6127af5791506108c99050565b6001600160a01b0381163014158061285957506040516302571be360e01b81526004810184905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015612829573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061284d9190615a25565b6001600160a01b031614155b15612868575091506108c99050565b5060006128786276a70083615966565b60008481526001602052604090205490915060a081901c61289b858383866142c1565b50919695505050505050565b6000866128b48133611782565b6128da5760405163168ab55d60e31b81526004810182905233602482015260440161088a565b600087876040516128ec929190615a5f565b604051809103902090506129278982604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506129338984613aa4565b61293d8386613be3565b60006129808a858b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613c1692505050565b905061298e8a858888613ce3565b945061299984613d29565b612a61576040517f06ab5923000000000000000000000000000000000000000000000000000000008152600481018b9052602481018390523060448201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906306ab5923906064016020604051808303816000875af1158015612a2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a4e9190615937565b50612a5c8482898989614458565b612aa7565b612aa78a858b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d92508c91508b9050613e19565b5050509695505050505050565b6000612afa600086868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061449a9050565b6007549091506001600160a01b0316612b3f576040517f24c1d6d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612b498133611782565b612b6f5760405163168ab55d60e31b81526004810182905233602482015260440161088a565b60008080612b7c846108cf565b919450925090506000612b8e85610958565b9050612b9985614559565b600760009054906101000a90046001600160a01b03166001600160a01b0316639198c2768a8a878787878e8e6040518963ffffffff1660e01b8152600401612be8989796959493929190615a98565b600060405180830381600087803b158015612c0257600080fd5b505af1158015612c16573d6000803e3d6000fd5b50505050505050505050505050565b83612c308133611782565b612c565760405163168ab55d60e31b81526004810182905233602482015260440161088a565b84601c6000612c64836108cf565b5091505063ffffffff8282161615612c925760405163a2a7201360e01b81526004810184905260240161088a565b6040517fcf408823000000000000000000000000000000000000000000000000000000008152600481018990523060248201526001600160a01b03878116604483015267ffffffffffffffff871660648301527f0000000000000000000000000000000000000000000000000000000000000000169063cf40882390608401600060405180830381600087803b158015612d2b57600080fd5b505af1158015612d3f573d6000803e3d6000fd5b5050506001600160a01b0388169050612da6576000612d5d896108cf565b509150506201ffff1962020000821601612d9557604051632ca49b0d60e11b81526001600160a01b038916600482015260240161088a565b612da0896000614366565b50611ccb565b6000612db1896119b7565b9050612dd381898b60001c600160405180602001604052806000815250614628565b505050505050505050565b60408051602080820186905281830185905282518083038401815260609092019092528051910120612e108133611782565b612e365760405163168ab55d60e31b81526004810182905233602482015260440161088a565b7f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b528401612e765760405163615a470360e01b815260040160405180910390fd5b6001600160a01b0382161580612e9457506001600160a01b03821630145b15612ebd57604051632ca49b0d60e11b81526001600160a01b038316600482015260240161088a565b604080516020808201879052818301869052825180830384018152606090920190925280519101206119b190611c28565b604080516020808201859052818301849052825180830384018152606090920190925280519101206000906000612f2482613d29565b90507f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae8514612f565791506108c99050565b6040516331a9108f60e11b8152600481018590527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa925050508015612fd7575060408051601f3d908101601f19168201909252612fd491810190615a25565b60015b612fe6576000925050506108c9565b6001600160a01b0316301492506108c9915050565b613003613a4a565b6001600160a01b038216600081815260046020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf8791015b60405180910390a25050565b6000806130aa600087878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061477a9050565b9150915060006130f38288888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061449a9050565b60408051602080820184905281830187905282518083038401815260609092019092528051910120909150600090600081815260066020526040902090915061313d888a83615b47565b507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b52820161317e5760405163615a470360e01b815260040160405180910390fd5b6040516302571be360e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa1580156131e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061320a9190615a25565b90506001600160a01b03811633148015906132b2575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa15801561328c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132b09190615a42565b155b156132d95760405163168ab55d60e31b81526004810183905233602482015260440161088a565b6001600160a01b0386161561336b57604051630c4b7b8560e11b8152600481018390526001600160a01b0387811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b15801561335257600080fd5b505af1158015613366573d6000803e3d6000fd5b505050505b604051635b0fc9c360e01b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635b0fc9c390604401600060405180830381600087803b1580156133d357600080fd5b505af11580156133e7573d6000803e3d6000fd5b50505050612dd3828a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508d93509150819050614458565b6001600160a01b0384166134925760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b0385163314806134cc57506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b61353e5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201527f20617070726f7665640000000000000000000000000000000000000000000000606482015260840161088a565b6114e48585858585614628565b613553613a4a565b6001600160a01b0381166135cf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161088a565b6125ad81614309565b600081815260066020526040812080548291906135f49061598e565b80601f01602080910402602001604051908101604052809291908181526020018280546136209061598e565b801561366d5780601f106136425761010080835404028352916020019161366d565b820191906000526020600020905b81548152906001019060200180831161365057829003601f168201915b5050505050905080516000036136865750600092915050565b600080613693838261477a565b909250905060006136a4848361449a565b9050610a738184612eee565b600080428367ffffffffffffffff1610156136de5761ffff19620100008516016136d957600094505b600093505b50929391925050565b60006001600160e01b031982167fd9b67a2600000000000000000000000000000000000000000000000000000000148061373157506001600160e01b031982166303a24d0760e21b145b806108c957507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146108c9565b6000613774826119b7565b9050806001600160a01b0316836001600160a01b0316036137fd5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f7200000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b336001600160a01b038216148061383757506001600160a01b038116600090815260026020908152604080832033845290915290205460ff165b6138a95760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161088a565b6109de8383614831565b6000620200008381161480156109965750426138d26276a70084615c07565b67ffffffffffffffff16109392505050565b84516020860120600061393e7f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae83604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b90506000613981886040518060400160405280600581526020017f03657468000000000000000000000000000000000000000000000000000000008152506148ac565b600083815260066020526040902090915061399c8282615c28565b506139af828289620300008a1789614458565b6001600160a01b03841615611ccb57604051630c4b7b8560e11b8152600481018390526001600160a01b0385811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b158015613a2857600080fd5b505af1158015613a3c573d6000803e3d6000fd5b505050505050505050505050565b6000546001600160a01b03163314611b295760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161088a565b60008080613ab1846108cf565b919450925090504267ffffffffffffffff821610808015613b7557506001600160a01b0384161580613b7557506040516302571be360e01b8152600481018690526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613b46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b6a9190615a25565b6001600160a01b0316145b15613bb4576000613b85876108cf565b509150506020811615613bae5760405163a2a7201360e01b81526004810187905260240161088a565b50613bdb565b62010000831615613bdb5760405163a2a7201360e01b81526004810186905260240161088a565b505050505050565b63fffdffff81811763ffffffff1614613c125760405163a2a7201360e01b81526004810183905260240161088a565b5050565b60606000613cbf83600660008881526020019081526020016000208054613c3c9061598e565b80601f0160208091040260200160405190810160405280929190818152602001828054613c689061598e565b8015613cb55780601f10613c8a57610100808354040283529160200191613cb5565b820191906000526020600020905b815481529060010190602001808311613c9857829003601f168201915b50505050506148ac565b6000858152600660205260409020909150613cda8282615c28565b50949350505050565b600080613cef856108cf565b92505050600080613d028860001c6108cf565b9250925050613d1287878461417c565b613d1d8584836141b7565b98975050505050505050565b600080613d35836119b7565b6001600160a01b0316141580156108c957506040516302571be360e01b81526004810183905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613dae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dd29190615a25565b6001600160a01b03161492915050565b60008681526006602052604081208054613e01918791613c3c9061598e565b9050613e108682868686614458565b50505050505050565b60008080613e26886108cf565b9250925092506000613e5088600660008d81526020019081526020016000208054613c3c9061598e565b60008a8152600660205260409020805491925090613e6d9061598e565b9050600003613e90576000898152600660205260409020613e8e8282615c28565b505b613e9f89858886178589614201565b6001600160a01b038716613ebd57613eb8896000614366565b610bfc565b610bfc84888b60001c600160405180602001604052806000815250614628565b6201ffff1962020000831601613efd57613efa6276a70082615c07565b90505b428167ffffffffffffffff161015613f7a5762010000821615613f755760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b613f9f565b6004821615613f9f5760405163a2a7201360e01b81526004810184905260240161088a565b604082166000036109de5750506000908152600360205260409020805473ffffffffffffffffffffffffffffffffffffffff19169055565b6001600160a01b0384163b15613bdb5760405163bc197c8160e01b81526001600160a01b0385169063bc197c819061401b9089908990889088908890600401615ce8565b6020604051808303816000875af1925050508015614056575060408051601f3d908101601f1916820190925261405391810190615d3a565b60015b61410b57614062615d57565b806308c379a00361409b5750614076615d73565b80614081575061409d565b8060405162461bcd60e51b815260040161088a9190614e3c565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560448201527f526563656976657220696d706c656d656e746572000000000000000000000000606482015260840161088a565b6001600160e01b0319811663bc197c8160e01b14613e105760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161088a565b63ffff000082161580159060018316159082906141965750805b156114e45760405163a2a7201360e01b81526004810186905260240161088a565b60008167ffffffffffffffff168467ffffffffffffffff1611156141d9578193505b8267ffffffffffffffff168467ffffffffffffffff1610156141f9578293505b509192915050565b61420d858585846142c1565b60405163ffffffff8416815285907f39873f00c80f4f94b7bd1594aebcf650f003545b74824d57ddf4939e3ff3a34b9060200160405180910390a28167ffffffffffffffff168167ffffffffffffffff1611156114e45760405167ffffffffffffffff8216815285907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b132906020015b60405180910390a25050505050565b6000806142b7836108cf565b5090949350505050565b6142cb8483614955565b60008481526001602052604090206001600160a01b03841663ffffffff60a01b60a085901b16176001600160c01b031960c084901b161790556119b1565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b614371826001612326565b156143925760405163a2a7201360e01b81526004810183905260240161088a565b61439b82614559565b604051635b0fc9c360e01b8152600481018390526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b15801561440557600080fd5b505af1158015614419573d6000803e3d6000fd5b50506040516001600160a01b03841681528492507fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49150602001613057565b6144648584848461498e565b847f8ce7013e8abebc55c3890a68f5a27c67c3f7efa64e584de5fb22363c606fd3408585858560405161429c9493929190615dfd565b60008060006144a9858561477a565b90925090508161451b57600185516144c19190615e45565b841461450f5760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d65000000604482015260640161088a565b50600091506108c99050565b614525858261449a565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b60008181526001602052604090205460a081901c60c082901c61457d8383836136b0565b6000868152600360209081526040808320805473ffffffffffffffffffffffffffffffffffffffff191690556001909152902063ffffffff60a01b60a083901b166001600160c01b031960c086901b1617905592506145d99050565b60408051858152600160208201526000916001600160a01b0386169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a450505050565b6000806000614636866108cf565b925092509250614647868383613edd565b8460011480156146685750876001600160a01b0316836001600160a01b0316145b6146c75760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b866001600160a01b0316836001600160a01b0316036146e8575050506114e4565b60008681526001602052604090206001600160a01b03881663ffffffff60a01b60a085901b16176001600160c01b031960c084901b1617905560408051878152602081018790526001600160a01b03808a1692908b169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611ccb338989898989614a02565b600080835183106147cd5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e64730000604482015260640161088a565b60008484815181106147e1576147e16159c8565b016020015160f81c9050801561480d5761480685614800866001615e58565b83614afe565b9250614812565b600092505b61481c8185615e58565b614827906001615e58565b9150509250929050565b6000818152600360205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091558190614873826119b7565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60606001835110156148ea576040517f280dacb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60ff8351111561492857826040517fe3ba295f00000000000000000000000000000000000000000000000000000000815260040161088a9190614e3c565b8251838360405160200161493e93929190615e6b565b604051602081830303815290604052905092915050565b61ffff81161580159061496d57506201000181811614155b15613c125760405163a2a7201360e01b81526004810183905260240161088a565b6149988483614955565b6000848152600160205260409020546001600160a01b038116156149f6576149bf85614559565b6040516000815285907fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49060200160405180910390a25b6114e485858585614b22565b6001600160a01b0384163b15613bdb5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190614a469089908990889088908890600401615ecc565b6020604051808303816000875af1925050508015614a81575060408051601f3d908101601f19168201909252614a7e91810190615d3a565b60015b614a8d57614062615d57565b6001600160e01b0319811663f23a6e6160e01b14613e105760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161088a565b8251600090614b0d8385615e58565b1115614b1857600080fd5b5091016020012090565b8360008080614b30846108cf565b9194509250905063ffff0000821667ffffffffffffffff8087169083161115614b57578195505b428267ffffffffffffffff1610614b6d57958617955b6001600160a01b03841615614bc45760405162461bcd60e51b815260206004820152601f60248201527f455243313135353a206d696e74206f66206578697374696e6720746f6b656e00604482015260640161088a565b6001600160a01b038816614c405760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b306001600160a01b03891603614cbe5760405162461bcd60e51b815260206004820152603460248201527f455243313135353a206e65774f776e65722063616e6e6f74206265207468652060448201527f4e616d655772617070657220636f6e7472616374000000000000000000000000606482015260840161088a565b60008581526001602052604090206001600160a01b03891663ffffffff60a01b60a08a901b16176001600160c01b031960c089901b1617905560408051868152600160208201526001600160a01b038a169160009133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4612dd33360008a88600160405180602001604052806000815250614a02565b6001600160a01b03811681146125ad57600080fd5b60008060408385031215614d8757600080fd5b8235614d9281614d5f565b946020939093013593505050565b600060208284031215614db257600080fd5b5035919050565b6001600160e01b0319811681146125ad57600080fd5b600060208284031215614de157600080fd5b813561099681614db9565b60005b83811015614e07578181015183820152602001614def565b50506000910152565b60008151808452614e28816020860160208601614dec565b601f01601f19169290920160200192915050565b6020815260006109966020830184614e10565b60008060408385031215614e6257600080fd5b823591506020830135614e7481614d5f565b809150509250929050565b803567ffffffffffffffff81168114614e9757600080fd5b919050565b60008060408385031215614eaf57600080fd5b82359150614ebf60208401614e7f565b90509250929050565b60008083601f840112614eda57600080fd5b50813567ffffffffffffffff811115614ef257600080fd5b602083019150836020828501011115614f0a57600080fd5b9250929050565b600080600080600060808688031215614f2957600080fd5b8535614f3481614d5f565b94506020860135614f4481614d5f565b935060408601359250606086013567ffffffffffffffff811115614f6757600080fd5b614f7388828901614ec8565b969995985093965092949392505050565b600060208284031215614f9657600080fd5b813561099681614d5f565b634e487b7160e01b600052604160045260246000fd5b601f8201601f1916810167ffffffffffffffff81118282101715614fdd57614fdd614fa1565b6040525050565b600067ffffffffffffffff821115614ffe57614ffe614fa1565b50601f01601f191660200190565b600082601f83011261501d57600080fd5b813561502881614fe4565b6040516150358282614fb7565b82815285602084870101111561504a57600080fd5b82602086016020830137600092810160200192909252509392505050565b803563ffffffff81168114614e9757600080fd5b600080600080600080600060e0888a03121561509757600080fd5b87359650602088013567ffffffffffffffff8111156150b557600080fd5b6150c18a828b0161500c565b96505060408801356150d281614d5f565b945060608801356150e281614d5f565b93506150f060808901614e7f565b92506150fe60a08901615068565b915061510c60c08901614e7f565b905092959891949750929550565b600067ffffffffffffffff82111561513457615134614fa1565b5060051b60200190565b600082601f83011261514f57600080fd5b8135602061515c8261511a565b6040516151698282614fb7565b83815260059390931b850182019282810191508684111561518957600080fd5b8286015b8481101561231b578035835291830191830161518d565b600080600080600060a086880312156151bc57600080fd5b85356151c781614d5f565b945060208601356151d781614d5f565b9350604086013567ffffffffffffffff808211156151f457600080fd5b61520089838a0161513e565b9450606088013591508082111561521657600080fd5b61522289838a0161513e565b9350608088013591508082111561523857600080fd5b506152458882890161500c565b9150509295509295909350565b6000806000806080858703121561526857600080fd5b843593506020850135925061527f60408601615068565b915061528d60608601614e7f565b905092959194509250565b803561ffff81168114614e9757600080fd5b600080604083850312156152bd57600080fd5b82359150614ebf60208401615298565b600080604083850312156152e057600080fd5b823567ffffffffffffffff808211156152f857600080fd5b818501915085601f83011261530c57600080fd5b813560206153198261511a565b6040516153268282614fb7565b83815260059390931b850182019282810191508984111561534657600080fd5b948201945b8386101561536d57853561535e81614d5f565b8252948201949082019061534b565b9650508601359250508082111561538357600080fd5b506148278582860161513e565b600081518084526020808501945080840160005b838110156153c0578151875295820195908201906001016153a4565b509495945050505050565b6020815260006109966020830184615390565b6000806000606084860312156153f357600080fd5b83356153fe81614d5f565b9250602084013561540e81614d5f565b929592945050506040919091013590565b60008060006060848603121561543457600080fd5b833592506020840135915061544b60408501614e7f565b90509250925092565b60008060006060848603121561546957600080fd5b83359250602084013561547b81614d5f565b9150604084013561548b81614d5f565b809150509250925092565b6000806000806000608086880312156154ae57600080fd5b853567ffffffffffffffff8111156154c557600080fd5b6154d188828901614ec8565b90965094505060208601356154e581614d5f565b92506154f360408701615298565b9150606086013561550381614d5f565b809150509295509295909350565b80151581146125ad57600080fd5b6000806040838503121561553257600080fd5b823561553d81614d5f565b91506020830135614e7481615511565b60008060008060008060a0878903121561556657600080fd5b863567ffffffffffffffff81111561557d57600080fd5b61558989828a01614ec8565b909750955050602087013561559d81614d5f565b93506040870135925060608701356155b481614d5f565b91506155c260808801615298565b90509295509295509295565b600080604083850312156155e157600080fd5b82359150614ebf60208401615068565b6000806040838503121561560457600080fd5b50508035926020909101359150565b60008060008060008060a0878903121561562c57600080fd5b86359550602087013567ffffffffffffffff81111561564a57600080fd5b61565689828a01614ec8565b909650945050604087013561566a81614d5f565b925061567860608801615068565b91506155c260808801614e7f565b6000806000806040858703121561569c57600080fd5b843567ffffffffffffffff808211156156b457600080fd5b6156c088838901614ec8565b909650945060208701359150808211156156d957600080fd5b506156e687828801614ec8565b95989497509550505050565b6000806000806080858703121561570857600080fd5b84359350602085013561571a81614d5f565b9250604085013561527f81614d5f565b60008060006060848603121561573f57600080fd5b8335925060208401359150604084013561548b81614d5f565b6000806040838503121561576b57600080fd5b823561577681614d5f565b91506020830135614e7481614d5f565b6000806000806060858703121561579c57600080fd5b843567ffffffffffffffff8111156157b357600080fd5b6157bf87828801614ec8565b90955093505060208501356157d381614d5f565b915060408501356157e381614d5f565b939692955090935050565b600080600080600060a0868803121561580657600080fd5b853561581181614d5f565b9450602086013561582181614d5f565b93506040860135925060608601359150608086013567ffffffffffffffff81111561584b57600080fd5b6152458882890161500c565b60006020828403121561586957600080fd5b815167ffffffffffffffff81111561588057600080fd5b8201601f8101841361589157600080fd5b805161589c81614fe4565b6040516158a98282614fb7565b8281528660208486010111156158be57600080fd5b610a73836020830160208701614dec565b600080600080608085870312156158e557600080fd5b843567ffffffffffffffff8111156158fc57600080fd5b6159088782880161500c565b945050602085013561591981614d5f565b925061592760408601615298565b915060608501356157e381614d5f565b60006020828403121561594957600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b67ffffffffffffffff81811683821601908082111561598757615987615950565b5092915050565b600181811c908216806159a257607f821691505b6020821081036159c257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b6000600182016159f0576159f0615950565b5060010190565b604081526000615a0a6040830185615390565b8281036020840152615a1c8185615390565b95945050505050565b600060208284031215615a3757600080fd5b815161099681614d5f565b600060208284031215615a5457600080fd5b815161099681615511565b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60c081526000615aac60c083018a8c615a6f565b6001600160a01b03898116602085015263ffffffff8916604085015267ffffffffffffffff881660608501528616608084015282810360a0840152615af2818587615a6f565b9b9a5050505050505050505050565b601f8211156109de57600081815260208120601f850160051c81016020861015615b285750805b601f850160051c820191505b81811015613bdb57828155600101615b34565b67ffffffffffffffff831115615b5f57615b5f614fa1565b615b7383615b6d835461598e565b83615b01565b6000601f841160018114615ba75760008515615b8f5750838201355b600019600387901b1c1916600186901b1783556114e4565b600083815260209020601f19861690835b82811015615bd85786850135825560209485019460019092019101615bb8565b5086821015615bf55760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b67ffffffffffffffff82811682821603908082111561598757615987615950565b815167ffffffffffffffff811115615c4257615c42614fa1565b615c5681615c50845461598e565b84615b01565b602080601f831160018114615c8b5760008415615c735750858301515b600019600386901b1c1916600185901b178555613bdb565b600085815260208120601f198616915b82811015615cba57888601518255948401946001909101908401615c9b565b5085821015615cd85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006001600160a01b03808816835280871660208401525060a06040830152615d1460a0830186615390565b8281036060840152615d268186615390565b90508281036080840152613d1d8185614e10565b600060208284031215615d4c57600080fd5b815161099681614db9565b600060033d1115615d705760046000803e5060005160e01c5b90565b600060443d1015615d815790565b6040516003193d81016004833e81513d67ffffffffffffffff8160248401118184111715615db157505050505090565b8285019150815181811115615dc95750505050505090565b843d8701016020828501011115615de35750505050505090565b615df260208286010187614fb7565b509095945050505050565b608081526000615e106080830187614e10565b6001600160a01b039590951660208301525063ffffffff92909216604083015267ffffffffffffffff16606090910152919050565b818103818111156108c9576108c9615950565b808201808211156108c9576108c9615950565b7fff000000000000000000000000000000000000000000000000000000000000008460f81b16815260008351615ea8816001850160208801614dec565b835190830190615ebf816001840160208801614dec565b0160010195945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152615f0460a0830184614e10565b97965050505050505056fea26469706673582212203420d6b763d82b1b590fea45d804e16953e66816411da10be7022bec2bfbbe2064736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "allFusesBurned(bytes32,uint32)": { + "params": { + "fuseMask": "The fuses you want to check", + "node": "Namehash of the name" + }, + "returns": { + "_0": "Boolean of whether or not all the selected fuses are burned" + } + }, + "approve(address,uint256)": { + "params": { + "to": "address to approve", + "tokenId": "name to approve" + } + }, + "balanceOf(address,uint256)": { + "details": "See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address." + }, + "balanceOfBatch(address[],uint256[])": { + "details": "See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length." + }, + "canExtendSubnames(bytes32,address)": { + "params": { + "addr": "which address to check permissions for", + "node": "namehash of the name to check" + }, + "returns": { + "_0": "whether or not is owner/operator or approved" + } + }, + "canModifyName(bytes32,address)": { + "params": { + "addr": "which address to check permissions for", + "node": "namehash of the name to check" + }, + "returns": { + "_0": "whether or not is owner or operator" + } + }, + "extendExpiry(bytes32,bytes32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "labelhash": "Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')", + "parentNode": "Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')" + }, + "returns": { + "_0": "New expiry" + } + }, + "getApproved(uint256)": { + "params": { + "id": "Namehash of the name" + }, + "returns": { + "operator": "Approved operator of a name" + } + }, + "getData(uint256)": { + "params": { + "id": "Namehash of the name" + }, + "returns": { + "expiry": "Expiry of the name", + "fuses": "Fuses of the name", + "owner": "Owner of the name" + } + }, + "isApprovedForAll(address,address)": { + "details": "See {IERC1155-isApprovedForAll}." + }, + "isWrapped(bytes32)": { + "params": { + "node": "Namehash of the name" + }, + "returns": { + "_0": "Boolean of whether or not the name is wrapped" + } + }, + "isWrapped(bytes32,bytes32)": { + "params": { + "labelhash": "Namehash of the name", + "parentNode": "Namehash of the name" + }, + "returns": { + "_0": "Boolean of whether or not the name is wrapped" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "ownerOf(uint256)": { + "params": { + "id": "Label as a string of the .eth domain to wrap" + }, + "returns": { + "owner": "The owner of the name" + } + }, + "recoverFunds(address,address,uint256)": { + "details": "The contract is Ownable and only the owner can call the recover function.", + "params": { + "_amount": "The amount of tokens to recover.", + "_to": "The address to send the tokens to.", + "_token": "The address of the ERC20 token to recover" + } + }, + "registerAndWrapETH2LD(string,address,uint256,address,uint16)": { + "details": "Registers a new .eth second-level domain and wraps it. Only callable by authorised controllers.", + "params": { + "duration": "The duration, in seconds, to register the name for.", + "label": "The label to register (Eg, 'foo' for 'foo.eth').", + "ownerControlledFuses": "Initial owner-controlled fuses to set", + "resolver": "The resolver address to set on the ENS registry (optional).", + "wrappedOwner": "The owner of the wrapped name." + }, + "returns": { + "registrarExpiry": "The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch." + } + }, + "renew(uint256,uint256)": { + "details": "Only callable by authorised controllers.", + "params": { + "duration": "The number of seconds to renew the name for.", + "tokenId": "The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth')." + }, + "returns": { + "expires": "The expiry date of the name on the .eth registrar, in seconds since the Unix epoch." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)": { + "details": "See {IERC1155-safeBatchTransferFrom}." + }, + "safeTransferFrom(address,address,uint256,uint256,bytes)": { + "details": "See {IERC1155-safeTransferFrom}." + }, + "setApprovalForAll(address,bool)": { + "details": "See {IERC1155-setApprovalForAll}." + }, + "setChildFuses(bytes32,bytes32,uint32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "fuses": "Fuses to burn", + "labelhash": "Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')", + "parentNode": "Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')" + } + }, + "setFuses(bytes32,uint16)": { + "params": { + "node": "Namehash of the name", + "ownerControlledFuses": "Owner-controlled fuses to burn" + }, + "returns": { + "_0": "Old fuses" + } + }, + "setMetadataService(address)": { + "params": { + "_metadataService": "The new metadata service" + } + }, + "setRecord(bytes32,address,address,uint64)": { + "params": { + "node": "Namehash of the name to set a record for", + "owner": "New owner in the registry", + "resolver": "Resolver contract", + "ttl": "Time to live in the registry" + } + }, + "setResolver(bytes32,address)": { + "params": { + "node": "namehash of the name", + "resolver": "the resolver contract" + } + }, + "setSubnodeOwner(bytes32,string,address,uint32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "fuses": "Initial fuses for the wrapped subdomain", + "label": "Label of the subdomain as a string", + "owner": "New owner in the wrapper", + "parentNode": "Parent namehash of the subdomain" + }, + "returns": { + "node": "Namehash of the subdomain" + } + }, + "setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "fuses": "initial fuses for the wrapped subdomain", + "label": "label of the subdomain as a string", + "owner": "new owner in the wrapper", + "parentNode": "parent namehash of the subdomain", + "resolver": "resolver contract in the registry", + "ttl": "ttl in the registry" + }, + "returns": { + "node": "Namehash of the subdomain" + } + }, + "setTTL(bytes32,uint64)": { + "params": { + "node": "Namehash of the name", + "ttl": "TTL in the registry" + } + }, + "setUpgradeContract(address)": { + "details": "The default value of upgradeContract is the 0 address. Use the 0 address at any time to make the contract not upgradable.", + "params": { + "_upgradeAddress": "address of an upgraded contract" + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "unwrap(bytes32,bytes32,address)": { + "details": "Can be called by the owner in the wrapper or an authorised caller in the wrapper", + "params": { + "controller": "Sets the owner in the registry to this address", + "labelhash": "Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')", + "parentNode": "Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')" + } + }, + "unwrapETH2LD(bytes32,address,address)": { + "details": "Can be called by the owner in the wrapper or an authorised caller in the wrapper", + "params": { + "controller": "Sets the owner in the registry to this address", + "labelhash": "Labelhash of the .eth domain", + "registrant": "Sets the owner in the .eth registrar to this address" + } + }, + "upgrade(bytes,bytes)": { + "details": "Can be called by the owner or an authorised caller", + "params": { + "extraData": "Extra data to pass to the upgrade contract", + "name": "The name to upgrade, in DNS format" + } + }, + "uri(uint256)": { + "params": { + "tokenId": "The id of the token" + }, + "returns": { + "_0": "string uri of the metadata service" + } + }, + "wrap(bytes,address,address)": { + "details": "Can be called by the owner in the registry or an authorised caller in the registry", + "params": { + "name": "The name to wrap, in DNS format", + "resolver": "Resolver contract", + "wrappedOwner": "Owner of the name in this contract" + } + }, + "wrapETH2LD(string,address,uint16,address)": { + "details": "Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar", + "params": { + "label": "Label as a string of the .eth domain to wrap", + "ownerControlledFuses": "Initial owner-controlled fuses to set", + "resolver": "Resolver contract address", + "wrappedOwner": "Owner of the name in this contract" + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "allFusesBurned(bytes32,uint32)": { + "notice": "Checks all Fuses in the mask are burned for the node" + }, + "approve(address,uint256)": { + "notice": "Approves an address for a name" + }, + "canExtendSubnames(bytes32,address)": { + "notice": "Checks if owner/operator or approved by owner" + }, + "canModifyName(bytes32,address)": { + "notice": "Checks if owner or operator of the owner" + }, + "extendExpiry(bytes32,bytes32,uint64)": { + "notice": "Extends expiry for a name" + }, + "getApproved(uint256)": { + "notice": "Gets the owner of a name" + }, + "getData(uint256)": { + "notice": "Gets the data for a name" + }, + "isWrapped(bytes32)": { + "notice": "Checks if a name is wrapped" + }, + "isWrapped(bytes32,bytes32)": { + "notice": "Checks if a name is wrapped in a more gas efficient way" + }, + "ownerOf(uint256)": { + "notice": "Gets the owner of a name" + }, + "recoverFunds(address,address,uint256)": { + "notice": "Recover ERC20 tokens sent to the contract by mistake." + }, + "renew(uint256,uint256)": { + "notice": "Renews a .eth second-level domain." + }, + "setChildFuses(bytes32,bytes32,uint32,uint64)": { + "notice": "Sets fuses of a name that you own the parent of" + }, + "setFuses(bytes32,uint16)": { + "notice": "Sets fuses of a name" + }, + "setMetadataService(address)": { + "notice": "Set the metadata service. Only the owner can do this" + }, + "setRecord(bytes32,address,address,uint64)": { + "notice": "Sets records for the name in the ENS Registry" + }, + "setResolver(bytes32,address)": { + "notice": "Sets resolver contract in the registry" + }, + "setSubnodeOwner(bytes32,string,address,uint32,uint64)": { + "notice": "Sets the subdomain owner in the registry and then wraps the subdomain" + }, + "setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)": { + "notice": "Sets the subdomain owner in the registry with records and then wraps the subdomain" + }, + "setTTL(bytes32,uint64)": { + "notice": "Sets TTL in the registry" + }, + "setUpgradeContract(address)": { + "notice": "Set the address of the upgradeContract of the contract. only admin can do this" + }, + "unwrap(bytes32,bytes32,address)": { + "notice": "Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain" + }, + "unwrapETH2LD(bytes32,address,address)": { + "notice": "Unwraps a .eth domain. e.g. vitalik.eth" + }, + "upgrade(bytes,bytes)": { + "notice": "Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain" + }, + "uri(uint256)": { + "notice": "Get the metadata uri" + }, + "wrap(bytes,address,address)": { + "notice": "Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain" + }, + "wrapETH2LD(string,address,uint16,address)": { + "notice": "Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 444, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 19886, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_tokens", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 19892, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_operatorApprovals", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" + }, + { + "astId": 19896, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_tokenApprovals", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_address)" + }, + { + "astId": 19817, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "controllers", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 21358, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "metadataService", + "offset": 0, + "slot": "5", + "type": "t_contract(IMetadataService)20860" + }, + { + "astId": 21362, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "names", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_bytes32,t_bytes_storage)" + }, + { + "astId": 21380, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "upgradeContract", + "offset": 0, + "slot": "7", + "type": "t_contract(INameWrapperUpgrade)21252" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(IMetadataService)20860": { + "encoding": "inplace", + "label": "contract IMetadataService", + "numberOfBytes": "20" + }, + "t_contract(INameWrapperUpgrade)21252": { + "encoding": "inplace", + "label": "contract INameWrapperUpgrade", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_bytes32,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint256,t_address)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/OffchainDNSResolver.json b/solidity/dns-contracts/deployments/mainnet/OffchainDNSResolver.json new file mode 100644 index 0000000..19f70ba --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/OffchainDNSResolver.json @@ -0,0 +1,238 @@ +{ + "address": "0xF142B308cF687d4358410a4cB885513b30A42025", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract DNSSEC", + "name": "_oracle", + "type": "address" + }, + { + "internalType": "string", + "name": "_gatewayURL", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "CouldNotResolve", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidOperation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "string[]", + "name": "urls", + "type": "string[]" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes4", + "name": "callbackFunction", + "type": "bytes4" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "OffchainLookup", + "type": "error" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gatewayURL", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract DNSSEC", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "response", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "resolveCallback", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0xf3766f296d6514d11a2caef1366c09fc8d4990a6a1e2849b0a1261b6e33f0994", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0xF142B308cF687d4358410a4cB885513b30A42025", + "transactionIndex": 99, + "gasUsed": "1860432", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xf5441d1eeefc3e10593222ed48649d2cb17282b669f65b3a54b0d59ca1bd592b", + "transactionHash": "0xf3766f296d6514d11a2caef1366c09fc8d4990a6a1e2849b0a1261b6e33f0994", + "logs": [], + "blockNumber": 19020689, + "cumulativeGasUsed": "7259998", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0x0fc3152971714E5ed7723FAFa650F86A4BaF30C5", + "https://dnssec-oracle.ens.domains/" + ], + "numDeployments": 1, + "solcInputHash": "dd9e022689821cffaeb04b9ddbda87ae", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract DNSSEC\",\"name\":\"_oracle\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_gatewayURL\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"CouldNotResolve\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidOperation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"string[]\",\"name\":\"urls\",\"type\":\"string[]\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes4\",\"name\":\"callbackFunction\",\"type\":\"bytes4\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"OffchainLookup\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gatewayURL\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract DNSSEC\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"response\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"resolveCallback\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnsregistrar/OffchainDNSResolver.sol\":\"OffchainDNSResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-2-Clause\\npragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for appending to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n let fpm := add(32, add(ptr, capacity))\\n if lt(fpm, ptr) {\\n revert(0, 0)\\n }\\n mstore(0x40, fpm)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n uint off = buf.buf.length;\\n uint newCapacity = off + len;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(newCapacity, buflen) {\\n mstore(bufptr, newCapacity)\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return append(buf, data, data.length);\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint offPlusOne = off + 1;\\n if (off >= buf.capacity) {\\n resize(buf, offPlusOne * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if gt(offPlusOne, mload(bufptr)) {\\n mstore(bufptr, offPlusOne)\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return append(buf, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return append(buf, data, 32);\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n return buf;\\n }\\n}\\n\",\"keccak256\":\"0xd6dd3b0b327288f8e1b711a609f4040fea602e2ad4bba9febdf2f33b4e56eb0c\",\"license\":\"BSD-2-Clause\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/dnsregistrar/OffchainDNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"../../contracts/resolvers/profiles/IAddrResolver.sol\\\";\\nimport \\\"../../contracts/resolvers/profiles/IExtendedResolver.sol\\\";\\nimport \\\"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"../dnssec-oracle/BytesUtils.sol\\\";\\nimport \\\"../dnssec-oracle/DNSSEC.sol\\\";\\nimport \\\"../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"../registry/ENSRegistry.sol\\\";\\nimport \\\"../utils/HexUtils.sol\\\";\\n\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {LowLevelCallUtils} from \\\"../utils/LowLevelCallUtils.sol\\\";\\n\\nerror InvalidOperation();\\nerror OffchainLookup(\\n address sender,\\n string[] urls,\\n bytes callData,\\n bytes4 callbackFunction,\\n bytes extraData\\n);\\n\\ninterface IDNSGateway {\\n function resolve(\\n bytes memory name,\\n uint16 qtype\\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\\n}\\n\\nuint16 constant CLASS_INET = 1;\\nuint16 constant TYPE_TXT = 16;\\n\\ncontract OffchainDNSResolver is IExtendedResolver, IERC165 {\\n using RRUtils for *;\\n using Address for address;\\n using BytesUtils for bytes;\\n using HexUtils for bytes;\\n\\n ENS public immutable ens;\\n DNSSEC public immutable oracle;\\n string public gatewayURL;\\n\\n error CouldNotResolve(bytes name);\\n\\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\\n ens = _ens;\\n oracle = _oracle;\\n gatewayURL = _gatewayURL;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) external pure override returns (bool) {\\n return interfaceId == type(IExtendedResolver).interfaceId;\\n }\\n\\n function resolve(\\n bytes calldata name,\\n bytes calldata data\\n ) external view returns (bytes memory) {\\n revertWithDefaultOffchainLookup(name, data);\\n }\\n\\n function resolveCallback(\\n bytes calldata response,\\n bytes calldata extraData\\n ) external view returns (bytes memory) {\\n (bytes memory name, bytes memory query, bytes4 selector) = abi.decode(\\n extraData,\\n (bytes, bytes, bytes4)\\n );\\n\\n if (selector != bytes4(0)) {\\n (bytes memory targetData, address targetResolver) = abi.decode(\\n query,\\n (bytes, address)\\n );\\n return\\n callWithOffchainLookupPropagation(\\n targetResolver,\\n name,\\n query,\\n abi.encodeWithSelector(\\n selector,\\n response,\\n abi.encode(targetData, address(this))\\n )\\n );\\n }\\n\\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\\n response,\\n (DNSSEC.RRSetWithSignature[])\\n );\\n\\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\\n for (\\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\\n !iter.done();\\n iter.next()\\n ) {\\n // Ignore records with wrong name, type, or class\\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\\n if (\\n !rrname.equals(name) ||\\n iter.class != CLASS_INET ||\\n iter.dnstype != TYPE_TXT\\n ) {\\n continue;\\n }\\n\\n // Look for a valid ENS-DNS TXT record\\n (address dnsresolver, bytes memory context) = parseRR(\\n iter.data,\\n iter.rdataOffset,\\n iter.nextOffset\\n );\\n\\n // If we found a valid record, try to resolve it\\n if (dnsresolver != address(0)) {\\n if (\\n IERC165(dnsresolver).supportsInterface(\\n IExtendedDNSResolver.resolve.selector\\n )\\n ) {\\n return\\n callWithOffchainLookupPropagation(\\n dnsresolver,\\n name,\\n query,\\n abi.encodeCall(\\n IExtendedDNSResolver.resolve,\\n (name, query, context)\\n )\\n );\\n } else if (\\n IERC165(dnsresolver).supportsInterface(\\n IExtendedResolver.resolve.selector\\n )\\n ) {\\n return\\n callWithOffchainLookupPropagation(\\n dnsresolver,\\n name,\\n query,\\n abi.encodeCall(\\n IExtendedResolver.resolve,\\n (name, query)\\n )\\n );\\n } else {\\n (bool ok, bytes memory ret) = address(dnsresolver)\\n .staticcall(query);\\n if (ok) {\\n return ret;\\n } else {\\n revert CouldNotResolve(name);\\n }\\n }\\n }\\n }\\n\\n // No valid records; revert.\\n revert CouldNotResolve(name);\\n }\\n\\n function parseRR(\\n bytes memory data,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal view returns (address, bytes memory) {\\n bytes memory txt = readTXT(data, idx, lastIdx);\\n\\n // Must start with the magic word\\n if (txt.length < 5 || !txt.equals(0, \\\"ENS1 \\\", 0, 5)) {\\n return (address(0), \\\"\\\");\\n }\\n\\n // Parse the name or address\\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \\\" \\\");\\n if (lastTxtIdx > txt.length) {\\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\\n return (dnsResolver, \\\"\\\");\\n } else {\\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\\n return (\\n dnsResolver,\\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\\n );\\n }\\n }\\n\\n function readTXT(\\n bytes memory data,\\n uint256 startIdx,\\n uint256 lastIdx\\n ) internal pure returns (bytes memory) {\\n // TODO: Concatenate multiple text fields\\n uint256 fieldLength = data.readUint8(startIdx);\\n assert(startIdx + fieldLength < lastIdx);\\n return data.substring(startIdx + 1, fieldLength);\\n }\\n\\n function parseAndResolve(\\n bytes memory nameOrAddress,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal view returns (address) {\\n if (nameOrAddress[idx] == \\\"0\\\" && nameOrAddress[idx + 1] == \\\"x\\\") {\\n (address ret, bool valid) = nameOrAddress.hexToAddress(\\n idx + 2,\\n lastIdx\\n );\\n if (valid) {\\n return ret;\\n }\\n }\\n return resolveName(nameOrAddress, idx, lastIdx);\\n }\\n\\n function resolveName(\\n bytes memory name,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal view returns (address) {\\n bytes32 node = textNamehash(name, idx, lastIdx);\\n address resolver = ens.resolver(node);\\n if (resolver == address(0)) {\\n return address(0);\\n }\\n return IAddrResolver(resolver).addr(node);\\n }\\n\\n /**\\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\\n * @param name Name to hash\\n * @param idx Index to start at\\n * @param lastIdx Index to end at\\n */\\n function textNamehash(\\n bytes memory name,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal view returns (bytes32) {\\n uint256 separator = name.find(idx, name.length - idx, bytes1(\\\".\\\"));\\n bytes32 parentNode = bytes32(0);\\n if (separator < lastIdx) {\\n parentNode = textNamehash(name, separator + 1, lastIdx);\\n } else {\\n separator = lastIdx;\\n }\\n return\\n keccak256(\\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\\n );\\n }\\n\\n function callWithOffchainLookupPropagation(\\n address target,\\n bytes memory name,\\n bytes memory innerdata,\\n bytes memory data\\n ) internal view returns (bytes memory) {\\n if (!target.isContract()) {\\n revertWithDefaultOffchainLookup(name, innerdata);\\n }\\n\\n bool result = LowLevelCallUtils.functionStaticCall(\\n address(target),\\n data\\n );\\n uint256 size = LowLevelCallUtils.returnDataSize();\\n if (result) {\\n bytes memory returnData = LowLevelCallUtils.readReturnData(0, size);\\n return abi.decode(returnData, (bytes));\\n }\\n // Failure\\n if (size >= 4) {\\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\\n if (bytes4(errorId) == OffchainLookup.selector) {\\n // Offchain lookup. Decode the revert message and create our own that nests it.\\n bytes memory revertData = LowLevelCallUtils.readReturnData(\\n 4,\\n size - 4\\n );\\n handleOffchainLookupError(revertData, target, name);\\n }\\n }\\n LowLevelCallUtils.propagateRevert();\\n }\\n\\n function revertWithDefaultOffchainLookup(\\n bytes memory name,\\n bytes memory data\\n ) internal view {\\n string[] memory urls = new string[](1);\\n urls[0] = gatewayURL;\\n\\n revert OffchainLookup(\\n address(this),\\n urls,\\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\\n OffchainDNSResolver.resolveCallback.selector,\\n abi.encode(name, data, bytes4(0))\\n );\\n }\\n\\n function handleOffchainLookupError(\\n bytes memory returnData,\\n address target,\\n bytes memory name\\n ) internal view {\\n (\\n address sender,\\n string[] memory urls,\\n bytes memory callData,\\n bytes4 innerCallbackFunction,\\n bytes memory extraData\\n ) = abi.decode(returnData, (address, string[], bytes, bytes4, bytes));\\n\\n if (sender != target) {\\n revert InvalidOperation();\\n }\\n\\n revert OffchainLookup(\\n address(this),\\n urls,\\n callData,\\n OffchainDNSResolver.resolveCallback.selector,\\n abi.encode(name, extraData, innerCallbackFunction)\\n );\\n }\\n}\\n\",\"keccak256\":\"0xdd7f8c44e6e73d5c90a942e8059296c5781cd4e2257623aa1eeb5fd3e60aec85\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/DNSSEC.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nabstract contract DNSSEC {\\n bytes public anchors;\\n\\n struct RRSetWithSignature {\\n bytes rrset;\\n bytes sig;\\n }\\n\\n event AlgorithmUpdated(uint8 id, address addr);\\n event DigestUpdated(uint8 id, address addr);\\n\\n function verifyRRSet(\\n RRSetWithSignature[] memory input\\n ) external view virtual returns (bytes memory rrs, uint32 inception);\\n\\n function verifyRRSet(\\n RRSetWithSignature[] memory input,\\n uint256 now\\n ) public view virtual returns (bytes memory rrs, uint32 inception);\\n}\\n\",\"keccak256\":\"0xee6a236a59e5db8418c98ee4640a91987d26533c02d305cc6c7a37a3ac4ee907\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n */\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint256 labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes memory ret) {\\n uint256 len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint256 labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint256 constant RRSIG_TYPE = 0;\\n uint256 constant RRSIG_ALGORITHM = 2;\\n uint256 constant RRSIG_LABELS = 3;\\n uint256 constant RRSIG_TTL = 4;\\n uint256 constant RRSIG_EXPIRATION = 8;\\n uint256 constant RRSIG_INCEPTION = 12;\\n uint256 constant RRSIG_KEY_TAG = 16;\\n uint256 constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(\\n bytes memory data\\n ) internal pure returns (SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(\\n RRSIG_SIGNER_NAME + self.signerName.length,\\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\\n );\\n }\\n\\n function rrs(\\n SignedSet memory rrset\\n ) internal pure returns (RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint256 offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint256 rdataOffset;\\n uint256 nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns (bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint256 rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.offset,\\n nameLength(iter.data, iter.offset)\\n );\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(\\n RRIterator memory iter\\n ) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.rdataOffset,\\n iter.nextOffset - iter.rdataOffset\\n );\\n }\\n\\n uint256 constant DNSKEY_FLAGS = 0;\\n uint256 constant DNSKEY_PROTOCOL = 2;\\n uint256 constant DNSKEY_ALGORITHM = 3;\\n uint256 constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(\\n offset + DNSKEY_PUBKEY,\\n length - DNSKEY_PUBKEY\\n );\\n }\\n\\n uint256 constant DS_KEY_TAG = 0;\\n uint256 constant DS_ALGORITHM = 2;\\n uint256 constant DS_DIGEST_TYPE = 3;\\n uint256 constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n function isSubdomainOf(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n uint256 off = 0;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n while (counts > othercounts) {\\n off = progress(self, off);\\n counts--;\\n }\\n\\n return self.equals(off, other, 0);\\n }\\n\\n function compareNames(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint256 off;\\n uint256 otheroff;\\n uint256 prevoff;\\n uint256 otherprevoff;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if (otheroff == 0) {\\n return 1;\\n }\\n\\n return\\n self.compare(\\n prevoff + 1,\\n self.readUint8(prevoff),\\n other,\\n otherprevoff + 1,\\n other.readUint8(otherprevoff)\\n );\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(\\n uint32 i1,\\n uint32 i2\\n ) internal pure returns (bool) {\\n unchecked {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n }\\n\\n function progress(\\n bytes memory body,\\n uint256 off\\n ) internal pure returns (uint256) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint256 ac1;\\n uint256 ac2;\\n for (uint256 i = 0; i < data.length + 31; i += 32) {\\n uint256 word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if (i + 32 > data.length) {\\n uint256 unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 +=\\n (word &\\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\\n 8;\\n ac2 += (word &\\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 =\\n (ac1 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac1 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac2 =\\n (ac2 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac2 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 =\\n (ac1 &\\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\\n 32);\\n ac1 =\\n (ac1 &\\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\\n 64);\\n ac1 =\\n (ac1 &\\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\\n (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4dd68a6efd7c38f6b0e95ca0c056ecb74f88583da650b1a8639e6e78be36fede\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/registry/ENSRegistry.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"./ENS.sol\\\";\\n\\n/**\\n * The ENS registry contract.\\n */\\ncontract ENSRegistry is ENS {\\n struct Record {\\n address owner;\\n address resolver;\\n uint64 ttl;\\n }\\n\\n mapping(bytes32 => Record) records;\\n mapping(address => mapping(address => bool)) operators;\\n\\n // Permits modifications only by the owner of the specified node.\\n modifier authorised(bytes32 node) {\\n address owner = records[node].owner;\\n require(owner == msg.sender || operators[owner][msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Constructs a new ENS registry.\\n */\\n constructor() public {\\n records[0x0].owner = msg.sender;\\n }\\n\\n /**\\n * @dev Sets the record for a node.\\n * @param node The node to update.\\n * @param owner The address of the new owner.\\n * @param resolver The address of the resolver.\\n * @param ttl The TTL in seconds.\\n */\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external virtual override {\\n setOwner(node, owner);\\n _setResolverAndTTL(node, resolver, ttl);\\n }\\n\\n /**\\n * @dev Sets the record for a subnode.\\n * @param node The parent node.\\n * @param label The hash of the label specifying the subnode.\\n * @param owner The address of the new owner.\\n * @param resolver The address of the resolver.\\n * @param ttl The TTL in seconds.\\n */\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external virtual override {\\n bytes32 subnode = setSubnodeOwner(node, label, owner);\\n _setResolverAndTTL(subnode, resolver, ttl);\\n }\\n\\n /**\\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\\n * @param node The node to transfer ownership of.\\n * @param owner The address of the new owner.\\n */\\n function setOwner(\\n bytes32 node,\\n address owner\\n ) public virtual override authorised(node) {\\n _setOwner(node, owner);\\n emit Transfer(node, owner);\\n }\\n\\n /**\\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\\n * @param node The parent node.\\n * @param label The hash of the label specifying the subnode.\\n * @param owner The address of the new owner.\\n */\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) public virtual override authorised(node) returns (bytes32) {\\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\\n _setOwner(subnode, owner);\\n emit NewOwner(node, label, owner);\\n return subnode;\\n }\\n\\n /**\\n * @dev Sets the resolver address for the specified node.\\n * @param node The node to update.\\n * @param resolver The address of the resolver.\\n */\\n function setResolver(\\n bytes32 node,\\n address resolver\\n ) public virtual override authorised(node) {\\n emit NewResolver(node, resolver);\\n records[node].resolver = resolver;\\n }\\n\\n /**\\n * @dev Sets the TTL for the specified node.\\n * @param node The node to update.\\n * @param ttl The TTL in seconds.\\n */\\n function setTTL(\\n bytes32 node,\\n uint64 ttl\\n ) public virtual override authorised(node) {\\n emit NewTTL(node, ttl);\\n records[node].ttl = ttl;\\n }\\n\\n /**\\n * @dev Enable or disable approval for a third party (\\\"operator\\\") to manage\\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\\n * @param operator Address to add to the set of authorized operators.\\n * @param approved True if the operator is approved, false to revoke approval.\\n */\\n function setApprovalForAll(\\n address operator,\\n bool approved\\n ) external virtual override {\\n operators[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev Returns the address that owns the specified node.\\n * @param node The specified node.\\n * @return address of the owner.\\n */\\n function owner(\\n bytes32 node\\n ) public view virtual override returns (address) {\\n address addr = records[node].owner;\\n if (addr == address(this)) {\\n return address(0x0);\\n }\\n\\n return addr;\\n }\\n\\n /**\\n * @dev Returns the address of the resolver for the specified node.\\n * @param node The specified node.\\n * @return address of the resolver.\\n */\\n function resolver(\\n bytes32 node\\n ) public view virtual override returns (address) {\\n return records[node].resolver;\\n }\\n\\n /**\\n * @dev Returns the TTL of a node, and any records associated with it.\\n * @param node The specified node.\\n * @return ttl of the node.\\n */\\n function ttl(bytes32 node) public view virtual override returns (uint64) {\\n return records[node].ttl;\\n }\\n\\n /**\\n * @dev Returns whether a record has been imported to the registry.\\n * @param node The specified node.\\n * @return Bool if record exists\\n */\\n function recordExists(\\n bytes32 node\\n ) public view virtual override returns (bool) {\\n return records[node].owner != address(0x0);\\n }\\n\\n /**\\n * @dev Query if an address is an authorized operator for another address.\\n * @param owner The address that owns the records.\\n * @param operator The address that acts on behalf of the owner.\\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\\n */\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view virtual override returns (bool) {\\n return operators[owner][operator];\\n }\\n\\n function _setOwner(bytes32 node, address owner) internal virtual {\\n records[node].owner = owner;\\n }\\n\\n function _setResolverAndTTL(\\n bytes32 node,\\n address resolver,\\n uint64 ttl\\n ) internal {\\n if (resolver != records[node].resolver) {\\n records[node].resolver = resolver;\\n emit NewResolver(node, resolver);\\n }\\n\\n if (ttl != records[node].ttl) {\\n records[node].ttl = ttl;\\n emit NewTTL(node, ttl);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa7a7a64fb980e521c991415e416fd4106a42f892479805e1daa51ecb0e2e5198\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedDNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedDNSResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data,\\n bytes memory context\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x541f8799c34ff9e7035d09f06ae0f0f8a16b6065e9b60a15670b957321630f72\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"contracts/utils/HexUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary HexUtils {\\n /**\\n * @dev Attempts to parse bytes32 from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexStringToBytes32(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (bytes32 r, bool valid) {\\n uint256 hexLength = lastIdx - idx;\\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\\n revert(\\\"Invalid string length\\\");\\n }\\n valid = true;\\n assembly {\\n // check that the index to read to is not past the end of the string\\n if gt(lastIdx, mload(str)) {\\n revert(0, 0)\\n }\\n\\n function getHex(c) -> ascii {\\n // chars 48-57: 0-9\\n if and(gt(c, 47), lt(c, 58)) {\\n ascii := sub(c, 48)\\n leave\\n }\\n // chars 65-70: A-F\\n if and(gt(c, 64), lt(c, 71)) {\\n ascii := add(sub(c, 65), 10)\\n leave\\n }\\n // chars 97-102: a-f\\n if and(gt(c, 96), lt(c, 103)) {\\n ascii := add(sub(c, 97), 10)\\n leave\\n }\\n // invalid char\\n ascii := 0xff\\n }\\n\\n let ptr := add(str, 32)\\n for {\\n let i := idx\\n } lt(i, lastIdx) {\\n i := add(i, 2)\\n } {\\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\\n // if either byte is invalid, set invalid and break loop\\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\\n valid := false\\n break\\n }\\n let combined := or(shl(4, byte1), byte2)\\n r := or(shl(8, r), combined)\\n }\\n }\\n }\\n\\n /**\\n * @dev Attempts to parse an address from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexToAddress(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (address, bool) {\\n if (lastIdx - idx < 40) return (address(0x0), false);\\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\\n return (address(uint160(uint256(r))), valid);\\n }\\n}\\n\",\"keccak256\":\"0x4a8a9c72d6f3effb80b310faa6dc273e7adbc3b949df9c7a42e290e5b13519f3\",\"license\":\"MIT\"},\"contracts/utils/LowLevelCallUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.13;\\n\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nlibrary LowLevelCallUtils {\\n using Address for address;\\n\\n /**\\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\\n * `returnDataSize` and `readReturnData`.\\n * @param target The address to staticcall.\\n * @param data The data to pass to the call.\\n * @return success True if the call succeeded, or false if it reverts.\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data\\n ) internal view returns (bool success) {\\n require(\\n target.isContract(),\\n \\\"LowLevelCallUtils: static call to non-contract\\\"\\n );\\n assembly {\\n success := staticcall(\\n gas(),\\n target,\\n add(data, 32),\\n mload(data),\\n 0,\\n 0\\n )\\n }\\n }\\n\\n /**\\n * @dev Returns the size of the return data of the most recent external call.\\n */\\n function returnDataSize() internal pure returns (uint256 len) {\\n assembly {\\n len := returndatasize()\\n }\\n }\\n\\n /**\\n * @dev Reads return data from the most recent external call.\\n * @param offset Offset into the return data.\\n * @param length Number of bytes to return.\\n */\\n function readReturnData(\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (bytes memory data) {\\n data = new bytes(length);\\n assembly {\\n returndatacopy(add(data, 32), offset, length)\\n }\\n }\\n\\n /**\\n * @dev Reverts with the return data from the most recent external call.\\n */\\n function propagateRevert() internal pure {\\n assembly {\\n returndatacopy(0, 0, returndatasize())\\n revert(0, returndatasize())\\n }\\n }\\n}\\n\",\"keccak256\":\"0x20d3d0d14fab6fc079f90d630a51bb8e274431ca929591ec8d62383ce946cb3a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c06040523480156200001157600080fd5b50604051620022743803806200227483398101604081905262000034916200008e565b6001600160a01b03808416608052821660a05260006200005582826200021d565b50505050620002e9565b6001600160a01b03811681146200007557600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215620000a457600080fd5b8351620000b1816200005f565b80935050602080850151620000c6816200005f565b60408601519093506001600160401b0380821115620000e457600080fd5b818701915087601f830112620000f957600080fd5b8151818111156200010e576200010e62000078565b604051601f8201601f19908116603f0116810190838211818310171562000139576200013962000078565b816040528281528a868487010111156200015257600080fd5b600093505b8284101562000176578484018601518185018701529285019262000157565b60008684830101528096505050505050509250925092565b600181811c90821680620001a357607f821691505b602082108103620001c457634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200021857600081815260208120601f850160051c81016020861015620001f35750805b601f850160051c820191505b818110156200021457828155600101620001ff565b5050505b505050565b81516001600160401b0381111562000239576200023962000078565b62000251816200024a84546200018e565b84620001ca565b602080601f831160018114620002895760008415620002705750858301515b600019600386901b1c1916600185901b17855562000214565b600085815260208120601f198616915b82811015620002ba5788860151825594840194600190910190840162000299565b5085821015620002d95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a051611f586200031c60003960008181610109015261033201526000818160b501526111d50152611f586000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c80637dc0d1d0116100505780637dc0d1d0146101045780639061b9231461012b578063b4a858011461013e57600080fd5b806301ffc9a7146100775780633f15457f146100b057806352539968146100ef575b600080fd5b61009b610085366004611507565b6001600160e01b031916639061b92360e01b1490565b60405190151581526020015b60405180910390f35b6100d77f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a7565b6100f7610151565b6040516100a79190611574565b6100d77f000000000000000000000000000000000000000000000000000000000000000081565b6100f76101393660046115d0565b6101df565b6100f761014c3660046115d0565b61025c565b6000805461015e9061163c565b80601f016020809104026020016040519081016040528092919081815260200182805461018a9061163c565b80156101d75780601f106101ac576101008083540402835291602001916101d7565b820191906000526020600020905b8154815290600101906020018083116101ba57829003601f168201915b505050505081565b606061025485858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f890181900481028201810190925287815292508791508690819084018382808284376000920191909152506106b792505050565b949350505050565b60606000808061026e85870187611764565b919450925090506001600160e01b031981161561031e576000808380602001905181019061029c9190611841565b91509150610312818686868e8e88306040516020016102bc929190611893565b60408051601f19818403018152908290526102db9392916024016118be565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610848565b95505050505050610254565b600061032c888a018a611920565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bdf95fef836040518263ffffffff1660e01b815260040161037c9190611a2c565b600060405180830381865afa158015610399573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103c19190810190611ab1565b50905060006103d08282610916565b90505b8051516020820151101561069b5760006103f58260000151836020015161097d565b90506104018188610998565b15806104165750606082015161ffff16600114155b8061042a5750604082015161ffff16601014155b15610435575061068d565b60008061044f84600001518560a001518660c001516109bd565b90925090506001600160a01b03821615610689576040516301ffc9a760e01b815263477cc53f60e11b60048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa1580156104ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d29190611b01565b1561053157610521828a8a8c8c866040516024016104f293929190611b23565b60408051601f198184030181529190526020810180516001600160e01b031663477cc53f60e11b179052610848565b9950505050505050505050610254565b6040516301ffc9a760e01b8152639061b92360e01b60048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa15801561057c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a09190611b01565b156105ed57610521828a8a8c8c6040516024016105be929190611b5c565b60408051601f198184030181529190526020810180516001600160e01b0316639061b92360e01b179052610848565b600080836001600160a01b03168a6040516106089190611b81565b600060405180830381855afa9150503d8060008114610643576040519150601f19603f3d011682016040523d82523d6000602084013e610648565b606091505b50915091508115610665579a506102549950505050505050505050565b8a6040516314d3b60360e11b81526004016106809190611574565b60405180910390fd5b5050505b61069681610b05565b6103d3565b50846040516314d3b60360e11b81526004016106809190611574565b604080516001808252818301909252600091816020015b60608152602001906001900390816106ce579050509050600080546106f29061163c565b80601f016020809104026020016040519081016040528092919081815260200182805461071e9061163c565b801561076b5780601f106107405761010080835404028352916020019161076b565b820191906000526020600020905b81548152906001019060200180831161074e57829003601f168201915b50505050508160008151811061078357610783611b9d565b602002602001018190525030818460106040516024016107a4929190611bb3565b60408051601f19818403018152918152602080830180516001600160e01b03167f31b137b90000000000000000000000000000000000000000000000000000000017905290517fb4a85801000000000000000000000000000000000000000000000000000000009161081d918991899160009101611bd9565b60408051601f1981840301815290829052630556f18360e41b82526106809594939291600401611c19565b60606001600160a01b0385163b6108635761086384846106b7565b600061086f8684610bed565b90503d81156108a5576000610885600083610c7f565b90508080602001905181019061089b9190611cc5565b9350505050610254565b600481106109045760006108bb60006004610c7f565b9050630556f18360e41b6108ce82611cfa565b6001600160e01b031916036109025760006108f360046108ee8186611d48565b610c7f565b9050610900818a8a610cd4565b505b505b61090c610d65565b5050949350505050565b6109646040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261097781610b05565b92915050565b6060600061098b8484610d6f565b9050610254848483610dc9565b6000815183511480156109b657506109b68360008460008751610e4b565b9392505050565b6000606060006109ce868686610e6e565b9050600581511080610a2357506040805180820190915260058082527f454e5331200000000000000000000000000000000000000000000000000000006020830152610a21918391600091908290610e4b565b155b15610a41575050604080516020810190915260008082529150610afd565b6000610a7e6005808451610a559190611d48565b8491907f2000000000000000000000000000000000000000000000000000000000000000610eb8565b90508151811115610ab5576000610a988360058551610f54565b6040805160208101909152600081529095509350610afd92505050565b6000610ac383600584610f54565b905080610af5610ad4846001611d5b565b6001858751610ae39190611d48565b610aed9190611d48565b869190610dc9565b945094505050505b935093915050565b60c08101516020820181905281515111610b1c5750565b6000610b3082600001518360200151610d6f565b8260200151610b3f9190611d5b565b8251909150610b4e908261105e565b61ffff166040830152610b62600282611d5b565b8251909150610b71908261105e565b61ffff166060830152610b85600282611d5b565b8251909150610b949082611086565b63ffffffff166080830152610baa600482611d5b565b8251909150600090610bbc908361105e565b61ffff169050610bcd600283611d5b565b60a084018190529150610be08183611d5b565b60c0909301929092525050565b60006001600160a01b0383163b610c6c5760405162461bcd60e51b815260206004820152602e60248201527f4c6f774c6576656c43616c6c5574696c733a207374617469632063616c6c207460448201527f6f206e6f6e2d636f6e74726163740000000000000000000000000000000000006064820152608401610680565b600080835160208501865afa9392505050565b60608167ffffffffffffffff811115610c9a57610c9a611676565b6040519080825280601f01601f191660200182016040528015610cc4576020820181803683370190505b5090508183602083013e92915050565b600080600080600087806020019051810190610cf09190611d7e565b94509450945094509450866001600160a01b0316856001600160a01b031614610d45576040517f398d4d3200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b30848463b4a8580160e01b89858760405160200161081d93929190611bd9565b3d6000803e3d6000fd5b6000815b83518110610d8357610d83611eb4565b6000610d8f85836110b0565b60ff169050610d9f816001611d5b565b610da99083611d5b565b915080600003610db95750610dbf565b50610d73565b6102548382611d48565b8251606090610dd88385611d5b565b1115610de357600080fd5b60008267ffffffffffffffff811115610dfe57610dfe611676565b6040519080825280601f01601f191660200182016040528015610e28576020820181803683370190505b50905060208082019086860101610e408282876110d4565b509095945050505050565b6000610e5884848461112a565b610e6387878561112a565b149695505050505050565b60606000610e7c85856110b0565b60ff16905082610e8c8286611d5b565b10610e9957610e99611eb4565b610eaf610ea7856001611d5b565b869083610dc9565b95945050505050565b6000835b610ec68486611d5b565b811015610f4757827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916868281518110610f0257610f02611b9d565b01602001517fff000000000000000000000000000000000000000000000000000000000000001603610f35579050610254565b80610f3f81611eca565b915050610ebc565b5060001995945050505050565b6000838381518110610f6857610f68611b9d565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f3000000000000000000000000000000000000000000000000000000000000000148015611020575083610fc5846001611d5b565b81518110610fd557610fd5611b9d565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f7800000000000000000000000000000000000000000000000000000000000000145b156110535760008061103e611036866002611d5b565b87908661114e565b915091508015611050575090506109b6565b50505b61025484848461118a565b815160009061106e836002611d5b565b111561107957600080fd5b50016002015161ffff1690565b8151600090611096836004611d5b565b11156110a157600080fd5b50016004015163ffffffff1690565b60008282815181106110c4576110c4611b9d565b016020015160f81c905092915050565b6020811061110c57815183526110eb602084611d5b565b92506110f8602083611d5b565b9150611105602082611d48565b90506110d4565b905182516020929092036101000a6000190180199091169116179052565b82516000906111398385611d5b565b111561114457600080fd5b5091016020012090565b600080602861115d8585611d48565b101561116e57506000905080610afd565b60008061117c8787876112e7565b909890975095505050505050565b60008061119885858561143b565b6040517f0178b8bf000000000000000000000000000000000000000000000000000000008152600481018290529091506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630178b8bf90602401602060405180830381865afa15801561121c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112409190611ee3565b90506001600160a01b03811661125b576000925050506109b6565b6040517f3b3b57de000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b03821690633b3b57de90602401602060405180830381865afa1580156112b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112dd9190611ee3565b9695505050505050565b600080806112f58585611d48565b905080604014158015611309575080602814155b8061131e575061131a600282611f00565b6001145b1561136b5760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610680565b60019150855184111561137d57600080fd5b6113ce565b6000603a8210602f8311161561139a5750602f190190565b604782106040831116156113b057506036190190565b606782106060831116156113c657506056190190565b5060ff919050565b60208601855b85811015611430576113eb8183015160001a611382565b6113fd6001830184015160001a611382565b60ff811460ff8314171561141657600095505050611430565b60049190911b1760089590951b94909417936002016113d4565b505050935093915050565b6000806114788485875161144f9190611d48565b8791907f2e00000000000000000000000000000000000000000000000000000000000000610eb8565b90506000838210156114a05761149986611493846001611d5b565b8661143b565b90506114a4565b8391505b806114bb866114b38186611d48565b89919061112a565b60408051602081019390935282015260600160405160208183030381529060405280519060200120925050509392505050565b6001600160e01b03198116811461150457600080fd5b50565b60006020828403121561151957600080fd5b81356109b6816114ee565b60005b8381101561153f578181015183820152602001611527565b50506000910152565b60008151808452611560816020860160208601611524565b601f01601f19169290920160200192915050565b6020815260006109b66020830184611548565b60008083601f84011261159957600080fd5b50813567ffffffffffffffff8111156115b157600080fd5b6020830191508360208285010111156115c957600080fd5b9250929050565b600080600080604085870312156115e657600080fd5b843567ffffffffffffffff808211156115fe57600080fd5b61160a88838901611587565b9096509450602087013591508082111561162357600080fd5b5061163087828801611587565b95989497509550505050565b600181811c9082168061165057607f821691505b60208210810361167057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156116af576116af611676565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156116de576116de611676565b604052919050565b600067ffffffffffffffff82111561170057611700611676565b50601f01601f191660200190565b600082601f83011261171f57600080fd5b813561173261172d826116e6565b6116b5565b81815284602083860101111561174757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561177957600080fd5b833567ffffffffffffffff8082111561179157600080fd5b61179d8783880161170e565b945060208601359150808211156117b357600080fd5b506117c08682870161170e565b92505060408401356117d1816114ee565b809150509250925092565b60006117ea61172d846116e6565b90508281528383830111156117fe57600080fd5b6109b6836020830184611524565b600082601f83011261181d57600080fd5b6109b6838351602085016117dc565b6001600160a01b038116811461150457600080fd5b6000806040838503121561185457600080fd5b825167ffffffffffffffff81111561186b57600080fd5b6118778582860161180c565b92505060208301516118888161182c565b809150509250929050565b6040815260006118a66040830185611548565b90506001600160a01b03831660208301529392505050565b60408152826040820152828460608301376000606084830101526000601f19601f850116820160608382030160208401526112dd6060820185611548565b600067ffffffffffffffff82111561191657611916611676565b5060051b60200190565b6000602080838503121561193357600080fd5b823567ffffffffffffffff8082111561194b57600080fd5b818501915085601f83011261195f57600080fd5b813561196d61172d826118fc565b81815260059190911b8301840190848101908883111561198c57600080fd5b8585015b83811015611a1f578035858111156119a85760008081fd5b86016040818c03601f19018113156119c05760008081fd5b6119c861168c565b89830135888111156119da5760008081fd5b6119e88e8c8387010161170e565b8252509082013590878211156119fe5760008081fd5b611a0c8d8b8486010161170e565b818b015285525050918601918601611990565b5098975050505050505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015611aa357888303603f1901855281518051878552611a7788860182611548565b91890151858303868b0152919050611a8f8183611548565b968901969450505090860190600101611a53565b509098975050505050505050565b60008060408385031215611ac457600080fd5b825167ffffffffffffffff811115611adb57600080fd5b611ae78582860161180c565b925050602083015163ffffffff8116811461188857600080fd5b600060208284031215611b1357600080fd5b815180151581146109b657600080fd5b606081526000611b366060830186611548565b8281036020840152611b488186611548565b905082810360408401526112dd8185611548565b604081526000611b6f6040830185611548565b8281036020840152610eaf8185611548565b60008251611b93818460208701611524565b9190910192915050565b634e487b7160e01b600052603260045260246000fd5b604081526000611bc66040830185611548565b905061ffff831660208301529392505050565b606081526000611bec6060830186611548565b8281036020840152611bfe8186611548565b9150506001600160e01b031983166040830152949350505050565b600060a082016001600160a01b0388168352602060a08185015281885180845260c08601915060c08160051b8701019350828a0160005b82811015611c7e5760bf19888703018452611c6c868351611548565b95509284019290840190600101611c50565b50505050508281036040840152611c958187611548565b6001600160e01b03198616606085015290508281036080840152611cb98185611548565b98975050505050505050565b600060208284031215611cd757600080fd5b815167ffffffffffffffff811115611cee57600080fd5b6102548482850161180c565b6000815160208301516001600160e01b031980821693506004831015611d2a5780818460040360031b1b83161693505b505050919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561097757610977611d32565b8082018082111561097757610977611d32565b8051611d79816114ee565b919050565b600080600080600060a08688031215611d9657600080fd5b8551611da18161182c565b8095505060208087015167ffffffffffffffff80821115611dc157600080fd5b818901915089601f830112611dd557600080fd5b8151611de361172d826118fc565b81815260059190911b8301840190848101908c831115611e0257600080fd5b8585015b83811015611e4f57805185811115611e1e5760008081fd5b8601603f81018f13611e305760008081fd5b611e418f89830151604084016117dc565b845250918601918601611e06565b5060408c01519099509450505080831115611e6957600080fd5b611e758a848b0161180c565b9550611e8360608a01611d6e565b94506080890151925080831115611e9957600080fd5b5050611ea78882890161180c565b9150509295509295909350565b634e487b7160e01b600052600160045260246000fd5b600060018201611edc57611edc611d32565b5060010190565b600060208284031215611ef557600080fd5b81516109b68161182c565b600082611f1d57634e487b7160e01b600052601260045260246000fd5b50069056fea26469706673582212209e2b76b2a7a2481b01072a4220752eb6ab94e104ea14aab19b0274e492f0578164736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100725760003560e01c80637dc0d1d0116100505780637dc0d1d0146101045780639061b9231461012b578063b4a858011461013e57600080fd5b806301ffc9a7146100775780633f15457f146100b057806352539968146100ef575b600080fd5b61009b610085366004611507565b6001600160e01b031916639061b92360e01b1490565b60405190151581526020015b60405180910390f35b6100d77f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a7565b6100f7610151565b6040516100a79190611574565b6100d77f000000000000000000000000000000000000000000000000000000000000000081565b6100f76101393660046115d0565b6101df565b6100f761014c3660046115d0565b61025c565b6000805461015e9061163c565b80601f016020809104026020016040519081016040528092919081815260200182805461018a9061163c565b80156101d75780601f106101ac576101008083540402835291602001916101d7565b820191906000526020600020905b8154815290600101906020018083116101ba57829003601f168201915b505050505081565b606061025485858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f890181900481028201810190925287815292508791508690819084018382808284376000920191909152506106b792505050565b949350505050565b60606000808061026e85870187611764565b919450925090506001600160e01b031981161561031e576000808380602001905181019061029c9190611841565b91509150610312818686868e8e88306040516020016102bc929190611893565b60408051601f19818403018152908290526102db9392916024016118be565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610848565b95505050505050610254565b600061032c888a018a611920565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bdf95fef836040518263ffffffff1660e01b815260040161037c9190611a2c565b600060405180830381865afa158015610399573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103c19190810190611ab1565b50905060006103d08282610916565b90505b8051516020820151101561069b5760006103f58260000151836020015161097d565b90506104018188610998565b15806104165750606082015161ffff16600114155b8061042a5750604082015161ffff16601014155b15610435575061068d565b60008061044f84600001518560a001518660c001516109bd565b90925090506001600160a01b03821615610689576040516301ffc9a760e01b815263477cc53f60e11b60048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa1580156104ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d29190611b01565b1561053157610521828a8a8c8c866040516024016104f293929190611b23565b60408051601f198184030181529190526020810180516001600160e01b031663477cc53f60e11b179052610848565b9950505050505050505050610254565b6040516301ffc9a760e01b8152639061b92360e01b60048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa15801561057c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a09190611b01565b156105ed57610521828a8a8c8c6040516024016105be929190611b5c565b60408051601f198184030181529190526020810180516001600160e01b0316639061b92360e01b179052610848565b600080836001600160a01b03168a6040516106089190611b81565b600060405180830381855afa9150503d8060008114610643576040519150601f19603f3d011682016040523d82523d6000602084013e610648565b606091505b50915091508115610665579a506102549950505050505050505050565b8a6040516314d3b60360e11b81526004016106809190611574565b60405180910390fd5b5050505b61069681610b05565b6103d3565b50846040516314d3b60360e11b81526004016106809190611574565b604080516001808252818301909252600091816020015b60608152602001906001900390816106ce579050509050600080546106f29061163c565b80601f016020809104026020016040519081016040528092919081815260200182805461071e9061163c565b801561076b5780601f106107405761010080835404028352916020019161076b565b820191906000526020600020905b81548152906001019060200180831161074e57829003601f168201915b50505050508160008151811061078357610783611b9d565b602002602001018190525030818460106040516024016107a4929190611bb3565b60408051601f19818403018152918152602080830180516001600160e01b03167f31b137b90000000000000000000000000000000000000000000000000000000017905290517fb4a85801000000000000000000000000000000000000000000000000000000009161081d918991899160009101611bd9565b60408051601f1981840301815290829052630556f18360e41b82526106809594939291600401611c19565b60606001600160a01b0385163b6108635761086384846106b7565b600061086f8684610bed565b90503d81156108a5576000610885600083610c7f565b90508080602001905181019061089b9190611cc5565b9350505050610254565b600481106109045760006108bb60006004610c7f565b9050630556f18360e41b6108ce82611cfa565b6001600160e01b031916036109025760006108f360046108ee8186611d48565b610c7f565b9050610900818a8a610cd4565b505b505b61090c610d65565b5050949350505050565b6109646040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261097781610b05565b92915050565b6060600061098b8484610d6f565b9050610254848483610dc9565b6000815183511480156109b657506109b68360008460008751610e4b565b9392505050565b6000606060006109ce868686610e6e565b9050600581511080610a2357506040805180820190915260058082527f454e5331200000000000000000000000000000000000000000000000000000006020830152610a21918391600091908290610e4b565b155b15610a41575050604080516020810190915260008082529150610afd565b6000610a7e6005808451610a559190611d48565b8491907f2000000000000000000000000000000000000000000000000000000000000000610eb8565b90508151811115610ab5576000610a988360058551610f54565b6040805160208101909152600081529095509350610afd92505050565b6000610ac383600584610f54565b905080610af5610ad4846001611d5b565b6001858751610ae39190611d48565b610aed9190611d48565b869190610dc9565b945094505050505b935093915050565b60c08101516020820181905281515111610b1c5750565b6000610b3082600001518360200151610d6f565b8260200151610b3f9190611d5b565b8251909150610b4e908261105e565b61ffff166040830152610b62600282611d5b565b8251909150610b71908261105e565b61ffff166060830152610b85600282611d5b565b8251909150610b949082611086565b63ffffffff166080830152610baa600482611d5b565b8251909150600090610bbc908361105e565b61ffff169050610bcd600283611d5b565b60a084018190529150610be08183611d5b565b60c0909301929092525050565b60006001600160a01b0383163b610c6c5760405162461bcd60e51b815260206004820152602e60248201527f4c6f774c6576656c43616c6c5574696c733a207374617469632063616c6c207460448201527f6f206e6f6e2d636f6e74726163740000000000000000000000000000000000006064820152608401610680565b600080835160208501865afa9392505050565b60608167ffffffffffffffff811115610c9a57610c9a611676565b6040519080825280601f01601f191660200182016040528015610cc4576020820181803683370190505b5090508183602083013e92915050565b600080600080600087806020019051810190610cf09190611d7e565b94509450945094509450866001600160a01b0316856001600160a01b031614610d45576040517f398d4d3200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b30848463b4a8580160e01b89858760405160200161081d93929190611bd9565b3d6000803e3d6000fd5b6000815b83518110610d8357610d83611eb4565b6000610d8f85836110b0565b60ff169050610d9f816001611d5b565b610da99083611d5b565b915080600003610db95750610dbf565b50610d73565b6102548382611d48565b8251606090610dd88385611d5b565b1115610de357600080fd5b60008267ffffffffffffffff811115610dfe57610dfe611676565b6040519080825280601f01601f191660200182016040528015610e28576020820181803683370190505b50905060208082019086860101610e408282876110d4565b509095945050505050565b6000610e5884848461112a565b610e6387878561112a565b149695505050505050565b60606000610e7c85856110b0565b60ff16905082610e8c8286611d5b565b10610e9957610e99611eb4565b610eaf610ea7856001611d5b565b869083610dc9565b95945050505050565b6000835b610ec68486611d5b565b811015610f4757827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916868281518110610f0257610f02611b9d565b01602001517fff000000000000000000000000000000000000000000000000000000000000001603610f35579050610254565b80610f3f81611eca565b915050610ebc565b5060001995945050505050565b6000838381518110610f6857610f68611b9d565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f3000000000000000000000000000000000000000000000000000000000000000148015611020575083610fc5846001611d5b565b81518110610fd557610fd5611b9d565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f7800000000000000000000000000000000000000000000000000000000000000145b156110535760008061103e611036866002611d5b565b87908661114e565b915091508015611050575090506109b6565b50505b61025484848461118a565b815160009061106e836002611d5b565b111561107957600080fd5b50016002015161ffff1690565b8151600090611096836004611d5b565b11156110a157600080fd5b50016004015163ffffffff1690565b60008282815181106110c4576110c4611b9d565b016020015160f81c905092915050565b6020811061110c57815183526110eb602084611d5b565b92506110f8602083611d5b565b9150611105602082611d48565b90506110d4565b905182516020929092036101000a6000190180199091169116179052565b82516000906111398385611d5b565b111561114457600080fd5b5091016020012090565b600080602861115d8585611d48565b101561116e57506000905080610afd565b60008061117c8787876112e7565b909890975095505050505050565b60008061119885858561143b565b6040517f0178b8bf000000000000000000000000000000000000000000000000000000008152600481018290529091506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630178b8bf90602401602060405180830381865afa15801561121c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112409190611ee3565b90506001600160a01b03811661125b576000925050506109b6565b6040517f3b3b57de000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b03821690633b3b57de90602401602060405180830381865afa1580156112b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112dd9190611ee3565b9695505050505050565b600080806112f58585611d48565b905080604014158015611309575080602814155b8061131e575061131a600282611f00565b6001145b1561136b5760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610680565b60019150855184111561137d57600080fd5b6113ce565b6000603a8210602f8311161561139a5750602f190190565b604782106040831116156113b057506036190190565b606782106060831116156113c657506056190190565b5060ff919050565b60208601855b85811015611430576113eb8183015160001a611382565b6113fd6001830184015160001a611382565b60ff811460ff8314171561141657600095505050611430565b60049190911b1760089590951b94909417936002016113d4565b505050935093915050565b6000806114788485875161144f9190611d48565b8791907f2e00000000000000000000000000000000000000000000000000000000000000610eb8565b90506000838210156114a05761149986611493846001611d5b565b8661143b565b90506114a4565b8391505b806114bb866114b38186611d48565b89919061112a565b60408051602081019390935282015260600160405160208183030381529060405280519060200120925050509392505050565b6001600160e01b03198116811461150457600080fd5b50565b60006020828403121561151957600080fd5b81356109b6816114ee565b60005b8381101561153f578181015183820152602001611527565b50506000910152565b60008151808452611560816020860160208601611524565b601f01601f19169290920160200192915050565b6020815260006109b66020830184611548565b60008083601f84011261159957600080fd5b50813567ffffffffffffffff8111156115b157600080fd5b6020830191508360208285010111156115c957600080fd5b9250929050565b600080600080604085870312156115e657600080fd5b843567ffffffffffffffff808211156115fe57600080fd5b61160a88838901611587565b9096509450602087013591508082111561162357600080fd5b5061163087828801611587565b95989497509550505050565b600181811c9082168061165057607f821691505b60208210810361167057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156116af576116af611676565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156116de576116de611676565b604052919050565b600067ffffffffffffffff82111561170057611700611676565b50601f01601f191660200190565b600082601f83011261171f57600080fd5b813561173261172d826116e6565b6116b5565b81815284602083860101111561174757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561177957600080fd5b833567ffffffffffffffff8082111561179157600080fd5b61179d8783880161170e565b945060208601359150808211156117b357600080fd5b506117c08682870161170e565b92505060408401356117d1816114ee565b809150509250925092565b60006117ea61172d846116e6565b90508281528383830111156117fe57600080fd5b6109b6836020830184611524565b600082601f83011261181d57600080fd5b6109b6838351602085016117dc565b6001600160a01b038116811461150457600080fd5b6000806040838503121561185457600080fd5b825167ffffffffffffffff81111561186b57600080fd5b6118778582860161180c565b92505060208301516118888161182c565b809150509250929050565b6040815260006118a66040830185611548565b90506001600160a01b03831660208301529392505050565b60408152826040820152828460608301376000606084830101526000601f19601f850116820160608382030160208401526112dd6060820185611548565b600067ffffffffffffffff82111561191657611916611676565b5060051b60200190565b6000602080838503121561193357600080fd5b823567ffffffffffffffff8082111561194b57600080fd5b818501915085601f83011261195f57600080fd5b813561196d61172d826118fc565b81815260059190911b8301840190848101908883111561198c57600080fd5b8585015b83811015611a1f578035858111156119a85760008081fd5b86016040818c03601f19018113156119c05760008081fd5b6119c861168c565b89830135888111156119da5760008081fd5b6119e88e8c8387010161170e565b8252509082013590878211156119fe5760008081fd5b611a0c8d8b8486010161170e565b818b015285525050918601918601611990565b5098975050505050505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015611aa357888303603f1901855281518051878552611a7788860182611548565b91890151858303868b0152919050611a8f8183611548565b968901969450505090860190600101611a53565b509098975050505050505050565b60008060408385031215611ac457600080fd5b825167ffffffffffffffff811115611adb57600080fd5b611ae78582860161180c565b925050602083015163ffffffff8116811461188857600080fd5b600060208284031215611b1357600080fd5b815180151581146109b657600080fd5b606081526000611b366060830186611548565b8281036020840152611b488186611548565b905082810360408401526112dd8185611548565b604081526000611b6f6040830185611548565b8281036020840152610eaf8185611548565b60008251611b93818460208701611524565b9190910192915050565b634e487b7160e01b600052603260045260246000fd5b604081526000611bc66040830185611548565b905061ffff831660208301529392505050565b606081526000611bec6060830186611548565b8281036020840152611bfe8186611548565b9150506001600160e01b031983166040830152949350505050565b600060a082016001600160a01b0388168352602060a08185015281885180845260c08601915060c08160051b8701019350828a0160005b82811015611c7e5760bf19888703018452611c6c868351611548565b95509284019290840190600101611c50565b50505050508281036040840152611c958187611548565b6001600160e01b03198616606085015290508281036080840152611cb98185611548565b98975050505050505050565b600060208284031215611cd757600080fd5b815167ffffffffffffffff811115611cee57600080fd5b6102548482850161180c565b6000815160208301516001600160e01b031980821693506004831015611d2a5780818460040360031b1b83161693505b505050919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561097757610977611d32565b8082018082111561097757610977611d32565b8051611d79816114ee565b919050565b600080600080600060a08688031215611d9657600080fd5b8551611da18161182c565b8095505060208087015167ffffffffffffffff80821115611dc157600080fd5b818901915089601f830112611dd557600080fd5b8151611de361172d826118fc565b81815260059190911b8301840190848101908c831115611e0257600080fd5b8585015b83811015611e4f57805185811115611e1e5760008081fd5b8601603f81018f13611e305760008081fd5b611e418f89830151604084016117dc565b845250918601918601611e06565b5060408c01519099509450505080831115611e6957600080fd5b611e758a848b0161180c565b9550611e8360608a01611d6e565b94506080890151925080831115611e9957600080fd5b5050611ea78882890161180c565b9150509295509295909350565b634e487b7160e01b600052600160045260246000fd5b600060018201611edc57611edc611d32565b5060010190565b600060208284031215611ef557600080fd5b81516109b68161182c565b600082611f1d57634e487b7160e01b600052601260045260246000fd5b50069056fea26469706673582212209e2b76b2a7a2481b01072a4220752eb6ab94e104ea14aab19b0274e492f0578164736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "supportsInterface(bytes4)": { + "details": "Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 4878, + "contract": "contracts/dnsregistrar/OffchainDNSResolver.sol:OffchainDNSResolver", + "label": "gatewayURL", + "offset": 0, + "slot": "0", + "type": "t_string_storage" + } + ], + "types": { + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/P256SHA256Algorithm.json b/solidity/dns-contracts/deployments/mainnet/P256SHA256Algorithm.json new file mode 100644 index 0000000..b4465cd --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/P256SHA256Algorithm.json @@ -0,0 +1,82 @@ +{ + "address": "0x0faa24e538bA4620165933f68a9d142f79A68091", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "key", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xb2138ff9bf3e722a0872cf79213cae19374c24976888fe2d55b8d1bf064ae739", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0x0faa24e538bA4620165933f68a9d142f79A68091", + "transactionIndex": 81, + "gasUsed": "896222", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x71469d1efd1d40280686921cd3585a39755863aa110223c1ce6d51296d409f06", + "transactionHash": "0xb2138ff9bf3e722a0872cf79213cae19374c24976888fe2d55b8d1bf064ae739", + "logs": [], + "blockNumber": 19020683, + "cumulativeGasUsed": "6995824", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 2, + "solcInputHash": "dd9e022689821cffaeb04b9ddbda87ae", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"verify(bytes,bytes,bytes)\":{\"details\":\"Verifies a signature.\",\"params\":{\"data\":\"The signed data to verify.\",\"key\":\"The public key to verify with.\",\"signature\":\"The signature to verify.\"},\"returns\":{\"_0\":\"True iff the signature is valid.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol\":\"P256SHA256Algorithm\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n */\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata signature\\n ) external view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xaf6825f9852c69f8e36540821d067b4550dd2263497af9d645309b6a0c457ba6\"},\"contracts/dnssec-oracle/algorithms/EllipticCurve.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @title EllipticCurve\\n *\\n * @author Tilman Drerup;\\n *\\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\\n *\\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\\n * (https://github.com/orbs-network/elliptic-curve-solidity)\\n *\\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\\n *\\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\\n * condition 'rs[1] > lowSmax' in validateSignature().\\n */\\ncontract EllipticCurve {\\n // Set parameters for curve.\\n uint256 constant a =\\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\\n uint256 constant b =\\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\\n uint256 constant gx =\\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\\n uint256 constant gy =\\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\\n uint256 constant p =\\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\\n uint256 constant n =\\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\\n\\n uint256 constant lowSmax =\\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\\n\\n /**\\n * @dev Inverse of u in the field of modulo m.\\n */\\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\\n unchecked {\\n if (u == 0 || u == m || m == 0) return 0;\\n if (u > m) u = u % m;\\n\\n int256 t1;\\n int256 t2 = 1;\\n uint256 r1 = m;\\n uint256 r2 = u;\\n uint256 q;\\n\\n while (r2 != 0) {\\n q = r1 / r2;\\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\\n }\\n\\n if (t1 < 0) return (m - uint256(-t1));\\n\\n return uint256(t1);\\n }\\n }\\n\\n /**\\n * @dev Transform affine coordinates into projective coordinates.\\n */\\n function toProjectivePoint(\\n uint256 x0,\\n uint256 y0\\n ) internal pure returns (uint256[3] memory P) {\\n P[2] = addmod(0, 1, p);\\n P[0] = mulmod(x0, P[2], p);\\n P[1] = mulmod(y0, P[2], p);\\n }\\n\\n /**\\n * @dev Add two points in affine coordinates and return projective point.\\n */\\n function addAndReturnProjectivePoint(\\n uint256 x1,\\n uint256 y1,\\n uint256 x2,\\n uint256 y2\\n ) internal pure returns (uint256[3] memory P) {\\n uint256 x;\\n uint256 y;\\n (x, y) = add(x1, y1, x2, y2);\\n P = toProjectivePoint(x, y);\\n }\\n\\n /**\\n * @dev Transform from projective to affine coordinates.\\n */\\n function toAffinePoint(\\n uint256 x0,\\n uint256 y0,\\n uint256 z0\\n ) internal pure returns (uint256 x1, uint256 y1) {\\n uint256 z0Inv;\\n z0Inv = inverseMod(z0, p);\\n x1 = mulmod(x0, z0Inv, p);\\n y1 = mulmod(y0, z0Inv, p);\\n }\\n\\n /**\\n * @dev Return the zero curve in projective coordinates.\\n */\\n function zeroProj()\\n internal\\n pure\\n returns (uint256 x, uint256 y, uint256 z)\\n {\\n return (0, 1, 0);\\n }\\n\\n /**\\n * @dev Return the zero curve in affine coordinates.\\n */\\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\\n return (0, 0);\\n }\\n\\n /**\\n * @dev Check if the curve is the zero curve.\\n */\\n function isZeroCurve(\\n uint256 x0,\\n uint256 y0\\n ) internal pure returns (bool isZero) {\\n if (x0 == 0 && y0 == 0) {\\n return true;\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Check if a point in affine coordinates is on the curve.\\n */\\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\\n if (0 == x || x == p || 0 == y || y == p) {\\n return false;\\n }\\n\\n uint256 LHS = mulmod(y, y, p); // y^2\\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\\n\\n if (a != 0) {\\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\\n }\\n if (b != 0) {\\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\\n }\\n\\n return LHS == RHS;\\n }\\n\\n /**\\n * @dev Double an elliptic curve point in projective coordinates. See\\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\\n */\\n function twiceProj(\\n uint256 x0,\\n uint256 y0,\\n uint256 z0\\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\\n uint256 t;\\n uint256 u;\\n uint256 v;\\n uint256 w;\\n\\n if (isZeroCurve(x0, y0)) {\\n return zeroProj();\\n }\\n\\n u = mulmod(y0, z0, p);\\n u = mulmod(u, 2, p);\\n\\n v = mulmod(u, x0, p);\\n v = mulmod(v, y0, p);\\n v = mulmod(v, 2, p);\\n\\n x0 = mulmod(x0, x0, p);\\n t = mulmod(x0, 3, p);\\n\\n z0 = mulmod(z0, z0, p);\\n z0 = mulmod(z0, a, p);\\n t = addmod(t, z0, p);\\n\\n w = mulmod(t, t, p);\\n x0 = mulmod(2, v, p);\\n w = addmod(w, p - x0, p);\\n\\n x0 = addmod(v, p - w, p);\\n x0 = mulmod(t, x0, p);\\n y0 = mulmod(y0, u, p);\\n y0 = mulmod(y0, y0, p);\\n y0 = mulmod(2, y0, p);\\n y1 = addmod(x0, p - y0, p);\\n\\n x1 = mulmod(u, w, p);\\n\\n z1 = mulmod(u, u, p);\\n z1 = mulmod(z1, u, p);\\n }\\n\\n /**\\n * @dev Add two elliptic curve points in projective coordinates. See\\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\\n */\\n function addProj(\\n uint256 x0,\\n uint256 y0,\\n uint256 z0,\\n uint256 x1,\\n uint256 y1,\\n uint256 z1\\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\\n uint256 t0;\\n uint256 t1;\\n uint256 u0;\\n uint256 u1;\\n\\n if (isZeroCurve(x0, y0)) {\\n return (x1, y1, z1);\\n } else if (isZeroCurve(x1, y1)) {\\n return (x0, y0, z0);\\n }\\n\\n t0 = mulmod(y0, z1, p);\\n t1 = mulmod(y1, z0, p);\\n\\n u0 = mulmod(x0, z1, p);\\n u1 = mulmod(x1, z0, p);\\n\\n if (u0 == u1) {\\n if (t0 == t1) {\\n return twiceProj(x0, y0, z0);\\n } else {\\n return zeroProj();\\n }\\n }\\n\\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\\n }\\n\\n /**\\n * @dev Helper function that splits addProj to avoid too many local variables.\\n */\\n function addProj2(\\n uint256 v,\\n uint256 u0,\\n uint256 u1,\\n uint256 t1,\\n uint256 t0\\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\\n uint256 u;\\n uint256 u2;\\n uint256 u3;\\n uint256 w;\\n uint256 t;\\n\\n t = addmod(t0, p - t1, p);\\n u = addmod(u0, p - u1, p);\\n u2 = mulmod(u, u, p);\\n\\n w = mulmod(t, t, p);\\n w = mulmod(w, v, p);\\n u1 = addmod(u1, u0, p);\\n u1 = mulmod(u1, u2, p);\\n w = addmod(w, p - u1, p);\\n\\n x2 = mulmod(u, w, p);\\n\\n u3 = mulmod(u2, u, p);\\n u0 = mulmod(u0, u2, p);\\n u0 = addmod(u0, p - w, p);\\n t = mulmod(t, u0, p);\\n t0 = mulmod(t0, u3, p);\\n\\n y2 = addmod(t, p - t0, p);\\n\\n z2 = mulmod(u3, v, p);\\n }\\n\\n /**\\n * @dev Add two elliptic curve points in affine coordinates.\\n */\\n function add(\\n uint256 x0,\\n uint256 y0,\\n uint256 x1,\\n uint256 y1\\n ) internal pure returns (uint256, uint256) {\\n uint256 z0;\\n\\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\\n\\n return toAffinePoint(x0, y0, z0);\\n }\\n\\n /**\\n * @dev Double an elliptic curve point in affine coordinates.\\n */\\n function twice(\\n uint256 x0,\\n uint256 y0\\n ) internal pure returns (uint256, uint256) {\\n uint256 z0;\\n\\n (x0, y0, z0) = twiceProj(x0, y0, 1);\\n\\n return toAffinePoint(x0, y0, z0);\\n }\\n\\n /**\\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\\n */\\n function multiplyPowerBase2(\\n uint256 x0,\\n uint256 y0,\\n uint256 exp\\n ) internal pure returns (uint256, uint256) {\\n uint256 base2X = x0;\\n uint256 base2Y = y0;\\n uint256 base2Z = 1;\\n\\n for (uint256 i = 0; i < exp; i++) {\\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\\n }\\n\\n return toAffinePoint(base2X, base2Y, base2Z);\\n }\\n\\n /**\\n * @dev Multiply an elliptic curve point by a scalar.\\n */\\n function multiplyScalar(\\n uint256 x0,\\n uint256 y0,\\n uint256 scalar\\n ) internal pure returns (uint256 x1, uint256 y1) {\\n if (scalar == 0) {\\n return zeroAffine();\\n } else if (scalar == 1) {\\n return (x0, y0);\\n } else if (scalar == 2) {\\n return twice(x0, y0);\\n }\\n\\n uint256 base2X = x0;\\n uint256 base2Y = y0;\\n uint256 base2Z = 1;\\n uint256 z1 = 1;\\n x1 = x0;\\n y1 = y0;\\n\\n if (scalar % 2 == 0) {\\n x1 = y1 = 0;\\n }\\n\\n scalar = scalar >> 1;\\n\\n while (scalar > 0) {\\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\\n\\n if (scalar % 2 == 1) {\\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\\n }\\n\\n scalar = scalar >> 1;\\n }\\n\\n return toAffinePoint(x1, y1, z1);\\n }\\n\\n /**\\n * @dev Multiply the curve's generator point by a scalar.\\n */\\n function multipleGeneratorByScalar(\\n uint256 scalar\\n ) internal pure returns (uint256, uint256) {\\n return multiplyScalar(gx, gy, scalar);\\n }\\n\\n /**\\n * @dev Validate combination of message, signature, and public key.\\n */\\n function validateSignature(\\n bytes32 message,\\n uint256[2] memory rs,\\n uint256[2] memory Q\\n ) internal pure returns (bool) {\\n // To disambiguate between public key solutions, include comment below.\\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\\n // || rs[1] > lowSmax)\\n return false;\\n }\\n if (!isOnCurve(Q[0], Q[1])) {\\n return false;\\n }\\n\\n uint256 x1;\\n uint256 x2;\\n uint256 y1;\\n uint256 y2;\\n\\n uint256 sInv = inverseMod(rs[1], n);\\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\\n\\n if (P[2] == 0) {\\n return false;\\n }\\n\\n uint256 Px = inverseMod(P[2], p);\\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\\n\\n return Px % n == rs[0];\\n }\\n}\\n\",\"keccak256\":\"0xdee968ffbfcb9a05b7ed7845e2c55f438f5e09a80fc6024c751a1718137e1838\"},\"contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\nimport \\\"./EllipticCurve.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\n\\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\\n using BytesUtils for *;\\n\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata signature\\n ) external view override returns (bool) {\\n return\\n validateSignature(\\n sha256(data),\\n parseSignature(signature),\\n parseKey(key)\\n );\\n }\\n\\n function parseSignature(\\n bytes memory data\\n ) internal pure returns (uint256[2] memory) {\\n require(data.length == 64, \\\"Invalid p256 signature length\\\");\\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\\n }\\n\\n function parseKey(\\n bytes memory data\\n ) internal pure returns (uint256[2] memory) {\\n require(data.length == 68, \\\"Invalid p256 key length\\\");\\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\\n }\\n}\\n\",\"keccak256\":\"0x406e394eb659ee8c75345b9d3795e0061de2bd6567dd8035e76a19588850f0ea\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610f41806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e366004610dd4565b610057565b604051901515815260200160405180910390f35b60006101316002868660405161006e929190610e6e565b602060405180830381855afa15801561008b573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906100ae9190610e7e565b6100ed85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061013c92505050565b61012c8a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101cb92505050565b61024a565b979650505050505050565b610144610d56565b815160401461019a5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642070323536207369676e6174757265206c656e67746800000060448201526064015b60405180910390fd5b60408051808201909152806101b0846000610445565b81526020908101906101c3908590610445565b905292915050565b6101d3610d56565b81516044146102245760405162461bcd60e51b815260206004820152601760248201527f496e76616c69642070323536206b6579206c656e6774680000000000000000006044820152606401610191565b604080518082019091528061023a846004610445565b81526020016101c3846024610445565b8151600090158061027c575082517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc63255111155b8061028957506020830151155b156102965750600061043e565b815160208301516102a79190610469565b6102b35750600061043e565b6000808080806102ea88600160200201517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551610565565b905061035a7f6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c2967f4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f57fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551848d096105ff565b885160208a01518b5193985091955061039a929091907fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551908590096105ff565b909450915060006103ad868587866106cf565b60408101519091506000036103cb576000965050505050505061043e565b60006103ec8260026020020151600160601b63ffffffff60c01b0319610565565b9050600160601b63ffffffff60c01b0319808283098351098a519091506104337fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc63255183610ead565b149750505050505050505b9392505050565b8151600090610455836020610ee5565b111561046057600080fd5b50016020015190565b60008215806104855750600160601b63ffffffff60c01b031983145b8061048e575081155b806104a65750600160601b63ffffffff60c01b031982145b156104b35750600061055f565b6000600160601b63ffffffff60c01b031983840990506000600160601b63ffffffff60c01b031985600160601b63ffffffff60c01b0319878809099050600160601b63ffffffff60c01b0319807fffffffff00000001000000000000000000000000fffffffffffffffffffffffc870982089050600160601b63ffffffff60c01b03197f5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b820890501490505b92915050565b600082158061057357508183145b8061057c575081155b156105895750600061055f565b818311156105a4578183816105a0576105a0610e97565b0692505b600060018385835b81156105db578183816105c1576105c1610e97565b9495940485810290940393919283830290039190506105ac565b60008512156105f357505050908301915061055f9050565b50929695505050505050565b60008082600003610617576000805b915091506106c7565b826001036106295750839050826106c7565b8260020361063b5761060e85856106f5565b50839050828181600180610650600288610ead565b60000361065f57600094508495505b600187901c96505b86156106b357610678848484610725565b9195509350915061068a600288610ead565b6001036106a75761069f848484898986610983565b919750955090505b600187901c9650610667565b6106be868683610a88565b95509550505050505b935093915050565b6106d7610d74565b6000806106e687878787610ad8565b90925090506101318282610b0d565b600080600061070685856001610725565b91965094509050610718858583610a88565b92509250505b9250929050565b600080600080600080600061073a8a8a610b66565b156107535760006001819650965096505050505061097a565b600160601b63ffffffff60c01b0319888a099250600160601b63ffffffff60c01b0319600284099250600160601b63ffffffff60c01b03198a84099150600160601b63ffffffff60c01b03198983099150600160601b63ffffffff60c01b0319600283099150600160601b63ffffffff60c01b03198a8b099950600160601b63ffffffff60c01b031960038b099350600160601b63ffffffff60c01b03198889099750600160601b63ffffffff60c01b03197fffffffff00000001000000000000000000000000fffffffffffffffffffffffc89099750600160601b63ffffffff60c01b03198885089350600160601b63ffffffff60c01b03198485099050600160601b63ffffffff60c01b0319826002099950600160601b63ffffffff60c01b031961088e8b600160601b63ffffffff60c01b0319610ef8565b82089050600160601b63ffffffff60c01b03196108b982600160601b63ffffffff60c01b0319610ef8565b83089950600160601b63ffffffff60c01b03198a85099950600160601b63ffffffff60c01b0319838a099850600160601b63ffffffff60c01b0319898a099850600160601b63ffffffff60c01b0319896002099850600160601b63ffffffff60c01b03196109358a600160601b63ffffffff60c01b0319610ef8565b8b089550600160601b63ffffffff60c01b03198184099650600160601b63ffffffff60c01b03198384099450600160601b63ffffffff60c01b03198386099450505050505b93509350939050565b60008060008060008060006109988d8d610b66565b156109af5789898996509650965050505050610a7c565b6109b98a8a610b66565b156109d0578c8c8c96509650965050505050610a7c565b600160601b63ffffffff60c01b0319888d099350600160601b63ffffffff60c01b03198b8a099250600160601b63ffffffff60c01b0319888e099150600160601b63ffffffff60c01b03198b8b099050808203610a5257828403610a4857610a398d8d8d610725565b96509650965050505050610a7c565b6000600181610a39565b610a70600160601b63ffffffff60c01b0319898d0983838688610b8a565b91985096509450505050505b96509650969350505050565b6000806000610aa584600160601b63ffffffff60c01b0319610565565b9050600160601b63ffffffff60c01b03198187099250600160601b63ffffffff60c01b0319818609915050935093915050565b6000806000610aed8787600188886001610983565b91985096509050610aff878783610a88565b925092505094509492505050565b610b15610d74565b600160601b63ffffffff60c01b0319600160000860408201819052600160601b63ffffffff60c01b031990840981526040810151600160601b63ffffffff60c01b0319908309602082015292915050565b600082158015610b74575081155b15610b815750600161055f565b50600092915050565b600080808080808080600160601b63ffffffff60c01b0319610bba8b600160601b63ffffffff60c01b0319610ef8565b8a089050600160601b63ffffffff60c01b0319610be58c600160601b63ffffffff60c01b0319610ef8565b8d089450600160601b63ffffffff60c01b03198586099350600160601b63ffffffff60c01b03198182099150600160601b63ffffffff60c01b03198d83099150600160601b63ffffffff60c01b03198c8c089a50600160601b63ffffffff60c01b0319848c099a50600160601b63ffffffff60c01b0319610c748c600160601b63ffffffff60c01b0319610ef8565b83089150600160601b63ffffffff60c01b03198286099750600160601b63ffffffff60c01b03198585099250600160601b63ffffffff60c01b0319848d099b50600160601b63ffffffff60c01b0319610cdb83600160601b63ffffffff60c01b0319610ef8565b8d089b50600160601b63ffffffff60c01b03198c82099050600160601b63ffffffff60c01b0319838a099850600160601b63ffffffff60c01b0319610d2e8a600160601b63ffffffff60c01b0319610ef8565b82089650600160601b63ffffffff60c01b03198d840995505050505050955095509592505050565b60405180604001604052806002906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60008083601f840112610da457600080fd5b50813567ffffffffffffffff811115610dbc57600080fd5b60208301915083602082850101111561071e57600080fd5b60008060008060008060608789031215610ded57600080fd5b863567ffffffffffffffff80821115610e0557600080fd5b610e118a838b01610d92565b90985096506020890135915080821115610e2a57600080fd5b610e368a838b01610d92565b90965094506040890135915080821115610e4f57600080fd5b50610e5c89828a01610d92565b979a9699509497509295939492505050565b8183823760009101908152919050565b600060208284031215610e9057600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b600082610eca57634e487b7160e01b600052601260045260246000fd5b500690565b634e487b7160e01b600052601160045260246000fd5b8082018082111561055f5761055f610ecf565b8181038181111561055f5761055f610ecf56fea26469706673582212200a7cdc61343825b33e51ff653c60245b511afc3bf209bfd7831b5eded2744b1c64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e366004610dd4565b610057565b604051901515815260200160405180910390f35b60006101316002868660405161006e929190610e6e565b602060405180830381855afa15801561008b573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906100ae9190610e7e565b6100ed85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061013c92505050565b61012c8a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101cb92505050565b61024a565b979650505050505050565b610144610d56565b815160401461019a5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642070323536207369676e6174757265206c656e67746800000060448201526064015b60405180910390fd5b60408051808201909152806101b0846000610445565b81526020908101906101c3908590610445565b905292915050565b6101d3610d56565b81516044146102245760405162461bcd60e51b815260206004820152601760248201527f496e76616c69642070323536206b6579206c656e6774680000000000000000006044820152606401610191565b604080518082019091528061023a846004610445565b81526020016101c3846024610445565b8151600090158061027c575082517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc63255111155b8061028957506020830151155b156102965750600061043e565b815160208301516102a79190610469565b6102b35750600061043e565b6000808080806102ea88600160200201517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551610565565b905061035a7f6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c2967f4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f57fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551848d096105ff565b885160208a01518b5193985091955061039a929091907fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551908590096105ff565b909450915060006103ad868587866106cf565b60408101519091506000036103cb576000965050505050505061043e565b60006103ec8260026020020151600160601b63ffffffff60c01b0319610565565b9050600160601b63ffffffff60c01b0319808283098351098a519091506104337fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc63255183610ead565b149750505050505050505b9392505050565b8151600090610455836020610ee5565b111561046057600080fd5b50016020015190565b60008215806104855750600160601b63ffffffff60c01b031983145b8061048e575081155b806104a65750600160601b63ffffffff60c01b031982145b156104b35750600061055f565b6000600160601b63ffffffff60c01b031983840990506000600160601b63ffffffff60c01b031985600160601b63ffffffff60c01b0319878809099050600160601b63ffffffff60c01b0319807fffffffff00000001000000000000000000000000fffffffffffffffffffffffc870982089050600160601b63ffffffff60c01b03197f5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b820890501490505b92915050565b600082158061057357508183145b8061057c575081155b156105895750600061055f565b818311156105a4578183816105a0576105a0610e97565b0692505b600060018385835b81156105db578183816105c1576105c1610e97565b9495940485810290940393919283830290039190506105ac565b60008512156105f357505050908301915061055f9050565b50929695505050505050565b60008082600003610617576000805b915091506106c7565b826001036106295750839050826106c7565b8260020361063b5761060e85856106f5565b50839050828181600180610650600288610ead565b60000361065f57600094508495505b600187901c96505b86156106b357610678848484610725565b9195509350915061068a600288610ead565b6001036106a75761069f848484898986610983565b919750955090505b600187901c9650610667565b6106be868683610a88565b95509550505050505b935093915050565b6106d7610d74565b6000806106e687878787610ad8565b90925090506101318282610b0d565b600080600061070685856001610725565b91965094509050610718858583610a88565b92509250505b9250929050565b600080600080600080600061073a8a8a610b66565b156107535760006001819650965096505050505061097a565b600160601b63ffffffff60c01b0319888a099250600160601b63ffffffff60c01b0319600284099250600160601b63ffffffff60c01b03198a84099150600160601b63ffffffff60c01b03198983099150600160601b63ffffffff60c01b0319600283099150600160601b63ffffffff60c01b03198a8b099950600160601b63ffffffff60c01b031960038b099350600160601b63ffffffff60c01b03198889099750600160601b63ffffffff60c01b03197fffffffff00000001000000000000000000000000fffffffffffffffffffffffc89099750600160601b63ffffffff60c01b03198885089350600160601b63ffffffff60c01b03198485099050600160601b63ffffffff60c01b0319826002099950600160601b63ffffffff60c01b031961088e8b600160601b63ffffffff60c01b0319610ef8565b82089050600160601b63ffffffff60c01b03196108b982600160601b63ffffffff60c01b0319610ef8565b83089950600160601b63ffffffff60c01b03198a85099950600160601b63ffffffff60c01b0319838a099850600160601b63ffffffff60c01b0319898a099850600160601b63ffffffff60c01b0319896002099850600160601b63ffffffff60c01b03196109358a600160601b63ffffffff60c01b0319610ef8565b8b089550600160601b63ffffffff60c01b03198184099650600160601b63ffffffff60c01b03198384099450600160601b63ffffffff60c01b03198386099450505050505b93509350939050565b60008060008060008060006109988d8d610b66565b156109af5789898996509650965050505050610a7c565b6109b98a8a610b66565b156109d0578c8c8c96509650965050505050610a7c565b600160601b63ffffffff60c01b0319888d099350600160601b63ffffffff60c01b03198b8a099250600160601b63ffffffff60c01b0319888e099150600160601b63ffffffff60c01b03198b8b099050808203610a5257828403610a4857610a398d8d8d610725565b96509650965050505050610a7c565b6000600181610a39565b610a70600160601b63ffffffff60c01b0319898d0983838688610b8a565b91985096509450505050505b96509650969350505050565b6000806000610aa584600160601b63ffffffff60c01b0319610565565b9050600160601b63ffffffff60c01b03198187099250600160601b63ffffffff60c01b0319818609915050935093915050565b6000806000610aed8787600188886001610983565b91985096509050610aff878783610a88565b925092505094509492505050565b610b15610d74565b600160601b63ffffffff60c01b0319600160000860408201819052600160601b63ffffffff60c01b031990840981526040810151600160601b63ffffffff60c01b0319908309602082015292915050565b600082158015610b74575081155b15610b815750600161055f565b50600092915050565b600080808080808080600160601b63ffffffff60c01b0319610bba8b600160601b63ffffffff60c01b0319610ef8565b8a089050600160601b63ffffffff60c01b0319610be58c600160601b63ffffffff60c01b0319610ef8565b8d089450600160601b63ffffffff60c01b03198586099350600160601b63ffffffff60c01b03198182099150600160601b63ffffffff60c01b03198d83099150600160601b63ffffffff60c01b03198c8c089a50600160601b63ffffffff60c01b0319848c099a50600160601b63ffffffff60c01b0319610c748c600160601b63ffffffff60c01b0319610ef8565b83089150600160601b63ffffffff60c01b03198286099750600160601b63ffffffff60c01b03198585099250600160601b63ffffffff60c01b0319848d099b50600160601b63ffffffff60c01b0319610cdb83600160601b63ffffffff60c01b0319610ef8565b8d089b50600160601b63ffffffff60c01b03198c82099050600160601b63ffffffff60c01b0319838a099850600160601b63ffffffff60c01b0319610d2e8a600160601b63ffffffff60c01b0319610ef8565b82089650600160601b63ffffffff60c01b03198d840995505050505050955095509592505050565b60405180604001604052806002906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60008083601f840112610da457600080fd5b50813567ffffffffffffffff811115610dbc57600080fd5b60208301915083602082850101111561071e57600080fd5b60008060008060008060608789031215610ded57600080fd5b863567ffffffffffffffff80821115610e0557600080fd5b610e118a838b01610d92565b90985096506020890135915080821115610e2a57600080fd5b610e368a838b01610d92565b90965094506040890135915080821115610e4f57600080fd5b50610e5c89828a01610d92565b979a9699509497509295939492505050565b8183823760009101908152919050565b600060208284031215610e9057600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b600082610eca57634e487b7160e01b600052601260045260246000fd5b500690565b634e487b7160e01b600052601160045260246000fd5b8082018082111561055f5761055f610ecf565b8181038181111561055f5761055f610ecf56fea26469706673582212200a7cdc61343825b33e51ff653c60245b511afc3bf209bfd7831b5eded2744b1c64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "verify(bytes,bytes,bytes)": { + "details": "Verifies a signature.", + "params": { + "data": "The signed data to verify.", + "key": "The public key to verify with.", + "signature": "The signature to verify." + }, + "returns": { + "_0": "True iff the signature is valid." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/PublicResolver.json b/solidity/dns-contracts/deployments/mainnet/PublicResolver.json new file mode 100644 index 0000000..6a07ef3 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/PublicResolver.json @@ -0,0 +1,1662 @@ +{ + "address": "0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract INameWrapper", + "name": "wrapperAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_trustedETHController", + "type": "address" + }, + { + "internalType": "address", + "name": "_trustedReverseRegistrar", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + } + ], + "name": "ABIChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "AddrChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "Approved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "ContenthashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "record", + "type": "bytes" + } + ], + "name": "DNSRecordChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "DNSRecordDeleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "lastzonehash", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "zonehash", + "type": "bytes" + } + ], + "name": "DNSZonehashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "InterfaceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "PubkeyChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "string", + "name": "indexedKey", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "TextChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "newVersion", + "type": "uint64" + } + ], + "name": "VersionChanged", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentTypes", + "type": "uint256" + } + ], + "name": "ABI", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "clearRecords", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "contenthash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "dnsRecord", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + } + ], + "name": "hasDNSRecords", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "interfaceImplementer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "delegate", + "type": "address" + } + ], + "name": "isApprovedFor", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "nodehash", + "type": "bytes32" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicallWithNodeCheck", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "pubkey", + "outputs": [ + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "recordVersions", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setABI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "a", + "type": "bytes" + } + ], + "name": "setAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "setAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setContenthash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setDNSRecords", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "setInterface", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "newName", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "setPubkey", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "setText", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setZonehash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "text", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "zonehash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x97409a208eb9cecb969cde484434dca6589a8e533c963d13a2dc3df2ff2ba811", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63", + "transactionIndex": 95, + "gasUsed": "2768314", + "logsBloom": "0x00000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000010000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000008000040000000000000000000000000200000000005000000000000000000000000000000000000000000000000000000000000100000000000000001000000000000000000000", + "blockHash": "0x70ebaedbce1d0b82228f2268d415167f923f9474cd5dc1b1b59e718733ba953a", + "transactionHash": "0x97409a208eb9cecb969cde484434dca6589a8e533c963d13a2dc3df2ff2ba811", + "logs": [ + { + "transactionIndex": 95, + "blockNumber": 16925619, + "transactionHash": "0x97409a208eb9cecb969cde484434dca6589a8e533c963d13a2dc3df2ff2ba811", + "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "topics": [ + "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", + "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2", + "0xb7e1ee41082754786e6040112f63ab27e9cda80736a3f80f3e0727fd6d19cfba" + ], + "data": "0x0000000000000000000000000904dac3347ea47d208f3fd67402d039a3b99859", + "logIndex": 153, + "blockHash": "0x70ebaedbce1d0b82228f2268d415167f923f9474cd5dc1b1b59e718733ba953a" + } + ], + "blockNumber": 16925619, + "cumulativeGasUsed": "9246445", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401", + "0x253553366Da8546fC250F225fe3d25d0C782303b", + "0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb" + ], + "numDeployments": 1, + "solcInputHash": "3fa59c31b7672c86eff32031f5a10f8a", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract INameWrapper\",\"name\":\"wrapperAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_trustedETHController\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_trustedReverseRegistrar\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"}],\"name\":\"ABIChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"AddrChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"newAddress\",\"type\":\"bytes\"}],\"name\":\"AddressChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"Approved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"ContenthashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"record\",\"type\":\"bytes\"}],\"name\":\"DNSRecordChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"DNSRecordDeleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"lastzonehash\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"zonehash\",\"type\":\"bytes\"}],\"name\":\"DNSZonehashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"InterfaceChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NameChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"PubkeyChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"indexedKey\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"TextChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"newVersion\",\"type\":\"uint64\"}],\"name\":\"VersionChanged\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentTypes\",\"type\":\"uint256\"}],\"name\":\"ABI\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"clearRecords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"contenthash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"dnsRecord\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"hasDNSRecords\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"interfaceImplementer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"}],\"name\":\"isApprovedFor\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nodehash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicallWithNodeCheck\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"pubkey\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"recordVersions\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setABI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"a\",\"type\":\"bytes\"}],\"name\":\"setAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"setAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setContenthash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setDNSRecords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"setInterface\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"newName\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"setPubkey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"setText\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setZonehash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"}],\"name\":\"text\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"zonehash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"ABI(bytes32,uint256)\":{\"params\":{\"contentTypes\":\"A bitwise OR of the ABI formats accepted by the caller.\",\"node\":\"The ENS node to query\"},\"returns\":{\"_0\":\"contentType The content type of the return value\",\"_1\":\"data The ABI data\"}},\"addr(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated address.\"}},\"approve(bytes32,address,bool)\":{\"details\":\"Approve a delegate to be able to updated records on a node.\"},\"clearRecords(bytes32)\":{\"params\":{\"node\":\"The node to update.\"}},\"contenthash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated contenthash.\"}},\"dnsRecord(bytes32,bytes32,uint16)\":{\"params\":{\"name\":\"the keccak-256 hash of the fully-qualified name for which to fetch the record\",\"node\":\"the namehash of the node for which to fetch the record\",\"resource\":\"the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\"},\"returns\":{\"_0\":\"the DNS record in wire format if present, otherwise empty\"}},\"hasDNSRecords(bytes32,bytes32)\":{\"params\":{\"name\":\"the namehash of the node for which to check the records\",\"node\":\"the namehash of the node for which to check the records\"}},\"interfaceImplementer(bytes32,bytes4)\":{\"params\":{\"interfaceID\":\"The EIP 165 interface ID to check for.\",\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The address that implements this interface, or 0 if the interface is unsupported.\"}},\"isApprovedFor(address,bytes32,address)\":{\"details\":\"Check to see if the delegate has been approved by the owner for the node.\"},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC1155-isApprovedForAll}.\"},\"name(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated name.\"}},\"pubkey(bytes32)\":{\"params\":{\"node\":\"The ENS node to query\"},\"returns\":{\"x\":\"The X coordinate of the curve point for the public key.\",\"y\":\"The Y coordinate of the curve point for the public key.\"}},\"setABI(bytes32,uint256,bytes)\":{\"params\":{\"contentType\":\"The content type of the ABI\",\"data\":\"The ABI data.\",\"node\":\"The node to update.\"}},\"setAddr(bytes32,address)\":{\"params\":{\"a\":\"The address to set.\",\"node\":\"The node to update.\"}},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC1155-setApprovalForAll}.\"},\"setContenthash(bytes32,bytes)\":{\"params\":{\"hash\":\"The contenthash to set\",\"node\":\"The node to update.\"}},\"setDNSRecords(bytes32,bytes)\":{\"params\":{\"data\":\"the DNS wire format records to set\",\"node\":\"the namehash of the node for which to set the records\"}},\"setInterface(bytes32,bytes4,address)\":{\"params\":{\"implementer\":\"The address of a contract that implements this interface for this node.\",\"interfaceID\":\"The EIP 165 interface ID.\",\"node\":\"The node to update.\"}},\"setName(bytes32,string)\":{\"params\":{\"node\":\"The node to update.\"}},\"setPubkey(bytes32,bytes32,bytes32)\":{\"params\":{\"node\":\"The ENS node to query\",\"x\":\"the X coordinate of the curve point for the public key.\",\"y\":\"the Y coordinate of the curve point for the public key.\"}},\"setText(bytes32,string,string)\":{\"params\":{\"key\":\"The key to set.\",\"node\":\"The node to update.\",\"value\":\"The text data value to set.\"}},\"setZonehash(bytes32,bytes)\":{\"params\":{\"hash\":\"The zonehash to set\",\"node\":\"The node to update.\"}},\"text(bytes32,string)\":{\"params\":{\"key\":\"The text data key to query.\",\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated text data.\"}},\"zonehash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated contenthash.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"ABI(bytes32,uint256)\":{\"notice\":\"Returns the ABI associated with an ENS node. Defined in EIP205.\"},\"addr(bytes32)\":{\"notice\":\"Returns the address associated with an ENS node.\"},\"clearRecords(bytes32)\":{\"notice\":\"Increments the record version associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"contenthash(bytes32)\":{\"notice\":\"Returns the contenthash associated with an ENS node.\"},\"dnsRecord(bytes32,bytes32,uint16)\":{\"notice\":\"Obtain a DNS record.\"},\"hasDNSRecords(bytes32,bytes32)\":{\"notice\":\"Check if a given node has records.\"},\"interfaceImplementer(bytes32,bytes4)\":{\"notice\":\"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.\"},\"name(bytes32)\":{\"notice\":\"Returns the name associated with an ENS node, for reverse records. Defined in EIP181.\"},\"pubkey(bytes32)\":{\"notice\":\"Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619.\"},\"setABI(bytes32,uint256,bytes)\":{\"notice\":\"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.\"},\"setAddr(bytes32,address)\":{\"notice\":\"Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setContenthash(bytes32,bytes)\":{\"notice\":\"Sets the contenthash associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setDNSRecords(bytes32,bytes)\":{\"notice\":\"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.\"},\"setInterface(bytes32,bytes4,address)\":{\"notice\":\"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.\"},\"setName(bytes32,string)\":{\"notice\":\"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.\"},\"setPubkey(bytes32,bytes32,bytes32)\":{\"notice\":\"Sets the SECP256k1 public key associated with an ENS node.\"},\"setText(bytes32,string,string)\":{\"notice\":\"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.\"},\"setZonehash(bytes32,bytes)\":{\"notice\":\"setZonehash sets the hash for the zone. May only be called by the owner of that node in the ENS registry.\"},\"text(bytes32,string)\":{\"notice\":\"Returns the text data associated with an ENS node and key.\"},\"zonehash(bytes32)\":{\"notice\":\"zonehash obtains the hash for the zone.\"}},\"notice\":\"A simple resolver anyone can use; only allows the owner of a node to set its address.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/resolvers/PublicResolver.sol\":\"PublicResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1300},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-2-Clause\\npragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for appending to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n let fpm := add(32, add(ptr, capacity))\\n if lt(fpm, ptr) {\\n revert(0, 0)\\n }\\n mstore(0x40, fpm)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n uint off = buf.buf.length;\\n uint newCapacity = off + len;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(newCapacity, buflen) {\\n mstore(bufptr, newCapacity)\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return append(buf, data, data.length);\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint offPlusOne = off + 1;\\n if (off >= buf.capacity) {\\n resize(buf, offPlusOne * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if gt(offPlusOne, mload(bufptr)) {\\n mstore(bufptr, offPlusOne)\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return append(buf, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return append(buf, data, 32);\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n return buf;\\n }\\n}\\n\",\"keccak256\":\"0xd6dd3b0b327288f8e1b711a609f4040fea602e2ad4bba9febdf2f33b4e56eb0c\",\"license\":\"BSD-2-Clause\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6392f2cfe3a5ee802227fe7a2dfd47096d881aec89bddd214b35c5b46d3cd941\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xab28a56179c1db258c9bf5235b382698cb650debecb51b23d12be9e241374b68\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n */\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint256 labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes memory ret) {\\n uint256 len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint256 labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint256 constant RRSIG_TYPE = 0;\\n uint256 constant RRSIG_ALGORITHM = 2;\\n uint256 constant RRSIG_LABELS = 3;\\n uint256 constant RRSIG_TTL = 4;\\n uint256 constant RRSIG_EXPIRATION = 8;\\n uint256 constant RRSIG_INCEPTION = 12;\\n uint256 constant RRSIG_KEY_TAG = 16;\\n uint256 constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(\\n bytes memory data\\n ) internal pure returns (SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(\\n RRSIG_SIGNER_NAME + self.signerName.length,\\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\\n );\\n }\\n\\n function rrs(\\n SignedSet memory rrset\\n ) internal pure returns (RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint256 offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint256 rdataOffset;\\n uint256 nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns (bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint256 rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.offset,\\n nameLength(iter.data, iter.offset)\\n );\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(\\n RRIterator memory iter\\n ) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.rdataOffset,\\n iter.nextOffset - iter.rdataOffset\\n );\\n }\\n\\n uint256 constant DNSKEY_FLAGS = 0;\\n uint256 constant DNSKEY_PROTOCOL = 2;\\n uint256 constant DNSKEY_ALGORITHM = 3;\\n uint256 constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(\\n offset + DNSKEY_PUBKEY,\\n length - DNSKEY_PUBKEY\\n );\\n }\\n\\n uint256 constant DS_KEY_TAG = 0;\\n uint256 constant DS_ALGORITHM = 2;\\n uint256 constant DS_DIGEST_TYPE = 3;\\n uint256 constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n function isSubdomainOf(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n uint256 off = 0;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n while (counts > othercounts) {\\n off = progress(self, off);\\n counts--;\\n }\\n\\n return self.equals(off, other, 0);\\n }\\n\\n function compareNames(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint256 off;\\n uint256 otheroff;\\n uint256 prevoff;\\n uint256 otherprevoff;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if (otheroff == 0) {\\n return 1;\\n }\\n\\n return\\n self.compare(\\n prevoff + 1,\\n self.readUint8(prevoff),\\n other,\\n otherprevoff + 1,\\n other.readUint8(otherprevoff)\\n );\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(\\n uint32 i1,\\n uint32 i2\\n ) internal pure returns (bool) {\\n unchecked {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n }\\n\\n function progress(\\n bytes memory body,\\n uint256 off\\n ) internal pure returns (uint256) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint256 ac1;\\n uint256 ac2;\\n for (uint256 i = 0; i < data.length + 31; i += 32) {\\n uint256 word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if (i + 32 > data.length) {\\n uint256 unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 +=\\n (word &\\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\\n 8;\\n ac2 += (word &\\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 =\\n (ac1 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac1 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac2 =\\n (ac2 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac2 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 =\\n (ac1 &\\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\\n 32);\\n ac1 =\\n (ac1 &\\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\\n 64);\\n ac1 =\\n (ac1 &\\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\\n (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4dd68a6efd7c38f6b0e95ca0c056ecb74f88583da650b1a8639e6e78be36fede\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x9ac51351ff72d73083aed62b7cdad4c07e9d1eb68401d7fd8457bdd828f2c6fe\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/resolvers/IMulticallable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IMulticallable {\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n}\\n\",\"keccak256\":\"0x0334202e20bb11995997083d05963f5e8e7ed6194cba494e7f9371ab7bf4e2c3\",\"license\":\"MIT\"},\"contracts/resolvers/Multicallable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"./IMulticallable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nabstract contract Multicallable is IMulticallable, ERC165 {\\n function _multicall(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) internal returns (bytes[] memory results) {\\n results = new bytes[](data.length);\\n for (uint256 i = 0; i < data.length; i++) {\\n if (nodehash != bytes32(0)) {\\n bytes32 txNamehash = bytes32(data[i][4:36]);\\n require(\\n txNamehash == nodehash,\\n \\\"multicall: All records must have a matching namehash\\\"\\n );\\n }\\n (bool success, bytes memory result) = address(this).delegatecall(\\n data[i]\\n );\\n require(success);\\n results[i] = result;\\n }\\n return results;\\n }\\n\\n // This function provides an extra security check when called\\n // from priviledged contracts (such as EthRegistrarController)\\n // that can set records on behalf of the node owners\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results) {\\n return _multicall(nodehash, data);\\n }\\n\\n function multicall(\\n bytes[] calldata data\\n ) public override returns (bytes[] memory results) {\\n return _multicall(bytes32(0), data);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IMulticallable).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x1063a9dd3b94ba304624d5ec6deb43c1916640758ae970eece4d4e3ef8b2fcb1\",\"license\":\"MIT\"},\"contracts/resolvers/PublicResolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./profiles/ABIResolver.sol\\\";\\nimport \\\"./profiles/AddrResolver.sol\\\";\\nimport \\\"./profiles/ContentHashResolver.sol\\\";\\nimport \\\"./profiles/DNSResolver.sol\\\";\\nimport \\\"./profiles/InterfaceResolver.sol\\\";\\nimport \\\"./profiles/NameResolver.sol\\\";\\nimport \\\"./profiles/PubkeyResolver.sol\\\";\\nimport \\\"./profiles/TextResolver.sol\\\";\\nimport \\\"./Multicallable.sol\\\";\\nimport {ReverseClaimer} from \\\"../reverseRegistrar/ReverseClaimer.sol\\\";\\nimport {INameWrapper} from \\\"../wrapper/INameWrapper.sol\\\";\\n\\n/**\\n * A simple resolver anyone can use; only allows the owner of a node to set its\\n * address.\\n */\\ncontract PublicResolver is\\n Multicallable,\\n ABIResolver,\\n AddrResolver,\\n ContentHashResolver,\\n DNSResolver,\\n InterfaceResolver,\\n NameResolver,\\n PubkeyResolver,\\n TextResolver,\\n ReverseClaimer\\n{\\n ENS immutable ens;\\n INameWrapper immutable nameWrapper;\\n address immutable trustedETHController;\\n address immutable trustedReverseRegistrar;\\n\\n /**\\n * A mapping of operators. An address that is authorised for an address\\n * may make any changes to the name that the owner could, but may not update\\n * the set of authorisations.\\n * (owner, operator) => approved\\n */\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * A mapping of delegates. A delegate that is authorised by an owner\\n * for a name may make changes to the name's resolver, but may not update\\n * the set of token approvals.\\n * (owner, name, delegate) => approved\\n */\\n mapping(address => mapping(bytes32 => mapping(address => bool)))\\n private _tokenApprovals;\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n // Logged when a delegate is approved or an approval is revoked.\\n event Approved(\\n address owner,\\n bytes32 indexed node,\\n address indexed delegate,\\n bool indexed approved\\n );\\n\\n constructor(\\n ENS _ens,\\n INameWrapper wrapperAddress,\\n address _trustedETHController,\\n address _trustedReverseRegistrar\\n ) ReverseClaimer(_ens, msg.sender) {\\n ens = _ens;\\n nameWrapper = wrapperAddress;\\n trustedETHController = _trustedETHController;\\n trustedReverseRegistrar = _trustedReverseRegistrar;\\n }\\n\\n /**\\n * @dev See {IERC1155-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) external {\\n require(\\n msg.sender != operator,\\n \\\"ERC1155: setting approval status for self\\\"\\n );\\n\\n _operatorApprovals[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC1155-isApprovedForAll}.\\n */\\n function isApprovedForAll(\\n address account,\\n address operator\\n ) public view returns (bool) {\\n return _operatorApprovals[account][operator];\\n }\\n\\n /**\\n * @dev Approve a delegate to be able to updated records on a node.\\n */\\n function approve(bytes32 node, address delegate, bool approved) external {\\n require(msg.sender != delegate, \\\"Setting delegate status for self\\\");\\n\\n _tokenApprovals[msg.sender][node][delegate] = approved;\\n emit Approved(msg.sender, node, delegate, approved);\\n }\\n\\n /**\\n * @dev Check to see if the delegate has been approved by the owner for the node.\\n */\\n function isApprovedFor(\\n address owner,\\n bytes32 node,\\n address delegate\\n ) public view returns (bool) {\\n return _tokenApprovals[owner][node][delegate];\\n }\\n\\n function isAuthorised(bytes32 node) internal view override returns (bool) {\\n if (\\n msg.sender == trustedETHController ||\\n msg.sender == trustedReverseRegistrar\\n ) {\\n return true;\\n }\\n address owner = ens.owner(node);\\n if (owner == address(nameWrapper)) {\\n owner = nameWrapper.ownerOf(uint256(node));\\n }\\n return\\n owner == msg.sender ||\\n isApprovedForAll(owner, msg.sender) ||\\n isApprovedFor(owner, node, msg.sender);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n )\\n public\\n view\\n override(\\n Multicallable,\\n ABIResolver,\\n AddrResolver,\\n ContentHashResolver,\\n DNSResolver,\\n InterfaceResolver,\\n NameResolver,\\n PubkeyResolver,\\n TextResolver\\n )\\n returns (bool)\\n {\\n return super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x24c839eb7118da8eea65d07401cc26bad0444a3e651b2cb19749c43065bd24de\",\"license\":\"MIT\"},\"contracts/resolvers/ResolverBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"./profiles/IVersionableResolver.sol\\\";\\n\\nabstract contract ResolverBase is ERC165, IVersionableResolver {\\n mapping(bytes32 => uint64) public recordVersions;\\n\\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\\n\\n modifier authorised(bytes32 node) {\\n require(isAuthorised(node));\\n _;\\n }\\n\\n /**\\n * Increments the record version associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function clearRecords(bytes32 node) public virtual authorised(node) {\\n recordVersions[node]++;\\n emit VersionChanged(node, recordVersions[node]);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IVersionableResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x893049fffd6feee06d7acef1680f6e26505bedff62a9f7a17e921c0ba2f66307\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"./IABIResolver.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\n\\nabstract contract ABIResolver is IABIResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\\n\\n /**\\n * Sets the ABI associated with an ENS node.\\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\\n * the empty string.\\n * @param node The node to update.\\n * @param contentType The content type of the ABI\\n * @param data The ABI data.\\n */\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external virtual authorised(node) {\\n // Content types must be powers of 2\\n require(((contentType - 1) & contentType) == 0);\\n\\n versionable_abis[recordVersions[node]][node][contentType] = data;\\n emit ABIChanged(node, contentType);\\n }\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view virtual override returns (uint256, bytes memory) {\\n mapping(uint256 => bytes) storage abiset = versionable_abis[\\n recordVersions[node]\\n ][node];\\n\\n for (\\n uint256 contentType = 1;\\n contentType <= contentTypes;\\n contentType <<= 1\\n ) {\\n if (\\n (contentType & contentTypes) != 0 &&\\n abiset[contentType].length > 0\\n ) {\\n return (contentType, abiset[contentType]);\\n }\\n }\\n\\n return (0, bytes(\\\"\\\"));\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IABIResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x2da96d7750786afe3be019fc6ff768e2d98a5e61d360bd92d8d7bc3c7c1dcc27\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/AddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IAddrResolver.sol\\\";\\nimport \\\"./IAddressResolver.sol\\\";\\n\\nabstract contract AddrResolver is\\n IAddrResolver,\\n IAddressResolver,\\n ResolverBase\\n{\\n uint256 private constant COIN_TYPE_ETH = 60;\\n\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\\n\\n /**\\n * Sets the address associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param a The address to set.\\n */\\n function setAddr(\\n bytes32 node,\\n address a\\n ) external virtual authorised(node) {\\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\\n }\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(\\n bytes32 node\\n ) public view virtual override returns (address payable) {\\n bytes memory a = addr(node, COIN_TYPE_ETH);\\n if (a.length == 0) {\\n return payable(0);\\n }\\n return bytesToAddress(a);\\n }\\n\\n function setAddr(\\n bytes32 node,\\n uint256 coinType,\\n bytes memory a\\n ) public virtual authorised(node) {\\n emit AddressChanged(node, coinType, a);\\n if (coinType == COIN_TYPE_ETH) {\\n emit AddrChanged(node, bytesToAddress(a));\\n }\\n versionable_addresses[recordVersions[node]][node][coinType] = a;\\n }\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) public view virtual override returns (bytes memory) {\\n return versionable_addresses[recordVersions[node]][node][coinType];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IAddrResolver).interfaceId ||\\n interfaceID == type(IAddressResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function bytesToAddress(\\n bytes memory b\\n ) internal pure returns (address payable a) {\\n require(b.length == 20);\\n assembly {\\n a := div(mload(add(b, 32)), exp(256, 12))\\n }\\n }\\n\\n function addressToBytes(address a) internal pure returns (bytes memory b) {\\n b = new bytes(20);\\n assembly {\\n mstore(add(b, 32), mul(a, exp(256, 12)))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7f6ebb3144530a02db03379f33ade869c8408eceed36dfbd751aaff198735b55\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IContentHashResolver.sol\\\";\\n\\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\\n\\n /**\\n * Sets the contenthash associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param hash The contenthash to set\\n */\\n function setContenthash(\\n bytes32 node,\\n bytes calldata hash\\n ) external virtual authorised(node) {\\n versionable_hashes[recordVersions[node]][node] = hash;\\n emit ContenthashChanged(node, hash);\\n }\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(\\n bytes32 node\\n ) external view virtual override returns (bytes memory) {\\n return versionable_hashes[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IContentHashResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xc9755bfb77985375ded880ecab5af41f2b9e8280f30d3e523fe5042ea59f93ea\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/DNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"../../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"./IDNSRecordResolver.sol\\\";\\nimport \\\"./IDNSZoneResolver.sol\\\";\\n\\nabstract contract DNSResolver is\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n ResolverBase\\n{\\n using RRUtils for *;\\n using BytesUtils for bytes;\\n\\n // Zone hashes for the domains.\\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\\n // resource containing a single zonefile.\\n // node => contenthash\\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\\n\\n // The records themselves. Stored as binary RRSETs\\n // node => version => name => resource => data\\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\\n private versionable_records;\\n\\n // Count of number of entries for a given name. Required for DNS resolvers\\n // when resolving wildcards.\\n // node => version => name => number of records\\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\\n private versionable_nameEntriesCount;\\n\\n /**\\n * Set one or more DNS records. Records are supplied in wire-format.\\n * Records with the same node/name/resource must be supplied one after the\\n * other to ensure the data is updated correctly. For example, if the data\\n * was supplied:\\n * a.example.com IN A 1.2.3.4\\n * a.example.com IN A 5.6.7.8\\n * www.example.com IN CNAME a.example.com.\\n * then this would store the two A records for a.example.com correctly as a\\n * single RRSET, however if the data was supplied:\\n * a.example.com IN A 1.2.3.4\\n * www.example.com IN CNAME a.example.com.\\n * a.example.com IN A 5.6.7.8\\n * then this would store the first A record, the CNAME, then the second A\\n * record which would overwrite the first.\\n *\\n * @param node the namehash of the node for which to set the records\\n * @param data the DNS wire format records to set\\n */\\n function setDNSRecords(\\n bytes32 node,\\n bytes calldata data\\n ) external virtual authorised(node) {\\n uint16 resource = 0;\\n uint256 offset = 0;\\n bytes memory name;\\n bytes memory value;\\n bytes32 nameHash;\\n uint64 version = recordVersions[node];\\n // Iterate over the data to add the resource records\\n for (\\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\\n !iter.done();\\n iter.next()\\n ) {\\n if (resource == 0) {\\n resource = iter.dnstype;\\n name = iter.name();\\n nameHash = keccak256(abi.encodePacked(name));\\n value = bytes(iter.rdata());\\n } else {\\n bytes memory newName = iter.name();\\n if (resource != iter.dnstype || !name.equals(newName)) {\\n setDNSRRSet(\\n node,\\n name,\\n resource,\\n data,\\n offset,\\n iter.offset - offset,\\n value.length == 0,\\n version\\n );\\n resource = iter.dnstype;\\n offset = iter.offset;\\n name = newName;\\n nameHash = keccak256(name);\\n value = bytes(iter.rdata());\\n }\\n }\\n }\\n if (name.length > 0) {\\n setDNSRRSet(\\n node,\\n name,\\n resource,\\n data,\\n offset,\\n data.length - offset,\\n value.length == 0,\\n version\\n );\\n }\\n }\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) public view virtual override returns (bytes memory) {\\n return versionable_records[recordVersions[node]][node][name][resource];\\n }\\n\\n /**\\n * Check if a given node has records.\\n * @param node the namehash of the node for which to check the records\\n * @param name the namehash of the node for which to check the records\\n */\\n function hasDNSRecords(\\n bytes32 node,\\n bytes32 name\\n ) public view virtual returns (bool) {\\n return (versionable_nameEntriesCount[recordVersions[node]][node][\\n name\\n ] != 0);\\n }\\n\\n /**\\n * setZonehash sets the hash for the zone.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param hash The zonehash to set\\n */\\n function setZonehash(\\n bytes32 node,\\n bytes calldata hash\\n ) external virtual authorised(node) {\\n uint64 currentRecordVersion = recordVersions[node];\\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\\n node\\n ];\\n versionable_zonehashes[currentRecordVersion][node] = hash;\\n emit DNSZonehashChanged(node, oldhash, hash);\\n }\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(\\n bytes32 node\\n ) external view virtual override returns (bytes memory) {\\n return versionable_zonehashes[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IDNSRecordResolver).interfaceId ||\\n interfaceID == type(IDNSZoneResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function setDNSRRSet(\\n bytes32 node,\\n bytes memory name,\\n uint16 resource,\\n bytes memory data,\\n uint256 offset,\\n uint256 size,\\n bool deleteRecord,\\n uint64 version\\n ) private {\\n bytes32 nameHash = keccak256(name);\\n bytes memory rrData = data.substring(offset, size);\\n if (deleteRecord) {\\n if (\\n versionable_records[version][node][nameHash][resource].length !=\\n 0\\n ) {\\n versionable_nameEntriesCount[version][node][nameHash]--;\\n }\\n delete (versionable_records[version][node][nameHash][resource]);\\n emit DNSRecordDeleted(node, name, resource);\\n } else {\\n if (\\n versionable_records[version][node][nameHash][resource].length ==\\n 0\\n ) {\\n versionable_nameEntriesCount[version][node][nameHash]++;\\n }\\n versionable_records[version][node][nameHash][resource] = rrData;\\n emit DNSRecordChanged(node, name, resource, rrData);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7233e4d2edca222ce6e1cdb07adf127ab52ecaea599fa5369971a7b28dbc59ac\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IVersionableResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IVersionableResolver {\\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\\n\\n function recordVersions(bytes32 node) external view returns (uint64);\\n}\\n\",\"keccak256\":\"0xd0d09596f20c57bafb2ffa8521a8c57120e9af6c6b194f9c689d4da56f91a57c\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/InterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./AddrResolver.sol\\\";\\nimport \\\"./IInterfaceResolver.sol\\\";\\n\\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\\n\\n /**\\n * Sets an interface associated with a name.\\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\\n * @param node The node to update.\\n * @param interfaceID The EIP 165 interface ID.\\n * @param implementer The address of a contract that implements this interface for this node.\\n */\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external virtual authorised(node) {\\n versionable_interfaces[recordVersions[node]][node][\\n interfaceID\\n ] = implementer;\\n emit InterfaceChanged(node, interfaceID, implementer);\\n }\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view virtual override returns (address) {\\n address implementer = versionable_interfaces[recordVersions[node]][\\n node\\n ][interfaceID];\\n if (implementer != address(0)) {\\n return implementer;\\n }\\n\\n address a = addr(node);\\n if (a == address(0)) {\\n return address(0);\\n }\\n\\n (bool success, bytes memory returnData) = a.staticcall(\\n abi.encodeWithSignature(\\n \\\"supportsInterface(bytes4)\\\",\\n type(IERC165).interfaceId\\n )\\n );\\n if (!success || returnData.length < 32 || returnData[31] == 0) {\\n // EIP 165 not supported by target\\n return address(0);\\n }\\n\\n (success, returnData) = a.staticcall(\\n abi.encodeWithSignature(\\\"supportsInterface(bytes4)\\\", interfaceID)\\n );\\n if (!success || returnData.length < 32 || returnData[31] == 0) {\\n // Specified interface not supported by target\\n return address(0);\\n }\\n\\n return a;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IInterfaceResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x820ec60183e7a49a4ee399cf4708acb776725c8e4ad275d1f316c152eace0a59\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/NameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./INameResolver.sol\\\";\\n\\nabstract contract NameResolver is INameResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\\n\\n /**\\n * Sets the name associated with an ENS node, for reverse records.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function setName(\\n bytes32 node,\\n string calldata newName\\n ) external virtual authorised(node) {\\n versionable_names[recordVersions[node]][node] = newName;\\n emit NameChanged(node, newName);\\n }\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(\\n bytes32 node\\n ) external view virtual override returns (string memory) {\\n return versionable_names[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(INameResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x52d0bbb8f9dd33fae471ef2f5f6b3118b221954e5bb7ba724885d4562e75b8e2\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/PubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IPubkeyResolver.sol\\\";\\n\\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\\n struct PublicKey {\\n bytes32 x;\\n bytes32 y;\\n }\\n\\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\\n\\n /**\\n * Sets the SECP256k1 public key associated with an ENS node.\\n * @param node The ENS node to query\\n * @param x the X coordinate of the curve point for the public key.\\n * @param y the Y coordinate of the curve point for the public key.\\n */\\n function setPubkey(\\n bytes32 node,\\n bytes32 x,\\n bytes32 y\\n ) external virtual authorised(node) {\\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\\n emit PubkeyChanged(node, x, y);\\n }\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(\\n bytes32 node\\n ) external view virtual override returns (bytes32 x, bytes32 y) {\\n uint64 currentRecordVersion = recordVersions[node];\\n return (\\n versionable_pubkeys[currentRecordVersion][node].x,\\n versionable_pubkeys[currentRecordVersion][node].y\\n );\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IPubkeyResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x1a1f10a0e40520c998a9296fc81c092c81521e05a784e9bd9ee44cc4c62c8c78\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/TextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./ITextResolver.sol\\\";\\n\\nabstract contract TextResolver is ITextResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\\n\\n /**\\n * Sets the text data associated with an ENS node and key.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param key The key to set.\\n * @param value The text data value to set.\\n */\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external virtual authorised(node) {\\n versionable_texts[recordVersions[node]][node][key] = value;\\n emit TextChanged(node, key, key, value);\\n }\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view virtual override returns (string memory) {\\n return versionable_texts[recordVersions[node]][node][key];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(ITextResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xf9bedd807add38136779d84083ac2fa4f8c92d017c9e1a72fbc9003fa5074379\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseClaimer.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\n\\ncontract ReverseClaimer {\\n bytes32 constant ADDR_REVERSE_NODE =\\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n constructor(ENS ens, address claimant) {\\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\\n ens.owner(ADDR_REVERSE_NODE)\\n );\\n reverseRegistrar.claim(claimant);\\n }\\n}\\n\",\"keccak256\":\"0x78a28627241535b595f6fff476a1fa7acc90c80684fe7784734920fc8af6fc22\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_ETH = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x70310eb67146d7290731c31841399640ac3b6a949eadc6598bc150123d185c57\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101006040523480156200001257600080fd5b50604051620032943803806200329483398101604081905262000035916200017a565b6040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152849033906000906001600160a01b038416906302571be390602401602060405180830381865afa158015620000a1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000c79190620001e2565b604051630f41a04d60e11b81526001600160a01b03848116600483015291925090821690631e83409a906024016020604051808303816000875af115801562000114573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200013a919062000209565b5050506001600160a01b039485166080525091831660a052821660c0521660e05262000223565b6001600160a01b03811681146200017757600080fd5b50565b600080600080608085870312156200019157600080fd5b84516200019e8162000161565b6020860151909450620001b18162000161565b6040860151909350620001c48162000161565b6060860151909250620001d78162000161565b939692955090935050565b600060208284031215620001f557600080fd5b8151620002028162000161565b9392505050565b6000602082840312156200021c57600080fd5b5051919050565b60805160a05160c05160e0516130306200026460003960006117d7015260006117a50152600081816118af01526119150152600061183801526130306000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c80638b95dd7111610104578063c8690233116100a2578063e32954eb11610071578063e32954eb14610504578063e59d895d14610517578063e985e9c51461052a578063f1cb7e061461056657600080fd5b8063c869023314610442578063ce3decdc1461049b578063d5fa2b00146104ae578063d700ff33146104c157600080fd5b8063a8fa5682116100de578063a8fa5682146103b8578063a9784b3e146103cb578063ac9650d81461040f578063bc1c58d11461042f57600080fd5b80638b95dd711461037f578063a22cb46514610392578063a4b91a01146103a557600080fd5b80633603d7581161017c5780635c98042b1161014b5780635c98042b14610333578063623195b014610346578063691f343114610359578063773722131461036c57600080fd5b80633603d758146102a15780633b3b57de146102b45780634cbf6ba4146102c757806359d1d43c1461031357600080fd5b8063124a319c116101b8578063124a319c1461022f5780632203ab561461025a57806329cd62ea1461027b578063304e6ade1461028e57600080fd5b806301ffc9a7146101df5780630af179d71461020757806310f13a8c1461021c575b600080fd5b6101f26101ed366004612529565b610579565b60405190151581526020015b60405180910390f35b61021a610215366004612586565b61058a565b005b61021a61022a3660046125d2565b610794565b61024261023d36600461264c565b610861565b6040516001600160a01b0390911681526020016101fe565b61026d610268366004612678565b610b0d565b6040516101fe9291906126ea565b61021a610289366004612703565b610c44565b61021a61029c366004612586565b610cdf565b61021a6102af36600461272f565b610d5b565b6102426102c236600461272f565b610dfe565b6101f26102d5366004612678565b6000828152602081815260408083205467ffffffffffffffff1683526006825280832094835293815283822092825291909152205461ffff16151590565b610326610321366004612586565b610e30565b6040516101fe9190612748565b61032661034136600461272f565b610f10565b61021a61035436600461275b565b610fcf565b61032661036736600461272f565b61106c565b61021a61037a366004612586565b6110a6565b61021a61038d3660046127c4565b611122565b61021a6103a03660046128ad565b611202565b61021a6103b33660046128d9565b6112f1565b6103266103c6366004612917565b6113be565b6101f26103d9366004612957565b6001600160a01b039283166000908152600c60209081526040808320948352938152838220929094168152925290205460ff1690565b61042261041d3660046129d3565b61140c565b6040516101fe9190612a15565b61032661043d36600461272f565b61141a565b61048661045036600461272f565b6000818152602081815260408083205467ffffffffffffffff168352600982528083209383529290522080546001909101549091565b604080519283526020830191909152016101fe565b61021a6104a9366004612586565b611454565b61021a6104bc366004612a77565b611597565b6104eb6104cf36600461272f565b60006020819052908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016101fe565b610422610512366004612aa7565b6115be565b61021a610525366004612ae6565b6115d3565b6101f2610538366004612b1b565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b610326610574366004612678565b611692565b60006105848261175a565b92915050565b8261059481611798565b61059d57600080fd5b600084815260208181526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff9091169183916106039183918d908d908190840183828082843760009201919091525092939250506119ff9050565b90505b8051516020820151101561072d578661ffff1660000361066b578060400151965061063081611a60565b9450846040516020016106439190612b49565b60405160208183030381529060405280519060200120925061066481611a81565b935061071f565b600061067682611a60565b9050816040015161ffff168861ffff1614158061069a57506106988682611a9d565b155b1561071d576106f68c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d91506106ed908290612b7b565b8b51158a611abb565b81604001519750816020015196508095508580519060200120935061071a82611a81565b94505b505b61072881611d28565b610606565b50835115610788576107888a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c925061077f91508290508f612b7b565b89511588611abb565b50505050505050505050565b8461079e81611798565b6107a757600080fd5b6000868152602081815260408083205467ffffffffffffffff168352600a8252808320898452909152908190209051849184916107e79089908990612b8e565b90815260200160405180910390209182610802929190612c26565b508484604051610813929190612b8e565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516108519493929190612d0f565b60405180910390a3505050505050565b6000828152602081815260408083205467ffffffffffffffff1683526007825280832085845282528083206001600160e01b0319851684529091528120546001600160a01b031680156108b5579050610584565b60006108c085610dfe565b90506001600160a01b0381166108db57600092505050610584565b6040516301ffc9a760e01b602482015260009081906001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516109489190612b49565b600060405180830381855afa9150503d8060008114610983576040519150601f19603f3d011682016040523d82523d6000602084013e610988565b606091505b509150915081158061099b575060208151105b806109dd575080601f815181106109b4576109b4612d41565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109ef576000945050505050610584565b6040516001600160e01b0319871660248201526001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b17905251610a5a9190612b49565b600060405180830381855afa9150503d8060008114610a95576040519150601f19603f3d011682016040523d82523d6000602084013e610a9a565b606091505b509092509050811580610aae575060208151105b80610af0575080601f81518110610ac757610ac7612d41565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610b02576000945050505050610584565b509095945050505050565b6000828152602081815260408083205467ffffffffffffffff168352600180835281842086855290925282206060915b848111610c245780851615801590610b6d575060008181526020839052604081208054610b6990612b9e565b9050115b15610c1c5780826000838152602001908152602001600020808054610b9190612b9e565b80601f0160208091040260200160405190810160405280929190818152602001828054610bbd90612b9e565b8015610c0a5780601f10610bdf57610100808354040283529160200191610c0a565b820191906000526020600020905b815481529060010190602001808311610bed57829003601f168201915b50505050509050935093505050610c3d565b60011b610b3d565b5060006040518060200160405280600081525092509250505b9250929050565b82610c4e81611798565b610c5757600080fd5b604080518082018252848152602080820185815260008881528083528481205467ffffffffffffffff1681526009835284812089825283528490209251835551600190920191909155815185815290810184905285917f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4691015b60405180910390a250505050565b82610ce981611798565b610cf257600080fd5b6000848152602081815260408083205467ffffffffffffffff168352600382528083208784529091529020610d28838583612c26565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610cd1929190612d57565b80610d6581611798565b610d6e57600080fd5b6000828152602081905260408120805467ffffffffffffffff1691610d9283612d6b565b82546101009290920a67ffffffffffffffff818102199093169183160217909155600084815260208181526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610e0c83603c611692565b90508051600003610e205750600092915050565b610e2981611e10565b9392505050565b6000838152602081815260408083205467ffffffffffffffff168352600a825280832086845290915290819020905160609190610e709085908590612b8e565b90815260200160405180910390208054610e8990612b9e565b80601f0160208091040260200160405190810160405280929190818152602001828054610eb590612b9e565b8015610f025780601f10610ed757610100808354040283529160200191610f02565b820191906000526020600020905b815481529060010190602001808311610ee557829003601f168201915b505050505090509392505050565b6000818152602081815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610f4a90612b9e565b80601f0160208091040260200160405190810160405280929190818152602001828054610f7690612b9e565b8015610fc35780601f10610f9857610100808354040283529160200191610fc3565b820191906000526020600020905b815481529060010190602001808311610fa657829003601f168201915b50505050509050919050565b83610fd981611798565b610fe257600080fd5b83610fee600182612b7b565b1615610ff957600080fd5b6000858152602081815260408083205467ffffffffffffffff1683526001825280832088845282528083208784529091529020611037838583612c26565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b6000818152602081815260408083205467ffffffffffffffff168352600882528083208484529091529020805460609190610f4a90612b9e565b826110b081611798565b6110b957600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526008825280832087845290915290206110ef838583612c26565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610cd1929190612d57565b8261112c81611798565b61113557600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af75284846040516111679291906126ea565b60405180910390a2603c83036111be57837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd26111a284611e10565b6040516001600160a01b03909116815260200160405180910390a25b6000848152602081815260408083205467ffffffffffffffff16835260028252808320878452825280832086845290915290206111fb8382612d92565b5050505050565b6001600160a01b03821633036112855760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336000818152600b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6001600160a01b03821633036113495760405162461bcd60e51b815260206004820181905260248201527f53657474696e672064656c65676174652073746174757320666f722073656c66604482015260640161127c565b336000818152600c6020908152604080832087845282528083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519384529286917ff0ddb3b04746704017f9aa8bd728fcc2c1d11675041205350018915f5e4750a0910160405180910390a4505050565b6000838152602081815260408083205467ffffffffffffffff168352600582528083208684528252808320858452825280832061ffff851684529091529020805460609190610e8990612b9e565b6060610e2960008484611e38565b6000818152602081815260408083205467ffffffffffffffff168352600382528083208484529091529020805460609190610f4a90612b9e565b8261145e81611798565b61146757600080fd5b6000848152602081815260408083205467ffffffffffffffff1680845260048352818420888552909252822080549192916114a190612b9e565b80601f01602080910402602001604051908101604052809291908181526020018280546114cd90612b9e565b801561151a5780601f106114ef5761010080835404028352916020019161151a565b820191906000526020600020905b8154815290600101906020018083116114fd57829003601f168201915b5050505067ffffffffffffffff841660009081526004602090815260408083208b845290915290209192506115529050858783612c26565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f8582878760405161158793929190612e52565b60405180910390a2505050505050565b816115a181611798565b6115aa57600080fd5b6115b983603c61038d85612011565b505050565b60606115cb848484611e38565b949350505050565b826115dd81611798565b6115e657600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526007825280832087845282528083206001600160e01b031987168085529083529281902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b6000828152602081815260408083205467ffffffffffffffff16835260028252808320858452825280832084845290915290208054606091906116d490612b9e565b80601f016020809104026020016040519081016040528092919081815260200182805461170090612b9e565b801561174d5780601f106117225761010080835404028352916020019161174d565b820191906000526020600020905b81548152906001019060200180831161173057829003601f168201915b5050505050905092915050565b60006001600160e01b031982167f59d1d43c00000000000000000000000000000000000000000000000000000000148061058457506105848261204a565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806117f95750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b1561180657506001919050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015611887573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ab9190612e82565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b03160361198b576040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611964573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119889190612e82565b90505b6001600160a01b0381163314806119c557506001600160a01b0381166000908152600b6020908152604080832033845290915290205460ff165b80610e2957506001600160a01b0381166000908152600c60209081526040808320868452825280832033845290915290205460ff16610e29565b611a4d6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261058481611d28565b6020810151815160609161058491611a789082612088565b845191906120e2565b60a081015160c082015160609161058491611a78908290612b7b565b600081518351148015610e295750610e298360008460008751612159565b865160208801206000611acf8787876120e2565b90508315611bf95767ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611b1a90612b9e565b159050611b795767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611b5d83612e9f565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091528120611bba916124b6565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a604051611bec929190612ebd565b60405180910390a2610788565b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611c3c90612b9e565b9050600003611c9d5767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611c8183612ee3565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091529020611cdf8282612d92565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a84604051611d1493929190612efa565b60405180910390a250505050505050505050565b60c08101516020820181905281515111611d3f5750565b6000611d5382600001518360200151612088565b8260200151611d629190612f29565b8251909150611d71908261217c565b61ffff166040830152611d85600282612f29565b8251909150611d94908261217c565b61ffff166060830152611da8600282612f29565b8251909150611db790826121a4565b63ffffffff166080830152611dcd600482612f29565b8251909150600090611ddf908361217c565b61ffff169050611df0600283612f29565b60a084018190529150611e038183612f29565b60c0909301929092525050565b60008151601414611e2057600080fd5b50602001516c01000000000000000000000000900490565b60608167ffffffffffffffff811115611e5357611e536127ae565b604051908082528060200260200182016040528015611e8657816020015b6060815260200190600190039081611e715790505b50905060005b82811015612009578415611f51576000848483818110611eae57611eae612d41565b9050602002810190611ec09190612f3c565b611ecf91602491600491612f83565b611ed891612fad565b9050858114611f4f5760405162461bcd60e51b815260206004820152603460248201527f6d756c746963616c6c3a20416c6c207265636f726473206d757374206861766560448201527f2061206d61746368696e67206e616d6568617368000000000000000000000000606482015260840161127c565b505b60008030868685818110611f6757611f67612d41565b9050602002810190611f799190612f3c565b604051611f87929190612b8e565b600060405180830381855af49150503d8060008114611fc2576040519150601f19603f3d011682016040523d82523d6000602084013e611fc7565b606091505b509150915081611fd657600080fd5b80848481518110611fe957611fe9612d41565b60200260200101819052505050808061200190612fcb565b915050611e8c565b509392505050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60006001600160e01b031982167fc86902330000000000000000000000000000000000000000000000000000000014806105845750610584826121ce565b6000815b8351811061209c5761209c612fe4565b60006120a8858361220c565b60ff1690506120b8816001612f29565b6120c29083612f29565b9150806000036120d257506120d8565b5061208c565b6115cb8382612b7b565b82516060906120f18385612f29565b11156120fc57600080fd5b60008267ffffffffffffffff811115612117576121176127ae565b6040519080825280601f01601f191660200182016040528015612141576020820181803683370190505b50905060208082019086860101610b02828287612230565b6000612166848484612286565b612171878785612286565b149695505050505050565b815160009061218c836002612f29565b111561219757600080fd5b50016002015161ffff1690565b81516000906121b4836004612f29565b11156121bf57600080fd5b50016004015163ffffffff1690565b60006001600160e01b031982167f691f34310000000000000000000000000000000000000000000000000000000014806105845750610584826122aa565b600082828151811061222057612220612d41565b016020015160f81c905092915050565b602081106122685781518352612247602084612f29565b9250612254602083612f29565b9150612261602082612b7b565b9050612230565b905182516020929092036101000a6000190180199091169116179052565b82516000906122958385612f29565b11156122a057600080fd5b5091016020012090565b60006001600160e01b031982167f124a319c00000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167fa8fa568200000000000000000000000000000000000000000000000000000000148061234657506001600160e01b031982167f5c98042b00000000000000000000000000000000000000000000000000000000145b8061058457506105848260006001600160e01b031982167fbc1c58d100000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167f3b3b57de0000000000000000000000000000000000000000000000000000000014806123ec57506001600160e01b031982167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061058457506105848260006001600160e01b031982167f2203ab5600000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167fd700ff3300000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167f4fbf043300000000000000000000000000000000000000000000000000000000148061058457506301ffc9a760e01b6001600160e01b0319831614610584565b5080546124c290612b9e565b6000825580601f106124d2575050565b601f0160209004906000526020600020908101906124f091906124f3565b50565b5b8082111561250857600081556001016124f4565b5090565b80356001600160e01b03198116811461252457600080fd5b919050565b60006020828403121561253b57600080fd5b610e298261250c565b60008083601f84011261255657600080fd5b50813567ffffffffffffffff81111561256e57600080fd5b602083019150836020828501011115610c3d57600080fd5b60008060006040848603121561259b57600080fd5b83359250602084013567ffffffffffffffff8111156125b957600080fd5b6125c586828701612544565b9497909650939450505050565b6000806000806000606086880312156125ea57600080fd5b85359450602086013567ffffffffffffffff8082111561260957600080fd5b61261589838a01612544565b9096509450604088013591508082111561262e57600080fd5b5061263b88828901612544565b969995985093965092949392505050565b6000806040838503121561265f57600080fd5b8235915061266f6020840161250c565b90509250929050565b6000806040838503121561268b57600080fd5b50508035926020909101359150565b60005b838110156126b557818101518382015260200161269d565b50506000910152565b600081518084526126d681602086016020860161269a565b601f01601f19169290920160200192915050565b8281526040602082015260006115cb60408301846126be565b60008060006060848603121561271857600080fd5b505081359360208301359350604090920135919050565b60006020828403121561274157600080fd5b5035919050565b602081526000610e2960208301846126be565b6000806000806060858703121561277157600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561279657600080fd5b6127a287828801612544565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b6000806000606084860312156127d957600080fd5b8335925060208401359150604084013567ffffffffffffffff808211156127ff57600080fd5b818601915086601f83011261281357600080fd5b813581811115612825576128256127ae565b604051601f8201601f19908116603f0116810190838211818310171561284d5761284d6127ae565b8160405282815289602084870101111561286657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b6001600160a01b03811681146124f057600080fd5b8035801515811461252457600080fd5b600080604083850312156128c057600080fd5b82356128cb81612888565b915061266f6020840161289d565b6000806000606084860312156128ee57600080fd5b83359250602084013561290081612888565b915061290e6040850161289d565b90509250925092565b60008060006060848603121561292c57600080fd5b8335925060208401359150604084013561ffff8116811461294c57600080fd5b809150509250925092565b60008060006060848603121561296c57600080fd5b833561297781612888565b925060208401359150604084013561294c81612888565b60008083601f8401126129a057600080fd5b50813567ffffffffffffffff8111156129b857600080fd5b6020830191508360208260051b8501011115610c3d57600080fd5b600080602083850312156129e657600080fd5b823567ffffffffffffffff8111156129fd57600080fd5b612a098582860161298e565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612a6a57603f19888603018452612a588583516126be565b94509285019290850190600101612a3c565b5092979650505050505050565b60008060408385031215612a8a57600080fd5b823591506020830135612a9c81612888565b809150509250929050565b600080600060408486031215612abc57600080fd5b83359250602084013567ffffffffffffffff811115612ada57600080fd5b6125c58682870161298e565b600080600060608486031215612afb57600080fd5b83359250612b0b6020850161250c565b9150604084013561294c81612888565b60008060408385031215612b2e57600080fd5b8235612b3981612888565b91506020830135612a9c81612888565b60008251612b5b81846020870161269a565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561058457610584612b65565b8183823760009101908152919050565b600181811c90821680612bb257607f821691505b602082108103612bd257634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156115b957600081815260208120601f850160051c81016020861015612bff5750805b601f850160051c820191505b81811015612c1e57828155600101612c0b565b505050505050565b67ffffffffffffffff831115612c3e57612c3e6127ae565b612c5283612c4c8354612b9e565b83612bd8565b6000601f841160018114612c865760008515612c6e5750838201355b600019600387901b1c1916600186901b1783556111fb565b600083815260209020601f19861690835b82811015612cb75786850135825560209485019460019092019101612c97565b5086821015612cd45760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b604081526000612d23604083018688612ce6565b8281036020840152612d36818587612ce6565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b6020815260006115cb602083018486612ce6565b600067ffffffffffffffff808316818103612d8857612d88612b65565b6001019392505050565b815167ffffffffffffffff811115612dac57612dac6127ae565b612dc081612dba8454612b9e565b84612bd8565b602080601f831160018114612df55760008415612ddd5750858301515b600019600386901b1c1916600185901b178555612c1e565b600085815260208120601f198616915b82811015612e2457888601518255948401946001909101908401612e05565b5085821015612e425787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000612e6560408301866126be565b8281036020840152612e78818587612ce6565b9695505050505050565b600060208284031215612e9457600080fd5b8151610e2981612888565b600061ffff821680612eb357612eb3612b65565b6000190192915050565b604081526000612ed060408301856126be565b905061ffff831660208301529392505050565b600061ffff808316818103612d8857612d88612b65565b606081526000612f0d60608301866126be565b61ffff851660208401528281036040840152612e7881856126be565b8082018082111561058457610584612b65565b6000808335601e19843603018112612f5357600080fd5b83018035915067ffffffffffffffff821115612f6e57600080fd5b602001915036819003821315610c3d57600080fd5b60008085851115612f9357600080fd5b83861115612fa057600080fd5b5050820193919092039150565b8035602083101561058457600019602084900360031b1b1692915050565b600060018201612fdd57612fdd612b65565b5060010190565b634e487b7160e01b600052600160045260246000fdfea26469706673582212200cadfbfa7a3500543d3cccaa88637fe3e6de9643115ee2aba8968d512f3c914864736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101da5760003560e01c80638b95dd7111610104578063c8690233116100a2578063e32954eb11610071578063e32954eb14610504578063e59d895d14610517578063e985e9c51461052a578063f1cb7e061461056657600080fd5b8063c869023314610442578063ce3decdc1461049b578063d5fa2b00146104ae578063d700ff33146104c157600080fd5b8063a8fa5682116100de578063a8fa5682146103b8578063a9784b3e146103cb578063ac9650d81461040f578063bc1c58d11461042f57600080fd5b80638b95dd711461037f578063a22cb46514610392578063a4b91a01146103a557600080fd5b80633603d7581161017c5780635c98042b1161014b5780635c98042b14610333578063623195b014610346578063691f343114610359578063773722131461036c57600080fd5b80633603d758146102a15780633b3b57de146102b45780634cbf6ba4146102c757806359d1d43c1461031357600080fd5b8063124a319c116101b8578063124a319c1461022f5780632203ab561461025a57806329cd62ea1461027b578063304e6ade1461028e57600080fd5b806301ffc9a7146101df5780630af179d71461020757806310f13a8c1461021c575b600080fd5b6101f26101ed366004612529565b610579565b60405190151581526020015b60405180910390f35b61021a610215366004612586565b61058a565b005b61021a61022a3660046125d2565b610794565b61024261023d36600461264c565b610861565b6040516001600160a01b0390911681526020016101fe565b61026d610268366004612678565b610b0d565b6040516101fe9291906126ea565b61021a610289366004612703565b610c44565b61021a61029c366004612586565b610cdf565b61021a6102af36600461272f565b610d5b565b6102426102c236600461272f565b610dfe565b6101f26102d5366004612678565b6000828152602081815260408083205467ffffffffffffffff1683526006825280832094835293815283822092825291909152205461ffff16151590565b610326610321366004612586565b610e30565b6040516101fe9190612748565b61032661034136600461272f565b610f10565b61021a61035436600461275b565b610fcf565b61032661036736600461272f565b61106c565b61021a61037a366004612586565b6110a6565b61021a61038d3660046127c4565b611122565b61021a6103a03660046128ad565b611202565b61021a6103b33660046128d9565b6112f1565b6103266103c6366004612917565b6113be565b6101f26103d9366004612957565b6001600160a01b039283166000908152600c60209081526040808320948352938152838220929094168152925290205460ff1690565b61042261041d3660046129d3565b61140c565b6040516101fe9190612a15565b61032661043d36600461272f565b61141a565b61048661045036600461272f565b6000818152602081815260408083205467ffffffffffffffff168352600982528083209383529290522080546001909101549091565b604080519283526020830191909152016101fe565b61021a6104a9366004612586565b611454565b61021a6104bc366004612a77565b611597565b6104eb6104cf36600461272f565b60006020819052908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016101fe565b610422610512366004612aa7565b6115be565b61021a610525366004612ae6565b6115d3565b6101f2610538366004612b1b565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b610326610574366004612678565b611692565b60006105848261175a565b92915050565b8261059481611798565b61059d57600080fd5b600084815260208181526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff9091169183916106039183918d908d908190840183828082843760009201919091525092939250506119ff9050565b90505b8051516020820151101561072d578661ffff1660000361066b578060400151965061063081611a60565b9450846040516020016106439190612b49565b60405160208183030381529060405280519060200120925061066481611a81565b935061071f565b600061067682611a60565b9050816040015161ffff168861ffff1614158061069a57506106988682611a9d565b155b1561071d576106f68c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d91506106ed908290612b7b565b8b51158a611abb565b81604001519750816020015196508095508580519060200120935061071a82611a81565b94505b505b61072881611d28565b610606565b50835115610788576107888a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c925061077f91508290508f612b7b565b89511588611abb565b50505050505050505050565b8461079e81611798565b6107a757600080fd5b6000868152602081815260408083205467ffffffffffffffff168352600a8252808320898452909152908190209051849184916107e79089908990612b8e565b90815260200160405180910390209182610802929190612c26565b508484604051610813929190612b8e565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516108519493929190612d0f565b60405180910390a3505050505050565b6000828152602081815260408083205467ffffffffffffffff1683526007825280832085845282528083206001600160e01b0319851684529091528120546001600160a01b031680156108b5579050610584565b60006108c085610dfe565b90506001600160a01b0381166108db57600092505050610584565b6040516301ffc9a760e01b602482015260009081906001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516109489190612b49565b600060405180830381855afa9150503d8060008114610983576040519150601f19603f3d011682016040523d82523d6000602084013e610988565b606091505b509150915081158061099b575060208151105b806109dd575080601f815181106109b4576109b4612d41565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109ef576000945050505050610584565b6040516001600160e01b0319871660248201526001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b17905251610a5a9190612b49565b600060405180830381855afa9150503d8060008114610a95576040519150601f19603f3d011682016040523d82523d6000602084013e610a9a565b606091505b509092509050811580610aae575060208151105b80610af0575080601f81518110610ac757610ac7612d41565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610b02576000945050505050610584565b509095945050505050565b6000828152602081815260408083205467ffffffffffffffff168352600180835281842086855290925282206060915b848111610c245780851615801590610b6d575060008181526020839052604081208054610b6990612b9e565b9050115b15610c1c5780826000838152602001908152602001600020808054610b9190612b9e565b80601f0160208091040260200160405190810160405280929190818152602001828054610bbd90612b9e565b8015610c0a5780601f10610bdf57610100808354040283529160200191610c0a565b820191906000526020600020905b815481529060010190602001808311610bed57829003601f168201915b50505050509050935093505050610c3d565b60011b610b3d565b5060006040518060200160405280600081525092509250505b9250929050565b82610c4e81611798565b610c5757600080fd5b604080518082018252848152602080820185815260008881528083528481205467ffffffffffffffff1681526009835284812089825283528490209251835551600190920191909155815185815290810184905285917f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4691015b60405180910390a250505050565b82610ce981611798565b610cf257600080fd5b6000848152602081815260408083205467ffffffffffffffff168352600382528083208784529091529020610d28838583612c26565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610cd1929190612d57565b80610d6581611798565b610d6e57600080fd5b6000828152602081905260408120805467ffffffffffffffff1691610d9283612d6b565b82546101009290920a67ffffffffffffffff818102199093169183160217909155600084815260208181526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610e0c83603c611692565b90508051600003610e205750600092915050565b610e2981611e10565b9392505050565b6000838152602081815260408083205467ffffffffffffffff168352600a825280832086845290915290819020905160609190610e709085908590612b8e565b90815260200160405180910390208054610e8990612b9e565b80601f0160208091040260200160405190810160405280929190818152602001828054610eb590612b9e565b8015610f025780601f10610ed757610100808354040283529160200191610f02565b820191906000526020600020905b815481529060010190602001808311610ee557829003601f168201915b505050505090509392505050565b6000818152602081815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610f4a90612b9e565b80601f0160208091040260200160405190810160405280929190818152602001828054610f7690612b9e565b8015610fc35780601f10610f9857610100808354040283529160200191610fc3565b820191906000526020600020905b815481529060010190602001808311610fa657829003601f168201915b50505050509050919050565b83610fd981611798565b610fe257600080fd5b83610fee600182612b7b565b1615610ff957600080fd5b6000858152602081815260408083205467ffffffffffffffff1683526001825280832088845282528083208784529091529020611037838583612c26565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b6000818152602081815260408083205467ffffffffffffffff168352600882528083208484529091529020805460609190610f4a90612b9e565b826110b081611798565b6110b957600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526008825280832087845290915290206110ef838583612c26565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610cd1929190612d57565b8261112c81611798565b61113557600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af75284846040516111679291906126ea565b60405180910390a2603c83036111be57837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd26111a284611e10565b6040516001600160a01b03909116815260200160405180910390a25b6000848152602081815260408083205467ffffffffffffffff16835260028252808320878452825280832086845290915290206111fb8382612d92565b5050505050565b6001600160a01b03821633036112855760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336000818152600b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6001600160a01b03821633036113495760405162461bcd60e51b815260206004820181905260248201527f53657474696e672064656c65676174652073746174757320666f722073656c66604482015260640161127c565b336000818152600c6020908152604080832087845282528083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519384529286917ff0ddb3b04746704017f9aa8bd728fcc2c1d11675041205350018915f5e4750a0910160405180910390a4505050565b6000838152602081815260408083205467ffffffffffffffff168352600582528083208684528252808320858452825280832061ffff851684529091529020805460609190610e8990612b9e565b6060610e2960008484611e38565b6000818152602081815260408083205467ffffffffffffffff168352600382528083208484529091529020805460609190610f4a90612b9e565b8261145e81611798565b61146757600080fd5b6000848152602081815260408083205467ffffffffffffffff1680845260048352818420888552909252822080549192916114a190612b9e565b80601f01602080910402602001604051908101604052809291908181526020018280546114cd90612b9e565b801561151a5780601f106114ef5761010080835404028352916020019161151a565b820191906000526020600020905b8154815290600101906020018083116114fd57829003601f168201915b5050505067ffffffffffffffff841660009081526004602090815260408083208b845290915290209192506115529050858783612c26565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f8582878760405161158793929190612e52565b60405180910390a2505050505050565b816115a181611798565b6115aa57600080fd5b6115b983603c61038d85612011565b505050565b60606115cb848484611e38565b949350505050565b826115dd81611798565b6115e657600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526007825280832087845282528083206001600160e01b031987168085529083529281902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b6000828152602081815260408083205467ffffffffffffffff16835260028252808320858452825280832084845290915290208054606091906116d490612b9e565b80601f016020809104026020016040519081016040528092919081815260200182805461170090612b9e565b801561174d5780601f106117225761010080835404028352916020019161174d565b820191906000526020600020905b81548152906001019060200180831161173057829003601f168201915b5050505050905092915050565b60006001600160e01b031982167f59d1d43c00000000000000000000000000000000000000000000000000000000148061058457506105848261204a565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806117f95750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b1561180657506001919050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015611887573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ab9190612e82565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b03160361198b576040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611964573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119889190612e82565b90505b6001600160a01b0381163314806119c557506001600160a01b0381166000908152600b6020908152604080832033845290915290205460ff165b80610e2957506001600160a01b0381166000908152600c60209081526040808320868452825280832033845290915290205460ff16610e29565b611a4d6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261058481611d28565b6020810151815160609161058491611a789082612088565b845191906120e2565b60a081015160c082015160609161058491611a78908290612b7b565b600081518351148015610e295750610e298360008460008751612159565b865160208801206000611acf8787876120e2565b90508315611bf95767ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611b1a90612b9e565b159050611b795767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611b5d83612e9f565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091528120611bba916124b6565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a604051611bec929190612ebd565b60405180910390a2610788565b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611c3c90612b9e565b9050600003611c9d5767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611c8183612ee3565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091529020611cdf8282612d92565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a84604051611d1493929190612efa565b60405180910390a250505050505050505050565b60c08101516020820181905281515111611d3f5750565b6000611d5382600001518360200151612088565b8260200151611d629190612f29565b8251909150611d71908261217c565b61ffff166040830152611d85600282612f29565b8251909150611d94908261217c565b61ffff166060830152611da8600282612f29565b8251909150611db790826121a4565b63ffffffff166080830152611dcd600482612f29565b8251909150600090611ddf908361217c565b61ffff169050611df0600283612f29565b60a084018190529150611e038183612f29565b60c0909301929092525050565b60008151601414611e2057600080fd5b50602001516c01000000000000000000000000900490565b60608167ffffffffffffffff811115611e5357611e536127ae565b604051908082528060200260200182016040528015611e8657816020015b6060815260200190600190039081611e715790505b50905060005b82811015612009578415611f51576000848483818110611eae57611eae612d41565b9050602002810190611ec09190612f3c565b611ecf91602491600491612f83565b611ed891612fad565b9050858114611f4f5760405162461bcd60e51b815260206004820152603460248201527f6d756c746963616c6c3a20416c6c207265636f726473206d757374206861766560448201527f2061206d61746368696e67206e616d6568617368000000000000000000000000606482015260840161127c565b505b60008030868685818110611f6757611f67612d41565b9050602002810190611f799190612f3c565b604051611f87929190612b8e565b600060405180830381855af49150503d8060008114611fc2576040519150601f19603f3d011682016040523d82523d6000602084013e611fc7565b606091505b509150915081611fd657600080fd5b80848481518110611fe957611fe9612d41565b60200260200101819052505050808061200190612fcb565b915050611e8c565b509392505050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60006001600160e01b031982167fc86902330000000000000000000000000000000000000000000000000000000014806105845750610584826121ce565b6000815b8351811061209c5761209c612fe4565b60006120a8858361220c565b60ff1690506120b8816001612f29565b6120c29083612f29565b9150806000036120d257506120d8565b5061208c565b6115cb8382612b7b565b82516060906120f18385612f29565b11156120fc57600080fd5b60008267ffffffffffffffff811115612117576121176127ae565b6040519080825280601f01601f191660200182016040528015612141576020820181803683370190505b50905060208082019086860101610b02828287612230565b6000612166848484612286565b612171878785612286565b149695505050505050565b815160009061218c836002612f29565b111561219757600080fd5b50016002015161ffff1690565b81516000906121b4836004612f29565b11156121bf57600080fd5b50016004015163ffffffff1690565b60006001600160e01b031982167f691f34310000000000000000000000000000000000000000000000000000000014806105845750610584826122aa565b600082828151811061222057612220612d41565b016020015160f81c905092915050565b602081106122685781518352612247602084612f29565b9250612254602083612f29565b9150612261602082612b7b565b9050612230565b905182516020929092036101000a6000190180199091169116179052565b82516000906122958385612f29565b11156122a057600080fd5b5091016020012090565b60006001600160e01b031982167f124a319c00000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167fa8fa568200000000000000000000000000000000000000000000000000000000148061234657506001600160e01b031982167f5c98042b00000000000000000000000000000000000000000000000000000000145b8061058457506105848260006001600160e01b031982167fbc1c58d100000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167f3b3b57de0000000000000000000000000000000000000000000000000000000014806123ec57506001600160e01b031982167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061058457506105848260006001600160e01b031982167f2203ab5600000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167fd700ff3300000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167f4fbf043300000000000000000000000000000000000000000000000000000000148061058457506301ffc9a760e01b6001600160e01b0319831614610584565b5080546124c290612b9e565b6000825580601f106124d2575050565b601f0160209004906000526020600020908101906124f091906124f3565b50565b5b8082111561250857600081556001016124f4565b5090565b80356001600160e01b03198116811461252457600080fd5b919050565b60006020828403121561253b57600080fd5b610e298261250c565b60008083601f84011261255657600080fd5b50813567ffffffffffffffff81111561256e57600080fd5b602083019150836020828501011115610c3d57600080fd5b60008060006040848603121561259b57600080fd5b83359250602084013567ffffffffffffffff8111156125b957600080fd5b6125c586828701612544565b9497909650939450505050565b6000806000806000606086880312156125ea57600080fd5b85359450602086013567ffffffffffffffff8082111561260957600080fd5b61261589838a01612544565b9096509450604088013591508082111561262e57600080fd5b5061263b88828901612544565b969995985093965092949392505050565b6000806040838503121561265f57600080fd5b8235915061266f6020840161250c565b90509250929050565b6000806040838503121561268b57600080fd5b50508035926020909101359150565b60005b838110156126b557818101518382015260200161269d565b50506000910152565b600081518084526126d681602086016020860161269a565b601f01601f19169290920160200192915050565b8281526040602082015260006115cb60408301846126be565b60008060006060848603121561271857600080fd5b505081359360208301359350604090920135919050565b60006020828403121561274157600080fd5b5035919050565b602081526000610e2960208301846126be565b6000806000806060858703121561277157600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561279657600080fd5b6127a287828801612544565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b6000806000606084860312156127d957600080fd5b8335925060208401359150604084013567ffffffffffffffff808211156127ff57600080fd5b818601915086601f83011261281357600080fd5b813581811115612825576128256127ae565b604051601f8201601f19908116603f0116810190838211818310171561284d5761284d6127ae565b8160405282815289602084870101111561286657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b6001600160a01b03811681146124f057600080fd5b8035801515811461252457600080fd5b600080604083850312156128c057600080fd5b82356128cb81612888565b915061266f6020840161289d565b6000806000606084860312156128ee57600080fd5b83359250602084013561290081612888565b915061290e6040850161289d565b90509250925092565b60008060006060848603121561292c57600080fd5b8335925060208401359150604084013561ffff8116811461294c57600080fd5b809150509250925092565b60008060006060848603121561296c57600080fd5b833561297781612888565b925060208401359150604084013561294c81612888565b60008083601f8401126129a057600080fd5b50813567ffffffffffffffff8111156129b857600080fd5b6020830191508360208260051b8501011115610c3d57600080fd5b600080602083850312156129e657600080fd5b823567ffffffffffffffff8111156129fd57600080fd5b612a098582860161298e565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612a6a57603f19888603018452612a588583516126be565b94509285019290850190600101612a3c565b5092979650505050505050565b60008060408385031215612a8a57600080fd5b823591506020830135612a9c81612888565b809150509250929050565b600080600060408486031215612abc57600080fd5b83359250602084013567ffffffffffffffff811115612ada57600080fd5b6125c58682870161298e565b600080600060608486031215612afb57600080fd5b83359250612b0b6020850161250c565b9150604084013561294c81612888565b60008060408385031215612b2e57600080fd5b8235612b3981612888565b91506020830135612a9c81612888565b60008251612b5b81846020870161269a565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561058457610584612b65565b8183823760009101908152919050565b600181811c90821680612bb257607f821691505b602082108103612bd257634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156115b957600081815260208120601f850160051c81016020861015612bff5750805b601f850160051c820191505b81811015612c1e57828155600101612c0b565b505050505050565b67ffffffffffffffff831115612c3e57612c3e6127ae565b612c5283612c4c8354612b9e565b83612bd8565b6000601f841160018114612c865760008515612c6e5750838201355b600019600387901b1c1916600186901b1783556111fb565b600083815260209020601f19861690835b82811015612cb75786850135825560209485019460019092019101612c97565b5086821015612cd45760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b604081526000612d23604083018688612ce6565b8281036020840152612d36818587612ce6565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b6020815260006115cb602083018486612ce6565b600067ffffffffffffffff808316818103612d8857612d88612b65565b6001019392505050565b815167ffffffffffffffff811115612dac57612dac6127ae565b612dc081612dba8454612b9e565b84612bd8565b602080601f831160018114612df55760008415612ddd5750858301515b600019600386901b1c1916600185901b178555612c1e565b600085815260208120601f198616915b82811015612e2457888601518255948401946001909101908401612e05565b5085821015612e425787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000612e6560408301866126be565b8281036020840152612e78818587612ce6565b9695505050505050565b600060208284031215612e9457600080fd5b8151610e2981612888565b600061ffff821680612eb357612eb3612b65565b6000190192915050565b604081526000612ed060408301856126be565b905061ffff831660208301529392505050565b600061ffff808316818103612d8857612d88612b65565b606081526000612f0d60608301866126be565b61ffff851660208401528281036040840152612e7881856126be565b8082018082111561058457610584612b65565b6000808335601e19843603018112612f5357600080fd5b83018035915067ffffffffffffffff821115612f6e57600080fd5b602001915036819003821315610c3d57600080fd5b60008085851115612f9357600080fd5b83861115612fa057600080fd5b5050820193919092039150565b8035602083101561058457600019602084900360031b1b1692915050565b600060018201612fdd57612fdd612b65565b5060010190565b634e487b7160e01b600052600160045260246000fdfea26469706673582212200cadfbfa7a3500543d3cccaa88637fe3e6de9643115ee2aba8968d512f3c914864736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "ABI(bytes32,uint256)": { + "params": { + "contentTypes": "A bitwise OR of the ABI formats accepted by the caller.", + "node": "The ENS node to query" + }, + "returns": { + "_0": "contentType The content type of the return value", + "_1": "data The ABI data" + } + }, + "addr(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated address." + } + }, + "approve(bytes32,address,bool)": { + "details": "Approve a delegate to be able to updated records on a node." + }, + "clearRecords(bytes32)": { + "params": { + "node": "The node to update." + } + }, + "contenthash(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated contenthash." + } + }, + "dnsRecord(bytes32,bytes32,uint16)": { + "params": { + "name": "the keccak-256 hash of the fully-qualified name for which to fetch the record", + "node": "the namehash of the node for which to fetch the record", + "resource": "the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types" + }, + "returns": { + "_0": "the DNS record in wire format if present, otherwise empty" + } + }, + "hasDNSRecords(bytes32,bytes32)": { + "params": { + "name": "the namehash of the node for which to check the records", + "node": "the namehash of the node for which to check the records" + } + }, + "interfaceImplementer(bytes32,bytes4)": { + "params": { + "interfaceID": "The EIP 165 interface ID to check for.", + "node": "The ENS node to query." + }, + "returns": { + "_0": "The address that implements this interface, or 0 if the interface is unsupported." + } + }, + "isApprovedFor(address,bytes32,address)": { + "details": "Check to see if the delegate has been approved by the owner for the node." + }, + "isApprovedForAll(address,address)": { + "details": "See {IERC1155-isApprovedForAll}." + }, + "name(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated name." + } + }, + "pubkey(bytes32)": { + "params": { + "node": "The ENS node to query" + }, + "returns": { + "x": "The X coordinate of the curve point for the public key.", + "y": "The Y coordinate of the curve point for the public key." + } + }, + "setABI(bytes32,uint256,bytes)": { + "params": { + "contentType": "The content type of the ABI", + "data": "The ABI data.", + "node": "The node to update." + } + }, + "setAddr(bytes32,address)": { + "params": { + "a": "The address to set.", + "node": "The node to update." + } + }, + "setApprovalForAll(address,bool)": { + "details": "See {IERC1155-setApprovalForAll}." + }, + "setContenthash(bytes32,bytes)": { + "params": { + "hash": "The contenthash to set", + "node": "The node to update." + } + }, + "setDNSRecords(bytes32,bytes)": { + "params": { + "data": "the DNS wire format records to set", + "node": "the namehash of the node for which to set the records" + } + }, + "setInterface(bytes32,bytes4,address)": { + "params": { + "implementer": "The address of a contract that implements this interface for this node.", + "interfaceID": "The EIP 165 interface ID.", + "node": "The node to update." + } + }, + "setName(bytes32,string)": { + "params": { + "node": "The node to update." + } + }, + "setPubkey(bytes32,bytes32,bytes32)": { + "params": { + "node": "The ENS node to query", + "x": "the X coordinate of the curve point for the public key.", + "y": "the Y coordinate of the curve point for the public key." + } + }, + "setText(bytes32,string,string)": { + "params": { + "key": "The key to set.", + "node": "The node to update.", + "value": "The text data value to set." + } + }, + "setZonehash(bytes32,bytes)": { + "params": { + "hash": "The zonehash to set", + "node": "The node to update." + } + }, + "text(bytes32,string)": { + "params": { + "key": "The text data key to query.", + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated text data." + } + }, + "zonehash(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated contenthash." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "ABI(bytes32,uint256)": { + "notice": "Returns the ABI associated with an ENS node. Defined in EIP205." + }, + "addr(bytes32)": { + "notice": "Returns the address associated with an ENS node." + }, + "clearRecords(bytes32)": { + "notice": "Increments the record version associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "contenthash(bytes32)": { + "notice": "Returns the contenthash associated with an ENS node." + }, + "dnsRecord(bytes32,bytes32,uint16)": { + "notice": "Obtain a DNS record." + }, + "hasDNSRecords(bytes32,bytes32)": { + "notice": "Check if a given node has records." + }, + "interfaceImplementer(bytes32,bytes4)": { + "notice": "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." + }, + "name(bytes32)": { + "notice": "Returns the name associated with an ENS node, for reverse records. Defined in EIP181." + }, + "pubkey(bytes32)": { + "notice": "Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619." + }, + "setABI(bytes32,uint256,bytes)": { + "notice": "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." + }, + "setAddr(bytes32,address)": { + "notice": "Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "setContenthash(bytes32,bytes)": { + "notice": "Sets the contenthash associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "setDNSRecords(bytes32,bytes)": { + "notice": "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." + }, + "setInterface(bytes32,bytes4,address)": { + "notice": "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." + }, + "setName(bytes32,string)": { + "notice": "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." + }, + "setPubkey(bytes32,bytes32,bytes32)": { + "notice": "Sets the SECP256k1 public key associated with an ENS node." + }, + "setText(bytes32,string,string)": { + "notice": "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." + }, + "setZonehash(bytes32,bytes)": { + "notice": "setZonehash sets the hash for the zone. May only be called by the owner of that node in the ENS registry." + }, + "text(bytes32,string)": { + "notice": "Returns the text data associated with an ENS node and key." + }, + "zonehash(bytes32)": { + "notice": "zonehash obtains the hash for the zone." + } + }, + "notice": "A simple resolver anyone can use; only allows the owner of a node to set its address.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 15383, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "recordVersions", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_bytes32,t_uint64)" + }, + { + "astId": 15477, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_abis", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))" + }, + { + "astId": 15631, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_addresses", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))" + }, + { + "astId": 15822, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_hashes", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))" + }, + { + "astId": 15912, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_zonehashes", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))" + }, + { + "astId": 15922, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_records", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))))" + }, + { + "astId": 15930, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_nameEntriesCount", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16)))" + }, + { + "astId": 16668, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_interfaces", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes4,t_address)))" + }, + { + "astId": 16860, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_names", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_string_storage))" + }, + { + "astId": 16947, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_pubkeys", + "offset": 0, + "slot": "9", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_struct(PublicKey)16940_storage))" + }, + { + "astId": 17050, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_texts", + "offset": 0, + "slot": "10", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage)))" + }, + { + "astId": 14912, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "_operatorApprovals", + "offset": 0, + "slot": "11", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" + }, + { + "astId": 14921, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "_tokenApprovals", + "offset": 0, + "slot": "12", + "type": "t_mapping(t_address,t_mapping(t_bytes32,t_mapping(t_address,t_bool)))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes4": { + "encoding": "inplace", + "label": "bytes4", + "numberOfBytes": "4" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_address,t_mapping(t_bytes32,t_mapping(t_address,t_bool)))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(bytes32 => mapping(address => bool)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_address,t_bool))" + }, + "t_mapping(t_bytes32,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_bytes32,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage)))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes32 => uint16))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_uint16)" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes4,t_address))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes4 => address))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes4,t_address)" + }, + "t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(string => string))", + "numberOfBytes": "32", + "value": "t_mapping(t_string_memory_ptr,t_string_storage)" + }, + "t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint16 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint16,t_bytes_storage)" + }, + "t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint256 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_bytes_storage)" + }, + "t_mapping(t_bytes32,t_string_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_bytes32,t_struct(PublicKey)16940_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct PubkeyResolver.PublicKey)", + "numberOfBytes": "32", + "value": "t_struct(PublicKey)16940_storage" + }, + "t_mapping(t_bytes32,t_uint16)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint16)", + "numberOfBytes": "32", + "value": "t_uint16" + }, + "t_mapping(t_bytes32,t_uint64)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint64)", + "numberOfBytes": "32", + "value": "t_uint64" + }, + "t_mapping(t_bytes4,t_address)": { + "encoding": "mapping", + "key": "t_bytes4", + "label": "mapping(bytes4 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_string_memory_ptr,t_string_storage)": { + "encoding": "mapping", + "key": "t_string_memory_ptr", + "label": "mapping(string => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_uint16,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint256,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_bytes_storage)" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage)))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes4,t_address)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes4,t_address))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(string => string)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_string_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => string))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_string_storage)" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_struct(PublicKey)16940_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => struct PubkeyResolver.PublicKey))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_struct(PublicKey)16940_storage)" + }, + "t_string_memory_ptr": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(PublicKey)16940_storage": { + "encoding": "inplace", + "label": "struct PubkeyResolver.PublicKey", + "members": [ + { + "astId": 16937, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "x", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 16939, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "y", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint16": { + "encoding": "inplace", + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint64": { + "encoding": "inplace", + "label": "uint64", + "numberOfBytes": "8" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/RSASHA1Algorithm.json b/solidity/dns-contracts/deployments/mainnet/RSASHA1Algorithm.json new file mode 100644 index 0000000..6d87f8d --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/RSASHA1Algorithm.json @@ -0,0 +1,71 @@ +{ + "address": "0x6ca8624Bc207F043D140125486De0f7E624e37A1", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "key", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xb7c94bd5d50e457e72c2880a671a61d5a834edb9d10fcbc5225b4094a09ebae4", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0x6ca8624Bc207F043D140125486De0f7E624e37A1", + "transactionIndex": 99, + "gasUsed": "695194", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x2cfbe854ef4921cee8511fa586d4c14a5cee499656c89c20e5519a44e0ebc23f", + "transactionHash": "0xb7c94bd5d50e457e72c2880a671a61d5a834edb9d10fcbc5225b4094a09ebae4", + "logs": [], + "blockNumber": 19020681, + "cumulativeGasUsed": "7769977", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 2, + "solcInputHash": "dd9e022689821cffaeb04b9ddbda87ae", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC RSASHA1 algorithm.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol\":\"RSASHA1Algorithm\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/solsha1/contracts/SHA1.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary SHA1 {\\n event Debug(bytes32 x);\\n\\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\\n assembly {\\n // Get a safe scratch location\\n let scratch := mload(0x40)\\n\\n // Get the data length, and point data at the first byte\\n let len := mload(data)\\n data := add(data, 32)\\n\\n // Find the length after padding\\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\\n switch lt(sub(totallen, len), 9)\\n case 1 { totallen := add(totallen, 64) }\\n\\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\\n\\n function readword(ptr, off, count) -> result {\\n result := 0\\n if lt(off, count) {\\n result := mload(add(ptr, off))\\n count := sub(count, off)\\n if lt(count, 32) {\\n let mask := not(sub(exp(256, sub(32, count)), 1))\\n result := and(result, mask)\\n }\\n }\\n }\\n\\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\\n mstore(scratch, readword(data, i, len))\\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\\n\\n // If we loaded the last byte, store the terminator byte\\n switch lt(sub(len, i), 64)\\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\\n\\n // If this is the last block, store the length\\n switch eq(i, sub(totallen, 64))\\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\\n\\n // Expand the 16 32-bit words into 80\\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\\n mstore(add(scratch, j), temp)\\n }\\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\\n mstore(add(scratch, j), temp)\\n }\\n\\n let x := h\\n let f := 0\\n let k := 0\\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\\n switch div(j, 20)\\n case 0 {\\n // f = d xor (b and (c xor d))\\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\\n f := and(div(x, 0x1000000000000000000000000000000), f)\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x5A827999\\n }\\n case 1{\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x6ED9EBA1\\n }\\n case 2 {\\n // f = (b and c) or (d and (b or c))\\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := and(div(x, 0x10000000000), f)\\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\\n k := 0x8F1BBCDC\\n }\\n case 3 {\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0xCA62C1D6\\n }\\n // temp = (a leftrotate 5) + f + e + k + w[i]\\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\\n temp := add(f, temp)\\n temp := add(and(x, 0xFFFFFFFF), temp)\\n temp := add(k, temp)\\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\\n }\\n\\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\\n }\\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x746d9b85de197afbc13182cbe4ba4f7917f19594e07c655d6a0c85fdf7460a8a\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n */\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata signature\\n ) external view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xaf6825f9852c69f8e36540821d067b4550dd2263497af9d645309b6a0c457ba6\"},\"contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary ModexpPrecompile {\\n /**\\n * @dev Computes (base ^ exponent) % modulus over big numbers.\\n */\\n function modexp(\\n bytes memory base,\\n bytes memory exponent,\\n bytes memory modulus\\n ) internal view returns (bool success, bytes memory output) {\\n bytes memory input = abi.encodePacked(\\n uint256(base.length),\\n uint256(exponent.length),\\n uint256(modulus.length),\\n base,\\n exponent,\\n modulus\\n );\\n\\n output = new bytes(modulus.length);\\n\\n assembly {\\n success := staticcall(\\n gas(),\\n 5,\\n add(input, 32),\\n mload(input),\\n add(output, 32),\\n mload(modulus)\\n )\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb3d46284534eb99061d4c79968c2d0420b63a6649d118ef2ea3608396b85de3f\"},\"contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./RSAVerify.sol\\\";\\nimport \\\"@ensdomains/solsha1/contracts/SHA1.sol\\\";\\n\\n/**\\n * @dev Implements the DNSSEC RSASHA1 algorithm.\\n */\\ncontract RSASHA1Algorithm is Algorithm {\\n using BytesUtils for *;\\n\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata sig\\n ) external view override returns (bool) {\\n bytes memory exponent;\\n bytes memory modulus;\\n\\n uint16 exponentLen = uint16(key.readUint8(4));\\n if (exponentLen != 0) {\\n exponent = key.substring(5, exponentLen);\\n modulus = key.substring(\\n exponentLen + 5,\\n key.length - exponentLen - 5\\n );\\n } else {\\n exponentLen = key.readUint16(5);\\n exponent = key.substring(7, exponentLen);\\n modulus = key.substring(\\n exponentLen + 7,\\n key.length - exponentLen - 7\\n );\\n }\\n\\n // Recover the message from the signature\\n bool ok;\\n bytes memory result;\\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\\n\\n // Verify it ends with the hash of our data\\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\\n }\\n}\\n\",\"keccak256\":\"0x5dee71f5a212ef48761ab4154fd68fb738eaefe145ee6c3a30d0ed6c63782b55\"},\"contracts/dnssec-oracle/algorithms/RSAVerify.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./ModexpPrecompile.sol\\\";\\n\\nlibrary RSAVerify {\\n /**\\n * @dev Recovers the input data from an RSA signature, returning the result in S.\\n * @param N The RSA public modulus.\\n * @param E The RSA public exponent.\\n * @param S The signature to recover.\\n * @return True if the recovery succeeded.\\n */\\n function rsarecover(\\n bytes memory N,\\n bytes memory E,\\n bytes memory S\\n ) internal view returns (bool, bytes memory) {\\n return ModexpPrecompile.modexp(S, E, N);\\n }\\n}\\n\",\"keccak256\":\"0xb386daa80070f79399a2cb97a534f31660161ccd50662fabcf63e26cce064506\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610bac806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e3660046109e6565b610057565b604051901515815260200160405180910390f35b600060608060006100a260048b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506103009050565b60ff169050801561016e576100f760058261ffff168c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103259050565b9250610167610107826005610a96565b61ffff9081169060059061011d9085168d610ab8565b6101279190610ab8565b8c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103259050565b9150610227565b6101b260058b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506103a99050565b90506101fe60078261ffff168c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103259050565b925061022461020e826007610a96565b61ffff9081169060079061011d9085168d610ab8565b91505b6000606061026c84868a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103d192505050565b90925090508180156102f057506102916014825161028a9190610ab8565b82906103ec565b6bffffffffffffffffffffffff19166102df8b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061041f92505050565b6bffffffffffffffffffffffff1916145b9c9b505050505050505050505050565b600082828151811061031457610314610acb565b016020015160f81c90505b92915050565b82516060906103348385610ae1565b111561033f57600080fd5b60008267ffffffffffffffff81111561035a5761035a610af4565b6040519080825280601f01601f191660200182016040528015610384576020820181803683370190505b5090506020808201908686010161039c8282876108b0565b50909150505b9392505050565b81516000906103b9836002610ae1565b11156103c457600080fd5b50016002015161ffff1690565b600060606103e0838587610906565b91509150935093915050565b81516000906103fc836014610ae1565b111561040757600080fd5b5001602001516bffffffffffffffffffffffff191690565b60006040518251602084019350604067ffffffffffffffc060018301160160098282031060018103610452576040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f06104a4565b6000838310156103a2575080820151928290039260208410156103a25760001960208590036101000a0119169392505050565b60005b82811015610830576104ba848289610471565b85526104ca846020830189610471565b6020860152604081850310600181036104e65760808286038701535b506040830381146001810361050357602086018051600887021790525b5060405b608081101561058b57858101603f19810151603719820151601f19830151600b198401516002911891909218189081027ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe1663800000009091047c010000000100000001000000010000000100000001000000010000000116179052600c01610507565b5060805b61014081101561061457858101607f19810151606f19820151603f198301516017198401516004911891909218189081027ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc1663400000009091047c03000000030000000300000003000000030000000300000003000000031617905260180161058f565b508160008060005b60508110156108065760148104801561064c576001811461067c57600281146106aa57600381146106dd57610707565b6501000000000085046a010000000000000000000086048118600160781b870416189350635a8279999250610707565b650100000000008504600160781b86046a0100000000000000000000870418189350636ed9eba19250610707565b6a01000000000000000000008504600160781b8604818117650100000000008804169116179350638f1bbcdc9250610707565b650100000000008504600160781b86046a010000000000000000000087041818935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c015104019050740100000000000000000000000000000000000000008102650100000000008604179450506a0100000000000000000000633fffffff6a040000000000000000000086041663c00000006604000000000000870416170277ffffffff00ffffffff000000000000ffffffff00ffffffff851617935060018101905061061c565b5050509190910177ffffffff00ffffffff00ffffffff00ffffffff00ffffffff16906040016104a7565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b602081106108e857815183526108c7602084610ae1565b92506108d4602083610ae1565b91506108e1602082610ab8565b90506108b0565b905182516020929092036101000a6000190180199091169116179052565b60006060600085518551855188888860405160200161092a96959493929190610b3a565b6040516020818303038152906040529050835167ffffffffffffffff81111561095557610955610af4565b6040519080825280601f01601f19166020018201604052801561097f576020820181803683370190505b50915083516020830182516020840160055afa925050935093915050565b60008083601f8401126109af57600080fd5b50813567ffffffffffffffff8111156109c757600080fd5b6020830191508360208285010111156109df57600080fd5b9250929050565b600080600080600080606087890312156109ff57600080fd5b863567ffffffffffffffff80821115610a1757600080fd5b610a238a838b0161099d565b90985096506020890135915080821115610a3c57600080fd5b610a488a838b0161099d565b90965094506040890135915080821115610a6157600080fd5b50610a6e89828a0161099d565b979a9699509497509295939492505050565b634e487b7160e01b600052601160045260246000fd5b61ffff818116838216019080821115610ab157610ab1610a80565b5092915050565b8181038181111561031f5761031f610a80565b634e487b7160e01b600052603260045260246000fd5b8082018082111561031f5761031f610a80565b634e487b7160e01b600052604160045260246000fd5b6000815160005b81811015610b2b5760208185018101518683015201610b11565b50600093019283525090919050565b8681528560208201528460408201526000610b6a610b64610b5e6060850188610b0a565b86610b0a565b84610b0a565b9897505050505050505056fea26469706673582212207857b7c8a67e5fd64e3ccb8e7b2e6fbd8ac879a5659d7498b1bc12aeeba36c9764736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e3660046109e6565b610057565b604051901515815260200160405180910390f35b600060608060006100a260048b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506103009050565b60ff169050801561016e576100f760058261ffff168c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103259050565b9250610167610107826005610a96565b61ffff9081169060059061011d9085168d610ab8565b6101279190610ab8565b8c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103259050565b9150610227565b6101b260058b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506103a99050565b90506101fe60078261ffff168c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103259050565b925061022461020e826007610a96565b61ffff9081169060079061011d9085168d610ab8565b91505b6000606061026c84868a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103d192505050565b90925090508180156102f057506102916014825161028a9190610ab8565b82906103ec565b6bffffffffffffffffffffffff19166102df8b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061041f92505050565b6bffffffffffffffffffffffff1916145b9c9b505050505050505050505050565b600082828151811061031457610314610acb565b016020015160f81c90505b92915050565b82516060906103348385610ae1565b111561033f57600080fd5b60008267ffffffffffffffff81111561035a5761035a610af4565b6040519080825280601f01601f191660200182016040528015610384576020820181803683370190505b5090506020808201908686010161039c8282876108b0565b50909150505b9392505050565b81516000906103b9836002610ae1565b11156103c457600080fd5b50016002015161ffff1690565b600060606103e0838587610906565b91509150935093915050565b81516000906103fc836014610ae1565b111561040757600080fd5b5001602001516bffffffffffffffffffffffff191690565b60006040518251602084019350604067ffffffffffffffc060018301160160098282031060018103610452576040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f06104a4565b6000838310156103a2575080820151928290039260208410156103a25760001960208590036101000a0119169392505050565b60005b82811015610830576104ba848289610471565b85526104ca846020830189610471565b6020860152604081850310600181036104e65760808286038701535b506040830381146001810361050357602086018051600887021790525b5060405b608081101561058b57858101603f19810151603719820151601f19830151600b198401516002911891909218189081027ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe1663800000009091047c010000000100000001000000010000000100000001000000010000000116179052600c01610507565b5060805b61014081101561061457858101607f19810151606f19820151603f198301516017198401516004911891909218189081027ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc1663400000009091047c03000000030000000300000003000000030000000300000003000000031617905260180161058f565b508160008060005b60508110156108065760148104801561064c576001811461067c57600281146106aa57600381146106dd57610707565b6501000000000085046a010000000000000000000086048118600160781b870416189350635a8279999250610707565b650100000000008504600160781b86046a0100000000000000000000870418189350636ed9eba19250610707565b6a01000000000000000000008504600160781b8604818117650100000000008804169116179350638f1bbcdc9250610707565b650100000000008504600160781b86046a010000000000000000000087041818935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c015104019050740100000000000000000000000000000000000000008102650100000000008604179450506a0100000000000000000000633fffffff6a040000000000000000000086041663c00000006604000000000000870416170277ffffffff00ffffffff000000000000ffffffff00ffffffff851617935060018101905061061c565b5050509190910177ffffffff00ffffffff00ffffffff00ffffffff00ffffffff16906040016104a7565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b602081106108e857815183526108c7602084610ae1565b92506108d4602083610ae1565b91506108e1602082610ab8565b90506108b0565b905182516020929092036101000a6000190180199091169116179052565b60006060600085518551855188888860405160200161092a96959493929190610b3a565b6040516020818303038152906040529050835167ffffffffffffffff81111561095557610955610af4565b6040519080825280601f01601f19166020018201604052801561097f576020820181803683370190505b50915083516020830182516020840160055afa925050935093915050565b60008083601f8401126109af57600080fd5b50813567ffffffffffffffff8111156109c757600080fd5b6020830191508360208285010111156109df57600080fd5b9250929050565b600080600080600080606087890312156109ff57600080fd5b863567ffffffffffffffff80821115610a1757600080fd5b610a238a838b0161099d565b90985096506020890135915080821115610a3c57600080fd5b610a488a838b0161099d565b90965094506040890135915080821115610a6157600080fd5b50610a6e89828a0161099d565b979a9699509497509295939492505050565b634e487b7160e01b600052601160045260246000fd5b61ffff818116838216019080821115610ab157610ab1610a80565b5092915050565b8181038181111561031f5761031f610a80565b634e487b7160e01b600052603260045260246000fd5b8082018082111561031f5761031f610a80565b634e487b7160e01b600052604160045260246000fd5b6000815160005b81811015610b2b5760208185018101518683015201610b11565b50600093019283525090919050565b8681528560208201528460408201526000610b6a610b64610b5e6060850188610b0a565b86610b0a565b84610b0a565b9897505050505050505056fea26469706673582212207857b7c8a67e5fd64e3ccb8e7b2e6fbd8ac879a5659d7498b1bc12aeeba36c9764736f6c63430008110033", + "devdoc": { + "details": "Implements the DNSSEC RSASHA1 algorithm.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/RSASHA256Algorithm.json b/solidity/dns-contracts/deployments/mainnet/RSASHA256Algorithm.json new file mode 100644 index 0000000..fca8cde --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/RSASHA256Algorithm.json @@ -0,0 +1,71 @@ +{ + "address": "0x9D1B5a639597f558bC37Cf81813724076c5C1e96", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "key", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x3bfc4088c954a7fd47fc5bc40fb0affdb5ca8369229e307e12019da09cee3665", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0x9D1B5a639597f558bC37Cf81813724076c5C1e96", + "transactionIndex": 33, + "gasUsed": "448967", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x386dd045029097dd9139f841cbf593572c54b455e846186854148c9fe4db391f", + "transactionHash": "0x3bfc4088c954a7fd47fc5bc40fb0affdb5ca8369229e307e12019da09cee3665", + "logs": [], + "blockNumber": 19020682, + "cumulativeGasUsed": "3660506", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 2, + "solcInputHash": "dd9e022689821cffaeb04b9ddbda87ae", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC RSASHA256 algorithm.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol\":\"RSASHA256Algorithm\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n */\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata signature\\n ) external view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xaf6825f9852c69f8e36540821d067b4550dd2263497af9d645309b6a0c457ba6\"},\"contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary ModexpPrecompile {\\n /**\\n * @dev Computes (base ^ exponent) % modulus over big numbers.\\n */\\n function modexp(\\n bytes memory base,\\n bytes memory exponent,\\n bytes memory modulus\\n ) internal view returns (bool success, bytes memory output) {\\n bytes memory input = abi.encodePacked(\\n uint256(base.length),\\n uint256(exponent.length),\\n uint256(modulus.length),\\n base,\\n exponent,\\n modulus\\n );\\n\\n output = new bytes(modulus.length);\\n\\n assembly {\\n success := staticcall(\\n gas(),\\n 5,\\n add(input, 32),\\n mload(input),\\n add(output, 32),\\n mload(modulus)\\n )\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb3d46284534eb99061d4c79968c2d0420b63a6649d118ef2ea3608396b85de3f\"},\"contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./RSAVerify.sol\\\";\\n\\n/**\\n * @dev Implements the DNSSEC RSASHA256 algorithm.\\n */\\ncontract RSASHA256Algorithm is Algorithm {\\n using BytesUtils for *;\\n\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata sig\\n ) external view override returns (bool) {\\n bytes memory exponent;\\n bytes memory modulus;\\n\\n uint16 exponentLen = uint16(key.readUint8(4));\\n if (exponentLen != 0) {\\n exponent = key.substring(5, exponentLen);\\n modulus = key.substring(\\n exponentLen + 5,\\n key.length - exponentLen - 5\\n );\\n } else {\\n exponentLen = key.readUint16(5);\\n exponent = key.substring(7, exponentLen);\\n modulus = key.substring(\\n exponentLen + 7,\\n key.length - exponentLen - 7\\n );\\n }\\n\\n // Recover the message from the signature\\n bool ok;\\n bytes memory result;\\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\\n\\n // Verify it ends with the hash of our data\\n return ok && sha256(data) == result.readBytes32(result.length - 32);\\n }\\n}\\n\",\"keccak256\":\"0x1d6ba44f41e957f9c53e6e5b88150cbb6c9f46e9da196502984ee0a53e9ac5a9\"},\"contracts/dnssec-oracle/algorithms/RSAVerify.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./ModexpPrecompile.sol\\\";\\n\\nlibrary RSAVerify {\\n /**\\n * @dev Recovers the input data from an RSA signature, returning the result in S.\\n * @param N The RSA public modulus.\\n * @param E The RSA public exponent.\\n * @param S The signature to recover.\\n * @return True if the recovery succeeded.\\n */\\n function rsarecover(\\n bytes memory N,\\n bytes memory E,\\n bytes memory S\\n ) internal view returns (bool, bytes memory) {\\n return ModexpPrecompile.modexp(S, E, N);\\n }\\n}\\n\",\"keccak256\":\"0xb386daa80070f79399a2cb97a534f31660161ccd50662fabcf63e26cce064506\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610728806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e366004610539565b610057565b604051901515815260200160405180910390f35b600060608060006100a260048b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506102f59050565b60ff169050801561016e576100f760058261ffff168c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061031a9050565b92506101676101078260056105e9565b61ffff9081169060059061011d9085168d61060b565b610127919061060b565b8c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061031a9050565b9150610227565b6101b260058b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061039c9050565b90506101fe60078261ffff168c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061031a9050565b925061022461020e8260076105e9565b61ffff9081169060079061011d9085168d61060b565b91505b6000606061026c84868a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103c492505050565b90925090508180156102e557506102916020825161028a919061060b565b82906103df565b60028b8b6040516102a392919061061e565b602060405180830381855afa1580156102c0573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906102e3919061062e565b145b9c9b505050505050505050505050565b600082828151811061030957610309610647565b016020015160f81c90505b92915050565b8251606090610329838561065d565b111561033457600080fd5b60008267ffffffffffffffff81111561034f5761034f610670565b6040519080825280601f01601f191660200182016040528015610379576020820181803683370190505b50905060208082019086860101610391828287610403565b509095945050505050565b81516000906103ac83600261065d565b11156103b757600080fd5b50016002015161ffff1690565b600060606103d3838587610459565b91509150935093915050565b81516000906103ef83602061065d565b11156103fa57600080fd5b50016020015190565b6020811061043b578151835261041a60208461065d565b925061042760208361065d565b915061043460208261060b565b9050610403565b905182516020929092036101000a6000190180199091169116179052565b60006060600085518551855188888860405160200161047d969594939291906106b6565b6040516020818303038152906040529050835167ffffffffffffffff8111156104a8576104a8610670565b6040519080825280601f01601f1916602001820160405280156104d2576020820181803683370190505b50915083516020830182516020840160055afa925050935093915050565b60008083601f84011261050257600080fd5b50813567ffffffffffffffff81111561051a57600080fd5b60208301915083602082850101111561053257600080fd5b9250929050565b6000806000806000806060878903121561055257600080fd5b863567ffffffffffffffff8082111561056a57600080fd5b6105768a838b016104f0565b9098509650602089013591508082111561058f57600080fd5b61059b8a838b016104f0565b909650945060408901359150808211156105b457600080fd5b506105c189828a016104f0565b979a9699509497509295939492505050565b634e487b7160e01b600052601160045260246000fd5b61ffff818116838216019080821115610604576106046105d3565b5092915050565b81810381811115610314576103146105d3565b8183823760009101908152919050565b60006020828403121561064057600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b80820180821115610314576103146105d3565b634e487b7160e01b600052604160045260246000fd5b6000815160005b818110156106a7576020818501810151868301520161068d565b50600093019283525090919050565b86815285602082015284604082015260006106e66106e06106da6060850188610686565b86610686565b84610686565b9897505050505050505056fea264697066735822122081d54f6872821586c976d8d9aa106e2ea811afa445a713b0da099f753dd8e48364736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e366004610539565b610057565b604051901515815260200160405180910390f35b600060608060006100a260048b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506102f59050565b60ff169050801561016e576100f760058261ffff168c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061031a9050565b92506101676101078260056105e9565b61ffff9081169060059061011d9085168d61060b565b610127919061060b565b8c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061031a9050565b9150610227565b6101b260058b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061039c9050565b90506101fe60078261ffff168c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061031a9050565b925061022461020e8260076105e9565b61ffff9081169060079061011d9085168d61060b565b91505b6000606061026c84868a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103c492505050565b90925090508180156102e557506102916020825161028a919061060b565b82906103df565b60028b8b6040516102a392919061061e565b602060405180830381855afa1580156102c0573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906102e3919061062e565b145b9c9b505050505050505050505050565b600082828151811061030957610309610647565b016020015160f81c90505b92915050565b8251606090610329838561065d565b111561033457600080fd5b60008267ffffffffffffffff81111561034f5761034f610670565b6040519080825280601f01601f191660200182016040528015610379576020820181803683370190505b50905060208082019086860101610391828287610403565b509095945050505050565b81516000906103ac83600261065d565b11156103b757600080fd5b50016002015161ffff1690565b600060606103d3838587610459565b91509150935093915050565b81516000906103ef83602061065d565b11156103fa57600080fd5b50016020015190565b6020811061043b578151835261041a60208461065d565b925061042760208361065d565b915061043460208261060b565b9050610403565b905182516020929092036101000a6000190180199091169116179052565b60006060600085518551855188888860405160200161047d969594939291906106b6565b6040516020818303038152906040529050835167ffffffffffffffff8111156104a8576104a8610670565b6040519080825280601f01601f1916602001820160405280156104d2576020820181803683370190505b50915083516020830182516020840160055afa925050935093915050565b60008083601f84011261050257600080fd5b50813567ffffffffffffffff81111561051a57600080fd5b60208301915083602082850101111561053257600080fd5b9250929050565b6000806000806000806060878903121561055257600080fd5b863567ffffffffffffffff8082111561056a57600080fd5b6105768a838b016104f0565b9098509650602089013591508082111561058f57600080fd5b61059b8a838b016104f0565b909650945060408901359150808211156105b457600080fd5b506105c189828a016104f0565b979a9699509497509295939492505050565b634e487b7160e01b600052601160045260246000fd5b61ffff818116838216019080821115610604576106046105d3565b5092915050565b81810381811115610314576103146105d3565b8183823760009101908152919050565b60006020828403121561064057600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b80820180821115610314576103146105d3565b634e487b7160e01b600052604160045260246000fd5b6000815160005b818110156106a7576020818501810151868301520161068d565b50600093019283525090919050565b86815285602082015284604082015260006106e66106e06106da6060850188610686565b86610686565b84610686565b9897505050505050505056fea264697066735822122081d54f6872821586c976d8d9aa106e2ea811afa445a713b0da099f753dd8e48364736f6c63430008110033", + "devdoc": { + "details": "Implements the DNSSEC RSASHA256 algorithm.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/ReverseRegistrar.json b/solidity/dns-contracts/deployments/mainnet/ReverseRegistrar.json new file mode 100644 index 0000000..58738e0 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/ReverseRegistrar.json @@ -0,0 +1,530 @@ +{ + "address": "0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "ensAddr", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "ControllerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract NameResolver", + "name": "resolver", + "type": "address" + } + ], + "name": "DefaultResolverChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "ReverseClaimed", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "claim", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "claimForAddr", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "claimWithResolver", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "defaultResolver", + "outputs": [ + { + "internalType": "contract NameResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "node", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setDefaultResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "setName", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "setNameForAddr", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x93d9a7b934d176c7acd14b29e87f141ce73493e7433ac4dbdd0bf5de8c950f5f", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb", + "transactionIndex": 70, + "gasUsed": "861172", + "logsBloom": "0x01000000000004000000000008000000000000000000000000800000000000000000040000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000001000000000000000000400000010000000000000000000000000000000020000000000000000000000000080000000000040000000000000004000000000000000001008000040000000000000000000000000000000000005000000000000000000000000000000020000000000000000000000000000100000000000000001000000000000000000000", + "blockHash": "0x94d3a033dc149409d4461b0db93715cf02eed021760ba32e1a74f1ae002e9cb2", + "transactionHash": "0x93d9a7b934d176c7acd14b29e87f141ce73493e7433ac4dbdd0bf5de8c950f5f", + "logs": [ + { + "transactionIndex": 70, + "blockNumber": 16925606, + "transactionHash": "0x93d9a7b934d176c7acd14b29e87f141ce73493e7433ac4dbdd0bf5de8c950f5f", + "address": "0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000904dac3347ea47d208f3fd67402d039a3b99859" + ], + "data": "0x", + "logIndex": 161, + "blockHash": "0x94d3a033dc149409d4461b0db93715cf02eed021760ba32e1a74f1ae002e9cb2" + }, + { + "transactionIndex": 70, + "blockNumber": 16925606, + "transactionHash": "0x93d9a7b934d176c7acd14b29e87f141ce73493e7433ac4dbdd0bf5de8c950f5f", + "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "topics": [ + "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", + "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2", + "0x7e4bc645674ba94b5d4acbc7cc31d65eba4f35d0e15c97816782ebb0c2fdd145" + ], + "data": "0x0000000000000000000000000904dac3347ea47d208f3fd67402d039a3b99859", + "logIndex": 162, + "blockHash": "0x94d3a033dc149409d4461b0db93715cf02eed021760ba32e1a74f1ae002e9cb2" + } + ], + "blockNumber": 16925606, + "cumulativeGasUsed": "5640100", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "numDeployments": 1, + "solcInputHash": "3fa59c31b7672c86eff32031f5a10f8a", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"ensAddr\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"ControllerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract NameResolver\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"DefaultResolverChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"ReverseClaimed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"claimForAddr\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"claimWithResolver\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"defaultResolver\",\"outputs\":[{\"internalType\":\"contract NameResolver\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"node\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setDefaultResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"setNameForAddr\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"claim(address)\":{\"details\":\"Transfers ownership of the reverse ENS record associated with the calling account.\",\"params\":{\"owner\":\"The address to set as the owner of the reverse record in ENS.\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"claimForAddr(address,address,address)\":{\"details\":\"Transfers ownership of the reverse ENS record associated with the calling account.\",\"params\":{\"addr\":\"The reverse record to set\",\"owner\":\"The address to set as the owner of the reverse record in ENS.\",\"resolver\":\"The resolver of the reverse node\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"claimWithResolver(address,address)\":{\"details\":\"Transfers ownership of the reverse ENS record associated with the calling account.\",\"params\":{\"owner\":\"The address to set as the owner of the reverse record in ENS.\",\"resolver\":\"The address of the resolver to set; 0 to leave unchanged.\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"constructor\":{\"details\":\"Constructor\",\"params\":{\"ensAddr\":\"The address of the ENS registry.\"}},\"node(address)\":{\"details\":\"Returns the node hash for a given account's reverse records.\",\"params\":{\"addr\":\"The address to hash\"},\"returns\":{\"_0\":\"The ENS node hash.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setName(string)\":{\"details\":\"Sets the `name()` record for the reverse ENS record associated with the calling account. First updates the resolver to the default reverse resolver if necessary.\",\"params\":{\"name\":\"The name to set for this address.\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"setNameForAddr(address,address,address,string)\":{\"details\":\"Sets the `name()` record for the reverse ENS record associated with the account provided. Updates the resolver to a designated resolver Only callable by controllers and authorised users\",\"params\":{\"addr\":\"The reverse record to set\",\"name\":\"The name to set for this address.\",\"owner\":\"The owner of the reverse node\",\"resolver\":\"The resolver of the reverse node\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/reverseRegistrar/ReverseRegistrar.sol\":\"ReverseRegistrar\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1300},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IReverseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"../root/Controllable.sol\\\";\\n\\nabstract contract NameResolver {\\n function setName(bytes32 node, string memory name) public virtual;\\n}\\n\\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\\n\\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n// namehash('addr.reverse')\\n\\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\\n ENS public immutable ens;\\n NameResolver public defaultResolver;\\n\\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\\n event DefaultResolverChanged(NameResolver indexed resolver);\\n\\n /**\\n * @dev Constructor\\n * @param ensAddr The address of the ENS registry.\\n */\\n constructor(ENS ensAddr) {\\n ens = ensAddr;\\n\\n // Assign ownership of the reverse record to our deployer\\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\\n ensAddr.owner(ADDR_REVERSE_NODE)\\n );\\n if (address(oldRegistrar) != address(0x0)) {\\n oldRegistrar.claim(msg.sender);\\n }\\n }\\n\\n modifier authorised(address addr) {\\n require(\\n addr == msg.sender ||\\n controllers[msg.sender] ||\\n ens.isApprovedForAll(addr, msg.sender) ||\\n ownsContract(addr),\\n \\\"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\\\"\\n );\\n _;\\n }\\n\\n function setDefaultResolver(address resolver) public override onlyOwner {\\n require(\\n address(resolver) != address(0),\\n \\\"ReverseRegistrar: Resolver address must not be 0\\\"\\n );\\n defaultResolver = NameResolver(resolver);\\n emit DefaultResolverChanged(NameResolver(resolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claim(address owner) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, address(defaultResolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param addr The reverse record to set\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The resolver of the reverse node\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) public override authorised(addr) returns (bytes32) {\\n bytes32 labelHash = sha3HexAddress(addr);\\n bytes32 reverseNode = keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\\n );\\n emit ReverseClaimed(addr, reverseNode);\\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\\n return reverseNode;\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, resolver);\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the calling account. First updates the resolver to the default reverse\\n * resolver if necessary.\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setName(string memory name) public override returns (bytes32) {\\n return\\n setNameForAddr(\\n msg.sender,\\n msg.sender,\\n address(defaultResolver),\\n name\\n );\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the account provided. Updates the resolver to a designated resolver\\n * Only callable by controllers and authorised users\\n * @param addr The reverse record to set\\n * @param owner The owner of the reverse node\\n * @param resolver The resolver of the reverse node\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) public override returns (bytes32) {\\n bytes32 node = claimForAddr(addr, owner, resolver);\\n NameResolver(resolver).setName(node, name);\\n return node;\\n }\\n\\n /**\\n * @dev Returns the node hash for a given account's reverse records.\\n * @param addr The address to hash\\n * @return The ENS node hash.\\n */\\n function node(address addr) public pure override returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\\n );\\n }\\n\\n /**\\n * @dev An optimised function to compute the sha3 of the lower-case\\n * hexadecimal representation of an Ethereum address.\\n * @param addr The address to hash\\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\\n * input address.\\n */\\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\\n assembly {\\n for {\\n let i := 40\\n } gt(i, 0) {\\n\\n } {\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n }\\n\\n ret := keccak256(0, 40)\\n }\\n }\\n\\n function ownsContract(address addr) internal view returns (bool) {\\n try Ownable(addr).owner() returns (address owner) {\\n return owner == msg.sender;\\n } catch {\\n return false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd57d28e5791b4b44650a00f5ef6c725af53698ec33faeeaa3591f0dbd939559a\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"}},\"version\":1}", + "bytecode": "0x60a060405234801561001057600080fd5b5060405162000f5338038062000f53833981016040819052610031916101b6565b61003a3361014e565b6001600160a01b03811660808190526040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152600091906302571be390602401602060405180830381865afa1580156100a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ca91906101b6565b90506001600160a01b0381161561014757604051630f41a04d60e11b81523360048201526001600160a01b03821690631e83409a906024016020604051808303816000875af1158015610121573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061014591906101da565b505b50506101f3565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146101b357600080fd5b50565b6000602082840312156101c857600080fd5b81516101d38161019e565b9392505050565b6000602082840312156101ec57600080fd5b5051919050565b608051610d366200021d6000396000818161012d015281816102f001526105070152610d366000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063c66485b211610066578063c66485b2146101e1578063da8c229e146101f4578063e0dba60f14610227578063f2fde38b1461023a57600080fd5b80638da5cb5b146101aa578063bffbe61c146101bb578063c47f0027146101ce57600080fd5b806365669631116100c85780636566963114610167578063715018a61461017a5780637a806d6b14610184578063828eab0e1461019757600080fd5b80630f5a5466146100ef5780631e83409a146101155780633f15457f14610128575b600080fd5b6101026100fd366004610a25565b61024d565b6040519081526020015b60405180910390f35b610102610123366004610a5e565b610261565b61014f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b610102610175366004610a7b565b610283565b61018261056e565b005b610102610192366004610b82565b610582565b60025461014f906001600160a01b031681565b6000546001600160a01b031661014f565b6101026101c9366004610a5e565b610616565b6101026101dc366004610bf7565b610671565b6101826101ef366004610a5e565b61068e565b610217610202366004610a5e565b60016020526000908152604090205460ff1681565b604051901515815260200161010c565b610182610235366004610c42565b610769565b610182610248366004610a5e565b6107d0565b600061025a338484610283565b9392505050565b60025460009061027d90339084906001600160a01b0316610283565b92915050565b6000836001600160a01b0381163314806102ac57503360009081526001602052604090205460ff165b8061035b57506040517fe985e9c50000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610337573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035b9190610c70565b8061036a575061036a81610860565b6104075760405162461bcd60e51b815260206004820152605b60248201527f526576657273655265676973747261723a2043616c6c6572206973206e6f742060448201527f6120636f6e74726f6c6c6572206f7220617574686f726973656420627920616460648201527f6472657373206f7220746865206164647265737320697473656c660000000000608482015260a4015b60405180910390fd5b6000610412866108d9565b604080517f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2602080830191909152818301849052825180830384018152606090920192839052815191012091925081906001600160a01b038916907f6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e9290600090a36040517f5ef2c7f00000000000000000000000000000000000000000000000000000000081527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152602481018390526001600160a01b0387811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561054b57600080fd5b505af115801561055f573d6000803e3d6000fd5b50929998505050505050505050565b610576610959565b61058060006109b3565b565b600080610590868686610283565b6040517f773722130000000000000000000000000000000000000000000000000000000081529091506001600160a01b038516906377372213906105da9084908790600401610c8d565b600060405180830381600087803b1580156105f457600080fd5b505af1158015610608573d6000803e3d6000fd5b509298975050505050505050565b60007f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2610642836108d9565b604080516020810193909352820152606001604051602081830303815290604052805190602001209050919050565b60025460009061027d90339081906001600160a01b031685610582565b610696610959565b6001600160a01b0381166107125760405162461bcd60e51b815260206004820152603060248201527f526576657273655265676973747261723a205265736f6c76657220616464726560448201527f7373206d757374206e6f7420626520300000000000000000000000000000000060648201526084016103fe565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517feae17a84d9eb83d8c8eb317f9e7d64857bc363fa51674d996c023f4340c577cf90600090a250565b610771610959565b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b6107d8610959565b6001600160a01b0381166108545760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103fe565b61085d816109b3565b50565b6000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156108bc575060408051601f3d908101601f191682019092526108b991810190610ce3565b60015b6108c857506000919050565b6001600160a01b0316331492915050565b600060285b801561094d57600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a8153601090920491600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a81536010830492506108de565b50506028600020919050565b6000546001600160a01b031633146105805760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103fe565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461085d57600080fd5b60008060408385031215610a3857600080fd5b8235610a4381610a10565b91506020830135610a5381610a10565b809150509250929050565b600060208284031215610a7057600080fd5b813561025a81610a10565b600080600060608486031215610a9057600080fd5b8335610a9b81610a10565b92506020840135610aab81610a10565b91506040840135610abb81610a10565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112610b0657600080fd5b813567ffffffffffffffff80821115610b2157610b21610ac6565b604051601f8301601f19908116603f01168101908282118183101715610b4957610b49610ac6565b81604052838152866020858801011115610b6257600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060808587031215610b9857600080fd5b8435610ba381610a10565b93506020850135610bb381610a10565b92506040850135610bc381610a10565b9150606085013567ffffffffffffffff811115610bdf57600080fd5b610beb87828801610af5565b91505092959194509250565b600060208284031215610c0957600080fd5b813567ffffffffffffffff811115610c2057600080fd5b610c2c84828501610af5565b949350505050565b801515811461085d57600080fd5b60008060408385031215610c5557600080fd5b8235610c6081610a10565b91506020830135610a5381610c34565b600060208284031215610c8257600080fd5b815161025a81610c34565b82815260006020604081840152835180604085015260005b81811015610cc157858101830151858201606001528201610ca5565b506000606082860101526060601f19601f830116850101925050509392505050565b600060208284031215610cf557600080fd5b815161025a81610a1056fea2646970667358221220b2342eb6db7213f08dc1aec36848c85736afd4f3ad81850bcdebabdc8bb3190664736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063c66485b211610066578063c66485b2146101e1578063da8c229e146101f4578063e0dba60f14610227578063f2fde38b1461023a57600080fd5b80638da5cb5b146101aa578063bffbe61c146101bb578063c47f0027146101ce57600080fd5b806365669631116100c85780636566963114610167578063715018a61461017a5780637a806d6b14610184578063828eab0e1461019757600080fd5b80630f5a5466146100ef5780631e83409a146101155780633f15457f14610128575b600080fd5b6101026100fd366004610a25565b61024d565b6040519081526020015b60405180910390f35b610102610123366004610a5e565b610261565b61014f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b610102610175366004610a7b565b610283565b61018261056e565b005b610102610192366004610b82565b610582565b60025461014f906001600160a01b031681565b6000546001600160a01b031661014f565b6101026101c9366004610a5e565b610616565b6101026101dc366004610bf7565b610671565b6101826101ef366004610a5e565b61068e565b610217610202366004610a5e565b60016020526000908152604090205460ff1681565b604051901515815260200161010c565b610182610235366004610c42565b610769565b610182610248366004610a5e565b6107d0565b600061025a338484610283565b9392505050565b60025460009061027d90339084906001600160a01b0316610283565b92915050565b6000836001600160a01b0381163314806102ac57503360009081526001602052604090205460ff165b8061035b57506040517fe985e9c50000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610337573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035b9190610c70565b8061036a575061036a81610860565b6104075760405162461bcd60e51b815260206004820152605b60248201527f526576657273655265676973747261723a2043616c6c6572206973206e6f742060448201527f6120636f6e74726f6c6c6572206f7220617574686f726973656420627920616460648201527f6472657373206f7220746865206164647265737320697473656c660000000000608482015260a4015b60405180910390fd5b6000610412866108d9565b604080517f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2602080830191909152818301849052825180830384018152606090920192839052815191012091925081906001600160a01b038916907f6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e9290600090a36040517f5ef2c7f00000000000000000000000000000000000000000000000000000000081527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152602481018390526001600160a01b0387811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561054b57600080fd5b505af115801561055f573d6000803e3d6000fd5b50929998505050505050505050565b610576610959565b61058060006109b3565b565b600080610590868686610283565b6040517f773722130000000000000000000000000000000000000000000000000000000081529091506001600160a01b038516906377372213906105da9084908790600401610c8d565b600060405180830381600087803b1580156105f457600080fd5b505af1158015610608573d6000803e3d6000fd5b509298975050505050505050565b60007f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2610642836108d9565b604080516020810193909352820152606001604051602081830303815290604052805190602001209050919050565b60025460009061027d90339081906001600160a01b031685610582565b610696610959565b6001600160a01b0381166107125760405162461bcd60e51b815260206004820152603060248201527f526576657273655265676973747261723a205265736f6c76657220616464726560448201527f7373206d757374206e6f7420626520300000000000000000000000000000000060648201526084016103fe565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517feae17a84d9eb83d8c8eb317f9e7d64857bc363fa51674d996c023f4340c577cf90600090a250565b610771610959565b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b6107d8610959565b6001600160a01b0381166108545760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103fe565b61085d816109b3565b50565b6000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156108bc575060408051601f3d908101601f191682019092526108b991810190610ce3565b60015b6108c857506000919050565b6001600160a01b0316331492915050565b600060285b801561094d57600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a8153601090920491600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a81536010830492506108de565b50506028600020919050565b6000546001600160a01b031633146105805760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103fe565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461085d57600080fd5b60008060408385031215610a3857600080fd5b8235610a4381610a10565b91506020830135610a5381610a10565b809150509250929050565b600060208284031215610a7057600080fd5b813561025a81610a10565b600080600060608486031215610a9057600080fd5b8335610a9b81610a10565b92506020840135610aab81610a10565b91506040840135610abb81610a10565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112610b0657600080fd5b813567ffffffffffffffff80821115610b2157610b21610ac6565b604051601f8301601f19908116603f01168101908282118183101715610b4957610b49610ac6565b81604052838152866020858801011115610b6257600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060808587031215610b9857600080fd5b8435610ba381610a10565b93506020850135610bb381610a10565b92506040850135610bc381610a10565b9150606085013567ffffffffffffffff811115610bdf57600080fd5b610beb87828801610af5565b91505092959194509250565b600060208284031215610c0957600080fd5b813567ffffffffffffffff811115610c2057600080fd5b610c2c84828501610af5565b949350505050565b801515811461085d57600080fd5b60008060408385031215610c5557600080fd5b8235610c6081610a10565b91506020830135610a5381610c34565b600060208284031215610c8257600080fd5b815161025a81610c34565b82815260006020604081840152835180604085015260005b81811015610cc157858101830151858201606001528201610ca5565b506000606082860101526060601f19601f830116850101925050509392505050565b600060208284031215610cf557600080fd5b815161025a81610a1056fea2646970667358221220b2342eb6db7213f08dc1aec36848c85736afd4f3ad81850bcdebabdc8bb3190664736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "claim(address)": { + "details": "Transfers ownership of the reverse ENS record associated with the calling account.", + "params": { + "owner": "The address to set as the owner of the reverse record in ENS." + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "claimForAddr(address,address,address)": { + "details": "Transfers ownership of the reverse ENS record associated with the calling account.", + "params": { + "addr": "The reverse record to set", + "owner": "The address to set as the owner of the reverse record in ENS.", + "resolver": "The resolver of the reverse node" + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "claimWithResolver(address,address)": { + "details": "Transfers ownership of the reverse ENS record associated with the calling account.", + "params": { + "owner": "The address to set as the owner of the reverse record in ENS.", + "resolver": "The address of the resolver to set; 0 to leave unchanged." + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "constructor": { + "details": "Constructor", + "params": { + "ensAddr": "The address of the ENS registry." + } + }, + "node(address)": { + "details": "Returns the node hash for a given account's reverse records.", + "params": { + "addr": "The address to hash" + }, + "returns": { + "_0": "The ENS node hash." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "setName(string)": { + "details": "Sets the `name()` record for the reverse ENS record associated with the calling account. First updates the resolver to the default reverse resolver if necessary.", + "params": { + "name": "The name to set for this address." + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "setNameForAddr(address,address,address,string)": { + "details": "Sets the `name()` record for the reverse ENS record associated with the account provided. Updates the resolver to a designated resolver Only callable by controllers and authorised users", + "params": { + "addr": "The reverse record to set", + "name": "The name to set for this address.", + "owner": "The owner of the reverse node", + "resolver": "The resolver of the reverse node" + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 444, + "contract": "contracts/reverseRegistrar/ReverseRegistrar.sol:ReverseRegistrar", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 17584, + "contract": "contracts/reverseRegistrar/ReverseRegistrar.sol:ReverseRegistrar", + "label": "controllers", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 17256, + "contract": "contracts/reverseRegistrar/ReverseRegistrar.sol:ReverseRegistrar", + "label": "defaultResolver", + "offset": 0, + "slot": "2", + "type": "t_contract(NameResolver)17238" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(NameResolver)17238": { + "encoding": "inplace", + "label": "contract NameResolver", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/Root.json b/solidity/dns-contracts/deployments/mainnet/Root.json new file mode 100644 index 0000000..d893752 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/Root.json @@ -0,0 +1,229 @@ +{ + "address": "0xaB528d626EC275E3faD363fF1393A41F581c5897", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + } + ], + "name": "TLDLocked", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + } + ], + "name": "lock", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "locked", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "setController", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ] +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/SHA1Digest.json b/solidity/dns-contracts/deployments/mainnet/SHA1Digest.json new file mode 100644 index 0000000..081682c --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/SHA1Digest.json @@ -0,0 +1,77 @@ +{ + "address": "0x9c9fcEa62bD0A723b62A2F1e98dE0Ee3df813619", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x15d000fd3bf7aaf9a0c767946e7f21bfd15067543cf2dfec35f3c4a5b16ab993", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0x9c9fcEa62bD0A723b62A2F1e98dE0Ee3df813619", + "transactionIndex": 75, + "gasUsed": "459448", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x828287f05629e1ef300c98e2aa5f12815f0b59d031db2214229e4455e60197d1", + "transactionHash": "0x15d000fd3bf7aaf9a0c767946e7f21bfd15067543cf2dfec35f3c4a5b16ab993", + "logs": [], + "blockNumber": 19020684, + "cumulativeGasUsed": "5206754", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 2, + "solcInputHash": "dd9e022689821cffaeb04b9ddbda87ae", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC SHA1 digest.\",\"kind\":\"dev\",\"methods\":{\"verify(bytes,bytes)\":{\"details\":\"Verifies a cryptographic hash.\",\"params\":{\"data\":\"The data to hash.\",\"hash\":\"The hash to compare to.\"},\"returns\":{\"_0\":\"True iff the hashed data matches the provided hash value.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/digests/SHA1Digest.sol\":\"SHA1Digest\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/solsha1/contracts/SHA1.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary SHA1 {\\n event Debug(bytes32 x);\\n\\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\\n assembly {\\n // Get a safe scratch location\\n let scratch := mload(0x40)\\n\\n // Get the data length, and point data at the first byte\\n let len := mload(data)\\n data := add(data, 32)\\n\\n // Find the length after padding\\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\\n switch lt(sub(totallen, len), 9)\\n case 1 { totallen := add(totallen, 64) }\\n\\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\\n\\n function readword(ptr, off, count) -> result {\\n result := 0\\n if lt(off, count) {\\n result := mload(add(ptr, off))\\n count := sub(count, off)\\n if lt(count, 32) {\\n let mask := not(sub(exp(256, sub(32, count)), 1))\\n result := and(result, mask)\\n }\\n }\\n }\\n\\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\\n mstore(scratch, readword(data, i, len))\\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\\n\\n // If we loaded the last byte, store the terminator byte\\n switch lt(sub(len, i), 64)\\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\\n\\n // If this is the last block, store the length\\n switch eq(i, sub(totallen, 64))\\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\\n\\n // Expand the 16 32-bit words into 80\\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\\n mstore(add(scratch, j), temp)\\n }\\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\\n mstore(add(scratch, j), temp)\\n }\\n\\n let x := h\\n let f := 0\\n let k := 0\\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\\n switch div(j, 20)\\n case 0 {\\n // f = d xor (b and (c xor d))\\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\\n f := and(div(x, 0x1000000000000000000000000000000), f)\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x5A827999\\n }\\n case 1{\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x6ED9EBA1\\n }\\n case 2 {\\n // f = (b and c) or (d and (b or c))\\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := and(div(x, 0x10000000000), f)\\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\\n k := 0x8F1BBCDC\\n }\\n case 3 {\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0xCA62C1D6\\n }\\n // temp = (a leftrotate 5) + f + e + k + w[i]\\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\\n temp := add(f, temp)\\n temp := add(and(x, 0xFFFFFFFF), temp)\\n temp := add(k, temp)\\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\\n }\\n\\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\\n }\\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x746d9b85de197afbc13182cbe4ba4f7917f19594e07c655d6a0c85fdf7460a8a\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC digest.\\n */\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(\\n bytes calldata data,\\n bytes calldata hash\\n ) external pure virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x8ea926b2db0578c4ad7fce4582fc0f6f0f9efee8dca2085dbdb9984f18941e28\"},\"contracts/dnssec-oracle/digests/SHA1Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Digest.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"@ensdomains/solsha1/contracts/SHA1.sol\\\";\\n\\n/**\\n * @dev Implements the DNSSEC SHA1 digest.\\n */\\ncontract SHA1Digest is Digest {\\n using BytesUtils for *;\\n\\n function verify(\\n bytes calldata data,\\n bytes calldata hash\\n ) external pure override returns (bool) {\\n require(hash.length == 20, \\\"Invalid sha1 hash length\\\");\\n bytes32 expected = hash.readBytes20(0);\\n bytes20 computed = SHA1.sha1(data);\\n return expected == computed;\\n }\\n}\\n\",\"keccak256\":\"0x56f4e188f9c5ea120354ff4d00555c3b76b5837be00a1564fed608e22a7dc8aa\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061076c806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004361003e36600461068a565b610057565b604051901515815260200160405180910390f35b6000601482146100c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e76616c696420736861312068617368206c656e6774680000000000000000604482015260640160405180910390fd5b600061010d600085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061017c9050565b6bffffffffffffffffffffffff19169050600061015f87878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101af92505050565b6bffffffffffffffffffffffff1916919091149695505050505050565b815160009061018c8360146106f6565b111561019757600080fd5b5001602001516bffffffffffffffffffffffff191690565b60006040518251602084019350604067ffffffffffffffc0600183011601600982820310600181036101e2576040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f0610235565b60008383101561022e5750808201519282900392602084101561022e5760001960208590036101000a0119165b9392505050565b60005b828110156105c15761024b848289610201565b855261025b846020830189610201565b6020860152604081850310600181036102775760808286038701535b506040830381146001810361029457602086018051600887021790525b5060405b608081101561031c57858101603f19810151603719820151601f19830151600b198401516002911891909218189081027ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe1663800000009091047c010000000100000001000000010000000100000001000000010000000116179052600c01610298565b5060805b6101408110156103a557858101607f19810151606f19820151603f198301516017198401516004911891909218189081027ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc1663400000009091047c030000000300000003000000030000000300000003000000030000000316179052601801610320565b508160008060005b6050811015610597576014810480156103dd576001811461040d576002811461043b576003811461046e57610498565b6501000000000085046a010000000000000000000086048118600160781b870416189350635a8279999250610498565b650100000000008504600160781b86046a0100000000000000000000870418189350636ed9eba19250610498565b6a01000000000000000000008504600160781b8604818117650100000000008804169116179350638f1bbcdc9250610498565b650100000000008504600160781b86046a010000000000000000000087041818935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c015104019050740100000000000000000000000000000000000000008102650100000000008604179450506a0100000000000000000000633fffffff6a040000000000000000000086041663c00000006604000000000000870416170277ffffffff00ffffffff000000000000ffffffff00ffffffff85161793506001810190506103ad565b5050509190910177ffffffff00ffffffff00ffffffff00ffffffff00ffffffff1690604001610238565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b60008083601f84011261065357600080fd5b50813567ffffffffffffffff81111561066b57600080fd5b60208301915083602082850101111561068357600080fd5b9250929050565b600080600080604085870312156106a057600080fd5b843567ffffffffffffffff808211156106b857600080fd5b6106c488838901610641565b909650945060208701359150808211156106dd57600080fd5b506106ea87828801610641565b95989497509550505050565b80820180821115610730577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea26469706673582212201eb056a89a6b6b67ba5acc9d1d278299eadfc218cf0f5baba761aa60461f441964736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004361003e36600461068a565b610057565b604051901515815260200160405180910390f35b6000601482146100c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e76616c696420736861312068617368206c656e6774680000000000000000604482015260640160405180910390fd5b600061010d600085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061017c9050565b6bffffffffffffffffffffffff19169050600061015f87878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101af92505050565b6bffffffffffffffffffffffff1916919091149695505050505050565b815160009061018c8360146106f6565b111561019757600080fd5b5001602001516bffffffffffffffffffffffff191690565b60006040518251602084019350604067ffffffffffffffc0600183011601600982820310600181036101e2576040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f0610235565b60008383101561022e5750808201519282900392602084101561022e5760001960208590036101000a0119165b9392505050565b60005b828110156105c15761024b848289610201565b855261025b846020830189610201565b6020860152604081850310600181036102775760808286038701535b506040830381146001810361029457602086018051600887021790525b5060405b608081101561031c57858101603f19810151603719820151601f19830151600b198401516002911891909218189081027ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe1663800000009091047c010000000100000001000000010000000100000001000000010000000116179052600c01610298565b5060805b6101408110156103a557858101607f19810151606f19820151603f198301516017198401516004911891909218189081027ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc1663400000009091047c030000000300000003000000030000000300000003000000030000000316179052601801610320565b508160008060005b6050811015610597576014810480156103dd576001811461040d576002811461043b576003811461046e57610498565b6501000000000085046a010000000000000000000086048118600160781b870416189350635a8279999250610498565b650100000000008504600160781b86046a0100000000000000000000870418189350636ed9eba19250610498565b6a01000000000000000000008504600160781b8604818117650100000000008804169116179350638f1bbcdc9250610498565b650100000000008504600160781b86046a010000000000000000000087041818935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c015104019050740100000000000000000000000000000000000000008102650100000000008604179450506a0100000000000000000000633fffffff6a040000000000000000000086041663c00000006604000000000000870416170277ffffffff00ffffffff000000000000ffffffff00ffffffff85161793506001810190506103ad565b5050509190910177ffffffff00ffffffff00ffffffff00ffffffff00ffffffff1690604001610238565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b60008083601f84011261065357600080fd5b50813567ffffffffffffffff81111561066b57600080fd5b60208301915083602082850101111561068357600080fd5b9250929050565b600080600080604085870312156106a057600080fd5b843567ffffffffffffffff808211156106b857600080fd5b6106c488838901610641565b909650945060208701359150808211156106dd57600080fd5b506106ea87828801610641565b95989497509550505050565b80820180821115610730577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea26469706673582212201eb056a89a6b6b67ba5acc9d1d278299eadfc218cf0f5baba761aa60461f441964736f6c63430008110033", + "devdoc": { + "details": "Implements the DNSSEC SHA1 digest.", + "kind": "dev", + "methods": { + "verify(bytes,bytes)": { + "details": "Verifies a cryptographic hash.", + "params": { + "data": "The data to hash.", + "hash": "The hash to compare to." + }, + "returns": { + "_0": "True iff the hashed data matches the provided hash value." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/SHA1NSEC3Digest.json b/solidity/dns-contracts/deployments/mainnet/SHA1NSEC3Digest.json new file mode 100644 index 0000000..3a54385 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/SHA1NSEC3Digest.json @@ -0,0 +1,82 @@ +{ + "address": "0x849851A7683cfF52De5F50C712C0606FEf6A3e8f", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "salt", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "iterations", + "type": "uint256" + } + ], + "name": "hash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x1e9806d0963233a2ceec08d32665ad9be97ef45c029d597480e37bdfc2055fa5", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0x849851A7683cfF52De5F50C712C0606FEf6A3e8f", + "transactionIndex": 205, + "gasUsed": "787577", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x9c6177045dd2ed0091f2cf71227577a203e763e795d76fc4c61ffe983a9f57c9", + "transactionHash": "0x1e9806d0963233a2ceec08d32665ad9be97ef45c029d597480e37bdfc2055fa5", + "logs": [], + "blockNumber": 13040273, + "cumulativeGasUsed": "16286139", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "40ce5451dce8f428cafdaca8fb82d91d", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"salt\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"iterations\",\"type\":\"uint256\"}],\"name\":\"hash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC iterated SHA1 digest used for NSEC3 records.\",\"kind\":\"dev\",\"methods\":{\"hash(bytes,bytes,uint256)\":{\"details\":\"Performs an NSEC3 iterated hash.\",\"params\":{\"data\":\"The data to hash.\",\"iterations\":\"The number of iterations to perform.\",\"salt\":\"The salt value to use on each iteration.\"},\"returns\":{\"_0\":\"The result of the iterated hash operation.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/nsec3digests/SHA1NSEC3Digest.sol\":\"SHA1NSEC3Digest\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for writing to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n mstore(0x40, add(32, add(ptr, capacity)))\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n function max(uint a, uint b) private pure returns(uint) {\\n if (a > b) {\\n return a;\\n }\\n return b;\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The start offset to write to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n if (off + len > buf.capacity) {\\n resize(buf, max(buf.capacity, len + off) * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(add(len, off), buflen) {\\n mstore(bufptr, add(len, off))\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, len);\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, data.length);\\n }\\n\\n /**\\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write the byte at.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\\n if (off >= buf.capacity) {\\n resize(buf, buf.capacity * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if eq(off, buflen) {\\n mstore(bufptr, add(buflen, 1))\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n return writeUint8(buf, buf.buf.length, data);\\n }\\n\\n /**\\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\\n if (len + off > buf.capacity) {\\n resize(buf, (len + off) * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off + len\\n let dest := add(add(bufptr, off), len)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(add(off, len), mload(bufptr)) {\\n mstore(bufptr, add(off, len))\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\\n return write(buf, off, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, 32);\\n }\\n\\n /**\\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\\n if (len + off > buf.capacity) {\\n resize(buf, (len + off) * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + off + sizeof(buffer length) + len\\n let dest := add(add(bufptr, off), len)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(add(off, len), mload(bufptr)) {\\n mstore(bufptr, add(off, len))\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n return writeInt(buf, buf.buf.length, data, len);\\n }\\n}\\n\",\"keccak256\":\"0x18e42be1a3e4f7b4442d7ab0b524af5e09163503439954faf0ab3792cce91caa\"},\"contracts/dnssec-oracle/SHA1.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary SHA1 {\\n event Debug(bytes32 x);\\n\\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\\n assembly {\\n // Get a safe scratch location\\n let scratch := mload(0x40)\\n\\n // Get the data length, and point data at the first byte\\n let len := mload(data)\\n data := add(data, 32)\\n\\n // Find the length after padding\\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\\n switch lt(sub(totallen, len), 9)\\n case 1 { totallen := add(totallen, 64) }\\n\\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\\n\\n function readword(ptr, off, count) -> result {\\n result := 0\\n if lt(off, count) {\\n result := mload(add(ptr, off))\\n count := sub(count, off)\\n if lt(count, 32) {\\n let mask := not(sub(exp(256, sub(32, count)), 1))\\n result := and(result, mask)\\n }\\n }\\n }\\n\\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\\n mstore(scratch, readword(data, i, len))\\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\\n\\n // If we loaded the last byte, store the terminator byte\\n switch lt(sub(len, i), 64)\\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\\n\\n // If this is the last block, store the length\\n switch eq(i, sub(totallen, 64))\\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\\n\\n // Expand the 16 32-bit words into 80\\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\\n mstore(add(scratch, j), temp)\\n }\\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\\n mstore(add(scratch, j), temp)\\n }\\n\\n let x := h\\n let f := 0\\n let k := 0\\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\\n switch div(j, 20)\\n case 0 {\\n // f = d xor (b and (c xor d))\\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\\n f := and(div(x, 0x1000000000000000000000000000000), f)\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x5A827999\\n }\\n case 1{\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x6ED9EBA1\\n }\\n case 2 {\\n // f = (b and c) or (d and (b or c))\\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := and(div(x, 0x10000000000), f)\\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\\n k := 0x8F1BBCDC\\n }\\n case 3 {\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0xCA62C1D6\\n }\\n // temp = (a leftrotate 5) + f + e + k + w[i]\\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\\n temp := add(f, temp)\\n temp := add(and(x, 0xFFFFFFFF), temp)\\n temp := add(k, temp)\\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\\n }\\n\\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\\n }\\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\\n }\\n }\\n}\",\"keccak256\":\"0x43d6fc9dfba44bcc5d696ac24d8e1b90355942b41c8324ea31dce1ebfce82263\"},\"contracts/dnssec-oracle/nsec3digests/NSEC3Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev Interface for contracts that implement NSEC3 digest algorithms.\\n */\\ninterface NSEC3Digest {\\n /**\\n * @dev Performs an NSEC3 iterated hash.\\n * @param salt The salt value to use on each iteration.\\n * @param data The data to hash.\\n * @param iterations The number of iterations to perform.\\n * @return The result of the iterated hash operation.\\n */\\n function hash(bytes calldata salt, bytes calldata data, uint iterations) external virtual pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0xb3b61aee6bb472158b7ace6b5644dcb668271296b98a6dcde24dc72e3cdf4950\"},\"contracts/dnssec-oracle/nsec3digests/SHA1NSEC3Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./NSEC3Digest.sol\\\";\\nimport \\\"../SHA1.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n/**\\n* @dev Implements the DNSSEC iterated SHA1 digest used for NSEC3 records.\\n*/\\ncontract SHA1NSEC3Digest is NSEC3Digest {\\n using Buffer for Buffer.buffer;\\n\\n function hash(bytes calldata salt, bytes calldata data, uint iterations) external override pure returns (bytes32) {\\n Buffer.buffer memory buf;\\n buf.init(salt.length + data.length + 16);\\n\\n buf.append(data);\\n buf.append(salt);\\n bytes20 h = SHA1.sha1(buf.buf);\\n if (iterations > 0) {\\n buf.truncate();\\n buf.appendBytes20(bytes20(0));\\n buf.append(salt);\\n\\n for (uint i = 0; i < iterations; i++) {\\n buf.writeBytes20(0, h);\\n h = SHA1.sha1(buf.buf);\\n }\\n }\\n\\n return bytes32(h);\\n }\\n}\\n\",\"keccak256\":\"0x2255d276d74fa236875f6cddd3061ce07189f84acd04538d002dbaa78daa48a0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610d61806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806368f9dab214610030575b600080fd5b61004a60048036038101906100459190610a91565b610060565b6040516100579190610b29565b60405180910390f35b600061006a610a18565b61009a601086869050898990506100819190610b44565b61008b9190610b44565b8261024290919063ffffffff16565b506100f285858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050826102ac90919063ffffffff16565b5061014a87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050826102ac90919063ffffffff16565b50600061015a82600001516102ce565b905060008411156102255761016e826107ec565b50610186600060601b8361080390919063ffffffff16565b506101de88888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050836102ac90919063ffffffff16565b5060005b8481101561022357610200600083856108349092919063ffffffff16565b5061020e83600001516102ce565b9150808061021b90610c3c565b9150506101e2565b505b806bffffffffffffffffffffffff19169250505095945050505050565b61024a610a18565b60006020836102599190610c85565b146102855760208261026b9190610c85565b60206102779190610bf4565b826102829190610b44565b91505b81836020018181525050604051808452600081528281016020016040525082905092915050565b6102b4610a18565b6102c683846000015151848551610861565b905092915050565b60006040518251602084019350604067ffffffffffffffc0600183011601600982820310600181146102ff57610306565b6040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f061035e565b6000838310156103575782820151905082840393506020841015610356576001846020036101000a03198082169150505b5b9392505050565b60005b8281101561076c57610374848289610325565b8552610384846020830189610325565b60208601526040818503106001811461039c576103a5565b60808286038701535b50604083038114600181146103b9576103c9565b6008850260208701511760208701525b5060405b60808110156104555760408103860151603882038701511860208203870151600c830388015118187c010000000100000001000000010000000100000001000000010000000163800000008204167ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe6002830216179050808288015250600c810190506103cd565b5060805b6101408110156104e257608081038601516070820387015118604082038701516018830388015118187c030000000300000003000000030000000300000003000000030000000363400000008204167ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc6004830216179050808288015250601881019050610459565b508160008060005b605081101561073e57601481046000811461051c576001811461056657600281146105a357600381146106065761063f565b6501000000000085046a01000000000000000000008604189350836f01000000000000000000000000000000860416935083650100000000008604189350635a827999925061063f565b6a010000000000000000000085046f01000000000000000000000000000000860418935083650100000000008604189350636ed9eba1925061063f565b6a010000000000000000000085046f01000000000000000000000000000000860417935083650100000000008604169350836a010000000000000000000086046f01000000000000000000000000000000870416179350638f1bbcdc925061063f565b6a010000000000000000000085046f0100000000000000000000000000000086041893508365010000000000860418935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c0151040190507401000000000000000000000000000000000000000081026501000000000086041794506a0100000000000000000000633fffffff6a040000000000000000000087041663c00000006604000000000000880416170277ffffffff00ffffffff000000000000ffffffff00ffffffff8616179450506001810190506104ea565b5077ffffffff00ffffffff00ffffffff00ffffffff00ffffffff838601169450505050604081019050610361565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b6107f4610a18565b81516000815250819050919050565b61080b610a18565b61082c83846000015151846bffffffffffffffffffffffff19166014610950565b905092915050565b61083c610a18565b6108588484846bffffffffffffffffffffffff19166014610950565b90509392505050565b610869610a18565b825182111561087757600080fd5b846020015182856108889190610b44565b11156108bd576108bc8560026108ad886020015188876108a89190610b44565b6109d8565b6108b79190610b9a565b6109f4565b5b6000808651805187602083010193508088870111156108dc5787860182525b60208701925050505b6020841061092357805182526020826108fe9190610b44565b915060208161090d9190610b44565b905060208461091c9190610bf4565b93506108e5565b60006001856020036101000a03905080198251168184511681811785525050508692505050949350505050565b610958610a18565b846020015184836109699190610b44565b11156109915761099085600286856109819190610b44565b61098b9190610b9a565b6109f4565b5b60006001836101000a0390508260200360080284901c935085518386820101858319825116178152815185880111156109ca5784870182525b505050849050949350505050565b6000818311156109ea578290506109ee565b8190505b92915050565b600082600001519050610a078383610242565b50610a1283826102ac565b50505050565b604051806040016040528060608152602001600081525090565b60008083601f840112610a4457600080fd5b8235905067ffffffffffffffff811115610a5d57600080fd5b602083019150836001820283011115610a7557600080fd5b9250929050565b600081359050610a8b81610d14565b92915050565b600080600080600060608688031215610aa957600080fd5b600086013567ffffffffffffffff811115610ac357600080fd5b610acf88828901610a32565b9550955050602086013567ffffffffffffffff811115610aee57600080fd5b610afa88828901610a32565b93509350506040610b0d88828901610a7c565b9150509295509295909350565b610b2381610c28565b82525050565b6000602082019050610b3e6000830184610b1a565b92915050565b6000610b4f82610c32565b9150610b5a83610c32565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610b8f57610b8e610cb6565b5b828201905092915050565b6000610ba582610c32565b9150610bb083610c32565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610be957610be8610cb6565b5b828202905092915050565b6000610bff82610c32565b9150610c0a83610c32565b925082821015610c1d57610c1c610cb6565b5b828203905092915050565b6000819050919050565b6000819050919050565b6000610c4782610c32565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610c7a57610c79610cb6565b5b600182019050919050565b6000610c9082610c32565b9150610c9b83610c32565b925082610cab57610caa610ce5565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b610d1d81610c32565b8114610d2857600080fd5b5056fea264697066735822122014909039cf171591f8629bfc52114a9908cd2479bcd90c7bef5c7a119ab14a3264736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c806368f9dab214610030575b600080fd5b61004a60048036038101906100459190610a91565b610060565b6040516100579190610b29565b60405180910390f35b600061006a610a18565b61009a601086869050898990506100819190610b44565b61008b9190610b44565b8261024290919063ffffffff16565b506100f285858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050826102ac90919063ffffffff16565b5061014a87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050826102ac90919063ffffffff16565b50600061015a82600001516102ce565b905060008411156102255761016e826107ec565b50610186600060601b8361080390919063ffffffff16565b506101de88888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050836102ac90919063ffffffff16565b5060005b8481101561022357610200600083856108349092919063ffffffff16565b5061020e83600001516102ce565b9150808061021b90610c3c565b9150506101e2565b505b806bffffffffffffffffffffffff19169250505095945050505050565b61024a610a18565b60006020836102599190610c85565b146102855760208261026b9190610c85565b60206102779190610bf4565b826102829190610b44565b91505b81836020018181525050604051808452600081528281016020016040525082905092915050565b6102b4610a18565b6102c683846000015151848551610861565b905092915050565b60006040518251602084019350604067ffffffffffffffc0600183011601600982820310600181146102ff57610306565b6040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f061035e565b6000838310156103575782820151905082840393506020841015610356576001846020036101000a03198082169150505b5b9392505050565b60005b8281101561076c57610374848289610325565b8552610384846020830189610325565b60208601526040818503106001811461039c576103a5565b60808286038701535b50604083038114600181146103b9576103c9565b6008850260208701511760208701525b5060405b60808110156104555760408103860151603882038701511860208203870151600c830388015118187c010000000100000001000000010000000100000001000000010000000163800000008204167ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe6002830216179050808288015250600c810190506103cd565b5060805b6101408110156104e257608081038601516070820387015118604082038701516018830388015118187c030000000300000003000000030000000300000003000000030000000363400000008204167ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc6004830216179050808288015250601881019050610459565b508160008060005b605081101561073e57601481046000811461051c576001811461056657600281146105a357600381146106065761063f565b6501000000000085046a01000000000000000000008604189350836f01000000000000000000000000000000860416935083650100000000008604189350635a827999925061063f565b6a010000000000000000000085046f01000000000000000000000000000000860418935083650100000000008604189350636ed9eba1925061063f565b6a010000000000000000000085046f01000000000000000000000000000000860417935083650100000000008604169350836a010000000000000000000086046f01000000000000000000000000000000870416179350638f1bbcdc925061063f565b6a010000000000000000000085046f0100000000000000000000000000000086041893508365010000000000860418935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c0151040190507401000000000000000000000000000000000000000081026501000000000086041794506a0100000000000000000000633fffffff6a040000000000000000000087041663c00000006604000000000000880416170277ffffffff00ffffffff000000000000ffffffff00ffffffff8616179450506001810190506104ea565b5077ffffffff00ffffffff00ffffffff00ffffffff00ffffffff838601169450505050604081019050610361565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b6107f4610a18565b81516000815250819050919050565b61080b610a18565b61082c83846000015151846bffffffffffffffffffffffff19166014610950565b905092915050565b61083c610a18565b6108588484846bffffffffffffffffffffffff19166014610950565b90509392505050565b610869610a18565b825182111561087757600080fd5b846020015182856108889190610b44565b11156108bd576108bc8560026108ad886020015188876108a89190610b44565b6109d8565b6108b79190610b9a565b6109f4565b5b6000808651805187602083010193508088870111156108dc5787860182525b60208701925050505b6020841061092357805182526020826108fe9190610b44565b915060208161090d9190610b44565b905060208461091c9190610bf4565b93506108e5565b60006001856020036101000a03905080198251168184511681811785525050508692505050949350505050565b610958610a18565b846020015184836109699190610b44565b11156109915761099085600286856109819190610b44565b61098b9190610b9a565b6109f4565b5b60006001836101000a0390508260200360080284901c935085518386820101858319825116178152815185880111156109ca5784870182525b505050849050949350505050565b6000818311156109ea578290506109ee565b8190505b92915050565b600082600001519050610a078383610242565b50610a1283826102ac565b50505050565b604051806040016040528060608152602001600081525090565b60008083601f840112610a4457600080fd5b8235905067ffffffffffffffff811115610a5d57600080fd5b602083019150836001820283011115610a7557600080fd5b9250929050565b600081359050610a8b81610d14565b92915050565b600080600080600060608688031215610aa957600080fd5b600086013567ffffffffffffffff811115610ac357600080fd5b610acf88828901610a32565b9550955050602086013567ffffffffffffffff811115610aee57600080fd5b610afa88828901610a32565b93509350506040610b0d88828901610a7c565b9150509295509295909350565b610b2381610c28565b82525050565b6000602082019050610b3e6000830184610b1a565b92915050565b6000610b4f82610c32565b9150610b5a83610c32565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610b8f57610b8e610cb6565b5b828201905092915050565b6000610ba582610c32565b9150610bb083610c32565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610be957610be8610cb6565b5b828202905092915050565b6000610bff82610c32565b9150610c0a83610c32565b925082821015610c1d57610c1c610cb6565b5b828203905092915050565b6000819050919050565b6000819050919050565b6000610c4782610c32565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610c7a57610c79610cb6565b5b600182019050919050565b6000610c9082610c32565b9150610c9b83610c32565b925082610cab57610caa610ce5565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b610d1d81610c32565b8114610d2857600080fd5b5056fea264697066735822122014909039cf171591f8629bfc52114a9908cd2479bcd90c7bef5c7a119ab14a3264736f6c63430008040033", + "devdoc": { + "details": "Implements the DNSSEC iterated SHA1 digest used for NSEC3 records.", + "kind": "dev", + "methods": { + "hash(bytes,bytes,uint256)": { + "details": "Performs an NSEC3 iterated hash.", + "params": { + "data": "The data to hash.", + "iterations": "The number of iterations to perform.", + "salt": "The salt value to use on each iteration." + }, + "returns": { + "_0": "The result of the iterated hash operation." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/SHA256Digest.json b/solidity/dns-contracts/deployments/mainnet/SHA256Digest.json new file mode 100644 index 0000000..f2a0cec --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/SHA256Digest.json @@ -0,0 +1,77 @@ +{ + "address": "0xCFe6edBD47a032585834A6921D1d05CB70FcC36d", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x32be39e9dbde5c8c29ba6d5f55df7b9b2cc8855b8cf63f53959ab5e86c5de4f9", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0xCFe6edBD47a032585834A6921D1d05CB70FcC36d", + "transactionIndex": 35, + "gasUsed": "211310", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x461a776b957f7d34a9df9efe0f14c1f1de4593037f85c66edaa5f333705d3f9d", + "transactionHash": "0x32be39e9dbde5c8c29ba6d5f55df7b9b2cc8855b8cf63f53959ab5e86c5de4f9", + "logs": [], + "blockNumber": 19020685, + "cumulativeGasUsed": "4688318", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 2, + "solcInputHash": "dd9e022689821cffaeb04b9ddbda87ae", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC SHA256 digest.\",\"kind\":\"dev\",\"methods\":{\"verify(bytes,bytes)\":{\"details\":\"Verifies a cryptographic hash.\",\"params\":{\"data\":\"The data to hash.\",\"hash\":\"The hash to compare to.\"},\"returns\":{\"_0\":\"True iff the hashed data matches the provided hash value.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/digests/SHA256Digest.sol\":\"SHA256Digest\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC digest.\\n */\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(\\n bytes calldata data,\\n bytes calldata hash\\n ) external pure virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x8ea926b2db0578c4ad7fce4582fc0f6f0f9efee8dca2085dbdb9984f18941e28\"},\"contracts/dnssec-oracle/digests/SHA256Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Digest.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\n\\n/**\\n * @dev Implements the DNSSEC SHA256 digest.\\n */\\ncontract SHA256Digest is Digest {\\n using BytesUtils for *;\\n\\n function verify(\\n bytes calldata data,\\n bytes calldata hash\\n ) external pure override returns (bool) {\\n require(hash.length == 32, \\\"Invalid sha256 hash length\\\");\\n return sha256(data) == hash.readBytes32(0);\\n }\\n}\\n\",\"keccak256\":\"0x0531c6764434ea17d967f079ed2299b1f83606e891dbdaa92500d43ef64cf126\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506102df806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004361003e3660046101d4565b610057565b604051901515815260200160405180910390f35b6000602082146100c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f496e76616c6964207368613235362068617368206c656e677468000000000000604482015260640160405180910390fd5b61010b600084848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506101679050565b6002868660405161011d929190610240565b602060405180830381855afa15801561013a573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061015d9190610250565b1495945050505050565b8151600090610177836020610269565b111561018257600080fd5b50016020015190565b60008083601f84011261019d57600080fd5b50813567ffffffffffffffff8111156101b557600080fd5b6020830191508360208285010111156101cd57600080fd5b9250929050565b600080600080604085870312156101ea57600080fd5b843567ffffffffffffffff8082111561020257600080fd5b61020e8883890161018b565b9096509450602087013591508082111561022757600080fd5b506102348782880161018b565b95989497509550505050565b8183823760009101908152919050565b60006020828403121561026257600080fd5b5051919050565b808201808211156102a3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea26469706673582212202348aaafc43a5bd6086d9011d799efff422cd74c984a03fe13c85cc4d45e842b64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004361003e3660046101d4565b610057565b604051901515815260200160405180910390f35b6000602082146100c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f496e76616c6964207368613235362068617368206c656e677468000000000000604482015260640160405180910390fd5b61010b600084848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506101679050565b6002868660405161011d929190610240565b602060405180830381855afa15801561013a573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061015d9190610250565b1495945050505050565b8151600090610177836020610269565b111561018257600080fd5b50016020015190565b60008083601f84011261019d57600080fd5b50813567ffffffffffffffff8111156101b557600080fd5b6020830191508360208285010111156101cd57600080fd5b9250929050565b600080600080604085870312156101ea57600080fd5b843567ffffffffffffffff8082111561020257600080fd5b61020e8883890161018b565b9096509450602087013591508082111561022757600080fd5b506102348782880161018b565b95989497509550505050565b8183823760009101908152919050565b60006020828403121561026257600080fd5b5051919050565b808201808211156102a3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea26469706673582212202348aaafc43a5bd6086d9011d799efff422cd74c984a03fe13c85cc4d45e842b64736f6c63430008110033", + "devdoc": { + "details": "Implements the DNSSEC SHA256 digest.", + "kind": "dev", + "methods": { + "verify(bytes,bytes)": { + "details": "Verifies a cryptographic hash.", + "params": { + "data": "The data to hash.", + "hash": "The hash to compare to." + }, + "returns": { + "_0": "True iff the hashed data matches the provided hash value." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/SimplePublicSuffixList.json b/solidity/dns-contracts/deployments/mainnet/SimplePublicSuffixList.json new file mode 100644 index 0000000..95477ea --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/SimplePublicSuffixList.json @@ -0,0 +1,190 @@ +{ + "address": "0x823BDa9cA8c47d072376eCD595530c8fb2fAa3ED", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "suffix", + "type": "bytes" + } + ], + "name": "SuffixAdded", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "names", + "type": "bytes[]" + } + ], + "name": "addPublicSuffixes", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "isPublicSuffix", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x7ec644afd6e132e8b9de61566e64011ef79810801ded41757b839d74730bec3f", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0x823BDa9cA8c47d072376eCD595530c8fb2fAa3ED", + "transactionIndex": 97, + "gasUsed": "383265", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x749cac8d93b42956b67c6590ec82b6073a3e9d780b6b7d68c4cfa6a7b8dfe55c", + "transactionHash": "0x7ec644afd6e132e8b9de61566e64011ef79810801ded41757b839d74730bec3f", + "logs": [], + "blockNumber": 19027537, + "cumulativeGasUsed": "8573249", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "a57ee6145a733d774c1e1946fd5c16b8", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"SuffixAdded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"names\",\"type\":\"bytes[]\"}],\"name\":\"addPublicSuffixes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"isPublicSuffix\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnsregistrar/SimplePublicSuffixList.sol\":\"SimplePublicSuffixList\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/dnsregistrar/PublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\ninterface PublicSuffixList {\\n function isPublicSuffix(bytes calldata name) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x12158ba8838ee2b1ebb0178a52d2f4d54dcc68282d569226e62afc2b0dccbbac\"},\"contracts/dnsregistrar/SimplePublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nimport \\\"../root/Ownable.sol\\\";\\nimport \\\"./PublicSuffixList.sol\\\";\\n\\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\\n mapping(bytes => bool) suffixes;\\n\\n event SuffixAdded(bytes suffix);\\n\\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\\n for (uint256 i = 0; i < names.length; i++) {\\n suffixes[names[i]] = true;\\n emit SuffixAdded(names[i]);\\n }\\n }\\n\\n function isPublicSuffix(\\n bytes calldata name\\n ) external view override returns (bool) {\\n return suffixes[name];\\n }\\n}\\n\",\"keccak256\":\"0x0cafa3192dc3731329cf74678829cc1bf578c3db2492a829417c0301fd09f3a2\"},\"contracts/root/Ownable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\ncontract Ownable {\\n address public owner;\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n modifier onlyOwner() {\\n require(isOwner(msg.sender));\\n _;\\n }\\n\\n constructor() public {\\n owner = msg.sender;\\n }\\n\\n function transferOwnership(address newOwner) public onlyOwner {\\n emit OwnershipTransferred(owner, newOwner);\\n owner = newOwner;\\n }\\n\\n function isOwner(address addr) public view returns (bool) {\\n return owner == addr;\\n }\\n}\\n\",\"keccak256\":\"0xd06845ede20815e1a6d5b36fec21d7b90ea24390f24a9b31e4220c90b2ff3252\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50600080546001600160a01b03191633179055610592806100326000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80636329cdfc116100505780636329cdfc146100b65780638da5cb5b146100cb578063f2fde38b146100f657600080fd5b80632f54bf6e1461006c5780634f89059e146100a3575b600080fd5b61008e61007a36600461029a565b6000546001600160a01b0390811691161490565b60405190151581526020015b60405180910390f35b61008e6100b13660046102ca565b610109565b6100c96100c4366004610383565b610138565b005b6000546100de906001600160a01b031681565b6040516001600160a01b03909116815260200161009a565b6100c961010436600461029a565b610210565b60006001838360405161011d92919061049c565b9081526040519081900360200190205460ff16905092915050565b6000546001600160a01b0316331461014f57600080fd5b60005b815181101561020c57600180838381518110610170576101706104ac565b602002602001015160405161018591906104e6565b908152602001604051809103902060006101000a81548160ff0219169083151502179055507f7cad7c0907646b87ae240d676052692501082856f06ba8e2589e239a77453b098282815181106101dd576101dd6104ac565b60200260200101516040516101f29190610502565b60405180910390a18061020481610535565b915050610152565b5050565b6000546001600160a01b0316331461022757600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6000602082840312156102ac57600080fd5b81356001600160a01b03811681146102c357600080fd5b9392505050565b600080602083850312156102dd57600080fd5b823567ffffffffffffffff808211156102f557600080fd5b818501915085601f83011261030957600080fd5b81358181111561031857600080fd5b86602082850101111561032a57600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561037b5761037b61033c565b604052919050565b6000602080838503121561039657600080fd5b823567ffffffffffffffff808211156103ae57600080fd5b8185019150601f86818401126103c357600080fd5b8235828111156103d5576103d561033c565b8060051b6103e4868201610352565b918252848101860191868101908a8411156103fe57600080fd5b87870192505b8383101561048e5782358681111561041c5760008081fd5b8701603f81018c1361042e5760008081fd5b888101356040888211156104445761044461033c565b610455828901601f19168c01610352565b8281528e8284860101111561046a5760008081fd5b828285018d83013760009281018c0192909252508352509187019190870190610404565b9a9950505050505050505050565b8183823760009101908152919050565b634e487b7160e01b600052603260045260246000fd5b60005b838110156104dd5781810151838201526020016104c5565b50506000910152565b600082516104f88184602087016104c2565b9190910192915050565b60208152600082518060208401526105218160408501602087016104c2565b601f01601f19169190910160400192915050565b60006001820161055557634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220c01b7cf9f606016ad0718eed2ea7820c75cfc73137245ea92220d234e7703dc264736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100675760003560e01c80636329cdfc116100505780636329cdfc146100b65780638da5cb5b146100cb578063f2fde38b146100f657600080fd5b80632f54bf6e1461006c5780634f89059e146100a3575b600080fd5b61008e61007a36600461029a565b6000546001600160a01b0390811691161490565b60405190151581526020015b60405180910390f35b61008e6100b13660046102ca565b610109565b6100c96100c4366004610383565b610138565b005b6000546100de906001600160a01b031681565b6040516001600160a01b03909116815260200161009a565b6100c961010436600461029a565b610210565b60006001838360405161011d92919061049c565b9081526040519081900360200190205460ff16905092915050565b6000546001600160a01b0316331461014f57600080fd5b60005b815181101561020c57600180838381518110610170576101706104ac565b602002602001015160405161018591906104e6565b908152602001604051809103902060006101000a81548160ff0219169083151502179055507f7cad7c0907646b87ae240d676052692501082856f06ba8e2589e239a77453b098282815181106101dd576101dd6104ac565b60200260200101516040516101f29190610502565b60405180910390a18061020481610535565b915050610152565b5050565b6000546001600160a01b0316331461022757600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6000602082840312156102ac57600080fd5b81356001600160a01b03811681146102c357600080fd5b9392505050565b600080602083850312156102dd57600080fd5b823567ffffffffffffffff808211156102f557600080fd5b818501915085601f83011261030957600080fd5b81358181111561031857600080fd5b86602082850101111561032a57600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561037b5761037b61033c565b604052919050565b6000602080838503121561039657600080fd5b823567ffffffffffffffff808211156103ae57600080fd5b8185019150601f86818401126103c357600080fd5b8235828111156103d5576103d561033c565b8060051b6103e4868201610352565b918252848101860191868101908a8411156103fe57600080fd5b87870192505b8383101561048e5782358681111561041c5760008081fd5b8701603f81018c1361042e5760008081fd5b888101356040888211156104445761044461033c565b610455828901601f19168c01610352565b8281528e8284860101111561046a5760008081fd5b828285018d83013760009281018c0192909252508352509187019190870190610404565b9a9950505050505050505050565b8183823760009101908152919050565b634e487b7160e01b600052603260045260246000fd5b60005b838110156104dd5781810151838201526020016104c5565b50506000910152565b600082516104f88184602087016104c2565b9190910192915050565b60208152600082518060208401526105218160408501602087016104c2565b601f01601f19169190910160400192915050565b60006001820161055557634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220c01b7cf9f606016ad0718eed2ea7820c75cfc73137245ea92220d234e7703dc264736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 18466, + "contract": "contracts/dnsregistrar/SimplePublicSuffixList.sol:SimplePublicSuffixList", + "label": "owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 5832, + "contract": "contracts/dnsregistrar/SimplePublicSuffixList.sol:SimplePublicSuffixList", + "label": "suffixes", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes_memory_ptr,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes_memory_ptr": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes_memory_ptr,t_bool)": { + "encoding": "mapping", + "key": "t_bytes_memory_ptr", + "label": "mapping(bytes => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/StaticBulkRenewal.json b/solidity/dns-contracts/deployments/mainnet/StaticBulkRenewal.json new file mode 100644 index 0000000..f66d4d5 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/StaticBulkRenewal.json @@ -0,0 +1,130 @@ +{ + "address": "0xa12159e5131b1eEf6B4857EEE3e1954744b5033A", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ETHRegistrarController", + "name": "_controller", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "names", + "type": "string[]" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renewAll", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "names", + "type": "string[]" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "rentPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "total", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x3c45be36720c08e6ae11d43ed1cfea997da54470f875ecc74f9e9776bdce525e", + "receipt": { + "to": null, + "from": "0x69420f05A11f617B4B74fFe2E04B2D300dFA556F", + "contractAddress": "0xa12159e5131b1eEf6B4857EEE3e1954744b5033A", + "transactionIndex": 59, + "gasUsed": "396872", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x40dc1cf50a2eccf097228aa80f36ca582aac3b2e50b0f061d9dcfaa4e4380545", + "transactionHash": "0x3c45be36720c08e6ae11d43ed1cfea997da54470f875ecc74f9e9776bdce525e", + "logs": [], + "blockNumber": 17119429, + "cumulativeGasUsed": "5420864", + "status": 1, + "byzantium": true + }, + "args": [ + "0x253553366Da8546fC250F225fe3d25d0C782303b" + ], + "numDeployments": 1, + "solcInputHash": "ad37cc3cd3f1925923b5003f9803ae69", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ETHRegistrarController\",\"name\":\"_controller\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"names\",\"type\":\"string[]\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"renewAll\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"names\",\"type\":\"string[]\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"rentPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/StaticBulkRenewal.sol\":\"StaticBulkRenewal\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1300},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6392f2cfe3a5ee802227fe7a2dfd47096d881aec89bddd214b35c5b46d3cd941\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/ERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721.sol\\\";\\nimport \\\"./IERC721Receiver.sol\\\";\\nimport \\\"./extensions/IERC721Metadata.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\nimport \\\"../../utils/Strings.sol\\\";\\nimport \\\"../../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\n * {ERC721Enumerable}.\\n */\\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\\n using Address for address;\\n using Strings for uint256;\\n\\n // Token name\\n string private _name;\\n\\n // Token symbol\\n string private _symbol;\\n\\n // Mapping from token ID to owner address\\n mapping(uint256 => address) private _owners;\\n\\n // Mapping owner address to token count\\n mapping(address => uint256) private _balances;\\n\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) private _tokenApprovals;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IERC721).interfaceId ||\\n interfaceId == type(IERC721Metadata).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721-balanceOf}.\\n */\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\n return _balances[owner];\\n }\\n\\n /**\\n * @dev See {IERC721-ownerOf}.\\n */\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\n address owner = _ownerOf(tokenId);\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n _requireMinted(tokenId);\\n\\n string memory baseURI = _baseURI();\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\n }\\n\\n /**\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\n * by default, can be overridden in child contracts.\\n */\\n function _baseURI() internal view virtual returns (string memory) {\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual override {\\n address owner = ERC721.ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\n _requireMinted(tokenId);\\n\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC721-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC721-isApprovedForAll}.\\n */\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[owner][operator];\\n }\\n\\n /**\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n _safeTransfer(from, to, tokenId, data);\\n }\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\n *\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeTransfer(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) internal virtual {\\n _transfer(from, to, tokenId);\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n }\\n\\n /**\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\n }\\n\\n /**\\n * @dev Returns whether `tokenId` exists.\\n *\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\n *\\n * Tokens start existing when they are minted (`_mint`),\\n * and stop existing when they are burned (`_burn`).\\n */\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\n return _ownerOf(tokenId) != address(0);\\n }\\n\\n /**\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\n address owner = ERC721.ownerOf(tokenId);\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\n }\\n\\n /**\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\n _safeMint(to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\n */\\n function _safeMint(\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) internal virtual {\\n _mint(to, tokenId);\\n require(\\n _checkOnERC721Received(address(0), to, tokenId, data),\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\n );\\n }\\n\\n /**\\n * @dev Mints `tokenId` and transfers it to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - `to` cannot be the zero address.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _mint(address to, uint256 tokenId) internal virtual {\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n _beforeTokenTransfer(address(0), to, tokenId, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _burn(uint256 tokenId) internal virtual {\\n address owner = ERC721.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\n }\\n\\n /**\\n * @dev Transfers `tokenId` from `from` to `to`.\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _transfer(\\n address from,\\n address to,\\n uint256 tokenId\\n ) internal virtual {\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, tokenId, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(\\n address owner,\\n address operator,\\n bool approved\\n ) internal virtual {\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Reverts if the `tokenId` has not been minted yet.\\n */\\n function _requireMinted(uint256 tokenId) internal view virtual {\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\n }\\n\\n /**\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\n * The call is not executed if the target address is not a contract.\\n *\\n * @param from address representing the previous owner of the given token ID\\n * @param to target address that will receive the tokens\\n * @param tokenId uint256 ID of the token to be transferred\\n * @param data bytes optional data to send along with the call\\n * @return bool whether the call correctly returned the expected magic value\\n */\\n function _checkOnERC721Received(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) private returns (bool) {\\n if (to.isContract()) {\\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721Receiver.onERC721Received.selector;\\n } catch (bytes memory reason) {\\n if (reason.length == 0) {\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n } else {\\n /// @solidity memory-safe-assembly\\n assembly {\\n revert(add(32, reason), mload(reason))\\n }\\n }\\n }\\n } else {\\n return true;\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256, /* firstTokenId */\\n uint256 batchSize\\n ) internal virtual {\\n if (batchSize > 1) {\\n if (from != address(0)) {\\n _balances[from] -= batchSize;\\n }\\n if (to != address(0)) {\\n _balances[to] += batchSize;\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 firstTokenId,\\n uint256 batchSize\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0xd89f3585b211fc9e3408384a4c4efdc3a93b2f877a3821046fa01c219d35be1b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xab28a56179c1db258c9bf5235b382698cb650debecb51b23d12be9e241374b68\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721Metadata is IERC721 {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\"},\"contracts/ethregistrar/BaseRegistrarImplementation.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/ERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\\n // A map of expiry times\\n mapping(uint256 => uint256) expiries;\\n // The ENS registry\\n ENS public ens;\\n // The namehash of the TLD this registrar owns (eg, .eth)\\n bytes32 public baseNode;\\n // A map of addresses that are authorised to register and renew names.\\n mapping(address => bool) public controllers;\\n uint256 public constant GRACE_PERIOD = 90 days;\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n bytes4 private constant ERC721_ID =\\n bytes4(\\n keccak256(\\\"balanceOf(address)\\\") ^\\n keccak256(\\\"ownerOf(uint256)\\\") ^\\n keccak256(\\\"approve(address,uint256)\\\") ^\\n keccak256(\\\"getApproved(uint256)\\\") ^\\n keccak256(\\\"setApprovalForAll(address,bool)\\\") ^\\n keccak256(\\\"isApprovedForAll(address,address)\\\") ^\\n keccak256(\\\"transferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256,bytes)\\\")\\n );\\n bytes4 private constant RECLAIM_ID =\\n bytes4(keccak256(\\\"reclaim(uint256,address)\\\"));\\n\\n /**\\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\\n * @dev Returns whether the given spender can transfer a given token ID\\n * @param spender address of the spender to query\\n * @param tokenId uint256 ID of the token to be transferred\\n * @return bool whether the msg.sender is approved for the given token ID,\\n * is an operator of the owner, or is the owner of the token\\n */\\n function _isApprovedOrOwner(\\n address spender,\\n uint256 tokenId\\n ) internal view override returns (bool) {\\n address owner = ownerOf(tokenId);\\n return (spender == owner ||\\n getApproved(tokenId) == spender ||\\n isApprovedForAll(owner, spender));\\n }\\n\\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\\\"\\\", \\\"\\\") {\\n ens = _ens;\\n baseNode = _baseNode;\\n }\\n\\n modifier live() {\\n require(ens.owner(baseNode) == address(this));\\n _;\\n }\\n\\n modifier onlyController() {\\n require(controllers[msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Gets the owner of the specified token ID. Names become unowned\\n * when their registration expires.\\n * @param tokenId uint256 ID of the token to query the owner of\\n * @return address currently marked as the owner of the given token ID\\n */\\n function ownerOf(\\n uint256 tokenId\\n ) public view override(IERC721, ERC721) returns (address) {\\n require(expiries[tokenId] > block.timestamp);\\n return super.ownerOf(tokenId);\\n }\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external override onlyOwner {\\n controllers[controller] = true;\\n emit ControllerAdded(controller);\\n }\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external override onlyOwner {\\n controllers[controller] = false;\\n emit ControllerRemoved(controller);\\n }\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external override onlyOwner {\\n ens.setResolver(baseNode, resolver);\\n }\\n\\n // Returns the expiration timestamp of the specified id.\\n function nameExpires(uint256 id) external view override returns (uint256) {\\n return expiries[id];\\n }\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) public view override returns (bool) {\\n // Not available if it's registered here or in its grace period.\\n return expiries[id] + GRACE_PERIOD < block.timestamp;\\n }\\n\\n /**\\n * @dev Register a name.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external override returns (uint256) {\\n return _register(id, owner, duration, true);\\n }\\n\\n /**\\n * @dev Register a name, without modifying the registry.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function registerOnly(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256) {\\n return _register(id, owner, duration, false);\\n }\\n\\n function _register(\\n uint256 id,\\n address owner,\\n uint256 duration,\\n bool updateRegistry\\n ) internal live onlyController returns (uint256) {\\n require(available(id));\\n require(\\n block.timestamp + duration + GRACE_PERIOD >\\n block.timestamp + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] = block.timestamp + duration;\\n if (_exists(id)) {\\n // Name was previously owned, and expired\\n _burn(id);\\n }\\n _mint(owner, id);\\n if (updateRegistry) {\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n emit NameRegistered(id, owner, block.timestamp + duration);\\n\\n return block.timestamp + duration;\\n }\\n\\n function renew(\\n uint256 id,\\n uint256 duration\\n ) external override live onlyController returns (uint256) {\\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\\n require(\\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] += duration;\\n emit NameRenewed(id, expiries[id]);\\n return expiries[id];\\n }\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external override live {\\n require(_isApprovedOrOwner(msg.sender, id));\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view override(ERC721, IERC165) returns (bool) {\\n return\\n interfaceID == INTERFACE_META_ID ||\\n interfaceID == ERC721_ID ||\\n interfaceID == RECLAIM_ID;\\n }\\n}\\n\",\"keccak256\":\"0xaee6eb36aead449d397b86a02e9c63bc46e3ef378d0a62bfd68beaae1150c9d0\"},\"contracts/ethregistrar/ETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport {BaseRegistrarImplementation} from \\\"./BaseRegistrarImplementation.sol\\\";\\nimport {StringUtils} from \\\"./StringUtils.sol\\\";\\nimport {Resolver} from \\\"../resolvers/Resolver.sol\\\";\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {ReverseRegistrar} from \\\"../reverseRegistrar/ReverseRegistrar.sol\\\";\\nimport {ReverseClaimer} from \\\"../reverseRegistrar/ReverseClaimer.sol\\\";\\nimport {IETHRegistrarController, IPriceOracle} from \\\"./IETHRegistrarController.sol\\\";\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {INameWrapper} from \\\"../wrapper/INameWrapper.sol\\\";\\nimport {ERC20Recoverable} from \\\"../utils/ERC20Recoverable.sol\\\";\\n\\nerror CommitmentTooNew(bytes32 commitment);\\nerror CommitmentTooOld(bytes32 commitment);\\nerror NameNotAvailable(string name);\\nerror DurationTooShort(uint256 duration);\\nerror ResolverRequiredWhenDataSupplied();\\nerror UnexpiredCommitmentExists(bytes32 commitment);\\nerror InsufficientValue();\\nerror Unauthorised(bytes32 node);\\nerror MaxCommitmentAgeTooLow();\\nerror MaxCommitmentAgeTooHigh();\\n\\n/**\\n * @dev A registrar controller for registering and renewing names at fixed cost.\\n */\\ncontract ETHRegistrarController is\\n Ownable,\\n IETHRegistrarController,\\n IERC165,\\n ERC20Recoverable,\\n ReverseClaimer\\n{\\n using StringUtils for *;\\n using Address for address;\\n\\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\\n bytes32 private constant ETH_NODE =\\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\\n uint64 private constant MAX_EXPIRY = type(uint64).max;\\n BaseRegistrarImplementation immutable base;\\n IPriceOracle public immutable prices;\\n uint256 public immutable minCommitmentAge;\\n uint256 public immutable maxCommitmentAge;\\n ReverseRegistrar public immutable reverseRegistrar;\\n INameWrapper public immutable nameWrapper;\\n\\n mapping(bytes32 => uint256) public commitments;\\n\\n event NameRegistered(\\n string name,\\n bytes32 indexed label,\\n address indexed owner,\\n uint256 baseCost,\\n uint256 premium,\\n uint256 expires\\n );\\n event NameRenewed(\\n string name,\\n bytes32 indexed label,\\n uint256 cost,\\n uint256 expires\\n );\\n\\n constructor(\\n BaseRegistrarImplementation _base,\\n IPriceOracle _prices,\\n uint256 _minCommitmentAge,\\n uint256 _maxCommitmentAge,\\n ReverseRegistrar _reverseRegistrar,\\n INameWrapper _nameWrapper,\\n ENS _ens\\n ) ReverseClaimer(_ens, msg.sender) {\\n if (_maxCommitmentAge <= _minCommitmentAge) {\\n revert MaxCommitmentAgeTooLow();\\n }\\n\\n if (_maxCommitmentAge > block.timestamp) {\\n revert MaxCommitmentAgeTooHigh();\\n }\\n\\n base = _base;\\n prices = _prices;\\n minCommitmentAge = _minCommitmentAge;\\n maxCommitmentAge = _maxCommitmentAge;\\n reverseRegistrar = _reverseRegistrar;\\n nameWrapper = _nameWrapper;\\n }\\n\\n function rentPrice(\\n string memory name,\\n uint256 duration\\n ) public view override returns (IPriceOracle.Price memory price) {\\n bytes32 label = keccak256(bytes(name));\\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\\n }\\n\\n function valid(string memory name) public pure returns (bool) {\\n return name.strlen() >= 3;\\n }\\n\\n function available(string memory name) public view override returns (bool) {\\n bytes32 label = keccak256(bytes(name));\\n return valid(name) && base.available(uint256(label));\\n }\\n\\n function makeCommitment(\\n string memory name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] calldata data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses\\n ) public pure override returns (bytes32) {\\n bytes32 label = keccak256(bytes(name));\\n if (data.length > 0 && resolver == address(0)) {\\n revert ResolverRequiredWhenDataSupplied();\\n }\\n return\\n keccak256(\\n abi.encode(\\n label,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses\\n )\\n );\\n }\\n\\n function commit(bytes32 commitment) public override {\\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\\n revert UnexpiredCommitmentExists(commitment);\\n }\\n commitments[commitment] = block.timestamp;\\n }\\n\\n function register(\\n string calldata name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] calldata data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses\\n ) public payable override {\\n IPriceOracle.Price memory price = rentPrice(name, duration);\\n if (msg.value < price.base + price.premium) {\\n revert InsufficientValue();\\n }\\n\\n _consumeCommitment(\\n name,\\n duration,\\n makeCommitment(\\n name,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses\\n )\\n );\\n\\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\\n name,\\n owner,\\n duration,\\n resolver,\\n ownerControlledFuses\\n );\\n\\n if (data.length > 0) {\\n _setRecords(resolver, keccak256(bytes(name)), data);\\n }\\n\\n if (reverseRecord) {\\n _setReverseRecord(name, resolver, msg.sender);\\n }\\n\\n emit NameRegistered(\\n name,\\n keccak256(bytes(name)),\\n owner,\\n price.base,\\n price.premium,\\n expires\\n );\\n\\n if (msg.value > (price.base + price.premium)) {\\n payable(msg.sender).transfer(\\n msg.value - (price.base + price.premium)\\n );\\n }\\n }\\n\\n function renew(\\n string calldata name,\\n uint256 duration\\n ) external payable override {\\n bytes32 labelhash = keccak256(bytes(name));\\n uint256 tokenId = uint256(labelhash);\\n IPriceOracle.Price memory price = rentPrice(name, duration);\\n if (msg.value < price.base) {\\n revert InsufficientValue();\\n }\\n uint256 expires = nameWrapper.renew(tokenId, duration);\\n\\n if (msg.value > price.base) {\\n payable(msg.sender).transfer(msg.value - price.base);\\n }\\n\\n emit NameRenewed(name, labelhash, msg.value, expires);\\n }\\n\\n function withdraw() public {\\n payable(owner()).transfer(address(this).balance);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IETHRegistrarController).interfaceId;\\n }\\n\\n /* Internal functions */\\n\\n function _consumeCommitment(\\n string memory name,\\n uint256 duration,\\n bytes32 commitment\\n ) internal {\\n // Require an old enough commitment.\\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\\n revert CommitmentTooNew(commitment);\\n }\\n\\n // If the commitment is too old, or the name is registered, stop\\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\\n revert CommitmentTooOld(commitment);\\n }\\n if (!available(name)) {\\n revert NameNotAvailable(name);\\n }\\n\\n delete (commitments[commitment]);\\n\\n if (duration < MIN_REGISTRATION_DURATION) {\\n revert DurationTooShort(duration);\\n }\\n }\\n\\n function _setRecords(\\n address resolverAddress,\\n bytes32 label,\\n bytes[] calldata data\\n ) internal {\\n // use hardcoded .eth namehash\\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\\n Resolver resolver = Resolver(resolverAddress);\\n resolver.multicallWithNodeCheck(nodehash, data);\\n }\\n\\n function _setReverseRecord(\\n string memory name,\\n address resolver,\\n address owner\\n ) internal {\\n reverseRegistrar.setNameForAddr(\\n msg.sender,\\n owner,\\n resolver,\\n string.concat(name, \\\".eth\\\")\\n );\\n }\\n}\\n\",\"keccak256\":\"0x2ba2cab655f9128ae5c803540b8712be9bdfee1a28b9623a06c02c2435d0ce8b\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/ethregistrar/IBulkRenewal.sol\":{\"content\":\"interface IBulkRenewal {\\n function rentPrice(\\n string[] calldata names,\\n uint256 duration\\n ) external view returns (uint256 total);\\n\\n function renewAll(\\n string[] calldata names,\\n uint256 duration\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x45d72e0464af5165831210496cd293cc7ceeb7307f2bdad679f64613a6bcf029\"},\"contracts/ethregistrar/IETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./IPriceOracle.sol\\\";\\n\\ninterface IETHRegistrarController {\\n function rentPrice(\\n string memory,\\n uint256\\n ) external view returns (IPriceOracle.Price memory);\\n\\n function available(string memory) external returns (bool);\\n\\n function makeCommitment(\\n string memory,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16\\n ) external pure returns (bytes32);\\n\\n function commit(bytes32) external;\\n\\n function register(\\n string calldata,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16\\n ) external payable;\\n\\n function renew(string calldata, uint256) external payable;\\n}\\n\",\"keccak256\":\"0x54575cc2e4245c0ba79e42a58086335ec0522f4cbeb8c92d71b886593c97060e\",\"license\":\"MIT\"},\"contracts/ethregistrar/IPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\ninterface IPriceOracle {\\n struct Price {\\n uint256 base;\\n uint256 premium;\\n }\\n\\n /**\\n * @dev Returns the price to register or renew a name.\\n * @param name The name being registered or renewed.\\n * @param expires When the name presently expires (0 if this is a new registration).\\n * @param duration How long the name is being registered or extended for, in seconds.\\n * @return base premium tuple of base price + premium price\\n */\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (Price calldata);\\n}\\n\",\"keccak256\":\"0x1ec537b4c7f9cc40363b39dcc7ade8c29bf94662e6b01d38e681487637bd577e\",\"license\":\"MIT\"},\"contracts/ethregistrar/StaticBulkRenewal.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./ETHRegistrarController.sol\\\";\\nimport \\\"./IBulkRenewal.sol\\\";\\nimport \\\"./IPriceOracle.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\ncontract StaticBulkRenewal is IBulkRenewal {\\n ETHRegistrarController controller;\\n\\n constructor(ETHRegistrarController _controller) {\\n controller = _controller;\\n }\\n\\n function rentPrice(\\n string[] calldata names,\\n uint256 duration\\n ) external view override returns (uint256 total) {\\n uint256 length = names.length;\\n for (uint256 i = 0; i < length; ) {\\n IPriceOracle.Price memory price = controller.rentPrice(\\n names[i],\\n duration\\n );\\n unchecked {\\n ++i;\\n total += (price.base + price.premium);\\n }\\n }\\n }\\n\\n function renewAll(\\n string[] calldata names,\\n uint256 duration\\n ) external payable override {\\n uint256 length = names.length;\\n uint256 total;\\n for (uint256 i = 0; i < length; ) {\\n IPriceOracle.Price memory price = controller.rentPrice(\\n names[i],\\n duration\\n );\\n uint256 totalPrice = price.base + price.premium;\\n controller.renew{value: totalPrice}(names[i], duration);\\n unchecked {\\n ++i;\\n total += totalPrice;\\n }\\n }\\n // Send any excess funds back\\n payable(msg.sender).transfer(address(this).balance);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IBulkRenewal).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xa4c30f4d395dec3d252e8b9e46710fe38038cfdc3e33a3bdd0ea54e046e91f48\",\"license\":\"MIT\"},\"contracts/ethregistrar/StringUtils.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary StringUtils {\\n /**\\n * @dev Returns the length of a given string\\n *\\n * @param s The string to measure the length of\\n * @return The length of the input string\\n */\\n function strlen(string memory s) internal pure returns (uint256) {\\n uint256 len;\\n uint256 i = 0;\\n uint256 bytelength = bytes(s).length;\\n for (len = 0; i < bytelength; len++) {\\n bytes1 b = bytes(s)[i];\\n if (b < 0x80) {\\n i += 1;\\n } else if (b < 0xE0) {\\n i += 2;\\n } else if (b < 0xF0) {\\n i += 3;\\n } else if (b < 0xF8) {\\n i += 4;\\n } else if (b < 0xFC) {\\n i += 5;\\n } else {\\n i += 6;\\n }\\n }\\n return len;\\n }\\n}\\n\",\"keccak256\":\"0x4cc8363a850dc9130c433ee50e7c97e29a45ae5d9bd0808205ac7134b34f24e4\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/resolvers/Resolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"./profiles/IABIResolver.sol\\\";\\nimport \\\"./profiles/IAddressResolver.sol\\\";\\nimport \\\"./profiles/IAddrResolver.sol\\\";\\nimport \\\"./profiles/IContentHashResolver.sol\\\";\\nimport \\\"./profiles/IDNSRecordResolver.sol\\\";\\nimport \\\"./profiles/IDNSZoneResolver.sol\\\";\\nimport \\\"./profiles/IInterfaceResolver.sol\\\";\\nimport \\\"./profiles/INameResolver.sol\\\";\\nimport \\\"./profiles/IPubkeyResolver.sol\\\";\\nimport \\\"./profiles/ITextResolver.sol\\\";\\nimport \\\"./profiles/IExtendedResolver.sol\\\";\\n\\n/**\\n * A generic resolver interface which includes all the functions including the ones deprecated\\n */\\ninterface Resolver is\\n IERC165,\\n IABIResolver,\\n IAddressResolver,\\n IAddrResolver,\\n IContentHashResolver,\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n IInterfaceResolver,\\n INameResolver,\\n IPubkeyResolver,\\n ITextResolver,\\n IExtendedResolver\\n{\\n /* Deprecated events */\\n event ContentChanged(bytes32 indexed node, bytes32 hash);\\n\\n function setApprovalForAll(address, bool) external;\\n\\n function approve(bytes32 node, address delegate, bool approved) external;\\n\\n function isApprovedForAll(address account, address operator) external;\\n\\n function isApprovedFor(\\n address owner,\\n bytes32 node,\\n address delegate\\n ) external;\\n\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external;\\n\\n function setAddr(bytes32 node, address addr) external;\\n\\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\\n\\n function setContenthash(bytes32 node, bytes calldata hash) external;\\n\\n function setDnsrr(bytes32 node, bytes calldata data) external;\\n\\n function setName(bytes32 node, string calldata _name) external;\\n\\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\\n\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external;\\n\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external;\\n\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n /* Deprecated functions */\\n function content(bytes32 node) external view returns (bytes32);\\n\\n function multihash(bytes32 node) external view returns (bytes memory);\\n\\n function setContent(bytes32 node, bytes32 hash) external;\\n\\n function setMultihash(bytes32 node, bytes calldata hash) external;\\n}\\n\",\"keccak256\":\"0xfc77ab6b7c59c3ebfe1c720bdebf9b08c2488ff7ac9501a9aa056c5d6d5b50c5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseClaimer.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\n\\ncontract ReverseClaimer {\\n bytes32 constant ADDR_REVERSE_NODE =\\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n constructor(ENS ens, address claimant) {\\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\\n ens.owner(ADDR_REVERSE_NODE)\\n );\\n reverseRegistrar.claim(claimant);\\n }\\n}\\n\",\"keccak256\":\"0x78a28627241535b595f6fff476a1fa7acc90c80684fe7784734920fc8af6fc22\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/ReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IReverseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"../root/Controllable.sol\\\";\\n\\nabstract contract NameResolver {\\n function setName(bytes32 node, string memory name) public virtual;\\n}\\n\\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\\n\\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n// namehash('addr.reverse')\\n\\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\\n ENS public immutable ens;\\n NameResolver public defaultResolver;\\n\\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\\n event DefaultResolverChanged(NameResolver indexed resolver);\\n\\n /**\\n * @dev Constructor\\n * @param ensAddr The address of the ENS registry.\\n */\\n constructor(ENS ensAddr) {\\n ens = ensAddr;\\n\\n // Assign ownership of the reverse record to our deployer\\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\\n ensAddr.owner(ADDR_REVERSE_NODE)\\n );\\n if (address(oldRegistrar) != address(0x0)) {\\n oldRegistrar.claim(msg.sender);\\n }\\n }\\n\\n modifier authorised(address addr) {\\n require(\\n addr == msg.sender ||\\n controllers[msg.sender] ||\\n ens.isApprovedForAll(addr, msg.sender) ||\\n ownsContract(addr),\\n \\\"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\\\"\\n );\\n _;\\n }\\n\\n function setDefaultResolver(address resolver) public override onlyOwner {\\n require(\\n address(resolver) != address(0),\\n \\\"ReverseRegistrar: Resolver address must not be 0\\\"\\n );\\n defaultResolver = NameResolver(resolver);\\n emit DefaultResolverChanged(NameResolver(resolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claim(address owner) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, address(defaultResolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param addr The reverse record to set\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The resolver of the reverse node\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) public override authorised(addr) returns (bytes32) {\\n bytes32 labelHash = sha3HexAddress(addr);\\n bytes32 reverseNode = keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\\n );\\n emit ReverseClaimed(addr, reverseNode);\\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\\n return reverseNode;\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, resolver);\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the calling account. First updates the resolver to the default reverse\\n * resolver if necessary.\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setName(string memory name) public override returns (bytes32) {\\n return\\n setNameForAddr(\\n msg.sender,\\n msg.sender,\\n address(defaultResolver),\\n name\\n );\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the account provided. Updates the resolver to a designated resolver\\n * Only callable by controllers and authorised users\\n * @param addr The reverse record to set\\n * @param owner The owner of the reverse node\\n * @param resolver The resolver of the reverse node\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) public override returns (bytes32) {\\n bytes32 node = claimForAddr(addr, owner, resolver);\\n NameResolver(resolver).setName(node, name);\\n return node;\\n }\\n\\n /**\\n * @dev Returns the node hash for a given account's reverse records.\\n * @param addr The address to hash\\n * @return The ENS node hash.\\n */\\n function node(address addr) public pure override returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\\n );\\n }\\n\\n /**\\n * @dev An optimised function to compute the sha3 of the lower-case\\n * hexadecimal representation of an Ethereum address.\\n * @param addr The address to hash\\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\\n * input address.\\n */\\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\\n assembly {\\n for {\\n let i := 40\\n } gt(i, 0) {\\n\\n } {\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n }\\n\\n ret := keccak256(0, 40)\\n }\\n }\\n\\n function ownsContract(address addr) internal view returns (bool) {\\n try Ownable(addr).owner() returns (address owner) {\\n return owner == msg.sender;\\n } catch {\\n return false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd57d28e5791b4b44650a00f5ef6c725af53698ec33faeeaa3591f0dbd939559a\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"},\"contracts/utils/ERC20Recoverable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\\n */\\n\\ncontract ERC20Recoverable is Ownable {\\n /**\\n @notice Recover ERC20 tokens sent to the contract by mistake.\\n @dev The contract is Ownable and only the owner can call the recover function.\\n @param _to The address to send the tokens to.\\n@param _token The address of the ERC20 token to recover\\n @param _amount The amount of tokens to recover.\\n */\\n function recoverFunds(\\n address _token,\\n address _to,\\n uint256 _amount\\n ) external onlyOwner {\\n IERC20(_token).transfer(_to, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x793a38091e1f81499a29ddba82c2b2f3cdd07071b81a832886e8e02a45ff352a\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_ETH = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x70310eb67146d7290731c31841399640ac3b6a949eadc6598bc150123d185c57\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161066138038061066183398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b6105ce806100936000396000f3fe6080604052600436106100345760003560e01c806301ffc9a7146100395780633971d4671461006e578063e8d6dbb41461009c575b600080fd5b34801561004557600080fd5b506100596100543660046103b9565b6100b1565b60405190151581526020015b60405180910390f35b34801561007a57600080fd5b5061008e610089366004610402565b61014a565b604051908152602001610065565b6100af6100aa366004610402565b610218565b005b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061014457507fffffffff0000000000000000000000000000000000000000000000000000000082167fd1a70fd300000000000000000000000000000000000000000000000000000000145b92915050565b600082815b8181101561020f576000805473ffffffffffffffffffffffffffffffffffffffff166383e7f6ff8888858181106101885761018861047d565b905060200281019061019a9190610493565b886040518463ffffffff1660e01b81526004016101b9939291906104e1565b6040805180830381865afa1580156101d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f9919061051a565b602081015190510193909301925060010161014f565b50509392505050565b816000805b82811015610384576000805473ffffffffffffffffffffffffffffffffffffffff166383e7f6ff8888858181106102565761025661047d565b90506020028101906102689190610493565b886040518463ffffffff1660e01b8152600401610287939291906104e1565b6040805180830381865afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c7919061051a565b90506000816020015182600001516102df9190610577565b60005490915073ffffffffffffffffffffffffffffffffffffffff1663acf1a841828a8a878181106103135761031361047d565b90506020028101906103259190610493565b8a6040518563ffffffff1660e01b8152600401610344939291906104e1565b6000604051808303818588803b15801561035d57600080fd5b505af1158015610371573d6000803e3d6000fd5b505050919094019350505060010161021d565b5060405133904780156108fc02916000818181858888f193505050501580156103b1573d6000803e3d6000fd5b505050505050565b6000602082840312156103cb57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146103fb57600080fd5b9392505050565b60008060006040848603121561041757600080fd5b833567ffffffffffffffff8082111561042f57600080fd5b818601915086601f83011261044357600080fd5b81358181111561045257600080fd5b8760208260051b850101111561046757600080fd5b6020928301989097509590910135949350505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126104aa57600080fd5b83018035915067ffffffffffffffff8211156104c557600080fd5b6020019150368190038213156104da57600080fd5b9250929050565b604081528260408201528284606083013760006060848301015260006060601f19601f8601168301019050826020830152949350505050565b60006040828403121561052c57600080fd5b6040516040810181811067ffffffffffffffff8211171561055d57634e487b7160e01b600052604160045260246000fd5b604052825181526020928301519281019290925250919050565b8082018082111561014457634e487b7160e01b600052601160045260246000fdfea2646970667358221220f2cafb300cd283e2fd3ccc16b0f7dbcddf659bdd5da544f7c2f88ee7a2a5388f64736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106100345760003560e01c806301ffc9a7146100395780633971d4671461006e578063e8d6dbb41461009c575b600080fd5b34801561004557600080fd5b506100596100543660046103b9565b6100b1565b60405190151581526020015b60405180910390f35b34801561007a57600080fd5b5061008e610089366004610402565b61014a565b604051908152602001610065565b6100af6100aa366004610402565b610218565b005b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061014457507fffffffff0000000000000000000000000000000000000000000000000000000082167fd1a70fd300000000000000000000000000000000000000000000000000000000145b92915050565b600082815b8181101561020f576000805473ffffffffffffffffffffffffffffffffffffffff166383e7f6ff8888858181106101885761018861047d565b905060200281019061019a9190610493565b886040518463ffffffff1660e01b81526004016101b9939291906104e1565b6040805180830381865afa1580156101d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f9919061051a565b602081015190510193909301925060010161014f565b50509392505050565b816000805b82811015610384576000805473ffffffffffffffffffffffffffffffffffffffff166383e7f6ff8888858181106102565761025661047d565b90506020028101906102689190610493565b886040518463ffffffff1660e01b8152600401610287939291906104e1565b6040805180830381865afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c7919061051a565b90506000816020015182600001516102df9190610577565b60005490915073ffffffffffffffffffffffffffffffffffffffff1663acf1a841828a8a878181106103135761031361047d565b90506020028101906103259190610493565b8a6040518563ffffffff1660e01b8152600401610344939291906104e1565b6000604051808303818588803b15801561035d57600080fd5b505af1158015610371573d6000803e3d6000fd5b505050919094019350505060010161021d565b5060405133904780156108fc02916000818181858888f193505050501580156103b1573d6000803e3d6000fd5b505050505050565b6000602082840312156103cb57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146103fb57600080fd5b9392505050565b60008060006040848603121561041757600080fd5b833567ffffffffffffffff8082111561042f57600080fd5b818601915086601f83011261044357600080fd5b81358181111561045257600080fd5b8760208260051b850101111561046757600080fd5b6020928301989097509590910135949350505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126104aa57600080fd5b83018035915067ffffffffffffffff8211156104c557600080fd5b6020019150368190038213156104da57600080fd5b9250929050565b604081528260408201528284606083013760006060848301015260006060601f19601f8601168301019050826020830152949350505050565b60006040828403121561052c57600080fd5b6040516040810181811067ffffffffffffffff8211171561055d57634e487b7160e01b600052604160045260246000fd5b604052825181526020928301519281019290925250919050565b8082018082111561014457634e487b7160e01b600052601160045260246000fdfea2646970667358221220f2cafb300cd283e2fd3ccc16b0f7dbcddf659bdd5da544f7c2f88ee7a2a5388f64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 4345, + "contract": "contracts/ethregistrar/StaticBulkRenewal.sol:StaticBulkRenewal", + "label": "controller", + "offset": 0, + "slot": "0", + "type": "t_contract(ETHRegistrarController)4123" + } + ], + "types": { + "t_contract(ETHRegistrarController)4123": { + "encoding": "inplace", + "label": "contract ETHRegistrarController", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/StaticMetadataService.json b/solidity/dns-contracts/deployments/mainnet/StaticMetadataService.json new file mode 100644 index 0000000..6b224d0 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/StaticMetadataService.json @@ -0,0 +1,88 @@ +{ + "address": "0x3A368e3D5F19aF3DE594A9fC2CFfc6e256a616c7", + "abi": [ + { + "inputs": [ + { + "internalType": "string", + "name": "_metaDataUri", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "uri", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xb932cee1f999f0da1b25144520fa37d583ec640d763034313bcce2dc6c73abc8", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0x3A368e3D5F19aF3DE594A9fC2CFfc6e256a616c7", + "transactionIndex": 89, + "gasUsed": "233736", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x560f9d61011ff17b2785387c1425ee6aa4065831f5f5c010fb702e01d23ececd", + "transactionHash": "0xb932cee1f999f0da1b25144520fa37d583ec640d763034313bcce2dc6c73abc8", + "logs": [], + "blockNumber": 16925607, + "cumulativeGasUsed": "6647803", + "status": 1, + "byzantium": true + }, + "args": [ + "ens-metadata-service.appspot.com/name/0x{id}" + ], + "numDeployments": 1, + "solcInputHash": "3fa59c31b7672c86eff32031f5a10f8a", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_metaDataUri\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/wrapper/StaticMetadataService.sol\":\"StaticMetadataService\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1300},\"remappings\":[]},\"sources\":{\"contracts/wrapper/StaticMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ncontract StaticMetadataService {\\n string private _uri;\\n\\n constructor(string memory _metaDataUri) {\\n _uri = _metaDataUri;\\n }\\n\\n function uri(uint256) public view returns (string memory) {\\n return _uri;\\n }\\n}\\n\",\"keccak256\":\"0x28aad4cb829118de64965e06af8e785e6b2efa5207859d2efc63e404c26cfea3\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161045538038061045583398101604081905261002f91610058565b600061003b82826101aa565b5050610269565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561006b57600080fd5b82516001600160401b038082111561008257600080fd5b818501915085601f83011261009657600080fd5b8151818111156100a8576100a8610042565b604051601f8201601f19908116603f011681019083821181831017156100d0576100d0610042565b8160405282815288868487010111156100e857600080fd5b600093505b8284101561010a57848401860151818501870152928501926100ed565b600086848301015280965050505050505092915050565b600181811c9082168061013557607f821691505b60208210810361015557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156101a557600081815260208120601f850160051c810160208610156101825750805b601f850160051c820191505b818110156101a15782815560010161018e565b5050505b505050565b81516001600160401b038111156101c3576101c3610042565b6101d7816101d18454610121565b8461015b565b602080601f83116001811461020c57600084156101f45750858301515b600019600386901b1c1916600185901b1785556101a1565b600085815260208120601f198616915b8281101561023b5788860151825594840194600190910190840161021c565b50858210156102595787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6101dd806102786000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80630e89341c14610030575b600080fd5b61004361003e3660046100ed565b610059565b6040516100509190610106565b60405180910390f35b60606000805461006890610154565b80601f016020809104026020016040519081016040528092919081815260200182805461009490610154565b80156100e15780601f106100b6576101008083540402835291602001916100e1565b820191906000526020600020905b8154815290600101906020018083116100c457829003601f168201915b50505050509050919050565b6000602082840312156100ff57600080fd5b5035919050565b600060208083528351808285015260005b8181101561013357858101830151858201604001528201610117565b506000604082860101526040601f19601f8301168501019250505092915050565b600181811c9082168061016857607f821691505b6020821081036101a1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea264697066735822122001ea8c956b4ed900b4cb998e1c7b9ce5ebf9c7718622fb5437c53ba715debc9b64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80630e89341c14610030575b600080fd5b61004361003e3660046100ed565b610059565b6040516100509190610106565b60405180910390f35b60606000805461006890610154565b80601f016020809104026020016040519081016040528092919081815260200182805461009490610154565b80156100e15780601f106100b6576101008083540402835291602001916100e1565b820191906000526020600020905b8154815290600101906020018083116100c457829003601f168201915b50505050509050919050565b6000602082840312156100ff57600080fd5b5035919050565b600060208083528351808285015260005b8181101561013357858101830151858201604001528201610117565b506000604082860101526040601f19601f8301168501019250505092915050565b600181811c9082168061016857607f821691505b6020821081036101a1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea264697066735822122001ea8c956b4ed900b4cb998e1c7b9ce5ebf9c7718622fb5437c53ba715debc9b64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 24202, + "contract": "contracts/wrapper/StaticMetadataService.sol:StaticMetadataService", + "label": "_uri", + "offset": 0, + "slot": "0", + "type": "t_string_storage" + } + ], + "types": { + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/TLDPublicSuffixList.json b/solidity/dns-contracts/deployments/mainnet/TLDPublicSuffixList.json new file mode 100644 index 0000000..83493a2 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/TLDPublicSuffixList.json @@ -0,0 +1,61 @@ +{ + "address": "0x7A72fEFd970A7726c4823623d88E9f3eFA1c300C", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "isPublicSuffix", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x7943cdd2d5675e25eee44b1eff8da0cb5ef699121e4ee572ba31979fbba26e9f", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0x7A72fEFd970A7726c4823623d88E9f3eFA1c300C", + "transactionIndex": 73, + "gasUsed": "166669", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xbdfc5a09fca414496fe235f8355db7103f4ab44bda01b7962ec2b905e10463d1", + "transactionHash": "0x7943cdd2d5675e25eee44b1eff8da0cb5ef699121e4ee572ba31979fbba26e9f", + "logs": [], + "blockNumber": 19020727, + "cumulativeGasUsed": "7397134", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 2, + "solcInputHash": "dd9e022689821cffaeb04b9ddbda87ae", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"isPublicSuffix\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"A public suffix list that treats all TLDs as public suffixes.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnsregistrar/TLDPublicSuffixList.sol\":\"TLDPublicSuffixList\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/dnsregistrar/PublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\ninterface PublicSuffixList {\\n function isPublicSuffix(bytes calldata name) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x12158ba8838ee2b1ebb0178a52d2f4d54dcc68282d569226e62afc2b0dccbbac\"},\"contracts/dnsregistrar/TLDPublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../dnssec-oracle/BytesUtils.sol\\\";\\nimport \\\"./PublicSuffixList.sol\\\";\\n\\n/**\\n * @dev A public suffix list that treats all TLDs as public suffixes.\\n */\\ncontract TLDPublicSuffixList is PublicSuffixList {\\n using BytesUtils for bytes;\\n\\n function isPublicSuffix(\\n bytes calldata name\\n ) external view override returns (bool) {\\n uint256 labellen = name.readUint8(0);\\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\\n }\\n}\\n\",\"keccak256\":\"0x0e64dc888396ef3c88e64afbf4e35fb107fa416174b97223d0b4894e5e085e53\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061020d806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80634f89059e14610030575b600080fd5b61004361003e36600461012e565b610057565b604051901515815260200160405180910390f35b60008061009e600085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061010a9050565b60ff16905060008111801561010057506100fb6100bc8260016101a0565b85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061010a9050565b60ff16155b9150505b92915050565b600082828151811061011e5761011e6101c1565b016020015160f81c905092915050565b6000806020838503121561014157600080fd5b823567ffffffffffffffff8082111561015957600080fd5b818501915085601f83011261016d57600080fd5b81358181111561017c57600080fd5b86602082850101111561018e57600080fd5b60209290920196919550909350505050565b8082018082111561010457634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fdfea2646970667358221220bd314730014c3187d1d82d4d375c5edf3ba7a6a9750141e8ca0924a3c4dec52b64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80634f89059e14610030575b600080fd5b61004361003e36600461012e565b610057565b604051901515815260200160405180910390f35b60008061009e600085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061010a9050565b60ff16905060008111801561010057506100fb6100bc8260016101a0565b85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061010a9050565b60ff16155b9150505b92915050565b600082828151811061011e5761011e6101c1565b016020015160f81c905092915050565b6000806020838503121561014157600080fd5b823567ffffffffffffffff8082111561015957600080fd5b818501915085601f83011261016d57600080fd5b81358181111561017c57600080fd5b86602082850101111561018e57600080fd5b60209290920196919550909350505050565b8082018082111561010457634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fdfea2646970667358221220bd314730014c3187d1d82d4d375c5edf3ba7a6a9750141e8ca0924a3c4dec52b64736f6c63430008110033", + "devdoc": { + "details": "A public suffix list that treats all TLDs as public suffixes.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/UniversalResolver.json b/solidity/dns-contracts/deployments/mainnet/UniversalResolver.json new file mode 100644 index 0000000..9698cf0 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/UniversalResolver.json @@ -0,0 +1,733 @@ +{ + "address": "0xce01f8eee7E479C928F8919abD53E553a36CeF67", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_registry", + "type": "address" + }, + { + "internalType": "string[]", + "name": "_urls", + "type": "string[]" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "string[]", + "name": "urls", + "type": "string[]" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes4", + "name": "callbackFunction", + "type": "bytes4" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "OffchainLookup", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "name": "ResolverError", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverNotContract", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverNotFound", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverWildcardNotSupported", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "string[]", + "name": "gateways", + "type": "string[]" + }, + { + "internalType": "bytes4", + "name": "callbackFunction", + "type": "bytes4" + }, + { + "internalType": "bytes", + "name": "metaData", + "type": "bytes" + } + ], + "name": "_resolveSingle", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "batchGatewayURLs", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "findResolver", + "outputs": [ + { + "internalType": "contract Resolver", + "name": "", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "registry", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "string[]", + "name": "gateways", + "type": "string[]" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "resolve", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "internalType": "struct Result[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "string[]", + "name": "gateways", + "type": "string[]" + } + ], + "name": "resolve", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "internalType": "struct Result[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "response", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "resolveCallback", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "internalType": "struct Result[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "response", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "resolveSingleCallback", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "reverseName", + "type": "bytes" + }, + { + "internalType": "string[]", + "name": "gateways", + "type": "string[]" + } + ], + "name": "reverse", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "reverseName", + "type": "bytes" + } + ], + "name": "reverse", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "response", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "reverseCallback", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "_urls", + "type": "string[]" + } + ], + "name": "setGatewayURLs", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x8200b7e257fb5bd6d7aec25c5172dd5ddc9830b42b827dcf2db51ec97abc034b", + "receipt": { + "to": null, + "from": "0x69420f05A11f617B4B74fFe2E04B2D300dFA556F", + "contractAddress": "0xce01f8eee7E479C928F8919abD53E553a36CeF67", + "transactionIndex": 75, + "gasUsed": "3139326", + "logsBloom": "0x00000000010000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020004000000000000000800000000000000000000000000000000400000000000000000000040000000000000008000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xcfa5df46abf1521f68ae72a7f7c4661949f4fb08a3d1296fe8082f6580a414e0", + "transactionHash": "0x8200b7e257fb5bd6d7aec25c5172dd5ddc9830b42b827dcf2db51ec97abc034b", + "logs": [ + { + "transactionIndex": 75, + "blockNumber": 19258213, + "transactionHash": "0x8200b7e257fb5bd6d7aec25c5172dd5ddc9830b42b827dcf2db51ec97abc034b", + "address": "0xce01f8eee7E479C928F8919abD53E553a36CeF67", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000069420f05a11f617b4b74ffe2e04b2d300dfa556f" + ], + "data": "0x", + "logIndex": 312, + "blockHash": "0xcfa5df46abf1521f68ae72a7f7c4661949f4fb08a3d1296fe8082f6580a414e0" + } + ], + "blockNumber": 19258213, + "cumulativeGasUsed": "13822779", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + [ + "https://ccip-v2.ens.xyz" + ] + ], + "numDeployments": 7, + "solcInputHash": "49f758ec505ff69b72f3179ac11d7cfc", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_registry\",\"type\":\"address\"},{\"internalType\":\"string[]\",\"name\":\"_urls\",\"type\":\"string[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"string[]\",\"name\":\"urls\",\"type\":\"string[]\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes4\",\"name\":\"callbackFunction\",\"type\":\"bytes4\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"OffchainLookup\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"name\":\"ResolverError\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverNotContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverWildcardNotSupported\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string[]\",\"name\":\"gateways\",\"type\":\"string[]\"},{\"internalType\":\"bytes4\",\"name\":\"callbackFunction\",\"type\":\"bytes4\"},{\"internalType\":\"bytes\",\"name\":\"metaData\",\"type\":\"bytes\"}],\"name\":\"_resolveSingle\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"batchGatewayURLs\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"findResolver\",\"outputs\":[{\"internalType\":\"contract Resolver\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"registry\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string[]\",\"name\":\"gateways\",\"type\":\"string[]\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"resolve\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"internalType\":\"struct Result[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"string[]\",\"name\":\"gateways\",\"type\":\"string[]\"}],\"name\":\"resolve\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"internalType\":\"struct Result[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"response\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"resolveCallback\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"internalType\":\"struct Result[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"response\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"resolveSingleCallback\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"reverseName\",\"type\":\"bytes\"},{\"internalType\":\"string[]\",\"name\":\"gateways\",\"type\":\"string[]\"}],\"name\":\"reverse\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"reverseName\",\"type\":\"bytes\"}],\"name\":\"reverse\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"response\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"reverseCallback\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"_urls\",\"type\":\"string[]\"}],\"name\":\"setGatewayURLs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"findResolver(bytes)\":{\"details\":\"Finds a resolver by recursively querying the registry, starting at the longest name and progressively removing labels until it finds a result.\",\"params\":{\"name\":\"The name to resolve, in DNS-encoded and normalised form.\"},\"returns\":{\"_0\":\"resolver The Resolver responsible for this name.\",\"_1\":\"namehash The namehash of the full name.\",\"_2\":\"finalOffset The offset of the first label with a resolver.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"resolve(bytes,bytes)\":{\"details\":\"Performs ENS name resolution for the supplied name and resolution data.\",\"params\":{\"data\":\"The resolution data, as specified in ENSIP-10.\",\"name\":\"The name to resolve, in normalised and DNS-encoded form.\"},\"returns\":{\"_0\":\"The result of resolving the name.\"}},\"reverse(bytes,string[])\":{\"details\":\"Performs ENS name reverse resolution for the supplied reverse name.\",\"params\":{\"reverseName\":\"The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\"},\"returns\":{\"_0\":\"The resolved name, the resolved address, the reverse resolver address, and the resolver address.\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"The Universal Resolver is a contract that handles the work of resolving a name entirely onchain, making it possible to make a single smart contract call to resolve an ENS name.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/utils/UniversalResolver.sol\":\"UniversalResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/resolvers/Resolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"./profiles/IABIResolver.sol\\\";\\nimport \\\"./profiles/IAddressResolver.sol\\\";\\nimport \\\"./profiles/IAddrResolver.sol\\\";\\nimport \\\"./profiles/IContentHashResolver.sol\\\";\\nimport \\\"./profiles/IDNSRecordResolver.sol\\\";\\nimport \\\"./profiles/IDNSZoneResolver.sol\\\";\\nimport \\\"./profiles/IInterfaceResolver.sol\\\";\\nimport \\\"./profiles/INameResolver.sol\\\";\\nimport \\\"./profiles/IPubkeyResolver.sol\\\";\\nimport \\\"./profiles/ITextResolver.sol\\\";\\nimport \\\"./profiles/IExtendedResolver.sol\\\";\\n\\n/**\\n * A generic resolver interface which includes all the functions including the ones deprecated\\n */\\ninterface Resolver is\\n IERC165,\\n IABIResolver,\\n IAddressResolver,\\n IAddrResolver,\\n IContentHashResolver,\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n IInterfaceResolver,\\n INameResolver,\\n IPubkeyResolver,\\n ITextResolver,\\n IExtendedResolver\\n{\\n /* Deprecated events */\\n event ContentChanged(bytes32 indexed node, bytes32 hash);\\n\\n function setApprovalForAll(address, bool) external;\\n\\n function approve(bytes32 node, address delegate, bool approved) external;\\n\\n function isApprovedForAll(address account, address operator) external;\\n\\n function isApprovedFor(\\n address owner,\\n bytes32 node,\\n address delegate\\n ) external;\\n\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external;\\n\\n function setAddr(bytes32 node, address addr) external;\\n\\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\\n\\n function setContenthash(bytes32 node, bytes calldata hash) external;\\n\\n function setDnsrr(bytes32 node, bytes calldata data) external;\\n\\n function setName(bytes32 node, string calldata _name) external;\\n\\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\\n\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external;\\n\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external;\\n\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n /* Deprecated functions */\\n function content(bytes32 node) external view returns (bytes32);\\n\\n function multihash(bytes32 node) external view returns (bytes memory);\\n\\n function setContent(bytes32 node, bytes32 hash) external;\\n\\n function setMultihash(bytes32 node, bytes calldata hash) external;\\n}\\n\",\"keccak256\":\"0xfc77ab6b7c59c3ebfe1c720bdebf9b08c2488ff7ac9501a9aa056c5d6d5b50c5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/utils/HexUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary HexUtils {\\n /**\\n * @dev Attempts to parse bytes32 from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexStringToBytes32(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (bytes32 r, bool valid) {\\n uint256 hexLength = lastIdx - idx;\\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\\n revert(\\\"Invalid string length\\\");\\n }\\n valid = true;\\n assembly {\\n // check that the index to read to is not past the end of the string\\n if gt(lastIdx, mload(str)) {\\n revert(0, 0)\\n }\\n\\n function getHex(c) -> ascii {\\n // chars 48-57: 0-9\\n if and(gt(c, 47), lt(c, 58)) {\\n ascii := sub(c, 48)\\n leave\\n }\\n // chars 65-70: A-F\\n if and(gt(c, 64), lt(c, 71)) {\\n ascii := add(sub(c, 65), 10)\\n leave\\n }\\n // chars 97-102: a-f\\n if and(gt(c, 96), lt(c, 103)) {\\n ascii := add(sub(c, 97), 10)\\n leave\\n }\\n // invalid char\\n ascii := 0xff\\n }\\n\\n let ptr := add(str, 32)\\n for {\\n let i := idx\\n } lt(i, lastIdx) {\\n i := add(i, 2)\\n } {\\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\\n // if either byte is invalid, set invalid and break loop\\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\\n valid := false\\n break\\n }\\n let combined := or(shl(4, byte1), byte2)\\n r := or(shl(8, r), combined)\\n }\\n }\\n }\\n\\n /**\\n * @dev Attempts to parse an address from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexToAddress(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (address, bool) {\\n if (lastIdx - idx < 40) return (address(0x0), false);\\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\\n return (address(uint160(uint256(r))), valid);\\n }\\n}\\n\",\"keccak256\":\"0x4a8a9c72d6f3effb80b310faa6dc273e7adbc3b949df9c7a42e290e5b13519f3\",\"license\":\"MIT\"},\"contracts/utils/LowLevelCallUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.13;\\n\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nlibrary LowLevelCallUtils {\\n using Address for address;\\n\\n /**\\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\\n * `returnDataSize` and `readReturnData`.\\n * @param target The address to staticcall.\\n * @param data The data to pass to the call.\\n * @return success True if the call succeeded, or false if it reverts.\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data\\n ) internal view returns (bool success) {\\n return functionStaticCall(target, data, gasleft());\\n }\\n\\n /**\\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\\n * `returnDataSize` and `readReturnData`.\\n * @param target The address to staticcall.\\n * @param data The data to pass to the call.\\n * @param gasLimit The gas limit to use for the call.\\n * @return success True if the call succeeded, or false if it reverts.\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n uint256 gasLimit\\n ) internal view returns (bool success) {\\n require(\\n target.isContract(),\\n \\\"LowLevelCallUtils: static call to non-contract\\\"\\n );\\n assembly {\\n success := staticcall(\\n gasLimit,\\n target,\\n add(data, 32),\\n mload(data),\\n 0,\\n 0\\n )\\n }\\n }\\n\\n /**\\n * @dev Returns the size of the return data of the most recent external call.\\n */\\n function returnDataSize() internal pure returns (uint256 len) {\\n assembly {\\n len := returndatasize()\\n }\\n }\\n\\n /**\\n * @dev Reads return data from the most recent external call.\\n * @param offset Offset into the return data.\\n * @param length Number of bytes to return.\\n */\\n function readReturnData(\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (bytes memory data) {\\n data = new bytes(length);\\n assembly {\\n returndatacopy(add(data, 32), offset, length)\\n }\\n }\\n\\n /**\\n * @dev Reverts with the return data from the most recent external call.\\n */\\n function propagateRevert() internal pure {\\n assembly {\\n returndatacopy(0, 0, returndatasize())\\n revert(0, returndatasize())\\n }\\n }\\n}\\n\",\"keccak256\":\"0xba30d0a44a6a2f1557e4913108b25d8b36cb40a54f44ac98086465d6bf77c5e6\",\"license\":\"MIT\"},\"contracts/utils/NameEncoder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.13;\\n\\nimport {BytesUtils} from \\\"../wrapper/BytesUtils.sol\\\";\\n\\nlibrary NameEncoder {\\n using BytesUtils for bytes;\\n\\n function dnsEncodeName(\\n string memory name\\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\\n uint8 labelLength = 0;\\n bytes memory bytesName = bytes(name);\\n uint256 length = bytesName.length;\\n dnsName = new bytes(length + 2);\\n node = 0;\\n if (length == 0) {\\n dnsName[0] = 0;\\n return (dnsName, node);\\n }\\n\\n // use unchecked to save gas since we check for an underflow\\n // and we check for the length before the loop\\n unchecked {\\n for (uint256 i = length - 1; i >= 0; i--) {\\n if (bytesName[i] == \\\".\\\") {\\n dnsName[i + 1] = bytes1(labelLength);\\n node = keccak256(\\n abi.encodePacked(\\n node,\\n bytesName.keccak(i + 1, labelLength)\\n )\\n );\\n labelLength = 0;\\n } else {\\n labelLength += 1;\\n dnsName[i + 1] = bytesName[i];\\n }\\n if (i == 0) {\\n break;\\n }\\n }\\n }\\n\\n node = keccak256(\\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\\n );\\n\\n dnsName[0] = bytes1(labelLength);\\n return (dnsName, node);\\n }\\n}\\n\",\"keccak256\":\"0x63fd5f360cef8c9b8b8cfdff20d3f0e955b4c8ac7dfac758788223c61678aad1\",\"license\":\"MIT\"},\"contracts/utils/UniversalResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ERC165} from \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {LowLevelCallUtils} from \\\"./LowLevelCallUtils.sol\\\";\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IExtendedResolver} from \\\"../resolvers/profiles/IExtendedResolver.sol\\\";\\nimport {Resolver, INameResolver, IAddrResolver} from \\\"../resolvers/Resolver.sol\\\";\\nimport {NameEncoder} from \\\"./NameEncoder.sol\\\";\\nimport {BytesUtils} from \\\"../wrapper/BytesUtils.sol\\\";\\nimport {HexUtils} from \\\"./HexUtils.sol\\\";\\n\\nerror OffchainLookup(\\n address sender,\\n string[] urls,\\n bytes callData,\\n bytes4 callbackFunction,\\n bytes extraData\\n);\\n\\nerror ResolverNotFound();\\n\\nerror ResolverWildcardNotSupported();\\n\\nerror ResolverNotContract();\\n\\nerror ResolverError(bytes returnData);\\n\\nerror HttpError(HttpErrorItem[] errors);\\n\\nstruct HttpErrorItem {\\n uint16 status;\\n string message;\\n}\\n\\nstruct MulticallData {\\n bytes name;\\n bytes[] data;\\n string[] gateways;\\n bytes4 callbackFunction;\\n bool isWildcard;\\n address resolver;\\n bytes metaData;\\n bool[] failures;\\n}\\n\\nstruct MulticallChecks {\\n bool isCallback;\\n bool hasExtendedResolver;\\n}\\n\\nstruct OffchainLookupCallData {\\n address sender;\\n string[] urls;\\n bytes callData;\\n}\\n\\nstruct OffchainLookupExtraData {\\n bytes4 callbackFunction;\\n bytes data;\\n}\\n\\nstruct Result {\\n bool success;\\n bytes returnData;\\n}\\n\\ninterface BatchGateway {\\n function query(\\n OffchainLookupCallData[] memory data\\n ) external returns (bool[] memory failures, bytes[] memory responses);\\n}\\n\\n/**\\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\\n * making it possible to make a single smart contract call to resolve an ENS name.\\n */\\ncontract UniversalResolver is ERC165, Ownable {\\n using Address for address;\\n using NameEncoder for string;\\n using BytesUtils for bytes;\\n using HexUtils for bytes;\\n\\n string[] public batchGatewayURLs;\\n ENS public immutable registry;\\n\\n constructor(address _registry, string[] memory _urls) {\\n registry = ENS(_registry);\\n batchGatewayURLs = _urls;\\n }\\n\\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\\n batchGatewayURLs = _urls;\\n }\\n\\n /**\\n * @dev Performs ENS name resolution for the supplied name and resolution data.\\n * @param name The name to resolve, in normalised and DNS-encoded form.\\n * @param data The resolution data, as specified in ENSIP-10.\\n * @return The result of resolving the name.\\n */\\n function resolve(\\n bytes calldata name,\\n bytes memory data\\n ) external view returns (bytes memory, address) {\\n return\\n _resolveSingle(\\n name,\\n data,\\n batchGatewayURLs,\\n this.resolveSingleCallback.selector,\\n \\\"\\\"\\n );\\n }\\n\\n function resolve(\\n bytes calldata name,\\n bytes[] memory data\\n ) external view returns (Result[] memory, address) {\\n return resolve(name, data, batchGatewayURLs);\\n }\\n\\n function resolve(\\n bytes calldata name,\\n bytes memory data,\\n string[] memory gateways\\n ) external view returns (bytes memory, address) {\\n return\\n _resolveSingle(\\n name,\\n data,\\n gateways,\\n this.resolveSingleCallback.selector,\\n \\\"\\\"\\n );\\n }\\n\\n function resolve(\\n bytes calldata name,\\n bytes[] memory data,\\n string[] memory gateways\\n ) public view returns (Result[] memory, address) {\\n return\\n _resolve(name, data, gateways, this.resolveCallback.selector, \\\"\\\");\\n }\\n\\n function _resolveSingle(\\n bytes calldata name,\\n bytes memory data,\\n string[] memory gateways,\\n bytes4 callbackFunction,\\n bytes memory metaData\\n ) public view returns (bytes memory, address) {\\n bytes[] memory dataArr = new bytes[](1);\\n dataArr[0] = data;\\n (Result[] memory results, address resolver) = _resolve(\\n name,\\n dataArr,\\n gateways,\\n callbackFunction,\\n metaData\\n );\\n\\n Result memory result = results[0];\\n\\n _checkResolveSingle(result);\\n\\n return (result.returnData, resolver);\\n }\\n\\n function _resolve(\\n bytes calldata name,\\n bytes[] memory data,\\n string[] memory gateways,\\n bytes4 callbackFunction,\\n bytes memory metaData\\n ) internal view returns (Result[] memory results, address resolverAddress) {\\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\\n resolverAddress = address(resolver);\\n if (resolverAddress == address(0)) {\\n revert ResolverNotFound();\\n }\\n\\n if (!resolverAddress.isContract()) {\\n revert ResolverNotContract();\\n }\\n\\n bool isWildcard = finalOffset != 0;\\n\\n results = _multicall(\\n MulticallData(\\n name,\\n data,\\n gateways,\\n callbackFunction,\\n isWildcard,\\n resolverAddress,\\n metaData,\\n new bool[](data.length)\\n )\\n );\\n }\\n\\n function reverse(\\n bytes calldata reverseName\\n ) external view returns (string memory, address, address, address) {\\n return reverse(reverseName, batchGatewayURLs);\\n }\\n\\n /**\\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\\n */\\n function reverse(\\n bytes calldata reverseName,\\n string[] memory gateways\\n ) public view returns (string memory, address, address, address) {\\n bytes memory encodedCall = abi.encodeCall(\\n INameResolver.name,\\n reverseName.namehash(0)\\n );\\n (\\n bytes memory reverseResolvedData,\\n address reverseResolverAddress\\n ) = _resolveSingle(\\n reverseName,\\n encodedCall,\\n gateways,\\n this.reverseCallback.selector,\\n \\\"\\\"\\n );\\n\\n return\\n getForwardDataFromReverse(\\n reverseResolvedData,\\n reverseResolverAddress,\\n gateways\\n );\\n }\\n\\n function getForwardDataFromReverse(\\n bytes memory resolvedReverseData,\\n address reverseResolverAddress,\\n string[] memory gateways\\n ) internal view returns (string memory, address, address, address) {\\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\\n\\n (bytes memory encodedName, bytes32 namehash) = resolvedName\\n .dnsEncodeName();\\n\\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\\n bytes memory metaData = abi.encode(\\n resolvedName,\\n reverseResolverAddress\\n );\\n (bytes memory resolvedData, address resolverAddress) = this\\n ._resolveSingle(\\n encodedName,\\n encodedCall,\\n gateways,\\n this.reverseCallback.selector,\\n metaData\\n );\\n\\n address resolvedAddress = abi.decode(resolvedData, (address));\\n\\n return (\\n resolvedName,\\n resolvedAddress,\\n reverseResolverAddress,\\n resolverAddress\\n );\\n }\\n\\n function resolveSingleCallback(\\n bytes calldata response,\\n bytes calldata extraData\\n ) external view returns (bytes memory, address) {\\n (Result[] memory results, address resolver, , ) = _resolveCallback(\\n response,\\n extraData,\\n this.resolveSingleCallback.selector\\n );\\n Result memory result = results[0];\\n\\n _checkResolveSingle(result);\\n\\n return (result.returnData, resolver);\\n }\\n\\n function resolveCallback(\\n bytes calldata response,\\n bytes calldata extraData\\n ) external view returns (Result[] memory, address) {\\n (Result[] memory results, address resolver, , ) = _resolveCallback(\\n response,\\n extraData,\\n this.resolveCallback.selector\\n );\\n return (results, resolver);\\n }\\n\\n function reverseCallback(\\n bytes calldata response,\\n bytes calldata extraData\\n ) external view returns (string memory, address, address, address) {\\n (\\n Result[] memory results,\\n address resolverAddress,\\n string[] memory gateways,\\n bytes memory metaData\\n ) = _resolveCallback(\\n response,\\n extraData,\\n this.reverseCallback.selector\\n );\\n\\n Result memory result = results[0];\\n\\n _checkResolveSingle(result);\\n\\n if (metaData.length > 0) {\\n (string memory resolvedName, address reverseResolverAddress) = abi\\n .decode(metaData, (string, address));\\n address resolvedAddress = abi.decode(result.returnData, (address));\\n return (\\n resolvedName,\\n resolvedAddress,\\n reverseResolverAddress,\\n resolverAddress\\n );\\n }\\n\\n return\\n getForwardDataFromReverse(\\n result.returnData,\\n resolverAddress,\\n gateways\\n );\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override returns (bool) {\\n return\\n interfaceId == type(IExtendedResolver).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n function _resolveCallback(\\n bytes calldata response,\\n bytes calldata extraData,\\n bytes4 callbackFunction\\n )\\n internal\\n view\\n returns (Result[] memory, address, string[] memory, bytes memory)\\n {\\n MulticallData memory multicallData;\\n multicallData.callbackFunction = callbackFunction;\\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\\n response,\\n (bool[], bytes[])\\n );\\n OffchainLookupExtraData[] memory extraDatas;\\n (\\n multicallData.isWildcard,\\n multicallData.resolver,\\n multicallData.gateways,\\n multicallData.metaData,\\n extraDatas\\n ) = abi.decode(\\n extraData,\\n (bool, address, string[], bytes, OffchainLookupExtraData[])\\n );\\n require(responses.length <= extraDatas.length);\\n multicallData.data = new bytes[](extraDatas.length);\\n multicallData.failures = new bool[](extraDatas.length);\\n uint256 offchainCount = 0;\\n for (uint256 i = 0; i < extraDatas.length; i++) {\\n if (extraDatas[i].callbackFunction == bytes4(0)) {\\n // This call did not require an offchain lookup; use the previous input data.\\n multicallData.data[i] = extraDatas[i].data;\\n } else {\\n if (failures[offchainCount]) {\\n multicallData.failures[i] = true;\\n multicallData.data[i] = responses[offchainCount];\\n } else {\\n multicallData.data[i] = abi.encodeWithSelector(\\n extraDatas[i].callbackFunction,\\n responses[offchainCount],\\n extraDatas[i].data\\n );\\n }\\n offchainCount = offchainCount + 1;\\n }\\n }\\n\\n return (\\n _multicall(multicallData),\\n multicallData.resolver,\\n multicallData.gateways,\\n multicallData.metaData\\n );\\n }\\n\\n /**\\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\\n * the error with the data necessary to continue the request where it left off.\\n * @param target The address to call.\\n * @param data The data to call `target` with.\\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\\n * @return result Whether the call succeeded.\\n */\\n function callWithOffchainLookupPropagation(\\n address target,\\n bytes memory data,\\n bool isSafe\\n )\\n internal\\n view\\n returns (\\n bool offchain,\\n bytes memory returnData,\\n OffchainLookupExtraData memory extraData,\\n bool result\\n )\\n {\\n if (isSafe) {\\n result = LowLevelCallUtils.functionStaticCall(target, data);\\n } else {\\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\\n }\\n uint256 size = LowLevelCallUtils.returnDataSize();\\n\\n if (result) {\\n return (\\n false,\\n LowLevelCallUtils.readReturnData(0, size),\\n extraData,\\n true\\n );\\n }\\n\\n // Failure\\n if (size >= 4) {\\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\\n // Offchain lookup. Decode the revert message and create our own that nests it.\\n bytes memory revertData = LowLevelCallUtils.readReturnData(\\n 4,\\n size - 4\\n );\\n if (bytes4(errorId) == OffchainLookup.selector) {\\n (\\n address wrappedSender,\\n string[] memory wrappedUrls,\\n bytes memory wrappedCallData,\\n bytes4 wrappedCallbackFunction,\\n bytes memory wrappedExtraData\\n ) = abi.decode(\\n revertData,\\n (address, string[], bytes, bytes4, bytes)\\n );\\n if (wrappedSender == target) {\\n returnData = abi.encode(\\n OffchainLookupCallData(\\n wrappedSender,\\n wrappedUrls,\\n wrappedCallData\\n )\\n );\\n extraData = OffchainLookupExtraData(\\n wrappedCallbackFunction,\\n wrappedExtraData\\n );\\n return (true, returnData, extraData, false);\\n }\\n } else {\\n returnData = bytes.concat(errorId, revertData);\\n return (false, returnData, extraData, false);\\n }\\n }\\n }\\n\\n /**\\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\\n * removing labels until it finds a result.\\n * @param name The name to resolve, in DNS-encoded and normalised form.\\n * @return resolver The Resolver responsible for this name.\\n * @return namehash The namehash of the full name.\\n * @return finalOffset The offset of the first label with a resolver.\\n */\\n function findResolver(\\n bytes calldata name\\n ) public view returns (Resolver, bytes32, uint256) {\\n (\\n address resolver,\\n bytes32 namehash,\\n uint256 finalOffset\\n ) = findResolver(name, 0);\\n return (Resolver(resolver), namehash, finalOffset);\\n }\\n\\n function findResolver(\\n bytes calldata name,\\n uint256 offset\\n ) internal view returns (address, bytes32, uint256) {\\n uint256 labelLength = uint256(uint8(name[offset]));\\n if (labelLength == 0) {\\n return (address(0), bytes32(0), offset);\\n }\\n uint256 nextLabel = offset + labelLength + 1;\\n bytes32 labelHash;\\n if (\\n labelLength == 66 &&\\n // 0x5b == '['\\n name[offset + 1] == 0x5b &&\\n // 0x5d == ']'\\n name[nextLabel - 1] == 0x5d\\n ) {\\n // Encrypted label\\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\\n .hexStringToBytes32(0, 64);\\n } else {\\n labelHash = keccak256(name[offset + 1:nextLabel]);\\n }\\n (\\n address parentresolver,\\n bytes32 parentnode,\\n uint256 parentoffset\\n ) = findResolver(name, nextLabel);\\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\\n address resolver = registry.resolver(node);\\n if (resolver != address(0)) {\\n return (resolver, node, offset);\\n }\\n return (parentresolver, node, parentoffset);\\n }\\n\\n function _checkInterface(\\n address resolver,\\n bytes4 interfaceId\\n ) internal view returns (bool) {\\n try\\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\\n returns (bool supported) {\\n return supported;\\n } catch {\\n return false;\\n }\\n }\\n\\n function _checkSafetyAndItem(\\n bytes memory name,\\n bytes memory item,\\n address resolver,\\n MulticallChecks memory multicallChecks\\n ) internal view returns (bool, bytes memory) {\\n if (!multicallChecks.isCallback) {\\n if (multicallChecks.hasExtendedResolver) {\\n return (\\n true,\\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\\n );\\n }\\n return (_checkInterface(resolver, bytes4(item)), item);\\n }\\n return (true, item);\\n }\\n\\n function _checkMulticall(\\n MulticallData memory multicallData\\n ) internal view returns (MulticallChecks memory) {\\n bool isCallback = multicallData.name.length == 0;\\n bool hasExtendedResolver = _checkInterface(\\n multicallData.resolver,\\n type(IExtendedResolver).interfaceId\\n );\\n\\n if (multicallData.isWildcard && !hasExtendedResolver) {\\n revert ResolverWildcardNotSupported();\\n }\\n\\n return MulticallChecks(isCallback, hasExtendedResolver);\\n }\\n\\n function _checkResolveSingle(Result memory result) internal pure {\\n if (!result.success) {\\n if (bytes4(result.returnData) == HttpError.selector) {\\n bytes memory returnData = result.returnData;\\n assembly {\\n revert(add(returnData, 32), mload(returnData))\\n }\\n }\\n revert ResolverError(result.returnData);\\n }\\n }\\n\\n function _multicall(\\n MulticallData memory multicallData\\n ) internal view returns (Result[] memory results) {\\n uint256 length = multicallData.data.length;\\n uint256 offchainCount = 0;\\n OffchainLookupCallData[]\\n memory callDatas = new OffchainLookupCallData[](length);\\n OffchainLookupExtraData[]\\n memory extraDatas = new OffchainLookupExtraData[](length);\\n results = new Result[](length);\\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\\n\\n for (uint256 i = 0; i < length; i++) {\\n bytes memory item = multicallData.data[i];\\n bool failure = multicallData.failures[i];\\n\\n if (failure) {\\n results[i] = Result(false, item);\\n continue;\\n }\\n\\n bool isSafe = false;\\n (isSafe, item) = _checkSafetyAndItem(\\n multicallData.name,\\n item,\\n multicallData.resolver,\\n multicallChecks\\n );\\n\\n (\\n bool offchain,\\n bytes memory returnData,\\n OffchainLookupExtraData memory extraData,\\n bool success\\n ) = callWithOffchainLookupPropagation(\\n multicallData.resolver,\\n item,\\n isSafe\\n );\\n\\n if (offchain) {\\n callDatas[offchainCount] = abi.decode(\\n returnData,\\n (OffchainLookupCallData)\\n );\\n extraDatas[i] = extraData;\\n offchainCount += 1;\\n continue;\\n }\\n\\n if (success && multicallChecks.hasExtendedResolver) {\\n // if this is a successful resolve() call, unwrap the result\\n returnData = abi.decode(returnData, (bytes));\\n }\\n results[i] = Result(success, returnData);\\n extraDatas[i].data = item;\\n }\\n\\n if (offchainCount == 0) {\\n return results;\\n }\\n\\n // Trim callDatas if offchain data exists\\n assembly {\\n mstore(callDatas, offchainCount)\\n }\\n\\n revert OffchainLookup(\\n address(this),\\n multicallData.gateways,\\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\\n multicallData.callbackFunction,\\n abi.encode(\\n multicallData.isWildcard,\\n multicallData.resolver,\\n multicallData.gateways,\\n multicallData.metaData,\\n extraDatas\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x2a03a3a94a411b599690e58634c2c5695561cbe4a16fae60cbfefa872a6c2f7b\",\"license\":\"MIT\"},\"contracts/wrapper/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes32) {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n}\\n\",\"keccak256\":\"0xf862cd86d749158a554e3cb517efa9097331ec0cf7225117f21e96fb50c67edb\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040523480156200001157600080fd5b5060405162003b0f38038062003b0f8339810160408190526200003491620001da565b6200003f336200006a565b6001600160a01b038216608052805162000061906001906020840190620000ba565b5050506200049c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b82805482825590600052602060002090810192821562000105579160200282015b82811115620001055782518290620000f49082620003d0565b5091602001919060010190620000db565b506200011392915062000117565b5090565b80821115620001135760006200012e828262000138565b5060010162000117565b508054620001469062000341565b6000825580601f1062000157575050565b601f0160209004906000526020600020908101906200017791906200017a565b50565b5b808211156200011357600081556001016200017b565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620001d257620001d262000191565b604052919050565b6000806040808486031215620001ef57600080fd5b83516001600160a01b03811681146200020757600080fd5b602085810151919450906001600160401b03808211156200022757600080fd5b8187019150601f88818401126200023d57600080fd5b82518281111562000252576200025262000191565b8060051b62000263868201620001a7565b918252848101860191868101908c8411156200027e57600080fd5b87870192505b838310156200032e578251868111156200029e5760008081fd5b8701603f81018e13620002b15760008081fd5b8881015187811115620002c857620002c862000191565b620002db818801601f19168b01620001a7565b8181528f8c838501011115620002f15760008081fd5b60005b8281101562000311578381018d01518282018d01528b01620002f4565b5060009181018b0191909152835250918701919087019062000284565b8099505050505050505050509250929050565b600181811c908216806200035657607f821691505b6020821081036200037757634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003cb57600081815260208120601f850160051c81016020861015620003a65750805b601f850160051c820191505b81811015620003c757828155600101620003b2565b5050505b505050565b81516001600160401b03811115620003ec57620003ec62000191565b6200040481620003fd845462000341565b846200037d565b602080601f8311600181146200043c5760008415620004235750858301515b600019600386901b1c1916600185901b178555620003c7565b600085815260208120601f198616915b828110156200046d578886015182559484019460019091019084016200044c565b50858210156200048c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b608051613650620004bf600039600081816101ea01526114fc01526136506000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c80638e5ea8df116100b2578063b241d0d311610081578063e0a8541211610066578063e0a85412146102ec578063ec11c823146102ff578063f2fde38b1461031257600080fd5b8063b241d0d3146102c6578063b4a85801146102d957600080fd5b80638e5ea8df146102485780639061b9231461025b578063a1cbcbaf1461026e578063a6b16419146102a657600080fd5b8063715018a6116101095780637b103999116100ee5780637b103999146101e55780638da5cb5b146102245780638e25a0f31461023557600080fd5b8063715018a6146101c857806376286c00146101d257600080fd5b806301ffc9a71461013b5780630667cfea14610163578063206c74c9146101845780636dc4fb73146101a5575b600080fd5b61014e6101493660046123d3565b610325565b60405190151581526020015b60405180910390f35b6101766101713660046125f3565b61035c565b60405161015a9291906126d1565b61019761019236600461277c565b610392565b60405161015a9291906127e5565b6101b86101b336600461286e565b61047f565b60405161015a94939291906128da565b6101d0610547565b005b6101976101e0366004612916565b61055b565b61020c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161015a565b6000546001600160a01b031661020c565b610176610243366004612975565b610583565b6101d0610256366004612a3b565b610626565b610176610269366004612a78565b610645565b61028161027c366004612ad7565b61073e565b604080516001600160a01b03909416845260208401929092529082015260600161015a565b6102b96102b4366004612b19565b610764565b60405161015a9190612b32565b6101b86102d4366004612b45565b610810565b6101976102e736600461286e565b610902565b6101766102fa36600461286e565b610946565b6101b861030d366004612ad7565b6109b8565b6101d0610320366004612bb9565b610aab565b60006001600160e01b03198216639061b92360e01b148061035657506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060006103848686868663e0a8541260e01b60405180602001604052806000815250610583565b915091505b94509492505050565b606060006104738585856001805480602002602001604051908101604052809291908181526020016000905b8282101561046a5783829060005260206000200180546103dd90612bd6565b80601f016020809104026020016040519081016040528092919081815260200182805461040990612bd6565b80156104565780601f1061042b57610100808354040283529160200191610456565b820191906000526020600020905b81548152906001019060200180831161043957829003601f168201915b5050505050815260200190600101906103be565b5050505061055b565b91509150935093915050565b6060600080808080808061049d8c8c8c8c636dc4fb7360e01b610b40565b93509350935093506000846000815181106104ba576104ba612c10565b602002602001015190506104cd81610ec6565b81511561051f57600080838060200190518101906104eb9190612c6b565b91509150600083602001518060200190518101906105099190612cbd565b929b50919950975093955061053c945050505050565b61052e81602001518585610f51565b985098509850985050505050505b945094509450949050565b61054f6110b2565b610559600061110c565b565b606060006103848686868663b4a8580160e01b60405180602001604052806000815250611174565b6040805160018082528183019092526060916000918291816020015b606081526020019060019003908161059f57905050905086816000815181106105ca576105ca612c10565b60200260200101819052506000806105e68b8b858b8b8b611174565b915091506000826000815181106105ff576105ff612c10565b6020026020010151905061061281610ec6565b602001519b909a5098505050505050505050565b61062e6110b2565b8051610641906001906020840190612300565b5050565b606060006104738585856001805480602002602001604051908101604052809291908181526020016000905b8282101561071d57838290600052602060002001805461069090612bd6565b80601f01602080910402602001604051908101604052809291908181526020018280546106bc90612bd6565b80156107095780601f106106de57610100808354040283529160200191610709565b820191906000526020600020905b8154815290600101906020018083116106ec57829003601f168201915b505050505081526020019060010190610671565b5050505063e0a8541260e01b60405180602001604052806000815250610583565b600080600080600080610753888860006112f5565b919750955093505050509250925092565b6001818154811061077457600080fd5b90600052602060002001600091509050805461078f90612bd6565b80601f01602080910402602001604051908101604052809291908181526020018280546107bb90612bd6565b80156108085780601f106107dd57610100808354040283529160200191610808565b820191906000526020600020905b8154815290600101906020018083116107eb57829003601f168201915b505050505081565b606060008060008061085c600089898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506115a39050565b60405160240161086e91815260200190565b60408051601f19818403018152918152602080830180516001600160e01b03167f691f3431000000000000000000000000000000000000000000000000000000001790528151908101909152600080825291925081906108de908b908b9086908c90636dc4fb7360e01b90610583565b915091506108ed82828a610f51565b96509650965096505050505b93509350935093565b606060008080610935888888887fb4a8580100000000000000000000000000000000000000000000000000000000610b40565b50919a909950975050505050505050565b606060008080610979888888887fe0a8541200000000000000000000000000000000000000000000000000000000610b40565b50509150915060008260008151811061099457610994612c10565b602002602001015190506109a781610ec6565b602001519890975095505050505050565b60606000806000610a9b86866001805480602002602001604051908101604052809291908181526020016000905b82821015610a92578382906000526020600020018054610a0590612bd6565b80601f0160208091040260200160405190810160405280929190818152602001828054610a3190612bd6565b8015610a7e5780601f10610a5357610100808354040283529160200191610a7e565b820191906000526020600020905b815481529060010190602001808311610a6157829003601f168201915b5050505050815260200190600101906109e6565b50505050610810565b9299919850965090945092505050565b610ab36110b2565b6001600160a01b038116610b345760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610b3d8161110c565b50565b60606000606080610ba460405180610100016040528060608152602001606081526020016060815260200160006001600160e01b031916815260200160001515815260200160006001600160a01b0316815260200160608152602001606081525090565b6001600160e01b031986166060820152600080610bc38b8d018d612ce8565b90925090506060610bd68a8c018c612da0565b60c089019190915260408801919091526001600160a01b0390911660a08701529015156080860152805183519192501015610c1057600080fd5b805167ffffffffffffffff811115610c2a57610c2a612439565b604051908082528060200260200182016040528015610c5d57816020015b6060815260200190600190039081610c485790505b506020850152805167ffffffffffffffff811115610c7d57610c7d612439565b604051908082528060200260200182016040528015610ca6578160200160208202803683370190505b5060e08501526000805b8251811015610e94578251600090849083908110610cd057610cd0612c10565b6020026020010151600001516001600160e01b03191603610d2f57828181518110610cfd57610cfd612c10565b60200260200101516020015186602001518281518110610d1f57610d1f612c10565b6020026020010181905250610e82565b848281518110610d4157610d41612c10565b602002602001015115610db85760018660e001518281518110610d6657610d66612c10565b602002602001019015159081151581525050838281518110610d8a57610d8a612c10565b602002602001015186602001518281518110610da857610da8612c10565b6020026020010181905250610e74565b828181518110610dca57610dca612c10565b602002602001015160000151848381518110610de857610de8612c10565b6020026020010151848381518110610e0257610e02612c10565b602002602001015160200151604051602401610e1f929190612f24565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b03838183161783525050505086602001518281518110610e6857610e68612c10565b60200260200101819052505b610e7f826001612f68565b91505b80610e8c81612f7b565b915050610cb0565b50610e9e85611662565b8560a0015186604001518760c001519850985098509850505050505095509550955095915050565b8051610b3d5760208101517fca7a4e750000000000000000000000000000000000000000000000000000000090610efc90612f94565b6001600160e01b03191603610f1957602080820151805190918201fd5b80602001516040517f95c0c752000000000000000000000000000000000000000000000000000000008152600401610b2b9190612b32565b606060008060008087806020019051810190610f6d9190612fcc565b9050600080610f7b83611a50565b91509150600081604051602401610f9491815260200190565b60408051601f19818403018152918152602080830180516001600160e01b03167f3b3b57de000000000000000000000000000000000000000000000000000000001790529051919250600091610fee9187918e91016126d1565b6040516020818303038152906040529050600080306001600160a01b0316638e25a0f387868f636dc4fb7360e01b886040518663ffffffff1660e01b815260040161103d959493929190613056565b600060405180830381865afa15801561105a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110829190810190612c6b565b9150915060008280602001905181019061109c9190612cbd565b979f979e50909b50959950505050505050505050565b6000546001600160a01b031633146105595760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b2b565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606060008060006111858a8a61073e565b919450849350909150506001600160a01b0382166111cf576040517f7199966d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0383163b611210576040517f4981ac0500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516101206020601f8d01819004028201810190925261010081018b8152831515926112e5929182918f908f9081908501838280828437600092019190915250505090825250602081018c9052604081018b90526001600160e01b03198a16606082015283151560808201526001600160a01b03871660a082015260c081018990528b5160e09091019067ffffffffffffffff8111156112b4576112b4612439565b6040519080825280602002602001820160405280156112dd578160200160208202803683370190505b509052611662565b9450505050965096945050505050565b60008060008086868681811061130d5761130d612c10565b919091013560f81c915050600081900361133157506000925082915083905061159a565b600061133d8287612f68565b611348906001612f68565b9050600082604214801561138e57508888611364896001612f68565b81811061137357611373612c10565b9050013560f81c60f81b6001600160f81b031916605b60f81b145b80156113cc575088886113a26001856130bf565b8181106113b1576113b1612c10565b9050013560f81c60f81b6001600160f81b031916605d60f81b145b156114445761143c600060408b8b6113e58c6002612f68565b906113f16001896130bf565b926113fe939291906130d2565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929493925050611c799050565b509050611476565b8888611451896001612f68565b61145d928592906130d2565b60405161146b9291906130fc565b604051809103902090505b60008060006114868c8c876112f5565b925092509250600082856040516020016114aa929190918252602082015260400190565b60408051601f198184030181529082905280516020909101207f0178b8bf0000000000000000000000000000000000000000000000000000000082526004820181905291506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630178b8bf90602401602060405180830381865afa158015611543573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115679190612cbd565b90506001600160a01b0381161561158b579950975089965061159a95505050505050565b50929850919650909450505050505b93509350939050565b60008060006115b28585611dcd565b90925090508161162457600185516115ca91906130bf565b84146116185760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d650000006044820152606401610b2b565b50600091506103569050565b61162e85826115a3565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b6020810151516060906000808267ffffffffffffffff81111561168757611687612439565b6040519080825280602002602001820160405280156116e557816020015b6116d2604051806060016040528060006001600160a01b0316815260200160608152602001606081525090565b8152602001906001900390816116a55790505b50905060008367ffffffffffffffff81111561170357611703612439565b60405190808252806020026020018201604052801561174957816020015b6040805180820190915260008152606060208201528152602001906001900390816117215790505b5090508367ffffffffffffffff81111561176557611765612439565b6040519080825280602002602001820160405280156117ab57816020015b6040805180820190915260008152606060208201528152602001906001900390816117835790505b50945060006117b987611e84565b905060005b8581101561198f576000886020015182815181106117de576117de612c10565b6020026020010151905060008960e00151838151811061180057611800612c10565b60200260200101519050801561184c5760405180604001604052806000151581526020018381525089848151811061183a5761183a612c10565b6020026020010181905250505061197d565b60006118628b60000151848d60a0015188611f1b565b809450819250505060008060008061187f8f60a001518887611fa3565b935093509350935083156118f557828060200190518101906118a1919061318c565b8b8d815181106118b3576118b3612c10565b6020026020010181905250818a89815181106118d1576118d1612c10565b60209081029190910101526118e760018d612f68565b9b505050505050505061197d565b808015611903575088602001515b1561191f578280602001905181019061191c9190612fcc565b92505b60405180604001604052808215158152602001848152508e898151811061194857611948612c10565b6020026020010181905250868a898151811061196657611966612c10565b602002602001015160200181905250505050505050505b8061198781612f7b565b9150506117be565b50836000036119a2575050505050919050565b83835230876040015163a780bab660e01b856040516024016119c49190613287565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b03838183161783525050505089606001518a608001518b60a001518c604001518d60c0015189604051602001611a259594939291906132e9565b60408051601f1981840301815290829052630556f18360e41b8252610b2b95949392916004016133a6565b805160609060009081908490611a67816002612f68565b67ffffffffffffffff811115611a7f57611a7f612439565b6040519080825280601f01601f191660200182016040528015611aa9576020820181803683370190505b50945060009350808403611aee57600060f81b85600081518110611acf57611acf612c10565b60200101906001600160f81b031916908160001a905350505050915091565b60001981015b828181518110611b0657611b06612c10565b01602001517fff00000000000000000000000000000000000000000000000000000000000000167f2e0000000000000000000000000000000000000000000000000000000000000003611bc8578360f81b868260010181518110611b6c57611b6c612c10565b60200101906001600160f81b031916908160001a90535084611b95846001840160ff881661215b565b60408051602081019390935282015260600160405160208183030381529060405280519060200120945060009350611c18565b600184019350828181518110611be057611be0612c10565b602001015160f81c60f81b868260010181518110611c0057611c00612c10565b60200101906001600160f81b031916908160001a9053505b8015611c275760001901611af4565b5083611c3883600060ff871661215b565b6040805160208101939093528201526060016040516020818303038152906040528051906020012093508260f81b85600081518110611acf57611acf612c10565b60008080611c8785856130bf565b905080604014158015611c9b575080602814155b80611cb05750611cac6002826133da565b6001145b15611cfd5760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610b2b565b600191508551841115611d0f57600080fd5b611d60565b6000603a8210602f83111615611d2c5750602f190190565b60478210604083111615611d4257506036190190565b60678210606083111615611d5857506056190190565b5060ff919050565b60208601855b85811015611dc257611d7d8183015160001a611d14565b611d8f6001830184015160001a611d14565b60ff811460ff83141715611da857600095505050611dc2565b60049190911b1760089590951b9490941793600201611d66565b505050935093915050565b60008083518310611e205760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e647300006044820152606401610b2b565b6000848481518110611e3457611e34612c10565b016020015160f81c90508015611e6057611e5985611e53866001612f68565b8361215b565b9250611e65565b600092505b611e6f8185612f68565b611e7a906001612f68565b9150509250929050565b604080518082019091526000808252602082015281515160a0830151901590600090611eb790639061b92360e01b61217f565b905083608001518015611ec8575080155b15611eff576040517f82c2c72800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805180820190915291151582521515602082015292915050565b600060608260000151611f9757826020015115611f7b5760018686604051602401611f47929190612f24565b60408051601f198184030181529190526020810180516001600160e01b0316639061b92360e01b1790529092509050610389565b611f8d84611f8887612f94565b61217f565b8591509150610389565b50600195939450505050565b604080518082019091526000808252606060208301819052909160008415611fd657611fcf8787612204565b9050611fe6565b611fe3878761c350612218565b90505b3d811561200a576000611ffa6000836122ab565b9095509350600191506108f99050565b60048110612151576000612020600060046122ab565b90506000612038600461203381866130bf565b6122ab565b9050630556f18360e41b61204b83612f94565b6001600160e01b031916036121195760008060008060008580602001905181019061207691906133fc565b945094509450945094508e6001600160a01b0316856001600160a01b03160361210f576040518060600160405280866001600160a01b03168152602001858152602001848152506040516020016120cd91906134ac565b60408051601f198184030181528282019091526001600160e01b03199093168152602081019190915260019b509099509750600096506108f995505050505050565b505050505061214e565b818160405160200161212c9291906134bf565b60408051601f198184030181529190526000975095508693506108f992505050565b50505b5093509350935093565b825160009061216a8385612f68565b111561217557600080fd5b5091016020012090565b6040516301ffc9a760e01b81526001600160e01b0319821660048201526000906001600160a01b038416906301ffc9a79061c350906024016020604051808303818786fa935050505080156121f1575060408051601f3d908101601f191682019092526121ee918101906134ee565b60015b6121fd57506000610356565b9050610356565b600061221183835a612218565b9392505050565b60006001600160a01b0384163b6122975760405162461bcd60e51b815260206004820152602e60248201527f4c6f774c6576656c43616c6c5574696c733a207374617469632063616c6c207460448201527f6f206e6f6e2d636f6e74726163740000000000000000000000000000000000006064820152608401610b2b565b6000808451602086018786fa949350505050565b60608167ffffffffffffffff8111156122c6576122c6612439565b6040519080825280601f01601f1916602001820160405280156122f0576020820181803683370190505b5090508183602083013e92915050565b828054828255906000526020600020908101928215612346579160200282015b828111156123465782518290612336908261355a565b5091602001919060010190612320565b50612352929150612356565b5090565b8082111561235257600061236a8282612373565b50600101612356565b50805461237f90612bd6565b6000825580601f1061238f575050565b601f016020900490600052602060002090810190610b3d91905b8082111561235257600081556001016123a9565b6001600160e01b031981168114610b3d57600080fd5b6000602082840312156123e557600080fd5b8135612211816123bd565b60008083601f84011261240257600080fd5b50813567ffffffffffffffff81111561241a57600080fd5b60208301915083602082850101111561243257600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561247257612472612439565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156124a1576124a1612439565b604052919050565b600067ffffffffffffffff8211156124c3576124c3612439565b50601f01601f191660200190565b60006124e46124df846124a9565b612478565b90508281528383830111156124f857600080fd5b828260208301376000602084830101529392505050565b600082601f83011261252057600080fd5b612211838335602085016124d1565b600067ffffffffffffffff82111561254957612549612439565b5060051b60200190565b600082601f83011261256457600080fd5b813560206125746124df8361252f565b82815260059290921b8401810191818101908684111561259357600080fd5b8286015b848110156125e857803567ffffffffffffffff8111156125b75760008081fd5b8701603f810189136125c95760008081fd5b6125da8986830135604084016124d1565b845250918301918301612597565b509695505050505050565b6000806000806060858703121561260957600080fd5b843567ffffffffffffffff8082111561262157600080fd5b61262d888389016123f0565b9096509450602087013591508082111561264657600080fd5b6126528883890161250f565b9350604087013591508082111561266857600080fd5b5061267587828801612553565b91505092959194509250565b60005b8381101561269c578181015183820152602001612684565b50506000910152565b600081518084526126bd816020860160208601612681565b601f01601f19169290920160200192915050565b6040815260006126e460408301856126a5565b90506001600160a01b03831660208301529392505050565b600082601f83011261270d57600080fd5b8135602061271d6124df8361252f565b82815260059290921b8401810191818101908684111561273c57600080fd5b8286015b848110156125e857803567ffffffffffffffff8111156127605760008081fd5b61276e8986838b010161250f565b845250918301918301612740565b60008060006040848603121561279157600080fd5b833567ffffffffffffffff808211156127a957600080fd5b6127b5878388016123f0565b909550935060208601359150808211156127ce57600080fd5b506127db868287016126fc565b9150509250925092565b6000604080830181845280865180835260608601915060608160051b8701019250602080890160005b8381101561284f57888603605f19018552815180511515875283015183870188905261283c888801826126a5565b965050938201939082019060010161280e565b50508395506001600160a01b0388168188015250505050509392505050565b6000806000806040858703121561288457600080fd5b843567ffffffffffffffff8082111561289c57600080fd5b6128a8888389016123f0565b909650945060208701359150808211156128c157600080fd5b506128ce878288016123f0565b95989497509550505050565b6080815260006128ed60808301876126a5565b6001600160a01b0395861660208401529385166040830152509216606090920191909152919050565b6000806000806060858703121561292c57600080fd5b843567ffffffffffffffff8082111561294457600080fd5b612950888389016123f0565b9096509450602087013591508082111561296957600080fd5b612652888389016126fc565b60008060008060008060a0878903121561298e57600080fd5b863567ffffffffffffffff808211156129a657600080fd5b6129b28a838b016123f0565b909850965060208901359150808211156129cb57600080fd5b6129d78a838b0161250f565b955060408901359150808211156129ed57600080fd5b6129f98a838b01612553565b945060608901359150612a0b826123bd565b90925060808801359080821115612a2157600080fd5b50612a2e89828a0161250f565b9150509295509295509295565b600060208284031215612a4d57600080fd5b813567ffffffffffffffff811115612a6457600080fd5b612a7084828501612553565b949350505050565b600080600060408486031215612a8d57600080fd5b833567ffffffffffffffff80821115612aa557600080fd5b612ab1878388016123f0565b90955093506020860135915080821115612aca57600080fd5b506127db8682870161250f565b60008060208385031215612aea57600080fd5b823567ffffffffffffffff811115612b0157600080fd5b612b0d858286016123f0565b90969095509350505050565b600060208284031215612b2b57600080fd5b5035919050565b60208152600061221160208301846126a5565b600080600060408486031215612b5a57600080fd5b833567ffffffffffffffff80821115612b7257600080fd5b612b7e878388016123f0565b90955093506020860135915080821115612b9757600080fd5b506127db86828701612553565b6001600160a01b0381168114610b3d57600080fd5b600060208284031215612bcb57600080fd5b813561221181612ba4565b600181811c90821680612bea57607f821691505b602082108103612c0a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b600082601f830112612c3757600080fd5b8151612c456124df826124a9565b818152846020838601011115612c5a57600080fd5b612a70826020830160208701612681565b60008060408385031215612c7e57600080fd5b825167ffffffffffffffff811115612c9557600080fd5b612ca185828601612c26565b9250506020830151612cb281612ba4565b809150509250929050565b600060208284031215612ccf57600080fd5b815161221181612ba4565b8015158114610b3d57600080fd5b60008060408385031215612cfb57600080fd5b823567ffffffffffffffff80821115612d1357600080fd5b818501915085601f830112612d2757600080fd5b81356020612d376124df8361252f565b82815260059290921b84018101918181019089841115612d5657600080fd5b948201945b83861015612d7d578535612d6e81612cda565b82529482019490820190612d5b565b96505086013592505080821115612d9357600080fd5b50611e7a858286016126fc565b600080600080600060a08688031215612db857600080fd5b612dc28635612cda565b85359450612dd36020870135612ba4565b6020860135935067ffffffffffffffff8060408801351115612df457600080fd5b612e048860408901358901612553565b93508060608801351115612e1757600080fd5b612e27886060890135890161250f565b92508060808801351115612e3a57600080fd5b6080870135870188601f820112612e5057600080fd5b612e5d6124df823561252f565b81358082526020808301929160051b8401018b1015612e7b57600080fd5b602083015b6020843560051b850101811015612f12578481351115612e9f57600080fd5b803584016040818e03601f19011215612eb757600080fd5b612ebf61244f565b612ecc60208301356123bd565b602082013581528660408301351115612ee457600080fd5b612ef78e6020604085013585010161250f565b60208201528085525050602083019250602081019050612e80565b50809450505050509295509295909350565b604081526000612f3760408301856126a5565b8281036020840152612f4981856126a5565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561035657610356612f52565b600060018201612f8d57612f8d612f52565b5060010190565b6000815160208301516001600160e01b031980821693506004831015612fc45780818460040360031b1b83161693505b505050919050565b600060208284031215612fde57600080fd5b815167ffffffffffffffff811115612ff557600080fd5b612a7084828501612c26565b600081518084526020808501808196508360051b8101915082860160005b858110156130495782840389526130378483516126a5565b9885019893509084019060010161301f565b5091979650505050505050565b60a08152600061306960a08301886126a5565b828103602084015261307b81886126a5565b9050828103604084015261308f8187613001565b90506001600160e01b03198516606084015282810360808401526130b381856126a5565b98975050505050505050565b8181038181111561035657610356612f52565b600080858511156130e257600080fd5b838611156130ef57600080fd5b5050820193919092039150565b8183823760009101908152919050565b600082601f83011261311d57600080fd5b8151602061312d6124df8361252f565b82815260059290921b8401810191818101908684111561314c57600080fd5b8286015b848110156125e857805167ffffffffffffffff8111156131705760008081fd5b61317e8986838b0101612c26565b845250918301918301613150565b60006020828403121561319e57600080fd5b815167ffffffffffffffff808211156131b657600080fd5b90830190606082860312156131ca57600080fd5b6040516060810181811083821117156131e5576131e5612439565b60405282516131f381612ba4565b815260208301518281111561320757600080fd5b6132138782860161310c565b60208301525060408301518281111561322b57600080fd5b61323787828601612c26565b60408301525095945050505050565b6001600160a01b038151168252600060208201516060602085015261326e6060850182613001565b905060408301518482036040860152612f4982826126a5565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156132dc57603f198886030184526132ca858351613246565b945092850192908501906001016132ae565b5092979650505050505050565b8515158152600060206001600160a01b03871681840152604060a08185015261331560a0850188613001565b848103606086015261332781886126a5565b905084810360808601528086518083528483019150848160051b84010185890160005b8381101561339357858303601f19018552815180516001600160e01b0319168452880151888401889052613380888501826126a5565b958901959350509087019060010161334a565b50909d9c50505050505050505050505050565b6001600160a01b038616815260a0602082015260006133c860a0830187613001565b828103604084015261308f81876126a5565b6000826133f757634e487b7160e01b600052601260045260246000fd5b500690565b600080600080600060a0868803121561341457600080fd5b855161341f81612ba4565b602087015190955067ffffffffffffffff8082111561343d57600080fd5b61344989838a0161310c565b9550604088015191508082111561345f57600080fd5b61346b89838a01612c26565b94506060880151915061347d826123bd565b60808801519193508082111561349257600080fd5b5061349f88828901612c26565b9150509295509295909350565b6020815260006122116020830184613246565b600083516134d1818460208801612681565b8351908301906134e5818360208801612681565b01949350505050565b60006020828403121561350057600080fd5b815161221181612cda565b601f82111561355557600081815260208120601f850160051c810160208610156135325750805b601f850160051c820191505b818110156135515782815560010161353e565b5050505b505050565b815167ffffffffffffffff81111561357457613574612439565b613588816135828454612bd6565b8461350b565b602080601f8311600181146135bd57600084156135a55750858301515b600019600386901b1c1916600185901b178555613551565b600085815260208120601f198616915b828110156135ec578886015182559484019460019091019084016135cd565b508582101561360a5787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fea2646970667358221220e80dfb43e469138d4ae0942cde3bd29b693f1811b97ac87db578fe698aaae86764736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101365760003560e01c80638e5ea8df116100b2578063b241d0d311610081578063e0a8541211610066578063e0a85412146102ec578063ec11c823146102ff578063f2fde38b1461031257600080fd5b8063b241d0d3146102c6578063b4a85801146102d957600080fd5b80638e5ea8df146102485780639061b9231461025b578063a1cbcbaf1461026e578063a6b16419146102a657600080fd5b8063715018a6116101095780637b103999116100ee5780637b103999146101e55780638da5cb5b146102245780638e25a0f31461023557600080fd5b8063715018a6146101c857806376286c00146101d257600080fd5b806301ffc9a71461013b5780630667cfea14610163578063206c74c9146101845780636dc4fb73146101a5575b600080fd5b61014e6101493660046123d3565b610325565b60405190151581526020015b60405180910390f35b6101766101713660046125f3565b61035c565b60405161015a9291906126d1565b61019761019236600461277c565b610392565b60405161015a9291906127e5565b6101b86101b336600461286e565b61047f565b60405161015a94939291906128da565b6101d0610547565b005b6101976101e0366004612916565b61055b565b61020c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161015a565b6000546001600160a01b031661020c565b610176610243366004612975565b610583565b6101d0610256366004612a3b565b610626565b610176610269366004612a78565b610645565b61028161027c366004612ad7565b61073e565b604080516001600160a01b03909416845260208401929092529082015260600161015a565b6102b96102b4366004612b19565b610764565b60405161015a9190612b32565b6101b86102d4366004612b45565b610810565b6101976102e736600461286e565b610902565b6101766102fa36600461286e565b610946565b6101b861030d366004612ad7565b6109b8565b6101d0610320366004612bb9565b610aab565b60006001600160e01b03198216639061b92360e01b148061035657506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060006103848686868663e0a8541260e01b60405180602001604052806000815250610583565b915091505b94509492505050565b606060006104738585856001805480602002602001604051908101604052809291908181526020016000905b8282101561046a5783829060005260206000200180546103dd90612bd6565b80601f016020809104026020016040519081016040528092919081815260200182805461040990612bd6565b80156104565780601f1061042b57610100808354040283529160200191610456565b820191906000526020600020905b81548152906001019060200180831161043957829003601f168201915b5050505050815260200190600101906103be565b5050505061055b565b91509150935093915050565b6060600080808080808061049d8c8c8c8c636dc4fb7360e01b610b40565b93509350935093506000846000815181106104ba576104ba612c10565b602002602001015190506104cd81610ec6565b81511561051f57600080838060200190518101906104eb9190612c6b565b91509150600083602001518060200190518101906105099190612cbd565b929b50919950975093955061053c945050505050565b61052e81602001518585610f51565b985098509850985050505050505b945094509450949050565b61054f6110b2565b610559600061110c565b565b606060006103848686868663b4a8580160e01b60405180602001604052806000815250611174565b6040805160018082528183019092526060916000918291816020015b606081526020019060019003908161059f57905050905086816000815181106105ca576105ca612c10565b60200260200101819052506000806105e68b8b858b8b8b611174565b915091506000826000815181106105ff576105ff612c10565b6020026020010151905061061281610ec6565b602001519b909a5098505050505050505050565b61062e6110b2565b8051610641906001906020840190612300565b5050565b606060006104738585856001805480602002602001604051908101604052809291908181526020016000905b8282101561071d57838290600052602060002001805461069090612bd6565b80601f01602080910402602001604051908101604052809291908181526020018280546106bc90612bd6565b80156107095780601f106106de57610100808354040283529160200191610709565b820191906000526020600020905b8154815290600101906020018083116106ec57829003601f168201915b505050505081526020019060010190610671565b5050505063e0a8541260e01b60405180602001604052806000815250610583565b600080600080600080610753888860006112f5565b919750955093505050509250925092565b6001818154811061077457600080fd5b90600052602060002001600091509050805461078f90612bd6565b80601f01602080910402602001604051908101604052809291908181526020018280546107bb90612bd6565b80156108085780601f106107dd57610100808354040283529160200191610808565b820191906000526020600020905b8154815290600101906020018083116107eb57829003601f168201915b505050505081565b606060008060008061085c600089898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506115a39050565b60405160240161086e91815260200190565b60408051601f19818403018152918152602080830180516001600160e01b03167f691f3431000000000000000000000000000000000000000000000000000000001790528151908101909152600080825291925081906108de908b908b9086908c90636dc4fb7360e01b90610583565b915091506108ed82828a610f51565b96509650965096505050505b93509350935093565b606060008080610935888888887fb4a8580100000000000000000000000000000000000000000000000000000000610b40565b50919a909950975050505050505050565b606060008080610979888888887fe0a8541200000000000000000000000000000000000000000000000000000000610b40565b50509150915060008260008151811061099457610994612c10565b602002602001015190506109a781610ec6565b602001519890975095505050505050565b60606000806000610a9b86866001805480602002602001604051908101604052809291908181526020016000905b82821015610a92578382906000526020600020018054610a0590612bd6565b80601f0160208091040260200160405190810160405280929190818152602001828054610a3190612bd6565b8015610a7e5780601f10610a5357610100808354040283529160200191610a7e565b820191906000526020600020905b815481529060010190602001808311610a6157829003601f168201915b5050505050815260200190600101906109e6565b50505050610810565b9299919850965090945092505050565b610ab36110b2565b6001600160a01b038116610b345760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610b3d8161110c565b50565b60606000606080610ba460405180610100016040528060608152602001606081526020016060815260200160006001600160e01b031916815260200160001515815260200160006001600160a01b0316815260200160608152602001606081525090565b6001600160e01b031986166060820152600080610bc38b8d018d612ce8565b90925090506060610bd68a8c018c612da0565b60c089019190915260408801919091526001600160a01b0390911660a08701529015156080860152805183519192501015610c1057600080fd5b805167ffffffffffffffff811115610c2a57610c2a612439565b604051908082528060200260200182016040528015610c5d57816020015b6060815260200190600190039081610c485790505b506020850152805167ffffffffffffffff811115610c7d57610c7d612439565b604051908082528060200260200182016040528015610ca6578160200160208202803683370190505b5060e08501526000805b8251811015610e94578251600090849083908110610cd057610cd0612c10565b6020026020010151600001516001600160e01b03191603610d2f57828181518110610cfd57610cfd612c10565b60200260200101516020015186602001518281518110610d1f57610d1f612c10565b6020026020010181905250610e82565b848281518110610d4157610d41612c10565b602002602001015115610db85760018660e001518281518110610d6657610d66612c10565b602002602001019015159081151581525050838281518110610d8a57610d8a612c10565b602002602001015186602001518281518110610da857610da8612c10565b6020026020010181905250610e74565b828181518110610dca57610dca612c10565b602002602001015160000151848381518110610de857610de8612c10565b6020026020010151848381518110610e0257610e02612c10565b602002602001015160200151604051602401610e1f929190612f24565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b03838183161783525050505086602001518281518110610e6857610e68612c10565b60200260200101819052505b610e7f826001612f68565b91505b80610e8c81612f7b565b915050610cb0565b50610e9e85611662565b8560a0015186604001518760c001519850985098509850505050505095509550955095915050565b8051610b3d5760208101517fca7a4e750000000000000000000000000000000000000000000000000000000090610efc90612f94565b6001600160e01b03191603610f1957602080820151805190918201fd5b80602001516040517f95c0c752000000000000000000000000000000000000000000000000000000008152600401610b2b9190612b32565b606060008060008087806020019051810190610f6d9190612fcc565b9050600080610f7b83611a50565b91509150600081604051602401610f9491815260200190565b60408051601f19818403018152918152602080830180516001600160e01b03167f3b3b57de000000000000000000000000000000000000000000000000000000001790529051919250600091610fee9187918e91016126d1565b6040516020818303038152906040529050600080306001600160a01b0316638e25a0f387868f636dc4fb7360e01b886040518663ffffffff1660e01b815260040161103d959493929190613056565b600060405180830381865afa15801561105a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110829190810190612c6b565b9150915060008280602001905181019061109c9190612cbd565b979f979e50909b50959950505050505050505050565b6000546001600160a01b031633146105595760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b2b565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606060008060006111858a8a61073e565b919450849350909150506001600160a01b0382166111cf576040517f7199966d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0383163b611210576040517f4981ac0500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516101206020601f8d01819004028201810190925261010081018b8152831515926112e5929182918f908f9081908501838280828437600092019190915250505090825250602081018c9052604081018b90526001600160e01b03198a16606082015283151560808201526001600160a01b03871660a082015260c081018990528b5160e09091019067ffffffffffffffff8111156112b4576112b4612439565b6040519080825280602002602001820160405280156112dd578160200160208202803683370190505b509052611662565b9450505050965096945050505050565b60008060008086868681811061130d5761130d612c10565b919091013560f81c915050600081900361133157506000925082915083905061159a565b600061133d8287612f68565b611348906001612f68565b9050600082604214801561138e57508888611364896001612f68565b81811061137357611373612c10565b9050013560f81c60f81b6001600160f81b031916605b60f81b145b80156113cc575088886113a26001856130bf565b8181106113b1576113b1612c10565b9050013560f81c60f81b6001600160f81b031916605d60f81b145b156114445761143c600060408b8b6113e58c6002612f68565b906113f16001896130bf565b926113fe939291906130d2565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929493925050611c799050565b509050611476565b8888611451896001612f68565b61145d928592906130d2565b60405161146b9291906130fc565b604051809103902090505b60008060006114868c8c876112f5565b925092509250600082856040516020016114aa929190918252602082015260400190565b60408051601f198184030181529082905280516020909101207f0178b8bf0000000000000000000000000000000000000000000000000000000082526004820181905291506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630178b8bf90602401602060405180830381865afa158015611543573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115679190612cbd565b90506001600160a01b0381161561158b579950975089965061159a95505050505050565b50929850919650909450505050505b93509350939050565b60008060006115b28585611dcd565b90925090508161162457600185516115ca91906130bf565b84146116185760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d650000006044820152606401610b2b565b50600091506103569050565b61162e85826115a3565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b6020810151516060906000808267ffffffffffffffff81111561168757611687612439565b6040519080825280602002602001820160405280156116e557816020015b6116d2604051806060016040528060006001600160a01b0316815260200160608152602001606081525090565b8152602001906001900390816116a55790505b50905060008367ffffffffffffffff81111561170357611703612439565b60405190808252806020026020018201604052801561174957816020015b6040805180820190915260008152606060208201528152602001906001900390816117215790505b5090508367ffffffffffffffff81111561176557611765612439565b6040519080825280602002602001820160405280156117ab57816020015b6040805180820190915260008152606060208201528152602001906001900390816117835790505b50945060006117b987611e84565b905060005b8581101561198f576000886020015182815181106117de576117de612c10565b6020026020010151905060008960e00151838151811061180057611800612c10565b60200260200101519050801561184c5760405180604001604052806000151581526020018381525089848151811061183a5761183a612c10565b6020026020010181905250505061197d565b60006118628b60000151848d60a0015188611f1b565b809450819250505060008060008061187f8f60a001518887611fa3565b935093509350935083156118f557828060200190518101906118a1919061318c565b8b8d815181106118b3576118b3612c10565b6020026020010181905250818a89815181106118d1576118d1612c10565b60209081029190910101526118e760018d612f68565b9b505050505050505061197d565b808015611903575088602001515b1561191f578280602001905181019061191c9190612fcc565b92505b60405180604001604052808215158152602001848152508e898151811061194857611948612c10565b6020026020010181905250868a898151811061196657611966612c10565b602002602001015160200181905250505050505050505b8061198781612f7b565b9150506117be565b50836000036119a2575050505050919050565b83835230876040015163a780bab660e01b856040516024016119c49190613287565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b03838183161783525050505089606001518a608001518b60a001518c604001518d60c0015189604051602001611a259594939291906132e9565b60408051601f1981840301815290829052630556f18360e41b8252610b2b95949392916004016133a6565b805160609060009081908490611a67816002612f68565b67ffffffffffffffff811115611a7f57611a7f612439565b6040519080825280601f01601f191660200182016040528015611aa9576020820181803683370190505b50945060009350808403611aee57600060f81b85600081518110611acf57611acf612c10565b60200101906001600160f81b031916908160001a905350505050915091565b60001981015b828181518110611b0657611b06612c10565b01602001517fff00000000000000000000000000000000000000000000000000000000000000167f2e0000000000000000000000000000000000000000000000000000000000000003611bc8578360f81b868260010181518110611b6c57611b6c612c10565b60200101906001600160f81b031916908160001a90535084611b95846001840160ff881661215b565b60408051602081019390935282015260600160405160208183030381529060405280519060200120945060009350611c18565b600184019350828181518110611be057611be0612c10565b602001015160f81c60f81b868260010181518110611c0057611c00612c10565b60200101906001600160f81b031916908160001a9053505b8015611c275760001901611af4565b5083611c3883600060ff871661215b565b6040805160208101939093528201526060016040516020818303038152906040528051906020012093508260f81b85600081518110611acf57611acf612c10565b60008080611c8785856130bf565b905080604014158015611c9b575080602814155b80611cb05750611cac6002826133da565b6001145b15611cfd5760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610b2b565b600191508551841115611d0f57600080fd5b611d60565b6000603a8210602f83111615611d2c5750602f190190565b60478210604083111615611d4257506036190190565b60678210606083111615611d5857506056190190565b5060ff919050565b60208601855b85811015611dc257611d7d8183015160001a611d14565b611d8f6001830184015160001a611d14565b60ff811460ff83141715611da857600095505050611dc2565b60049190911b1760089590951b9490941793600201611d66565b505050935093915050565b60008083518310611e205760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e647300006044820152606401610b2b565b6000848481518110611e3457611e34612c10565b016020015160f81c90508015611e6057611e5985611e53866001612f68565b8361215b565b9250611e65565b600092505b611e6f8185612f68565b611e7a906001612f68565b9150509250929050565b604080518082019091526000808252602082015281515160a0830151901590600090611eb790639061b92360e01b61217f565b905083608001518015611ec8575080155b15611eff576040517f82c2c72800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805180820190915291151582521515602082015292915050565b600060608260000151611f9757826020015115611f7b5760018686604051602401611f47929190612f24565b60408051601f198184030181529190526020810180516001600160e01b0316639061b92360e01b1790529092509050610389565b611f8d84611f8887612f94565b61217f565b8591509150610389565b50600195939450505050565b604080518082019091526000808252606060208301819052909160008415611fd657611fcf8787612204565b9050611fe6565b611fe3878761c350612218565b90505b3d811561200a576000611ffa6000836122ab565b9095509350600191506108f99050565b60048110612151576000612020600060046122ab565b90506000612038600461203381866130bf565b6122ab565b9050630556f18360e41b61204b83612f94565b6001600160e01b031916036121195760008060008060008580602001905181019061207691906133fc565b945094509450945094508e6001600160a01b0316856001600160a01b03160361210f576040518060600160405280866001600160a01b03168152602001858152602001848152506040516020016120cd91906134ac565b60408051601f198184030181528282019091526001600160e01b03199093168152602081019190915260019b509099509750600096506108f995505050505050565b505050505061214e565b818160405160200161212c9291906134bf565b60408051601f198184030181529190526000975095508693506108f992505050565b50505b5093509350935093565b825160009061216a8385612f68565b111561217557600080fd5b5091016020012090565b6040516301ffc9a760e01b81526001600160e01b0319821660048201526000906001600160a01b038416906301ffc9a79061c350906024016020604051808303818786fa935050505080156121f1575060408051601f3d908101601f191682019092526121ee918101906134ee565b60015b6121fd57506000610356565b9050610356565b600061221183835a612218565b9392505050565b60006001600160a01b0384163b6122975760405162461bcd60e51b815260206004820152602e60248201527f4c6f774c6576656c43616c6c5574696c733a207374617469632063616c6c207460448201527f6f206e6f6e2d636f6e74726163740000000000000000000000000000000000006064820152608401610b2b565b6000808451602086018786fa949350505050565b60608167ffffffffffffffff8111156122c6576122c6612439565b6040519080825280601f01601f1916602001820160405280156122f0576020820181803683370190505b5090508183602083013e92915050565b828054828255906000526020600020908101928215612346579160200282015b828111156123465782518290612336908261355a565b5091602001919060010190612320565b50612352929150612356565b5090565b8082111561235257600061236a8282612373565b50600101612356565b50805461237f90612bd6565b6000825580601f1061238f575050565b601f016020900490600052602060002090810190610b3d91905b8082111561235257600081556001016123a9565b6001600160e01b031981168114610b3d57600080fd5b6000602082840312156123e557600080fd5b8135612211816123bd565b60008083601f84011261240257600080fd5b50813567ffffffffffffffff81111561241a57600080fd5b60208301915083602082850101111561243257600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561247257612472612439565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156124a1576124a1612439565b604052919050565b600067ffffffffffffffff8211156124c3576124c3612439565b50601f01601f191660200190565b60006124e46124df846124a9565b612478565b90508281528383830111156124f857600080fd5b828260208301376000602084830101529392505050565b600082601f83011261252057600080fd5b612211838335602085016124d1565b600067ffffffffffffffff82111561254957612549612439565b5060051b60200190565b600082601f83011261256457600080fd5b813560206125746124df8361252f565b82815260059290921b8401810191818101908684111561259357600080fd5b8286015b848110156125e857803567ffffffffffffffff8111156125b75760008081fd5b8701603f810189136125c95760008081fd5b6125da8986830135604084016124d1565b845250918301918301612597565b509695505050505050565b6000806000806060858703121561260957600080fd5b843567ffffffffffffffff8082111561262157600080fd5b61262d888389016123f0565b9096509450602087013591508082111561264657600080fd5b6126528883890161250f565b9350604087013591508082111561266857600080fd5b5061267587828801612553565b91505092959194509250565b60005b8381101561269c578181015183820152602001612684565b50506000910152565b600081518084526126bd816020860160208601612681565b601f01601f19169290920160200192915050565b6040815260006126e460408301856126a5565b90506001600160a01b03831660208301529392505050565b600082601f83011261270d57600080fd5b8135602061271d6124df8361252f565b82815260059290921b8401810191818101908684111561273c57600080fd5b8286015b848110156125e857803567ffffffffffffffff8111156127605760008081fd5b61276e8986838b010161250f565b845250918301918301612740565b60008060006040848603121561279157600080fd5b833567ffffffffffffffff808211156127a957600080fd5b6127b5878388016123f0565b909550935060208601359150808211156127ce57600080fd5b506127db868287016126fc565b9150509250925092565b6000604080830181845280865180835260608601915060608160051b8701019250602080890160005b8381101561284f57888603605f19018552815180511515875283015183870188905261283c888801826126a5565b965050938201939082019060010161280e565b50508395506001600160a01b0388168188015250505050509392505050565b6000806000806040858703121561288457600080fd5b843567ffffffffffffffff8082111561289c57600080fd5b6128a8888389016123f0565b909650945060208701359150808211156128c157600080fd5b506128ce878288016123f0565b95989497509550505050565b6080815260006128ed60808301876126a5565b6001600160a01b0395861660208401529385166040830152509216606090920191909152919050565b6000806000806060858703121561292c57600080fd5b843567ffffffffffffffff8082111561294457600080fd5b612950888389016123f0565b9096509450602087013591508082111561296957600080fd5b612652888389016126fc565b60008060008060008060a0878903121561298e57600080fd5b863567ffffffffffffffff808211156129a657600080fd5b6129b28a838b016123f0565b909850965060208901359150808211156129cb57600080fd5b6129d78a838b0161250f565b955060408901359150808211156129ed57600080fd5b6129f98a838b01612553565b945060608901359150612a0b826123bd565b90925060808801359080821115612a2157600080fd5b50612a2e89828a0161250f565b9150509295509295509295565b600060208284031215612a4d57600080fd5b813567ffffffffffffffff811115612a6457600080fd5b612a7084828501612553565b949350505050565b600080600060408486031215612a8d57600080fd5b833567ffffffffffffffff80821115612aa557600080fd5b612ab1878388016123f0565b90955093506020860135915080821115612aca57600080fd5b506127db8682870161250f565b60008060208385031215612aea57600080fd5b823567ffffffffffffffff811115612b0157600080fd5b612b0d858286016123f0565b90969095509350505050565b600060208284031215612b2b57600080fd5b5035919050565b60208152600061221160208301846126a5565b600080600060408486031215612b5a57600080fd5b833567ffffffffffffffff80821115612b7257600080fd5b612b7e878388016123f0565b90955093506020860135915080821115612b9757600080fd5b506127db86828701612553565b6001600160a01b0381168114610b3d57600080fd5b600060208284031215612bcb57600080fd5b813561221181612ba4565b600181811c90821680612bea57607f821691505b602082108103612c0a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b600082601f830112612c3757600080fd5b8151612c456124df826124a9565b818152846020838601011115612c5a57600080fd5b612a70826020830160208701612681565b60008060408385031215612c7e57600080fd5b825167ffffffffffffffff811115612c9557600080fd5b612ca185828601612c26565b9250506020830151612cb281612ba4565b809150509250929050565b600060208284031215612ccf57600080fd5b815161221181612ba4565b8015158114610b3d57600080fd5b60008060408385031215612cfb57600080fd5b823567ffffffffffffffff80821115612d1357600080fd5b818501915085601f830112612d2757600080fd5b81356020612d376124df8361252f565b82815260059290921b84018101918181019089841115612d5657600080fd5b948201945b83861015612d7d578535612d6e81612cda565b82529482019490820190612d5b565b96505086013592505080821115612d9357600080fd5b50611e7a858286016126fc565b600080600080600060a08688031215612db857600080fd5b612dc28635612cda565b85359450612dd36020870135612ba4565b6020860135935067ffffffffffffffff8060408801351115612df457600080fd5b612e048860408901358901612553565b93508060608801351115612e1757600080fd5b612e27886060890135890161250f565b92508060808801351115612e3a57600080fd5b6080870135870188601f820112612e5057600080fd5b612e5d6124df823561252f565b81358082526020808301929160051b8401018b1015612e7b57600080fd5b602083015b6020843560051b850101811015612f12578481351115612e9f57600080fd5b803584016040818e03601f19011215612eb757600080fd5b612ebf61244f565b612ecc60208301356123bd565b602082013581528660408301351115612ee457600080fd5b612ef78e6020604085013585010161250f565b60208201528085525050602083019250602081019050612e80565b50809450505050509295509295909350565b604081526000612f3760408301856126a5565b8281036020840152612f4981856126a5565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561035657610356612f52565b600060018201612f8d57612f8d612f52565b5060010190565b6000815160208301516001600160e01b031980821693506004831015612fc45780818460040360031b1b83161693505b505050919050565b600060208284031215612fde57600080fd5b815167ffffffffffffffff811115612ff557600080fd5b612a7084828501612c26565b600081518084526020808501808196508360051b8101915082860160005b858110156130495782840389526130378483516126a5565b9885019893509084019060010161301f565b5091979650505050505050565b60a08152600061306960a08301886126a5565b828103602084015261307b81886126a5565b9050828103604084015261308f8187613001565b90506001600160e01b03198516606084015282810360808401526130b381856126a5565b98975050505050505050565b8181038181111561035657610356612f52565b600080858511156130e257600080fd5b838611156130ef57600080fd5b5050820193919092039150565b8183823760009101908152919050565b600082601f83011261311d57600080fd5b8151602061312d6124df8361252f565b82815260059290921b8401810191818101908684111561314c57600080fd5b8286015b848110156125e857805167ffffffffffffffff8111156131705760008081fd5b61317e8986838b0101612c26565b845250918301918301613150565b60006020828403121561319e57600080fd5b815167ffffffffffffffff808211156131b657600080fd5b90830190606082860312156131ca57600080fd5b6040516060810181811083821117156131e5576131e5612439565b60405282516131f381612ba4565b815260208301518281111561320757600080fd5b6132138782860161310c565b60208301525060408301518281111561322b57600080fd5b61323787828601612c26565b60408301525095945050505050565b6001600160a01b038151168252600060208201516060602085015261326e6060850182613001565b905060408301518482036040860152612f4982826126a5565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156132dc57603f198886030184526132ca858351613246565b945092850192908501906001016132ae565b5092979650505050505050565b8515158152600060206001600160a01b03871681840152604060a08185015261331560a0850188613001565b848103606086015261332781886126a5565b905084810360808601528086518083528483019150848160051b84010185890160005b8381101561339357858303601f19018552815180516001600160e01b0319168452880151888401889052613380888501826126a5565b958901959350509087019060010161334a565b50909d9c50505050505050505050505050565b6001600160a01b038616815260a0602082015260006133c860a0830187613001565b828103604084015261308f81876126a5565b6000826133f757634e487b7160e01b600052601260045260246000fd5b500690565b600080600080600060a0868803121561341457600080fd5b855161341f81612ba4565b602087015190955067ffffffffffffffff8082111561343d57600080fd5b61344989838a0161310c565b9550604088015191508082111561345f57600080fd5b61346b89838a01612c26565b94506060880151915061347d826123bd565b60808801519193508082111561349257600080fd5b5061349f88828901612c26565b9150509295509295909350565b6020815260006122116020830184613246565b600083516134d1818460208801612681565b8351908301906134e5818360208801612681565b01949350505050565b60006020828403121561350057600080fd5b815161221181612cda565b601f82111561355557600081815260208120601f850160051c810160208610156135325750805b601f850160051c820191505b818110156135515782815560010161353e565b5050505b505050565b815167ffffffffffffffff81111561357457613574612439565b613588816135828454612bd6565b8461350b565b602080601f8311600181146135bd57600084156135a55750858301515b600019600386901b1c1916600185901b178555613551565b600085815260208120601f198616915b828110156135ec578886015182559484019460019091019084016135cd565b508582101561360a5787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fea2646970667358221220e80dfb43e469138d4ae0942cde3bd29b693f1811b97ac87db578fe698aaae86764736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "findResolver(bytes)": { + "details": "Finds a resolver by recursively querying the registry, starting at the longest name and progressively removing labels until it finds a result.", + "params": { + "name": "The name to resolve, in DNS-encoded and normalised form." + }, + "returns": { + "_0": "resolver The Resolver responsible for this name.", + "_1": "namehash The namehash of the full name.", + "_2": "finalOffset The offset of the first label with a resolver." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "resolve(bytes,bytes)": { + "details": "Performs ENS name resolution for the supplied name and resolution data.", + "params": { + "data": "The resolution data, as specified in ENSIP-10.", + "name": "The name to resolve, in normalised and DNS-encoded form." + }, + "returns": { + "_0": "The result of resolving the name." + } + }, + "reverse(bytes,string[])": { + "details": "Performs ENS name reverse resolution for the supplied reverse name.", + "params": { + "reverseName": "The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse" + }, + "returns": { + "_0": "The resolved name, the resolved address, the reverse resolver address, and the resolver address." + } + }, + "supportsInterface(bytes4)": { + "details": "See {IERC165-supportsInterface}." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "notice": "The Universal Resolver is a contract that handles the work of resolving a name entirely onchain, making it possible to make a single smart contract call to resolve an ENS name.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 7, + "contract": "contracts/utils/UniversalResolver.sol:UniversalResolver", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 1537, + "contract": "contracts/utils/UniversalResolver.sol:UniversalResolver", + "label": "batchGatewayURLs", + "offset": 0, + "slot": "1", + "type": "t_array(t_string_storage)dyn_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_string_storage)dyn_storage": { + "base": "t_string_storage", + "encoding": "dynamic_array", + "label": "string[]", + "numberOfBytes": "32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/solcInputs/05815edbbdb20af69c4af1fa3e576dba.json b/solidity/dns-contracts/deployments/mainnet/solcInputs/05815edbbdb20af69c4af1fa3e576dba.json new file mode 100644 index 0000000..7d81e2c --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/solcInputs/05815edbbdb20af69c4af1fa3e576dba.json @@ -0,0 +1,47 @@ +{ + "language": "Solidity", + "sources": { + "contracts/dnsregistrar/MappingPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n event SuffixAdded(bytes suffix);\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n emit SuffixAdded(names[i]);\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/solcInputs/060d98a9425039d7f82a146eac9bd32e.json b/solidity/dns-contracts/deployments/mainnet/solcInputs/060d98a9425039d7f82a146eac9bd32e.json new file mode 100644 index 0000000..9ce58bc --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/solcInputs/060d98a9425039d7f82a146eac9bd32e.json @@ -0,0 +1,422 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(\n uint16 _expectedType,\n bytes memory _expectedName,\n uint32 _inception,\n uint64 _inserted,\n bytes memory _proof\n ) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if (_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(\n uint16 dnstype,\n bytes memory name\n ) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyExtendedDNSSECResolver is IExtendedDNSResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes memory /* name */,\n bytes memory /* data */,\n bytes memory context\n ) external view override returns (bytes memory) {\n return abi.encode(context);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyLegacyTextResolver is ITextResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(ITextResolver).interfaceId;\n }\n\n function text(\n bytes32 /* node */,\n string calldata key\n ) external view override returns (string memory) {\n return key;\n }\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver {\n using RRUtils for *;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, data)\n );\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query) = abi.decode(\n extraData,\n (bytes, bytes)\n );\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n IExtendedDNSResolver(dnsresolver).resolve(\n name,\n query,\n context\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return IExtendedResolver(dnsresolver).resolve(name, query);\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (bytes memory key, bytes memory value, uint256 nextOffset)\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = input.length;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n nextOffset = terminator + 1;\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256[3] memory P) {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (uint256 x, uint256 y, uint256 z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(\n uint256 x0,\n uint256 y0\n ) internal pure returns (bool isZero) {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(\n uint256 scalar\n ) internal pure returns (uint256, uint256) {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(\n bytes calldata,\n bytes calldata\n ) external pure override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input\n )\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n )\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(\n RRUtils.SignedSet memory rrset,\n uint16 typecovered\n ) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if (address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns (bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 {\n totallen := add(totallen, 64)\n }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for {\n let i := 0\n } lt(i, totallen) {\n i := add(i, 64)\n } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 {\n mstore8(add(scratch, sub(len, i)), 0x80)\n }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 {\n mstore(\n add(scratch, 32),\n or(mload(add(scratch, 32)), mul(len, 8))\n )\n }\n\n // Expand the 16 32-bit words into 80\n for {\n let j := 64\n } lt(j, 128) {\n j := add(j, 12)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 12))),\n mload(add(scratch, sub(j, 32)))\n ),\n xor(\n mload(add(scratch, sub(j, 56))),\n mload(add(scratch, sub(j, 64)))\n )\n )\n temp := or(\n and(\n mul(temp, 2),\n 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE\n ),\n and(\n div(temp, 0x80000000),\n 0x0000000100000001000000010000000100000001000000010000000100000001\n )\n )\n mstore(add(scratch, j), temp)\n }\n for {\n let j := 128\n } lt(j, 320) {\n j := add(j, 24)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 24))),\n mload(add(scratch, sub(j, 64)))\n ),\n xor(\n mload(add(scratch, sub(j, 112))),\n mload(add(scratch, sub(j, 128)))\n )\n )\n temp := or(\n and(\n mul(temp, 4),\n 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC\n ),\n and(\n div(temp, 0x40000000),\n 0x0000000300000003000000030000000300000003000000030000000300000003\n )\n )\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for {\n let j := 0\n } lt(j, 80) {\n j := add(j, 1)\n } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(\n div(x, 0x100000000000000000000),\n div(x, 0x10000000000)\n )\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := and(div(x, 0x10000000000), f)\n f := or(\n and(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n ),\n f\n )\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(\n div(\n x,\n 0x80000000000000000000000000000000000000000000000\n ),\n 0x1F\n )\n temp := or(\n and(\n div(x, 0x800000000000000000000000000000000000000),\n 0xFFFFFFE0\n ),\n temp\n )\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(\n div(\n mload(add(scratch, mul(j, 4))),\n 0x100000000000000000000000000000000000000000000000000000000\n ),\n temp\n )\n x := or(\n div(x, 0x10000000000),\n mul(temp, 0x10000000000000000000000000000000000000000)\n )\n x := or(\n and(\n x,\n 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF\n ),\n mul(\n or(\n and(div(x, 0x4000000000000), 0xC0000000),\n and(div(x, 0x400000000000000000000), 0x3FFFFFFF)\n ),\n 0x100000000000000000000\n )\n )\n }\n\n h := and(\n add(h, x),\n 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF\n )\n }\n ret := mul(\n or(\n or(\n or(\n or(\n and(\n div(h, 0x100000000),\n 0xFFFFFFFF00000000000000000000000000000000\n ),\n and(\n div(h, 0x1000000),\n 0xFFFFFFFF000000000000000000000000\n )\n ),\n and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)\n ),\n and(div(h, 0x100), 0xFFFFFFFF00000000)\n ),\n and(h, 0xFFFFFFFF)\n ),\n 0x1000000000000000000000000\n )\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ReverseRegistrar} from \"../registry/ReverseRegistrar.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper\n ) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/ILinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface ILinearPremiumPriceOracle {\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256);\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns (address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping(bytes32 => address) addresses;\n\n constructor() public {}\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/registry/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Implements a dummy NameWrapper which returns the caller's address\n */\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\nimport \"./Multicallable.sol\";\nimport \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/TestHexUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {HexUtils} from \"./HexUtils.sol\";\n\ncontract TestHexUtils {\n using HexUtils for *;\n\n function hexStringToBytes32(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes32, bool) {\n return name.hexStringToBytes32(idx, lastInx);\n }\n\n function hexToAddress(\n bytes calldata input,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (address, bool) {\n return input.hexToAddress(idx, lastInx);\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(\n string memory name\n ) public pure returns (bytes memory, bytes32) {\n return name.dnsEncodeName();\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (bytes[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, ) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n return (results, address(0));\n }\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes[] memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (bytes[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n result = LowLevelCallUtils.functionStaticCall(address(target), data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = revertData;\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return The Resolver responsible for this name, and the namehash of the full name.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32) {\n (address resolver, bytes32 labelhash) = findResolver(name, 0);\n return (Resolver(resolver), labelhash);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0));\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (address parentresolver, bytes32 parentnode) = findResolver(\n name,\n nextLabel\n );\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node);\n }\n return (parentresolver, node);\n }\n\n function _hasExtendedResolver(\n address resolver\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface(\n type(IExtendedResolver).interfaceId\n )\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (bytes[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _hasExtendedResolver(multicallData.resolver);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = item;\n continue;\n }\n if (!isCallback && hasExtendedResolver) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = returnData;\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external;\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(name, wrappedOwner, fuses, expiry, extraData);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the owner of a name\n * @param id Namehash of the name\n * @return operator Approved operator of a name\n */\n\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /**\n * @notice Approves an address for a name\n * @param to address to approve\n * @param tokenId name to approve\n */\n\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if msg.sender is the owner or approved\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwnerOrApproved(bytes32 node) {\n if (!canModifySubnames(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or operator of the owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or operator\n */\n\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Checks if owner/operator or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner/operator or approved\n */\n\n function canModifySubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n //use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n // this flag is used later, when checking fuses\n bool canModifyParentSubname = canModifySubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canModifyParentSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canModifyParentSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n extraData\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of. Can also be called by the owner of a .eth name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifySubnames(parentNode, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwnerOrApproved(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwnerOrApproved(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /**\n * @notice Checks if a name is wrapped in a more gas efficient way\n * @param parentNode Namehash of the name\n * @param labelhash Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != ETH_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + }, + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external view override returns (bool) {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32, uint256) {\n return name.readLabel(offset);\n }\n\n function namehash(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32) {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\n \"\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n require(\n \"foo\".keccak(0, 3) ==\n bytes32(\n 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d\n ),\n \"Incorrect hash of 'foo'\"\n );\n require(\n \"foo\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\n \"hello\".equals(1, \"ello\") == true,\n \"Substring to string equality\"\n );\n require(\n \"hello\".equals(1, \"jello\", 1, 4) == true,\n \"Substring to substring equality\"\n );\n require(\n \"zhello\".equals(1, \"abchello\", 3) == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"0x0102030000\".equals(0, \"0x010203\") == false,\n \"Compare with offset and trailing bytes\"\n );\n }\n\n function testComparePartial() public pure {\n require(\n \"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true,\n \"Compare same length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true,\n \"Compare different length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true,\n \"Compare same with different offset\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 33\n ) ==\n 0 ==\n true,\n \"Compare different long strings same length smaller partial length which must be equal\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 34\n ) <\n 0 ==\n true,\n \"Compare long strings same length different partial length\"\n );\n require(\n \"0123456789012345012345678901234a\".compare(\n 0,\n 32,\n \"0123456789012345012345678901234b\",\n 0,\n 32\n ) <\n 0 ==\n true,\n \"Compare strings exactly 32 characters long\"\n );\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\n \"a\".compare(\"b\") < 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"b\".compare(\"a\") > 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"aa\".compare(\"ab\") < 0 == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"a\".compare(\"aa\") < 0 == true,\n \"Compare different value with different length\"\n );\n require(\n \"aa\".compare(\"a\") > 0 == true,\n \"Compare different value with different length\"\n );\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(\n longChar.compare(longChar) == 0 == true,\n \"Compares more than 32 bytes char\"\n );\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(\n longChar.compare(otherLongChar) < 0 == true,\n \"Compare long char with difference at start\"\n );\n }\n\n function testSubstring() public pure {\n require(\n keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")),\n \"Copy 0 bytes\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 4))) ==\n keccak256(bytes(\"hell\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(1, 4))) ==\n keccak256(bytes(\"ello\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 5))) ==\n keccak256(bytes(\"hello\")),\n \"Copy whole string\"\n );\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(\n bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) ==\n bytes32(\n 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000\n ),\n \"readBytes20\"\n );\n }\n\n function testReadBytes32() public pure {\n require(\n \"0123456789abcdef0123456789abcdef\".readBytes32(0) ==\n bytes32(\n 0x3031323334353637383961626364656630313233343536373839616263646566\n ),\n \"readBytes32\"\n );\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\n \"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")),\n \"Decode 'a'\"\n );\n require(\n \"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")),\n \"Decode 'aa'\"\n );\n require(\n \"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")),\n \"Decode 'aaa'\"\n );\n require(\n \"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")),\n \"Decode 'aaaa'\"\n );\n require(\n \"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa'\"\n );\n require(\n \"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa' lowercase\"\n );\n require(\n \"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet\"\n );\n require(\n \"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet lowercase\"\n );\n require(\n \"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\"\n .base32HexDecodeWord(0, 52) ==\n bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"),\n \"Decode 32*'a'\"\n );\n require(\n \" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\"\n .base32HexDecodeWord(1, 32) ==\n bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"),\n \"Decode real bytes32hex\"\n );\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex\"00\".nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex\"00\".labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex\"016100\".labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(\n hex\"016201610000\".labelCount(0) == 2,\n \"labelCount('b.a.') == 2\"\n );\n require(\n hex\"066574686c61620378797a00\".labelCount(6 + 1) == 1,\n \"nameLength('(bthlab).xyz.') == 6\"\n );\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes\n memory rrs = hex\"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101\";\n bytes[2] memory names = [bytes(hex\"016100\"), bytes(hex\"0162016100\")];\n bytes[2] memory rdatas = [bytes(hex\"74000001\"), bytes(hex\"c0a80101\")];\n uint i = 0;\n for (\n RRUtils.RRIterator memory iter = rrs.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(\n keccak256(iter.name()) == keccak256(names[i]),\n \"Name matches\"\n );\n require(\n keccak256(iter.rdata()) == keccak256(rdatas[i]),\n \"Rdata matches\"\n );\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex\"066274686c61620378797a00\";\n bytes memory ethLabXyz = hex\"066574686c61620378797a00\";\n bytes memory xyz = hex\"0378797a00\";\n bytes memory a_b_c = hex\"01610162016300\";\n bytes memory b_b_c = hex\"01620162016300\";\n bytes memory c = hex\"016300\";\n bytes memory d = hex\"016400\";\n bytes memory a_d_c = hex\"01610164016300\";\n bytes memory b_a_c = hex\"01620161016300\";\n bytes memory ab_c_d = hex\"0261620163016400\";\n bytes memory a_c_d = hex\"01610163016400\";\n bytes\n memory verylong1_eth = hex\"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n bytes\n memory verylong2_eth = hex\"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n\n require(\n hex\"0301616100\".compareNames(hex\"0302616200\") < 0,\n \"label lengths are correctly checked\"\n );\n require(\n a_b_c.compareNames(c) > 0,\n \"one name has a difference of >1 label to with the same root name\"\n );\n require(\n a_b_c.compareNames(d) < 0,\n \"one name has a difference of >1 label to with different root name\"\n );\n require(\n a_b_c.compareNames(a_d_c) < 0,\n \"two names start the same but have differences in later labels\"\n );\n require(\n a_b_c.compareNames(b_a_c) > 0,\n \"the first label sorts later, but the first label sorts earlier\"\n );\n require(\n ab_c_d.compareNames(a_c_d) > 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(\n a_b_c.compareNames(b_b_c) < 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(\n bthLabXyz.compareNames(ethLabXyz) < 0,\n \"bthLab.xyz comes before ethLab.xyz\"\n );\n require(\n bthLabXyz.compareNames(bthLabXyz) == 0,\n \"bthLab.xyz and bthLab.xyz are the same\"\n );\n require(\n ethLabXyz.compareNames(bthLabXyz) > 0,\n \"ethLab.xyz comes after bethLab.xyz\"\n );\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(\n verylong1_eth.compareNames(verylong2_eth) > 0,\n \"longa.vlong.eth comes after long.vlong.eth\"\n );\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(\n RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA),\n \"0x11111111 >= 0xAAAAAAAA\"\n );\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(\n hex\"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d\"\n .computeKeytag() == 19036,\n \"Invalid keytag\"\n );\n require(\n hex\"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf\"\n .computeKeytag() == 21693,\n \"Invalid keytag (2)\"\n );\n require(\n hex\"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3\"\n .computeKeytag() == 33630\n );\n require(\n hex\"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5\"\n .computeKeytag() == 20326,\n \"Invalid keytag (3)\"\n );\n }\n}\n" + }, + "test/registry/mocks/DummyResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyResolver {\n mapping(bytes32 => string) public name;\n\n function setName(bytes32 node, string memory _name) public {\n name[node] = _name;\n }\n}\n" + }, + "test/utils/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n if (bytes4(extraData) == bytes4(keccak256(\"name(bytes32)\"))) {\n return abi.encode(\"offchain.test.eth\");\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "test/utils/mocks/LegacyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\ncontract LegacyResolver {\n function addr(bytes32 /* node */) public view returns (address) {\n return address(this);\n }\n}\n" + }, + "test/utils/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10 ** uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10 ** uint256(decimals()));\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1500 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/solcInputs/08371ea78d6ca0259dbc9b2f768cf73e.json b/solidity/dns-contracts/deployments/mainnet/solcInputs/08371ea78d6ca0259dbc9b2f768cf73e.json new file mode 100644 index 0000000..63302dd --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/solcInputs/08371ea78d6ca0259dbc9b2f768cf73e.json @@ -0,0 +1,125 @@ +{ + "language": "Solidity", + "sources": { + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n\n using BytesUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(DNSSEC oracle, bytes memory name, bytes memory proof)\n internal\n view\n returns (address, bool)\n {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n bytes20 hash;\n uint32 expiration;\n // Check the provided TXT record has been validated by the oracle\n (, expiration, hash) = oracle.rrdata(TYPE_TXT, buf.buf);\n if (hash == bytes20(0) && proof.length == 0) return (address(0x0), false);\n\n require(hash == bytes20(keccak256(proof)));\n\n for (RRUtils.RRIterator memory iter = proof.iterateRRs(0); !iter.done(); iter.next()) {\n require(RRUtils.serialNumberGte(expiration + iter.ttl, uint32(block.timestamp)), \"DNS record is stale; refresh or delete it before proceeding.\");\n\n bool found;\n address addr;\n (addr, found) = parseRR(proof, iter.rdataOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(bytes memory rdata, uint idx) internal pure returns (address, bool) {\n while (idx < rdata.length) {\n uint len = rdata.readUint8(idx); idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(bytes memory str, uint idx, uint len) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n if (len < 44) return (address(0x0), false);\n return hexToAddress(str, idx + 4);\n }\n\n function hexToAddress(bytes memory str, uint idx) internal pure returns (address, bool) {\n if (str.length - idx < 40) return (address(0x0), false);\n uint ret = 0;\n for (uint i = idx; i < idx + 40; i++) {\n ret <<= 4;\n uint x = str.readUint8(i);\n if (x >= 48 && x < 58) {\n ret |= x - 48;\n } else if (x >= 65 && x < 71) {\n ret |= x - 55;\n } else if (x >= 97 && x < 103) {\n ret |= x - 87;\n } else {\n return (address(0x0), false);\n }\n }\n return (address(uint160(ret)), true);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n event NSEC3DigestUpdated(uint8 id, address addr);\n event RRSetUpdated(bytes name, bytes rrset);\n\n function submitRRSets(RRSetWithSignature[] memory input, bytes calldata proof) public virtual returns (bytes memory);\n function submitRRSet(RRSetWithSignature calldata input, bytes calldata proof) public virtual returns (bytes memory);\n function deleteRRSet(uint16 deleteType, bytes calldata deleteName, RRSetWithSignature calldata nsec, bytes calldata proof) public virtual;\n function deleteRRSetNSEC3(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory closestEncloser, RRSetWithSignature memory nextClosest, bytes memory dnskey) public virtual;\n function rrdata(uint16 dnstype, bytes calldata name) external virtual view returns (uint32, uint32, bytes20);\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\n uint shortest = len;\n if (otherlen < len)\n shortest = otherlen;\n\n uint selfptr;\n uint otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint idx = 0; idx < shortest; idx += 32) {\n uint a;\n uint b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint mask;\n if (shortest > 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\n }\n int diff = int(a & mask) - int(b & mask);\n if (diff != 0)\n return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int(len) - int(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\n return self.length == other.length && equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint dest, uint src, uint len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint dest;\n uint src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\n require(len <= 52);\n\n uint ret = 0;\n uint8 decoded;\n for(uint i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if(i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint bitlen = len * 5;\n if(len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if(len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if(len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if(len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if(len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n}" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n* @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n*/\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(bytes memory self, uint offset) internal pure returns(uint) {\n uint idx = offset;\n while (true) {\n assert(idx < self.length);\n uint labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(bytes memory self, uint offset) internal pure returns(bytes memory ret) {\n uint len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(bytes memory self, uint offset) internal pure returns(uint) {\n uint count = 0;\n while (true) {\n assert(offset < self.length);\n uint labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint constant RRSIG_TYPE = 0;\n uint constant RRSIG_ALGORITHM = 2;\n uint constant RRSIG_LABELS = 3;\n uint constant RRSIG_TTL = 4;\n uint constant RRSIG_EXPIRATION = 8;\n uint constant RRSIG_INCEPTION = 12;\n uint constant RRSIG_KEY_TAG = 16;\n uint constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(bytes memory data) internal pure returns(SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(RRSIG_SIGNER_NAME + self.signerName.length, data.length - RRSIG_SIGNER_NAME - self.signerName.length);\n }\n\n function rrs(SignedSet memory rrset) internal pure returns(RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint rdataOffset;\n uint nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(bytes memory self, uint offset) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns(bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns(bytes memory) {\n return iter.data.substring(iter.offset, nameLength(iter.data, iter.offset));\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(RRIterator memory iter) internal pure returns(bytes memory) {\n return iter.data.substring(iter.rdataOffset, iter.nextOffset - iter.rdataOffset);\n }\n\n uint constant DNSKEY_FLAGS = 0;\n uint constant DNSKEY_PROTOCOL = 2;\n uint constant DNSKEY_ALGORITHM = 3;\n uint constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(bytes memory data, uint offset, uint length) internal pure returns(DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(offset + DNSKEY_PUBKEY, length - DNSKEY_PUBKEY);\n } \n\n uint constant DS_KEY_TAG = 0;\n uint constant DS_ALGORITHM = 2;\n uint constant DS_DIGEST_TYPE = 3;\n uint constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(bytes memory data, uint offset, uint length) internal pure returns(DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n struct NSEC3 {\n uint8 hashAlgorithm;\n uint8 flags;\n uint16 iterations;\n bytes salt;\n bytes32 nextHashedOwnerName;\n bytes typeBitmap;\n }\n\n uint constant NSEC3_HASH_ALGORITHM = 0;\n uint constant NSEC3_FLAGS = 1;\n uint constant NSEC3_ITERATIONS = 2;\n uint constant NSEC3_SALT_LENGTH = 4;\n uint constant NSEC3_SALT = 5;\n\n function readNSEC3(bytes memory data, uint offset, uint length) internal pure returns(NSEC3 memory self) {\n uint end = offset + length;\n self.hashAlgorithm = data.readUint8(offset + NSEC3_HASH_ALGORITHM);\n self.flags = data.readUint8(offset + NSEC3_FLAGS);\n self.iterations = data.readUint16(offset + NSEC3_ITERATIONS);\n uint8 saltLength = data.readUint8(offset + NSEC3_SALT_LENGTH);\n offset = offset + NSEC3_SALT;\n self.salt = data.substring(offset, saltLength);\n offset += saltLength;\n uint8 nextLength = data.readUint8(offset);\n require(nextLength <= 32);\n offset += 1;\n self.nextHashedOwnerName = data.readBytesN(offset, nextLength);\n offset += nextLength;\n self.typeBitmap = data.substring(offset, end - offset);\n }\n\n function checkTypeBitmap(NSEC3 memory self, uint16 rrtype) internal pure returns(bool) {\n return checkTypeBitmap(self.typeBitmap, 0, rrtype);\n }\n\n /**\n * @dev Checks if a given RR type exists in a type bitmap.\n * @param bitmap The byte string to read the type bitmap from.\n * @param offset The offset to start reading at.\n * @param rrtype The RR type to check for.\n * @return True if the type is found in the bitmap, false otherwise.\n */\n function checkTypeBitmap(bytes memory bitmap, uint offset, uint16 rrtype) internal pure returns (bool) {\n uint8 typeWindow = uint8(rrtype >> 8);\n uint8 windowByte = uint8((rrtype & 0xff) / 8);\n uint8 windowBitmask = uint8(uint8(1) << (uint8(7) - uint8(rrtype & 0x7)));\n for (uint off = offset; off < bitmap.length;) {\n uint8 window = bitmap.readUint8(off);\n uint8 len = bitmap.readUint8(off + 1);\n if (typeWindow < window) {\n // We've gone past our window; it's not here.\n return false;\n } else if (typeWindow == window) {\n // Check this type bitmap\n if (len <= windowByte) {\n // Our type is past the end of the bitmap\n return false;\n }\n return (bitmap.readUint8(off + windowByte + 2) & windowBitmask) != 0;\n } else {\n // Skip this type bitmap\n off += len + 2;\n }\n }\n\n return false;\n }\n\n function compareNames(bytes memory self, bytes memory other) internal pure returns (int) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint off;\n uint otheroff;\n uint prevoff;\n uint otherprevoff;\n uint counts = labelCount(self, 0);\n uint othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if(otheroff == 0) {\n return 1;\n }\n\n return self.compare(prevoff + 1, self.readUint8(prevoff), other, otherprevoff + 1, other.readUint8(otherprevoff));\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(uint32 i1, uint32 i2) internal pure returns(bool) {\n return int32(i1) - int32(i2) >= 0;\n }\n\n function progress(bytes memory body, uint off) internal pure returns(uint) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint ac1;\n uint ac2;\n for(uint i = 0; i < data.length + 31; i += 32) {\n uint word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if(i + 32 > data.length) {\n uint unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 += (word & 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >> 8;\n ac2 += (word & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 = (ac1 & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF)\n + ((ac1 & 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >> 16);\n ac2 = (ac2 & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF)\n + ((ac2 & 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >> 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 = (ac1 & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF)\n + ((ac1 & 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >> 32);\n ac1 = (ac1 & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF)\n + ((ac1 & 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >> 64);\n ac1 = (ac1 & 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\n + (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}" + }, + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\n\ninterface IDNSRegistrar {\n function claim(bytes memory name, bytes memory proof) external;\n function proveAndClaim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof) external;\n function proveAndClaimWithResolver(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof, address resolver, address addr) external;\n}\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar {\n using BytesUtils for bytes;\n\n DNSSEC public oracle;\n ENS public ens;\n PublicSuffixList public suffixes;\n\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event Claim(bytes32 indexed node, address indexed owner, bytes dnsname);\n event NewOracle(address oracle);\n event NewPublicSuffixList(address suffixes);\n\n constructor(DNSSEC _dnssec, PublicSuffixList _suffixes, ENS _ens) {\n oracle = _dnssec;\n emit NewOracle(address(oracle));\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setOracle(DNSSEC _dnssec) public onlyOwner {\n oracle = _dnssec;\n emit NewOracle(address(oracle));\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Claims a name by proving ownership of its DNS equivalent.\n * @param name The name to claim, in DNS wire format.\n * @param proof A DNS RRSet proving ownership of the name. Must be verified\n * in the DNSSEC oracle before calling. This RRSET must contain a TXT\n * record for '_ens.' + name, with the value 'a=0x...'. Ownership of\n * the name will be transferred to the address specified in the TXT\n * record.\n */\n function claim(bytes memory name, bytes memory proof) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(name, proof);\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input The data to be passed to the Oracle's `submitProofs` function. The last\n * proof must be the TXT record required by the registrar.\n * @param proof The proof record for the first element in input.\n */\n function proveAndClaim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof) public override {\n proof = oracle.submitRRSets(input, proof);\n claim(name, proof);\n }\n\n function proveAndClaimWithResolver(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof, address resolver, address addr) public override {\n proof = oracle.submitRRSets(input, proof);\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(name, proof);\n require(msg.sender == owner, \"Only owner can call proveAndClaimWithResolver\");\n if(addr != address(0)) {\n require(resolver != address(0), \"Cannot set addr if resolver is not set\");\n // Set ourselves as the owner so we can set a record on the resolver\n ens.setSubnodeRecord(rootNode, labelHash, address(this), resolver, 0);\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n // Transfer the record to the owner\n ens.setOwner(node, owner);\n } else {\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n }\n }\n\n function supportsInterface(bytes4 interfaceID) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(bytes memory name, bytes memory proof) internal returns(bytes32 rootNode, bytes32 labelHash, address addr) {\n // Get the first label\n uint labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n // Parent name must be in the public suffix list.\n bytes memory parentName = name.substring(labelLen + 1, name.length - labelLen - 1);\n require(suffixes.isPublicSuffix(parentName), \"Parent name must be a public suffix\");\n\n // Make sure the parent name is enabled\n rootNode = enableNode(parentName, 0);\n\n (addr,) = DNSClaimChecker.getOwnerAddress(oracle, name, proof);\n\n emit Claim(keccak256(abi.encodePacked(rootNode, labelHash)), addr, name);\n }\n\n function enableNode(bytes memory domain, uint offset) internal returns(bytes32 node) {\n uint len = domain.readUint8(offset);\n if(len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n require(owner == address(0) || owner == address(this), \"Cannot enable a name owned by someone else\");\n if(owner != address(this)) {\n if(parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n } else {\n ens.setSubnodeOwner(parentNode, label, address(this));\n }\n }\n return node;\n }\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping (bytes32 => Record) records;\n mapping (address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(bytes32 node, address owner) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public virtual override authorised(node) returns(bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(bytes32 node, address resolver) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(bytes32 node, uint64 ttl) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(address operator, bool approved) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public virtual override view returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public virtual override view returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public virtual override view returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(bytes32 node) public virtual override view returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(address owner, address operator) external virtual override view returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(bytes32 node, address resolver, uint64 ttl) internal {\n if(resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if(ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(bytes32 label, address owner)\n external\n onlyController\n {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns(bool);\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract AddrResolver is ResolverBase {\n bytes4 constant private ADDR_INTERFACE_ID = 0x3b3b57de;\n bytes4 constant private ADDRESS_INTERFACE_ID = 0xf1cb7e06;\n uint constant private COIN_TYPE_ETH = 60;\n\n event AddrChanged(bytes32 indexed node, address a);\n event AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress);\n\n mapping(bytes32=>mapping(uint=>bytes)) _addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(bytes32 node, address a) external authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) public view returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if(a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(bytes32 node, uint coinType, bytes memory a) public authorised(node) {\n emit AddressChanged(node, coinType, a);\n if(coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n _addresses[node][coinType] = a;\n }\n\n function addr(bytes32 node, uint coinType) public view returns(bytes memory) {\n return _addresses[node][coinType];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == ADDR_INTERFACE_ID || interfaceID == ADDRESS_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(bytes memory b) internal pure returns(address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns(bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual;\n function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual;\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external virtual returns(bytes32);\n function setResolver(bytes32 node, address resolver) external virtual;\n function setOwner(bytes32 node, address owner) external virtual;\n function setTTL(bytes32 node, uint64 ttl) external virtual;\n function setApprovalForAll(address operator, bool approved) external virtual;\n function owner(bytes32 node) external virtual view returns (address);\n function resolver(bytes32 node) external virtual view returns (address);\n function ttl(bytes32 node) external virtual view returns (uint64);\n function recordExists(bytes32 node) external virtual view returns (bool);\n function isApprovedForAll(address owner, address operator) external virtual view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor () {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "pragma solidity >=0.8.4;\nabstract contract ResolverBase {\n bytes4 private constant INTERFACE_META_ID = 0x01ffc9a7;\n\n function supportsInterface(bytes4 interfaceID) virtual public pure returns(bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n\n function isAuthorised(bytes32 node) internal virtual view returns(bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\n\ninterface INameWrapper {\n function ownerOf(uint256 id) external view returns (address);\n}\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver {\n ENS ens;\n INameWrapper nameWrapper;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n constructor(ENS _ens, INameWrapper wrapperAddress){\n ens = _ens;\n nameWrapper = wrapperAddress;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external{\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n function isAuthorised(bytes32 node) internal override view returns(bool) {\n address owner = ens.owner(node);\n if(owner == address(nameWrapper) ){\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return owner == msg.sender || isApprovedForAll(owner, msg.sender);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator) public view returns (bool){\n return _operatorApprovals[account][operator];\n }\n\n function multicall(bytes[] calldata data) external returns(bytes[] memory results) {\n results = new bytes[](data.length);\n for(uint i = 0; i < data.length; i++) {\n (bool success, bytes memory result) = address(this).delegatecall(data[i]);\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override(ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver) public pure returns(bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is ResolverBase {\n bytes4 constant private ABI_INTERFACE_ID = 0x2203ab56;\n\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n mapping(bytes32=>mapping(uint256=>bytes)) abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(bytes32 node, uint256 contentType, bytes calldata data) external authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n abis[node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(bytes32 node, uint256 contentTypes) external view returns (uint256, bytes memory) {\n mapping(uint256=>bytes) storage abiset = abis[node];\n\n for (uint256 contentType = 1; contentType <= contentTypes; contentType <<= 1) {\n if ((contentType & contentTypes) != 0 && abiset[contentType].length > 0) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == ABI_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract ContentHashResolver is ResolverBase {\n bytes4 constant private CONTENT_HASH_INTERFACE_ID = 0xbc1c58d1;\n\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n mapping(bytes32=>bytes) hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(bytes32 node, bytes calldata hash) external authorised(node) {\n hashes[node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory) {\n return hashes[node];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == CONTENT_HASH_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\n\nabstract contract DNSResolver is ResolverBase {\n using RRUtils for *;\n using BytesUtils for bytes;\n\n bytes4 constant private DNS_RECORD_INTERFACE_ID = 0xa8fa5682;\n bytes4 constant private DNS_ZONE_INTERFACE_ID = 0x5c47637c;\n\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(bytes32 indexed node, bytes name, uint16 resource, bytes record);\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n // DNSZoneCleared is emitted whenever a given node's zone information is cleared.\n event DNSZoneCleared(bytes32 indexed node);\n\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(bytes32 indexed node, bytes lastzonehash, bytes zonehash);\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(bytes32=>bytes) private zonehashes;\n\n // Version the mapping for each zone. This allows users who have lost\n // track of their entries to effectively delete an entire zone by bumping\n // the version number.\n // node => version\n mapping(bytes32=>uint256) private versions;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(bytes32=>mapping(uint256=>mapping(bytes32=>mapping(uint16=>bytes)))) private records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(bytes32=>mapping(uint256=>mapping(bytes32=>uint16))) private nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(bytes32 node, bytes calldata data) external authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n // Iterate over the data to add the resource records\n for (RRUtils.RRIterator memory iter = data.iterateRRs(0); !iter.done(); iter.next()) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(node, name, resource, data, offset, iter.offset - offset, value.length == 0);\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(node, name, resource, data, offset, data.length - offset, value.length == 0);\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(bytes32 node, bytes32 name, uint16 resource) public view returns (bytes memory) {\n return records[node][versions[node]][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(bytes32 node, bytes32 name) public view returns (bool) {\n return (nameEntriesCount[node][versions[node]][name] != 0);\n }\n\n /**\n * Clear all information for a DNS zone.\n * @param node the namehash of the node for which to clear the zone\n */\n function clearDNSZone(bytes32 node) public authorised(node) {\n versions[node]++;\n emit DNSZoneCleared(node);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(bytes32 node, bytes calldata hash) external authorised(node) {\n bytes memory oldhash = zonehashes[node];\n zonehashes[node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory) {\n return zonehashes[node];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == DNS_RECORD_INTERFACE_ID ||\n interfaceID == DNS_ZONE_INTERFACE_ID ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord) private\n {\n uint256 version = versions[node];\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (records[node][version][nameHash][resource].length != 0) {\n nameEntriesCount[node][version][nameHash]--;\n }\n delete(records[node][version][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (records[node][version][nameHash][resource].length == 0) {\n nameEntriesCount[node][version][nameHash]++;\n }\n records[node][version][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\n\nabstract contract InterfaceResolver is ResolverBase, AddrResolver {\n bytes4 constant private INTERFACE_INTERFACE_ID = bytes4(keccak256(\"interfaceImplementer(bytes32,bytes4)\"));\n bytes4 private constant INTERFACE_META_ID = 0x01ffc9a7;\n\n event InterfaceChanged(bytes32 indexed node, bytes4 indexed interfaceID, address implementer);\n\n mapping(bytes32=>mapping(bytes4=>address)) interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(bytes32 node, bytes4 interfaceID, address implementer) external authorised(node) {\n interfaces[node][interfaceID] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(bytes32 node, bytes4 interfaceID) external view returns (address) {\n address implementer = interfaces[node][interfaceID];\n if(implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if(a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(abi.encodeWithSignature(\"supportsInterface(bytes4)\", INTERFACE_META_ID));\n if(!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID));\n if(!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override(AddrResolver, ResolverBase) public pure returns(bool) {\n return interfaceID == INTERFACE_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract NameResolver is ResolverBase {\n bytes4 constant private NAME_INTERFACE_ID = 0x691f3431;\n\n event NameChanged(bytes32 indexed node, string name);\n\n mapping(bytes32=>string) names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param name The name to set.\n */\n function setName(bytes32 node, string calldata name) external authorised(node) {\n names[node] = name;\n emit NameChanged(node, name);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory) {\n return names[node];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == NAME_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract PubkeyResolver is ResolverBase {\n bytes4 constant private PUBKEY_INTERFACE_ID = 0xc8690233;\n\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(bytes32=>PublicKey) pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external authorised(node) {\n pubkeys[node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y) {\n return (pubkeys[node].x, pubkeys[node].y);\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == PUBKEY_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract TextResolver is ResolverBase {\n bytes4 constant private TEXT_INTERFACE_ID = 0x59d1d43c;\n\n event TextChanged(bytes32 indexed node, string indexed indexedKey, string key);\n\n mapping(bytes32=>mapping(string=>string)) texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(bytes32 node, string calldata key, string calldata value) external authorised(node) {\n texts[node][key] = value;\n emit TextChanged(node, key, key);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(bytes32 node, string calldata key) external view returns (string memory) {\n return texts[node][key];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == TEXT_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is Ownable, ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver {\n function isAuthorised(bytes32 node) internal override view returns(bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override(ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver) public pure returns(bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_NSEC = 47;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex'00'.nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex'0361626300'.nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex'0361626300'.nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex'00'.labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex'016100'.labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(hex'016201610000'.labelCount(0) == 2, \"labelCount('b.a.') == 2\");\n require(hex'066574686c61620378797a00'.labelCount(6 +1) == 1, \"nameLength('(bthlab).xyz.') == 6\");\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes memory rrs = hex'0161000001000100000e1000047400000101620161000001000100000e100004c0a80101';\n string[2] memory names = [hex'016100', hex'0162016100'];\n string[2] memory rdatas = [hex'74000001', hex'c0a80101'];\n uint i = 0;\n for(RRUtils.RRIterator memory iter = rrs.iterateRRs(0); !iter.done(); iter.next()) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(keccak256(iter.name()) == keccak256(bytes(names[i])), \"Name matches\");\n require(keccak256(iter.rdata()) == keccak256(bytes(rdatas[i])), \"Rdata matches\");\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n function testCheckTypeBitmapTextType() public pure {\n bytes memory tb = hex'0003000080';\n require(tb.checkTypeBitmap(0, DNSTYPE_TEXT) == true, \"A record should exist in type bitmap\");\n }\n\n function testCheckTypeBitmap() public pure {\n // From https://tools.ietf.org/html/rfc4034#section-4.3\n // alfa.example.com. 86400 IN NSEC host.example.com. (\n // A MX RRSIG NSEC TYPE1234\n bytes memory tb = hex'FF0006400100000003041b000000000000000000000000000000000000000000000000000020';\n\n // Exists in bitmap\n require(tb.checkTypeBitmap(1, DNSTYPE_A) == true, \"A record should exist in type bitmap\");\n // Does not exist, but in a window that is included\n require(tb.checkTypeBitmap(1, DNSTYPE_CNAME) == false, \"CNAME record should not exist in type bitmap\");\n // Does not exist, past the end of a window that is included\n require(tb.checkTypeBitmap(1, 64) == false, \"Type 64 should not exist in type bitmap\");\n // Does not exist, in a window that does not exist\n require(tb.checkTypeBitmap(1, 769) == false, \"Type 769 should not exist in type bitmap\");\n // Exists in a subsequent window\n require(tb.checkTypeBitmap(1, DNSTYPE_TYPE1234) == true, \"Type 1234 should exist in type bitmap\");\n // Does not exist, past the end of the bitmap windows\n require(tb.checkTypeBitmap(1, 1281) == false, \"Type 1281 should not exist in type bitmap\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex'066274686c61620378797a00';\n bytes memory ethLabXyz = hex'066574686c61620378797a00';\n bytes memory xyz = hex'0378797a00';\n bytes memory a_b_c = hex'01610162016300';\n bytes memory b_b_c = hex'01620162016300';\n bytes memory c = hex'016300';\n bytes memory d = hex'016400';\n bytes memory a_d_c = hex'01610164016300';\n bytes memory b_a_c = hex'01620161016300';\n bytes memory ab_c_d = hex'0261620163016400';\n bytes memory a_c_d = hex'01610163016400';\n\n require(hex'0301616100'.compareNames(hex'0302616200') < 0, \"label lengths are correctly checked\");\n require(a_b_c.compareNames(c) > 0, \"one name has a difference of >1 label to with the same root name\");\n require(a_b_c.compareNames(d) < 0, \"one name has a difference of >1 label to with different root name\");\n require(a_b_c.compareNames(a_d_c) < 0, \"two names start the same but have differences in later labels\");\n require(a_b_c.compareNames(b_a_c) > 0, \"the first label sorts later, but the first label sorts earlier\");\n require(ab_c_d.compareNames(a_c_d) > 0, \"two names where the first label on one is a prefix of the first label on the other\");\n require(a_b_c.compareNames(b_b_c) < 0, \"two names where the first label on one is a prefix of the first label on the other\");\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(bthLabXyz.compareNames(ethLabXyz) < 0, \"bthLab.xyz comes before ethLab.xyz\");\n require(bthLabXyz.compareNames(bthLabXyz) == 0, \"bthLab.xyz and bthLab.xyz are the same\");\n require(ethLabXyz.compareNames(bthLabXyz) > 0, \"ethLab.xyz comes after bethLab.xyz\");\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA), \"0x11111111 >= 0xAAAAAAAA\");\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(hex'0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d'.computeKeytag() == 19036, \"Invalid keytag\");\n require(hex'010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf'.computeKeytag() == 21693, \"Invalid keytag (2)\");\n require(hex'0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3'.computeKeytag() == 33630);\n require(hex'0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5'.computeKeytag() == 20326, \"Invalid keytag (3)\");\n }\n}" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\"\".keccak(0, 0) == bytes32(0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470), \"Incorrect hash of empty string\");\n require(\"foo\".keccak(0, 3) == bytes32(0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d), \"Incorrect hash of 'foo'\");\n require(\"foo\".keccak(0, 0) == bytes32(0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470), \"Incorrect hash of empty string\");\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\"hello\".equals(1, \"ello\") == true, \"Substring to string equality\");\n require(\"hello\".equals(1, \"jello\", 1, 4) == true, \"Substring to substring equality\");\n require(\"zhello\".equals(1, \"abchello\", 3) == true, \"Compare different value with multiple length\");\n }\n\n function testComparePartial() public pure {\n require(\"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true, \"Compare same length\");\n require(\"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true, \"Compare different length\");\n require(\"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true, \"Compare same with different offset\");\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\"a\".compare(\"b\") < 0 == true, \"Compare different value with same length\");\n require(\"b\".compare(\"a\") > 0 == true, \"Compare different value with same length\");\n require(\"aa\".compare(\"ab\") < 0 == true, \"Compare different value with multiple length\");\n require(\"a\".compare(\"aa\") < 0 == true, \"Compare different value with different length\");\n require(\"aa\".compare(\"a\") > 0 == true, \"Compare different value with different length\");\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(longChar.compare(longChar) == 0 == true, \"Compares more than 32 bytes char\");\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(longChar.compare(otherLongChar) < 0 == true, \"Compare long char with difference at start\");\n }\n\n function testSubstring() public pure {\n require(keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")), \"Copy 0 bytes\");\n require(keccak256(bytes(\"hello\".substring(0, 4))) == keccak256(bytes(\"hell\")), \"Copy substring\");\n require(keccak256(bytes(\"hello\".substring(1, 4))) == keccak256(bytes(\"ello\")), \"Copy substring\");\n require(keccak256(bytes(\"hello\".substring(0, 5))) == keccak256(bytes(\"hello\")), \"Copy whole string\");\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) == bytes32(0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000), \"readBytes20\");\n }\n\n function testReadBytes32() public pure {\n require(\"0123456789abcdef0123456789abcdef\".readBytes32(0) == bytes32(0x3031323334353637383961626364656630313233343536373839616263646566), \"readBytes32\");\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")), \"Decode 'a'\");\n require(\"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")), \"Decode 'aa'\");\n require(\"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")), \"Decode 'aaa'\");\n require(\"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")), \"Decode 'aaaa'\");\n require(\"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")), \"Decode 'aaaaa'\");\n require(\"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")), \"Decode 'aaaaa' lowercase\");\n require(\"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(0, 42) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")), \"Decode alphabet\");\n require(\"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(0, 42) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")), \"Decode alphabet lowercase\");\n require(\"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\".base32HexDecodeWord(0, 52) == bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"), \"Decode 32*'a'\");\n require(\" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\".base32HexDecodeWord(1, 32) == bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"), \"Decode real bytes32hex\");\n }\n}" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"./nsec3digests/NSEC3Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n *\n * TODO: Support for NSEC3 records\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_NS = 2;\n uint16 constant DNSTYPE_SOA = 6;\n uint16 constant DNSTYPE_DNAME = 39;\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_NSEC = 47;\n uint16 constant DNSTYPE_DNSKEY = 48;\n uint16 constant DNSTYPE_NSEC3 = 50;\n\n uint constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n uint8 constant ALGORITHM_RSASHA256 = 8;\n\n uint8 constant DIGEST_ALGORITHM_SHA256 = 2;\n\n struct RRSet {\n uint32 inception;\n uint32 expiration;\n bytes20 hash;\n }\n\n // (name, type) => RRSet\n mapping (bytes32 => mapping(uint16 => RRSet)) rrsets;\n\n mapping (uint8 => Algorithm) public algorithms;\n mapping (uint8 => Digest) public digests;\n mapping (uint8 => NSEC3Digest) public nsec3Digests;\n\n event Test(uint t);\n event Marker();\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n rrsets[keccak256(hex\"00\")][DNSTYPE_DS] = RRSet({\n inception: uint32(0),\n expiration: uint32(3767581600), // May 22 2089 - the latest date we can encode as of writing this\n hash: bytes20(keccak256(anchors))\n });\n emit RRSetUpdated(hex\"00\", anchors);\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Sets the contract address for an NSEC3 digest algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setNSEC3Digest(uint8 id, NSEC3Digest digest) public owner_only {\n nsec3Digests[id] = digest;\n emit NSEC3DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Submits multiple RRSets\n * @param input A list of RRSets and signatures forming a chain of trust from an existing known-good record.\n * @param _proof The DNSKEY or DS to validate the first signature against.\n * @return The last RRSET submitted.\n */\n function submitRRSets(RRSetWithSignature[] memory input, bytes calldata _proof) public override returns (bytes memory) {\n bytes memory proof = _proof;\n for(uint i = 0; i < input.length; i++) {\n proof = _submitRRSet(input[i], proof);\n }\n return proof;\n }\n\n /**\n * @dev Submits a signed set of RRs to the oracle.\n *\n * RRSETs are only accepted if they are signed with a key that is already\n * trusted, or if they are self-signed, and the signing key is identified by\n * a DS record that is already trusted.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against. Must Already\n * have been submitted and proved previously.\n */\n function submitRRSet(RRSetWithSignature memory input, bytes memory proof)\n public override\n returns (bytes memory)\n {\n return _submitRRSet(input, proof);\n }\n\n /**\n * @dev Deletes an RR from the oracle.\n *\n * @param deleteType The DNS record type to delete.\n * @param deleteName which you want to delete\n * @param nsec The signed NSEC RRset. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n */\n function deleteRRSet(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory nsec, bytes memory proof)\n public override\n {\n RRUtils.SignedSet memory rrset;\n rrset = validateSignedSet(nsec, proof);\n require(rrset.typeCovered == DNSTYPE_NSEC);\n\n // Don't let someone use an old proof to delete a new name\n require(RRUtils.serialNumberGte(rrset.inception, rrsets[keccak256(deleteName)][deleteType].inception));\n\n for (RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\n // We're dealing with three names here:\n // - deleteName is the name the user wants us to delete\n // - nsecName is the owner name of the NSEC record\n // - nextName is the next name specified in the NSEC record\n //\n // And three cases:\n // - deleteName equals nsecName, in which case we can delete the\n // record if it's not in the type bitmap.\n // - nextName comes after nsecName, in which case we can delete\n // the record if deleteName comes between nextName and nsecName.\n // - nextName comes before nsecName, in which case nextName is the\n // zone apex, and deleteName must come after nsecName.\n checkNsecName(iter, rrset.name, deleteName, deleteType);\n delete rrsets[keccak256(deleteName)][deleteType];\n return;\n }\n // We should never reach this point\n revert();\n }\n\n function checkNsecName(RRUtils.RRIterator memory iter, bytes memory nsecName, bytes memory deleteName, uint16 deleteType) private pure {\n uint rdataOffset = iter.rdataOffset;\n uint nextNameLength = iter.data.nameLength(rdataOffset);\n uint rDataLength = iter.nextOffset - iter.rdataOffset;\n\n // We assume that there is always typed bitmap after the next domain name\n require(rDataLength > nextNameLength);\n\n int compareResult = deleteName.compareNames(nsecName);\n if(compareResult == 0) {\n // Name to delete is on the same label as the NSEC record\n require(!iter.data.checkTypeBitmap(rdataOffset + nextNameLength, deleteType));\n } else {\n // First check if the NSEC next name comes after the NSEC name.\n bytes memory nextName = iter.data.substring(rdataOffset,nextNameLength);\n // deleteName must come after nsecName\n require(compareResult > 0);\n if(nsecName.compareNames(nextName) < 0) {\n // deleteName must also come before nextName\n require(deleteName.compareNames(nextName) < 0);\n }\n }\n }\n\n /**\n * @dev Deletes an RR from the oracle using an NSEC3 proof.\n * Deleting a record using NSEC3 requires using up to two NSEC3 records. There are two cases:\n * 1. The name exists, but the record type doesn't. Eg, example.com has A records but no TXT records.\n * 2. The name does not exist, but a parent name does.\n * In the first case, we submit one NSEC3 proof in `closestEncloser` that matches the target name\n * but does not have the bit for `deleteType` set in its type bitmap. In the second case, we submit\n * two proofs: closestEncloser and nextClosest, that together prove that the name does not exist.\n * NSEC3 records are in the format described in section 5.3.2 of RFC4035: The RRDATA section\n * from the RRSIG without the signature data, followed by a series of canonicalised RR records\n * that the signature applies to.\n *\n * @param deleteType The DNS record type to delete.\n * @param deleteName The name to delete.\n * @param closestEncloser An NSEC3 proof matching the closest enclosing name - that is,\n * the nearest ancestor of the target name that *does* exist.\n * @param nextClosest An NSEC3 proof covering the next closest name. This proves that the immediate\n * subdomain of the closestEncloser does not exist.\n * @param dnskey An encoded DNSKEY record that has already been submitted to the oracle and can be used\n * to verify the signatures closestEncloserSig and nextClosestSig\n */\n function deleteRRSetNSEC3(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory closestEncloser, RRSetWithSignature memory nextClosest, bytes memory dnskey)\n public override\n {\n uint32 originalInception = rrsets[keccak256(deleteName)][deleteType].inception;\n\n RRUtils.SignedSet memory ce = validateSignedSet(closestEncloser, dnskey);\n checkNSEC3Validity(ce, deleteName, originalInception);\n\n RRUtils.SignedSet memory nc;\n if(nextClosest.rrset.length > 0) {\n nc = validateSignedSet(nextClosest, dnskey);\n checkNSEC3Validity(nc, deleteName, originalInception);\n }\n\n RRUtils.NSEC3 memory ceNSEC3 = readNSEC3(ce);\n // The flags field must be 0 or 1 (RFC5155 section 8.2).\n require(ceNSEC3.flags & 0xfe == 0);\n // Check that the closest encloser is from the correct zone (RFC5155 section 8.3)\n // \"The DNAME type bit must not be set and the NS type bit may only be set if the SOA type bit is set.\"\n require(!ceNSEC3.checkTypeBitmap(DNSTYPE_DNAME) && (!ceNSEC3.checkTypeBitmap(DNSTYPE_NS) || ceNSEC3.checkTypeBitmap(DNSTYPE_SOA)));\n\n // Case 1: deleteName does exist, but no records of RRTYPE deleteType do.\n if(isMatchingNSEC3Record(deleteType, deleteName, ce.name, ceNSEC3)) {\n delete rrsets[keccak256(deleteName)][deleteType];\n // Case 2: deleteName does not exist.\n } else if(isCoveringNSEC3Record(deleteName, ce.name, ceNSEC3, nc.name, readNSEC3(nc))) {\n delete rrsets[keccak256(deleteName)][deleteType];\n } else {\n revert();\n }\n }\n\n function checkNSEC3Validity(RRUtils.SignedSet memory nsec, bytes memory deleteName, uint32 originalInception) private pure {\n // The records must have been signed after the record we're trying to delete\n require(RRUtils.serialNumberGte(nsec.inception, originalInception));\n\n // The record must be an NSEC3\n require(nsec.typeCovered == DNSTYPE_NSEC3);\n\n // nsecName is of the form .zone.xyz. is the NSEC3 hash of the entire name the NSEC3 record matches, while\n // zone.xyz can be any ancestor of that name. We'll check that, so someone can't use a record on foo.com\n // as proof of the nonexistence of bar.org.\n require(checkNSEC3OwnerName(nsec.name, deleteName));\n }\n\n function isMatchingNSEC3Record(uint16 deleteType, bytes memory deleteName, bytes memory closestEncloserName, RRUtils.NSEC3 memory closestEncloser) private view returns(bool) {\n // Check the record matches the hashed name, but the type bitmap does not include the type\n if(checkNSEC3Name(closestEncloser, closestEncloserName, deleteName)) {\n return !closestEncloser.checkTypeBitmap(deleteType);\n }\n\n return false;\n }\n\n function isCoveringNSEC3Record(bytes memory deleteName, bytes memory ceName, RRUtils.NSEC3 memory ce, bytes memory ncName, RRUtils.NSEC3 memory nc) private view returns(bool) {\n // The flags field must be 0 or 1 (RFC5155 section 8.2).\n require(nc.flags & 0xfe == 0);\n\n bytes32 ceNameHash = decodeOwnerNameHash(ceName);\n bytes32 ncNameHash = decodeOwnerNameHash(ncName);\n\n uint lastOffset = 0;\n // Iterate over suffixes of the name to delete until one matches the closest encloser\n for(uint offset = deleteName.readUint8(0) + 1; offset < deleteName.length; offset += deleteName.readUint8(offset) + 1) {\n if(hashName(ce, deleteName.substring(offset, deleteName.length - offset)) == ceNameHash) {\n // Check that the next closest record encloses the name one label longer\n bytes32 checkHash = hashName(nc, deleteName.substring(lastOffset, deleteName.length - lastOffset));\n if(ncNameHash < nc.nextHashedOwnerName) {\n return checkHash > ncNameHash && checkHash < nc.nextHashedOwnerName;\n } else {\n return checkHash > ncNameHash || checkHash < nc.nextHashedOwnerName;\n }\n }\n lastOffset = offset;\n }\n // If we reached the root without finding a match, return false.\n return false;\n }\n\n function readNSEC3(RRUtils.SignedSet memory ss) private pure returns(RRUtils.NSEC3 memory) {\n RRUtils.RRIterator memory iter = ss.rrs();\n return iter.data.readNSEC3(iter.rdataOffset, iter.nextOffset - iter.rdataOffset);\n }\n\n function checkNSEC3Name(RRUtils.NSEC3 memory nsec, bytes memory ownerName, bytes memory deleteName) private view returns(bool) {\n // Compute the NSEC3 name hash of the name to delete.\n bytes32 deleteNameHash = hashName(nsec, deleteName);\n\n // Decode the NSEC3 name hash from the first label of the NSEC3 owner name.\n bytes32 nsecNameHash = decodeOwnerNameHash(ownerName);\n\n return deleteNameHash == nsecNameHash;\n }\n\n function hashName(RRUtils.NSEC3 memory nsec, bytes memory name) private view returns(bytes32) {\n return nsec3Digests[nsec.hashAlgorithm].hash(nsec.salt, name, nsec.iterations);\n }\n\n function decodeOwnerNameHash(bytes memory name) private pure returns(bytes32) {\n return name.base32HexDecodeWord(1, uint(name.readUint8(0)));\n }\n\n function checkNSEC3OwnerName(bytes memory nsecName, bytes memory deleteName) private pure returns(bool) {\n uint nsecNameOffset = nsecName.readUint8(0) + 1;\n uint deleteNameOffset = 0;\n while(deleteNameOffset < deleteName.length) {\n if(deleteName.equals(deleteNameOffset, nsecName, nsecNameOffset)) {\n return true;\n }\n deleteNameOffset += deleteName.readUint8(deleteNameOffset) + 1;\n }\n return false;\n }\n\n /**\n * @dev Returns data about the RRs (if any) known to this oracle with the provided type and name.\n * @param dnstype The DNS record type to query.\n * @param name The name to query, in DNS label-sequence format.\n * @return inception The unix timestamp (wrapped) at which the signature for this RRSET was created.\n * @return expiration The unix timestamp (wrapped) at which the signature for this RRSET expires.\n * @return hash The hash of the RRset.\n */\n function rrdata(uint16 dnstype, bytes calldata name) external override view returns (uint32, uint32, bytes20) {\n RRSet storage result = rrsets[keccak256(name)][dnstype];\n return (result.inception, result.expiration, result.hash);\n }\n\n function _submitRRSet(RRSetWithSignature memory input, bytes memory proof) internal returns (bytes memory) {\n RRUtils.SignedSet memory rrset;\n rrset = validateSignedSet(input, proof);\n\n RRSet storage storedSet = rrsets[keccak256(rrset.name)][rrset.typeCovered];\n if (storedSet.hash != bytes20(0)) {\n // To replace an existing rrset, the signature must be at least as new\n require(RRUtils.serialNumberGte(rrset.inception, storedSet.inception));\n }\n rrsets[keccak256(rrset.name)][rrset.typeCovered] = RRSet({\n inception: rrset.inception,\n expiration: rrset.expiration,\n hash: bytes20(keccak256(rrset.data))\n });\n\n emit RRSetUpdated(rrset.name, rrset.data);\n\n return rrset.data;\n }\n\n /**\n * @dev Submits a signed set of RRs to the oracle.\n *\n * RRSETs are only accepted if they are signed with a key that is already\n * trusted, or if they are self-signed, and the signing key is identified by\n * a DS record that is already trusted.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against. Must Already\n * have been submitted and proved previously.\n */\n function validateSignedSet(RRSetWithSignature memory input, bytes memory proof) internal view returns(RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n require(validProof(rrset.signerName, proof));\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n require(name.labelCount(0) == rrset.labels);\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n require(RRUtils.serialNumberGte(rrset.expiration, uint32(block.timestamp)));\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n require(RRUtils.serialNumberGte(uint32(block.timestamp), rrset.inception));\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n function validProof(bytes memory name, bytes memory proof) internal view returns(bool) {\n uint16 dnstype = proof.readUint16(proof.nameLength(0));\n return rrsets[keccak256(name)][dnstype].hash == bytes20(keccak256(proof));\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(RRUtils.SignedSet memory rrset, uint16 typecovered) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\n // We only support class IN (Internet)\n require(iter.class == DNSCLASS_IN);\n\n if(name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n require(name.length == iter.data.nameLength(iter.offset));\n require(name.equals(0, iter.data, iter.offset, name.length));\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n require(iter.dnstype == typecovered);\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(bytes memory name, RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, bytes memory proof) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n require(rrset.signerName.length <= name.length);\n require(rrset.signerName.equals(0, name, name.length - rrset.signerName.length));\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n require(verifyWithDS(rrset, data, proofRR));\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n require(verifyWithKnownKey(rrset, data, proofRR));\n } else {\n revert(\"No valid proof found\");\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n * @return True if the RRSET could be verified, false otherwise.\n */\n function verifyWithKnownKey(RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, RRUtils.RRIterator memory proof) internal view returns(bool) {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n require(proof.name().equals(rrset.signerName));\n for(; !proof.done(); proof.next()) {\n require(proof.name().equals(rrset.signerName));\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(0, keyrdata.length);\n if(verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(RRUtils.DNSKEY memory dnskey, bytes memory keyrdata, RRUtils.SignedSet memory rrset, RRSetWithSignature memory data)\n internal\n view\n returns (bool)\n {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if(dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if(dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n return algorithms[dnskey.algorithm].verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record \n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n * @return True if the RRSET could be verified, false otherwise.\n */\n function verifyWithDS(RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, RRUtils.RRIterator memory proof) internal view returns(bool) {\n for(RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\n require(iter.dnstype == DNSTYPE_DNSKEY);\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(0, keyrdata.length);\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n return verifyKeyWithDS(iter.name(), proof, dnskey, keyrdata);\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(bytes memory keyname, RRUtils.RRIterator memory dsrrs, RRUtils.DNSKEY memory dnskey, bytes memory keyrdata)\n internal view returns (bool)\n {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n RRUtils.DS memory ds = dsrrs.data.readDS(dsrrs.rdataOffset, dsrrs.nextOffset - dsrrs.rdataOffset);\n if(ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(uint8 digesttype, bytes memory data, bytes memory digest) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev Contract mixin for 'owned' contracts.\n*/\ncontract Owned {\n address public owner;\n \n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n*/\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external virtual view returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev An interface for contracts implementing a DNSSEC digest.\n*/\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(bytes calldata data, bytes calldata hash) external virtual pure returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/nsec3digests/NSEC3Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Interface for contracts that implement NSEC3 digest algorithms.\n */\ninterface NSEC3Digest {\n /**\n * @dev Performs an NSEC3 iterated hash.\n * @param salt The salt value to use on each iteration.\n * @param data The data to hash.\n * @param iterations The number of iterations to perform.\n * @return The result of the iterated hash operation.\n */\n function hash(bytes calldata salt, bytes calldata data, uint iterations) external virtual pure returns (bytes32);\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": false, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/solcInputs/1834f6cfd464e3a85d236ff981ae4c0e.json b/solidity/dns-contracts/deployments/mainnet/solcInputs/1834f6cfd464e3a85d236ff981ae4c0e.json new file mode 100644 index 0000000..be90732 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/solcInputs/1834f6cfd464e3a85d236ff981ae4c0e.json @@ -0,0 +1,173 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (bytes[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, ) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n return (results, address(0));\n }\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes[] memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (bytes[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n result = LowLevelCallUtils.functionStaticCall(address(target), data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = revertData;\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return The Resolver responsible for this name, and the namehash of the full name.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32) {\n (address resolver, bytes32 labelhash) = findResolver(name, 0);\n return (Resolver(resolver), labelhash);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0));\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (address parentresolver, bytes32 parentnode) = findResolver(\n name,\n nextLabel\n );\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node);\n }\n return (parentresolver, node);\n }\n\n function _hasExtendedResolver(\n address resolver\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface(\n type(IExtendedResolver).interfaceId\n )\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (bytes[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _hasExtendedResolver(multicallData.resolver);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = item;\n continue;\n }\n if (!isCallback && hasExtendedResolver) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = returnData;\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1300 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/solcInputs/1f16f502a8b053fb7c640b7ed74a06d8.json b/solidity/dns-contracts/deployments/mainnet/solcInputs/1f16f502a8b053fb7c640b7ed74a06d8.json new file mode 100644 index 0000000..49c7ec1 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/solcInputs/1f16f502a8b053fb7c640b7ed74a06d8.json @@ -0,0 +1,434 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (iter.name().compareNames(buf.buf) != 0) continue;\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(\n uint16 _expectedType,\n bytes memory _expectedName,\n uint32 _inception,\n uint64 _inserted,\n bytes memory _proof\n ) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if (_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(\n uint16 dnstype,\n bytes memory name\n ) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyExtendedDNSSECResolver is IExtendedDNSResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes memory /* name */,\n bytes memory /* data */,\n bytes memory context\n ) external view override returns (bytes memory) {\n return abi.encode(context);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyLegacyTextResolver is ITextResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(ITextResolver).interfaceId;\n }\n\n function text(\n bytes32 /* node */,\n string calldata key\n ) external view override returns (string memory) {\n return key;\n }\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver {\n using RRUtils for *;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, data)\n );\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query) = abi.decode(\n extraData,\n (bytes, bytes)\n );\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n IExtendedDNSResolver(dnsresolver).resolve(\n name,\n query,\n context\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return IExtendedResolver(dnsresolver).resolve(name, query);\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (bytes memory key, bytes memory value, uint256 nextOffset)\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = input.length;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n nextOffset = terminator + 1;\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256[3] memory P) {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (uint256 x, uint256 y, uint256 z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(\n uint256 x0,\n uint256 y0\n ) internal pure returns (bool isZero) {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(\n uint256 scalar\n ) internal pure returns (uint256, uint256) {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(\n bytes calldata,\n bytes calldata\n ) external pure override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input\n )\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n )\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(\n RRUtils.SignedSet memory rrset,\n uint16 typecovered\n ) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if (address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns (bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 {\n totallen := add(totallen, 64)\n }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for {\n let i := 0\n } lt(i, totallen) {\n i := add(i, 64)\n } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 {\n mstore8(add(scratch, sub(len, i)), 0x80)\n }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 {\n mstore(\n add(scratch, 32),\n or(mload(add(scratch, 32)), mul(len, 8))\n )\n }\n\n // Expand the 16 32-bit words into 80\n for {\n let j := 64\n } lt(j, 128) {\n j := add(j, 12)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 12))),\n mload(add(scratch, sub(j, 32)))\n ),\n xor(\n mload(add(scratch, sub(j, 56))),\n mload(add(scratch, sub(j, 64)))\n )\n )\n temp := or(\n and(\n mul(temp, 2),\n 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE\n ),\n and(\n div(temp, 0x80000000),\n 0x0000000100000001000000010000000100000001000000010000000100000001\n )\n )\n mstore(add(scratch, j), temp)\n }\n for {\n let j := 128\n } lt(j, 320) {\n j := add(j, 24)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 24))),\n mload(add(scratch, sub(j, 64)))\n ),\n xor(\n mload(add(scratch, sub(j, 112))),\n mload(add(scratch, sub(j, 128)))\n )\n )\n temp := or(\n and(\n mul(temp, 4),\n 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC\n ),\n and(\n div(temp, 0x40000000),\n 0x0000000300000003000000030000000300000003000000030000000300000003\n )\n )\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for {\n let j := 0\n } lt(j, 80) {\n j := add(j, 1)\n } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(\n div(x, 0x100000000000000000000),\n div(x, 0x10000000000)\n )\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := and(div(x, 0x10000000000), f)\n f := or(\n and(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n ),\n f\n )\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(\n div(\n x,\n 0x80000000000000000000000000000000000000000000000\n ),\n 0x1F\n )\n temp := or(\n and(\n div(x, 0x800000000000000000000000000000000000000),\n 0xFFFFFFE0\n ),\n temp\n )\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(\n div(\n mload(add(scratch, mul(j, 4))),\n 0x100000000000000000000000000000000000000000000000000000000\n ),\n temp\n )\n x := or(\n div(x, 0x10000000000),\n mul(temp, 0x10000000000000000000000000000000000000000)\n )\n x := or(\n and(\n x,\n 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF\n ),\n mul(\n or(\n and(div(x, 0x4000000000000), 0xC0000000),\n and(div(x, 0x400000000000000000000), 0x3FFFFFFF)\n ),\n 0x100000000000000000000\n )\n )\n }\n\n h := and(\n add(h, x),\n 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF\n )\n }\n ret := mul(\n or(\n or(\n or(\n or(\n and(\n div(h, 0x100000000),\n 0xFFFFFFFF00000000000000000000000000000000\n ),\n and(\n div(h, 0x1000000),\n 0xFFFFFFFF000000000000000000000000\n )\n ),\n and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)\n ),\n and(div(h, 0x100), 0xFFFFFFFF00000000)\n ),\n and(h, 0xFFFFFFFF)\n ),\n 0x1000000000000000000000000\n )\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/ILinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface ILinearPremiumPriceOracle {\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256);\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns (address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping(bytes32 => address) addresses;\n\n constructor() public {}\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Implements a dummy NameWrapper which returns the caller's address\n */\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ReverseClaimer\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/utils/DummyRevertResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ncontract DummyRevertResolver {\n function resolve(\n bytes calldata,\n bytes calldata\n ) external pure returns (bytes memory) {\n revert(\"Not Supported\");\n }\n\n function supportsInterface(bytes4) external pure returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n return functionStaticCall(target, data, gasleft());\n }\n\n /**\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @param gasLimit The gas limit to use for the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n uint256 gasLimit\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gasLimit,\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/TestHexUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {HexUtils} from \"./HexUtils.sol\";\n\ncontract TestHexUtils {\n using HexUtils for *;\n\n function hexStringToBytes32(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes32, bool) {\n return name.hexStringToBytes32(idx, lastInx);\n }\n\n function hexToAddress(\n bytes calldata input,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (address, bool) {\n return input.hexToAddress(idx, lastInx);\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(\n string memory name\n ) public pure returns (bytes memory, bytes32) {\n return name.dnsEncodeName();\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nerror ResolverNotContract();\n\nerror ResolverError(bytes returnData);\n\nerror HttpError(HttpErrorItem[] errors);\n\nstruct HttpErrorItem {\n uint16 status;\n string message;\n}\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct MulticallChecks {\n bool isCallback;\n bool hasExtendedResolver;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\nstruct Result {\n bool success;\n bytes returnData;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (Result[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (Result[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (Result[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (Result[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n if (!resolverAddress.isContract()) {\n revert ResolverNotContract();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory reverseResolvedData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n reverseResolvedData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (Result[] memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n Result[] memory results,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n Result memory result = results[0];\n\n if (!result.success) {\n revert ResolverError(result.returnData);\n }\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(result.returnData, (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n result.returnData,\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (Result[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data,\n bool isSafe\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n if (isSafe) {\n result = LowLevelCallUtils.functionStaticCall(target, data);\n } else {\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\n }\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _checkInterface(\n address resolver,\n bytes4 interfaceId\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _checkSafetyAndItem(\n bytes memory name,\n bytes memory item,\n address resolver,\n MulticallChecks memory multicallChecks\n ) internal view returns (bool, bytes memory) {\n if (!multicallChecks.isCallback) {\n if (multicallChecks.hasExtendedResolver) {\n return (\n true,\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\n );\n }\n return (_checkInterface(resolver, bytes4(item)), item);\n }\n return (true, item);\n }\n\n function _checkMulticall(\n MulticallData memory multicallData\n ) internal view returns (MulticallChecks memory) {\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _checkInterface(\n multicallData.resolver,\n type(IExtendedResolver).interfaceId\n );\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n return MulticallChecks(isCallback, hasExtendedResolver);\n }\n\n function _checkResolveSingle(Result memory result) internal pure {\n if (!result.success) {\n if (bytes4(result.returnData) == HttpError.selector) {\n (, HttpErrorItem[] memory errors) = abi.decode(\n result.returnData,\n (bytes4, HttpErrorItem[])\n );\n revert HttpError(errors);\n }\n revert ResolverError(result.returnData);\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (Result[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new Result[](length);\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n\n if (failure) {\n results[i] = Result(false, item);\n continue;\n }\n\n bool isSafe = false;\n (isSafe, item) = _checkSafetyAndItem(\n multicallData.name,\n item,\n multicallData.resolver,\n multicallChecks\n );\n\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(\n multicallData.resolver,\n item,\n isSafe\n );\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && multicallChecks.hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = Result(success, returnData);\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(\n name,\n wrappedOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable,\n ReverseClaimer\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE and set expiry to max */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the owner of a name\n * @param id Namehash of the name\n * @return operator Approved operator of a name\n */\n\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /**\n * @notice Approves an address for a name\n * @param to address to approve\n * @param tokenId name to approve\n */\n\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or operator of the owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or operator\n */\n\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Checks if owner/operator or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner/operator or approved\n */\n\n function canExtendSubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public returns (uint64 expiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // Set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (!_isWrapped(node)) {\n revert NameIsNotWrapped();\n }\n\n // this flag is used later, when checking fuses\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // Max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n address approved = getApproved(uint256(node));\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(parentNode, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /**\n * @notice Checks if a name is wrapped in a more gas efficient way\n * @param parentNode Namehash of the name\n * @param labelhash Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != ETH_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + }, + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external view override returns (bool) {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32, uint256) {\n return name.readLabel(offset);\n }\n\n function namehash(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32) {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\n \"\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n require(\n \"foo\".keccak(0, 3) ==\n bytes32(\n 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d\n ),\n \"Incorrect hash of 'foo'\"\n );\n require(\n \"foo\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\n \"hello\".equals(1, \"ello\") == true,\n \"Substring to string equality\"\n );\n require(\n \"hello\".equals(1, \"jello\", 1, 4) == true,\n \"Substring to substring equality\"\n );\n require(\n \"zhello\".equals(1, \"abchello\", 3) == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"0x0102030000\".equals(0, \"0x010203\") == false,\n \"Compare with offset and trailing bytes\"\n );\n }\n\n function testComparePartial() public pure {\n require(\n \"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true,\n \"Compare same length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true,\n \"Compare different length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true,\n \"Compare same with different offset\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 33\n ) ==\n 0 ==\n true,\n \"Compare different long strings same length smaller partial length which must be equal\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 34\n ) <\n 0 ==\n true,\n \"Compare long strings same length different partial length\"\n );\n require(\n \"0123456789012345012345678901234a\".compare(\n 0,\n 32,\n \"0123456789012345012345678901234b\",\n 0,\n 32\n ) <\n 0 ==\n true,\n \"Compare strings exactly 32 characters long\"\n );\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\n \"a\".compare(\"b\") < 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"b\".compare(\"a\") > 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"aa\".compare(\"ab\") < 0 == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"a\".compare(\"aa\") < 0 == true,\n \"Compare different value with different length\"\n );\n require(\n \"aa\".compare(\"a\") > 0 == true,\n \"Compare different value with different length\"\n );\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(\n longChar.compare(longChar) == 0 == true,\n \"Compares more than 32 bytes char\"\n );\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(\n longChar.compare(otherLongChar) < 0 == true,\n \"Compare long char with difference at start\"\n );\n }\n\n function testSubstring() public pure {\n require(\n keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")),\n \"Copy 0 bytes\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 4))) ==\n keccak256(bytes(\"hell\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(1, 4))) ==\n keccak256(bytes(\"ello\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 5))) ==\n keccak256(bytes(\"hello\")),\n \"Copy whole string\"\n );\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(\n bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) ==\n bytes32(\n 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000\n ),\n \"readBytes20\"\n );\n }\n\n function testReadBytes32() public pure {\n require(\n \"0123456789abcdef0123456789abcdef\".readBytes32(0) ==\n bytes32(\n 0x3031323334353637383961626364656630313233343536373839616263646566\n ),\n \"readBytes32\"\n );\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\n \"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")),\n \"Decode 'a'\"\n );\n require(\n \"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")),\n \"Decode 'aa'\"\n );\n require(\n \"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")),\n \"Decode 'aaa'\"\n );\n require(\n \"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")),\n \"Decode 'aaaa'\"\n );\n require(\n \"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa'\"\n );\n require(\n \"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa' lowercase\"\n );\n require(\n \"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet\"\n );\n require(\n \"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet lowercase\"\n );\n require(\n \"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\"\n .base32HexDecodeWord(0, 52) ==\n bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"),\n \"Decode 32*'a'\"\n );\n require(\n \" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\"\n .base32HexDecodeWord(1, 32) ==\n bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"),\n \"Decode real bytes32hex\"\n );\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex\"00\".nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex\"00\".labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex\"016100\".labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(\n hex\"016201610000\".labelCount(0) == 2,\n \"labelCount('b.a.') == 2\"\n );\n require(\n hex\"066574686c61620378797a00\".labelCount(6 + 1) == 1,\n \"nameLength('(bthlab).xyz.') == 6\"\n );\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes\n memory rrs = hex\"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101\";\n bytes[2] memory names = [bytes(hex\"016100\"), bytes(hex\"0162016100\")];\n bytes[2] memory rdatas = [bytes(hex\"74000001\"), bytes(hex\"c0a80101\")];\n uint i = 0;\n for (\n RRUtils.RRIterator memory iter = rrs.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(\n keccak256(iter.name()) == keccak256(names[i]),\n \"Name matches\"\n );\n require(\n keccak256(iter.rdata()) == keccak256(rdatas[i]),\n \"Rdata matches\"\n );\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex\"066274686c61620378797a00\";\n bytes memory ethLabXyz = hex\"066574686c61620378797a00\";\n bytes memory xyz = hex\"0378797a00\";\n bytes memory a_b_c = hex\"01610162016300\";\n bytes memory b_b_c = hex\"01620162016300\";\n bytes memory c = hex\"016300\";\n bytes memory d = hex\"016400\";\n bytes memory a_d_c = hex\"01610164016300\";\n bytes memory b_a_c = hex\"01620161016300\";\n bytes memory ab_c_d = hex\"0261620163016400\";\n bytes memory a_c_d = hex\"01610163016400\";\n bytes\n memory verylong1_eth = hex\"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n bytes\n memory verylong2_eth = hex\"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n\n require(\n hex\"0301616100\".compareNames(hex\"0302616200\") < 0,\n \"label lengths are correctly checked\"\n );\n require(\n a_b_c.compareNames(c) > 0,\n \"one name has a difference of >1 label to with the same root name\"\n );\n require(\n a_b_c.compareNames(d) < 0,\n \"one name has a difference of >1 label to with different root name\"\n );\n require(\n a_b_c.compareNames(a_d_c) < 0,\n \"two names start the same but have differences in later labels\"\n );\n require(\n a_b_c.compareNames(b_a_c) > 0,\n \"the first label sorts later, but the first label sorts earlier\"\n );\n require(\n ab_c_d.compareNames(a_c_d) > 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(\n a_b_c.compareNames(b_b_c) < 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(\n bthLabXyz.compareNames(ethLabXyz) < 0,\n \"bthLab.xyz comes before ethLab.xyz\"\n );\n require(\n bthLabXyz.compareNames(bthLabXyz) == 0,\n \"bthLab.xyz and bthLab.xyz are the same\"\n );\n require(\n ethLabXyz.compareNames(bthLabXyz) > 0,\n \"ethLab.xyz comes after bethLab.xyz\"\n );\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(\n verylong1_eth.compareNames(verylong2_eth) > 0,\n \"longa.vlong.eth comes after long.vlong.eth\"\n );\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(\n RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA),\n \"0x11111111 >= 0xAAAAAAAA\"\n );\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(\n hex\"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d\"\n .computeKeytag() == 19036,\n \"Invalid keytag\"\n );\n require(\n hex\"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf\"\n .computeKeytag() == 21693,\n \"Invalid keytag (2)\"\n );\n require(\n hex\"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3\"\n .computeKeytag() == 33630\n );\n require(\n hex\"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5\"\n .computeKeytag() == 20326,\n \"Invalid keytag (3)\"\n );\n }\n}\n" + }, + "test/registry/mocks/DummyResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyResolver {\n mapping(bytes32 => string) public name;\n\n function setName(bytes32 node, string memory _name) public {\n name[node] = _name;\n }\n}\n" + }, + "test/reverseRegistrar/mocks/MockReverseClaimerImplementer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../../../contracts/registry/ENS.sol\";\nimport {ReverseClaimer} from \"../../../contracts/reverseRegistrar/ReverseClaimer.sol\";\n\ncontract MockReverseClaimerImplementer is ReverseClaimer {\n constructor(ENS ens, address claimant) ReverseClaimer(ens, claimant) {}\n}\n" + }, + "test/utils/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n if (bytes4(extraData) == bytes4(keccak256(\"name(bytes32)\"))) {\n return abi.encode(\"offchain.test.eth\");\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "test/utils/mocks/LegacyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\ncontract LegacyResolver {\n function addr(bytes32 /* node */) public view returns (address) {\n return address(this);\n }\n}\n" + }, + "test/utils/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10 ** uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10 ** uint256(decimals()));\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/solcInputs/2623184d1fe6fb81f7e39a0a868bd472.json b/solidity/dns-contracts/deployments/mainnet/solcInputs/2623184d1fe6fb81f7e39a0a868bd472.json new file mode 100644 index 0000000..4bbde5e --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/solcInputs/2623184d1fe6fb81f7e39a0a868bd472.json @@ -0,0 +1,101 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (bytes[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n return (results, address(0));\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes[] memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (bytes[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n result = LowLevelCallUtils.functionStaticCall(address(target), data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = revertData;\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _hasExtendedResolver(\n address resolver\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(\n type(IExtendedResolver).interfaceId\n )\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (bytes[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _hasExtendedResolver(multicallData.resolver);\n\n require(\n !multicallData.isWildcard || hasExtendedResolver,\n \"UniversalResolver: Wildcard on non-extended resolvers is not supported\"\n );\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = item;\n continue;\n }\n if (!isCallback && hasExtendedResolver) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = returnData;\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1300 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/solcInputs/3fa59c31b7672c86eff32031f5a10f8a.json b/solidity/dns-contracts/deployments/mainnet/solcInputs/3fa59c31b7672c86eff32031f5a10f8a.json new file mode 100644 index 0000000..22e0580 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/solcInputs/3fa59c31b7672c86eff32031f5a10f8a.json @@ -0,0 +1,428 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(\n uint16 _expectedType,\n bytes memory _expectedName,\n uint32 _inception,\n uint64 _inserted,\n bytes memory _proof\n ) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if (_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(\n uint16 dnstype,\n bytes memory name\n ) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyExtendedDNSSECResolver is IExtendedDNSResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes memory /* name */,\n bytes memory /* data */,\n bytes memory context\n ) external view override returns (bytes memory) {\n return abi.encode(context);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyLegacyTextResolver is ITextResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(ITextResolver).interfaceId;\n }\n\n function text(\n bytes32 /* node */,\n string calldata key\n ) external view override returns (string memory) {\n return key;\n }\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver {\n using RRUtils for *;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, data)\n );\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query) = abi.decode(\n extraData,\n (bytes, bytes)\n );\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n IExtendedDNSResolver(dnsresolver).resolve(\n name,\n query,\n context\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return IExtendedResolver(dnsresolver).resolve(name, query);\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (bytes memory key, bytes memory value, uint256 nextOffset)\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = input.length;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n nextOffset = terminator + 1;\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256[3] memory P) {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (uint256 x, uint256 y, uint256 z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(\n uint256 x0,\n uint256 y0\n ) internal pure returns (bool isZero) {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(\n uint256 scalar\n ) internal pure returns (uint256, uint256) {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(\n bytes calldata,\n bytes calldata\n ) external pure override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input\n )\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n )\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(\n RRUtils.SignedSet memory rrset,\n uint16 typecovered\n ) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if (address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns (bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 {\n totallen := add(totallen, 64)\n }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for {\n let i := 0\n } lt(i, totallen) {\n i := add(i, 64)\n } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 {\n mstore8(add(scratch, sub(len, i)), 0x80)\n }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 {\n mstore(\n add(scratch, 32),\n or(mload(add(scratch, 32)), mul(len, 8))\n )\n }\n\n // Expand the 16 32-bit words into 80\n for {\n let j := 64\n } lt(j, 128) {\n j := add(j, 12)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 12))),\n mload(add(scratch, sub(j, 32)))\n ),\n xor(\n mload(add(scratch, sub(j, 56))),\n mload(add(scratch, sub(j, 64)))\n )\n )\n temp := or(\n and(\n mul(temp, 2),\n 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE\n ),\n and(\n div(temp, 0x80000000),\n 0x0000000100000001000000010000000100000001000000010000000100000001\n )\n )\n mstore(add(scratch, j), temp)\n }\n for {\n let j := 128\n } lt(j, 320) {\n j := add(j, 24)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 24))),\n mload(add(scratch, sub(j, 64)))\n ),\n xor(\n mload(add(scratch, sub(j, 112))),\n mload(add(scratch, sub(j, 128)))\n )\n )\n temp := or(\n and(\n mul(temp, 4),\n 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC\n ),\n and(\n div(temp, 0x40000000),\n 0x0000000300000003000000030000000300000003000000030000000300000003\n )\n )\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for {\n let j := 0\n } lt(j, 80) {\n j := add(j, 1)\n } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(\n div(x, 0x100000000000000000000),\n div(x, 0x10000000000)\n )\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := and(div(x, 0x10000000000), f)\n f := or(\n and(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n ),\n f\n )\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(\n div(\n x,\n 0x80000000000000000000000000000000000000000000000\n ),\n 0x1F\n )\n temp := or(\n and(\n div(x, 0x800000000000000000000000000000000000000),\n 0xFFFFFFE0\n ),\n temp\n )\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(\n div(\n mload(add(scratch, mul(j, 4))),\n 0x100000000000000000000000000000000000000000000000000000000\n ),\n temp\n )\n x := or(\n div(x, 0x10000000000),\n mul(temp, 0x10000000000000000000000000000000000000000)\n )\n x := or(\n and(\n x,\n 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF\n ),\n mul(\n or(\n and(div(x, 0x4000000000000), 0xC0000000),\n and(div(x, 0x400000000000000000000), 0x3FFFFFFF)\n ),\n 0x100000000000000000000\n )\n )\n }\n\n h := and(\n add(h, x),\n 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF\n )\n }\n ret := mul(\n or(\n or(\n or(\n or(\n and(\n div(h, 0x100000000),\n 0xFFFFFFFF00000000000000000000000000000000\n ),\n and(\n div(h, 0x1000000),\n 0xFFFFFFFF000000000000000000000000\n )\n ),\n and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)\n ),\n and(div(h, 0x100), 0xFFFFFFFF00000000)\n ),\n and(h, 0xFFFFFFFF)\n ),\n 0x1000000000000000000000000\n )\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/ILinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface ILinearPremiumPriceOracle {\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256);\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns (address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping(bytes32 => address) addresses;\n\n constructor() public {}\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Implements a dummy NameWrapper which returns the caller's address\n */\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ReverseClaimer\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external; \n\n function approve(bytes32 node, address delegate, bool approved) external; \n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(address owner, bytes32 node, address delegate) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/TestHexUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {HexUtils} from \"./HexUtils.sol\";\n\ncontract TestHexUtils {\n using HexUtils for *;\n\n function hexStringToBytes32(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes32, bool) {\n return name.hexStringToBytes32(idx, lastInx);\n }\n\n function hexToAddress(\n bytes calldata input,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (address, bool) {\n return input.hexToAddress(idx, lastInx);\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(\n string memory name\n ) public pure returns (bytes memory, bytes32) {\n return name.dnsEncodeName();\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (bytes[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, ) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n return (results, address(0));\n }\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes[] memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (bytes[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n result = LowLevelCallUtils.functionStaticCall(address(target), data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = revertData;\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return The Resolver responsible for this name, and the namehash of the full name.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32) {\n (address resolver, bytes32 labelhash) = findResolver(name, 0);\n return (Resolver(resolver), labelhash);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0));\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (address parentresolver, bytes32 parentnode) = findResolver(\n name,\n nextLabel\n );\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node);\n }\n return (parentresolver, node);\n }\n\n function _hasExtendedResolver(\n address resolver\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface(\n type(IExtendedResolver).interfaceId\n )\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (bytes[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _hasExtendedResolver(multicallData.resolver);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = item;\n continue;\n }\n if (!isCallback && hasExtendedResolver) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = returnData;\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(\n name,\n wrappedOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable,\n ReverseClaimer\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE and set expiry to max */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the owner of a name\n * @param id Namehash of the name\n * @return operator Approved operator of a name\n */\n\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /**\n * @notice Approves an address for a name\n * @param to address to approve\n * @param tokenId name to approve\n */\n\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or operator of the owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or operator\n */\n\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Checks if owner/operator or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner/operator or approved\n */\n\n function canExtendSubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public returns (uint64 expiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // Set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (!_isWrapped(node)) {\n revert NameIsNotWrapped();\n }\n\n // this flag is used later, when checking fuses\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // Max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n address approved = getApproved(uint256(node));\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(parentNode, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /**\n * @notice Checks if a name is wrapped in a more gas efficient way\n * @param parentNode Namehash of the name\n * @param labelhash Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != ETH_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + }, + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external view override returns (bool) {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32, uint256) {\n return name.readLabel(offset);\n }\n\n function namehash(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32) {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\n \"\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n require(\n \"foo\".keccak(0, 3) ==\n bytes32(\n 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d\n ),\n \"Incorrect hash of 'foo'\"\n );\n require(\n \"foo\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\n \"hello\".equals(1, \"ello\") == true,\n \"Substring to string equality\"\n );\n require(\n \"hello\".equals(1, \"jello\", 1, 4) == true,\n \"Substring to substring equality\"\n );\n require(\n \"zhello\".equals(1, \"abchello\", 3) == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"0x0102030000\".equals(0, \"0x010203\") == false,\n \"Compare with offset and trailing bytes\"\n );\n }\n\n function testComparePartial() public pure {\n require(\n \"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true,\n \"Compare same length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true,\n \"Compare different length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true,\n \"Compare same with different offset\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 33\n ) ==\n 0 ==\n true,\n \"Compare different long strings same length smaller partial length which must be equal\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 34\n ) <\n 0 ==\n true,\n \"Compare long strings same length different partial length\"\n );\n require(\n \"0123456789012345012345678901234a\".compare(\n 0,\n 32,\n \"0123456789012345012345678901234b\",\n 0,\n 32\n ) <\n 0 ==\n true,\n \"Compare strings exactly 32 characters long\"\n );\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\n \"a\".compare(\"b\") < 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"b\".compare(\"a\") > 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"aa\".compare(\"ab\") < 0 == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"a\".compare(\"aa\") < 0 == true,\n \"Compare different value with different length\"\n );\n require(\n \"aa\".compare(\"a\") > 0 == true,\n \"Compare different value with different length\"\n );\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(\n longChar.compare(longChar) == 0 == true,\n \"Compares more than 32 bytes char\"\n );\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(\n longChar.compare(otherLongChar) < 0 == true,\n \"Compare long char with difference at start\"\n );\n }\n\n function testSubstring() public pure {\n require(\n keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")),\n \"Copy 0 bytes\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 4))) ==\n keccak256(bytes(\"hell\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(1, 4))) ==\n keccak256(bytes(\"ello\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 5))) ==\n keccak256(bytes(\"hello\")),\n \"Copy whole string\"\n );\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(\n bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) ==\n bytes32(\n 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000\n ),\n \"readBytes20\"\n );\n }\n\n function testReadBytes32() public pure {\n require(\n \"0123456789abcdef0123456789abcdef\".readBytes32(0) ==\n bytes32(\n 0x3031323334353637383961626364656630313233343536373839616263646566\n ),\n \"readBytes32\"\n );\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\n \"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")),\n \"Decode 'a'\"\n );\n require(\n \"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")),\n \"Decode 'aa'\"\n );\n require(\n \"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")),\n \"Decode 'aaa'\"\n );\n require(\n \"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")),\n \"Decode 'aaaa'\"\n );\n require(\n \"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa'\"\n );\n require(\n \"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa' lowercase\"\n );\n require(\n \"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet\"\n );\n require(\n \"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet lowercase\"\n );\n require(\n \"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\"\n .base32HexDecodeWord(0, 52) ==\n bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"),\n \"Decode 32*'a'\"\n );\n require(\n \" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\"\n .base32HexDecodeWord(1, 32) ==\n bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"),\n \"Decode real bytes32hex\"\n );\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex\"00\".nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex\"00\".labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex\"016100\".labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(\n hex\"016201610000\".labelCount(0) == 2,\n \"labelCount('b.a.') == 2\"\n );\n require(\n hex\"066574686c61620378797a00\".labelCount(6 + 1) == 1,\n \"nameLength('(bthlab).xyz.') == 6\"\n );\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes\n memory rrs = hex\"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101\";\n bytes[2] memory names = [bytes(hex\"016100\"), bytes(hex\"0162016100\")];\n bytes[2] memory rdatas = [bytes(hex\"74000001\"), bytes(hex\"c0a80101\")];\n uint i = 0;\n for (\n RRUtils.RRIterator memory iter = rrs.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(\n keccak256(iter.name()) == keccak256(names[i]),\n \"Name matches\"\n );\n require(\n keccak256(iter.rdata()) == keccak256(rdatas[i]),\n \"Rdata matches\"\n );\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex\"066274686c61620378797a00\";\n bytes memory ethLabXyz = hex\"066574686c61620378797a00\";\n bytes memory xyz = hex\"0378797a00\";\n bytes memory a_b_c = hex\"01610162016300\";\n bytes memory b_b_c = hex\"01620162016300\";\n bytes memory c = hex\"016300\";\n bytes memory d = hex\"016400\";\n bytes memory a_d_c = hex\"01610164016300\";\n bytes memory b_a_c = hex\"01620161016300\";\n bytes memory ab_c_d = hex\"0261620163016400\";\n bytes memory a_c_d = hex\"01610163016400\";\n bytes\n memory verylong1_eth = hex\"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n bytes\n memory verylong2_eth = hex\"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n\n require(\n hex\"0301616100\".compareNames(hex\"0302616200\") < 0,\n \"label lengths are correctly checked\"\n );\n require(\n a_b_c.compareNames(c) > 0,\n \"one name has a difference of >1 label to with the same root name\"\n );\n require(\n a_b_c.compareNames(d) < 0,\n \"one name has a difference of >1 label to with different root name\"\n );\n require(\n a_b_c.compareNames(a_d_c) < 0,\n \"two names start the same but have differences in later labels\"\n );\n require(\n a_b_c.compareNames(b_a_c) > 0,\n \"the first label sorts later, but the first label sorts earlier\"\n );\n require(\n ab_c_d.compareNames(a_c_d) > 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(\n a_b_c.compareNames(b_b_c) < 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(\n bthLabXyz.compareNames(ethLabXyz) < 0,\n \"bthLab.xyz comes before ethLab.xyz\"\n );\n require(\n bthLabXyz.compareNames(bthLabXyz) == 0,\n \"bthLab.xyz and bthLab.xyz are the same\"\n );\n require(\n ethLabXyz.compareNames(bthLabXyz) > 0,\n \"ethLab.xyz comes after bethLab.xyz\"\n );\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(\n verylong1_eth.compareNames(verylong2_eth) > 0,\n \"longa.vlong.eth comes after long.vlong.eth\"\n );\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(\n RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA),\n \"0x11111111 >= 0xAAAAAAAA\"\n );\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(\n hex\"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d\"\n .computeKeytag() == 19036,\n \"Invalid keytag\"\n );\n require(\n hex\"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf\"\n .computeKeytag() == 21693,\n \"Invalid keytag (2)\"\n );\n require(\n hex\"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3\"\n .computeKeytag() == 33630\n );\n require(\n hex\"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5\"\n .computeKeytag() == 20326,\n \"Invalid keytag (3)\"\n );\n }\n}\n" + }, + "test/registry/mocks/DummyResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyResolver {\n mapping(bytes32 => string) public name;\n\n function setName(bytes32 node, string memory _name) public {\n name[node] = _name;\n }\n}\n" + }, + "test/reverseRegistrar/mocks/MockReverseClaimerImplementer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../../../contracts/registry/ENS.sol\";\nimport {ReverseClaimer} from \"../../../contracts/reverseRegistrar/ReverseClaimer.sol\";\n\ncontract MockReverseClaimerImplementer is ReverseClaimer {\n constructor(ENS ens, address claimant) ReverseClaimer(ens, claimant) {}\n}\n" + }, + "test/utils/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n if (bytes4(extraData) == bytes4(keccak256(\"name(bytes32)\"))) {\n return abi.encode(\"offchain.test.eth\");\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "test/utils/mocks/LegacyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\ncontract LegacyResolver {\n function addr(bytes32 /* node */) public view returns (address) {\n return address(this);\n }\n}\n" + }, + "test/utils/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10 ** uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10 ** uint256(decimals()));\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1300 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/solcInputs/40ce5451dce8f428cafdaca8fb82d91d.json b/solidity/dns-contracts/deployments/mainnet/solcInputs/40ce5451dce8f428cafdaca8fb82d91d.json new file mode 100644 index 0000000..35a61d4 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/solcInputs/40ce5451dce8f428cafdaca8fb82d91d.json @@ -0,0 +1,263 @@ +{ + "language": "Solidity", + "sources": { + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n\n using BytesUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(DNSSEC oracle, bytes memory name, bytes memory proof)\n internal\n view\n returns (address, bool)\n {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n bytes20 hash;\n uint32 expiration;\n // Check the provided TXT record has been validated by the oracle\n (, expiration, hash) = oracle.rrdata(TYPE_TXT, buf.buf);\n if (hash == bytes20(0) && proof.length == 0) return (address(0x0), false);\n\n require(hash == bytes20(keccak256(proof)));\n\n for (RRUtils.RRIterator memory iter = proof.iterateRRs(0); !iter.done(); iter.next()) {\n require(RRUtils.serialNumberGte(expiration + iter.ttl, uint32(block.timestamp)), \"DNS record is stale; refresh or delete it before proceeding.\");\n\n bool found;\n address addr;\n (addr, found) = parseRR(proof, iter.rdataOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(bytes memory rdata, uint idx) internal pure returns (address, bool) {\n while (idx < rdata.length) {\n uint len = rdata.readUint8(idx); idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(bytes memory str, uint idx, uint len) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n if (len < 44) return (address(0x0), false);\n return hexToAddress(str, idx + 4);\n }\n\n function hexToAddress(bytes memory str, uint idx) internal pure returns (address, bool) {\n if (str.length - idx < 40) return (address(0x0), false);\n uint ret = 0;\n for (uint i = idx; i < idx + 40; i++) {\n ret <<= 4;\n uint x = str.readUint8(i);\n if (x >= 48 && x < 58) {\n ret |= x - 48;\n } else if (x >= 65 && x < 71) {\n ret |= x - 55;\n } else if (x >= 97 && x < 103) {\n ret |= x - 87;\n } else {\n return (address(0x0), false);\n }\n }\n return (address(uint160(ret)), true);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n event NSEC3DigestUpdated(uint8 id, address addr);\n event RRSetUpdated(bytes name, bytes rrset);\n\n function submitRRSets(RRSetWithSignature[] memory input, bytes calldata proof) public virtual returns (bytes memory);\n function submitRRSet(RRSetWithSignature calldata input, bytes calldata proof) public virtual returns (bytes memory);\n function deleteRRSet(uint16 deleteType, bytes calldata deleteName, RRSetWithSignature calldata nsec, bytes calldata proof) public virtual;\n function deleteRRSetNSEC3(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory closestEncloser, RRSetWithSignature memory nextClosest, bytes memory dnskey) public virtual;\n function rrdata(uint16 dnstype, bytes calldata name) external virtual view returns (uint32, uint32, bytes20);\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\n uint shortest = len;\n if (otherlen < len)\n shortest = otherlen;\n\n uint selfptr;\n uint otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint idx = 0; idx < shortest; idx += 32) {\n uint a;\n uint b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint mask;\n if (shortest > 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\n }\n int diff = int(a & mask) - int(b & mask);\n if (diff != 0)\n return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int(len) - int(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\n return self.length == other.length && equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint dest, uint src, uint len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint dest;\n uint src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\n require(len <= 52);\n\n uint ret = 0;\n uint8 decoded;\n for(uint i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if(i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint bitlen = len * 5;\n if(len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if(len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if(len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if(len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if(len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n}" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n* @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n*/\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(bytes memory self, uint offset) internal pure returns(uint) {\n uint idx = offset;\n while (true) {\n assert(idx < self.length);\n uint labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(bytes memory self, uint offset) internal pure returns(bytes memory ret) {\n uint len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(bytes memory self, uint offset) internal pure returns(uint) {\n uint count = 0;\n while (true) {\n assert(offset < self.length);\n uint labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint constant RRSIG_TYPE = 0;\n uint constant RRSIG_ALGORITHM = 2;\n uint constant RRSIG_LABELS = 3;\n uint constant RRSIG_TTL = 4;\n uint constant RRSIG_EXPIRATION = 8;\n uint constant RRSIG_INCEPTION = 12;\n uint constant RRSIG_KEY_TAG = 16;\n uint constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(bytes memory data) internal pure returns(SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(RRSIG_SIGNER_NAME + self.signerName.length, data.length - RRSIG_SIGNER_NAME - self.signerName.length);\n }\n\n function rrs(SignedSet memory rrset) internal pure returns(RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint rdataOffset;\n uint nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(bytes memory self, uint offset) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns(bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns(bytes memory) {\n return iter.data.substring(iter.offset, nameLength(iter.data, iter.offset));\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(RRIterator memory iter) internal pure returns(bytes memory) {\n return iter.data.substring(iter.rdataOffset, iter.nextOffset - iter.rdataOffset);\n }\n\n uint constant DNSKEY_FLAGS = 0;\n uint constant DNSKEY_PROTOCOL = 2;\n uint constant DNSKEY_ALGORITHM = 3;\n uint constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(bytes memory data, uint offset, uint length) internal pure returns(DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(offset + DNSKEY_PUBKEY, length - DNSKEY_PUBKEY);\n } \n\n uint constant DS_KEY_TAG = 0;\n uint constant DS_ALGORITHM = 2;\n uint constant DS_DIGEST_TYPE = 3;\n uint constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(bytes memory data, uint offset, uint length) internal pure returns(DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n struct NSEC3 {\n uint8 hashAlgorithm;\n uint8 flags;\n uint16 iterations;\n bytes salt;\n bytes32 nextHashedOwnerName;\n bytes typeBitmap;\n }\n\n uint constant NSEC3_HASH_ALGORITHM = 0;\n uint constant NSEC3_FLAGS = 1;\n uint constant NSEC3_ITERATIONS = 2;\n uint constant NSEC3_SALT_LENGTH = 4;\n uint constant NSEC3_SALT = 5;\n\n function readNSEC3(bytes memory data, uint offset, uint length) internal pure returns(NSEC3 memory self) {\n uint end = offset + length;\n self.hashAlgorithm = data.readUint8(offset + NSEC3_HASH_ALGORITHM);\n self.flags = data.readUint8(offset + NSEC3_FLAGS);\n self.iterations = data.readUint16(offset + NSEC3_ITERATIONS);\n uint8 saltLength = data.readUint8(offset + NSEC3_SALT_LENGTH);\n offset = offset + NSEC3_SALT;\n self.salt = data.substring(offset, saltLength);\n offset += saltLength;\n uint8 nextLength = data.readUint8(offset);\n require(nextLength <= 32);\n offset += 1;\n self.nextHashedOwnerName = data.readBytesN(offset, nextLength);\n offset += nextLength;\n self.typeBitmap = data.substring(offset, end - offset);\n }\n\n function checkTypeBitmap(NSEC3 memory self, uint16 rrtype) internal pure returns(bool) {\n return checkTypeBitmap(self.typeBitmap, 0, rrtype);\n }\n\n /**\n * @dev Checks if a given RR type exists in a type bitmap.\n * @param bitmap The byte string to read the type bitmap from.\n * @param offset The offset to start reading at.\n * @param rrtype The RR type to check for.\n * @return True if the type is found in the bitmap, false otherwise.\n */\n function checkTypeBitmap(bytes memory bitmap, uint offset, uint16 rrtype) internal pure returns (bool) {\n uint8 typeWindow = uint8(rrtype >> 8);\n uint8 windowByte = uint8((rrtype & 0xff) / 8);\n uint8 windowBitmask = uint8(uint8(1) << (uint8(7) - uint8(rrtype & 0x7)));\n for (uint off = offset; off < bitmap.length;) {\n uint8 window = bitmap.readUint8(off);\n uint8 len = bitmap.readUint8(off + 1);\n if (typeWindow < window) {\n // We've gone past our window; it's not here.\n return false;\n } else if (typeWindow == window) {\n // Check this type bitmap\n if (len <= windowByte) {\n // Our type is past the end of the bitmap\n return false;\n }\n return (bitmap.readUint8(off + windowByte + 2) & windowBitmask) != 0;\n } else {\n // Skip this type bitmap\n off += len + 2;\n }\n }\n\n return false;\n }\n\n function compareNames(bytes memory self, bytes memory other) internal pure returns (int) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint off;\n uint otheroff;\n uint prevoff;\n uint otherprevoff;\n uint counts = labelCount(self, 0);\n uint othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if(otheroff == 0) {\n return 1;\n }\n\n return self.compare(prevoff + 1, self.readUint8(prevoff), other, otherprevoff + 1, other.readUint8(otherprevoff));\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(uint32 i1, uint32 i2) internal pure returns(bool) {\n return int32(i1) - int32(i2) >= 0;\n }\n\n function progress(bytes memory body, uint off) internal pure returns(uint) {\n return off + 1 + body.readUint8(off);\n }\n}" + }, + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\n\ninterface IDNSRegistrar {\n function claim(bytes memory name, bytes memory proof) external;\n function proveAndClaim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof) external;\n function proveAndClaimWithResolver(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof, address resolver, address addr) external;\n}\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar {\n using BytesUtils for bytes;\n\n DNSSEC public oracle;\n ENS public ens;\n PublicSuffixList public suffixes;\n\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event Claim(bytes32 indexed node, address indexed owner, bytes dnsname);\n event NewOracle(address oracle);\n event NewPublicSuffixList(address suffixes);\n\n constructor(DNSSEC _dnssec, PublicSuffixList _suffixes, ENS _ens) {\n oracle = _dnssec;\n emit NewOracle(address(oracle));\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setOracle(DNSSEC _dnssec) public onlyOwner {\n oracle = _dnssec;\n emit NewOracle(address(oracle));\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Claims a name by proving ownership of its DNS equivalent.\n * @param name The name to claim, in DNS wire format.\n * @param proof A DNS RRSet proving ownership of the name. Must be verified\n * in the DNSSEC oracle before calling. This RRSET must contain a TXT\n * record for '_ens.' + name, with the value 'a=0x...'. Ownership of\n * the name will be transferred to the address specified in the TXT\n * record.\n */\n function claim(bytes memory name, bytes memory proof) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(name, proof);\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input The data to be passed to the Oracle's `submitProofs` function. The last\n * proof must be the TXT record required by the registrar.\n * @param proof The proof record for the first element in input.\n */\n function proveAndClaim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof) public override {\n proof = oracle.submitRRSets(input, proof);\n claim(name, proof);\n }\n\n function proveAndClaimWithResolver(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof, address resolver, address addr) public override {\n proof = oracle.submitRRSets(input, proof);\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(name, proof);\n require(msg.sender == owner, \"Only owner can call proveAndClaimWithResolver\");\n if(addr != address(0)) {\n require(resolver != address(0), \"Cannot set addr if resolver is not set\");\n // Set ourselves as the owner so we can set a record on the resolver\n ens.setSubnodeRecord(rootNode, labelHash, address(this), resolver, 0);\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n // Transfer the record to the owner\n ens.setOwner(node, owner);\n } else {\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n }\n }\n\n function supportsInterface(bytes4 interfaceID) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(bytes memory name, bytes memory proof) internal returns(bytes32 rootNode, bytes32 labelHash, address addr) {\n // Get the first label\n uint labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n // Parent name must be in the public suffix list.\n bytes memory parentName = name.substring(labelLen + 1, name.length - labelLen - 1);\n require(suffixes.isPublicSuffix(parentName), \"Parent name must be a public suffix\");\n\n // Make sure the parent name is enabled\n rootNode = enableNode(parentName, 0);\n\n (addr,) = DNSClaimChecker.getOwnerAddress(oracle, name, proof);\n\n emit Claim(keccak256(abi.encodePacked(rootNode, labelHash)), addr, name);\n }\n\n function enableNode(bytes memory domain, uint offset) internal returns(bytes32 node) {\n uint len = domain.readUint8(offset);\n if(len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n require(owner == address(0) || owner == address(this), \"Cannot enable a name owned by someone else\");\n if(owner != address(this)) {\n if(parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n } else {\n ens.setSubnodeOwner(parentNode, label, address(this));\n }\n }\n return node;\n }\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping (bytes32 => Record) records;\n mapping (address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(bytes32 node, address owner) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public virtual override authorised(node) returns(bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(bytes32 node, address resolver) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(bytes32 node, uint64 ttl) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(address operator, bool approved) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public virtual override view returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public virtual override view returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public virtual override view returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(bytes32 node) public virtual override view returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(address owner, address operator) external virtual override view returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(bytes32 node, address resolver, uint64 ttl) internal {\n if(resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if(ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(bytes32 label, address owner)\n external\n onlyController\n {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns(bool);\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract AddrResolver is ResolverBase {\n bytes4 constant private ADDR_INTERFACE_ID = 0x3b3b57de;\n bytes4 constant private ADDRESS_INTERFACE_ID = 0xf1cb7e06;\n uint constant private COIN_TYPE_ETH = 60;\n\n event AddrChanged(bytes32 indexed node, address a);\n event AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress);\n\n mapping(bytes32=>mapping(uint=>bytes)) _addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(bytes32 node, address a) external authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) public view returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if(a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(bytes32 node, uint coinType, bytes memory a) public authorised(node) {\n emit AddressChanged(node, coinType, a);\n if(coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n _addresses[node][coinType] = a;\n }\n\n function addr(bytes32 node, uint coinType) public view returns(bytes memory) {\n return _addresses[node][coinType];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == ADDR_INTERFACE_ID || interfaceID == ADDRESS_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(bytes memory b) internal pure returns(address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns(bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual;\n function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual;\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external virtual returns(bytes32);\n function setResolver(bytes32 node, address resolver) external virtual;\n function setOwner(bytes32 node, address owner) external virtual;\n function setTTL(bytes32 node, uint64 ttl) external virtual;\n function setApprovalForAll(address operator, bool approved) external virtual;\n function owner(bytes32 node) external virtual view returns (address);\n function resolver(bytes32 node) external virtual view returns (address);\n function ttl(bytes32 node) external virtual view returns (uint64);\n function recordExists(bytes32 node) external virtual view returns (bool);\n function isApprovedForAll(address owner, address operator) external virtual view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor () {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "pragma solidity >=0.8.4;\nabstract contract ResolverBase {\n bytes4 private constant INTERFACE_META_ID = 0x01ffc9a7;\n\n function supportsInterface(bytes4 interfaceID) virtual public pure returns(bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n\n function isAuthorised(bytes32 node) internal virtual view returns(bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\n\ninterface INameWrapper {\n function ownerOf(uint256 id) external view returns (address);\n}\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver {\n ENS ens;\n INameWrapper nameWrapper;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n constructor(ENS _ens, INameWrapper wrapperAddress){\n ens = _ens;\n nameWrapper = wrapperAddress;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external{\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n function isAuthorised(bytes32 node) internal override view returns(bool) {\n address owner = ens.owner(node);\n if(owner == address(nameWrapper) ){\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return owner == msg.sender || isApprovedForAll(owner, msg.sender);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator) public view returns (bool){\n return _operatorApprovals[account][operator];\n }\n\n function multicall(bytes[] calldata data) external returns(bytes[] memory results) {\n results = new bytes[](data.length);\n for(uint i = 0; i < data.length; i++) {\n (bool success, bytes memory result) = address(this).delegatecall(data[i]);\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override(ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver) public pure returns(bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is ResolverBase {\n bytes4 constant private ABI_INTERFACE_ID = 0x2203ab56;\n\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n mapping(bytes32=>mapping(uint256=>bytes)) abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(bytes32 node, uint256 contentType, bytes calldata data) external authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n abis[node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(bytes32 node, uint256 contentTypes) external view returns (uint256, bytes memory) {\n mapping(uint256=>bytes) storage abiset = abis[node];\n\n for (uint256 contentType = 1; contentType <= contentTypes; contentType <<= 1) {\n if ((contentType & contentTypes) != 0 && abiset[contentType].length > 0) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == ABI_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract ContentHashResolver is ResolverBase {\n bytes4 constant private CONTENT_HASH_INTERFACE_ID = 0xbc1c58d1;\n\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n mapping(bytes32=>bytes) hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(bytes32 node, bytes calldata hash) external authorised(node) {\n hashes[node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory) {\n return hashes[node];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == CONTENT_HASH_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\n\nabstract contract DNSResolver is ResolverBase {\n using RRUtils for *;\n using BytesUtils for bytes;\n\n bytes4 constant private DNS_RECORD_INTERFACE_ID = 0xa8fa5682;\n bytes4 constant private DNS_ZONE_INTERFACE_ID = 0x5c47637c;\n\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(bytes32 indexed node, bytes name, uint16 resource, bytes record);\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n // DNSZoneCleared is emitted whenever a given node's zone information is cleared.\n event DNSZoneCleared(bytes32 indexed node);\n\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(bytes32 indexed node, bytes lastzonehash, bytes zonehash);\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(bytes32=>bytes) private zonehashes;\n\n // Version the mapping for each zone. This allows users who have lost\n // track of their entries to effectively delete an entire zone by bumping\n // the version number.\n // node => version\n mapping(bytes32=>uint256) private versions;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(bytes32=>mapping(uint256=>mapping(bytes32=>mapping(uint16=>bytes)))) private records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(bytes32=>mapping(uint256=>mapping(bytes32=>uint16))) private nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(bytes32 node, bytes calldata data) external authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n // Iterate over the data to add the resource records\n for (RRUtils.RRIterator memory iter = data.iterateRRs(0); !iter.done(); iter.next()) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(node, name, resource, data, offset, iter.offset - offset, value.length == 0);\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(node, name, resource, data, offset, data.length - offset, value.length == 0);\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(bytes32 node, bytes32 name, uint16 resource) public view returns (bytes memory) {\n return records[node][versions[node]][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(bytes32 node, bytes32 name) public view returns (bool) {\n return (nameEntriesCount[node][versions[node]][name] != 0);\n }\n\n /**\n * Clear all information for a DNS zone.\n * @param node the namehash of the node for which to clear the zone\n */\n function clearDNSZone(bytes32 node) public authorised(node) {\n versions[node]++;\n emit DNSZoneCleared(node);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(bytes32 node, bytes calldata hash) external authorised(node) {\n bytes memory oldhash = zonehashes[node];\n zonehashes[node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory) {\n return zonehashes[node];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == DNS_RECORD_INTERFACE_ID ||\n interfaceID == DNS_ZONE_INTERFACE_ID ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord) private\n {\n uint256 version = versions[node];\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (records[node][version][nameHash][resource].length != 0) {\n nameEntriesCount[node][version][nameHash]--;\n }\n delete(records[node][version][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (records[node][version][nameHash][resource].length == 0) {\n nameEntriesCount[node][version][nameHash]++;\n }\n records[node][version][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\n\nabstract contract InterfaceResolver is ResolverBase, AddrResolver {\n bytes4 constant private INTERFACE_INTERFACE_ID = bytes4(keccak256(\"interfaceImplementer(bytes32,bytes4)\"));\n bytes4 private constant INTERFACE_META_ID = 0x01ffc9a7;\n\n event InterfaceChanged(bytes32 indexed node, bytes4 indexed interfaceID, address implementer);\n\n mapping(bytes32=>mapping(bytes4=>address)) interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(bytes32 node, bytes4 interfaceID, address implementer) external authorised(node) {\n interfaces[node][interfaceID] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(bytes32 node, bytes4 interfaceID) external view returns (address) {\n address implementer = interfaces[node][interfaceID];\n if(implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if(a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(abi.encodeWithSignature(\"supportsInterface(bytes4)\", INTERFACE_META_ID));\n if(!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID));\n if(!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override(AddrResolver, ResolverBase) public pure returns(bool) {\n return interfaceID == INTERFACE_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract NameResolver is ResolverBase {\n bytes4 constant private NAME_INTERFACE_ID = 0x691f3431;\n\n event NameChanged(bytes32 indexed node, string name);\n\n mapping(bytes32=>string) names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param name The name to set.\n */\n function setName(bytes32 node, string calldata name) external authorised(node) {\n names[node] = name;\n emit NameChanged(node, name);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory) {\n return names[node];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == NAME_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract PubkeyResolver is ResolverBase {\n bytes4 constant private PUBKEY_INTERFACE_ID = 0xc8690233;\n\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(bytes32=>PublicKey) pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external authorised(node) {\n pubkeys[node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y) {\n return (pubkeys[node].x, pubkeys[node].y);\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == PUBKEY_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract TextResolver is ResolverBase {\n bytes4 constant private TEXT_INTERFACE_ID = 0x59d1d43c;\n\n event TextChanged(bytes32 indexed node, string indexed indexedKey, string key);\n\n mapping(bytes32=>mapping(string=>string)) texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(bytes32 node, string calldata key, string calldata value) external authorised(node) {\n texts[node][key] = value;\n emit TextChanged(node, key, key);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(bytes32 node, string calldata key) external view returns (string memory) {\n return texts[node][key];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == TEXT_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is Ownable, ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver {\n function isAuthorised(bytes32 node) internal override view returns(bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override(ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver) public pure returns(bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_NSEC = 47;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex'00'.nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex'0361626300'.nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex'0361626300'.nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex'00'.labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex'016100'.labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(hex'016201610000'.labelCount(0) == 2, \"labelCount('b.a.') == 2\");\n require(hex'066574686c61620378797a00'.labelCount(6 +1) == 1, \"nameLength('(bthlab).xyz.') == 6\");\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes memory rrs = hex'0161000001000100000e1000047400000101620161000001000100000e100004c0a80101';\n string[2] memory names = [hex'016100', hex'0162016100'];\n string[2] memory rdatas = [hex'74000001', hex'c0a80101'];\n uint i = 0;\n for(RRUtils.RRIterator memory iter = rrs.iterateRRs(0); !iter.done(); iter.next()) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(keccak256(iter.name()) == keccak256(bytes(names[i])), \"Name matches\");\n require(keccak256(iter.rdata()) == keccak256(bytes(rdatas[i])), \"Rdata matches\");\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n function testCheckTypeBitmapTextType() public pure {\n bytes memory tb = hex'0003000080';\n require(tb.checkTypeBitmap(0, DNSTYPE_TEXT) == true, \"A record should exist in type bitmap\");\n }\n\n function testCheckTypeBitmap() public pure {\n // From https://tools.ietf.org/html/rfc4034#section-4.3\n // alfa.example.com. 86400 IN NSEC host.example.com. (\n // A MX RRSIG NSEC TYPE1234\n bytes memory tb = hex'FF0006400100000003041b000000000000000000000000000000000000000000000000000020';\n\n // Exists in bitmap\n require(tb.checkTypeBitmap(1, DNSTYPE_A) == true, \"A record should exist in type bitmap\");\n // Does not exist, but in a window that is included\n require(tb.checkTypeBitmap(1, DNSTYPE_CNAME) == false, \"CNAME record should not exist in type bitmap\");\n // Does not exist, past the end of a window that is included\n require(tb.checkTypeBitmap(1, 64) == false, \"Type 64 should not exist in type bitmap\");\n // Does not exist, in a window that does not exist\n require(tb.checkTypeBitmap(1, 769) == false, \"Type 769 should not exist in type bitmap\");\n // Exists in a subsequent window\n require(tb.checkTypeBitmap(1, DNSTYPE_TYPE1234) == true, \"Type 1234 should exist in type bitmap\");\n // Does not exist, past the end of the bitmap windows\n require(tb.checkTypeBitmap(1, 1281) == false, \"Type 1281 should not exist in type bitmap\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex'066274686c61620378797a00';\n bytes memory ethLabXyz = hex'066574686c61620378797a00';\n bytes memory xyz = hex'0378797a00';\n bytes memory a_b_c = hex'01610162016300';\n bytes memory b_b_c = hex'01620162016300';\n bytes memory c = hex'016300';\n bytes memory d = hex'016400';\n bytes memory a_d_c = hex'01610164016300';\n bytes memory b_a_c = hex'01620161016300';\n bytes memory ab_c_d = hex'0261620163016400';\n bytes memory a_c_d = hex'01610163016400';\n\n require(hex'0301616100'.compareNames(hex'0302616200') < 0, \"label lengths are correctly checked\");\n require(a_b_c.compareNames(c) > 0, \"one name has a difference of >1 label to with the same root name\");\n require(a_b_c.compareNames(d) < 0, \"one name has a difference of >1 label to with different root name\");\n require(a_b_c.compareNames(a_d_c) < 0, \"two names start the same but have differences in later labels\");\n require(a_b_c.compareNames(b_a_c) > 0, \"the first label sorts later, but the first label sorts earlier\");\n require(ab_c_d.compareNames(a_c_d) > 0, \"two names where the first label on one is a prefix of the first label on the other\");\n require(a_b_c.compareNames(b_b_c) < 0, \"two names where the first label on one is a prefix of the first label on the other\");\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(bthLabXyz.compareNames(ethLabXyz) < 0, \"bthLab.xyz comes before ethLab.xyz\");\n require(bthLabXyz.compareNames(bthLabXyz) == 0, \"bthLab.xyz and bthLab.xyz are the same\");\n require(ethLabXyz.compareNames(bthLabXyz) > 0, \"ethLab.xyz comes after bethLab.xyz\");\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA), \"0x11111111 >= 0xAAAAAAAA\");\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n}" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\"\".keccak(0, 0) == bytes32(0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470), \"Incorrect hash of empty string\");\n require(\"foo\".keccak(0, 3) == bytes32(0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d), \"Incorrect hash of 'foo'\");\n require(\"foo\".keccak(0, 0) == bytes32(0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470), \"Incorrect hash of empty string\");\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\"hello\".equals(1, \"ello\") == true, \"Substring to string equality\");\n require(\"hello\".equals(1, \"jello\", 1, 4) == true, \"Substring to substring equality\");\n require(\"zhello\".equals(1, \"abchello\", 3) == true, \"Compare different value with multiple length\");\n }\n\n function testComparePartial() public pure {\n require(\"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true, \"Compare same length\");\n require(\"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true, \"Compare different length\");\n require(\"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true, \"Compare same with different offset\");\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\"a\".compare(\"b\") < 0 == true, \"Compare different value with same length\");\n require(\"b\".compare(\"a\") > 0 == true, \"Compare different value with same length\");\n require(\"aa\".compare(\"ab\") < 0 == true, \"Compare different value with multiple length\");\n require(\"a\".compare(\"aa\") < 0 == true, \"Compare different value with different length\");\n require(\"aa\".compare(\"a\") > 0 == true, \"Compare different value with different length\");\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(longChar.compare(longChar) == 0 == true, \"Compares more than 32 bytes char\");\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(longChar.compare(otherLongChar) < 0 == true, \"Compare long char with difference at start\");\n }\n\n function testSubstring() public pure {\n require(keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")), \"Copy 0 bytes\");\n require(keccak256(bytes(\"hello\".substring(0, 4))) == keccak256(bytes(\"hell\")), \"Copy substring\");\n require(keccak256(bytes(\"hello\".substring(1, 4))) == keccak256(bytes(\"ello\")), \"Copy substring\");\n require(keccak256(bytes(\"hello\".substring(0, 5))) == keccak256(bytes(\"hello\")), \"Copy whole string\");\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) == bytes32(0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000), \"readBytes20\");\n }\n\n function testReadBytes32() public pure {\n require(\"0123456789abcdef0123456789abcdef\".readBytes32(0) == bytes32(0x3031323334353637383961626364656630313233343536373839616263646566), \"readBytes32\");\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")), \"Decode 'a'\");\n require(\"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")), \"Decode 'aa'\");\n require(\"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")), \"Decode 'aaa'\");\n require(\"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")), \"Decode 'aaaa'\");\n require(\"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")), \"Decode 'aaaaa'\");\n require(\"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")), \"Decode 'aaaaa' lowercase\");\n require(\"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(0, 42) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")), \"Decode alphabet\");\n require(\"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(0, 42) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")), \"Decode alphabet lowercase\");\n require(\"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\".base32HexDecodeWord(0, 52) == bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"), \"Decode 32*'a'\");\n require(\" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\".base32HexDecodeWord(1, 32) == bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"), \"Decode real bytes32hex\");\n }\n}" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"./nsec3digests/NSEC3Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n *\n * TODO: Support for NSEC3 records\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_NS = 2;\n uint16 constant DNSTYPE_SOA = 6;\n uint16 constant DNSTYPE_DNAME = 39;\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_NSEC = 47;\n uint16 constant DNSTYPE_DNSKEY = 48;\n uint16 constant DNSTYPE_NSEC3 = 50;\n\n uint constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n uint8 constant ALGORITHM_RSASHA256 = 8;\n\n uint8 constant DIGEST_ALGORITHM_SHA256 = 2;\n\n struct RRSet {\n uint32 inception;\n uint32 expiration;\n bytes20 hash;\n }\n\n // (name, type) => RRSet\n mapping (bytes32 => mapping(uint16 => RRSet)) rrsets;\n\n mapping (uint8 => Algorithm) public algorithms;\n mapping (uint8 => Digest) public digests;\n mapping (uint8 => NSEC3Digest) public nsec3Digests;\n\n event Test(uint t);\n event Marker();\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n rrsets[keccak256(hex\"00\")][DNSTYPE_DS] = RRSet({\n inception: uint32(0),\n expiration: uint32(3767581600), // May 22 2089 - the latest date we can encode as of writing this\n hash: bytes20(keccak256(anchors))\n });\n emit RRSetUpdated(hex\"00\", anchors);\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Sets the contract address for an NSEC3 digest algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setNSEC3Digest(uint8 id, NSEC3Digest digest) public owner_only {\n nsec3Digests[id] = digest;\n emit NSEC3DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Submits multiple RRSets\n * @param input A list of RRSets and signatures forming a chain of trust from an existing known-good record.\n * @param _proof The DNSKEY or DS to validate the first signature against.\n * @return The last RRSET submitted.\n */\n function submitRRSets(RRSetWithSignature[] memory input, bytes calldata _proof) public override returns (bytes memory) {\n bytes memory proof = _proof;\n for(uint i = 0; i < input.length; i++) {\n proof = _submitRRSet(input[i], proof);\n }\n return proof;\n }\n\n /**\n * @dev Submits a signed set of RRs to the oracle.\n *\n * RRSETs are only accepted if they are signed with a key that is already\n * trusted, or if they are self-signed, and the signing key is identified by\n * a DS record that is already trusted.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against. Must Already\n * have been submitted and proved previously.\n */\n function submitRRSet(RRSetWithSignature memory input, bytes memory proof)\n public override\n returns (bytes memory)\n {\n return _submitRRSet(input, proof);\n }\n\n /**\n * @dev Deletes an RR from the oracle.\n *\n * @param deleteType The DNS record type to delete.\n * @param deleteName which you want to delete\n * @param nsec The signed NSEC RRset. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n */\n function deleteRRSet(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory nsec, bytes memory proof)\n public override\n {\n RRUtils.SignedSet memory rrset;\n rrset = validateSignedSet(nsec, proof);\n require(rrset.typeCovered == DNSTYPE_NSEC);\n\n // Don't let someone use an old proof to delete a new name\n require(RRUtils.serialNumberGte(rrset.inception, rrsets[keccak256(deleteName)][deleteType].inception));\n\n for (RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\n // We're dealing with three names here:\n // - deleteName is the name the user wants us to delete\n // - nsecName is the owner name of the NSEC record\n // - nextName is the next name specified in the NSEC record\n //\n // And three cases:\n // - deleteName equals nsecName, in which case we can delete the\n // record if it's not in the type bitmap.\n // - nextName comes after nsecName, in which case we can delete\n // the record if deleteName comes between nextName and nsecName.\n // - nextName comes before nsecName, in which case nextName is the\n // zone apex, and deleteName must come after nsecName.\n checkNsecName(iter, rrset.name, deleteName, deleteType);\n delete rrsets[keccak256(deleteName)][deleteType];\n return;\n }\n // We should never reach this point\n revert();\n }\n\n function checkNsecName(RRUtils.RRIterator memory iter, bytes memory nsecName, bytes memory deleteName, uint16 deleteType) private pure {\n uint rdataOffset = iter.rdataOffset;\n uint nextNameLength = iter.data.nameLength(rdataOffset);\n uint rDataLength = iter.nextOffset - iter.rdataOffset;\n\n // We assume that there is always typed bitmap after the next domain name\n require(rDataLength > nextNameLength);\n\n int compareResult = deleteName.compareNames(nsecName);\n if(compareResult == 0) {\n // Name to delete is on the same label as the NSEC record\n require(!iter.data.checkTypeBitmap(rdataOffset + nextNameLength, deleteType));\n } else {\n // First check if the NSEC next name comes after the NSEC name.\n bytes memory nextName = iter.data.substring(rdataOffset,nextNameLength);\n // deleteName must come after nsecName\n require(compareResult > 0);\n if(nsecName.compareNames(nextName) < 0) {\n // deleteName must also come before nextName\n require(deleteName.compareNames(nextName) < 0);\n }\n }\n }\n\n /**\n * @dev Deletes an RR from the oracle using an NSEC3 proof.\n * Deleting a record using NSEC3 requires using up to two NSEC3 records. There are two cases:\n * 1. The name exists, but the record type doesn't. Eg, example.com has A records but no TXT records.\n * 2. The name does not exist, but a parent name does.\n * In the first case, we submit one NSEC3 proof in `closestEncloser` that matches the target name\n * but does not have the bit for `deleteType` set in its type bitmap. In the second case, we submit\n * two proofs: closestEncloser and nextClosest, that together prove that the name does not exist.\n * NSEC3 records are in the format described in section 5.3.2 of RFC4035: The RRDATA section\n * from the RRSIG without the signature data, followed by a series of canonicalised RR records\n * that the signature applies to.\n *\n * @param deleteType The DNS record type to delete.\n * @param deleteName The name to delete.\n * @param closestEncloser An NSEC3 proof matching the closest enclosing name - that is,\n * the nearest ancestor of the target name that *does* exist.\n * @param nextClosest An NSEC3 proof covering the next closest name. This proves that the immediate\n * subdomain of the closestEncloser does not exist.\n * @param dnskey An encoded DNSKEY record that has already been submitted to the oracle and can be used\n * to verify the signatures closestEncloserSig and nextClosestSig\n */\n function deleteRRSetNSEC3(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory closestEncloser, RRSetWithSignature memory nextClosest, bytes memory dnskey)\n public override\n {\n uint32 originalInception = rrsets[keccak256(deleteName)][deleteType].inception;\n\n RRUtils.SignedSet memory ce = validateSignedSet(closestEncloser, dnskey);\n checkNSEC3Validity(ce, deleteName, originalInception);\n\n RRUtils.SignedSet memory nc;\n if(nextClosest.rrset.length > 0) {\n nc = validateSignedSet(nextClosest, dnskey);\n checkNSEC3Validity(nc, deleteName, originalInception);\n }\n\n RRUtils.NSEC3 memory ceNSEC3 = readNSEC3(ce);\n // The flags field must be 0 or 1 (RFC5155 section 8.2).\n require(ceNSEC3.flags & 0xfe == 0);\n // Check that the closest encloser is from the correct zone (RFC5155 section 8.3)\n // \"The DNAME type bit must not be set and the NS type bit may only be set if the SOA type bit is set.\"\n require(!ceNSEC3.checkTypeBitmap(DNSTYPE_DNAME) && (!ceNSEC3.checkTypeBitmap(DNSTYPE_NS) || ceNSEC3.checkTypeBitmap(DNSTYPE_SOA)));\n\n // Case 1: deleteName does exist, but no records of RRTYPE deleteType do.\n if(isMatchingNSEC3Record(deleteType, deleteName, ce.name, ceNSEC3)) {\n delete rrsets[keccak256(deleteName)][deleteType];\n // Case 2: deleteName does not exist.\n } else if(isCoveringNSEC3Record(deleteName, ce.name, ceNSEC3, nc.name, readNSEC3(nc))) {\n delete rrsets[keccak256(deleteName)][deleteType];\n } else {\n revert();\n }\n }\n\n function checkNSEC3Validity(RRUtils.SignedSet memory nsec, bytes memory deleteName, uint32 originalInception) private pure {\n // The records must have been signed after the record we're trying to delete\n require(RRUtils.serialNumberGte(nsec.inception, originalInception));\n\n // The record must be an NSEC3\n require(nsec.typeCovered == DNSTYPE_NSEC3);\n\n // nsecName is of the form .zone.xyz. is the NSEC3 hash of the entire name the NSEC3 record matches, while\n // zone.xyz can be any ancestor of that name. We'll check that, so someone can't use a record on foo.com\n // as proof of the nonexistence of bar.org.\n require(checkNSEC3OwnerName(nsec.name, deleteName));\n }\n\n function isMatchingNSEC3Record(uint16 deleteType, bytes memory deleteName, bytes memory closestEncloserName, RRUtils.NSEC3 memory closestEncloser) private view returns(bool) {\n // Check the record matches the hashed name, but the type bitmap does not include the type\n if(checkNSEC3Name(closestEncloser, closestEncloserName, deleteName)) {\n return !closestEncloser.checkTypeBitmap(deleteType);\n }\n\n return false;\n }\n\n function isCoveringNSEC3Record(bytes memory deleteName, bytes memory ceName, RRUtils.NSEC3 memory ce, bytes memory ncName, RRUtils.NSEC3 memory nc) private view returns(bool) {\n // The flags field must be 0 or 1 (RFC5155 section 8.2).\n require(nc.flags & 0xfe == 0);\n\n bytes32 ceNameHash = decodeOwnerNameHash(ceName);\n bytes32 ncNameHash = decodeOwnerNameHash(ncName);\n\n uint lastOffset = 0;\n // Iterate over suffixes of the name to delete until one matches the closest encloser\n for(uint offset = deleteName.readUint8(0) + 1; offset < deleteName.length; offset += deleteName.readUint8(offset) + 1) {\n if(hashName(ce, deleteName.substring(offset, deleteName.length - offset)) == ceNameHash) {\n // Check that the next closest record encloses the name one label longer\n bytes32 checkHash = hashName(nc, deleteName.substring(lastOffset, deleteName.length - lastOffset));\n if(ncNameHash < nc.nextHashedOwnerName) {\n return checkHash > ncNameHash && checkHash < nc.nextHashedOwnerName;\n } else {\n return checkHash > ncNameHash || checkHash < nc.nextHashedOwnerName;\n }\n }\n lastOffset = offset;\n }\n // If we reached the root without finding a match, return false.\n return false;\n }\n\n function readNSEC3(RRUtils.SignedSet memory ss) private pure returns(RRUtils.NSEC3 memory) {\n RRUtils.RRIterator memory iter = ss.rrs();\n return iter.data.readNSEC3(iter.rdataOffset, iter.nextOffset - iter.rdataOffset);\n }\n\n function checkNSEC3Name(RRUtils.NSEC3 memory nsec, bytes memory ownerName, bytes memory deleteName) private view returns(bool) {\n // Compute the NSEC3 name hash of the name to delete.\n bytes32 deleteNameHash = hashName(nsec, deleteName);\n\n // Decode the NSEC3 name hash from the first label of the NSEC3 owner name.\n bytes32 nsecNameHash = decodeOwnerNameHash(ownerName);\n\n return deleteNameHash == nsecNameHash;\n }\n\n function hashName(RRUtils.NSEC3 memory nsec, bytes memory name) private view returns(bytes32) {\n return nsec3Digests[nsec.hashAlgorithm].hash(nsec.salt, name, nsec.iterations);\n }\n\n function decodeOwnerNameHash(bytes memory name) private pure returns(bytes32) {\n return name.base32HexDecodeWord(1, uint(name.readUint8(0)));\n }\n\n function checkNSEC3OwnerName(bytes memory nsecName, bytes memory deleteName) private pure returns(bool) {\n uint nsecNameOffset = nsecName.readUint8(0) + 1;\n uint deleteNameOffset = 0;\n while(deleteNameOffset < deleteName.length) {\n if(deleteName.equals(deleteNameOffset, nsecName, nsecNameOffset)) {\n return true;\n }\n deleteNameOffset += deleteName.readUint8(deleteNameOffset) + 1;\n }\n return false;\n }\n\n /**\n * @dev Returns data about the RRs (if any) known to this oracle with the provided type and name.\n * @param dnstype The DNS record type to query.\n * @param name The name to query, in DNS label-sequence format.\n * @return inception The unix timestamp (wrapped) at which the signature for this RRSET was created.\n * @return expiration The unix timestamp (wrapped) at which the signature for this RRSET expires.\n * @return hash The hash of the RRset.\n */\n function rrdata(uint16 dnstype, bytes calldata name) external override view returns (uint32, uint32, bytes20) {\n RRSet storage result = rrsets[keccak256(name)][dnstype];\n return (result.inception, result.expiration, result.hash);\n }\n\n function _submitRRSet(RRSetWithSignature memory input, bytes memory proof) internal returns (bytes memory) {\n RRUtils.SignedSet memory rrset;\n rrset = validateSignedSet(input, proof);\n\n RRSet storage storedSet = rrsets[keccak256(rrset.name)][rrset.typeCovered];\n if (storedSet.hash != bytes20(0)) {\n // To replace an existing rrset, the signature must be at least as new\n require(RRUtils.serialNumberGte(rrset.inception, storedSet.inception));\n }\n rrsets[keccak256(rrset.name)][rrset.typeCovered] = RRSet({\n inception: rrset.inception,\n expiration: rrset.expiration,\n hash: bytes20(keccak256(rrset.data))\n });\n\n emit RRSetUpdated(rrset.name, rrset.data);\n\n return rrset.data;\n }\n\n /**\n * @dev Submits a signed set of RRs to the oracle.\n *\n * RRSETs are only accepted if they are signed with a key that is already\n * trusted, or if they are self-signed, and the signing key is identified by\n * a DS record that is already trusted.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against. Must Already\n * have been submitted and proved previously.\n */\n function validateSignedSet(RRSetWithSignature memory input, bytes memory proof) internal view returns(RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n require(validProof(rrset.signerName, proof));\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n require(name.labelCount(0) == rrset.labels);\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n require(RRUtils.serialNumberGte(rrset.expiration, uint32(block.timestamp)));\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n require(RRUtils.serialNumberGte(uint32(block.timestamp), rrset.inception));\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n function validProof(bytes memory name, bytes memory proof) internal view returns(bool) {\n uint16 dnstype = proof.readUint16(proof.nameLength(0));\n return rrsets[keccak256(name)][dnstype].hash == bytes20(keccak256(proof));\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(RRUtils.SignedSet memory rrset, uint16 typecovered) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\n // We only support class IN (Internet)\n require(iter.class == DNSCLASS_IN);\n\n if(name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n require(name.length == iter.data.nameLength(iter.offset));\n require(name.equals(0, iter.data, iter.offset, name.length));\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n require(iter.dnstype == typecovered);\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(bytes memory name, RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, bytes memory proof) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n require(rrset.signerName.length <= name.length);\n require(rrset.signerName.equals(0, name, name.length - rrset.signerName.length));\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n require(verifyWithDS(rrset, data, proofRR));\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n require(verifyWithKnownKey(rrset, data, proofRR));\n } else {\n revert(\"No valid proof found\");\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n * @return True if the RRSET could be verified, false otherwise.\n */\n function verifyWithKnownKey(RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, RRUtils.RRIterator memory proof) internal view returns(bool) {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n require(proof.name().equals(rrset.signerName));\n for(; !proof.done(); proof.next()) {\n require(proof.name().equals(rrset.signerName));\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(0, keyrdata.length);\n if(verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(RRUtils.DNSKEY memory dnskey, bytes memory keyrdata, RRUtils.SignedSet memory rrset, RRSetWithSignature memory data)\n internal\n view\n returns (bool)\n {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if(dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if(dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = computeKeytag(keyrdata);\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n return algorithms[dnskey.algorithm].verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record \n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n * @return True if the RRSET could be verified, false otherwise.\n */\n function verifyWithDS(RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, RRUtils.RRIterator memory proof) internal view returns(bool) {\n for(RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\n require(iter.dnstype == DNSTYPE_DNSKEY);\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(0, keyrdata.length);\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n return verifyKeyWithDS(iter.name(), proof, dnskey, keyrdata);\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(bytes memory keyname, RRUtils.RRIterator memory dsrrs, RRUtils.DNSKEY memory dnskey, bytes memory keyrdata)\n internal view returns (bool)\n {\n uint16 keytag = computeKeytag(keyrdata);\n for (; !dsrrs.done(); dsrrs.next()) {\n RRUtils.DS memory ds = dsrrs.data.readDS(dsrrs.rdataOffset, dsrrs.nextOffset - dsrrs.rdataOffset);\n if(ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(uint8 digesttype, bytes memory data, bytes memory digest) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n uint ac;\n for (uint i = 0; i < data.length; i++) {\n ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n }\n return uint16(ac + (ac >> 16));\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev Contract mixin for 'owned' contracts.\n*/\ncontract Owned {\n address public owner;\n \n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n*/\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external virtual view returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev An interface for contracts implementing a DNSSEC digest.\n*/\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(bytes calldata data, bytes calldata hash) external virtual pure returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/nsec3digests/NSEC3Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Interface for contracts that implement NSEC3 digest algorithms.\n */\ninterface NSEC3Digest {\n /**\n * @dev Performs an NSEC3 iterated hash.\n * @param salt The salt value to use on each iteration.\n * @param data The data to hash.\n * @param iterations The number of iterations to perform.\n * @return The result of the iterated hash operation.\n */\n function hash(bytes calldata salt, bytes calldata data, uint iterations) external virtual pure returns (bytes32);\n}\n" + }, + "contracts/dnssec-oracle/nsec3digests/SHA1NSEC3Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./NSEC3Digest.sol\";\nimport \"../SHA1.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n/**\n* @dev Implements the DNSSEC iterated SHA1 digest used for NSEC3 records.\n*/\ncontract SHA1NSEC3Digest is NSEC3Digest {\n using Buffer for Buffer.buffer;\n\n function hash(bytes calldata salt, bytes calldata data, uint iterations) external override pure returns (bytes32) {\n Buffer.buffer memory buf;\n buf.init(salt.length + data.length + 16);\n\n buf.append(data);\n buf.append(salt);\n bytes20 h = SHA1.sha1(buf.buf);\n if (iterations > 0) {\n buf.truncate();\n buf.appendBytes20(bytes20(0));\n buf.append(salt);\n\n for (uint i = 0; i < iterations; i++) {\n buf.writeBytes20(0, h);\n h = SHA1.sha1(buf.buf);\n }\n }\n\n return bytes32(h);\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n* @dev Implements the DNSSEC SHA256 digest.\n*/\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(bytes calldata data, bytes calldata hash) external override pure returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n* @dev Implements the DNSSEC SHA1 digest.\n*/\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(bytes calldata data, bytes calldata hash) external override pure returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n* @dev Implements the DNSSEC RSASHA1 algorithm.\n*/\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(bytes calldata key, bytes calldata data, bytes calldata sig) external override view returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(exponentLen + 5, key.length - exponentLen - 5);\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(exponentLen + 7, key.length - exponentLen - 7);\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(bytes memory N, bytes memory E, bytes memory S) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(bytes memory base, bytes memory exponent, bytes memory modulus) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(gas(), 5, add(input, 32), mload(input), add(output, 32), mload(modulus))\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n* @dev Implements the DNSSEC RSASHA256 algorithm.\n*/\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(bytes calldata key, bytes calldata data, bytes calldata sig) external override view returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(exponentLen + 5, key.length - exponentLen - 5);\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(exponentLen + 7, key.length - exponentLen - 7);\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external override view returns (bool) {\n return validateSignature(sha256(data), parseSignature(signature), parseKey(key));\n }\n\n function parseSignature(bytes memory data) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(bytes memory data) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n\n // Set parameters for curve.\n uint constant a = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint constant b = 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint constant gx = 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint constant gy = 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint constant p = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint constant n = 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint constant lowSmax = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint u, uint m) internal pure\n returns (uint)\n {\n unchecked {\n if (u == 0 || u == m || m == 0)\n return 0;\n if (u > m)\n u = u % m;\n\n int t1;\n int t2 = 1;\n uint r1 = m;\n uint r2 = u;\n uint q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0)\n return (m - uint(-t1));\n\n return uint(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(uint x0, uint y0) internal pure\n returns (uint[3] memory P)\n {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(uint x1, uint y1, uint x2, uint y2) internal pure\n returns (uint[3] memory P)\n {\n uint x;\n uint y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(uint x0, uint y0, uint z0) internal pure\n returns (uint x1, uint y1)\n {\n uint z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj() internal pure\n returns (uint x, uint y, uint z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure\n returns (uint x, uint y)\n {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(uint x0, uint y0) internal pure\n returns (bool isZero)\n {\n if(x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint x, uint y) internal pure\n returns (bool)\n {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint LHS = mulmod(y, y, p); // y^2\n uint RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(uint x0, uint y0, uint z0) internal pure\n returns (uint x1, uint y1, uint z1)\n {\n uint t;\n uint u;\n uint v;\n uint w;\n\n if(isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p-x0, p);\n\n x0 = addmod(v, p-w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p-y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(uint x0, uint y0, uint z0, uint x1, uint y1, uint z1) internal pure\n returns (uint x2, uint y2, uint z2)\n {\n uint t0;\n uint t1;\n uint u0;\n uint u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n }\n else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n }\n else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(uint v, uint u0, uint u1, uint t1, uint t0) private pure\n returns (uint x2, uint y2, uint z2)\n {\n uint u;\n uint u2;\n uint u3;\n uint w;\n uint t;\n\n t = addmod(t0, p-t1, p);\n u = addmod(u0, p-u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p-u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p-w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p-t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(uint x0, uint y0, uint x1, uint y1) internal pure\n returns (uint, uint)\n {\n uint z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(uint x0, uint y0) internal pure\n returns (uint, uint)\n {\n uint z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(uint x0, uint y0, uint exp) internal pure\n returns (uint, uint)\n {\n uint base2X = x0;\n uint base2Y = y0;\n uint base2Z = 1;\n\n for(uint i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(uint x0, uint y0, uint scalar) internal pure\n returns (uint x1, uint y1)\n {\n if(scalar == 0) {\n return zeroAffine();\n }\n else if (scalar == 1) {\n return (x0, y0);\n }\n else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint base2X = x0;\n uint base2Y = y0;\n uint base2Z = 1;\n uint z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if(scalar%2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while(scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if(scalar%2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(uint scalar) internal pure\n returns (uint, uint)\n {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(bytes32 message, uint[2] memory rs, uint[2] memory Q) internal pure\n returns (bool)\n {\n\n // To disambiguate between public key solutions, include comment below.\n if(rs[0] == 0 || rs[0] >= n || rs[1] == 0) {// || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint x1;\n uint x2;\n uint y1;\n uint y2;\n\n uint sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n* @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n* signatures, for testing.\n*/\ncontract DummyAlgorithm is Algorithm {\n function verify(bytes calldata, bytes calldata, bytes calldata) external override view returns (bool) { return true; }\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n* @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n*/\ncontract DummyDigest is Digest {\n function verify(bytes calldata, bytes calldata) external override pure returns (bool) { return true; }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyDNSSEC.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../../registry/ENSRegistry.sol\";\nimport \"../../dnssec-oracle/DNSSEC.sol\";\n\ncontract DummyDnsRegistrarDNSSEC {\n\n struct Data {\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n }\n\n mapping (bytes32 => Data) private datas;\n\n function setData(uint16 _expectedType, bytes memory _expectedName, uint32 _inception, uint64 _inserted, bytes memory _proof) public {\n Data storage rr = datas[keccak256(abi.encodePacked(_expectedType, _expectedName))];\n rr.inception = _inception;\n rr.inserted = _inserted;\n\n if (_proof.length != 0) {\n rr.hash = bytes20(keccak256(_proof));\n } else {\n rr.hash = bytes20(0);\n }\n }\n\n function rrdata(uint16 dnstype, bytes memory name) public view returns (uint32, uint64, bytes20) {\n Data storage rr = datas[keccak256(abi.encodePacked(dnstype, name))];\n return (rr.inception, rr.inserted, rr.hash);\n }\n\n function submitRRSets(DNSSEC.RRSetWithSignature[] memory input, bytes calldata) public virtual returns (bytes memory) {\n return input[input.length - 1].rrset;\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public override view returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public override view returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public override view returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/resolvers/DefaultReverseResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"../registry/ReverseRegistrar.sol\";\n\n/**\n * @dev Provides a default implementation of a resolver for reverse records,\n * which permits only the owner to update it.\n */\ncontract DefaultReverseResolver {\n // namehash('addr.reverse')\n bytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n ENS public ens;\n mapping (bytes32 => string) public name;\n\n /**\n * @dev Only permits calls by the reverse registrar.\n * @param node The node permission is required for.\n */\n modifier onlyOwner(bytes32 node) {\n require(msg.sender == ens.owner(node));\n _;\n }\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar registrar = ReverseRegistrar(ens.owner(ADDR_REVERSE_NODE));\n if (address(registrar) != address(0x0)) {\n registrar.claim(msg.sender);\n }\n }\n\n /**\n * @dev Sets the name for a node.\n * @param node The node to update.\n * @param _name The name to set.\n */\n function setName(bytes32 node, string memory _name) public onlyOwner(node) {\n name[node] = _name;\n }\n}\n" + }, + "contracts/registry/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable {\n ENS public ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n * @param resolverAddr The address of the default reverse resolver.\n */\n constructor(ENS ensAddr, NameResolver resolverAddr) {\n ens = ensAddr;\n defaultResolver = resolverAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public returns (bytes32) {\n return _claimWithResolver(msg.sender, owner, address(0x0));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(address addr, address owner)\n public\n authorised(addr)\n returns (bytes32)\n {\n return _claimWithResolver(addr, owner, address(0x0));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(address owner, address resolver)\n public\n returns (bytes32)\n {\n return _claimWithResolver(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record specified with the\n * address provided\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolverForAddr(\n address addr,\n address owner,\n address resolver\n ) public authorised(addr) returns (bytes32) {\n return _claimWithResolver(addr, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public returns (bytes32) {\n bytes32 node = _claimWithResolver(\n msg.sender,\n address(this),\n address(defaultResolver)\n );\n defaultResolver.setName(node, name);\n return node;\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. First updates the resolver to the default reverse\n * resolver if necessary.\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n string memory name\n ) public authorised(addr) returns (bytes32) {\n bytes32 node = _claimWithResolver(\n addr,\n address(this),\n address(defaultResolver)\n );\n defaultResolver.setName(node, name);\n ens.setSubnodeOwner(ADDR_REVERSE_NODE, sha3HexAddress(addr), owner);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n /* Internal functions */\n\n function _claimWithResolver(\n address addr,\n address owner,\n address resolver\n ) internal returns (bytes32) {\n bytes32 label = sha3HexAddress(addr);\n bytes32 node = keccak256(abi.encodePacked(ADDR_REVERSE_NODE, label));\n address currentResolver = ens.resolver(node);\n bool shouldUpdateResolver = (resolver != address(0x0) &&\n resolver != currentResolver);\n address newResolver = shouldUpdateResolver ? resolver : currentResolver;\n\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, label, owner, newResolver, 0);\n\n emit ReverseClaimed(addr, node);\n\n return node;\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./PriceOracle.sol\";\nimport \"./SafeMath.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is Ownable, PriceOracle {\n using SafeMath for *;\n using StringUtils for *;\n\n // Rent in base price units by length. Element 0 is for 1-length names, and so on.\n uint[] public rentPrices;\n\n // Oracle address\n AggregatorInterface public usdOracle;\n\n event OracleChanged(address oracle);\n\n event RentPriceChanged(uint[] prices);\n\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 constant private ORACLE_ID = bytes4(keccak256(\"price(string,uint256,uint256)\") ^ keccak256(\"premium(string,uint256,uint256)\"));\n\n constructor(AggregatorInterface _usdOracle, uint[] memory _rentPrices) public {\n usdOracle = _usdOracle;\n setPrices(_rentPrices);\n }\n\n function price(string calldata name, uint expires, uint duration) external view override returns(uint) {\n uint len = name.strlen();\n if(len > rentPrices.length) {\n len = rentPrices.length;\n }\n require(len > 0);\n \n uint basePrice = rentPrices[len - 1].mul(duration);\n basePrice = basePrice.add(_premium(name, expires, duration));\n\n return attoUSDToWei(basePrice);\n }\n\n /**\n * @dev Sets rent prices.\n * @param _rentPrices The price array. Each element corresponds to a specific\n * name length; names longer than the length of the array\n * default to the price of the last element. Values are\n * in base price units, equal to one attodollar (1e-18\n * dollar) each.\n */\n function setPrices(uint[] memory _rentPrices) public onlyOwner {\n rentPrices = _rentPrices;\n emit RentPriceChanged(_rentPrices);\n }\n\n /**\n * @dev Sets the price oracle address\n * @param _usdOracle The address of the price oracle to use.\n */\n function setOracle(AggregatorInterface _usdOracle) public onlyOwner {\n usdOracle = _usdOracle;\n emit OracleChanged(address(_usdOracle));\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(string calldata name, uint expires, uint duration) external view returns(uint) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(string memory name, uint expires, uint duration) virtual internal view returns(uint) {\n return 0;\n }\n\n function attoUSDToWei(uint amount) internal view returns(uint) {\n uint ethPrice = uint(usdOracle.latestAnswer());\n return amount.mul(1e8).div(ethPrice);\n }\n\n function weiToAttoUSD(uint amount) internal view returns(uint) {\n uint ethPrice = uint(usdOracle.latestAnswer());\n return amount.mul(ethPrice).div(1e8);\n }\n\n function supportsInterface(bytes4 interfaceID) public view virtual returns (bool) {\n return interfaceID == INTERFACE_META_ID || interfaceID == ORACLE_ID;\n }\n}\n" + }, + "contracts/ethregistrar/PriceOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface PriceOracle {\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return The price of this renewal or registration, in wei.\n */\n function price(string calldata name, uint expires, uint duration) external view returns(uint);\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint) {\n uint len;\n uint i = 0;\n uint bytelength = bytes(s).length;\n for(len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if(b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./PriceOracle.sol\";\nimport \"./BaseRegistrarImplementation.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../resolvers/Resolver.sol\";\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is Ownable {\n using StringUtils for *;\n\n uint constant public MIN_REGISTRATION_DURATION = 28 days;\n\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 constant private COMMITMENT_CONTROLLER_ID = bytes4(\n keccak256(\"rentPrice(string,uint256)\") ^\n keccak256(\"available(string)\") ^\n keccak256(\"makeCommitment(string,address,bytes32)\") ^\n keccak256(\"commit(bytes32)\") ^\n keccak256(\"register(string,address,uint256,bytes32)\") ^\n keccak256(\"renew(string,uint256)\")\n );\n\n bytes4 constant private COMMITMENT_WITH_CONFIG_CONTROLLER_ID = bytes4(\n keccak256(\"registerWithConfig(string,address,uint256,bytes32,address,address)\") ^\n keccak256(\"makeCommitmentWithConfig(string,address,bytes32,address,address)\")\n );\n\n BaseRegistrarImplementation base;\n PriceOracle prices;\n uint public minCommitmentAge;\n uint public maxCommitmentAge;\n\n mapping(bytes32=>uint) public commitments;\n\n event NameRegistered(string name, bytes32 indexed label, address indexed owner, uint cost, uint expires);\n event NameRenewed(string name, bytes32 indexed label, uint cost, uint expires);\n event NewPriceOracle(address indexed oracle);\n\n constructor(BaseRegistrarImplementation _base, PriceOracle _prices, uint _minCommitmentAge, uint _maxCommitmentAge) public {\n require(_maxCommitmentAge > _minCommitmentAge);\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n }\n\n function rentPrice(string memory name, uint duration) view public returns(uint) {\n bytes32 hash = keccak256(bytes(name));\n return prices.price(name, base.nameExpires(uint256(hash)), duration);\n }\n\n function valid(string memory name) public pure returns(bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view returns(bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(string memory name, address owner, bytes32 secret) pure public returns(bytes32) {\n return makeCommitmentWithConfig(name, owner, secret, address(0), address(0));\n }\n\n function makeCommitmentWithConfig(string memory name, address owner, bytes32 secret, address resolver, address addr) pure public returns(bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (resolver == address(0) && addr == address(0)) {\n return keccak256(abi.encodePacked(label, owner, secret));\n }\n require(resolver != address(0));\n return keccak256(abi.encodePacked(label, owner, resolver, addr, secret));\n }\n\n function commit(bytes32 commitment) public {\n require(commitments[commitment] + maxCommitmentAge < block.timestamp);\n commitments[commitment] = block.timestamp;\n }\n\n function register(string calldata name, address owner, uint duration, bytes32 secret) external payable {\n registerWithConfig(name, owner, duration, secret, address(0), address(0));\n }\n\n function registerWithConfig(string memory name, address owner, uint duration, bytes32 secret, address resolver, address addr) public payable {\n bytes32 commitment = makeCommitmentWithConfig(name, owner, secret, resolver, addr);\n uint cost = _consumeCommitment(name, duration, commitment);\n\n bytes32 label = keccak256(bytes(name));\n uint256 tokenId = uint256(label);\n\n uint expires;\n if(resolver != address(0)) {\n // Set this contract as the (temporary) owner, giving it\n // permission to set up the resolver.\n expires = base.register(tokenId, address(this), duration);\n\n // The nodehash of this label\n bytes32 nodehash = keccak256(abi.encodePacked(base.baseNode(), label));\n\n // Set the resolver\n base.ens().setResolver(nodehash, resolver);\n\n // Configure the resolver\n if (addr != address(0)) {\n Resolver(resolver).setAddr(nodehash, addr);\n }\n\n // Now transfer full ownership to the expeceted owner\n base.reclaim(tokenId, owner);\n base.transferFrom(address(this), owner, tokenId);\n } else {\n require(addr == address(0));\n expires = base.register(tokenId, owner, duration);\n }\n\n emit NameRegistered(name, label, owner, cost, expires);\n\n // Refund any extra payment\n if(msg.value > cost) {\n payable(msg.sender).transfer(msg.value - cost);\n }\n }\n\n function renew(string calldata name, uint duration) external payable {\n uint cost = rentPrice(name, duration);\n require(msg.value >= cost);\n\n bytes32 label = keccak256(bytes(name));\n uint expires = base.renew(uint256(label), duration);\n\n if(msg.value > cost) {\n payable(msg.sender).transfer(msg.value - cost);\n }\n\n emit NameRenewed(name, label, cost, expires);\n }\n\n function setPriceOracle(PriceOracle _prices) public onlyOwner {\n prices = _prices;\n emit NewPriceOracle(address(prices));\n }\n\n function setCommitmentAges(uint _minCommitmentAge, uint _maxCommitmentAge) public onlyOwner {\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n }\n\n function withdraw() public onlyOwner {\n payable(msg.sender).transfer(address(this).balance); \n }\n\n function supportsInterface(bytes4 interfaceID) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID ||\n interfaceID == COMMITMENT_CONTROLLER_ID ||\n interfaceID == COMMITMENT_WITH_CONFIG_CONTROLLER_ID;\n }\n\n function _consumeCommitment(string memory name, uint duration, bytes32 commitment) internal returns (uint256) {\n // Require a valid commitment\n require(commitments[commitment] + minCommitmentAge <= block.timestamp);\n\n // If the commitment is too old, or the name is registered, stop\n require(commitments[commitment] + maxCommitmentAge > block.timestamp);\n require(available(name));\n\n delete(commitments[commitment]);\n\n uint cost = rentPrice(name, duration);\n require(duration >= MIN_REGISTRATION_DURATION);\n require(msg.value >= cost);\n\n return cost;\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\n\nimport \"./BaseRegistrar.sol\";\ncontract BaseRegistrarImplementation is ERC721, BaseRegistrar {\n // A map of expiry times\n mapping(uint256=>uint) expiries;\n\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 constant private ERC721_ID = bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 constant private RECLAIM_ID = bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\",\"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(uint256 tokenId) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns(uint) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns(bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(uint256 id, address owner, uint duration) external override returns(uint) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(uint256 id, address owner, uint duration) external returns(uint) {\n return _register(id, owner, duration, false);\n }\n\n function _register(uint256 id, address owner, uint duration, bool updateRegistry) internal live onlyController returns(uint) {\n require(available(id));\n require(block.timestamp + duration + GRACE_PERIOD > block.timestamp + GRACE_PERIOD); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if(_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if(updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(uint256 id, uint duration) external override live onlyController returns(uint) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(bytes4 interfaceID) public override(ERC721, IERC165) view returns (bool) {\n return interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "pragma solidity >=0.8.4;\npragma experimental ABIEncoderV2;\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver{\n event AddrChanged(bytes32 indexed node, address a);\n event AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress);\n event NameChanged(bytes32 indexed node, string name);\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n event TextChanged(bytes32 indexed node, string indexed indexedKey, string key);\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function ABI(bytes32 node, uint256 contentTypes) external view returns (uint256, bytes memory);\n function addr(bytes32 node) external view returns (address);\n function addr(bytes32 node, uint coinType) external view returns(bytes memory);\n function contenthash(bytes32 node) external view returns (bytes memory);\n function dnsrr(bytes32 node) external view returns (bytes memory);\n function name(bytes32 node) external view returns (string memory);\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n function text(bytes32 node, string calldata key) external view returns (string memory);\n function interfaceImplementer(bytes32 node, bytes4 interfaceID) external view returns (address);\n function setABI(bytes32 node, uint256 contentType, bytes calldata data) external;\n function setAddr(bytes32 node, address addr) external;\n function setAddr(bytes32 node, uint coinType, bytes calldata a) external;\n function setContenthash(bytes32 node, bytes calldata hash) external;\n function setDnsrr(bytes32 node, bytes calldata data) external;\n function setName(bytes32 node, string calldata _name) external;\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n function setText(bytes32 node, string calldata key, string calldata value) external;\n function setInterface(bytes32 node, bytes4 interfaceID, address implementer) external;\n function supportsInterface(bytes4 interfaceID) external pure returns (bool);\n function multicall(bytes[] calldata data) external returns(bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n function multihash(bytes32 node) external view returns (bytes memory);\n function setContent(bytes32 node, bytes32 hash) external;\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping (uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping (address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping (uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping (address => mapping (address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor (string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IERC721).interfaceId\n || interfaceId == type(IERC721Metadata).interfaceId\n || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: balance query for the zero address\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"ERC721: owner query for nonexistent token\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n require(_exists(tokenId), \"ERC721Metadata: URI query for nonexistent token\");\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0\n ? string(abi.encodePacked(baseURI, tokenId.toString()))\n : '';\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. Empty by default, can be overriden\n * in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n require(_exists(tokenId), \"ERC721: approved query for nonexistent token\");\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n require(operator != _msgSender(), \"ERC721: approve to caller\");\n\n _operatorApprovals[_msgSender()][operator] = approved;\n emit ApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n _safeTransfer(from, to, tokenId, _data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `_data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, _data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n require(_exists(tokenId), \"ERC721: operator query for nonexistent token\");\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {\n _mint(to, tokenId);\n require(_checkOnERC721Received(address(0), to, tokenId, _data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Clear approvals\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer of token that is not own\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits a {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param _data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)\n private returns (bool)\n {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {\n return retval == IERC721Receiver(to).onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrar.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\nabstract contract BaseRegistrar is Ownable, IERC721 {\n uint constant public GRACE_PERIOD = 90 days;\n\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(uint256 indexed id, address indexed owner, uint expires);\n event NameRegistered(uint256 indexed id, address indexed owner, uint expires);\n event NameRenewed(uint256 indexed id, uint expires);\n\n // The ENS registry\n ENS public ens;\n\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n\n // A map of addresses that are authorised to register and renew names.\n mapping(address=>bool) public controllers;\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) virtual external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) virtual external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) virtual external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) virtual external view returns(uint);\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) virtual public view returns(bool);\n\n /**\n * @dev Register a name.\n */\n function register(uint256 id, address owner, uint duration) virtual external returns(uint);\n\n function renew(uint256 id, uint duration) virtual external returns(uint);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) virtual external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n // solhint-disable-next-line no-inline-assembly\n assembly { size := extcodesize(account) }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n (bool success, ) = recipient.call{ value: amount }(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain`call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.staticcall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant alphabet = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = alphabet[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "pragma solidity >=0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\n\ncontract BulkRenewal {\n bytes32 constant private ETH_NAMEHASH = 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes4 constant private REGISTRAR_CONTROLLER_ID = 0x018fac06;\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 constant public BULK_RENEWAL_ID = bytes4(\n keccak256(\"rentPrice(string[],uint)\") ^\n keccak256(\"renewAll(string[],uint\")\n );\n\n ENS public ens;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function getController() internal view returns(ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return ETHRegistrarController(r.interfaceImplementer(ETH_NAMEHASH, REGISTRAR_CONTROLLER_ID));\n }\n\n function rentPrice(string[] calldata names, uint duration) external view returns(uint total) {\n ETHRegistrarController controller = getController();\n for(uint i = 0; i < names.length; i++) {\n total += controller.rentPrice(names[i], duration);\n }\n }\n\n function renewAll(string[] calldata names, uint duration) external payable {\n ETHRegistrarController controller = getController();\n for(uint i = 0; i < names.length; i++) {\n uint cost = controller.rentPrice(names[i], duration);\n controller.renew{value:cost}(names[i], duration);\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(bytes4 interfaceID) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID || interfaceID == BULK_RENEWAL_ID;\n }\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint GRACE_PERIOD = 90 days;\n\n uint public initialPremium;\n uint public premiumDecreaseRate;\n\n bytes4 constant private TIME_UNTIL_PREMIUM_ID = bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(AggregatorInterface _usdOracle, uint[] memory _rentPrices, uint _initialPremium, uint _premiumDecreaseRate) public\n StablePriceOracle(_usdOracle, _rentPrices)\n {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(string memory name, uint expires, uint /*duration*/) override internal view returns(uint) {\n expires = expires.add(GRACE_PERIOD);\n if(expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint discount = premiumDecreaseRate.mul(block.timestamp.sub(expires));\n\n // If we've run out the premium period, return 0.\n if(discount > initialPremium) {\n return 0;\n }\n \n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(uint expires, uint amount) external view returns(uint) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint discount = initialPremium.sub(amount);\n uint duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(bytes4 interfaceID) public view virtual override returns (bool) {\n return (interfaceID == TIME_UNTIL_PREMIUM_ID) || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint constant registrationPeriod = 4 weeks;\n\n ENS public ens;\n bytes32 public rootNode;\n mapping (bytes32 => uint) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(keccak256(abi.encodePacked(rootNode, label)));\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(bytes calldata name) external override view returns(bool) {\n uint labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes=>bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for(uint i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(bytes calldata name) external override view returns(bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n\n address public owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n modifier onlyOwner {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(uint16 _expectedType, bytes memory _expectedName, uint32 _inception, uint64 _inserted, bytes memory _proof) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if(_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(uint16 dnstype, bytes memory name) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int value;\n\n constructor(int _value) public {\n set(_value);\n }\n\n function set(int _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns(int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns(address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping (bytes32 => address) addresses;\n\n constructor() public {\n }\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev Implements a dummy NameWrapper which returns the caller's address\n*/\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "test/registry/mocks/DummyResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyResolver {\n\n mapping (bytes32 => string) public name;\n\n function setName(bytes32 node, string memory _name) public {\n name[node] = _name;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": false, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/solcInputs/49f758ec505ff69b72f3179ac11d7cfc.json b/solidity/dns-contracts/deployments/mainnet/solcInputs/49f758ec505ff69b72f3179ac11d7cfc.json new file mode 100644 index 0000000..51bd823 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/solcInputs/49f758ec505ff69b72f3179ac11d7cfc.json @@ -0,0 +1,101 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n uint256 hexLength = lastIdx - idx;\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\n revert(\"Invalid string length\");\n }\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n return functionStaticCall(target, data, gasleft());\n }\n\n /**\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @param gasLimit The gas limit to use for the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n uint256 gasLimit\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gasLimit,\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nerror ResolverNotContract();\n\nerror ResolverError(bytes returnData);\n\nerror HttpError(HttpErrorItem[] errors);\n\nstruct HttpErrorItem {\n uint16 status;\n string message;\n}\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct MulticallChecks {\n bool isCallback;\n bool hasExtendedResolver;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\nstruct Result {\n bool success;\n bytes returnData;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (Result[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (Result[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (Result[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (Result[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n if (!resolverAddress.isContract()) {\n revert ResolverNotContract();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory reverseResolvedData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n reverseResolvedData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (Result[] memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n Result[] memory results,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(result.returnData, (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n result.returnData,\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (Result[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data,\n bool isSafe\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n if (isSafe) {\n result = LowLevelCallUtils.functionStaticCall(target, data);\n } else {\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\n }\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _checkInterface(\n address resolver,\n bytes4 interfaceId\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _checkSafetyAndItem(\n bytes memory name,\n bytes memory item,\n address resolver,\n MulticallChecks memory multicallChecks\n ) internal view returns (bool, bytes memory) {\n if (!multicallChecks.isCallback) {\n if (multicallChecks.hasExtendedResolver) {\n return (\n true,\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\n );\n }\n return (_checkInterface(resolver, bytes4(item)), item);\n }\n return (true, item);\n }\n\n function _checkMulticall(\n MulticallData memory multicallData\n ) internal view returns (MulticallChecks memory) {\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _checkInterface(\n multicallData.resolver,\n type(IExtendedResolver).interfaceId\n );\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n return MulticallChecks(isCallback, hasExtendedResolver);\n }\n\n function _checkResolveSingle(Result memory result) internal pure {\n if (!result.success) {\n if (bytes4(result.returnData) == HttpError.selector) {\n bytes memory returnData = result.returnData;\n assembly {\n revert(add(returnData, 32), mload(returnData))\n }\n }\n revert ResolverError(result.returnData);\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (Result[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new Result[](length);\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n\n if (failure) {\n results[i] = Result(false, item);\n continue;\n }\n\n bool isSafe = false;\n (isSafe, item) = _checkSafetyAndItem(\n multicallData.name,\n item,\n multicallData.resolver,\n multicallChecks\n );\n\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(\n multicallData.resolver,\n item,\n isSafe\n );\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && multicallChecks.hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = Result(success, returnData);\n extraDatas[i].data = item;\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/solcInputs/7f2f23a913c7bd6ad25d5b30d3461108.json b/solidity/dns-contracts/deployments/mainnet/solcInputs/7f2f23a913c7bd6ad25d5b30d3461108.json new file mode 100644 index 0000000..d2e9028 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/solcInputs/7f2f23a913c7bd6ad25d5b30d3461108.json @@ -0,0 +1,245 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(bytes memory self, bytes memory other)\n internal\n pure\n returns (int256)\n {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if(offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if(otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n \n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, bytes memory other)\n internal\n pure\n returns (bool)\n {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(bytes memory self, uint256 idx)\n internal\n pure\n returns (uint8 ret)\n {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(bytes memory self, uint256 idx)\n internal\n pure\n returns (uint16 ret)\n {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(bytes memory self, uint256 idx)\n internal\n pure\n returns (uint32 ret)\n {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(bytes memory self, uint256 idx)\n internal\n pure\n returns (bytes32 ret)\n {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(bytes memory self, uint256 idx)\n internal\n pure\n returns (bytes20 ret)\n {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(\n uint256 dest,\n uint256 src,\n uint256 len\n ) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256**(32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(bytes memory self, uint256 offset)\n internal\n pure\n returns (uint256)\n {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(bytes memory self, uint256 offset)\n internal\n pure\n returns (bytes memory ret)\n {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(bytes memory self, uint256 offset)\n internal\n pure\n returns (uint256)\n {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(bytes memory data)\n internal\n pure\n returns (SignedSet memory self)\n {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(SignedSet memory rrset)\n internal\n pure\n returns (RRIterator memory)\n {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(bytes memory self, uint256 offset)\n internal\n pure\n returns (RRIterator memory ret)\n {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(RRIterator memory iter)\n internal\n pure\n returns (bytes memory)\n {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(bytes memory self, bytes memory other) \n internal\n pure\n returns (bool)\n {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while(counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(bytes memory self, bytes memory other)\n internal\n pure\n returns (int256)\n {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(uint32 i1, uint32 i2)\n internal\n pure\n returns (bool)\n {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(bytes memory body, uint256 off)\n internal\n pure\n returns (uint256)\n {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId)\n internal\n view\n override\n returns (bool)\n {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(uint256 tokenId)\n public\n view\n override(IERC721, ERC721)\n returns (address)\n {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(uint256 id, uint256 duration)\n external\n override\n live\n onlyController\n returns (uint256)\n {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n override(ERC721, IERC165)\n returns (bool)\n {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(string[] calldata names, uint256 duration)\n external\n view\n override\n returns (uint256 total)\n {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(string[] calldata names, uint256 duration)\n external\n payable\n override\n {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ReverseRegistrar} from \"../registry/ReverseRegistrar.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper\n ) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(string memory name, uint256 duration)\n public\n view\n override\n returns (IPriceOracle.Price memory price)\n {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(string calldata name, uint256 duration)\n external\n payable\n override\n {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(\n tokenId,\n duration\n );\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(string[] calldata names, uint256 duration)\n external\n view\n returns (uint256 total);\n\n function renewAll(string[] calldata names, uint256 duration)\n external\n payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(string memory, uint256)\n external\n view\n returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(address owner, address operator)\n external\n view\n returns (bool);\n}\n" + }, + "contracts/registry/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(address owner, address resolver)\n external\n returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/registry/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(address owner, address resolver)\n public\n override\n returns (bytes32)\n {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(bytes[] calldata data)\n external\n returns (bytes[] memory results);\n\n function multicallWithNodeCheck(bytes32, bytes[] calldata data)\n external\n returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(bytes32 nodehash, bytes[] calldata data)\n internal\n returns (bytes[] memory results)\n {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(bytes32 nodehash, bytes[] calldata data)\n external\n returns (bytes[] memory results)\n {\n return _multicall(nodehash, data);\n }\n\n function multicall(bytes[] calldata data)\n public\n override\n returns (bytes[] memory results)\n {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(bytes32 node, uint256 contentTypes)\n external\n view\n virtual\n override\n returns (uint256, bytes memory)\n {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(bytes32 node, address a)\n external\n virtual\n authorised(node)\n {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node)\n public\n view\n virtual\n override\n returns (address payable)\n {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(bytes32 node, uint256 coinType)\n public\n view\n virtual\n override\n returns (bytes memory)\n {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(bytes memory b)\n internal\n pure\n returns (address payable a)\n {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(bytes32 node, bytes calldata hash)\n external\n virtual\n authorised(node)\n {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node)\n external\n view\n virtual\n override\n returns (bytes memory)\n {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(bytes32 node, bytes calldata data)\n external\n virtual\n authorised(node)\n {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(bytes32 node, bytes32 name)\n public\n view\n virtual\n returns (bool)\n {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(bytes32 node, bytes calldata hash)\n external\n virtual\n authorised(node)\n {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node)\n external\n view\n virtual\n override\n returns (bytes memory)\n {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(bytes32 node, uint256 contentTypes)\n external\n view\n returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(bytes32 node, uint256 coinType)\n external\n view\n returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(bytes memory name, bytes memory data)\n external\n view\n returns (bytes memory, address);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(bytes32 node, bytes4 interfaceID)\n external\n view\n returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][interfaceID] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(bytes32 node, bytes4 interfaceID)\n external\n view\n virtual\n override\n returns (address)\n {\n address implementer = versionable_interfaces[recordVersions[node]][node][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(bytes32 node, string calldata key)\n external\n view\n returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(bytes32 node, string calldata newName)\n external\n virtual\n authorised(node)\n {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node)\n external\n view\n virtual\n override\n returns (string memory)\n {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node)\n external\n view\n virtual\n override\n returns (bytes32 x, bytes32 y)\n {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(bytes32 node, string calldata key)\n external\n view\n virtual\n override\n returns (string memory)\n {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\n\ninterface INameWrapper {\n function ownerOf(uint256 id) external view returns (address);\n}\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool))) private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator)\n public\n view\n returns (bool)\n {\n return _operatorApprovals[account][operator];\n }\n\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(\n msg.sender != delegate,\n \"Setting delegate status for self\"\n );\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(address owner, bytes32 node, address delegate)\n public\n view\n returns (bool)\n {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return owner == msg.sender || isApprovedForAll(owner, msg.sender) || \n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes calldata a\n ) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(bytes[] calldata data)\n external\n returns (bytes[] memory results);\n\n function multicallWithNodeCheck(bytes32 nodehash, bytes[] calldata data)\n external\n returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(address target, bytes memory data)\n internal\n view\n returns (bool success)\n {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(uint256 offset, uint256 length)\n internal\n pure\n returns (bytes memory data)\n {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(string memory name)\n internal\n pure\n returns (bytes memory dnsName, bytes32 node)\n {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(OffchainLookupCallData[] memory data)\n external\n returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(bytes calldata name, bytes memory data)\n external\n view\n returns (bytes memory, address)\n {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(bytes calldata name, bytes[] memory data)\n external\n view\n returns (bytes[] memory, address)\n {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, ) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n return (results, address(0));\n }\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(bytes calldata reverseName)\n external\n view\n returns (\n string memory,\n address,\n address,\n address\n )\n {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(bytes calldata reverseName, string[] memory gateways)\n public\n view\n returns (\n string memory,\n address,\n address,\n address\n )\n {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n )\n internal\n view\n returns (\n string memory,\n address,\n address,\n address\n )\n {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(bytes calldata response, bytes calldata extraData)\n external\n view\n returns (bytes[] memory, address)\n {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(bytes calldata response, bytes calldata extraData)\n external\n view\n returns (\n string memory,\n address,\n address,\n address\n )\n {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (\n bytes[] memory,\n address,\n string[] memory,\n bytes memory\n )\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n result = LowLevelCallUtils.functionStaticCall(address(target), data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = revertData;\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return The Resolver responsible for this name, and the namehash of the full name.\n */\n function findResolver(bytes calldata name)\n public\n view\n returns (Resolver, bytes32)\n {\n (address resolver, bytes32 labelhash) = findResolver(name, 0);\n return (Resolver(resolver), labelhash);\n }\n\n function findResolver(bytes calldata name, uint256 offset)\n internal\n view\n returns (address, bytes32)\n {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0));\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash = keccak256(name[offset + 1:nextLabel]);\n (address parentresolver, bytes32 parentnode) = findResolver(\n name,\n nextLabel\n );\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node);\n }\n return (parentresolver, node);\n }\n\n function _hasExtendedResolver(\n address resolver\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface(\n type(IExtendedResolver).interfaceId\n )\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _multicall(MulticallData memory multicallData)\n internal\n view\n returns (bytes[] memory results)\n {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _hasExtendedResolver(multicallData.resolver);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = item;\n continue;\n }\n if (!isCallback && hasExtendedResolver) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = returnData;\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(bytes memory self, uint256 offset)\n internal\n pure\n returns (bytes32)\n {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(bytes memory self, uint256 idx)\n internal\n pure\n returns (bytes32 labelhash, uint256 newIdx)\n {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _preTransferCheck and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC165, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id)\n public\n view\n virtual\n override\n returns (uint256)\n {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] memory accounts, uint256[] memory ids)\n public\n view\n virtual\n override\n returns (uint256[] memory)\n {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved)\n public\n virtual\n override\n {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator)\n public\n view\n virtual\n override\n returns (bool)\n {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(uint256 tokenId)\n public\n view\n virtual\n returns (\n address owner,\n uint32 fuses,\n uint64 expiry\n )\n {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _preTransferCheck(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _preTransferCheck(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (bool);\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _preTransferCheck(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external;\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(uint256 labelHash, uint256 duration)\n external\n returns (uint256 expires);\n\n function unwrap(\n bytes32 node,\n bytes32 label,\n address owner\n ) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(\n bytes calldata name,\n bytes calldata extraData\n ) external;\n\n function setFuses(bytes32 node, uint16 ownerControlledFuses)\n external\n returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(bytes32 node, address addr) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function getData(uint256 id)\n external\n view\n returns (\n address,\n uint32,\n uint64\n );\n\n function allFusesBurned(bytes32 node, uint32 fuseMask)\n external\n view\n returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(name, wrappedOwner, fuses, expiry, extraData);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable\n{\n using BytesUtils for bytes;\n\n ENS public immutable override ens;\n IBaseRegistrar public immutable override registrar;\n IMetadataService public override metadataService;\n mapping(bytes32 => bytes) public override names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC1155Fuse, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(uint256 id)\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner)\n {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(uint256 id)\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (\n address owner,\n uint32 fuses,\n uint64 expiry\n )\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(IMetadataService _metadataService)\n public\n onlyOwner\n {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(uint256 tokenId) public view override returns (string memory) {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress)\n public\n onlyOwner\n {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or approved by the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or approved\n */\n\n function canModifyName(bytes32 node, address addr)\n public\n view\n override\n returns (bool)\n {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n (fuses & IS_DOT_ETH == 0 ||\n expiry - GRACE_PERIOD >= block.timestamp);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public override {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external override onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(uint256 tokenId, uint256 duration)\n external\n override\n onlyController\n returns (uint256 expires)\n {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n //use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public override {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public override onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public override onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(bytes32 node, uint16 ownerControlledFuses)\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n // this flag is used later, when checking fuses\n bool canModifyParentName = canModifyName(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canModifyParentName && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canModifyParentName && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(\n bytes calldata name,\n bytes calldata extraData\n ) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(name, currentOwner, fuses, expiry, extraData);\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of. Can also be called by the owner of a .eth name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n override\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(bytes32 node, address resolver)\n public\n override\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_SET_RESOLVER)\n {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(bytes32 node, uint64 ttl)\n public\n override\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_SET_TTL)\n {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(bytes32 parentNode, bytes32 subnode)\n internal\n view\n {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(bytes32 node, uint32 fuseMask)\n public\n view\n override\n returns (bool)\n {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n function isWrapped(bytes32 node) public view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public override returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _preTransferCheck(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (bool) {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(bytes32 node, bytes32 labelhash)\n private\n pure\n returns (bytes32)\n {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(string memory label, bytes memory name)\n internal\n pure\n returns (bytes memory ret)\n {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) internal pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n view\n override\n returns (bool)\n {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC165, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 2500 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/solcInputs/96d118177ae253bdd3815d2757c11cd9.json b/solidity/dns-contracts/deployments/mainnet/solcInputs/96d118177ae253bdd3815d2757c11cd9.json new file mode 100644 index 0000000..4ad6d18 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/solcInputs/96d118177ae253bdd3815d2757c11cd9.json @@ -0,0 +1,446 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/BytesUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (iter.name().compareNames(buf.buf) != 0) continue;\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"../utils/BytesUtils.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(\n uint16 _expectedType,\n bytes memory _expectedName,\n uint32 _inception,\n uint64 _inserted,\n bytes memory _proof\n ) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if (_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(\n uint16 dnstype,\n bytes memory name\n ) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyExtendedDNSSECResolver is IExtendedDNSResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes memory /* name */,\n bytes memory /* data */,\n bytes memory context\n ) external view override returns (bytes memory) {\n return abi.encode(context);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyLegacyTextResolver is ITextResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(ITextResolver).interfaceId;\n }\n\n function text(\n bytes32 /* node */,\n string calldata key\n ) external view override returns (string memory) {\n return key;\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyNonCCIPAwareResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../OffchainDNSResolver.sol\";\nimport \"../../resolvers/profiles/IExtendedResolver.sol\";\n\ncontract DummyNonCCIPAwareResolver is IExtendedResolver, ERC165 {\n OffchainDNSResolver dnsResolver;\n\n constructor(OffchainDNSResolver _dnsResolver) {\n dnsResolver = _dnsResolver;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(dnsResolver),\n urls,\n data,\n OffchainDNSResolver.resolveCallback.selector,\n data\n );\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyParser.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../utils/BytesUtils.sol\";\nimport \"../RecordParser.sol\";\n\ncontract DummyParser {\n using BytesUtils for bytes;\n\n // parse data in format: name;key1=value1 key2=value2;url\n function parseData(\n bytes memory data,\n uint256 kvCount\n )\n external\n pure\n returns (\n string memory name,\n string[] memory keys,\n string[] memory values,\n string memory url\n )\n {\n uint256 len = data.length;\n // retrieve name\n uint256 sep1 = data.find(0, len, \";\");\n name = string(data.substring(0, sep1));\n\n // retrieve url\n uint256 sep2 = data.find(sep1 + 1, len - sep1, \";\");\n url = string(data.substring(sep2 + 1, len - sep2 - 1));\n\n keys = new string[](kvCount);\n values = new string[](kvCount);\n // retrieve keys and values\n uint256 offset = sep1 + 1;\n for (uint256 i; i < kvCount && offset < len; i++) {\n (\n bytes memory key,\n bytes memory val,\n uint256 nextOffset\n ) = RecordParser.readKeyValue(data, offset, sep2 - offset);\n keys[i] = string(key);\n values[i] = string(val);\n offset = nextOffset;\n }\n }\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"../utils/BytesUtils.sol\";\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"../utils/LowLevelCallUtils.sol\";\n\nerror InvalidOperation();\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver, IERC165 {\n using RRUtils for *;\n using Address for address;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedResolver).interfaceId;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n revertWithDefaultOffchainLookup(name, data);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query, bytes4 selector) = abi.decode(\n extraData,\n (bytes, bytes, bytes4)\n );\n\n if (selector != bytes4(0)) {\n (bytes memory targetData, address targetResolver) = abi.decode(\n query,\n (bytes, address)\n );\n return\n callWithOffchainLookupPropagation(\n targetResolver,\n name,\n query,\n abi.encodeWithSelector(\n selector,\n response,\n abi.encode(targetData, address(this))\n )\n );\n }\n\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n callWithOffchainLookupPropagation(\n dnsresolver,\n name,\n query,\n abi.encodeCall(\n IExtendedDNSResolver.resolve,\n (name, query, context)\n )\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return\n callWithOffchainLookupPropagation(\n dnsresolver,\n name,\n query,\n abi.encodeCall(\n IExtendedResolver.resolve,\n (name, query)\n )\n );\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory name,\n bytes memory innerdata,\n bytes memory data\n ) internal view returns (bytes memory) {\n if (!target.isContract()) {\n revertWithDefaultOffchainLookup(name, innerdata);\n }\n\n bool result = LowLevelCallUtils.functionStaticCall(\n address(target),\n data\n );\n uint256 size = LowLevelCallUtils.returnDataSize();\n if (result) {\n bytes memory returnData = LowLevelCallUtils.readReturnData(0, size);\n return abi.decode(returnData, (bytes));\n }\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n if (bytes4(errorId) == OffchainLookup.selector) {\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n handleOffchainLookupError(revertData, target, name);\n }\n }\n LowLevelCallUtils.propagateRevert();\n }\n\n function revertWithDefaultOffchainLookup(\n bytes memory name,\n bytes memory data\n ) internal view {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, data, bytes4(0))\n );\n }\n\n function handleOffchainLookupError(\n bytes memory returnData,\n address target,\n bytes memory name\n ) internal view {\n (\n address sender,\n string[] memory urls,\n bytes memory callData,\n bytes4 innerCallbackFunction,\n bytes memory extraData\n ) = abi.decode(returnData, (address, string[], bytes, bytes4, bytes));\n\n if (sender != target) {\n revert InvalidOperation();\n }\n\n revert OffchainLookup(\n address(this),\n urls,\n callData,\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, extraData, innerCallbackFunction)\n );\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../utils/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (bytes memory key, bytes memory value, uint256 nextOffset)\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = len + offset;\n nextOffset = terminator;\n } else {\n nextOffset = terminator + 1;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n event SuffixAdded(bytes suffix);\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n emit SuffixAdded(names[i]);\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../utils/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256[3] memory P) {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (uint256 x, uint256 y, uint256 z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(\n uint256 x0,\n uint256 y0\n ) internal pure returns (bool isZero) {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(\n uint256 scalar\n ) internal pure returns (uint256, uint256) {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../../utils/BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./RSAVerify.sol\";\nimport \"../../utils/BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./RSAVerify.sol\";\nimport \"../../utils/BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./ModexpPrecompile.sol\";\nimport \"../../utils/BytesUtils.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(\n bytes calldata,\n bytes calldata\n ) external pure override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../../utils/BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../../utils/BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"../utils/BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input\n )\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n )\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(\n RRUtils.SignedSet memory rrset,\n uint16 typecovered\n ) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if (address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../utils/BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns (bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 {\n totallen := add(totallen, 64)\n }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for {\n let i := 0\n } lt(i, totallen) {\n i := add(i, 64)\n } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 {\n mstore8(add(scratch, sub(len, i)), 0x80)\n }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 {\n mstore(\n add(scratch, 32),\n or(mload(add(scratch, 32)), mul(len, 8))\n )\n }\n\n // Expand the 16 32-bit words into 80\n for {\n let j := 64\n } lt(j, 128) {\n j := add(j, 12)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 12))),\n mload(add(scratch, sub(j, 32)))\n ),\n xor(\n mload(add(scratch, sub(j, 56))),\n mload(add(scratch, sub(j, 64)))\n )\n )\n temp := or(\n and(\n mul(temp, 2),\n 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE\n ),\n and(\n div(temp, 0x80000000),\n 0x0000000100000001000000010000000100000001000000010000000100000001\n )\n )\n mstore(add(scratch, j), temp)\n }\n for {\n let j := 128\n } lt(j, 320) {\n j := add(j, 24)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 24))),\n mload(add(scratch, sub(j, 64)))\n ),\n xor(\n mload(add(scratch, sub(j, 112))),\n mload(add(scratch, sub(j, 128)))\n )\n )\n temp := or(\n and(\n mul(temp, 4),\n 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC\n ),\n and(\n div(temp, 0x40000000),\n 0x0000000300000003000000030000000300000003000000030000000300000003\n )\n )\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for {\n let j := 0\n } lt(j, 80) {\n j := add(j, 1)\n } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(\n div(x, 0x100000000000000000000),\n div(x, 0x10000000000)\n )\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := and(div(x, 0x10000000000), f)\n f := or(\n and(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n ),\n f\n )\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(\n div(\n x,\n 0x80000000000000000000000000000000000000000000000\n ),\n 0x1F\n )\n temp := or(\n and(\n div(x, 0x800000000000000000000000000000000000000),\n 0xFFFFFFE0\n ),\n temp\n )\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(\n div(\n mload(add(scratch, mul(j, 4))),\n 0x100000000000000000000000000000000000000000000000000000000\n ),\n temp\n )\n x := or(\n div(x, 0x10000000000),\n mul(temp, 0x10000000000000000000000000000000000000000)\n )\n x := or(\n and(\n x,\n 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF\n ),\n mul(\n or(\n and(div(x, 0x4000000000000), 0xC0000000),\n and(div(x, 0x400000000000000000000), 0x3FFFFFFF)\n ),\n 0x100000000000000000000\n )\n )\n }\n\n h := and(\n add(h, x),\n 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF\n )\n }\n ret := mul(\n or(\n or(\n or(\n or(\n and(\n div(h, 0x100000000),\n 0xFFFFFFFF00000000000000000000000000000000\n ),\n and(\n div(h, 0x1000000),\n 0xFFFFFFFF000000000000000000000000\n )\n ),\n and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)\n ),\n and(div(h, 0x100), 0xFFFFFFFF00000000)\n ),\n and(h, 0xFFFFFFFF)\n ),\n 0x1000000000000000000000000\n )\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"../utils/StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/ILinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface ILinearPremiumPriceOracle {\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256);\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns (address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"../utils/StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping(bytes32 => address) addresses;\n\n constructor() public {}\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Implements a dummy NameWrapper which returns the caller's address\n */\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"../../resolvers/profiles/IAddressResolver.sol\";\nimport \"../../resolvers/profiles/IAddrResolver.sol\";\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"../../utils/HexUtils.sol\";\nimport \"../../utils/BytesUtils.sol\";\n\n/**\n * @dev Resolves names on ENS by interpreting record data stored in a DNS TXT record.\n * This resolver implements the IExtendedDNSResolver interface, meaning that when\n * a DNS name specifies it as the resolver via a TXT record, this resolver's\n * resolve() method is invoked, and is passed any additional information from that\n * text record. This resolver implements a simple text parser allowing a variety\n * of records to be specified in text, which will then be used to resolve the name\n * in ENS.\n *\n * To use this, set a TXT record on your DNS name in the following format:\n * ENS1
\n *\n * For example:\n * ENS1 2.dnsname.ens.eth a[60]=0x1234...\n *\n * The record data consists of a series of key=value pairs, separated by spaces. Keys\n * may have an optional argument in square brackets, and values may be either unquoted\n * - in which case they may not contain spaces - or single-quoted. Single quotes in\n * a quoted value may be backslash-escaped.\n *\n *\n * ┌────────┐\n * │ ┌───┐ │\n * ┌──────────────────────────────┴─┤\" \"│◄─┴────────────────────────────────────────┐\n * │ └───┘ │\n * │ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌────────────┐ ┌───┐ │\n * ^─┴─►│key├─┬─►│\"[\"├───►│arg├───►│\"]\"├─┬─►│\"=\"├─┬─►│\"'\"├───►│quoted_value├───►│\"'\"├─┼─$\n * └───┘ │ └───┘ └───┘ └───┘ │ └───┘ │ └───┘ └────────────┘ └───┘ │\n * └──────────────────────────┘ │ ┌──────────────┐ │\n * └─────────►│unquoted_value├─────────┘\n * └──────────────┘\n *\n * Record types:\n * - a[] - Specifies how an `addr()` request should be resolved for the specified\n * `coinType`. Ethereum has `coinType` 60. The value must be 0x-prefixed hexadecimal, and will\n * be returned unmodified; this means that non-EVM addresses will need to be translated\n * into binary format and then encoded in hex.\n * Examples:\n * - a[60]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7\n * - a[0]=0x00149010587f8364b964fcaa70687216b53bd2cbd798\n * - a[e] - Specifies how an `addr()` request should be resolved for the specified\n * `chainId`. The value must be 0x-prefixed hexadecimal. When encoding an address for an\n * EVM-based cryptocurrency that uses a chainId instead of a coinType, this syntax *must*\n * be used in place of the coin type - eg, Optimism is `a[e10]`, not `a[2147483658]`.\n * A list of supported cryptocurrencies for both syntaxes can be found here:\n * https://github.com/ensdomains/address-encoder/blob/master/docs/supported-cryptocurrencies.md\n * Example:\n * - a[e10]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7\n * - t[] - Specifies how a `text()` request should be resolved for the specified `key`.\n * Examples:\n * - t[com.twitter]=nicksdjohnson\n * - t[url]='https://ens.domains/'\n * - t[note]='I\\'m great'\n */\ncontract ExtendedDNSResolver is IExtendedDNSResolver, IERC165 {\n using HexUtils for *;\n using BytesUtils for *;\n using Strings for *;\n\n uint256 private constant COIN_TYPE_ETH = 60;\n\n error NotImplemented();\n error InvalidAddressFormat(bytes addr);\n\n function supportsInterface(\n bytes4 interfaceId\n ) external view virtual override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data,\n bytes calldata context\n ) external pure override returns (bytes memory) {\n bytes4 selector = bytes4(data);\n if (selector == IAddrResolver.addr.selector) {\n return _resolveAddr(context);\n } else if (selector == IAddressResolver.addr.selector) {\n return _resolveAddress(data, context);\n } else if (selector == ITextResolver.text.selector) {\n return _resolveText(data, context);\n }\n revert NotImplemented();\n }\n\n function _resolveAddress(\n bytes calldata data,\n bytes calldata context\n ) internal pure returns (bytes memory) {\n (, uint256 coinType) = abi.decode(data[4:], (bytes32, uint256));\n bytes memory value;\n // Per https://docs.ens.domains/ensip/11#specification\n if (coinType & 0x80000000 != 0) {\n value = _findValue(\n context,\n bytes.concat(\n \"a[e\",\n bytes((coinType & 0x7fffffff).toString()),\n \"]=\"\n )\n );\n } else {\n value = _findValue(\n context,\n bytes.concat(\"a[\", bytes(coinType.toString()), \"]=\")\n );\n }\n if (value.length == 0) {\n return value;\n }\n (bytes memory record, bool valid) = value.hexToBytes(2, value.length);\n if (!valid) revert InvalidAddressFormat(value);\n return record;\n }\n\n function _resolveAddr(\n bytes calldata context\n ) internal pure returns (bytes memory) {\n bytes memory value = _findValue(context, \"a[60]=\");\n if (value.length == 0) {\n return value;\n }\n (bytes memory record, bool valid) = value.hexToBytes(2, value.length);\n if (!valid) revert InvalidAddressFormat(value);\n return record;\n }\n\n function _resolveText(\n bytes calldata data,\n bytes calldata context\n ) internal pure returns (bytes memory) {\n (, string memory key) = abi.decode(data[4:], (bytes32, string));\n bytes memory value = _findValue(\n context,\n bytes.concat(\"t[\", bytes(key), \"]=\")\n );\n return value;\n }\n\n uint256 constant STATE_START = 0;\n uint256 constant STATE_IGNORED_KEY = 1;\n uint256 constant STATE_IGNORED_KEY_ARG = 2;\n uint256 constant STATE_VALUE = 3;\n uint256 constant STATE_QUOTED_VALUE = 4;\n uint256 constant STATE_UNQUOTED_VALUE = 5;\n uint256 constant STATE_IGNORED_VALUE = 6;\n uint256 constant STATE_IGNORED_QUOTED_VALUE = 7;\n uint256 constant STATE_IGNORED_UNQUOTED_VALUE = 8;\n\n /**\n * @dev Implements a DFA to parse the text record, looking for an entry\n * matching `key`.\n * @param data The text record to parse.\n * @param key The exact key to search for.\n * @return value The value if found, or an empty string if `key` does not exist.\n */\n function _findValue(\n bytes memory data,\n bytes memory key\n ) internal pure returns (bytes memory value) {\n // Here we use a simple state machine to parse the text record. We\n // process characters one at a time; each character can trigger a\n // transition to a new state, or terminate the DFA and return a value.\n // For states that expect to process a number of tokens, we use\n // inner loops for efficiency reasons, to avoid the need to go\n // through the outer loop and switch statement for every character.\n uint256 state = STATE_START;\n uint256 len = data.length;\n for (uint256 i = 0; i < len; ) {\n if (state == STATE_START) {\n // Look for a matching key.\n if (data.equals(i, key, 0, key.length)) {\n i += key.length;\n state = STATE_VALUE;\n } else {\n state = STATE_IGNORED_KEY;\n }\n } else if (state == STATE_IGNORED_KEY) {\n for (; i < len; i++) {\n if (data[i] == \"=\") {\n state = STATE_IGNORED_VALUE;\n i += 1;\n break;\n } else if (data[i] == \"[\") {\n state = STATE_IGNORED_KEY_ARG;\n i += 1;\n break;\n }\n }\n } else if (state == STATE_IGNORED_KEY_ARG) {\n for (; i < len; i++) {\n if (data[i] == \"]\") {\n state = STATE_IGNORED_VALUE;\n i += 1;\n if (data[i] == \"=\") {\n i += 1;\n }\n break;\n }\n }\n } else if (state == STATE_VALUE) {\n if (data[i] == \"'\") {\n state = STATE_QUOTED_VALUE;\n i += 1;\n } else {\n state = STATE_UNQUOTED_VALUE;\n }\n } else if (state == STATE_QUOTED_VALUE) {\n uint256 start = i;\n uint256 valueLen = 0;\n bool escaped = false;\n for (; i < len; i++) {\n if (escaped) {\n data[start + valueLen] = data[i];\n valueLen += 1;\n escaped = false;\n } else {\n if (data[i] == \"\\\\\") {\n escaped = true;\n } else if (data[i] == \"'\") {\n return data.substring(start, valueLen);\n } else {\n data[start + valueLen] = data[i];\n valueLen += 1;\n }\n }\n }\n } else if (state == STATE_UNQUOTED_VALUE) {\n uint256 start = i;\n for (; i < len; i++) {\n if (data[i] == \" \") {\n return data.substring(start, i - start);\n }\n }\n return data.substring(start, len - start);\n } else if (state == STATE_IGNORED_VALUE) {\n if (data[i] == \"'\") {\n state = STATE_IGNORED_QUOTED_VALUE;\n i += 1;\n } else {\n state = STATE_IGNORED_UNQUOTED_VALUE;\n }\n } else if (state == STATE_IGNORED_QUOTED_VALUE) {\n bool escaped = false;\n for (; i < len; i++) {\n if (escaped) {\n escaped = false;\n } else {\n if (data[i] == \"\\\\\") {\n escaped = true;\n } else if (data[i] == \"'\") {\n i += 1;\n while (data[i] == \" \") {\n i += 1;\n }\n state = STATE_START;\n break;\n }\n }\n }\n } else {\n assert(state == STATE_IGNORED_UNQUOTED_VALUE);\n for (; i < len; i++) {\n if (data[i] == \" \") {\n while (data[i] == \" \") {\n i += 1;\n }\n state = STATE_START;\n break;\n }\n }\n }\n }\n return \"\";\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ReverseClaimer\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/test/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/ITextResolver.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n\n if (bytes4(data) == bytes4(0x12345678)) {\n return abi.encode(\"foo\");\n }\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (address) {\n return 0x69420f05A11f617B4B74fFe2E04B2D300dFA556F;\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n if (bytes4(extraData) == bytes4(keccak256(\"name(bytes32)\"))) {\n return abi.encode(\"offchain.test.eth\");\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "contracts/test/mocks/LegacyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\ncontract LegacyResolver {\n function addr(bytes32 /* node */) public view returns (address) {\n return address(this);\n }\n}\n" + }, + "contracts/test/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10 ** uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10 ** uint256(decimals()));\n }\n }\n}\n" + }, + "contracts/test/mocks/MockOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract MockOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n MockOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (, bytes memory callData, ) = abi.decode(\n extraData,\n (bytes, bytes, bytes4)\n );\n if (bytes4(callData) == bytes4(keccak256(\"addr(bytes32)\"))) {\n (bytes memory result, , ) = abi.decode(\n response,\n (bytes, uint64, bytes)\n );\n return result;\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "contracts/test/mocks/MockReverseClaimerImplementer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../../../contracts/registry/ENS.sol\";\nimport {ReverseClaimer} from \"../../../contracts/reverseRegistrar/ReverseClaimer.sol\";\n\ncontract MockReverseClaimerImplementer is ReverseClaimer {\n constructor(ENS ens, address claimant) ReverseClaimer(ens, claimant) {}\n}\n" + }, + "contracts/test/mocks/StringUtilsTest.sol": { + "content": "// SPDX-License-Identifier: MIT\nimport \"../../../contracts/utils/StringUtils.sol\";\n\nlibrary StringUtilsTest {\n function testEscape(\n string calldata testStr\n ) public pure returns (string memory) {\n return StringUtils.escape(testStr);\n }\n}\n" + }, + "contracts/test/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/utils/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\n \"\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n require(\n \"foo\".keccak(0, 3) ==\n bytes32(\n 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d\n ),\n \"Incorrect hash of 'foo'\"\n );\n require(\n \"foo\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\n \"hello\".equals(1, \"ello\") == true,\n \"Substring to string equality\"\n );\n require(\n \"hello\".equals(1, \"jello\", 1, 4) == true,\n \"Substring to substring equality\"\n );\n require(\n \"zhello\".equals(1, \"abchello\", 3) == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"0x0102030000\".equals(0, \"0x010203\") == false,\n \"Compare with offset and trailing bytes\"\n );\n }\n\n function testComparePartial() public pure {\n require(\n \"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true,\n \"Compare same length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true,\n \"Compare different length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true,\n \"Compare same with different offset\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 33\n ) ==\n 0 ==\n true,\n \"Compare different long strings same length smaller partial length which must be equal\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 34\n ) <\n 0 ==\n true,\n \"Compare long strings same length different partial length\"\n );\n require(\n \"0123456789012345012345678901234a\".compare(\n 0,\n 32,\n \"0123456789012345012345678901234b\",\n 0,\n 32\n ) <\n 0 ==\n true,\n \"Compare strings exactly 32 characters long\"\n );\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\n \"a\".compare(\"b\") < 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"b\".compare(\"a\") > 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"aa\".compare(\"ab\") < 0 == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"a\".compare(\"aa\") < 0 == true,\n \"Compare different value with different length\"\n );\n require(\n \"aa\".compare(\"a\") > 0 == true,\n \"Compare different value with different length\"\n );\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(\n longChar.compare(longChar) == 0 == true,\n \"Compares more than 32 bytes char\"\n );\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(\n longChar.compare(otherLongChar) < 0 == true,\n \"Compare long char with difference at start\"\n );\n }\n\n function testSubstring() public pure {\n require(\n keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")),\n \"Copy 0 bytes\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 4))) ==\n keccak256(bytes(\"hell\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(1, 4))) ==\n keccak256(bytes(\"ello\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 5))) ==\n keccak256(bytes(\"hello\")),\n \"Copy whole string\"\n );\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(\n bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) ==\n bytes32(\n 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000\n ),\n \"readBytes20\"\n );\n }\n\n function testReadBytes32() public pure {\n require(\n \"0123456789abcdef0123456789abcdef\".readBytes32(0) ==\n bytes32(\n 0x3031323334353637383961626364656630313233343536373839616263646566\n ),\n \"readBytes32\"\n );\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\n \"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")),\n \"Decode 'a'\"\n );\n require(\n \"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")),\n \"Decode 'aa'\"\n );\n require(\n \"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")),\n \"Decode 'aaa'\"\n );\n require(\n \"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")),\n \"Decode 'aaaa'\"\n );\n require(\n \"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa'\"\n );\n require(\n \"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa' lowercase\"\n );\n require(\n \"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet\"\n );\n require(\n \"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet lowercase\"\n );\n require(\n \"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\"\n .base32HexDecodeWord(0, 52) ==\n bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"),\n \"Decode 32*'a'\"\n );\n require(\n \" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\"\n .base32HexDecodeWord(1, 32) ==\n bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"),\n \"Decode real bytes32hex\"\n );\n }\n}\n" + }, + "contracts/test/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/utils/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex\"00\".nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex\"00\".labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex\"016100\".labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(\n hex\"016201610000\".labelCount(0) == 2,\n \"labelCount('b.a.') == 2\"\n );\n require(\n hex\"066574686c61620378797a00\".labelCount(6 + 1) == 1,\n \"nameLength('(bthlab).xyz.') == 6\"\n );\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes\n memory rrs = hex\"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101\";\n bytes[2] memory names = [bytes(hex\"016100\"), bytes(hex\"0162016100\")];\n bytes[2] memory rdatas = [bytes(hex\"74000001\"), bytes(hex\"c0a80101\")];\n uint i = 0;\n for (\n RRUtils.RRIterator memory iter = rrs.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(\n keccak256(iter.name()) == keccak256(names[i]),\n \"Name matches\"\n );\n require(\n keccak256(iter.rdata()) == keccak256(rdatas[i]),\n \"Rdata matches\"\n );\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex\"066274686c61620378797a00\";\n bytes memory ethLabXyz = hex\"066574686c61620378797a00\";\n bytes memory xyz = hex\"0378797a00\";\n bytes memory a_b_c = hex\"01610162016300\";\n bytes memory b_b_c = hex\"01620162016300\";\n bytes memory c = hex\"016300\";\n bytes memory d = hex\"016400\";\n bytes memory a_d_c = hex\"01610164016300\";\n bytes memory b_a_c = hex\"01620161016300\";\n bytes memory ab_c_d = hex\"0261620163016400\";\n bytes memory a_c_d = hex\"01610163016400\";\n bytes\n memory verylong1_eth = hex\"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n bytes\n memory verylong2_eth = hex\"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n\n require(\n hex\"0301616100\".compareNames(hex\"0302616200\") < 0,\n \"label lengths are correctly checked\"\n );\n require(\n a_b_c.compareNames(c) > 0,\n \"one name has a difference of >1 label to with the same root name\"\n );\n require(\n a_b_c.compareNames(d) < 0,\n \"one name has a difference of >1 label to with different root name\"\n );\n require(\n a_b_c.compareNames(a_d_c) < 0,\n \"two names start the same but have differences in later labels\"\n );\n require(\n a_b_c.compareNames(b_a_c) > 0,\n \"the first label sorts later, but the first label sorts earlier\"\n );\n require(\n ab_c_d.compareNames(a_c_d) > 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(\n a_b_c.compareNames(b_b_c) < 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(\n bthLabXyz.compareNames(ethLabXyz) < 0,\n \"bthLab.xyz comes before ethLab.xyz\"\n );\n require(\n bthLabXyz.compareNames(bthLabXyz) == 0,\n \"bthLab.xyz and bthLab.xyz are the same\"\n );\n require(\n ethLabXyz.compareNames(bthLabXyz) > 0,\n \"ethLab.xyz comes after bethLab.xyz\"\n );\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(\n verylong1_eth.compareNames(verylong2_eth) > 0,\n \"longa.vlong.eth comes after long.vlong.eth\"\n );\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(\n RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA),\n \"0x11111111 >= 0xAAAAAAAA\"\n );\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(\n hex\"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d\"\n .computeKeytag() == 19036,\n \"Invalid keytag\"\n );\n require(\n hex\"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf\"\n .computeKeytag() == 21693,\n \"Invalid keytag (2)\"\n );\n require(\n hex\"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3\"\n .computeKeytag() == 33630\n );\n require(\n hex\"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5\"\n .computeKeytag() == 20326,\n \"Invalid keytag (3)\"\n );\n }\n}\n" + }, + "contracts/utils/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/utils/DummyRevertResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ncontract DummyRevertResolver {\n function resolve(\n bytes calldata,\n bytes calldata\n ) external pure returns (bytes memory) {\n revert(\"Not Supported\");\n }\n\n function supportsInterface(bytes4) external pure returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32, bool) {\n require(lastIdx - idx <= 64);\n (bytes memory r, bool valid) = hexToBytes(str, idx, lastIdx);\n if (!valid) {\n return (bytes32(0), false);\n }\n bytes32 ret;\n assembly {\n ret := shr(mul(4, sub(64, sub(lastIdx, idx))), mload(add(r, 32)))\n }\n return (ret, true);\n }\n\n function hexToBytes(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes memory r, bool valid) {\n uint256 hexLength = lastIdx - idx;\n if (hexLength % 2 == 1) {\n revert(\"Invalid string length\");\n }\n r = new bytes(hexLength / 2);\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n mstore8(add(add(r, 32), div(sub(i, idx), 2)), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n\n /**\n * @dev Attempts to convert an address to a hex string\n * @param addr The _addr to parse\n */\n function addressToHex(address addr) internal pure returns (string memory) {\n bytes memory hexString = new bytes(40);\n for (uint i = 0; i < 20; i++) {\n bytes1 byteValue = bytes1(uint8(uint160(addr) >> (8 * (19 - i))));\n bytes1 highNibble = bytes1(uint8(byteValue) / 16);\n bytes1 lowNibble = bytes1(\n uint8(byteValue) - 16 * uint8(highNibble)\n );\n hexString[2 * i] = _nibbleToHexChar(highNibble);\n hexString[2 * i + 1] = _nibbleToHexChar(lowNibble);\n }\n return string(hexString);\n }\n\n function _nibbleToHexChar(\n bytes1 nibble\n ) internal pure returns (bytes1 hexChar) {\n if (uint8(nibble) < 10) return bytes1(uint8(nibble) + 0x30);\n else return bytes1(uint8(nibble) + 0x57);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n return functionStaticCall(target, data, gasleft());\n }\n\n /**\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @param gasLimit The gas limit to use for the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n uint256 gasLimit\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gasLimit,\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../utils/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n\n /**\n * @dev Escapes special characters in a given string\n *\n * @param str The string to escape\n * @return The escaped string\n */\n function escape(string memory str) internal pure returns (string memory) {\n bytes memory strBytes = bytes(str);\n uint extraChars = 0;\n\n // count extra space needed for escaping\n for (uint i = 0; i < strBytes.length; i++) {\n if (_needsEscaping(strBytes[i])) {\n extraChars++;\n }\n }\n\n // allocate buffer with the exact size needed\n bytes memory buffer = new bytes(strBytes.length + extraChars);\n uint index = 0;\n\n // escape characters\n for (uint i = 0; i < strBytes.length; i++) {\n if (_needsEscaping(strBytes[i])) {\n buffer[index++] = \"\\\\\";\n buffer[index++] = _getEscapedChar(strBytes[i]);\n } else {\n buffer[index++] = strBytes[i];\n }\n }\n\n return string(buffer);\n }\n\n // determine if a character needs escaping\n function _needsEscaping(bytes1 char) private pure returns (bool) {\n return\n char == '\"' ||\n char == \"/\" ||\n char == \"\\\\\" ||\n char == \"\\n\" ||\n char == \"\\r\" ||\n char == \"\\t\";\n }\n\n // get the escaped character\n function _getEscapedChar(bytes1 char) private pure returns (bytes1) {\n if (char == \"\\n\") return \"n\";\n if (char == \"\\r\") return \"r\";\n if (char == \"\\t\") return \"t\";\n return char;\n }\n}\n" + }, + "contracts/utils/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"./BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32, uint256) {\n return name.readLabel(offset);\n }\n\n function namehash(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32) {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/utils/TestHexUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {HexUtils} from \"./HexUtils.sol\";\n\ncontract TestHexUtils {\n using HexUtils for *;\n\n function hexToBytes(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes memory, bool) {\n return name.hexToBytes(idx, lastInx);\n }\n\n function hexStringToBytes32(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes32, bool) {\n return name.hexStringToBytes32(idx, lastInx);\n }\n\n function hexToAddress(\n bytes calldata input,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (address, bool) {\n return input.hexToAddress(idx, lastInx);\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(\n string memory name\n ) public pure returns (bytes memory, bytes32) {\n return name.dnsEncodeName();\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {BytesUtils} from \"../utils/BytesUtils.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nerror ResolverNotContract();\n\nerror ResolverError(bytes returnData);\n\nerror HttpError(HttpErrorItem[] errors);\n\nstruct HttpErrorItem {\n uint16 status;\n string message;\n}\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct MulticallChecks {\n bool isCallback;\n bool hasExtendedResolver;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\nstruct Result {\n bool success;\n bytes returnData;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (Result[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (Result[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (Result[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (Result[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n if (!resolverAddress.isContract()) {\n revert ResolverNotContract();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory reverseResolvedData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n reverseResolvedData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (Result[] memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n Result[] memory results,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(result.returnData, (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n result.returnData,\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (Result[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data,\n bool isSafe\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n if (isSafe) {\n result = LowLevelCallUtils.functionStaticCall(target, data);\n } else {\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\n }\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _checkInterface(\n address resolver,\n bytes4 interfaceId\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _checkSafetyAndItem(\n bytes memory name,\n bytes memory item,\n address resolver,\n MulticallChecks memory multicallChecks\n ) internal view returns (bool, bytes memory) {\n if (!multicallChecks.isCallback) {\n if (multicallChecks.hasExtendedResolver) {\n return (\n true,\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\n );\n }\n return (_checkInterface(resolver, bytes4(item)), item);\n }\n return (true, item);\n }\n\n function _checkMulticall(\n MulticallData memory multicallData\n ) internal view returns (MulticallChecks memory) {\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _checkInterface(\n multicallData.resolver,\n type(IExtendedResolver).interfaceId\n );\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n return MulticallChecks(isCallback, hasExtendedResolver);\n }\n\n function _checkResolveSingle(Result memory result) internal pure {\n if (!result.success) {\n if (bytes4(result.returnData) == HttpError.selector) {\n bytes memory returnData = result.returnData;\n assembly {\n revert(add(returnData, 32), mload(returnData))\n }\n }\n revert ResolverError(result.returnData);\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (Result[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new Result[](length);\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n\n if (failure) {\n results[i] = Result(false, item);\n continue;\n }\n\n bool isSafe = false;\n (isSafe, item) = _checkSafetyAndItem(\n multicallData.name,\n item,\n multicallData.resolver,\n multicallChecks\n );\n\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(\n multicallData.resolver,\n item,\n isSafe\n );\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && multicallChecks.hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = Result(success, returnData);\n extraDatas[i].data = item;\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../../utils/BytesUtils.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../../utils/BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(\n name,\n wrappedOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../utils/BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable,\n ReverseClaimer\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE and set expiry to max */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the owner of a name\n * @param id Namehash of the name\n * @return operator Approved operator of a name\n */\n\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /**\n * @notice Approves an address for a name\n * @param to address to approve\n * @param tokenId name to approve\n */\n\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or operator of the owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or operator\n */\n\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Checks if owner/operator or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner/operator or approved\n */\n\n function canExtendSubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public returns (uint64 expiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // Set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (!_isWrapped(node)) {\n revert NameIsNotWrapped();\n }\n\n // this flag is used later, when checking fuses\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // Max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n address approved = getApproved(uint256(node));\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(parentNode, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /**\n * @notice Checks if a name is wrapped in a more gas efficient way\n * @param parentNode Namehash of the name\n * @param labelhash Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != ETH_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + }, + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {BytesUtils} from \"../../utils/BytesUtils.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external view override returns (bool) {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/solcInputs/a57ee6145a733d774c1e1946fd5c16b8.json b/solidity/dns-contracts/deployments/mainnet/solcInputs/a57ee6145a733d774c1e1946fd5c16b8.json new file mode 100644 index 0000000..afd7928 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/solcInputs/a57ee6145a733d774c1e1946fd5c16b8.json @@ -0,0 +1,446 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (iter.name().compareNames(buf.buf) != 0) continue;\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(\n uint16 _expectedType,\n bytes memory _expectedName,\n uint32 _inception,\n uint64 _inserted,\n bytes memory _proof\n ) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if (_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(\n uint16 dnstype,\n bytes memory name\n ) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyExtendedDNSSECResolver is IExtendedDNSResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes memory /* name */,\n bytes memory /* data */,\n bytes memory context\n ) external view override returns (bytes memory) {\n return abi.encode(context);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyLegacyTextResolver is ITextResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(ITextResolver).interfaceId;\n }\n\n function text(\n bytes32 /* node */,\n string calldata key\n ) external view override returns (string memory) {\n return key;\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyNonCCIPAwareResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../OffchainDNSResolver.sol\";\nimport \"../../resolvers/profiles/IExtendedResolver.sol\";\n\ncontract DummyNonCCIPAwareResolver is IExtendedResolver, ERC165 {\n OffchainDNSResolver dnsResolver;\n\n constructor(OffchainDNSResolver _dnsResolver) {\n dnsResolver = _dnsResolver;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(dnsResolver),\n urls,\n data,\n OffchainDNSResolver.resolveCallback.selector,\n data\n );\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyParser.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../dnssec-oracle/BytesUtils.sol\";\nimport \"../RecordParser.sol\";\n\ncontract DummyParser {\n using BytesUtils for bytes;\n\n // parse data in format: name;key1=value1 key2=value2;url\n function parseData(\n bytes memory data,\n uint256 kvCount\n )\n external\n pure\n returns (\n string memory name,\n string[] memory keys,\n string[] memory values,\n string memory url\n )\n {\n uint256 len = data.length;\n // retrieve name\n uint256 sep1 = data.find(0, len, \";\");\n name = string(data.substring(0, sep1));\n\n // retrieve url\n uint256 sep2 = data.find(sep1 + 1, len - sep1, \";\");\n url = string(data.substring(sep2 + 1, len - sep2 - 1));\n\n keys = new string[](kvCount);\n values = new string[](kvCount);\n // retrieve keys and values\n uint256 offset = sep1 + 1;\n for (uint256 i; i < kvCount && offset < len; i++) {\n (\n bytes memory key,\n bytes memory val,\n uint256 nextOffset\n ) = RecordParser.readKeyValue(data, offset, sep2 - offset);\n keys[i] = string(key);\n values[i] = string(val);\n offset = nextOffset;\n }\n }\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"../utils/LowLevelCallUtils.sol\";\n\nerror InvalidOperation();\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver, IERC165 {\n using RRUtils for *;\n using Address for address;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedResolver).interfaceId;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n revertWithDefaultOffchainLookup(name, data);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query, bytes4 selector) = abi.decode(\n extraData,\n (bytes, bytes, bytes4)\n );\n\n if (selector != bytes4(0)) {\n (bytes memory targetData, address targetResolver) = abi.decode(\n query,\n (bytes, address)\n );\n return\n callWithOffchainLookupPropagation(\n targetResolver,\n name,\n query,\n abi.encodeWithSelector(\n selector,\n response,\n abi.encode(targetData, address(this))\n )\n );\n }\n\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n callWithOffchainLookupPropagation(\n dnsresolver,\n name,\n query,\n abi.encodeCall(\n IExtendedDNSResolver.resolve,\n (name, query, context)\n )\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return\n callWithOffchainLookupPropagation(\n dnsresolver,\n name,\n query,\n abi.encodeCall(\n IExtendedResolver.resolve,\n (name, query)\n )\n );\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory name,\n bytes memory innerdata,\n bytes memory data\n ) internal view returns (bytes memory) {\n if (!target.isContract()) {\n revertWithDefaultOffchainLookup(name, innerdata);\n }\n\n bool result = LowLevelCallUtils.functionStaticCall(\n address(target),\n data\n );\n uint256 size = LowLevelCallUtils.returnDataSize();\n if (result) {\n bytes memory returnData = LowLevelCallUtils.readReturnData(0, size);\n return abi.decode(returnData, (bytes));\n }\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n if (bytes4(errorId) == OffchainLookup.selector) {\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n handleOffchainLookupError(revertData, target, name);\n }\n }\n LowLevelCallUtils.propagateRevert();\n }\n\n function revertWithDefaultOffchainLookup(\n bytes memory name,\n bytes memory data\n ) internal view {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, data, bytes4(0))\n );\n }\n\n function handleOffchainLookupError(\n bytes memory returnData,\n address target,\n bytes memory name\n ) internal view {\n (\n address sender,\n string[] memory urls,\n bytes memory callData,\n bytes4 innerCallbackFunction,\n bytes memory extraData\n ) = abi.decode(returnData, (address, string[], bytes, bytes4, bytes));\n\n if (sender != target) {\n revert InvalidOperation();\n }\n\n revert OffchainLookup(\n address(this),\n urls,\n callData,\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, extraData, innerCallbackFunction)\n );\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (bytes memory key, bytes memory value, uint256 nextOffset)\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = len + offset;\n nextOffset = terminator;\n } else {\n nextOffset = terminator + 1;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n event SuffixAdded(bytes suffix);\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n emit SuffixAdded(names[i]);\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256[3] memory P) {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (uint256 x, uint256 y, uint256 z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(\n uint256 x0,\n uint256 y0\n ) internal pure returns (bool isZero) {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(\n uint256 scalar\n ) internal pure returns (uint256, uint256) {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(\n bytes calldata,\n bytes calldata\n ) external pure override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input\n )\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n )\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(\n RRUtils.SignedSet memory rrset,\n uint16 typecovered\n ) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if (address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns (bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 {\n totallen := add(totallen, 64)\n }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for {\n let i := 0\n } lt(i, totallen) {\n i := add(i, 64)\n } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 {\n mstore8(add(scratch, sub(len, i)), 0x80)\n }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 {\n mstore(\n add(scratch, 32),\n or(mload(add(scratch, 32)), mul(len, 8))\n )\n }\n\n // Expand the 16 32-bit words into 80\n for {\n let j := 64\n } lt(j, 128) {\n j := add(j, 12)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 12))),\n mload(add(scratch, sub(j, 32)))\n ),\n xor(\n mload(add(scratch, sub(j, 56))),\n mload(add(scratch, sub(j, 64)))\n )\n )\n temp := or(\n and(\n mul(temp, 2),\n 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE\n ),\n and(\n div(temp, 0x80000000),\n 0x0000000100000001000000010000000100000001000000010000000100000001\n )\n )\n mstore(add(scratch, j), temp)\n }\n for {\n let j := 128\n } lt(j, 320) {\n j := add(j, 24)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 24))),\n mload(add(scratch, sub(j, 64)))\n ),\n xor(\n mload(add(scratch, sub(j, 112))),\n mload(add(scratch, sub(j, 128)))\n )\n )\n temp := or(\n and(\n mul(temp, 4),\n 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC\n ),\n and(\n div(temp, 0x40000000),\n 0x0000000300000003000000030000000300000003000000030000000300000003\n )\n )\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for {\n let j := 0\n } lt(j, 80) {\n j := add(j, 1)\n } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(\n div(x, 0x100000000000000000000),\n div(x, 0x10000000000)\n )\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := and(div(x, 0x10000000000), f)\n f := or(\n and(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n ),\n f\n )\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(\n div(\n x,\n 0x80000000000000000000000000000000000000000000000\n ),\n 0x1F\n )\n temp := or(\n and(\n div(x, 0x800000000000000000000000000000000000000),\n 0xFFFFFFE0\n ),\n temp\n )\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(\n div(\n mload(add(scratch, mul(j, 4))),\n 0x100000000000000000000000000000000000000000000000000000000\n ),\n temp\n )\n x := or(\n div(x, 0x10000000000),\n mul(temp, 0x10000000000000000000000000000000000000000)\n )\n x := or(\n and(\n x,\n 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF\n ),\n mul(\n or(\n and(div(x, 0x4000000000000), 0xC0000000),\n and(div(x, 0x400000000000000000000), 0x3FFFFFFF)\n ),\n 0x100000000000000000000\n )\n )\n }\n\n h := and(\n add(h, x),\n 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF\n )\n }\n ret := mul(\n or(\n or(\n or(\n or(\n and(\n div(h, 0x100000000),\n 0xFFFFFFFF00000000000000000000000000000000\n ),\n and(\n div(h, 0x1000000),\n 0xFFFFFFFF000000000000000000000000\n )\n ),\n and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)\n ),\n and(div(h, 0x100), 0xFFFFFFFF00000000)\n ),\n and(h, 0xFFFFFFFF)\n ),\n 0x1000000000000000000000000\n )\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/ILinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface ILinearPremiumPriceOracle {\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256);\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns (address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping(bytes32 => address) addresses;\n\n constructor() public {}\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Implements a dummy NameWrapper which returns the caller's address\n */\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"../../resolvers/profiles/IAddressResolver.sol\";\nimport \"../../resolvers/profiles/IAddrResolver.sol\";\nimport \"../../utils/HexUtils.sol\";\n\ncontract ExtendedDNSResolver is IExtendedDNSResolver, IERC165 {\n using HexUtils for *;\n\n uint256 private constant COIN_TYPE_ETH = 60;\n\n error NotImplemented();\n error InvalidAddressFormat();\n\n function supportsInterface(\n bytes4 interfaceId\n ) external view virtual override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data,\n bytes calldata context\n ) external pure override returns (bytes memory) {\n bytes4 selector = bytes4(data);\n if (\n selector == IAddrResolver.addr.selector ||\n selector == IAddressResolver.addr.selector\n ) {\n if (selector == IAddressResolver.addr.selector) {\n (, uint256 coinType) = abi.decode(data[4:], (bytes32, uint256));\n if (coinType != COIN_TYPE_ETH) return abi.encode(\"\");\n }\n (address record, bool valid) = context.hexToAddress(\n 2,\n context.length\n );\n if (!valid) revert InvalidAddressFormat();\n return abi.encode(record);\n }\n revert NotImplemented();\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ReverseClaimer\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/utils/DummyRevertResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ncontract DummyRevertResolver {\n function resolve(\n bytes calldata,\n bytes calldata\n ) external pure returns (bytes memory) {\n revert(\"Not Supported\");\n }\n\n function supportsInterface(bytes4) external pure returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n uint256 hexLength = lastIdx - idx;\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\n revert(\"Invalid string length\");\n }\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/TestHexUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {HexUtils} from \"./HexUtils.sol\";\n\ncontract TestHexUtils {\n using HexUtils for *;\n\n function hexStringToBytes32(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes32, bool) {\n return name.hexStringToBytes32(idx, lastInx);\n }\n\n function hexToAddress(\n bytes calldata input,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (address, bool) {\n return input.hexToAddress(idx, lastInx);\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(\n string memory name\n ) public pure returns (bytes memory, bytes32) {\n return name.dnsEncodeName();\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (bytes[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes[] memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (bytes[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n result = LowLevelCallUtils.functionStaticCall(address(target), data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _hasExtendedResolver(\n address resolver\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(\n type(IExtendedResolver).interfaceId\n )\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (bytes[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _hasExtendedResolver(multicallData.resolver);\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = item;\n continue;\n }\n if (!isCallback && hasExtendedResolver) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = returnData;\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(\n name,\n wrappedOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable,\n ReverseClaimer\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE and set expiry to max */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the owner of a name\n * @param id Namehash of the name\n * @return operator Approved operator of a name\n */\n\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /**\n * @notice Approves an address for a name\n * @param to address to approve\n * @param tokenId name to approve\n */\n\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or operator of the owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or operator\n */\n\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Checks if owner/operator or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner/operator or approved\n */\n\n function canExtendSubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public returns (uint64 expiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // Set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (!_isWrapped(node)) {\n revert NameIsNotWrapped();\n }\n\n // this flag is used later, when checking fuses\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // Max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n address approved = getApproved(uint256(node));\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(parentNode, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /**\n * @notice Checks if a name is wrapped in a more gas efficient way\n * @param parentNode Namehash of the name\n * @param labelhash Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != ETH_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + }, + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external view override returns (bool) {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32, uint256) {\n return name.readLabel(offset);\n }\n\n function namehash(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32) {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\n \"\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n require(\n \"foo\".keccak(0, 3) ==\n bytes32(\n 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d\n ),\n \"Incorrect hash of 'foo'\"\n );\n require(\n \"foo\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\n \"hello\".equals(1, \"ello\") == true,\n \"Substring to string equality\"\n );\n require(\n \"hello\".equals(1, \"jello\", 1, 4) == true,\n \"Substring to substring equality\"\n );\n require(\n \"zhello\".equals(1, \"abchello\", 3) == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"0x0102030000\".equals(0, \"0x010203\") == false,\n \"Compare with offset and trailing bytes\"\n );\n }\n\n function testComparePartial() public pure {\n require(\n \"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true,\n \"Compare same length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true,\n \"Compare different length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true,\n \"Compare same with different offset\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 33\n ) ==\n 0 ==\n true,\n \"Compare different long strings same length smaller partial length which must be equal\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 34\n ) <\n 0 ==\n true,\n \"Compare long strings same length different partial length\"\n );\n require(\n \"0123456789012345012345678901234a\".compare(\n 0,\n 32,\n \"0123456789012345012345678901234b\",\n 0,\n 32\n ) <\n 0 ==\n true,\n \"Compare strings exactly 32 characters long\"\n );\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\n \"a\".compare(\"b\") < 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"b\".compare(\"a\") > 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"aa\".compare(\"ab\") < 0 == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"a\".compare(\"aa\") < 0 == true,\n \"Compare different value with different length\"\n );\n require(\n \"aa\".compare(\"a\") > 0 == true,\n \"Compare different value with different length\"\n );\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(\n longChar.compare(longChar) == 0 == true,\n \"Compares more than 32 bytes char\"\n );\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(\n longChar.compare(otherLongChar) < 0 == true,\n \"Compare long char with difference at start\"\n );\n }\n\n function testSubstring() public pure {\n require(\n keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")),\n \"Copy 0 bytes\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 4))) ==\n keccak256(bytes(\"hell\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(1, 4))) ==\n keccak256(bytes(\"ello\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 5))) ==\n keccak256(bytes(\"hello\")),\n \"Copy whole string\"\n );\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(\n bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) ==\n bytes32(\n 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000\n ),\n \"readBytes20\"\n );\n }\n\n function testReadBytes32() public pure {\n require(\n \"0123456789abcdef0123456789abcdef\".readBytes32(0) ==\n bytes32(\n 0x3031323334353637383961626364656630313233343536373839616263646566\n ),\n \"readBytes32\"\n );\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\n \"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")),\n \"Decode 'a'\"\n );\n require(\n \"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")),\n \"Decode 'aa'\"\n );\n require(\n \"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")),\n \"Decode 'aaa'\"\n );\n require(\n \"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")),\n \"Decode 'aaaa'\"\n );\n require(\n \"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa'\"\n );\n require(\n \"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa' lowercase\"\n );\n require(\n \"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet\"\n );\n require(\n \"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet lowercase\"\n );\n require(\n \"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\"\n .base32HexDecodeWord(0, 52) ==\n bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"),\n \"Decode 32*'a'\"\n );\n require(\n \" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\"\n .base32HexDecodeWord(1, 32) ==\n bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"),\n \"Decode real bytes32hex\"\n );\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex\"00\".nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex\"00\".labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex\"016100\".labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(\n hex\"016201610000\".labelCount(0) == 2,\n \"labelCount('b.a.') == 2\"\n );\n require(\n hex\"066574686c61620378797a00\".labelCount(6 + 1) == 1,\n \"nameLength('(bthlab).xyz.') == 6\"\n );\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes\n memory rrs = hex\"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101\";\n bytes[2] memory names = [bytes(hex\"016100\"), bytes(hex\"0162016100\")];\n bytes[2] memory rdatas = [bytes(hex\"74000001\"), bytes(hex\"c0a80101\")];\n uint i = 0;\n for (\n RRUtils.RRIterator memory iter = rrs.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(\n keccak256(iter.name()) == keccak256(names[i]),\n \"Name matches\"\n );\n require(\n keccak256(iter.rdata()) == keccak256(rdatas[i]),\n \"Rdata matches\"\n );\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex\"066274686c61620378797a00\";\n bytes memory ethLabXyz = hex\"066574686c61620378797a00\";\n bytes memory xyz = hex\"0378797a00\";\n bytes memory a_b_c = hex\"01610162016300\";\n bytes memory b_b_c = hex\"01620162016300\";\n bytes memory c = hex\"016300\";\n bytes memory d = hex\"016400\";\n bytes memory a_d_c = hex\"01610164016300\";\n bytes memory b_a_c = hex\"01620161016300\";\n bytes memory ab_c_d = hex\"0261620163016400\";\n bytes memory a_c_d = hex\"01610163016400\";\n bytes\n memory verylong1_eth = hex\"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n bytes\n memory verylong2_eth = hex\"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n\n require(\n hex\"0301616100\".compareNames(hex\"0302616200\") < 0,\n \"label lengths are correctly checked\"\n );\n require(\n a_b_c.compareNames(c) > 0,\n \"one name has a difference of >1 label to with the same root name\"\n );\n require(\n a_b_c.compareNames(d) < 0,\n \"one name has a difference of >1 label to with different root name\"\n );\n require(\n a_b_c.compareNames(a_d_c) < 0,\n \"two names start the same but have differences in later labels\"\n );\n require(\n a_b_c.compareNames(b_a_c) > 0,\n \"the first label sorts later, but the first label sorts earlier\"\n );\n require(\n ab_c_d.compareNames(a_c_d) > 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(\n a_b_c.compareNames(b_b_c) < 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(\n bthLabXyz.compareNames(ethLabXyz) < 0,\n \"bthLab.xyz comes before ethLab.xyz\"\n );\n require(\n bthLabXyz.compareNames(bthLabXyz) == 0,\n \"bthLab.xyz and bthLab.xyz are the same\"\n );\n require(\n ethLabXyz.compareNames(bthLabXyz) > 0,\n \"ethLab.xyz comes after bethLab.xyz\"\n );\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(\n verylong1_eth.compareNames(verylong2_eth) > 0,\n \"longa.vlong.eth comes after long.vlong.eth\"\n );\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(\n RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA),\n \"0x11111111 >= 0xAAAAAAAA\"\n );\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(\n hex\"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d\"\n .computeKeytag() == 19036,\n \"Invalid keytag\"\n );\n require(\n hex\"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf\"\n .computeKeytag() == 21693,\n \"Invalid keytag (2)\"\n );\n require(\n hex\"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3\"\n .computeKeytag() == 33630\n );\n require(\n hex\"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5\"\n .computeKeytag() == 20326,\n \"Invalid keytag (3)\"\n );\n }\n}\n" + }, + "test/registry/mocks/DummyResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyResolver {\n mapping(bytes32 => string) public name;\n\n function setName(bytes32 node, string memory _name) public {\n name[node] = _name;\n }\n}\n" + }, + "test/reverseRegistrar/mocks/MockReverseClaimerImplementer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../../../contracts/registry/ENS.sol\";\nimport {ReverseClaimer} from \"../../../contracts/reverseRegistrar/ReverseClaimer.sol\";\n\ncontract MockReverseClaimerImplementer is ReverseClaimer {\n constructor(ENS ens, address claimant) ReverseClaimer(ens, claimant) {}\n}\n" + }, + "test/utils/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n if (bytes4(extraData) == bytes4(keccak256(\"name(bytes32)\"))) {\n return abi.encode(\"offchain.test.eth\");\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "test/utils/mocks/LegacyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\ncontract LegacyResolver {\n function addr(bytes32 /* node */) public view returns (address) {\n return address(this);\n }\n}\n" + }, + "test/utils/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10 ** uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10 ** uint256(decimals()));\n }\n }\n}\n" + }, + "test/utils/mocks/MockOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract MockOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n MockOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (, bytes memory callData, ) = abi.decode(\n extraData,\n (bytes, bytes, bytes4)\n );\n if (bytes4(callData) == bytes4(keccak256(\"addr(bytes32)\"))) {\n (bytes memory result, , ) = abi.decode(\n response,\n (bytes, uint64, bytes)\n );\n return result;\n }\n return abi.encode(address(this));\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/solcInputs/ad37cc3cd3f1925923b5003f9803ae69.json b/solidity/dns-contracts/deployments/mainnet/solcInputs/ad37cc3cd3f1925923b5003f9803ae69.json new file mode 100644 index 0000000..7f5f250 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/solcInputs/ad37cc3cd3f1925923b5003f9803ae69.json @@ -0,0 +1,158 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1300 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/solcInputs/b8a92c9207ae2a5ea22df4d7303f97f4.json b/solidity/dns-contracts/deployments/mainnet/solcInputs/b8a92c9207ae2a5ea22df4d7303f97f4.json new file mode 100644 index 0000000..068c6c5 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/solcInputs/b8a92c9207ae2a5ea22df4d7303f97f4.json @@ -0,0 +1,101 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n return functionStaticCall(target, data, gasleft());\n }\n\n /**\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @param gasLimit The gas limit to use for the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n uint256 gasLimit\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gasLimit,\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nerror ResolverNotContract();\n\nerror ResolverError(bytes returnData);\n\nerror HttpError(HttpErrorItem[] errors);\n\nstruct HttpErrorItem {\n uint16 status;\n string message;\n}\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct MulticallChecks {\n bool isCallback;\n bool hasExtendedResolver;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\nstruct Result {\n bool success;\n bytes returnData;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (Result[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (Result[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (Result[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (Result[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n if (!resolverAddress.isContract()) {\n revert ResolverNotContract();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory reverseResolvedData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n reverseResolvedData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (Result[] memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n Result[] memory results,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n Result memory result = results[0];\n\n if (!result.success) {\n revert ResolverError(result.returnData);\n }\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(result.returnData, (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n result.returnData,\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (Result[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data,\n bool isSafe\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n if (isSafe) {\n result = LowLevelCallUtils.functionStaticCall(target, data);\n } else {\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\n }\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _checkInterface(\n address resolver,\n bytes4 interfaceId\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _checkSafetyAndItem(\n bytes memory name,\n bytes memory item,\n address resolver,\n MulticallChecks memory multicallChecks\n ) internal view returns (bool, bytes memory) {\n if (!multicallChecks.isCallback) {\n if (multicallChecks.hasExtendedResolver) {\n return (\n true,\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\n );\n }\n return (_checkInterface(resolver, bytes4(item)), item);\n }\n return (true, item);\n }\n\n function _checkMulticall(\n MulticallData memory multicallData\n ) internal view returns (MulticallChecks memory) {\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _checkInterface(\n multicallData.resolver,\n type(IExtendedResolver).interfaceId\n );\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n return MulticallChecks(isCallback, hasExtendedResolver);\n }\n\n function _checkResolveSingle(Result memory result) internal pure {\n if (!result.success) {\n if (bytes4(result.returnData) == HttpError.selector) {\n bytes memory returnData = result.returnData;\n assembly {\n revert(add(returnData, 32), mload(returnData))\n }\n }\n revert ResolverError(result.returnData);\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (Result[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new Result[](length);\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n\n if (failure) {\n results[i] = Result(false, item);\n continue;\n }\n\n bool isSafe = false;\n (isSafe, item) = _checkSafetyAndItem(\n multicallData.name,\n item,\n multicallData.resolver,\n multicallChecks\n );\n\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(\n multicallData.resolver,\n item,\n isSafe\n );\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && multicallChecks.hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = Result(success, returnData);\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/solcInputs/dd9e022689821cffaeb04b9ddbda87ae.json b/solidity/dns-contracts/deployments/mainnet/solcInputs/dd9e022689821cffaeb04b9ddbda87ae.json new file mode 100644 index 0000000..6447349 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/solcInputs/dd9e022689821cffaeb04b9ddbda87ae.json @@ -0,0 +1,446 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (iter.name().compareNames(buf.buf) != 0) continue;\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(\n uint16 _expectedType,\n bytes memory _expectedName,\n uint32 _inception,\n uint64 _inserted,\n bytes memory _proof\n ) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if (_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(\n uint16 dnstype,\n bytes memory name\n ) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyExtendedDNSSECResolver is IExtendedDNSResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes memory /* name */,\n bytes memory /* data */,\n bytes memory context\n ) external view override returns (bytes memory) {\n return abi.encode(context);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyLegacyTextResolver is ITextResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(ITextResolver).interfaceId;\n }\n\n function text(\n bytes32 /* node */,\n string calldata key\n ) external view override returns (string memory) {\n return key;\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyNonCCIPAwareResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../OffchainDNSResolver.sol\";\nimport \"../../resolvers/profiles/IExtendedResolver.sol\";\n\ncontract DummyNonCCIPAwareResolver is IExtendedResolver, ERC165 {\n OffchainDNSResolver dnsResolver;\n\n constructor(OffchainDNSResolver _dnsResolver) {\n dnsResolver = _dnsResolver;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(dnsResolver),\n urls,\n data,\n OffchainDNSResolver.resolveCallback.selector,\n data\n );\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyParser.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../dnssec-oracle/BytesUtils.sol\";\nimport \"../RecordParser.sol\";\n\ncontract DummyParser {\n using BytesUtils for bytes;\n\n // parse data in format: name;key1=value1 key2=value2;url\n function parseData(\n bytes memory data,\n uint256 kvCount\n )\n external\n pure\n returns (\n string memory name,\n string[] memory keys,\n string[] memory values,\n string memory url\n )\n {\n uint256 len = data.length;\n // retrieve name\n uint256 sep1 = data.find(0, len, \";\");\n name = string(data.substring(0, sep1));\n\n // retrieve url\n uint256 sep2 = data.find(sep1 + 1, len - sep1, \";\");\n url = string(data.substring(sep2 + 1, len - sep2 - 1));\n\n keys = new string[](kvCount);\n values = new string[](kvCount);\n // retrieve keys and values\n uint256 offset = sep1 + 1;\n for (uint256 i; i < kvCount && offset < len; i++) {\n (\n bytes memory key,\n bytes memory val,\n uint256 nextOffset\n ) = RecordParser.readKeyValue(data, offset, sep2 - offset);\n keys[i] = string(key);\n values[i] = string(val);\n offset = nextOffset;\n }\n }\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"../utils/LowLevelCallUtils.sol\";\n\nerror InvalidOperation();\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver, IERC165 {\n using RRUtils for *;\n using Address for address;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedResolver).interfaceId;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n revertWithDefaultOffchainLookup(name, data);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query, bytes4 selector) = abi.decode(\n extraData,\n (bytes, bytes, bytes4)\n );\n\n if (selector != bytes4(0)) {\n (bytes memory targetData, address targetResolver) = abi.decode(\n query,\n (bytes, address)\n );\n return\n callWithOffchainLookupPropagation(\n targetResolver,\n name,\n query,\n abi.encodeWithSelector(\n selector,\n response,\n abi.encode(targetData, address(this))\n )\n );\n }\n\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n callWithOffchainLookupPropagation(\n dnsresolver,\n name,\n query,\n abi.encodeCall(\n IExtendedDNSResolver.resolve,\n (name, query, context)\n )\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return\n callWithOffchainLookupPropagation(\n dnsresolver,\n name,\n query,\n abi.encodeCall(\n IExtendedResolver.resolve,\n (name, query)\n )\n );\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory name,\n bytes memory innerdata,\n bytes memory data\n ) internal view returns (bytes memory) {\n if (!target.isContract()) {\n revertWithDefaultOffchainLookup(name, innerdata);\n }\n\n bool result = LowLevelCallUtils.functionStaticCall(\n address(target),\n data\n );\n uint256 size = LowLevelCallUtils.returnDataSize();\n if (result) {\n bytes memory returnData = LowLevelCallUtils.readReturnData(0, size);\n return abi.decode(returnData, (bytes));\n }\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n if (bytes4(errorId) == OffchainLookup.selector) {\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n handleOffchainLookupError(revertData, target, name);\n }\n }\n LowLevelCallUtils.propagateRevert();\n }\n\n function revertWithDefaultOffchainLookup(\n bytes memory name,\n bytes memory data\n ) internal view {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, data, bytes4(0))\n );\n }\n\n function handleOffchainLookupError(\n bytes memory returnData,\n address target,\n bytes memory name\n ) internal view {\n (\n address sender,\n string[] memory urls,\n bytes memory callData,\n bytes4 innerCallbackFunction,\n bytes memory extraData\n ) = abi.decode(returnData, (address, string[], bytes, bytes4, bytes));\n\n if (sender != target) {\n revert InvalidOperation();\n }\n\n revert OffchainLookup(\n address(this),\n urls,\n callData,\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, extraData, innerCallbackFunction)\n );\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (bytes memory key, bytes memory value, uint256 nextOffset)\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = len + offset;\n nextOffset = terminator;\n } else {\n nextOffset = terminator + 1;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256[3] memory P) {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (uint256 x, uint256 y, uint256 z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(\n uint256 x0,\n uint256 y0\n ) internal pure returns (bool isZero) {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(\n uint256 scalar\n ) internal pure returns (uint256, uint256) {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(\n bytes calldata,\n bytes calldata\n ) external pure override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input\n )\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n )\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(\n RRUtils.SignedSet memory rrset,\n uint16 typecovered\n ) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if (address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns (bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 {\n totallen := add(totallen, 64)\n }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for {\n let i := 0\n } lt(i, totallen) {\n i := add(i, 64)\n } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 {\n mstore8(add(scratch, sub(len, i)), 0x80)\n }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 {\n mstore(\n add(scratch, 32),\n or(mload(add(scratch, 32)), mul(len, 8))\n )\n }\n\n // Expand the 16 32-bit words into 80\n for {\n let j := 64\n } lt(j, 128) {\n j := add(j, 12)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 12))),\n mload(add(scratch, sub(j, 32)))\n ),\n xor(\n mload(add(scratch, sub(j, 56))),\n mload(add(scratch, sub(j, 64)))\n )\n )\n temp := or(\n and(\n mul(temp, 2),\n 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE\n ),\n and(\n div(temp, 0x80000000),\n 0x0000000100000001000000010000000100000001000000010000000100000001\n )\n )\n mstore(add(scratch, j), temp)\n }\n for {\n let j := 128\n } lt(j, 320) {\n j := add(j, 24)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 24))),\n mload(add(scratch, sub(j, 64)))\n ),\n xor(\n mload(add(scratch, sub(j, 112))),\n mload(add(scratch, sub(j, 128)))\n )\n )\n temp := or(\n and(\n mul(temp, 4),\n 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC\n ),\n and(\n div(temp, 0x40000000),\n 0x0000000300000003000000030000000300000003000000030000000300000003\n )\n )\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for {\n let j := 0\n } lt(j, 80) {\n j := add(j, 1)\n } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(\n div(x, 0x100000000000000000000),\n div(x, 0x10000000000)\n )\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := and(div(x, 0x10000000000), f)\n f := or(\n and(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n ),\n f\n )\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(\n div(\n x,\n 0x80000000000000000000000000000000000000000000000\n ),\n 0x1F\n )\n temp := or(\n and(\n div(x, 0x800000000000000000000000000000000000000),\n 0xFFFFFFE0\n ),\n temp\n )\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(\n div(\n mload(add(scratch, mul(j, 4))),\n 0x100000000000000000000000000000000000000000000000000000000\n ),\n temp\n )\n x := or(\n div(x, 0x10000000000),\n mul(temp, 0x10000000000000000000000000000000000000000)\n )\n x := or(\n and(\n x,\n 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF\n ),\n mul(\n or(\n and(div(x, 0x4000000000000), 0xC0000000),\n and(div(x, 0x400000000000000000000), 0x3FFFFFFF)\n ),\n 0x100000000000000000000\n )\n )\n }\n\n h := and(\n add(h, x),\n 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF\n )\n }\n ret := mul(\n or(\n or(\n or(\n or(\n and(\n div(h, 0x100000000),\n 0xFFFFFFFF00000000000000000000000000000000\n ),\n and(\n div(h, 0x1000000),\n 0xFFFFFFFF000000000000000000000000\n )\n ),\n and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)\n ),\n and(div(h, 0x100), 0xFFFFFFFF00000000)\n ),\n and(h, 0xFFFFFFFF)\n ),\n 0x1000000000000000000000000\n )\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/ILinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface ILinearPremiumPriceOracle {\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256);\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns (address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping(bytes32 => address) addresses;\n\n constructor() public {}\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Implements a dummy NameWrapper which returns the caller's address\n */\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"../../resolvers/profiles/IAddressResolver.sol\";\nimport \"../../resolvers/profiles/IAddrResolver.sol\";\nimport \"../../utils/HexUtils.sol\";\n\ncontract ExtendedDNSResolver is IExtendedDNSResolver, IERC165 {\n using HexUtils for *;\n\n uint256 private constant COIN_TYPE_ETH = 60;\n\n error NotImplemented();\n error InvalidAddressFormat();\n\n function supportsInterface(\n bytes4 interfaceId\n ) external view virtual override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data,\n bytes calldata context\n ) external pure override returns (bytes memory) {\n bytes4 selector = bytes4(data);\n if (\n selector == IAddrResolver.addr.selector ||\n selector == IAddressResolver.addr.selector\n ) {\n if (selector == IAddressResolver.addr.selector) {\n (, uint256 coinType) = abi.decode(data[4:], (bytes32, uint256));\n if (coinType != COIN_TYPE_ETH) return abi.encode(\"\");\n }\n (address record, bool valid) = context.hexToAddress(\n 2,\n context.length\n );\n if (!valid) revert InvalidAddressFormat();\n return abi.encode(record);\n }\n revert NotImplemented();\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ReverseClaimer\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/utils/DummyRevertResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ncontract DummyRevertResolver {\n function resolve(\n bytes calldata,\n bytes calldata\n ) external pure returns (bytes memory) {\n revert(\"Not Supported\");\n }\n\n function supportsInterface(bytes4) external pure returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n uint256 hexLength = lastIdx - idx;\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\n revert(\"Invalid string length\");\n }\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/TestHexUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {HexUtils} from \"./HexUtils.sol\";\n\ncontract TestHexUtils {\n using HexUtils for *;\n\n function hexStringToBytes32(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes32, bool) {\n return name.hexStringToBytes32(idx, lastInx);\n }\n\n function hexToAddress(\n bytes calldata input,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (address, bool) {\n return input.hexToAddress(idx, lastInx);\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(\n string memory name\n ) public pure returns (bytes memory, bytes32) {\n return name.dnsEncodeName();\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (bytes[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes[] memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (bytes[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n result = LowLevelCallUtils.functionStaticCall(address(target), data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _hasExtendedResolver(\n address resolver\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(\n type(IExtendedResolver).interfaceId\n )\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (bytes[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _hasExtendedResolver(multicallData.resolver);\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = item;\n continue;\n }\n if (!isCallback && hasExtendedResolver) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = returnData;\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(\n name,\n wrappedOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable,\n ReverseClaimer\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE and set expiry to max */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the owner of a name\n * @param id Namehash of the name\n * @return operator Approved operator of a name\n */\n\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /**\n * @notice Approves an address for a name\n * @param to address to approve\n * @param tokenId name to approve\n */\n\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or operator of the owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or operator\n */\n\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Checks if owner/operator or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner/operator or approved\n */\n\n function canExtendSubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public returns (uint64 expiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // Set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (!_isWrapped(node)) {\n revert NameIsNotWrapped();\n }\n\n // this flag is used later, when checking fuses\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // Max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n address approved = getApproved(uint256(node));\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(parentNode, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /**\n * @notice Checks if a name is wrapped in a more gas efficient way\n * @param parentNode Namehash of the name\n * @param labelhash Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != ETH_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + }, + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external view override returns (bool) {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32, uint256) {\n return name.readLabel(offset);\n }\n\n function namehash(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32) {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\n \"\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n require(\n \"foo\".keccak(0, 3) ==\n bytes32(\n 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d\n ),\n \"Incorrect hash of 'foo'\"\n );\n require(\n \"foo\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\n \"hello\".equals(1, \"ello\") == true,\n \"Substring to string equality\"\n );\n require(\n \"hello\".equals(1, \"jello\", 1, 4) == true,\n \"Substring to substring equality\"\n );\n require(\n \"zhello\".equals(1, \"abchello\", 3) == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"0x0102030000\".equals(0, \"0x010203\") == false,\n \"Compare with offset and trailing bytes\"\n );\n }\n\n function testComparePartial() public pure {\n require(\n \"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true,\n \"Compare same length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true,\n \"Compare different length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true,\n \"Compare same with different offset\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 33\n ) ==\n 0 ==\n true,\n \"Compare different long strings same length smaller partial length which must be equal\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 34\n ) <\n 0 ==\n true,\n \"Compare long strings same length different partial length\"\n );\n require(\n \"0123456789012345012345678901234a\".compare(\n 0,\n 32,\n \"0123456789012345012345678901234b\",\n 0,\n 32\n ) <\n 0 ==\n true,\n \"Compare strings exactly 32 characters long\"\n );\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\n \"a\".compare(\"b\") < 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"b\".compare(\"a\") > 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"aa\".compare(\"ab\") < 0 == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"a\".compare(\"aa\") < 0 == true,\n \"Compare different value with different length\"\n );\n require(\n \"aa\".compare(\"a\") > 0 == true,\n \"Compare different value with different length\"\n );\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(\n longChar.compare(longChar) == 0 == true,\n \"Compares more than 32 bytes char\"\n );\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(\n longChar.compare(otherLongChar) < 0 == true,\n \"Compare long char with difference at start\"\n );\n }\n\n function testSubstring() public pure {\n require(\n keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")),\n \"Copy 0 bytes\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 4))) ==\n keccak256(bytes(\"hell\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(1, 4))) ==\n keccak256(bytes(\"ello\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 5))) ==\n keccak256(bytes(\"hello\")),\n \"Copy whole string\"\n );\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(\n bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) ==\n bytes32(\n 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000\n ),\n \"readBytes20\"\n );\n }\n\n function testReadBytes32() public pure {\n require(\n \"0123456789abcdef0123456789abcdef\".readBytes32(0) ==\n bytes32(\n 0x3031323334353637383961626364656630313233343536373839616263646566\n ),\n \"readBytes32\"\n );\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\n \"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")),\n \"Decode 'a'\"\n );\n require(\n \"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")),\n \"Decode 'aa'\"\n );\n require(\n \"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")),\n \"Decode 'aaa'\"\n );\n require(\n \"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")),\n \"Decode 'aaaa'\"\n );\n require(\n \"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa'\"\n );\n require(\n \"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa' lowercase\"\n );\n require(\n \"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet\"\n );\n require(\n \"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet lowercase\"\n );\n require(\n \"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\"\n .base32HexDecodeWord(0, 52) ==\n bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"),\n \"Decode 32*'a'\"\n );\n require(\n \" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\"\n .base32HexDecodeWord(1, 32) ==\n bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"),\n \"Decode real bytes32hex\"\n );\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex\"00\".nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex\"00\".labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex\"016100\".labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(\n hex\"016201610000\".labelCount(0) == 2,\n \"labelCount('b.a.') == 2\"\n );\n require(\n hex\"066574686c61620378797a00\".labelCount(6 + 1) == 1,\n \"nameLength('(bthlab).xyz.') == 6\"\n );\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes\n memory rrs = hex\"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101\";\n bytes[2] memory names = [bytes(hex\"016100\"), bytes(hex\"0162016100\")];\n bytes[2] memory rdatas = [bytes(hex\"74000001\"), bytes(hex\"c0a80101\")];\n uint i = 0;\n for (\n RRUtils.RRIterator memory iter = rrs.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(\n keccak256(iter.name()) == keccak256(names[i]),\n \"Name matches\"\n );\n require(\n keccak256(iter.rdata()) == keccak256(rdatas[i]),\n \"Rdata matches\"\n );\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex\"066274686c61620378797a00\";\n bytes memory ethLabXyz = hex\"066574686c61620378797a00\";\n bytes memory xyz = hex\"0378797a00\";\n bytes memory a_b_c = hex\"01610162016300\";\n bytes memory b_b_c = hex\"01620162016300\";\n bytes memory c = hex\"016300\";\n bytes memory d = hex\"016400\";\n bytes memory a_d_c = hex\"01610164016300\";\n bytes memory b_a_c = hex\"01620161016300\";\n bytes memory ab_c_d = hex\"0261620163016400\";\n bytes memory a_c_d = hex\"01610163016400\";\n bytes\n memory verylong1_eth = hex\"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n bytes\n memory verylong2_eth = hex\"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n\n require(\n hex\"0301616100\".compareNames(hex\"0302616200\") < 0,\n \"label lengths are correctly checked\"\n );\n require(\n a_b_c.compareNames(c) > 0,\n \"one name has a difference of >1 label to with the same root name\"\n );\n require(\n a_b_c.compareNames(d) < 0,\n \"one name has a difference of >1 label to with different root name\"\n );\n require(\n a_b_c.compareNames(a_d_c) < 0,\n \"two names start the same but have differences in later labels\"\n );\n require(\n a_b_c.compareNames(b_a_c) > 0,\n \"the first label sorts later, but the first label sorts earlier\"\n );\n require(\n ab_c_d.compareNames(a_c_d) > 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(\n a_b_c.compareNames(b_b_c) < 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(\n bthLabXyz.compareNames(ethLabXyz) < 0,\n \"bthLab.xyz comes before ethLab.xyz\"\n );\n require(\n bthLabXyz.compareNames(bthLabXyz) == 0,\n \"bthLab.xyz and bthLab.xyz are the same\"\n );\n require(\n ethLabXyz.compareNames(bthLabXyz) > 0,\n \"ethLab.xyz comes after bethLab.xyz\"\n );\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(\n verylong1_eth.compareNames(verylong2_eth) > 0,\n \"longa.vlong.eth comes after long.vlong.eth\"\n );\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(\n RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA),\n \"0x11111111 >= 0xAAAAAAAA\"\n );\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(\n hex\"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d\"\n .computeKeytag() == 19036,\n \"Invalid keytag\"\n );\n require(\n hex\"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf\"\n .computeKeytag() == 21693,\n \"Invalid keytag (2)\"\n );\n require(\n hex\"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3\"\n .computeKeytag() == 33630\n );\n require(\n hex\"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5\"\n .computeKeytag() == 20326,\n \"Invalid keytag (3)\"\n );\n }\n}\n" + }, + "test/registry/mocks/DummyResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyResolver {\n mapping(bytes32 => string) public name;\n\n function setName(bytes32 node, string memory _name) public {\n name[node] = _name;\n }\n}\n" + }, + "test/reverseRegistrar/mocks/MockReverseClaimerImplementer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../../../contracts/registry/ENS.sol\";\nimport {ReverseClaimer} from \"../../../contracts/reverseRegistrar/ReverseClaimer.sol\";\n\ncontract MockReverseClaimerImplementer is ReverseClaimer {\n constructor(ENS ens, address claimant) ReverseClaimer(ens, claimant) {}\n}\n" + }, + "test/utils/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n if (bytes4(extraData) == bytes4(keccak256(\"name(bytes32)\"))) {\n return abi.encode(\"offchain.test.eth\");\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "test/utils/mocks/LegacyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\ncontract LegacyResolver {\n function addr(bytes32 /* node */) public view returns (address) {\n return address(this);\n }\n}\n" + }, + "test/utils/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10 ** uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10 ** uint256(decimals()));\n }\n }\n}\n" + }, + "test/utils/mocks/MockOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract MockOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n MockOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (, bytes memory callData, ) = abi.decode(\n extraData,\n (bytes, bytes, bytes4)\n );\n if (bytes4(callData) == bytes4(keccak256(\"addr(bytes32)\"))) {\n (bytes memory result, , ) = abi.decode(\n response,\n (bytes, uint64, bytes)\n );\n return result;\n }\n return abi.encode(address(this));\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/mainnet/solcInputs/df131fa07ebda91fa31150d094629ae8.json b/solidity/dns-contracts/deployments/mainnet/solcInputs/df131fa07ebda91fa31150d094629ae8.json new file mode 100644 index 0000000..4c7d655 --- /dev/null +++ b/solidity/dns-contracts/deployments/mainnet/solcInputs/df131fa07ebda91fa31150d094629ae8.json @@ -0,0 +1,443 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC1271.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n *\n * _Available since v4.1._\n */\ninterface IERC1271 {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param hash Hash of the data to be signed\n * @param signature Signature byte array associated with _data\n */\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/SignatureChecker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\nimport \"../Address.sol\";\nimport \"../../interfaces/IERC1271.sol\";\n\n/**\n * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA\n * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like\n * Argent and Gnosis Safe.\n *\n * _Available since v4.1._\n */\nlibrary SignatureChecker {\n /**\n * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the\n * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.\n *\n * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\n * change through time. It could return true at block N and false at block N+1 (or the opposite).\n */\n function isValidSignatureNow(\n address signer,\n bytes32 hash,\n bytes memory signature\n ) internal view returns (bool) {\n (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\n if (error == ECDSA.RecoverError.NoError && recovered == signer) {\n return true;\n }\n\n (bool success, bytes memory result) = signer.staticcall(\n abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\n );\n return (success &&\n result.length == 32 &&\n abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (iter.name().compareNames(buf.buf) != 0) continue;\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(\n uint16 _expectedType,\n bytes memory _expectedName,\n uint32 _inception,\n uint64 _inserted,\n bytes memory _proof\n ) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if (_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(\n uint16 dnstype,\n bytes memory name\n ) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyExtendedDNSSECResolver is IExtendedDNSResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes memory /* name */,\n bytes memory /* data */,\n bytes memory context\n ) external view override returns (bytes memory) {\n return abi.encode(context);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyLegacyTextResolver is ITextResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(ITextResolver).interfaceId;\n }\n\n function text(\n bytes32 /* node */,\n string calldata key\n ) external view override returns (string memory) {\n return key;\n }\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver {\n using RRUtils for *;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, data)\n );\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query) = abi.decode(\n extraData,\n (bytes, bytes)\n );\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n IExtendedDNSResolver(dnsresolver).resolve(\n name,\n query,\n context\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return IExtendedResolver(dnsresolver).resolve(name, query);\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (bytes memory key, bytes memory value, uint256 nextOffset)\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = input.length;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n nextOffset = terminator + 1;\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256[3] memory P) {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (uint256 x, uint256 y, uint256 z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(\n uint256 x0,\n uint256 y0\n ) internal pure returns (bool isZero) {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(\n uint256 scalar\n ) internal pure returns (uint256, uint256) {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(\n bytes calldata,\n bytes calldata\n ) external pure override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input\n )\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n )\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(\n RRUtils.SignedSet memory rrset,\n uint16 typecovered\n ) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if (address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns (bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 {\n totallen := add(totallen, 64)\n }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for {\n let i := 0\n } lt(i, totallen) {\n i := add(i, 64)\n } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 {\n mstore8(add(scratch, sub(len, i)), 0x80)\n }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 {\n mstore(\n add(scratch, 32),\n or(mload(add(scratch, 32)), mul(len, 8))\n )\n }\n\n // Expand the 16 32-bit words into 80\n for {\n let j := 64\n } lt(j, 128) {\n j := add(j, 12)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 12))),\n mload(add(scratch, sub(j, 32)))\n ),\n xor(\n mload(add(scratch, sub(j, 56))),\n mload(add(scratch, sub(j, 64)))\n )\n )\n temp := or(\n and(\n mul(temp, 2),\n 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE\n ),\n and(\n div(temp, 0x80000000),\n 0x0000000100000001000000010000000100000001000000010000000100000001\n )\n )\n mstore(add(scratch, j), temp)\n }\n for {\n let j := 128\n } lt(j, 320) {\n j := add(j, 24)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 24))),\n mload(add(scratch, sub(j, 64)))\n ),\n xor(\n mload(add(scratch, sub(j, 112))),\n mload(add(scratch, sub(j, 128)))\n )\n )\n temp := or(\n and(\n mul(temp, 4),\n 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC\n ),\n and(\n div(temp, 0x40000000),\n 0x0000000300000003000000030000000300000003000000030000000300000003\n )\n )\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for {\n let j := 0\n } lt(j, 80) {\n j := add(j, 1)\n } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(\n div(x, 0x100000000000000000000),\n div(x, 0x10000000000)\n )\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := and(div(x, 0x10000000000), f)\n f := or(\n and(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n ),\n f\n )\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(\n div(\n x,\n 0x80000000000000000000000000000000000000000000000\n ),\n 0x1F\n )\n temp := or(\n and(\n div(x, 0x800000000000000000000000000000000000000),\n 0xFFFFFFE0\n ),\n temp\n )\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(\n div(\n mload(add(scratch, mul(j, 4))),\n 0x100000000000000000000000000000000000000000000000000000000\n ),\n temp\n )\n x := or(\n div(x, 0x10000000000),\n mul(temp, 0x10000000000000000000000000000000000000000)\n )\n x := or(\n and(\n x,\n 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF\n ),\n mul(\n or(\n and(div(x, 0x4000000000000), 0xC0000000),\n and(div(x, 0x400000000000000000000), 0x3FFFFFFF)\n ),\n 0x100000000000000000000\n )\n )\n }\n\n h := and(\n add(h, x),\n 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF\n )\n }\n ret := mul(\n or(\n or(\n or(\n or(\n and(\n div(h, 0x100000000),\n 0xFFFFFFFF00000000000000000000000000000000\n ),\n and(\n div(h, 0x1000000),\n 0xFFFFFFFF000000000000000000000000\n )\n ),\n and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)\n ),\n and(div(h, 0x100), 0xFFFFFFFF00000000)\n ),\n and(h, 0xFFFFFFFF)\n ),\n 0x1000000000000000000000000\n )\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, price.base, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/ILinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface ILinearPremiumPriceOracle {\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256);\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns (address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping(bytes32 => address) addresses;\n\n constructor() public {}\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Implements a dummy NameWrapper which returns the caller's address\n */\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ReverseClaimer\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimForAddrWithSignature(\n address addr,\n address owner,\n address resolver,\n address relayer,\n uint256 signatureExpiry,\n bytes calldata signature\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function setNameForAddrWithSignature(\n address addr,\n address owner,\n address resolver,\n address relayer,\n uint256 signatureExpiry,\n bytes calldata signature,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\nerror InvalidSignature();\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n using ECDSA for bytes32;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddrWithSignature(\n address addr,\n address owner,\n address resolver,\n address relayer,\n uint256 signatureExpiry,\n bytes memory signature\n ) public override returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n\n bytes32 hash = keccak256(\n abi.encodePacked(\n IReverseRegistrar.claimForAddrWithSignature.selector,\n addr,\n owner,\n resolver,\n relayer,\n signatureExpiry\n )\n );\n\n bytes32 message = hash.toEthSignedMessageHash();\n\n if (\n !SignatureChecker.isValidSignatureNow(addr, message, signature) ||\n relayer != msg.sender ||\n signatureExpiry < block.timestamp ||\n signatureExpiry > block.timestamp + 1 days\n ) {\n revert InvalidSignature();\n }\n\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddrWithSignature(\n address addr,\n address owner,\n address resolver,\n address relayer,\n uint256 signatureExpiry,\n bytes memory signature,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddrWithSignature(\n addr,\n owner,\n resolver,\n relayer,\n signatureExpiry,\n signature\n );\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/utils/DummyRevertResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ncontract DummyRevertResolver {\n function resolve(\n bytes calldata,\n bytes calldata\n ) external pure returns (bytes memory) {\n revert(\"Not Supported\");\n }\n\n function supportsInterface(bytes4) external pure returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/TestHexUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {HexUtils} from \"./HexUtils.sol\";\n\ncontract TestHexUtils {\n using HexUtils for *;\n\n function hexStringToBytes32(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes32, bool) {\n return name.hexStringToBytes32(idx, lastInx);\n }\n\n function hexToAddress(\n bytes calldata input,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (address, bool) {\n return input.hexToAddress(idx, lastInx);\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(\n string memory name\n ) public pure returns (bytes memory, bytes32) {\n return name.dnsEncodeName();\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (bytes[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes[] memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (bytes[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n result = LowLevelCallUtils.functionStaticCall(address(target), data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _hasExtendedResolver(\n address resolver\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(\n type(IExtendedResolver).interfaceId\n )\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (bytes[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _hasExtendedResolver(multicallData.resolver);\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = item;\n continue;\n }\n if (!isCallback && hasExtendedResolver) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = returnData;\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(\n name,\n wrappedOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable,\n ReverseClaimer\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE and set expiry to max */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the owner of a name\n * @param id Namehash of the name\n * @return operator Approved operator of a name\n */\n\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /**\n * @notice Approves an address for a name\n * @param to address to approve\n * @param tokenId name to approve\n */\n\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or operator of the owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or operator\n */\n\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Checks if owner/operator or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner/operator or approved\n */\n\n function canExtendSubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public returns (uint64 expiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // Set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (!_isWrapped(node)) {\n revert NameIsNotWrapped();\n }\n\n // this flag is used later, when checking fuses\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // Max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n address approved = getApproved(uint256(node));\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(parentNode, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /**\n * @notice Checks if a name is wrapped in a more gas efficient way\n * @param parentNode Namehash of the name\n * @param labelhash Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != ETH_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + }, + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {IMetadataService} from \"./IMetadataService.sol\";\n\ncontract StaticMetadataService is IMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external view override returns (bool) {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32, uint256) {\n return name.readLabel(offset);\n }\n\n function namehash(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32) {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\n \"\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n require(\n \"foo\".keccak(0, 3) ==\n bytes32(\n 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d\n ),\n \"Incorrect hash of 'foo'\"\n );\n require(\n \"foo\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\n \"hello\".equals(1, \"ello\") == true,\n \"Substring to string equality\"\n );\n require(\n \"hello\".equals(1, \"jello\", 1, 4) == true,\n \"Substring to substring equality\"\n );\n require(\n \"zhello\".equals(1, \"abchello\", 3) == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"0x0102030000\".equals(0, \"0x010203\") == false,\n \"Compare with offset and trailing bytes\"\n );\n }\n\n function testComparePartial() public pure {\n require(\n \"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true,\n \"Compare same length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true,\n \"Compare different length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true,\n \"Compare same with different offset\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 33\n ) ==\n 0 ==\n true,\n \"Compare different long strings same length smaller partial length which must be equal\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 34\n ) <\n 0 ==\n true,\n \"Compare long strings same length different partial length\"\n );\n require(\n \"0123456789012345012345678901234a\".compare(\n 0,\n 32,\n \"0123456789012345012345678901234b\",\n 0,\n 32\n ) <\n 0 ==\n true,\n \"Compare strings exactly 32 characters long\"\n );\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\n \"a\".compare(\"b\") < 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"b\".compare(\"a\") > 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"aa\".compare(\"ab\") < 0 == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"a\".compare(\"aa\") < 0 == true,\n \"Compare different value with different length\"\n );\n require(\n \"aa\".compare(\"a\") > 0 == true,\n \"Compare different value with different length\"\n );\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(\n longChar.compare(longChar) == 0 == true,\n \"Compares more than 32 bytes char\"\n );\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(\n longChar.compare(otherLongChar) < 0 == true,\n \"Compare long char with difference at start\"\n );\n }\n\n function testSubstring() public pure {\n require(\n keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")),\n \"Copy 0 bytes\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 4))) ==\n keccak256(bytes(\"hell\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(1, 4))) ==\n keccak256(bytes(\"ello\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 5))) ==\n keccak256(bytes(\"hello\")),\n \"Copy whole string\"\n );\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(\n bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) ==\n bytes32(\n 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000\n ),\n \"readBytes20\"\n );\n }\n\n function testReadBytes32() public pure {\n require(\n \"0123456789abcdef0123456789abcdef\".readBytes32(0) ==\n bytes32(\n 0x3031323334353637383961626364656630313233343536373839616263646566\n ),\n \"readBytes32\"\n );\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\n \"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")),\n \"Decode 'a'\"\n );\n require(\n \"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")),\n \"Decode 'aa'\"\n );\n require(\n \"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")),\n \"Decode 'aaa'\"\n );\n require(\n \"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")),\n \"Decode 'aaaa'\"\n );\n require(\n \"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa'\"\n );\n require(\n \"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa' lowercase\"\n );\n require(\n \"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet\"\n );\n require(\n \"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet lowercase\"\n );\n require(\n \"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\"\n .base32HexDecodeWord(0, 52) ==\n bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"),\n \"Decode 32*'a'\"\n );\n require(\n \" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\"\n .base32HexDecodeWord(1, 32) ==\n bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"),\n \"Decode real bytes32hex\"\n );\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex\"00\".nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex\"00\".labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex\"016100\".labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(\n hex\"016201610000\".labelCount(0) == 2,\n \"labelCount('b.a.') == 2\"\n );\n require(\n hex\"066574686c61620378797a00\".labelCount(6 + 1) == 1,\n \"nameLength('(bthlab).xyz.') == 6\"\n );\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes\n memory rrs = hex\"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101\";\n bytes[2] memory names = [bytes(hex\"016100\"), bytes(hex\"0162016100\")];\n bytes[2] memory rdatas = [bytes(hex\"74000001\"), bytes(hex\"c0a80101\")];\n uint i = 0;\n for (\n RRUtils.RRIterator memory iter = rrs.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(\n keccak256(iter.name()) == keccak256(names[i]),\n \"Name matches\"\n );\n require(\n keccak256(iter.rdata()) == keccak256(rdatas[i]),\n \"Rdata matches\"\n );\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex\"066274686c61620378797a00\";\n bytes memory ethLabXyz = hex\"066574686c61620378797a00\";\n bytes memory xyz = hex\"0378797a00\";\n bytes memory a_b_c = hex\"01610162016300\";\n bytes memory b_b_c = hex\"01620162016300\";\n bytes memory c = hex\"016300\";\n bytes memory d = hex\"016400\";\n bytes memory a_d_c = hex\"01610164016300\";\n bytes memory b_a_c = hex\"01620161016300\";\n bytes memory ab_c_d = hex\"0261620163016400\";\n bytes memory a_c_d = hex\"01610163016400\";\n bytes\n memory verylong1_eth = hex\"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n bytes\n memory verylong2_eth = hex\"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n\n require(\n hex\"0301616100\".compareNames(hex\"0302616200\") < 0,\n \"label lengths are correctly checked\"\n );\n require(\n a_b_c.compareNames(c) > 0,\n \"one name has a difference of >1 label to with the same root name\"\n );\n require(\n a_b_c.compareNames(d) < 0,\n \"one name has a difference of >1 label to with different root name\"\n );\n require(\n a_b_c.compareNames(a_d_c) < 0,\n \"two names start the same but have differences in later labels\"\n );\n require(\n a_b_c.compareNames(b_a_c) > 0,\n \"the first label sorts later, but the first label sorts earlier\"\n );\n require(\n ab_c_d.compareNames(a_c_d) > 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(\n a_b_c.compareNames(b_b_c) < 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(\n bthLabXyz.compareNames(ethLabXyz) < 0,\n \"bthLab.xyz comes before ethLab.xyz\"\n );\n require(\n bthLabXyz.compareNames(bthLabXyz) == 0,\n \"bthLab.xyz and bthLab.xyz are the same\"\n );\n require(\n ethLabXyz.compareNames(bthLabXyz) > 0,\n \"ethLab.xyz comes after bethLab.xyz\"\n );\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(\n verylong1_eth.compareNames(verylong2_eth) > 0,\n \"longa.vlong.eth comes after long.vlong.eth\"\n );\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(\n RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA),\n \"0x11111111 >= 0xAAAAAAAA\"\n );\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(\n hex\"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d\"\n .computeKeytag() == 19036,\n \"Invalid keytag\"\n );\n require(\n hex\"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf\"\n .computeKeytag() == 21693,\n \"Invalid keytag (2)\"\n );\n require(\n hex\"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3\"\n .computeKeytag() == 33630\n );\n require(\n hex\"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5\"\n .computeKeytag() == 20326,\n \"Invalid keytag (3)\"\n );\n }\n}\n" + }, + "test/registry/mocks/DummyResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyResolver {\n mapping(bytes32 => string) public name;\n\n function setName(bytes32 node, string memory _name) public {\n name[node] = _name;\n }\n}\n" + }, + "test/reverseRegistrar/mocks/MockReverseClaimerImplementer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../../../contracts/registry/ENS.sol\";\nimport {ReverseClaimer} from \"../../../contracts/reverseRegistrar/ReverseClaimer.sol\";\n\ncontract MockReverseClaimerImplementer is ReverseClaimer {\n constructor(ENS ens, address claimant) ReverseClaimer(ens, claimant) {}\n}\n" + }, + "test/utils/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n if (bytes4(extraData) == bytes4(keccak256(\"name(bytes32)\"))) {\n return abi.encode(\"offchain.test.eth\");\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "test/utils/mocks/LegacyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\ncontract LegacyResolver {\n function addr(bytes32 /* node */) public view returns (address) {\n return address(this);\n }\n}\n" + }, + "test/utils/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10 ** uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10 ** uint256(decimals()));\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1300 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/.chainId b/solidity/dns-contracts/deployments/ropsten/.chainId new file mode 100644 index 0000000..e440e5c --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/.chainId @@ -0,0 +1 @@ +3 \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/.migrations.json b/solidity/dns-contracts/deployments/ropsten/.migrations.json new file mode 100644 index 0000000..fdb7c76 --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/.migrations.json @@ -0,0 +1,4 @@ +{ + "ens": 1580387832, + "root": 1580387832 +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/BaseRegistrarImplementation.json b/solidity/dns-contracts/deployments/ropsten/BaseRegistrarImplementation.json new file mode 100644 index 0000000..48df272 --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/BaseRegistrarImplementation.json @@ -0,0 +1,756 @@ +{ + "address": "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_baseNode", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "ControllerAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "ControllerRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameMigrated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRenewed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "GRACE_PERIOD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "addController", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "available", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "baseNode", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "nameExpires", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "reclaim", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "register", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "registerOnly", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "removeController", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ] +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/DNSRegistrar.json b/solidity/dns-contracts/deployments/ropsten/DNSRegistrar.json new file mode 100644 index 0000000..1a09b76 --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/DNSRegistrar.json @@ -0,0 +1,381 @@ +{ + "address": "0xdB328BA5FEcb432AF325Ca59E3778441eF5aa14F", + "abi": [ + { + "inputs": [ + { + "internalType": "contract DNSSEC", + "name": "_dnssec", + "type": "address" + }, + { + "internalType": "contract PublicSuffixList", + "name": "_suffixes", + "type": "address" + }, + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "dnsname", + "type": "bytes" + } + ], + "name": "Claim", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oracle", + "type": "address" + } + ], + "name": "NewOracle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "suffixes", + "type": "address" + } + ], + "name": "NewPublicSuffixList", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract DNSSEC", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature[]", + "name": "input", + "type": "tuple[]" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + } + ], + "name": "proveAndClaim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature[]", + "name": "input", + "type": "tuple[]" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "proveAndClaimWithResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DNSSEC", + "name": "_dnssec", + "type": "address" + } + ], + "name": "setOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract PublicSuffixList", + "name": "_suffixes", + "type": "address" + } + ], + "name": "setPublicSuffixList", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "suffixes", + "outputs": [ + { + "internalType": "contract PublicSuffixList", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0xbd4871de391c70ba20c5e49af2eeccff3f7fce588d8e748e9128eeaa7aed9064", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0xdB328BA5FEcb432AF325Ca59E3778441eF5aa14F", + "transactionIndex": 0, + "gasUsed": "2850448", + "logsBloom": "0x00000000000000100100000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000001000000000000000000000000000000000000008000000000000000000000000000000000000000008000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x8257a252b1439a70294e40649432460d04d797521de0358844cf9282210ea2aa", + "transactionHash": "0xbd4871de391c70ba20c5e49af2eeccff3f7fce588d8e748e9128eeaa7aed9064", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10646078, + "transactionHash": "0xbd4871de391c70ba20c5e49af2eeccff3f7fce588d8e748e9128eeaa7aed9064", + "address": "0xdB328BA5FEcb432AF325Ca59E3778441eF5aa14F", + "topics": [ + "0xb3eacd0e351fafdfefdec84e1cd19679b38dbcd63ea7c2c24da17fd2bc3b3c0e" + ], + "data": "0x0000000000000000000000003b82b2966c1af8de911458afcf68c6c9960d4c11", + "logIndex": 0, + "blockHash": "0x8257a252b1439a70294e40649432460d04d797521de0358844cf9282210ea2aa" + }, + { + "transactionIndex": 0, + "blockNumber": 10646078, + "transactionHash": "0xbd4871de391c70ba20c5e49af2eeccff3f7fce588d8e748e9128eeaa7aed9064", + "address": "0xdB328BA5FEcb432AF325Ca59E3778441eF5aa14F", + "topics": [ + "0x9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba8" + ], + "data": "0x0000000000000000000000002fd5b53f14059a43e65f9a91ff21889d6d8d974b", + "logIndex": 1, + "blockHash": "0x8257a252b1439a70294e40649432460d04d797521de0358844cf9282210ea2aa" + } + ], + "blockNumber": 10646078, + "cumulativeGasUsed": "2850448", + "status": 1, + "byzantium": true + }, + "args": [ + "0x3B82B2966c1AF8de911458AfCF68C6C9960d4c11", + "0x2FD5B53F14059A43e65f9A91ff21889D6d8D974B", + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "solcInputHash": "424cfdf012b9aa11d2e839569d49524c", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract DNSSEC\",\"name\":\"_dnssec\",\"type\":\"address\"},{\"internalType\":\"contract PublicSuffixList\",\"name\":\"_suffixes\",\"type\":\"address\"},{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"dnsname\",\"type\":\"bytes\"}],\"name\":\"Claim\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oracle\",\"type\":\"address\"}],\"name\":\"NewOracle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"suffixes\",\"type\":\"address\"}],\"name\":\"NewPublicSuffixList\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract DNSSEC\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature[]\",\"name\":\"input\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"proveAndClaim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature[]\",\"name\":\"input\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"proveAndClaimWithResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract DNSSEC\",\"name\":\"_dnssec\",\"type\":\"address\"}],\"name\":\"setOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract PublicSuffixList\",\"name\":\"_suffixes\",\"type\":\"address\"}],\"name\":\"setPublicSuffixList\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"suffixes\",\"outputs\":[{\"internalType\":\"contract PublicSuffixList\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"An ENS registrar that allows the owner of a DNS name to claim the corresponding name in ENS.\",\"kind\":\"dev\",\"methods\":{\"claim(bytes,bytes)\":{\"details\":\"Claims a name by proving ownership of its DNS equivalent.\",\"params\":{\"name\":\"The name to claim, in DNS wire format.\",\"proof\":\"A DNS RRSet proving ownership of the name. Must be verified in the DNSSEC oracle before calling. This RRSET must contain a TXT record for '_ens.' + name, with the value 'a=0x...'. Ownership of the name will be transferred to the address specified in the TXT record.\"}},\"proveAndClaim(bytes,(bytes,bytes)[],bytes)\":{\"details\":\"Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\",\"params\":{\"input\":\"The data to be passed to the Oracle's `submitProofs` function. The last proof must be the TXT record required by the registrar.\",\"name\":\"The name to claim, in DNS wire format.\",\"proof\":\"The proof record for the first element in input.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnsregistrar/DNSRegistrar.sol\":\"DNSRegistrar\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for writing to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n mstore(0x40, add(32, add(ptr, capacity)))\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n function max(uint a, uint b) private pure returns(uint) {\\n if (a > b) {\\n return a;\\n }\\n return b;\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The start offset to write to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n if (off + len > buf.capacity) {\\n resize(buf, max(buf.capacity, len + off) * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(add(len, off), buflen) {\\n mstore(bufptr, add(len, off))\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, len);\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, data.length);\\n }\\n\\n /**\\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write the byte at.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\\n if (off >= buf.capacity) {\\n resize(buf, buf.capacity * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if eq(off, buflen) {\\n mstore(bufptr, add(buflen, 1))\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n return writeUint8(buf, buf.buf.length, data);\\n }\\n\\n /**\\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\\n if (len + off > buf.capacity) {\\n resize(buf, (len + off) * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off + len\\n let dest := add(add(bufptr, off), len)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(add(off, len), mload(bufptr)) {\\n mstore(bufptr, add(off, len))\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\\n return write(buf, off, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, 32);\\n }\\n\\n /**\\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\\n if (len + off > buf.capacity) {\\n resize(buf, (len + off) * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + off + sizeof(buffer length) + len\\n let dest := add(add(bufptr, off), len)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(add(off, len), mload(bufptr)) {\\n mstore(bufptr, add(off, len))\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n return writeInt(buf, buf.buf.length, data, len);\\n }\\n}\\n\",\"keccak256\":\"0x18e42be1a3e4f7b4442d7ab0b524af5e09163503439954faf0ab3792cce91caa\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x1cae4f85f114ff17b90414f5da67365b1d00337abb5bce9bf944eb78a2c0673c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xf930d2df426bfcfc1f7415be724f04081c96f4fb9ec8d0e3a521c07692dface0\",\"license\":\"MIT\"},\"contracts/dnsregistrar/DNSClaimChecker.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../dnssec-oracle/DNSSEC.sol\\\";\\nimport \\\"../dnssec-oracle/BytesUtils.sol\\\";\\nimport \\\"../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\nlibrary DNSClaimChecker {\\n\\n using BytesUtils for bytes;\\n using RRUtils for *;\\n using Buffer for Buffer.buffer;\\n\\n uint16 constant CLASS_INET = 1;\\n uint16 constant TYPE_TXT = 16;\\n\\n function getOwnerAddress(DNSSEC oracle, bytes memory name, bytes memory proof)\\n internal\\n view\\n returns (address, bool)\\n {\\n // Add \\\"_ens.\\\" to the front of the name.\\n Buffer.buffer memory buf;\\n buf.init(name.length + 5);\\n buf.append(\\\"\\\\x04_ens\\\");\\n buf.append(name);\\n bytes20 hash;\\n uint32 expiration;\\n // Check the provided TXT record has been validated by the oracle\\n (, expiration, hash) = oracle.rrdata(TYPE_TXT, buf.buf);\\n if (hash == bytes20(0) && proof.length == 0) return (address(0x0), false);\\n\\n require(hash == bytes20(keccak256(proof)));\\n\\n for (RRUtils.RRIterator memory iter = proof.iterateRRs(0); !iter.done(); iter.next()) {\\n require(RRUtils.serialNumberGte(expiration + iter.ttl, uint32(block.timestamp)), \\\"DNS record is stale; refresh or delete it before proceeding.\\\");\\n\\n bool found;\\n address addr;\\n (addr, found) = parseRR(proof, iter.rdataOffset);\\n if (found) {\\n return (addr, true);\\n }\\n }\\n\\n return (address(0x0), false);\\n }\\n\\n function parseRR(bytes memory rdata, uint idx) internal pure returns (address, bool) {\\n while (idx < rdata.length) {\\n uint len = rdata.readUint8(idx); idx += 1;\\n\\n bool found;\\n address addr;\\n (addr, found) = parseString(rdata, idx, len);\\n\\n if (found) return (addr, true);\\n idx += len;\\n }\\n\\n return (address(0x0), false);\\n }\\n\\n function parseString(bytes memory str, uint idx, uint len) internal pure returns (address, bool) {\\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\\n if (len < 44) return (address(0x0), false);\\n return hexToAddress(str, idx + 4);\\n }\\n\\n function hexToAddress(bytes memory str, uint idx) internal pure returns (address, bool) {\\n if (str.length - idx < 40) return (address(0x0), false);\\n uint ret = 0;\\n for (uint i = idx; i < idx + 40; i++) {\\n ret <<= 4;\\n uint x = str.readUint8(i);\\n if (x >= 48 && x < 58) {\\n ret |= x - 48;\\n } else if (x >= 65 && x < 71) {\\n ret |= x - 55;\\n } else if (x >= 97 && x < 103) {\\n ret |= x - 87;\\n } else {\\n return (address(0x0), false);\\n }\\n }\\n return (address(uint160(ret)), true);\\n }\\n}\\n\",\"keccak256\":\"0xbbae9477060a4e16d01432400029b85d278a7186dad7139d0f24381906cf63db\"},\"contracts/dnsregistrar/DNSRegistrar.sol\":{\"content\":\"pragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nimport \\\"../dnssec-oracle/BytesUtils.sol\\\";\\nimport \\\"../dnssec-oracle/DNSSEC.sol\\\";\\nimport \\\"../registry/ENSRegistry.sol\\\";\\nimport \\\"../root/Root.sol\\\";\\nimport \\\"./DNSClaimChecker.sol\\\";\\nimport \\\"./PublicSuffixList.sol\\\";\\nimport \\\"../resolvers/profiles/AddrResolver.sol\\\";\\n\\ninterface IDNSRegistrar {\\n function claim(bytes memory name, bytes memory proof) external;\\n function proveAndClaim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof) external;\\n function proveAndClaimWithResolver(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof, address resolver, address addr) external;\\n}\\n\\n/**\\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\\n * corresponding name in ENS.\\n */\\ncontract DNSRegistrar is IDNSRegistrar {\\n using BytesUtils for bytes;\\n\\n DNSSEC public oracle;\\n ENS public ens;\\n PublicSuffixList public suffixes;\\n\\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n\\n event Claim(bytes32 indexed node, address indexed owner, bytes dnsname);\\n event NewOracle(address oracle);\\n event NewPublicSuffixList(address suffixes);\\n\\n constructor(DNSSEC _dnssec, PublicSuffixList _suffixes, ENS _ens) {\\n oracle = _dnssec;\\n emit NewOracle(address(oracle));\\n suffixes = _suffixes;\\n emit NewPublicSuffixList(address(suffixes));\\n ens = _ens;\\n }\\n\\n /**\\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\\n */\\n modifier onlyOwner {\\n Root root = Root(ens.owner(bytes32(0)));\\n address owner = root.owner();\\n require(msg.sender == owner);\\n _;\\n }\\n\\n function setOracle(DNSSEC _dnssec) public onlyOwner {\\n oracle = _dnssec;\\n emit NewOracle(address(oracle));\\n }\\n\\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\\n suffixes = _suffixes;\\n emit NewPublicSuffixList(address(suffixes));\\n }\\n\\n /**\\n * @dev Claims a name by proving ownership of its DNS equivalent.\\n * @param name The name to claim, in DNS wire format.\\n * @param proof A DNS RRSet proving ownership of the name. Must be verified\\n * in the DNSSEC oracle before calling. This RRSET must contain a TXT\\n * record for '_ens.' + name, with the value 'a=0x...'. Ownership of\\n * the name will be transferred to the address specified in the TXT\\n * record.\\n */\\n function claim(bytes memory name, bytes memory proof) public override {\\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(name, proof);\\n ens.setSubnodeOwner(rootNode, labelHash, addr);\\n }\\n\\n /**\\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\\n * @param name The name to claim, in DNS wire format.\\n * @param input The data to be passed to the Oracle's `submitProofs` function. The last\\n * proof must be the TXT record required by the registrar.\\n * @param proof The proof record for the first element in input.\\n */\\n function proveAndClaim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof) public override {\\n proof = oracle.submitRRSets(input, proof);\\n claim(name, proof);\\n }\\n\\n function proveAndClaimWithResolver(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof, address resolver, address addr) public override {\\n proof = oracle.submitRRSets(input, proof);\\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(name, proof);\\n require(msg.sender == owner, \\\"Only owner can call proveAndClaimWithResolver\\\");\\n if(addr != address(0)) {\\n require(resolver != address(0), \\\"Cannot set addr if resolver is not set\\\");\\n // Set ourselves as the owner so we can set a record on the resolver\\n ens.setSubnodeRecord(rootNode, labelHash, address(this), resolver, 0);\\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\\n // Set the resolver record\\n AddrResolver(resolver).setAddr(node, addr);\\n // Transfer the record to the owner\\n ens.setOwner(node, owner);\\n } else {\\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\\n }\\n }\\n\\n function supportsInterface(bytes4 interfaceID) external pure returns (bool) {\\n return interfaceID == INTERFACE_META_ID ||\\n interfaceID == type(IDNSRegistrar).interfaceId;\\n }\\n\\n function _claim(bytes memory name, bytes memory proof) internal returns(bytes32 rootNode, bytes32 labelHash, address addr) {\\n // Get the first label\\n uint labelLen = name.readUint8(0);\\n labelHash = name.keccak(1, labelLen);\\n\\n // Parent name must be in the public suffix list.\\n bytes memory parentName = name.substring(labelLen + 1, name.length - labelLen - 1);\\n require(suffixes.isPublicSuffix(parentName), \\\"Parent name must be a public suffix\\\");\\n\\n // Make sure the parent name is enabled\\n rootNode = enableNode(parentName, 0);\\n\\n (addr,) = DNSClaimChecker.getOwnerAddress(oracle, name, proof);\\n\\n emit Claim(keccak256(abi.encodePacked(rootNode, labelHash)), addr, name);\\n }\\n\\n function enableNode(bytes memory domain, uint offset) internal returns(bytes32 node) {\\n uint len = domain.readUint8(offset);\\n if(len == 0) {\\n return bytes32(0);\\n }\\n\\n bytes32 parentNode = enableNode(domain, offset + len + 1);\\n bytes32 label = domain.keccak(offset + 1, len);\\n node = keccak256(abi.encodePacked(parentNode, label));\\n address owner = ens.owner(node);\\n require(owner == address(0) || owner == address(this), \\\"Cannot enable a name owned by someone else\\\");\\n if(owner != address(this)) {\\n if(parentNode == bytes32(0)) {\\n Root root = Root(ens.owner(bytes32(0)));\\n root.setSubnodeOwner(label, address(this));\\n } else {\\n ens.setSubnodeOwner(parentNode, label, address(this));\\n }\\n }\\n return node;\\n }\\n}\\n\",\"keccak256\":\"0x0781f008efeefa1ff7a9517ed94d69fe160c399c7cd6388a79e26d7f0e4e6001\"},\"contracts/dnsregistrar/PublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\ninterface PublicSuffixList {\\n function isPublicSuffix(bytes calldata name) external view returns(bool);\\n}\\n\",\"keccak256\":\"0x8e593c73f54e07a54074ed3b6bc8e976d06211f923051c9793bcb9c10114854d\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\\n uint shortest = len;\\n if (otherlen < len)\\n shortest = otherlen;\\n\\n uint selfptr;\\n uint otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint idx = 0; idx < shortest; idx += 32) {\\n uint a;\\n uint b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint mask;\\n if (shortest > 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\\n }\\n int diff = int(a & mask) - int(b & mask);\\n if (diff != 0)\\n return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int(len) - int(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\\n return self.length == other.length && equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint dest, uint src, uint len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint dest;\\n uint src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\\n require(len <= 52);\\n\\n uint ret = 0;\\n uint8 decoded;\\n for(uint i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if(i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint bitlen = len * 5;\\n if(len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if(len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if(len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if(len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if(len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n}\",\"keccak256\":\"0x83315df2e54c74451577c70da2c267c3459802b08b9aeec6516302eee70f796e\"},\"contracts/dnssec-oracle/DNSSEC.sol\":{\"content\":\"pragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nabstract contract DNSSEC {\\n\\n bytes public anchors;\\n\\n struct RRSetWithSignature {\\n bytes rrset;\\n bytes sig;\\n }\\n\\n event AlgorithmUpdated(uint8 id, address addr);\\n event DigestUpdated(uint8 id, address addr);\\n event NSEC3DigestUpdated(uint8 id, address addr);\\n event RRSetUpdated(bytes name, bytes rrset);\\n\\n function submitRRSets(RRSetWithSignature[] memory input, bytes calldata proof) public virtual returns (bytes memory);\\n function submitRRSet(RRSetWithSignature calldata input, bytes calldata proof) public virtual returns (bytes memory);\\n function deleteRRSet(uint16 deleteType, bytes calldata deleteName, RRSetWithSignature calldata nsec, bytes calldata proof) public virtual;\\n function deleteRRSetNSEC3(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory closestEncloser, RRSetWithSignature memory nextClosest, bytes memory dnskey) public virtual;\\n function rrdata(uint16 dnstype, bytes calldata name) external virtual view returns (uint32, uint32, bytes20);\\n}\\n\",\"keccak256\":\"0x5b8d2391f66e878e09aa88a97fe8ea5b26604a0c0ad9247feb6124db9817f6c1\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n* @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n*/\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(bytes memory self, uint offset) internal pure returns(uint) {\\n uint idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(bytes memory self, uint offset) internal pure returns(bytes memory ret) {\\n uint len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(bytes memory self, uint offset) internal pure returns(uint) {\\n uint count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint constant RRSIG_TYPE = 0;\\n uint constant RRSIG_ALGORITHM = 2;\\n uint constant RRSIG_LABELS = 3;\\n uint constant RRSIG_TTL = 4;\\n uint constant RRSIG_EXPIRATION = 8;\\n uint constant RRSIG_INCEPTION = 12;\\n uint constant RRSIG_KEY_TAG = 16;\\n uint constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(bytes memory data) internal pure returns(SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(RRSIG_SIGNER_NAME + self.signerName.length, data.length - RRSIG_SIGNER_NAME - self.signerName.length);\\n }\\n\\n function rrs(SignedSet memory rrset) internal pure returns(RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint rdataOffset;\\n uint nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(bytes memory self, uint offset) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns(bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns(bytes memory) {\\n return iter.data.substring(iter.offset, nameLength(iter.data, iter.offset));\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(RRIterator memory iter) internal pure returns(bytes memory) {\\n return iter.data.substring(iter.rdataOffset, iter.nextOffset - iter.rdataOffset);\\n }\\n\\n uint constant DNSKEY_FLAGS = 0;\\n uint constant DNSKEY_PROTOCOL = 2;\\n uint constant DNSKEY_ALGORITHM = 3;\\n uint constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(bytes memory data, uint offset, uint length) internal pure returns(DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(offset + DNSKEY_PUBKEY, length - DNSKEY_PUBKEY);\\n } \\n\\n uint constant DS_KEY_TAG = 0;\\n uint constant DS_ALGORITHM = 2;\\n uint constant DS_DIGEST_TYPE = 3;\\n uint constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(bytes memory data, uint offset, uint length) internal pure returns(DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n struct NSEC3 {\\n uint8 hashAlgorithm;\\n uint8 flags;\\n uint16 iterations;\\n bytes salt;\\n bytes32 nextHashedOwnerName;\\n bytes typeBitmap;\\n }\\n\\n uint constant NSEC3_HASH_ALGORITHM = 0;\\n uint constant NSEC3_FLAGS = 1;\\n uint constant NSEC3_ITERATIONS = 2;\\n uint constant NSEC3_SALT_LENGTH = 4;\\n uint constant NSEC3_SALT = 5;\\n\\n function readNSEC3(bytes memory data, uint offset, uint length) internal pure returns(NSEC3 memory self) {\\n uint end = offset + length;\\n self.hashAlgorithm = data.readUint8(offset + NSEC3_HASH_ALGORITHM);\\n self.flags = data.readUint8(offset + NSEC3_FLAGS);\\n self.iterations = data.readUint16(offset + NSEC3_ITERATIONS);\\n uint8 saltLength = data.readUint8(offset + NSEC3_SALT_LENGTH);\\n offset = offset + NSEC3_SALT;\\n self.salt = data.substring(offset, saltLength);\\n offset += saltLength;\\n uint8 nextLength = data.readUint8(offset);\\n require(nextLength <= 32);\\n offset += 1;\\n self.nextHashedOwnerName = data.readBytesN(offset, nextLength);\\n offset += nextLength;\\n self.typeBitmap = data.substring(offset, end - offset);\\n }\\n\\n function checkTypeBitmap(NSEC3 memory self, uint16 rrtype) internal pure returns(bool) {\\n return checkTypeBitmap(self.typeBitmap, 0, rrtype);\\n }\\n\\n /**\\n * @dev Checks if a given RR type exists in a type bitmap.\\n * @param bitmap The byte string to read the type bitmap from.\\n * @param offset The offset to start reading at.\\n * @param rrtype The RR type to check for.\\n * @return True if the type is found in the bitmap, false otherwise.\\n */\\n function checkTypeBitmap(bytes memory bitmap, uint offset, uint16 rrtype) internal pure returns (bool) {\\n uint8 typeWindow = uint8(rrtype >> 8);\\n uint8 windowByte = uint8((rrtype & 0xff) / 8);\\n uint8 windowBitmask = uint8(uint8(1) << (uint8(7) - uint8(rrtype & 0x7)));\\n for (uint off = offset; off < bitmap.length;) {\\n uint8 window = bitmap.readUint8(off);\\n uint8 len = bitmap.readUint8(off + 1);\\n if (typeWindow < window) {\\n // We've gone past our window; it's not here.\\n return false;\\n } else if (typeWindow == window) {\\n // Check this type bitmap\\n if (len <= windowByte) {\\n // Our type is past the end of the bitmap\\n return false;\\n }\\n return (bitmap.readUint8(off + windowByte + 2) & windowBitmask) != 0;\\n } else {\\n // Skip this type bitmap\\n off += len + 2;\\n }\\n }\\n\\n return false;\\n }\\n\\n function compareNames(bytes memory self, bytes memory other) internal pure returns (int) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint off;\\n uint otheroff;\\n uint prevoff;\\n uint otherprevoff;\\n uint counts = labelCount(self, 0);\\n uint othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if(otheroff == 0) {\\n return 1;\\n }\\n\\n return self.compare(prevoff + 1, self.readUint8(prevoff), other, otherprevoff + 1, other.readUint8(otherprevoff));\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(uint32 i1, uint32 i2) internal pure returns(bool) {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n\\n function progress(bytes memory body, uint off) internal pure returns(uint) {\\n return off + 1 + body.readUint8(off);\\n }\\n}\",\"keccak256\":\"0x021cc7832a603e41b94d38eced8175452eaa5ab4794376fa3f722362844aeefe\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual;\\n function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual;\\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external virtual returns(bytes32);\\n function setResolver(bytes32 node, address resolver) external virtual;\\n function setOwner(bytes32 node, address owner) external virtual;\\n function setTTL(bytes32 node, uint64 ttl) external virtual;\\n function setApprovalForAll(address operator, bool approved) external virtual;\\n function owner(bytes32 node) external virtual view returns (address);\\n function resolver(bytes32 node) external virtual view returns (address);\\n function ttl(bytes32 node) external virtual view returns (uint64);\\n function recordExists(bytes32 node) external virtual view returns (bool);\\n function isApprovedForAll(address owner, address operator) external virtual view returns (bool);\\n}\\n\",\"keccak256\":\"0x942ef29bd7c0f62228aeb91879ddd1ba101f52a2162970d3e48adffa498f4483\"},\"contracts/registry/ENSRegistry.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"./ENS.sol\\\";\\n\\n/**\\n * The ENS registry contract.\\n */\\ncontract ENSRegistry is ENS {\\n\\n struct Record {\\n address owner;\\n address resolver;\\n uint64 ttl;\\n }\\n\\n mapping (bytes32 => Record) records;\\n mapping (address => mapping(address => bool)) operators;\\n\\n // Permits modifications only by the owner of the specified node.\\n modifier authorised(bytes32 node) {\\n address owner = records[node].owner;\\n require(owner == msg.sender || operators[owner][msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Constructs a new ENS registrar.\\n */\\n constructor() public {\\n records[0x0].owner = msg.sender;\\n }\\n\\n /**\\n * @dev Sets the record for a node.\\n * @param node The node to update.\\n * @param owner The address of the new owner.\\n * @param resolver The address of the resolver.\\n * @param ttl The TTL in seconds.\\n */\\n function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual override {\\n setOwner(node, owner);\\n _setResolverAndTTL(node, resolver, ttl);\\n }\\n\\n /**\\n * @dev Sets the record for a subnode.\\n * @param node The parent node.\\n * @param label The hash of the label specifying the subnode.\\n * @param owner The address of the new owner.\\n * @param resolver The address of the resolver.\\n * @param ttl The TTL in seconds.\\n */\\n function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual override {\\n bytes32 subnode = setSubnodeOwner(node, label, owner);\\n _setResolverAndTTL(subnode, resolver, ttl);\\n }\\n\\n /**\\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\\n * @param node The node to transfer ownership of.\\n * @param owner The address of the new owner.\\n */\\n function setOwner(bytes32 node, address owner) public virtual override authorised(node) {\\n _setOwner(node, owner);\\n emit Transfer(node, owner);\\n }\\n\\n /**\\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\\n * @param node The parent node.\\n * @param label The hash of the label specifying the subnode.\\n * @param owner The address of the new owner.\\n */\\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public virtual override authorised(node) returns(bytes32) {\\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\\n _setOwner(subnode, owner);\\n emit NewOwner(node, label, owner);\\n return subnode;\\n }\\n\\n /**\\n * @dev Sets the resolver address for the specified node.\\n * @param node The node to update.\\n * @param resolver The address of the resolver.\\n */\\n function setResolver(bytes32 node, address resolver) public virtual override authorised(node) {\\n emit NewResolver(node, resolver);\\n records[node].resolver = resolver;\\n }\\n\\n /**\\n * @dev Sets the TTL for the specified node.\\n * @param node The node to update.\\n * @param ttl The TTL in seconds.\\n */\\n function setTTL(bytes32 node, uint64 ttl) public virtual override authorised(node) {\\n emit NewTTL(node, ttl);\\n records[node].ttl = ttl;\\n }\\n\\n /**\\n * @dev Enable or disable approval for a third party (\\\"operator\\\") to manage\\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\\n * @param operator Address to add to the set of authorized operators.\\n * @param approved True if the operator is approved, false to revoke approval.\\n */\\n function setApprovalForAll(address operator, bool approved) external virtual override {\\n operators[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev Returns the address that owns the specified node.\\n * @param node The specified node.\\n * @return address of the owner.\\n */\\n function owner(bytes32 node) public virtual override view returns (address) {\\n address addr = records[node].owner;\\n if (addr == address(this)) {\\n return address(0x0);\\n }\\n\\n return addr;\\n }\\n\\n /**\\n * @dev Returns the address of the resolver for the specified node.\\n * @param node The specified node.\\n * @return address of the resolver.\\n */\\n function resolver(bytes32 node) public virtual override view returns (address) {\\n return records[node].resolver;\\n }\\n\\n /**\\n * @dev Returns the TTL of a node, and any records associated with it.\\n * @param node The specified node.\\n * @return ttl of the node.\\n */\\n function ttl(bytes32 node) public virtual override view returns (uint64) {\\n return records[node].ttl;\\n }\\n\\n /**\\n * @dev Returns whether a record has been imported to the registry.\\n * @param node The specified node.\\n * @return Bool if record exists\\n */\\n function recordExists(bytes32 node) public virtual override view returns (bool) {\\n return records[node].owner != address(0x0);\\n }\\n\\n /**\\n * @dev Query if an address is an authorized operator for another address.\\n * @param owner The address that owns the records.\\n * @param operator The address that acts on behalf of the owner.\\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\\n */\\n function isApprovedForAll(address owner, address operator) external virtual override view returns (bool) {\\n return operators[owner][operator];\\n }\\n\\n function _setOwner(bytes32 node, address owner) internal virtual {\\n records[node].owner = owner;\\n }\\n\\n function _setResolverAndTTL(bytes32 node, address resolver, uint64 ttl) internal {\\n if(resolver != records[node].resolver) {\\n records[node].resolver = resolver;\\n emit NewResolver(node, resolver);\\n }\\n\\n if(ttl != records[node].ttl) {\\n records[node].ttl = ttl;\\n emit NewTTL(node, ttl);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf025a2fa3fcf89a3db7064e85e9b618707a39cb47c9c1bfedaec5313b118a1c6\"},\"contracts/resolvers/ResolverBase.sol\":{\"content\":\"pragma solidity >=0.8.4;\\nabstract contract ResolverBase {\\n bytes4 private constant INTERFACE_META_ID = 0x01ffc9a7;\\n\\n function supportsInterface(bytes4 interfaceID) virtual public pure returns(bool) {\\n return interfaceID == INTERFACE_META_ID;\\n }\\n\\n function isAuthorised(bytes32 node) internal virtual view returns(bool);\\n\\n modifier authorised(bytes32 node) {\\n require(isAuthorised(node));\\n _;\\n }\\n\\n function bytesToAddress(bytes memory b) internal pure returns(address payable a) {\\n require(b.length == 20);\\n assembly {\\n a := div(mload(add(b, 32)), exp(256, 12))\\n }\\n }\\n\\n function addressToBytes(address a) internal pure returns(bytes memory b) {\\n b = new bytes(20);\\n assembly {\\n mstore(add(b, 32), mul(a, exp(256, 12)))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x19ff93130a91ea54f949022dafa27cd9fa9af647820d957aed3c8641b1354d8e\"},\"contracts/resolvers/profiles/AddrResolver.sol\":{\"content\":\"pragma solidity >=0.8.4;\\nimport \\\"../ResolverBase.sol\\\";\\n\\nabstract contract AddrResolver is ResolverBase {\\n bytes4 constant private ADDR_INTERFACE_ID = 0x3b3b57de;\\n bytes4 constant private ADDRESS_INTERFACE_ID = 0xf1cb7e06;\\n uint constant private COIN_TYPE_ETH = 60;\\n\\n event AddrChanged(bytes32 indexed node, address a);\\n event AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress);\\n\\n mapping(bytes32=>mapping(uint=>bytes)) _addresses;\\n\\n /**\\n * Sets the address associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param a The address to set.\\n */\\n function setAddr(bytes32 node, address a) external authorised(node) {\\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\\n }\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) public view returns (address payable) {\\n bytes memory a = addr(node, COIN_TYPE_ETH);\\n if(a.length == 0) {\\n return payable(0);\\n }\\n return bytesToAddress(a);\\n }\\n\\n function setAddr(bytes32 node, uint coinType, bytes memory a) public authorised(node) {\\n emit AddressChanged(node, coinType, a);\\n if(coinType == COIN_TYPE_ETH) {\\n emit AddrChanged(node, bytesToAddress(a));\\n }\\n _addresses[node][coinType] = a;\\n }\\n\\n function addr(bytes32 node, uint coinType) public view returns(bytes memory) {\\n return _addresses[node][coinType];\\n }\\n\\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\\n return interfaceID == ADDR_INTERFACE_ID || interfaceID == ADDRESS_INTERFACE_ID || super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x5e32ad40c831931e1d1cba27622078fd8a838227ed23d2bba253e1256e8f331a\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0x0c364a5b65b6fff279adbe1fd6498c488feabeec781599cd60a5844e80ee7d88\"},\"contracts/root/Root.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"./Controllable.sol\\\";\\n\\ncontract Root is Ownable, Controllable {\\n bytes32 private constant ROOT_NODE = bytes32(0);\\n\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n\\n event TLDLocked(bytes32 indexed label);\\n\\n ENS public ens;\\n mapping(bytes32 => bool) public locked;\\n\\n constructor(ENS _ens) public {\\n ens = _ens;\\n }\\n\\n function setSubnodeOwner(bytes32 label, address owner)\\n external\\n onlyController\\n {\\n require(!locked[label]);\\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\\n }\\n\\n function setResolver(address resolver) external onlyOwner {\\n ens.setResolver(ROOT_NODE, resolver);\\n }\\n\\n function lock(bytes32 label) external onlyOwner {\\n emit TLDLocked(label);\\n locked[label] = true;\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n external\\n pure\\n returns (bool)\\n {\\n return interfaceID == INTERFACE_META_ID;\\n }\\n}\\n\",\"keccak256\":\"0xf6fed46bbdc8a425d112c473a649045148b2e0404647c97590d2a3e2798c9fe3\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b5060405162003488380380620034888339818101604052810190620000379190620001fb565b826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fb3eacd0e351fafdfefdec84e1cd19679b38dbcd63ea7c2c24da17fd2bc3b3c0e60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051620000c8919062000262565b60405180910390a181600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba8600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660405162000164919062000262565b60405180910390a180600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050506200033d565b600081519050620001c781620002ef565b92915050565b600081519050620001de8162000309565b92915050565b600081519050620001f58162000323565b92915050565b6000806000606084860312156200021157600080fd5b60006200022186828701620001b6565b93505060206200023486828701620001e4565b92505060406200024786828701620001cd565b9150509250925092565b6200025c816200027f565b82525050565b600060208201905062000279600083018462000251565b92915050565b60006200028c82620002cf565b9050919050565b6000620002a0826200027f565b9050919050565b6000620002b4826200027f565b9050919050565b6000620002c8826200027f565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b620002fa8162000293565b81146200030657600080fd5b50565b6200031481620002a7565b81146200032057600080fd5b50565b6200032e81620002bb565b81146200033a57600080fd5b50565b61313b806200034d6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c80633f15457f116100665780633f15457f1461011e5780637adbf9731461013c5780637dc0d1d0146101585780638bbedf7514610176578063be27b22c1461019257610093565b806301ffc9a7146100985780631ecfc411146100c8578063224199c2146100e457806330349ebe14610100575b600080fd5b6100b260048036038101906100ad919061211f565b6101ae565b6040516100bf91906126e7565b60405180910390f35b6100e260048036038101906100dd9190612374565b610280565b005b6100fe60048036038101906100f99190612220565b61048b565b005b6101086108cc565b6040516101159190612828565b60405180910390f35b6101266108f2565b604051610133919061280d565b60405180910390f35b6101566004803603810190610151919061234b565b610918565b005b610160610b20565b60405161016d91906127f2565b60405180910390f35b610190600480360381019061018b9190612189565b610b44565b005b6101ac60048036038101906101a791906122df565b610c07565b005b60007f01ffc9a7a5cef8baa21ed3c5c0d7e23accb804b619e9333b597f47a0d84076e27bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061027957507f17d8f49b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b9050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be36000801b6040518263ffffffff1660e01b81526004016102e09190612702565b60206040518083038186803b1580156102f857600080fd5b505afa15801561030c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033091906120a4565b905060008173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561037a57600080fd5b505afa15801561038e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b291906120a4565b90508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103ec57600080fd5b82600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba8600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660405161047e9190612695565b60405180910390a1505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663435cc16285856040518363ffffffff1660e01b81526004016104e69291906126b0565b600060405180830381600087803b15801561050057600080fd5b505af1158015610514573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525081019061053d9190612148565b9250600080600061054e8887610cd5565b9250925092508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146105c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b9906128c3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161461082b57600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415610666576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065d90612843565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635ef2c7f08484308960006040518663ffffffff1660e01b81526004016106ca95949392919061277d565b600060405180830381600087803b1580156106e457600080fd5b505af11580156106f8573d6000803e3d6000fd5b5050505060008383604051602001610711929190612669565b6040516020818303038152906040528051906020012090508573ffffffffffffffffffffffffffffffffffffffff1663d5fa2b0082876040518363ffffffff1660e01b815260040161076492919061271d565b600060405180830381600087803b15801561077e57600080fd5b505af1158015610792573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635b0fc9c382846040518363ffffffff1660e01b81526004016107f392919061271d565b600060405180830381600087803b15801561080d57600080fd5b505af1158015610821573d6000803e3d6000fd5b50505050506108c2565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635ef2c7f08484848960006040518663ffffffff1660e01b815260040161088f95949392919061277d565b600060405180830381600087803b1580156108a957600080fd5b505af11580156108bd573d6000803e3d6000fd5b505050505b5050505050505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be36000801b6040518263ffffffff1660e01b81526004016109789190612702565b60206040518083038186803b15801561099057600080fd5b505afa1580156109a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c891906120a4565b905060008173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a1257600080fd5b505afa158015610a26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a4a91906120a4565b90508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a8457600080fd5b826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fb3eacd0e351fafdfefdec84e1cd19679b38dbcd63ea7c2c24da17fd2bc3b3c0e60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051610b139190612695565b60405180910390a1505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663435cc16283836040518363ffffffff1660e01b8152600401610b9f9291906126b0565b600060405180830381600087803b158015610bb957600080fd5b505af1158015610bcd573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190610bf69190612148565b9050610c028382610c07565b505050565b6000806000610c168585610cd5565b925092509250600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166306ab59238484846040518463ffffffff1660e01b8152600401610c7b93929190612746565b602060405180830381600087803b158015610c9557600080fd5b505af1158015610ca9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ccd91906120f6565b505050505050565b600080600080610cef600087610ef090919063ffffffff16565b60ff169050610d0a60018288610f419092919063ffffffff16565b92506000610d47600183610d1e9190612a0c565b6001848a51610d2d9190612b6e565b610d379190612b6e565b89610f6d9092919063ffffffff16565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f89059e826040518263ffffffff1660e01b8152600401610da491906127d0565b60206040518083038186803b158015610dbc57600080fd5b505afa158015610dd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df491906120cd565b610e33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2a90612863565b60405180910390fd5b610e3e816000611028565b9450610e6b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff168888611443565b50809350508273ffffffffffffffffffffffffffffffffffffffff168585604051602001610e9a929190612669565b604051602081830303815290604052805190602001207fa2e66ce20e6fb2c4f61339c364ad79f15160cf5307230c8bc4d628adbca2ba3989604051610edf91906127d0565b60405180910390a350509250925092565b6000828281518110610f2b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b60f81c905092915050565b600083518284610f519190612a0c565b1115610f5c57600080fd5b818360208601012090509392505050565b606083518284610f7d9190612a0c565b1115610f8857600080fd5b60008267ffffffffffffffff811115610fca577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015610ffc5781602001600182028036833780820191505090505b509050600080602083019150856020880101905061101b8282876116b4565b8293505050509392505050565b60008061103e8385610ef090919063ffffffff16565b60ff1690506000811415611058576000801b91505061143d565b600061107b856001848761106c9190612a0c565b6110769190612a0c565b611028565b905060006110a060018661108f9190612a0c565b8488610f419092919063ffffffff16565b905081816040516020016110b5929190612669565b6040516020818303038152906040528051906020012093506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be3866040518263ffffffff1660e01b815260040161112a9190612702565b60206040518083038186803b15801561114257600080fd5b505afa158015611156573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117a91906120a4565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614806111e257503073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611221576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121890612883565b60405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611438576000801b831415611384576000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be36000801b6040518263ffffffff1660e01b81526004016112bf9190612702565b60206040518083038186803b1580156112d757600080fd5b505afa1580156112eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130f91906120a4565b90508073ffffffffffffffffffffffffffffffffffffffff16638cb8ecec84306040518363ffffffff1660e01b815260040161134c92919061271d565b600060405180830381600087803b15801561136657600080fd5b505af115801561137a573d6000803e3d6000fd5b5050505050611437565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166306ab59238484306040518463ffffffff1660e01b81526004016113e393929190612746565b602060405180830381600087803b1580156113fd57600080fd5b505af1158015611411573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143591906120f6565b505b5b505050505b92915050565b60008061144e611d86565b61146e6005865161145f9190612a0c565b8261171890919063ffffffff16565b506114b76040518060400160405280600581526020017f045f656e730000000000000000000000000000000000000000000000000000008152508261178290919063ffffffff16565b506114cb858261178290919063ffffffff16565b506000808773ffffffffffffffffffffffffffffffffffffffff1663087991bc601085600001516040518363ffffffff1660e01b815260040161150f9291906128e3565b60606040518083038186803b15801561152757600080fd5b505afa15801561153b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155f919061239d565b9091508093508192505050600060601b6bffffffffffffffffffffffff1916826bffffffffffffffffffffffff191614801561159c575060008651145b156115b057600080945094505050506116ac565b85805190602001206bffffffffffffffffffffffff1916826bffffffffffffffffffffffff1916146115e157600080fd5b60006115f76000886117a490919063ffffffff16565b90505b611603816117ce565b6116a05761162081608001518361161a9190612a62565b426117e4565b61165f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611656906128a3565b60405180910390fd5b600080611670898460a00151611800565b8093508192505050811561169057806001975097505050505050506116ac565b505061169b81611886565b6115fa565b50600080945094505050505b935093915050565b5b602081106116f357815183526020836116ce9190612a0c565b92506020826116dd9190612a0c565b91506020816116ec9190612b6e565b90506116b5565b60006001826020036101000a0390508019835116818551168181178652505050505050565b611720611d86565b600060208361172f9190612df3565b1461175b576020826117419190612df3565b602061174d9190612b6e565b826117589190612a0c565b91505b81836020018181525050604051808452600081528281016020016040525082905092915050565b61178a611d86565b61179c838460000151518485516119d0565b905092915050565b6117ac611da0565b828160000181905250818160c00181815250506117c881611886565b92915050565b6000816000015151826020015110159050919050565b60008082846117f39190612af6565b60030b1215905092915050565b6000805b83518310156118775760006118228486610ef090919063ffffffff16565b60ff1690506001846118349190612a0c565b9350600080611844878785611abf565b80935081925050508115611861578060019450945050505061187f565b828661186d9190612a0c565b9550505050611804565b600080915091505b9250929050565b8060c001518160200181815250508060000151518160200151106118a9576119cd565b60006118bd82600001518360200151611b29565b82602001516118cc9190612a0c565b90506118e5818360000151611bcc90919063ffffffff16565b826040019061ffff16908161ffff16815250506002816119059190612a0c565b905061191e818360000151611bcc90919063ffffffff16565b826060019061ffff16908161ffff168152505060028161193e9190612a0c565b9050611957818360000151611bfb90919063ffffffff16565b826080019063ffffffff16908163ffffffff168152505060048161197b9190612a0c565b90506000611996828460000151611bcc90919063ffffffff16565b61ffff1690506002826119a99190612a0c565b9150818360a001818152505080826119c19190612a0c565b8360c001818152505050505b50565b6119d8611d86565b82518211156119e657600080fd5b846020015182856119f79190612a0c565b1115611a2c57611a2b856002611a1c88602001518887611a179190612a0c565b611c2c565b611a269190612a9c565b611c48565b5b600080865180518760208301019350808887011115611a4b5787860182525b60208701925050505b60208410611a925780518252602082611a6d9190612a0c565b9150602081611a7c9190612a0c565b9050602084611a8b9190612b6e565b9350611a54565b60006001856020036101000a03905080198251168184511681811785525050508692505050949350505050565b60008063613d3078611ada8587611bfb90919063ffffffff16565b63ffffffff1614611af15760008091509150611b21565b602c831015611b065760008091509150611b21565b611b1c85600486611b179190612a0c565b611c6c565b915091505b935093915050565b6000808290505b600115611bb75783518110611b6e577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000611b838286610ef090919063ffffffff16565b60ff169050600181611b959190612a0c565b82611ba09190612a0c565b91506000811415611bb15750611bb7565b50611b30565b8281611bc39190612b6e565b91505092915050565b60008251600283611bdd9190612a0c565b1115611be857600080fd5b61ffff8260028501015116905092915050565b60008251600483611c0c9190612a0c565b1115611c1757600080fd5b63ffffffff8260048501015116905092915050565b600081831115611c3e57829050611c42565b8190505b92915050565b600082600001519050611c5b8383611718565b50611c668382611782565b50505050565b6000806028838551611c7e9190612b6e565b1015611c905760008091509150611d7f565b6000808490505b602885611ca49190612a0c565b811015611d7557600482901b91506000611cc78288610ef090919063ffffffff16565b60ff16905060308110158015611cdd5750603a81105b15611cf857603081611cef9190612b6e565b83179250611d61565b60418110158015611d095750604781105b15611d2457603781611d1b9190612b6e565b83179250611d60565b60618110158015611d355750606781105b15611d5057605781611d479190612b6e565b83179250611d5f565b60008094509450505050611d7f565b5b5b508080611d6d90612da0565b915050611c97565b5080600192509250505b9250929050565b604051806040016040528060608152602001600081525090565b6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b6000611dfe611df984612938565b612913565b90508083825260208201905082856020860282011115611e1d57600080fd5b60005b85811015611e6757813567ffffffffffffffff811115611e3f57600080fd5b808601611e4c8982612013565b85526020850194506020840193505050600181019050611e20565b5050509392505050565b6000611e84611e7f84612964565b612913565b905082815260208101848484011115611e9c57600080fd5b611ea7848285612d2d565b509392505050565b6000611ec2611ebd84612964565b612913565b905082815260208101848484011115611eda57600080fd5b611ee5848285612d3c565b509392505050565b600081359050611efc8161304d565b92915050565b600081519050611f118161304d565b92915050565b600082601f830112611f2857600080fd5b8135611f38848260208601611deb565b91505092915050565b600081519050611f5081613064565b92915050565b600081519050611f658161307b565b92915050565b600081519050611f7a81613092565b92915050565b600081359050611f8f816130a9565b92915050565b600082601f830112611fa657600080fd5b8135611fb6848260208601611e71565b91505092915050565b600082601f830112611fd057600080fd5b8151611fe0848260208601611eaf565b91505092915050565b600081359050611ff8816130c0565b92915050565b60008135905061200d816130d7565b92915050565b60006040828403121561202557600080fd5b61202f6040612913565b9050600082013567ffffffffffffffff81111561204b57600080fd5b61205784828501611f95565b600083015250602082013567ffffffffffffffff81111561207757600080fd5b61208384828501611f95565b60208301525092915050565b60008151905061209e816130ee565b92915050565b6000602082840312156120b657600080fd5b60006120c484828501611f02565b91505092915050565b6000602082840312156120df57600080fd5b60006120ed84828501611f41565b91505092915050565b60006020828403121561210857600080fd5b600061211684828501611f6b565b91505092915050565b60006020828403121561213157600080fd5b600061213f84828501611f80565b91505092915050565b60006020828403121561215a57600080fd5b600082015167ffffffffffffffff81111561217457600080fd5b61218084828501611fbf565b91505092915050565b60008060006060848603121561219e57600080fd5b600084013567ffffffffffffffff8111156121b857600080fd5b6121c486828701611f95565b935050602084013567ffffffffffffffff8111156121e157600080fd5b6121ed86828701611f17565b925050604084013567ffffffffffffffff81111561220a57600080fd5b61221686828701611f95565b9150509250925092565b600080600080600060a0868803121561223857600080fd5b600086013567ffffffffffffffff81111561225257600080fd5b61225e88828901611f95565b955050602086013567ffffffffffffffff81111561227b57600080fd5b61228788828901611f17565b945050604086013567ffffffffffffffff8111156122a457600080fd5b6122b088828901611f95565b93505060606122c188828901611eed565b92505060806122d288828901611eed565b9150509295509295909350565b600080604083850312156122f257600080fd5b600083013567ffffffffffffffff81111561230c57600080fd5b61231885828601611f95565b925050602083013567ffffffffffffffff81111561233557600080fd5b61234185828601611f95565b9150509250929050565b60006020828403121561235d57600080fd5b600061236b84828501611fe9565b91505092915050565b60006020828403121561238657600080fd5b600061239484828501611ffe565b91505092915050565b6000806000606084860312156123b257600080fd5b60006123c08682870161208f565b93505060206123d18682870161208f565b92505060406123e286828701611f56565b9150509250925092565b60006123f88383612616565b905092915050565b61240981612ba2565b82525050565b600061241a826129a5565b61242481856129c8565b93508360208202850161243685612995565b8060005b85811015612472578484038952815161245385826123ec565b945061245e836129bb565b925060208a0199505060018101905061243a565b50829750879550505050505092915050565b61248d81612bb4565b82525050565b61249c81612bec565b82525050565b6124b36124ae82612bec565b612de9565b82525050565b60006124c4826129b0565b6124ce81856129d9565b93506124de818560208601612d3c565b6124e781612eb1565b840191505092915050565b60006124fd826129b0565b61250781856129ea565b9350612517818560208601612d3c565b61252081612eb1565b840191505092915050565b61253481612caf565b82525050565b61254381612cd3565b82525050565b61255281612cf7565b82525050565b61256181612d1b565b82525050565b60006125746026836129fb565b915061257f82612ec2565b604082019050919050565b60006125976023836129fb565b91506125a282612f11565b604082019050919050565b60006125ba602a836129fb565b91506125c582612f60565b604082019050919050565b60006125dd603c836129fb565b91506125e882612faf565b604082019050919050565b6000612600602d836129fb565b915061260b82612ffe565b604082019050919050565b6000604083016000830151848203600086015261263382826124b9565b9150506020830151848203602086015261264d82826124b9565b9150508091505092915050565b61266381612c53565b82525050565b600061267582856124a2565b60208201915061268582846124a2565b6020820191508190509392505050565b60006020820190506126aa6000830184612400565b92915050565b600060408201905081810360008301526126ca818561240f565b905081810360208301526126de81846124f2565b90509392505050565b60006020820190506126fc6000830184612484565b92915050565b60006020820190506127176000830184612493565b92915050565b60006040820190506127326000830185612493565b61273f6020830184612400565b9392505050565b600060608201905061275b6000830186612493565b6127686020830185612493565b6127756040830184612400565b949350505050565b600060a0820190506127926000830188612493565b61279f6020830187612493565b6127ac6040830186612400565b6127b96060830185612400565b6127c66080830184612558565b9695505050505050565b600060208201905081810360008301526127ea81846124f2565b905092915050565b6000602082019050612807600083018461252b565b92915050565b6000602082019050612822600083018461253a565b92915050565b600060208201905061283d6000830184612549565b92915050565b6000602082019050818103600083015261285c81612567565b9050919050565b6000602082019050818103600083015261287c8161258a565b9050919050565b6000602082019050818103600083015261289c816125ad565b9050919050565b600060208201905081810360008301526128bc816125d0565b9050919050565b600060208201905081810360008301526128dc816125f3565b9050919050565b60006040820190506128f8600083018561265a565b818103602083015261290a81846124f2565b90509392505050565b600061291d61292e565b90506129298282612d6f565b919050565b6000604051905090565b600067ffffffffffffffff82111561295357612952612e82565b5b602082029050602081019050919050565b600067ffffffffffffffff82111561297f5761297e612e82565b5b61298882612eb1565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612a1782612c81565b9150612a2283612c81565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612a5757612a56612e24565b5b828201905092915050565b6000612a6d82612c8b565b9150612a7883612c8b565b92508263ffffffff03821115612a9157612a90612e24565b5b828201905092915050565b6000612aa782612c81565b9150612ab283612c81565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612aeb57612aea612e24565b5b828202905092915050565b6000612b0182612c46565b9150612b0c83612c46565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffff8000000001821260008412151615612b4757612b46612e24565b5b82637fffffff018213600084121615612b6357612b62612e24565b5b828203905092915050565b6000612b7982612c81565b9150612b8483612c81565b925082821015612b9757612b96612e24565b5b828203905092915050565b6000612bad82612c61565b9050919050565b60008115159050919050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6000612c2d82612ba2565b9050919050565b6000612c3f82612ba2565b9050919050565b60008160030b9050919050565b600061ffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600063ffffffff82169050919050565b600067ffffffffffffffff82169050919050565b6000612cba82612cc1565b9050919050565b6000612ccc82612c61565b9050919050565b6000612cde82612ce5565b9050919050565b6000612cf082612c61565b9050919050565b6000612d0282612d09565b9050919050565b6000612d1482612c61565b9050919050565b6000612d2682612c9b565b9050919050565b82818337600083830152505050565b60005b83811015612d5a578082015181840152602081019050612d3f565b83811115612d69576000848401525b50505050565b612d7882612eb1565b810181811067ffffffffffffffff82111715612d9757612d96612e82565b5b80604052505050565b6000612dab82612c81565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612dde57612ddd612e24565b5b600182019050919050565b6000819050919050565b6000612dfe82612c81565b9150612e0983612c81565b925082612e1957612e18612e53565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f43616e6e6f74207365742061646472206966207265736f6c766572206973206e60008201527f6f74207365740000000000000000000000000000000000000000000000000000602082015250565b7f506172656e74206e616d65206d7573742062652061207075626c69632073756660008201527f6669780000000000000000000000000000000000000000000000000000000000602082015250565b7f43616e6e6f7420656e61626c652061206e616d65206f776e656420627920736f60008201527f6d656f6e6520656c736500000000000000000000000000000000000000000000602082015250565b7f444e53207265636f7264206973207374616c653b2072656672657368206f722060008201527f64656c657465206974206265666f72652070726f63656564696e672e00000000602082015250565b7f4f6e6c79206f776e65722063616e2063616c6c2070726f7665416e64436c616960008201527f6d576974685265736f6c76657200000000000000000000000000000000000000602082015250565b61305681612ba2565b811461306157600080fd5b50565b61306d81612bb4565b811461307857600080fd5b50565b61308481612bc0565b811461308f57600080fd5b50565b61309b81612bec565b81146130a657600080fd5b50565b6130b281612bf6565b81146130bd57600080fd5b50565b6130c981612c22565b81146130d457600080fd5b50565b6130e081612c34565b81146130eb57600080fd5b50565b6130f781612c8b565b811461310257600080fd5b5056fea26469706673582212205a3082f3cdf4a36b012985b9db868214dcb218d09a3e2419bf61684540df4b3464736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100935760003560e01c80633f15457f116100665780633f15457f1461011e5780637adbf9731461013c5780637dc0d1d0146101585780638bbedf7514610176578063be27b22c1461019257610093565b806301ffc9a7146100985780631ecfc411146100c8578063224199c2146100e457806330349ebe14610100575b600080fd5b6100b260048036038101906100ad919061211f565b6101ae565b6040516100bf91906126e7565b60405180910390f35b6100e260048036038101906100dd9190612374565b610280565b005b6100fe60048036038101906100f99190612220565b61048b565b005b6101086108cc565b6040516101159190612828565b60405180910390f35b6101266108f2565b604051610133919061280d565b60405180910390f35b6101566004803603810190610151919061234b565b610918565b005b610160610b20565b60405161016d91906127f2565b60405180910390f35b610190600480360381019061018b9190612189565b610b44565b005b6101ac60048036038101906101a791906122df565b610c07565b005b60007f01ffc9a7a5cef8baa21ed3c5c0d7e23accb804b619e9333b597f47a0d84076e27bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061027957507f17d8f49b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b9050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be36000801b6040518263ffffffff1660e01b81526004016102e09190612702565b60206040518083038186803b1580156102f857600080fd5b505afa15801561030c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033091906120a4565b905060008173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561037a57600080fd5b505afa15801561038e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b291906120a4565b90508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103ec57600080fd5b82600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba8600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660405161047e9190612695565b60405180910390a1505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663435cc16285856040518363ffffffff1660e01b81526004016104e69291906126b0565b600060405180830381600087803b15801561050057600080fd5b505af1158015610514573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525081019061053d9190612148565b9250600080600061054e8887610cd5565b9250925092508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146105c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b9906128c3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161461082b57600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415610666576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065d90612843565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635ef2c7f08484308960006040518663ffffffff1660e01b81526004016106ca95949392919061277d565b600060405180830381600087803b1580156106e457600080fd5b505af11580156106f8573d6000803e3d6000fd5b5050505060008383604051602001610711929190612669565b6040516020818303038152906040528051906020012090508573ffffffffffffffffffffffffffffffffffffffff1663d5fa2b0082876040518363ffffffff1660e01b815260040161076492919061271d565b600060405180830381600087803b15801561077e57600080fd5b505af1158015610792573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635b0fc9c382846040518363ffffffff1660e01b81526004016107f392919061271d565b600060405180830381600087803b15801561080d57600080fd5b505af1158015610821573d6000803e3d6000fd5b50505050506108c2565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635ef2c7f08484848960006040518663ffffffff1660e01b815260040161088f95949392919061277d565b600060405180830381600087803b1580156108a957600080fd5b505af11580156108bd573d6000803e3d6000fd5b505050505b5050505050505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be36000801b6040518263ffffffff1660e01b81526004016109789190612702565b60206040518083038186803b15801561099057600080fd5b505afa1580156109a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c891906120a4565b905060008173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a1257600080fd5b505afa158015610a26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a4a91906120a4565b90508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a8457600080fd5b826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fb3eacd0e351fafdfefdec84e1cd19679b38dbcd63ea7c2c24da17fd2bc3b3c0e60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051610b139190612695565b60405180910390a1505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663435cc16283836040518363ffffffff1660e01b8152600401610b9f9291906126b0565b600060405180830381600087803b158015610bb957600080fd5b505af1158015610bcd573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190610bf69190612148565b9050610c028382610c07565b505050565b6000806000610c168585610cd5565b925092509250600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166306ab59238484846040518463ffffffff1660e01b8152600401610c7b93929190612746565b602060405180830381600087803b158015610c9557600080fd5b505af1158015610ca9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ccd91906120f6565b505050505050565b600080600080610cef600087610ef090919063ffffffff16565b60ff169050610d0a60018288610f419092919063ffffffff16565b92506000610d47600183610d1e9190612a0c565b6001848a51610d2d9190612b6e565b610d379190612b6e565b89610f6d9092919063ffffffff16565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f89059e826040518263ffffffff1660e01b8152600401610da491906127d0565b60206040518083038186803b158015610dbc57600080fd5b505afa158015610dd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df491906120cd565b610e33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2a90612863565b60405180910390fd5b610e3e816000611028565b9450610e6b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff168888611443565b50809350508273ffffffffffffffffffffffffffffffffffffffff168585604051602001610e9a929190612669565b604051602081830303815290604052805190602001207fa2e66ce20e6fb2c4f61339c364ad79f15160cf5307230c8bc4d628adbca2ba3989604051610edf91906127d0565b60405180910390a350509250925092565b6000828281518110610f2b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b60f81c905092915050565b600083518284610f519190612a0c565b1115610f5c57600080fd5b818360208601012090509392505050565b606083518284610f7d9190612a0c565b1115610f8857600080fd5b60008267ffffffffffffffff811115610fca577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015610ffc5781602001600182028036833780820191505090505b509050600080602083019150856020880101905061101b8282876116b4565b8293505050509392505050565b60008061103e8385610ef090919063ffffffff16565b60ff1690506000811415611058576000801b91505061143d565b600061107b856001848761106c9190612a0c565b6110769190612a0c565b611028565b905060006110a060018661108f9190612a0c565b8488610f419092919063ffffffff16565b905081816040516020016110b5929190612669565b6040516020818303038152906040528051906020012093506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be3866040518263ffffffff1660e01b815260040161112a9190612702565b60206040518083038186803b15801561114257600080fd5b505afa158015611156573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117a91906120a4565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614806111e257503073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611221576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121890612883565b60405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611438576000801b831415611384576000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166302571be36000801b6040518263ffffffff1660e01b81526004016112bf9190612702565b60206040518083038186803b1580156112d757600080fd5b505afa1580156112eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130f91906120a4565b90508073ffffffffffffffffffffffffffffffffffffffff16638cb8ecec84306040518363ffffffff1660e01b815260040161134c92919061271d565b600060405180830381600087803b15801561136657600080fd5b505af115801561137a573d6000803e3d6000fd5b5050505050611437565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166306ab59238484306040518463ffffffff1660e01b81526004016113e393929190612746565b602060405180830381600087803b1580156113fd57600080fd5b505af1158015611411573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143591906120f6565b505b5b505050505b92915050565b60008061144e611d86565b61146e6005865161145f9190612a0c565b8261171890919063ffffffff16565b506114b76040518060400160405280600581526020017f045f656e730000000000000000000000000000000000000000000000000000008152508261178290919063ffffffff16565b506114cb858261178290919063ffffffff16565b506000808773ffffffffffffffffffffffffffffffffffffffff1663087991bc601085600001516040518363ffffffff1660e01b815260040161150f9291906128e3565b60606040518083038186803b15801561152757600080fd5b505afa15801561153b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155f919061239d565b9091508093508192505050600060601b6bffffffffffffffffffffffff1916826bffffffffffffffffffffffff191614801561159c575060008651145b156115b057600080945094505050506116ac565b85805190602001206bffffffffffffffffffffffff1916826bffffffffffffffffffffffff1916146115e157600080fd5b60006115f76000886117a490919063ffffffff16565b90505b611603816117ce565b6116a05761162081608001518361161a9190612a62565b426117e4565b61165f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611656906128a3565b60405180910390fd5b600080611670898460a00151611800565b8093508192505050811561169057806001975097505050505050506116ac565b505061169b81611886565b6115fa565b50600080945094505050505b935093915050565b5b602081106116f357815183526020836116ce9190612a0c565b92506020826116dd9190612a0c565b91506020816116ec9190612b6e565b90506116b5565b60006001826020036101000a0390508019835116818551168181178652505050505050565b611720611d86565b600060208361172f9190612df3565b1461175b576020826117419190612df3565b602061174d9190612b6e565b826117589190612a0c565b91505b81836020018181525050604051808452600081528281016020016040525082905092915050565b61178a611d86565b61179c838460000151518485516119d0565b905092915050565b6117ac611da0565b828160000181905250818160c00181815250506117c881611886565b92915050565b6000816000015151826020015110159050919050565b60008082846117f39190612af6565b60030b1215905092915050565b6000805b83518310156118775760006118228486610ef090919063ffffffff16565b60ff1690506001846118349190612a0c565b9350600080611844878785611abf565b80935081925050508115611861578060019450945050505061187f565b828661186d9190612a0c565b9550505050611804565b600080915091505b9250929050565b8060c001518160200181815250508060000151518160200151106118a9576119cd565b60006118bd82600001518360200151611b29565b82602001516118cc9190612a0c565b90506118e5818360000151611bcc90919063ffffffff16565b826040019061ffff16908161ffff16815250506002816119059190612a0c565b905061191e818360000151611bcc90919063ffffffff16565b826060019061ffff16908161ffff168152505060028161193e9190612a0c565b9050611957818360000151611bfb90919063ffffffff16565b826080019063ffffffff16908163ffffffff168152505060048161197b9190612a0c565b90506000611996828460000151611bcc90919063ffffffff16565b61ffff1690506002826119a99190612a0c565b9150818360a001818152505080826119c19190612a0c565b8360c001818152505050505b50565b6119d8611d86565b82518211156119e657600080fd5b846020015182856119f79190612a0c565b1115611a2c57611a2b856002611a1c88602001518887611a179190612a0c565b611c2c565b611a269190612a9c565b611c48565b5b600080865180518760208301019350808887011115611a4b5787860182525b60208701925050505b60208410611a925780518252602082611a6d9190612a0c565b9150602081611a7c9190612a0c565b9050602084611a8b9190612b6e565b9350611a54565b60006001856020036101000a03905080198251168184511681811785525050508692505050949350505050565b60008063613d3078611ada8587611bfb90919063ffffffff16565b63ffffffff1614611af15760008091509150611b21565b602c831015611b065760008091509150611b21565b611b1c85600486611b179190612a0c565b611c6c565b915091505b935093915050565b6000808290505b600115611bb75783518110611b6e577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000611b838286610ef090919063ffffffff16565b60ff169050600181611b959190612a0c565b82611ba09190612a0c565b91506000811415611bb15750611bb7565b50611b30565b8281611bc39190612b6e565b91505092915050565b60008251600283611bdd9190612a0c565b1115611be857600080fd5b61ffff8260028501015116905092915050565b60008251600483611c0c9190612a0c565b1115611c1757600080fd5b63ffffffff8260048501015116905092915050565b600081831115611c3e57829050611c42565b8190505b92915050565b600082600001519050611c5b8383611718565b50611c668382611782565b50505050565b6000806028838551611c7e9190612b6e565b1015611c905760008091509150611d7f565b6000808490505b602885611ca49190612a0c565b811015611d7557600482901b91506000611cc78288610ef090919063ffffffff16565b60ff16905060308110158015611cdd5750603a81105b15611cf857603081611cef9190612b6e565b83179250611d61565b60418110158015611d095750604781105b15611d2457603781611d1b9190612b6e565b83179250611d60565b60618110158015611d355750606781105b15611d5057605781611d479190612b6e565b83179250611d5f565b60008094509450505050611d7f565b5b5b508080611d6d90612da0565b915050611c97565b5080600192509250505b9250929050565b604051806040016040528060608152602001600081525090565b6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b6000611dfe611df984612938565b612913565b90508083825260208201905082856020860282011115611e1d57600080fd5b60005b85811015611e6757813567ffffffffffffffff811115611e3f57600080fd5b808601611e4c8982612013565b85526020850194506020840193505050600181019050611e20565b5050509392505050565b6000611e84611e7f84612964565b612913565b905082815260208101848484011115611e9c57600080fd5b611ea7848285612d2d565b509392505050565b6000611ec2611ebd84612964565b612913565b905082815260208101848484011115611eda57600080fd5b611ee5848285612d3c565b509392505050565b600081359050611efc8161304d565b92915050565b600081519050611f118161304d565b92915050565b600082601f830112611f2857600080fd5b8135611f38848260208601611deb565b91505092915050565b600081519050611f5081613064565b92915050565b600081519050611f658161307b565b92915050565b600081519050611f7a81613092565b92915050565b600081359050611f8f816130a9565b92915050565b600082601f830112611fa657600080fd5b8135611fb6848260208601611e71565b91505092915050565b600082601f830112611fd057600080fd5b8151611fe0848260208601611eaf565b91505092915050565b600081359050611ff8816130c0565b92915050565b60008135905061200d816130d7565b92915050565b60006040828403121561202557600080fd5b61202f6040612913565b9050600082013567ffffffffffffffff81111561204b57600080fd5b61205784828501611f95565b600083015250602082013567ffffffffffffffff81111561207757600080fd5b61208384828501611f95565b60208301525092915050565b60008151905061209e816130ee565b92915050565b6000602082840312156120b657600080fd5b60006120c484828501611f02565b91505092915050565b6000602082840312156120df57600080fd5b60006120ed84828501611f41565b91505092915050565b60006020828403121561210857600080fd5b600061211684828501611f6b565b91505092915050565b60006020828403121561213157600080fd5b600061213f84828501611f80565b91505092915050565b60006020828403121561215a57600080fd5b600082015167ffffffffffffffff81111561217457600080fd5b61218084828501611fbf565b91505092915050565b60008060006060848603121561219e57600080fd5b600084013567ffffffffffffffff8111156121b857600080fd5b6121c486828701611f95565b935050602084013567ffffffffffffffff8111156121e157600080fd5b6121ed86828701611f17565b925050604084013567ffffffffffffffff81111561220a57600080fd5b61221686828701611f95565b9150509250925092565b600080600080600060a0868803121561223857600080fd5b600086013567ffffffffffffffff81111561225257600080fd5b61225e88828901611f95565b955050602086013567ffffffffffffffff81111561227b57600080fd5b61228788828901611f17565b945050604086013567ffffffffffffffff8111156122a457600080fd5b6122b088828901611f95565b93505060606122c188828901611eed565b92505060806122d288828901611eed565b9150509295509295909350565b600080604083850312156122f257600080fd5b600083013567ffffffffffffffff81111561230c57600080fd5b61231885828601611f95565b925050602083013567ffffffffffffffff81111561233557600080fd5b61234185828601611f95565b9150509250929050565b60006020828403121561235d57600080fd5b600061236b84828501611fe9565b91505092915050565b60006020828403121561238657600080fd5b600061239484828501611ffe565b91505092915050565b6000806000606084860312156123b257600080fd5b60006123c08682870161208f565b93505060206123d18682870161208f565b92505060406123e286828701611f56565b9150509250925092565b60006123f88383612616565b905092915050565b61240981612ba2565b82525050565b600061241a826129a5565b61242481856129c8565b93508360208202850161243685612995565b8060005b85811015612472578484038952815161245385826123ec565b945061245e836129bb565b925060208a0199505060018101905061243a565b50829750879550505050505092915050565b61248d81612bb4565b82525050565b61249c81612bec565b82525050565b6124b36124ae82612bec565b612de9565b82525050565b60006124c4826129b0565b6124ce81856129d9565b93506124de818560208601612d3c565b6124e781612eb1565b840191505092915050565b60006124fd826129b0565b61250781856129ea565b9350612517818560208601612d3c565b61252081612eb1565b840191505092915050565b61253481612caf565b82525050565b61254381612cd3565b82525050565b61255281612cf7565b82525050565b61256181612d1b565b82525050565b60006125746026836129fb565b915061257f82612ec2565b604082019050919050565b60006125976023836129fb565b91506125a282612f11565b604082019050919050565b60006125ba602a836129fb565b91506125c582612f60565b604082019050919050565b60006125dd603c836129fb565b91506125e882612faf565b604082019050919050565b6000612600602d836129fb565b915061260b82612ffe565b604082019050919050565b6000604083016000830151848203600086015261263382826124b9565b9150506020830151848203602086015261264d82826124b9565b9150508091505092915050565b61266381612c53565b82525050565b600061267582856124a2565b60208201915061268582846124a2565b6020820191508190509392505050565b60006020820190506126aa6000830184612400565b92915050565b600060408201905081810360008301526126ca818561240f565b905081810360208301526126de81846124f2565b90509392505050565b60006020820190506126fc6000830184612484565b92915050565b60006020820190506127176000830184612493565b92915050565b60006040820190506127326000830185612493565b61273f6020830184612400565b9392505050565b600060608201905061275b6000830186612493565b6127686020830185612493565b6127756040830184612400565b949350505050565b600060a0820190506127926000830188612493565b61279f6020830187612493565b6127ac6040830186612400565b6127b96060830185612400565b6127c66080830184612558565b9695505050505050565b600060208201905081810360008301526127ea81846124f2565b905092915050565b6000602082019050612807600083018461252b565b92915050565b6000602082019050612822600083018461253a565b92915050565b600060208201905061283d6000830184612549565b92915050565b6000602082019050818103600083015261285c81612567565b9050919050565b6000602082019050818103600083015261287c8161258a565b9050919050565b6000602082019050818103600083015261289c816125ad565b9050919050565b600060208201905081810360008301526128bc816125d0565b9050919050565b600060208201905081810360008301526128dc816125f3565b9050919050565b60006040820190506128f8600083018561265a565b818103602083015261290a81846124f2565b90509392505050565b600061291d61292e565b90506129298282612d6f565b919050565b6000604051905090565b600067ffffffffffffffff82111561295357612952612e82565b5b602082029050602081019050919050565b600067ffffffffffffffff82111561297f5761297e612e82565b5b61298882612eb1565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612a1782612c81565b9150612a2283612c81565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612a5757612a56612e24565b5b828201905092915050565b6000612a6d82612c8b565b9150612a7883612c8b565b92508263ffffffff03821115612a9157612a90612e24565b5b828201905092915050565b6000612aa782612c81565b9150612ab283612c81565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612aeb57612aea612e24565b5b828202905092915050565b6000612b0182612c46565b9150612b0c83612c46565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffff8000000001821260008412151615612b4757612b46612e24565b5b82637fffffff018213600084121615612b6357612b62612e24565b5b828203905092915050565b6000612b7982612c81565b9150612b8483612c81565b925082821015612b9757612b96612e24565b5b828203905092915050565b6000612bad82612c61565b9050919050565b60008115159050919050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6000612c2d82612ba2565b9050919050565b6000612c3f82612ba2565b9050919050565b60008160030b9050919050565b600061ffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600063ffffffff82169050919050565b600067ffffffffffffffff82169050919050565b6000612cba82612cc1565b9050919050565b6000612ccc82612c61565b9050919050565b6000612cde82612ce5565b9050919050565b6000612cf082612c61565b9050919050565b6000612d0282612d09565b9050919050565b6000612d1482612c61565b9050919050565b6000612d2682612c9b565b9050919050565b82818337600083830152505050565b60005b83811015612d5a578082015181840152602081019050612d3f565b83811115612d69576000848401525b50505050565b612d7882612eb1565b810181811067ffffffffffffffff82111715612d9757612d96612e82565b5b80604052505050565b6000612dab82612c81565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612dde57612ddd612e24565b5b600182019050919050565b6000819050919050565b6000612dfe82612c81565b9150612e0983612c81565b925082612e1957612e18612e53565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f43616e6e6f74207365742061646472206966207265736f6c766572206973206e60008201527f6f74207365740000000000000000000000000000000000000000000000000000602082015250565b7f506172656e74206e616d65206d7573742062652061207075626c69632073756660008201527f6669780000000000000000000000000000000000000000000000000000000000602082015250565b7f43616e6e6f7420656e61626c652061206e616d65206f776e656420627920736f60008201527f6d656f6e6520656c736500000000000000000000000000000000000000000000602082015250565b7f444e53207265636f7264206973207374616c653b2072656672657368206f722060008201527f64656c657465206974206265666f72652070726f63656564696e672e00000000602082015250565b7f4f6e6c79206f776e65722063616e2063616c6c2070726f7665416e64436c616960008201527f6d576974685265736f6c76657200000000000000000000000000000000000000602082015250565b61305681612ba2565b811461306157600080fd5b50565b61306d81612bb4565b811461307857600080fd5b50565b61308481612bc0565b811461308f57600080fd5b50565b61309b81612bec565b81146130a657600080fd5b50565b6130b281612bf6565b81146130bd57600080fd5b50565b6130c981612c22565b81146130d457600080fd5b50565b6130e081612c34565b81146130eb57600080fd5b50565b6130f781612c8b565b811461310257600080fd5b5056fea26469706673582212205a3082f3cdf4a36b012985b9db868214dcb218d09a3e2419bf61684540df4b3464736f6c63430008040033", + "devdoc": { + "details": "An ENS registrar that allows the owner of a DNS name to claim the corresponding name in ENS.", + "kind": "dev", + "methods": { + "claim(bytes,bytes)": { + "details": "Claims a name by proving ownership of its DNS equivalent.", + "params": { + "name": "The name to claim, in DNS wire format.", + "proof": "A DNS RRSet proving ownership of the name. Must be verified in the DNSSEC oracle before calling. This RRSET must contain a TXT record for '_ens.' + name, with the value 'a=0x...'. Ownership of the name will be transferred to the address specified in the TXT record." + } + }, + "proveAndClaim(bytes,(bytes,bytes)[],bytes)": { + "details": "Submits proofs to the DNSSEC oracle, then claims a name using those proofs.", + "params": { + "input": "The data to be passed to the Oracle's `submitProofs` function. The last proof must be the TXT record required by the registrar.", + "name": "The name to claim, in DNS wire format.", + "proof": "The proof record for the first element in input." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 1126, + "contract": "contracts/dnsregistrar/DNSRegistrar.sol:DNSRegistrar", + "label": "oracle", + "offset": 0, + "slot": "0", + "type": "t_contract(DNSSEC)2509" + }, + { + "astId": 1129, + "contract": "contracts/dnsregistrar/DNSRegistrar.sol:DNSRegistrar", + "label": "ens", + "offset": 0, + "slot": "1", + "type": "t_contract(ENS)5725" + }, + { + "astId": 1132, + "contract": "contracts/dnsregistrar/DNSRegistrar.sol:DNSRegistrar", + "label": "suffixes", + "offset": 0, + "slot": "2", + "type": "t_contract(PublicSuffixList)1679" + } + ], + "types": { + "t_contract(DNSSEC)2509": { + "encoding": "inplace", + "label": "contract DNSSEC", + "numberOfBytes": "20" + }, + "t_contract(ENS)5725": { + "encoding": "inplace", + "label": "contract ENS", + "numberOfBytes": "20" + }, + "t_contract(PublicSuffixList)1679": { + "encoding": "inplace", + "label": "contract PublicSuffixList", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/DNSSECImpl.json b/solidity/dns-contracts/deployments/ropsten/DNSSECImpl.json new file mode 100644 index 0000000..eed6654 --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/DNSSECImpl.json @@ -0,0 +1,755 @@ +{ + "address": "0xC16B94F118DD7181655bbb34e555Db82514A6E38", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "_anchors", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "AlgorithmUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "DigestUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "Marker", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "NSEC3DigestUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + } + ], + "name": "RRSetUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "t", + "type": "uint256" + } + ], + "name": "Test", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "algorithms", + "outputs": [ + { + "internalType": "contract Algorithm", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "anchors", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "deleteType", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "deleteName", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature", + "name": "nsec", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + } + ], + "name": "deleteRRSet", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "deleteType", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "deleteName", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature", + "name": "closestEncloser", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature", + "name": "nextClosest", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "dnskey", + "type": "bytes" + } + ], + "name": "deleteRRSetNSEC3", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "digests", + "outputs": [ + { + "internalType": "contract Digest", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "nsec3Digests", + "outputs": [ + { + "internalType": "contract NSEC3Digest", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "dnstype", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "rrdata", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "", + "type": "uint32" + }, + { + "internalType": "bytes20", + "name": "", + "type": "bytes20" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "internalType": "contract Algorithm", + "name": "algo", + "type": "address" + } + ], + "name": "setAlgorithm", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "internalType": "contract Digest", + "name": "digest", + "type": "address" + } + ], + "name": "setDigest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "internalType": "contract NSEC3Digest", + "name": "digest", + "type": "address" + } + ], + "name": "setNSEC3Digest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature", + "name": "input", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + } + ], + "name": "submitRRSet", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature[]", + "name": "input", + "type": "tuple[]" + }, + { + "internalType": "bytes", + "name": "_proof", + "type": "bytes" + } + ], + "name": "submitRRSets", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x6bf46695f16f724493d4103824f8b51b03bf9dcc759c185399cf908d1c96efe3", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0xC16B94F118DD7181655bbb34e555Db82514A6E38", + "transactionIndex": 0, + "gasUsed": "4221613", + "logsBloom": "0x00000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x785b16051b9ebddd6dfb6319d716cf21b5aef4b720c64276ac599243070e846f", + "transactionHash": "0x6bf46695f16f724493d4103824f8b51b03bf9dcc759c185399cf908d1c96efe3", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10909322, + "transactionHash": "0x6bf46695f16f724493d4103824f8b51b03bf9dcc759c185399cf908d1c96efe3", + "address": "0xC16B94F118DD7181655bbb34e555Db82514A6E38", + "topics": [ + "0x55ced933cdd5a34dd03eb5d4bef19ec6ebb251dcd7a988eee0c1b9a13baaa88b" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006d00002b000100000e1000244a5c080249aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb500002b000100000e1000244f660802e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d00002b000100000e10000404fefdfd00000000000000000000000000000000000000", + "logIndex": 0, + "blockHash": "0x785b16051b9ebddd6dfb6319d716cf21b5aef4b720c64276ac599243070e846f" + } + ], + "blockNumber": 10909322, + "cumulativeGasUsed": "4221613", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00002b000100000e1000244a5c080249aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb500002b000100000e1000244f660802e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d00002b000100000e10000404fefdfd" + ], + "solcInputHash": "08371ea78d6ca0259dbc9b2f768cf73e", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_anchors\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"AlgorithmUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"DigestUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"Marker\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"NSEC3DigestUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"}],\"name\":\"RRSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"t\",\"type\":\"uint256\"}],\"name\":\"Test\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"algorithms\",\"outputs\":[{\"internalType\":\"contract Algorithm\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"anchors\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"deleteType\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"deleteName\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature\",\"name\":\"nsec\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"deleteRRSet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"deleteType\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"deleteName\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature\",\"name\":\"closestEncloser\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature\",\"name\":\"nextClosest\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"dnskey\",\"type\":\"bytes\"}],\"name\":\"deleteRRSetNSEC3\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"digests\",\"outputs\":[{\"internalType\":\"contract Digest\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"nsec3Digests\",\"outputs\":[{\"internalType\":\"contract NSEC3Digest\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"dnstype\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"rrdata\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"},{\"internalType\":\"bytes20\",\"name\":\"\",\"type\":\"bytes20\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"internalType\":\"contract Algorithm\",\"name\":\"algo\",\"type\":\"address\"}],\"name\":\"setAlgorithm\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"internalType\":\"contract Digest\",\"name\":\"digest\",\"type\":\"address\"}],\"name\":\"setDigest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"internalType\":\"contract NSEC3Digest\",\"name\":\"digest\",\"type\":\"address\"}],\"name\":\"setNSEC3Digest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature\",\"name\":\"input\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"submitRRSet\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature[]\",\"name\":\"input\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"_proof\",\"type\":\"bytes\"}],\"name\":\"submitRRSets\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_anchors\":\"The binary format RR entries for the root DS records.\"}},\"deleteRRSet(uint16,bytes,(bytes,bytes),bytes)\":{\"details\":\"Deletes an RR from the oracle.\",\"params\":{\"deleteName\":\"which you want to delete\",\"deleteType\":\"The DNS record type to delete.\",\"nsec\":\"The signed NSEC RRset. This is in the format described in section 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature data, followed by a series of canonicalised RR records that the signature applies to.\"}},\"deleteRRSetNSEC3(uint16,bytes,(bytes,bytes),(bytes,bytes),bytes)\":{\"details\":\"Deletes an RR from the oracle using an NSEC3 proof. Deleting a record using NSEC3 requires using up to two NSEC3 records. There are two cases: 1. The name exists, but the record type doesn't. Eg, example.com has A records but no TXT records. 2. The name does not exist, but a parent name does. In the first case, we submit one NSEC3 proof in `closestEncloser` that matches the target name but does not have the bit for `deleteType` set in its type bitmap. In the second case, we submit two proofs: closestEncloser and nextClosest, that together prove that the name does not exist. NSEC3 records are in the format described in section 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature data, followed by a series of canonicalised RR records that the signature applies to.\",\"params\":{\"closestEncloser\":\"An NSEC3 proof matching the closest enclosing name - that is, the nearest ancestor of the target name that *does* exist.\",\"deleteName\":\"The name to delete.\",\"deleteType\":\"The DNS record type to delete.\",\"dnskey\":\"An encoded DNSKEY record that has already been submitted to the oracle and can be used to verify the signatures closestEncloserSig and nextClosestSig\",\"nextClosest\":\"An NSEC3 proof covering the next closest name. This proves that the immediate subdomain of the closestEncloser does not exist.\"}},\"rrdata(uint16,bytes)\":{\"details\":\"Returns data about the RRs (if any) known to this oracle with the provided type and name.\",\"params\":{\"dnstype\":\"The DNS record type to query.\",\"name\":\"The name to query, in DNS label-sequence format.\"},\"returns\":{\"_0\":\"inception The unix timestamp (wrapped) at which the signature for this RRSET was created.\",\"_1\":\"expiration The unix timestamp (wrapped) at which the signature for this RRSET expires.\",\"_2\":\"hash The hash of the RRset.\"}},\"setAlgorithm(uint8,address)\":{\"details\":\"Sets the contract address for a signature verification algorithm. Callable only by the owner.\",\"params\":{\"algo\":\"The address of the algorithm contract.\",\"id\":\"The algorithm ID\"}},\"setDigest(uint8,address)\":{\"details\":\"Sets the contract address for a digest verification algorithm. Callable only by the owner.\",\"params\":{\"digest\":\"The address of the digest contract.\",\"id\":\"The digest ID\"}},\"setNSEC3Digest(uint8,address)\":{\"details\":\"Sets the contract address for an NSEC3 digest algorithm. Callable only by the owner.\",\"params\":{\"digest\":\"The address of the digest contract.\",\"id\":\"The digest ID\"}},\"submitRRSet((bytes,bytes),bytes)\":{\"details\":\"Submits a signed set of RRs to the oracle. RRSETs are only accepted if they are signed with a key that is already trusted, or if they are self-signed, and the signing key is identified by a DS record that is already trusted.\",\"params\":{\"input\":\"The signed RR set. This is in the format described in section 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature data, followed by a series of canonicalised RR records that the signature applies to.\",\"proof\":\"The DNSKEY or DS to validate the signature against. Must Already have been submitted and proved previously.\"}},\"submitRRSets((bytes,bytes)[],bytes)\":{\"details\":\"Submits multiple RRSets\",\"params\":{\"_proof\":\"The DNSKEY or DS to validate the first signature against.\",\"input\":\"A list of RRSets and signatures forming a chain of trust from an existing known-good record.\"},\"returns\":{\"_0\":\"The last RRSET submitted.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/DNSSECImpl.sol\":\"DNSSECImpl\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for writing to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n mstore(0x40, add(32, add(ptr, capacity)))\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n function max(uint a, uint b) private pure returns(uint) {\\n if (a > b) {\\n return a;\\n }\\n return b;\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The start offset to write to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n if (off + len > buf.capacity) {\\n resize(buf, max(buf.capacity, len + off) * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(add(len, off), buflen) {\\n mstore(bufptr, add(len, off))\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, len);\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, data.length);\\n }\\n\\n /**\\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write the byte at.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\\n if (off >= buf.capacity) {\\n resize(buf, buf.capacity * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if eq(off, buflen) {\\n mstore(bufptr, add(buflen, 1))\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n return writeUint8(buf, buf.buf.length, data);\\n }\\n\\n /**\\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\\n if (len + off > buf.capacity) {\\n resize(buf, (len + off) * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off + len\\n let dest := add(add(bufptr, off), len)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(add(off, len), mload(bufptr)) {\\n mstore(bufptr, add(off, len))\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\\n return write(buf, off, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, 32);\\n }\\n\\n /**\\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\\n if (len + off > buf.capacity) {\\n resize(buf, (len + off) * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + off + sizeof(buffer length) + len\\n let dest := add(add(bufptr, off), len)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(add(off, len), mload(bufptr)) {\\n mstore(bufptr, add(off, len))\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n return writeInt(buf, buf.buf.length, data, len);\\n }\\n}\\n\",\"keccak256\":\"0x18e42be1a3e4f7b4442d7ab0b524af5e09163503439954faf0ab3792cce91caa\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\\n uint shortest = len;\\n if (otherlen < len)\\n shortest = otherlen;\\n\\n uint selfptr;\\n uint otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint idx = 0; idx < shortest; idx += 32) {\\n uint a;\\n uint b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint mask;\\n if (shortest > 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\\n }\\n int diff = int(a & mask) - int(b & mask);\\n if (diff != 0)\\n return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int(len) - int(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\\n return self.length == other.length && equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint dest, uint src, uint len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint dest;\\n uint src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\\n require(len <= 52);\\n\\n uint ret = 0;\\n uint8 decoded;\\n for(uint i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if(i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint bitlen = len * 5;\\n if(len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if(len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if(len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if(len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if(len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n}\",\"keccak256\":\"0x83315df2e54c74451577c70da2c267c3459802b08b9aeec6516302eee70f796e\"},\"contracts/dnssec-oracle/DNSSEC.sol\":{\"content\":\"pragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nabstract contract DNSSEC {\\n\\n bytes public anchors;\\n\\n struct RRSetWithSignature {\\n bytes rrset;\\n bytes sig;\\n }\\n\\n event AlgorithmUpdated(uint8 id, address addr);\\n event DigestUpdated(uint8 id, address addr);\\n event NSEC3DigestUpdated(uint8 id, address addr);\\n event RRSetUpdated(bytes name, bytes rrset);\\n\\n function submitRRSets(RRSetWithSignature[] memory input, bytes calldata proof) public virtual returns (bytes memory);\\n function submitRRSet(RRSetWithSignature calldata input, bytes calldata proof) public virtual returns (bytes memory);\\n function deleteRRSet(uint16 deleteType, bytes calldata deleteName, RRSetWithSignature calldata nsec, bytes calldata proof) public virtual;\\n function deleteRRSetNSEC3(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory closestEncloser, RRSetWithSignature memory nextClosest, bytes memory dnskey) public virtual;\\n function rrdata(uint16 dnstype, bytes calldata name) external virtual view returns (uint32, uint32, bytes20);\\n}\\n\",\"keccak256\":\"0x5b8d2391f66e878e09aa88a97fe8ea5b26604a0c0ad9247feb6124db9817f6c1\"},\"contracts/dnssec-oracle/DNSSECImpl.sol\":{\"content\":\"pragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nimport \\\"./Owned.sol\\\";\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"./RRUtils.sol\\\";\\nimport \\\"./DNSSEC.sol\\\";\\nimport \\\"./algorithms/Algorithm.sol\\\";\\nimport \\\"./digests/Digest.sol\\\";\\nimport \\\"./nsec3digests/NSEC3Digest.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/*\\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\\n *\\n * TODO: Support for NSEC3 records\\n */\\ncontract DNSSECImpl is DNSSEC, Owned {\\n using Buffer for Buffer.buffer;\\n using BytesUtils for bytes;\\n using RRUtils for *;\\n\\n uint16 constant DNSCLASS_IN = 1;\\n\\n uint16 constant DNSTYPE_NS = 2;\\n uint16 constant DNSTYPE_SOA = 6;\\n uint16 constant DNSTYPE_DNAME = 39;\\n uint16 constant DNSTYPE_DS = 43;\\n uint16 constant DNSTYPE_RRSIG = 46;\\n uint16 constant DNSTYPE_NSEC = 47;\\n uint16 constant DNSTYPE_DNSKEY = 48;\\n uint16 constant DNSTYPE_NSEC3 = 50;\\n\\n uint constant DNSKEY_FLAG_ZONEKEY = 0x100;\\n\\n uint8 constant ALGORITHM_RSASHA256 = 8;\\n\\n uint8 constant DIGEST_ALGORITHM_SHA256 = 2;\\n\\n struct RRSet {\\n uint32 inception;\\n uint32 expiration;\\n bytes20 hash;\\n }\\n\\n // (name, type) => RRSet\\n mapping (bytes32 => mapping(uint16 => RRSet)) rrsets;\\n\\n mapping (uint8 => Algorithm) public algorithms;\\n mapping (uint8 => Digest) public digests;\\n mapping (uint8 => NSEC3Digest) public nsec3Digests;\\n\\n event Test(uint t);\\n event Marker();\\n\\n /**\\n * @dev Constructor.\\n * @param _anchors The binary format RR entries for the root DS records.\\n */\\n constructor(bytes memory _anchors) {\\n // Insert the 'trust anchors' - the key hashes that start the chain\\n // of trust for all other records.\\n anchors = _anchors;\\n rrsets[keccak256(hex\\\"00\\\")][DNSTYPE_DS] = RRSet({\\n inception: uint32(0),\\n expiration: uint32(3767581600), // May 22 2089 - the latest date we can encode as of writing this\\n hash: bytes20(keccak256(anchors))\\n });\\n emit RRSetUpdated(hex\\\"00\\\", anchors);\\n }\\n\\n /**\\n * @dev Sets the contract address for a signature verification algorithm.\\n * Callable only by the owner.\\n * @param id The algorithm ID\\n * @param algo The address of the algorithm contract.\\n */\\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\\n algorithms[id] = algo;\\n emit AlgorithmUpdated(id, address(algo));\\n }\\n\\n /**\\n * @dev Sets the contract address for a digest verification algorithm.\\n * Callable only by the owner.\\n * @param id The digest ID\\n * @param digest The address of the digest contract.\\n */\\n function setDigest(uint8 id, Digest digest) public owner_only {\\n digests[id] = digest;\\n emit DigestUpdated(id, address(digest));\\n }\\n\\n /**\\n * @dev Sets the contract address for an NSEC3 digest algorithm.\\n * Callable only by the owner.\\n * @param id The digest ID\\n * @param digest The address of the digest contract.\\n */\\n function setNSEC3Digest(uint8 id, NSEC3Digest digest) public owner_only {\\n nsec3Digests[id] = digest;\\n emit NSEC3DigestUpdated(id, address(digest));\\n }\\n\\n /**\\n * @dev Submits multiple RRSets\\n * @param input A list of RRSets and signatures forming a chain of trust from an existing known-good record.\\n * @param _proof The DNSKEY or DS to validate the first signature against.\\n * @return The last RRSET submitted.\\n */\\n function submitRRSets(RRSetWithSignature[] memory input, bytes calldata _proof) public override returns (bytes memory) {\\n bytes memory proof = _proof;\\n for(uint i = 0; i < input.length; i++) {\\n proof = _submitRRSet(input[i], proof);\\n }\\n return proof;\\n }\\n\\n /**\\n * @dev Submits a signed set of RRs to the oracle.\\n *\\n * RRSETs are only accepted if they are signed with a key that is already\\n * trusted, or if they are self-signed, and the signing key is identified by\\n * a DS record that is already trusted.\\n *\\n * @param input The signed RR set. This is in the format described in section\\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\\n * data, followed by a series of canonicalised RR records that the signature\\n * applies to.\\n * @param proof The DNSKEY or DS to validate the signature against. Must Already\\n * have been submitted and proved previously.\\n */\\n function submitRRSet(RRSetWithSignature memory input, bytes memory proof)\\n public override\\n returns (bytes memory)\\n {\\n return _submitRRSet(input, proof);\\n }\\n\\n /**\\n * @dev Deletes an RR from the oracle.\\n *\\n * @param deleteType The DNS record type to delete.\\n * @param deleteName which you want to delete\\n * @param nsec The signed NSEC RRset. This is in the format described in section\\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\\n * data, followed by a series of canonicalised RR records that the signature\\n * applies to.\\n */\\n function deleteRRSet(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory nsec, bytes memory proof)\\n public override\\n {\\n RRUtils.SignedSet memory rrset;\\n rrset = validateSignedSet(nsec, proof);\\n require(rrset.typeCovered == DNSTYPE_NSEC);\\n\\n // Don't let someone use an old proof to delete a new name\\n require(RRUtils.serialNumberGte(rrset.inception, rrsets[keccak256(deleteName)][deleteType].inception));\\n\\n for (RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\\n // We're dealing with three names here:\\n // - deleteName is the name the user wants us to delete\\n // - nsecName is the owner name of the NSEC record\\n // - nextName is the next name specified in the NSEC record\\n //\\n // And three cases:\\n // - deleteName equals nsecName, in which case we can delete the\\n // record if it's not in the type bitmap.\\n // - nextName comes after nsecName, in which case we can delete\\n // the record if deleteName comes between nextName and nsecName.\\n // - nextName comes before nsecName, in which case nextName is the\\n // zone apex, and deleteName must come after nsecName.\\n checkNsecName(iter, rrset.name, deleteName, deleteType);\\n delete rrsets[keccak256(deleteName)][deleteType];\\n return;\\n }\\n // We should never reach this point\\n revert();\\n }\\n\\n function checkNsecName(RRUtils.RRIterator memory iter, bytes memory nsecName, bytes memory deleteName, uint16 deleteType) private pure {\\n uint rdataOffset = iter.rdataOffset;\\n uint nextNameLength = iter.data.nameLength(rdataOffset);\\n uint rDataLength = iter.nextOffset - iter.rdataOffset;\\n\\n // We assume that there is always typed bitmap after the next domain name\\n require(rDataLength > nextNameLength);\\n\\n int compareResult = deleteName.compareNames(nsecName);\\n if(compareResult == 0) {\\n // Name to delete is on the same label as the NSEC record\\n require(!iter.data.checkTypeBitmap(rdataOffset + nextNameLength, deleteType));\\n } else {\\n // First check if the NSEC next name comes after the NSEC name.\\n bytes memory nextName = iter.data.substring(rdataOffset,nextNameLength);\\n // deleteName must come after nsecName\\n require(compareResult > 0);\\n if(nsecName.compareNames(nextName) < 0) {\\n // deleteName must also come before nextName\\n require(deleteName.compareNames(nextName) < 0);\\n }\\n }\\n }\\n\\n /**\\n * @dev Deletes an RR from the oracle using an NSEC3 proof.\\n * Deleting a record using NSEC3 requires using up to two NSEC3 records. There are two cases:\\n * 1. The name exists, but the record type doesn't. Eg, example.com has A records but no TXT records.\\n * 2. The name does not exist, but a parent name does.\\n * In the first case, we submit one NSEC3 proof in `closestEncloser` that matches the target name\\n * but does not have the bit for `deleteType` set in its type bitmap. In the second case, we submit\\n * two proofs: closestEncloser and nextClosest, that together prove that the name does not exist.\\n * NSEC3 records are in the format described in section 5.3.2 of RFC4035: The RRDATA section\\n * from the RRSIG without the signature data, followed by a series of canonicalised RR records\\n * that the signature applies to.\\n *\\n * @param deleteType The DNS record type to delete.\\n * @param deleteName The name to delete.\\n * @param closestEncloser An NSEC3 proof matching the closest enclosing name - that is,\\n * the nearest ancestor of the target name that *does* exist.\\n * @param nextClosest An NSEC3 proof covering the next closest name. This proves that the immediate\\n * subdomain of the closestEncloser does not exist.\\n * @param dnskey An encoded DNSKEY record that has already been submitted to the oracle and can be used\\n * to verify the signatures closestEncloserSig and nextClosestSig\\n */\\n function deleteRRSetNSEC3(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory closestEncloser, RRSetWithSignature memory nextClosest, bytes memory dnskey)\\n public override\\n {\\n uint32 originalInception = rrsets[keccak256(deleteName)][deleteType].inception;\\n\\n RRUtils.SignedSet memory ce = validateSignedSet(closestEncloser, dnskey);\\n checkNSEC3Validity(ce, deleteName, originalInception);\\n\\n RRUtils.SignedSet memory nc;\\n if(nextClosest.rrset.length > 0) {\\n nc = validateSignedSet(nextClosest, dnskey);\\n checkNSEC3Validity(nc, deleteName, originalInception);\\n }\\n\\n RRUtils.NSEC3 memory ceNSEC3 = readNSEC3(ce);\\n // The flags field must be 0 or 1 (RFC5155 section 8.2).\\n require(ceNSEC3.flags & 0xfe == 0);\\n // Check that the closest encloser is from the correct zone (RFC5155 section 8.3)\\n // \\\"The DNAME type bit must not be set and the NS type bit may only be set if the SOA type bit is set.\\\"\\n require(!ceNSEC3.checkTypeBitmap(DNSTYPE_DNAME) && (!ceNSEC3.checkTypeBitmap(DNSTYPE_NS) || ceNSEC3.checkTypeBitmap(DNSTYPE_SOA)));\\n\\n // Case 1: deleteName does exist, but no records of RRTYPE deleteType do.\\n if(isMatchingNSEC3Record(deleteType, deleteName, ce.name, ceNSEC3)) {\\n delete rrsets[keccak256(deleteName)][deleteType];\\n // Case 2: deleteName does not exist.\\n } else if(isCoveringNSEC3Record(deleteName, ce.name, ceNSEC3, nc.name, readNSEC3(nc))) {\\n delete rrsets[keccak256(deleteName)][deleteType];\\n } else {\\n revert();\\n }\\n }\\n\\n function checkNSEC3Validity(RRUtils.SignedSet memory nsec, bytes memory deleteName, uint32 originalInception) private pure {\\n // The records must have been signed after the record we're trying to delete\\n require(RRUtils.serialNumberGte(nsec.inception, originalInception));\\n\\n // The record must be an NSEC3\\n require(nsec.typeCovered == DNSTYPE_NSEC3);\\n\\n // nsecName is of the form .zone.xyz. is the NSEC3 hash of the entire name the NSEC3 record matches, while\\n // zone.xyz can be any ancestor of that name. We'll check that, so someone can't use a record on foo.com\\n // as proof of the nonexistence of bar.org.\\n require(checkNSEC3OwnerName(nsec.name, deleteName));\\n }\\n\\n function isMatchingNSEC3Record(uint16 deleteType, bytes memory deleteName, bytes memory closestEncloserName, RRUtils.NSEC3 memory closestEncloser) private view returns(bool) {\\n // Check the record matches the hashed name, but the type bitmap does not include the type\\n if(checkNSEC3Name(closestEncloser, closestEncloserName, deleteName)) {\\n return !closestEncloser.checkTypeBitmap(deleteType);\\n }\\n\\n return false;\\n }\\n\\n function isCoveringNSEC3Record(bytes memory deleteName, bytes memory ceName, RRUtils.NSEC3 memory ce, bytes memory ncName, RRUtils.NSEC3 memory nc) private view returns(bool) {\\n // The flags field must be 0 or 1 (RFC5155 section 8.2).\\n require(nc.flags & 0xfe == 0);\\n\\n bytes32 ceNameHash = decodeOwnerNameHash(ceName);\\n bytes32 ncNameHash = decodeOwnerNameHash(ncName);\\n\\n uint lastOffset = 0;\\n // Iterate over suffixes of the name to delete until one matches the closest encloser\\n for(uint offset = deleteName.readUint8(0) + 1; offset < deleteName.length; offset += deleteName.readUint8(offset) + 1) {\\n if(hashName(ce, deleteName.substring(offset, deleteName.length - offset)) == ceNameHash) {\\n // Check that the next closest record encloses the name one label longer\\n bytes32 checkHash = hashName(nc, deleteName.substring(lastOffset, deleteName.length - lastOffset));\\n if(ncNameHash < nc.nextHashedOwnerName) {\\n return checkHash > ncNameHash && checkHash < nc.nextHashedOwnerName;\\n } else {\\n return checkHash > ncNameHash || checkHash < nc.nextHashedOwnerName;\\n }\\n }\\n lastOffset = offset;\\n }\\n // If we reached the root without finding a match, return false.\\n return false;\\n }\\n\\n function readNSEC3(RRUtils.SignedSet memory ss) private pure returns(RRUtils.NSEC3 memory) {\\n RRUtils.RRIterator memory iter = ss.rrs();\\n return iter.data.readNSEC3(iter.rdataOffset, iter.nextOffset - iter.rdataOffset);\\n }\\n\\n function checkNSEC3Name(RRUtils.NSEC3 memory nsec, bytes memory ownerName, bytes memory deleteName) private view returns(bool) {\\n // Compute the NSEC3 name hash of the name to delete.\\n bytes32 deleteNameHash = hashName(nsec, deleteName);\\n\\n // Decode the NSEC3 name hash from the first label of the NSEC3 owner name.\\n bytes32 nsecNameHash = decodeOwnerNameHash(ownerName);\\n\\n return deleteNameHash == nsecNameHash;\\n }\\n\\n function hashName(RRUtils.NSEC3 memory nsec, bytes memory name) private view returns(bytes32) {\\n return nsec3Digests[nsec.hashAlgorithm].hash(nsec.salt, name, nsec.iterations);\\n }\\n\\n function decodeOwnerNameHash(bytes memory name) private pure returns(bytes32) {\\n return name.base32HexDecodeWord(1, uint(name.readUint8(0)));\\n }\\n\\n function checkNSEC3OwnerName(bytes memory nsecName, bytes memory deleteName) private pure returns(bool) {\\n uint nsecNameOffset = nsecName.readUint8(0) + 1;\\n uint deleteNameOffset = 0;\\n while(deleteNameOffset < deleteName.length) {\\n if(deleteName.equals(deleteNameOffset, nsecName, nsecNameOffset)) {\\n return true;\\n }\\n deleteNameOffset += deleteName.readUint8(deleteNameOffset) + 1;\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Returns data about the RRs (if any) known to this oracle with the provided type and name.\\n * @param dnstype The DNS record type to query.\\n * @param name The name to query, in DNS label-sequence format.\\n * @return inception The unix timestamp (wrapped) at which the signature for this RRSET was created.\\n * @return expiration The unix timestamp (wrapped) at which the signature for this RRSET expires.\\n * @return hash The hash of the RRset.\\n */\\n function rrdata(uint16 dnstype, bytes calldata name) external override view returns (uint32, uint32, bytes20) {\\n RRSet storage result = rrsets[keccak256(name)][dnstype];\\n return (result.inception, result.expiration, result.hash);\\n }\\n\\n function _submitRRSet(RRSetWithSignature memory input, bytes memory proof) internal returns (bytes memory) {\\n RRUtils.SignedSet memory rrset;\\n rrset = validateSignedSet(input, proof);\\n\\n RRSet storage storedSet = rrsets[keccak256(rrset.name)][rrset.typeCovered];\\n if (storedSet.hash != bytes20(0)) {\\n // To replace an existing rrset, the signature must be at least as new\\n require(RRUtils.serialNumberGte(rrset.inception, storedSet.inception));\\n }\\n rrsets[keccak256(rrset.name)][rrset.typeCovered] = RRSet({\\n inception: rrset.inception,\\n expiration: rrset.expiration,\\n hash: bytes20(keccak256(rrset.data))\\n });\\n\\n emit RRSetUpdated(rrset.name, rrset.data);\\n\\n return rrset.data;\\n }\\n\\n /**\\n * @dev Submits a signed set of RRs to the oracle.\\n *\\n * RRSETs are only accepted if they are signed with a key that is already\\n * trusted, or if they are self-signed, and the signing key is identified by\\n * a DS record that is already trusted.\\n *\\n * @param input The signed RR set. This is in the format described in section\\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\\n * data, followed by a series of canonicalised RR records that the signature\\n * applies to.\\n * @param proof The DNSKEY or DS to validate the signature against. Must Already\\n * have been submitted and proved previously.\\n */\\n function validateSignedSet(RRSetWithSignature memory input, bytes memory proof) internal view returns(RRUtils.SignedSet memory rrset) {\\n rrset = input.rrset.readSignedSet();\\n require(validProof(rrset.signerName, proof));\\n\\n // Do some basic checks on the RRs and extract the name\\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\\n require(name.labelCount(0) == rrset.labels);\\n rrset.name = name;\\n\\n // All comparisons involving the Signature Expiration and\\n // Inception fields MUST use \\\"serial number arithmetic\\\", as\\n // defined in RFC 1982\\n\\n // o The validator's notion of the current time MUST be less than or\\n // equal to the time listed in the RRSIG RR's Expiration field.\\n require(RRUtils.serialNumberGte(rrset.expiration, uint32(block.timestamp)));\\n\\n // o The validator's notion of the current time MUST be greater than or\\n // equal to the time listed in the RRSIG RR's Inception field.\\n require(RRUtils.serialNumberGte(uint32(block.timestamp), rrset.inception));\\n\\n // Validate the signature\\n verifySignature(name, rrset, input, proof);\\n\\n return rrset;\\n }\\n\\n function validProof(bytes memory name, bytes memory proof) internal view returns(bool) {\\n uint16 dnstype = proof.readUint16(proof.nameLength(0));\\n return rrsets[keccak256(name)][dnstype].hash == bytes20(keccak256(proof));\\n }\\n\\n /**\\n * @dev Validates a set of RRs.\\n * @param rrset The RR set.\\n * @param typecovered The type covered by the RRSIG record.\\n */\\n function validateRRs(RRUtils.SignedSet memory rrset, uint16 typecovered) internal pure returns (bytes memory name) {\\n // Iterate over all the RRs\\n for (RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\\n // We only support class IN (Internet)\\n require(iter.class == DNSCLASS_IN);\\n\\n if(name.length == 0) {\\n name = iter.name();\\n } else {\\n // Name must be the same on all RRs. We do things this way to avoid copying the name\\n // repeatedly.\\n require(name.length == iter.data.nameLength(iter.offset));\\n require(name.equals(0, iter.data, iter.offset, name.length));\\n }\\n\\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\\n require(iter.dnstype == typecovered);\\n }\\n }\\n\\n /**\\n * @dev Performs signature verification.\\n *\\n * Throws or reverts if unable to verify the record.\\n *\\n * @param name The name of the RRSIG record, in DNS label-sequence format.\\n * @param data The original data to verify.\\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\\n */\\n function verifySignature(bytes memory name, RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, bytes memory proof) internal view {\\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\\n // that contains the RRset.\\n require(rrset.signerName.length <= name.length);\\n require(rrset.signerName.equals(0, name, name.length - rrset.signerName.length));\\n\\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\\n // Check the proof\\n if (proofRR.dnstype == DNSTYPE_DS) {\\n require(verifyWithDS(rrset, data, proofRR));\\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\\n require(verifyWithKnownKey(rrset, data, proofRR));\\n } else {\\n revert(\\\"No valid proof found\\\");\\n }\\n }\\n\\n /**\\n * @dev Attempts to verify a signed RRSET against an already known public key.\\n * @param rrset The signed set to verify.\\n * @param data The original data the signed set was read from.\\n * @param proof The serialized DS or DNSKEY record to use as proof.\\n * @return True if the RRSET could be verified, false otherwise.\\n */\\n function verifyWithKnownKey(RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, RRUtils.RRIterator memory proof) internal view returns(bool) {\\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\\n require(proof.name().equals(rrset.signerName));\\n for(; !proof.done(); proof.next()) {\\n require(proof.name().equals(rrset.signerName));\\n bytes memory keyrdata = proof.rdata();\\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(0, keyrdata.length);\\n if(verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\\n return true;\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Attempts to verify some data using a provided key and a signature.\\n * @param dnskey The dns key record to verify the signature with.\\n * @param rrset The signed RRSET being verified.\\n * @param data The original data `rrset` was decoded from.\\n * @return True iff the key verifies the signature.\\n */\\n function verifySignatureWithKey(RRUtils.DNSKEY memory dnskey, bytes memory keyrdata, RRUtils.SignedSet memory rrset, RRSetWithSignature memory data)\\n internal\\n view\\n returns (bool)\\n {\\n // TODO: Check key isn't expired, unless updating key itself\\n\\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\\n if(dnskey.protocol != 3) {\\n return false;\\n }\\n\\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\\n // the zone's apex DNSKEY RRset.\\n if(dnskey.algorithm != rrset.algorithm) {\\n return false;\\n }\\n uint16 computedkeytag = keyrdata.computeKeytag();\\n if (computedkeytag != rrset.keytag) {\\n return false;\\n }\\n\\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\\n // set.\\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\\n return false;\\n }\\n\\n return algorithms[dnskey.algorithm].verify(keyrdata, data.rrset, data.sig);\\n }\\n\\n /**\\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\\n * that the record \\n * @param rrset The signed set to verify.\\n * @param data The original data the signed set was read from.\\n * @param proof The serialized DS or DNSKEY record to use as proof.\\n * @return True if the RRSET could be verified, false otherwise.\\n */\\n function verifyWithDS(RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, RRUtils.RRIterator memory proof) internal view returns(bool) {\\n for(RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\\n require(iter.dnstype == DNSTYPE_DNSKEY);\\n bytes memory keyrdata = iter.rdata();\\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(0, keyrdata.length);\\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\\n // It's self-signed - look for a DS record to verify it.\\n return verifyKeyWithDS(iter.name(), proof, dnskey, keyrdata);\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Attempts to verify a key using DS records.\\n * @param keyname The DNS name of the key, in DNS label-sequence format.\\n * @param dsrrs The DS records to use in verification.\\n * @param dnskey The dnskey to verify.\\n * @param keyrdata The RDATA section of the key.\\n * @return True if a DS record verifies this key.\\n */\\n function verifyKeyWithDS(bytes memory keyname, RRUtils.RRIterator memory dsrrs, RRUtils.DNSKEY memory dnskey, bytes memory keyrdata)\\n internal view returns (bool)\\n {\\n uint16 keytag = keyrdata.computeKeytag();\\n for (; !dsrrs.done(); dsrrs.next()) {\\n RRUtils.DS memory ds = dsrrs.data.readDS(dsrrs.rdataOffset, dsrrs.nextOffset - dsrrs.rdataOffset);\\n if(ds.keytag != keytag) {\\n continue;\\n }\\n if (ds.algorithm != dnskey.algorithm) {\\n continue;\\n }\\n\\n Buffer.buffer memory buf;\\n buf.init(keyname.length + keyrdata.length);\\n buf.append(keyname);\\n buf.append(keyrdata);\\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\\n return true;\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Attempts to verify a DS record's hash value against some data.\\n * @param digesttype The digest ID from the DS record.\\n * @param data The data to digest.\\n * @param digest The digest data to check against.\\n * @return True iff the digest matches.\\n */\\n function verifyDSHash(uint8 digesttype, bytes memory data, bytes memory digest) internal view returns (bool) {\\n if (address(digests[digesttype]) == address(0)) {\\n return false;\\n }\\n return digests[digesttype].verify(data, digest);\\n }\\n}\\n\",\"keccak256\":\"0x347fdc38971b863831f00f0e5a8e791ace9dda1196da57fbf726a125c9d99a04\"},\"contracts/dnssec-oracle/Owned.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev Contract mixin for 'owned' contracts.\\n*/\\ncontract Owned {\\n address public owner;\\n \\n modifier owner_only() {\\n require(msg.sender == owner);\\n _;\\n }\\n\\n constructor() public {\\n owner = msg.sender;\\n }\\n\\n function setOwner(address newOwner) public owner_only {\\n owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x14ca1cbae3a361b9d868147498af8bdea7e7d5b0829e207fb7719f607cce5ab3\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n* @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n*/\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(bytes memory self, uint offset) internal pure returns(uint) {\\n uint idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(bytes memory self, uint offset) internal pure returns(bytes memory ret) {\\n uint len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(bytes memory self, uint offset) internal pure returns(uint) {\\n uint count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint constant RRSIG_TYPE = 0;\\n uint constant RRSIG_ALGORITHM = 2;\\n uint constant RRSIG_LABELS = 3;\\n uint constant RRSIG_TTL = 4;\\n uint constant RRSIG_EXPIRATION = 8;\\n uint constant RRSIG_INCEPTION = 12;\\n uint constant RRSIG_KEY_TAG = 16;\\n uint constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(bytes memory data) internal pure returns(SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(RRSIG_SIGNER_NAME + self.signerName.length, data.length - RRSIG_SIGNER_NAME - self.signerName.length);\\n }\\n\\n function rrs(SignedSet memory rrset) internal pure returns(RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint rdataOffset;\\n uint nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(bytes memory self, uint offset) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns(bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns(bytes memory) {\\n return iter.data.substring(iter.offset, nameLength(iter.data, iter.offset));\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(RRIterator memory iter) internal pure returns(bytes memory) {\\n return iter.data.substring(iter.rdataOffset, iter.nextOffset - iter.rdataOffset);\\n }\\n\\n uint constant DNSKEY_FLAGS = 0;\\n uint constant DNSKEY_PROTOCOL = 2;\\n uint constant DNSKEY_ALGORITHM = 3;\\n uint constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(bytes memory data, uint offset, uint length) internal pure returns(DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(offset + DNSKEY_PUBKEY, length - DNSKEY_PUBKEY);\\n } \\n\\n uint constant DS_KEY_TAG = 0;\\n uint constant DS_ALGORITHM = 2;\\n uint constant DS_DIGEST_TYPE = 3;\\n uint constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(bytes memory data, uint offset, uint length) internal pure returns(DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n struct NSEC3 {\\n uint8 hashAlgorithm;\\n uint8 flags;\\n uint16 iterations;\\n bytes salt;\\n bytes32 nextHashedOwnerName;\\n bytes typeBitmap;\\n }\\n\\n uint constant NSEC3_HASH_ALGORITHM = 0;\\n uint constant NSEC3_FLAGS = 1;\\n uint constant NSEC3_ITERATIONS = 2;\\n uint constant NSEC3_SALT_LENGTH = 4;\\n uint constant NSEC3_SALT = 5;\\n\\n function readNSEC3(bytes memory data, uint offset, uint length) internal pure returns(NSEC3 memory self) {\\n uint end = offset + length;\\n self.hashAlgorithm = data.readUint8(offset + NSEC3_HASH_ALGORITHM);\\n self.flags = data.readUint8(offset + NSEC3_FLAGS);\\n self.iterations = data.readUint16(offset + NSEC3_ITERATIONS);\\n uint8 saltLength = data.readUint8(offset + NSEC3_SALT_LENGTH);\\n offset = offset + NSEC3_SALT;\\n self.salt = data.substring(offset, saltLength);\\n offset += saltLength;\\n uint8 nextLength = data.readUint8(offset);\\n require(nextLength <= 32);\\n offset += 1;\\n self.nextHashedOwnerName = data.readBytesN(offset, nextLength);\\n offset += nextLength;\\n self.typeBitmap = data.substring(offset, end - offset);\\n }\\n\\n function checkTypeBitmap(NSEC3 memory self, uint16 rrtype) internal pure returns(bool) {\\n return checkTypeBitmap(self.typeBitmap, 0, rrtype);\\n }\\n\\n /**\\n * @dev Checks if a given RR type exists in a type bitmap.\\n * @param bitmap The byte string to read the type bitmap from.\\n * @param offset The offset to start reading at.\\n * @param rrtype The RR type to check for.\\n * @return True if the type is found in the bitmap, false otherwise.\\n */\\n function checkTypeBitmap(bytes memory bitmap, uint offset, uint16 rrtype) internal pure returns (bool) {\\n uint8 typeWindow = uint8(rrtype >> 8);\\n uint8 windowByte = uint8((rrtype & 0xff) / 8);\\n uint8 windowBitmask = uint8(uint8(1) << (uint8(7) - uint8(rrtype & 0x7)));\\n for (uint off = offset; off < bitmap.length;) {\\n uint8 window = bitmap.readUint8(off);\\n uint8 len = bitmap.readUint8(off + 1);\\n if (typeWindow < window) {\\n // We've gone past our window; it's not here.\\n return false;\\n } else if (typeWindow == window) {\\n // Check this type bitmap\\n if (len <= windowByte) {\\n // Our type is past the end of the bitmap\\n return false;\\n }\\n return (bitmap.readUint8(off + windowByte + 2) & windowBitmask) != 0;\\n } else {\\n // Skip this type bitmap\\n off += len + 2;\\n }\\n }\\n\\n return false;\\n }\\n\\n function compareNames(bytes memory self, bytes memory other) internal pure returns (int) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint off;\\n uint otheroff;\\n uint prevoff;\\n uint otherprevoff;\\n uint counts = labelCount(self, 0);\\n uint othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if(otheroff == 0) {\\n return 1;\\n }\\n\\n return self.compare(prevoff + 1, self.readUint8(prevoff), other, otherprevoff + 1, other.readUint8(otherprevoff));\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(uint32 i1, uint32 i2) internal pure returns(bool) {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n\\n function progress(bytes memory body, uint off) internal pure returns(uint) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint ac1;\\n uint ac2;\\n for(uint i = 0; i < data.length + 31; i += 32) {\\n uint word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if(i + 32 > data.length) {\\n uint unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 += (word & 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >> 8;\\n ac2 += (word & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 = (ac1 & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF)\\n + ((ac1 & 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >> 16);\\n ac2 = (ac2 & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF)\\n + ((ac2 & 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >> 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 = (ac1 & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF)\\n + ((ac1 & 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >> 32);\\n ac1 = (ac1 & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF)\\n + ((ac1 & 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >> 64);\\n ac1 = (ac1 & 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\\n + (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\",\"keccak256\":\"0x811642c86c539d645ef99a15fa1bf0eb4ce963cf1a618ef2a6f34d27a5e34030\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n*/\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external virtual view returns (bool);\\n}\\n\",\"keccak256\":\"0x51d6251568844e435f58952354abe8c8c8e978ab40ecb0bbb2f5bd767838b3a7\"},\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev An interface for contracts implementing a DNSSEC digest.\\n*/\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(bytes calldata data, bytes calldata hash) external virtual pure returns (bool);\\n}\\n\",\"keccak256\":\"0x259720cef78c019d38b908bc7dd524f087c58d8c40792cebcdd4e982c628bc9a\"},\"contracts/dnssec-oracle/nsec3digests/NSEC3Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev Interface for contracts that implement NSEC3 digest algorithms.\\n */\\ninterface NSEC3Digest {\\n /**\\n * @dev Performs an NSEC3 iterated hash.\\n * @param salt The salt value to use on each iteration.\\n * @param data The data to hash.\\n * @param iterations The number of iterations to perform.\\n * @return The result of the iterated hash operation.\\n */\\n function hash(bytes calldata salt, bytes calldata data, uint iterations) external virtual pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0xb3b61aee6bb472158b7ace6b5644dcb668271296b98a6dcde24dc72e3cdf4950\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b5060405162004ecb38038062004ecb833981810160405281019062000037919062000319565b33600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806000908051906020019062000090929190620001f7565b506040518060600160405280600063ffffffff16815260200163e090bba063ffffffff1681526020016000604051620000ca91906200049c565b60405180910390206bffffffffffffffffffffffff1916815250600260007fbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a81526020019081526020016000206000602b61ffff1661ffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548163ffffffff021916908363ffffffff16021790555060408201518160000160086101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908360601c02179055509050507f55ced933cdd5a34dd03eb5d4bef19ec6ebb251dcd7a988eee0c1b9a13baaa88b6000604051620001e89190620004b5565b60405180910390a15062000698565b8280546200020590620005b4565b90600052602060002090601f01602090048101928262000229576000855562000275565b82601f106200024457805160ff191683800117855562000275565b8280016001018555821562000275579182015b828111156200027457825182559160200191906001019062000257565b5b50905062000284919062000288565b5090565b5b80821115620002a357600081600090555060010162000289565b5090565b6000620002be620002b88462000517565b620004ee565b905082815260208101848484011115620002d757600080fd5b620002e48482856200057e565b509392505050565b600082601f830112620002fe57600080fd5b815162000310848260208601620002a7565b91505092915050565b6000602082840312156200032c57600080fd5b600082015167ffffffffffffffff8111156200034757600080fd5b6200035584828501620002ec565b91505092915050565b600081546200036d81620005b4565b62000379818662000562565b94506001821660008114620003975760018114620003aa57620003e1565b60ff1983168652602086019350620003e1565b620003b5856200054d565b60005b83811015620003d957815481890152600182019150602081019050620003b8565b808801955050505b50505092915050565b60008154620003f981620005b4565b62000405818662000573565b9450600182166000811462000423576001811462000435576200046c565b60ff198316865281860193506200046c565b62000440856200054d565b60005b83811015620004645781548189015260018201915060208101905062000443565b838801955050505b50505092915050565b60006200048460018362000562565b915062000491826200068f565b602082019050919050565b6000620004aa8284620003ea565b915081905092915050565b60006040820190508181036000830152620004d08162000475565b90508181036020830152620004e681846200035e565b905092915050565b6000620004fa6200050d565b9050620005088282620005ea565b919050565b6000604051905090565b600067ffffffffffffffff8211156200053557620005346200064f565b5b62000540826200067e565b9050602081019050919050565b60008190508160005260206000209050919050565b600082825260208201905092915050565b600081905092915050565b60005b838110156200059e57808201518184015260208101905062000581565b83811115620005ae576000848401525b50505050565b60006002820490506001821680620005cd57607f821691505b60208210811415620005e457620005e362000620565b5b50919050565b620005f5826200067e565b810181811067ffffffffffffffff821117156200061757620006166200064f565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60008082015250565b61482380620006a86000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c806373cc48a61161008c57806398d35f201161006657806398d35f2014610247578063bd7ed31a14610265578063c327deef14610295578063d7b82ebe146102c5576100ea565b806373cc48a6146101dd5780638438dc041461020d5780638da5cb5b14610229576100ea565b806313af4035116100c857806313af40351461015957806328e7677d146101755780632c095cbb14610191578063435cc162146101ad576100ea565b8063020ed8d3146100ef578063087991bc1461010b5780630b1a24951461013d575b600080fd5b61010960048036038101906101049190613a6f565b6102f5565b005b6101256004803603810190610120919061386c565b6103e4565b60405161013493929190613dee565b60405180910390f35b6101576004803603810190610152919061396f565b61047b565b005b610173600480360381019061016e9190613715565b6106f2565b005b61018f600480360381019061018a9190613aab565b610790565b005b6101ab60048036038101906101a691906138c4565b61087f565b005b6101c760048036038101906101c2919061373e565b6109d2565b6040516101d49190613c73565b60405180910390f35b6101f760048036038101906101f29190613a46565b610a94565b6040516102049190613d78565b60405180910390f35b61022760048036038101906102229190613ae7565b610ac7565b005b610231610bb6565b60405161023e9190613c58565b60405180910390f35b61024f610bdc565b60405161025c9190613c73565b60405180910390f35b61027f600480360381019061027a9190613a46565b610c6a565b60405161028c9190613d93565b60405180910390f35b6102af60048036038101906102aa9190613a46565b610c9d565b6040516102bc9190613d5d565b60405180910390f35b6102df60048036038101906102da9190613800565b610cd0565b6040516102ec9190613c73565b60405180910390f35b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461034f57600080fd5b80600360008460ff1660ff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507ff73c3c226af96b7f1ba666a21b3ceaf2be3ee6a365e3178fd9cd1eaae0075aa882826040516103d8929190613e25565b60405180910390a15050565b6000806000806002600087876040516103fe929190613c3f565b6040518091039020815260200190815260200160002060008861ffff1661ffff16815260200190815260200160002090508060000160009054906101000a900463ffffffff168160000160049054906101000a900463ffffffff168260000160089054906101000a900460601b9350935093505093509350939050565b6000600260008680519060200120815260200190815260200160002060008761ffff1661ffff16815260200190815260200160002060000160009054906101000a900463ffffffff16905060006104d28584610ce4565b90506104df818784610d95565b6104e7613310565b6000856000015151111561050d576104ff8585610ce4565b905061050c818885610d95565b5b600061051883610de2565b9050600060fe82602001511660ff161461053157600080fd5b610545602782610e2f90919063ffffffff16565b15801561057e5750610561600282610e2f90919063ffffffff16565b158061057d575061057c600682610e2f90919063ffffffff16565b5b5b61058757600080fd5b610598898985610120015184610e49565b1561062d57600260008980519060200120815260200190815260200160002060008a61ffff1661ffff168152602001908152602001600020600080820160006101000a81549063ffffffff02191690556000820160046101000a81549063ffffffff02191690556000820160086101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550506106e7565b61064c888461012001518385610120015161064787610de2565b610e83565b156106e157600260008980519060200120815260200190815260200160002060008a61ffff1661ffff168152602001908152602001600020600080820160006101000a81549063ffffffff02191690556000820160046101000a81549063ffffffff02191690556000820160086101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550506106e6565b600080fd5b5b505050505050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461074c57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107ea57600080fd5b80600460008460ff1660ff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f2fcc274c3b72dd483ab201bfa87295e3817e8b9b10693219873b722ca1af00c78282604051610873929190613e25565b60405180910390a15050565b610887613310565b6108918383610ce4565b9050602f61ffff16816000015161ffff16146108ac57600080fd5b6109008160a00151600260008780519060200120815260200190815260200160002060008861ffff1661ffff16815260200190815260200160002060000160009054906101000a900463ffffffff16610fd6565b61090957600080fd5b600061091482610ff2565b905061091f81611011565b6109c657610934818361012001518789611027565b600260008680519060200120815260200190815260200160002060008761ffff1661ffff168152602001908152602001600020600080820160006101000a81549063ffffffff02191690556000820160046101000a81549063ffffffff02191690556000820160086101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055505050506109cc565b50600080fd5b50505050565b6060600083838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060005b8551811015610a8857610a73868281518110610a65577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101518361127d565b91508080610a8090614548565b915050610a20565b50809150509392505050565b60046020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b2157600080fd5b80600560008460ff1660ff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fc7eec866a7a1386188cc3ca20ffea75b71bd3e90a60b6791b1d3f0971145118d8282604051610baa929190613e25565b60405180910390a15050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054610be9906144e5565b80601f0160208091040260200160405190810160405280929190818152602001828054610c15906144e5565b8015610c625780601f10610c3757610100808354040283529160200191610c62565b820191906000526020600020905b815481529060010190602001808311610c4557829003601f168201915b505050505081565b60056020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60036020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060610cdc838361127d565b905092915050565b610cec613310565b610cf98360000151611497565b9050610d098160e001518361161c565b610d1257600080fd5b6000610d228283600001516116bb565b9050816040015160ff16610d4060008361178c90919063ffffffff16565b14610d4a57600080fd5b80826101200181905250610d62826080015142610fd6565b610d6b57600080fd5b610d79428360a00151610fd6565b610d8257600080fd5b610d8e81838686611834565b5092915050565b610da38360a0015182610fd6565b610dac57600080fd5b603261ffff16836000015161ffff1614610dc557600080fd5b610dd483610120015183611934565b610ddd57600080fd5b505050565b610dea613383565b6000610df583610ff2565b9050610e278160a001518260a001518360c00151610e13919061429d565b83600001516119d09092919063ffffffff16565b915050919050565b6000610e418360a00151600084611b78565b905092915050565b6000610e56828486611cbf565b15610e7657610e6e8583610e2f90919063ffffffff16565b159050610e7b565b600090505b949350505050565b60008060fe83602001511660ff1614610e9b57600080fd5b6000610ea686611ce9565b90506000610eb385611ce9565b90506000806001610ece60008c611d1e90919063ffffffff16565b610ed89190613f5e565b60ff1690505b8951811015610fc45783610f1289610f0d84858f51610efd919061429d565b8f611d6f9092919063ffffffff16565b611e2a565b1415610f8d576000610f4487610f3f85868f51610f2f919061429d565b8f611d6f9092919063ffffffff16565b611e2a565b90508660800151841015610f70578381118015610f645750866080015181105b95505050505050610fcd565b83811180610f815750866080015181105b95505050505050610fcd565b8091506001610fa5828c611d1e90919063ffffffff16565b610faf9190613f5e565b60ff1681610fbd9190613f08565b9050610ede565b50600093505050505b95945050505050565b6000808284610fe59190614225565b60030b1215905092915050565b610ffa6133c6565b61100a8261010001516000611f06565b9050919050565b6000816000015151826020015110159050919050565b60008460a0015190506000611049828760000151611f3090919063ffffffff16565b905060008660a001518760c00151611061919061429d565b905081811161106f57600080fd5b60006110848787611fd390919063ffffffff16565b905060008114156110c2576110b3838561109e9190613f08565b868a60000151611b789092919063ffffffff16565b156110bd57600080fd5b611129565b60006110dd85858b60000151611d6f9092919063ffffffff16565b9050600082136110ec57600080fd5b6000611101828a611fd390919063ffffffff16565b121561112757600061111c8289611fd390919063ffffffff16565b1261112657600080fd5b5b505b5050505050505050565b8060c001518160200181815250508060000151518160200151106111565761127a565b600061116a82600001518360200151611f30565b82602001516111799190613f08565b905061119281836000015161218790919063ffffffff16565b826040019061ffff16908161ffff16815250506002816111b29190613f08565b90506111cb81836000015161218790919063ffffffff16565b826060019061ffff16908161ffff16815250506002816111eb9190613f08565b90506112048183600001516121b690919063ffffffff16565b826080019063ffffffff16908163ffffffff16815250506004816112289190613f08565b9050600061124382846000015161218790919063ffffffff16565b61ffff1690506002826112569190613f08565b9150818360a0018181525050808261126e9190613f08565b8360c001818152505050505b50565b6060611287613310565b6112918484610ce4565b90506000600260008361012001518051906020012081526020019081526020016000206000836000015161ffff1661ffff1681526020019081526020016000209050600060601b6bffffffffffffffffffffffff19168160000160089054906101000a900460601b6bffffffffffffffffffffffff1916146113395761132f8260a001518260000160009054906101000a900463ffffffff16610fd6565b61133857600080fd5b5b60405180606001604052808360a0015163ffffffff168152602001836080015163ffffffff168152602001836101000151805190602001206bffffffffffffffffffffffff1916815250600260008461012001518051906020012081526020019081526020016000206000846000015161ffff1661ffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548163ffffffff021916908363ffffffff16021790555060408201518160000160086101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908360601c02179055509050507f55ced933cdd5a34dd03eb5d4bef19ec6ebb251dcd7a988eee0c1b9a13baaa88b82610120015183610100015160405161147f929190613c95565b60405180910390a18161010001519250505092915050565b61149f613310565b6114b360008361218790919063ffffffff16565b816000019061ffff16908161ffff16815250506114da600283611d1e90919063ffffffff16565b816020019060ff16908160ff16815250506114ff600383611d1e90919063ffffffff16565b816040019060ff16908160ff16815250506115246004836121b690919063ffffffff16565b816060019063ffffffff16908163ffffffff168152505061154f6008836121b690919063ffffffff16565b816080019063ffffffff16908163ffffffff168152505061157a600c836121b690919063ffffffff16565b8160a0019063ffffffff16908163ffffffff16815250506115a560108361218790919063ffffffff16565b8160c0019061ffff16908161ffff16815250506115c38260126121e7565b8160e0018190525061160e8160e001515160126115e09190613f08565b8260e0015151601285516115f4919061429d565b6115fe919061429d565b84611d6f9092919063ffffffff16565b816101000181905250919050565b600080611645611636600085611f3090919063ffffffff16565b8461218790919063ffffffff16565b905082805190602001206bffffffffffffffffffffffff1916600260008680519060200120815260200190815260200160002060008361ffff1661ffff16815260200190815260200160002060000160089054906101000a900460601b6bffffffffffffffffffffffff19161491505092915050565b606060006116c884610ff2565b90505b6116d481611011565b61178557600161ffff16816060015161ffff16146116f157600080fd5b60008251141561170b5761170481612215565b915061175f565b61172681602001518260000151611f3090919063ffffffff16565b82511461173257600080fd5b61175560008260000151836020015185518661224c90949392919063ffffffff16565b61175e57600080fd5b5b8261ffff16816040015161ffff161461177757600080fd5b61178081611133565b6116cb565b5092915050565b600080600090505b60011561182a57835183106117d2577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b60006117e78486611d1e90919063ffffffff16565b60ff1690506001816117f99190613f08565b846118049190613f08565b93506000811415611815575061182a565b6001826118229190613f08565b915050611794565b8091505092915050565b83518360e0015151111561184757600080fd5b6118746000858560e0015151875161185f919061429d565b8660e00151612270909392919063ffffffff16565b61187d57600080fd5b6000611893600083611f0690919063ffffffff16565b9050602b61ffff16816040015161ffff1614156118c3576118b58484836122ab565b6118be57600080fd5b61192d565b603061ffff16816040015161ffff1614156118f1576118e3848483612354565b6118ec57600080fd5b61192c565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192390613dce565b60405180910390fd5b5b5050505050565b600080600161194d600086611d1e90919063ffffffff16565b6119579190613f5e565b60ff16905060005b83518110156119c35761197f81868487612270909392919063ffffffff16565b1561198f576001925050506119ca565b60016119a48286611d1e90919063ffffffff16565b6119ae9190613f5e565b60ff16816119bc9190613f08565b905061195f565b6000925050505b92915050565b6119d8613383565b600082846119e69190613f08565b9050611a076000856119f89190613f08565b86611d1e90919063ffffffff16565b826000019060ff16908160ff1681525050611a37600185611a289190613f08565b86611d1e90919063ffffffff16565b826020019060ff16908160ff1681525050611a67600285611a589190613f08565b8661218790919063ffffffff16565b826040019061ffff16908161ffff16815250506000611a9b600486611a8c9190613f08565b87611d1e90919063ffffffff16565b9050600585611aaa9190613f08565b9450611ac4858260ff1688611d6f9092919063ffffffff16565b83606001819052508060ff1685611adb9190613f08565b94506000611af28688611d1e90919063ffffffff16565b905060208160ff161115611b0557600080fd5b600186611b129190613f08565b9550611b2c868260ff16896124149092919063ffffffff16565b8460800181815250508060ff1686611b449190613f08565b9550611b66868785611b56919061429d565b89611d6f9092919063ffffffff16565b8460a001819052505050509392505050565b60008060088361ffff16901c90506000600860ff8516611b989190613f95565b90506000600785166007611bac91906142d1565b60ff16600160ff16901b905060008690505b8751811015611caf576000611bdc828a611d1e90919063ffffffff16565b90506000611bff600184611bf09190613f08565b8b611d1e90919063ffffffff16565b90508160ff168660ff161015611c1e5760009650505050505050611cb8565b8160ff168660ff161415611c8b578460ff168160ff1611611c485760009650505050505050611cb8565b600084611c7860028860ff1687611c5f9190613f08565b611c699190613f08565b8d611d1e90919063ffffffff16565b1660ff1614159650505050505050611cb8565b600281611c989190613f5e565b60ff1683611ca69190613f08565b92505050611bbe565b50600093505050505b9392505050565b600080611ccc8584611e2a565b90506000611cd985611ce9565b9050808214925050509392505050565b6000611d176001611d04600085611d1e90919063ffffffff16565b60ff168461245c9092919063ffffffff16565b9050919050565b6000828281518110611d59577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b60f81c905092915050565b606083518284611d7f9190613f08565b1115611d8a57600080fd5b60008267ffffffffffffffff811115611dcc577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611dfe5781602001600182028036833780820191505090505b5090506000806020830191508560208801019050611e1d828287612744565b8293505050509392505050565b600060056000846000015160ff1660ff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166368f9dab284606001518486604001516040518463ffffffff1660e01b8152600401611eae93929190613d18565b60206040518083038186803b158015611ec657600080fd5b505afa158015611eda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611efe91906137d7565b905092915050565b611f0e6133c6565b828160000181905250818160c0018181525050611f2a81611133565b92915050565b6000808290505b600115611fbe5783518110611f75577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000611f8a8286611d1e90919063ffffffff16565b60ff169050600181611f9c9190613f08565b82611fa79190613f08565b91506000811415611fb85750611fbe565b50611f37565b8281611fca919061429d565b91505092915050565b6000611fe882846127a890919063ffffffff16565b15611ff65760009050612181565b600080600080600061200988600061178c565b9050600061201888600061178c565b90505b808211156120455785935061203089876127cf565b9550818061203d906144bb565b92505061201b565b5b818111156120705784925061205b88866127cf565b94508080612068906144bb565b915050612046565b5b60008211801561209557506120938689878c612270909392919063ffffffff16565b155b156120cc578593506120a789876127cf565b95508492506120b688866127cf565b94506001826120c5919061429d565b9150612071565b6000861415612103577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9650505050505050612181565b600085141561211b5760019650505050505050612181565b61217860018561212b9190613f08565b61213e868c611d1e90919063ffffffff16565b60ff168a60018761214f9190613f08565b612162888e611d1e90919063ffffffff16565b60ff168e6128069095949392919063ffffffff16565b96505050505050505b92915050565b600082516002836121989190613f08565b11156121a357600080fd5b61ffff8260028501015116905092915050565b600082516004836121c79190613f08565b11156121d257600080fd5b63ffffffff8260048501015116905092915050565b606060006121f58484611f30565b905061220c838286611d6f9092919063ffffffff16565b91505092915050565b6060612245826020015161223184600001518560200151611f30565b8460000151611d6f9092919063ffffffff16565b9050919050565b600061225984848461293b565b61226487878561293b565b14905095945050505050565b60006122898383848651612284919061429d565b61293b565b6122a0868687895161229b919061429d565b61293b565b149050949350505050565b6000806122b785610ff2565b90505b6122c381611011565b61234757603061ffff16816040015161ffff16146122e057600080fd5b60006122eb82612967565b9050600061230660008351846129a09092919063ffffffff16565b905061231481838989612a76565b156123375761232d61232584612215565b868385612bd5565b935050505061234d565b505061234281611133565b6122ba565b50600090505b9392505050565b60006123758460e0015161236784612215565b6127a890919063ffffffff16565b61237e57600080fd5b5b61238882611011565b612408576123ab8460e0015161239d84612215565b6127a890919063ffffffff16565b6123b457600080fd5b60006123bf83612967565b905060006123da60008351846129a09092919063ffffffff16565b90506123e881838888612a76565b156123f85760019250505061240d565b505061240382611133565b61237f565b600090505b9392505050565b6000602082111561242457600080fd5b835182846124329190613f08565b111561243d57600080fd5b6001826020036101000a03198084602087010151169150509392505050565b6000603482111561246c57600080fd5b60008080600090505b848110156125f357600087828861248c9190613f08565b815181106124c3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b9050603060f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161015801561252c5750607a60f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191611155b61253557600080fd5b6040518060800160405280604781526020016147a76047913960308260f81c60ff16612561919061429d565b81518110612598577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b60f81c925060208360ff1611156125b957600080fd5b6001866125c6919061429d565b8214156125d357506125f3565b8260ff16600585901b1793505080806125eb90614548565b915050612475565b5060006005856126039190614137565b905060006008866126149190614591565b141561262b578160ff16600584901b179250612724565b600260088661263a9190614591565b14156126675760028260ff16901c60ff16600384901b179250600281612660919061429d565b9050612723565b60046008866126769190614591565b14156126a35760048260ff16901c60ff16600184901b17925060048161269c919061429d565b9050612722565b60056008866126b29190614591565b14156126df5760018260ff16901c60ff16600484901b1792506001816126d8919061429d565b9050612721565b60076008866126ee9190614591565b141561271b5760038260ff16901c60ff16600284901b179250600381612714919061429d565b9050612720565b600080fd5b5b5b5b5b80610100612732919061429d565b83901b60001b93505050509392505050565b5b60208110612783578151835260208361275e9190613f08565b925060208261276d9190613f08565b915060208161277c919061429d565b9050612745565b60006001826020036101000a0390508019835116818551168181178652505050505050565b6000815183511480156127c757506127c6836000846000875161224c565b5b905092915050565b60006127e48284611d1e90919063ffffffff16565b60ff166001836127f49190613f08565b6127fe9190613f08565b905092915050565b60008085905085831015612818578290505b600080602089018a019150602086018701905060005b8381101561291e5760008084519150835190508082146128ea576000602087111561287b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90506128bb565b60018488602061288b919061429d565b6128959190613f08565b60086128a19190614137565b60026128ad9190614019565b6128b7919061429d565b1990505b60008183168285166128cd9190614191565b9050600081146128e7578098505050505050505050612931565b50505b6020856128f79190613f08565b94506020846129069190613f08565b935050506020816129179190613f08565b905061282e565b50848861292b9190614191565b93505050505b9695505050505050565b60008351828461294b9190613f08565b111561295657600080fd5b818360208601012090509392505050565b60606129998260a001518360a001518460c00151612985919061429d565b8460000151611d6f9092919063ffffffff16565b9050919050565b6129a8613411565b6129c76000846129b89190613f08565b8561218790919063ffffffff16565b816000019061ffff16908161ffff16815250506129f96002846129ea9190613f08565b85611d1e90919063ffffffff16565b816020019060ff16908160ff1681525050612a29600384612a1a9190613f08565b85611d1e90919063ffffffff16565b816040019060ff16908160ff1681525050612a67600484612a4a9190613f08565b600484612a57919061429d565b86611d6f9092919063ffffffff16565b81606001819052509392505050565b60006003856020015160ff1614612a905760009050612bcd565b826020015160ff16856040015160ff1614612aae5760009050612bcd565b6000612ab985612cf1565b90508360c0015161ffff168161ffff1614612ad8576000915050612bcd565b6000610100876000015161ffff16161415612af7576000915050612bcd565b60036000876040015160ff1660ff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663de8f50a186856000015186602001516040518463ffffffff1660e01b8152600401612b7993929190613ccc565b60206040518083038186803b158015612b9157600080fd5b505afa158015612ba5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bc991906137ae565b9150505b949350505050565b600080612be183612cf1565b90505b612bed85611011565b612ce3576000612c238660a001518760a001518860c00151612c0f919061429d565b8860000151612f399092919063ffffffff16565b90508161ffff16816000015161ffff1614612c3e5750612cd5565b846040015160ff16816020015160ff1614612c595750612cd5565b612c61613443565b612c8185518951612c729190613f08565b8261300f90919063ffffffff16565b50612c95888261307990919063ffffffff16565b50612ca9858261307990919063ffffffff16565b50612cc182604001518260000151846060015161309b565b15612cd25760019350505050612ce9565b50505b612cde85611133565b612be4565b60009150505b949350505050565b600061200082511115612d39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d3090613dae565b60405180910390fd5b60008060005b601f855101811015612dd95760008160208701015190508551602083011115612d7c57600060088388510302610100039050808183901c901b9150505b60087fff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff008216901c840193507eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff81168301925050602081019050612d3f565b5060107fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff00008316901c7dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff831601915060107fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff00008216901c7dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff821601905080600883901b01915060207fffffffff00000000ffffffff00000000ffffffff00000000ffffffff000000008316901c7bffffffff00000000ffffffff00000000ffffffff00000000ffffffff831601915060407fffffffffffffffff0000000000000000ffffffffffffffff00000000000000008316901c77ffffffffffffffff0000000000000000ffffffffffffffff8316019150608082901c6fffffffffffffffffffffffffffffffff831601915061ffff601083901c16820191508192505050919050565b612f4161345d565b612f60600084612f519190613f08565b8561218790919063ffffffff16565b816000019061ffff16908161ffff1681525050612f92600284612f839190613f08565b85611d1e90919063ffffffff16565b816020019060ff16908160ff1681525050612fc2600384612fb39190613f08565b85611d1e90919063ffffffff16565b816040019060ff16908160ff1681525050613000600484612fe39190613f08565b600484612ff0919061429d565b86611d6f9092919063ffffffff16565b81606001819052509392505050565b613017613443565b60006020836130269190614591565b14613052576020826130389190614591565b6020613044919061429d565b8261304f9190613f08565b91505b81836020018181525050604051808452600081528281016020016040525082905092915050565b613081613443565b613093838460000151518485516131e1565b905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff16600460008660ff1660ff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561311357600090506131da565b600460008560ff1660ff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f7e83aee84846040518363ffffffff1660e01b8152600401613187929190613c95565b60206040518083038186803b15801561319f57600080fd5b505afa1580156131b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131d791906137ae565b90505b9392505050565b6131e9613443565b82518211156131f757600080fd5b846020015182856132089190613f08565b111561323d5761323c85600261322d886020015188876132289190613f08565b6132d0565b6132379190614137565b6132ec565b5b60008086518051876020830101935080888701111561325c5787860182525b60208701925050505b602084106132a3578051825260208261327e9190613f08565b915060208161328d9190613f08565b905060208461329c919061429d565b9350613265565b60006001856020036101000a03905080198251168184511681811785525050508692505050949350505050565b6000818311156132e2578290506132e6565b8190505b92915050565b6000826000015190506132ff838361300f565b5061330a8382613079565b50505050565b604051806101400160405280600061ffff168152602001600060ff168152602001600060ff168152602001600063ffffffff168152602001600063ffffffff168152602001600063ffffffff168152602001600061ffff1681526020016060815260200160608152602001606081525090565b6040518060c00160405280600060ff168152602001600060ff168152602001600061ffff1681526020016060815260200160008019168152602001606081525090565b6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b6040518060800160405280600061ffff168152602001600060ff168152602001600060ff168152602001606081525090565b604051806040016040528060608152602001600081525090565b6040518060800160405280600061ffff168152602001600060ff168152602001600060ff168152602001606081525090565b60006134a261349d84613e73565b613e4e565b905080838252602082019050828560208602820111156134c157600080fd5b60005b8581101561350b57813567ffffffffffffffff8111156134e357600080fd5b8086016134f0898261366f565b855260208501945060208401935050506001810190506134c4565b5050509392505050565b600061352861352384613e9f565b613e4e565b90508281526020810184848401111561354057600080fd5b61354b848285614479565b509392505050565b600081359050613562816146ee565b92915050565b600082601f83011261357957600080fd5b813561358984826020860161348f565b91505092915050565b6000815190506135a181614705565b92915050565b6000815190506135b68161471c565b92915050565b60008083601f8401126135ce57600080fd5b8235905067ffffffffffffffff8111156135e757600080fd5b6020830191508360018202830111156135ff57600080fd5b9250929050565b600082601f83011261361757600080fd5b8135613627848260208601613515565b91505092915050565b60008135905061363f81614733565b92915050565b6000813590506136548161474a565b92915050565b60008135905061366981614761565b92915050565b60006040828403121561368157600080fd5b61368b6040613e4e565b9050600082013567ffffffffffffffff8111156136a757600080fd5b6136b384828501613606565b600083015250602082013567ffffffffffffffff8111156136d357600080fd5b6136df84828501613606565b60208301525092915050565b6000813590506136fa81614778565b92915050565b60008135905061370f8161478f565b92915050565b60006020828403121561372757600080fd5b600061373584828501613553565b91505092915050565b60008060006040848603121561375357600080fd5b600084013567ffffffffffffffff81111561376d57600080fd5b61377986828701613568565b935050602084013567ffffffffffffffff81111561379657600080fd5b6137a2868287016135bc565b92509250509250925092565b6000602082840312156137c057600080fd5b60006137ce84828501613592565b91505092915050565b6000602082840312156137e957600080fd5b60006137f7848285016135a7565b91505092915050565b6000806040838503121561381357600080fd5b600083013567ffffffffffffffff81111561382d57600080fd5b6138398582860161366f565b925050602083013567ffffffffffffffff81111561385657600080fd5b61386285828601613606565b9150509250929050565b60008060006040848603121561388157600080fd5b600061388f868287016136eb565b935050602084013567ffffffffffffffff8111156138ac57600080fd5b6138b8868287016135bc565b92509250509250925092565b600080600080608085870312156138da57600080fd5b60006138e8878288016136eb565b945050602085013567ffffffffffffffff81111561390557600080fd5b61391187828801613606565b935050604085013567ffffffffffffffff81111561392e57600080fd5b61393a8782880161366f565b925050606085013567ffffffffffffffff81111561395757600080fd5b61396387828801613606565b91505092959194509250565b600080600080600060a0868803121561398757600080fd5b6000613995888289016136eb565b955050602086013567ffffffffffffffff8111156139b257600080fd5b6139be88828901613606565b945050604086013567ffffffffffffffff8111156139db57600080fd5b6139e78882890161366f565b935050606086013567ffffffffffffffff811115613a0457600080fd5b613a108882890161366f565b925050608086013567ffffffffffffffff811115613a2d57600080fd5b613a3988828901613606565b9150509295509295909350565b600060208284031215613a5857600080fd5b6000613a6684828501613700565b91505092915050565b60008060408385031215613a8257600080fd5b6000613a9085828601613700565b9250506020613aa185828601613630565b9150509250929050565b60008060408385031215613abe57600080fd5b6000613acc85828601613700565b9250506020613add85828601613645565b9150509250929050565b60008060408385031215613afa57600080fd5b6000613b0885828601613700565b9250506020613b198582860161365a565b9150509250929050565b613b2c81614305565b82525050565b613b3b81614323565b82525050565b6000613b4d8385613eec565b9350613b5a838584614479565b82840190509392505050565b6000613b7182613ed0565b613b7b8185613edb565b9350613b8b818560208601614488565b613b948161467e565b840191505092915050565b613ba8816143fb565b82525050565b613bb78161441f565b82525050565b613bc681614443565b82525050565b6000613bd9601783613ef7565b9150613be48261469c565b602082019050919050565b6000613bfc601483613ef7565b9150613c07826146c5565b602082019050919050565b613c1b81614467565b82525050565b613c2a816143de565b82525050565b613c39816143ee565b82525050565b6000613c4c828486613b41565b91508190509392505050565b6000602082019050613c6d6000830184613b23565b92915050565b60006020820190508181036000830152613c8d8184613b66565b905092915050565b60006040820190508181036000830152613caf8185613b66565b90508181036020830152613cc38184613b66565b90509392505050565b60006060820190508181036000830152613ce68186613b66565b90508181036020830152613cfa8185613b66565b90508181036040830152613d0e8184613b66565b9050949350505050565b60006060820190508181036000830152613d328186613b66565b90508181036020830152613d468185613b66565b9050613d556040830184613c12565b949350505050565b6000602082019050613d726000830184613b9f565b92915050565b6000602082019050613d8d6000830184613bae565b92915050565b6000602082019050613da86000830184613bbd565b92915050565b60006020820190508181036000830152613dc781613bcc565b9050919050565b60006020820190508181036000830152613de781613bef565b9050919050565b6000606082019050613e036000830186613c21565b613e106020830185613c21565b613e1d6040830184613b32565b949350505050565b6000604082019050613e3a6000830185613c30565b613e476020830184613b23565b9392505050565b6000613e58613e69565b9050613e648282614517565b919050565b6000604051905090565b600067ffffffffffffffff821115613e8e57613e8d61464f565b5b602082029050602081019050919050565b600067ffffffffffffffff821115613eba57613eb961464f565b5b613ec38261467e565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b6000613f13826143d4565b9150613f1e836143d4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613f5357613f526145c2565b5b828201905092915050565b6000613f69826143ee565b9150613f74836143ee565b92508260ff03821115613f8a57613f896145c2565b5b828201905092915050565b6000613fa0826143a6565b9150613fab836143a6565b925082613fbb57613fba6145f1565b5b828204905092915050565b6000808291508390505b600185111561401057808604811115613fec57613feb6145c2565b5b6001851615613ffb5780820291505b80810290506140098561468f565b9450613fd0565b94509492505050565b6000614024826143d4565b915061402f836143d4565b925061405c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484614064565b905092915050565b6000826140745760019050614130565b816140825760009050614130565b816001811461409857600281146140a2576140d1565b6001915050614130565b60ff8411156140b4576140b36145c2565b5b8360020a9150848211156140cb576140ca6145c2565b5b50614130565b5060208310610133831016604e8410600b84101617156141065782820a905083811115614101576141006145c2565b5b614130565b6141138484846001613fc6565b9250905081840481111561412a576141296145c2565b5b81810290505b9392505050565b6000614142826143d4565b915061414d836143d4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614186576141856145c2565b5b828202905092915050565b600061419c8261438f565b91506141a78361438f565b9250827f8000000000000000000000000000000000000000000000000000000000000000018212600084121516156141e2576141e16145c2565b5b827f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01821360008412161561421a576142196145c2565b5b828203905092915050565b600061423082614399565b915061423b83614399565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffff8000000001821260008412151615614276576142756145c2565b5b82637fffffff018213600084121615614292576142916145c2565b5b828203905092915050565b60006142a8826143d4565b91506142b3836143d4565b9250828210156142c6576142c56145c2565b5b828203905092915050565b60006142dc826143ee565b91506142e7836143ee565b9250828210156142fa576142f96145c2565b5b828203905092915050565b6000614310826143b4565b9050919050565b60008115159050919050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b6000819050919050565b600061436482614305565b9050919050565b600061437682614305565b9050919050565b600061438882614305565b9050919050565b6000819050919050565b60008160030b9050919050565b600061ffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600063ffffffff82169050919050565b600060ff82169050919050565b60006144068261440d565b9050919050565b6000614418826143b4565b9050919050565b600061442a82614431565b9050919050565b600061443c826143b4565b9050919050565b600061444e82614455565b9050919050565b6000614460826143b4565b9050919050565b6000614472826143a6565b9050919050565b82818337600083830152505050565b60005b838110156144a657808201518184015260208101905061448b565b838111156144b5576000848401525b50505050565b60006144c6826143d4565b915060008214156144da576144d96145c2565b5b600182039050919050565b600060028204905060018216806144fd57607f821691505b6020821081141561451157614510614620565b5b50919050565b6145208261467e565b810181811067ffffffffffffffff8211171561453f5761453e61464f565b5b80604052505050565b6000614553826143d4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415614586576145856145c2565b5b600182019050919050565b600061459c826143d4565b91506145a7836143d4565b9250826145b7576145b66145f1565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f4c6f6e67206b657973206e6f74207065726d6974746564000000000000000000600082015250565b7f4e6f2076616c69642070726f6f6620666f756e64000000000000000000000000600082015250565b6146f781614305565b811461470257600080fd5b50565b61470e81614317565b811461471957600080fd5b50565b6147258161434f565b811461473057600080fd5b50565b61473c81614359565b811461474757600080fd5b50565b6147538161436b565b811461475e57600080fd5b50565b61476a8161437d565b811461477557600080fd5b50565b614781816143a6565b811461478c57600080fd5b50565b614798816143ee565b81146147a357600080fd5b5056fe00010203040506070809ffffffffffffff0a0b0c0d0e0f101112131415161718191a1b1c1d1e1fffffffffffffffffffff0a0b0c0d0e0f101112131415161718191a1b1c1d1e1fa26469706673582212200863ca5c6fb425baca4f13e2cb90134252c9ba773757e3a584f08f724650c50164736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806373cc48a61161008c57806398d35f201161006657806398d35f2014610247578063bd7ed31a14610265578063c327deef14610295578063d7b82ebe146102c5576100ea565b806373cc48a6146101dd5780638438dc041461020d5780638da5cb5b14610229576100ea565b806313af4035116100c857806313af40351461015957806328e7677d146101755780632c095cbb14610191578063435cc162146101ad576100ea565b8063020ed8d3146100ef578063087991bc1461010b5780630b1a24951461013d575b600080fd5b61010960048036038101906101049190613a6f565b6102f5565b005b6101256004803603810190610120919061386c565b6103e4565b60405161013493929190613dee565b60405180910390f35b6101576004803603810190610152919061396f565b61047b565b005b610173600480360381019061016e9190613715565b6106f2565b005b61018f600480360381019061018a9190613aab565b610790565b005b6101ab60048036038101906101a691906138c4565b61087f565b005b6101c760048036038101906101c2919061373e565b6109d2565b6040516101d49190613c73565b60405180910390f35b6101f760048036038101906101f29190613a46565b610a94565b6040516102049190613d78565b60405180910390f35b61022760048036038101906102229190613ae7565b610ac7565b005b610231610bb6565b60405161023e9190613c58565b60405180910390f35b61024f610bdc565b60405161025c9190613c73565b60405180910390f35b61027f600480360381019061027a9190613a46565b610c6a565b60405161028c9190613d93565b60405180910390f35b6102af60048036038101906102aa9190613a46565b610c9d565b6040516102bc9190613d5d565b60405180910390f35b6102df60048036038101906102da9190613800565b610cd0565b6040516102ec9190613c73565b60405180910390f35b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461034f57600080fd5b80600360008460ff1660ff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507ff73c3c226af96b7f1ba666a21b3ceaf2be3ee6a365e3178fd9cd1eaae0075aa882826040516103d8929190613e25565b60405180910390a15050565b6000806000806002600087876040516103fe929190613c3f565b6040518091039020815260200190815260200160002060008861ffff1661ffff16815260200190815260200160002090508060000160009054906101000a900463ffffffff168160000160049054906101000a900463ffffffff168260000160089054906101000a900460601b9350935093505093509350939050565b6000600260008680519060200120815260200190815260200160002060008761ffff1661ffff16815260200190815260200160002060000160009054906101000a900463ffffffff16905060006104d28584610ce4565b90506104df818784610d95565b6104e7613310565b6000856000015151111561050d576104ff8585610ce4565b905061050c818885610d95565b5b600061051883610de2565b9050600060fe82602001511660ff161461053157600080fd5b610545602782610e2f90919063ffffffff16565b15801561057e5750610561600282610e2f90919063ffffffff16565b158061057d575061057c600682610e2f90919063ffffffff16565b5b5b61058757600080fd5b610598898985610120015184610e49565b1561062d57600260008980519060200120815260200190815260200160002060008a61ffff1661ffff168152602001908152602001600020600080820160006101000a81549063ffffffff02191690556000820160046101000a81549063ffffffff02191690556000820160086101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550506106e7565b61064c888461012001518385610120015161064787610de2565b610e83565b156106e157600260008980519060200120815260200190815260200160002060008a61ffff1661ffff168152602001908152602001600020600080820160006101000a81549063ffffffff02191690556000820160046101000a81549063ffffffff02191690556000820160086101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550506106e6565b600080fd5b5b505050505050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461074c57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107ea57600080fd5b80600460008460ff1660ff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f2fcc274c3b72dd483ab201bfa87295e3817e8b9b10693219873b722ca1af00c78282604051610873929190613e25565b60405180910390a15050565b610887613310565b6108918383610ce4565b9050602f61ffff16816000015161ffff16146108ac57600080fd5b6109008160a00151600260008780519060200120815260200190815260200160002060008861ffff1661ffff16815260200190815260200160002060000160009054906101000a900463ffffffff16610fd6565b61090957600080fd5b600061091482610ff2565b905061091f81611011565b6109c657610934818361012001518789611027565b600260008680519060200120815260200190815260200160002060008761ffff1661ffff168152602001908152602001600020600080820160006101000a81549063ffffffff02191690556000820160046101000a81549063ffffffff02191690556000820160086101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055505050506109cc565b50600080fd5b50505050565b6060600083838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060005b8551811015610a8857610a73868281518110610a65577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101518361127d565b91508080610a8090614548565b915050610a20565b50809150509392505050565b60046020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b2157600080fd5b80600560008460ff1660ff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fc7eec866a7a1386188cc3ca20ffea75b71bd3e90a60b6791b1d3f0971145118d8282604051610baa929190613e25565b60405180910390a15050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054610be9906144e5565b80601f0160208091040260200160405190810160405280929190818152602001828054610c15906144e5565b8015610c625780601f10610c3757610100808354040283529160200191610c62565b820191906000526020600020905b815481529060010190602001808311610c4557829003601f168201915b505050505081565b60056020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60036020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060610cdc838361127d565b905092915050565b610cec613310565b610cf98360000151611497565b9050610d098160e001518361161c565b610d1257600080fd5b6000610d228283600001516116bb565b9050816040015160ff16610d4060008361178c90919063ffffffff16565b14610d4a57600080fd5b80826101200181905250610d62826080015142610fd6565b610d6b57600080fd5b610d79428360a00151610fd6565b610d8257600080fd5b610d8e81838686611834565b5092915050565b610da38360a0015182610fd6565b610dac57600080fd5b603261ffff16836000015161ffff1614610dc557600080fd5b610dd483610120015183611934565b610ddd57600080fd5b505050565b610dea613383565b6000610df583610ff2565b9050610e278160a001518260a001518360c00151610e13919061429d565b83600001516119d09092919063ffffffff16565b915050919050565b6000610e418360a00151600084611b78565b905092915050565b6000610e56828486611cbf565b15610e7657610e6e8583610e2f90919063ffffffff16565b159050610e7b565b600090505b949350505050565b60008060fe83602001511660ff1614610e9b57600080fd5b6000610ea686611ce9565b90506000610eb385611ce9565b90506000806001610ece60008c611d1e90919063ffffffff16565b610ed89190613f5e565b60ff1690505b8951811015610fc45783610f1289610f0d84858f51610efd919061429d565b8f611d6f9092919063ffffffff16565b611e2a565b1415610f8d576000610f4487610f3f85868f51610f2f919061429d565b8f611d6f9092919063ffffffff16565b611e2a565b90508660800151841015610f70578381118015610f645750866080015181105b95505050505050610fcd565b83811180610f815750866080015181105b95505050505050610fcd565b8091506001610fa5828c611d1e90919063ffffffff16565b610faf9190613f5e565b60ff1681610fbd9190613f08565b9050610ede565b50600093505050505b95945050505050565b6000808284610fe59190614225565b60030b1215905092915050565b610ffa6133c6565b61100a8261010001516000611f06565b9050919050565b6000816000015151826020015110159050919050565b60008460a0015190506000611049828760000151611f3090919063ffffffff16565b905060008660a001518760c00151611061919061429d565b905081811161106f57600080fd5b60006110848787611fd390919063ffffffff16565b905060008114156110c2576110b3838561109e9190613f08565b868a60000151611b789092919063ffffffff16565b156110bd57600080fd5b611129565b60006110dd85858b60000151611d6f9092919063ffffffff16565b9050600082136110ec57600080fd5b6000611101828a611fd390919063ffffffff16565b121561112757600061111c8289611fd390919063ffffffff16565b1261112657600080fd5b5b505b5050505050505050565b8060c001518160200181815250508060000151518160200151106111565761127a565b600061116a82600001518360200151611f30565b82602001516111799190613f08565b905061119281836000015161218790919063ffffffff16565b826040019061ffff16908161ffff16815250506002816111b29190613f08565b90506111cb81836000015161218790919063ffffffff16565b826060019061ffff16908161ffff16815250506002816111eb9190613f08565b90506112048183600001516121b690919063ffffffff16565b826080019063ffffffff16908163ffffffff16815250506004816112289190613f08565b9050600061124382846000015161218790919063ffffffff16565b61ffff1690506002826112569190613f08565b9150818360a0018181525050808261126e9190613f08565b8360c001818152505050505b50565b6060611287613310565b6112918484610ce4565b90506000600260008361012001518051906020012081526020019081526020016000206000836000015161ffff1661ffff1681526020019081526020016000209050600060601b6bffffffffffffffffffffffff19168160000160089054906101000a900460601b6bffffffffffffffffffffffff1916146113395761132f8260a001518260000160009054906101000a900463ffffffff16610fd6565b61133857600080fd5b5b60405180606001604052808360a0015163ffffffff168152602001836080015163ffffffff168152602001836101000151805190602001206bffffffffffffffffffffffff1916815250600260008461012001518051906020012081526020019081526020016000206000846000015161ffff1661ffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548163ffffffff021916908363ffffffff16021790555060408201518160000160086101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908360601c02179055509050507f55ced933cdd5a34dd03eb5d4bef19ec6ebb251dcd7a988eee0c1b9a13baaa88b82610120015183610100015160405161147f929190613c95565b60405180910390a18161010001519250505092915050565b61149f613310565b6114b360008361218790919063ffffffff16565b816000019061ffff16908161ffff16815250506114da600283611d1e90919063ffffffff16565b816020019060ff16908160ff16815250506114ff600383611d1e90919063ffffffff16565b816040019060ff16908160ff16815250506115246004836121b690919063ffffffff16565b816060019063ffffffff16908163ffffffff168152505061154f6008836121b690919063ffffffff16565b816080019063ffffffff16908163ffffffff168152505061157a600c836121b690919063ffffffff16565b8160a0019063ffffffff16908163ffffffff16815250506115a560108361218790919063ffffffff16565b8160c0019061ffff16908161ffff16815250506115c38260126121e7565b8160e0018190525061160e8160e001515160126115e09190613f08565b8260e0015151601285516115f4919061429d565b6115fe919061429d565b84611d6f9092919063ffffffff16565b816101000181905250919050565b600080611645611636600085611f3090919063ffffffff16565b8461218790919063ffffffff16565b905082805190602001206bffffffffffffffffffffffff1916600260008680519060200120815260200190815260200160002060008361ffff1661ffff16815260200190815260200160002060000160089054906101000a900460601b6bffffffffffffffffffffffff19161491505092915050565b606060006116c884610ff2565b90505b6116d481611011565b61178557600161ffff16816060015161ffff16146116f157600080fd5b60008251141561170b5761170481612215565b915061175f565b61172681602001518260000151611f3090919063ffffffff16565b82511461173257600080fd5b61175560008260000151836020015185518661224c90949392919063ffffffff16565b61175e57600080fd5b5b8261ffff16816040015161ffff161461177757600080fd5b61178081611133565b6116cb565b5092915050565b600080600090505b60011561182a57835183106117d2577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b60006117e78486611d1e90919063ffffffff16565b60ff1690506001816117f99190613f08565b846118049190613f08565b93506000811415611815575061182a565b6001826118229190613f08565b915050611794565b8091505092915050565b83518360e0015151111561184757600080fd5b6118746000858560e0015151875161185f919061429d565b8660e00151612270909392919063ffffffff16565b61187d57600080fd5b6000611893600083611f0690919063ffffffff16565b9050602b61ffff16816040015161ffff1614156118c3576118b58484836122ab565b6118be57600080fd5b61192d565b603061ffff16816040015161ffff1614156118f1576118e3848483612354565b6118ec57600080fd5b61192c565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192390613dce565b60405180910390fd5b5b5050505050565b600080600161194d600086611d1e90919063ffffffff16565b6119579190613f5e565b60ff16905060005b83518110156119c35761197f81868487612270909392919063ffffffff16565b1561198f576001925050506119ca565b60016119a48286611d1e90919063ffffffff16565b6119ae9190613f5e565b60ff16816119bc9190613f08565b905061195f565b6000925050505b92915050565b6119d8613383565b600082846119e69190613f08565b9050611a076000856119f89190613f08565b86611d1e90919063ffffffff16565b826000019060ff16908160ff1681525050611a37600185611a289190613f08565b86611d1e90919063ffffffff16565b826020019060ff16908160ff1681525050611a67600285611a589190613f08565b8661218790919063ffffffff16565b826040019061ffff16908161ffff16815250506000611a9b600486611a8c9190613f08565b87611d1e90919063ffffffff16565b9050600585611aaa9190613f08565b9450611ac4858260ff1688611d6f9092919063ffffffff16565b83606001819052508060ff1685611adb9190613f08565b94506000611af28688611d1e90919063ffffffff16565b905060208160ff161115611b0557600080fd5b600186611b129190613f08565b9550611b2c868260ff16896124149092919063ffffffff16565b8460800181815250508060ff1686611b449190613f08565b9550611b66868785611b56919061429d565b89611d6f9092919063ffffffff16565b8460a001819052505050509392505050565b60008060088361ffff16901c90506000600860ff8516611b989190613f95565b90506000600785166007611bac91906142d1565b60ff16600160ff16901b905060008690505b8751811015611caf576000611bdc828a611d1e90919063ffffffff16565b90506000611bff600184611bf09190613f08565b8b611d1e90919063ffffffff16565b90508160ff168660ff161015611c1e5760009650505050505050611cb8565b8160ff168660ff161415611c8b578460ff168160ff1611611c485760009650505050505050611cb8565b600084611c7860028860ff1687611c5f9190613f08565b611c699190613f08565b8d611d1e90919063ffffffff16565b1660ff1614159650505050505050611cb8565b600281611c989190613f5e565b60ff1683611ca69190613f08565b92505050611bbe565b50600093505050505b9392505050565b600080611ccc8584611e2a565b90506000611cd985611ce9565b9050808214925050509392505050565b6000611d176001611d04600085611d1e90919063ffffffff16565b60ff168461245c9092919063ffffffff16565b9050919050565b6000828281518110611d59577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b60f81c905092915050565b606083518284611d7f9190613f08565b1115611d8a57600080fd5b60008267ffffffffffffffff811115611dcc577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611dfe5781602001600182028036833780820191505090505b5090506000806020830191508560208801019050611e1d828287612744565b8293505050509392505050565b600060056000846000015160ff1660ff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166368f9dab284606001518486604001516040518463ffffffff1660e01b8152600401611eae93929190613d18565b60206040518083038186803b158015611ec657600080fd5b505afa158015611eda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611efe91906137d7565b905092915050565b611f0e6133c6565b828160000181905250818160c0018181525050611f2a81611133565b92915050565b6000808290505b600115611fbe5783518110611f75577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000611f8a8286611d1e90919063ffffffff16565b60ff169050600181611f9c9190613f08565b82611fa79190613f08565b91506000811415611fb85750611fbe565b50611f37565b8281611fca919061429d565b91505092915050565b6000611fe882846127a890919063ffffffff16565b15611ff65760009050612181565b600080600080600061200988600061178c565b9050600061201888600061178c565b90505b808211156120455785935061203089876127cf565b9550818061203d906144bb565b92505061201b565b5b818111156120705784925061205b88866127cf565b94508080612068906144bb565b915050612046565b5b60008211801561209557506120938689878c612270909392919063ffffffff16565b155b156120cc578593506120a789876127cf565b95508492506120b688866127cf565b94506001826120c5919061429d565b9150612071565b6000861415612103577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9650505050505050612181565b600085141561211b5760019650505050505050612181565b61217860018561212b9190613f08565b61213e868c611d1e90919063ffffffff16565b60ff168a60018761214f9190613f08565b612162888e611d1e90919063ffffffff16565b60ff168e6128069095949392919063ffffffff16565b96505050505050505b92915050565b600082516002836121989190613f08565b11156121a357600080fd5b61ffff8260028501015116905092915050565b600082516004836121c79190613f08565b11156121d257600080fd5b63ffffffff8260048501015116905092915050565b606060006121f58484611f30565b905061220c838286611d6f9092919063ffffffff16565b91505092915050565b6060612245826020015161223184600001518560200151611f30565b8460000151611d6f9092919063ffffffff16565b9050919050565b600061225984848461293b565b61226487878561293b565b14905095945050505050565b60006122898383848651612284919061429d565b61293b565b6122a0868687895161229b919061429d565b61293b565b149050949350505050565b6000806122b785610ff2565b90505b6122c381611011565b61234757603061ffff16816040015161ffff16146122e057600080fd5b60006122eb82612967565b9050600061230660008351846129a09092919063ffffffff16565b905061231481838989612a76565b156123375761232d61232584612215565b868385612bd5565b935050505061234d565b505061234281611133565b6122ba565b50600090505b9392505050565b60006123758460e0015161236784612215565b6127a890919063ffffffff16565b61237e57600080fd5b5b61238882611011565b612408576123ab8460e0015161239d84612215565b6127a890919063ffffffff16565b6123b457600080fd5b60006123bf83612967565b905060006123da60008351846129a09092919063ffffffff16565b90506123e881838888612a76565b156123f85760019250505061240d565b505061240382611133565b61237f565b600090505b9392505050565b6000602082111561242457600080fd5b835182846124329190613f08565b111561243d57600080fd5b6001826020036101000a03198084602087010151169150509392505050565b6000603482111561246c57600080fd5b60008080600090505b848110156125f357600087828861248c9190613f08565b815181106124c3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b9050603060f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161015801561252c5750607a60f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191611155b61253557600080fd5b6040518060800160405280604781526020016147a76047913960308260f81c60ff16612561919061429d565b81518110612598577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b60f81c925060208360ff1611156125b957600080fd5b6001866125c6919061429d565b8214156125d357506125f3565b8260ff16600585901b1793505080806125eb90614548565b915050612475565b5060006005856126039190614137565b905060006008866126149190614591565b141561262b578160ff16600584901b179250612724565b600260088661263a9190614591565b14156126675760028260ff16901c60ff16600384901b179250600281612660919061429d565b9050612723565b60046008866126769190614591565b14156126a35760048260ff16901c60ff16600184901b17925060048161269c919061429d565b9050612722565b60056008866126b29190614591565b14156126df5760018260ff16901c60ff16600484901b1792506001816126d8919061429d565b9050612721565b60076008866126ee9190614591565b141561271b5760038260ff16901c60ff16600284901b179250600381612714919061429d565b9050612720565b600080fd5b5b5b5b5b80610100612732919061429d565b83901b60001b93505050509392505050565b5b60208110612783578151835260208361275e9190613f08565b925060208261276d9190613f08565b915060208161277c919061429d565b9050612745565b60006001826020036101000a0390508019835116818551168181178652505050505050565b6000815183511480156127c757506127c6836000846000875161224c565b5b905092915050565b60006127e48284611d1e90919063ffffffff16565b60ff166001836127f49190613f08565b6127fe9190613f08565b905092915050565b60008085905085831015612818578290505b600080602089018a019150602086018701905060005b8381101561291e5760008084519150835190508082146128ea576000602087111561287b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90506128bb565b60018488602061288b919061429d565b6128959190613f08565b60086128a19190614137565b60026128ad9190614019565b6128b7919061429d565b1990505b60008183168285166128cd9190614191565b9050600081146128e7578098505050505050505050612931565b50505b6020856128f79190613f08565b94506020846129069190613f08565b935050506020816129179190613f08565b905061282e565b50848861292b9190614191565b93505050505b9695505050505050565b60008351828461294b9190613f08565b111561295657600080fd5b818360208601012090509392505050565b60606129998260a001518360a001518460c00151612985919061429d565b8460000151611d6f9092919063ffffffff16565b9050919050565b6129a8613411565b6129c76000846129b89190613f08565b8561218790919063ffffffff16565b816000019061ffff16908161ffff16815250506129f96002846129ea9190613f08565b85611d1e90919063ffffffff16565b816020019060ff16908160ff1681525050612a29600384612a1a9190613f08565b85611d1e90919063ffffffff16565b816040019060ff16908160ff1681525050612a67600484612a4a9190613f08565b600484612a57919061429d565b86611d6f9092919063ffffffff16565b81606001819052509392505050565b60006003856020015160ff1614612a905760009050612bcd565b826020015160ff16856040015160ff1614612aae5760009050612bcd565b6000612ab985612cf1565b90508360c0015161ffff168161ffff1614612ad8576000915050612bcd565b6000610100876000015161ffff16161415612af7576000915050612bcd565b60036000876040015160ff1660ff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663de8f50a186856000015186602001516040518463ffffffff1660e01b8152600401612b7993929190613ccc565b60206040518083038186803b158015612b9157600080fd5b505afa158015612ba5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bc991906137ae565b9150505b949350505050565b600080612be183612cf1565b90505b612bed85611011565b612ce3576000612c238660a001518760a001518860c00151612c0f919061429d565b8860000151612f399092919063ffffffff16565b90508161ffff16816000015161ffff1614612c3e5750612cd5565b846040015160ff16816020015160ff1614612c595750612cd5565b612c61613443565b612c8185518951612c729190613f08565b8261300f90919063ffffffff16565b50612c95888261307990919063ffffffff16565b50612ca9858261307990919063ffffffff16565b50612cc182604001518260000151846060015161309b565b15612cd25760019350505050612ce9565b50505b612cde85611133565b612be4565b60009150505b949350505050565b600061200082511115612d39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d3090613dae565b60405180910390fd5b60008060005b601f855101811015612dd95760008160208701015190508551602083011115612d7c57600060088388510302610100039050808183901c901b9150505b60087fff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff008216901c840193507eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff81168301925050602081019050612d3f565b5060107fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff00008316901c7dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff831601915060107fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff00008216901c7dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff821601905080600883901b01915060207fffffffff00000000ffffffff00000000ffffffff00000000ffffffff000000008316901c7bffffffff00000000ffffffff00000000ffffffff00000000ffffffff831601915060407fffffffffffffffff0000000000000000ffffffffffffffff00000000000000008316901c77ffffffffffffffff0000000000000000ffffffffffffffff8316019150608082901c6fffffffffffffffffffffffffffffffff831601915061ffff601083901c16820191508192505050919050565b612f4161345d565b612f60600084612f519190613f08565b8561218790919063ffffffff16565b816000019061ffff16908161ffff1681525050612f92600284612f839190613f08565b85611d1e90919063ffffffff16565b816020019060ff16908160ff1681525050612fc2600384612fb39190613f08565b85611d1e90919063ffffffff16565b816040019060ff16908160ff1681525050613000600484612fe39190613f08565b600484612ff0919061429d565b86611d6f9092919063ffffffff16565b81606001819052509392505050565b613017613443565b60006020836130269190614591565b14613052576020826130389190614591565b6020613044919061429d565b8261304f9190613f08565b91505b81836020018181525050604051808452600081528281016020016040525082905092915050565b613081613443565b613093838460000151518485516131e1565b905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff16600460008660ff1660ff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561311357600090506131da565b600460008560ff1660ff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f7e83aee84846040518363ffffffff1660e01b8152600401613187929190613c95565b60206040518083038186803b15801561319f57600080fd5b505afa1580156131b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131d791906137ae565b90505b9392505050565b6131e9613443565b82518211156131f757600080fd5b846020015182856132089190613f08565b111561323d5761323c85600261322d886020015188876132289190613f08565b6132d0565b6132379190614137565b6132ec565b5b60008086518051876020830101935080888701111561325c5787860182525b60208701925050505b602084106132a3578051825260208261327e9190613f08565b915060208161328d9190613f08565b905060208461329c919061429d565b9350613265565b60006001856020036101000a03905080198251168184511681811785525050508692505050949350505050565b6000818311156132e2578290506132e6565b8190505b92915050565b6000826000015190506132ff838361300f565b5061330a8382613079565b50505050565b604051806101400160405280600061ffff168152602001600060ff168152602001600060ff168152602001600063ffffffff168152602001600063ffffffff168152602001600063ffffffff168152602001600061ffff1681526020016060815260200160608152602001606081525090565b6040518060c00160405280600060ff168152602001600060ff168152602001600061ffff1681526020016060815260200160008019168152602001606081525090565b6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b6040518060800160405280600061ffff168152602001600060ff168152602001600060ff168152602001606081525090565b604051806040016040528060608152602001600081525090565b6040518060800160405280600061ffff168152602001600060ff168152602001600060ff168152602001606081525090565b60006134a261349d84613e73565b613e4e565b905080838252602082019050828560208602820111156134c157600080fd5b60005b8581101561350b57813567ffffffffffffffff8111156134e357600080fd5b8086016134f0898261366f565b855260208501945060208401935050506001810190506134c4565b5050509392505050565b600061352861352384613e9f565b613e4e565b90508281526020810184848401111561354057600080fd5b61354b848285614479565b509392505050565b600081359050613562816146ee565b92915050565b600082601f83011261357957600080fd5b813561358984826020860161348f565b91505092915050565b6000815190506135a181614705565b92915050565b6000815190506135b68161471c565b92915050565b60008083601f8401126135ce57600080fd5b8235905067ffffffffffffffff8111156135e757600080fd5b6020830191508360018202830111156135ff57600080fd5b9250929050565b600082601f83011261361757600080fd5b8135613627848260208601613515565b91505092915050565b60008135905061363f81614733565b92915050565b6000813590506136548161474a565b92915050565b60008135905061366981614761565b92915050565b60006040828403121561368157600080fd5b61368b6040613e4e565b9050600082013567ffffffffffffffff8111156136a757600080fd5b6136b384828501613606565b600083015250602082013567ffffffffffffffff8111156136d357600080fd5b6136df84828501613606565b60208301525092915050565b6000813590506136fa81614778565b92915050565b60008135905061370f8161478f565b92915050565b60006020828403121561372757600080fd5b600061373584828501613553565b91505092915050565b60008060006040848603121561375357600080fd5b600084013567ffffffffffffffff81111561376d57600080fd5b61377986828701613568565b935050602084013567ffffffffffffffff81111561379657600080fd5b6137a2868287016135bc565b92509250509250925092565b6000602082840312156137c057600080fd5b60006137ce84828501613592565b91505092915050565b6000602082840312156137e957600080fd5b60006137f7848285016135a7565b91505092915050565b6000806040838503121561381357600080fd5b600083013567ffffffffffffffff81111561382d57600080fd5b6138398582860161366f565b925050602083013567ffffffffffffffff81111561385657600080fd5b61386285828601613606565b9150509250929050565b60008060006040848603121561388157600080fd5b600061388f868287016136eb565b935050602084013567ffffffffffffffff8111156138ac57600080fd5b6138b8868287016135bc565b92509250509250925092565b600080600080608085870312156138da57600080fd5b60006138e8878288016136eb565b945050602085013567ffffffffffffffff81111561390557600080fd5b61391187828801613606565b935050604085013567ffffffffffffffff81111561392e57600080fd5b61393a8782880161366f565b925050606085013567ffffffffffffffff81111561395757600080fd5b61396387828801613606565b91505092959194509250565b600080600080600060a0868803121561398757600080fd5b6000613995888289016136eb565b955050602086013567ffffffffffffffff8111156139b257600080fd5b6139be88828901613606565b945050604086013567ffffffffffffffff8111156139db57600080fd5b6139e78882890161366f565b935050606086013567ffffffffffffffff811115613a0457600080fd5b613a108882890161366f565b925050608086013567ffffffffffffffff811115613a2d57600080fd5b613a3988828901613606565b9150509295509295909350565b600060208284031215613a5857600080fd5b6000613a6684828501613700565b91505092915050565b60008060408385031215613a8257600080fd5b6000613a9085828601613700565b9250506020613aa185828601613630565b9150509250929050565b60008060408385031215613abe57600080fd5b6000613acc85828601613700565b9250506020613add85828601613645565b9150509250929050565b60008060408385031215613afa57600080fd5b6000613b0885828601613700565b9250506020613b198582860161365a565b9150509250929050565b613b2c81614305565b82525050565b613b3b81614323565b82525050565b6000613b4d8385613eec565b9350613b5a838584614479565b82840190509392505050565b6000613b7182613ed0565b613b7b8185613edb565b9350613b8b818560208601614488565b613b948161467e565b840191505092915050565b613ba8816143fb565b82525050565b613bb78161441f565b82525050565b613bc681614443565b82525050565b6000613bd9601783613ef7565b9150613be48261469c565b602082019050919050565b6000613bfc601483613ef7565b9150613c07826146c5565b602082019050919050565b613c1b81614467565b82525050565b613c2a816143de565b82525050565b613c39816143ee565b82525050565b6000613c4c828486613b41565b91508190509392505050565b6000602082019050613c6d6000830184613b23565b92915050565b60006020820190508181036000830152613c8d8184613b66565b905092915050565b60006040820190508181036000830152613caf8185613b66565b90508181036020830152613cc38184613b66565b90509392505050565b60006060820190508181036000830152613ce68186613b66565b90508181036020830152613cfa8185613b66565b90508181036040830152613d0e8184613b66565b9050949350505050565b60006060820190508181036000830152613d328186613b66565b90508181036020830152613d468185613b66565b9050613d556040830184613c12565b949350505050565b6000602082019050613d726000830184613b9f565b92915050565b6000602082019050613d8d6000830184613bae565b92915050565b6000602082019050613da86000830184613bbd565b92915050565b60006020820190508181036000830152613dc781613bcc565b9050919050565b60006020820190508181036000830152613de781613bef565b9050919050565b6000606082019050613e036000830186613c21565b613e106020830185613c21565b613e1d6040830184613b32565b949350505050565b6000604082019050613e3a6000830185613c30565b613e476020830184613b23565b9392505050565b6000613e58613e69565b9050613e648282614517565b919050565b6000604051905090565b600067ffffffffffffffff821115613e8e57613e8d61464f565b5b602082029050602081019050919050565b600067ffffffffffffffff821115613eba57613eb961464f565b5b613ec38261467e565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b6000613f13826143d4565b9150613f1e836143d4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613f5357613f526145c2565b5b828201905092915050565b6000613f69826143ee565b9150613f74836143ee565b92508260ff03821115613f8a57613f896145c2565b5b828201905092915050565b6000613fa0826143a6565b9150613fab836143a6565b925082613fbb57613fba6145f1565b5b828204905092915050565b6000808291508390505b600185111561401057808604811115613fec57613feb6145c2565b5b6001851615613ffb5780820291505b80810290506140098561468f565b9450613fd0565b94509492505050565b6000614024826143d4565b915061402f836143d4565b925061405c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484614064565b905092915050565b6000826140745760019050614130565b816140825760009050614130565b816001811461409857600281146140a2576140d1565b6001915050614130565b60ff8411156140b4576140b36145c2565b5b8360020a9150848211156140cb576140ca6145c2565b5b50614130565b5060208310610133831016604e8410600b84101617156141065782820a905083811115614101576141006145c2565b5b614130565b6141138484846001613fc6565b9250905081840481111561412a576141296145c2565b5b81810290505b9392505050565b6000614142826143d4565b915061414d836143d4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614186576141856145c2565b5b828202905092915050565b600061419c8261438f565b91506141a78361438f565b9250827f8000000000000000000000000000000000000000000000000000000000000000018212600084121516156141e2576141e16145c2565b5b827f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01821360008412161561421a576142196145c2565b5b828203905092915050565b600061423082614399565b915061423b83614399565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffff8000000001821260008412151615614276576142756145c2565b5b82637fffffff018213600084121615614292576142916145c2565b5b828203905092915050565b60006142a8826143d4565b91506142b3836143d4565b9250828210156142c6576142c56145c2565b5b828203905092915050565b60006142dc826143ee565b91506142e7836143ee565b9250828210156142fa576142f96145c2565b5b828203905092915050565b6000614310826143b4565b9050919050565b60008115159050919050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b6000819050919050565b600061436482614305565b9050919050565b600061437682614305565b9050919050565b600061438882614305565b9050919050565b6000819050919050565b60008160030b9050919050565b600061ffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600063ffffffff82169050919050565b600060ff82169050919050565b60006144068261440d565b9050919050565b6000614418826143b4565b9050919050565b600061442a82614431565b9050919050565b600061443c826143b4565b9050919050565b600061444e82614455565b9050919050565b6000614460826143b4565b9050919050565b6000614472826143a6565b9050919050565b82818337600083830152505050565b60005b838110156144a657808201518184015260208101905061448b565b838111156144b5576000848401525b50505050565b60006144c6826143d4565b915060008214156144da576144d96145c2565b5b600182039050919050565b600060028204905060018216806144fd57607f821691505b6020821081141561451157614510614620565b5b50919050565b6145208261467e565b810181811067ffffffffffffffff8211171561453f5761453e61464f565b5b80604052505050565b6000614553826143d4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415614586576145856145c2565b5b600182019050919050565b600061459c826143d4565b91506145a7836143d4565b9250826145b7576145b66145f1565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f4c6f6e67206b657973206e6f74207065726d6974746564000000000000000000600082015250565b7f4e6f2076616c69642070726f6f6620666f756e64000000000000000000000000600082015250565b6146f781614305565b811461470257600080fd5b50565b61470e81614317565b811461471957600080fd5b50565b6147258161434f565b811461473057600080fd5b50565b61473c81614359565b811461474757600080fd5b50565b6147538161436b565b811461475e57600080fd5b50565b61476a8161437d565b811461477557600080fd5b50565b614781816143a6565b811461478c57600080fd5b50565b614798816143ee565b81146147a357600080fd5b5056fe00010203040506070809ffffffffffffff0a0b0c0d0e0f101112131415161718191a1b1c1d1e1fffffffffffffffffffff0a0b0c0d0e0f101112131415161718191a1b1c1d1e1fa26469706673582212200863ca5c6fb425baca4f13e2cb90134252c9ba773757e3a584f08f724650c50164736f6c63430008040033", + "devdoc": { + "kind": "dev", + "methods": { + "constructor": { + "details": "Constructor.", + "params": { + "_anchors": "The binary format RR entries for the root DS records." + } + }, + "deleteRRSet(uint16,bytes,(bytes,bytes),bytes)": { + "details": "Deletes an RR from the oracle.", + "params": { + "deleteName": "which you want to delete", + "deleteType": "The DNS record type to delete.", + "nsec": "The signed NSEC RRset. This is in the format described in section 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature data, followed by a series of canonicalised RR records that the signature applies to." + } + }, + "deleteRRSetNSEC3(uint16,bytes,(bytes,bytes),(bytes,bytes),bytes)": { + "details": "Deletes an RR from the oracle using an NSEC3 proof. Deleting a record using NSEC3 requires using up to two NSEC3 records. There are two cases: 1. The name exists, but the record type doesn't. Eg, example.com has A records but no TXT records. 2. The name does not exist, but a parent name does. In the first case, we submit one NSEC3 proof in `closestEncloser` that matches the target name but does not have the bit for `deleteType` set in its type bitmap. In the second case, we submit two proofs: closestEncloser and nextClosest, that together prove that the name does not exist. NSEC3 records are in the format described in section 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature data, followed by a series of canonicalised RR records that the signature applies to.", + "params": { + "closestEncloser": "An NSEC3 proof matching the closest enclosing name - that is, the nearest ancestor of the target name that *does* exist.", + "deleteName": "The name to delete.", + "deleteType": "The DNS record type to delete.", + "dnskey": "An encoded DNSKEY record that has already been submitted to the oracle and can be used to verify the signatures closestEncloserSig and nextClosestSig", + "nextClosest": "An NSEC3 proof covering the next closest name. This proves that the immediate subdomain of the closestEncloser does not exist." + } + }, + "rrdata(uint16,bytes)": { + "details": "Returns data about the RRs (if any) known to this oracle with the provided type and name.", + "params": { + "dnstype": "The DNS record type to query.", + "name": "The name to query, in DNS label-sequence format." + }, + "returns": { + "_0": "inception The unix timestamp (wrapped) at which the signature for this RRSET was created.", + "_1": "expiration The unix timestamp (wrapped) at which the signature for this RRSET expires.", + "_2": "hash The hash of the RRset." + } + }, + "setAlgorithm(uint8,address)": { + "details": "Sets the contract address for a signature verification algorithm. Callable only by the owner.", + "params": { + "algo": "The address of the algorithm contract.", + "id": "The algorithm ID" + } + }, + "setDigest(uint8,address)": { + "details": "Sets the contract address for a digest verification algorithm. Callable only by the owner.", + "params": { + "digest": "The address of the digest contract.", + "id": "The digest ID" + } + }, + "setNSEC3Digest(uint8,address)": { + "details": "Sets the contract address for an NSEC3 digest algorithm. Callable only by the owner.", + "params": { + "digest": "The address of the digest contract.", + "id": "The digest ID" + } + }, + "submitRRSet((bytes,bytes),bytes)": { + "details": "Submits a signed set of RRs to the oracle. RRSETs are only accepted if they are signed with a key that is already trusted, or if they are self-signed, and the signing key is identified by a DS record that is already trusted.", + "params": { + "input": "The signed RR set. This is in the format described in section 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature data, followed by a series of canonicalised RR records that the signature applies to.", + "proof": "The DNSKEY or DS to validate the signature against. Must Already have been submitted and proved previously." + } + }, + "submitRRSets((bytes,bytes)[],bytes)": { + "details": "Submits multiple RRSets", + "params": { + "_proof": "The DNSKEY or DS to validate the first signature against.", + "input": "A list of RRSets and signatures forming a chain of trust from an existing known-good record." + }, + "returns": { + "_0": "The last RRSET submitted." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 2402, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "anchors", + "offset": 0, + "slot": "0", + "type": "t_bytes_storage" + }, + { + "astId": 4242, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "owner", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 2567, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "rrsets", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_bytes32,t_mapping(t_uint16,t_struct(RRSet)2560_storage))" + }, + { + "astId": 2572, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "algorithms", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint8,t_contract(Algorithm)5633)" + }, + { + "astId": 2577, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "digests", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_uint8,t_contract(Digest)5647)" + }, + { + "astId": 2582, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "nsec3Digests", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_uint8,t_contract(NSEC3Digest)5663)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes20": { + "encoding": "inplace", + "label": "bytes20", + "numberOfBytes": "20" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(Algorithm)5633": { + "encoding": "inplace", + "label": "contract Algorithm", + "numberOfBytes": "20" + }, + "t_contract(Digest)5647": { + "encoding": "inplace", + "label": "contract Digest", + "numberOfBytes": "20" + }, + "t_contract(NSEC3Digest)5663": { + "encoding": "inplace", + "label": "contract NSEC3Digest", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes32,t_mapping(t_uint16,t_struct(RRSet)2560_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint16 => struct DNSSECImpl.RRSet))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint16,t_struct(RRSet)2560_storage)" + }, + "t_mapping(t_uint16,t_struct(RRSet)2560_storage)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => struct DNSSECImpl.RRSet)", + "numberOfBytes": "32", + "value": "t_struct(RRSet)2560_storage" + }, + "t_mapping(t_uint8,t_contract(Algorithm)5633)": { + "encoding": "mapping", + "key": "t_uint8", + "label": "mapping(uint8 => contract Algorithm)", + "numberOfBytes": "32", + "value": "t_contract(Algorithm)5633" + }, + "t_mapping(t_uint8,t_contract(Digest)5647)": { + "encoding": "mapping", + "key": "t_uint8", + "label": "mapping(uint8 => contract Digest)", + "numberOfBytes": "32", + "value": "t_contract(Digest)5647" + }, + "t_mapping(t_uint8,t_contract(NSEC3Digest)5663)": { + "encoding": "mapping", + "key": "t_uint8", + "label": "mapping(uint8 => contract NSEC3Digest)", + "numberOfBytes": "32", + "value": "t_contract(NSEC3Digest)5663" + }, + "t_struct(RRSet)2560_storage": { + "encoding": "inplace", + "label": "struct DNSSECImpl.RRSet", + "members": [ + { + "astId": 2555, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "inception", + "offset": 0, + "slot": "0", + "type": "t_uint32" + }, + { + "astId": 2557, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "expiration", + "offset": 4, + "slot": "0", + "type": "t_uint32" + }, + { + "astId": 2559, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "hash", + "offset": 8, + "slot": "0", + "type": "t_bytes20" + } + ], + "numberOfBytes": "32" + }, + "t_uint16": { + "encoding": "inplace", + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/DefaultReverseResolver.json b/solidity/dns-contracts/deployments/ropsten/DefaultReverseResolver.json new file mode 100644 index 0000000..75748f2 --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/DefaultReverseResolver.json @@ -0,0 +1,73 @@ +{ + "address": "0x084b1c3C81545d370f3634392De611CaaBFf8148", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "ensAddr", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "constant": true, + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ] +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/DummyAlgorithm.json b/solidity/dns-contracts/deployments/ropsten/DummyAlgorithm.json new file mode 100644 index 0000000..b90d06f --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/DummyAlgorithm.json @@ -0,0 +1,70 @@ +{ + "address": "0x79456fE8B62C936cCF45D117CDe6bDd184A6182d", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xe8444805fcf350673b3123448ce8cd8dc1552d81e0e42276e2713f70f9d13f72", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x79456fE8B62C936cCF45D117CDe6bDd184A6182d", + "transactionIndex": 6, + "gasUsed": "152065", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x1ed6b8da244de61409dafe892b7a69ecf5d857601ea6efdf7b634da01bbbf855", + "transactionHash": "0xe8444805fcf350673b3123448ce8cd8dc1552d81e0e42276e2713f70f9d13f72", + "logs": [], + "blockNumber": 10645996, + "cumulativeGasUsed": "1462718", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "a50cca78b1bed5d39e9ebe70f5371ee9", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements a dummy DNSSEC (signing) algorithm that approves all signatures, for testing.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol\":\"DummyAlgorithm\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n*/\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external virtual view returns (bool);\\n}\\n\",\"keccak256\":\"0x51d6251568844e435f58952354abe8c8c8e978ab40ecb0bbb2f5bd767838b3a7\"},\"contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\n\\n/**\\n* @dev Implements a dummy DNSSEC (signing) algorithm that approves all\\n* signatures, for testing.\\n*/\\ncontract DummyAlgorithm is Algorithm {\\n function verify(bytes calldata, bytes calldata, bytes calldata) external override view returns (bool) { return true; }\\n}\\n\",\"keccak256\":\"0x59bb926cf8544aa5624717a2fd5850508ac7dd2a09620b05799b4ee00b708b2d\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506101ca806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004a600480360381019061004591906100ba565b610060565b604051610057919061016d565b60405180910390f35b6000600190509695505050505050565b60008083601f84011261008257600080fd5b8235905067ffffffffffffffff81111561009b57600080fd5b6020830191508360018202830111156100b357600080fd5b9250929050565b600080600080600080606087890312156100d357600080fd5b600087013567ffffffffffffffff8111156100ed57600080fd5b6100f989828a01610070565b9650965050602087013567ffffffffffffffff81111561011857600080fd5b61012489828a01610070565b9450945050604087013567ffffffffffffffff81111561014357600080fd5b61014f89828a01610070565b92509250509295509295509295565b61016781610188565b82525050565b6000602082019050610182600083018461015e565b92915050565b6000811515905091905056fea26469706673582212202bd735fbfbac3f59fb2f61586d9b6aaaa5eb85678261893d3270e9f1a0151c9464736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004a600480360381019061004591906100ba565b610060565b604051610057919061016d565b60405180910390f35b6000600190509695505050505050565b60008083601f84011261008257600080fd5b8235905067ffffffffffffffff81111561009b57600080fd5b6020830191508360018202830111156100b357600080fd5b9250929050565b600080600080600080606087890312156100d357600080fd5b600087013567ffffffffffffffff8111156100ed57600080fd5b6100f989828a01610070565b9650965050602087013567ffffffffffffffff81111561011857600080fd5b61012489828a01610070565b9450945050604087013567ffffffffffffffff81111561014357600080fd5b61014f89828a01610070565b92509250509295509295509295565b61016781610188565b82525050565b6000602082019050610182600083018461015e565b92915050565b6000811515905091905056fea26469706673582212202bd735fbfbac3f59fb2f61586d9b6aaaa5eb85678261893d3270e9f1a0151c9464736f6c63430008040033", + "devdoc": { + "details": "Implements a dummy DNSSEC (signing) algorithm that approves all signatures, for testing.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/DummyDigest.json b/solidity/dns-contracts/deployments/ropsten/DummyDigest.json new file mode 100644 index 0000000..a7d9074 --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/DummyDigest.json @@ -0,0 +1,65 @@ +{ + "address": "0x1206D34F8Dfc05d48EbB7E41d2FFA0A4858361C3", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x0af42dd6e8ed313f420e079b10c5d16f7a7053b51658845c7632c9868ead6968", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x1206D34F8Dfc05d48EbB7E41d2FFA0A4858361C3", + "transactionIndex": 6, + "gasUsed": "141505", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x7ed5758d05466ba6f282021d4ef4d16768dcd1391753fd1ac18a99f1fb678cf4", + "transactionHash": "0x0af42dd6e8ed313f420e079b10c5d16f7a7053b51658845c7632c9868ead6968", + "logs": [], + "blockNumber": 10646000, + "cumulativeGasUsed": "856198", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "a50cca78b1bed5d39e9ebe70f5371ee9", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements a dummy DNSSEC digest that approves all hashes, for testing.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/digests/DummyDigest.sol\":\"DummyDigest\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev An interface for contracts implementing a DNSSEC digest.\\n*/\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(bytes calldata data, bytes calldata hash) external virtual pure returns (bool);\\n}\\n\",\"keccak256\":\"0x259720cef78c019d38b908bc7dd524f087c58d8c40792cebcdd4e982c628bc9a\"},\"contracts/dnssec-oracle/digests/DummyDigest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Digest.sol\\\";\\n\\n/**\\n* @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\\n*/\\ncontract DummyDigest is Digest {\\n function verify(bytes calldata, bytes calldata) external override pure returns (bool) { return true; }\\n}\\n\",\"keccak256\":\"0x15e3a63572d9325d0e59346e5758181aed1865b934b3422f53cac930c7902c14\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610199806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004a600480360381019061004591906100b8565b610060565b604051610057919061013c565b60405180910390f35b600060019050949350505050565b60008083601f84011261008057600080fd5b8235905067ffffffffffffffff81111561009957600080fd5b6020830191508360018202830111156100b157600080fd5b9250929050565b600080600080604085870312156100ce57600080fd5b600085013567ffffffffffffffff8111156100e857600080fd5b6100f48782880161006e565b9450945050602085013567ffffffffffffffff81111561011357600080fd5b61011f8782880161006e565b925092505092959194509250565b61013681610157565b82525050565b6000602082019050610151600083018461012d565b92915050565b6000811515905091905056fea264697066735822122043bde4b4acc44aa2afbe0d57e0bd3e17827b3bef8343f64b9a5a66a65049467064736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004a600480360381019061004591906100b8565b610060565b604051610057919061013c565b60405180910390f35b600060019050949350505050565b60008083601f84011261008057600080fd5b8235905067ffffffffffffffff81111561009957600080fd5b6020830191508360018202830111156100b157600080fd5b9250929050565b600080600080604085870312156100ce57600080fd5b600085013567ffffffffffffffff8111156100e857600080fd5b6100f48782880161006e565b9450945050602085013567ffffffffffffffff81111561011357600080fd5b61011f8782880161006e565b925092505092959194509250565b61013681610157565b82525050565b6000602082019050610151600083018461012d565b92915050565b6000811515905091905056fea264697066735822122043bde4b4acc44aa2afbe0d57e0bd3e17827b3bef8343f64b9a5a66a65049467064736f6c63430008040033", + "devdoc": { + "details": "Implements a dummy DNSSEC digest that approves all hashes, for testing.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/DummyOracle.json b/solidity/dns-contracts/deployments/ropsten/DummyOracle.json new file mode 100644 index 0000000..9f4947f --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/DummyOracle.json @@ -0,0 +1,95 @@ +{ + "address": "0xbe76a7714EF626A73698ab797EC385c87Bd84a70", + "abi": [ + { + "inputs": [ + { + "internalType": "int256", + "name": "_value", + "type": "int256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "latestAnswer", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int256", + "name": "_value", + "type": "int256" + } + ], + "name": "set", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x9f4b9099f230e55d07f46074df26aa7374ca5717b7b640417ebc3b17613b24b5", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0xbe76a7714EF626A73698ab797EC385c87Bd84a70", + "transactionIndex": 2, + "gasUsed": "114009", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x7270ab3b02639655a613b494cbe95fea96932df58fb9618dc4a7c20b0fe8e407", + "transactionHash": "0x9f4b9099f230e55d07f46074df26aa7374ca5717b7b640417ebc3b17613b24b5", + "logs": [], + "blockNumber": 13019104, + "cumulativeGasUsed": "214937", + "status": 1, + "byzantium": true + }, + "args": [ + "160000000000" + ], + "numDeployments": 1, + "solcInputHash": "9ab134ee99f7410d077d71824d3e2f84", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"_value\",\"type\":\"int256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"_value\",\"type\":\"int256\"}],\"name\":\"set\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/DummyOracle.sol\":\"DummyOracle\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"contracts/ethregistrar/DummyOracle.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ncontract DummyOracle {\\n int256 value;\\n\\n constructor(int256 _value) public {\\n set(_value);\\n }\\n\\n function set(int256 _value) public {\\n value = _value;\\n }\\n\\n function latestAnswer() public view returns (int256) {\\n return value;\\n }\\n}\\n\",\"keccak256\":\"0x8f0d88c42c074c3fb80710f7639cb455a582fa96629e26a974dd6a19c15678ff\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161011138038061011183398101604081905261002f9161003e565b61003881600055565b50610057565b60006020828403121561005057600080fd5b5051919050565b60ac806100656000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806350d25bcd146037578063e5c19b2d14604c575b600080fd5b60005460405190815260200160405180910390f35b605c6057366004605e565b600055565b005b600060208284031215606f57600080fd5b503591905056fea2646970667358221220a8de3ba5e8615edab3cc4519b8f2c3736cd9eaaf1dad97bca592b10503c7a63864736f6c63430008110033", + "deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060325760003560e01c806350d25bcd146037578063e5c19b2d14604c575b600080fd5b60005460405190815260200160405180910390f35b605c6057366004605e565b600055565b005b600060208284031215606f57600080fd5b503591905056fea2646970667358221220a8de3ba5e8615edab3cc4519b8f2c3736cd9eaaf1dad97bca592b10503c7a63864736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3, + "contract": "contracts/ethregistrar/DummyOracle.sol:DummyOracle", + "label": "value", + "offset": 0, + "slot": "0", + "type": "t_int256" + } + ], + "types": { + "t_int256": { + "encoding": "inplace", + "label": "int256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/ENSRegistry.json b/solidity/dns-contracts/deployments/ropsten/ENSRegistry.json new file mode 100644 index 0000000..4b2f5ae --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/ENSRegistry.json @@ -0,0 +1,425 @@ +{ + "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_old", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NewOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "NewResolver", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "NewTTL", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "old", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "recordExists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "resolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setRecord", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "ttl", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ] +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/ETHRegistrarController.json b/solidity/dns-contracts/deployments/ropsten/ETHRegistrarController.json new file mode 100644 index 0000000..3d97646 --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/ETHRegistrarController.json @@ -0,0 +1,765 @@ +{ + "address": "0xa5627AB7Ae47063B533622C34FEBDb52d3281dF8", + "abi": [ + { + "inputs": [ + { + "internalType": "contract BaseRegistrarImplementation", + "name": "_base", + "type": "address" + }, + { + "internalType": "contract IPriceOracle", + "name": "_prices", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minCommitmentAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxCommitmentAge", + "type": "uint256" + }, + { + "internalType": "contract ReverseRegistrar", + "name": "_reverseRegistrar", + "type": "address" + }, + { + "internalType": "contract INameWrapper", + "name": "_nameWrapper", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "CommitmentTooNew", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "CommitmentTooOld", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "DurationTooShort", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientValue", + "type": "error" + }, + { + "inputs": [], + "name": "MaxCommitmentAgeTooHigh", + "type": "error" + }, + { + "inputs": [], + "name": "MaxCommitmentAgeTooLow", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameNotAvailable", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverRequiredWhenDataSupplied", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "Unauthorised", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "UnexpiredCommitmentExists", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "baseCost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "premium", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRenewed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "MIN_REGISTRATION_DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "available", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "commit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "commitments", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "bool", + "name": "reverseRecord", + "type": "bool" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "wrapperExpiry", + "type": "uint64" + } + ], + "name": "makeCommitment", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "maxCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nameWrapper", + "outputs": [ + { + "internalType": "contract INameWrapper", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "prices", + "outputs": [ + { + "internalType": "contract IPriceOracle", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "recoverFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "bool", + "name": "reverseRecord", + "type": "bool" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "wrapperExpiry", + "type": "uint64" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "wrapperExpiry", + "type": "uint64" + } + ], + "name": "renewWithFuses", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "rentPrice", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "base", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "premium", + "type": "uint256" + } + ], + "internalType": "struct IPriceOracle.Price", + "name": "price", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "reverseRegistrar", + "outputs": [ + { + "internalType": "contract ReverseRegistrar", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "valid", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x70ee666425d9c7d10a68c03c9aae371af027ecd3b9503a3ac39bd9efc248797d", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0xa5627AB7Ae47063B533622C34FEBDb52d3281dF8", + "transactionIndex": 15, + "gasUsed": "2127185", + "logsBloom": "0x00000000000000200000000000000000000040000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001000000000000000000000000010000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xc0f9afeb4508c3173f8c19acbcf7f69f3bfdb856cf3f726f94e5a1b012f05526", + "transactionHash": "0x70ee666425d9c7d10a68c03c9aae371af027ecd3b9503a3ac39bd9efc248797d", + "logs": [ + { + "transactionIndex": 15, + "blockNumber": 13068663, + "transactionHash": "0x70ee666425d9c7d10a68c03c9aae371af027ecd3b9503a3ac39bd9efc248797d", + "address": "0xa5627AB7Ae47063B533622C34FEBDb52d3281dF8", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000a303ddc620aa7d1390baccc8a495508b183fab59" + ], + "data": "0x", + "logIndex": 38, + "blockHash": "0xc0f9afeb4508c3173f8c19acbcf7f69f3bfdb856cf3f726f94e5a1b012f05526" + } + ], + "blockNumber": 13068663, + "cumulativeGasUsed": "4240769", + "status": 1, + "byzantium": true + }, + "args": [ + "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85", + "0x0e765d28FABf9E219770CAb07D64967451026bD7", + 60, + 86400, + "0x806246b52f8cB61655d3038c58D2f63Aa55d4edE", + "0xF82155e2a43Be0871821E9654Fc8Ae894FB8307C" + ], + "numDeployments": 2, + "solcInputHash": "e0f6f00faee6ee60a1220d91a962cdaa", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract BaseRegistrarImplementation\",\"name\":\"_base\",\"type\":\"address\"},{\"internalType\":\"contract IPriceOracle\",\"name\":\"_prices\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_minCommitmentAge\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxCommitmentAge\",\"type\":\"uint256\"},{\"internalType\":\"contract ReverseRegistrar\",\"name\":\"_reverseRegistrar\",\"type\":\"address\"},{\"internalType\":\"contract INameWrapper\",\"name\":\"_nameWrapper\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"CommitmentTooNew\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"CommitmentTooOld\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"DurationTooShort\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxCommitmentAgeTooHigh\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxCommitmentAgeTooLow\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NameNotAvailable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverRequiredWhenDataSupplied\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"Unauthorised\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"UnexpiredCommitmentExists\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"baseCost\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameRenewed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MIN_REGISTRATION_DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"available\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"commit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"commitments\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"bool\",\"name\":\"reverseRecord\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"wrapperExpiry\",\"type\":\"uint64\"}],\"name\":\"makeCommitment\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxCommitmentAge\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minCommitmentAge\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nameWrapper\",\"outputs\":[{\"internalType\":\"contract INameWrapper\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"prices\",\"outputs\":[{\"internalType\":\"contract IPriceOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"recoverFunds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"bool\",\"name\":\"reverseRecord\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"wrapperExpiry\",\"type\":\"uint64\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"renew\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"wrapperExpiry\",\"type\":\"uint64\"}],\"name\":\"renewWithFuses\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"rentPrice\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"base\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"}],\"internalType\":\"struct IPriceOracle.Price\",\"name\":\"price\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"reverseRegistrar\",\"outputs\":[{\"internalType\":\"contract ReverseRegistrar\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"valid\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"A registrar controller for registering and renewing names at fixed cost.\",\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"recoverFunds(address,address,uint256)\":{\"details\":\"The contract is Ownable and only the owner can call the recover function.\",\"params\":{\"_amount\":\"The amount of tokens to recover.\",\"_to\":\"The address to send the tokens to.\",\"_token\":\"The address of the ERC20 token to recover\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"recoverFunds(address,address,uint256)\":{\"notice\":\"Recover ERC20 tokens sent to the contract by mistake.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/ETHRegistrarController.sol\":\"ETHRegistrarController\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0x24e0364e503a9bbde94c715d26573a76f14cd2a202d45f96f52134ab806b67b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x8e93de94c9062ebc94fb7e2e3929b0781ac6a2b7772e2f7a59045861c93e5be9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/ERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721.sol\\\";\\nimport \\\"./IERC721Receiver.sol\\\";\\nimport \\\"./extensions/IERC721Metadata.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\nimport \\\"../../utils/Strings.sol\\\";\\nimport \\\"../../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\n * {ERC721Enumerable}.\\n */\\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\\n using Address for address;\\n using Strings for uint256;\\n\\n // Token name\\n string private _name;\\n\\n // Token symbol\\n string private _symbol;\\n\\n // Mapping from token ID to owner address\\n mapping(uint256 => address) private _owners;\\n\\n // Mapping owner address to token count\\n mapping(address => uint256) private _balances;\\n\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) private _tokenApprovals;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IERC721).interfaceId ||\\n interfaceId == type(IERC721Metadata).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721-balanceOf}.\\n */\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\n require(owner != address(0), \\\"ERC721: balance query for the zero address\\\");\\n return _balances[owner];\\n }\\n\\n /**\\n * @dev See {IERC721-ownerOf}.\\n */\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\n address owner = _owners[tokenId];\\n require(owner != address(0), \\\"ERC721: owner query for nonexistent token\\\");\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n require(_exists(tokenId), \\\"ERC721Metadata: URI query for nonexistent token\\\");\\n\\n string memory baseURI = _baseURI();\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\n }\\n\\n /**\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\n * by default, can be overriden in child contracts.\\n */\\n function _baseURI() internal view virtual returns (string memory) {\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual override {\\n address owner = ERC721.ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\n \\\"ERC721: approve caller is not owner nor approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\n require(_exists(tokenId), \\\"ERC721: approved query for nonexistent token\\\");\\n\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC721-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC721-isApprovedForAll}.\\n */\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[owner][operator];\\n }\\n\\n /**\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: transfer caller is not owner nor approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory _data\\n ) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: transfer caller is not owner nor approved\\\");\\n _safeTransfer(from, to, tokenId, _data);\\n }\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * `_data` is additional data, it has no specified format and it is sent in call to `to`.\\n *\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeTransfer(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory _data\\n ) internal virtual {\\n _transfer(from, to, tokenId);\\n require(_checkOnERC721Received(from, to, tokenId, _data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n }\\n\\n /**\\n * @dev Returns whether `tokenId` exists.\\n *\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\n *\\n * Tokens start existing when they are minted (`_mint`),\\n * and stop existing when they are burned (`_burn`).\\n */\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\n return _owners[tokenId] != address(0);\\n }\\n\\n /**\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\n require(_exists(tokenId), \\\"ERC721: operator query for nonexistent token\\\");\\n address owner = ERC721.ownerOf(tokenId);\\n return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));\\n }\\n\\n /**\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\n _safeMint(to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\n */\\n function _safeMint(\\n address to,\\n uint256 tokenId,\\n bytes memory _data\\n ) internal virtual {\\n _mint(to, tokenId);\\n require(\\n _checkOnERC721Received(address(0), to, tokenId, _data),\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\n );\\n }\\n\\n /**\\n * @dev Mints `tokenId` and transfers it to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - `to` cannot be the zero address.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _mint(address to, uint256 tokenId) internal virtual {\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n _beforeTokenTransfer(address(0), to, tokenId);\\n\\n _balances[to] += 1;\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _burn(uint256 tokenId) internal virtual {\\n address owner = ERC721.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId);\\n\\n // Clear approvals\\n _approve(address(0), tokenId);\\n\\n _balances[owner] -= 1;\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId);\\n }\\n\\n /**\\n * @dev Transfers `tokenId` from `from` to `to`.\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _transfer(\\n address from,\\n address to,\\n uint256 tokenId\\n ) internal virtual {\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, tokenId);\\n\\n // Clear approvals from the previous owner\\n _approve(address(0), tokenId);\\n\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits a {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits a {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(\\n address owner,\\n address operator,\\n bool approved\\n ) internal virtual {\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\n * The call is not executed if the target address is not a contract.\\n *\\n * @param from address representing the previous owner of the given token ID\\n * @param to target address that will receive the tokens\\n * @param tokenId uint256 ID of the token to be transferred\\n * @param _data bytes optional data to send along with the call\\n * @return bool whether the call correctly returned the expected magic value\\n */\\n function _checkOnERC721Received(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory _data\\n ) private returns (bool) {\\n if (to.isContract()) {\\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {\\n return retval == IERC721Receiver.onERC721Received.selector;\\n } catch (bytes memory reason) {\\n if (reason.length == 0) {\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n } else {\\n assembly {\\n revert(add(32, reason), mload(reason))\\n }\\n }\\n }\\n } else {\\n return true;\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting\\n * and burning.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\\n * transferred to `to`.\\n * - When `from` is zero, `tokenId` will be minted for `to`.\\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 tokenId\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 tokenId\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0x11b84bb56dc112a6590bfe3e0efa118aa1b5891132342200d04c4ef544cb93de\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x516a22876c1fab47f49b1bc22b4614491cd05338af8bd2e7b382da090a079990\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xd5fa74b4fb323776fa4a8158800fec9d5ac0fec0d6dd046dd93798632ada265f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721Metadata is IERC721 {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n}\\n\",\"keccak256\":\"0x32c202bd28995dd20c4347b7c6467a6d3241c74c8ad3edcbb610cd9205916c45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/ethregistrar/BaseRegistrarImplementation.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/ERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\\n // A map of expiry times\\n mapping(uint256 => uint256) expiries;\\n // The ENS registry\\n ENS public ens;\\n // The namehash of the TLD this registrar owns (eg, .eth)\\n bytes32 public baseNode;\\n // A map of addresses that are authorised to register and renew names.\\n mapping(address => bool) public controllers;\\n uint256 public constant GRACE_PERIOD = 90 days;\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n bytes4 private constant ERC721_ID =\\n bytes4(\\n keccak256(\\\"balanceOf(address)\\\") ^\\n keccak256(\\\"ownerOf(uint256)\\\") ^\\n keccak256(\\\"approve(address,uint256)\\\") ^\\n keccak256(\\\"getApproved(uint256)\\\") ^\\n keccak256(\\\"setApprovalForAll(address,bool)\\\") ^\\n keccak256(\\\"isApprovedForAll(address,address)\\\") ^\\n keccak256(\\\"transferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256,bytes)\\\")\\n );\\n bytes4 private constant RECLAIM_ID =\\n bytes4(keccak256(\\\"reclaim(uint256,address)\\\"));\\n\\n /**\\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\\n * @dev Returns whether the given spender can transfer a given token ID\\n * @param spender address of the spender to query\\n * @param tokenId uint256 ID of the token to be transferred\\n * @return bool whether the msg.sender is approved for the given token ID,\\n * is an operator of the owner, or is the owner of the token\\n */\\n function _isApprovedOrOwner(address spender, uint256 tokenId)\\n internal\\n view\\n override\\n returns (bool)\\n {\\n address owner = ownerOf(tokenId);\\n return (spender == owner ||\\n getApproved(tokenId) == spender ||\\n isApprovedForAll(owner, spender));\\n }\\n\\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\\\"\\\", \\\"\\\") {\\n ens = _ens;\\n baseNode = _baseNode;\\n }\\n\\n modifier live() {\\n require(ens.owner(baseNode) == address(this));\\n _;\\n }\\n\\n modifier onlyController() {\\n require(controllers[msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Gets the owner of the specified token ID. Names become unowned\\n * when their registration expires.\\n * @param tokenId uint256 ID of the token to query the owner of\\n * @return address currently marked as the owner of the given token ID\\n */\\n function ownerOf(uint256 tokenId)\\n public\\n view\\n override(IERC721, ERC721)\\n returns (address)\\n {\\n require(expiries[tokenId] > block.timestamp);\\n return super.ownerOf(tokenId);\\n }\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external override onlyOwner {\\n controllers[controller] = true;\\n emit ControllerAdded(controller);\\n }\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external override onlyOwner {\\n controllers[controller] = false;\\n emit ControllerRemoved(controller);\\n }\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external override onlyOwner {\\n ens.setResolver(baseNode, resolver);\\n }\\n\\n // Returns the expiration timestamp of the specified id.\\n function nameExpires(uint256 id) external view override returns (uint256) {\\n return expiries[id];\\n }\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) public view override returns (bool) {\\n // Not available if it's registered here or in its grace period.\\n return expiries[id] + GRACE_PERIOD < block.timestamp;\\n }\\n\\n /**\\n * @dev Register a name.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external override returns (uint256) {\\n return _register(id, owner, duration, true);\\n }\\n\\n /**\\n * @dev Register a name, without modifying the registry.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function registerOnly(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256) {\\n return _register(id, owner, duration, false);\\n }\\n\\n function _register(\\n uint256 id,\\n address owner,\\n uint256 duration,\\n bool updateRegistry\\n ) internal live onlyController returns (uint256) {\\n require(available(id));\\n require(\\n block.timestamp + duration + GRACE_PERIOD >\\n block.timestamp + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] = block.timestamp + duration;\\n if (_exists(id)) {\\n // Name was previously owned, and expired\\n _burn(id);\\n }\\n _mint(owner, id);\\n if (updateRegistry) {\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n emit NameRegistered(id, owner, block.timestamp + duration);\\n\\n return block.timestamp + duration;\\n }\\n\\n function renew(uint256 id, uint256 duration)\\n external\\n override\\n live\\n onlyController\\n returns (uint256)\\n {\\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\\n require(\\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] += duration;\\n emit NameRenewed(id, expiries[id]);\\n return expiries[id];\\n }\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external override live {\\n require(_isApprovedOrOwner(msg.sender, id));\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n public\\n view\\n override(ERC721, IERC165)\\n returns (bool)\\n {\\n return\\n interfaceID == INTERFACE_META_ID ||\\n interfaceID == ERC721_ID ||\\n interfaceID == RECLAIM_ID;\\n }\\n}\\n\",\"keccak256\":\"0xb757a151137d4b1b877773226797c8f95a4320cd3d68c7c2cfa588b22f5438ed\"},\"contracts/ethregistrar/ETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport {BaseRegistrarImplementation} from \\\"./BaseRegistrarImplementation.sol\\\";\\nimport {StringUtils} from \\\"./StringUtils.sol\\\";\\nimport {Resolver} from \\\"../resolvers/Resolver.sol\\\";\\nimport {ReverseRegistrar} from \\\"../registry/ReverseRegistrar.sol\\\";\\nimport {IETHRegistrarController, IPriceOracle} from \\\"./IETHRegistrarController.sol\\\";\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {INameWrapper} from \\\"../wrapper/INameWrapper.sol\\\";\\nimport {ERC20Recoverable} from \\\"../utils/ERC20Recoverable.sol\\\";\\n\\nerror CommitmentTooNew(bytes32 commitment);\\nerror CommitmentTooOld(bytes32 commitment);\\nerror NameNotAvailable(string name);\\nerror DurationTooShort(uint256 duration);\\nerror ResolverRequiredWhenDataSupplied();\\nerror UnexpiredCommitmentExists(bytes32 commitment);\\nerror InsufficientValue();\\nerror Unauthorised(bytes32 node);\\nerror MaxCommitmentAgeTooLow();\\nerror MaxCommitmentAgeTooHigh();\\n\\n/**\\n * @dev A registrar controller for registering and renewing names at fixed cost.\\n */\\ncontract ETHRegistrarController is\\n Ownable,\\n IETHRegistrarController,\\n IERC165,\\n ERC20Recoverable\\n{\\n using StringUtils for *;\\n using Address for address;\\n\\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\\n bytes32 private constant ETH_NODE =\\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\\n uint64 private constant MAX_EXPIRY = type(uint64).max;\\n BaseRegistrarImplementation immutable base;\\n IPriceOracle public immutable prices;\\n uint256 public immutable minCommitmentAge;\\n uint256 public immutable maxCommitmentAge;\\n ReverseRegistrar public immutable reverseRegistrar;\\n INameWrapper public immutable nameWrapper;\\n\\n mapping(bytes32 => uint256) public commitments;\\n\\n event NameRegistered(\\n string name,\\n bytes32 indexed label,\\n address indexed owner,\\n uint256 baseCost,\\n uint256 premium,\\n uint256 expires\\n );\\n event NameRenewed(\\n string name,\\n bytes32 indexed label,\\n uint256 cost,\\n uint256 expires\\n );\\n\\n constructor(\\n BaseRegistrarImplementation _base,\\n IPriceOracle _prices,\\n uint256 _minCommitmentAge,\\n uint256 _maxCommitmentAge,\\n ReverseRegistrar _reverseRegistrar,\\n INameWrapper _nameWrapper\\n ) {\\n if (_maxCommitmentAge <= _minCommitmentAge) {\\n revert MaxCommitmentAgeTooLow();\\n }\\n\\n if (_maxCommitmentAge > block.timestamp) {\\n revert MaxCommitmentAgeTooHigh();\\n }\\n\\n base = _base;\\n prices = _prices;\\n minCommitmentAge = _minCommitmentAge;\\n maxCommitmentAge = _maxCommitmentAge;\\n reverseRegistrar = _reverseRegistrar;\\n nameWrapper = _nameWrapper;\\n }\\n\\n function rentPrice(string memory name, uint256 duration)\\n public\\n view\\n override\\n returns (IPriceOracle.Price memory price)\\n {\\n bytes32 label = keccak256(bytes(name));\\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\\n }\\n\\n function valid(string memory name) public pure returns (bool) {\\n return name.strlen() >= 3;\\n }\\n\\n function available(string memory name) public view override returns (bool) {\\n bytes32 label = keccak256(bytes(name));\\n return valid(name) && base.available(uint256(label));\\n }\\n\\n function makeCommitment(\\n string memory name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] calldata data,\\n bool reverseRecord,\\n uint32 fuses,\\n uint64 wrapperExpiry\\n ) public pure override returns (bytes32) {\\n bytes32 label = keccak256(bytes(name));\\n if (data.length > 0 && resolver == address(0)) {\\n revert ResolverRequiredWhenDataSupplied();\\n }\\n return\\n keccak256(\\n abi.encode(\\n label,\\n owner,\\n duration,\\n resolver,\\n data,\\n secret,\\n reverseRecord,\\n fuses,\\n wrapperExpiry\\n )\\n );\\n }\\n\\n function commit(bytes32 commitment) public override {\\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\\n revert UnexpiredCommitmentExists(commitment);\\n }\\n commitments[commitment] = block.timestamp;\\n }\\n\\n function register(\\n string calldata name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] calldata data,\\n bool reverseRecord,\\n uint32 fuses,\\n uint64 wrapperExpiry\\n ) public payable override {\\n IPriceOracle.Price memory price = rentPrice(name, duration);\\n if (msg.value < price.base + price.premium) {\\n revert InsufficientValue();\\n }\\n\\n _consumeCommitment(\\n name,\\n duration,\\n makeCommitment(\\n name,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n fuses,\\n wrapperExpiry\\n )\\n );\\n\\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\\n name,\\n owner,\\n duration,\\n resolver,\\n fuses,\\n wrapperExpiry\\n );\\n\\n if (data.length > 0) {\\n _setRecords(resolver, keccak256(bytes(name)), data);\\n }\\n\\n if (reverseRecord) {\\n _setReverseRecord(name, resolver, msg.sender);\\n }\\n\\n emit NameRegistered(\\n name,\\n keccak256(bytes(name)),\\n owner,\\n price.base,\\n price.premium,\\n expires\\n );\\n\\n if (msg.value > (price.base + price.premium)) {\\n payable(msg.sender).transfer(\\n msg.value - (price.base + price.premium)\\n );\\n }\\n }\\n\\n function renew(string calldata name, uint256 duration)\\n external\\n payable\\n override\\n {\\n _renew(name, duration, 0, 0);\\n }\\n\\n function renewWithFuses(\\n string calldata name,\\n uint256 duration,\\n uint32 fuses,\\n uint64 wrapperExpiry\\n ) external payable {\\n bytes32 labelhash = keccak256(bytes(name));\\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, labelhash));\\n if (!nameWrapper.isTokenOwnerOrApproved(nodehash, msg.sender)) {\\n revert Unauthorised(nodehash);\\n }\\n _renew(name, duration, fuses, wrapperExpiry);\\n }\\n\\n function _renew(\\n string calldata name,\\n uint256 duration,\\n uint32 fuses,\\n uint64 wrapperExpiry\\n ) internal {\\n bytes32 labelhash = keccak256(bytes(name));\\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, labelhash));\\n uint256 tokenId = uint256(labelhash);\\n IPriceOracle.Price memory price = rentPrice(name, duration);\\n if (msg.value < price.base) {\\n revert InsufficientValue();\\n }\\n uint256 expires;\\n if (nameWrapper.isWrapped(nodehash)) {\\n expires = nameWrapper.renew(\\n tokenId,\\n duration,\\n fuses,\\n wrapperExpiry\\n );\\n } else {\\n expires = base.renew(tokenId, duration);\\n }\\n\\n if (msg.value > price.base) {\\n payable(msg.sender).transfer(msg.value - price.base);\\n }\\n\\n emit NameRenewed(name, labelhash, msg.value, expires);\\n }\\n\\n function withdraw() public {\\n payable(owner()).transfer(address(this).balance);\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n external\\n pure\\n returns (bool)\\n {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IETHRegistrarController).interfaceId;\\n }\\n\\n /* Internal functions */\\n\\n function _consumeCommitment(\\n string memory name,\\n uint256 duration,\\n bytes32 commitment\\n ) internal {\\n // Require an old enough commitment.\\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\\n revert CommitmentTooNew(commitment);\\n }\\n\\n // If the commitment is too old, or the name is registered, stop\\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\\n revert CommitmentTooOld(commitment);\\n }\\n if (!available(name)) {\\n revert NameNotAvailable(name);\\n }\\n\\n delete (commitments[commitment]);\\n\\n if (duration < MIN_REGISTRATION_DURATION) {\\n revert DurationTooShort(duration);\\n }\\n }\\n\\n function _setRecords(\\n address resolverAddress,\\n bytes32 label,\\n bytes[] calldata data\\n ) internal {\\n // use hardcoded .eth namehash\\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\\n Resolver resolver = Resolver(resolverAddress);\\n resolver.multicallWithNodeCheck(nodehash, data);\\n }\\n\\n function _setReverseRecord(\\n string memory name,\\n address resolver,\\n address owner\\n ) internal {\\n reverseRegistrar.setNameForAddr(\\n msg.sender,\\n owner,\\n resolver,\\n string.concat(name, \\\".eth\\\")\\n );\\n }\\n}\\n\",\"keccak256\":\"0x88fa793320fc7f510b0b3a9286664b8ac76c5b27da90b25d370854757b0dfecd\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x9ac51351ff72d73083aed62b7cdad4c07e9d1eb68401d7fd8457bdd828f2c6fe\"},\"contracts/ethregistrar/IETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./IPriceOracle.sol\\\";\\n\\ninterface IETHRegistrarController {\\n function rentPrice(string memory, uint256)\\n external\\n returns (IPriceOracle.Price memory);\\n\\n function available(string memory) external returns (bool);\\n\\n function makeCommitment(\\n string memory,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint32,\\n uint64\\n ) external returns (bytes32);\\n\\n function commit(bytes32) external;\\n\\n function register(\\n string calldata,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint32,\\n uint64\\n ) external payable;\\n\\n function renew(string calldata, uint256) external payable;\\n}\\n\",\"keccak256\":\"0x999c1c3386cfef6a52b86b33a45820d551366141db8c5915740895c9f2425772\",\"license\":\"MIT\"},\"contracts/ethregistrar/IPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\ninterface IPriceOracle {\\n struct Price {\\n uint256 base;\\n uint256 premium;\\n }\\n\\n /**\\n * @dev Returns the price to register or renew a name.\\n * @param name The name being registered or renewed.\\n * @param expires When the name presently expires (0 if this is a new registration).\\n * @param duration How long the name is being registered or extended for, in seconds.\\n * @return base premium tuple of base price + premium price\\n */\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (Price calldata);\\n}\\n\",\"keccak256\":\"0x1ec537b4c7f9cc40363b39dcc7ade8c29bf94662e6b01d38e681487637bd577e\",\"license\":\"MIT\"},\"contracts/ethregistrar/StringUtils.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary StringUtils {\\n /**\\n * @dev Returns the length of a given string\\n *\\n * @param s The string to measure the length of\\n * @return The length of the input string\\n */\\n function strlen(string memory s) internal pure returns (uint256) {\\n uint256 len;\\n uint256 i = 0;\\n uint256 bytelength = bytes(s).length;\\n for (len = 0; i < bytelength; len++) {\\n bytes1 b = bytes(s)[i];\\n if (b < 0x80) {\\n i += 1;\\n } else if (b < 0xE0) {\\n i += 2;\\n } else if (b < 0xF0) {\\n i += 3;\\n } else if (b < 0xF8) {\\n i += 4;\\n } else if (b < 0xFC) {\\n i += 5;\\n } else {\\n i += 6;\\n }\\n }\\n return len;\\n }\\n}\\n\",\"keccak256\":\"0x4cc8363a850dc9130c433ee50e7c97e29a45ae5d9bd0808205ac7134b34f24e4\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(address owner, address operator)\\n external\\n view\\n returns (bool);\\n}\\n\",\"keccak256\":\"0xf79be82c1a2eb0a77fba4e0972221912e803309081ca460fd2cf61653e55758a\"},\"contracts/registry/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(address owner, address resolver)\\n external\\n returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0xd6ba83973ffbab31dec17a716af3bb5703844d16dceb5078583fb2c509f8bcc2\"},\"contracts/registry/ReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"./ENS.sol\\\";\\nimport \\\"./IReverseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"../root/Controllable.sol\\\";\\n\\nabstract contract NameResolver {\\n function setName(bytes32 node, string memory name) public virtual;\\n}\\n\\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\\n\\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n// namehash('addr.reverse')\\n\\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\\n ENS public immutable ens;\\n NameResolver public defaultResolver;\\n\\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\\n event DefaultResolverChanged(NameResolver indexed resolver);\\n\\n /**\\n * @dev Constructor\\n * @param ensAddr The address of the ENS registry.\\n */\\n constructor(ENS ensAddr) {\\n ens = ensAddr;\\n\\n // Assign ownership of the reverse record to our deployer\\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\\n ensAddr.owner(ADDR_REVERSE_NODE)\\n );\\n if (address(oldRegistrar) != address(0x0)) {\\n oldRegistrar.claim(msg.sender);\\n }\\n }\\n\\n modifier authorised(address addr) {\\n require(\\n addr == msg.sender ||\\n controllers[msg.sender] ||\\n ens.isApprovedForAll(addr, msg.sender) ||\\n ownsContract(addr),\\n \\\"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\\\"\\n );\\n _;\\n }\\n\\n function setDefaultResolver(address resolver) public override onlyOwner {\\n require(\\n address(resolver) != address(0),\\n \\\"ReverseRegistrar: Resolver address must not be 0\\\"\\n );\\n defaultResolver = NameResolver(resolver);\\n emit DefaultResolverChanged(NameResolver(resolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claim(address owner) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, address(defaultResolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param addr The reverse record to set\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The resolver of the reverse node\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) public override authorised(addr) returns (bytes32) {\\n bytes32 labelHash = sha3HexAddress(addr);\\n bytes32 reverseNode = keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\\n );\\n emit ReverseClaimed(addr, reverseNode);\\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\\n return reverseNode;\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimWithResolver(address owner, address resolver)\\n public\\n override\\n returns (bytes32)\\n {\\n return claimForAddr(msg.sender, owner, resolver);\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the calling account. First updates the resolver to the default reverse\\n * resolver if necessary.\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setName(string memory name) public override returns (bytes32) {\\n return\\n setNameForAddr(\\n msg.sender,\\n msg.sender,\\n address(defaultResolver),\\n name\\n );\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the account provided. Updates the resolver to a designated resolver\\n * Only callable by controllers and authorised users\\n * @param addr The reverse record to set\\n * @param owner The owner of the reverse node\\n * @param resolver The resolver of the reverse node\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) public override returns (bytes32) {\\n bytes32 node = claimForAddr(addr, owner, resolver);\\n NameResolver(resolver).setName(node, name);\\n return node;\\n }\\n\\n /**\\n * @dev Returns the node hash for a given account's reverse records.\\n * @param addr The address to hash\\n * @return The ENS node hash.\\n */\\n function node(address addr) public pure override returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\\n );\\n }\\n\\n /**\\n * @dev An optimised function to compute the sha3 of the lower-case\\n * hexadecimal representation of an Ethereum address.\\n * @param addr The address to hash\\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\\n * input address.\\n */\\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\\n assembly {\\n for {\\n let i := 40\\n } gt(i, 0) {\\n\\n } {\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n }\\n\\n ret := keccak256(0, 40)\\n }\\n }\\n\\n function ownsContract(address addr) internal view returns (bool) {\\n try Ownable(addr).owner() returns (address owner) {\\n return owner == msg.sender;\\n } catch {\\n return false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4430930561750d2de1163f7b7ba22ae003a7684394371e90a04374859a2337cf\"},\"contracts/resolvers/Resolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"./profiles/IABIResolver.sol\\\";\\nimport \\\"./profiles/IAddressResolver.sol\\\";\\nimport \\\"./profiles/IAddrResolver.sol\\\";\\nimport \\\"./profiles/IContentHashResolver.sol\\\";\\nimport \\\"./profiles/IDNSRecordResolver.sol\\\";\\nimport \\\"./profiles/IDNSZoneResolver.sol\\\";\\nimport \\\"./profiles/IInterfaceResolver.sol\\\";\\nimport \\\"./profiles/INameResolver.sol\\\";\\nimport \\\"./profiles/IPubkeyResolver.sol\\\";\\nimport \\\"./profiles/ITextResolver.sol\\\";\\nimport \\\"./profiles/IExtendedResolver.sol\\\";\\n\\n/**\\n * A generic resolver interface which includes all the functions including the ones deprecated\\n */\\ninterface Resolver is\\n IERC165,\\n IABIResolver,\\n IAddressResolver,\\n IAddrResolver,\\n IContentHashResolver,\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n IInterfaceResolver,\\n INameResolver,\\n IPubkeyResolver,\\n ITextResolver,\\n IExtendedResolver\\n{\\n /* Deprecated events */\\n event ContentChanged(bytes32 indexed node, bytes32 hash);\\n\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external;\\n\\n function setAddr(bytes32 node, address addr) external;\\n\\n function setAddr(\\n bytes32 node,\\n uint256 coinType,\\n bytes calldata a\\n ) external;\\n\\n function setContenthash(bytes32 node, bytes calldata hash) external;\\n\\n function setDnsrr(bytes32 node, bytes calldata data) external;\\n\\n function setName(bytes32 node, string calldata _name) external;\\n\\n function setPubkey(\\n bytes32 node,\\n bytes32 x,\\n bytes32 y\\n ) external;\\n\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external;\\n\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external;\\n\\n function multicall(bytes[] calldata data)\\n external\\n returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(bytes32 nodehash, bytes[] calldata data)\\n external\\n returns (bytes[] memory results);\\n\\n /* Deprecated functions */\\n function content(bytes32 node) external view returns (bytes32);\\n\\n function multihash(bytes32 node) external view returns (bytes memory);\\n\\n function setContent(bytes32 node, bytes32 hash) external;\\n\\n function setMultihash(bytes32 node, bytes calldata hash) external;\\n}\\n\",\"keccak256\":\"0x73b6cd44b0ed803083996abd3d2683f2444731b6486045f8274c44fce66bf939\",\"license\":\"MIT\"},\"contracts/resolvers/ResolverBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"./profiles/IVersionableResolver.sol\\\";\\n\\nabstract contract ResolverBase is ERC165, IVersionableResolver {\\n mapping(bytes32 => uint64) public recordVersions;\\n\\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\\n\\n modifier authorised(bytes32 node) {\\n require(isAuthorised(node));\\n _;\\n }\\n\\n /**\\n * Increments the record version associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function clearRecords(bytes32 node) public virtual authorised(node) {\\n recordVersions[node]++;\\n emit VersionChanged(node, recordVersions[node]);\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n public\\n view\\n virtual\\n override\\n returns (bool)\\n {\\n return\\n interfaceID == type(IVersionableResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x99887f8890c62800bfe702dd67e36453a7017f05a368017c1187366bd98bc0a6\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"./IABIResolver.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(bytes32 node, uint256 contentTypes)\\n external\\n view\\n returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0xc6db25d9b07ea925c64bb777f00ba557e99fbccd4c30c20e5a1b5cd8c159dcbf\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(bytes32 node, uint256 coinType)\\n external\\n view\\n returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x37221203e063dee5aa2a067a6ab3401e9cca41cce5b15230994b6ea377f05ed5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(bytes memory name, bytes memory data)\\n external\\n view\\n returns (bytes memory, address);\\n}\\n\",\"keccak256\":\"0x0a586a1725cdc5f90f2e302c620a4a033adfc87e49bbcc5a43604ba579bce7a7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(bytes32 node, bytes4 interfaceID)\\n external\\n view\\n returns (address);\\n}\\n\",\"keccak256\":\"0x6d75d6010016684030e13711b3bc1a4e1a784c7398937f1b7c2b2f328f962c2b\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(bytes32 node, string calldata key)\\n external\\n view\\n returns (string memory);\\n}\\n\",\"keccak256\":\"0xcc5eada60de63f42f47a4bbc8a5d2bed4cd1394646197a08da7957c6fd90ba5d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IVersionableResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IVersionableResolver {\\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\\n\\n function recordVersions(bytes32 node) external view returns (uint64);\\n}\\n\",\"keccak256\":\"0xd0d09596f20c57bafb2ffa8521a8c57120e9af6c6b194f9c689d4da56f91a57c\",\"license\":\"MIT\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"},\"contracts/utils/ERC20Recoverable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\\n */\\n\\ncontract ERC20Recoverable is Ownable {\\n /**\\n @notice Recover ERC20 tokens sent to the contract by mistake.\\n @dev The contract is Ownable and only the owner can call the recover function.\\n @param _to The address to send the tokens to.\\n@param _token The address of the ERC20 token to recover\\n @param _amount The amount of tokens to recover.\\n */\\n function recoverFunds(\\n address _token,\\n address _to,\\n uint256 _amount\\n ) external onlyOwner {\\n IERC20(_token).transfer(_to, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x793a38091e1f81499a29ddba82c2b2f3cdd07071b81a832886e8e02a45ff352a\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant PARENT_CANNOT_CONTROL = 64;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 _expiry,\\n address resolver\\n ) external returns (uint64 expiry);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (uint256 expires);\\n\\n function unwrap(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function setFuses(bytes32 node, uint32 fuses)\\n external\\n returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function isTokenOwnerOrApproved(bytes32 node, address addr)\\n external\\n returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external returns (address owner);\\n\\n function getData(uint256 id)\\n external\\n returns (\\n address,\\n uint32,\\n uint64\\n );\\n\\n function allFusesBurned(bytes32 node, uint32 fuseMask)\\n external\\n view\\n returns (bool);\\n\\n function isWrapped(bytes32 node) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x9c0ff4675d7faf51638138ecfc76a1f50c1005d1005bfba31c1cac7990a43c30\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101406040523480156200001257600080fd5b50604051620027783803806200277883398101604081905262000035916200011a565b6200004033620000b1565b83831162000061576040516307cb550760e31b815260040160405180910390fd5b428311156200008357604051630b4319e560e21b815260040160405180910390fd5b6001600160a01b0395861660805293851660a05260c09290925260e052821661010052166101205262000197565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200011757600080fd5b50565b60008060008060008060c087890312156200013457600080fd5b8651620001418162000101565b6020880151909650620001548162000101565b8095505060408701519350606087015192506080870151620001768162000101565b60a0880151909250620001898162000101565b809150509295509295509295565b60805160a05160c05160e0516101005161012051612544620002346000396000818161038d0152818161074f015281816109e4015281816111bc015261129301526000818161022801526117410152600081816103f401528181610f03015261156901526000818161030e01526114f20152600081816104280152610c30015260008181610c7201528181610db7015261135201526125446000f3fe60806040526004361061016a5760003560e01c80638d839ffe116100cb578063aeb8ce9b1161007f578063d555254a11610059578063d555254a1461044a578063f14fcbc81461046a578063f2fde38b1461048a57600080fd5b8063aeb8ce9b146103c2578063ce1e09c0146103e2578063d3419bf31461041657600080fd5b80639791c097116100b05780639791c0971461035b578063a8e5fbc01461037b578063acf1a841146103af57600080fd5b80638d839ffe146102fc5780638da5cb5b1461033057600080fd5b80637acaaf2611610122578063839df94511610107578063839df9451461026f57806383e7f6ff146102aa5780638a95b09f146102e557600080fd5b80637acaaf2614610203578063808698531461021657600080fd5b80635d3590d5116101535780635d3590d5146101bb5780636459220f146101db578063715018a6146101ee57600080fd5b806301ffc9a71461016f5780633ccfd60b146101a4575b600080fd5b34801561017b57600080fd5b5061018f61018a366004611a07565b6104aa565b60405190151581526020015b60405180910390f35b3480156101b057600080fd5b506101b9610543565b005b3480156101c757600080fd5b506101b96101d6366004611a72565b61058d565b6101b96101e9366004611b23565b6106b2565b3480156101fa57600080fd5b506101b9610820565b6101b9610211366004611be4565b6108ad565b34801561022257600080fd5b5061024a7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b34801561027b57600080fd5b5061029c61028a366004611cbd565b60016020526000908152604090205481565b60405190815260200161019b565b3480156102b657600080fd5b506102ca6102c5366004611db4565b610be6565b6040805182518152602092830151928101929092520161019b565b3480156102f157600080fd5b5061029c6224ea0081565b34801561030857600080fd5b5061029c7f000000000000000000000000000000000000000000000000000000000000000081565b34801561033c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff1661024a565b34801561036757600080fd5b5061018f610376366004611df9565b610d46565b34801561038757600080fd5b5061024a7f000000000000000000000000000000000000000000000000000000000000000081565b6101b96103bd366004611e2e565b610d5b565b3480156103ce57600080fd5b5061018f6103dd366004611df9565b610d6e565b3480156103ee57600080fd5b5061029c7f000000000000000000000000000000000000000000000000000000000000000081565b34801561042257600080fd5b5061024a7f000000000000000000000000000000000000000000000000000000000000000081565b34801561045657600080fd5b5061029c610465366004611e7a565b610e3e565b34801561047657600080fd5b506101b9610485366004611cbd565b610eec565b34801561049657600080fd5b506101b96104a5366004611f4d565b610f75565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061053d57507fffffffff0000000000000000000000000000000000000000000000000000000082167fdf7ed18100000000000000000000000000000000000000000000000000000000145b92915050565b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116914780156108fc02929091818181858888f1935050505015801561058a573d6000803e3d6000fd5b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610613576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015610688573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ac9190611f68565b50505050565b600085856040516106c4929190611f85565b604080519182900382207f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae6020840152908201819052915060009060600160408051808303601f190181529082905280516020909101207ff44779b90000000000000000000000000000000000000000000000000000000082526004820181905233602483015291507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063f44779b9906044016020604051808303816000875af11580156107ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d19190611f68565b61080a576040517fe4fd57ae0000000000000000000000000000000000000000000000000000000081526004810182905260240161060a565b61081787878787876110a2565b50505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146108a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161060a565b6108ab6000611466565b565b60006108f08c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d9250610be6915050565b6020810151815191925061090391611fc4565b34101561093c576040517f1101129400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109e08c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508a6109db8f8f8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508e8e8e8e8e8e8e8e8e610e3e565b6114db565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16639f56dac68e8e8e8e8d8a8a6040518863ffffffff1660e01b8152600401610a479796959493929190612002565b6020604051808303816000875af1158015610a66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8a919061206c565b90508515610ab557610ab5888e8e604051610aa6929190611f85565b60405180910390208989611658565b8415610afe57610afe8d8d8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c925033915061173f9050565b8a73ffffffffffffffffffffffffffffffffffffffff168d8d604051610b25929190611f85565b60405180910390207f69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf278f8f8660000151876020015187604051610b6c959493929190612085565b60405180910390a360208201518251610b859190611fc4565b341115610bd7576020820151825133916108fc91610ba39190611fc4565b610bad90346120b6565b6040518115909202916000818181858888f19350505050158015610bd5573d6000803e3d6000fd5b505b50505050505050505050505050565b6040805180820190915260008082526020820152825160208401206040517fd6e4fa86000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff908116916350e9a7159187917f00000000000000000000000000000000000000000000000000000000000000009091169063d6e4fa8690602401602060405180830381865afa158015610cbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cdf919061206c565b866040518463ffffffff1660e01b8152600401610cfe93929190612119565b6040805180830381865afa158015610d1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d3e919061213e565b949350505050565b60006003610d5383611800565b101592915050565b610d698383836000806110a2565b505050565b80516020820120600090610d8183610d46565b8015610e3757506040517f96e494e8000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906396e494e890602401602060405180830381865afa158015610e13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e379190611f68565b9392505050565b895160208b01206000908515801590610e6b575073ffffffffffffffffffffffffffffffffffffffff8816155b15610ea2576040517fd3f605c400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808b8b8a8a8a8e8b8b8b604051602001610ec59a9998979695949392919061223d565b604051602081830303815290604052805190602001209150509a9950505050505050505050565b6000818152600160205260409020544290610f28907f000000000000000000000000000000000000000000000000000000000000000090611fc4565b10610f62576040517f0a059d710000000000000000000000000000000000000000000000000000000081526004810182905260240161060a565b6000908152600160205260409020429055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ff6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161060a565b73ffffffffffffffffffffffffffffffffffffffff8116611099576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161060a565b61058a81611466565b600085856040516110b4929190611f85565b604080519182900382207f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae6020840152908201819052915060009060600160408051601f198184030181528282528051602091820120601f8a01829004820284018201909252888352909250839160009161114c91908b908b90819084018382808284376000920191909152508b9250610be6915050565b805190915034101561118a576040517f1101129400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517ffd0cd0d9000000000000000000000000000000000000000000000000000000008152600481018490526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063fd0cd0d990602401602060405180830381865afa158015611218573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123c9190611f68565b1561131c576040517f47d2e9fe000000000000000000000000000000000000000000000000000000008152600481018490526024810189905263ffffffff8816604482015267ffffffffffffffff871660648201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906347d2e9fe906084016020604051808303816000875af11580156112f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611315919061206c565b90506113d7565b6040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101849052602481018990527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063c475abff906044016020604051808303816000875af11580156113b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d4919061206c565b90505b815134111561141c57815133906108fc906113f290346120b6565b6040518115909202916000818181858888f1935050505015801561141a573d6000803e3d6000fd5b505b847f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae8b8b348560405161145294939291906122bf565b60405180910390a250505050505050505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000818152600160205260409020544290611517907f000000000000000000000000000000000000000000000000000000000000000090611fc4565b1115611552576040517f5320bcf90000000000000000000000000000000000000000000000000000000081526004810182905260240161060a565b600081815260016020526040902054429061158e907f000000000000000000000000000000000000000000000000000000000000000090611fc4565b116115c8576040517fcb7690d70000000000000000000000000000000000000000000000000000000081526004810182905260240161060a565b6115d183610d6e565b61160957826040517f477707e800000000000000000000000000000000000000000000000000000000815260040161060a91906122e6565b6000818152600160205260408120556224ea00821015610d69576040517f9a71997b0000000000000000000000000000000000000000000000000000000081526004810183905260240161060a565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301869052825180830384018152606083019384905280519101207fe32954eb00000000000000000000000000000000000000000000000000000000909252859073ffffffffffffffffffffffffffffffffffffffff82169063e32954eb906116f8908590889088906064016122f9565b6000604051808303816000875af1158015611717573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610817919081019061231c565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16637a806d6b3383858760405160200161178f919061241b565b6040516020818303038152906040526040518563ffffffff1660e01b81526004016117bd949392919061245c565b6020604051808303816000875af11580156117dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ac919061206c565b8051600090819081905b808210156119fe576000858381518110611826576118266124a7565b01602001517fff000000000000000000000000000000000000000000000000000000000000001690507f800000000000000000000000000000000000000000000000000000000000000081101561188957611882600184611fc4565b92506119eb565b7fe0000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821610156118de57611882600284611fc4565b7ff0000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216101561193357611882600384611fc4565b7ff8000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216101561198857611882600484611fc4565b7ffc000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821610156119dd57611882600584611fc4565b6119e8600684611fc4565b92505b50826119f6816124d6565b93505061180a565b50909392505050565b600060208284031215611a1957600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610e3757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff81168114611a6d57600080fd5b919050565b600080600060608486031215611a8757600080fd5b611a9084611a49565b9250611a9e60208501611a49565b9150604084013590509250925092565b60008083601f840112611ac057600080fd5b50813567ffffffffffffffff811115611ad857600080fd5b602083019150836020828501011115611af057600080fd5b9250929050565b803563ffffffff81168114611a6d57600080fd5b803567ffffffffffffffff81168114611a6d57600080fd5b600080600080600060808688031215611b3b57600080fd5b853567ffffffffffffffff811115611b5257600080fd5b611b5e88828901611aae565b90965094505060208601359250611b7760408701611af7565b9150611b8560608701611b0b565b90509295509295909350565b60008083601f840112611ba357600080fd5b50813567ffffffffffffffff811115611bbb57600080fd5b6020830191508360208260051b8501011115611af057600080fd5b801515811461058a57600080fd5b60008060008060008060008060008060006101208c8e031215611c0657600080fd5b67ffffffffffffffff808d351115611c1d57600080fd5b611c2a8e8e358f01611aae565b909c509a50611c3b60208e01611a49565b995060408d0135985060608d01359750611c5760808e01611a49565b96508060a08e01351115611c6a57600080fd5b50611c7b8d60a08e01358e01611b91565b909550935060c08c0135611c8e81611bd6565b9250611c9c60e08d01611af7565b9150611cab6101008d01611b0b565b90509295989b509295989b9093969950565b600060208284031215611ccf57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611d2e57611d2e611cd6565b604052919050565b600067ffffffffffffffff821115611d5057611d50611cd6565b50601f01601f191660200190565b600082601f830112611d6f57600080fd5b8135611d82611d7d82611d36565b611d05565b818152846020838601011115611d9757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060408385031215611dc757600080fd5b823567ffffffffffffffff811115611dde57600080fd5b611dea85828601611d5e565b95602094909401359450505050565b600060208284031215611e0b57600080fd5b813567ffffffffffffffff811115611e2257600080fd5b610d3e84828501611d5e565b600080600060408486031215611e4357600080fd5b833567ffffffffffffffff811115611e5a57600080fd5b611e6686828701611aae565b909790965060209590950135949350505050565b6000806000806000806000806000806101208b8d031215611e9a57600080fd5b8a3567ffffffffffffffff80821115611eb257600080fd5b611ebe8e838f01611d5e565b9b50611ecc60208e01611a49565b9a5060408d0135995060608d01359850611ee860808e01611a49565b975060a08d0135915080821115611efe57600080fd5b50611f0b8d828e01611b91565b90965094505060c08b0135611f1f81611bd6565b9250611f2d60e08c01611af7565b9150611f3c6101008c01611b0b565b90509295989b9194979a5092959850565b600060208284031215611f5f57600080fd5b610e3782611a49565b600060208284031215611f7a57600080fd5b8151610e3781611bd6565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561053d5761053d611f95565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b60c08152600061201660c08301898b611fd7565b905073ffffffffffffffffffffffffffffffffffffffff808816602084015286604084015280861660608401525063ffffffff8416608083015267ffffffffffffffff831660a083015298975050505050505050565b60006020828403121561207e57600080fd5b5051919050565b608081526000612099608083018789611fd7565b602083019590955250604081019290925260609091015292915050565b8181038181111561053d5761053d611f95565b60005b838110156120e45781810151838201526020016120cc565b50506000910152565b600081518084526121058160208601602086016120c9565b601f01601f19169290920160200192915050565b60608152600061212c60608301866120ed565b60208301949094525060400152919050565b60006040828403121561215057600080fd5b6040516040810181811067ffffffffffffffff8211171561217357612173611cd6565b604052825181526020928301519281019290925250919050565b81835260006020808501808196508560051b810191508460005b8781101561223057828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126121e657600080fd5b8701858101903567ffffffffffffffff81111561220257600080fd5b80360382131561221157600080fd5b61221c868284611fd7565b9a87019a95505050908401906001016121a7565b5091979650505050505050565b60006101208c835273ffffffffffffffffffffffffffffffffffffffff808d1660208501528b6040850152808b16606085015250806080840152612284818401898b61218d565b60a0840197909752505092151560c084015263ffffffff9190911660e083015267ffffffffffffffff16610100909101529695505050505050565b6060815260006122d3606083018688611fd7565b6020830194909452506040015292915050565b602081526000610e3760208301846120ed565b83815260406020820152600061231360408301848661218d565b95945050505050565b6000602080838503121561232f57600080fd5b825167ffffffffffffffff8082111561234757600080fd5b818501915085601f83011261235b57600080fd5b81518181111561236d5761236d611cd6565b8060051b61237c858201611d05565b918252838101850191858101908984111561239657600080fd5b86860192505b8383101561240e578251858111156123b45760008081fd5b8601603f81018b136123c65760008081fd5b8781015160406123d8611d7d83611d36565b8281528d828486010111156123ed5760008081fd5b6123fc838c83018487016120c9565b8552505050918601919086019061239c565b9998505050505050505050565b6000825161242d8184602087016120c9565b7f2e65746800000000000000000000000000000000000000000000000000000000920191825250600401919050565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401528085166040840152506080606083015261249d60808301846120ed565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361250757612507611f95565b506001019056fea2646970667358221220d9fb3b87e91578f7a8a6d5440953ca3826801764d1dd460b7339ced1842a0af364736f6c63430008110033", + "deployedBytecode": "0x60806040526004361061016a5760003560e01c80638d839ffe116100cb578063aeb8ce9b1161007f578063d555254a11610059578063d555254a1461044a578063f14fcbc81461046a578063f2fde38b1461048a57600080fd5b8063aeb8ce9b146103c2578063ce1e09c0146103e2578063d3419bf31461041657600080fd5b80639791c097116100b05780639791c0971461035b578063a8e5fbc01461037b578063acf1a841146103af57600080fd5b80638d839ffe146102fc5780638da5cb5b1461033057600080fd5b80637acaaf2611610122578063839df94511610107578063839df9451461026f57806383e7f6ff146102aa5780638a95b09f146102e557600080fd5b80637acaaf2614610203578063808698531461021657600080fd5b80635d3590d5116101535780635d3590d5146101bb5780636459220f146101db578063715018a6146101ee57600080fd5b806301ffc9a71461016f5780633ccfd60b146101a4575b600080fd5b34801561017b57600080fd5b5061018f61018a366004611a07565b6104aa565b60405190151581526020015b60405180910390f35b3480156101b057600080fd5b506101b9610543565b005b3480156101c757600080fd5b506101b96101d6366004611a72565b61058d565b6101b96101e9366004611b23565b6106b2565b3480156101fa57600080fd5b506101b9610820565b6101b9610211366004611be4565b6108ad565b34801561022257600080fd5b5061024a7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b34801561027b57600080fd5b5061029c61028a366004611cbd565b60016020526000908152604090205481565b60405190815260200161019b565b3480156102b657600080fd5b506102ca6102c5366004611db4565b610be6565b6040805182518152602092830151928101929092520161019b565b3480156102f157600080fd5b5061029c6224ea0081565b34801561030857600080fd5b5061029c7f000000000000000000000000000000000000000000000000000000000000000081565b34801561033c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff1661024a565b34801561036757600080fd5b5061018f610376366004611df9565b610d46565b34801561038757600080fd5b5061024a7f000000000000000000000000000000000000000000000000000000000000000081565b6101b96103bd366004611e2e565b610d5b565b3480156103ce57600080fd5b5061018f6103dd366004611df9565b610d6e565b3480156103ee57600080fd5b5061029c7f000000000000000000000000000000000000000000000000000000000000000081565b34801561042257600080fd5b5061024a7f000000000000000000000000000000000000000000000000000000000000000081565b34801561045657600080fd5b5061029c610465366004611e7a565b610e3e565b34801561047657600080fd5b506101b9610485366004611cbd565b610eec565b34801561049657600080fd5b506101b96104a5366004611f4d565b610f75565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061053d57507fffffffff0000000000000000000000000000000000000000000000000000000082167fdf7ed18100000000000000000000000000000000000000000000000000000000145b92915050565b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116914780156108fc02929091818181858888f1935050505015801561058a573d6000803e3d6000fd5b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610613576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015610688573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ac9190611f68565b50505050565b600085856040516106c4929190611f85565b604080519182900382207f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae6020840152908201819052915060009060600160408051808303601f190181529082905280516020909101207ff44779b90000000000000000000000000000000000000000000000000000000082526004820181905233602483015291507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063f44779b9906044016020604051808303816000875af11580156107ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d19190611f68565b61080a576040517fe4fd57ae0000000000000000000000000000000000000000000000000000000081526004810182905260240161060a565b61081787878787876110a2565b50505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146108a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161060a565b6108ab6000611466565b565b60006108f08c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d9250610be6915050565b6020810151815191925061090391611fc4565b34101561093c576040517f1101129400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109e08c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508a6109db8f8f8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508e8e8e8e8e8e8e8e8e610e3e565b6114db565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16639f56dac68e8e8e8e8d8a8a6040518863ffffffff1660e01b8152600401610a479796959493929190612002565b6020604051808303816000875af1158015610a66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8a919061206c565b90508515610ab557610ab5888e8e604051610aa6929190611f85565b60405180910390208989611658565b8415610afe57610afe8d8d8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c925033915061173f9050565b8a73ffffffffffffffffffffffffffffffffffffffff168d8d604051610b25929190611f85565b60405180910390207f69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf278f8f8660000151876020015187604051610b6c959493929190612085565b60405180910390a360208201518251610b859190611fc4565b341115610bd7576020820151825133916108fc91610ba39190611fc4565b610bad90346120b6565b6040518115909202916000818181858888f19350505050158015610bd5573d6000803e3d6000fd5b505b50505050505050505050505050565b6040805180820190915260008082526020820152825160208401206040517fd6e4fa86000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff908116916350e9a7159187917f00000000000000000000000000000000000000000000000000000000000000009091169063d6e4fa8690602401602060405180830381865afa158015610cbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cdf919061206c565b866040518463ffffffff1660e01b8152600401610cfe93929190612119565b6040805180830381865afa158015610d1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d3e919061213e565b949350505050565b60006003610d5383611800565b101592915050565b610d698383836000806110a2565b505050565b80516020820120600090610d8183610d46565b8015610e3757506040517f96e494e8000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906396e494e890602401602060405180830381865afa158015610e13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e379190611f68565b9392505050565b895160208b01206000908515801590610e6b575073ffffffffffffffffffffffffffffffffffffffff8816155b15610ea2576040517fd3f605c400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808b8b8a8a8a8e8b8b8b604051602001610ec59a9998979695949392919061223d565b604051602081830303815290604052805190602001209150509a9950505050505050505050565b6000818152600160205260409020544290610f28907f000000000000000000000000000000000000000000000000000000000000000090611fc4565b10610f62576040517f0a059d710000000000000000000000000000000000000000000000000000000081526004810182905260240161060a565b6000908152600160205260409020429055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ff6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161060a565b73ffffffffffffffffffffffffffffffffffffffff8116611099576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161060a565b61058a81611466565b600085856040516110b4929190611f85565b604080519182900382207f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae6020840152908201819052915060009060600160408051601f198184030181528282528051602091820120601f8a01829004820284018201909252888352909250839160009161114c91908b908b90819084018382808284376000920191909152508b9250610be6915050565b805190915034101561118a576040517f1101129400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517ffd0cd0d9000000000000000000000000000000000000000000000000000000008152600481018490526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063fd0cd0d990602401602060405180830381865afa158015611218573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123c9190611f68565b1561131c576040517f47d2e9fe000000000000000000000000000000000000000000000000000000008152600481018490526024810189905263ffffffff8816604482015267ffffffffffffffff871660648201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906347d2e9fe906084016020604051808303816000875af11580156112f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611315919061206c565b90506113d7565b6040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101849052602481018990527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063c475abff906044016020604051808303816000875af11580156113b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d4919061206c565b90505b815134111561141c57815133906108fc906113f290346120b6565b6040518115909202916000818181858888f1935050505015801561141a573d6000803e3d6000fd5b505b847f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae8b8b348560405161145294939291906122bf565b60405180910390a250505050505050505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000818152600160205260409020544290611517907f000000000000000000000000000000000000000000000000000000000000000090611fc4565b1115611552576040517f5320bcf90000000000000000000000000000000000000000000000000000000081526004810182905260240161060a565b600081815260016020526040902054429061158e907f000000000000000000000000000000000000000000000000000000000000000090611fc4565b116115c8576040517fcb7690d70000000000000000000000000000000000000000000000000000000081526004810182905260240161060a565b6115d183610d6e565b61160957826040517f477707e800000000000000000000000000000000000000000000000000000000815260040161060a91906122e6565b6000818152600160205260408120556224ea00821015610d69576040517f9a71997b0000000000000000000000000000000000000000000000000000000081526004810183905260240161060a565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301869052825180830384018152606083019384905280519101207fe32954eb00000000000000000000000000000000000000000000000000000000909252859073ffffffffffffffffffffffffffffffffffffffff82169063e32954eb906116f8908590889088906064016122f9565b6000604051808303816000875af1158015611717573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610817919081019061231c565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16637a806d6b3383858760405160200161178f919061241b565b6040516020818303038152906040526040518563ffffffff1660e01b81526004016117bd949392919061245c565b6020604051808303816000875af11580156117dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ac919061206c565b8051600090819081905b808210156119fe576000858381518110611826576118266124a7565b01602001517fff000000000000000000000000000000000000000000000000000000000000001690507f800000000000000000000000000000000000000000000000000000000000000081101561188957611882600184611fc4565b92506119eb565b7fe0000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821610156118de57611882600284611fc4565b7ff0000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216101561193357611882600384611fc4565b7ff8000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216101561198857611882600484611fc4565b7ffc000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821610156119dd57611882600584611fc4565b6119e8600684611fc4565b92505b50826119f6816124d6565b93505061180a565b50909392505050565b600060208284031215611a1957600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610e3757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff81168114611a6d57600080fd5b919050565b600080600060608486031215611a8757600080fd5b611a9084611a49565b9250611a9e60208501611a49565b9150604084013590509250925092565b60008083601f840112611ac057600080fd5b50813567ffffffffffffffff811115611ad857600080fd5b602083019150836020828501011115611af057600080fd5b9250929050565b803563ffffffff81168114611a6d57600080fd5b803567ffffffffffffffff81168114611a6d57600080fd5b600080600080600060808688031215611b3b57600080fd5b853567ffffffffffffffff811115611b5257600080fd5b611b5e88828901611aae565b90965094505060208601359250611b7760408701611af7565b9150611b8560608701611b0b565b90509295509295909350565b60008083601f840112611ba357600080fd5b50813567ffffffffffffffff811115611bbb57600080fd5b6020830191508360208260051b8501011115611af057600080fd5b801515811461058a57600080fd5b60008060008060008060008060008060006101208c8e031215611c0657600080fd5b67ffffffffffffffff808d351115611c1d57600080fd5b611c2a8e8e358f01611aae565b909c509a50611c3b60208e01611a49565b995060408d0135985060608d01359750611c5760808e01611a49565b96508060a08e01351115611c6a57600080fd5b50611c7b8d60a08e01358e01611b91565b909550935060c08c0135611c8e81611bd6565b9250611c9c60e08d01611af7565b9150611cab6101008d01611b0b565b90509295989b509295989b9093969950565b600060208284031215611ccf57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611d2e57611d2e611cd6565b604052919050565b600067ffffffffffffffff821115611d5057611d50611cd6565b50601f01601f191660200190565b600082601f830112611d6f57600080fd5b8135611d82611d7d82611d36565b611d05565b818152846020838601011115611d9757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060408385031215611dc757600080fd5b823567ffffffffffffffff811115611dde57600080fd5b611dea85828601611d5e565b95602094909401359450505050565b600060208284031215611e0b57600080fd5b813567ffffffffffffffff811115611e2257600080fd5b610d3e84828501611d5e565b600080600060408486031215611e4357600080fd5b833567ffffffffffffffff811115611e5a57600080fd5b611e6686828701611aae565b909790965060209590950135949350505050565b6000806000806000806000806000806101208b8d031215611e9a57600080fd5b8a3567ffffffffffffffff80821115611eb257600080fd5b611ebe8e838f01611d5e565b9b50611ecc60208e01611a49565b9a5060408d0135995060608d01359850611ee860808e01611a49565b975060a08d0135915080821115611efe57600080fd5b50611f0b8d828e01611b91565b90965094505060c08b0135611f1f81611bd6565b9250611f2d60e08c01611af7565b9150611f3c6101008c01611b0b565b90509295989b9194979a5092959850565b600060208284031215611f5f57600080fd5b610e3782611a49565b600060208284031215611f7a57600080fd5b8151610e3781611bd6565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561053d5761053d611f95565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b60c08152600061201660c08301898b611fd7565b905073ffffffffffffffffffffffffffffffffffffffff808816602084015286604084015280861660608401525063ffffffff8416608083015267ffffffffffffffff831660a083015298975050505050505050565b60006020828403121561207e57600080fd5b5051919050565b608081526000612099608083018789611fd7565b602083019590955250604081019290925260609091015292915050565b8181038181111561053d5761053d611f95565b60005b838110156120e45781810151838201526020016120cc565b50506000910152565b600081518084526121058160208601602086016120c9565b601f01601f19169290920160200192915050565b60608152600061212c60608301866120ed565b60208301949094525060400152919050565b60006040828403121561215057600080fd5b6040516040810181811067ffffffffffffffff8211171561217357612173611cd6565b604052825181526020928301519281019290925250919050565b81835260006020808501808196508560051b810191508460005b8781101561223057828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126121e657600080fd5b8701858101903567ffffffffffffffff81111561220257600080fd5b80360382131561221157600080fd5b61221c868284611fd7565b9a87019a95505050908401906001016121a7565b5091979650505050505050565b60006101208c835273ffffffffffffffffffffffffffffffffffffffff808d1660208501528b6040850152808b16606085015250806080840152612284818401898b61218d565b60a0840197909752505092151560c084015263ffffffff9190911660e083015267ffffffffffffffff16610100909101529695505050505050565b6060815260006122d3606083018688611fd7565b6020830194909452506040015292915050565b602081526000610e3760208301846120ed565b83815260406020820152600061231360408301848661218d565b95945050505050565b6000602080838503121561232f57600080fd5b825167ffffffffffffffff8082111561234757600080fd5b818501915085601f83011261235b57600080fd5b81518181111561236d5761236d611cd6565b8060051b61237c858201611d05565b918252838101850191858101908984111561239657600080fd5b86860192505b8383101561240e578251858111156123b45760008081fd5b8601603f81018b136123c65760008081fd5b8781015160406123d8611d7d83611d36565b8281528d828486010111156123ed5760008081fd5b6123fc838c83018487016120c9565b8552505050918601919086019061239c565b9998505050505050505050565b6000825161242d8184602087016120c9565b7f2e65746800000000000000000000000000000000000000000000000000000000920191825250600401919050565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401528085166040840152506080606083015261249d60808301846120ed565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361250757612507611f95565b506001019056fea2646970667358221220d9fb3b87e91578f7a8a6d5440953ca3826801764d1dd460b7339ced1842a0af364736f6c63430008110033", + "devdoc": { + "details": "A registrar controller for registering and renewing names at fixed cost.", + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "recoverFunds(address,address,uint256)": { + "details": "The contract is Ownable and only the owner can call the recover function.", + "params": { + "_amount": "The amount of tokens to recover.", + "_to": "The address to send the tokens to.", + "_token": "The address of the ERC20 token to recover" + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "recoverFunds(address,address,uint256)": { + "notice": "Recover ERC20 tokens sent to the contract by mistake." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 545, + "contract": "contracts/ethregistrar/ETHRegistrarController.sol:ETHRegistrarController", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 9866, + "contract": "contracts/ethregistrar/ETHRegistrarController.sol:ETHRegistrarController", + "label": "commitments", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_uint256)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_uint256)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/ExponentialPremiumPriceOracle.json b/solidity/dns-contracts/deployments/ropsten/ExponentialPremiumPriceOracle.json new file mode 100644 index 0000000..ef412df --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/ExponentialPremiumPriceOracle.json @@ -0,0 +1,304 @@ +{ + "address": "0x0e765d28FABf9E219770CAb07D64967451026bD7", + "abi": [ + { + "inputs": [ + { + "internalType": "contract AggregatorInterface", + "name": "_usdOracle", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "_rentPrices", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "_startPremium", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalDays", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256[]", + "name": "prices", + "type": "uint256[]" + } + ], + "name": "RentPriceChanged", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "startPremium", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "elapsed", + "type": "uint256" + } + ], + "name": "decayedPremium", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "premium", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "price", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "base", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "premium", + "type": "uint256" + } + ], + "internalType": "struct IPriceOracle.Price", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price1Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price2Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price3Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price4Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price5Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "usdOracle", + "outputs": [ + { + "internalType": "contract AggregatorInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x32dd49c38b2b26a26e373ccad0c422edf969567a1aaf5ff74387a6bb48e3230b", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x0e765d28FABf9E219770CAb07D64967451026bD7", + "transactionIndex": 9, + "gasUsed": "860573", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x5dfa36dc57fc349215819eed01691c4878a43d80d6245972011315617672e4b7", + "transactionHash": "0x32dd49c38b2b26a26e373ccad0c422edf969567a1aaf5ff74387a6bb48e3230b", + "logs": [], + "blockNumber": 13019105, + "cumulativeGasUsed": "2106596", + "status": 1, + "byzantium": true + }, + "args": [ + "0xbe76a7714EF626A73698ab797EC385c87Bd84a70", + [ + 0, + 0, + "20294266869609", + "5073566717402", + "158548959919" + ], + "100000000000000000000000000", + 21 + ], + "numDeployments": 1, + "solcInputHash": "a5ab15037ea2d912526c4e5696fda13f", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract AggregatorInterface\",\"name\":\"_usdOracle\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"_rentPrices\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_startPremium\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalDays\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"prices\",\"type\":\"uint256[]\"}],\"name\":\"RentPriceChanged\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"startPremium\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"elapsed\",\"type\":\"uint256\"}],\"name\":\"decayedPremium\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"premium\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"price\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"base\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"}],\"internalType\":\"struct IPriceOracle.Price\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price1Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price2Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price3Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price4Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price5Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"usdOracle\",\"outputs\":[{\"internalType\":\"contract AggregatorInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"decayedPremium(uint256,uint256)\":{\"details\":\"Returns the premium price at current time elapsed\",\"params\":{\"elapsed\":\"time past since expiry\",\"startPremium\":\"starting price\"}},\"premium(string,uint256,uint256)\":{\"details\":\"Returns the pricing premium in wei.\"},\"price(string,uint256,uint256)\":{\"details\":\"Returns the price to register or renew a name.\",\"params\":{\"duration\":\"How long the name is being registered or extended for, in seconds.\",\"expires\":\"When the name presently expires (0 if this is a new registration).\",\"name\":\"The name being registered or renewed.\"},\"returns\":{\"_0\":\"base premium tuple of base price + premium price\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/ExponentialPremiumPriceOracle.sol\":\"ExponentialPremiumPriceOracle\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0x24e0364e503a9bbde94c715d26573a76f14cd2a202d45f96f52134ab806b67b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/ethregistrar/ExponentialPremiumPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./StablePriceOracle.sol\\\";\\n\\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\\n uint256 constant GRACE_PERIOD = 90 days;\\n uint256 immutable startPremium;\\n uint256 immutable endValue;\\n\\n constructor(\\n AggregatorInterface _usdOracle,\\n uint256[] memory _rentPrices,\\n uint256 _startPremium,\\n uint256 totalDays\\n ) StablePriceOracle(_usdOracle, _rentPrices) {\\n startPremium = _startPremium;\\n endValue = _startPremium >> totalDays;\\n }\\n\\n uint256 constant PRECISION = 1e18;\\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\\n uint256 constant bit3 = 999957694548431104;\\n uint256 constant bit4 = 999915390886613504;\\n uint256 constant bit5 = 999830788931929088;\\n uint256 constant bit6 = 999661606496243712;\\n uint256 constant bit7 = 999323327502650752;\\n uint256 constant bit8 = 998647112890970240;\\n uint256 constant bit9 = 997296056085470080;\\n uint256 constant bit10 = 994599423483633152;\\n uint256 constant bit11 = 989228013193975424;\\n uint256 constant bit12 = 978572062087700096;\\n uint256 constant bit13 = 957603280698573696;\\n uint256 constant bit14 = 917004043204671232;\\n uint256 constant bit15 = 840896415253714560;\\n uint256 constant bit16 = 707106781186547584;\\n\\n /**\\n * @dev Returns the pricing premium in internal base units.\\n */\\n function _premium(\\n string memory,\\n uint256 expires,\\n uint256\\n ) internal view override returns (uint256) {\\n expires = expires + GRACE_PERIOD;\\n if (expires > block.timestamp) {\\n return 0;\\n }\\n\\n uint256 elapsed = block.timestamp - expires;\\n uint256 premium = decayedPremium(startPremium, elapsed);\\n if (premium >= endValue) {\\n return premium - endValue;\\n }\\n return 0;\\n }\\n\\n /**\\n * @dev Returns the premium price at current time elapsed\\n * @param startPremium starting price\\n * @param elapsed time past since expiry\\n */\\n function decayedPremium(uint256 startPremium, uint256 elapsed)\\n public\\n pure\\n returns (uint256)\\n {\\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\\n uint256 intDays = daysPast / PRECISION;\\n uint256 premium = startPremium >> intDays;\\n uint256 partDay = (daysPast - intDays * PRECISION);\\n uint256 fraction = (partDay * (2**16)) / PRECISION;\\n uint256 totalPremium = addFractionalPremium(fraction, premium);\\n return totalPremium;\\n }\\n\\n function addFractionalPremium(uint256 fraction, uint256 premium)\\n internal\\n pure\\n returns (uint256)\\n {\\n if (fraction & (1 << 0) != 0) {\\n premium = (premium * bit1) / PRECISION;\\n }\\n if (fraction & (1 << 1) != 0) {\\n premium = (premium * bit2) / PRECISION;\\n }\\n if (fraction & (1 << 2) != 0) {\\n premium = (premium * bit3) / PRECISION;\\n }\\n if (fraction & (1 << 3) != 0) {\\n premium = (premium * bit4) / PRECISION;\\n }\\n if (fraction & (1 << 4) != 0) {\\n premium = (premium * bit5) / PRECISION;\\n }\\n if (fraction & (1 << 5) != 0) {\\n premium = (premium * bit6) / PRECISION;\\n }\\n if (fraction & (1 << 6) != 0) {\\n premium = (premium * bit7) / PRECISION;\\n }\\n if (fraction & (1 << 7) != 0) {\\n premium = (premium * bit8) / PRECISION;\\n }\\n if (fraction & (1 << 8) != 0) {\\n premium = (premium * bit9) / PRECISION;\\n }\\n if (fraction & (1 << 9) != 0) {\\n premium = (premium * bit10) / PRECISION;\\n }\\n if (fraction & (1 << 10) != 0) {\\n premium = (premium * bit11) / PRECISION;\\n }\\n if (fraction & (1 << 11) != 0) {\\n premium = (premium * bit12) / PRECISION;\\n }\\n if (fraction & (1 << 12) != 0) {\\n premium = (premium * bit13) / PRECISION;\\n }\\n if (fraction & (1 << 13) != 0) {\\n premium = (premium * bit14) / PRECISION;\\n }\\n if (fraction & (1 << 14) != 0) {\\n premium = (premium * bit15) / PRECISION;\\n }\\n if (fraction & (1 << 15) != 0) {\\n premium = (premium * bit16) / PRECISION;\\n }\\n return premium;\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n public\\n view\\n virtual\\n override\\n returns (bool)\\n {\\n return super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x27c65d1e85df53443323b399cc0356c7659304c58863655d66edbd1048a9a3aa\",\"license\":\"MIT\"},\"contracts/ethregistrar/IPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\ninterface IPriceOracle {\\n struct Price {\\n uint256 base;\\n uint256 premium;\\n }\\n\\n /**\\n * @dev Returns the price to register or renew a name.\\n * @param name The name being registered or renewed.\\n * @param expires When the name presently expires (0 if this is a new registration).\\n * @param duration How long the name is being registered or extended for, in seconds.\\n * @return base premium tuple of base price + premium price\\n */\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (Price calldata);\\n}\\n\",\"keccak256\":\"0x1ec537b4c7f9cc40363b39dcc7ade8c29bf94662e6b01d38e681487637bd577e\",\"license\":\"MIT\"},\"contracts/ethregistrar/SafeMath.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\n/**\\n * @title SafeMath\\n * @dev Unsigned math operations with safety checks that revert on error\\n */\\nlibrary SafeMath {\\n /**\\n * @dev Multiplies two unsigned integers, reverts on overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\\n if (a == 0) {\\n return 0;\\n }\\n\\n uint256 c = a * b;\\n require(c / a == b);\\n\\n return c;\\n }\\n\\n /**\\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n // Solidity only automatically asserts when dividing by 0\\n require(b > 0);\\n uint256 c = a / b;\\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\\n\\n return c;\\n }\\n\\n /**\\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b <= a);\\n uint256 c = a - b;\\n\\n return c;\\n }\\n\\n /**\\n * @dev Adds two unsigned integers, reverts on overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n uint256 c = a + b;\\n require(c >= a);\\n\\n return c;\\n }\\n\\n /**\\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\\n * reverts when dividing by zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b != 0);\\n return a % b;\\n }\\n}\\n\",\"keccak256\":\"0xcb33819183087dcf646afd774ac6d2fb59d4fcb3f669b45b679cb8a936f0d22b\",\"license\":\"MIT\"},\"contracts/ethregistrar/StablePriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./IPriceOracle.sol\\\";\\nimport \\\"./SafeMath.sol\\\";\\nimport \\\"./StringUtils.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\ninterface AggregatorInterface {\\n function latestAnswer() external view returns (int256);\\n}\\n\\n// StablePriceOracle sets a price in USD, based on an oracle.\\ncontract StablePriceOracle is IPriceOracle {\\n using SafeMath for *;\\n using StringUtils for *;\\n\\n // Rent in base price units by length\\n uint256 public immutable price1Letter;\\n uint256 public immutable price2Letter;\\n uint256 public immutable price3Letter;\\n uint256 public immutable price4Letter;\\n uint256 public immutable price5Letter;\\n\\n // Oracle address\\n AggregatorInterface public immutable usdOracle;\\n\\n event RentPriceChanged(uint256[] prices);\\n\\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\\n usdOracle = _usdOracle;\\n price1Letter = _rentPrices[0];\\n price2Letter = _rentPrices[1];\\n price3Letter = _rentPrices[2];\\n price4Letter = _rentPrices[3];\\n price5Letter = _rentPrices[4];\\n }\\n\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view override returns (IPriceOracle.Price memory) {\\n uint256 len = name.strlen();\\n uint256 basePrice;\\n\\n if (len >= 5) {\\n basePrice = price5Letter * duration;\\n } else if (len == 4) {\\n basePrice = price4Letter * duration;\\n } else if (len == 3) {\\n basePrice = price3Letter * duration;\\n } else if (len == 2) {\\n basePrice = price2Letter * duration;\\n } else {\\n basePrice = price1Letter * duration;\\n }\\n\\n return\\n IPriceOracle.Price({\\n base: attoUSDToWei(basePrice),\\n premium: attoUSDToWei(_premium(name, expires, duration))\\n });\\n }\\n\\n /**\\n * @dev Returns the pricing premium in wei.\\n */\\n function premium(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (uint256) {\\n return attoUSDToWei(_premium(name, expires, duration));\\n }\\n\\n /**\\n * @dev Returns the pricing premium in internal base units.\\n */\\n function _premium(\\n string memory name,\\n uint256 expires,\\n uint256 duration\\n ) internal view virtual returns (uint256) {\\n return 0;\\n }\\n\\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\\n return (amount * 1e8) / ethPrice;\\n }\\n\\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\\n return (amount * ethPrice) / 1e8;\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n public\\n view\\n virtual\\n returns (bool)\\n {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IPriceOracle).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xb05505ede4d654283caaa035e1083af0ff7df41e1038889a35ac129703b45b58\",\"license\":\"MIT\"},\"contracts/ethregistrar/StringUtils.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary StringUtils {\\n /**\\n * @dev Returns the length of a given string\\n *\\n * @param s The string to measure the length of\\n * @return The length of the input string\\n */\\n function strlen(string memory s) internal pure returns (uint256) {\\n uint256 len;\\n uint256 i = 0;\\n uint256 bytelength = bytes(s).length;\\n for (len = 0; i < bytelength; len++) {\\n bytes1 b = bytes(s)[i];\\n if (b < 0x80) {\\n i += 1;\\n } else if (b < 0xE0) {\\n i += 2;\\n } else if (b < 0xF0) {\\n i += 3;\\n } else if (b < 0xF8) {\\n i += 4;\\n } else if (b < 0xFC) {\\n i += 5;\\n } else {\\n i += 6;\\n }\\n }\\n return len;\\n }\\n}\\n\",\"keccak256\":\"0x4cc8363a850dc9130c433ee50e7c97e29a45ae5d9bd0808205ac7134b34f24e4\"}},\"version\":1}", + "bytecode": "0x6101806040523480156200001257600080fd5b50604051620011683803806200116883398101604081905262000035916200012c565b6001600160a01b0384166101205282518490849081906000906200005d576200005d62000227565b6020026020010151608081815250508060018151811062000082576200008262000227565b602002602001015160a0818152505080600281518110620000a757620000a762000227565b602002602001015160c0818152505080600381518110620000cc57620000cc62000227565b602002602001015160e0818152505080600481518110620000f157620000f162000227565b60209081029190910101516101005250506101408290521c61016052506200023d9050565b634e487b7160e01b600052604160045260246000fd5b600080600080608085870312156200014357600080fd5b84516001600160a01b03811681146200015b57600080fd5b602086810151919550906001600160401b03808211156200017b57600080fd5b818801915088601f8301126200019057600080fd5b815181811115620001a557620001a562000116565b8060051b604051601f19603f83011681018181108582111715620001cd57620001cd62000116565b60405291825284820192508381018501918b831115620001ec57600080fd5b938501935b828510156200020c57845184529385019392850192620001f1565b60408b01516060909b0151999c909b50975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60805160a05160c05160e05161010051610120516101405161016051610e95620002d3600039600081816108d101526108fb015260006108a80152600081816101c701526107c301526000818161015301526102d401526000818161023a015261030d01526000818161018d015261033f015260008181610213015261037101526000818160f0015261039b0152610e956000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c8063a200e15311610076578063c8a4271f1161005b578063c8a4271f146101c2578063cd5d2c741461020e578063d820ed421461023557600080fd5b8063a200e15314610188578063a34e3596146101af57600080fd5b806350e9a715116100a757806350e9a7151461012057806359b6b86c1461014e57806359e1777c1461017557600080fd5b806301ffc9a7146100c35780632c0fd74c146100eb575b600080fd5b6100d66100d1366004610c55565b61025c565b60405190151581526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016100e2565b61013361012e366004610c97565b61026d565b604080518251815260209283015192810192909252016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b610112610183366004610d16565b610433565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101126101bd366004610c97565b6104ce565b6101e97f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b60006102678261051f565b92915050565b604080518082019091526000808252602082015260006102c286868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506105b792505050565b90506000600582106102ff576102f8847f0000000000000000000000000000000000000000000000000000000000000000610d67565b90506103c2565b81600403610331576102f8847f0000000000000000000000000000000000000000000000000000000000000000610d67565b81600303610363576102f8847f0000000000000000000000000000000000000000000000000000000000000000610d67565b81600203610395576102f8847f0000000000000000000000000000000000000000000000000000000000000000610d67565b6103bf847f0000000000000000000000000000000000000000000000000000000000000000610d67565b90505b60405180604001604052806103d6836107be565b81526020016104266104218a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92508b91506108729050565b6107be565b9052979650505050505050565b6000806201518061044c670de0b6b3a764000085610d67565b6104569190610d7e565b9050600061046c670de0b6b3a764000083610d7e565b905084811c6000610485670de0b6b3a764000084610d67565b61048f9085610db9565b90506000670de0b6b3a76400006104a98362010000610d67565b6104b39190610d7e565b905060006104c18285610935565b9998505050505050505050565b600061051661042186868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508892508791506108729050565b95945050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061026757507fffffffff0000000000000000000000000000000000000000000000000000000082167f50e9a715000000000000000000000000000000000000000000000000000000001492915050565b8051600090819081905b808210156107b55760008583815181106105dd576105dd610dcc565b01602001517fff000000000000000000000000000000000000000000000000000000000000001690507f800000000000000000000000000000000000000000000000000000000000000081101561064057610639600184610dfb565b92506107a2565b7fe0000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216101561069557610639600284610dfb565b7ff0000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821610156106ea57610639600384610dfb565b7ff8000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216101561073f57610639600484610dfb565b7ffc000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216101561079457610639600584610dfb565b61079f600684610dfb565b92505b50826107ad81610e0e565b9350506105c1565b50909392505050565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561082c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108509190610e46565b905080610861846305f5e100610d67565b61086b9190610d7e565b9392505050565b60006108816276a70084610dfb565b9250428311156108935750600061086b565b600061089f8442610db9565b905060006108cd7f000000000000000000000000000000000000000000000000000000000000000083610433565b90507f00000000000000000000000000000000000000000000000000000000000000008110610929576109207f000000000000000000000000000000000000000000000000000000000000000082610db9565b9250505061086b565b50600095945050505050565b6000600183161561096857670de0b6b3a764000061095b670de0ad151d09418084610d67565b6109659190610d7e565b91505b600283161561099957670de0b6b3a764000061098c670de0a3769959680084610d67565b6109969190610d7e565b91505b60048316156109ca57670de0b6b3a76400006109bd670de09039a5fa510084610d67565b6109c79190610d7e565b91505b60088316156109fb57670de0b6b3a76400006109ee670de069c00f3e120084610d67565b6109f89190610d7e565b91505b6010831615610a2c57670de0b6b3a7640000610a1f670de01cce21c9440084610d67565b610a299190610d7e565b91505b6020831615610a5d57670de0b6b3a7640000610a50670ddf82ef46ce100084610d67565b610a5a9190610d7e565b91505b6040831615610a8e57670de0b6b3a7640000610a81670dde4f458f8e8d8084610d67565b610a8b9190610d7e565b91505b6080831615610abf57670de0b6b3a7640000610ab2670ddbe84213d5f08084610d67565b610abc9190610d7e565b91505b610100831615610af157670de0b6b3a7640000610ae4670dd71b7aa6df5b8084610d67565b610aee9190610d7e565b91505b610200831615610b2357670de0b6b3a7640000610b16670dcd86e7f28cde0084610d67565b610b209190610d7e565b91505b610400831615610b5557670de0b6b3a7640000610b48670dba71a3084ad68084610d67565b610b529190610d7e565b91505b610800831615610b8757670de0b6b3a7640000610b7a670d94961b13dbde8084610d67565b610b849190610d7e565b91505b611000831615610bb957670de0b6b3a7640000610bac670d4a171c35c9838084610d67565b610bb69190610d7e565b91505b612000831615610beb57670de0b6b3a7640000610bde670cb9da519ccfb70084610d67565b610be89190610d7e565b91505b614000831615610c1d57670de0b6b3a7640000610c10670bab76d59c18d68084610d67565b610c1a9190610d7e565b91505b618000831615610c4f57670de0b6b3a7640000610c426709d025defee4df8084610d67565b610c4c9190610d7e565b91505b50919050565b600060208284031215610c6757600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461086b57600080fd5b60008060008060608587031215610cad57600080fd5b843567ffffffffffffffff80821115610cc557600080fd5b818701915087601f830112610cd957600080fd5b813581811115610ce857600080fd5b886020828501011115610cfa57600080fd5b6020928301999098509187013596604001359550909350505050565b60008060408385031215610d2957600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808202811582820484141761026757610267610d38565b600082610db4577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561026757610267610d38565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b8082018082111561026757610267610d38565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610e3f57610e3f610d38565b5060010190565b600060208284031215610e5857600080fd5b505191905056fea264697066735822122026ee1972789ed12d69c43bb984759c3d84f50065c3e2508d4e865675e467d74564736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100be5760003560e01c8063a200e15311610076578063c8a4271f1161005b578063c8a4271f146101c2578063cd5d2c741461020e578063d820ed421461023557600080fd5b8063a200e15314610188578063a34e3596146101af57600080fd5b806350e9a715116100a757806350e9a7151461012057806359b6b86c1461014e57806359e1777c1461017557600080fd5b806301ffc9a7146100c35780632c0fd74c146100eb575b600080fd5b6100d66100d1366004610c55565b61025c565b60405190151581526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016100e2565b61013361012e366004610c97565b61026d565b604080518251815260209283015192810192909252016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b610112610183366004610d16565b610433565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101126101bd366004610c97565b6104ce565b6101e97f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b60006102678261051f565b92915050565b604080518082019091526000808252602082015260006102c286868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506105b792505050565b90506000600582106102ff576102f8847f0000000000000000000000000000000000000000000000000000000000000000610d67565b90506103c2565b81600403610331576102f8847f0000000000000000000000000000000000000000000000000000000000000000610d67565b81600303610363576102f8847f0000000000000000000000000000000000000000000000000000000000000000610d67565b81600203610395576102f8847f0000000000000000000000000000000000000000000000000000000000000000610d67565b6103bf847f0000000000000000000000000000000000000000000000000000000000000000610d67565b90505b60405180604001604052806103d6836107be565b81526020016104266104218a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92508b91506108729050565b6107be565b9052979650505050505050565b6000806201518061044c670de0b6b3a764000085610d67565b6104569190610d7e565b9050600061046c670de0b6b3a764000083610d7e565b905084811c6000610485670de0b6b3a764000084610d67565b61048f9085610db9565b90506000670de0b6b3a76400006104a98362010000610d67565b6104b39190610d7e565b905060006104c18285610935565b9998505050505050505050565b600061051661042186868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508892508791506108729050565b95945050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061026757507fffffffff0000000000000000000000000000000000000000000000000000000082167f50e9a715000000000000000000000000000000000000000000000000000000001492915050565b8051600090819081905b808210156107b55760008583815181106105dd576105dd610dcc565b01602001517fff000000000000000000000000000000000000000000000000000000000000001690507f800000000000000000000000000000000000000000000000000000000000000081101561064057610639600184610dfb565b92506107a2565b7fe0000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216101561069557610639600284610dfb565b7ff0000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821610156106ea57610639600384610dfb565b7ff8000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216101561073f57610639600484610dfb565b7ffc000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216101561079457610639600584610dfb565b61079f600684610dfb565b92505b50826107ad81610e0e565b9350506105c1565b50909392505050565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561082c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108509190610e46565b905080610861846305f5e100610d67565b61086b9190610d7e565b9392505050565b60006108816276a70084610dfb565b9250428311156108935750600061086b565b600061089f8442610db9565b905060006108cd7f000000000000000000000000000000000000000000000000000000000000000083610433565b90507f00000000000000000000000000000000000000000000000000000000000000008110610929576109207f000000000000000000000000000000000000000000000000000000000000000082610db9565b9250505061086b565b50600095945050505050565b6000600183161561096857670de0b6b3a764000061095b670de0ad151d09418084610d67565b6109659190610d7e565b91505b600283161561099957670de0b6b3a764000061098c670de0a3769959680084610d67565b6109969190610d7e565b91505b60048316156109ca57670de0b6b3a76400006109bd670de09039a5fa510084610d67565b6109c79190610d7e565b91505b60088316156109fb57670de0b6b3a76400006109ee670de069c00f3e120084610d67565b6109f89190610d7e565b91505b6010831615610a2c57670de0b6b3a7640000610a1f670de01cce21c9440084610d67565b610a299190610d7e565b91505b6020831615610a5d57670de0b6b3a7640000610a50670ddf82ef46ce100084610d67565b610a5a9190610d7e565b91505b6040831615610a8e57670de0b6b3a7640000610a81670dde4f458f8e8d8084610d67565b610a8b9190610d7e565b91505b6080831615610abf57670de0b6b3a7640000610ab2670ddbe84213d5f08084610d67565b610abc9190610d7e565b91505b610100831615610af157670de0b6b3a7640000610ae4670dd71b7aa6df5b8084610d67565b610aee9190610d7e565b91505b610200831615610b2357670de0b6b3a7640000610b16670dcd86e7f28cde0084610d67565b610b209190610d7e565b91505b610400831615610b5557670de0b6b3a7640000610b48670dba71a3084ad68084610d67565b610b529190610d7e565b91505b610800831615610b8757670de0b6b3a7640000610b7a670d94961b13dbde8084610d67565b610b849190610d7e565b91505b611000831615610bb957670de0b6b3a7640000610bac670d4a171c35c9838084610d67565b610bb69190610d7e565b91505b612000831615610beb57670de0b6b3a7640000610bde670cb9da519ccfb70084610d67565b610be89190610d7e565b91505b614000831615610c1d57670de0b6b3a7640000610c10670bab76d59c18d68084610d67565b610c1a9190610d7e565b91505b618000831615610c4f57670de0b6b3a7640000610c426709d025defee4df8084610d67565b610c4c9190610d7e565b91505b50919050565b600060208284031215610c6757600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461086b57600080fd5b60008060008060608587031215610cad57600080fd5b843567ffffffffffffffff80821115610cc557600080fd5b818701915087601f830112610cd957600080fd5b813581811115610ce857600080fd5b886020828501011115610cfa57600080fd5b6020928301999098509187013596604001359550909350505050565b60008060408385031215610d2957600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808202811582820484141761026757610267610d38565b600082610db4577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561026757610267610d38565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b8082018082111561026757610267610d38565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610e3f57610e3f610d38565b5060010190565b600060208284031215610e5857600080fd5b505191905056fea264697066735822122026ee1972789ed12d69c43bb984759c3d84f50065c3e2508d4e865675e467d74564736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "decayedPremium(uint256,uint256)": { + "details": "Returns the premium price at current time elapsed", + "params": { + "elapsed": "time past since expiry", + "startPremium": "starting price" + } + }, + "premium(string,uint256,uint256)": { + "details": "Returns the pricing premium in wei." + }, + "price(string,uint256,uint256)": { + "details": "Returns the price to register or renew a name.", + "params": { + "duration": "How long the name is being registered or extended for, in seconds.", + "expires": "When the name presently expires (0 if this is a new registration).", + "name": "The name being registered or renewed." + }, + "returns": { + "_0": "base premium tuple of base price + premium price" + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/LegacyENSRegistry.json b/solidity/dns-contracts/deployments/ropsten/LegacyENSRegistry.json new file mode 100644 index 0000000..4d59051 --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/LegacyENSRegistry.json @@ -0,0 +1,204 @@ +{ + "address": "0x112234455C3a32FD11230C42E7Bccd4A84e02010", + "abi": [ + { + "constant": true, + "inputs": [ + { + "name": "node", + "type": "bytes32" + } + ], + "name": "resolver", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "node", + "type": "bytes32" + } + ], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "node", + "type": "bytes32" + }, + { + "name": "label", + "type": "bytes32" + }, + { + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "node", + "type": "bytes32" + }, + { + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "node", + "type": "bytes32" + } + ], + "name": "ttl", + "outputs": [ + { + "name": "", + "type": "uint64" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "node", + "type": "bytes32" + }, + { + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "node", + "type": "bytes32" + }, + { + "name": "owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "name": "owner", + "type": "address" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "name": "owner", + "type": "address" + } + ], + "name": "NewOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "name": "resolver", + "type": "address" + } + ], + "name": "NewResolver", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "name": "ttl", + "type": "uint64" + } + ], + "name": "NewTTL", + "type": "event" + } + ] +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/NameWrapper.json b/solidity/dns-contracts/deployments/ropsten/NameWrapper.json new file mode 100644 index 0000000..389cf90 --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/NameWrapper.json @@ -0,0 +1,1827 @@ +{ + "address": "0xF82155e2a43Be0871821E9654Fc8Ae894FB8307C", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract IBaseRegistrar", + "name": "_registrar", + "type": "address" + }, + { + "internalType": "contract IMetadataService", + "name": "_metadataService", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "CannotUpgrade", + "type": "error" + }, + { + "inputs": [], + "name": "IncompatibleParent", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "IncorrectTargetOwner", + "type": "error" + }, + { + "inputs": [], + "name": "IncorrectTokenType", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "labelHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "expectedLabelhash", + "type": "bytes32" + } + ], + "name": "LabelMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + } + ], + "name": "LabelTooLong", + "type": "error" + }, + { + "inputs": [], + "name": "LabelTooShort", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "OperationProhibited", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "Unauthorised", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "ControllerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "FusesSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NameUnwrapped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "NameWrapped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + } + ], + "name": "TransferBatch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "TransferSingle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "value", + "type": "string" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "URI", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "_tokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint32", + "name": "fuseMask", + "type": "uint32" + } + ], + "name": "allFusesBurned", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "accounts", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + } + ], + "name": "balanceOfBatch", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "getData", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint32", + "name": "", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "isTokenOwnerOrApproved", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "isWrapped", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "metadataService", + "outputs": [ + { + "internalType": "contract IMetadataService", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "names", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "recoverFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "registerAndWrapETH2LD", + "outputs": [ + { + "internalType": "uint256", + "name": "registrarExpiry", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "registrar", + "outputs": [ + { + "internalType": "contract IBaseRegistrar", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "renew", + "outputs": [ + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeBatchTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setChildFuses", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + } + ], + "name": "setFuses", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IMetadataService", + "name": "_metadataService", + "type": "address" + } + ], + "name": "setMetadataService", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setSubnodeOwner", + "outputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract INameWrapperUpgrade", + "name": "_upgradeAddress", + "type": "address" + } + ], + "name": "setUpgradeContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "unwrap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "unwrapETH2LD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "upgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "upgradeContract", + "outputs": [ + { + "internalType": "contract INameWrapperUpgrade", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "upgradeETH2LD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "uri", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "wrap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "wrapETH2LD", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xf8818cdbfaf4a80d0e999fc806a37f2dd798529d2eaf0fe62f7d218e8cf6e943", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0xF82155e2a43Be0871821E9654Fc8Ae894FB8307C", + "transactionIndex": 3, + "gasUsed": "5341921", + "logsBloom": "0x00000000000000000000004000000000000040000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000200000010000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000004000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x9883a31efcf66733158f63349cd6370d059758cdd02b691b8880f4abac7351bb", + "transactionHash": "0xf8818cdbfaf4a80d0e999fc806a37f2dd798529d2eaf0fe62f7d218e8cf6e943", + "logs": [ + { + "transactionIndex": 3, + "blockNumber": 13068658, + "transactionHash": "0xf8818cdbfaf4a80d0e999fc806a37f2dd798529d2eaf0fe62f7d218e8cf6e943", + "address": "0xF82155e2a43Be0871821E9654Fc8Ae894FB8307C", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000a303ddc620aa7d1390baccc8a495508b183fab59" + ], + "data": "0x", + "logIndex": 5, + "blockHash": "0x9883a31efcf66733158f63349cd6370d059758cdd02b691b8880f4abac7351bb" + } + ], + "blockNumber": 13068658, + "cumulativeGasUsed": "5546023", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85", + "0x3bAa5F3ea7bFCC8948c4140f233d72c11eBF0bdB" + ], + "numDeployments": 2, + "solcInputHash": "e0f6f00faee6ee60a1220d91a962cdaa", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"_registrar\",\"type\":\"address\"},{\"internalType\":\"contract IMetadataService\",\"name\":\"_metadataService\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CannotUpgrade\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncompatibleParent\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"IncorrectTargetOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncorrectTokenType\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"labelHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"expectedLabelhash\",\"type\":\"bytes32\"}],\"name\":\"LabelMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"}],\"name\":\"LabelTooLong\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LabelTooShort\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"OperationProhibited\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"Unauthorised\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"}],\"name\":\"ControllerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"FusesSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"NameUnwrapped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"NameWrapped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"name\":\"TransferBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"TransferSingle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"URI\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"_tokens\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"fuseMask\",\"type\":\"uint32\"}],\"name\":\"allFusesBurned\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"balanceOfBatch\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getData\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isTokenOwnerOrApproved\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"isWrapped\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"metadataService\",\"outputs\":[{\"internalType\":\"contract IMetadataService\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"names\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"onERC721Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"recoverFunds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"registerAndWrapETH2LD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"registrarExpiry\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"registrar\",\"outputs\":[{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"renew\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeBatchTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setChildFuses\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"}],\"name\":\"setFuses\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IMetadataService\",\"name\":\"_metadataService\",\"type\":\"address\"}],\"name\":\"setMetadataService\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"}],\"name\":\"setRecord\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setSubnodeOwner\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setSubnodeRecord\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"}],\"name\":\"setTTL\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract INameWrapperUpgrade\",\"name\":\"_upgradeAddress\",\"type\":\"address\"}],\"name\":\"setUpgradeContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"unwrap\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"registrant\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"unwrapETH2LD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"upgrade\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"upgradeContract\",\"outputs\":[{\"internalType\":\"contract INameWrapperUpgrade\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"upgradeETH2LD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"wrap\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"wrapETH2LD\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"allFusesBurned(bytes32,uint32)\":{\"params\":{\"fuseMask\":\"The fuses you want to check\",\"node\":\"Namehash of the name\"},\"returns\":{\"_0\":\"Boolean of whether or not all the selected fuses are burned\"}},\"balanceOf(address,uint256)\":{\"details\":\"See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address.\"},\"balanceOfBatch(address[],uint256[])\":{\"details\":\"See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length.\"},\"getData(uint256)\":{\"params\":{\"id\":\"Label as a string of the .eth domain to wrap\"},\"returns\":{\"_0\":\"address The owner of the name\",\"_1\":\"uint32 Fuses of the name\",\"_2\":\"uint64 Expiry of when the fuses expire for the name\"}},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC1155-isApprovedForAll}.\"},\"isTokenOwnerOrApproved(bytes32,address)\":{\"params\":{\"addr\":\"which address to check permissions for\",\"node\":\"namehash of the name to check\"},\"returns\":{\"_0\":\"whether or not is owner or approved\"}},\"isWrapped(bytes32)\":{\"details\":\"Both of these checks need to be true to be considered wrapped if checked without this contract\",\"params\":{\"node\":\"Namehash of the name\"},\"returns\":{\"_0\":\"Boolean of whether or not the name is wrapped\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"ownerOf(uint256)\":{\"params\":{\"id\":\"Label as a string of the .eth domain to wrap\"},\"returns\":{\"owner\":\"The owner of the name\"}},\"recoverFunds(address,address,uint256)\":{\"details\":\"The contract is Ownable and only the owner can call the recover function.\",\"params\":{\"_amount\":\"The amount of tokens to recover.\",\"_to\":\"The address to send the tokens to.\",\"_token\":\"The address of the ERC20 token to recover\"}},\"registerAndWrapETH2LD(string,address,uint256,address,uint32,uint64)\":{\"details\":\"Registers a new .eth second-level domain and wraps it. Only callable by authorised controllers.\",\"params\":{\"duration\":\"The duration, in seconds, to register the name for.\",\"expiry\":\"When the fuses will expire\",\"fuses\":\"Initial fuses to set\",\"label\":\"The label to register (Eg, 'foo' for 'foo.eth').\",\"resolver\":\"The resolver address to set on the ENS registry (optional).\",\"wrappedOwner\":\"The owner of the wrapped name.\"},\"returns\":{\"registrarExpiry\":\"The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\"}},\"renew(uint256,uint256,uint32,uint64)\":{\"details\":\"Only callable by authorised controllers.\",\"params\":{\"duration\":\"The number of seconds to renew the name for.\",\"tokenId\":\"The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\"},\"returns\":{\"expires\":\"The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)\":{\"details\":\"See {IERC1155-safeBatchTransferFrom}.\"},\"safeTransferFrom(address,address,uint256,uint256,bytes)\":{\"details\":\"See {IERC1155-safeTransferFrom}.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC1155-setApprovalForAll}.\"},\"setChildFuses(bytes32,bytes32,uint32,uint64)\":{\"params\":{\"expiry\":\"When the fuses will expire\",\"fuses\":\"Fuses to burn\",\"labelhash\":\"Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\",\"parentNode\":\"Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\"}},\"setFuses(bytes32,uint32)\":{\"params\":{\"fuses\":\"Fuses to burn (cannot burn PARENT_CANNOT_CONTROL)\",\"node\":\"Namehash of the name\"},\"returns\":{\"_0\":\"New fuses\"}},\"setMetadataService(address)\":{\"params\":{\"_metadataService\":\"The new metadata service\"}},\"setRecord(bytes32,address,address,uint64)\":{\"params\":{\"node\":\"Namehash of the name to set a record for\",\"owner\":\"New owner in the registry\",\"resolver\":\"Resolver contract\",\"ttl\":\"Time to live in the registry\"}},\"setResolver(bytes32,address)\":{\"params\":{\"node\":\"namehash of the name\",\"resolver\":\"the resolver contract\"}},\"setSubnodeOwner(bytes32,string,address,uint32,uint64)\":{\"params\":{\"expiry\":\"When the fuses will expire\",\"fuses\":\"Initial fuses for the wrapped subdomain\",\"label\":\"Label of the subdomain as a string\",\"owner\":\"New owner in the wrapper\",\"parentNode\":\"Parent namehash of the subdomain\"},\"returns\":{\"node\":\"Namehash of the subdomain\"}},\"setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)\":{\"params\":{\"expiry\":\"expiry date for the domain\",\"fuses\":\"initial fuses for the wrapped subdomain\",\"label\":\"label of the subdomain as a string\",\"owner\":\"new owner in the wrapper\",\"parentNode\":\"parent namehash of the subdomain\",\"resolver\":\"resolver contract in the registry\",\"ttl\":\"ttl in the regsitry\"},\"returns\":{\"node\":\"Namehash of the subdomain\"}},\"setTTL(bytes32,uint64)\":{\"params\":{\"node\":\"Namehash of the name\",\"ttl\":\"TTL in the registry\"}},\"setUpgradeContract(address)\":{\"details\":\"The default value of upgradeContract is the 0 address. Use the 0 address at any time to make the contract not upgradable.\",\"params\":{\"_upgradeAddress\":\"address of an upgraded contract\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"unwrap(bytes32,bytes32,address)\":{\"details\":\"Can be called by the owner in the wrapper or an authorised caller in the wrapper\",\"params\":{\"controller\":\"Sets the owner in the registry to this address\",\"labelhash\":\"Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\",\"parentNode\":\"Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\"}},\"unwrapETH2LD(bytes32,address,address)\":{\"details\":\"Can be called by the owner in the wrapper or an authorised caller in the wrapper\",\"params\":{\"controller\":\"Sets the owner in the registry to this address\",\"labelhash\":\"Labelhash of the .eth domain\",\"registrant\":\"Sets the owner in the .eth registrar to this address\"}},\"upgrade(bytes32,string,address,address)\":{\"details\":\"Can be called by the owner or an authorised caller Requires upgraded Namewrapper to permit old Namewrapper to call `setSubnodeRecord` for all names\",\"params\":{\"label\":\"Label as a string of the name to upgrade\",\"parentNode\":\"Namehash of the parent name\",\"resolver\":\"Resolver contract for this name\",\"wrappedOwner\":\"Owner of the name in this contract\"}},\"upgradeETH2LD(string,address,address)\":{\"details\":\"Can be called by the owner of the name in this contract\",\"params\":{\"label\":\"Label as a string of the .eth name to upgrade\",\"wrappedOwner\":\"The owner of the wrapped name\"}},\"uri(uint256)\":{\"params\":{\"tokenId\":\"The id of the token\"},\"returns\":{\"_0\":\"string uri of the metadata service\"}},\"wrap(bytes,address,address)\":{\"details\":\"Can be called by the owner in the registry or an authorised caller in the registry\",\"params\":{\"name\":\"The name to wrap, in DNS format\",\"resolver\":\"Resolver contract\",\"wrappedOwner\":\"Owner of the name in this contract\"}},\"wrapETH2LD(string,address,uint32,uint64,address)\":{\"details\":\"Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\",\"params\":{\"expiry\":\"When the fuses will expire\",\"fuses\":\"Initial fuses to set\",\"label\":\"Label as a string of the .eth domain to wrap\",\"resolver\":\"Resolver contract address\",\"wrappedOwner\":\"Owner of the name in this contract\"},\"returns\":{\"_0\":\"Normalised expiry of when the fuses expire\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"allFusesBurned(bytes32,uint32)\":{\"notice\":\"Checks all Fuses in the mask are burned for the node\"},\"getData(uint256)\":{\"notice\":\"Gets the data for a name\"},\"isTokenOwnerOrApproved(bytes32,address)\":{\"notice\":\"Checks if owner or approved by owner\"},\"isWrapped(bytes32)\":{\"notice\":\"Checks if a name is wrapped or not\"},\"ownerOf(uint256)\":{\"notice\":\"Gets the owner of a name\"},\"recoverFunds(address,address,uint256)\":{\"notice\":\"Recover ERC20 tokens sent to the contract by mistake.\"},\"renew(uint256,uint256,uint32,uint64)\":{\"notice\":\"Renews a .eth second-level domain.\"},\"setChildFuses(bytes32,bytes32,uint32,uint64)\":{\"notice\":\"Sets fuses of a name that you own the parent of. Can also be called by the owner of a .eth name\"},\"setFuses(bytes32,uint32)\":{\"notice\":\"Sets fuses of a name\"},\"setMetadataService(address)\":{\"notice\":\"Set the metadata service. Only the owner can do this\"},\"setRecord(bytes32,address,address,uint64)\":{\"notice\":\"Sets records for the name in the ENS Registry\"},\"setResolver(bytes32,address)\":{\"notice\":\"Sets resolver contract in the registry\"},\"setSubnodeOwner(bytes32,string,address,uint32,uint64)\":{\"notice\":\"Sets the subdomain owner in the registry and then wraps the subdomain\"},\"setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)\":{\"notice\":\"Sets the subdomain owner in the registry with records and then wraps the subdomain\"},\"setTTL(bytes32,uint64)\":{\"notice\":\"Sets TTL in the registry\"},\"setUpgradeContract(address)\":{\"notice\":\"Set the address of the upgradeContract of the contract. only admin can do this\"},\"unwrap(bytes32,bytes32,address)\":{\"notice\":\"Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\"},\"unwrapETH2LD(bytes32,address,address)\":{\"notice\":\"Unwraps a .eth domain. e.g. vitalik.eth\"},\"upgrade(bytes32,string,address,address)\":{\"notice\":\"Upgrades a non .eth domain of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\"},\"upgradeETH2LD(string,address,address)\":{\"notice\":\"Upgrades a .eth wrapped domain by calling the wrapETH2LD function of the upgradeContract and burning the token of this contract\"},\"uri(uint256)\":{\"notice\":\"Get the metadata uri\"},\"wrap(bytes,address,address)\":{\"notice\":\"Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\"},\"wrapETH2LD(string,address,uint32,uint64,address)\":{\"notice\":\"Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/wrapper/NameWrapper.sol\":\"NameWrapper\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0x24e0364e503a9bbde94c715d26573a76f14cd2a202d45f96f52134ab806b67b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x8e93de94c9062ebc94fb7e2e3929b0781ac6a2b7772e2f7a59045861c93e5be9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\ninterface IERC1155Receiver is IERC165 {\\n /**\\n * @dev Handles the receipt of a single ERC1155 token type. This function is\\n * called at the end of a `safeTransferFrom` after the balance has been updated.\\n *\\n * NOTE: To accept the transfer, this must return\\n * `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))`\\n * (i.e. 0xf23a6e61, or its own function selector).\\n *\\n * @param operator The address which initiated the transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param id The ID of the token being transferred\\n * @param value The amount of tokens being transferred\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155Received(\\n address operator,\\n address from,\\n uint256 id,\\n uint256 value,\\n bytes calldata data\\n ) external returns (bytes4);\\n\\n /**\\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\\n * is called at the end of a `safeBatchTransferFrom` after the balances have\\n * been updated.\\n *\\n * NOTE: To accept the transfer(s), this must return\\n * `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))`\\n * (i.e. 0xbc197c81, or its own function selector).\\n *\\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xeb373f1fdc7b755c6a750123a9b9e3a8a02c1470042fd6505d875000a80bde0b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC1155.sol\\\";\\n\\n/**\\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155MetadataURI is IERC1155 {\\n /**\\n * @dev Returns the URI for token type `id`.\\n *\\n * If the `\\\\{id\\\\}` substring is present in the URI, it must be replaced by\\n * clients with the actual token type ID.\\n */\\n function uri(uint256 id) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xa66d18b9a85458d28fc3304717964502ae36f7f8a2ff35bc83f6f85d74b03574\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0xbbc8ac883ac3c0078ce5ad3e288fbb3ffcc8a30c3a98c0fda0114d64fc44fca2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x516a22876c1fab47f49b1bc22b4614491cd05338af8bd2e7b382da090a079990\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xd5fa74b4fb323776fa4a8158800fec9d5ac0fec0d6dd046dd93798632ada265f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x9ac51351ff72d73083aed62b7cdad4c07e9d1eb68401d7fd8457bdd828f2c6fe\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(address owner, address operator)\\n external\\n view\\n returns (bool);\\n}\\n\",\"keccak256\":\"0xf79be82c1a2eb0a77fba4e0972221912e803309081ca460fd2cf61653e55758a\"},\"contracts/utils/ERC20Recoverable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\\n */\\n\\ncontract ERC20Recoverable is Ownable {\\n /**\\n @notice Recover ERC20 tokens sent to the contract by mistake.\\n @dev The contract is Ownable and only the owner can call the recover function.\\n @param _to The address to send the tokens to.\\n@param _token The address of the ERC20 token to recover\\n @param _amount The amount of tokens to recover.\\n */\\n function recoverFunds(\\n address _token,\\n address _to,\\n uint256 _amount\\n ) external onlyOwner {\\n IERC20(_token).transfer(_to, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x793a38091e1f81499a29ddba82c2b2f3cdd07071b81a832886e8e02a45ff352a\",\"license\":\"MIT\"},\"contracts/wrapper/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(bytes memory self, uint256 offset)\\n internal\\n pure\\n returns (bytes32)\\n {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(bytes memory self, uint256 idx)\\n internal\\n pure\\n returns (bytes32 labelhash, uint256 newIdx)\\n {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n}\\n\",\"keccak256\":\"0xc0d13fcaccd6c3af927106b2ea48eec83c5d0a18d608bde013a53742ac058526\",\"license\":\"MIT\"},\"contracts/wrapper/Controllable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool active);\\n\\n function setController(address controller, bool active) public onlyOwner {\\n controllers[controller] = active;\\n emit ControllerChanged(controller, active);\\n }\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x9a9191656a82eda6763cda29ce893ddbfddb6c43559ff3b90c00a184e14e1fa1\",\"license\":\"MIT\"},\"contracts/wrapper/ERC1155Fuse.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _canTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\\n\\nerror OperationProhibited(bytes32 node);\\n\\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\\n using Address for address;\\n mapping(uint256 => uint256) public _tokens;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**************************************************************************\\n * ERC721 methods\\n *************************************************************************/\\n\\n function ownerOf(uint256 id) public view virtual returns (address) {\\n (address owner, , ) = getData(id);\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId)\\n public\\n view\\n virtual\\n override(ERC165, IERC165)\\n returns (bool)\\n {\\n return\\n interfaceId == type(IERC1155).interfaceId ||\\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id)\\n public\\n view\\n virtual\\n override\\n returns (uint256)\\n {\\n require(\\n account != address(0),\\n \\\"ERC1155: balance query for the zero address\\\"\\n );\\n (address owner, , ) = getData(id);\\n if (owner == account) {\\n return 1;\\n }\\n return 0;\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOfBatch}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(address[] memory accounts, uint256[] memory ids)\\n public\\n view\\n virtual\\n override\\n returns (uint256[] memory)\\n {\\n require(\\n accounts.length == ids.length,\\n \\\"ERC1155: accounts and ids length mismatch\\\"\\n );\\n\\n uint256[] memory batchBalances = new uint256[](accounts.length);\\n\\n for (uint256 i = 0; i < accounts.length; ++i) {\\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\\n }\\n\\n return batchBalances;\\n }\\n\\n /**\\n * @dev See {IERC1155-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved)\\n public\\n virtual\\n override\\n {\\n require(\\n msg.sender != operator,\\n \\\"ERC1155: setting approval status for self\\\"\\n );\\n\\n _operatorApprovals[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC1155-isApprovedForAll}.\\n */\\n function isApprovedForAll(address account, address operator)\\n public\\n view\\n virtual\\n override\\n returns (bool)\\n {\\n return _operatorApprovals[account][operator];\\n }\\n\\n /**\\n * @dev Returns the Name's owner address and fuses\\n */\\n function getData(uint256 tokenId)\\n public\\n view\\n virtual\\n returns (\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n )\\n {\\n uint256 t = _tokens[tokenId];\\n owner = address(uint160(t));\\n expiry = uint64(t >> 192);\\n if (block.timestamp > expiry) {\\n fuses = 0;\\n } else {\\n fuses = uint32(t >> 160);\\n }\\n }\\n\\n /**\\n * @dev See {IERC1155-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) public virtual override {\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n require(\\n from == msg.sender || isApprovedForAll(from, msg.sender),\\n \\\"ERC1155: caller is not owner nor approved\\\"\\n );\\n\\n _transfer(from, to, id, amount, data);\\n }\\n\\n /**\\n * @dev See {IERC1155-safeBatchTransferFrom}.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) public virtual override {\\n require(\\n ids.length == amounts.length,\\n \\\"ERC1155: ids and amounts length mismatch\\\"\\n );\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n require(\\n from == msg.sender || isApprovedForAll(from, msg.sender),\\n \\\"ERC1155: transfer caller is not owner nor approved\\\"\\n );\\n\\n for (uint256 i = 0; i < ids.length; ++i) {\\n uint256 id = ids[i];\\n uint256 amount = amounts[i];\\n\\n (address oldOwner, uint32 fuses, uint64 expiration) = getData(id);\\n\\n if (!_canTransfer(fuses)) {\\n revert OperationProhibited(bytes32(id));\\n }\\n\\n require(\\n amount == 1 && oldOwner == from,\\n \\\"ERC1155: insufficient balance for transfer\\\"\\n );\\n _setData(id, to, fuses, expiration);\\n }\\n\\n emit TransferBatch(msg.sender, from, to, ids, amounts);\\n\\n _doSafeBatchTransferAcceptanceCheck(\\n msg.sender,\\n from,\\n to,\\n ids,\\n amounts,\\n data\\n );\\n }\\n\\n /**************************************************************************\\n * Internal/private methods\\n *************************************************************************/\\n\\n /**\\n * @dev Sets the Name's owner address and fuses\\n */\\n function _setData(\\n uint256 tokenId,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual {\\n _tokens[tokenId] =\\n uint256(uint160(owner)) |\\n (uint256(fuses) << 160) |\\n (uint256(expiry) << 192);\\n }\\n\\n function _canTransfer(uint32 fuses) internal virtual returns (bool);\\n\\n function _mint(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual {\\n uint256 tokenId = uint256(node);\\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n\\n if (oldExpiry > expiry) {\\n expiry = oldExpiry;\\n }\\n\\n require(oldOwner == address(0), \\\"ERC1155: mint of existing token\\\");\\n require(owner != address(0), \\\"ERC1155: mint to the zero address\\\");\\n require(\\n owner != address(this),\\n \\\"ERC1155: newOwner cannot be the NameWrapper contract\\\"\\n );\\n\\n _setData(tokenId, owner, fuses | oldFuses, expiry);\\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\\n _doSafeTransferAcceptanceCheck(\\n msg.sender,\\n address(0),\\n owner,\\n tokenId,\\n 1,\\n \\\"\\\"\\n );\\n }\\n\\n function _burn(uint256 tokenId) internal virtual {\\n (address owner, uint32 fuses, uint64 expiry) = getData(tokenId);\\n // Fuses and expiry are kept on burn\\n _setData(tokenId, address(0x0), fuses, expiry);\\n emit TransferSingle(msg.sender, owner, address(0x0), tokenId, 1);\\n }\\n\\n function _transfer(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) internal {\\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\\n\\n if (!_canTransfer(fuses)) {\\n revert OperationProhibited(bytes32(id));\\n }\\n\\n require(\\n amount == 1 && oldOwner == from,\\n \\\"ERC1155: insufficient balance for transfer\\\"\\n );\\n\\n if (oldOwner == to) {\\n return;\\n }\\n\\n _setData(id, to, fuses, expiry);\\n\\n emit TransferSingle(msg.sender, from, to, id, amount);\\n\\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\\n }\\n\\n function _doSafeTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try\\n IERC1155Receiver(to).onERC1155Received(\\n operator,\\n from,\\n id,\\n amount,\\n data\\n )\\n returns (bytes4 response) {\\n if (\\n response != IERC1155Receiver(to).onERC1155Received.selector\\n ) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n function _doSafeBatchTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try\\n IERC1155Receiver(to).onERC1155BatchReceived(\\n operator,\\n from,\\n ids,\\n amounts,\\n data\\n )\\n returns (bytes4 response) {\\n if (\\n response !=\\n IERC1155Receiver(to).onERC1155BatchReceived.selector\\n ) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5af84ab27b3f359527255d8d3f19ad9ea428165ab632a2ab4ad6fdeb8b48389d\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant PARENT_CANNOT_CONTROL = 64;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 _expiry,\\n address resolver\\n ) external returns (uint64 expiry);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (uint256 expires);\\n\\n function unwrap(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function setFuses(bytes32 node, uint32 fuses)\\n external\\n returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function isTokenOwnerOrApproved(bytes32 node, address addr)\\n external\\n returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external returns (address owner);\\n\\n function getData(uint256 id)\\n external\\n returns (\\n address,\\n uint32,\\n uint64\\n );\\n\\n function allFusesBurned(bytes32 node, uint32 fuseMask)\\n external\\n view\\n returns (bool);\\n\\n function isWrapped(bytes32 node) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x9c0ff4675d7faf51638138ecfc76a1f50c1005d1005bfba31c1cac7990a43c30\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function setSubnodeRecord(\\n bytes32 parentNode,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address resolver\\n ) external;\\n}\\n\",\"keccak256\":\"0x40b2719f8a3c5f037dd7c827fd5e694d0e5485bbbca4e66aa9334e097f3d2854\",\"license\":\"MIT\"},\"contracts/wrapper/NameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport {ERC1155Fuse, IERC165, OperationProhibited} from \\\"./ERC1155Fuse.sol\\\";\\nimport {Controllable} from \\\"./Controllable.sol\\\";\\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING} from \\\"./INameWrapper.sol\\\";\\nimport {INameWrapperUpgrade} from \\\"./INameWrapperUpgrade.sol\\\";\\nimport {IMetadataService} from \\\"./IMetadataService.sol\\\";\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IBaseRegistrar} from \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport {IERC721Receiver} from \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {BytesUtils} from \\\"./BytesUtils.sol\\\";\\nimport {ERC20Recoverable} from \\\"../utils/ERC20Recoverable.sol\\\";\\n\\nerror Unauthorised(bytes32 node, address addr);\\nerror NameNotFound();\\nerror IncompatibleParent();\\nerror IncompatibleName(bytes name);\\nerror IncorrectTokenType();\\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\\nerror LabelTooShort();\\nerror LabelTooLong(string label);\\nerror IncorrectTargetOwner(address owner);\\nerror CannotUpgrade();\\n\\ncontract NameWrapper is\\n Ownable,\\n ERC1155Fuse,\\n INameWrapper,\\n Controllable,\\n IERC721Receiver,\\n ERC20Recoverable\\n{\\n using BytesUtils for bytes;\\n ENS public immutable override ens;\\n IBaseRegistrar public immutable override registrar;\\n IMetadataService public override metadataService;\\n mapping(bytes32 => bytes) public override names;\\n\\n bytes32 private constant ETH_NODE =\\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\\n bytes32 private constant ROOT_NODE =\\n 0x0000000000000000000000000000000000000000000000000000000000000000;\\n\\n INameWrapperUpgrade public upgradeContract;\\n uint64 private constant MAX_EXPIRY = type(uint64).max;\\n\\n constructor(\\n ENS _ens,\\n IBaseRegistrar _registrar,\\n IMetadataService _metadataService\\n ) {\\n ens = _ens;\\n registrar = _registrar;\\n metadataService = _metadataService;\\n\\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE */\\n\\n _setData(\\n uint256(ETH_NODE),\\n address(0),\\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\\n MAX_EXPIRY\\n );\\n _setData(\\n uint256(ROOT_NODE),\\n address(0),\\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\\n MAX_EXPIRY\\n );\\n names[ROOT_NODE] = \\\"\\\\x00\\\";\\n names[ETH_NODE] = \\\"\\\\x03eth\\\\x00\\\";\\n }\\n\\n function supportsInterface(bytes4 interfaceId)\\n public\\n view\\n virtual\\n override(ERC1155Fuse, IERC165)\\n returns (bool)\\n {\\n return\\n interfaceId == type(INameWrapper).interfaceId ||\\n interfaceId == type(IERC721Receiver).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /* ERC1155 Fuse */\\n\\n /**\\n * @notice Gets the owner of a name\\n * @param id Label as a string of the .eth domain to wrap\\n * @return owner The owner of the name\\n */\\n\\n function ownerOf(uint256 id)\\n public\\n view\\n override(ERC1155Fuse, INameWrapper)\\n returns (address owner)\\n {\\n return super.ownerOf(id);\\n }\\n\\n /**\\n * @notice Gets the data for a name\\n * @param id Label as a string of the .eth domain to wrap\\n * @return address The owner of the name\\n * @return uint32 Fuses of the name\\n * @return uint64 Expiry of when the fuses expire for the name\\n */\\n\\n function getData(uint256 id)\\n public\\n view\\n override(ERC1155Fuse, INameWrapper)\\n returns (\\n address,\\n uint32,\\n uint64\\n )\\n {\\n return super.getData(id);\\n }\\n\\n /* Metadata service */\\n\\n /**\\n * @notice Set the metadata service. Only the owner can do this\\n * @param _metadataService The new metadata service\\n */\\n\\n function setMetadataService(IMetadataService _metadataService)\\n public\\n onlyOwner\\n {\\n metadataService = _metadataService;\\n }\\n\\n /**\\n * @notice Get the metadata uri\\n * @param tokenId The id of the token\\n * @return string uri of the metadata service\\n */\\n\\n function uri(uint256 tokenId) public view override returns (string memory) {\\n return metadataService.uri(tokenId);\\n }\\n\\n /**\\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\\n * to make the contract not upgradable.\\n * @param _upgradeAddress address of an upgraded contract\\n */\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress)\\n public\\n onlyOwner\\n {\\n if (address(upgradeContract) != address(0)) {\\n registrar.setApprovalForAll(address(upgradeContract), false);\\n ens.setApprovalForAll(address(upgradeContract), false);\\n }\\n\\n upgradeContract = _upgradeAddress;\\n\\n if (address(upgradeContract) != address(0)) {\\n registrar.setApprovalForAll(address(upgradeContract), true);\\n ens.setApprovalForAll(address(upgradeContract), true);\\n }\\n }\\n\\n /**\\n * @notice Checks if msg.sender is the owner or approved by the owner of a name\\n * @param node namehash of the name to check\\n */\\n\\n modifier onlyTokenOwner(bytes32 node) {\\n if (!isTokenOwnerOrApproved(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n _;\\n }\\n\\n /**\\n * @notice Checks if owner or approved by owner\\n * @param node namehash of the name to check\\n * @param addr which address to check permissions for\\n * @return whether or not is owner or approved\\n */\\n\\n function isTokenOwnerOrApproved(bytes32 node, address addr)\\n public\\n view\\n override\\n returns (bool)\\n {\\n address owner = ownerOf(uint256(node));\\n return owner == addr || isApprovedForAll(owner, addr);\\n }\\n\\n /**\\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\\n * @param label Label as a string of the .eth domain to wrap\\n * @param wrappedOwner Owner of the name in this contract\\n * @param fuses Initial fuses to set\\n * @param expiry When the fuses will expire\\n * @param resolver Resolver contract address\\n * @return Normalised expiry of when the fuses expire\\n */\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address resolver\\n ) public override returns (uint64) {\\n uint256 tokenId = uint256(keccak256(bytes(label)));\\n address registrant = registrar.ownerOf(tokenId);\\n if (\\n registrant != msg.sender &&\\n !registrar.isApprovedForAll(registrant, msg.sender)\\n ) {\\n revert Unauthorised(\\n _makeNode(ETH_NODE, bytes32(tokenId)),\\n msg.sender\\n );\\n }\\n\\n // transfer the token from the user to this contract\\n registrar.transferFrom(registrant, address(this), tokenId);\\n\\n // transfer the ens record back to the new owner (this contract)\\n registrar.reclaim(tokenId, address(this));\\n\\n return _wrapETH2LD(label, wrappedOwner, fuses, expiry, resolver);\\n }\\n\\n /**\\n * @dev Registers a new .eth second-level domain and wraps it.\\n * Only callable by authorised controllers.\\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\\n * @param wrappedOwner The owner of the wrapped name.\\n * @param duration The duration, in seconds, to register the name for.\\n * @param resolver The resolver address to set on the ENS registry (optional).\\n * @param fuses Initial fuses to set\\n * @param expiry When the fuses will expire\\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\\n */\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint32 fuses,\\n uint64 expiry\\n ) external override onlyController returns (uint256 registrarExpiry) {\\n uint256 tokenId = uint256(keccak256(bytes(label)));\\n registrarExpiry = registrar.register(tokenId, address(this), duration);\\n _wrapETH2LD(label, wrappedOwner, fuses, expiry, resolver);\\n }\\n\\n /**\\n * @notice Renews a .eth second-level domain.\\n * @dev Only callable by authorised controllers.\\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\\n * @param duration The number of seconds to renew the name for.\\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\\n */\\n\\n function renew(\\n uint256 tokenId,\\n uint256 duration,\\n uint32 fuses,\\n uint64 expiry\\n ) external override onlyController returns (uint256 expires) {\\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\\n\\n expires = registrar.renew(tokenId, duration);\\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n expiry = _normaliseExpiry(expiry, oldExpiry, uint64(expires));\\n\\n _setData(node, owner, oldFuses | fuses | PARENT_CANNOT_CONTROL, expiry);\\n }\\n\\n /**\\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\\n * @param name The name to wrap, in DNS format\\n * @param wrappedOwner Owner of the name in this contract\\n * @param resolver Resolver contract\\n */\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) public override {\\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\\n bytes32 parentNode = name.namehash(offset);\\n bytes32 node = _makeNode(parentNode, labelhash);\\n\\n if (parentNode == ETH_NODE) {\\n revert IncompatibleParent();\\n }\\n\\n address owner = ens.owner(node);\\n\\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n if (resolver != address(0)) {\\n ens.setResolver(node, resolver);\\n }\\n\\n ens.setOwner(node, address(this));\\n\\n _wrap(node, name, wrappedOwner, 0, 0);\\n }\\n\\n /**\\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\\n * @param labelhash Labelhash of the .eth domain\\n * @param registrant Sets the owner in the .eth registrar to this address\\n * @param controller Sets the owner in the registry to this address\\n */\\n\\n function unwrapETH2LD(\\n bytes32 labelhash,\\n address registrant,\\n address controller\\n ) public override onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\\n registrar.safeTransferFrom(\\n address(this),\\n registrant,\\n uint256(labelhash)\\n );\\n }\\n\\n /**\\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\\n * @param controller Sets the owner in the registry to this address\\n */\\n\\n function unwrap(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n address controller\\n ) public override onlyTokenOwner(_makeNode(parentNode, labelhash)) {\\n if (parentNode == ETH_NODE) {\\n revert IncompatibleParent();\\n }\\n _unwrap(_makeNode(parentNode, labelhash), controller);\\n }\\n\\n /**\\n * @notice Sets fuses of a name\\n * @param node Namehash of the name\\n * @param fuses Fuses to burn (cannot burn PARENT_CANNOT_CONTROL)\\n * @return New fuses\\n */\\n\\n function setFuses(bytes32 node, uint32 fuses)\\n public\\n onlyTokenOwner(node)\\n operationAllowed(node, CANNOT_BURN_FUSES)\\n returns (uint32)\\n {\\n _checkForParentCannotControl(node, fuses);\\n\\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\\n uint256(node)\\n );\\n\\n fuses |= oldFuses;\\n _setFuses(node, owner, fuses, expiry);\\n return fuses;\\n }\\n\\n /**\\n * @notice Upgrades a .eth wrapped domain by calling the wrapETH2LD function of the upgradeContract\\n * and burning the token of this contract\\n * @dev Can be called by the owner of the name in this contract\\n * @param label Label as a string of the .eth name to upgrade\\n * @param wrappedOwner The owner of the wrapped name\\n */\\n\\n function upgradeETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n address resolver\\n ) public {\\n bytes32 labelhash = keccak256(bytes(label));\\n bytes32 node = _makeNode(ETH_NODE, labelhash);\\n (uint32 fuses, uint64 expiry) = _prepareUpgrade(node);\\n\\n upgradeContract.wrapETH2LD(\\n label,\\n wrappedOwner,\\n fuses,\\n expiry,\\n resolver\\n );\\n }\\n\\n /**\\n * @notice Upgrades a non .eth domain of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\\n * @dev Can be called by the owner or an authorised caller\\n * Requires upgraded Namewrapper to permit old Namewrapper to call `setSubnodeRecord` for all names\\n * @param parentNode Namehash of the parent name\\n * @param label Label as a string of the name to upgrade\\n * @param wrappedOwner Owner of the name in this contract\\n * @param resolver Resolver contract for this name\\n */\\n\\n function upgrade(\\n bytes32 parentNode,\\n string calldata label,\\n address wrappedOwner,\\n address resolver\\n ) public {\\n bytes32 labelhash = keccak256(bytes(label));\\n bytes32 node = _makeNode(parentNode, labelhash);\\n (uint32 fuses, uint64 expiry) = _prepareUpgrade(node);\\n upgradeContract.setSubnodeRecord(\\n parentNode,\\n label,\\n wrappedOwner,\\n resolver,\\n 0,\\n fuses,\\n expiry\\n );\\n }\\n\\n /** \\n /* @notice Sets fuses of a name that you own the parent of. Can also be called by the owner of a .eth name\\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\\n * @param fuses Fuses to burn\\n * @param expiry When the fuses will expire\\n */\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) public {\\n bytes32 node = _makeNode(parentNode, labelhash);\\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n uint64 maxExpiry;\\n (, uint32 parentFuses, uint64 parentExpiry) = getData(\\n uint256(parentNode)\\n );\\n if (parentNode == ETH_NODE) {\\n if (!isTokenOwnerOrApproved(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n // max expiry is set to the expiry on the registrar\\n maxExpiry = uint64(registrar.nameExpires(uint256(labelhash)));\\n } else {\\n if (!isTokenOwnerOrApproved(parentNode, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n // max expiry is set to the expiry of the parent\\n maxExpiry = parentExpiry;\\n }\\n\\n _checkParentFuses(node, fuses, parentFuses);\\n\\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\\n\\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\\n if (\\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\\n oldFuses | fuses != oldFuses\\n ) {\\n revert OperationProhibited(node);\\n }\\n fuses |= oldFuses;\\n _setFuses(node, owner, fuses, expiry);\\n }\\n\\n /**\\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\\n * @param parentNode Parent namehash of the subdomain\\n * @param label Label of the subdomain as a string\\n * @param owner New owner in the wrapper\\n * @param fuses Initial fuses for the wrapped subdomain\\n * @param expiry When the fuses will expire\\n * @return node Namehash of the subdomain\\n */\\n\\n function setSubnodeOwner(\\n bytes32 parentNode,\\n string calldata label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n )\\n public\\n onlyTokenOwner(parentNode)\\n canCallSetSubnodeOwner(parentNode, keccak256(bytes(label)))\\n returns (bytes32 node)\\n {\\n bytes32 labelhash = keccak256(bytes(label));\\n node = _makeNode(parentNode, labelhash);\\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\\n\\n if (!isWrapped(node)) {\\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\\n _addLabelAndWrap(parentNode, node, label, owner, fuses, expiry);\\n } else {\\n _addLabelSetFusesAndTransfer(\\n parentNode,\\n node,\\n label,\\n owner,\\n fuses,\\n expiry\\n );\\n }\\n }\\n\\n /**\\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\\n * @param parentNode parent namehash of the subdomain\\n * @param label label of the subdomain as a string\\n * @param owner new owner in the wrapper\\n * @param resolver resolver contract in the registry\\n * @param ttl ttl in the regsitry\\n * @param fuses initial fuses for the wrapped subdomain\\n * @param expiry expiry date for the domain\\n * @return node Namehash of the subdomain\\n */\\n\\n function setSubnodeRecord(\\n bytes32 parentNode,\\n string memory label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n )\\n public\\n onlyTokenOwner(parentNode)\\n canCallSetSubnodeOwner(parentNode, keccak256(bytes(label)))\\n returns (bytes32 node)\\n {\\n bytes32 labelhash = keccak256(bytes(label));\\n node = _makeNode(parentNode, labelhash);\\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\\n if (!isWrapped(node)) {\\n ens.setSubnodeRecord(\\n parentNode,\\n labelhash,\\n address(this),\\n resolver,\\n ttl\\n );\\n _addLabelAndWrap(parentNode, node, label, owner, fuses, expiry);\\n } else {\\n ens.setSubnodeRecord(\\n parentNode,\\n labelhash,\\n address(this),\\n resolver,\\n ttl\\n );\\n _addLabelSetFusesAndTransfer(\\n parentNode,\\n node,\\n label,\\n owner,\\n fuses,\\n expiry\\n );\\n }\\n }\\n\\n /**\\n * @notice Sets records for the name in the ENS Registry\\n * @param node Namehash of the name to set a record for\\n * @param owner New owner in the registry\\n * @param resolver Resolver contract\\n * @param ttl Time to live in the registry\\n */\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n )\\n public\\n override\\n onlyTokenOwner(node)\\n operationAllowed(\\n node,\\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\\n )\\n {\\n ens.setRecord(node, address(this), resolver, ttl);\\n (address oldOwner, , ) = getData(uint256(node));\\n _transfer(oldOwner, owner, uint256(node), 1, \\\"\\\");\\n }\\n\\n /**\\n * @notice Sets resolver contract in the registry\\n * @param node namehash of the name\\n * @param resolver the resolver contract\\n */\\n\\n function setResolver(bytes32 node, address resolver)\\n public\\n override\\n onlyTokenOwner(node)\\n operationAllowed(node, CANNOT_SET_RESOLVER)\\n {\\n ens.setResolver(node, resolver);\\n }\\n\\n /**\\n * @notice Sets TTL in the registry\\n * @param node Namehash of the name\\n * @param ttl TTL in the registry\\n */\\n\\n function setTTL(bytes32 node, uint64 ttl)\\n public\\n override\\n onlyTokenOwner(node)\\n operationAllowed(node, CANNOT_SET_TTL)\\n {\\n ens.setTTL(node, ttl);\\n }\\n\\n /**\\n * @dev Allows an operation only if none of the specified fuses are burned.\\n * @param node The namehash of the name to check fuses on.\\n * @param fuseMask A bitmask of fuses that must not be burned.\\n */\\n\\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\\n (, uint32 fuses, ) = getData(uint256(node));\\n if (fuses & fuseMask != 0) {\\n revert OperationProhibited(node);\\n }\\n _;\\n }\\n\\n /**\\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\\n * replacing a subdomain. If either conditions are true, then it is possible to call\\n * setSubnodeOwner\\n * @param node Namehash of the name to check\\n * @param labelhash Labelhash of the name to check\\n */\\n\\n modifier canCallSetSubnodeOwner(bytes32 node, bytes32 labelhash) {\\n bytes32 subnode = _makeNode(node, labelhash);\\n address owner = ens.owner(subnode);\\n\\n if (owner == address(0)) {\\n (, uint32 fuses, ) = getData(uint256(node));\\n if (fuses & CANNOT_CREATE_SUBDOMAIN != 0) {\\n revert OperationProhibited(subnode);\\n }\\n } else {\\n (, uint32 subnodeFuses, ) = getData(uint256(subnode));\\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\\n revert OperationProhibited(subnode);\\n }\\n }\\n\\n _;\\n }\\n\\n /**\\n * @notice Checks all Fuses in the mask are burned for the node\\n * @param node Namehash of the name\\n * @param fuseMask The fuses you want to check\\n * @return Boolean of whether or not all the selected fuses are burned\\n */\\n\\n function allFusesBurned(bytes32 node, uint32 fuseMask)\\n public\\n view\\n override\\n returns (bool)\\n {\\n (, uint32 fuses, ) = getData(uint256(node));\\n return fuses & fuseMask == fuseMask;\\n }\\n\\n /**\\n * @notice Checks if a name is wrapped or not\\n * @dev Both of these checks need to be true to be considered wrapped if checked without this contract\\n * @param node Namehash of the name\\n * @return Boolean of whether or not the name is wrapped\\n */\\n\\n function isWrapped(bytes32 node) public view override returns (bool) {\\n return\\n ownerOf(uint256(node)) != address(0) &&\\n ens.owner(node) == address(this);\\n }\\n\\n function onERC721Received(\\n address to,\\n address,\\n uint256 tokenId,\\n bytes calldata data\\n ) public override returns (bytes4) {\\n //check if it's the eth registrar ERC721\\n if (msg.sender != address(registrar)) {\\n revert IncorrectTokenType();\\n }\\n\\n (\\n string memory label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry,\\n address resolver\\n ) = abi.decode(data, (string, address, uint32, uint64, address));\\n\\n bytes32 labelhash = bytes32(tokenId);\\n bytes32 labelhashFromData = keccak256(bytes(label));\\n\\n if (labelhashFromData != labelhash) {\\n revert LabelMismatch(labelhashFromData, labelhash);\\n }\\n\\n // transfer the ens record back to the new owner (this contract)\\n registrar.reclaim(uint256(labelhash), address(this));\\n\\n _wrapETH2LD(label, owner, fuses, expiry, resolver);\\n\\n return IERC721Receiver(to).onERC721Received.selector;\\n }\\n\\n /***** Internal functions */\\n\\n function _canTransfer(uint32 fuses) internal pure override returns (bool) {\\n return fuses & CANNOT_TRANSFER == 0;\\n }\\n\\n function _makeNode(bytes32 node, bytes32 labelhash)\\n private\\n pure\\n returns (bytes32)\\n {\\n return keccak256(abi.encodePacked(node, labelhash));\\n }\\n\\n function _addLabel(string memory label, bytes memory name)\\n internal\\n pure\\n returns (bytes memory ret)\\n {\\n if (bytes(label).length < 1) {\\n revert LabelTooShort();\\n }\\n if (bytes(label).length > 255) {\\n revert LabelTooLong(label);\\n }\\n return abi.encodePacked(uint8(bytes(label).length), label, name);\\n }\\n\\n function _mint(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal override {\\n _canFusesBeBurned(node, fuses);\\n address oldOwner = ownerOf(uint256(node));\\n if (oldOwner != address(0)) {\\n // burn and unwrap old token of old owner\\n _burn(uint256(node));\\n emit NameUnwrapped(node, address(0));\\n }\\n super._mint(node, owner, fuses, expiry);\\n }\\n\\n function _wrap(\\n bytes32 node,\\n bytes memory name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n names[node] = name;\\n _mint(node, wrappedOwner, fuses, expiry);\\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\\n }\\n\\n function _addLabelAndWrap(\\n bytes32 parentNode,\\n bytes32 node,\\n string memory label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n bytes memory name = _addLabel(label, names[parentNode]);\\n _wrap(node, name, owner, fuses, expiry);\\n }\\n\\n function _prepareUpgrade(bytes32 node)\\n private\\n returns (uint32 fuses, uint64 expiry)\\n {\\n if (address(upgradeContract) == address(0)) {\\n revert CannotUpgrade();\\n }\\n\\n if (!isTokenOwnerOrApproved(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n (, fuses, expiry) = getData(uint256(node));\\n\\n // burn token and fuse data\\n _burn(uint256(node));\\n }\\n\\n function _addLabelSetFusesAndTransfer(\\n bytes32 parentNode,\\n bytes32 node,\\n string memory label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n address oldOwner = ownerOf(uint256(node));\\n bytes memory name = _addLabel(label, names[parentNode]);\\n if (names[node].length == 0) {\\n names[node] = name;\\n }\\n _setFuses(node, oldOwner, fuses, expiry);\\n _transfer(oldOwner, owner, uint256(node), 1, \\\"\\\");\\n }\\n\\n // wrapper function for stack limit\\n function _checkParentFusesAndExpiry(\\n bytes32 parentNode,\\n bytes32 node,\\n uint32 fuses,\\n uint64 expiry\\n ) internal view returns (uint64) {\\n (, , uint64 oldExpiry) = getData(uint256(node));\\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\\n _checkParentFuses(node, fuses, parentFuses);\\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\\n }\\n\\n function _checkParentFuses(\\n bytes32 node,\\n uint32 fuses,\\n uint32 parentFuses\\n ) internal pure {\\n bool isBurningPCC = fuses & PARENT_CANNOT_CONTROL ==\\n PARENT_CANNOT_CONTROL;\\n\\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\\n\\n if (isBurningPCC && parentHasNotBurnedCU) {\\n revert OperationProhibited(node);\\n }\\n }\\n\\n function _getETH2LDDataAndNormaliseExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n )\\n internal\\n view\\n returns (\\n address owner,\\n uint32 fuses,\\n uint64\\n )\\n {\\n uint64 oldExpiry;\\n (owner, fuses, oldExpiry) = getData(uint256(node));\\n uint64 maxExpiry = uint64(registrar.nameExpires(uint256(labelhash)));\\n\\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\\n return (owner, fuses, expiry);\\n }\\n\\n function _normaliseExpiry(\\n uint64 expiry,\\n uint64 oldExpiry,\\n uint64 maxExpiry\\n ) internal pure returns (uint64) {\\n // Expiry cannot be more than maximum allowed\\n // .eth names will check registrar, non .eth check parent\\n if (expiry > maxExpiry) {\\n expiry = maxExpiry;\\n }\\n // Expiry cannot be less than old expiry\\n if (expiry < oldExpiry) {\\n expiry = oldExpiry;\\n }\\n\\n return expiry;\\n }\\n\\n function _wrapETH2LD(\\n string memory label,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address resolver\\n ) private returns (uint64) {\\n // Mint a new ERC1155 token with fuses\\n // Set PARENT_CANNOT_REPLACE to reflect wrapper + registrar control over the 2LD\\n bytes32 labelhash = keccak256(bytes(label));\\n bytes32 node = _makeNode(ETH_NODE, labelhash);\\n uint32 oldFuses;\\n\\n (, oldFuses, expiry) = _getETH2LDDataAndNormaliseExpiry(\\n node,\\n labelhash,\\n expiry\\n );\\n\\n _addLabelAndWrap(\\n ETH_NODE,\\n node,\\n label,\\n wrappedOwner,\\n fuses | PARENT_CANNOT_CONTROL,\\n expiry\\n );\\n if (resolver != address(0)) {\\n ens.setResolver(node, resolver);\\n }\\n\\n return expiry;\\n }\\n\\n function _unwrap(bytes32 node, address owner) private {\\n if (owner == address(0x0) || owner == address(this)) {\\n revert IncorrectTargetOwner(owner);\\n }\\n\\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\\n revert OperationProhibited(node);\\n }\\n\\n // Burn token and fuse data\\n _burn(uint256(node));\\n ens.setOwner(node, owner);\\n\\n emit NameUnwrapped(node, owner);\\n }\\n\\n function _setFuses(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n _setData(node, owner, fuses, expiry);\\n emit FusesSet(node, fuses, expiry);\\n }\\n\\n function _setData(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n _canFusesBeBurned(node, fuses);\\n super._setData(uint256(node), owner, fuses, expiry);\\n }\\n\\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\\n if (\\n fuses & ~PARENT_CANNOT_CONTROL != 0 &&\\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\\n ) {\\n revert OperationProhibited(node);\\n }\\n }\\n\\n function _checkForParentCannotControl(bytes32 node, uint32 fuses)\\n internal\\n view\\n {\\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\\n // Only the parent can burn the PARENT_CANNOT_CONTROL fuse.\\n revert Unauthorised(node, msg.sender);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x82cb93a1df0da9c407f1e5a81ec1520a1a118bded60ac379b8e5182cabe63ac5\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c06040523480156200001157600080fd5b5060405162006245380380620062458339810160408190526200003491620001ef565b6200003f3362000186565b6001600160a01b0383811660805282811660a052600480546001600160a01b031916918316919091179055600163ffffffbf60a01b03197fafa26c20e8b3d9a2853d642cfe1021dae26242ffedfac91c97aab212c1a4b93b8190557fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb4955604080518082019091526001815260006020808301829052908052600590527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc90620001099082620002e8565b50604080518082019091526005808252626cae8d60e31b6020808401919091527f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae600052527fd99130487705d6970718a0cee91984b61956f8a1db3482bba7e6bf0131adb01f906200017c9082620002e8565b50505050620003b4565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114620001ec57600080fd5b50565b6000806000606084860312156200020557600080fd5b83516200021281620001d6565b60208501519093506200022581620001d6565b60408501519092506200023881620001d6565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200026e57607f821691505b6020821081036200028f57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620002e357600081815260208120601f850160051c81016020861015620002be5750805b601f850160051c820191505b81811015620002df57828155600101620002ca565b5050505b505050565b81516001600160401b0381111562000304576200030462000243565b6200031c8162000315845462000259565b8462000295565b602080601f8311600181146200035457600084156200033b5750858301515b600019600386901b1c1916600185901b178555620002df565b600085815260208120601f198616915b82811015620003855788860151825594840194600190910190840162000364565b5085821015620003a45787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a051615d99620004ac6000396000818161047201528181610a9a01528181610b910152818161163f0152818161186e01528181611cd101528181611e0e015281816120b10152818161222d01528181613351015281816134180152818161353a015281816135c901526145400152600081816104bf01528181610a2001528181610d7501528181610eea01528181611086015281816111510152818161214f015281816122cb015281816124910152818161262a0152818161281301528181612cbd01528181612d8401528181612e6601528181612ef8015281816136d80152818161395d015261400f0152615d996000f3fe608060405234801561001057600080fd5b50600436106102e85760003560e01c80638b4dfa7511610191578063e0dba60f116100e3578063ee7eba7811610097578063f44779b911610071578063f44779b914610717578063f9547a9e1461072a578063fd0cd0d91461075657600080fd5b8063ee7eba78146106de578063f242432a146106f1578063f2fde38b1461070457600080fd5b8063e985e9c5116100c8578063e985e9c51461066f578063eb8ae530146106ab578063ed70554d146106be57600080fd5b8063e0dba60f14610649578063e72bf00f1461065c57600080fd5b8063b6bcad2611610145578063cf4088231161011f578063cf40882314610600578063d8c9921a14610613578063da8c229e1461062657600080fd5b8063b6bcad26146105b2578063c20a2eb0146105c5578063c658e086146105ed57600080fd5b80639f56dac6116101765780639f56dac614610579578063a22cb4651461058c578063adf4960a1461059f57600080fd5b80638b4dfa75146105555780638da5cb5b1461056857600080fd5b806324c1af441161024a57806347d2e9fe116101fe5780635d3590d5116101d85780635d3590d5146105275780636352211e1461053a578063715018a61461054d57600080fd5b806347d2e9fe146104e15780634e1273f4146104f4578063530954671461051457600080fd5b80632eb2c2d61161022f5780632eb2c2d61461049457806333c69ea9146104a75780633f15457f146104ba57600080fd5b806324c1af441461045a5780632b20e3971461046d57600080fd5b8063150b7a02116102a15780631896f70a116102865780631896f70a146104095780631f4e15041461041c57806320c38e2b1461044757600080fd5b8063150b7a02146103b25780631534e177146103f657600080fd5b806301ffc9a7116102d257806301ffc9a71461035a5780630e89341c1461037d57806314ab90381461039d57600080fd5b8062fdd58e146102ed5780630178fe3f14610313575b600080fd5b6103006102fb366004614bbe565b610769565b6040519081526020015b60405180910390f35b610326610321366004614bea565b61082a565b604080516001600160a01b03909416845263ffffffff909216602084015267ffffffffffffffff169082015260600161030a565b61036d610368366004614c31565b610845565b604051901515815260200161030a565b61039061038b366004614bea565b6108e7565b60405161030a9190614ca5565b6103b06103ab366004614cd5565b610974565b005b6103c56103c0366004614d4a565b610a8d565b6040517fffffffff00000000000000000000000000000000000000000000000000000000909116815260200161030a565b6103b0610404366004614dbd565b610c35565b6103b0610417366004614dda565b610cc9565b60065461042f906001600160a01b031681565b6040516001600160a01b03909116815260200161030a565b610390610455366004614bea565b610da4565b610300610468366004614efe565b610e3e565b61042f7f000000000000000000000000000000000000000000000000000000000000000081565b6103b06104a2366004615031565b6111cc565b6103b06104b53660046150df565b61156a565b61042f7f000000000000000000000000000000000000000000000000000000000000000081565b6103006104ef3660046150df565b611763565b610507610502366004615125565b611922565b60405161030a9190615223565b60045461042f906001600160a01b031681565b6103b0610535366004615236565b611a60565b61042f610548366004614bea565b611b4c565b6103b0611b57565b6103b0610563366004615277565b611bbd565b6000546001600160a01b031661042f565b6103006105873660046152b9565b611d33565b6103b061059a36600461534c565b611ed7565b61036d6105ad36600461537a565b611fdf565b6103b06105c0366004614dbd565b612004565b6105d86105d336600461537a565b61232a565b60405163ffffffff909116815260200161030a565b6103006105fb36600461539d565b6123d5565b6103b061060e36600461541c565b612751565b6103b0610621366004615454565b6128ac565b61036d610634366004614dbd565b60036020526000908152604090205460ff1681565b6103b061065736600461534c565b61298e565b6103b061066a366004615482565b612a66565b61036d61067d3660046154ea565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b6103b06106b9366004615482565b612b77565b6103006106cc366004614bea565b60016020526000908152604090205481565b6103b06106ec366004615518565b612f9f565b6103b06106ff36600461558c565b613095565b6103b0610712366004614dbd565b6131ca565b61036d610725366004614dda565b6132a9565b61073d6107383660046155f5565b613304565b60405167ffffffffffffffff909116815260200161030a565b61036d610764366004614bea565b613681565b60006001600160a01b0383166107ec5760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60006107f78361082a565b50509050836001600160a01b0316816001600160a01b03160361081e576001915050610824565b60009150505b92915050565b600080600061083884613753565b9250925092509193909250565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fe89c48dc0000000000000000000000000000000000000000000000000000000014806108d857507fffffffff0000000000000000000000000000000000000000000000000000000082167f150b7a0200000000000000000000000000000000000000000000000000000000145b8061082457506108248261378a565b600480546040517f0e89341c0000000000000000000000000000000000000000000000000000000081529182018390526060916001600160a01b0390911690630e89341c90602401600060405180830381865afa15801561094c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610824919081019061567f565b8161097f81336132a9565b6109a55760405163168ab55d60e31b8152600481018290523360248201526044016107e3565b82601060006109b38361082a565b5091505063ffffffff82821616156109e15760405163a2a7201360e01b8152600481018490526024016107e3565b6040517f14ab90380000000000000000000000000000000000000000000000000000000081526004810187905267ffffffffffffffff861660248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906314ab9038906044015b600060405180830381600087803b158015610a6d57600080fd5b505af1158015610a81573d6000803e3d6000fd5b50505050505050505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610af1576040517f1931a53800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080808080610b0387890189615701565b84516020860120949950929750909550935091508990808214610b5c576040517fc65c3ccc00000000000000000000000000000000000000000000000000000000815260048101829052602481018390526044016107e3565b6040517f28ed4f6c000000000000000000000000000000000000000000000000000000008152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906328ed4f6c90604401600060405180830381600087803b158015610bdd57600080fd5b505af1158015610bf1573d6000803e3d6000fd5b50505050610c02878787878761386d565b507f150b7a02000000000000000000000000000000000000000000000000000000009d9c50505050505050505050505050565b6000546001600160a01b03163314610c8f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107e3565b600480547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b81610cd481336132a9565b610cfa5760405163168ab55d60e31b8152600481018290523360248201526044016107e3565b8260086000610d088361082a565b5091505063ffffffff8282161615610d365760405163a2a7201360e01b8152600481018490526024016107e3565b6040517f1896f70a000000000000000000000000000000000000000000000000000000008152600481018790526001600160a01b0386811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401610a53565b60056020526000908152604090208054610dbd90615779565b80601f0160208091040260200160405190810160405280929190818152602001828054610de990615779565b8015610e365780601f10610e0b57610100808354040283529160200191610e36565b820191906000526020600020905b815481529060010190602001808311610e1957829003601f168201915b505050505081565b600087610e4b81336132a9565b610e715760405163168ab55d60e31b8152600481018290523360248201526044016107e3565b8888805190602001206000610ead8383604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018290529091506000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015610f31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5591906157cc565b90506001600160a01b038116610f9f576000610f708561082a565b509150506020811615610f995760405163a2a7201360e01b8152600481018490526024016107e3565b50610fd5565b6000610faa8361082a565b509150506040811615610fd35760405163a2a7201360e01b8152600481018490526024016107e3565b505b8b5160208d012061100d8e82604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b965061101b8e888b8b6139c7565b975061102687613681565b6110f5576040517f5ef2c7f0000000000000000000000000000000000000000000000000000000008152600481018f9052602481018290523060448201526001600160a01b038c8116606483015267ffffffffffffffff8c1660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156110ca57600080fd5b505af11580156110de573d6000803e3d6000fd5b505050506110f08e888f8f8d8d613a0d565b6111bb565b6040517f5ef2c7f0000000000000000000000000000000000000000000000000000000008152600481018f9052602481018290523060448201526001600160a01b038c8116606483015267ffffffffffffffff8c1660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561119557600080fd5b505af11580156111a9573d6000803e3d6000fd5b505050506111bb8e888f8f8d8d613ac7565b505050505050979650505050505050565b81518351146112435760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060448201527f6d69736d6174636800000000000000000000000000000000000000000000000060648201526084016107e3565b6001600160a01b0384166112bf5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016107e3565b6001600160a01b0385163314806112f957506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b61136b5760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f766564000000000000000000000000000060648201526084016107e3565b60005b83518110156114fd57600084828151811061138b5761138b6157e9565b6020026020010151905060008483815181106113a9576113a96157e9565b6020026020010151905060008060006113c18561082a565b9250925092506113d2826004161590565b6113f25760405163a2a7201360e01b8152600481018690526024016107e3565b83600114801561141357508a6001600160a01b0316836001600160a01b0316145b6114855760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016107e3565b60008581526001602052604090206001600160a01b038b1677ffffffff000000000000000000000000000000000000000060a085901b16177fffffffffffffffff00000000000000000000000000000000000000000000000060c084901b161790555050505050806114f690615847565b905061136e565b50836001600160a01b0316856001600160a01b0316336001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb868660405161154d92919061587f565b60405180910390a4611563338686868686613b64565b5050505050565b604080516020808201879052818301869052825180830384018152606090920190925280519101206000808061159f8461082a565b91945092509050600080806115b38b61082a565b9093509150507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b528b016116b9576115ea87336132a9565b6116105760405163168ab55d60e31b8152600481018890523360248201526044016107e3565b6040517fd6e4fa86000000000000000000000000000000000000000000000000000000008152600481018b90527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063d6e4fa8690602401602060405180830381865afa15801561168e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b291906158ad565b92506116ed565b6116c38b336132a9565b6116e95760405163168ab55d60e31b8152600481018890523360248201526044016107e3565b8092505b6116f8878a84613d70565b611703888585613da6565b9750604085161580159061172557508463ffffffff1689861763ffffffff1614155b156117465760405163a2a7201360e01b8152600481018890526024016107e3565b9784179761175687878b8b613df0565b5050505050505050505050565b3360009081526003602052604081205460ff166117e85760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f60448201527f6e74726f6c6c657200000000000000000000000000000000000000000000000060648201526084016107e3565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301889052825180830384018152606090920190925280519101206000906040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101889052602481018790529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c475abff906044016020604051808303816000875af11580156118bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118e391906158ad565b9150600080806118f28461082a565b925092509250611903868287613da6565b9550611916848460408a86171789613e4c565b50505050949350505050565b6060815183511461199b5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d61746368000000000000000000000000000000000000000000000060648201526084016107e3565b6000835167ffffffffffffffff8111156119b7576119b7614e0a565b6040519080825280602002602001820160405280156119e0578160200160208202803683370190505b50905060005b8451811015611a5857611a2b858281518110611a0457611a046157e9565b6020026020010151858381518110611a1e57611a1e6157e9565b6020026020010151610769565b828281518110611a3d57611a3d6157e9565b6020908102919091010152611a5181615847565b90506119e6565b509392505050565b6000546001600160a01b03163314611aba5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107e3565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015611b22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b4691906158c6565b50505050565b600061082482613ebd565b6000546001600160a01b03163314611bb15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107e3565b611bbb6000613ed3565b565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830186905282518083038401815260609092019092528051910120611c1181336132a9565b611c375760405163168ab55d60e31b8152600481018290523360248201526044016107e3565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830187905282518083038401815260609092019092528051910120611c8c905b83613f3b565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038481166024830152604482018690527f000000000000000000000000000000000000000000000000000000000000000016906342842e0e90606401600060405180830381600087803b158015611d1557600080fd5b505af1158015611d29573d6000803e3d6000fd5b5050505050505050565b3360009081526003602052604081205460ff16611db85760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f60448201527f6e74726f6c6c657200000000000000000000000000000000000000000000000060648201526084016107e3565b60008888604051611dca9291906158e3565b6040519081900381207ffca247ac000000000000000000000000000000000000000000000000000000008252600482018190523060248301526044820188905291507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fca247ac906064016020604051808303816000875af1158015611e5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8391906158ad565b9150611eca89898080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508b92508891508790508961386d565b5050979650505050505050565b6001600160a01b0382163303611f555760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084016107e3565b3360008181526002602090815260408083206001600160a01b0387168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600080611feb8461082a565b50841663ffffffff908116908516149250505092915050565b6000546001600160a01b0316331461205e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107e3565b6006546001600160a01b0316156121b0576006546040517fa22cb4650000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152600060248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156120f757600080fd5b505af115801561210b573d6000803e3d6000fd5b50506006546040517fa22cb4650000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152600060248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561219757600080fd5b505af11580156121ab573d6000803e3d6000fd5b505050505b600680547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03831690811790915515612327576006546040517fa22cb4650000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152600160248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b15801561227357600080fd5b505af1158015612287573d6000803e3d6000fd5b50506006546040517fa22cb4650000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152600160248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561231357600080fd5b505af1158015611563573d6000803e3d6000fd5b50565b60008261233781336132a9565b61235d5760405163168ab55d60e31b8152600481018290523360248201526044016107e3565b836002600061236b8361082a565b5091505063ffffffff82821616156123995760405163a2a7201360e01b8152600481018490526024016107e3565b6123a387876140a6565b600080806123b08a61082a565b92509250925081891798506123c78a848b84613df0565b509698975050505050505050565b6000866123e281336132a9565b6124085760405163168ab55d60e31b8152600481018290523360248201526044016107e3565b8787876040516124199291906158e3565b604051809103902060006124548383604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018290529091506000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa1580156124d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124fc91906157cc565b90506001600160a01b0381166125465760006125178561082a565b5091505060208116156125405760405163a2a7201360e01b8152600481018490526024016107e3565b5061257c565b60006125518361082a565b50915050604081161561257a5760405163a2a7201360e01b8152600481018490526024016107e3565b505b60008b8b60405161258e9291906158e3565b604051809103902090506125c98d82604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b96506125d78d888b8b6139c7565b97506125e287613681565b6126ef576040517f06ab5923000000000000000000000000000000000000000000000000000000008152600481018e9052602481018290523060448201526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906306ab5923906064016020604051808303816000875af1158015612673573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061269791906158ad565b506126ea8d888e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d8d8d613a0d565b612741565b6127418d888e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d8d8d613ac7565b5050505050509695505050505050565b8361275c81336132a9565b6127825760405163168ab55d60e31b8152600481018290523360248201526044016107e3565b84601c60006127908361082a565b5091505063ffffffff82821616156127be5760405163a2a7201360e01b8152600481018490526024016107e3565b6040517fcf408823000000000000000000000000000000000000000000000000000000008152600481018990523060248201526001600160a01b03878116604483015267ffffffffffffffff871660648301527f0000000000000000000000000000000000000000000000000000000000000000169063cf40882390608401600060405180830381600087803b15801561285757600080fd5b505af115801561286b573d6000803e3d6000fd5b50505050600061287d8960001c61082a565b505090506128a181898b60001c6001604051806020016040528060008152506140d5565b505050505050505050565b604080516020808201869052818301859052825180830384018152606090920190925280519101206128de81336132a9565b6129045760405163168ab55d60e31b8152600481018290523360248201526044016107e3565b7f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b52840161295d576040517f615a470300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408051602080820187905281830186905282518083038401815260609092019092528051910120611b4690611c86565b6000546001600160a01b031633146129e85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107e3565b6001600160a01b03821660008181526003602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf8791015b60405180910390a25050565b60008484604051612a789291906158e3565b60405190819003902090506000612ad67f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae83604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b9050600080612ae483614283565b6006546040517ff9547a9e0000000000000000000000000000000000000000000000000000000081529294509092506001600160a01b03169063f9547a9e90612b3b908b908b908b90889088908d9060040161591e565b600060405180830381600087803b158015612b5557600080fd5b505af1158015612b69573d6000803e3d6000fd5b505050505050505050505050565b600080612bbe600087878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506143189050565b915091506000612c078288888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506143cf9050565b604080516020808201849052818301879052825180830384018152606090920190925280519101209091507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b528201612c8b576040517f615a470300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015612d0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d3091906157cc565b90506001600160a01b0381163314801590612df157506040517fe985e9c50000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015612dcb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612def91906158c6565b155b15612e185760405163168ab55d60e31b8152600481018390523360248201526044016107e3565b6001600160a01b03861615612ec3576040517f1896f70a000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b0387811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b158015612eaa57600080fd5b505af1158015612ebe573d6000803e3d6000fd5b505050505b6040517f5b0fc9c3000000000000000000000000000000000000000000000000000000008152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635b0fc9c390604401600060405180830381600087803b158015612f4457600080fd5b505af1158015612f58573d6000803e3d6000fd5b505050506128a1828a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508d9350915081905061448e565b60008484604051612fb19291906158e3565b604051809103902090506000612fee8783604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b9050600080612ffc83614283565b6006546040517f24c1af440000000000000000000000000000000000000000000000000000000081529294509092506001600160a01b0316906324c1af4490613058908c908c908c908c908c906000908b908b90600401615974565b600060405180830381600087803b15801561307257600080fd5b505af1158015613086573d6000803e3d6000fd5b50505050505050505050505050565b6001600160a01b0384166131115760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016107e3565b6001600160a01b03851633148061314b57506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b6131bd5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201527f20617070726f766564000000000000000000000000000000000000000000000060648201526084016107e3565b61156385858585856140d5565b6000546001600160a01b031633146132245760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107e3565b6001600160a01b0381166132a05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016107e3565b61232781613ed3565b6000806132b584611b4c565b9050826001600160a01b0316816001600160a01b031614806132fc57506001600160a01b0380821660009081526002602090815260408083209387168352929052205460ff165b949350505050565b60008087876040516133179291906158e3565b6040519081900381207f6352211e0000000000000000000000000000000000000000000000000000000082526004820181905291506000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa1580156133a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133c491906157cc565b90506001600160a01b038116331480159061348557506040517fe985e9c50000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa15801561345f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061348391906158c6565b155b156134f557604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae6020808301919091528183018590528251808303840181526060830193849052805191012063168ab55d60e31b909252606481019190915233608482015260a4016107e3565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152306024830152604482018490527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90606401600060405180830381600087803b15801561357e57600080fd5b505af1158015613592573d6000803e3d6000fd5b50506040517f28ed4f6c000000000000000000000000000000000000000000000000000000008152600481018590523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506328ed4f6c9150604401600060405180830381600087803b15801561361757600080fd5b505af115801561362b573d6000803e3d6000fd5b5050505061367489898080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508b92508a91508990508861386d565b9998505050505050505050565b60008061368d83611b4c565b6001600160a01b03161415801561082457506040517f02571be30000000000000000000000000000000000000000000000000000000081526004810183905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa15801561371f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061374391906157cc565b6001600160a01b03161492915050565b6000818152600160205260408120549060c082901c824282101561377a5760009250613782565b60a081901c92505b509193909250565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fd9b67a2600000000000000000000000000000000000000000000000000000000148061381d57507fffffffff0000000000000000000000000000000000000000000000000000000082167f0e89341c00000000000000000000000000000000000000000000000000000000145b8061082457507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610824565b84516020860120600090816138c97f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae83604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b905060006138d88284886144f8565b9750915061390f90507f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae838b8b60408c178b613a0d565b6001600160a01b038516156139ba576040517f1896f70a000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b0386811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b1580156139a157600080fd5b505af11580156139b5573d6000803e3d6000fd5b505050505b5093979650505050505050565b6000806139d38561082a565b925050506000806139e68860001c61082a565b92509250506139f6878784613d70565b613a01858483613da6565b98975050505050505050565b60008681526005602052604081208054613aaf918791613a2c90615779565b80601f0160208091040260200160405190810160405280929190818152602001828054613a5890615779565b8015613aa55780601f10613a7a57610100808354040283529160200191613aa5565b820191906000526020600020905b815481529060010190602001808311613a8857829003601f168201915b50505050506145d0565b9050613abe868286868661448e565b50505050505050565b6000613ad286611b4c565b90506000613af886600560008b81526020019081526020016000208054613a2c90615779565b6000888152600560205260409020805491925090613b1590615779565b9050600003613b38576000878152600560205260409020613b368282615a22565b505b613b4487838686613df0565b611d2982868960001c6001604051806020016040528060008152506140d5565b6001600160a01b0384163b15613d68576040517fbc197c810000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063bc197c8190613bc19089908990889088908890600401615b1e565b6020604051808303816000875af1925050508015613bfc575060408051601f3d908101601f19168201909252613bf991810190615b70565b60015b613cb157613c08615b8d565b806308c379a003613c415750613c1c615ba9565b80613c275750613c43565b8060405162461bcd60e51b81526004016107e39190614ca5565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560448201527f526563656976657220696d706c656d656e74657200000000000000000000000060648201526084016107e3565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fbc197c810000000000000000000000000000000000000000000000000000000014613abe5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016107e3565b505050505050565b6040828116146001821615818015613d855750805b156115635760405163a2a7201360e01b8152600481018690526024016107e3565b60008167ffffffffffffffff168467ffffffffffffffff161115613dc8578193505b8267ffffffffffffffff168467ffffffffffffffff161015613de8578293505b509192915050565b613dfc84848484613e4c565b6040805163ffffffff8416815267ffffffffffffffff8316602082015285917f936318e296f824e203b086d97bb155a0200cec4847efea1fb4b9b7f924157355910160405180910390a250505050565b613e568483614679565b60008481526001602052604090206001600160a01b03841677ffffffff000000000000000000000000000000000000000060a085901b16177fffffffffffffffff00000000000000000000000000000000000000000000000060c084901b16179055611b46565b600080613ec98361082a565b5090949350505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381161580613f5957506001600160a01b03811630145b15613f9b576040517f5949361a0000000000000000000000000000000000000000000000000000000081526001600160a01b03821660048201526024016107e3565b613fa6826001611fdf565b15613fc75760405163a2a7201360e01b8152600481018390526024016107e3565b613fd0826146b2565b6040517f5b0fc9c3000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b15801561405357600080fd5b505af1158015614067573d6000803e3d6000fd5b50506040516001600160a01b03841681528492507fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49150602001612a5a565b60408116156140d15760405163168ab55d60e31b8152600481018390523360248201526044016107e3565b5050565b60008060006140e38661082a565b9250925092506140f4826004161590565b6141145760405163a2a7201360e01b8152600481018790526024016107e3565b8460011480156141355750876001600160a01b0316836001600160a01b0316145b6141a75760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016107e3565b866001600160a01b0316836001600160a01b0316036141c857505050611563565b60008681526001602052604090206001600160a01b03881677ffffffff000000000000000000000000000000000000000060a085901b16177fffffffffffffffff00000000000000000000000000000000000000000000000060c084901b1617905560408051878152602081018790526001600160a01b03808a1692908b169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611d2933898989898961476d565b60065460009081906001600160a01b03166142ca576040517f24c1d6d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6142d483336132a9565b6142fa5760405163168ab55d60e31b8152600481018490523360248201526044016107e3565b6143038361082a565b90935091506143139050836146b2565b915091565b6000808351831061436b5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e6473000060448201526064016107e3565b600084848151811061437f5761437f6157e9565b016020015160f81c905080156143ab576143a48561439e866001615c51565b836148c8565b92506143b0565b600092505b6143ba8185615c51565b6143c5906001615c51565b9150509250929050565b60008060006143de8585614318565b90925090508161445057600185516143f69190615c64565b84146144445760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d6500000060448201526064016107e3565b50600091506108249050565b61445a85826143cf565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b60008581526005602052604090206144a68582615a22565b506144b3858484846148ec565b847f8ce7013e8abebc55c3890a68f5a27c67c3f7efa64e584de5fb22363c606fd340858585856040516144e99493929190615c77565b60405180910390a25050505050565b60008080806145068761082a565b6040517fd6e4fa86000000000000000000000000000000000000000000000000000000008152600481018a905292965090945091506000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063d6e4fa8690602401602060405180830381865afa15801561458f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145b391906158ad565b90506145c0868383613da6565b9550859250505093509350939050565b606060018351101561460e576040517f280dacb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60ff8351111561464c57826040517fe3ba295f0000000000000000000000000000000000000000000000000000000081526004016107e39190614ca5565b8251838360405160200161466293929190615cbf565b604051602081830303815290604052905092915050565b63ffffffbf8116158015906146915750604181811614155b156140d15760405163a2a7201360e01b8152600481018390526024016107e3565b60008060006146c08461082a565b600087815260016020526040902077ffffffff000000000000000000000000000000000000000060a084901b167fffffffffffffffff00000000000000000000000000000000000000000000000060c084901b161790559194509250905060408051858152600160208201526000916001600160a01b0386169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a450505050565b6001600160a01b0384163b15613d68576040517ff23a6e610000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063f23a6e61906147ca9089908990889088908890600401615d20565b6020604051808303816000875af1925050508015614805575060408051601f3d908101601f1916820190925261480291810190615b70565b60015b61481157613c08615b8d565b7fffffffff0000000000000000000000000000000000000000000000000000000081167ff23a6e610000000000000000000000000000000000000000000000000000000014613abe5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016107e3565b82516000906148d78385615c51565b11156148e257600080fd5b5091016020012090565b6148f68483614679565b600061490185611b4c565b90506001600160a01b038116156149525761491b856146b2565b6040516000815285907fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49060200160405180910390a25b6115638585858583600080806149678461082a565b9250925092508467ffffffffffffffff168167ffffffffffffffff16111561498d578094505b6001600160a01b038316156149e45760405162461bcd60e51b815260206004820152601f60248201527f455243313135353a206d696e74206f66206578697374696e6720746f6b656e0060448201526064016107e3565b6001600160a01b038716614a605760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016107e3565b306001600160a01b03881603614ade5760405162461bcd60e51b815260206004820152603460248201527f455243313135353a206e65774f776e65722063616e6e6f74206265207468652060448201527f4e616d655772617070657220636f6e747261637400000000000000000000000060648201526084016107e3565b60008481526001602052604090206001600160a01b03881677ffffffff000000000000000000000000000000000000000088851760a01b16177fffffffffffffffff00000000000000000000000000000000000000000000000060c088901b1617905560408051858152600160208201526001600160a01b0389169160009133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611d29336000898760016040518060200160405280600081525061476d565b6001600160a01b038116811461232757600080fd5b60008060408385031215614bd157600080fd5b8235614bdc81614ba9565b946020939093013593505050565b600060208284031215614bfc57600080fd5b5035919050565b7fffffffff000000000000000000000000000000000000000000000000000000008116811461232757600080fd5b600060208284031215614c4357600080fd5b8135614c4e81614c03565b9392505050565b60005b83811015614c70578181015183820152602001614c58565b50506000910152565b60008151808452614c91816020860160208601614c55565b601f01601f19169290920160200192915050565b602081526000614c4e6020830184614c79565b803567ffffffffffffffff81168114614cd057600080fd5b919050565b60008060408385031215614ce857600080fd5b82359150614cf860208401614cb8565b90509250929050565b60008083601f840112614d1357600080fd5b50813567ffffffffffffffff811115614d2b57600080fd5b602083019150836020828501011115614d4357600080fd5b9250929050565b600080600080600060808688031215614d6257600080fd5b8535614d6d81614ba9565b94506020860135614d7d81614ba9565b935060408601359250606086013567ffffffffffffffff811115614da057600080fd5b614dac88828901614d01565b969995985093965092949392505050565b600060208284031215614dcf57600080fd5b8135614c4e81614ba9565b60008060408385031215614ded57600080fd5b823591506020830135614dff81614ba9565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff82111715614e5f57614e5f614e0a565b6040525050565b600067ffffffffffffffff821115614e8057614e80614e0a565b50601f01601f191660200190565b600082601f830112614e9f57600080fd5b8135614eaa81614e66565b604051614eb78282614e39565b828152856020848701011115614ecc57600080fd5b82602086016020830137600092810160200192909252509392505050565b803563ffffffff81168114614cd057600080fd5b600080600080600080600060e0888a031215614f1957600080fd5b87359650602088013567ffffffffffffffff811115614f3757600080fd5b614f438a828b01614e8e565b9650506040880135614f5481614ba9565b94506060880135614f6481614ba9565b9350614f7260808901614cb8565b9250614f8060a08901614eea565b9150614f8e60c08901614cb8565b905092959891949750929550565b600067ffffffffffffffff821115614fb657614fb6614e0a565b5060051b60200190565b600082601f830112614fd157600080fd5b81356020614fde82614f9c565b604051614feb8282614e39565b83815260059390931b850182019282810191508684111561500b57600080fd5b8286015b84811015615026578035835291830191830161500f565b509695505050505050565b600080600080600060a0868803121561504957600080fd5b853561505481614ba9565b9450602086013561506481614ba9565b9350604086013567ffffffffffffffff8082111561508157600080fd5b61508d89838a01614fc0565b945060608801359150808211156150a357600080fd5b6150af89838a01614fc0565b935060808801359150808211156150c557600080fd5b506150d288828901614e8e565b9150509295509295909350565b600080600080608085870312156150f557600080fd5b843593506020850135925061510c60408601614eea565b915061511a60608601614cb8565b905092959194509250565b6000806040838503121561513857600080fd5b823567ffffffffffffffff8082111561515057600080fd5b818501915085601f83011261516457600080fd5b8135602061517182614f9c565b60405161517e8282614e39565b83815260059390931b850182019282810191508984111561519e57600080fd5b948201945b838610156151c55785356151b681614ba9565b825294820194908201906151a3565b965050860135925050808211156151db57600080fd5b506143c585828601614fc0565b600081518084526020808501945080840160005b83811015615218578151875295820195908201906001016151fc565b509495945050505050565b602081526000614c4e60208301846151e8565b60008060006060848603121561524b57600080fd5b833561525681614ba9565b9250602084013561526681614ba9565b929592945050506040919091013590565b60008060006060848603121561528c57600080fd5b83359250602084013561529e81614ba9565b915060408401356152ae81614ba9565b809150509250925092565b600080600080600080600060c0888a0312156152d457600080fd5b873567ffffffffffffffff8111156152eb57600080fd5b6152f78a828b01614d01565b909850965050602088013561530b81614ba9565b945060408801359350606088013561532281614ba9565b925061533060808901614eea565b9150614f8e60a08901614cb8565b801515811461232757600080fd5b6000806040838503121561535f57600080fd5b823561536a81614ba9565b91506020830135614dff8161533e565b6000806040838503121561538d57600080fd5b82359150614cf860208401614eea565b60008060008060008060a087890312156153b657600080fd5b86359550602087013567ffffffffffffffff8111156153d457600080fd5b6153e089828a01614d01565b90965094505060408701356153f481614ba9565b925061540260608801614eea565b915061541060808801614cb8565b90509295509295509295565b6000806000806080858703121561543257600080fd5b84359350602085013561544481614ba9565b9250604085013561510c81614ba9565b60008060006060848603121561546957600080fd5b833592506020840135915060408401356152ae81614ba9565b6000806000806060858703121561549857600080fd5b843567ffffffffffffffff8111156154af57600080fd5b6154bb87828801614d01565b90955093505060208501356154cf81614ba9565b915060408501356154df81614ba9565b939692955090935050565b600080604083850312156154fd57600080fd5b823561550881614ba9565b91506020830135614dff81614ba9565b60008060008060006080868803121561553057600080fd5b85359450602086013567ffffffffffffffff81111561554e57600080fd5b61555a88828901614d01565b909550935050604086013561556e81614ba9565b9150606086013561557e81614ba9565b809150509295509295909350565b600080600080600060a086880312156155a457600080fd5b85356155af81614ba9565b945060208601356155bf81614ba9565b93506040860135925060608601359150608086013567ffffffffffffffff8111156155e957600080fd5b6150d288828901614e8e565b60008060008060008060a0878903121561560e57600080fd5b863567ffffffffffffffff81111561562557600080fd5b61563189828a01614d01565b909750955050602087013561564581614ba9565b935061565360408801614eea565b925061566160608801614cb8565b9150608087013561567181614ba9565b809150509295509295509295565b60006020828403121561569157600080fd5b815167ffffffffffffffff8111156156a857600080fd5b8201601f810184136156b957600080fd5b80516156c481614e66565b6040516156d18282614e39565b8281528660208486010111156156e657600080fd5b6156f7836020830160208701614c55565b9695505050505050565b600080600080600060a0868803121561571957600080fd5b853567ffffffffffffffff81111561573057600080fd5b61573c88828901614e8e565b955050602086013561574d81614ba9565b935061575b60408701614eea565b925061576960608701614cb8565b9150608086013561557e81614ba9565b600181811c9082168061578d57607f821691505b6020821081036157c6577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b6000602082840312156157de57600080fd5b8151614c4e81614ba9565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361587857615878615818565b5060010190565b60408152600061589260408301856151e8565b82810360208401526158a481856151e8565b95945050505050565b6000602082840312156158bf57600080fd5b5051919050565b6000602082840312156158d857600080fd5b8151614c4e8161533e565b8183823760009101908152919050565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b60a08152600061593260a08301888a6158f3565b90506001600160a01b03808716602084015263ffffffff8616604084015267ffffffffffffffff85166060840152808416608084015250979650505050505050565b88815260e06020820152600061598e60e08301898b6158f3565b6001600160a01b03978816604084015295909616606082015267ffffffffffffffff938416608082015263ffffffff9290921660a083015290911660c090910152949350505050565b601f821115615a1d57600081815260208120601f850160051c810160208610156159fe5750805b601f850160051c820191505b81811015613d6857828155600101615a0a565b505050565b815167ffffffffffffffff811115615a3c57615a3c614e0a565b615a5081615a4a8454615779565b846159d7565b602080601f831160018114615aa35760008415615a6d5750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b178555613d68565b600085815260208120601f198616915b82811015615ad257888601518255948401946001909101908401615ab3565b5085821015615b0e57878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b60006001600160a01b03808816835280871660208401525060a06040830152615b4a60a08301866151e8565b8281036060840152615b5c81866151e8565b90508281036080840152613a018185614c79565b600060208284031215615b8257600080fd5b8151614c4e81614c03565b600060033d1115615ba65760046000803e5060005160e01c5b90565b600060443d1015615bb75790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff8160248401118184111715615c0557505050505090565b8285019150815181811115615c1d5750505050505090565b843d8701016020828501011115615c375750505050505090565b615c4660208286010187614e39565b509095945050505050565b8082018082111561082457610824615818565b8181038181111561082457610824615818565b608081526000615c8a6080830187614c79565b6001600160a01b039590951660208301525063ffffffff92909216604083015267ffffffffffffffff16606090910152919050565b7fff000000000000000000000000000000000000000000000000000000000000008460f81b16815260008351615cfc816001850160208801614c55565b835190830190615d13816001840160208801614c55565b0160010195945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152615d5860a0830184614c79565b97965050505050505056fea2646970667358221220023c9c32e014d489c5a23e8e087c412538ac97c4b9baab7e6c472e2d81c489f164736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102e85760003560e01c80638b4dfa7511610191578063e0dba60f116100e3578063ee7eba7811610097578063f44779b911610071578063f44779b914610717578063f9547a9e1461072a578063fd0cd0d91461075657600080fd5b8063ee7eba78146106de578063f242432a146106f1578063f2fde38b1461070457600080fd5b8063e985e9c5116100c8578063e985e9c51461066f578063eb8ae530146106ab578063ed70554d146106be57600080fd5b8063e0dba60f14610649578063e72bf00f1461065c57600080fd5b8063b6bcad2611610145578063cf4088231161011f578063cf40882314610600578063d8c9921a14610613578063da8c229e1461062657600080fd5b8063b6bcad26146105b2578063c20a2eb0146105c5578063c658e086146105ed57600080fd5b80639f56dac6116101765780639f56dac614610579578063a22cb4651461058c578063adf4960a1461059f57600080fd5b80638b4dfa75146105555780638da5cb5b1461056857600080fd5b806324c1af441161024a57806347d2e9fe116101fe5780635d3590d5116101d85780635d3590d5146105275780636352211e1461053a578063715018a61461054d57600080fd5b806347d2e9fe146104e15780634e1273f4146104f4578063530954671461051457600080fd5b80632eb2c2d61161022f5780632eb2c2d61461049457806333c69ea9146104a75780633f15457f146104ba57600080fd5b806324c1af441461045a5780632b20e3971461046d57600080fd5b8063150b7a02116102a15780631896f70a116102865780631896f70a146104095780631f4e15041461041c57806320c38e2b1461044757600080fd5b8063150b7a02146103b25780631534e177146103f657600080fd5b806301ffc9a7116102d257806301ffc9a71461035a5780630e89341c1461037d57806314ab90381461039d57600080fd5b8062fdd58e146102ed5780630178fe3f14610313575b600080fd5b6103006102fb366004614bbe565b610769565b6040519081526020015b60405180910390f35b610326610321366004614bea565b61082a565b604080516001600160a01b03909416845263ffffffff909216602084015267ffffffffffffffff169082015260600161030a565b61036d610368366004614c31565b610845565b604051901515815260200161030a565b61039061038b366004614bea565b6108e7565b60405161030a9190614ca5565b6103b06103ab366004614cd5565b610974565b005b6103c56103c0366004614d4a565b610a8d565b6040517fffffffff00000000000000000000000000000000000000000000000000000000909116815260200161030a565b6103b0610404366004614dbd565b610c35565b6103b0610417366004614dda565b610cc9565b60065461042f906001600160a01b031681565b6040516001600160a01b03909116815260200161030a565b610390610455366004614bea565b610da4565b610300610468366004614efe565b610e3e565b61042f7f000000000000000000000000000000000000000000000000000000000000000081565b6103b06104a2366004615031565b6111cc565b6103b06104b53660046150df565b61156a565b61042f7f000000000000000000000000000000000000000000000000000000000000000081565b6103006104ef3660046150df565b611763565b610507610502366004615125565b611922565b60405161030a9190615223565b60045461042f906001600160a01b031681565b6103b0610535366004615236565b611a60565b61042f610548366004614bea565b611b4c565b6103b0611b57565b6103b0610563366004615277565b611bbd565b6000546001600160a01b031661042f565b6103006105873660046152b9565b611d33565b6103b061059a36600461534c565b611ed7565b61036d6105ad36600461537a565b611fdf565b6103b06105c0366004614dbd565b612004565b6105d86105d336600461537a565b61232a565b60405163ffffffff909116815260200161030a565b6103006105fb36600461539d565b6123d5565b6103b061060e36600461541c565b612751565b6103b0610621366004615454565b6128ac565b61036d610634366004614dbd565b60036020526000908152604090205460ff1681565b6103b061065736600461534c565b61298e565b6103b061066a366004615482565b612a66565b61036d61067d3660046154ea565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b6103b06106b9366004615482565b612b77565b6103006106cc366004614bea565b60016020526000908152604090205481565b6103b06106ec366004615518565b612f9f565b6103b06106ff36600461558c565b613095565b6103b0610712366004614dbd565b6131ca565b61036d610725366004614dda565b6132a9565b61073d6107383660046155f5565b613304565b60405167ffffffffffffffff909116815260200161030a565b61036d610764366004614bea565b613681565b60006001600160a01b0383166107ec5760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60006107f78361082a565b50509050836001600160a01b0316816001600160a01b03160361081e576001915050610824565b60009150505b92915050565b600080600061083884613753565b9250925092509193909250565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fe89c48dc0000000000000000000000000000000000000000000000000000000014806108d857507fffffffff0000000000000000000000000000000000000000000000000000000082167f150b7a0200000000000000000000000000000000000000000000000000000000145b8061082457506108248261378a565b600480546040517f0e89341c0000000000000000000000000000000000000000000000000000000081529182018390526060916001600160a01b0390911690630e89341c90602401600060405180830381865afa15801561094c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610824919081019061567f565b8161097f81336132a9565b6109a55760405163168ab55d60e31b8152600481018290523360248201526044016107e3565b82601060006109b38361082a565b5091505063ffffffff82821616156109e15760405163a2a7201360e01b8152600481018490526024016107e3565b6040517f14ab90380000000000000000000000000000000000000000000000000000000081526004810187905267ffffffffffffffff861660248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906314ab9038906044015b600060405180830381600087803b158015610a6d57600080fd5b505af1158015610a81573d6000803e3d6000fd5b50505050505050505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610af1576040517f1931a53800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080808080610b0387890189615701565b84516020860120949950929750909550935091508990808214610b5c576040517fc65c3ccc00000000000000000000000000000000000000000000000000000000815260048101829052602481018390526044016107e3565b6040517f28ed4f6c000000000000000000000000000000000000000000000000000000008152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906328ed4f6c90604401600060405180830381600087803b158015610bdd57600080fd5b505af1158015610bf1573d6000803e3d6000fd5b50505050610c02878787878761386d565b507f150b7a02000000000000000000000000000000000000000000000000000000009d9c50505050505050505050505050565b6000546001600160a01b03163314610c8f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107e3565b600480547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b81610cd481336132a9565b610cfa5760405163168ab55d60e31b8152600481018290523360248201526044016107e3565b8260086000610d088361082a565b5091505063ffffffff8282161615610d365760405163a2a7201360e01b8152600481018490526024016107e3565b6040517f1896f70a000000000000000000000000000000000000000000000000000000008152600481018790526001600160a01b0386811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401610a53565b60056020526000908152604090208054610dbd90615779565b80601f0160208091040260200160405190810160405280929190818152602001828054610de990615779565b8015610e365780601f10610e0b57610100808354040283529160200191610e36565b820191906000526020600020905b815481529060010190602001808311610e1957829003601f168201915b505050505081565b600087610e4b81336132a9565b610e715760405163168ab55d60e31b8152600481018290523360248201526044016107e3565b8888805190602001206000610ead8383604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018290529091506000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015610f31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5591906157cc565b90506001600160a01b038116610f9f576000610f708561082a565b509150506020811615610f995760405163a2a7201360e01b8152600481018490526024016107e3565b50610fd5565b6000610faa8361082a565b509150506040811615610fd35760405163a2a7201360e01b8152600481018490526024016107e3565b505b8b5160208d012061100d8e82604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b965061101b8e888b8b6139c7565b975061102687613681565b6110f5576040517f5ef2c7f0000000000000000000000000000000000000000000000000000000008152600481018f9052602481018290523060448201526001600160a01b038c8116606483015267ffffffffffffffff8c1660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156110ca57600080fd5b505af11580156110de573d6000803e3d6000fd5b505050506110f08e888f8f8d8d613a0d565b6111bb565b6040517f5ef2c7f0000000000000000000000000000000000000000000000000000000008152600481018f9052602481018290523060448201526001600160a01b038c8116606483015267ffffffffffffffff8c1660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561119557600080fd5b505af11580156111a9573d6000803e3d6000fd5b505050506111bb8e888f8f8d8d613ac7565b505050505050979650505050505050565b81518351146112435760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060448201527f6d69736d6174636800000000000000000000000000000000000000000000000060648201526084016107e3565b6001600160a01b0384166112bf5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016107e3565b6001600160a01b0385163314806112f957506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b61136b5760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f766564000000000000000000000000000060648201526084016107e3565b60005b83518110156114fd57600084828151811061138b5761138b6157e9565b6020026020010151905060008483815181106113a9576113a96157e9565b6020026020010151905060008060006113c18561082a565b9250925092506113d2826004161590565b6113f25760405163a2a7201360e01b8152600481018690526024016107e3565b83600114801561141357508a6001600160a01b0316836001600160a01b0316145b6114855760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016107e3565b60008581526001602052604090206001600160a01b038b1677ffffffff000000000000000000000000000000000000000060a085901b16177fffffffffffffffff00000000000000000000000000000000000000000000000060c084901b161790555050505050806114f690615847565b905061136e565b50836001600160a01b0316856001600160a01b0316336001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb868660405161154d92919061587f565b60405180910390a4611563338686868686613b64565b5050505050565b604080516020808201879052818301869052825180830384018152606090920190925280519101206000808061159f8461082a565b91945092509050600080806115b38b61082a565b9093509150507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b528b016116b9576115ea87336132a9565b6116105760405163168ab55d60e31b8152600481018890523360248201526044016107e3565b6040517fd6e4fa86000000000000000000000000000000000000000000000000000000008152600481018b90527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063d6e4fa8690602401602060405180830381865afa15801561168e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b291906158ad565b92506116ed565b6116c38b336132a9565b6116e95760405163168ab55d60e31b8152600481018890523360248201526044016107e3565b8092505b6116f8878a84613d70565b611703888585613da6565b9750604085161580159061172557508463ffffffff1689861763ffffffff1614155b156117465760405163a2a7201360e01b8152600481018890526024016107e3565b9784179761175687878b8b613df0565b5050505050505050505050565b3360009081526003602052604081205460ff166117e85760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f60448201527f6e74726f6c6c657200000000000000000000000000000000000000000000000060648201526084016107e3565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301889052825180830384018152606090920190925280519101206000906040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101889052602481018790529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c475abff906044016020604051808303816000875af11580156118bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118e391906158ad565b9150600080806118f28461082a565b925092509250611903868287613da6565b9550611916848460408a86171789613e4c565b50505050949350505050565b6060815183511461199b5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d61746368000000000000000000000000000000000000000000000060648201526084016107e3565b6000835167ffffffffffffffff8111156119b7576119b7614e0a565b6040519080825280602002602001820160405280156119e0578160200160208202803683370190505b50905060005b8451811015611a5857611a2b858281518110611a0457611a046157e9565b6020026020010151858381518110611a1e57611a1e6157e9565b6020026020010151610769565b828281518110611a3d57611a3d6157e9565b6020908102919091010152611a5181615847565b90506119e6565b509392505050565b6000546001600160a01b03163314611aba5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107e3565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015611b22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b4691906158c6565b50505050565b600061082482613ebd565b6000546001600160a01b03163314611bb15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107e3565b611bbb6000613ed3565b565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830186905282518083038401815260609092019092528051910120611c1181336132a9565b611c375760405163168ab55d60e31b8152600481018290523360248201526044016107e3565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830187905282518083038401815260609092019092528051910120611c8c905b83613f3b565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038481166024830152604482018690527f000000000000000000000000000000000000000000000000000000000000000016906342842e0e90606401600060405180830381600087803b158015611d1557600080fd5b505af1158015611d29573d6000803e3d6000fd5b5050505050505050565b3360009081526003602052604081205460ff16611db85760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f60448201527f6e74726f6c6c657200000000000000000000000000000000000000000000000060648201526084016107e3565b60008888604051611dca9291906158e3565b6040519081900381207ffca247ac000000000000000000000000000000000000000000000000000000008252600482018190523060248301526044820188905291507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fca247ac906064016020604051808303816000875af1158015611e5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8391906158ad565b9150611eca89898080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508b92508891508790508961386d565b5050979650505050505050565b6001600160a01b0382163303611f555760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084016107e3565b3360008181526002602090815260408083206001600160a01b0387168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600080611feb8461082a565b50841663ffffffff908116908516149250505092915050565b6000546001600160a01b0316331461205e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107e3565b6006546001600160a01b0316156121b0576006546040517fa22cb4650000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152600060248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156120f757600080fd5b505af115801561210b573d6000803e3d6000fd5b50506006546040517fa22cb4650000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152600060248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561219757600080fd5b505af11580156121ab573d6000803e3d6000fd5b505050505b600680547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03831690811790915515612327576006546040517fa22cb4650000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152600160248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b15801561227357600080fd5b505af1158015612287573d6000803e3d6000fd5b50506006546040517fa22cb4650000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152600160248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561231357600080fd5b505af1158015611563573d6000803e3d6000fd5b50565b60008261233781336132a9565b61235d5760405163168ab55d60e31b8152600481018290523360248201526044016107e3565b836002600061236b8361082a565b5091505063ffffffff82821616156123995760405163a2a7201360e01b8152600481018490526024016107e3565b6123a387876140a6565b600080806123b08a61082a565b92509250925081891798506123c78a848b84613df0565b509698975050505050505050565b6000866123e281336132a9565b6124085760405163168ab55d60e31b8152600481018290523360248201526044016107e3565b8787876040516124199291906158e3565b604051809103902060006124548383604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018290529091506000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa1580156124d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124fc91906157cc565b90506001600160a01b0381166125465760006125178561082a565b5091505060208116156125405760405163a2a7201360e01b8152600481018490526024016107e3565b5061257c565b60006125518361082a565b50915050604081161561257a5760405163a2a7201360e01b8152600481018490526024016107e3565b505b60008b8b60405161258e9291906158e3565b604051809103902090506125c98d82604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b96506125d78d888b8b6139c7565b97506125e287613681565b6126ef576040517f06ab5923000000000000000000000000000000000000000000000000000000008152600481018e9052602481018290523060448201526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906306ab5923906064016020604051808303816000875af1158015612673573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061269791906158ad565b506126ea8d888e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d8d8d613a0d565b612741565b6127418d888e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d8d8d613ac7565b5050505050509695505050505050565b8361275c81336132a9565b6127825760405163168ab55d60e31b8152600481018290523360248201526044016107e3565b84601c60006127908361082a565b5091505063ffffffff82821616156127be5760405163a2a7201360e01b8152600481018490526024016107e3565b6040517fcf408823000000000000000000000000000000000000000000000000000000008152600481018990523060248201526001600160a01b03878116604483015267ffffffffffffffff871660648301527f0000000000000000000000000000000000000000000000000000000000000000169063cf40882390608401600060405180830381600087803b15801561285757600080fd5b505af115801561286b573d6000803e3d6000fd5b50505050600061287d8960001c61082a565b505090506128a181898b60001c6001604051806020016040528060008152506140d5565b505050505050505050565b604080516020808201869052818301859052825180830384018152606090920190925280519101206128de81336132a9565b6129045760405163168ab55d60e31b8152600481018290523360248201526044016107e3565b7f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b52840161295d576040517f615a470300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408051602080820187905281830186905282518083038401815260609092019092528051910120611b4690611c86565b6000546001600160a01b031633146129e85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107e3565b6001600160a01b03821660008181526003602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf8791015b60405180910390a25050565b60008484604051612a789291906158e3565b60405190819003902090506000612ad67f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae83604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b9050600080612ae483614283565b6006546040517ff9547a9e0000000000000000000000000000000000000000000000000000000081529294509092506001600160a01b03169063f9547a9e90612b3b908b908b908b90889088908d9060040161591e565b600060405180830381600087803b158015612b5557600080fd5b505af1158015612b69573d6000803e3d6000fd5b505050505050505050505050565b600080612bbe600087878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506143189050565b915091506000612c078288888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506143cf9050565b604080516020808201849052818301879052825180830384018152606090920190925280519101209091507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b528201612c8b576040517f615a470300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015612d0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d3091906157cc565b90506001600160a01b0381163314801590612df157506040517fe985e9c50000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015612dcb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612def91906158c6565b155b15612e185760405163168ab55d60e31b8152600481018390523360248201526044016107e3565b6001600160a01b03861615612ec3576040517f1896f70a000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b0387811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b158015612eaa57600080fd5b505af1158015612ebe573d6000803e3d6000fd5b505050505b6040517f5b0fc9c3000000000000000000000000000000000000000000000000000000008152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635b0fc9c390604401600060405180830381600087803b158015612f4457600080fd5b505af1158015612f58573d6000803e3d6000fd5b505050506128a1828a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508d9350915081905061448e565b60008484604051612fb19291906158e3565b604051809103902090506000612fee8783604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b9050600080612ffc83614283565b6006546040517f24c1af440000000000000000000000000000000000000000000000000000000081529294509092506001600160a01b0316906324c1af4490613058908c908c908c908c908c906000908b908b90600401615974565b600060405180830381600087803b15801561307257600080fd5b505af1158015613086573d6000803e3d6000fd5b50505050505050505050505050565b6001600160a01b0384166131115760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016107e3565b6001600160a01b03851633148061314b57506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b6131bd5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201527f20617070726f766564000000000000000000000000000000000000000000000060648201526084016107e3565b61156385858585856140d5565b6000546001600160a01b031633146132245760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107e3565b6001600160a01b0381166132a05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016107e3565b61232781613ed3565b6000806132b584611b4c565b9050826001600160a01b0316816001600160a01b031614806132fc57506001600160a01b0380821660009081526002602090815260408083209387168352929052205460ff165b949350505050565b60008087876040516133179291906158e3565b6040519081900381207f6352211e0000000000000000000000000000000000000000000000000000000082526004820181905291506000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa1580156133a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133c491906157cc565b90506001600160a01b038116331480159061348557506040517fe985e9c50000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa15801561345f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061348391906158c6565b155b156134f557604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae6020808301919091528183018590528251808303840181526060830193849052805191012063168ab55d60e31b909252606481019190915233608482015260a4016107e3565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152306024830152604482018490527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90606401600060405180830381600087803b15801561357e57600080fd5b505af1158015613592573d6000803e3d6000fd5b50506040517f28ed4f6c000000000000000000000000000000000000000000000000000000008152600481018590523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506328ed4f6c9150604401600060405180830381600087803b15801561361757600080fd5b505af115801561362b573d6000803e3d6000fd5b5050505061367489898080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508b92508a91508990508861386d565b9998505050505050505050565b60008061368d83611b4c565b6001600160a01b03161415801561082457506040517f02571be30000000000000000000000000000000000000000000000000000000081526004810183905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa15801561371f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061374391906157cc565b6001600160a01b03161492915050565b6000818152600160205260408120549060c082901c824282101561377a5760009250613782565b60a081901c92505b509193909250565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fd9b67a2600000000000000000000000000000000000000000000000000000000148061381d57507fffffffff0000000000000000000000000000000000000000000000000000000082167f0e89341c00000000000000000000000000000000000000000000000000000000145b8061082457507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610824565b84516020860120600090816138c97f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae83604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b905060006138d88284886144f8565b9750915061390f90507f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae838b8b60408c178b613a0d565b6001600160a01b038516156139ba576040517f1896f70a000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b0386811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b1580156139a157600080fd5b505af11580156139b5573d6000803e3d6000fd5b505050505b5093979650505050505050565b6000806139d38561082a565b925050506000806139e68860001c61082a565b92509250506139f6878784613d70565b613a01858483613da6565b98975050505050505050565b60008681526005602052604081208054613aaf918791613a2c90615779565b80601f0160208091040260200160405190810160405280929190818152602001828054613a5890615779565b8015613aa55780601f10613a7a57610100808354040283529160200191613aa5565b820191906000526020600020905b815481529060010190602001808311613a8857829003601f168201915b50505050506145d0565b9050613abe868286868661448e565b50505050505050565b6000613ad286611b4c565b90506000613af886600560008b81526020019081526020016000208054613a2c90615779565b6000888152600560205260409020805491925090613b1590615779565b9050600003613b38576000878152600560205260409020613b368282615a22565b505b613b4487838686613df0565b611d2982868960001c6001604051806020016040528060008152506140d5565b6001600160a01b0384163b15613d68576040517fbc197c810000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063bc197c8190613bc19089908990889088908890600401615b1e565b6020604051808303816000875af1925050508015613bfc575060408051601f3d908101601f19168201909252613bf991810190615b70565b60015b613cb157613c08615b8d565b806308c379a003613c415750613c1c615ba9565b80613c275750613c43565b8060405162461bcd60e51b81526004016107e39190614ca5565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560448201527f526563656976657220696d706c656d656e74657200000000000000000000000060648201526084016107e3565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fbc197c810000000000000000000000000000000000000000000000000000000014613abe5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016107e3565b505050505050565b6040828116146001821615818015613d855750805b156115635760405163a2a7201360e01b8152600481018690526024016107e3565b60008167ffffffffffffffff168467ffffffffffffffff161115613dc8578193505b8267ffffffffffffffff168467ffffffffffffffff161015613de8578293505b509192915050565b613dfc84848484613e4c565b6040805163ffffffff8416815267ffffffffffffffff8316602082015285917f936318e296f824e203b086d97bb155a0200cec4847efea1fb4b9b7f924157355910160405180910390a250505050565b613e568483614679565b60008481526001602052604090206001600160a01b03841677ffffffff000000000000000000000000000000000000000060a085901b16177fffffffffffffffff00000000000000000000000000000000000000000000000060c084901b16179055611b46565b600080613ec98361082a565b5090949350505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381161580613f5957506001600160a01b03811630145b15613f9b576040517f5949361a0000000000000000000000000000000000000000000000000000000081526001600160a01b03821660048201526024016107e3565b613fa6826001611fdf565b15613fc75760405163a2a7201360e01b8152600481018390526024016107e3565b613fd0826146b2565b6040517f5b0fc9c3000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b15801561405357600080fd5b505af1158015614067573d6000803e3d6000fd5b50506040516001600160a01b03841681528492507fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49150602001612a5a565b60408116156140d15760405163168ab55d60e31b8152600481018390523360248201526044016107e3565b5050565b60008060006140e38661082a565b9250925092506140f4826004161590565b6141145760405163a2a7201360e01b8152600481018790526024016107e3565b8460011480156141355750876001600160a01b0316836001600160a01b0316145b6141a75760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016107e3565b866001600160a01b0316836001600160a01b0316036141c857505050611563565b60008681526001602052604090206001600160a01b03881677ffffffff000000000000000000000000000000000000000060a085901b16177fffffffffffffffff00000000000000000000000000000000000000000000000060c084901b1617905560408051878152602081018790526001600160a01b03808a1692908b169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611d2933898989898961476d565b60065460009081906001600160a01b03166142ca576040517f24c1d6d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6142d483336132a9565b6142fa5760405163168ab55d60e31b8152600481018490523360248201526044016107e3565b6143038361082a565b90935091506143139050836146b2565b915091565b6000808351831061436b5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e6473000060448201526064016107e3565b600084848151811061437f5761437f6157e9565b016020015160f81c905080156143ab576143a48561439e866001615c51565b836148c8565b92506143b0565b600092505b6143ba8185615c51565b6143c5906001615c51565b9150509250929050565b60008060006143de8585614318565b90925090508161445057600185516143f69190615c64565b84146144445760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d6500000060448201526064016107e3565b50600091506108249050565b61445a85826143cf565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b60008581526005602052604090206144a68582615a22565b506144b3858484846148ec565b847f8ce7013e8abebc55c3890a68f5a27c67c3f7efa64e584de5fb22363c606fd340858585856040516144e99493929190615c77565b60405180910390a25050505050565b60008080806145068761082a565b6040517fd6e4fa86000000000000000000000000000000000000000000000000000000008152600481018a905292965090945091506000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063d6e4fa8690602401602060405180830381865afa15801561458f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145b391906158ad565b90506145c0868383613da6565b9550859250505093509350939050565b606060018351101561460e576040517f280dacb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60ff8351111561464c57826040517fe3ba295f0000000000000000000000000000000000000000000000000000000081526004016107e39190614ca5565b8251838360405160200161466293929190615cbf565b604051602081830303815290604052905092915050565b63ffffffbf8116158015906146915750604181811614155b156140d15760405163a2a7201360e01b8152600481018390526024016107e3565b60008060006146c08461082a565b600087815260016020526040902077ffffffff000000000000000000000000000000000000000060a084901b167fffffffffffffffff00000000000000000000000000000000000000000000000060c084901b161790559194509250905060408051858152600160208201526000916001600160a01b0386169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a450505050565b6001600160a01b0384163b15613d68576040517ff23a6e610000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063f23a6e61906147ca9089908990889088908890600401615d20565b6020604051808303816000875af1925050508015614805575060408051601f3d908101601f1916820190925261480291810190615b70565b60015b61481157613c08615b8d565b7fffffffff0000000000000000000000000000000000000000000000000000000081167ff23a6e610000000000000000000000000000000000000000000000000000000014613abe5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016107e3565b82516000906148d78385615c51565b11156148e257600080fd5b5091016020012090565b6148f68483614679565b600061490185611b4c565b90506001600160a01b038116156149525761491b856146b2565b6040516000815285907fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49060200160405180910390a25b6115638585858583600080806149678461082a565b9250925092508467ffffffffffffffff168167ffffffffffffffff16111561498d578094505b6001600160a01b038316156149e45760405162461bcd60e51b815260206004820152601f60248201527f455243313135353a206d696e74206f66206578697374696e6720746f6b656e0060448201526064016107e3565b6001600160a01b038716614a605760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016107e3565b306001600160a01b03881603614ade5760405162461bcd60e51b815260206004820152603460248201527f455243313135353a206e65774f776e65722063616e6e6f74206265207468652060448201527f4e616d655772617070657220636f6e747261637400000000000000000000000060648201526084016107e3565b60008481526001602052604090206001600160a01b03881677ffffffff000000000000000000000000000000000000000088851760a01b16177fffffffffffffffff00000000000000000000000000000000000000000000000060c088901b1617905560408051858152600160208201526001600160a01b0389169160009133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611d29336000898760016040518060200160405280600081525061476d565b6001600160a01b038116811461232757600080fd5b60008060408385031215614bd157600080fd5b8235614bdc81614ba9565b946020939093013593505050565b600060208284031215614bfc57600080fd5b5035919050565b7fffffffff000000000000000000000000000000000000000000000000000000008116811461232757600080fd5b600060208284031215614c4357600080fd5b8135614c4e81614c03565b9392505050565b60005b83811015614c70578181015183820152602001614c58565b50506000910152565b60008151808452614c91816020860160208601614c55565b601f01601f19169290920160200192915050565b602081526000614c4e6020830184614c79565b803567ffffffffffffffff81168114614cd057600080fd5b919050565b60008060408385031215614ce857600080fd5b82359150614cf860208401614cb8565b90509250929050565b60008083601f840112614d1357600080fd5b50813567ffffffffffffffff811115614d2b57600080fd5b602083019150836020828501011115614d4357600080fd5b9250929050565b600080600080600060808688031215614d6257600080fd5b8535614d6d81614ba9565b94506020860135614d7d81614ba9565b935060408601359250606086013567ffffffffffffffff811115614da057600080fd5b614dac88828901614d01565b969995985093965092949392505050565b600060208284031215614dcf57600080fd5b8135614c4e81614ba9565b60008060408385031215614ded57600080fd5b823591506020830135614dff81614ba9565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff82111715614e5f57614e5f614e0a565b6040525050565b600067ffffffffffffffff821115614e8057614e80614e0a565b50601f01601f191660200190565b600082601f830112614e9f57600080fd5b8135614eaa81614e66565b604051614eb78282614e39565b828152856020848701011115614ecc57600080fd5b82602086016020830137600092810160200192909252509392505050565b803563ffffffff81168114614cd057600080fd5b600080600080600080600060e0888a031215614f1957600080fd5b87359650602088013567ffffffffffffffff811115614f3757600080fd5b614f438a828b01614e8e565b9650506040880135614f5481614ba9565b94506060880135614f6481614ba9565b9350614f7260808901614cb8565b9250614f8060a08901614eea565b9150614f8e60c08901614cb8565b905092959891949750929550565b600067ffffffffffffffff821115614fb657614fb6614e0a565b5060051b60200190565b600082601f830112614fd157600080fd5b81356020614fde82614f9c565b604051614feb8282614e39565b83815260059390931b850182019282810191508684111561500b57600080fd5b8286015b84811015615026578035835291830191830161500f565b509695505050505050565b600080600080600060a0868803121561504957600080fd5b853561505481614ba9565b9450602086013561506481614ba9565b9350604086013567ffffffffffffffff8082111561508157600080fd5b61508d89838a01614fc0565b945060608801359150808211156150a357600080fd5b6150af89838a01614fc0565b935060808801359150808211156150c557600080fd5b506150d288828901614e8e565b9150509295509295909350565b600080600080608085870312156150f557600080fd5b843593506020850135925061510c60408601614eea565b915061511a60608601614cb8565b905092959194509250565b6000806040838503121561513857600080fd5b823567ffffffffffffffff8082111561515057600080fd5b818501915085601f83011261516457600080fd5b8135602061517182614f9c565b60405161517e8282614e39565b83815260059390931b850182019282810191508984111561519e57600080fd5b948201945b838610156151c55785356151b681614ba9565b825294820194908201906151a3565b965050860135925050808211156151db57600080fd5b506143c585828601614fc0565b600081518084526020808501945080840160005b83811015615218578151875295820195908201906001016151fc565b509495945050505050565b602081526000614c4e60208301846151e8565b60008060006060848603121561524b57600080fd5b833561525681614ba9565b9250602084013561526681614ba9565b929592945050506040919091013590565b60008060006060848603121561528c57600080fd5b83359250602084013561529e81614ba9565b915060408401356152ae81614ba9565b809150509250925092565b600080600080600080600060c0888a0312156152d457600080fd5b873567ffffffffffffffff8111156152eb57600080fd5b6152f78a828b01614d01565b909850965050602088013561530b81614ba9565b945060408801359350606088013561532281614ba9565b925061533060808901614eea565b9150614f8e60a08901614cb8565b801515811461232757600080fd5b6000806040838503121561535f57600080fd5b823561536a81614ba9565b91506020830135614dff8161533e565b6000806040838503121561538d57600080fd5b82359150614cf860208401614eea565b60008060008060008060a087890312156153b657600080fd5b86359550602087013567ffffffffffffffff8111156153d457600080fd5b6153e089828a01614d01565b90965094505060408701356153f481614ba9565b925061540260608801614eea565b915061541060808801614cb8565b90509295509295509295565b6000806000806080858703121561543257600080fd5b84359350602085013561544481614ba9565b9250604085013561510c81614ba9565b60008060006060848603121561546957600080fd5b833592506020840135915060408401356152ae81614ba9565b6000806000806060858703121561549857600080fd5b843567ffffffffffffffff8111156154af57600080fd5b6154bb87828801614d01565b90955093505060208501356154cf81614ba9565b915060408501356154df81614ba9565b939692955090935050565b600080604083850312156154fd57600080fd5b823561550881614ba9565b91506020830135614dff81614ba9565b60008060008060006080868803121561553057600080fd5b85359450602086013567ffffffffffffffff81111561554e57600080fd5b61555a88828901614d01565b909550935050604086013561556e81614ba9565b9150606086013561557e81614ba9565b809150509295509295909350565b600080600080600060a086880312156155a457600080fd5b85356155af81614ba9565b945060208601356155bf81614ba9565b93506040860135925060608601359150608086013567ffffffffffffffff8111156155e957600080fd5b6150d288828901614e8e565b60008060008060008060a0878903121561560e57600080fd5b863567ffffffffffffffff81111561562557600080fd5b61563189828a01614d01565b909750955050602087013561564581614ba9565b935061565360408801614eea565b925061566160608801614cb8565b9150608087013561567181614ba9565b809150509295509295509295565b60006020828403121561569157600080fd5b815167ffffffffffffffff8111156156a857600080fd5b8201601f810184136156b957600080fd5b80516156c481614e66565b6040516156d18282614e39565b8281528660208486010111156156e657600080fd5b6156f7836020830160208701614c55565b9695505050505050565b600080600080600060a0868803121561571957600080fd5b853567ffffffffffffffff81111561573057600080fd5b61573c88828901614e8e565b955050602086013561574d81614ba9565b935061575b60408701614eea565b925061576960608701614cb8565b9150608086013561557e81614ba9565b600181811c9082168061578d57607f821691505b6020821081036157c6577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b6000602082840312156157de57600080fd5b8151614c4e81614ba9565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361587857615878615818565b5060010190565b60408152600061589260408301856151e8565b82810360208401526158a481856151e8565b95945050505050565b6000602082840312156158bf57600080fd5b5051919050565b6000602082840312156158d857600080fd5b8151614c4e8161533e565b8183823760009101908152919050565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b60a08152600061593260a08301888a6158f3565b90506001600160a01b03808716602084015263ffffffff8616604084015267ffffffffffffffff85166060840152808416608084015250979650505050505050565b88815260e06020820152600061598e60e08301898b6158f3565b6001600160a01b03978816604084015295909616606082015267ffffffffffffffff938416608082015263ffffffff9290921660a083015290911660c090910152949350505050565b601f821115615a1d57600081815260208120601f850160051c810160208610156159fe5750805b601f850160051c820191505b81811015613d6857828155600101615a0a565b505050565b815167ffffffffffffffff811115615a3c57615a3c614e0a565b615a5081615a4a8454615779565b846159d7565b602080601f831160018114615aa35760008415615a6d5750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b178555613d68565b600085815260208120601f198616915b82811015615ad257888601518255948401946001909101908401615ab3565b5085821015615b0e57878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b60006001600160a01b03808816835280871660208401525060a06040830152615b4a60a08301866151e8565b8281036060840152615b5c81866151e8565b90508281036080840152613a018185614c79565b600060208284031215615b8257600080fd5b8151614c4e81614c03565b600060033d1115615ba65760046000803e5060005160e01c5b90565b600060443d1015615bb75790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff8160248401118184111715615c0557505050505090565b8285019150815181811115615c1d5750505050505090565b843d8701016020828501011115615c375750505050505090565b615c4660208286010187614e39565b509095945050505050565b8082018082111561082457610824615818565b8181038181111561082457610824615818565b608081526000615c8a6080830187614c79565b6001600160a01b039590951660208301525063ffffffff92909216604083015267ffffffffffffffff16606090910152919050565b7fff000000000000000000000000000000000000000000000000000000000000008460f81b16815260008351615cfc816001850160208801614c55565b835190830190615d13816001840160208801614c55565b0160010195945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152615d5860a0830184614c79565b97965050505050505056fea2646970667358221220023c9c32e014d489c5a23e8e087c412538ac97c4b9baab7e6c472e2d81c489f164736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "allFusesBurned(bytes32,uint32)": { + "params": { + "fuseMask": "The fuses you want to check", + "node": "Namehash of the name" + }, + "returns": { + "_0": "Boolean of whether or not all the selected fuses are burned" + } + }, + "balanceOf(address,uint256)": { + "details": "See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address." + }, + "balanceOfBatch(address[],uint256[])": { + "details": "See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length." + }, + "getData(uint256)": { + "params": { + "id": "Label as a string of the .eth domain to wrap" + }, + "returns": { + "_0": "address The owner of the name", + "_1": "uint32 Fuses of the name", + "_2": "uint64 Expiry of when the fuses expire for the name" + } + }, + "isApprovedForAll(address,address)": { + "details": "See {IERC1155-isApprovedForAll}." + }, + "isTokenOwnerOrApproved(bytes32,address)": { + "params": { + "addr": "which address to check permissions for", + "node": "namehash of the name to check" + }, + "returns": { + "_0": "whether or not is owner or approved" + } + }, + "isWrapped(bytes32)": { + "details": "Both of these checks need to be true to be considered wrapped if checked without this contract", + "params": { + "node": "Namehash of the name" + }, + "returns": { + "_0": "Boolean of whether or not the name is wrapped" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "ownerOf(uint256)": { + "params": { + "id": "Label as a string of the .eth domain to wrap" + }, + "returns": { + "owner": "The owner of the name" + } + }, + "recoverFunds(address,address,uint256)": { + "details": "The contract is Ownable and only the owner can call the recover function.", + "params": { + "_amount": "The amount of tokens to recover.", + "_to": "The address to send the tokens to.", + "_token": "The address of the ERC20 token to recover" + } + }, + "registerAndWrapETH2LD(string,address,uint256,address,uint32,uint64)": { + "details": "Registers a new .eth second-level domain and wraps it. Only callable by authorised controllers.", + "params": { + "duration": "The duration, in seconds, to register the name for.", + "expiry": "When the fuses will expire", + "fuses": "Initial fuses to set", + "label": "The label to register (Eg, 'foo' for 'foo.eth').", + "resolver": "The resolver address to set on the ENS registry (optional).", + "wrappedOwner": "The owner of the wrapped name." + }, + "returns": { + "registrarExpiry": "The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch." + } + }, + "renew(uint256,uint256,uint32,uint64)": { + "details": "Only callable by authorised controllers.", + "params": { + "duration": "The number of seconds to renew the name for.", + "tokenId": "The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth')." + }, + "returns": { + "expires": "The expiry date of the name on the .eth registrar, in seconds since the Unix epoch." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)": { + "details": "See {IERC1155-safeBatchTransferFrom}." + }, + "safeTransferFrom(address,address,uint256,uint256,bytes)": { + "details": "See {IERC1155-safeTransferFrom}." + }, + "setApprovalForAll(address,bool)": { + "details": "See {IERC1155-setApprovalForAll}." + }, + "setChildFuses(bytes32,bytes32,uint32,uint64)": { + "params": { + "expiry": "When the fuses will expire", + "fuses": "Fuses to burn", + "labelhash": "Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')", + "parentNode": "Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')" + } + }, + "setFuses(bytes32,uint32)": { + "params": { + "fuses": "Fuses to burn (cannot burn PARENT_CANNOT_CONTROL)", + "node": "Namehash of the name" + }, + "returns": { + "_0": "New fuses" + } + }, + "setMetadataService(address)": { + "params": { + "_metadataService": "The new metadata service" + } + }, + "setRecord(bytes32,address,address,uint64)": { + "params": { + "node": "Namehash of the name to set a record for", + "owner": "New owner in the registry", + "resolver": "Resolver contract", + "ttl": "Time to live in the registry" + } + }, + "setResolver(bytes32,address)": { + "params": { + "node": "namehash of the name", + "resolver": "the resolver contract" + } + }, + "setSubnodeOwner(bytes32,string,address,uint32,uint64)": { + "params": { + "expiry": "When the fuses will expire", + "fuses": "Initial fuses for the wrapped subdomain", + "label": "Label of the subdomain as a string", + "owner": "New owner in the wrapper", + "parentNode": "Parent namehash of the subdomain" + }, + "returns": { + "node": "Namehash of the subdomain" + } + }, + "setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)": { + "params": { + "expiry": "expiry date for the domain", + "fuses": "initial fuses for the wrapped subdomain", + "label": "label of the subdomain as a string", + "owner": "new owner in the wrapper", + "parentNode": "parent namehash of the subdomain", + "resolver": "resolver contract in the registry", + "ttl": "ttl in the regsitry" + }, + "returns": { + "node": "Namehash of the subdomain" + } + }, + "setTTL(bytes32,uint64)": { + "params": { + "node": "Namehash of the name", + "ttl": "TTL in the registry" + } + }, + "setUpgradeContract(address)": { + "details": "The default value of upgradeContract is the 0 address. Use the 0 address at any time to make the contract not upgradable.", + "params": { + "_upgradeAddress": "address of an upgraded contract" + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "unwrap(bytes32,bytes32,address)": { + "details": "Can be called by the owner in the wrapper or an authorised caller in the wrapper", + "params": { + "controller": "Sets the owner in the registry to this address", + "labelhash": "Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')", + "parentNode": "Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')" + } + }, + "unwrapETH2LD(bytes32,address,address)": { + "details": "Can be called by the owner in the wrapper or an authorised caller in the wrapper", + "params": { + "controller": "Sets the owner in the registry to this address", + "labelhash": "Labelhash of the .eth domain", + "registrant": "Sets the owner in the .eth registrar to this address" + } + }, + "upgrade(bytes32,string,address,address)": { + "details": "Can be called by the owner or an authorised caller Requires upgraded Namewrapper to permit old Namewrapper to call `setSubnodeRecord` for all names", + "params": { + "label": "Label as a string of the name to upgrade", + "parentNode": "Namehash of the parent name", + "resolver": "Resolver contract for this name", + "wrappedOwner": "Owner of the name in this contract" + } + }, + "upgradeETH2LD(string,address,address)": { + "details": "Can be called by the owner of the name in this contract", + "params": { + "label": "Label as a string of the .eth name to upgrade", + "wrappedOwner": "The owner of the wrapped name" + } + }, + "uri(uint256)": { + "params": { + "tokenId": "The id of the token" + }, + "returns": { + "_0": "string uri of the metadata service" + } + }, + "wrap(bytes,address,address)": { + "details": "Can be called by the owner in the registry or an authorised caller in the registry", + "params": { + "name": "The name to wrap, in DNS format", + "resolver": "Resolver contract", + "wrappedOwner": "Owner of the name in this contract" + } + }, + "wrapETH2LD(string,address,uint32,uint64,address)": { + "details": "Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar", + "params": { + "expiry": "When the fuses will expire", + "fuses": "Initial fuses to set", + "label": "Label as a string of the .eth domain to wrap", + "resolver": "Resolver contract address", + "wrappedOwner": "Owner of the name in this contract" + }, + "returns": { + "_0": "Normalised expiry of when the fuses expire" + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "allFusesBurned(bytes32,uint32)": { + "notice": "Checks all Fuses in the mask are burned for the node" + }, + "getData(uint256)": { + "notice": "Gets the data for a name" + }, + "isTokenOwnerOrApproved(bytes32,address)": { + "notice": "Checks if owner or approved by owner" + }, + "isWrapped(bytes32)": { + "notice": "Checks if a name is wrapped or not" + }, + "ownerOf(uint256)": { + "notice": "Gets the owner of a name" + }, + "recoverFunds(address,address,uint256)": { + "notice": "Recover ERC20 tokens sent to the contract by mistake." + }, + "renew(uint256,uint256,uint32,uint64)": { + "notice": "Renews a .eth second-level domain." + }, + "setChildFuses(bytes32,bytes32,uint32,uint64)": { + "notice": "Sets fuses of a name that you own the parent of. Can also be called by the owner of a .eth name" + }, + "setFuses(bytes32,uint32)": { + "notice": "Sets fuses of a name" + }, + "setMetadataService(address)": { + "notice": "Set the metadata service. Only the owner can do this" + }, + "setRecord(bytes32,address,address,uint64)": { + "notice": "Sets records for the name in the ENS Registry" + }, + "setResolver(bytes32,address)": { + "notice": "Sets resolver contract in the registry" + }, + "setSubnodeOwner(bytes32,string,address,uint32,uint64)": { + "notice": "Sets the subdomain owner in the registry and then wraps the subdomain" + }, + "setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)": { + "notice": "Sets the subdomain owner in the registry with records and then wraps the subdomain" + }, + "setTTL(bytes32,uint64)": { + "notice": "Sets TTL in the registry" + }, + "setUpgradeContract(address)": { + "notice": "Set the address of the upgradeContract of the contract. only admin can do this" + }, + "unwrap(bytes32,bytes32,address)": { + "notice": "Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain" + }, + "unwrapETH2LD(bytes32,address,address)": { + "notice": "Unwraps a .eth domain. e.g. vitalik.eth" + }, + "upgrade(bytes32,string,address,address)": { + "notice": "Upgrades a non .eth domain of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain" + }, + "upgradeETH2LD(string,address,address)": { + "notice": "Upgrades a .eth wrapped domain by calling the wrapETH2LD function of the upgradeContract and burning the token of this contract" + }, + "uri(uint256)": { + "notice": "Get the metadata uri" + }, + "wrap(bytes,address,address)": { + "notice": "Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain" + }, + "wrapETH2LD(string,address,uint32,uint64,address)": { + "notice": "Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 545, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 16915, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_tokens", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 16921, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_operatorApprovals", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" + }, + { + "astId": 16851, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "controllers", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 18183, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "metadataService", + "offset": 0, + "slot": "4", + "type": "t_contract(IMetadataService)17777" + }, + { + "astId": 18188, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "names", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_bytes32,t_bytes_storage)" + }, + { + "astId": 18197, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "upgradeContract", + "offset": 0, + "slot": "6", + "type": "t_contract(INameWrapperUpgrade)18088" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(IMetadataService)17777": { + "encoding": "inplace", + "label": "contract IMetadataService", + "numberOfBytes": "20" + }, + "t_contract(INameWrapperUpgrade)18088": { + "encoding": "inplace", + "label": "contract INameWrapperUpgrade", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_bytes32,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/P256SHA256Algorithm.json b/solidity/dns-contracts/deployments/ropsten/P256SHA256Algorithm.json new file mode 100644 index 0000000..0e8b99a --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/P256SHA256Algorithm.json @@ -0,0 +1,81 @@ +{ + "address": "0x5e5a01e17Ff2f49a84d8374A4034460d82AD9107", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "key", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xd570bab21d40dcc343b857fc21e0c4f8d48c43bbffe0dfbfbdbd50cfb6cc59be", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x5e5a01e17Ff2f49a84d8374A4034460d82AD9107", + "transactionIndex": 8, + "gasUsed": "2240436", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xa5c77d62b7010196a5aa03e58891177c5a3097c4df363d253029417f6b8ec7a6", + "transactionHash": "0xd570bab21d40dcc343b857fc21e0c4f8d48c43bbffe0dfbfbdbd50cfb6cc59be", + "logs": [], + "blockNumber": 10645995, + "cumulativeGasUsed": "2531328", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "424cfdf012b9aa11d2e839569d49524c", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"verify(bytes,bytes,bytes)\":{\"details\":\"Verifies a signature.\",\"params\":{\"data\":\"The signed data to verify.\",\"key\":\"The public key to verify with.\",\"signature\":\"The signature to verify.\"},\"returns\":{\"_0\":\"True iff the signature is valid.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol\":\"P256SHA256Algorithm\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\\n uint shortest = len;\\n if (otherlen < len)\\n shortest = otherlen;\\n\\n uint selfptr;\\n uint otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint idx = 0; idx < shortest; idx += 32) {\\n uint a;\\n uint b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint mask;\\n if (shortest > 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\\n }\\n int diff = int(a & mask) - int(b & mask);\\n if (diff != 0)\\n return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int(len) - int(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\\n return self.length == other.length && equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint dest, uint src, uint len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint dest;\\n uint src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\\n require(len <= 52);\\n\\n uint ret = 0;\\n uint8 decoded;\\n for(uint i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if(i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint bitlen = len * 5;\\n if(len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if(len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if(len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if(len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if(len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n}\",\"keccak256\":\"0x83315df2e54c74451577c70da2c267c3459802b08b9aeec6516302eee70f796e\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n*/\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external virtual view returns (bool);\\n}\\n\",\"keccak256\":\"0x51d6251568844e435f58952354abe8c8c8e978ab40ecb0bbb2f5bd767838b3a7\"},\"contracts/dnssec-oracle/algorithms/EllipticCurve.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @title EllipticCurve\\n *\\n * @author Tilman Drerup;\\n *\\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\\n *\\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\\n * (https://github.com/orbs-network/elliptic-curve-solidity)\\n *\\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\\n *\\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\\n * condition 'rs[1] > lowSmax' in validateSignature().\\n */\\ncontract EllipticCurve {\\n\\n // Set parameters for curve.\\n uint constant a = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\\n uint constant b = 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\\n uint constant gx = 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\\n uint constant gy = 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\\n uint constant p = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\\n uint constant n = 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\\n\\n uint constant lowSmax = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\\n\\n /**\\n * @dev Inverse of u in the field of modulo m.\\n */\\n function inverseMod(uint u, uint m) internal pure\\n returns (uint)\\n {\\n unchecked {\\n if (u == 0 || u == m || m == 0)\\n return 0;\\n if (u > m)\\n u = u % m;\\n\\n int t1;\\n int t2 = 1;\\n uint r1 = m;\\n uint r2 = u;\\n uint q;\\n\\n while (r2 != 0) {\\n q = r1 / r2;\\n (t1, t2, r1, r2) = (t2, t1 - int(q) * t2, r2, r1 - q * r2);\\n }\\n\\n if (t1 < 0)\\n return (m - uint(-t1));\\n\\n return uint(t1);\\n }\\n }\\n\\n /**\\n * @dev Transform affine coordinates into projective coordinates.\\n */\\n function toProjectivePoint(uint x0, uint y0) internal pure\\n returns (uint[3] memory P)\\n {\\n P[2] = addmod(0, 1, p);\\n P[0] = mulmod(x0, P[2], p);\\n P[1] = mulmod(y0, P[2], p);\\n }\\n\\n /**\\n * @dev Add two points in affine coordinates and return projective point.\\n */\\n function addAndReturnProjectivePoint(uint x1, uint y1, uint x2, uint y2) internal pure\\n returns (uint[3] memory P)\\n {\\n uint x;\\n uint y;\\n (x, y) = add(x1, y1, x2, y2);\\n P = toProjectivePoint(x, y);\\n }\\n\\n /**\\n * @dev Transform from projective to affine coordinates.\\n */\\n function toAffinePoint(uint x0, uint y0, uint z0) internal pure\\n returns (uint x1, uint y1)\\n {\\n uint z0Inv;\\n z0Inv = inverseMod(z0, p);\\n x1 = mulmod(x0, z0Inv, p);\\n y1 = mulmod(y0, z0Inv, p);\\n }\\n\\n /**\\n * @dev Return the zero curve in projective coordinates.\\n */\\n function zeroProj() internal pure\\n returns (uint x, uint y, uint z)\\n {\\n return (0, 1, 0);\\n }\\n\\n /**\\n * @dev Return the zero curve in affine coordinates.\\n */\\n function zeroAffine() internal pure\\n returns (uint x, uint y)\\n {\\n return (0, 0);\\n }\\n\\n /**\\n * @dev Check if the curve is the zero curve.\\n */\\n function isZeroCurve(uint x0, uint y0) internal pure\\n returns (bool isZero)\\n {\\n if(x0 == 0 && y0 == 0) {\\n return true;\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Check if a point in affine coordinates is on the curve.\\n */\\n function isOnCurve(uint x, uint y) internal pure\\n returns (bool)\\n {\\n if (0 == x || x == p || 0 == y || y == p) {\\n return false;\\n }\\n\\n uint LHS = mulmod(y, y, p); // y^2\\n uint RHS = mulmod(mulmod(x, x, p), x, p); // x^3\\n\\n if (a != 0) {\\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\\n }\\n if (b != 0) {\\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\\n }\\n\\n return LHS == RHS;\\n }\\n\\n /**\\n * @dev Double an elliptic curve point in projective coordinates. See\\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\\n */\\n function twiceProj(uint x0, uint y0, uint z0) internal pure\\n returns (uint x1, uint y1, uint z1)\\n {\\n uint t;\\n uint u;\\n uint v;\\n uint w;\\n\\n if(isZeroCurve(x0, y0)) {\\n return zeroProj();\\n }\\n\\n u = mulmod(y0, z0, p);\\n u = mulmod(u, 2, p);\\n\\n v = mulmod(u, x0, p);\\n v = mulmod(v, y0, p);\\n v = mulmod(v, 2, p);\\n\\n x0 = mulmod(x0, x0, p);\\n t = mulmod(x0, 3, p);\\n\\n z0 = mulmod(z0, z0, p);\\n z0 = mulmod(z0, a, p);\\n t = addmod(t, z0, p);\\n\\n w = mulmod(t, t, p);\\n x0 = mulmod(2, v, p);\\n w = addmod(w, p-x0, p);\\n\\n x0 = addmod(v, p-w, p);\\n x0 = mulmod(t, x0, p);\\n y0 = mulmod(y0, u, p);\\n y0 = mulmod(y0, y0, p);\\n y0 = mulmod(2, y0, p);\\n y1 = addmod(x0, p-y0, p);\\n\\n x1 = mulmod(u, w, p);\\n\\n z1 = mulmod(u, u, p);\\n z1 = mulmod(z1, u, p);\\n }\\n\\n /**\\n * @dev Add two elliptic curve points in projective coordinates. See\\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\\n */\\n function addProj(uint x0, uint y0, uint z0, uint x1, uint y1, uint z1) internal pure\\n returns (uint x2, uint y2, uint z2)\\n {\\n uint t0;\\n uint t1;\\n uint u0;\\n uint u1;\\n\\n if (isZeroCurve(x0, y0)) {\\n return (x1, y1, z1);\\n }\\n else if (isZeroCurve(x1, y1)) {\\n return (x0, y0, z0);\\n }\\n\\n t0 = mulmod(y0, z1, p);\\n t1 = mulmod(y1, z0, p);\\n\\n u0 = mulmod(x0, z1, p);\\n u1 = mulmod(x1, z0, p);\\n\\n if (u0 == u1) {\\n if (t0 == t1) {\\n return twiceProj(x0, y0, z0);\\n }\\n else {\\n return zeroProj();\\n }\\n }\\n\\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\\n }\\n\\n /**\\n * @dev Helper function that splits addProj to avoid too many local variables.\\n */\\n function addProj2(uint v, uint u0, uint u1, uint t1, uint t0) private pure\\n returns (uint x2, uint y2, uint z2)\\n {\\n uint u;\\n uint u2;\\n uint u3;\\n uint w;\\n uint t;\\n\\n t = addmod(t0, p-t1, p);\\n u = addmod(u0, p-u1, p);\\n u2 = mulmod(u, u, p);\\n\\n w = mulmod(t, t, p);\\n w = mulmod(w, v, p);\\n u1 = addmod(u1, u0, p);\\n u1 = mulmod(u1, u2, p);\\n w = addmod(w, p-u1, p);\\n\\n x2 = mulmod(u, w, p);\\n\\n u3 = mulmod(u2, u, p);\\n u0 = mulmod(u0, u2, p);\\n u0 = addmod(u0, p-w, p);\\n t = mulmod(t, u0, p);\\n t0 = mulmod(t0, u3, p);\\n\\n y2 = addmod(t, p-t0, p);\\n\\n z2 = mulmod(u3, v, p);\\n }\\n\\n /**\\n * @dev Add two elliptic curve points in affine coordinates.\\n */\\n function add(uint x0, uint y0, uint x1, uint y1) internal pure\\n returns (uint, uint)\\n {\\n uint z0;\\n\\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\\n\\n return toAffinePoint(x0, y0, z0);\\n }\\n\\n /**\\n * @dev Double an elliptic curve point in affine coordinates.\\n */\\n function twice(uint x0, uint y0) internal pure\\n returns (uint, uint)\\n {\\n uint z0;\\n\\n (x0, y0, z0) = twiceProj(x0, y0, 1);\\n\\n return toAffinePoint(x0, y0, z0);\\n }\\n\\n /**\\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\\n */\\n function multiplyPowerBase2(uint x0, uint y0, uint exp) internal pure\\n returns (uint, uint)\\n {\\n uint base2X = x0;\\n uint base2Y = y0;\\n uint base2Z = 1;\\n\\n for(uint i = 0; i < exp; i++) {\\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\\n }\\n\\n return toAffinePoint(base2X, base2Y, base2Z);\\n }\\n\\n /**\\n * @dev Multiply an elliptic curve point by a scalar.\\n */\\n function multiplyScalar(uint x0, uint y0, uint scalar) internal pure\\n returns (uint x1, uint y1)\\n {\\n if(scalar == 0) {\\n return zeroAffine();\\n }\\n else if (scalar == 1) {\\n return (x0, y0);\\n }\\n else if (scalar == 2) {\\n return twice(x0, y0);\\n }\\n\\n uint base2X = x0;\\n uint base2Y = y0;\\n uint base2Z = 1;\\n uint z1 = 1;\\n x1 = x0;\\n y1 = y0;\\n\\n if(scalar%2 == 0) {\\n x1 = y1 = 0;\\n }\\n\\n scalar = scalar >> 1;\\n\\n while(scalar > 0) {\\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\\n\\n if(scalar%2 == 1) {\\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\\n }\\n\\n scalar = scalar >> 1;\\n }\\n\\n return toAffinePoint(x1, y1, z1);\\n }\\n\\n /**\\n * @dev Multiply the curve's generator point by a scalar.\\n */\\n function multipleGeneratorByScalar(uint scalar) internal pure\\n returns (uint, uint)\\n {\\n return multiplyScalar(gx, gy, scalar);\\n }\\n\\n /**\\n * @dev Validate combination of message, signature, and public key.\\n */\\n function validateSignature(bytes32 message, uint[2] memory rs, uint[2] memory Q) internal pure\\n returns (bool)\\n {\\n\\n // To disambiguate between public key solutions, include comment below.\\n if(rs[0] == 0 || rs[0] >= n || rs[1] == 0) {// || rs[1] > lowSmax)\\n return false;\\n }\\n if (!isOnCurve(Q[0], Q[1])) {\\n return false;\\n }\\n\\n uint x1;\\n uint x2;\\n uint y1;\\n uint y2;\\n\\n uint sInv = inverseMod(rs[1], n);\\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint(message), sInv, n));\\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\\n uint[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\\n\\n if (P[2] == 0) {\\n return false;\\n }\\n\\n uint Px = inverseMod(P[2], p);\\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\\n\\n return Px % n == rs[0];\\n }\\n}\",\"keccak256\":\"0xa0dc7fe8a8877e69c22e3e2e47dbc8370027c27dbd6a22cf5d36a4c3679608c8\"},\"contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\nimport \\\"./EllipticCurve.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\n\\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\\n\\n using BytesUtils for *;\\n\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external override view returns (bool) {\\n return validateSignature(sha256(data), parseSignature(signature), parseKey(key));\\n }\\n\\n function parseSignature(bytes memory data) internal pure returns (uint256[2] memory) {\\n require(data.length == 64, \\\"Invalid p256 signature length\\\");\\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\\n }\\n\\n function parseKey(bytes memory data) internal pure returns (uint256[2] memory) {\\n require(data.length == 68, \\\"Invalid p256 key length\\\");\\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\\n }\\n}\\n\",\"keccak256\":\"0x60c0ee554d9a3a3f1cda75c49050143c2aaa33ade54b20d782322035baeb5f81\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50612850806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004a600480360381019061004591906124bb565b610060565b60405161005791906125f2565b60405180910390f35b6000610156600286866040516100779291906125d9565b602060405180830381855afa158015610094573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906100b79190612492565b61010485858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610162565b6101518a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506101f6565b61028a565b90509695505050505050565b61016a6123ef565b60408251146101ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101a59061262d565b60405180910390fd5b60405180604001604052806101cd6000856108a190919063ffffffff16565b60001c81526020016101e96020856108a190919063ffffffff16565b60001c8152509050919050565b6101fe6123ef565b6044825114610242576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102399061260d565b60405180910390fd5b60405180604001604052806102616004856108a190919063ffffffff16565b60001c815260200161027d6024856108a190919063ffffffff16565b60001c8152509050919050565b600080836000600281106102c7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020020151148061033657507fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc6325518360006002811061032e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002015110155b8061037f5750600083600160028110610378577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020020151145b1561038d576000905061089a565b610413826000600281106103ca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002015183600160028110610409577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201516108cc565b610420576000905061089a565b600080600080600061049088600160028110610465577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551610bf9565b90506105377f6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c2967f4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f57fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc6325518061052c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b848d60001c09610d03565b809450819650505061065b8760006002811061057c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020020151886001600281106105bb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc63255180610615577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b848c600060028110610650577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002015109610d03565b8093508195505050600061067186858786610e09565b90506000816002600381106106af577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002015114156106c9576000965050505050505061089a565b600061073382600260038110610708577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201517fffffffff00000001000000000000000000000000ffffffffffffffffffffffff610bf9565b90507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061078a577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806107df577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8283098360006003811061081c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201510990508960006002811061085e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc6325518261088f9190612722565b149750505050505050505b9392505050565b600082516020836108b29190612669565b11156108bd57600080fd5b81602084010151905092915050565b600082600014806108fc57507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff83145b806109075750816000145b8061093157507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff82145b1561093f5760009050610bf3565b60007fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80610996577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b838409905060007fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806109f2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b857fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80610a48577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b87880909905060007fffffffff00000001000000000000000000000000fffffffffffffffffffffffc14610b48577fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80610acb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80610b20577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7fffffffff00000001000000000000000000000000fffffffffffffffffffffffc8709820890505b60007f5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b14610beb577fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80610bc5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b820890505b808214925050505b92915050565b600080831480610c0857508183145b80610c135750600082145b15610c215760009050610cfd565b81831115610c6357818381610c5f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b0692505b600080600190506000849050600086905060005b60008214610cd957818381610cb5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b04905083848202860383848402860380955081965082975083985050505050610c77565b6000851215610cf45784600003870395505050505050610cfd565b84955050505050505b92915050565b6000806000831415610d2057610d17610e3e565b91509150610e01565b6001831415610d3457848491509150610e01565b6002831415610d5057610d478585610e4c565b91509150610e01565b600085905060008590506000600190506000600190508895508794506000600288610d7b9190612722565b1415610d8957600094508495505b600187901c96505b6000871115610ded57610da5848484610e80565b8094508195508296505050506001600288610dc09190612722565b1415610de157610dd4848484898986611721565b8093508197508298505050505b600187901c9650610d91565b610df8868683611998565b95509550505050505b935093915050565b610e11612411565b600080610e2087878787611a86565b8092508193505050610e328282611ac0565b92505050949350505050565b600080600080915091509091565b6000806000610e5d85856001610e80565b809350819650829750505050610e74858583611998565b92509250509250929050565b6000806000806000806000610e958a8a611d1d565b15610eb157610ea2611d47565b96509650965050505050611718565b7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80610f06577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b888a0992507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80610f60577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6002840992507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80610fbb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8a840991507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611015577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b89830991507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061106f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6002830991507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806110ca577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8a8b0999507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611124577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60038b0993507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061117f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b88890997507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806111d9577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7fffffffff00000001000000000000000000000000fffffffffffffffffffffffc890997507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611253577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b88850893507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806112ad577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b84850990507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611307577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8260020999507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611362577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8a7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff61138e91906126bf565b820890507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806113e7577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b817fffffffff00000001000000000000000000000000ffffffffffffffffffffffff61141391906126bf565b830899507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061146c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8a850999507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806114c6577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b838a0998507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611520577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b898a0998507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061157a577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8960020998507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806115d5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b897fffffffff00000001000000000000000000000000ffffffffffffffffffffffff61160191906126bf565b8b0895507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061165a577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b81840996507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806116b4577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b83840994507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061170e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8386099450505050505b93509350939050565b60008060008060008060006117368d8d611d1d565b1561174d578989899650965096505050505061198c565b6117578a8a611d1d565b1561176e578c8c8c9650965096505050505061198c565b7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806117c3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b888d0993507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061181d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8b8a0992507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611877577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b888e0991507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806118d1577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8b8b099050808214156119175782841415611900576118f18d8d8d610e80565b9650965096505050505061198c565b611908611d47565b9650965096505050505061198c565b61197b7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061196f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b898d0983838688611d5c565b809750819850829950505050505050505b96509650969350505050565b60008060006119c7847fffffffff00000001000000000000000000000000ffffffffffffffffffffffff610bf9565b90507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611a1e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b81870992507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611a78577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b818609915050935093915050565b6000806000611a9b8787600188886001611721565b809350819850829950505050611ab2878783611998565b925092505094509492505050565b611ac8612411565b7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611b1d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600160000881600260038110611b5c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020020181815250507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611bba577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b81600260038110611bf4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020020151840981600060038110611c35577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020020181815250507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611c93577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b81600260038110611ccd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020020151830981600160038110611d0e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201818152505092915050565b60008083148015611d2e5750600082145b15611d3c5760019050611d41565b600090505b92915050565b60008060008060016000925092509250909192565b6000806000806000806000807fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611dbd577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8a7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff611de991906126bf565b8a0890507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611e42577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8b7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff611e6e91906126bf565b8d0894507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611ec7577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b85860993507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611f21577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b81820991507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611f7b577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8d830991507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611fd5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8c8c089a507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061202f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b848c099a507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80612089577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8b7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff6120b591906126bf565b830891507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061210e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b82860997507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80612168577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b85850992507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806121c2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b848d099b507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061221c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b827fffffffff00000001000000000000000000000000ffffffffffffffffffffffff61224891906126bf565b8d089b507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806122a1577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8c820990507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806122fb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b838a0998507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80612355577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b897fffffffff00000001000000000000000000000000ffffffffffffffffffffffff61238191906126bf565b820896507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806123da577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8d840995505050505050955095509592505050565b6040518060400160405280600290602082028036833780820191505090505090565b6040518060600160405280600390602082028036833780820191505090505090565b60008151905061244281612803565b92915050565b60008083601f84011261245a57600080fd5b8235905067ffffffffffffffff81111561247357600080fd5b60208301915083600182028301111561248b57600080fd5b9250929050565b6000602082840312156124a457600080fd5b60006124b284828501612433565b91505092915050565b600080600080600080606087890312156124d457600080fd5b600087013567ffffffffffffffff8111156124ee57600080fd5b6124fa89828a01612448565b9650965050602087013567ffffffffffffffff81111561251957600080fd5b61252589828a01612448565b9450945050604087013567ffffffffffffffff81111561254457600080fd5b61255089828a01612448565b92509250509295509295509295565b612568816126f3565b82525050565b600061257a838561264d565b9350612587838584612713565b82840190509392505050565b60006125a0601783612658565b91506125ab826127b1565b602082019050919050565b60006125c3601d83612658565b91506125ce826127da565b602082019050919050565b60006125e682848661256e565b91508190509392505050565b6000602082019050612607600083018461255f565b92915050565b6000602082019050818103600083015261262681612593565b9050919050565b60006020820190508181036000830152612646816125b6565b9050919050565b600081905092915050565b600082825260208201905092915050565b600061267482612709565b915061267f83612709565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156126b4576126b3612753565b5b828201905092915050565b60006126ca82612709565b91506126d583612709565b9250828210156126e8576126e7612753565b5b828203905092915050565b60008115159050919050565b6000819050919050565b6000819050919050565b82818337600083830152505050565b600061272d82612709565b915061273883612709565b92508261274857612747612782565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f496e76616c69642070323536206b6579206c656e677468000000000000000000600082015250565b7f496e76616c69642070323536207369676e6174757265206c656e677468000000600082015250565b61280c816126ff565b811461281757600080fd5b5056fea264697066735822122041b469a58c17efa4bbf76a90284953a55d4d07789c01f010594180f826f9babe64736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004a600480360381019061004591906124bb565b610060565b60405161005791906125f2565b60405180910390f35b6000610156600286866040516100779291906125d9565b602060405180830381855afa158015610094573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906100b79190612492565b61010485858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610162565b6101518a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506101f6565b61028a565b90509695505050505050565b61016a6123ef565b60408251146101ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101a59061262d565b60405180910390fd5b60405180604001604052806101cd6000856108a190919063ffffffff16565b60001c81526020016101e96020856108a190919063ffffffff16565b60001c8152509050919050565b6101fe6123ef565b6044825114610242576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102399061260d565b60405180910390fd5b60405180604001604052806102616004856108a190919063ffffffff16565b60001c815260200161027d6024856108a190919063ffffffff16565b60001c8152509050919050565b600080836000600281106102c7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020020151148061033657507fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc6325518360006002811061032e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002015110155b8061037f5750600083600160028110610378577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020020151145b1561038d576000905061089a565b610413826000600281106103ca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002015183600160028110610409577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201516108cc565b610420576000905061089a565b600080600080600061049088600160028110610465577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551610bf9565b90506105377f6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c2967f4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f57fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc6325518061052c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b848d60001c09610d03565b809450819650505061065b8760006002811061057c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020020151886001600281106105bb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc63255180610615577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b848c600060028110610650577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002015109610d03565b8093508195505050600061067186858786610e09565b90506000816002600381106106af577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002015114156106c9576000965050505050505061089a565b600061073382600260038110610708577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201517fffffffff00000001000000000000000000000000ffffffffffffffffffffffff610bf9565b90507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061078a577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806107df577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8283098360006003811061081c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201510990508960006002811061085e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc6325518261088f9190612722565b149750505050505050505b9392505050565b600082516020836108b29190612669565b11156108bd57600080fd5b81602084010151905092915050565b600082600014806108fc57507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff83145b806109075750816000145b8061093157507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff82145b1561093f5760009050610bf3565b60007fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80610996577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b838409905060007fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806109f2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b857fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80610a48577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b87880909905060007fffffffff00000001000000000000000000000000fffffffffffffffffffffffc14610b48577fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80610acb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80610b20577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7fffffffff00000001000000000000000000000000fffffffffffffffffffffffc8709820890505b60007f5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b14610beb577fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80610bc5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b820890505b808214925050505b92915050565b600080831480610c0857508183145b80610c135750600082145b15610c215760009050610cfd565b81831115610c6357818381610c5f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b0692505b600080600190506000849050600086905060005b60008214610cd957818381610cb5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b04905083848202860383848402860380955081965082975083985050505050610c77565b6000851215610cf45784600003870395505050505050610cfd565b84955050505050505b92915050565b6000806000831415610d2057610d17610e3e565b91509150610e01565b6001831415610d3457848491509150610e01565b6002831415610d5057610d478585610e4c565b91509150610e01565b600085905060008590506000600190506000600190508895508794506000600288610d7b9190612722565b1415610d8957600094508495505b600187901c96505b6000871115610ded57610da5848484610e80565b8094508195508296505050506001600288610dc09190612722565b1415610de157610dd4848484898986611721565b8093508197508298505050505b600187901c9650610d91565b610df8868683611998565b95509550505050505b935093915050565b610e11612411565b600080610e2087878787611a86565b8092508193505050610e328282611ac0565b92505050949350505050565b600080600080915091509091565b6000806000610e5d85856001610e80565b809350819650829750505050610e74858583611998565b92509250509250929050565b6000806000806000806000610e958a8a611d1d565b15610eb157610ea2611d47565b96509650965050505050611718565b7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80610f06577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b888a0992507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80610f60577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6002840992507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80610fbb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8a840991507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611015577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b89830991507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061106f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6002830991507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806110ca577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8a8b0999507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611124577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60038b0993507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061117f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b88890997507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806111d9577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7fffffffff00000001000000000000000000000000fffffffffffffffffffffffc890997507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611253577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b88850893507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806112ad577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b84850990507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611307577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8260020999507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611362577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8a7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff61138e91906126bf565b820890507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806113e7577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b817fffffffff00000001000000000000000000000000ffffffffffffffffffffffff61141391906126bf565b830899507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061146c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8a850999507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806114c6577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b838a0998507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611520577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b898a0998507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061157a577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8960020998507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806115d5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b897fffffffff00000001000000000000000000000000ffffffffffffffffffffffff61160191906126bf565b8b0895507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061165a577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b81840996507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806116b4577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b83840994507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061170e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8386099450505050505b93509350939050565b60008060008060008060006117368d8d611d1d565b1561174d578989899650965096505050505061198c565b6117578a8a611d1d565b1561176e578c8c8c9650965096505050505061198c565b7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806117c3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b888d0993507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061181d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8b8a0992507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611877577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b888e0991507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806118d1577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8b8b099050808214156119175782841415611900576118f18d8d8d610e80565b9650965096505050505061198c565b611908611d47565b9650965096505050505061198c565b61197b7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061196f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b898d0983838688611d5c565b809750819850829950505050505050505b96509650969350505050565b60008060006119c7847fffffffff00000001000000000000000000000000ffffffffffffffffffffffff610bf9565b90507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611a1e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b81870992507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611a78577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b818609915050935093915050565b6000806000611a9b8787600188886001611721565b809350819850829950505050611ab2878783611998565b925092505094509492505050565b611ac8612411565b7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611b1d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600160000881600260038110611b5c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020020181815250507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611bba577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b81600260038110611bf4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020020151840981600060038110611c35577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020020181815250507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611c93577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b81600260038110611ccd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020020151830981600160038110611d0e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200201818152505092915050565b60008083148015611d2e5750600082145b15611d3c5760019050611d41565b600090505b92915050565b60008060008060016000925092509250909192565b6000806000806000806000807fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611dbd577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8a7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff611de991906126bf565b8a0890507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611e42577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8b7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff611e6e91906126bf565b8d0894507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611ec7577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b85860993507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611f21577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b81820991507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611f7b577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8d830991507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80611fd5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8c8c089a507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061202f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b848c099a507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80612089577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8b7fffffffff00000001000000000000000000000000ffffffffffffffffffffffff6120b591906126bf565b830891507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061210e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b82860997507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80612168577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b85850992507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806121c2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b848d099b507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff8061221c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b827fffffffff00000001000000000000000000000000ffffffffffffffffffffffff61224891906126bf565b8d089b507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806122a1577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8c820990507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806122fb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b838a0998507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff80612355577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b897fffffffff00000001000000000000000000000000ffffffffffffffffffffffff61238191906126bf565b820896507fffffffff00000001000000000000000000000000ffffffffffffffffffffffff806123da577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8d840995505050505050955095509592505050565b6040518060400160405280600290602082028036833780820191505090505090565b6040518060600160405280600390602082028036833780820191505090505090565b60008151905061244281612803565b92915050565b60008083601f84011261245a57600080fd5b8235905067ffffffffffffffff81111561247357600080fd5b60208301915083600182028301111561248b57600080fd5b9250929050565b6000602082840312156124a457600080fd5b60006124b284828501612433565b91505092915050565b600080600080600080606087890312156124d457600080fd5b600087013567ffffffffffffffff8111156124ee57600080fd5b6124fa89828a01612448565b9650965050602087013567ffffffffffffffff81111561251957600080fd5b61252589828a01612448565b9450945050604087013567ffffffffffffffff81111561254457600080fd5b61255089828a01612448565b92509250509295509295509295565b612568816126f3565b82525050565b600061257a838561264d565b9350612587838584612713565b82840190509392505050565b60006125a0601783612658565b91506125ab826127b1565b602082019050919050565b60006125c3601d83612658565b91506125ce826127da565b602082019050919050565b60006125e682848661256e565b91508190509392505050565b6000602082019050612607600083018461255f565b92915050565b6000602082019050818103600083015261262681612593565b9050919050565b60006020820190508181036000830152612646816125b6565b9050919050565b600081905092915050565b600082825260208201905092915050565b600061267482612709565b915061267f83612709565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156126b4576126b3612753565b5b828201905092915050565b60006126ca82612709565b91506126d583612709565b9250828210156126e8576126e7612753565b5b828203905092915050565b60008115159050919050565b6000819050919050565b6000819050919050565b82818337600083830152505050565b600061272d82612709565b915061273883612709565b92508261274857612747612782565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f496e76616c69642070323536206b6579206c656e677468000000000000000000600082015250565b7f496e76616c69642070323536207369676e6174757265206c656e677468000000600082015250565b61280c816126ff565b811461281757600080fd5b5056fea264697066735822122041b469a58c17efa4bbf76a90284953a55d4d07789c01f010594180f826f9babe64736f6c63430008040033", + "devdoc": { + "kind": "dev", + "methods": { + "verify(bytes,bytes,bytes)": { + "details": "Verifies a signature.", + "params": { + "data": "The signed data to verify.", + "key": "The public key to verify with.", + "signature": "The signature to verify." + }, + "returns": { + "_0": "True iff the signature is valid." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/PublicResolver.json b/solidity/dns-contracts/deployments/ropsten/PublicResolver.json new file mode 100644 index 0000000..0bb8b2d --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/PublicResolver.json @@ -0,0 +1,1536 @@ +{ + "address": "0x13F0659Ee6bb7484C884FEeFb7F75C93951ef837", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract INameWrapper", + "name": "wrapperAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_trustedETHController", + "type": "address" + }, + { + "internalType": "address", + "name": "_trustedReverseRegistrar", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + } + ], + "name": "ABIChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "AddrChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "ContenthashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "record", + "type": "bytes" + } + ], + "name": "DNSRecordChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "DNSRecordDeleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "lastzonehash", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "zonehash", + "type": "bytes" + } + ], + "name": "DNSZonehashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "InterfaceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "PubkeyChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "string", + "name": "indexedKey", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "TextChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "newVersion", + "type": "uint64" + } + ], + "name": "VersionChanged", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentTypes", + "type": "uint256" + } + ], + "name": "ABI", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "clearRecords", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "contenthash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "dnsRecord", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + } + ], + "name": "hasDNSRecords", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "interfaceImplementer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "nodehash", + "type": "bytes32" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicallWithNodeCheck", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "pubkey", + "outputs": [ + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "recordVersions", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setABI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "a", + "type": "bytes" + } + ], + "name": "setAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "setAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setContenthash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setDNSRecords", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "setInterface", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "newName", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "setPubkey", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "setText", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setZonehash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "text", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "zonehash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x7d4cabd1dcdda07c4e5cca6d43cfd2225f65de75b2617dcd2ec598ab5747fc89", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x13F0659Ee6bb7484C884FEeFb7F75C93951ef837", + "transactionIndex": 3, + "gasUsed": "2819960", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xbe92ad94687450e926f5cb55d42de3f598d33299eb90b919d9d6781d69c8a44c", + "transactionHash": "0x7d4cabd1dcdda07c4e5cca6d43cfd2225f65de75b2617dcd2ec598ab5747fc89", + "logs": [], + "blockNumber": 13068671, + "cumulativeGasUsed": "3166302", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0xF82155e2a43Be0871821E9654Fc8Ae894FB8307C", + "0xa5627AB7Ae47063B533622C34FEBDb52d3281dF8", + "0x806246b52f8cB61655d3038c58D2f63Aa55d4edE" + ], + "numDeployments": 2, + "solcInputHash": "e0f6f00faee6ee60a1220d91a962cdaa", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract INameWrapper\",\"name\":\"wrapperAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_trustedETHController\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_trustedReverseRegistrar\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"}],\"name\":\"ABIChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"AddrChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"newAddress\",\"type\":\"bytes\"}],\"name\":\"AddressChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"ContenthashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"record\",\"type\":\"bytes\"}],\"name\":\"DNSRecordChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"DNSRecordDeleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"lastzonehash\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"zonehash\",\"type\":\"bytes\"}],\"name\":\"DNSZonehashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"InterfaceChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NameChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"PubkeyChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"indexedKey\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"TextChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"newVersion\",\"type\":\"uint64\"}],\"name\":\"VersionChanged\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentTypes\",\"type\":\"uint256\"}],\"name\":\"ABI\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"clearRecords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"contenthash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"dnsRecord\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"hasDNSRecords\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"interfaceImplementer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nodehash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicallWithNodeCheck\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"pubkey\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"recordVersions\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setABI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"a\",\"type\":\"bytes\"}],\"name\":\"setAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"setAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setContenthash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setDNSRecords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"setInterface\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"newName\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"setPubkey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"setText\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setZonehash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"}],\"name\":\"text\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"zonehash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"ABI(bytes32,uint256)\":{\"params\":{\"contentTypes\":\"A bitwise OR of the ABI formats accepted by the caller.\",\"node\":\"The ENS node to query\"},\"returns\":{\"_0\":\"contentType The content type of the return value\",\"_1\":\"data The ABI data\"}},\"addr(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated address.\"}},\"clearRecords(bytes32)\":{\"params\":{\"node\":\"The node to update.\"}},\"contenthash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated contenthash.\"}},\"dnsRecord(bytes32,bytes32,uint16)\":{\"params\":{\"name\":\"the keccak-256 hash of the fully-qualified name for which to fetch the record\",\"node\":\"the namehash of the node for which to fetch the record\",\"resource\":\"the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\"},\"returns\":{\"_0\":\"the DNS record in wire format if present, otherwise empty\"}},\"hasDNSRecords(bytes32,bytes32)\":{\"params\":{\"name\":\"the namehash of the node for which to check the records\",\"node\":\"the namehash of the node for which to check the records\"}},\"interfaceImplementer(bytes32,bytes4)\":{\"params\":{\"interfaceID\":\"The EIP 165 interface ID to check for.\",\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The address that implements this interface, or 0 if the interface is unsupported.\"}},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC1155-isApprovedForAll}.\"},\"name(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated name.\"}},\"pubkey(bytes32)\":{\"params\":{\"node\":\"The ENS node to query\"},\"returns\":{\"x\":\"The X coordinate of the curve point for the public key.\",\"y\":\"The Y coordinate of the curve point for the public key.\"}},\"setABI(bytes32,uint256,bytes)\":{\"params\":{\"contentType\":\"The content type of the ABI\",\"data\":\"The ABI data.\",\"node\":\"The node to update.\"}},\"setAddr(bytes32,address)\":{\"params\":{\"a\":\"The address to set.\",\"node\":\"The node to update.\"}},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC1155-setApprovalForAll}.\"},\"setContenthash(bytes32,bytes)\":{\"params\":{\"hash\":\"The contenthash to set\",\"node\":\"The node to update.\"}},\"setDNSRecords(bytes32,bytes)\":{\"params\":{\"data\":\"the DNS wire format records to set\",\"node\":\"the namehash of the node for which to set the records\"}},\"setInterface(bytes32,bytes4,address)\":{\"params\":{\"implementer\":\"The address of a contract that implements this interface for this node.\",\"interfaceID\":\"The EIP 165 interface ID.\",\"node\":\"The node to update.\"}},\"setName(bytes32,string)\":{\"params\":{\"node\":\"The node to update.\"}},\"setPubkey(bytes32,bytes32,bytes32)\":{\"params\":{\"node\":\"The ENS node to query\",\"x\":\"the X coordinate of the curve point for the public key.\",\"y\":\"the Y coordinate of the curve point for the public key.\"}},\"setText(bytes32,string,string)\":{\"params\":{\"key\":\"The key to set.\",\"node\":\"The node to update.\",\"value\":\"The text data value to set.\"}},\"setZonehash(bytes32,bytes)\":{\"params\":{\"hash\":\"The zonehash to set\",\"node\":\"The node to update.\"}},\"text(bytes32,string)\":{\"params\":{\"key\":\"The text data key to query.\",\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated text data.\"}},\"zonehash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated contenthash.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"ABI(bytes32,uint256)\":{\"notice\":\"Returns the ABI associated with an ENS node. Defined in EIP205.\"},\"addr(bytes32)\":{\"notice\":\"Returns the address associated with an ENS node.\"},\"clearRecords(bytes32)\":{\"notice\":\"Increments the record version associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"contenthash(bytes32)\":{\"notice\":\"Returns the contenthash associated with an ENS node.\"},\"dnsRecord(bytes32,bytes32,uint16)\":{\"notice\":\"Obtain a DNS record.\"},\"hasDNSRecords(bytes32,bytes32)\":{\"notice\":\"Check if a given node has records.\"},\"interfaceImplementer(bytes32,bytes4)\":{\"notice\":\"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.\"},\"name(bytes32)\":{\"notice\":\"Returns the name associated with an ENS node, for reverse records. Defined in EIP181.\"},\"pubkey(bytes32)\":{\"notice\":\"Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619.\"},\"setABI(bytes32,uint256,bytes)\":{\"notice\":\"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.\"},\"setAddr(bytes32,address)\":{\"notice\":\"Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setContenthash(bytes32,bytes)\":{\"notice\":\"Sets the contenthash associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setDNSRecords(bytes32,bytes)\":{\"notice\":\"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.\"},\"setInterface(bytes32,bytes4,address)\":{\"notice\":\"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.\"},\"setName(bytes32,string)\":{\"notice\":\"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.\"},\"setPubkey(bytes32,bytes32,bytes32)\":{\"notice\":\"Sets the SECP256k1 public key associated with an ENS node.\"},\"setText(bytes32,string,string)\":{\"notice\":\"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.\"},\"setZonehash(bytes32,bytes)\":{\"notice\":\"setZonehash sets the hash for the zone. May only be called by the owner of that node in the ENS registry.\"},\"text(bytes32,string)\":{\"notice\":\"Returns the text data associated with an ENS node and key.\"},\"zonehash(bytes32)\":{\"notice\":\"zonehash obtains the hash for the zone.\"}},\"notice\":\"A simple resolver anyone can use; only allows the owner of a node to set its address.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/resolvers/PublicResolver.sol\":\"PublicResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for writing to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n mstore(0x40, add(32, add(ptr, capacity)))\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n function max(uint a, uint b) private pure returns(uint) {\\n if (a > b) {\\n return a;\\n }\\n return b;\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The start offset to write to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n if (off + len > buf.capacity) {\\n resize(buf, max(buf.capacity, len + off) * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(add(len, off), buflen) {\\n mstore(bufptr, add(len, off))\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, len);\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, data.length);\\n }\\n\\n /**\\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write the byte at.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\\n if (off >= buf.capacity) {\\n resize(buf, buf.capacity * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if eq(off, buflen) {\\n mstore(bufptr, add(buflen, 1))\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n return writeUint8(buf, buf.buf.length, data);\\n }\\n\\n /**\\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\\n if (len + off > buf.capacity) {\\n resize(buf, (len + off) * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off + len\\n let dest := add(add(bufptr, off), len)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(add(off, len), mload(bufptr)) {\\n mstore(bufptr, add(off, len))\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\\n return write(buf, off, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, 32);\\n }\\n\\n /**\\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\\n if (len + off > buf.capacity) {\\n resize(buf, (len + off) * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + off + sizeof(buffer length) + len\\n let dest := add(add(bufptr, off), len)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(add(off, len), mload(bufptr)) {\\n mstore(bufptr, add(off, len))\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n return writeInt(buf, buf.buf.length, data, len);\\n }\\n}\\n\",\"keccak256\":\"0x18e42be1a3e4f7b4442d7ab0b524af5e09163503439954faf0ab3792cce91caa\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, bytes memory other)\\n internal\\n pure\\n returns (int256)\\n {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest > 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2**(8 * (32 - shortest + idx)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length >= offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, bytes memory other)\\n internal\\n pure\\n returns (bool)\\n {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(bytes memory self, uint256 idx)\\n internal\\n pure\\n returns (uint8 ret)\\n {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(bytes memory self, uint256 idx)\\n internal\\n pure\\n returns (uint16 ret)\\n {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(bytes memory self, uint256 idx)\\n internal\\n pure\\n returns (uint32 ret)\\n {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(bytes memory self, uint256 idx)\\n internal\\n pure\\n returns (bytes32 ret)\\n {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(bytes memory self, uint256 idx)\\n internal\\n pure\\n returns (bytes20 ret)\\n {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(\\n uint256 dest,\\n uint256 src,\\n uint256 len\\n ) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256**(32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0xbb12e0c376de4b977f5b43a85b8b28d951c16362a58e35d061d7543f16a923a9\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n */\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(bytes memory self, uint256 offset)\\n internal\\n pure\\n returns (uint256)\\n {\\n uint256 idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint256 labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(bytes memory self, uint256 offset)\\n internal\\n pure\\n returns (bytes memory ret)\\n {\\n uint256 len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(bytes memory self, uint256 offset)\\n internal\\n pure\\n returns (uint256)\\n {\\n uint256 count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint256 labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint256 constant RRSIG_TYPE = 0;\\n uint256 constant RRSIG_ALGORITHM = 2;\\n uint256 constant RRSIG_LABELS = 3;\\n uint256 constant RRSIG_TTL = 4;\\n uint256 constant RRSIG_EXPIRATION = 8;\\n uint256 constant RRSIG_INCEPTION = 12;\\n uint256 constant RRSIG_KEY_TAG = 16;\\n uint256 constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(bytes memory data)\\n internal\\n pure\\n returns (SignedSet memory self)\\n {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(\\n RRSIG_SIGNER_NAME + self.signerName.length,\\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\\n );\\n }\\n\\n function rrs(SignedSet memory rrset)\\n internal\\n pure\\n returns (RRIterator memory)\\n {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint256 offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint256 rdataOffset;\\n uint256 nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(bytes memory self, uint256 offset)\\n internal\\n pure\\n returns (RRIterator memory ret)\\n {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns (bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint256 rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.offset,\\n nameLength(iter.data, iter.offset)\\n );\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(RRIterator memory iter)\\n internal\\n pure\\n returns (bytes memory)\\n {\\n return\\n iter.data.substring(\\n iter.rdataOffset,\\n iter.nextOffset - iter.rdataOffset\\n );\\n }\\n\\n uint256 constant DNSKEY_FLAGS = 0;\\n uint256 constant DNSKEY_PROTOCOL = 2;\\n uint256 constant DNSKEY_ALGORITHM = 3;\\n uint256 constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(\\n offset + DNSKEY_PUBKEY,\\n length - DNSKEY_PUBKEY\\n );\\n }\\n\\n uint256 constant DS_KEY_TAG = 0;\\n uint256 constant DS_ALGORITHM = 2;\\n uint256 constant DS_DIGEST_TYPE = 3;\\n uint256 constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n function compareNames(bytes memory self, bytes memory other)\\n internal\\n pure\\n returns (int256)\\n {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint256 off;\\n uint256 otheroff;\\n uint256 prevoff;\\n uint256 otherprevoff;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if (otheroff == 0) {\\n return 1;\\n }\\n\\n return\\n self.compare(\\n prevoff + 1,\\n self.readUint8(prevoff),\\n other,\\n otherprevoff + 1,\\n other.readUint8(otherprevoff)\\n );\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(uint32 i1, uint32 i2)\\n internal\\n pure\\n returns (bool)\\n {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n\\n function progress(bytes memory body, uint256 off)\\n internal\\n pure\\n returns (uint256)\\n {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint256 ac1;\\n uint256 ac2;\\n for (uint256 i = 0; i < data.length + 31; i += 32) {\\n uint256 word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if (i + 32 > data.length) {\\n uint256 unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 +=\\n (word &\\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\\n 8;\\n ac2 += (word &\\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 =\\n (ac1 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac1 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac2 =\\n (ac2 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac2 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 =\\n (ac1 &\\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\\n 32);\\n ac1 =\\n (ac1 &\\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\\n 64);\\n ac1 =\\n (ac1 &\\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\\n (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc40cbcdbc625038ecec82017337ada164c9778069136c0ade9f0ab07aaa6f188\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(address owner, address operator)\\n external\\n view\\n returns (bool);\\n}\\n\",\"keccak256\":\"0xf79be82c1a2eb0a77fba4e0972221912e803309081ca460fd2cf61653e55758a\"},\"contracts/resolvers/IMulticallable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IMulticallable {\\n function multicall(bytes[] calldata data)\\n external\\n returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(bytes32, bytes[] calldata data)\\n external\\n returns (bytes[] memory results);\\n}\\n\",\"keccak256\":\"0x78b9070106d539e070dde613caaa03522143ab55c206a2efd5664c9da783741a\",\"license\":\"MIT\"},\"contracts/resolvers/Multicallable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"./IMulticallable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nabstract contract Multicallable is IMulticallable, ERC165 {\\n function _multicall(bytes32 nodehash, bytes[] calldata data)\\n internal\\n returns (bytes[] memory results)\\n {\\n results = new bytes[](data.length);\\n for (uint256 i = 0; i < data.length; i++) {\\n if (nodehash != bytes32(0)) {\\n bytes32 txNamehash = bytes32(data[i][4:36]);\\n require(\\n txNamehash == nodehash,\\n \\\"multicall: All records must have a matching namehash\\\"\\n );\\n }\\n (bool success, bytes memory result) = address(this).delegatecall(\\n data[i]\\n );\\n require(success);\\n results[i] = result;\\n }\\n return results;\\n }\\n\\n // This function provides an extra security check when called\\n // from priviledged contracts (such as EthRegistrarController)\\n // that can set records on behalf of the node owners\\n function multicallWithNodeCheck(bytes32 nodehash, bytes[] calldata data)\\n external\\n returns (bytes[] memory results)\\n {\\n return _multicall(nodehash, data);\\n }\\n\\n function multicall(bytes[] calldata data)\\n public\\n override\\n returns (bytes[] memory results)\\n {\\n return _multicall(bytes32(0), data);\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n public\\n view\\n virtual\\n override\\n returns (bool)\\n {\\n return\\n interfaceID == type(IMulticallable).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x0232b14c50b5c8bef0777fa8c130228a6a2c10b27f9be08760d40a44fd8823e9\",\"license\":\"MIT\"},\"contracts/resolvers/PublicResolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./profiles/ABIResolver.sol\\\";\\nimport \\\"./profiles/AddrResolver.sol\\\";\\nimport \\\"./profiles/ContentHashResolver.sol\\\";\\nimport \\\"./profiles/DNSResolver.sol\\\";\\nimport \\\"./profiles/InterfaceResolver.sol\\\";\\nimport \\\"./profiles/NameResolver.sol\\\";\\nimport \\\"./profiles/PubkeyResolver.sol\\\";\\nimport \\\"./profiles/TextResolver.sol\\\";\\nimport \\\"./Multicallable.sol\\\";\\n\\ninterface INameWrapper {\\n function ownerOf(uint256 id) external view returns (address);\\n}\\n\\n/**\\n * A simple resolver anyone can use; only allows the owner of a node to set its\\n * address.\\n */\\ncontract PublicResolver is\\n Multicallable,\\n ABIResolver,\\n AddrResolver,\\n ContentHashResolver,\\n DNSResolver,\\n InterfaceResolver,\\n NameResolver,\\n PubkeyResolver,\\n TextResolver\\n{\\n ENS immutable ens;\\n INameWrapper immutable nameWrapper;\\n address immutable trustedETHController;\\n address immutable trustedReverseRegistrar;\\n\\n /**\\n * A mapping of operators. An address that is authorised for an address\\n * may make any changes to the name that the owner could, but may not update\\n * the set of authorisations.\\n * (owner, operator) => approved\\n */\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n constructor(\\n ENS _ens,\\n INameWrapper wrapperAddress,\\n address _trustedETHController,\\n address _trustedReverseRegistrar\\n ) {\\n ens = _ens;\\n nameWrapper = wrapperAddress;\\n trustedETHController = _trustedETHController;\\n trustedReverseRegistrar = _trustedReverseRegistrar;\\n }\\n\\n /**\\n * @dev See {IERC1155-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) external {\\n require(\\n msg.sender != operator,\\n \\\"ERC1155: setting approval status for self\\\"\\n );\\n\\n _operatorApprovals[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC1155-isApprovedForAll}.\\n */\\n function isApprovedForAll(address account, address operator)\\n public\\n view\\n returns (bool)\\n {\\n return _operatorApprovals[account][operator];\\n }\\n\\n function isAuthorised(bytes32 node) internal view override returns (bool) {\\n if (\\n msg.sender == trustedETHController ||\\n msg.sender == trustedReverseRegistrar\\n ) {\\n return true;\\n }\\n address owner = ens.owner(node);\\n if (owner == address(nameWrapper)) {\\n owner = nameWrapper.ownerOf(uint256(node));\\n }\\n return owner == msg.sender || isApprovedForAll(owner, msg.sender);\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n public\\n view\\n override(\\n Multicallable,\\n ABIResolver,\\n AddrResolver,\\n ContentHashResolver,\\n DNSResolver,\\n InterfaceResolver,\\n NameResolver,\\n PubkeyResolver,\\n TextResolver\\n )\\n returns (bool)\\n {\\n return super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x95e776158dbaaaa58c3918787aa4e6bb22df44c6873b57129ab7e2ddcc2b6927\",\"license\":\"MIT\"},\"contracts/resolvers/ResolverBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"./profiles/IVersionableResolver.sol\\\";\\n\\nabstract contract ResolverBase is ERC165, IVersionableResolver {\\n mapping(bytes32 => uint64) public recordVersions;\\n\\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\\n\\n modifier authorised(bytes32 node) {\\n require(isAuthorised(node));\\n _;\\n }\\n\\n /**\\n * Increments the record version associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function clearRecords(bytes32 node) public virtual authorised(node) {\\n recordVersions[node]++;\\n emit VersionChanged(node, recordVersions[node]);\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n public\\n view\\n virtual\\n override\\n returns (bool)\\n {\\n return\\n interfaceID == type(IVersionableResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x99887f8890c62800bfe702dd67e36453a7017f05a368017c1187366bd98bc0a6\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"./IABIResolver.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\n\\nabstract contract ABIResolver is IABIResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\\n\\n /**\\n * Sets the ABI associated with an ENS node.\\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\\n * the empty string.\\n * @param node The node to update.\\n * @param contentType The content type of the ABI\\n * @param data The ABI data.\\n */\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external virtual authorised(node) {\\n // Content types must be powers of 2\\n require(((contentType - 1) & contentType) == 0);\\n\\n versionable_abis[recordVersions[node]][node][contentType] = data;\\n emit ABIChanged(node, contentType);\\n }\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(bytes32 node, uint256 contentTypes)\\n external\\n view\\n virtual\\n override\\n returns (uint256, bytes memory)\\n {\\n mapping(uint256 => bytes) storage abiset = versionable_abis[\\n recordVersions[node]\\n ][node];\\n\\n for (\\n uint256 contentType = 1;\\n contentType <= contentTypes;\\n contentType <<= 1\\n ) {\\n if (\\n (contentType & contentTypes) != 0 &&\\n abiset[contentType].length > 0\\n ) {\\n return (contentType, abiset[contentType]);\\n }\\n }\\n\\n return (0, bytes(\\\"\\\"));\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n public\\n view\\n virtual\\n override\\n returns (bool)\\n {\\n return\\n interfaceID == type(IABIResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x8f6fc2c3aeb2eee665ae4b2db8efe137869509a2fba4ec3dfd381257e64c82c4\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/AddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IAddrResolver.sol\\\";\\nimport \\\"./IAddressResolver.sol\\\";\\n\\nabstract contract AddrResolver is\\n IAddrResolver,\\n IAddressResolver,\\n ResolverBase\\n{\\n uint256 private constant COIN_TYPE_ETH = 60;\\n\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\\n\\n /**\\n * Sets the address associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param a The address to set.\\n */\\n function setAddr(bytes32 node, address a)\\n external\\n virtual\\n authorised(node)\\n {\\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\\n }\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node)\\n public\\n view\\n virtual\\n override\\n returns (address payable)\\n {\\n bytes memory a = addr(node, COIN_TYPE_ETH);\\n if (a.length == 0) {\\n return payable(0);\\n }\\n return bytesToAddress(a);\\n }\\n\\n function setAddr(\\n bytes32 node,\\n uint256 coinType,\\n bytes memory a\\n ) public virtual authorised(node) {\\n emit AddressChanged(node, coinType, a);\\n if (coinType == COIN_TYPE_ETH) {\\n emit AddrChanged(node, bytesToAddress(a));\\n }\\n versionable_addresses[recordVersions[node]][node][coinType] = a;\\n }\\n\\n function addr(bytes32 node, uint256 coinType)\\n public\\n view\\n virtual\\n override\\n returns (bytes memory)\\n {\\n return versionable_addresses[recordVersions[node]][node][coinType];\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n public\\n view\\n virtual\\n override\\n returns (bool)\\n {\\n return\\n interfaceID == type(IAddrResolver).interfaceId ||\\n interfaceID == type(IAddressResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function bytesToAddress(bytes memory b)\\n internal\\n pure\\n returns (address payable a)\\n {\\n require(b.length == 20);\\n assembly {\\n a := div(mload(add(b, 32)), exp(256, 12))\\n }\\n }\\n\\n function addressToBytes(address a) internal pure returns (bytes memory b) {\\n b = new bytes(20);\\n assembly {\\n mstore(add(b, 32), mul(a, exp(256, 12)))\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd646c5d83209db92099b84effe8ab19bb9fccb95c25b2984e2d217c70eeccbf3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IContentHashResolver.sol\\\";\\n\\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\\n\\n /**\\n * Sets the contenthash associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param hash The contenthash to set\\n */\\n function setContenthash(bytes32 node, bytes calldata hash)\\n external\\n virtual\\n authorised(node)\\n {\\n versionable_hashes[recordVersions[node]][node] = hash;\\n emit ContenthashChanged(node, hash);\\n }\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node)\\n external\\n view\\n virtual\\n override\\n returns (bytes memory)\\n {\\n return versionable_hashes[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n public\\n view\\n virtual\\n override\\n returns (bool)\\n {\\n return\\n interfaceID == type(IContentHashResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x51997248aa9b178ce3fcc708ede901f02f1613091743bc91adeb0b3c42600f14\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/DNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"../../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"./IDNSRecordResolver.sol\\\";\\nimport \\\"./IDNSZoneResolver.sol\\\";\\n\\nabstract contract DNSResolver is\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n ResolverBase\\n{\\n using RRUtils for *;\\n using BytesUtils for bytes;\\n\\n // Zone hashes for the domains.\\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\\n // resource containing a single zonefile.\\n // node => contenthash\\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\\n\\n // The records themselves. Stored as binary RRSETs\\n // node => version => name => resource => data\\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\\n private versionable_records;\\n\\n // Count of number of entries for a given name. Required for DNS resolvers\\n // when resolving wildcards.\\n // node => version => name => number of records\\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\\n private versionable_nameEntriesCount;\\n\\n /**\\n * Set one or more DNS records. Records are supplied in wire-format.\\n * Records with the same node/name/resource must be supplied one after the\\n * other to ensure the data is updated correctly. For example, if the data\\n * was supplied:\\n * a.example.com IN A 1.2.3.4\\n * a.example.com IN A 5.6.7.8\\n * www.example.com IN CNAME a.example.com.\\n * then this would store the two A records for a.example.com correctly as a\\n * single RRSET, however if the data was supplied:\\n * a.example.com IN A 1.2.3.4\\n * www.example.com IN CNAME a.example.com.\\n * a.example.com IN A 5.6.7.8\\n * then this would store the first A record, the CNAME, then the second A\\n * record which would overwrite the first.\\n *\\n * @param node the namehash of the node for which to set the records\\n * @param data the DNS wire format records to set\\n */\\n function setDNSRecords(bytes32 node, bytes calldata data)\\n external\\n virtual\\n authorised(node)\\n {\\n uint16 resource = 0;\\n uint256 offset = 0;\\n bytes memory name;\\n bytes memory value;\\n bytes32 nameHash;\\n uint64 version = recordVersions[node];\\n // Iterate over the data to add the resource records\\n for (\\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\\n !iter.done();\\n iter.next()\\n ) {\\n if (resource == 0) {\\n resource = iter.dnstype;\\n name = iter.name();\\n nameHash = keccak256(abi.encodePacked(name));\\n value = bytes(iter.rdata());\\n } else {\\n bytes memory newName = iter.name();\\n if (resource != iter.dnstype || !name.equals(newName)) {\\n setDNSRRSet(\\n node,\\n name,\\n resource,\\n data,\\n offset,\\n iter.offset - offset,\\n value.length == 0,\\n version\\n );\\n resource = iter.dnstype;\\n offset = iter.offset;\\n name = newName;\\n nameHash = keccak256(name);\\n value = bytes(iter.rdata());\\n }\\n }\\n }\\n if (name.length > 0) {\\n setDNSRRSet(\\n node,\\n name,\\n resource,\\n data,\\n offset,\\n data.length - offset,\\n value.length == 0,\\n version\\n );\\n }\\n }\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) public view virtual override returns (bytes memory) {\\n return versionable_records[recordVersions[node]][node][name][resource];\\n }\\n\\n /**\\n * Check if a given node has records.\\n * @param node the namehash of the node for which to check the records\\n * @param name the namehash of the node for which to check the records\\n */\\n function hasDNSRecords(bytes32 node, bytes32 name)\\n public\\n view\\n virtual\\n returns (bool)\\n {\\n return (versionable_nameEntriesCount[recordVersions[node]][node][\\n name\\n ] != 0);\\n }\\n\\n /**\\n * setZonehash sets the hash for the zone.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param hash The zonehash to set\\n */\\n function setZonehash(bytes32 node, bytes calldata hash)\\n external\\n virtual\\n authorised(node)\\n {\\n uint64 currentRecordVersion = recordVersions[node];\\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\\n node\\n ];\\n versionable_zonehashes[currentRecordVersion][node] = hash;\\n emit DNSZonehashChanged(node, oldhash, hash);\\n }\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node)\\n external\\n view\\n virtual\\n override\\n returns (bytes memory)\\n {\\n return versionable_zonehashes[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n public\\n view\\n virtual\\n override\\n returns (bool)\\n {\\n return\\n interfaceID == type(IDNSRecordResolver).interfaceId ||\\n interfaceID == type(IDNSZoneResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function setDNSRRSet(\\n bytes32 node,\\n bytes memory name,\\n uint16 resource,\\n bytes memory data,\\n uint256 offset,\\n uint256 size,\\n bool deleteRecord,\\n uint64 version\\n ) private {\\n bytes32 nameHash = keccak256(name);\\n bytes memory rrData = data.substring(offset, size);\\n if (deleteRecord) {\\n if (\\n versionable_records[version][node][nameHash][resource].length !=\\n 0\\n ) {\\n versionable_nameEntriesCount[version][node][nameHash]--;\\n }\\n delete (versionable_records[version][node][nameHash][resource]);\\n emit DNSRecordDeleted(node, name, resource);\\n } else {\\n if (\\n versionable_records[version][node][nameHash][resource].length ==\\n 0\\n ) {\\n versionable_nameEntriesCount[version][node][nameHash]++;\\n }\\n versionable_records[version][node][nameHash][resource] = rrData;\\n emit DNSRecordChanged(node, name, resource, rrData);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x018591569fae9070357135a943958592f9e3bde5092e81ed234e47db9ee54d16\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"./IABIResolver.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(bytes32 node, uint256 contentTypes)\\n external\\n view\\n returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0xc6db25d9b07ea925c64bb777f00ba557e99fbccd4c30c20e5a1b5cd8c159dcbf\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(bytes32 node, uint256 coinType)\\n external\\n view\\n returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x37221203e063dee5aa2a067a6ab3401e9cca41cce5b15230994b6ea377f05ed5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(bytes32 node, bytes4 interfaceID)\\n external\\n view\\n returns (address);\\n}\\n\",\"keccak256\":\"0x6d75d6010016684030e13711b3bc1a4e1a784c7398937f1b7c2b2f328f962c2b\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(bytes32 node, string calldata key)\\n external\\n view\\n returns (string memory);\\n}\\n\",\"keccak256\":\"0xcc5eada60de63f42f47a4bbc8a5d2bed4cd1394646197a08da7957c6fd90ba5d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IVersionableResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IVersionableResolver {\\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\\n\\n function recordVersions(bytes32 node) external view returns (uint64);\\n}\\n\",\"keccak256\":\"0xd0d09596f20c57bafb2ffa8521a8c57120e9af6c6b194f9c689d4da56f91a57c\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/InterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./AddrResolver.sol\\\";\\nimport \\\"./IInterfaceResolver.sol\\\";\\n\\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\\n\\n /**\\n * Sets an interface associated with a name.\\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\\n * @param node The node to update.\\n * @param interfaceID The EIP 165 interface ID.\\n * @param implementer The address of a contract that implements this interface for this node.\\n */\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external virtual authorised(node) {\\n versionable_interfaces[recordVersions[node]][node][interfaceID] = implementer;\\n emit InterfaceChanged(node, interfaceID, implementer);\\n }\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(bytes32 node, bytes4 interfaceID)\\n external\\n view\\n virtual\\n override\\n returns (address)\\n {\\n address implementer = versionable_interfaces[recordVersions[node]][node][interfaceID];\\n if (implementer != address(0)) {\\n return implementer;\\n }\\n\\n address a = addr(node);\\n if (a == address(0)) {\\n return address(0);\\n }\\n\\n (bool success, bytes memory returnData) = a.staticcall(\\n abi.encodeWithSignature(\\n \\\"supportsInterface(bytes4)\\\",\\n type(IERC165).interfaceId\\n )\\n );\\n if (!success || returnData.length < 32 || returnData[31] == 0) {\\n // EIP 165 not supported by target\\n return address(0);\\n }\\n\\n (success, returnData) = a.staticcall(\\n abi.encodeWithSignature(\\\"supportsInterface(bytes4)\\\", interfaceID)\\n );\\n if (!success || returnData.length < 32 || returnData[31] == 0) {\\n // Specified interface not supported by target\\n return address(0);\\n }\\n\\n return a;\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n public\\n view\\n virtual\\n override\\n returns (bool)\\n {\\n return\\n interfaceID == type(IInterfaceResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x3daeadb9196264d907ef62b4d615fb1aae8ec3552293ae0004c3e39b5533e70f\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/NameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./INameResolver.sol\\\";\\n\\nabstract contract NameResolver is INameResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\\n\\n /**\\n * Sets the name associated with an ENS node, for reverse records.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function setName(bytes32 node, string calldata newName)\\n external\\n virtual\\n authorised(node)\\n {\\n versionable_names[recordVersions[node]][node] = newName;\\n emit NameChanged(node, newName);\\n }\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node)\\n external\\n view\\n virtual\\n override\\n returns (string memory)\\n {\\n return versionable_names[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n public\\n view\\n virtual\\n override\\n returns (bool)\\n {\\n return\\n interfaceID == type(INameResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xaa9acf9a857d791d8e3ecb3b962addc7c6a54a9bf4cdd429bb77f075d384486f\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/PubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IPubkeyResolver.sol\\\";\\n\\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\\n struct PublicKey {\\n bytes32 x;\\n bytes32 y;\\n }\\n\\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\\n\\n /**\\n * Sets the SECP256k1 public key associated with an ENS node.\\n * @param node The ENS node to query\\n * @param x the X coordinate of the curve point for the public key.\\n * @param y the Y coordinate of the curve point for the public key.\\n */\\n function setPubkey(\\n bytes32 node,\\n bytes32 x,\\n bytes32 y\\n ) external virtual authorised(node) {\\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\\n emit PubkeyChanged(node, x, y);\\n }\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node)\\n external\\n view\\n virtual\\n override\\n returns (bytes32 x, bytes32 y)\\n {\\n uint64 currentRecordVersion = recordVersions[node];\\n return (\\n versionable_pubkeys[currentRecordVersion][node].x,\\n versionable_pubkeys[currentRecordVersion][node].y\\n );\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n public\\n view\\n virtual\\n override\\n returns (bool)\\n {\\n return\\n interfaceID == type(IPubkeyResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x3b7b2e3b59874bacd585928af1b15978f900df4c87fd265510db184623e35546\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/TextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./ITextResolver.sol\\\";\\n\\nabstract contract TextResolver is ITextResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\\n\\n /**\\n * Sets the text data associated with an ENS node and key.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param key The key to set.\\n * @param value The text data value to set.\\n */\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external virtual authorised(node) {\\n versionable_texts[recordVersions[node]][node][key] = value;\\n emit TextChanged(node, key, key, value);\\n }\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(bytes32 node, string calldata key)\\n external\\n view\\n virtual\\n override\\n returns (string memory)\\n {\\n return versionable_texts[recordVersions[node]][node][key];\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n public\\n view\\n virtual\\n override\\n returns (bool)\\n {\\n return\\n interfaceID == type(ITextResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x3a52fa55967f964206fdefe61461f505bcdfa23264ef28da648c34a9c98081c1\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101006040523480156200001257600080fd5b506040516200335d3803806200335d833981016040819052620000359162000071565b6001600160a01b0393841660805291831660a052821660c0521660e052620000d9565b6001600160a01b03811681146200006e57600080fd5b50565b600080600080608085870312156200008857600080fd5b8451620000958162000058565b6020860151909450620000a88162000058565b6040860151909350620000bb8162000058565b6060860151909250620000ce8162000058565b939692955090935050565b60805160a05160c05160e0516132436200011a600039600061181c015260006117dd01526000818161190101526119810152600061187d01526132436000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c806377372213116100f9578063ce3decdc11610097578063e32954eb11610071578063e32954eb146104a4578063e59d895d146104b7578063e985e9c5146104ca578063f1cb7e061461051357600080fd5b8063ce3decdc1461043b578063d5fa2b001461044e578063d700ff331461046157600080fd5b8063a8fa5682116100d3578063a8fa56821461039c578063ac9650d8146103af578063bc1c58d1146103cf578063c8690233146103e257600080fd5b806377372213146103635780638b95dd7114610376578063a22cb4651461038957600080fd5b80633603d7581161016657806359d1d43c1161014057806359d1d43c1461030a5780635c98042b1461032a578063623195b01461033d578063691f34311461035057600080fd5b80633603d758146102985780633b3b57de146102ab5780634cbf6ba4146102be57600080fd5b8063124a319c116101a2578063124a319c146102195780632203ab561461025157806329cd62ea14610272578063304e6ade1461028557600080fd5b806301ffc9a7146101c95780630af179d7146101f157806310f13a8c14610206575b600080fd5b6101dc6101d73660046126f1565b610526565b60405190151581526020015b60405180910390f35b6102046101ff36600461274e565b610537565b005b61020461021436600461279a565b610741565b61022c610227366004612814565b61080e565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101e8565b61026461025f366004612840565b610b69565b6040516101e89291906128b2565b6102046102803660046128cb565b610ca0565b61020461029336600461274e565b610d3b565b6102046102a63660046128f7565b610db7565b61022c6102b93660046128f7565b610e5a565b6101dc6102cc366004612840565b6000828152602081815260408083205467ffffffffffffffff1683526006825280832094835293815283822092825291909152205461ffff16151590565b61031d61031836600461274e565b610e8c565b6040516101e89190612910565b61031d6103383660046128f7565b610f6c565b61020461034b366004612923565b61102b565b61031d61035e3660046128f7565b6110c8565b61020461037136600461274e565b611102565b6102046103843660046129a5565b61117e565b610204610397366004612a8b565b61126b565b61031d6103aa366004612ac9565b6113ac565b6103c26103bd366004612b4e565b6113fa565b6040516101e89190612b90565b61031d6103dd3660046128f7565b611408565b6104266103f03660046128f7565b6000818152602081815260408083205467ffffffffffffffff168352600982528083209383529290522080546001909101549091565b604080519283526020830191909152016101e8565b61020461044936600461274e565b611442565b61020461045c366004612c10565b611585565b61048b61046f3660046128f7565b60006020819052908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016101e8565b6103c26104b2366004612c35565b6115ac565b6102046104c5366004612c74565b6115c1565b6101dc6104d8366004612ca9565b73ffffffffffffffffffffffffffffffffffffffff9182166000908152600b6020908152604080832093909416825291909152205460ff1690565b61031d610521366004612840565b6116a5565b60006105318261176d565b92915050565b82610541816117c3565b61054a57600080fd5b600084815260208181526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff9091169183916105b09183918d908d90819084018382808284376000920191909152509293925050611a5c9050565b90505b805151602082015110156106da578661ffff1660000361061857806040015196506105dd81611abd565b9450846040516020016105f09190612cd7565b60405160208183030381529060405280519060200120925061061181611ade565b93506106cc565b600061062382611abd565b9050816040015161ffff168861ffff1614158061064757506106458682611afa565b155b156106ca576106a38c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d915061069a908290612d22565b8b51158a611b18565b8160400151975081602001519650809550858051906020012093506106c782611ade565b94505b505b6106d581611d85565b6105b3565b50835115610735576107358a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c925061072c91508290508f612d22565b89511588611b18565b50505050505050505050565b8461074b816117c3565b61075457600080fd5b6000868152602081815260408083205467ffffffffffffffff168352600a8252808320898452909152908190209051849184916107949089908990612d35565b908152602001604051809103902091826107af929190612de6565b5084846040516107c0929190612d35565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516107fe9493929190612ed1565b60405180910390a3505050505050565b6000828152602081815260408083205467ffffffffffffffff1683526007825280832085845282528083207fffffffff000000000000000000000000000000000000000000000000000000008516845290915281205473ffffffffffffffffffffffffffffffffffffffff168015610887579050610531565b600061089285610e5a565b905073ffffffffffffffffffffffffffffffffffffffff81166108ba57600092505050610531565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000006024820152600090819073ffffffffffffffffffffffffffffffffffffffff84169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a700000000000000000000000000000000000000000000000000000000179052516109669190612cd7565b600060405180830381855afa9150503d80600081146109a1576040519150601f19603f3d011682016040523d82523d6000602084013e6109a6565b606091505b50915091508115806109b9575060208151105b806109fb575080601f815181106109d2576109d2612f03565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610a0d576000945050505050610531565b6040517fffffffff000000000000000000000000000000000000000000000000000000008716602482015273ffffffffffffffffffffffffffffffffffffffff84169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a70000000000000000000000000000000000000000000000000000000017905251610ab69190612cd7565b600060405180830381855afa9150503d8060008114610af1576040519150601f19603f3d011682016040523d82523d6000602084013e610af6565b606091505b509092509050811580610b0a575060208151105b80610b4c575080601f81518110610b2357610b23612f03565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610b5e576000945050505050610531565b509095945050505050565b6000828152602081815260408083205467ffffffffffffffff168352600180835281842086855290925282206060915b848111610c805780851615801590610bc9575060008181526020839052604081208054610bc590612d45565b9050115b15610c785780826000838152602001908152602001600020808054610bed90612d45565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1990612d45565b8015610c665780601f10610c3b57610100808354040283529160200191610c66565b820191906000526020600020905b815481529060010190602001808311610c4957829003601f168201915b50505050509050935093505050610c99565b60011b610b99565b5060006040518060200160405280600081525092509250505b9250929050565b82610caa816117c3565b610cb357600080fd5b604080518082018252848152602080820185815260008881528083528481205467ffffffffffffffff1681526009835284812089825283528490209251835551600190920191909155815185815290810184905285917f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4691015b60405180910390a250505050565b82610d45816117c3565b610d4e57600080fd5b6000848152602081815260408083205467ffffffffffffffff168352600382528083208784529091529020610d84838583612de6565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610d2d929190612f32565b80610dc1816117c3565b610dca57600080fd5b6000828152602081905260408120805467ffffffffffffffff1691610dee83612f46565b82546101009290920a67ffffffffffffffff818102199093169183160217909155600084815260208181526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610e6883603c6116a5565b90508051600003610e7c5750600092915050565b610e8581611e6d565b9392505050565b6000838152602081815260408083205467ffffffffffffffff168352600a825280832086845290915290819020905160609190610ecc9085908590612d35565b90815260200160405180910390208054610ee590612d45565b80601f0160208091040260200160405190810160405280929190818152602001828054610f1190612d45565b8015610f5e5780601f10610f3357610100808354040283529160200191610f5e565b820191906000526020600020905b815481529060010190602001808311610f4157829003601f168201915b505050505090509392505050565b6000818152602081815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610fa690612d45565b80601f0160208091040260200160405190810160405280929190818152602001828054610fd290612d45565b801561101f5780601f10610ff45761010080835404028352916020019161101f565b820191906000526020600020905b81548152906001019060200180831161100257829003601f168201915b50505050509050919050565b83611035816117c3565b61103e57600080fd5b8361104a600182612d22565b161561105557600080fd5b6000858152602081815260408083205467ffffffffffffffff1683526001825280832088845282528083208784529091529020611093838583612de6565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b6000818152602081815260408083205467ffffffffffffffff168352600882528083208484529091529020805460609190610fa690612d45565b8261110c816117c3565b61111557600080fd5b6000848152602081815260408083205467ffffffffffffffff16835260088252808320878452909152902061114b838583612de6565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610d2d929190612f32565b82611188816117c3565b61119157600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af75284846040516111c39291906128b2565b60405180910390a2603c830361122757837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd26111fe84611e6d565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a25b6000848152602081815260408083205467ffffffffffffffff16835260028252808320878452825280832086845290915290206112648382612f6d565b5050505050565b73ffffffffffffffffffffffffffffffffffffffff82163303611315576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000838152602081815260408083205467ffffffffffffffff168352600582528083208684528252808320858452825280832061ffff851684529091529020805460609190610ee590612d45565b6060610e8560008484611e95565b6000818152602081815260408083205467ffffffffffffffff168352600382528083208484529091529020805460609190610fa690612d45565b8261144c816117c3565b61145557600080fd5b6000848152602081815260408083205467ffffffffffffffff16808452600483528184208885529092528220805491929161148f90612d45565b80601f01602080910402602001604051908101604052809291908181526020018280546114bb90612d45565b80156115085780601f106114dd57610100808354040283529160200191611508565b820191906000526020600020905b8154815290600101906020018083116114eb57829003601f168201915b5050505067ffffffffffffffff841660009081526004602090815260408083208b845290915290209192506115409050858783612de6565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f858287876040516115759392919061302d565b60405180910390a2505050505050565b8161158f816117c3565b61159857600080fd5b6115a783603c61038485612088565b505050565b60606115b9848484611e95565b949350505050565b826115cb816117c3565b6115d457600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526007825280832087845282528083207fffffffff0000000000000000000000000000000000000000000000000000000087168085529083529281902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b6000828152602081815260408083205467ffffffffffffffff16835260028252808320858452825280832084845290915290208054606091906116e790612d45565b80601f016020809104026020016040519081016040528092919081815260200182805461171390612d45565b80156117605780601f1061173557610100808354040283529160200191611760565b820191906000526020600020905b81548152906001019060200180831161174357829003601f168201915b5050505050905092915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f59d1d43c0000000000000000000000000000000000000000000000000000000014806105315750610531826120c1565b60003373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016148061183e57503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016145b1561184b57506001919050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018390526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906302571be390602401602060405180830381865afa1580156118d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118fd919061305d565b90507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611a04576040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018490527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690636352211e90602401602060405180830381865afa1580156119dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a01919061305d565b90505b73ffffffffffffffffffffffffffffffffffffffff8116331480610e85575073ffffffffffffffffffffffffffffffffffffffff81166000908152600b6020908152604080832033845290915290205460ff16610e85565b611aaa6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261053181611d85565b6020810151815160609161053191611ad59082612117565b84519190612171565b60a081015160c082015160609161053191611ad5908290612d22565b600081518351148015610e855750610e8583600084600087516121e8565b865160208801206000611b2c878787612171565b90508315611c565767ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611b7790612d45565b159050611bd65767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611bba8361307a565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091528120611c1791612666565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a604051611c49929190613098565b60405180910390a2610735565b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611c9990612d45565b9050600003611cfa5767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611cde836130be565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091529020611d3c8282612f6d565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a84604051611d71939291906130d5565b60405180910390a250505050505050505050565b60c08101516020820181905281515111611d9c5750565b6000611db082600001518360200151612117565b8260200151611dbf9190613104565b8251909150611dce908261220b565b61ffff166040830152611de2600282613104565b8251909150611df1908261220b565b61ffff166060830152611e05600282613104565b8251909150611e149082612233565b63ffffffff166080830152611e2a600482613104565b8251909150600090611e3c908361220b565b61ffff169050611e4d600283613104565b60a084018190529150611e608183613104565b60c0909301929092525050565b60008151601414611e7d57600080fd5b50602001516c01000000000000000000000000900490565b60608167ffffffffffffffff811115611eb057611eb0612976565b604051908082528060200260200182016040528015611ee357816020015b6060815260200190600190039081611ece5790505b50905060005b82811015612080578415611fc8576000848483818110611f0b57611f0b612f03565b9050602002810190611f1d9190613117565b611f2c9160249160049161317c565b611f35916131a6565b9050858114611fc6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603460248201527f6d756c746963616c6c3a20416c6c207265636f726473206d757374206861766560448201527f2061206d61746368696e67206e616d6568617368000000000000000000000000606482015260840161130c565b505b60008030868685818110611fde57611fde612f03565b9050602002810190611ff09190613117565b604051611ffe929190612d35565b600060405180830381855af49150503d8060008114612039576040519150601f19603f3d011682016040523d82523d6000602084013e61203e565b606091505b50915091508161204d57600080fd5b8084848151811061206057612060612f03565b602002602001018190525050508080612078906131c4565b915050611ee9565b509392505050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fc869023300000000000000000000000000000000000000000000000000000000148061053157506105318261225d565b6000815b8351811061212b5761212b6131de565b600061213785836122b3565b60ff169050612147816001613104565b6121519083613104565b9150806000036121615750612167565b5061211b565b6115b98382612d22565b82516060906121808385613104565b111561218b57600080fd5b60008267ffffffffffffffff8111156121a6576121a6612976565b6040519080825280601f01601f1916602001820160405280156121d0576020820181803683370190505b50905060208082019086860101610b5e8282876122d7565b60006121f584848461232d565b61220087878561232d565b149695505050505050565b815160009061221b836002613104565b111561222657600080fd5b50016002015161ffff1690565b8151600090612243836004613104565b111561224e57600080fd5b50016004015163ffffffff1690565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f691f3431000000000000000000000000000000000000000000000000000000001480610531575061053182612351565b60008282815181106122c7576122c7612f03565b016020015160f81c905092915050565b6020811061230f57815183526122ee602084613104565b92506122fb602083613104565b9150612308602082612d22565b90506122d7565b905182516020929092036101000a6000190180199091169116179052565b825160009061233c8385613104565b111561234757600080fd5b5091016020012090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f124a319c00000000000000000000000000000000000000000000000000000000148061053157506105318260007fffffffff0000000000000000000000000000000000000000000000000000000082167fa8fa568200000000000000000000000000000000000000000000000000000000148061243557507fffffffff0000000000000000000000000000000000000000000000000000000082167f5c98042b00000000000000000000000000000000000000000000000000000000145b8061053157506105318260007fffffffff0000000000000000000000000000000000000000000000000000000082167fbc1c58d100000000000000000000000000000000000000000000000000000000148061053157506105318260007fffffffff0000000000000000000000000000000000000000000000000000000082167f3b3b57de00000000000000000000000000000000000000000000000000000000148061252357507fffffffff0000000000000000000000000000000000000000000000000000000082167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061053157506105318260007fffffffff0000000000000000000000000000000000000000000000000000000082167f2203ab5600000000000000000000000000000000000000000000000000000000148061053157506105318260007fffffffff0000000000000000000000000000000000000000000000000000000082167fd700ff3300000000000000000000000000000000000000000000000000000000148061053157506105318260007fffffffff0000000000000000000000000000000000000000000000000000000082167f4fbf043300000000000000000000000000000000000000000000000000000000148061053157507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610531565b50805461267290612d45565b6000825580601f10612682575050565b601f0160209004906000526020600020908101906126a091906126a3565b50565b5b808211156126b857600081556001016126a4565b5090565b80357fffffffff00000000000000000000000000000000000000000000000000000000811681146126ec57600080fd5b919050565b60006020828403121561270357600080fd5b610e85826126bc565b60008083601f84011261271e57600080fd5b50813567ffffffffffffffff81111561273657600080fd5b602083019150836020828501011115610c9957600080fd5b60008060006040848603121561276357600080fd5b83359250602084013567ffffffffffffffff81111561278157600080fd5b61278d8682870161270c565b9497909650939450505050565b6000806000806000606086880312156127b257600080fd5b85359450602086013567ffffffffffffffff808211156127d157600080fd5b6127dd89838a0161270c565b909650945060408801359150808211156127f657600080fd5b506128038882890161270c565b969995985093965092949392505050565b6000806040838503121561282757600080fd5b82359150612837602084016126bc565b90509250929050565b6000806040838503121561285357600080fd5b50508035926020909101359150565b60005b8381101561287d578181015183820152602001612865565b50506000910152565b6000815180845261289e816020860160208601612862565b601f01601f19169290920160200192915050565b8281526040602082015260006115b96040830184612886565b6000806000606084860312156128e057600080fd5b505081359360208301359350604090920135919050565b60006020828403121561290957600080fd5b5035919050565b602081526000610e856020830184612886565b6000806000806060858703121561293957600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561295e57600080fd5b61296a8782880161270c565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156129ba57600080fd5b8335925060208401359150604084013567ffffffffffffffff808211156129e057600080fd5b818601915086601f8301126129f457600080fd5b813581811115612a0657612a06612976565b604051601f8201601f19908116603f01168101908382118183101715612a2e57612a2e612976565b81604052828152896020848701011115612a4757600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b73ffffffffffffffffffffffffffffffffffffffff811681146126a057600080fd5b60008060408385031215612a9e57600080fd5b8235612aa981612a69565b915060208301358015158114612abe57600080fd5b809150509250929050565b600080600060608486031215612ade57600080fd5b8335925060208401359150604084013561ffff81168114612afe57600080fd5b809150509250925092565b60008083601f840112612b1b57600080fd5b50813567ffffffffffffffff811115612b3357600080fd5b6020830191508360208260051b8501011115610c9957600080fd5b60008060208385031215612b6157600080fd5b823567ffffffffffffffff811115612b7857600080fd5b612b8485828601612b09565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612c03577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452612bf1858351612886565b94509285019290850190600101612bb7565b5092979650505050505050565b60008060408385031215612c2357600080fd5b823591506020830135612abe81612a69565b600080600060408486031215612c4a57600080fd5b83359250602084013567ffffffffffffffff811115612c6857600080fd5b61278d86828701612b09565b600080600060608486031215612c8957600080fd5b83359250612c99602085016126bc565b91506040840135612afe81612a69565b60008060408385031215612cbc57600080fd5b8235612cc781612a69565b91506020830135612abe81612a69565b60008251612ce9818460208701612862565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561053157610531612cf3565b8183823760009101908152919050565b600181811c90821680612d5957607f821691505b602082108103612d92577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b601f8211156115a757600081815260208120601f850160051c81016020861015612dbf5750805b601f850160051c820191505b81811015612dde57828155600101612dcb565b505050505050565b67ffffffffffffffff831115612dfe57612dfe612976565b612e1283612e0c8354612d45565b83612d98565b6000601f841160018114612e465760008515612e2e5750838201355b600019600387901b1c1916600186901b178355611264565b600083815260209020601f19861690835b82811015612e775786850135825560209485019460019092019101612e57565b5086821015612e945760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b604081526000612ee5604083018688612ea6565b8281036020840152612ef8818587612ea6565b979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020815260006115b9602083018486612ea6565b600067ffffffffffffffff808316818103612f6357612f63612cf3565b6001019392505050565b815167ffffffffffffffff811115612f8757612f87612976565b612f9b81612f958454612d45565b84612d98565b602080601f831160018114612fd05760008415612fb85750858301515b600019600386901b1c1916600185901b178555612dde565b600085815260208120601f198616915b82811015612fff57888601518255948401946001909101908401612fe0565b508582101561301d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6040815260006130406040830186612886565b8281036020840152613053818587612ea6565b9695505050505050565b60006020828403121561306f57600080fd5b8151610e8581612a69565b600061ffff82168061308e5761308e612cf3565b6000190192915050565b6040815260006130ab6040830185612886565b905061ffff831660208301529392505050565b600061ffff808316818103612f6357612f63612cf3565b6060815260006130e86060830186612886565b61ffff8516602084015282810360408401526130538185612886565b8082018082111561053157610531612cf3565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261314c57600080fd5b83018035915067ffffffffffffffff82111561316757600080fd5b602001915036819003821315610c9957600080fd5b6000808585111561318c57600080fd5b8386111561319957600080fd5b5050820193919092039150565b8035602083101561053157600019602084900360031b1b1692915050565b600060001982036131d7576131d7612cf3565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fdfea26469706673582212202673f63d364d138759b82a66e0266a4d87a91b389a1d1a45dcec5e0fbce1a7f764736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101c45760003560e01c806377372213116100f9578063ce3decdc11610097578063e32954eb11610071578063e32954eb146104a4578063e59d895d146104b7578063e985e9c5146104ca578063f1cb7e061461051357600080fd5b8063ce3decdc1461043b578063d5fa2b001461044e578063d700ff331461046157600080fd5b8063a8fa5682116100d3578063a8fa56821461039c578063ac9650d8146103af578063bc1c58d1146103cf578063c8690233146103e257600080fd5b806377372213146103635780638b95dd7114610376578063a22cb4651461038957600080fd5b80633603d7581161016657806359d1d43c1161014057806359d1d43c1461030a5780635c98042b1461032a578063623195b01461033d578063691f34311461035057600080fd5b80633603d758146102985780633b3b57de146102ab5780634cbf6ba4146102be57600080fd5b8063124a319c116101a2578063124a319c146102195780632203ab561461025157806329cd62ea14610272578063304e6ade1461028557600080fd5b806301ffc9a7146101c95780630af179d7146101f157806310f13a8c14610206575b600080fd5b6101dc6101d73660046126f1565b610526565b60405190151581526020015b60405180910390f35b6102046101ff36600461274e565b610537565b005b61020461021436600461279a565b610741565b61022c610227366004612814565b61080e565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101e8565b61026461025f366004612840565b610b69565b6040516101e89291906128b2565b6102046102803660046128cb565b610ca0565b61020461029336600461274e565b610d3b565b6102046102a63660046128f7565b610db7565b61022c6102b93660046128f7565b610e5a565b6101dc6102cc366004612840565b6000828152602081815260408083205467ffffffffffffffff1683526006825280832094835293815283822092825291909152205461ffff16151590565b61031d61031836600461274e565b610e8c565b6040516101e89190612910565b61031d6103383660046128f7565b610f6c565b61020461034b366004612923565b61102b565b61031d61035e3660046128f7565b6110c8565b61020461037136600461274e565b611102565b6102046103843660046129a5565b61117e565b610204610397366004612a8b565b61126b565b61031d6103aa366004612ac9565b6113ac565b6103c26103bd366004612b4e565b6113fa565b6040516101e89190612b90565b61031d6103dd3660046128f7565b611408565b6104266103f03660046128f7565b6000818152602081815260408083205467ffffffffffffffff168352600982528083209383529290522080546001909101549091565b604080519283526020830191909152016101e8565b61020461044936600461274e565b611442565b61020461045c366004612c10565b611585565b61048b61046f3660046128f7565b60006020819052908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016101e8565b6103c26104b2366004612c35565b6115ac565b6102046104c5366004612c74565b6115c1565b6101dc6104d8366004612ca9565b73ffffffffffffffffffffffffffffffffffffffff9182166000908152600b6020908152604080832093909416825291909152205460ff1690565b61031d610521366004612840565b6116a5565b60006105318261176d565b92915050565b82610541816117c3565b61054a57600080fd5b600084815260208181526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff9091169183916105b09183918d908d90819084018382808284376000920191909152509293925050611a5c9050565b90505b805151602082015110156106da578661ffff1660000361061857806040015196506105dd81611abd565b9450846040516020016105f09190612cd7565b60405160208183030381529060405280519060200120925061061181611ade565b93506106cc565b600061062382611abd565b9050816040015161ffff168861ffff1614158061064757506106458682611afa565b155b156106ca576106a38c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d915061069a908290612d22565b8b51158a611b18565b8160400151975081602001519650809550858051906020012093506106c782611ade565b94505b505b6106d581611d85565b6105b3565b50835115610735576107358a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c925061072c91508290508f612d22565b89511588611b18565b50505050505050505050565b8461074b816117c3565b61075457600080fd5b6000868152602081815260408083205467ffffffffffffffff168352600a8252808320898452909152908190209051849184916107949089908990612d35565b908152602001604051809103902091826107af929190612de6565b5084846040516107c0929190612d35565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516107fe9493929190612ed1565b60405180910390a3505050505050565b6000828152602081815260408083205467ffffffffffffffff1683526007825280832085845282528083207fffffffff000000000000000000000000000000000000000000000000000000008516845290915281205473ffffffffffffffffffffffffffffffffffffffff168015610887579050610531565b600061089285610e5a565b905073ffffffffffffffffffffffffffffffffffffffff81166108ba57600092505050610531565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000006024820152600090819073ffffffffffffffffffffffffffffffffffffffff84169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a700000000000000000000000000000000000000000000000000000000179052516109669190612cd7565b600060405180830381855afa9150503d80600081146109a1576040519150601f19603f3d011682016040523d82523d6000602084013e6109a6565b606091505b50915091508115806109b9575060208151105b806109fb575080601f815181106109d2576109d2612f03565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610a0d576000945050505050610531565b6040517fffffffff000000000000000000000000000000000000000000000000000000008716602482015273ffffffffffffffffffffffffffffffffffffffff84169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a70000000000000000000000000000000000000000000000000000000017905251610ab69190612cd7565b600060405180830381855afa9150503d8060008114610af1576040519150601f19603f3d011682016040523d82523d6000602084013e610af6565b606091505b509092509050811580610b0a575060208151105b80610b4c575080601f81518110610b2357610b23612f03565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610b5e576000945050505050610531565b509095945050505050565b6000828152602081815260408083205467ffffffffffffffff168352600180835281842086855290925282206060915b848111610c805780851615801590610bc9575060008181526020839052604081208054610bc590612d45565b9050115b15610c785780826000838152602001908152602001600020808054610bed90612d45565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1990612d45565b8015610c665780601f10610c3b57610100808354040283529160200191610c66565b820191906000526020600020905b815481529060010190602001808311610c4957829003601f168201915b50505050509050935093505050610c99565b60011b610b99565b5060006040518060200160405280600081525092509250505b9250929050565b82610caa816117c3565b610cb357600080fd5b604080518082018252848152602080820185815260008881528083528481205467ffffffffffffffff1681526009835284812089825283528490209251835551600190920191909155815185815290810184905285917f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4691015b60405180910390a250505050565b82610d45816117c3565b610d4e57600080fd5b6000848152602081815260408083205467ffffffffffffffff168352600382528083208784529091529020610d84838583612de6565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610d2d929190612f32565b80610dc1816117c3565b610dca57600080fd5b6000828152602081905260408120805467ffffffffffffffff1691610dee83612f46565b82546101009290920a67ffffffffffffffff818102199093169183160217909155600084815260208181526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610e6883603c6116a5565b90508051600003610e7c5750600092915050565b610e8581611e6d565b9392505050565b6000838152602081815260408083205467ffffffffffffffff168352600a825280832086845290915290819020905160609190610ecc9085908590612d35565b90815260200160405180910390208054610ee590612d45565b80601f0160208091040260200160405190810160405280929190818152602001828054610f1190612d45565b8015610f5e5780601f10610f3357610100808354040283529160200191610f5e565b820191906000526020600020905b815481529060010190602001808311610f4157829003601f168201915b505050505090509392505050565b6000818152602081815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610fa690612d45565b80601f0160208091040260200160405190810160405280929190818152602001828054610fd290612d45565b801561101f5780601f10610ff45761010080835404028352916020019161101f565b820191906000526020600020905b81548152906001019060200180831161100257829003601f168201915b50505050509050919050565b83611035816117c3565b61103e57600080fd5b8361104a600182612d22565b161561105557600080fd5b6000858152602081815260408083205467ffffffffffffffff1683526001825280832088845282528083208784529091529020611093838583612de6565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b6000818152602081815260408083205467ffffffffffffffff168352600882528083208484529091529020805460609190610fa690612d45565b8261110c816117c3565b61111557600080fd5b6000848152602081815260408083205467ffffffffffffffff16835260088252808320878452909152902061114b838583612de6565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610d2d929190612f32565b82611188816117c3565b61119157600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af75284846040516111c39291906128b2565b60405180910390a2603c830361122757837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd26111fe84611e6d565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a25b6000848152602081815260408083205467ffffffffffffffff16835260028252808320878452825280832086845290915290206112648382612f6d565b5050505050565b73ffffffffffffffffffffffffffffffffffffffff82163303611315576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336000818152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000838152602081815260408083205467ffffffffffffffff168352600582528083208684528252808320858452825280832061ffff851684529091529020805460609190610ee590612d45565b6060610e8560008484611e95565b6000818152602081815260408083205467ffffffffffffffff168352600382528083208484529091529020805460609190610fa690612d45565b8261144c816117c3565b61145557600080fd5b6000848152602081815260408083205467ffffffffffffffff16808452600483528184208885529092528220805491929161148f90612d45565b80601f01602080910402602001604051908101604052809291908181526020018280546114bb90612d45565b80156115085780601f106114dd57610100808354040283529160200191611508565b820191906000526020600020905b8154815290600101906020018083116114eb57829003601f168201915b5050505067ffffffffffffffff841660009081526004602090815260408083208b845290915290209192506115409050858783612de6565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f858287876040516115759392919061302d565b60405180910390a2505050505050565b8161158f816117c3565b61159857600080fd5b6115a783603c61038485612088565b505050565b60606115b9848484611e95565b949350505050565b826115cb816117c3565b6115d457600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526007825280832087845282528083207fffffffff0000000000000000000000000000000000000000000000000000000087168085529083529281902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b6000828152602081815260408083205467ffffffffffffffff16835260028252808320858452825280832084845290915290208054606091906116e790612d45565b80601f016020809104026020016040519081016040528092919081815260200182805461171390612d45565b80156117605780601f1061173557610100808354040283529160200191611760565b820191906000526020600020905b81548152906001019060200180831161174357829003601f168201915b5050505050905092915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f59d1d43c0000000000000000000000000000000000000000000000000000000014806105315750610531826120c1565b60003373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016148061183e57503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016145b1561184b57506001919050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018390526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906302571be390602401602060405180830381865afa1580156118d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118fd919061305d565b90507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611a04576040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018490527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690636352211e90602401602060405180830381865afa1580156119dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a01919061305d565b90505b73ffffffffffffffffffffffffffffffffffffffff8116331480610e85575073ffffffffffffffffffffffffffffffffffffffff81166000908152600b6020908152604080832033845290915290205460ff16610e85565b611aaa6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261053181611d85565b6020810151815160609161053191611ad59082612117565b84519190612171565b60a081015160c082015160609161053191611ad5908290612d22565b600081518351148015610e855750610e8583600084600087516121e8565b865160208801206000611b2c878787612171565b90508315611c565767ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611b7790612d45565b159050611bd65767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611bba8361307a565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091528120611c1791612666565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a604051611c49929190613098565b60405180910390a2610735565b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611c9990612d45565b9050600003611cfa5767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611cde836130be565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091529020611d3c8282612f6d565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a84604051611d71939291906130d5565b60405180910390a250505050505050505050565b60c08101516020820181905281515111611d9c5750565b6000611db082600001518360200151612117565b8260200151611dbf9190613104565b8251909150611dce908261220b565b61ffff166040830152611de2600282613104565b8251909150611df1908261220b565b61ffff166060830152611e05600282613104565b8251909150611e149082612233565b63ffffffff166080830152611e2a600482613104565b8251909150600090611e3c908361220b565b61ffff169050611e4d600283613104565b60a084018190529150611e608183613104565b60c0909301929092525050565b60008151601414611e7d57600080fd5b50602001516c01000000000000000000000000900490565b60608167ffffffffffffffff811115611eb057611eb0612976565b604051908082528060200260200182016040528015611ee357816020015b6060815260200190600190039081611ece5790505b50905060005b82811015612080578415611fc8576000848483818110611f0b57611f0b612f03565b9050602002810190611f1d9190613117565b611f2c9160249160049161317c565b611f35916131a6565b9050858114611fc6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603460248201527f6d756c746963616c6c3a20416c6c207265636f726473206d757374206861766560448201527f2061206d61746368696e67206e616d6568617368000000000000000000000000606482015260840161130c565b505b60008030868685818110611fde57611fde612f03565b9050602002810190611ff09190613117565b604051611ffe929190612d35565b600060405180830381855af49150503d8060008114612039576040519150601f19603f3d011682016040523d82523d6000602084013e61203e565b606091505b50915091508161204d57600080fd5b8084848151811061206057612060612f03565b602002602001018190525050508080612078906131c4565b915050611ee9565b509392505050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fc869023300000000000000000000000000000000000000000000000000000000148061053157506105318261225d565b6000815b8351811061212b5761212b6131de565b600061213785836122b3565b60ff169050612147816001613104565b6121519083613104565b9150806000036121615750612167565b5061211b565b6115b98382612d22565b82516060906121808385613104565b111561218b57600080fd5b60008267ffffffffffffffff8111156121a6576121a6612976565b6040519080825280601f01601f1916602001820160405280156121d0576020820181803683370190505b50905060208082019086860101610b5e8282876122d7565b60006121f584848461232d565b61220087878561232d565b149695505050505050565b815160009061221b836002613104565b111561222657600080fd5b50016002015161ffff1690565b8151600090612243836004613104565b111561224e57600080fd5b50016004015163ffffffff1690565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f691f3431000000000000000000000000000000000000000000000000000000001480610531575061053182612351565b60008282815181106122c7576122c7612f03565b016020015160f81c905092915050565b6020811061230f57815183526122ee602084613104565b92506122fb602083613104565b9150612308602082612d22565b90506122d7565b905182516020929092036101000a6000190180199091169116179052565b825160009061233c8385613104565b111561234757600080fd5b5091016020012090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f124a319c00000000000000000000000000000000000000000000000000000000148061053157506105318260007fffffffff0000000000000000000000000000000000000000000000000000000082167fa8fa568200000000000000000000000000000000000000000000000000000000148061243557507fffffffff0000000000000000000000000000000000000000000000000000000082167f5c98042b00000000000000000000000000000000000000000000000000000000145b8061053157506105318260007fffffffff0000000000000000000000000000000000000000000000000000000082167fbc1c58d100000000000000000000000000000000000000000000000000000000148061053157506105318260007fffffffff0000000000000000000000000000000000000000000000000000000082167f3b3b57de00000000000000000000000000000000000000000000000000000000148061252357507fffffffff0000000000000000000000000000000000000000000000000000000082167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061053157506105318260007fffffffff0000000000000000000000000000000000000000000000000000000082167f2203ab5600000000000000000000000000000000000000000000000000000000148061053157506105318260007fffffffff0000000000000000000000000000000000000000000000000000000082167fd700ff3300000000000000000000000000000000000000000000000000000000148061053157506105318260007fffffffff0000000000000000000000000000000000000000000000000000000082167f4fbf043300000000000000000000000000000000000000000000000000000000148061053157507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610531565b50805461267290612d45565b6000825580601f10612682575050565b601f0160209004906000526020600020908101906126a091906126a3565b50565b5b808211156126b857600081556001016126a4565b5090565b80357fffffffff00000000000000000000000000000000000000000000000000000000811681146126ec57600080fd5b919050565b60006020828403121561270357600080fd5b610e85826126bc565b60008083601f84011261271e57600080fd5b50813567ffffffffffffffff81111561273657600080fd5b602083019150836020828501011115610c9957600080fd5b60008060006040848603121561276357600080fd5b83359250602084013567ffffffffffffffff81111561278157600080fd5b61278d8682870161270c565b9497909650939450505050565b6000806000806000606086880312156127b257600080fd5b85359450602086013567ffffffffffffffff808211156127d157600080fd5b6127dd89838a0161270c565b909650945060408801359150808211156127f657600080fd5b506128038882890161270c565b969995985093965092949392505050565b6000806040838503121561282757600080fd5b82359150612837602084016126bc565b90509250929050565b6000806040838503121561285357600080fd5b50508035926020909101359150565b60005b8381101561287d578181015183820152602001612865565b50506000910152565b6000815180845261289e816020860160208601612862565b601f01601f19169290920160200192915050565b8281526040602082015260006115b96040830184612886565b6000806000606084860312156128e057600080fd5b505081359360208301359350604090920135919050565b60006020828403121561290957600080fd5b5035919050565b602081526000610e856020830184612886565b6000806000806060858703121561293957600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561295e57600080fd5b61296a8782880161270c565b95989497509550505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156129ba57600080fd5b8335925060208401359150604084013567ffffffffffffffff808211156129e057600080fd5b818601915086601f8301126129f457600080fd5b813581811115612a0657612a06612976565b604051601f8201601f19908116603f01168101908382118183101715612a2e57612a2e612976565b81604052828152896020848701011115612a4757600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b73ffffffffffffffffffffffffffffffffffffffff811681146126a057600080fd5b60008060408385031215612a9e57600080fd5b8235612aa981612a69565b915060208301358015158114612abe57600080fd5b809150509250929050565b600080600060608486031215612ade57600080fd5b8335925060208401359150604084013561ffff81168114612afe57600080fd5b809150509250925092565b60008083601f840112612b1b57600080fd5b50813567ffffffffffffffff811115612b3357600080fd5b6020830191508360208260051b8501011115610c9957600080fd5b60008060208385031215612b6157600080fd5b823567ffffffffffffffff811115612b7857600080fd5b612b8485828601612b09565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612c03577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452612bf1858351612886565b94509285019290850190600101612bb7565b5092979650505050505050565b60008060408385031215612c2357600080fd5b823591506020830135612abe81612a69565b600080600060408486031215612c4a57600080fd5b83359250602084013567ffffffffffffffff811115612c6857600080fd5b61278d86828701612b09565b600080600060608486031215612c8957600080fd5b83359250612c99602085016126bc565b91506040840135612afe81612a69565b60008060408385031215612cbc57600080fd5b8235612cc781612a69565b91506020830135612abe81612a69565b60008251612ce9818460208701612862565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561053157610531612cf3565b8183823760009101908152919050565b600181811c90821680612d5957607f821691505b602082108103612d92577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b601f8211156115a757600081815260208120601f850160051c81016020861015612dbf5750805b601f850160051c820191505b81811015612dde57828155600101612dcb565b505050505050565b67ffffffffffffffff831115612dfe57612dfe612976565b612e1283612e0c8354612d45565b83612d98565b6000601f841160018114612e465760008515612e2e5750838201355b600019600387901b1c1916600186901b178355611264565b600083815260209020601f19861690835b82811015612e775786850135825560209485019460019092019101612e57565b5086821015612e945760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b604081526000612ee5604083018688612ea6565b8281036020840152612ef8818587612ea6565b979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020815260006115b9602083018486612ea6565b600067ffffffffffffffff808316818103612f6357612f63612cf3565b6001019392505050565b815167ffffffffffffffff811115612f8757612f87612976565b612f9b81612f958454612d45565b84612d98565b602080601f831160018114612fd05760008415612fb85750858301515b600019600386901b1c1916600185901b178555612dde565b600085815260208120601f198616915b82811015612fff57888601518255948401946001909101908401612fe0565b508582101561301d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6040815260006130406040830186612886565b8281036020840152613053818587612ea6565b9695505050505050565b60006020828403121561306f57600080fd5b8151610e8581612a69565b600061ffff82168061308e5761308e612cf3565b6000190192915050565b6040815260006130ab6040830185612886565b905061ffff831660208301529392505050565b600061ffff808316818103612f6357612f63612cf3565b6060815260006130e86060830186612886565b61ffff8516602084015282810360408401526130538185612886565b8082018082111561053157610531612cf3565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261314c57600080fd5b83018035915067ffffffffffffffff82111561316757600080fd5b602001915036819003821315610c9957600080fd5b6000808585111561318c57600080fd5b8386111561319957600080fd5b5050820193919092039150565b8035602083101561053157600019602084900360031b1b1692915050565b600060001982036131d7576131d7612cf3565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fdfea26469706673582212202673f63d364d138759b82a66e0266a4d87a91b389a1d1a45dcec5e0fbce1a7f764736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "ABI(bytes32,uint256)": { + "params": { + "contentTypes": "A bitwise OR of the ABI formats accepted by the caller.", + "node": "The ENS node to query" + }, + "returns": { + "_0": "contentType The content type of the return value", + "_1": "data The ABI data" + } + }, + "addr(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated address." + } + }, + "clearRecords(bytes32)": { + "params": { + "node": "The node to update." + } + }, + "contenthash(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated contenthash." + } + }, + "dnsRecord(bytes32,bytes32,uint16)": { + "params": { + "name": "the keccak-256 hash of the fully-qualified name for which to fetch the record", + "node": "the namehash of the node for which to fetch the record", + "resource": "the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types" + }, + "returns": { + "_0": "the DNS record in wire format if present, otherwise empty" + } + }, + "hasDNSRecords(bytes32,bytes32)": { + "params": { + "name": "the namehash of the node for which to check the records", + "node": "the namehash of the node for which to check the records" + } + }, + "interfaceImplementer(bytes32,bytes4)": { + "params": { + "interfaceID": "The EIP 165 interface ID to check for.", + "node": "The ENS node to query." + }, + "returns": { + "_0": "The address that implements this interface, or 0 if the interface is unsupported." + } + }, + "isApprovedForAll(address,address)": { + "details": "See {IERC1155-isApprovedForAll}." + }, + "name(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated name." + } + }, + "pubkey(bytes32)": { + "params": { + "node": "The ENS node to query" + }, + "returns": { + "x": "The X coordinate of the curve point for the public key.", + "y": "The Y coordinate of the curve point for the public key." + } + }, + "setABI(bytes32,uint256,bytes)": { + "params": { + "contentType": "The content type of the ABI", + "data": "The ABI data.", + "node": "The node to update." + } + }, + "setAddr(bytes32,address)": { + "params": { + "a": "The address to set.", + "node": "The node to update." + } + }, + "setApprovalForAll(address,bool)": { + "details": "See {IERC1155-setApprovalForAll}." + }, + "setContenthash(bytes32,bytes)": { + "params": { + "hash": "The contenthash to set", + "node": "The node to update." + } + }, + "setDNSRecords(bytes32,bytes)": { + "params": { + "data": "the DNS wire format records to set", + "node": "the namehash of the node for which to set the records" + } + }, + "setInterface(bytes32,bytes4,address)": { + "params": { + "implementer": "The address of a contract that implements this interface for this node.", + "interfaceID": "The EIP 165 interface ID.", + "node": "The node to update." + } + }, + "setName(bytes32,string)": { + "params": { + "node": "The node to update." + } + }, + "setPubkey(bytes32,bytes32,bytes32)": { + "params": { + "node": "The ENS node to query", + "x": "the X coordinate of the curve point for the public key.", + "y": "the Y coordinate of the curve point for the public key." + } + }, + "setText(bytes32,string,string)": { + "params": { + "key": "The key to set.", + "node": "The node to update.", + "value": "The text data value to set." + } + }, + "setZonehash(bytes32,bytes)": { + "params": { + "hash": "The zonehash to set", + "node": "The node to update." + } + }, + "text(bytes32,string)": { + "params": { + "key": "The text data key to query.", + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated text data." + } + }, + "zonehash(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated contenthash." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "ABI(bytes32,uint256)": { + "notice": "Returns the ABI associated with an ENS node. Defined in EIP205." + }, + "addr(bytes32)": { + "notice": "Returns the address associated with an ENS node." + }, + "clearRecords(bytes32)": { + "notice": "Increments the record version associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "contenthash(bytes32)": { + "notice": "Returns the contenthash associated with an ENS node." + }, + "dnsRecord(bytes32,bytes32,uint16)": { + "notice": "Obtain a DNS record." + }, + "hasDNSRecords(bytes32,bytes32)": { + "notice": "Check if a given node has records." + }, + "interfaceImplementer(bytes32,bytes4)": { + "notice": "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." + }, + "name(bytes32)": { + "notice": "Returns the name associated with an ENS node, for reverse records. Defined in EIP181." + }, + "pubkey(bytes32)": { + "notice": "Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619." + }, + "setABI(bytes32,uint256,bytes)": { + "notice": "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." + }, + "setAddr(bytes32,address)": { + "notice": "Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "setContenthash(bytes32,bytes)": { + "notice": "Sets the contenthash associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "setDNSRecords(bytes32,bytes)": { + "notice": "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." + }, + "setInterface(bytes32,bytes4,address)": { + "notice": "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." + }, + "setName(bytes32,string)": { + "notice": "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." + }, + "setPubkey(bytes32,bytes32,bytes32)": { + "notice": "Sets the SECP256k1 public key associated with an ENS node." + }, + "setText(bytes32,string,string)": { + "notice": "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." + }, + "setZonehash(bytes32,bytes)": { + "notice": "setZonehash sets the hash for the zone. May only be called by the owner of that node in the ENS registry." + }, + "text(bytes32,string)": { + "notice": "Returns the text data associated with an ENS node and key." + }, + "zonehash(bytes32)": { + "notice": "zonehash obtains the hash for the zone." + } + }, + "notice": "A simple resolver anyone can use; only allows the owner of a node to set its address.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 13957, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "recordVersions", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_bytes32,t_uint64)" + }, + { + "astId": 14036, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_abis", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))" + }, + { + "astId": 14190, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_addresses", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))" + }, + { + "astId": 14381, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_hashes", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))" + }, + { + "astId": 14471, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_zonehashes", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))" + }, + { + "astId": 14481, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_records", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))))" + }, + { + "astId": 14489, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_nameEntriesCount", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16)))" + }, + { + "astId": 15185, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_interfaces", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes4,t_address)))" + }, + { + "astId": 15377, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_names", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_string_storage))" + }, + { + "astId": 15464, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_pubkeys", + "offset": 0, + "slot": "9", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_struct(PublicKey)15457_storage))" + }, + { + "astId": 15567, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_texts", + "offset": 0, + "slot": "10", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage)))" + }, + { + "astId": 13608, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "_operatorApprovals", + "offset": 0, + "slot": "11", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes4": { + "encoding": "inplace", + "label": "bytes4", + "numberOfBytes": "4" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_bytes32,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage)))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes32 => uint16))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_uint16)" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes4,t_address))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes4 => address))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes4,t_address)" + }, + "t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(string => string))", + "numberOfBytes": "32", + "value": "t_mapping(t_string_memory_ptr,t_string_storage)" + }, + "t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint16 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint16,t_bytes_storage)" + }, + "t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint256 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_bytes_storage)" + }, + "t_mapping(t_bytes32,t_string_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_bytes32,t_struct(PublicKey)15457_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct PubkeyResolver.PublicKey)", + "numberOfBytes": "32", + "value": "t_struct(PublicKey)15457_storage" + }, + "t_mapping(t_bytes32,t_uint16)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint16)", + "numberOfBytes": "32", + "value": "t_uint16" + }, + "t_mapping(t_bytes32,t_uint64)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint64)", + "numberOfBytes": "32", + "value": "t_uint64" + }, + "t_mapping(t_bytes4,t_address)": { + "encoding": "mapping", + "key": "t_bytes4", + "label": "mapping(bytes4 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_string_memory_ptr,t_string_storage)": { + "encoding": "mapping", + "key": "t_string_memory_ptr", + "label": "mapping(string => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_uint16,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint256,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_bytes_storage)" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage)))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes4,t_address)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes4,t_address))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(string => string)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_string_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => string))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_string_storage)" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_struct(PublicKey)15457_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => struct PubkeyResolver.PublicKey))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_struct(PublicKey)15457_storage)" + }, + "t_string_memory_ptr": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(PublicKey)15457_storage": { + "encoding": "inplace", + "label": "struct PubkeyResolver.PublicKey", + "members": [ + { + "astId": 15454, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "x", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 15456, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "y", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint16": { + "encoding": "inplace", + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint64": { + "encoding": "inplace", + "label": "uint64", + "numberOfBytes": "8" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/RSASHA1Algorithm.json b/solidity/dns-contracts/deployments/ropsten/RSASHA1Algorithm.json new file mode 100644 index 0000000..bfac47d --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/RSASHA1Algorithm.json @@ -0,0 +1,70 @@ +{ + "address": "0x83651055E817D9618C7465a4044B7540079cFbbb", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "key", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x0f3de623a439bc206553365e188d5a08043e7dcfcc3a8d9bda567df3b564b318", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x83651055E817D9618C7465a4044B7540079cFbbb", + "transactionIndex": 41, + "gasUsed": "893658", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x1cd549d940702d2e2d9bc0954954d1f150443c157c64058827b74d831f617cb7", + "transactionHash": "0x0f3de623a439bc206553365e188d5a08043e7dcfcc3a8d9bda567df3b564b318", + "logs": [], + "blockNumber": 10645784, + "cumulativeGasUsed": "6467411", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "424cfdf012b9aa11d2e839569d49524c", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC RSASHA1 algorithm.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol\":\"RSASHA1Algorithm\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@ensdomains/solsha1/contracts/SHA1.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary SHA1 {\\n event Debug(bytes32 x);\\n\\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\\n assembly {\\n // Get a safe scratch location\\n let scratch := mload(0x40)\\n\\n // Get the data length, and point data at the first byte\\n let len := mload(data)\\n data := add(data, 32)\\n\\n // Find the length after padding\\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\\n switch lt(sub(totallen, len), 9)\\n case 1 { totallen := add(totallen, 64) }\\n\\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\\n\\n function readword(ptr, off, count) -> result {\\n result := 0\\n if lt(off, count) {\\n result := mload(add(ptr, off))\\n count := sub(count, off)\\n if lt(count, 32) {\\n let mask := not(sub(exp(256, sub(32, count)), 1))\\n result := and(result, mask)\\n }\\n }\\n }\\n\\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\\n mstore(scratch, readword(data, i, len))\\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\\n\\n // If we loaded the last byte, store the terminator byte\\n switch lt(sub(len, i), 64)\\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\\n\\n // If this is the last block, store the length\\n switch eq(i, sub(totallen, 64))\\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\\n\\n // Expand the 16 32-bit words into 80\\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\\n mstore(add(scratch, j), temp)\\n }\\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\\n mstore(add(scratch, j), temp)\\n }\\n\\n let x := h\\n let f := 0\\n let k := 0\\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\\n switch div(j, 20)\\n case 0 {\\n // f = d xor (b and (c xor d))\\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\\n f := and(div(x, 0x1000000000000000000000000000000), f)\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x5A827999\\n }\\n case 1{\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x6ED9EBA1\\n }\\n case 2 {\\n // f = (b and c) or (d and (b or c))\\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := and(div(x, 0x10000000000), f)\\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\\n k := 0x8F1BBCDC\\n }\\n case 3 {\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0xCA62C1D6\\n }\\n // temp = (a leftrotate 5) + f + e + k + w[i]\\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\\n temp := add(f, temp)\\n temp := add(and(x, 0xFFFFFFFF), temp)\\n temp := add(k, temp)\\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\\n }\\n\\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\\n }\\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x746d9b85de197afbc13182cbe4ba4f7917f19594e07c655d6a0c85fdf7460a8a\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\\n uint shortest = len;\\n if (otherlen < len)\\n shortest = otherlen;\\n\\n uint selfptr;\\n uint otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint idx = 0; idx < shortest; idx += 32) {\\n uint a;\\n uint b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint mask;\\n if (shortest > 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\\n }\\n int diff = int(a & mask) - int(b & mask);\\n if (diff != 0)\\n return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int(len) - int(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\\n return self.length == other.length && equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint dest, uint src, uint len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint dest;\\n uint src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\\n require(len <= 52);\\n\\n uint ret = 0;\\n uint8 decoded;\\n for(uint i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if(i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint bitlen = len * 5;\\n if(len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if(len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if(len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if(len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if(len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n}\",\"keccak256\":\"0x83315df2e54c74451577c70da2c267c3459802b08b9aeec6516302eee70f796e\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n*/\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external virtual view returns (bool);\\n}\\n\",\"keccak256\":\"0x51d6251568844e435f58952354abe8c8c8e978ab40ecb0bbb2f5bd767838b3a7\"},\"contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary ModexpPrecompile {\\n /**\\n * @dev Computes (base ^ exponent) % modulus over big numbers.\\n */\\n function modexp(bytes memory base, bytes memory exponent, bytes memory modulus) internal view returns (bool success, bytes memory output) {\\n bytes memory input = abi.encodePacked(\\n uint256(base.length),\\n uint256(exponent.length),\\n uint256(modulus.length),\\n base,\\n exponent,\\n modulus\\n );\\n\\n output = new bytes(modulus.length);\\n\\n assembly {\\n success := staticcall(gas(), 5, add(input, 32), mload(input), add(output, 32), mload(modulus))\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe3d689d14cf0294f433f4e14cdd8feab8d542e5b8342c911d5c7cb518170e2b1\"},\"contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./RSAVerify.sol\\\";\\nimport \\\"@ensdomains/solsha1/contracts/SHA1.sol\\\";\\n\\n/**\\n* @dev Implements the DNSSEC RSASHA1 algorithm.\\n*/\\ncontract RSASHA1Algorithm is Algorithm {\\n using BytesUtils for *;\\n\\n function verify(bytes calldata key, bytes calldata data, bytes calldata sig) external override view returns (bool) {\\n bytes memory exponent;\\n bytes memory modulus;\\n\\n uint16 exponentLen = uint16(key.readUint8(4));\\n if (exponentLen != 0) {\\n exponent = key.substring(5, exponentLen);\\n modulus = key.substring(exponentLen + 5, key.length - exponentLen - 5);\\n } else {\\n exponentLen = key.readUint16(5);\\n exponent = key.substring(7, exponentLen);\\n modulus = key.substring(exponentLen + 7, key.length - exponentLen - 7);\\n }\\n\\n // Recover the message from the signature\\n bool ok;\\n bytes memory result;\\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\\n\\n // Verify it ends with the hash of our data\\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\\n }\\n}\\n\",\"keccak256\":\"0x4d3b4b7873785b2d1806faa3fc31aca7b5897b1ae69b1224f6a12d06e295939e\"},\"contracts/dnssec-oracle/algorithms/RSAVerify.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./ModexpPrecompile.sol\\\";\\n\\nlibrary RSAVerify {\\n /**\\n * @dev Recovers the input data from an RSA signature, returning the result in S.\\n * @param N The RSA public modulus.\\n * @param E The RSA public exponent.\\n * @param S The signature to recover.\\n * @return True if the recovery succeeded.\\n */\\n function rsarecover(bytes memory N, bytes memory E, bytes memory S) internal view returns (bool, bytes memory) {\\n return ModexpPrecompile.modexp(S, E, N);\\n }\\n}\\n\",\"keccak256\":\"0xc630e4d296e2d7bd2b968f8a9a8df629fef5161e10ffae9973e045900741cfe4\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610f50806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004a60048036038101906100459190610c38565b610060565b6040516100579190610d97565b60405180910390f35b600060608060006100bf60048b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061040390919063ffffffff16565b60ff16905060008161ffff16146101be5761012e60058261ffff168c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104549092919063ffffffff16565b92506101b76005826101409190610dc8565b61ffff1660058361ffff168d8d90506101599190610e56565b6101639190610e56565b8c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104549092919063ffffffff16565b9150610302565b61021660058b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061050f90919063ffffffff16565b905061027660078261ffff168c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104549092919063ffffffff16565b92506102ff6007826102889190610dc8565b61ffff1660078361ffff168d8d90506102a19190610e56565b6102ab9190610e56565b8c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104549092919063ffffffff16565b91505b6000606061035584868a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061053e565b80925081935050508180156103f25750610385601482516103769190610e56565b8261055990919063ffffffff16565b6bffffffffffffffffffffffff19166103e18b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506105a6565b6bffffffffffffffffffffffff1916145b955050505050509695505050505050565b600082828151811061043e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b60f81c905092915050565b6060835182846104649190610e00565b111561046f57600080fd5b60008267ffffffffffffffff8111156104b1577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156104e35781602001600182028036833780820191505090505b5090506000806020830191508560208801019050610502828287610ac4565b8293505050509392505050565b600082516002836105209190610e00565b111561052b57600080fd5b61ffff8260028501015116905092915050565b6000606061054d838587610b28565b91509150935093915050565b6000825160148361056a9190610e00565b111561057557600080fd5b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008260208501015116905092915050565b60006040518251602084019350604067ffffffffffffffc0600183011601600982820310600181146105d7576105de565b6040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f0610636565b60008383101561062f578282015190508284039350602084101561062e576001846020036101000a03198082169150505b5b9392505050565b60005b82811015610a445761064c8482896105fd565b855261065c8460208301896105fd565b6020860152604081850310600181146106745761067d565b60808286038701535b5060408303811460018114610691576106a1565b6008850260208701511760208701525b5060405b608081101561072d5760408103860151603882038701511860208203870151600c830388015118187c010000000100000001000000010000000100000001000000010000000163800000008204167ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe6002830216179050808288015250600c810190506106a5565b5060805b6101408110156107ba57608081038601516070820387015118604082038701516018830388015118187c030000000300000003000000030000000300000003000000030000000363400000008204167ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc6004830216179050808288015250601881019050610731565b508160008060005b6050811015610a165760148104600081146107f4576001811461083e576002811461087b57600381146108de57610917565b6501000000000085046a01000000000000000000008604189350836f01000000000000000000000000000000860416935083650100000000008604189350635a8279999250610917565b6a010000000000000000000085046f01000000000000000000000000000000860418935083650100000000008604189350636ed9eba19250610917565b6a010000000000000000000085046f01000000000000000000000000000000860417935083650100000000008604169350836a010000000000000000000086046f01000000000000000000000000000000870416179350638f1bbcdc9250610917565b6a010000000000000000000085046f0100000000000000000000000000000086041893508365010000000000860418935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c0151040190507401000000000000000000000000000000000000000081026501000000000086041794506a0100000000000000000000633fffffff6a040000000000000000000087041663c00000006604000000000000880416170277ffffffff00ffffffff000000000000ffffffff00ffffffff8616179450506001810190506107c2565b5077ffffffff00ffffffff00ffffffff00ffffffff00ffffffff838601169450505050604081019050610639565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b5b60208110610b035781518352602083610ade9190610e00565b9250602082610aed9190610e00565b9150602081610afc9190610e56565b9050610ac5565b60006001826020036101000a0390508019835116818551168181178652505050505050565b600060606000855185518551888888604051602001610b4c96959493929190610d33565b6040516020818303038152906040529050835167ffffffffffffffff811115610b9e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015610bd05781602001600182028036833780820191505090505b50915083516020830182516020840160055afa925050935093915050565b60008083601f840112610c0057600080fd5b8235905067ffffffffffffffff811115610c1957600080fd5b602083019150836001820283011115610c3157600080fd5b9250929050565b60008060008060008060608789031215610c5157600080fd5b600087013567ffffffffffffffff811115610c6b57600080fd5b610c7789828a01610bee565b9650965050602087013567ffffffffffffffff811115610c9657600080fd5b610ca289828a01610bee565b9450945050604087013567ffffffffffffffff811115610cc157600080fd5b610ccd89828a01610bee565b92509250509295509295509295565b610ce581610e8a565b82525050565b6000610cf682610db2565b610d008185610dbd565b9350610d10818560208601610eae565b80840191505092915050565b610d2d610d2882610ea4565b610ee1565b82525050565b6000610d3f8289610d1c565b602082019150610d4f8288610d1c565b602082019150610d5f8287610d1c565b602082019150610d6f8286610ceb565b9150610d7b8285610ceb565b9150610d878284610ceb565b9150819050979650505050505050565b6000602082019050610dac6000830184610cdc565b92915050565b600081519050919050565b600081905092915050565b6000610dd382610e96565b9150610dde83610e96565b92508261ffff03821115610df557610df4610eeb565b5b828201905092915050565b6000610e0b82610ea4565b9150610e1683610ea4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610e4b57610e4a610eeb565b5b828201905092915050565b6000610e6182610ea4565b9150610e6c83610ea4565b925082821015610e7f57610e7e610eeb565b5b828203905092915050565b60008115159050919050565b600061ffff82169050919050565b6000819050919050565b60005b83811015610ecc578082015181840152602081019050610eb1565b83811115610edb576000848401525b50505050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea26469706673582212204b112e59e50f4f6898d426d8d95810ecb2715e88420d95291c6eae114b7a633564736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004a60048036038101906100459190610c38565b610060565b6040516100579190610d97565b60405180910390f35b600060608060006100bf60048b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061040390919063ffffffff16565b60ff16905060008161ffff16146101be5761012e60058261ffff168c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104549092919063ffffffff16565b92506101b76005826101409190610dc8565b61ffff1660058361ffff168d8d90506101599190610e56565b6101639190610e56565b8c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104549092919063ffffffff16565b9150610302565b61021660058b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061050f90919063ffffffff16565b905061027660078261ffff168c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104549092919063ffffffff16565b92506102ff6007826102889190610dc8565b61ffff1660078361ffff168d8d90506102a19190610e56565b6102ab9190610e56565b8c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104549092919063ffffffff16565b91505b6000606061035584868a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061053e565b80925081935050508180156103f25750610385601482516103769190610e56565b8261055990919063ffffffff16565b6bffffffffffffffffffffffff19166103e18b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506105a6565b6bffffffffffffffffffffffff1916145b955050505050509695505050505050565b600082828151811061043e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b60f81c905092915050565b6060835182846104649190610e00565b111561046f57600080fd5b60008267ffffffffffffffff8111156104b1577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156104e35781602001600182028036833780820191505090505b5090506000806020830191508560208801019050610502828287610ac4565b8293505050509392505050565b600082516002836105209190610e00565b111561052b57600080fd5b61ffff8260028501015116905092915050565b6000606061054d838587610b28565b91509150935093915050565b6000825160148361056a9190610e00565b111561057557600080fd5b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008260208501015116905092915050565b60006040518251602084019350604067ffffffffffffffc0600183011601600982820310600181146105d7576105de565b6040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f0610636565b60008383101561062f578282015190508284039350602084101561062e576001846020036101000a03198082169150505b5b9392505050565b60005b82811015610a445761064c8482896105fd565b855261065c8460208301896105fd565b6020860152604081850310600181146106745761067d565b60808286038701535b5060408303811460018114610691576106a1565b6008850260208701511760208701525b5060405b608081101561072d5760408103860151603882038701511860208203870151600c830388015118187c010000000100000001000000010000000100000001000000010000000163800000008204167ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe6002830216179050808288015250600c810190506106a5565b5060805b6101408110156107ba57608081038601516070820387015118604082038701516018830388015118187c030000000300000003000000030000000300000003000000030000000363400000008204167ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc6004830216179050808288015250601881019050610731565b508160008060005b6050811015610a165760148104600081146107f4576001811461083e576002811461087b57600381146108de57610917565b6501000000000085046a01000000000000000000008604189350836f01000000000000000000000000000000860416935083650100000000008604189350635a8279999250610917565b6a010000000000000000000085046f01000000000000000000000000000000860418935083650100000000008604189350636ed9eba19250610917565b6a010000000000000000000085046f01000000000000000000000000000000860417935083650100000000008604169350836a010000000000000000000086046f01000000000000000000000000000000870416179350638f1bbcdc9250610917565b6a010000000000000000000085046f0100000000000000000000000000000086041893508365010000000000860418935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c0151040190507401000000000000000000000000000000000000000081026501000000000086041794506a0100000000000000000000633fffffff6a040000000000000000000087041663c00000006604000000000000880416170277ffffffff00ffffffff000000000000ffffffff00ffffffff8616179450506001810190506107c2565b5077ffffffff00ffffffff00ffffffff00ffffffff00ffffffff838601169450505050604081019050610639565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b5b60208110610b035781518352602083610ade9190610e00565b9250602082610aed9190610e00565b9150602081610afc9190610e56565b9050610ac5565b60006001826020036101000a0390508019835116818551168181178652505050505050565b600060606000855185518551888888604051602001610b4c96959493929190610d33565b6040516020818303038152906040529050835167ffffffffffffffff811115610b9e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015610bd05781602001600182028036833780820191505090505b50915083516020830182516020840160055afa925050935093915050565b60008083601f840112610c0057600080fd5b8235905067ffffffffffffffff811115610c1957600080fd5b602083019150836001820283011115610c3157600080fd5b9250929050565b60008060008060008060608789031215610c5157600080fd5b600087013567ffffffffffffffff811115610c6b57600080fd5b610c7789828a01610bee565b9650965050602087013567ffffffffffffffff811115610c9657600080fd5b610ca289828a01610bee565b9450945050604087013567ffffffffffffffff811115610cc157600080fd5b610ccd89828a01610bee565b92509250509295509295509295565b610ce581610e8a565b82525050565b6000610cf682610db2565b610d008185610dbd565b9350610d10818560208601610eae565b80840191505092915050565b610d2d610d2882610ea4565b610ee1565b82525050565b6000610d3f8289610d1c565b602082019150610d4f8288610d1c565b602082019150610d5f8287610d1c565b602082019150610d6f8286610ceb565b9150610d7b8285610ceb565b9150610d878284610ceb565b9150819050979650505050505050565b6000602082019050610dac6000830184610cdc565b92915050565b600081519050919050565b600081905092915050565b6000610dd382610e96565b9150610dde83610e96565b92508261ffff03821115610df557610df4610eeb565b5b828201905092915050565b6000610e0b82610ea4565b9150610e1683610ea4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610e4b57610e4a610eeb565b5b828201905092915050565b6000610e6182610ea4565b9150610e6c83610ea4565b925082821015610e7f57610e7e610eeb565b5b828203905092915050565b60008115159050919050565b600061ffff82169050919050565b6000819050919050565b60005b83811015610ecc578082015181840152602081019050610eb1565b83811115610edb576000848401525b50505050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea26469706673582212204b112e59e50f4f6898d426d8d95810ecb2715e88420d95291c6eae114b7a633564736f6c63430008040033", + "devdoc": { + "details": "Implements the DNSSEC RSASHA1 algorithm.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/RSASHA256Algorithm.json b/solidity/dns-contracts/deployments/ropsten/RSASHA256Algorithm.json new file mode 100644 index 0000000..1795abb --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/RSASHA256Algorithm.json @@ -0,0 +1,69 @@ +{ + "address": "0xca725080d594e225b5afb5d1f755aab36bfbbccf", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "key", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xc019a62401b8ed32f6195bf3a90c2718da9ef1648286b21990b99580a2116d08", + "receipt": { + "to": null, + "from": "0xa303ddc620aa7d1390baccc8a495508b183fab59", + "contractAddress": "0xca725080d594e225b5afb5d1f755aab36bfbbccf", + "transactionIndex": "0x2a", + "gasUsed": "0x9c369", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x8d3ed903701789c20998a16c01e9ff5de6dd3c8c9d89c8124c7e8362f972d3e0", + "transactionHash": "0xc019a62401b8ed32f6195bf3a90c2718da9ef1648286b21990b99580a2116d08", + "logs": [], + "blockNumber": "0xa27159", + "cumulativeGasUsed": "0x6728ea", + "status": "0x1" + }, + "args": [], + "solcInputHash": "424cfdf012b9aa11d2e839569d49524c", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC RSASHA256 algorithm.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol\":\"RSASHA256Algorithm\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\\n uint shortest = len;\\n if (otherlen < len)\\n shortest = otherlen;\\n\\n uint selfptr;\\n uint otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint idx = 0; idx < shortest; idx += 32) {\\n uint a;\\n uint b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint mask;\\n if (shortest > 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\\n }\\n int diff = int(a & mask) - int(b & mask);\\n if (diff != 0)\\n return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int(len) - int(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\\n return self.length == other.length && equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint dest, uint src, uint len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint dest;\\n uint src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\\n require(len <= 52);\\n\\n uint ret = 0;\\n uint8 decoded;\\n for(uint i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if(i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint bitlen = len * 5;\\n if(len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if(len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if(len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if(len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if(len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n}\",\"keccak256\":\"0x83315df2e54c74451577c70da2c267c3459802b08b9aeec6516302eee70f796e\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n*/\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external virtual view returns (bool);\\n}\\n\",\"keccak256\":\"0x51d6251568844e435f58952354abe8c8c8e978ab40ecb0bbb2f5bd767838b3a7\"},\"contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary ModexpPrecompile {\\n /**\\n * @dev Computes (base ^ exponent) % modulus over big numbers.\\n */\\n function modexp(bytes memory base, bytes memory exponent, bytes memory modulus) internal view returns (bool success, bytes memory output) {\\n bytes memory input = abi.encodePacked(\\n uint256(base.length),\\n uint256(exponent.length),\\n uint256(modulus.length),\\n base,\\n exponent,\\n modulus\\n );\\n\\n output = new bytes(modulus.length);\\n\\n assembly {\\n success := staticcall(gas(), 5, add(input, 32), mload(input), add(output, 32), mload(modulus))\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe3d689d14cf0294f433f4e14cdd8feab8d542e5b8342c911d5c7cb518170e2b1\"},\"contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./RSAVerify.sol\\\";\\n\\n/**\\n* @dev Implements the DNSSEC RSASHA256 algorithm.\\n*/\\ncontract RSASHA256Algorithm is Algorithm {\\n using BytesUtils for *;\\n\\n function verify(bytes calldata key, bytes calldata data, bytes calldata sig) external override view returns (bool) {\\n bytes memory exponent;\\n bytes memory modulus;\\n\\n uint16 exponentLen = uint16(key.readUint8(4));\\n if (exponentLen != 0) {\\n exponent = key.substring(5, exponentLen);\\n modulus = key.substring(exponentLen + 5, key.length - exponentLen - 5);\\n } else {\\n exponentLen = key.readUint16(5);\\n exponent = key.substring(7, exponentLen);\\n modulus = key.substring(exponentLen + 7, key.length - exponentLen - 7);\\n }\\n\\n // Recover the message from the signature\\n bool ok;\\n bytes memory result;\\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\\n\\n // Verify it ends with the hash of our data\\n return ok && sha256(data) == result.readBytes32(result.length - 32);\\n }\\n}\\n\",\"keccak256\":\"0x8a5f89ac82a433590cd29d0a9e72ca68618b86105dfcd62e04dff313ddcf809d\"},\"contracts/dnssec-oracle/algorithms/RSAVerify.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./ModexpPrecompile.sol\\\";\\n\\nlibrary RSAVerify {\\n /**\\n * @dev Recovers the input data from an RSA signature, returning the result in S.\\n * @param N The RSA public modulus.\\n * @param E The RSA public exponent.\\n * @param S The signature to recover.\\n * @return True if the recovery succeeded.\\n */\\n function rsarecover(bytes memory N, bytes memory E, bytes memory S) internal view returns (bool, bytes memory) {\\n return ModexpPrecompile.modexp(S, E, N);\\n }\\n}\\n\",\"keccak256\":\"0xc630e4d296e2d7bd2b968f8a9a8df629fef5161e10ffae9973e045900741cfe4\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610aa3806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004a6004803603810190610045919061071d565b610060565b60405161005791906108ba565b60405180910390f35b600060608060006100bf60048b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506103ea90919063ffffffff16565b60ff16905060008161ffff16146101be5761012e60058261ffff168c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061043b9092919063ffffffff16565b92506101b760058261014091906108eb565b61ffff1660058361ffff168d8d90506101599190610979565b6101639190610979565b8c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061043b9092919063ffffffff16565b9150610302565b61021660058b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104f690919063ffffffff16565b905061027660078261ffff168c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061043b9092919063ffffffff16565b92506102ff60078261028891906108eb565b61ffff1660078361ffff168d8d90506102a19190610979565b6102ab9190610979565b8c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061043b9092919063ffffffff16565b91505b6000606061035584868a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610525565b80925081935050508180156103d95750610385602082516103769190610979565b8261054090919063ffffffff16565b60028b8b60405161039792919061083d565b602060405180830381855afa1580156103b4573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906103d791906106f4565b145b955050505050509695505050505050565b6000828281518110610425577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b60f81c905092915050565b60608351828461044b9190610923565b111561045657600080fd5b60008267ffffffffffffffff811115610498577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156104ca5781602001600182028036833780820191505090505b50905060008060208301915085602088010190506104e982828761056b565b8293505050509392505050565b600082516002836105079190610923565b111561051257600080fd5b61ffff8260028501015116905092915050565b600060606105348385876105cf565b91509150935093915050565b600082516020836105519190610923565b111561055c57600080fd5b81602084010151905092915050565b5b602081106105aa57815183526020836105859190610923565b92506020826105949190610923565b91506020816105a39190610979565b905061056c565b60006001826020036101000a0390508019835116818551168181178652505050505050565b6000606060008551855185518888886040516020016105f396959493929190610856565b6040516020818303038152906040529050835167ffffffffffffffff811115610645577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156106775781602001600182028036833780820191505090505b50915083516020830182516020840160055afa925050935093915050565b6000815190506106a481610a56565b92915050565b60008083601f8401126106bc57600080fd5b8235905067ffffffffffffffff8111156106d557600080fd5b6020830191508360018202830111156106ed57600080fd5b9250929050565b60006020828403121561070657600080fd5b600061071484828501610695565b91505092915050565b6000806000806000806060878903121561073657600080fd5b600087013567ffffffffffffffff81111561075057600080fd5b61075c89828a016106aa565b9650965050602087013567ffffffffffffffff81111561077b57600080fd5b61078789828a016106aa565b9450945050604087013567ffffffffffffffff8111156107a657600080fd5b6107b289828a016106aa565b92509250509295509295509295565b6107ca816109ad565b82525050565b60006107dc83856108e0565b93506107e98385846109db565b82840190509392505050565b6000610800826108d5565b61080a81856108e0565b935061081a8185602086016109ea565b80840191505092915050565b610837610832826109d1565b610a1d565b82525050565b600061084a8284866107d0565b91508190509392505050565b60006108628289610826565b6020820191506108728288610826565b6020820191506108828287610826565b60208201915061089282866107f5565b915061089e82856107f5565b91506108aa82846107f5565b9150819050979650505050505050565b60006020820190506108cf60008301846107c1565b92915050565b600081519050919050565b600081905092915050565b60006108f6826109c3565b9150610901836109c3565b92508261ffff0382111561091857610917610a27565b5b828201905092915050565b600061092e826109d1565b9150610939836109d1565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561096e5761096d610a27565b5b828201905092915050565b6000610984826109d1565b915061098f836109d1565b9250828210156109a2576109a1610a27565b5b828203905092915050565b60008115159050919050565b6000819050919050565b600061ffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015610a085780820151818401526020810190506109ed565b83811115610a17576000848401525b50505050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b610a5f816109b9565b8114610a6a57600080fd5b5056fea2646970667358221220e8a3623f1ae22c54b7f4fd48d3e69f062c1f2d47656ad9b51d4eac713b8fbde864736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004a6004803603810190610045919061071d565b610060565b60405161005791906108ba565b60405180910390f35b600060608060006100bf60048b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506103ea90919063ffffffff16565b60ff16905060008161ffff16146101be5761012e60058261ffff168c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061043b9092919063ffffffff16565b92506101b760058261014091906108eb565b61ffff1660058361ffff168d8d90506101599190610979565b6101639190610979565b8c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061043b9092919063ffffffff16565b9150610302565b61021660058b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104f690919063ffffffff16565b905061027660078261ffff168c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061043b9092919063ffffffff16565b92506102ff60078261028891906108eb565b61ffff1660078361ffff168d8d90506102a19190610979565b6102ab9190610979565b8c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061043b9092919063ffffffff16565b91505b6000606061035584868a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610525565b80925081935050508180156103d95750610385602082516103769190610979565b8261054090919063ffffffff16565b60028b8b60405161039792919061083d565b602060405180830381855afa1580156103b4573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906103d791906106f4565b145b955050505050509695505050505050565b6000828281518110610425577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b60f81c905092915050565b60608351828461044b9190610923565b111561045657600080fd5b60008267ffffffffffffffff811115610498577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156104ca5781602001600182028036833780820191505090505b50905060008060208301915085602088010190506104e982828761056b565b8293505050509392505050565b600082516002836105079190610923565b111561051257600080fd5b61ffff8260028501015116905092915050565b600060606105348385876105cf565b91509150935093915050565b600082516020836105519190610923565b111561055c57600080fd5b81602084010151905092915050565b5b602081106105aa57815183526020836105859190610923565b92506020826105949190610923565b91506020816105a39190610979565b905061056c565b60006001826020036101000a0390508019835116818551168181178652505050505050565b6000606060008551855185518888886040516020016105f396959493929190610856565b6040516020818303038152906040529050835167ffffffffffffffff811115610645577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156106775781602001600182028036833780820191505090505b50915083516020830182516020840160055afa925050935093915050565b6000815190506106a481610a56565b92915050565b60008083601f8401126106bc57600080fd5b8235905067ffffffffffffffff8111156106d557600080fd5b6020830191508360018202830111156106ed57600080fd5b9250929050565b60006020828403121561070657600080fd5b600061071484828501610695565b91505092915050565b6000806000806000806060878903121561073657600080fd5b600087013567ffffffffffffffff81111561075057600080fd5b61075c89828a016106aa565b9650965050602087013567ffffffffffffffff81111561077b57600080fd5b61078789828a016106aa565b9450945050604087013567ffffffffffffffff8111156107a657600080fd5b6107b289828a016106aa565b92509250509295509295509295565b6107ca816109ad565b82525050565b60006107dc83856108e0565b93506107e98385846109db565b82840190509392505050565b6000610800826108d5565b61080a81856108e0565b935061081a8185602086016109ea565b80840191505092915050565b610837610832826109d1565b610a1d565b82525050565b600061084a8284866107d0565b91508190509392505050565b60006108628289610826565b6020820191506108728288610826565b6020820191506108828287610826565b60208201915061089282866107f5565b915061089e82856107f5565b91506108aa82846107f5565b9150819050979650505050505050565b60006020820190506108cf60008301846107c1565b92915050565b600081519050919050565b600081905092915050565b60006108f6826109c3565b9150610901836109c3565b92508261ffff0382111561091857610917610a27565b5b828201905092915050565b600061092e826109d1565b9150610939836109d1565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561096e5761096d610a27565b5b828201905092915050565b6000610984826109d1565b915061098f836109d1565b9250828210156109a2576109a1610a27565b5b828203905092915050565b60008115159050919050565b6000819050919050565b600061ffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015610a085780820151818401526020810190506109ed565b83811115610a17576000848401525b50505050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b610a5f816109b9565b8114610a6a57600080fd5b5056fea2646970667358221220e8a3623f1ae22c54b7f4fd48d3e69f062c1f2d47656ad9b51d4eac713b8fbde864736f6c63430008040033", + "devdoc": { + "details": "Implements the DNSSEC RSASHA256 algorithm.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/ReverseRegistrar.json b/solidity/dns-contracts/deployments/ropsten/ReverseRegistrar.json new file mode 100644 index 0000000..3a83e70 --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/ReverseRegistrar.json @@ -0,0 +1,530 @@ +{ + "address": "0x806246b52f8cB61655d3038c58D2f63Aa55d4edE", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "ensAddr", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "ControllerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract NameResolver", + "name": "resolver", + "type": "address" + } + ], + "name": "DefaultResolverChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "ReverseClaimed", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "claim", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "claimForAddr", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "claimWithResolver", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "defaultResolver", + "outputs": [ + { + "internalType": "contract NameResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "node", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setDefaultResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "setName", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "setNameForAddr", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x00f69465decf0898dd365f9dce7bae84397f28383a86ca18ee082c94dac4bc88", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x806246b52f8cB61655d3038c58D2f63Aa55d4edE", + "transactionIndex": 17, + "gasUsed": "1054704", + "logsBloom": "0x00000000000000000000000000000000000040000000000000800000000000000000000000000400000000000000000000000000000010000020000040000000000000000000000000000000000000000001000000004000000000000000010000000000020000000000000000000800000000000000000000000000000000400001010000000000000000000000000004000000000000000000000000000000000000000000040000000000000000020000000000000000008000040000000000000000000000000000000000005000000000000000000000000000000020000000000000000000000000000100000000000000001000000000000000000000", + "blockHash": "0x39df004f6d24e269ccdf9688390092853d7397389ad23385680fb075480cc373", + "transactionHash": "0x00f69465decf0898dd365f9dce7bae84397f28383a86ca18ee082c94dac4bc88", + "logs": [ + { + "transactionIndex": 17, + "blockNumber": 13019106, + "transactionHash": "0x00f69465decf0898dd365f9dce7bae84397f28383a86ca18ee082c94dac4bc88", + "address": "0x806246b52f8cB61655d3038c58D2f63Aa55d4edE", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000a303ddc620aa7d1390baccc8a495508b183fab59" + ], + "data": "0x", + "logIndex": 6, + "blockHash": "0x39df004f6d24e269ccdf9688390092853d7397389ad23385680fb075480cc373" + }, + { + "transactionIndex": 17, + "blockNumber": 13019106, + "transactionHash": "0x00f69465decf0898dd365f9dce7bae84397f28383a86ca18ee082c94dac4bc88", + "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "topics": [ + "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", + "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2", + "0xa705d601e275e9718a34167361a1347d60411018bd002667dbf0344c1d5f846f" + ], + "data": "0x000000000000000000000000a303ddc620aa7d1390baccc8a495508b183fab59", + "logIndex": 7, + "blockHash": "0x39df004f6d24e269ccdf9688390092853d7397389ad23385680fb075480cc373" + } + ], + "blockNumber": 13019106, + "cumulativeGasUsed": "2256536", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "numDeployments": 1, + "solcInputHash": "a5ab15037ea2d912526c4e5696fda13f", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"ensAddr\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"ControllerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract NameResolver\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"DefaultResolverChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"ReverseClaimed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"claimForAddr\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"claimWithResolver\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"defaultResolver\",\"outputs\":[{\"internalType\":\"contract NameResolver\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"node\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setDefaultResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"setNameForAddr\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"claim(address)\":{\"details\":\"Transfers ownership of the reverse ENS record associated with the calling account.\",\"params\":{\"owner\":\"The address to set as the owner of the reverse record in ENS.\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"claimForAddr(address,address,address)\":{\"details\":\"Transfers ownership of the reverse ENS record associated with the calling account.\",\"params\":{\"addr\":\"The reverse record to set\",\"owner\":\"The address to set as the owner of the reverse record in ENS.\",\"resolver\":\"The resolver of the reverse node\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"claimWithResolver(address,address)\":{\"details\":\"Transfers ownership of the reverse ENS record associated with the calling account.\",\"params\":{\"owner\":\"The address to set as the owner of the reverse record in ENS.\",\"resolver\":\"The address of the resolver to set; 0 to leave unchanged.\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"constructor\":{\"details\":\"Constructor\",\"params\":{\"ensAddr\":\"The address of the ENS registry.\"}},\"node(address)\":{\"details\":\"Returns the node hash for a given account's reverse records.\",\"params\":{\"addr\":\"The address to hash\"},\"returns\":{\"_0\":\"The ENS node hash.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setName(string)\":{\"details\":\"Sets the `name()` record for the reverse ENS record associated with the calling account. First updates the resolver to the default reverse resolver if necessary.\",\"params\":{\"name\":\"The name to set for this address.\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"setNameForAddr(address,address,address,string)\":{\"details\":\"Sets the `name()` record for the reverse ENS record associated with the account provided. Updates the resolver to a designated resolver Only callable by controllers and authorised users\",\"params\":{\"addr\":\"The reverse record to set\",\"name\":\"The name to set for this address.\",\"owner\":\"The owner of the reverse node\",\"resolver\":\"The resolver of the reverse node\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/registry/ReverseRegistrar.sol\":\"ReverseRegistrar\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0x24e0364e503a9bbde94c715d26573a76f14cd2a202d45f96f52134ab806b67b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(address owner, address operator)\\n external\\n view\\n returns (bool);\\n}\\n\",\"keccak256\":\"0xf79be82c1a2eb0a77fba4e0972221912e803309081ca460fd2cf61653e55758a\"},\"contracts/registry/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(address owner, address resolver)\\n external\\n returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0xd6ba83973ffbab31dec17a716af3bb5703844d16dceb5078583fb2c509f8bcc2\"},\"contracts/registry/ReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"./ENS.sol\\\";\\nimport \\\"./IReverseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"../root/Controllable.sol\\\";\\n\\nabstract contract NameResolver {\\n function setName(bytes32 node, string memory name) public virtual;\\n}\\n\\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\\n\\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n// namehash('addr.reverse')\\n\\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\\n ENS public immutable ens;\\n NameResolver public defaultResolver;\\n\\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\\n event DefaultResolverChanged(NameResolver indexed resolver);\\n\\n /**\\n * @dev Constructor\\n * @param ensAddr The address of the ENS registry.\\n */\\n constructor(ENS ensAddr) {\\n ens = ensAddr;\\n\\n // Assign ownership of the reverse record to our deployer\\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\\n ensAddr.owner(ADDR_REVERSE_NODE)\\n );\\n if (address(oldRegistrar) != address(0x0)) {\\n oldRegistrar.claim(msg.sender);\\n }\\n }\\n\\n modifier authorised(address addr) {\\n require(\\n addr == msg.sender ||\\n controllers[msg.sender] ||\\n ens.isApprovedForAll(addr, msg.sender) ||\\n ownsContract(addr),\\n \\\"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\\\"\\n );\\n _;\\n }\\n\\n function setDefaultResolver(address resolver) public override onlyOwner {\\n require(\\n address(resolver) != address(0),\\n \\\"ReverseRegistrar: Resolver address must not be 0\\\"\\n );\\n defaultResolver = NameResolver(resolver);\\n emit DefaultResolverChanged(NameResolver(resolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claim(address owner) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, address(defaultResolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param addr The reverse record to set\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The resolver of the reverse node\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) public override authorised(addr) returns (bytes32) {\\n bytes32 labelHash = sha3HexAddress(addr);\\n bytes32 reverseNode = keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\\n );\\n emit ReverseClaimed(addr, reverseNode);\\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\\n return reverseNode;\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimWithResolver(address owner, address resolver)\\n public\\n override\\n returns (bytes32)\\n {\\n return claimForAddr(msg.sender, owner, resolver);\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the calling account. First updates the resolver to the default reverse\\n * resolver if necessary.\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setName(string memory name) public override returns (bytes32) {\\n return\\n setNameForAddr(\\n msg.sender,\\n msg.sender,\\n address(defaultResolver),\\n name\\n );\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the account provided. Updates the resolver to a designated resolver\\n * Only callable by controllers and authorised users\\n * @param addr The reverse record to set\\n * @param owner The owner of the reverse node\\n * @param resolver The resolver of the reverse node\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) public override returns (bytes32) {\\n bytes32 node = claimForAddr(addr, owner, resolver);\\n NameResolver(resolver).setName(node, name);\\n return node;\\n }\\n\\n /**\\n * @dev Returns the node hash for a given account's reverse records.\\n * @param addr The address to hash\\n * @return The ENS node hash.\\n */\\n function node(address addr) public pure override returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\\n );\\n }\\n\\n /**\\n * @dev An optimised function to compute the sha3 of the lower-case\\n * hexadecimal representation of an Ethereum address.\\n * @param addr The address to hash\\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\\n * input address.\\n */\\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\\n assembly {\\n for {\\n let i := 40\\n } gt(i, 0) {\\n\\n } {\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n }\\n\\n ret := keccak256(0, 40)\\n }\\n }\\n\\n function ownsContract(address addr) internal view returns (bool) {\\n try Ownable(addr).owner() returns (address owner) {\\n return owner == msg.sender;\\n } catch {\\n return false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4430930561750d2de1163f7b7ba22ae003a7684394371e90a04374859a2337cf\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"}},\"version\":1}", + "bytecode": "0x60a06040523480156200001157600080fd5b50604051620012f1380380620012f18339810160408190526200003491620001c4565b6200003f336200015b565b6001600160a01b03811660808190526040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152600091906302571be390602401602060405180830381865afa158015620000ac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000d29190620001c4565b90506001600160a01b038116156200015357604051630f41a04d60e11b81523360048201526001600160a01b03821690631e83409a906024016020604051808303816000875af11580156200012b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001519190620001eb565b505b505062000205565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114620001c157600080fd5b50565b600060208284031215620001d757600080fd5b8151620001e481620001ab565b9392505050565b600060208284031215620001fe57600080fd5b5051919050565b6080516110c26200022f6000396000818161012d0152818161033e015261058901526110c26000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063c66485b211610066578063c66485b214610208578063da8c229e1461021b578063e0dba60f1461024e578063f2fde38b1461026157600080fd5b80638da5cb5b146101c4578063bffbe61c146101e2578063c47f0027146101f557600080fd5b806365669631116100c85780636566963114610174578063715018a6146101875780637a806d6b14610191578063828eab0e146101a457600080fd5b80630f5a5466146100ef5780631e83409a146101155780633f15457f14610128575b600080fd5b6101026100fd366004610d75565b610274565b6040519081526020015b60405180910390f35b610102610123366004610dae565b610288565b61014f7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161010c565b610102610182366004610dcb565b6102b7565b61018f6105f0565b005b61010261019f366004610ef0565b61067d565b60025461014f9073ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1661014f565b6101026101f0366004610dae565b61071e565b610102610203366004610f65565b610779565b61018f610216366004610dae565b6107a3565b61023e610229366004610dae565b60016020526000908152604090205460ff1681565b604051901515815260200161010c565b61018f61025c366004610fb0565b610936565b61018f61026f366004610dae565b610a41565b60006102813384846102b7565b9392505050565b6002546000906102b1903390849073ffffffffffffffffffffffffffffffffffffffff166102b7565b92915050565b60008373ffffffffffffffffffffffffffffffffffffffff81163314806102ed57503360009081526001602052604090205460ff165b806103a957506040517fe985e9c500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a99190610fde565b806103b857506103b881610b71565b61046f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152605b60248201527f526576657273655265676973747261723a2043616c6c6572206973206e6f742060448201527f6120636f6e74726f6c6c6572206f7220617574686f726973656420627920616460648201527f6472657373206f7220746865206164647265737320697473656c660000000000608482015260a4015b60405180910390fd5b600061047a86610c22565b604080517f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26020808301919091528183018490528251808303840181526060909201928390528151910120919250819073ffffffffffffffffffffffffffffffffffffffff8916907f6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e9290600090a36040517f5ef2c7f00000000000000000000000000000000000000000000000000000000081527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e260048201526024810183905273ffffffffffffffffffffffffffffffffffffffff87811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156105cd57600080fd5b505af11580156105e1573d6000803e3d6000fd5b50929998505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610671576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610466565b61067b6000610cde565b565b60008061068b8686866102b7565b6040517f7737221300000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff8516906377372213906106e29084908790600401610ffb565b600060405180830381600087803b1580156106fc57600080fd5b505af1158015610710573d6000803e3d6000fd5b509298975050505050505050565b60007f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e261074a83610c22565b604080516020810193909352820152606001604051602081830303815290604052805190602001209050919050565b6002546000906102b1903390819073ffffffffffffffffffffffffffffffffffffffff168561067d565b60005473ffffffffffffffffffffffffffffffffffffffff163314610824576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610466565b73ffffffffffffffffffffffffffffffffffffffff81166108c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f526576657273655265676973747261723a205265736f6c76657220616464726560448201527f7373206d757374206e6f742062652030000000000000000000000000000000006064820152608401610466565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517feae17a84d9eb83d8c8eb317f9e7d64857bc363fa51674d996c023f4340c577cf90600090a250565b60005473ffffffffffffffffffffffffffffffffffffffff1633146109b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610466565b73ffffffffffffffffffffffffffffffffffffffff821660008181526001602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ac2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610466565b73ffffffffffffffffffffffffffffffffffffffff8116610b65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610466565b610b6e81610cde565b50565b60008173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610bf8575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252610bf59181019061106f565b60015b610c0457506000919050565b73ffffffffffffffffffffffffffffffffffffffff16331492915050565b600060285b8015610cd2577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff017f3031323334353637383961626364656600000000000000000000000000000000600f84161a81536010909204917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff017f3031323334353637383961626364656600000000000000000000000000000000600f84161a8153601083049250610c27565b50506028600020919050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff81168114610b6e57600080fd5b60008060408385031215610d8857600080fd5b8235610d9381610d53565b91506020830135610da381610d53565b809150509250929050565b600060208284031215610dc057600080fd5b813561028181610d53565b600080600060608486031215610de057600080fd5b8335610deb81610d53565b92506020840135610dfb81610d53565b91506040840135610e0b81610d53565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112610e5657600080fd5b813567ffffffffffffffff80821115610e7157610e71610e16565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715610eb757610eb7610e16565b81604052838152866020858801011115610ed057600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060808587031215610f0657600080fd5b8435610f1181610d53565b93506020850135610f2181610d53565b92506040850135610f3181610d53565b9150606085013567ffffffffffffffff811115610f4d57600080fd5b610f5987828801610e45565b91505092959194509250565b600060208284031215610f7757600080fd5b813567ffffffffffffffff811115610f8e57600080fd5b610f9a84828501610e45565b949350505050565b8015158114610b6e57600080fd5b60008060408385031215610fc357600080fd5b8235610fce81610d53565b91506020830135610da381610fa2565b600060208284031215610ff057600080fd5b815161028181610fa2565b82815260006020604081840152835180604085015260005b8181101561102f57858101830151858201606001528201611013565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f830116850101925050509392505050565b60006020828403121561108157600080fd5b815161028181610d5356fea264697066735822122030f8ee7d282ef64d328e7804deeb2da69cb552c7cd254f7f899b8afc6a03042664736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063c66485b211610066578063c66485b214610208578063da8c229e1461021b578063e0dba60f1461024e578063f2fde38b1461026157600080fd5b80638da5cb5b146101c4578063bffbe61c146101e2578063c47f0027146101f557600080fd5b806365669631116100c85780636566963114610174578063715018a6146101875780637a806d6b14610191578063828eab0e146101a457600080fd5b80630f5a5466146100ef5780631e83409a146101155780633f15457f14610128575b600080fd5b6101026100fd366004610d75565b610274565b6040519081526020015b60405180910390f35b610102610123366004610dae565b610288565b61014f7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161010c565b610102610182366004610dcb565b6102b7565b61018f6105f0565b005b61010261019f366004610ef0565b61067d565b60025461014f9073ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1661014f565b6101026101f0366004610dae565b61071e565b610102610203366004610f65565b610779565b61018f610216366004610dae565b6107a3565b61023e610229366004610dae565b60016020526000908152604090205460ff1681565b604051901515815260200161010c565b61018f61025c366004610fb0565b610936565b61018f61026f366004610dae565b610a41565b60006102813384846102b7565b9392505050565b6002546000906102b1903390849073ffffffffffffffffffffffffffffffffffffffff166102b7565b92915050565b60008373ffffffffffffffffffffffffffffffffffffffff81163314806102ed57503360009081526001602052604090205460ff165b806103a957506040517fe985e9c500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a99190610fde565b806103b857506103b881610b71565b61046f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152605b60248201527f526576657273655265676973747261723a2043616c6c6572206973206e6f742060448201527f6120636f6e74726f6c6c6572206f7220617574686f726973656420627920616460648201527f6472657373206f7220746865206164647265737320697473656c660000000000608482015260a4015b60405180910390fd5b600061047a86610c22565b604080517f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26020808301919091528183018490528251808303840181526060909201928390528151910120919250819073ffffffffffffffffffffffffffffffffffffffff8916907f6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e9290600090a36040517f5ef2c7f00000000000000000000000000000000000000000000000000000000081527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e260048201526024810183905273ffffffffffffffffffffffffffffffffffffffff87811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156105cd57600080fd5b505af11580156105e1573d6000803e3d6000fd5b50929998505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610671576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610466565b61067b6000610cde565b565b60008061068b8686866102b7565b6040517f7737221300000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff8516906377372213906106e29084908790600401610ffb565b600060405180830381600087803b1580156106fc57600080fd5b505af1158015610710573d6000803e3d6000fd5b509298975050505050505050565b60007f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e261074a83610c22565b604080516020810193909352820152606001604051602081830303815290604052805190602001209050919050565b6002546000906102b1903390819073ffffffffffffffffffffffffffffffffffffffff168561067d565b60005473ffffffffffffffffffffffffffffffffffffffff163314610824576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610466565b73ffffffffffffffffffffffffffffffffffffffff81166108c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f526576657273655265676973747261723a205265736f6c76657220616464726560448201527f7373206d757374206e6f742062652030000000000000000000000000000000006064820152608401610466565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517feae17a84d9eb83d8c8eb317f9e7d64857bc363fa51674d996c023f4340c577cf90600090a250565b60005473ffffffffffffffffffffffffffffffffffffffff1633146109b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610466565b73ffffffffffffffffffffffffffffffffffffffff821660008181526001602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ac2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610466565b73ffffffffffffffffffffffffffffffffffffffff8116610b65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610466565b610b6e81610cde565b50565b60008173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610bf8575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252610bf59181019061106f565b60015b610c0457506000919050565b73ffffffffffffffffffffffffffffffffffffffff16331492915050565b600060285b8015610cd2577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff017f3031323334353637383961626364656600000000000000000000000000000000600f84161a81536010909204917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff017f3031323334353637383961626364656600000000000000000000000000000000600f84161a8153601083049250610c27565b50506028600020919050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff81168114610b6e57600080fd5b60008060408385031215610d8857600080fd5b8235610d9381610d53565b91506020830135610da381610d53565b809150509250929050565b600060208284031215610dc057600080fd5b813561028181610d53565b600080600060608486031215610de057600080fd5b8335610deb81610d53565b92506020840135610dfb81610d53565b91506040840135610e0b81610d53565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112610e5657600080fd5b813567ffffffffffffffff80821115610e7157610e71610e16565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715610eb757610eb7610e16565b81604052838152866020858801011115610ed057600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060808587031215610f0657600080fd5b8435610f1181610d53565b93506020850135610f2181610d53565b92506040850135610f3181610d53565b9150606085013567ffffffffffffffff811115610f4d57600080fd5b610f5987828801610e45565b91505092959194509250565b600060208284031215610f7757600080fd5b813567ffffffffffffffff811115610f8e57600080fd5b610f9a84828501610e45565b949350505050565b8015158114610b6e57600080fd5b60008060408385031215610fc357600080fd5b8235610fce81610d53565b91506020830135610da381610fa2565b600060208284031215610ff057600080fd5b815161028181610fa2565b82815260006020604081840152835180604085015260005b8181101561102f57858101830151858201606001528201611013565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f830116850101925050509392505050565b60006020828403121561108157600080fd5b815161028181610d5356fea264697066735822122030f8ee7d282ef64d328e7804deeb2da69cb552c7cd254f7f899b8afc6a03042664736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "claim(address)": { + "details": "Transfers ownership of the reverse ENS record associated with the calling account.", + "params": { + "owner": "The address to set as the owner of the reverse record in ENS." + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "claimForAddr(address,address,address)": { + "details": "Transfers ownership of the reverse ENS record associated with the calling account.", + "params": { + "addr": "The reverse record to set", + "owner": "The address to set as the owner of the reverse record in ENS.", + "resolver": "The resolver of the reverse node" + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "claimWithResolver(address,address)": { + "details": "Transfers ownership of the reverse ENS record associated with the calling account.", + "params": { + "owner": "The address to set as the owner of the reverse record in ENS.", + "resolver": "The address of the resolver to set; 0 to leave unchanged." + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "constructor": { + "details": "Constructor", + "params": { + "ensAddr": "The address of the ENS registry." + } + }, + "node(address)": { + "details": "Returns the node hash for a given account's reverse records.", + "params": { + "addr": "The address to hash" + }, + "returns": { + "_0": "The ENS node hash." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "setName(string)": { + "details": "Sets the `name()` record for the reverse ENS record associated with the calling account. First updates the resolver to the default reverse resolver if necessary.", + "params": { + "name": "The name to set for this address." + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "setNameForAddr(address,address,address,string)": { + "details": "Sets the `name()` record for the reverse ENS record associated with the account provided. Updates the resolver to a designated resolver Only callable by controllers and authorised users", + "params": { + "addr": "The reverse record to set", + "name": "The name to set for this address.", + "owner": "The owner of the reverse node", + "resolver": "The resolver of the reverse node" + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 545, + "contract": "contracts/registry/ReverseRegistrar.sol:ReverseRegistrar", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 15518, + "contract": "contracts/registry/ReverseRegistrar.sol:ReverseRegistrar", + "label": "controllers", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 12919, + "contract": "contracts/registry/ReverseRegistrar.sol:ReverseRegistrar", + "label": "defaultResolver", + "offset": 0, + "slot": "2", + "type": "t_contract(NameResolver)12901" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(NameResolver)12901": { + "encoding": "inplace", + "label": "contract NameResolver", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/Root.json b/solidity/dns-contracts/deployments/ropsten/Root.json new file mode 100644 index 0000000..eaa5b0c --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/Root.json @@ -0,0 +1,362 @@ +{ + "address": "0x31e789Eb325aB116997942f7809731197a3dc059", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "ControllerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + } + ], + "name": "TLDLocked", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + } + ], + "name": "lock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "locked", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xc3437c766e475166db108bb1da1aa6b2763eaebb63c7d6e3cd26f98ef246d7c0", + "receipt": { + "to": null, + "from": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "contractAddress": "0x8B2760811Eb2CAf088F2Aa0AF654534Be2Ddf1Cc", + "transactionIndex": 0, + "gasUsed": "970135", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000100000800000000000000000000000000000000400000008000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000002000000000000000000020000000000000000000000000000000000000000008000000000000000000000000", + "blockHash": "0x5c926fa5b9b02373fbbb3879f79a74837a584c9196492960347ec055daed8764", + "transactionHash": "0xc3437c766e475166db108bb1da1aa6b2763eaebb63c7d6e3cd26f98ef246d7c0", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 10645548, + "transactionHash": "0xc3437c766e475166db108bb1da1aa6b2763eaebb63c7d6e3cd26f98ef246d7c0", + "address": "0x8B2760811Eb2CAf088F2Aa0AF654534Be2Ddf1Cc", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x5c926fa5b9b02373fbbb3879f79a74837a584c9196492960347ec055daed8764" + } + ], + "blockNumber": 10645548, + "cumulativeGasUsed": "970135", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "solcInputHash": "a50cca78b1bed5d39e9ebe70f5371ee9", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"ControllerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"}],\"name\":\"TLDLocked\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"}],\"name\":\"lock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"locked\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setSubnodeOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/root/Root.sol\":\"Root\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x1cae4f85f114ff17b90414f5da67365b1d00337abb5bce9bf944eb78a2c0673c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xf930d2df426bfcfc1f7415be724f04081c96f4fb9ec8d0e3a521c07692dface0\",\"license\":\"MIT\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual;\\n function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual;\\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external virtual returns(bytes32);\\n function setResolver(bytes32 node, address resolver) external virtual;\\n function setOwner(bytes32 node, address owner) external virtual;\\n function setTTL(bytes32 node, uint64 ttl) external virtual;\\n function setApprovalForAll(address operator, bool approved) external virtual;\\n function owner(bytes32 node) external virtual view returns (address);\\n function resolver(bytes32 node) external virtual view returns (address);\\n function ttl(bytes32 node) external virtual view returns (uint64);\\n function recordExists(bytes32 node) external virtual view returns (bool);\\n function isApprovedForAll(address owner, address operator) external virtual view returns (bool);\\n}\\n\",\"keccak256\":\"0x942ef29bd7c0f62228aeb91879ddd1ba101f52a2162970d3e48adffa498f4483\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0x0c364a5b65b6fff279adbe1fd6498c488feabeec781599cd60a5844e80ee7d88\"},\"contracts/root/Root.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"./Controllable.sol\\\";\\n\\ncontract Root is Ownable, Controllable {\\n bytes32 private constant ROOT_NODE = bytes32(0);\\n\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n\\n event TLDLocked(bytes32 indexed label);\\n\\n ENS public ens;\\n mapping(bytes32 => bool) public locked;\\n\\n constructor(ENS _ens) public {\\n ens = _ens;\\n }\\n\\n function setSubnodeOwner(bytes32 label, address owner)\\n external\\n onlyController\\n {\\n require(!locked[label]);\\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\\n }\\n\\n function setResolver(address resolver) external onlyOwner {\\n ens.setResolver(ROOT_NODE, resolver);\\n }\\n\\n function lock(bytes32 label) external onlyOwner {\\n emit TLDLocked(label);\\n locked[label] = true;\\n }\\n\\n function supportsInterface(bytes4 interfaceID)\\n external\\n pure\\n returns (bool)\\n {\\n return interfaceID == INTERFACE_META_ID;\\n }\\n}\\n\",\"keccak256\":\"0xf6fed46bbdc8a425d112c473a649045148b2e0404647c97590d2a3e2798c9fe3\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506040516200119b3803806200119b83398181016040528101906200003791906200014e565b6000620000496200012f60201b60201c565b9050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050620001dc565b600033905090565b6000815190506200014881620001c2565b92915050565b6000602082840312156200016157600080fd5b6000620001718482850162000137565b91505092915050565b60006200018782620001a2565b9050919050565b60006200019b826200017a565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b620001cd816200018e565b8114620001d957600080fd5b50565b610faf80620001ec6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80638cb8ecec116100715780638cb8ecec1461013e5780638da5cb5b1461015a578063cbe9e76414610178578063da8c229e146101a8578063e0dba60f146101d8578063f2fde38b146101f4576100a9565b806301670ba9146100ae57806301ffc9a7146100ca5780633f15457f146100fa5780634e543b2614610118578063715018a614610134575b600080fd5b6100c860048036038101906100c39190610b40565b610210565b005b6100e460048036038101906100df9190610bce565b6102e8565b6040516100f19190610cb7565b60405180910390f35b610102610352565b60405161010f9190610d32565b60405180910390f35b610132600480360381019061012d9190610adb565b610378565b005b61013c610489565b005b61015860048036038101906101539190610b92565b6105c3565b005b610162610733565b60405161016f9190610c9c565b60405180910390f35b610192600480360381019061018d9190610b40565b61075c565b60405161019f9190610cb7565b60405180910390f35b6101c260048036038101906101bd9190610adb565b61077c565b6040516101cf9190610cb7565b60405180910390f35b6101f260048036038101906101ed9190610b04565b61079c565b005b61020e60048036038101906102099190610adb565b6108c1565b005b610218610a6a565b73ffffffffffffffffffffffffffffffffffffffff16610236610733565b73ffffffffffffffffffffffffffffffffffffffff161461028c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161028390610d8d565b60405180910390fd5b807f1764176cfa565853ba1ded547a830a9f9bff95231ef6fd228b3ddd617577756960405160405180910390a260016003600083815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60007f01ffc9a7a5cef8baa21ed3c5c0d7e23accb804b619e9333b597f47a0d84076e27bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610380610a6a565b73ffffffffffffffffffffffffffffffffffffffff1661039e610733565b73ffffffffffffffffffffffffffffffffffffffff16146103f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103eb90610d8d565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631896f70a6000801b836040518363ffffffff1660e01b8152600401610454929190610cd2565b600060405180830381600087803b15801561046e57600080fd5b505af1158015610482573d6000803e3d6000fd5b5050505050565b610491610a6a565b73ffffffffffffffffffffffffffffffffffffffff166104af610733565b73ffffffffffffffffffffffffffffffffffffffff1614610505576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104fc90610d8d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661064f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161064690610d6d565b60405180910390fd5b6003600083815260200190815260200160002060009054906101000a900460ff161561067a57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166306ab59236000801b84846040518463ffffffff1660e01b81526004016106dc93929190610cfb565b602060405180830381600087803b1580156106f657600080fd5b505af115801561070a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072e9190610b69565b505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60036020528060005260406000206000915054906101000a900460ff1681565b60016020528060005260406000206000915054906101000a900460ff1681565b6107a4610a6a565b73ffffffffffffffffffffffffffffffffffffffff166107c2610733565b73ffffffffffffffffffffffffffffffffffffffff1614610818576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080f90610d8d565b60405180910390fd5b80600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87826040516108b59190610cb7565b60405180910390a25050565b6108c9610a6a565b73ffffffffffffffffffffffffffffffffffffffff166108e7610733565b73ffffffffffffffffffffffffffffffffffffffff161461093d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093490610d8d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156109ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a490610d4d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600081359050610a8181610f1d565b92915050565b600081359050610a9681610f34565b92915050565b600081359050610aab81610f4b565b92915050565b600081519050610ac081610f4b565b92915050565b600081359050610ad581610f62565b92915050565b600060208284031215610aed57600080fd5b6000610afb84828501610a72565b91505092915050565b60008060408385031215610b1757600080fd5b6000610b2585828601610a72565b9250506020610b3685828601610a87565b9150509250929050565b600060208284031215610b5257600080fd5b6000610b6084828501610a9c565b91505092915050565b600060208284031215610b7b57600080fd5b6000610b8984828501610ab1565b91505092915050565b60008060408385031215610ba557600080fd5b6000610bb385828601610a9c565b9250506020610bc485828601610a72565b9150509250929050565b600060208284031215610be057600080fd5b6000610bee84828501610ac6565b91505092915050565b610c0081610dbe565b82525050565b610c0f81610dd0565b82525050565b610c1e81610ddc565b82525050565b610c2d81610e32565b82525050565b6000610c40602683610dad565b9150610c4b82610e56565b604082019050919050565b6000610c63602883610dad565b9150610c6e82610ea5565b604082019050919050565b6000610c86602083610dad565b9150610c9182610ef4565b602082019050919050565b6000602082019050610cb16000830184610bf7565b92915050565b6000602082019050610ccc6000830184610c06565b92915050565b6000604082019050610ce76000830185610c15565b610cf46020830184610bf7565b9392505050565b6000606082019050610d106000830186610c15565b610d1d6020830185610c15565b610d2a6040830184610bf7565b949350505050565b6000602082019050610d476000830184610c24565b92915050565b60006020820190508181036000830152610d6681610c33565b9050919050565b60006020820190508181036000830152610d8681610c56565b9050919050565b60006020820190508181036000830152610da681610c79565b9050919050565b600082825260208201905092915050565b6000610dc982610e12565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610e3d82610e44565b9050919050565b6000610e4f82610e12565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f60008201527f6e74726f6c6c6572000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b610f2681610dbe565b8114610f3157600080fd5b50565b610f3d81610dd0565b8114610f4857600080fd5b50565b610f5481610ddc565b8114610f5f57600080fd5b50565b610f6b81610de6565b8114610f7657600080fd5b5056fea26469706673582212205e697f39b3f6ec0e2f53ccf2db1bb39804cfe7b19856f913dbb6b3a50b993e8264736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80638cb8ecec116100715780638cb8ecec1461013e5780638da5cb5b1461015a578063cbe9e76414610178578063da8c229e146101a8578063e0dba60f146101d8578063f2fde38b146101f4576100a9565b806301670ba9146100ae57806301ffc9a7146100ca5780633f15457f146100fa5780634e543b2614610118578063715018a614610134575b600080fd5b6100c860048036038101906100c39190610b40565b610210565b005b6100e460048036038101906100df9190610bce565b6102e8565b6040516100f19190610cb7565b60405180910390f35b610102610352565b60405161010f9190610d32565b60405180910390f35b610132600480360381019061012d9190610adb565b610378565b005b61013c610489565b005b61015860048036038101906101539190610b92565b6105c3565b005b610162610733565b60405161016f9190610c9c565b60405180910390f35b610192600480360381019061018d9190610b40565b61075c565b60405161019f9190610cb7565b60405180910390f35b6101c260048036038101906101bd9190610adb565b61077c565b6040516101cf9190610cb7565b60405180910390f35b6101f260048036038101906101ed9190610b04565b61079c565b005b61020e60048036038101906102099190610adb565b6108c1565b005b610218610a6a565b73ffffffffffffffffffffffffffffffffffffffff16610236610733565b73ffffffffffffffffffffffffffffffffffffffff161461028c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161028390610d8d565b60405180910390fd5b807f1764176cfa565853ba1ded547a830a9f9bff95231ef6fd228b3ddd617577756960405160405180910390a260016003600083815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60007f01ffc9a7a5cef8baa21ed3c5c0d7e23accb804b619e9333b597f47a0d84076e27bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610380610a6a565b73ffffffffffffffffffffffffffffffffffffffff1661039e610733565b73ffffffffffffffffffffffffffffffffffffffff16146103f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103eb90610d8d565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631896f70a6000801b836040518363ffffffff1660e01b8152600401610454929190610cd2565b600060405180830381600087803b15801561046e57600080fd5b505af1158015610482573d6000803e3d6000fd5b5050505050565b610491610a6a565b73ffffffffffffffffffffffffffffffffffffffff166104af610733565b73ffffffffffffffffffffffffffffffffffffffff1614610505576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104fc90610d8d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661064f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161064690610d6d565b60405180910390fd5b6003600083815260200190815260200160002060009054906101000a900460ff161561067a57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166306ab59236000801b84846040518463ffffffff1660e01b81526004016106dc93929190610cfb565b602060405180830381600087803b1580156106f657600080fd5b505af115801561070a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072e9190610b69565b505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60036020528060005260406000206000915054906101000a900460ff1681565b60016020528060005260406000206000915054906101000a900460ff1681565b6107a4610a6a565b73ffffffffffffffffffffffffffffffffffffffff166107c2610733565b73ffffffffffffffffffffffffffffffffffffffff1614610818576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080f90610d8d565b60405180910390fd5b80600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87826040516108b59190610cb7565b60405180910390a25050565b6108c9610a6a565b73ffffffffffffffffffffffffffffffffffffffff166108e7610733565b73ffffffffffffffffffffffffffffffffffffffff161461093d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093490610d8d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156109ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a490610d4d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600081359050610a8181610f1d565b92915050565b600081359050610a9681610f34565b92915050565b600081359050610aab81610f4b565b92915050565b600081519050610ac081610f4b565b92915050565b600081359050610ad581610f62565b92915050565b600060208284031215610aed57600080fd5b6000610afb84828501610a72565b91505092915050565b60008060408385031215610b1757600080fd5b6000610b2585828601610a72565b9250506020610b3685828601610a87565b9150509250929050565b600060208284031215610b5257600080fd5b6000610b6084828501610a9c565b91505092915050565b600060208284031215610b7b57600080fd5b6000610b8984828501610ab1565b91505092915050565b60008060408385031215610ba557600080fd5b6000610bb385828601610a9c565b9250506020610bc485828601610a72565b9150509250929050565b600060208284031215610be057600080fd5b6000610bee84828501610ac6565b91505092915050565b610c0081610dbe565b82525050565b610c0f81610dd0565b82525050565b610c1e81610ddc565b82525050565b610c2d81610e32565b82525050565b6000610c40602683610dad565b9150610c4b82610e56565b604082019050919050565b6000610c63602883610dad565b9150610c6e82610ea5565b604082019050919050565b6000610c86602083610dad565b9150610c9182610ef4565b602082019050919050565b6000602082019050610cb16000830184610bf7565b92915050565b6000602082019050610ccc6000830184610c06565b92915050565b6000604082019050610ce76000830185610c15565b610cf46020830184610bf7565b9392505050565b6000606082019050610d106000830186610c15565b610d1d6020830185610c15565b610d2a6040830184610bf7565b949350505050565b6000602082019050610d476000830184610c24565b92915050565b60006020820190508181036000830152610d6681610c33565b9050919050565b60006020820190508181036000830152610d8681610c56565b9050919050565b60006020820190508181036000830152610da681610c79565b9050919050565b600082825260208201905092915050565b6000610dc982610e12565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610e3d82610e44565b9050919050565b6000610e4f82610e12565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f60008201527f6e74726f6c6c6572000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b610f2681610dbe565b8114610f3157600080fd5b50565b610f3d81610dd0565b8114610f4857600080fd5b50565b610f5481610ddc565b8114610f5f57600080fd5b50565b610f6b81610de6565b8114610f7657600080fd5b5056fea26469706673582212205e697f39b3f6ec0e2f53ccf2db1bb39804cfe7b19856f913dbb6b3a50b993e8264736f6c63430008040033", + "devdoc": { + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 545, + "contract": "contracts/root/Root.sol:Root", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 15162, + "contract": "contracts/root/Root.sol:Root", + "label": "controllers", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 15292, + "contract": "contracts/root/Root.sol:Root", + "label": "ens", + "offset": 0, + "slot": "2", + "type": "t_contract(ENS)11959" + }, + { + "astId": 15296, + "contract": "contracts/root/Root.sol:Root", + "label": "locked", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_bytes32,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(ENS)11959": { + "encoding": "inplace", + "label": "contract ENS", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_bytes32,t_bool)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/SHA1Digest.json b/solidity/dns-contracts/deployments/ropsten/SHA1Digest.json new file mode 100644 index 0000000..7c2a9fa --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/SHA1Digest.json @@ -0,0 +1,76 @@ +{ + "address": "0xBE47e4dD84429B8702D7BfBe4dAB2018B3809821", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0xa8a9641d4d7aa8bce713206db7a5c69bf6b6f28cbcc274943f6c06f71d4bda2b", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0xBE47e4dD84429B8702D7BfBe4dAB2018B3809821", + "transactionIndex": 1, + "gasUsed": "553061", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x2e4a5078cac58c0defd0281b4fd4fa70f49e5d2ca90de4290deb34917e6e9942", + "transactionHash": "0xa8a9641d4d7aa8bce713206db7a5c69bf6b6f28cbcc274943f6c06f71d4bda2b", + "logs": [], + "blockNumber": 10645998, + "cumulativeGasUsed": "3338939", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "424cfdf012b9aa11d2e839569d49524c", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC SHA1 digest.\",\"kind\":\"dev\",\"methods\":{\"verify(bytes,bytes)\":{\"details\":\"Verifies a cryptographic hash.\",\"params\":{\"data\":\"The data to hash.\",\"hash\":\"The hash to compare to.\"},\"returns\":{\"_0\":\"True iff the hashed data matches the provided hash value.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/digests/SHA1Digest.sol\":\"SHA1Digest\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@ensdomains/solsha1/contracts/SHA1.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary SHA1 {\\n event Debug(bytes32 x);\\n\\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\\n assembly {\\n // Get a safe scratch location\\n let scratch := mload(0x40)\\n\\n // Get the data length, and point data at the first byte\\n let len := mload(data)\\n data := add(data, 32)\\n\\n // Find the length after padding\\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\\n switch lt(sub(totallen, len), 9)\\n case 1 { totallen := add(totallen, 64) }\\n\\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\\n\\n function readword(ptr, off, count) -> result {\\n result := 0\\n if lt(off, count) {\\n result := mload(add(ptr, off))\\n count := sub(count, off)\\n if lt(count, 32) {\\n let mask := not(sub(exp(256, sub(32, count)), 1))\\n result := and(result, mask)\\n }\\n }\\n }\\n\\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\\n mstore(scratch, readword(data, i, len))\\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\\n\\n // If we loaded the last byte, store the terminator byte\\n switch lt(sub(len, i), 64)\\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\\n\\n // If this is the last block, store the length\\n switch eq(i, sub(totallen, 64))\\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\\n\\n // Expand the 16 32-bit words into 80\\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\\n mstore(add(scratch, j), temp)\\n }\\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\\n mstore(add(scratch, j), temp)\\n }\\n\\n let x := h\\n let f := 0\\n let k := 0\\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\\n switch div(j, 20)\\n case 0 {\\n // f = d xor (b and (c xor d))\\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\\n f := and(div(x, 0x1000000000000000000000000000000), f)\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x5A827999\\n }\\n case 1{\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x6ED9EBA1\\n }\\n case 2 {\\n // f = (b and c) or (d and (b or c))\\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := and(div(x, 0x10000000000), f)\\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\\n k := 0x8F1BBCDC\\n }\\n case 3 {\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0xCA62C1D6\\n }\\n // temp = (a leftrotate 5) + f + e + k + w[i]\\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\\n temp := add(f, temp)\\n temp := add(and(x, 0xFFFFFFFF), temp)\\n temp := add(k, temp)\\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\\n }\\n\\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\\n }\\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x746d9b85de197afbc13182cbe4ba4f7917f19594e07c655d6a0c85fdf7460a8a\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\\n uint shortest = len;\\n if (otherlen < len)\\n shortest = otherlen;\\n\\n uint selfptr;\\n uint otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint idx = 0; idx < shortest; idx += 32) {\\n uint a;\\n uint b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint mask;\\n if (shortest > 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\\n }\\n int diff = int(a & mask) - int(b & mask);\\n if (diff != 0)\\n return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int(len) - int(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\\n return self.length == other.length && equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint dest, uint src, uint len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint dest;\\n uint src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\\n require(len <= 52);\\n\\n uint ret = 0;\\n uint8 decoded;\\n for(uint i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if(i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint bitlen = len * 5;\\n if(len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if(len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if(len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if(len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if(len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n}\",\"keccak256\":\"0x83315df2e54c74451577c70da2c267c3459802b08b9aeec6516302eee70f796e\"},\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev An interface for contracts implementing a DNSSEC digest.\\n*/\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(bytes calldata data, bytes calldata hash) external virtual pure returns (bool);\\n}\\n\",\"keccak256\":\"0x259720cef78c019d38b908bc7dd524f087c58d8c40792cebcdd4e982c628bc9a\"},\"contracts/dnssec-oracle/digests/SHA1Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Digest.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"@ensdomains/solsha1/contracts/SHA1.sol\\\";\\n\\n/**\\n* @dev Implements the DNSSEC SHA1 digest.\\n*/\\ncontract SHA1Digest is Digest {\\n using BytesUtils for *;\\n\\n function verify(bytes calldata data, bytes calldata hash) external override pure returns (bool) {\\n require(hash.length == 20, \\\"Invalid sha1 hash length\\\");\\n bytes32 expected = hash.readBytes20(0);\\n bytes20 computed = SHA1.sha1(data);\\n return expected == computed;\\n }\\n}\\n\",\"keccak256\":\"0xe22a081f2622e2bf3e532dba60c18d01914db3945767362be9b504b07c0c9e1d\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610924806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004a60048036038101906100459190610737565b610060565b60405161005791906107de565b60405180910390f35b6000601483839050146100a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009f906107f9565b60405180910390fd5b6000610102600085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061018290919063ffffffff16565b6bffffffffffffffffffffffff19169050600061016287878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506101cf565b9050806bffffffffffffffffffffffff1916821492505050949350505050565b60008251601483610193919061082a565b111561019e57600080fd5b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008260208501015116905092915050565b60006040518251602084019350604067ffffffffffffffc06001830116016009828203106001811461020057610207565b6040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f061025f565b6000838310156102585782820151905082840393506020841015610257576001846020036101000a03198082169150505b5b9392505050565b60005b8281101561066d57610275848289610226565b8552610285846020830189610226565b60208601526040818503106001811461029d576102a6565b60808286038701535b50604083038114600181146102ba576102ca565b6008850260208701511760208701525b5060405b60808110156103565760408103860151603882038701511860208203870151600c830388015118187c010000000100000001000000010000000100000001000000010000000163800000008204167ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe6002830216179050808288015250600c810190506102ce565b5060805b6101408110156103e357608081038601516070820387015118604082038701516018830388015118187c030000000300000003000000030000000300000003000000030000000363400000008204167ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc600483021617905080828801525060188101905061035a565b508160008060005b605081101561063f57601481046000811461041d576001811461046757600281146104a4576003811461050757610540565b6501000000000085046a01000000000000000000008604189350836f01000000000000000000000000000000860416935083650100000000008604189350635a8279999250610540565b6a010000000000000000000085046f01000000000000000000000000000000860418935083650100000000008604189350636ed9eba19250610540565b6a010000000000000000000085046f01000000000000000000000000000000860417935083650100000000008604169350836a010000000000000000000086046f01000000000000000000000000000000870416179350638f1bbcdc9250610540565b6a010000000000000000000085046f0100000000000000000000000000000086041893508365010000000000860418935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c0151040190507401000000000000000000000000000000000000000081026501000000000086041794506a0100000000000000000000633fffffff6a040000000000000000000087041663c00000006604000000000000880416170277ffffffff00ffffffff000000000000ffffffff00ffffffff8616179450506001810190506103eb565b5077ffffffff00ffffffff00ffffffff00ffffffff00ffffffff838601169450505050604081019050610262565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b60008083601f8401126106ff57600080fd5b8235905067ffffffffffffffff81111561071857600080fd5b60208301915083600182028301111561073057600080fd5b9250929050565b6000806000806040858703121561074d57600080fd5b600085013567ffffffffffffffff81111561076757600080fd5b610773878288016106ed565b9450945050602085013567ffffffffffffffff81111561079257600080fd5b61079e878288016106ed565b925092505092959194509250565b6107b581610880565b82525050565b60006107c8601883610819565b91506107d3826108c5565b602082019050919050565b60006020820190506107f360008301846107ac565b92915050565b60006020820190508181036000830152610812816107bb565b9050919050565b600082825260208201905092915050565b60006108358261088c565b91506108408361088c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561087557610874610896565b5b828201905092915050565b60008115159050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f496e76616c696420736861312068617368206c656e677468000000000000000060008201525056fea2646970667358221220bb4464cdaaa81739af0648c949149178d7f2a1221866db1adee1843295a2783864736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004a60048036038101906100459190610737565b610060565b60405161005791906107de565b60405180910390f35b6000601483839050146100a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009f906107f9565b60405180910390fd5b6000610102600085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061018290919063ffffffff16565b6bffffffffffffffffffffffff19169050600061016287878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506101cf565b9050806bffffffffffffffffffffffff1916821492505050949350505050565b60008251601483610193919061082a565b111561019e57600080fd5b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008260208501015116905092915050565b60006040518251602084019350604067ffffffffffffffc06001830116016009828203106001811461020057610207565b6040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f061025f565b6000838310156102585782820151905082840393506020841015610257576001846020036101000a03198082169150505b5b9392505050565b60005b8281101561066d57610275848289610226565b8552610285846020830189610226565b60208601526040818503106001811461029d576102a6565b60808286038701535b50604083038114600181146102ba576102ca565b6008850260208701511760208701525b5060405b60808110156103565760408103860151603882038701511860208203870151600c830388015118187c010000000100000001000000010000000100000001000000010000000163800000008204167ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe6002830216179050808288015250600c810190506102ce565b5060805b6101408110156103e357608081038601516070820387015118604082038701516018830388015118187c030000000300000003000000030000000300000003000000030000000363400000008204167ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc600483021617905080828801525060188101905061035a565b508160008060005b605081101561063f57601481046000811461041d576001811461046757600281146104a4576003811461050757610540565b6501000000000085046a01000000000000000000008604189350836f01000000000000000000000000000000860416935083650100000000008604189350635a8279999250610540565b6a010000000000000000000085046f01000000000000000000000000000000860418935083650100000000008604189350636ed9eba19250610540565b6a010000000000000000000085046f01000000000000000000000000000000860417935083650100000000008604169350836a010000000000000000000086046f01000000000000000000000000000000870416179350638f1bbcdc9250610540565b6a010000000000000000000085046f0100000000000000000000000000000086041893508365010000000000860418935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c0151040190507401000000000000000000000000000000000000000081026501000000000086041794506a0100000000000000000000633fffffff6a040000000000000000000087041663c00000006604000000000000880416170277ffffffff00ffffffff000000000000ffffffff00ffffffff8616179450506001810190506103eb565b5077ffffffff00ffffffff00ffffffff00ffffffff00ffffffff838601169450505050604081019050610262565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b60008083601f8401126106ff57600080fd5b8235905067ffffffffffffffff81111561071857600080fd5b60208301915083600182028301111561073057600080fd5b9250929050565b6000806000806040858703121561074d57600080fd5b600085013567ffffffffffffffff81111561076757600080fd5b610773878288016106ed565b9450945050602085013567ffffffffffffffff81111561079257600080fd5b61079e878288016106ed565b925092505092959194509250565b6107b581610880565b82525050565b60006107c8601883610819565b91506107d3826108c5565b602082019050919050565b60006020820190506107f360008301846107ac565b92915050565b60006020820190508181036000830152610812816107bb565b9050919050565b600082825260208201905092915050565b60006108358261088c565b91506108408361088c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561087557610874610896565b5b828201905092915050565b60008115159050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f496e76616c696420736861312068617368206c656e677468000000000000000060008201525056fea2646970667358221220bb4464cdaaa81739af0648c949149178d7f2a1221866db1adee1843295a2783864736f6c63430008040033", + "devdoc": { + "details": "Implements the DNSSEC SHA1 digest.", + "kind": "dev", + "methods": { + "verify(bytes,bytes)": { + "details": "Verifies a cryptographic hash.", + "params": { + "data": "The data to hash.", + "hash": "The hash to compare to." + }, + "returns": { + "_0": "True iff the hashed data matches the provided hash value." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/SHA1NSEC3Digest.json b/solidity/dns-contracts/deployments/ropsten/SHA1NSEC3Digest.json new file mode 100644 index 0000000..d21f0fe --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/SHA1NSEC3Digest.json @@ -0,0 +1,82 @@ +{ + "address": "0xA22aCf04175B54b111F2054f408aaaA60e1D3Ae5", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "salt", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "iterations", + "type": "uint256" + } + ], + "name": "hash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x4203de53c6e155afec04a0f1235cb41a3ab014d49764d97eee61e0fcebe501e4", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0xA22aCf04175B54b111F2054f408aaaA60e1D3Ae5", + "transactionIndex": 1, + "gasUsed": "787577", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xebf8d804b767861cb7b03080bd9851b8498b3fe02588ebbae1e0ce7e2e48f0f1", + "transactionHash": "0x4203de53c6e155afec04a0f1235cb41a3ab014d49764d97eee61e0fcebe501e4", + "logs": [], + "blockNumber": 10646001, + "cumulativeGasUsed": "815829", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "a50cca78b1bed5d39e9ebe70f5371ee9", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"salt\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"iterations\",\"type\":\"uint256\"}],\"name\":\"hash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC iterated SHA1 digest used for NSEC3 records.\",\"kind\":\"dev\",\"methods\":{\"hash(bytes,bytes,uint256)\":{\"details\":\"Performs an NSEC3 iterated hash.\",\"params\":{\"data\":\"The data to hash.\",\"iterations\":\"The number of iterations to perform.\",\"salt\":\"The salt value to use on each iteration.\"},\"returns\":{\"_0\":\"The result of the iterated hash operation.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/nsec3digests/SHA1NSEC3Digest.sol\":\"SHA1NSEC3Digest\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for writing to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n mstore(0x40, add(32, add(ptr, capacity)))\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n function max(uint a, uint b) private pure returns(uint) {\\n if (a > b) {\\n return a;\\n }\\n return b;\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The start offset to write to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n if (off + len > buf.capacity) {\\n resize(buf, max(buf.capacity, len + off) * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(add(len, off), buflen) {\\n mstore(bufptr, add(len, off))\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, len);\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, data.length);\\n }\\n\\n /**\\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write the byte at.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\\n if (off >= buf.capacity) {\\n resize(buf, buf.capacity * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if eq(off, buflen) {\\n mstore(bufptr, add(buflen, 1))\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n return writeUint8(buf, buf.buf.length, data);\\n }\\n\\n /**\\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\\n if (len + off > buf.capacity) {\\n resize(buf, (len + off) * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off + len\\n let dest := add(add(bufptr, off), len)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(add(off, len), mload(bufptr)) {\\n mstore(bufptr, add(off, len))\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\\n return write(buf, off, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return write(buf, buf.buf.length, data, 32);\\n }\\n\\n /**\\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param off The offset to write at.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\\n if (len + off > buf.capacity) {\\n resize(buf, (len + off) * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + off + sizeof(buffer length) + len\\n let dest := add(add(bufptr, off), len)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(add(off, len), mload(bufptr)) {\\n mstore(bufptr, add(off, len))\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n return writeInt(buf, buf.buf.length, data, len);\\n }\\n}\\n\",\"keccak256\":\"0x18e42be1a3e4f7b4442d7ab0b524af5e09163503439954faf0ab3792cce91caa\"},\"contracts/dnssec-oracle/SHA1.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary SHA1 {\\n event Debug(bytes32 x);\\n\\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\\n assembly {\\n // Get a safe scratch location\\n let scratch := mload(0x40)\\n\\n // Get the data length, and point data at the first byte\\n let len := mload(data)\\n data := add(data, 32)\\n\\n // Find the length after padding\\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\\n switch lt(sub(totallen, len), 9)\\n case 1 { totallen := add(totallen, 64) }\\n\\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\\n\\n function readword(ptr, off, count) -> result {\\n result := 0\\n if lt(off, count) {\\n result := mload(add(ptr, off))\\n count := sub(count, off)\\n if lt(count, 32) {\\n let mask := not(sub(exp(256, sub(32, count)), 1))\\n result := and(result, mask)\\n }\\n }\\n }\\n\\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\\n mstore(scratch, readword(data, i, len))\\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\\n\\n // If we loaded the last byte, store the terminator byte\\n switch lt(sub(len, i), 64)\\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\\n\\n // If this is the last block, store the length\\n switch eq(i, sub(totallen, 64))\\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\\n\\n // Expand the 16 32-bit words into 80\\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\\n mstore(add(scratch, j), temp)\\n }\\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\\n mstore(add(scratch, j), temp)\\n }\\n\\n let x := h\\n let f := 0\\n let k := 0\\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\\n switch div(j, 20)\\n case 0 {\\n // f = d xor (b and (c xor d))\\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\\n f := and(div(x, 0x1000000000000000000000000000000), f)\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x5A827999\\n }\\n case 1{\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x6ED9EBA1\\n }\\n case 2 {\\n // f = (b and c) or (d and (b or c))\\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := and(div(x, 0x10000000000), f)\\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\\n k := 0x8F1BBCDC\\n }\\n case 3 {\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0xCA62C1D6\\n }\\n // temp = (a leftrotate 5) + f + e + k + w[i]\\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\\n temp := add(f, temp)\\n temp := add(and(x, 0xFFFFFFFF), temp)\\n temp := add(k, temp)\\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\\n }\\n\\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\\n }\\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\\n }\\n }\\n}\",\"keccak256\":\"0x43d6fc9dfba44bcc5d696ac24d8e1b90355942b41c8324ea31dce1ebfce82263\"},\"contracts/dnssec-oracle/nsec3digests/NSEC3Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev Interface for contracts that implement NSEC3 digest algorithms.\\n */\\ninterface NSEC3Digest {\\n /**\\n * @dev Performs an NSEC3 iterated hash.\\n * @param salt The salt value to use on each iteration.\\n * @param data The data to hash.\\n * @param iterations The number of iterations to perform.\\n * @return The result of the iterated hash operation.\\n */\\n function hash(bytes calldata salt, bytes calldata data, uint iterations) external virtual pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0xb3b61aee6bb472158b7ace6b5644dcb668271296b98a6dcde24dc72e3cdf4950\"},\"contracts/dnssec-oracle/nsec3digests/SHA1NSEC3Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./NSEC3Digest.sol\\\";\\nimport \\\"../SHA1.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n/**\\n* @dev Implements the DNSSEC iterated SHA1 digest used for NSEC3 records.\\n*/\\ncontract SHA1NSEC3Digest is NSEC3Digest {\\n using Buffer for Buffer.buffer;\\n\\n function hash(bytes calldata salt, bytes calldata data, uint iterations) external override pure returns (bytes32) {\\n Buffer.buffer memory buf;\\n buf.init(salt.length + data.length + 16);\\n\\n buf.append(data);\\n buf.append(salt);\\n bytes20 h = SHA1.sha1(buf.buf);\\n if (iterations > 0) {\\n buf.truncate();\\n buf.appendBytes20(bytes20(0));\\n buf.append(salt);\\n\\n for (uint i = 0; i < iterations; i++) {\\n buf.writeBytes20(0, h);\\n h = SHA1.sha1(buf.buf);\\n }\\n }\\n\\n return bytes32(h);\\n }\\n}\\n\",\"keccak256\":\"0x2255d276d74fa236875f6cddd3061ce07189f84acd04538d002dbaa78daa48a0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610d61806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806368f9dab214610030575b600080fd5b61004a60048036038101906100459190610a91565b610060565b6040516100579190610b29565b60405180910390f35b600061006a610a18565b61009a601086869050898990506100819190610b44565b61008b9190610b44565b8261024290919063ffffffff16565b506100f285858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050826102ac90919063ffffffff16565b5061014a87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050826102ac90919063ffffffff16565b50600061015a82600001516102ce565b905060008411156102255761016e826107ec565b50610186600060601b8361080390919063ffffffff16565b506101de88888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050836102ac90919063ffffffff16565b5060005b8481101561022357610200600083856108349092919063ffffffff16565b5061020e83600001516102ce565b9150808061021b90610c3c565b9150506101e2565b505b806bffffffffffffffffffffffff19169250505095945050505050565b61024a610a18565b60006020836102599190610c85565b146102855760208261026b9190610c85565b60206102779190610bf4565b826102829190610b44565b91505b81836020018181525050604051808452600081528281016020016040525082905092915050565b6102b4610a18565b6102c683846000015151848551610861565b905092915050565b60006040518251602084019350604067ffffffffffffffc0600183011601600982820310600181146102ff57610306565b6040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f061035e565b6000838310156103575782820151905082840393506020841015610356576001846020036101000a03198082169150505b5b9392505050565b60005b8281101561076c57610374848289610325565b8552610384846020830189610325565b60208601526040818503106001811461039c576103a5565b60808286038701535b50604083038114600181146103b9576103c9565b6008850260208701511760208701525b5060405b60808110156104555760408103860151603882038701511860208203870151600c830388015118187c010000000100000001000000010000000100000001000000010000000163800000008204167ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe6002830216179050808288015250600c810190506103cd565b5060805b6101408110156104e257608081038601516070820387015118604082038701516018830388015118187c030000000300000003000000030000000300000003000000030000000363400000008204167ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc6004830216179050808288015250601881019050610459565b508160008060005b605081101561073e57601481046000811461051c576001811461056657600281146105a357600381146106065761063f565b6501000000000085046a01000000000000000000008604189350836f01000000000000000000000000000000860416935083650100000000008604189350635a827999925061063f565b6a010000000000000000000085046f01000000000000000000000000000000860418935083650100000000008604189350636ed9eba1925061063f565b6a010000000000000000000085046f01000000000000000000000000000000860417935083650100000000008604169350836a010000000000000000000086046f01000000000000000000000000000000870416179350638f1bbcdc925061063f565b6a010000000000000000000085046f0100000000000000000000000000000086041893508365010000000000860418935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c0151040190507401000000000000000000000000000000000000000081026501000000000086041794506a0100000000000000000000633fffffff6a040000000000000000000087041663c00000006604000000000000880416170277ffffffff00ffffffff000000000000ffffffff00ffffffff8616179450506001810190506104ea565b5077ffffffff00ffffffff00ffffffff00ffffffff00ffffffff838601169450505050604081019050610361565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b6107f4610a18565b81516000815250819050919050565b61080b610a18565b61082c83846000015151846bffffffffffffffffffffffff19166014610950565b905092915050565b61083c610a18565b6108588484846bffffffffffffffffffffffff19166014610950565b90509392505050565b610869610a18565b825182111561087757600080fd5b846020015182856108889190610b44565b11156108bd576108bc8560026108ad886020015188876108a89190610b44565b6109d8565b6108b79190610b9a565b6109f4565b5b6000808651805187602083010193508088870111156108dc5787860182525b60208701925050505b6020841061092357805182526020826108fe9190610b44565b915060208161090d9190610b44565b905060208461091c9190610bf4565b93506108e5565b60006001856020036101000a03905080198251168184511681811785525050508692505050949350505050565b610958610a18565b846020015184836109699190610b44565b11156109915761099085600286856109819190610b44565b61098b9190610b9a565b6109f4565b5b60006001836101000a0390508260200360080284901c935085518386820101858319825116178152815185880111156109ca5784870182525b505050849050949350505050565b6000818311156109ea578290506109ee565b8190505b92915050565b600082600001519050610a078383610242565b50610a1283826102ac565b50505050565b604051806040016040528060608152602001600081525090565b60008083601f840112610a4457600080fd5b8235905067ffffffffffffffff811115610a5d57600080fd5b602083019150836001820283011115610a7557600080fd5b9250929050565b600081359050610a8b81610d14565b92915050565b600080600080600060608688031215610aa957600080fd5b600086013567ffffffffffffffff811115610ac357600080fd5b610acf88828901610a32565b9550955050602086013567ffffffffffffffff811115610aee57600080fd5b610afa88828901610a32565b93509350506040610b0d88828901610a7c565b9150509295509295909350565b610b2381610c28565b82525050565b6000602082019050610b3e6000830184610b1a565b92915050565b6000610b4f82610c32565b9150610b5a83610c32565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610b8f57610b8e610cb6565b5b828201905092915050565b6000610ba582610c32565b9150610bb083610c32565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610be957610be8610cb6565b5b828202905092915050565b6000610bff82610c32565b9150610c0a83610c32565b925082821015610c1d57610c1c610cb6565b5b828203905092915050565b6000819050919050565b6000819050919050565b6000610c4782610c32565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610c7a57610c79610cb6565b5b600182019050919050565b6000610c9082610c32565b9150610c9b83610c32565b925082610cab57610caa610ce5565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b610d1d81610c32565b8114610d2857600080fd5b5056fea264697066735822122014909039cf171591f8629bfc52114a9908cd2479bcd90c7bef5c7a119ab14a3264736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c806368f9dab214610030575b600080fd5b61004a60048036038101906100459190610a91565b610060565b6040516100579190610b29565b60405180910390f35b600061006a610a18565b61009a601086869050898990506100819190610b44565b61008b9190610b44565b8261024290919063ffffffff16565b506100f285858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050826102ac90919063ffffffff16565b5061014a87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050826102ac90919063ffffffff16565b50600061015a82600001516102ce565b905060008411156102255761016e826107ec565b50610186600060601b8361080390919063ffffffff16565b506101de88888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050836102ac90919063ffffffff16565b5060005b8481101561022357610200600083856108349092919063ffffffff16565b5061020e83600001516102ce565b9150808061021b90610c3c565b9150506101e2565b505b806bffffffffffffffffffffffff19169250505095945050505050565b61024a610a18565b60006020836102599190610c85565b146102855760208261026b9190610c85565b60206102779190610bf4565b826102829190610b44565b91505b81836020018181525050604051808452600081528281016020016040525082905092915050565b6102b4610a18565b6102c683846000015151848551610861565b905092915050565b60006040518251602084019350604067ffffffffffffffc0600183011601600982820310600181146102ff57610306565b6040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f061035e565b6000838310156103575782820151905082840393506020841015610356576001846020036101000a03198082169150505b5b9392505050565b60005b8281101561076c57610374848289610325565b8552610384846020830189610325565b60208601526040818503106001811461039c576103a5565b60808286038701535b50604083038114600181146103b9576103c9565b6008850260208701511760208701525b5060405b60808110156104555760408103860151603882038701511860208203870151600c830388015118187c010000000100000001000000010000000100000001000000010000000163800000008204167ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe6002830216179050808288015250600c810190506103cd565b5060805b6101408110156104e257608081038601516070820387015118604082038701516018830388015118187c030000000300000003000000030000000300000003000000030000000363400000008204167ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc6004830216179050808288015250601881019050610459565b508160008060005b605081101561073e57601481046000811461051c576001811461056657600281146105a357600381146106065761063f565b6501000000000085046a01000000000000000000008604189350836f01000000000000000000000000000000860416935083650100000000008604189350635a827999925061063f565b6a010000000000000000000085046f01000000000000000000000000000000860418935083650100000000008604189350636ed9eba1925061063f565b6a010000000000000000000085046f01000000000000000000000000000000860417935083650100000000008604169350836a010000000000000000000086046f01000000000000000000000000000000870416179350638f1bbcdc925061063f565b6a010000000000000000000085046f0100000000000000000000000000000086041893508365010000000000860418935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c0151040190507401000000000000000000000000000000000000000081026501000000000086041794506a0100000000000000000000633fffffff6a040000000000000000000087041663c00000006604000000000000880416170277ffffffff00ffffffff000000000000ffffffff00ffffffff8616179450506001810190506104ea565b5077ffffffff00ffffffff00ffffffff00ffffffff00ffffffff838601169450505050604081019050610361565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b6107f4610a18565b81516000815250819050919050565b61080b610a18565b61082c83846000015151846bffffffffffffffffffffffff19166014610950565b905092915050565b61083c610a18565b6108588484846bffffffffffffffffffffffff19166014610950565b90509392505050565b610869610a18565b825182111561087757600080fd5b846020015182856108889190610b44565b11156108bd576108bc8560026108ad886020015188876108a89190610b44565b6109d8565b6108b79190610b9a565b6109f4565b5b6000808651805187602083010193508088870111156108dc5787860182525b60208701925050505b6020841061092357805182526020826108fe9190610b44565b915060208161090d9190610b44565b905060208461091c9190610bf4565b93506108e5565b60006001856020036101000a03905080198251168184511681811785525050508692505050949350505050565b610958610a18565b846020015184836109699190610b44565b11156109915761099085600286856109819190610b44565b61098b9190610b9a565b6109f4565b5b60006001836101000a0390508260200360080284901c935085518386820101858319825116178152815185880111156109ca5784870182525b505050849050949350505050565b6000818311156109ea578290506109ee565b8190505b92915050565b600082600001519050610a078383610242565b50610a1283826102ac565b50505050565b604051806040016040528060608152602001600081525090565b60008083601f840112610a4457600080fd5b8235905067ffffffffffffffff811115610a5d57600080fd5b602083019150836001820283011115610a7557600080fd5b9250929050565b600081359050610a8b81610d14565b92915050565b600080600080600060608688031215610aa957600080fd5b600086013567ffffffffffffffff811115610ac357600080fd5b610acf88828901610a32565b9550955050602086013567ffffffffffffffff811115610aee57600080fd5b610afa88828901610a32565b93509350506040610b0d88828901610a7c565b9150509295509295909350565b610b2381610c28565b82525050565b6000602082019050610b3e6000830184610b1a565b92915050565b6000610b4f82610c32565b9150610b5a83610c32565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610b8f57610b8e610cb6565b5b828201905092915050565b6000610ba582610c32565b9150610bb083610c32565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610be957610be8610cb6565b5b828202905092915050565b6000610bff82610c32565b9150610c0a83610c32565b925082821015610c1d57610c1c610cb6565b5b828203905092915050565b6000819050919050565b6000819050919050565b6000610c4782610c32565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610c7a57610c79610cb6565b5b600182019050919050565b6000610c9082610c32565b9150610c9b83610c32565b925082610cab57610caa610ce5565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b610d1d81610c32565b8114610d2857600080fd5b5056fea264697066735822122014909039cf171591f8629bfc52114a9908cd2479bcd90c7bef5c7a119ab14a3264736f6c63430008040033", + "devdoc": { + "details": "Implements the DNSSEC iterated SHA1 digest used for NSEC3 records.", + "kind": "dev", + "methods": { + "hash(bytes,bytes,uint256)": { + "details": "Performs an NSEC3 iterated hash.", + "params": { + "data": "The data to hash.", + "iterations": "The number of iterations to perform.", + "salt": "The salt value to use on each iteration." + }, + "returns": { + "_0": "The result of the iterated hash operation." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/SHA256Digest.json b/solidity/dns-contracts/deployments/ropsten/SHA256Digest.json new file mode 100644 index 0000000..fc7ccf6 --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/SHA256Digest.json @@ -0,0 +1,76 @@ +{ + "address": "0x215f836bF8A8c0ccA455226d40904d7b40b33f12", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0xbca682c120e2a8dc0622b72d31c5eab30526af38dafd9c76311813652ee87072", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x215f836bF8A8c0ccA455226d40904d7b40b33f12", + "transactionIndex": 8, + "gasUsed": "298989", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x0c66f3980bf8fd015cbad4c5282ccc7a9e35bfcf4f4d66a4851e9474a68c684f", + "transactionHash": "0xbca682c120e2a8dc0622b72d31c5eab30526af38dafd9c76311813652ee87072", + "logs": [], + "blockNumber": 10645999, + "cumulativeGasUsed": "796903", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "424cfdf012b9aa11d2e839569d49524c", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC SHA256 digest.\",\"kind\":\"dev\",\"methods\":{\"verify(bytes,bytes)\":{\"details\":\"Verifies a cryptographic hash.\",\"params\":{\"data\":\"The data to hash.\",\"hash\":\"The hash to compare to.\"},\"returns\":{\"_0\":\"True iff the hashed data matches the provided hash value.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/digests/SHA256Digest.sol\":\"SHA256Digest\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\\n uint shortest = len;\\n if (otherlen < len)\\n shortest = otherlen;\\n\\n uint selfptr;\\n uint otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint idx = 0; idx < shortest; idx += 32) {\\n uint a;\\n uint b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint mask;\\n if (shortest > 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\\n }\\n int diff = int(a & mask) - int(b & mask);\\n if (diff != 0)\\n return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int(len) - int(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\\n return self.length == other.length && equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint dest, uint src, uint len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint dest;\\n uint src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\\n require(len <= 52);\\n\\n uint ret = 0;\\n uint8 decoded;\\n for(uint i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if(i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint bitlen = len * 5;\\n if(len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if(len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if(len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if(len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if(len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n}\",\"keccak256\":\"0x83315df2e54c74451577c70da2c267c3459802b08b9aeec6516302eee70f796e\"},\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n* @dev An interface for contracts implementing a DNSSEC digest.\\n*/\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(bytes calldata data, bytes calldata hash) external virtual pure returns (bool);\\n}\\n\",\"keccak256\":\"0x259720cef78c019d38b908bc7dd524f087c58d8c40792cebcdd4e982c628bc9a\"},\"contracts/dnssec-oracle/digests/SHA256Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Digest.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\n\\n/**\\n* @dev Implements the DNSSEC SHA256 digest.\\n*/\\ncontract SHA256Digest is Digest {\\n using BytesUtils for *;\\n\\n function verify(bytes calldata data, bytes calldata hash) external override pure returns (bool) {\\n require(hash.length == 32, \\\"Invalid sha256 hash length\\\");\\n return sha256(data) == hash.readBytes32(0);\\n }\\n}\\n\",\"keccak256\":\"0xd4661871bc8d4ddd7186631d1126693ea0b5c435e4b0c793b1c3ffbcc426f4dd\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610476806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004a60048036038101906100459190610210565b610060565b60405161005791906102f5565b60405180910390f35b6000602083839050146100a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009f90610310565b60405180910390fd5b610100600084848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061015d90919063ffffffff16565b600286866040516101129291906102dc565b602060405180830381855afa15801561012f573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061015291906101e7565b149050949350505050565b6000825160208361016e919061034c565b111561017957600080fd5b81602084010151905092915050565b60008151905061019781610429565b92915050565b60008083601f8401126101af57600080fd5b8235905067ffffffffffffffff8111156101c857600080fd5b6020830191508360018202830111156101e057600080fd5b9250929050565b6000602082840312156101f957600080fd5b600061020784828501610188565b91505092915050565b6000806000806040858703121561022657600080fd5b600085013567ffffffffffffffff81111561024057600080fd5b61024c8782880161019d565b9450945050602085013567ffffffffffffffff81111561026b57600080fd5b6102778782880161019d565b925092505092959194509250565b61028e816103a2565b82525050565b60006102a08385610330565b93506102ad8385846103c2565b82840190509392505050565b60006102c6601a8361033b565b91506102d182610400565b602082019050919050565b60006102e9828486610294565b91508190509392505050565b600060208201905061030a6000830184610285565b92915050565b60006020820190508181036000830152610329816102b9565b9050919050565b600081905092915050565b600082825260208201905092915050565b6000610357826103b8565b9150610362836103b8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610397576103966103d1565b5b828201905092915050565b60008115159050919050565b6000819050919050565b6000819050919050565b82818337600083830152505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f496e76616c6964207368613235362068617368206c656e677468000000000000600082015250565b610432816103ae565b811461043d57600080fd5b5056fea26469706673582212205a6c0d3ca7e9316a86f951cf99715b47098325f52075833ecbde2d473b7b090464736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004a60048036038101906100459190610210565b610060565b60405161005791906102f5565b60405180910390f35b6000602083839050146100a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009f90610310565b60405180910390fd5b610100600084848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061015d90919063ffffffff16565b600286866040516101129291906102dc565b602060405180830381855afa15801561012f573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061015291906101e7565b149050949350505050565b6000825160208361016e919061034c565b111561017957600080fd5b81602084010151905092915050565b60008151905061019781610429565b92915050565b60008083601f8401126101af57600080fd5b8235905067ffffffffffffffff8111156101c857600080fd5b6020830191508360018202830111156101e057600080fd5b9250929050565b6000602082840312156101f957600080fd5b600061020784828501610188565b91505092915050565b6000806000806040858703121561022657600080fd5b600085013567ffffffffffffffff81111561024057600080fd5b61024c8782880161019d565b9450945050602085013567ffffffffffffffff81111561026b57600080fd5b6102778782880161019d565b925092505092959194509250565b61028e816103a2565b82525050565b60006102a08385610330565b93506102ad8385846103c2565b82840190509392505050565b60006102c6601a8361033b565b91506102d182610400565b602082019050919050565b60006102e9828486610294565b91508190509392505050565b600060208201905061030a6000830184610285565b92915050565b60006020820190508181036000830152610329816102b9565b9050919050565b600081905092915050565b600082825260208201905092915050565b6000610357826103b8565b9150610362836103b8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610397576103966103d1565b5b828201905092915050565b60008115159050919050565b6000819050919050565b6000819050919050565b82818337600083830152505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f496e76616c6964207368613235362068617368206c656e677468000000000000600082015250565b610432816103ae565b811461043d57600080fd5b5056fea26469706673582212205a6c0d3ca7e9316a86f951cf99715b47098325f52075833ecbde2d473b7b090464736f6c63430008040033", + "devdoc": { + "details": "Implements the DNSSEC SHA256 digest.", + "kind": "dev", + "methods": { + "verify(bytes,bytes)": { + "details": "Verifies a cryptographic hash.", + "params": { + "data": "The data to hash.", + "hash": "The hash to compare to." + }, + "returns": { + "_0": "True iff the hashed data matches the provided hash value." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/StaticMetadataService.json b/solidity/dns-contracts/deployments/ropsten/StaticMetadataService.json new file mode 100644 index 0000000..2200162 --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/StaticMetadataService.json @@ -0,0 +1,88 @@ +{ + "address": "0x3bAa5F3ea7bFCC8948c4140f233d72c11eBF0bdB", + "abi": [ + { + "inputs": [ + { + "internalType": "string", + "name": "_metaDataUri", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "uri", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x74a7f153912824e841541de28b0a189abedde706f7b8eb5ce7081ad3c277c0b4", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x3bAa5F3ea7bFCC8948c4140f233d72c11eBF0bdB", + "transactionIndex": 10, + "gasUsed": "240222", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xba0ddbfd23af7dc4906e94b775786ddc01918e224d3f67595b8a988ddc5c1e30", + "transactionHash": "0x74a7f153912824e841541de28b0a189abedde706f7b8eb5ce7081ad3c277c0b4", + "logs": [], + "blockNumber": 13019110, + "cumulativeGasUsed": "1121015", + "status": 1, + "byzantium": true + }, + "args": [ + "ens-metadata-service.appspot.com/name/0x{id}" + ], + "numDeployments": 1, + "solcInputHash": "2d8cd8af817b3996918016eaf0684f54", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_metaDataUri\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/wrapper/StaticMetadataService.sol\":\"StaticMetadataService\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"contracts/wrapper/StaticMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ncontract StaticMetadataService {\\n string private _uri;\\n\\n constructor(string memory _metaDataUri) {\\n _uri = _metaDataUri;\\n }\\n\\n function uri(uint256) public view returns (string memory) {\\n return _uri;\\n }\\n}\\n\",\"keccak256\":\"0x28aad4cb829118de64965e06af8e785e6b2efa5207859d2efc63e404c26cfea3\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161047338038061047383398101604081905261002f91610058565b600061003b82826101aa565b5050610269565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561006b57600080fd5b82516001600160401b038082111561008257600080fd5b818501915085601f83011261009657600080fd5b8151818111156100a8576100a8610042565b604051601f8201601f19908116603f011681019083821181831017156100d0576100d0610042565b8160405282815288868487010111156100e857600080fd5b600093505b8284101561010a57848401860151818501870152928501926100ed565b600086848301015280965050505050505092915050565b600181811c9082168061013557607f821691505b60208210810361015557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156101a557600081815260208120601f850160051c810160208610156101825750805b601f850160051c820191505b818110156101a15782815560010161018e565b5050505b505050565b81516001600160401b038111156101c3576101c3610042565b6101d7816101d18454610121565b8461015b565b602080601f83116001811461020c57600084156101f45750858301515b600019600386901b1c1916600185901b1785556101a1565b600085815260208120601f198616915b8281101561023b5788860151825594840194600190910190840161021c565b50858210156102595787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6101fb806102786000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80630e89341c14610030575b600080fd5b61004361003e3660046100ed565b610059565b6040516100509190610106565b60405180910390f35b60606000805461006890610172565b80601f016020809104026020016040519081016040528092919081815260200182805461009490610172565b80156100e15780601f106100b6576101008083540402835291602001916100e1565b820191906000526020600020905b8154815290600101906020018083116100c457829003601f168201915b50505050509050919050565b6000602082840312156100ff57600080fd5b5035919050565b600060208083528351808285015260005b8181101561013357858101830151858201604001528201610117565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b600181811c9082168061018657607f821691505b6020821081036101bf577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea2646970667358221220f100acc2f2e385cccbfeea195abeed40ba79f3672462763da96786a66c7a987a64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80630e89341c14610030575b600080fd5b61004361003e3660046100ed565b610059565b6040516100509190610106565b60405180910390f35b60606000805461006890610172565b80601f016020809104026020016040519081016040528092919081815260200182805461009490610172565b80156100e15780601f106100b6576101008083540402835291602001916100e1565b820191906000526020600020905b8154815290600101906020018083116100c457829003601f168201915b50505050509050919050565b6000602082840312156100ff57600080fd5b5035919050565b600060208083528351808285015260005b8181101561013357858101830151858201604001528201610117565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b600181811c9082168061018657607f821691505b6020821081036101bf577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea2646970667358221220f100acc2f2e385cccbfeea195abeed40ba79f3672462763da96786a66c7a987a64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3, + "contract": "contracts/wrapper/StaticMetadataService.sol:StaticMetadataService", + "label": "_uri", + "offset": 0, + "slot": "0", + "type": "t_string_storage" + } + ], + "types": { + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/TLDPublicSuffixList.json b/solidity/dns-contracts/deployments/ropsten/TLDPublicSuffixList.json new file mode 100644 index 0000000..db83c34 --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/TLDPublicSuffixList.json @@ -0,0 +1,60 @@ +{ + "address": "0x2FD5B53F14059A43e65f9A91ff21889D6d8D974B", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "isPublicSuffix", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x9afebebaacad78bd66ac8b6b84cad75724f28594c7c561181bddcf5dea5a5043", + "receipt": { + "to": null, + "from": "0xa303ddC620aa7d1390BACcc8A495508B183fab59", + "contractAddress": "0x2FD5B53F14059A43e65f9A91ff21889D6d8D974B", + "transactionIndex": 8, + "gasUsed": "223814", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xd6e51495921c278f139e1a6f2e10d6287bdc247aca06852f8186eed05f70a637", + "transactionHash": "0x9afebebaacad78bd66ac8b6b84cad75724f28594c7c561181bddcf5dea5a5043", + "logs": [], + "blockNumber": 10646007, + "cumulativeGasUsed": "1144658", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "a50cca78b1bed5d39e9ebe70f5371ee9", + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"isPublicSuffix\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"A public suffix list that treats all TLDs as public suffixes.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnsregistrar/TLDPublicSuffixList.sol\":\"TLDPublicSuffixList\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/dnsregistrar/PublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\ninterface PublicSuffixList {\\n function isPublicSuffix(bytes calldata name) external view returns(bool);\\n}\\n\",\"keccak256\":\"0x8e593c73f54e07a54074ed3b6bc8e976d06211f923051c9793bcb9c10114854d\"},\"contracts/dnsregistrar/TLDPublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../dnssec-oracle/BytesUtils.sol\\\";\\nimport \\\"./PublicSuffixList.sol\\\";\\n\\n/**\\n * @dev A public suffix list that treats all TLDs as public suffixes.\\n */\\ncontract TLDPublicSuffixList is PublicSuffixList {\\n using BytesUtils for bytes;\\n\\n function isPublicSuffix(bytes calldata name) external override view returns(bool) {\\n uint labellen = name.readUint8(0);\\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\\n }\\n}\\n\",\"keccak256\":\"0xe5b1a99e2fbc719fdf234de39724d78196fe981f9a10a241ed3014318d85f927\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\\n uint shortest = len;\\n if (otherlen < len)\\n shortest = otherlen;\\n\\n uint selfptr;\\n uint otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint idx = 0; idx < shortest; idx += 32) {\\n uint a;\\n uint b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint mask;\\n if (shortest > 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\\n }\\n int diff = int(a & mask) - int(b & mask);\\n if (diff != 0)\\n return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int(len) - int(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\\n return self.length == other.length && equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint dest, uint src, uint len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint dest;\\n uint src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\\n require(len <= 52);\\n\\n uint ret = 0;\\n uint8 decoded;\\n for(uint i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if(i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint bitlen = len * 5;\\n if(len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if(len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if(len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if(len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if(len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n}\",\"keccak256\":\"0x83315df2e54c74451577c70da2c267c3459802b08b9aeec6516302eee70f796e\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610319806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80634f89059e14610030575b600080fd5b61004a600480360381019061004591906101d9565b610060565b604051610057919061022d565b60405180910390f35b6000806100bb600085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061013e90919063ffffffff16565b60ff169050600081118015610135575060006101306001836100dd9190610248565b86868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061013e90919063ffffffff16565b60ff16145b91505092915050565b6000828281518110610179577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b60f81c905092915050565b60008083601f8401126101a157600080fd5b8235905067ffffffffffffffff8111156101ba57600080fd5b6020830191508360018202830111156101d257600080fd5b9250929050565b600080602083850312156101ec57600080fd5b600083013567ffffffffffffffff81111561020657600080fd5b6102128582860161018f565b92509250509250929050565b6102278161029e565b82525050565b6000602082019050610242600083018461021e565b92915050565b6000610253826102aa565b915061025e836102aa565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610293576102926102b4565b5b828201905092915050565b60008115159050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220b532069c267f49adbbd903657805a090abc71404bbc14065e2ca096d166ea07164736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80634f89059e14610030575b600080fd5b61004a600480360381019061004591906101d9565b610060565b604051610057919061022d565b60405180910390f35b6000806100bb600085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061013e90919063ffffffff16565b60ff169050600081118015610135575060006101306001836100dd9190610248565b86868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061013e90919063ffffffff16565b60ff16145b91505092915050565b6000828281518110610179577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b60f81c905092915050565b60008083601f8401126101a157600080fd5b8235905067ffffffffffffffff8111156101ba57600080fd5b6020830191508360018202830111156101d257600080fd5b9250929050565b600080602083850312156101ec57600080fd5b600083013567ffffffffffffffff81111561020657600080fd5b6102128582860161018f565b92509250509250929050565b6102278161029e565b82525050565b6000602082019050610242600083018461021e565b92915050565b6000610253826102aa565b915061025e836102aa565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610293576102926102b4565b5b828201905092915050565b60008115159050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220b532069c267f49adbbd903657805a090abc71404bbc14065e2ca096d166ea07164736f6c63430008040033", + "devdoc": { + "details": "A public suffix list that treats all TLDs as public suffixes.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/solcInputs/08371ea78d6ca0259dbc9b2f768cf73e.json b/solidity/dns-contracts/deployments/ropsten/solcInputs/08371ea78d6ca0259dbc9b2f768cf73e.json new file mode 100644 index 0000000..63302dd --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/solcInputs/08371ea78d6ca0259dbc9b2f768cf73e.json @@ -0,0 +1,125 @@ +{ + "language": "Solidity", + "sources": { + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n\n using BytesUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(DNSSEC oracle, bytes memory name, bytes memory proof)\n internal\n view\n returns (address, bool)\n {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n bytes20 hash;\n uint32 expiration;\n // Check the provided TXT record has been validated by the oracle\n (, expiration, hash) = oracle.rrdata(TYPE_TXT, buf.buf);\n if (hash == bytes20(0) && proof.length == 0) return (address(0x0), false);\n\n require(hash == bytes20(keccak256(proof)));\n\n for (RRUtils.RRIterator memory iter = proof.iterateRRs(0); !iter.done(); iter.next()) {\n require(RRUtils.serialNumberGte(expiration + iter.ttl, uint32(block.timestamp)), \"DNS record is stale; refresh or delete it before proceeding.\");\n\n bool found;\n address addr;\n (addr, found) = parseRR(proof, iter.rdataOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(bytes memory rdata, uint idx) internal pure returns (address, bool) {\n while (idx < rdata.length) {\n uint len = rdata.readUint8(idx); idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(bytes memory str, uint idx, uint len) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n if (len < 44) return (address(0x0), false);\n return hexToAddress(str, idx + 4);\n }\n\n function hexToAddress(bytes memory str, uint idx) internal pure returns (address, bool) {\n if (str.length - idx < 40) return (address(0x0), false);\n uint ret = 0;\n for (uint i = idx; i < idx + 40; i++) {\n ret <<= 4;\n uint x = str.readUint8(i);\n if (x >= 48 && x < 58) {\n ret |= x - 48;\n } else if (x >= 65 && x < 71) {\n ret |= x - 55;\n } else if (x >= 97 && x < 103) {\n ret |= x - 87;\n } else {\n return (address(0x0), false);\n }\n }\n return (address(uint160(ret)), true);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n event NSEC3DigestUpdated(uint8 id, address addr);\n event RRSetUpdated(bytes name, bytes rrset);\n\n function submitRRSets(RRSetWithSignature[] memory input, bytes calldata proof) public virtual returns (bytes memory);\n function submitRRSet(RRSetWithSignature calldata input, bytes calldata proof) public virtual returns (bytes memory);\n function deleteRRSet(uint16 deleteType, bytes calldata deleteName, RRSetWithSignature calldata nsec, bytes calldata proof) public virtual;\n function deleteRRSetNSEC3(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory closestEncloser, RRSetWithSignature memory nextClosest, bytes memory dnskey) public virtual;\n function rrdata(uint16 dnstype, bytes calldata name) external virtual view returns (uint32, uint32, bytes20);\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\n uint shortest = len;\n if (otherlen < len)\n shortest = otherlen;\n\n uint selfptr;\n uint otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint idx = 0; idx < shortest; idx += 32) {\n uint a;\n uint b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint mask;\n if (shortest > 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\n }\n int diff = int(a & mask) - int(b & mask);\n if (diff != 0)\n return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int(len) - int(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\n return self.length == other.length && equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint dest, uint src, uint len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint dest;\n uint src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\n require(len <= 52);\n\n uint ret = 0;\n uint8 decoded;\n for(uint i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if(i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint bitlen = len * 5;\n if(len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if(len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if(len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if(len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if(len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n}" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n* @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n*/\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(bytes memory self, uint offset) internal pure returns(uint) {\n uint idx = offset;\n while (true) {\n assert(idx < self.length);\n uint labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(bytes memory self, uint offset) internal pure returns(bytes memory ret) {\n uint len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(bytes memory self, uint offset) internal pure returns(uint) {\n uint count = 0;\n while (true) {\n assert(offset < self.length);\n uint labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint constant RRSIG_TYPE = 0;\n uint constant RRSIG_ALGORITHM = 2;\n uint constant RRSIG_LABELS = 3;\n uint constant RRSIG_TTL = 4;\n uint constant RRSIG_EXPIRATION = 8;\n uint constant RRSIG_INCEPTION = 12;\n uint constant RRSIG_KEY_TAG = 16;\n uint constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(bytes memory data) internal pure returns(SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(RRSIG_SIGNER_NAME + self.signerName.length, data.length - RRSIG_SIGNER_NAME - self.signerName.length);\n }\n\n function rrs(SignedSet memory rrset) internal pure returns(RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint rdataOffset;\n uint nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(bytes memory self, uint offset) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns(bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns(bytes memory) {\n return iter.data.substring(iter.offset, nameLength(iter.data, iter.offset));\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(RRIterator memory iter) internal pure returns(bytes memory) {\n return iter.data.substring(iter.rdataOffset, iter.nextOffset - iter.rdataOffset);\n }\n\n uint constant DNSKEY_FLAGS = 0;\n uint constant DNSKEY_PROTOCOL = 2;\n uint constant DNSKEY_ALGORITHM = 3;\n uint constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(bytes memory data, uint offset, uint length) internal pure returns(DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(offset + DNSKEY_PUBKEY, length - DNSKEY_PUBKEY);\n } \n\n uint constant DS_KEY_TAG = 0;\n uint constant DS_ALGORITHM = 2;\n uint constant DS_DIGEST_TYPE = 3;\n uint constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(bytes memory data, uint offset, uint length) internal pure returns(DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n struct NSEC3 {\n uint8 hashAlgorithm;\n uint8 flags;\n uint16 iterations;\n bytes salt;\n bytes32 nextHashedOwnerName;\n bytes typeBitmap;\n }\n\n uint constant NSEC3_HASH_ALGORITHM = 0;\n uint constant NSEC3_FLAGS = 1;\n uint constant NSEC3_ITERATIONS = 2;\n uint constant NSEC3_SALT_LENGTH = 4;\n uint constant NSEC3_SALT = 5;\n\n function readNSEC3(bytes memory data, uint offset, uint length) internal pure returns(NSEC3 memory self) {\n uint end = offset + length;\n self.hashAlgorithm = data.readUint8(offset + NSEC3_HASH_ALGORITHM);\n self.flags = data.readUint8(offset + NSEC3_FLAGS);\n self.iterations = data.readUint16(offset + NSEC3_ITERATIONS);\n uint8 saltLength = data.readUint8(offset + NSEC3_SALT_LENGTH);\n offset = offset + NSEC3_SALT;\n self.salt = data.substring(offset, saltLength);\n offset += saltLength;\n uint8 nextLength = data.readUint8(offset);\n require(nextLength <= 32);\n offset += 1;\n self.nextHashedOwnerName = data.readBytesN(offset, nextLength);\n offset += nextLength;\n self.typeBitmap = data.substring(offset, end - offset);\n }\n\n function checkTypeBitmap(NSEC3 memory self, uint16 rrtype) internal pure returns(bool) {\n return checkTypeBitmap(self.typeBitmap, 0, rrtype);\n }\n\n /**\n * @dev Checks if a given RR type exists in a type bitmap.\n * @param bitmap The byte string to read the type bitmap from.\n * @param offset The offset to start reading at.\n * @param rrtype The RR type to check for.\n * @return True if the type is found in the bitmap, false otherwise.\n */\n function checkTypeBitmap(bytes memory bitmap, uint offset, uint16 rrtype) internal pure returns (bool) {\n uint8 typeWindow = uint8(rrtype >> 8);\n uint8 windowByte = uint8((rrtype & 0xff) / 8);\n uint8 windowBitmask = uint8(uint8(1) << (uint8(7) - uint8(rrtype & 0x7)));\n for (uint off = offset; off < bitmap.length;) {\n uint8 window = bitmap.readUint8(off);\n uint8 len = bitmap.readUint8(off + 1);\n if (typeWindow < window) {\n // We've gone past our window; it's not here.\n return false;\n } else if (typeWindow == window) {\n // Check this type bitmap\n if (len <= windowByte) {\n // Our type is past the end of the bitmap\n return false;\n }\n return (bitmap.readUint8(off + windowByte + 2) & windowBitmask) != 0;\n } else {\n // Skip this type bitmap\n off += len + 2;\n }\n }\n\n return false;\n }\n\n function compareNames(bytes memory self, bytes memory other) internal pure returns (int) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint off;\n uint otheroff;\n uint prevoff;\n uint otherprevoff;\n uint counts = labelCount(self, 0);\n uint othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if(otheroff == 0) {\n return 1;\n }\n\n return self.compare(prevoff + 1, self.readUint8(prevoff), other, otherprevoff + 1, other.readUint8(otherprevoff));\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(uint32 i1, uint32 i2) internal pure returns(bool) {\n return int32(i1) - int32(i2) >= 0;\n }\n\n function progress(bytes memory body, uint off) internal pure returns(uint) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint ac1;\n uint ac2;\n for(uint i = 0; i < data.length + 31; i += 32) {\n uint word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if(i + 32 > data.length) {\n uint unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 += (word & 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >> 8;\n ac2 += (word & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 = (ac1 & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF)\n + ((ac1 & 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >> 16);\n ac2 = (ac2 & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF)\n + ((ac2 & 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >> 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 = (ac1 & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF)\n + ((ac1 & 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >> 32);\n ac1 = (ac1 & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF)\n + ((ac1 & 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >> 64);\n ac1 = (ac1 & 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)\n + (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}" + }, + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\n\ninterface IDNSRegistrar {\n function claim(bytes memory name, bytes memory proof) external;\n function proveAndClaim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof) external;\n function proveAndClaimWithResolver(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof, address resolver, address addr) external;\n}\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar {\n using BytesUtils for bytes;\n\n DNSSEC public oracle;\n ENS public ens;\n PublicSuffixList public suffixes;\n\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event Claim(bytes32 indexed node, address indexed owner, bytes dnsname);\n event NewOracle(address oracle);\n event NewPublicSuffixList(address suffixes);\n\n constructor(DNSSEC _dnssec, PublicSuffixList _suffixes, ENS _ens) {\n oracle = _dnssec;\n emit NewOracle(address(oracle));\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setOracle(DNSSEC _dnssec) public onlyOwner {\n oracle = _dnssec;\n emit NewOracle(address(oracle));\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Claims a name by proving ownership of its DNS equivalent.\n * @param name The name to claim, in DNS wire format.\n * @param proof A DNS RRSet proving ownership of the name. Must be verified\n * in the DNSSEC oracle before calling. This RRSET must contain a TXT\n * record for '_ens.' + name, with the value 'a=0x...'. Ownership of\n * the name will be transferred to the address specified in the TXT\n * record.\n */\n function claim(bytes memory name, bytes memory proof) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(name, proof);\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input The data to be passed to the Oracle's `submitProofs` function. The last\n * proof must be the TXT record required by the registrar.\n * @param proof The proof record for the first element in input.\n */\n function proveAndClaim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof) public override {\n proof = oracle.submitRRSets(input, proof);\n claim(name, proof);\n }\n\n function proveAndClaimWithResolver(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof, address resolver, address addr) public override {\n proof = oracle.submitRRSets(input, proof);\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(name, proof);\n require(msg.sender == owner, \"Only owner can call proveAndClaimWithResolver\");\n if(addr != address(0)) {\n require(resolver != address(0), \"Cannot set addr if resolver is not set\");\n // Set ourselves as the owner so we can set a record on the resolver\n ens.setSubnodeRecord(rootNode, labelHash, address(this), resolver, 0);\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n // Transfer the record to the owner\n ens.setOwner(node, owner);\n } else {\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n }\n }\n\n function supportsInterface(bytes4 interfaceID) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(bytes memory name, bytes memory proof) internal returns(bytes32 rootNode, bytes32 labelHash, address addr) {\n // Get the first label\n uint labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n // Parent name must be in the public suffix list.\n bytes memory parentName = name.substring(labelLen + 1, name.length - labelLen - 1);\n require(suffixes.isPublicSuffix(parentName), \"Parent name must be a public suffix\");\n\n // Make sure the parent name is enabled\n rootNode = enableNode(parentName, 0);\n\n (addr,) = DNSClaimChecker.getOwnerAddress(oracle, name, proof);\n\n emit Claim(keccak256(abi.encodePacked(rootNode, labelHash)), addr, name);\n }\n\n function enableNode(bytes memory domain, uint offset) internal returns(bytes32 node) {\n uint len = domain.readUint8(offset);\n if(len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n require(owner == address(0) || owner == address(this), \"Cannot enable a name owned by someone else\");\n if(owner != address(this)) {\n if(parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n } else {\n ens.setSubnodeOwner(parentNode, label, address(this));\n }\n }\n return node;\n }\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping (bytes32 => Record) records;\n mapping (address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(bytes32 node, address owner) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public virtual override authorised(node) returns(bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(bytes32 node, address resolver) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(bytes32 node, uint64 ttl) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(address operator, bool approved) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public virtual override view returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public virtual override view returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public virtual override view returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(bytes32 node) public virtual override view returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(address owner, address operator) external virtual override view returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(bytes32 node, address resolver, uint64 ttl) internal {\n if(resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if(ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(bytes32 label, address owner)\n external\n onlyController\n {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns(bool);\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract AddrResolver is ResolverBase {\n bytes4 constant private ADDR_INTERFACE_ID = 0x3b3b57de;\n bytes4 constant private ADDRESS_INTERFACE_ID = 0xf1cb7e06;\n uint constant private COIN_TYPE_ETH = 60;\n\n event AddrChanged(bytes32 indexed node, address a);\n event AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress);\n\n mapping(bytes32=>mapping(uint=>bytes)) _addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(bytes32 node, address a) external authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) public view returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if(a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(bytes32 node, uint coinType, bytes memory a) public authorised(node) {\n emit AddressChanged(node, coinType, a);\n if(coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n _addresses[node][coinType] = a;\n }\n\n function addr(bytes32 node, uint coinType) public view returns(bytes memory) {\n return _addresses[node][coinType];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == ADDR_INTERFACE_ID || interfaceID == ADDRESS_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(bytes memory b) internal pure returns(address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns(bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual;\n function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual;\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external virtual returns(bytes32);\n function setResolver(bytes32 node, address resolver) external virtual;\n function setOwner(bytes32 node, address owner) external virtual;\n function setTTL(bytes32 node, uint64 ttl) external virtual;\n function setApprovalForAll(address operator, bool approved) external virtual;\n function owner(bytes32 node) external virtual view returns (address);\n function resolver(bytes32 node) external virtual view returns (address);\n function ttl(bytes32 node) external virtual view returns (uint64);\n function recordExists(bytes32 node) external virtual view returns (bool);\n function isApprovedForAll(address owner, address operator) external virtual view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor () {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "pragma solidity >=0.8.4;\nabstract contract ResolverBase {\n bytes4 private constant INTERFACE_META_ID = 0x01ffc9a7;\n\n function supportsInterface(bytes4 interfaceID) virtual public pure returns(bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n\n function isAuthorised(bytes32 node) internal virtual view returns(bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\n\ninterface INameWrapper {\n function ownerOf(uint256 id) external view returns (address);\n}\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver {\n ENS ens;\n INameWrapper nameWrapper;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n constructor(ENS _ens, INameWrapper wrapperAddress){\n ens = _ens;\n nameWrapper = wrapperAddress;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external{\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n function isAuthorised(bytes32 node) internal override view returns(bool) {\n address owner = ens.owner(node);\n if(owner == address(nameWrapper) ){\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return owner == msg.sender || isApprovedForAll(owner, msg.sender);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator) public view returns (bool){\n return _operatorApprovals[account][operator];\n }\n\n function multicall(bytes[] calldata data) external returns(bytes[] memory results) {\n results = new bytes[](data.length);\n for(uint i = 0; i < data.length; i++) {\n (bool success, bytes memory result) = address(this).delegatecall(data[i]);\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override(ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver) public pure returns(bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is ResolverBase {\n bytes4 constant private ABI_INTERFACE_ID = 0x2203ab56;\n\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n mapping(bytes32=>mapping(uint256=>bytes)) abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(bytes32 node, uint256 contentType, bytes calldata data) external authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n abis[node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(bytes32 node, uint256 contentTypes) external view returns (uint256, bytes memory) {\n mapping(uint256=>bytes) storage abiset = abis[node];\n\n for (uint256 contentType = 1; contentType <= contentTypes; contentType <<= 1) {\n if ((contentType & contentTypes) != 0 && abiset[contentType].length > 0) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == ABI_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract ContentHashResolver is ResolverBase {\n bytes4 constant private CONTENT_HASH_INTERFACE_ID = 0xbc1c58d1;\n\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n mapping(bytes32=>bytes) hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(bytes32 node, bytes calldata hash) external authorised(node) {\n hashes[node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory) {\n return hashes[node];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == CONTENT_HASH_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\n\nabstract contract DNSResolver is ResolverBase {\n using RRUtils for *;\n using BytesUtils for bytes;\n\n bytes4 constant private DNS_RECORD_INTERFACE_ID = 0xa8fa5682;\n bytes4 constant private DNS_ZONE_INTERFACE_ID = 0x5c47637c;\n\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(bytes32 indexed node, bytes name, uint16 resource, bytes record);\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n // DNSZoneCleared is emitted whenever a given node's zone information is cleared.\n event DNSZoneCleared(bytes32 indexed node);\n\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(bytes32 indexed node, bytes lastzonehash, bytes zonehash);\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(bytes32=>bytes) private zonehashes;\n\n // Version the mapping for each zone. This allows users who have lost\n // track of their entries to effectively delete an entire zone by bumping\n // the version number.\n // node => version\n mapping(bytes32=>uint256) private versions;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(bytes32=>mapping(uint256=>mapping(bytes32=>mapping(uint16=>bytes)))) private records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(bytes32=>mapping(uint256=>mapping(bytes32=>uint16))) private nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(bytes32 node, bytes calldata data) external authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n // Iterate over the data to add the resource records\n for (RRUtils.RRIterator memory iter = data.iterateRRs(0); !iter.done(); iter.next()) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(node, name, resource, data, offset, iter.offset - offset, value.length == 0);\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(node, name, resource, data, offset, data.length - offset, value.length == 0);\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(bytes32 node, bytes32 name, uint16 resource) public view returns (bytes memory) {\n return records[node][versions[node]][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(bytes32 node, bytes32 name) public view returns (bool) {\n return (nameEntriesCount[node][versions[node]][name] != 0);\n }\n\n /**\n * Clear all information for a DNS zone.\n * @param node the namehash of the node for which to clear the zone\n */\n function clearDNSZone(bytes32 node) public authorised(node) {\n versions[node]++;\n emit DNSZoneCleared(node);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(bytes32 node, bytes calldata hash) external authorised(node) {\n bytes memory oldhash = zonehashes[node];\n zonehashes[node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory) {\n return zonehashes[node];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == DNS_RECORD_INTERFACE_ID ||\n interfaceID == DNS_ZONE_INTERFACE_ID ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord) private\n {\n uint256 version = versions[node];\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (records[node][version][nameHash][resource].length != 0) {\n nameEntriesCount[node][version][nameHash]--;\n }\n delete(records[node][version][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (records[node][version][nameHash][resource].length == 0) {\n nameEntriesCount[node][version][nameHash]++;\n }\n records[node][version][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\n\nabstract contract InterfaceResolver is ResolverBase, AddrResolver {\n bytes4 constant private INTERFACE_INTERFACE_ID = bytes4(keccak256(\"interfaceImplementer(bytes32,bytes4)\"));\n bytes4 private constant INTERFACE_META_ID = 0x01ffc9a7;\n\n event InterfaceChanged(bytes32 indexed node, bytes4 indexed interfaceID, address implementer);\n\n mapping(bytes32=>mapping(bytes4=>address)) interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(bytes32 node, bytes4 interfaceID, address implementer) external authorised(node) {\n interfaces[node][interfaceID] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(bytes32 node, bytes4 interfaceID) external view returns (address) {\n address implementer = interfaces[node][interfaceID];\n if(implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if(a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(abi.encodeWithSignature(\"supportsInterface(bytes4)\", INTERFACE_META_ID));\n if(!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID));\n if(!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override(AddrResolver, ResolverBase) public pure returns(bool) {\n return interfaceID == INTERFACE_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract NameResolver is ResolverBase {\n bytes4 constant private NAME_INTERFACE_ID = 0x691f3431;\n\n event NameChanged(bytes32 indexed node, string name);\n\n mapping(bytes32=>string) names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param name The name to set.\n */\n function setName(bytes32 node, string calldata name) external authorised(node) {\n names[node] = name;\n emit NameChanged(node, name);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory) {\n return names[node];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == NAME_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract PubkeyResolver is ResolverBase {\n bytes4 constant private PUBKEY_INTERFACE_ID = 0xc8690233;\n\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(bytes32=>PublicKey) pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external authorised(node) {\n pubkeys[node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y) {\n return (pubkeys[node].x, pubkeys[node].y);\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == PUBKEY_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract TextResolver is ResolverBase {\n bytes4 constant private TEXT_INTERFACE_ID = 0x59d1d43c;\n\n event TextChanged(bytes32 indexed node, string indexed indexedKey, string key);\n\n mapping(bytes32=>mapping(string=>string)) texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(bytes32 node, string calldata key, string calldata value) external authorised(node) {\n texts[node][key] = value;\n emit TextChanged(node, key, key);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(bytes32 node, string calldata key) external view returns (string memory) {\n return texts[node][key];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == TEXT_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is Ownable, ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver {\n function isAuthorised(bytes32 node) internal override view returns(bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override(ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver) public pure returns(bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_NSEC = 47;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex'00'.nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex'0361626300'.nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex'0361626300'.nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex'00'.labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex'016100'.labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(hex'016201610000'.labelCount(0) == 2, \"labelCount('b.a.') == 2\");\n require(hex'066574686c61620378797a00'.labelCount(6 +1) == 1, \"nameLength('(bthlab).xyz.') == 6\");\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes memory rrs = hex'0161000001000100000e1000047400000101620161000001000100000e100004c0a80101';\n string[2] memory names = [hex'016100', hex'0162016100'];\n string[2] memory rdatas = [hex'74000001', hex'c0a80101'];\n uint i = 0;\n for(RRUtils.RRIterator memory iter = rrs.iterateRRs(0); !iter.done(); iter.next()) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(keccak256(iter.name()) == keccak256(bytes(names[i])), \"Name matches\");\n require(keccak256(iter.rdata()) == keccak256(bytes(rdatas[i])), \"Rdata matches\");\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n function testCheckTypeBitmapTextType() public pure {\n bytes memory tb = hex'0003000080';\n require(tb.checkTypeBitmap(0, DNSTYPE_TEXT) == true, \"A record should exist in type bitmap\");\n }\n\n function testCheckTypeBitmap() public pure {\n // From https://tools.ietf.org/html/rfc4034#section-4.3\n // alfa.example.com. 86400 IN NSEC host.example.com. (\n // A MX RRSIG NSEC TYPE1234\n bytes memory tb = hex'FF0006400100000003041b000000000000000000000000000000000000000000000000000020';\n\n // Exists in bitmap\n require(tb.checkTypeBitmap(1, DNSTYPE_A) == true, \"A record should exist in type bitmap\");\n // Does not exist, but in a window that is included\n require(tb.checkTypeBitmap(1, DNSTYPE_CNAME) == false, \"CNAME record should not exist in type bitmap\");\n // Does not exist, past the end of a window that is included\n require(tb.checkTypeBitmap(1, 64) == false, \"Type 64 should not exist in type bitmap\");\n // Does not exist, in a window that does not exist\n require(tb.checkTypeBitmap(1, 769) == false, \"Type 769 should not exist in type bitmap\");\n // Exists in a subsequent window\n require(tb.checkTypeBitmap(1, DNSTYPE_TYPE1234) == true, \"Type 1234 should exist in type bitmap\");\n // Does not exist, past the end of the bitmap windows\n require(tb.checkTypeBitmap(1, 1281) == false, \"Type 1281 should not exist in type bitmap\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex'066274686c61620378797a00';\n bytes memory ethLabXyz = hex'066574686c61620378797a00';\n bytes memory xyz = hex'0378797a00';\n bytes memory a_b_c = hex'01610162016300';\n bytes memory b_b_c = hex'01620162016300';\n bytes memory c = hex'016300';\n bytes memory d = hex'016400';\n bytes memory a_d_c = hex'01610164016300';\n bytes memory b_a_c = hex'01620161016300';\n bytes memory ab_c_d = hex'0261620163016400';\n bytes memory a_c_d = hex'01610163016400';\n\n require(hex'0301616100'.compareNames(hex'0302616200') < 0, \"label lengths are correctly checked\");\n require(a_b_c.compareNames(c) > 0, \"one name has a difference of >1 label to with the same root name\");\n require(a_b_c.compareNames(d) < 0, \"one name has a difference of >1 label to with different root name\");\n require(a_b_c.compareNames(a_d_c) < 0, \"two names start the same but have differences in later labels\");\n require(a_b_c.compareNames(b_a_c) > 0, \"the first label sorts later, but the first label sorts earlier\");\n require(ab_c_d.compareNames(a_c_d) > 0, \"two names where the first label on one is a prefix of the first label on the other\");\n require(a_b_c.compareNames(b_b_c) < 0, \"two names where the first label on one is a prefix of the first label on the other\");\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(bthLabXyz.compareNames(ethLabXyz) < 0, \"bthLab.xyz comes before ethLab.xyz\");\n require(bthLabXyz.compareNames(bthLabXyz) == 0, \"bthLab.xyz and bthLab.xyz are the same\");\n require(ethLabXyz.compareNames(bthLabXyz) > 0, \"ethLab.xyz comes after bethLab.xyz\");\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA), \"0x11111111 >= 0xAAAAAAAA\");\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(hex'0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d'.computeKeytag() == 19036, \"Invalid keytag\");\n require(hex'010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf'.computeKeytag() == 21693, \"Invalid keytag (2)\");\n require(hex'0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3'.computeKeytag() == 33630);\n require(hex'0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5'.computeKeytag() == 20326, \"Invalid keytag (3)\");\n }\n}" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\"\".keccak(0, 0) == bytes32(0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470), \"Incorrect hash of empty string\");\n require(\"foo\".keccak(0, 3) == bytes32(0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d), \"Incorrect hash of 'foo'\");\n require(\"foo\".keccak(0, 0) == bytes32(0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470), \"Incorrect hash of empty string\");\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\"hello\".equals(1, \"ello\") == true, \"Substring to string equality\");\n require(\"hello\".equals(1, \"jello\", 1, 4) == true, \"Substring to substring equality\");\n require(\"zhello\".equals(1, \"abchello\", 3) == true, \"Compare different value with multiple length\");\n }\n\n function testComparePartial() public pure {\n require(\"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true, \"Compare same length\");\n require(\"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true, \"Compare different length\");\n require(\"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true, \"Compare same with different offset\");\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\"a\".compare(\"b\") < 0 == true, \"Compare different value with same length\");\n require(\"b\".compare(\"a\") > 0 == true, \"Compare different value with same length\");\n require(\"aa\".compare(\"ab\") < 0 == true, \"Compare different value with multiple length\");\n require(\"a\".compare(\"aa\") < 0 == true, \"Compare different value with different length\");\n require(\"aa\".compare(\"a\") > 0 == true, \"Compare different value with different length\");\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(longChar.compare(longChar) == 0 == true, \"Compares more than 32 bytes char\");\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(longChar.compare(otherLongChar) < 0 == true, \"Compare long char with difference at start\");\n }\n\n function testSubstring() public pure {\n require(keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")), \"Copy 0 bytes\");\n require(keccak256(bytes(\"hello\".substring(0, 4))) == keccak256(bytes(\"hell\")), \"Copy substring\");\n require(keccak256(bytes(\"hello\".substring(1, 4))) == keccak256(bytes(\"ello\")), \"Copy substring\");\n require(keccak256(bytes(\"hello\".substring(0, 5))) == keccak256(bytes(\"hello\")), \"Copy whole string\");\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) == bytes32(0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000), \"readBytes20\");\n }\n\n function testReadBytes32() public pure {\n require(\"0123456789abcdef0123456789abcdef\".readBytes32(0) == bytes32(0x3031323334353637383961626364656630313233343536373839616263646566), \"readBytes32\");\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")), \"Decode 'a'\");\n require(\"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")), \"Decode 'aa'\");\n require(\"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")), \"Decode 'aaa'\");\n require(\"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")), \"Decode 'aaaa'\");\n require(\"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")), \"Decode 'aaaaa'\");\n require(\"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")), \"Decode 'aaaaa' lowercase\");\n require(\"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(0, 42) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")), \"Decode alphabet\");\n require(\"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(0, 42) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")), \"Decode alphabet lowercase\");\n require(\"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\".base32HexDecodeWord(0, 52) == bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"), \"Decode 32*'a'\");\n require(\" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\".base32HexDecodeWord(1, 32) == bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"), \"Decode real bytes32hex\");\n }\n}" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"./nsec3digests/NSEC3Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n *\n * TODO: Support for NSEC3 records\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_NS = 2;\n uint16 constant DNSTYPE_SOA = 6;\n uint16 constant DNSTYPE_DNAME = 39;\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_NSEC = 47;\n uint16 constant DNSTYPE_DNSKEY = 48;\n uint16 constant DNSTYPE_NSEC3 = 50;\n\n uint constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n uint8 constant ALGORITHM_RSASHA256 = 8;\n\n uint8 constant DIGEST_ALGORITHM_SHA256 = 2;\n\n struct RRSet {\n uint32 inception;\n uint32 expiration;\n bytes20 hash;\n }\n\n // (name, type) => RRSet\n mapping (bytes32 => mapping(uint16 => RRSet)) rrsets;\n\n mapping (uint8 => Algorithm) public algorithms;\n mapping (uint8 => Digest) public digests;\n mapping (uint8 => NSEC3Digest) public nsec3Digests;\n\n event Test(uint t);\n event Marker();\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n rrsets[keccak256(hex\"00\")][DNSTYPE_DS] = RRSet({\n inception: uint32(0),\n expiration: uint32(3767581600), // May 22 2089 - the latest date we can encode as of writing this\n hash: bytes20(keccak256(anchors))\n });\n emit RRSetUpdated(hex\"00\", anchors);\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Sets the contract address for an NSEC3 digest algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setNSEC3Digest(uint8 id, NSEC3Digest digest) public owner_only {\n nsec3Digests[id] = digest;\n emit NSEC3DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Submits multiple RRSets\n * @param input A list of RRSets and signatures forming a chain of trust from an existing known-good record.\n * @param _proof The DNSKEY or DS to validate the first signature against.\n * @return The last RRSET submitted.\n */\n function submitRRSets(RRSetWithSignature[] memory input, bytes calldata _proof) public override returns (bytes memory) {\n bytes memory proof = _proof;\n for(uint i = 0; i < input.length; i++) {\n proof = _submitRRSet(input[i], proof);\n }\n return proof;\n }\n\n /**\n * @dev Submits a signed set of RRs to the oracle.\n *\n * RRSETs are only accepted if they are signed with a key that is already\n * trusted, or if they are self-signed, and the signing key is identified by\n * a DS record that is already trusted.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against. Must Already\n * have been submitted and proved previously.\n */\n function submitRRSet(RRSetWithSignature memory input, bytes memory proof)\n public override\n returns (bytes memory)\n {\n return _submitRRSet(input, proof);\n }\n\n /**\n * @dev Deletes an RR from the oracle.\n *\n * @param deleteType The DNS record type to delete.\n * @param deleteName which you want to delete\n * @param nsec The signed NSEC RRset. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n */\n function deleteRRSet(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory nsec, bytes memory proof)\n public override\n {\n RRUtils.SignedSet memory rrset;\n rrset = validateSignedSet(nsec, proof);\n require(rrset.typeCovered == DNSTYPE_NSEC);\n\n // Don't let someone use an old proof to delete a new name\n require(RRUtils.serialNumberGte(rrset.inception, rrsets[keccak256(deleteName)][deleteType].inception));\n\n for (RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\n // We're dealing with three names here:\n // - deleteName is the name the user wants us to delete\n // - nsecName is the owner name of the NSEC record\n // - nextName is the next name specified in the NSEC record\n //\n // And three cases:\n // - deleteName equals nsecName, in which case we can delete the\n // record if it's not in the type bitmap.\n // - nextName comes after nsecName, in which case we can delete\n // the record if deleteName comes between nextName and nsecName.\n // - nextName comes before nsecName, in which case nextName is the\n // zone apex, and deleteName must come after nsecName.\n checkNsecName(iter, rrset.name, deleteName, deleteType);\n delete rrsets[keccak256(deleteName)][deleteType];\n return;\n }\n // We should never reach this point\n revert();\n }\n\n function checkNsecName(RRUtils.RRIterator memory iter, bytes memory nsecName, bytes memory deleteName, uint16 deleteType) private pure {\n uint rdataOffset = iter.rdataOffset;\n uint nextNameLength = iter.data.nameLength(rdataOffset);\n uint rDataLength = iter.nextOffset - iter.rdataOffset;\n\n // We assume that there is always typed bitmap after the next domain name\n require(rDataLength > nextNameLength);\n\n int compareResult = deleteName.compareNames(nsecName);\n if(compareResult == 0) {\n // Name to delete is on the same label as the NSEC record\n require(!iter.data.checkTypeBitmap(rdataOffset + nextNameLength, deleteType));\n } else {\n // First check if the NSEC next name comes after the NSEC name.\n bytes memory nextName = iter.data.substring(rdataOffset,nextNameLength);\n // deleteName must come after nsecName\n require(compareResult > 0);\n if(nsecName.compareNames(nextName) < 0) {\n // deleteName must also come before nextName\n require(deleteName.compareNames(nextName) < 0);\n }\n }\n }\n\n /**\n * @dev Deletes an RR from the oracle using an NSEC3 proof.\n * Deleting a record using NSEC3 requires using up to two NSEC3 records. There are two cases:\n * 1. The name exists, but the record type doesn't. Eg, example.com has A records but no TXT records.\n * 2. The name does not exist, but a parent name does.\n * In the first case, we submit one NSEC3 proof in `closestEncloser` that matches the target name\n * but does not have the bit for `deleteType` set in its type bitmap. In the second case, we submit\n * two proofs: closestEncloser and nextClosest, that together prove that the name does not exist.\n * NSEC3 records are in the format described in section 5.3.2 of RFC4035: The RRDATA section\n * from the RRSIG without the signature data, followed by a series of canonicalised RR records\n * that the signature applies to.\n *\n * @param deleteType The DNS record type to delete.\n * @param deleteName The name to delete.\n * @param closestEncloser An NSEC3 proof matching the closest enclosing name - that is,\n * the nearest ancestor of the target name that *does* exist.\n * @param nextClosest An NSEC3 proof covering the next closest name. This proves that the immediate\n * subdomain of the closestEncloser does not exist.\n * @param dnskey An encoded DNSKEY record that has already been submitted to the oracle and can be used\n * to verify the signatures closestEncloserSig and nextClosestSig\n */\n function deleteRRSetNSEC3(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory closestEncloser, RRSetWithSignature memory nextClosest, bytes memory dnskey)\n public override\n {\n uint32 originalInception = rrsets[keccak256(deleteName)][deleteType].inception;\n\n RRUtils.SignedSet memory ce = validateSignedSet(closestEncloser, dnskey);\n checkNSEC3Validity(ce, deleteName, originalInception);\n\n RRUtils.SignedSet memory nc;\n if(nextClosest.rrset.length > 0) {\n nc = validateSignedSet(nextClosest, dnskey);\n checkNSEC3Validity(nc, deleteName, originalInception);\n }\n\n RRUtils.NSEC3 memory ceNSEC3 = readNSEC3(ce);\n // The flags field must be 0 or 1 (RFC5155 section 8.2).\n require(ceNSEC3.flags & 0xfe == 0);\n // Check that the closest encloser is from the correct zone (RFC5155 section 8.3)\n // \"The DNAME type bit must not be set and the NS type bit may only be set if the SOA type bit is set.\"\n require(!ceNSEC3.checkTypeBitmap(DNSTYPE_DNAME) && (!ceNSEC3.checkTypeBitmap(DNSTYPE_NS) || ceNSEC3.checkTypeBitmap(DNSTYPE_SOA)));\n\n // Case 1: deleteName does exist, but no records of RRTYPE deleteType do.\n if(isMatchingNSEC3Record(deleteType, deleteName, ce.name, ceNSEC3)) {\n delete rrsets[keccak256(deleteName)][deleteType];\n // Case 2: deleteName does not exist.\n } else if(isCoveringNSEC3Record(deleteName, ce.name, ceNSEC3, nc.name, readNSEC3(nc))) {\n delete rrsets[keccak256(deleteName)][deleteType];\n } else {\n revert();\n }\n }\n\n function checkNSEC3Validity(RRUtils.SignedSet memory nsec, bytes memory deleteName, uint32 originalInception) private pure {\n // The records must have been signed after the record we're trying to delete\n require(RRUtils.serialNumberGte(nsec.inception, originalInception));\n\n // The record must be an NSEC3\n require(nsec.typeCovered == DNSTYPE_NSEC3);\n\n // nsecName is of the form .zone.xyz. is the NSEC3 hash of the entire name the NSEC3 record matches, while\n // zone.xyz can be any ancestor of that name. We'll check that, so someone can't use a record on foo.com\n // as proof of the nonexistence of bar.org.\n require(checkNSEC3OwnerName(nsec.name, deleteName));\n }\n\n function isMatchingNSEC3Record(uint16 deleteType, bytes memory deleteName, bytes memory closestEncloserName, RRUtils.NSEC3 memory closestEncloser) private view returns(bool) {\n // Check the record matches the hashed name, but the type bitmap does not include the type\n if(checkNSEC3Name(closestEncloser, closestEncloserName, deleteName)) {\n return !closestEncloser.checkTypeBitmap(deleteType);\n }\n\n return false;\n }\n\n function isCoveringNSEC3Record(bytes memory deleteName, bytes memory ceName, RRUtils.NSEC3 memory ce, bytes memory ncName, RRUtils.NSEC3 memory nc) private view returns(bool) {\n // The flags field must be 0 or 1 (RFC5155 section 8.2).\n require(nc.flags & 0xfe == 0);\n\n bytes32 ceNameHash = decodeOwnerNameHash(ceName);\n bytes32 ncNameHash = decodeOwnerNameHash(ncName);\n\n uint lastOffset = 0;\n // Iterate over suffixes of the name to delete until one matches the closest encloser\n for(uint offset = deleteName.readUint8(0) + 1; offset < deleteName.length; offset += deleteName.readUint8(offset) + 1) {\n if(hashName(ce, deleteName.substring(offset, deleteName.length - offset)) == ceNameHash) {\n // Check that the next closest record encloses the name one label longer\n bytes32 checkHash = hashName(nc, deleteName.substring(lastOffset, deleteName.length - lastOffset));\n if(ncNameHash < nc.nextHashedOwnerName) {\n return checkHash > ncNameHash && checkHash < nc.nextHashedOwnerName;\n } else {\n return checkHash > ncNameHash || checkHash < nc.nextHashedOwnerName;\n }\n }\n lastOffset = offset;\n }\n // If we reached the root without finding a match, return false.\n return false;\n }\n\n function readNSEC3(RRUtils.SignedSet memory ss) private pure returns(RRUtils.NSEC3 memory) {\n RRUtils.RRIterator memory iter = ss.rrs();\n return iter.data.readNSEC3(iter.rdataOffset, iter.nextOffset - iter.rdataOffset);\n }\n\n function checkNSEC3Name(RRUtils.NSEC3 memory nsec, bytes memory ownerName, bytes memory deleteName) private view returns(bool) {\n // Compute the NSEC3 name hash of the name to delete.\n bytes32 deleteNameHash = hashName(nsec, deleteName);\n\n // Decode the NSEC3 name hash from the first label of the NSEC3 owner name.\n bytes32 nsecNameHash = decodeOwnerNameHash(ownerName);\n\n return deleteNameHash == nsecNameHash;\n }\n\n function hashName(RRUtils.NSEC3 memory nsec, bytes memory name) private view returns(bytes32) {\n return nsec3Digests[nsec.hashAlgorithm].hash(nsec.salt, name, nsec.iterations);\n }\n\n function decodeOwnerNameHash(bytes memory name) private pure returns(bytes32) {\n return name.base32HexDecodeWord(1, uint(name.readUint8(0)));\n }\n\n function checkNSEC3OwnerName(bytes memory nsecName, bytes memory deleteName) private pure returns(bool) {\n uint nsecNameOffset = nsecName.readUint8(0) + 1;\n uint deleteNameOffset = 0;\n while(deleteNameOffset < deleteName.length) {\n if(deleteName.equals(deleteNameOffset, nsecName, nsecNameOffset)) {\n return true;\n }\n deleteNameOffset += deleteName.readUint8(deleteNameOffset) + 1;\n }\n return false;\n }\n\n /**\n * @dev Returns data about the RRs (if any) known to this oracle with the provided type and name.\n * @param dnstype The DNS record type to query.\n * @param name The name to query, in DNS label-sequence format.\n * @return inception The unix timestamp (wrapped) at which the signature for this RRSET was created.\n * @return expiration The unix timestamp (wrapped) at which the signature for this RRSET expires.\n * @return hash The hash of the RRset.\n */\n function rrdata(uint16 dnstype, bytes calldata name) external override view returns (uint32, uint32, bytes20) {\n RRSet storage result = rrsets[keccak256(name)][dnstype];\n return (result.inception, result.expiration, result.hash);\n }\n\n function _submitRRSet(RRSetWithSignature memory input, bytes memory proof) internal returns (bytes memory) {\n RRUtils.SignedSet memory rrset;\n rrset = validateSignedSet(input, proof);\n\n RRSet storage storedSet = rrsets[keccak256(rrset.name)][rrset.typeCovered];\n if (storedSet.hash != bytes20(0)) {\n // To replace an existing rrset, the signature must be at least as new\n require(RRUtils.serialNumberGte(rrset.inception, storedSet.inception));\n }\n rrsets[keccak256(rrset.name)][rrset.typeCovered] = RRSet({\n inception: rrset.inception,\n expiration: rrset.expiration,\n hash: bytes20(keccak256(rrset.data))\n });\n\n emit RRSetUpdated(rrset.name, rrset.data);\n\n return rrset.data;\n }\n\n /**\n * @dev Submits a signed set of RRs to the oracle.\n *\n * RRSETs are only accepted if they are signed with a key that is already\n * trusted, or if they are self-signed, and the signing key is identified by\n * a DS record that is already trusted.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against. Must Already\n * have been submitted and proved previously.\n */\n function validateSignedSet(RRSetWithSignature memory input, bytes memory proof) internal view returns(RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n require(validProof(rrset.signerName, proof));\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n require(name.labelCount(0) == rrset.labels);\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n require(RRUtils.serialNumberGte(rrset.expiration, uint32(block.timestamp)));\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n require(RRUtils.serialNumberGte(uint32(block.timestamp), rrset.inception));\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n function validProof(bytes memory name, bytes memory proof) internal view returns(bool) {\n uint16 dnstype = proof.readUint16(proof.nameLength(0));\n return rrsets[keccak256(name)][dnstype].hash == bytes20(keccak256(proof));\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(RRUtils.SignedSet memory rrset, uint16 typecovered) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\n // We only support class IN (Internet)\n require(iter.class == DNSCLASS_IN);\n\n if(name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n require(name.length == iter.data.nameLength(iter.offset));\n require(name.equals(0, iter.data, iter.offset, name.length));\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n require(iter.dnstype == typecovered);\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(bytes memory name, RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, bytes memory proof) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n require(rrset.signerName.length <= name.length);\n require(rrset.signerName.equals(0, name, name.length - rrset.signerName.length));\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n require(verifyWithDS(rrset, data, proofRR));\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n require(verifyWithKnownKey(rrset, data, proofRR));\n } else {\n revert(\"No valid proof found\");\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n * @return True if the RRSET could be verified, false otherwise.\n */\n function verifyWithKnownKey(RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, RRUtils.RRIterator memory proof) internal view returns(bool) {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n require(proof.name().equals(rrset.signerName));\n for(; !proof.done(); proof.next()) {\n require(proof.name().equals(rrset.signerName));\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(0, keyrdata.length);\n if(verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(RRUtils.DNSKEY memory dnskey, bytes memory keyrdata, RRUtils.SignedSet memory rrset, RRSetWithSignature memory data)\n internal\n view\n returns (bool)\n {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if(dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if(dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n return algorithms[dnskey.algorithm].verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record \n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n * @return True if the RRSET could be verified, false otherwise.\n */\n function verifyWithDS(RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, RRUtils.RRIterator memory proof) internal view returns(bool) {\n for(RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\n require(iter.dnstype == DNSTYPE_DNSKEY);\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(0, keyrdata.length);\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n return verifyKeyWithDS(iter.name(), proof, dnskey, keyrdata);\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(bytes memory keyname, RRUtils.RRIterator memory dsrrs, RRUtils.DNSKEY memory dnskey, bytes memory keyrdata)\n internal view returns (bool)\n {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n RRUtils.DS memory ds = dsrrs.data.readDS(dsrrs.rdataOffset, dsrrs.nextOffset - dsrrs.rdataOffset);\n if(ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(uint8 digesttype, bytes memory data, bytes memory digest) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev Contract mixin for 'owned' contracts.\n*/\ncontract Owned {\n address public owner;\n \n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n*/\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external virtual view returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev An interface for contracts implementing a DNSSEC digest.\n*/\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(bytes calldata data, bytes calldata hash) external virtual pure returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/nsec3digests/NSEC3Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Interface for contracts that implement NSEC3 digest algorithms.\n */\ninterface NSEC3Digest {\n /**\n * @dev Performs an NSEC3 iterated hash.\n * @param salt The salt value to use on each iteration.\n * @param data The data to hash.\n * @param iterations The number of iterations to perform.\n * @return The result of the iterated hash operation.\n */\n function hash(bytes calldata salt, bytes calldata data, uint iterations) external virtual pure returns (bytes32);\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": false, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/solcInputs/2d8cd8af817b3996918016eaf0684f54.json b/solidity/dns-contracts/deployments/ropsten/solcInputs/2d8cd8af817b3996918016eaf0684f54.json new file mode 100644 index 0000000..88e1d05 --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/solcInputs/2d8cd8af817b3996918016eaf0684f54.json @@ -0,0 +1,35 @@ +{ + "language": "Solidity", + "sources": { + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 10000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/solcInputs/424cfdf012b9aa11d2e839569d49524c.json b/solidity/dns-contracts/deployments/ropsten/solcInputs/424cfdf012b9aa11d2e839569d49524c.json new file mode 100644 index 0000000..24876f9 --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/solcInputs/424cfdf012b9aa11d2e839569d49524c.json @@ -0,0 +1,116 @@ +{ + "language": "Solidity", + "sources": { + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\n\ninterface IDNSRegistrar {\n function claim(bytes memory name, bytes memory proof) external;\n function proveAndClaim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof) external;\n function proveAndClaimWithResolver(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof, address resolver, address addr) external;\n}\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar {\n using BytesUtils for bytes;\n\n DNSSEC public oracle;\n ENS public ens;\n PublicSuffixList public suffixes;\n\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event Claim(bytes32 indexed node, address indexed owner, bytes dnsname);\n event NewOracle(address oracle);\n event NewPublicSuffixList(address suffixes);\n\n constructor(DNSSEC _dnssec, PublicSuffixList _suffixes, ENS _ens) {\n oracle = _dnssec;\n emit NewOracle(address(oracle));\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setOracle(DNSSEC _dnssec) public onlyOwner {\n oracle = _dnssec;\n emit NewOracle(address(oracle));\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Claims a name by proving ownership of its DNS equivalent.\n * @param name The name to claim, in DNS wire format.\n * @param proof A DNS RRSet proving ownership of the name. Must be verified\n * in the DNSSEC oracle before calling. This RRSET must contain a TXT\n * record for '_ens.' + name, with the value 'a=0x...'. Ownership of\n * the name will be transferred to the address specified in the TXT\n * record.\n */\n function claim(bytes memory name, bytes memory proof) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(name, proof);\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input The data to be passed to the Oracle's `submitProofs` function. The last\n * proof must be the TXT record required by the registrar.\n * @param proof The proof record for the first element in input.\n */\n function proveAndClaim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof) public override {\n proof = oracle.submitRRSets(input, proof);\n claim(name, proof);\n }\n\n function proveAndClaimWithResolver(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof, address resolver, address addr) public override {\n proof = oracle.submitRRSets(input, proof);\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(name, proof);\n require(msg.sender == owner, \"Only owner can call proveAndClaimWithResolver\");\n if(addr != address(0)) {\n require(resolver != address(0), \"Cannot set addr if resolver is not set\");\n // Set ourselves as the owner so we can set a record on the resolver\n ens.setSubnodeRecord(rootNode, labelHash, address(this), resolver, 0);\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n // Transfer the record to the owner\n ens.setOwner(node, owner);\n } else {\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n }\n }\n\n function supportsInterface(bytes4 interfaceID) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(bytes memory name, bytes memory proof) internal returns(bytes32 rootNode, bytes32 labelHash, address addr) {\n // Get the first label\n uint labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n // Parent name must be in the public suffix list.\n bytes memory parentName = name.substring(labelLen + 1, name.length - labelLen - 1);\n require(suffixes.isPublicSuffix(parentName), \"Parent name must be a public suffix\");\n\n // Make sure the parent name is enabled\n rootNode = enableNode(parentName, 0);\n\n (addr,) = DNSClaimChecker.getOwnerAddress(oracle, name, proof);\n\n emit Claim(keccak256(abi.encodePacked(rootNode, labelHash)), addr, name);\n }\n\n function enableNode(bytes memory domain, uint offset) internal returns(bytes32 node) {\n uint len = domain.readUint8(offset);\n if(len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n require(owner == address(0) || owner == address(this), \"Cannot enable a name owned by someone else\");\n if(owner != address(this)) {\n if(parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n } else {\n ens.setSubnodeOwner(parentNode, label, address(this));\n }\n }\n return node;\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\n uint shortest = len;\n if (otherlen < len)\n shortest = otherlen;\n\n uint selfptr;\n uint otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint idx = 0; idx < shortest; idx += 32) {\n uint a;\n uint b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint mask;\n if (shortest > 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\n }\n int diff = int(a & mask) - int(b & mask);\n if (diff != 0)\n return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int(len) - int(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\n return self.length == other.length && equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint dest, uint src, uint len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint dest;\n uint src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\n require(len <= 52);\n\n uint ret = 0;\n uint8 decoded;\n for(uint i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if(i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint bitlen = len * 5;\n if(len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if(len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if(len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if(len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if(len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n}" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n event NSEC3DigestUpdated(uint8 id, address addr);\n event RRSetUpdated(bytes name, bytes rrset);\n\n function submitRRSets(RRSetWithSignature[] memory input, bytes calldata proof) public virtual returns (bytes memory);\n function submitRRSet(RRSetWithSignature calldata input, bytes calldata proof) public virtual returns (bytes memory);\n function deleteRRSet(uint16 deleteType, bytes calldata deleteName, RRSetWithSignature calldata nsec, bytes calldata proof) public virtual;\n function deleteRRSetNSEC3(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory closestEncloser, RRSetWithSignature memory nextClosest, bytes memory dnskey) public virtual;\n function rrdata(uint16 dnstype, bytes calldata name) external virtual view returns (uint32, uint32, bytes20);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping (bytes32 => Record) records;\n mapping (address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(bytes32 node, address owner) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public virtual override authorised(node) returns(bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(bytes32 node, address resolver) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(bytes32 node, uint64 ttl) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(address operator, bool approved) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public virtual override view returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public virtual override view returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public virtual override view returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(bytes32 node) public virtual override view returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(address owner, address operator) external virtual override view returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(bytes32 node, address resolver, uint64 ttl) internal {\n if(resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if(ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(bytes32 label, address owner)\n external\n onlyController\n {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n\n using BytesUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(DNSSEC oracle, bytes memory name, bytes memory proof)\n internal\n view\n returns (address, bool)\n {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n bytes20 hash;\n uint32 expiration;\n // Check the provided TXT record has been validated by the oracle\n (, expiration, hash) = oracle.rrdata(TYPE_TXT, buf.buf);\n if (hash == bytes20(0) && proof.length == 0) return (address(0x0), false);\n\n require(hash == bytes20(keccak256(proof)));\n\n for (RRUtils.RRIterator memory iter = proof.iterateRRs(0); !iter.done(); iter.next()) {\n require(RRUtils.serialNumberGte(expiration + iter.ttl, uint32(block.timestamp)), \"DNS record is stale; refresh or delete it before proceeding.\");\n\n bool found;\n address addr;\n (addr, found) = parseRR(proof, iter.rdataOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(bytes memory rdata, uint idx) internal pure returns (address, bool) {\n while (idx < rdata.length) {\n uint len = rdata.readUint8(idx); idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(bytes memory str, uint idx, uint len) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n if (len < 44) return (address(0x0), false);\n return hexToAddress(str, idx + 4);\n }\n\n function hexToAddress(bytes memory str, uint idx) internal pure returns (address, bool) {\n if (str.length - idx < 40) return (address(0x0), false);\n uint ret = 0;\n for (uint i = idx; i < idx + 40; i++) {\n ret <<= 4;\n uint x = str.readUint8(i);\n if (x >= 48 && x < 58) {\n ret |= x - 48;\n } else if (x >= 65 && x < 71) {\n ret |= x - 55;\n } else if (x >= 97 && x < 103) {\n ret |= x - 87;\n } else {\n return (address(0x0), false);\n }\n }\n return (address(uint160(ret)), true);\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns(bool);\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract AddrResolver is ResolverBase {\n bytes4 constant private ADDR_INTERFACE_ID = 0x3b3b57de;\n bytes4 constant private ADDRESS_INTERFACE_ID = 0xf1cb7e06;\n uint constant private COIN_TYPE_ETH = 60;\n\n event AddrChanged(bytes32 indexed node, address a);\n event AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress);\n\n mapping(bytes32=>mapping(uint=>bytes)) _addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(bytes32 node, address a) external authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) public view returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if(a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(bytes32 node, uint coinType, bytes memory a) public authorised(node) {\n emit AddressChanged(node, coinType, a);\n if(coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n _addresses[node][coinType] = a;\n }\n\n function addr(bytes32 node, uint coinType) public view returns(bytes memory) {\n return _addresses[node][coinType];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == ADDR_INTERFACE_ID || interfaceID == ADDRESS_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual;\n function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual;\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external virtual returns(bytes32);\n function setResolver(bytes32 node, address resolver) external virtual;\n function setOwner(bytes32 node, address owner) external virtual;\n function setTTL(bytes32 node, uint64 ttl) external virtual;\n function setApprovalForAll(address operator, bool approved) external virtual;\n function owner(bytes32 node) external virtual view returns (address);\n function resolver(bytes32 node) external virtual view returns (address);\n function ttl(bytes32 node) external virtual view returns (uint64);\n function recordExists(bytes32 node) external virtual view returns (bool);\n function isApprovedForAll(address owner, address operator) external virtual view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor () {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n* @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n*/\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(bytes memory self, uint offset) internal pure returns(uint) {\n uint idx = offset;\n while (true) {\n assert(idx < self.length);\n uint labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(bytes memory self, uint offset) internal pure returns(bytes memory ret) {\n uint len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(bytes memory self, uint offset) internal pure returns(uint) {\n uint count = 0;\n while (true) {\n assert(offset < self.length);\n uint labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint constant RRSIG_TYPE = 0;\n uint constant RRSIG_ALGORITHM = 2;\n uint constant RRSIG_LABELS = 3;\n uint constant RRSIG_TTL = 4;\n uint constant RRSIG_EXPIRATION = 8;\n uint constant RRSIG_INCEPTION = 12;\n uint constant RRSIG_KEY_TAG = 16;\n uint constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(bytes memory data) internal pure returns(SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(RRSIG_SIGNER_NAME + self.signerName.length, data.length - RRSIG_SIGNER_NAME - self.signerName.length);\n }\n\n function rrs(SignedSet memory rrset) internal pure returns(RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint rdataOffset;\n uint nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(bytes memory self, uint offset) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns(bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns(bytes memory) {\n return iter.data.substring(iter.offset, nameLength(iter.data, iter.offset));\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(RRIterator memory iter) internal pure returns(bytes memory) {\n return iter.data.substring(iter.rdataOffset, iter.nextOffset - iter.rdataOffset);\n }\n\n uint constant DNSKEY_FLAGS = 0;\n uint constant DNSKEY_PROTOCOL = 2;\n uint constant DNSKEY_ALGORITHM = 3;\n uint constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(bytes memory data, uint offset, uint length) internal pure returns(DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(offset + DNSKEY_PUBKEY, length - DNSKEY_PUBKEY);\n } \n\n uint constant DS_KEY_TAG = 0;\n uint constant DS_ALGORITHM = 2;\n uint constant DS_DIGEST_TYPE = 3;\n uint constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(bytes memory data, uint offset, uint length) internal pure returns(DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n struct NSEC3 {\n uint8 hashAlgorithm;\n uint8 flags;\n uint16 iterations;\n bytes salt;\n bytes32 nextHashedOwnerName;\n bytes typeBitmap;\n }\n\n uint constant NSEC3_HASH_ALGORITHM = 0;\n uint constant NSEC3_FLAGS = 1;\n uint constant NSEC3_ITERATIONS = 2;\n uint constant NSEC3_SALT_LENGTH = 4;\n uint constant NSEC3_SALT = 5;\n\n function readNSEC3(bytes memory data, uint offset, uint length) internal pure returns(NSEC3 memory self) {\n uint end = offset + length;\n self.hashAlgorithm = data.readUint8(offset + NSEC3_HASH_ALGORITHM);\n self.flags = data.readUint8(offset + NSEC3_FLAGS);\n self.iterations = data.readUint16(offset + NSEC3_ITERATIONS);\n uint8 saltLength = data.readUint8(offset + NSEC3_SALT_LENGTH);\n offset = offset + NSEC3_SALT;\n self.salt = data.substring(offset, saltLength);\n offset += saltLength;\n uint8 nextLength = data.readUint8(offset);\n require(nextLength <= 32);\n offset += 1;\n self.nextHashedOwnerName = data.readBytesN(offset, nextLength);\n offset += nextLength;\n self.typeBitmap = data.substring(offset, end - offset);\n }\n\n function checkTypeBitmap(NSEC3 memory self, uint16 rrtype) internal pure returns(bool) {\n return checkTypeBitmap(self.typeBitmap, 0, rrtype);\n }\n\n /**\n * @dev Checks if a given RR type exists in a type bitmap.\n * @param bitmap The byte string to read the type bitmap from.\n * @param offset The offset to start reading at.\n * @param rrtype The RR type to check for.\n * @return True if the type is found in the bitmap, false otherwise.\n */\n function checkTypeBitmap(bytes memory bitmap, uint offset, uint16 rrtype) internal pure returns (bool) {\n uint8 typeWindow = uint8(rrtype >> 8);\n uint8 windowByte = uint8((rrtype & 0xff) / 8);\n uint8 windowBitmask = uint8(uint8(1) << (uint8(7) - uint8(rrtype & 0x7)));\n for (uint off = offset; off < bitmap.length;) {\n uint8 window = bitmap.readUint8(off);\n uint8 len = bitmap.readUint8(off + 1);\n if (typeWindow < window) {\n // We've gone past our window; it's not here.\n return false;\n } else if (typeWindow == window) {\n // Check this type bitmap\n if (len <= windowByte) {\n // Our type is past the end of the bitmap\n return false;\n }\n return (bitmap.readUint8(off + windowByte + 2) & windowBitmask) != 0;\n } else {\n // Skip this type bitmap\n off += len + 2;\n }\n }\n\n return false;\n }\n\n function compareNames(bytes memory self, bytes memory other) internal pure returns (int) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint off;\n uint otheroff;\n uint prevoff;\n uint otherprevoff;\n uint counts = labelCount(self, 0);\n uint othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if(otheroff == 0) {\n return 1;\n }\n\n return self.compare(prevoff + 1, self.readUint8(prevoff), other, otherprevoff + 1, other.readUint8(otherprevoff));\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(uint32 i1, uint32 i2) internal pure returns(bool) {\n return int32(i1) - int32(i2) >= 0;\n }\n\n function progress(bytes memory body, uint off) internal pure returns(uint) {\n return off + 1 + body.readUint8(off);\n }\n}" + }, + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "pragma solidity >=0.8.4;\nabstract contract ResolverBase {\n bytes4 private constant INTERFACE_META_ID = 0x01ffc9a7;\n\n function supportsInterface(bytes4 interfaceID) virtual public pure returns(bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n\n function isAuthorised(bytes32 node) internal virtual view returns(bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n function bytesToAddress(bytes memory b) internal pure returns(address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns(bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n* @dev Implements the DNSSEC SHA256 digest.\n*/\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(bytes calldata data, bytes calldata hash) external override pure returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev An interface for contracts implementing a DNSSEC digest.\n*/\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(bytes calldata data, bytes calldata hash) external virtual pure returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n* @dev Implements the DNSSEC SHA1 digest.\n*/\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(bytes calldata data, bytes calldata hash) external override pure returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n* @dev Implements the DNSSEC RSASHA1 algorithm.\n*/\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(bytes calldata key, bytes calldata data, bytes calldata sig) external override view returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(exponentLen + 5, key.length - exponentLen - 5);\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(exponentLen + 7, key.length - exponentLen - 7);\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n*/\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external virtual view returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(bytes memory N, bytes memory E, bytes memory S) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(bytes memory base, bytes memory exponent, bytes memory modulus) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(gas(), 5, add(input, 32), mload(input), add(output, 32), mload(modulus))\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n* @dev Implements the DNSSEC RSASHA256 algorithm.\n*/\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(bytes calldata key, bytes calldata data, bytes calldata sig) external override view returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(exponentLen + 5, key.length - exponentLen - 5);\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(exponentLen + 7, key.length - exponentLen - 7);\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external override view returns (bool) {\n return validateSignature(sha256(data), parseSignature(signature), parseKey(key));\n }\n\n function parseSignature(bytes memory data) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(bytes memory data) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n\n // Set parameters for curve.\n uint constant a = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint constant b = 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint constant gx = 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint constant gy = 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint constant p = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint constant n = 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint constant lowSmax = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint u, uint m) internal pure\n returns (uint)\n {\n unchecked {\n if (u == 0 || u == m || m == 0)\n return 0;\n if (u > m)\n u = u % m;\n\n int t1;\n int t2 = 1;\n uint r1 = m;\n uint r2 = u;\n uint q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0)\n return (m - uint(-t1));\n\n return uint(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(uint x0, uint y0) internal pure\n returns (uint[3] memory P)\n {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(uint x1, uint y1, uint x2, uint y2) internal pure\n returns (uint[3] memory P)\n {\n uint x;\n uint y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(uint x0, uint y0, uint z0) internal pure\n returns (uint x1, uint y1)\n {\n uint z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj() internal pure\n returns (uint x, uint y, uint z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure\n returns (uint x, uint y)\n {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(uint x0, uint y0) internal pure\n returns (bool isZero)\n {\n if(x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint x, uint y) internal pure\n returns (bool)\n {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint LHS = mulmod(y, y, p); // y^2\n uint RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(uint x0, uint y0, uint z0) internal pure\n returns (uint x1, uint y1, uint z1)\n {\n uint t;\n uint u;\n uint v;\n uint w;\n\n if(isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p-x0, p);\n\n x0 = addmod(v, p-w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p-y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(uint x0, uint y0, uint z0, uint x1, uint y1, uint z1) internal pure\n returns (uint x2, uint y2, uint z2)\n {\n uint t0;\n uint t1;\n uint u0;\n uint u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n }\n else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n }\n else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(uint v, uint u0, uint u1, uint t1, uint t0) private pure\n returns (uint x2, uint y2, uint z2)\n {\n uint u;\n uint u2;\n uint u3;\n uint w;\n uint t;\n\n t = addmod(t0, p-t1, p);\n u = addmod(u0, p-u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p-u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p-w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p-t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(uint x0, uint y0, uint x1, uint y1) internal pure\n returns (uint, uint)\n {\n uint z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(uint x0, uint y0) internal pure\n returns (uint, uint)\n {\n uint z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(uint x0, uint y0, uint exp) internal pure\n returns (uint, uint)\n {\n uint base2X = x0;\n uint base2Y = y0;\n uint base2Z = 1;\n\n for(uint i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(uint x0, uint y0, uint scalar) internal pure\n returns (uint x1, uint y1)\n {\n if(scalar == 0) {\n return zeroAffine();\n }\n else if (scalar == 1) {\n return (x0, y0);\n }\n else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint base2X = x0;\n uint base2Y = y0;\n uint base2Z = 1;\n uint z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if(scalar%2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while(scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if(scalar%2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(uint scalar) internal pure\n returns (uint, uint)\n {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(bytes32 message, uint[2] memory rs, uint[2] memory Q) internal pure\n returns (bool)\n {\n\n // To disambiguate between public key solutions, include comment below.\n if(rs[0] == 0 || rs[0] >= n || rs[1] == 0) {// || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint x1;\n uint x2;\n uint y1;\n uint y2;\n\n uint sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}" + }, + "contracts/resolvers/DefaultReverseResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"../registry/ReverseRegistrar.sol\";\n\n/**\n * @dev Provides a default implementation of a resolver for reverse records,\n * which permits only the owner to update it.\n */\ncontract DefaultReverseResolver {\n // namehash('addr.reverse')\n bytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n ENS public ens;\n mapping (bytes32 => string) public name;\n\n /**\n * @dev Only permits calls by the reverse registrar.\n * @param node The node permission is required for.\n */\n modifier onlyOwner(bytes32 node) {\n require(msg.sender == ens.owner(node));\n _;\n }\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar registrar = ReverseRegistrar(ens.owner(ADDR_REVERSE_NODE));\n if (address(registrar) != address(0x0)) {\n registrar.claim(msg.sender);\n }\n }\n\n /**\n * @dev Sets the name for a node.\n * @param node The node to update.\n * @param _name The name to set.\n */\n function setName(bytes32 node, string memory _name) public onlyOwner(node) {\n name[node] = _name;\n }\n}\n" + }, + "contracts/registry/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable {\n ENS public ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n * @param resolverAddr The address of the default reverse resolver.\n */\n constructor(ENS ensAddr, NameResolver resolverAddr) {\n ens = ensAddr;\n defaultResolver = resolverAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public returns (bytes32) {\n return _claimWithResolver(msg.sender, owner, address(0x0));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(address addr, address owner)\n public\n authorised(addr)\n returns (bytes32)\n {\n return _claimWithResolver(addr, owner, address(0x0));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(address owner, address resolver)\n public\n returns (bytes32)\n {\n return _claimWithResolver(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record specified with the\n * address provided\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolverForAddr(\n address addr,\n address owner,\n address resolver\n ) public authorised(addr) returns (bytes32) {\n return _claimWithResolver(addr, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public returns (bytes32) {\n bytes32 node = _claimWithResolver(\n msg.sender,\n address(this),\n address(defaultResolver)\n );\n defaultResolver.setName(node, name);\n return node;\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. First updates the resolver to the default reverse\n * resolver if necessary.\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n string memory name\n ) public authorised(addr) returns (bytes32) {\n bytes32 node = _claimWithResolver(\n addr,\n address(this),\n address(defaultResolver)\n );\n defaultResolver.setName(node, name);\n ens.setSubnodeOwner(ADDR_REVERSE_NODE, sha3HexAddress(addr), owner);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n /* Internal functions */\n\n function _claimWithResolver(\n address addr,\n address owner,\n address resolver\n ) internal returns (bytes32) {\n bytes32 label = sha3HexAddress(addr);\n bytes32 node = keccak256(abi.encodePacked(ADDR_REVERSE_NODE, label));\n address currentResolver = ens.resolver(node);\n bool shouldUpdateResolver = (resolver != address(0x0) &&\n resolver != currentResolver);\n address newResolver = shouldUpdateResolver ? resolver : currentResolver;\n\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, label, owner, newResolver, 0);\n\n emit ReverseClaimed(addr, node);\n\n return node;\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": false, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/solcInputs/9ab134ee99f7410d077d71824d3e2f84.json b/solidity/dns-contracts/deployments/ropsten/solcInputs/9ab134ee99f7410d077d71824d3e2f84.json new file mode 100644 index 0000000..ba123bd --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/solcInputs/9ab134ee99f7410d077d71824d3e2f84.json @@ -0,0 +1,35 @@ +{ + "language": "Solidity", + "sources": { + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 10000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/solcInputs/a50cca78b1bed5d39e9ebe70f5371ee9.json b/solidity/dns-contracts/deployments/ropsten/solcInputs/a50cca78b1bed5d39e9ebe70f5371ee9.json new file mode 100644 index 0000000..6da9ed9 --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/solcInputs/a50cca78b1bed5d39e9ebe70f5371ee9.json @@ -0,0 +1,263 @@ +{ + "language": "Solidity", + "sources": { + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n\n using BytesUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(DNSSEC oracle, bytes memory name, bytes memory proof)\n internal\n view\n returns (address, bool)\n {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n bytes20 hash;\n uint32 expiration;\n // Check the provided TXT record has been validated by the oracle\n (, expiration, hash) = oracle.rrdata(TYPE_TXT, buf.buf);\n if (hash == bytes20(0) && proof.length == 0) return (address(0x0), false);\n\n require(hash == bytes20(keccak256(proof)));\n\n for (RRUtils.RRIterator memory iter = proof.iterateRRs(0); !iter.done(); iter.next()) {\n require(RRUtils.serialNumberGte(expiration + iter.ttl, uint32(block.timestamp)), \"DNS record is stale; refresh or delete it before proceeding.\");\n\n bool found;\n address addr;\n (addr, found) = parseRR(proof, iter.rdataOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(bytes memory rdata, uint idx) internal pure returns (address, bool) {\n while (idx < rdata.length) {\n uint len = rdata.readUint8(idx); idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(bytes memory str, uint idx, uint len) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n if (len < 44) return (address(0x0), false);\n return hexToAddress(str, idx + 4);\n }\n\n function hexToAddress(bytes memory str, uint idx) internal pure returns (address, bool) {\n if (str.length - idx < 40) return (address(0x0), false);\n uint ret = 0;\n for (uint i = idx; i < idx + 40; i++) {\n ret <<= 4;\n uint x = str.readUint8(i);\n if (x >= 48 && x < 58) {\n ret |= x - 48;\n } else if (x >= 65 && x < 71) {\n ret |= x - 55;\n } else if (x >= 97 && x < 103) {\n ret |= x - 87;\n } else {\n return (address(0x0), false);\n }\n }\n return (address(uint160(ret)), true);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n event NSEC3DigestUpdated(uint8 id, address addr);\n event RRSetUpdated(bytes name, bytes rrset);\n\n function submitRRSets(RRSetWithSignature[] memory input, bytes calldata proof) public virtual returns (bytes memory);\n function submitRRSet(RRSetWithSignature calldata input, bytes calldata proof) public virtual returns (bytes memory);\n function deleteRRSet(uint16 deleteType, bytes calldata deleteName, RRSetWithSignature calldata nsec, bytes calldata proof) public virtual;\n function deleteRRSetNSEC3(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory closestEncloser, RRSetWithSignature memory nextClosest, bytes memory dnskey) public virtual;\n function rrdata(uint16 dnstype, bytes calldata name) external virtual view returns (uint32, uint32, bytes20);\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(bytes memory self, uint offset, uint len) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(bytes memory self, bytes memory other) internal pure returns (int) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(bytes memory self, uint offset, uint len, bytes memory other, uint otheroffset, uint otherlen) internal pure returns (int) {\n uint shortest = len;\n if (otherlen < len)\n shortest = otherlen;\n\n uint selfptr;\n uint otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint idx = 0; idx < shortest; idx += 32) {\n uint a;\n uint b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint mask;\n if (shortest > 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\n }\n int diff = int(a & mask) - int(b & mask);\n if (diff != 0)\n return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int(len) - int(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset, uint len) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, uint offset, bytes memory other, uint otherOffset) internal pure returns (bool) {\n return keccak(self, offset, self.length - offset) == keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, uint offset, bytes memory other) internal pure returns (bool) {\n return self.length >= offset + other.length && equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, bytes memory other) internal pure returns(bool) {\n return self.length == other.length && equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(bytes memory self, uint idx) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(bytes memory self, uint idx) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(bytes memory self, uint idx) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(bytes memory self, uint idx) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(bytes memory self, uint idx) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 32), idx)), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000)\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(bytes memory self, uint idx, uint len) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint dest, uint src, uint len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(bytes memory self, uint offset, uint len) internal pure returns(bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint dest;\n uint src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable = hex'00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F';\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(bytes memory self, uint off, uint len) internal pure returns(bytes32) {\n require(len <= 52);\n\n uint ret = 0;\n uint8 decoded;\n for(uint i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if(i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint bitlen = len * 5;\n if(len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if(len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if(len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if(len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if(len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n}" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n* @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n*/\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(bytes memory self, uint offset) internal pure returns(uint) {\n uint idx = offset;\n while (true) {\n assert(idx < self.length);\n uint labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(bytes memory self, uint offset) internal pure returns(bytes memory ret) {\n uint len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(bytes memory self, uint offset) internal pure returns(uint) {\n uint count = 0;\n while (true) {\n assert(offset < self.length);\n uint labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint constant RRSIG_TYPE = 0;\n uint constant RRSIG_ALGORITHM = 2;\n uint constant RRSIG_LABELS = 3;\n uint constant RRSIG_TTL = 4;\n uint constant RRSIG_EXPIRATION = 8;\n uint constant RRSIG_INCEPTION = 12;\n uint constant RRSIG_KEY_TAG = 16;\n uint constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(bytes memory data) internal pure returns(SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(RRSIG_SIGNER_NAME + self.signerName.length, data.length - RRSIG_SIGNER_NAME - self.signerName.length);\n }\n\n function rrs(SignedSet memory rrset) internal pure returns(RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint rdataOffset;\n uint nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(bytes memory self, uint offset) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns(bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns(bytes memory) {\n return iter.data.substring(iter.offset, nameLength(iter.data, iter.offset));\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(RRIterator memory iter) internal pure returns(bytes memory) {\n return iter.data.substring(iter.rdataOffset, iter.nextOffset - iter.rdataOffset);\n }\n\n uint constant DNSKEY_FLAGS = 0;\n uint constant DNSKEY_PROTOCOL = 2;\n uint constant DNSKEY_ALGORITHM = 3;\n uint constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(bytes memory data, uint offset, uint length) internal pure returns(DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(offset + DNSKEY_PUBKEY, length - DNSKEY_PUBKEY);\n } \n\n uint constant DS_KEY_TAG = 0;\n uint constant DS_ALGORITHM = 2;\n uint constant DS_DIGEST_TYPE = 3;\n uint constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(bytes memory data, uint offset, uint length) internal pure returns(DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n struct NSEC3 {\n uint8 hashAlgorithm;\n uint8 flags;\n uint16 iterations;\n bytes salt;\n bytes32 nextHashedOwnerName;\n bytes typeBitmap;\n }\n\n uint constant NSEC3_HASH_ALGORITHM = 0;\n uint constant NSEC3_FLAGS = 1;\n uint constant NSEC3_ITERATIONS = 2;\n uint constant NSEC3_SALT_LENGTH = 4;\n uint constant NSEC3_SALT = 5;\n\n function readNSEC3(bytes memory data, uint offset, uint length) internal pure returns(NSEC3 memory self) {\n uint end = offset + length;\n self.hashAlgorithm = data.readUint8(offset + NSEC3_HASH_ALGORITHM);\n self.flags = data.readUint8(offset + NSEC3_FLAGS);\n self.iterations = data.readUint16(offset + NSEC3_ITERATIONS);\n uint8 saltLength = data.readUint8(offset + NSEC3_SALT_LENGTH);\n offset = offset + NSEC3_SALT;\n self.salt = data.substring(offset, saltLength);\n offset += saltLength;\n uint8 nextLength = data.readUint8(offset);\n require(nextLength <= 32);\n offset += 1;\n self.nextHashedOwnerName = data.readBytesN(offset, nextLength);\n offset += nextLength;\n self.typeBitmap = data.substring(offset, end - offset);\n }\n\n function checkTypeBitmap(NSEC3 memory self, uint16 rrtype) internal pure returns(bool) {\n return checkTypeBitmap(self.typeBitmap, 0, rrtype);\n }\n\n /**\n * @dev Checks if a given RR type exists in a type bitmap.\n * @param bitmap The byte string to read the type bitmap from.\n * @param offset The offset to start reading at.\n * @param rrtype The RR type to check for.\n * @return True if the type is found in the bitmap, false otherwise.\n */\n function checkTypeBitmap(bytes memory bitmap, uint offset, uint16 rrtype) internal pure returns (bool) {\n uint8 typeWindow = uint8(rrtype >> 8);\n uint8 windowByte = uint8((rrtype & 0xff) / 8);\n uint8 windowBitmask = uint8(uint8(1) << (uint8(7) - uint8(rrtype & 0x7)));\n for (uint off = offset; off < bitmap.length;) {\n uint8 window = bitmap.readUint8(off);\n uint8 len = bitmap.readUint8(off + 1);\n if (typeWindow < window) {\n // We've gone past our window; it's not here.\n return false;\n } else if (typeWindow == window) {\n // Check this type bitmap\n if (len <= windowByte) {\n // Our type is past the end of the bitmap\n return false;\n }\n return (bitmap.readUint8(off + windowByte + 2) & windowBitmask) != 0;\n } else {\n // Skip this type bitmap\n off += len + 2;\n }\n }\n\n return false;\n }\n\n function compareNames(bytes memory self, bytes memory other) internal pure returns (int) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint off;\n uint otheroff;\n uint prevoff;\n uint otherprevoff;\n uint counts = labelCount(self, 0);\n uint othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if(otheroff == 0) {\n return 1;\n }\n\n return self.compare(prevoff + 1, self.readUint8(prevoff), other, otherprevoff + 1, other.readUint8(otherprevoff));\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(uint32 i1, uint32 i2) internal pure returns(bool) {\n return int32(i1) - int32(i2) >= 0;\n }\n\n function progress(bytes memory body, uint off) internal pure returns(uint) {\n return off + 1 + body.readUint8(off);\n }\n}" + }, + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\n\ninterface IDNSRegistrar {\n function claim(bytes memory name, bytes memory proof) external;\n function proveAndClaim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof) external;\n function proveAndClaimWithResolver(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof, address resolver, address addr) external;\n}\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar {\n using BytesUtils for bytes;\n\n DNSSEC public oracle;\n ENS public ens;\n PublicSuffixList public suffixes;\n\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event Claim(bytes32 indexed node, address indexed owner, bytes dnsname);\n event NewOracle(address oracle);\n event NewPublicSuffixList(address suffixes);\n\n constructor(DNSSEC _dnssec, PublicSuffixList _suffixes, ENS _ens) {\n oracle = _dnssec;\n emit NewOracle(address(oracle));\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setOracle(DNSSEC _dnssec) public onlyOwner {\n oracle = _dnssec;\n emit NewOracle(address(oracle));\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Claims a name by proving ownership of its DNS equivalent.\n * @param name The name to claim, in DNS wire format.\n * @param proof A DNS RRSet proving ownership of the name. Must be verified\n * in the DNSSEC oracle before calling. This RRSET must contain a TXT\n * record for '_ens.' + name, with the value 'a=0x...'. Ownership of\n * the name will be transferred to the address specified in the TXT\n * record.\n */\n function claim(bytes memory name, bytes memory proof) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(name, proof);\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input The data to be passed to the Oracle's `submitProofs` function. The last\n * proof must be the TXT record required by the registrar.\n * @param proof The proof record for the first element in input.\n */\n function proveAndClaim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof) public override {\n proof = oracle.submitRRSets(input, proof);\n claim(name, proof);\n }\n\n function proveAndClaimWithResolver(bytes memory name, DNSSEC.RRSetWithSignature[] memory input, bytes memory proof, address resolver, address addr) public override {\n proof = oracle.submitRRSets(input, proof);\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(name, proof);\n require(msg.sender == owner, \"Only owner can call proveAndClaimWithResolver\");\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if(addr != address(0)) {\n require(resolver != address(0), \"Cannot set addr if resolver is not set\");\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(bytes4 interfaceID) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(bytes memory name, bytes memory proof) internal returns(bytes32 rootNode, bytes32 labelHash, address addr) {\n // Get the first label\n uint labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n // Parent name must be in the public suffix list.\n bytes memory parentName = name.substring(labelLen + 1, name.length - labelLen - 1);\n require(suffixes.isPublicSuffix(parentName), \"Parent name must be a public suffix\");\n\n // Make sure the parent name is enabled\n rootNode = enableNode(parentName, 0);\n\n (addr,) = DNSClaimChecker.getOwnerAddress(oracle, name, proof);\n\n emit Claim(keccak256(abi.encodePacked(rootNode, labelHash)), addr, name);\n }\n\n function enableNode(bytes memory domain, uint offset) internal returns(bytes32 node) {\n uint len = domain.readUint8(offset);\n if(len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n require(owner == address(0) || owner == address(this), \"Cannot enable a name owned by someone else\");\n if(owner != address(this)) {\n if(parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n } else {\n ens.setSubnodeOwner(parentNode, label, address(this));\n }\n }\n return node;\n }\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping (bytes32 => Record) records;\n mapping (address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(bytes32 node, address owner) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public virtual override authorised(node) returns(bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(bytes32 node, address resolver) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(bytes32 node, uint64 ttl) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(address operator, bool approved) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public virtual override view returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public virtual override view returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public virtual override view returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(bytes32 node) public virtual override view returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(address owner, address operator) external virtual override view returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(bytes32 node, address resolver, uint64 ttl) internal {\n if(resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if(ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(bytes32 label, address owner)\n external\n onlyController\n {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns(bool);\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract AddrResolver is ResolverBase {\n bytes4 constant private ADDR_INTERFACE_ID = 0x3b3b57de;\n bytes4 constant private ADDRESS_INTERFACE_ID = 0xf1cb7e06;\n uint constant private COIN_TYPE_ETH = 60;\n\n event AddrChanged(bytes32 indexed node, address a);\n event AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress);\n\n mapping(bytes32=>mapping(uint=>bytes)) _addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(bytes32 node, address a) external authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) public view returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if(a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(bytes32 node, uint coinType, bytes memory a) public authorised(node) {\n emit AddressChanged(node, coinType, a);\n if(coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n _addresses[node][coinType] = a;\n }\n\n function addr(bytes32 node, uint coinType) public view returns(bytes memory) {\n return _addresses[node][coinType];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == ADDR_INTERFACE_ID || interfaceID == ADDRESS_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual;\n function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual;\n function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external virtual returns(bytes32);\n function setResolver(bytes32 node, address resolver) external virtual;\n function setOwner(bytes32 node, address owner) external virtual;\n function setTTL(bytes32 node, uint64 ttl) external virtual;\n function setApprovalForAll(address operator, bool approved) external virtual;\n function owner(bytes32 node) external virtual view returns (address);\n function resolver(bytes32 node) external virtual view returns (address);\n function ttl(bytes32 node) external virtual view returns (uint64);\n function recordExists(bytes32 node) external virtual view returns (bool);\n function isApprovedForAll(address owner, address operator) external virtual view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor () {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "pragma solidity >=0.8.4;\nabstract contract ResolverBase {\n bytes4 private constant INTERFACE_META_ID = 0x01ffc9a7;\n\n function supportsInterface(bytes4 interfaceID) virtual public pure returns(bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n\n function isAuthorised(bytes32 node) internal virtual view returns(bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n function bytesToAddress(bytes memory b) internal pure returns(address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns(bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\n\ninterface INameWrapper {\n function ownerOf(uint256 id) external view returns (address);\n}\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver {\n ENS ens;\n INameWrapper nameWrapper;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n constructor(ENS _ens, INameWrapper wrapperAddress){\n ens = _ens;\n nameWrapper = wrapperAddress;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external{\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n function isAuthorised(bytes32 node) internal override view returns(bool) {\n address owner = ens.owner(node);\n if(owner == address(nameWrapper) ){\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return owner == msg.sender || isApprovedForAll(owner, msg.sender);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator) public view returns (bool){\n return _operatorApprovals[account][operator];\n }\n\n function multicall(bytes[] calldata data) external returns(bytes[] memory results) {\n results = new bytes[](data.length);\n for(uint i = 0; i < data.length; i++) {\n (bool success, bytes memory result) = address(this).delegatecall(data[i]);\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override(ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver) public pure returns(bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is ResolverBase {\n bytes4 constant private ABI_INTERFACE_ID = 0x2203ab56;\n\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n mapping(bytes32=>mapping(uint256=>bytes)) abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(bytes32 node, uint256 contentType, bytes calldata data) external authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n abis[node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(bytes32 node, uint256 contentTypes) external view returns (uint256, bytes memory) {\n mapping(uint256=>bytes) storage abiset = abis[node];\n\n for (uint256 contentType = 1; contentType <= contentTypes; contentType <<= 1) {\n if ((contentType & contentTypes) != 0 && abiset[contentType].length > 0) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == ABI_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract ContentHashResolver is ResolverBase {\n bytes4 constant private CONTENT_HASH_INTERFACE_ID = 0xbc1c58d1;\n\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n mapping(bytes32=>bytes) hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(bytes32 node, bytes calldata hash) external authorised(node) {\n hashes[node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory) {\n return hashes[node];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == CONTENT_HASH_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\n\nabstract contract DNSResolver is ResolverBase {\n using RRUtils for *;\n using BytesUtils for bytes;\n\n bytes4 constant private DNS_RECORD_INTERFACE_ID = 0xa8fa5682;\n bytes4 constant private DNS_ZONE_INTERFACE_ID = 0x5c47637c;\n\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(bytes32 indexed node, bytes name, uint16 resource, bytes record);\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n // DNSZoneCleared is emitted whenever a given node's zone information is cleared.\n event DNSZoneCleared(bytes32 indexed node);\n\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(bytes32 indexed node, bytes lastzonehash, bytes zonehash);\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(bytes32=>bytes) private zonehashes;\n\n // Version the mapping for each zone. This allows users who have lost\n // track of their entries to effectively delete an entire zone by bumping\n // the version number.\n // node => version\n mapping(bytes32=>uint256) private versions;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(bytes32=>mapping(uint256=>mapping(bytes32=>mapping(uint16=>bytes)))) private records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(bytes32=>mapping(uint256=>mapping(bytes32=>uint16))) private nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(bytes32 node, bytes calldata data) external authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n // Iterate over the data to add the resource records\n for (RRUtils.RRIterator memory iter = data.iterateRRs(0); !iter.done(); iter.next()) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(node, name, resource, data, offset, iter.offset - offset, value.length == 0);\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(node, name, resource, data, offset, data.length - offset, value.length == 0);\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(bytes32 node, bytes32 name, uint16 resource) public view returns (bytes memory) {\n return records[node][versions[node]][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(bytes32 node, bytes32 name) public view returns (bool) {\n return (nameEntriesCount[node][versions[node]][name] != 0);\n }\n\n /**\n * Clear all information for a DNS zone.\n * @param node the namehash of the node for which to clear the zone\n */\n function clearDNSZone(bytes32 node) public authorised(node) {\n versions[node]++;\n emit DNSZoneCleared(node);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(bytes32 node, bytes calldata hash) external authorised(node) {\n bytes memory oldhash = zonehashes[node];\n zonehashes[node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory) {\n return zonehashes[node];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == DNS_RECORD_INTERFACE_ID ||\n interfaceID == DNS_ZONE_INTERFACE_ID ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord) private\n {\n uint256 version = versions[node];\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (records[node][version][nameHash][resource].length != 0) {\n nameEntriesCount[node][version][nameHash]--;\n }\n delete(records[node][version][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (records[node][version][nameHash][resource].length == 0) {\n nameEntriesCount[node][version][nameHash]++;\n }\n records[node][version][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\n\nabstract contract InterfaceResolver is ResolverBase, AddrResolver {\n bytes4 constant private INTERFACE_INTERFACE_ID = bytes4(keccak256(\"interfaceImplementer(bytes32,bytes4)\"));\n bytes4 private constant INTERFACE_META_ID = 0x01ffc9a7;\n\n event InterfaceChanged(bytes32 indexed node, bytes4 indexed interfaceID, address implementer);\n\n mapping(bytes32=>mapping(bytes4=>address)) interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(bytes32 node, bytes4 interfaceID, address implementer) external authorised(node) {\n interfaces[node][interfaceID] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(bytes32 node, bytes4 interfaceID) external view returns (address) {\n address implementer = interfaces[node][interfaceID];\n if(implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if(a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(abi.encodeWithSignature(\"supportsInterface(bytes4)\", INTERFACE_META_ID));\n if(!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID));\n if(!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override(AddrResolver, ResolverBase) public pure returns(bool) {\n return interfaceID == INTERFACE_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract NameResolver is ResolverBase {\n bytes4 constant private NAME_INTERFACE_ID = 0x691f3431;\n\n event NameChanged(bytes32 indexed node, string name);\n\n mapping(bytes32=>string) names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param name The name to set.\n */\n function setName(bytes32 node, string calldata name) external authorised(node) {\n names[node] = name;\n emit NameChanged(node, name);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory) {\n return names[node];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == NAME_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract PubkeyResolver is ResolverBase {\n bytes4 constant private PUBKEY_INTERFACE_ID = 0xc8690233;\n\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(bytes32=>PublicKey) pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external authorised(node) {\n pubkeys[node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y) {\n return (pubkeys[node].x, pubkeys[node].y);\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == PUBKEY_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"../ResolverBase.sol\";\n\nabstract contract TextResolver is ResolverBase {\n bytes4 constant private TEXT_INTERFACE_ID = 0x59d1d43c;\n\n event TextChanged(bytes32 indexed node, string indexed indexedKey, string key);\n\n mapping(bytes32=>mapping(string=>string)) texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(bytes32 node, string calldata key, string calldata value) external authorised(node) {\n texts[node][key] = value;\n emit TextChanged(node, key, key);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(bytes32 node, string calldata key) external view returns (string memory) {\n return texts[node][key];\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {\n return interfaceID == TEXT_INTERFACE_ID || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is Ownable, ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver {\n function isAuthorised(bytes32 node) internal override view returns(bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(bytes4 interfaceID) virtual override(ABIResolver, AddrResolver, ContentHashResolver, DNSResolver, InterfaceResolver, NameResolver, PubkeyResolver, TextResolver) public pure returns(bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_NSEC = 47;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex'00'.nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex'0361626300'.nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex'0361626300'.nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex'00'.labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex'016100'.labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(hex'016201610000'.labelCount(0) == 2, \"labelCount('b.a.') == 2\");\n require(hex'066574686c61620378797a00'.labelCount(6 +1) == 1, \"nameLength('(bthlab).xyz.') == 6\");\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes memory rrs = hex'0161000001000100000e1000047400000101620161000001000100000e100004c0a80101';\n string[2] memory names = [hex'016100', hex'0162016100'];\n string[2] memory rdatas = [hex'74000001', hex'c0a80101'];\n uint i = 0;\n for(RRUtils.RRIterator memory iter = rrs.iterateRRs(0); !iter.done(); iter.next()) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(keccak256(iter.name()) == keccak256(bytes(names[i])), \"Name matches\");\n require(keccak256(iter.rdata()) == keccak256(bytes(rdatas[i])), \"Rdata matches\");\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n function testCheckTypeBitmapTextType() public pure {\n bytes memory tb = hex'0003000080';\n require(tb.checkTypeBitmap(0, DNSTYPE_TEXT) == true, \"A record should exist in type bitmap\");\n }\n\n function testCheckTypeBitmap() public pure {\n // From https://tools.ietf.org/html/rfc4034#section-4.3\n // alfa.example.com. 86400 IN NSEC host.example.com. (\n // A MX RRSIG NSEC TYPE1234\n bytes memory tb = hex'FF0006400100000003041b000000000000000000000000000000000000000000000000000020';\n\n // Exists in bitmap\n require(tb.checkTypeBitmap(1, DNSTYPE_A) == true, \"A record should exist in type bitmap\");\n // Does not exist, but in a window that is included\n require(tb.checkTypeBitmap(1, DNSTYPE_CNAME) == false, \"CNAME record should not exist in type bitmap\");\n // Does not exist, past the end of a window that is included\n require(tb.checkTypeBitmap(1, 64) == false, \"Type 64 should not exist in type bitmap\");\n // Does not exist, in a window that does not exist\n require(tb.checkTypeBitmap(1, 769) == false, \"Type 769 should not exist in type bitmap\");\n // Exists in a subsequent window\n require(tb.checkTypeBitmap(1, DNSTYPE_TYPE1234) == true, \"Type 1234 should exist in type bitmap\");\n // Does not exist, past the end of the bitmap windows\n require(tb.checkTypeBitmap(1, 1281) == false, \"Type 1281 should not exist in type bitmap\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex'066274686c61620378797a00';\n bytes memory ethLabXyz = hex'066574686c61620378797a00';\n bytes memory xyz = hex'0378797a00';\n bytes memory a_b_c = hex'01610162016300';\n bytes memory b_b_c = hex'01620162016300';\n bytes memory c = hex'016300';\n bytes memory d = hex'016400';\n bytes memory a_d_c = hex'01610164016300';\n bytes memory b_a_c = hex'01620161016300';\n bytes memory ab_c_d = hex'0261620163016400';\n bytes memory a_c_d = hex'01610163016400';\n\n require(hex'0301616100'.compareNames(hex'0302616200') < 0, \"label lengths are correctly checked\");\n require(a_b_c.compareNames(c) > 0, \"one name has a difference of >1 label to with the same root name\");\n require(a_b_c.compareNames(d) < 0, \"one name has a difference of >1 label to with different root name\");\n require(a_b_c.compareNames(a_d_c) < 0, \"two names start the same but have differences in later labels\");\n require(a_b_c.compareNames(b_a_c) > 0, \"the first label sorts later, but the first label sorts earlier\");\n require(ab_c_d.compareNames(a_c_d) > 0, \"two names where the first label on one is a prefix of the first label on the other\");\n require(a_b_c.compareNames(b_b_c) < 0, \"two names where the first label on one is a prefix of the first label on the other\");\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(bthLabXyz.compareNames(ethLabXyz) < 0, \"bthLab.xyz comes before ethLab.xyz\");\n require(bthLabXyz.compareNames(bthLabXyz) == 0, \"bthLab.xyz and bthLab.xyz are the same\");\n require(ethLabXyz.compareNames(bthLabXyz) > 0, \"ethLab.xyz comes after bethLab.xyz\");\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA), \"0x11111111 >= 0xAAAAAAAA\");\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n}" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\"\".keccak(0, 0) == bytes32(0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470), \"Incorrect hash of empty string\");\n require(\"foo\".keccak(0, 3) == bytes32(0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d), \"Incorrect hash of 'foo'\");\n require(\"foo\".keccak(0, 0) == bytes32(0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470), \"Incorrect hash of empty string\");\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\"hello\".equals(1, \"ello\") == true, \"Substring to string equality\");\n require(\"hello\".equals(1, \"jello\", 1, 4) == true, \"Substring to substring equality\");\n require(\"zhello\".equals(1, \"abchello\", 3) == true, \"Compare different value with multiple length\");\n }\n\n function testComparePartial() public pure {\n require(\"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true, \"Compare same length\");\n require(\"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true, \"Compare different length\");\n require(\"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true, \"Compare same with different offset\");\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\"a\".compare(\"b\") < 0 == true, \"Compare different value with same length\");\n require(\"b\".compare(\"a\") > 0 == true, \"Compare different value with same length\");\n require(\"aa\".compare(\"ab\") < 0 == true, \"Compare different value with multiple length\");\n require(\"a\".compare(\"aa\") < 0 == true, \"Compare different value with different length\");\n require(\"aa\".compare(\"a\") > 0 == true, \"Compare different value with different length\");\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(longChar.compare(longChar) == 0 == true, \"Compares more than 32 bytes char\");\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(longChar.compare(otherLongChar) < 0 == true, \"Compare long char with difference at start\");\n }\n\n function testSubstring() public pure {\n require(keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")), \"Copy 0 bytes\");\n require(keccak256(bytes(\"hello\".substring(0, 4))) == keccak256(bytes(\"hell\")), \"Copy substring\");\n require(keccak256(bytes(\"hello\".substring(1, 4))) == keccak256(bytes(\"ello\")), \"Copy substring\");\n require(keccak256(bytes(\"hello\".substring(0, 5))) == keccak256(bytes(\"hello\")), \"Copy whole string\");\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) == bytes32(0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000), \"readBytes20\");\n }\n\n function testReadBytes32() public pure {\n require(\"0123456789abcdef0123456789abcdef\".readBytes32(0) == bytes32(0x3031323334353637383961626364656630313233343536373839616263646566), \"readBytes32\");\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")), \"Decode 'a'\");\n require(\"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")), \"Decode 'aa'\");\n require(\"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")), \"Decode 'aaa'\");\n require(\"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")), \"Decode 'aaaa'\");\n require(\"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")), \"Decode 'aaaaa'\");\n require(\"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")), \"Decode 'aaaaa' lowercase\");\n require(\"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(0, 42) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")), \"Decode alphabet\");\n require(\"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(0, 42) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")), \"Decode alphabet lowercase\");\n require(\"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\".base32HexDecodeWord(0, 52) == bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"), \"Decode 32*'a'\");\n require(\" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\".base32HexDecodeWord(1, 32) == bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"), \"Decode real bytes32hex\");\n }\n}" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"./nsec3digests/NSEC3Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n *\n * TODO: Support for NSEC3 records\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_NS = 2;\n uint16 constant DNSTYPE_SOA = 6;\n uint16 constant DNSTYPE_DNAME = 39;\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_NSEC = 47;\n uint16 constant DNSTYPE_DNSKEY = 48;\n uint16 constant DNSTYPE_NSEC3 = 50;\n\n uint constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n uint8 constant ALGORITHM_RSASHA256 = 8;\n\n uint8 constant DIGEST_ALGORITHM_SHA256 = 2;\n\n struct RRSet {\n uint32 inception;\n uint32 expiration;\n bytes20 hash;\n }\n\n // (name, type) => RRSet\n mapping (bytes32 => mapping(uint16 => RRSet)) rrsets;\n\n mapping (uint8 => Algorithm) public algorithms;\n mapping (uint8 => Digest) public digests;\n mapping (uint8 => NSEC3Digest) public nsec3Digests;\n\n event Test(uint t);\n event Marker();\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n rrsets[keccak256(hex\"00\")][DNSTYPE_DS] = RRSet({\n inception: uint32(0),\n expiration: uint32(3767581600), // May 22 2089 - the latest date we can encode as of writing this\n hash: bytes20(keccak256(anchors))\n });\n emit RRSetUpdated(hex\"00\", anchors);\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Sets the contract address for an NSEC3 digest algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setNSEC3Digest(uint8 id, NSEC3Digest digest) public owner_only {\n nsec3Digests[id] = digest;\n emit NSEC3DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Submits multiple RRSets\n * @param input A list of RRSets and signatures forming a chain of trust from an existing known-good record.\n * @param _proof The DNSKEY or DS to validate the first signature against.\n * @return The last RRSET submitted.\n */\n function submitRRSets(RRSetWithSignature[] memory input, bytes calldata _proof) public override returns (bytes memory) {\n bytes memory proof = _proof;\n for(uint i = 0; i < input.length; i++) {\n proof = _submitRRSet(input[i], proof);\n }\n return proof;\n }\n\n /**\n * @dev Submits a signed set of RRs to the oracle.\n *\n * RRSETs are only accepted if they are signed with a key that is already\n * trusted, or if they are self-signed, and the signing key is identified by\n * a DS record that is already trusted.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against. Must Already\n * have been submitted and proved previously.\n */\n function submitRRSet(RRSetWithSignature memory input, bytes memory proof)\n public override\n returns (bytes memory)\n {\n return _submitRRSet(input, proof);\n }\n\n /**\n * @dev Deletes an RR from the oracle.\n *\n * @param deleteType The DNS record type to delete.\n * @param deleteName which you want to delete\n * @param nsec The signed NSEC RRset. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n */\n function deleteRRSet(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory nsec, bytes memory proof)\n public override\n {\n RRUtils.SignedSet memory rrset;\n rrset = validateSignedSet(nsec, proof);\n require(rrset.typeCovered == DNSTYPE_NSEC);\n\n // Don't let someone use an old proof to delete a new name\n require(RRUtils.serialNumberGte(rrset.inception, rrsets[keccak256(deleteName)][deleteType].inception));\n\n for (RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\n // We're dealing with three names here:\n // - deleteName is the name the user wants us to delete\n // - nsecName is the owner name of the NSEC record\n // - nextName is the next name specified in the NSEC record\n //\n // And three cases:\n // - deleteName equals nsecName, in which case we can delete the\n // record if it's not in the type bitmap.\n // - nextName comes after nsecName, in which case we can delete\n // the record if deleteName comes between nextName and nsecName.\n // - nextName comes before nsecName, in which case nextName is the\n // zone apex, and deleteName must come after nsecName.\n checkNsecName(iter, rrset.name, deleteName, deleteType);\n delete rrsets[keccak256(deleteName)][deleteType];\n return;\n }\n // We should never reach this point\n revert();\n }\n\n function checkNsecName(RRUtils.RRIterator memory iter, bytes memory nsecName, bytes memory deleteName, uint16 deleteType) private pure {\n uint rdataOffset = iter.rdataOffset;\n uint nextNameLength = iter.data.nameLength(rdataOffset);\n uint rDataLength = iter.nextOffset - iter.rdataOffset;\n\n // We assume that there is always typed bitmap after the next domain name\n require(rDataLength > nextNameLength);\n\n int compareResult = deleteName.compareNames(nsecName);\n if(compareResult == 0) {\n // Name to delete is on the same label as the NSEC record\n require(!iter.data.checkTypeBitmap(rdataOffset + nextNameLength, deleteType));\n } else {\n // First check if the NSEC next name comes after the NSEC name.\n bytes memory nextName = iter.data.substring(rdataOffset,nextNameLength);\n // deleteName must come after nsecName\n require(compareResult > 0);\n if(nsecName.compareNames(nextName) < 0) {\n // deleteName must also come before nextName\n require(deleteName.compareNames(nextName) < 0);\n }\n }\n }\n\n /**\n * @dev Deletes an RR from the oracle using an NSEC3 proof.\n * Deleting a record using NSEC3 requires using up to two NSEC3 records. There are two cases:\n * 1. The name exists, but the record type doesn't. Eg, example.com has A records but no TXT records.\n * 2. The name does not exist, but a parent name does.\n * In the first case, we submit one NSEC3 proof in `closestEncloser` that matches the target name\n * but does not have the bit for `deleteType` set in its type bitmap. In the second case, we submit\n * two proofs: closestEncloser and nextClosest, that together prove that the name does not exist.\n * NSEC3 records are in the format described in section 5.3.2 of RFC4035: The RRDATA section\n * from the RRSIG without the signature data, followed by a series of canonicalised RR records\n * that the signature applies to.\n *\n * @param deleteType The DNS record type to delete.\n * @param deleteName The name to delete.\n * @param closestEncloser An NSEC3 proof matching the closest enclosing name - that is,\n * the nearest ancestor of the target name that *does* exist.\n * @param nextClosest An NSEC3 proof covering the next closest name. This proves that the immediate\n * subdomain of the closestEncloser does not exist.\n * @param dnskey An encoded DNSKEY record that has already been submitted to the oracle and can be used\n * to verify the signatures closestEncloserSig and nextClosestSig\n */\n function deleteRRSetNSEC3(uint16 deleteType, bytes memory deleteName, RRSetWithSignature memory closestEncloser, RRSetWithSignature memory nextClosest, bytes memory dnskey)\n public override\n {\n uint32 originalInception = rrsets[keccak256(deleteName)][deleteType].inception;\n\n RRUtils.SignedSet memory ce = validateSignedSet(closestEncloser, dnskey);\n checkNSEC3Validity(ce, deleteName, originalInception);\n\n RRUtils.SignedSet memory nc;\n if(nextClosest.rrset.length > 0) {\n nc = validateSignedSet(nextClosest, dnskey);\n checkNSEC3Validity(nc, deleteName, originalInception);\n }\n\n RRUtils.NSEC3 memory ceNSEC3 = readNSEC3(ce);\n // The flags field must be 0 or 1 (RFC5155 section 8.2).\n require(ceNSEC3.flags & 0xfe == 0);\n // Check that the closest encloser is from the correct zone (RFC5155 section 8.3)\n // \"The DNAME type bit must not be set and the NS type bit may only be set if the SOA type bit is set.\"\n require(!ceNSEC3.checkTypeBitmap(DNSTYPE_DNAME) && (!ceNSEC3.checkTypeBitmap(DNSTYPE_NS) || ceNSEC3.checkTypeBitmap(DNSTYPE_SOA)));\n\n // Case 1: deleteName does exist, but no records of RRTYPE deleteType do.\n if(isMatchingNSEC3Record(deleteType, deleteName, ce.name, ceNSEC3)) {\n delete rrsets[keccak256(deleteName)][deleteType];\n // Case 2: deleteName does not exist.\n } else if(isCoveringNSEC3Record(deleteName, ce.name, ceNSEC3, nc.name, readNSEC3(nc))) {\n delete rrsets[keccak256(deleteName)][deleteType];\n } else {\n revert();\n }\n }\n\n function checkNSEC3Validity(RRUtils.SignedSet memory nsec, bytes memory deleteName, uint32 originalInception) private pure {\n // The records must have been signed after the record we're trying to delete\n require(RRUtils.serialNumberGte(nsec.inception, originalInception));\n\n // The record must be an NSEC3\n require(nsec.typeCovered == DNSTYPE_NSEC3);\n\n // nsecName is of the form .zone.xyz. is the NSEC3 hash of the entire name the NSEC3 record matches, while\n // zone.xyz can be any ancestor of that name. We'll check that, so someone can't use a record on foo.com\n // as proof of the nonexistence of bar.org.\n require(checkNSEC3OwnerName(nsec.name, deleteName));\n }\n\n function isMatchingNSEC3Record(uint16 deleteType, bytes memory deleteName, bytes memory closestEncloserName, RRUtils.NSEC3 memory closestEncloser) private view returns(bool) {\n // Check the record matches the hashed name, but the type bitmap does not include the type\n if(checkNSEC3Name(closestEncloser, closestEncloserName, deleteName)) {\n return !closestEncloser.checkTypeBitmap(deleteType);\n }\n\n return false;\n }\n\n function isCoveringNSEC3Record(bytes memory deleteName, bytes memory ceName, RRUtils.NSEC3 memory ce, bytes memory ncName, RRUtils.NSEC3 memory nc) private view returns(bool) {\n // The flags field must be 0 or 1 (RFC5155 section 8.2).\n require(nc.flags & 0xfe == 0);\n\n bytes32 ceNameHash = decodeOwnerNameHash(ceName);\n bytes32 ncNameHash = decodeOwnerNameHash(ncName);\n\n uint lastOffset = 0;\n // Iterate over suffixes of the name to delete until one matches the closest encloser\n for(uint offset = deleteName.readUint8(0) + 1; offset < deleteName.length; offset += deleteName.readUint8(offset) + 1) {\n if(hashName(ce, deleteName.substring(offset, deleteName.length - offset)) == ceNameHash) {\n // Check that the next closest record encloses the name one label longer\n bytes32 checkHash = hashName(nc, deleteName.substring(lastOffset, deleteName.length - lastOffset));\n if(ncNameHash < nc.nextHashedOwnerName) {\n return checkHash > ncNameHash && checkHash < nc.nextHashedOwnerName;\n } else {\n return checkHash > ncNameHash || checkHash < nc.nextHashedOwnerName;\n }\n }\n lastOffset = offset;\n }\n // If we reached the root without finding a match, return false.\n return false;\n }\n\n function readNSEC3(RRUtils.SignedSet memory ss) private pure returns(RRUtils.NSEC3 memory) {\n RRUtils.RRIterator memory iter = ss.rrs();\n return iter.data.readNSEC3(iter.rdataOffset, iter.nextOffset - iter.rdataOffset);\n }\n\n function checkNSEC3Name(RRUtils.NSEC3 memory nsec, bytes memory ownerName, bytes memory deleteName) private view returns(bool) {\n // Compute the NSEC3 name hash of the name to delete.\n bytes32 deleteNameHash = hashName(nsec, deleteName);\n\n // Decode the NSEC3 name hash from the first label of the NSEC3 owner name.\n bytes32 nsecNameHash = decodeOwnerNameHash(ownerName);\n\n return deleteNameHash == nsecNameHash;\n }\n\n function hashName(RRUtils.NSEC3 memory nsec, bytes memory name) private view returns(bytes32) {\n return nsec3Digests[nsec.hashAlgorithm].hash(nsec.salt, name, nsec.iterations);\n }\n\n function decodeOwnerNameHash(bytes memory name) private pure returns(bytes32) {\n return name.base32HexDecodeWord(1, uint(name.readUint8(0)));\n }\n\n function checkNSEC3OwnerName(bytes memory nsecName, bytes memory deleteName) private pure returns(bool) {\n uint nsecNameOffset = nsecName.readUint8(0) + 1;\n uint deleteNameOffset = 0;\n while(deleteNameOffset < deleteName.length) {\n if(deleteName.equals(deleteNameOffset, nsecName, nsecNameOffset)) {\n return true;\n }\n deleteNameOffset += deleteName.readUint8(deleteNameOffset) + 1;\n }\n return false;\n }\n\n /**\n * @dev Returns data about the RRs (if any) known to this oracle with the provided type and name.\n * @param dnstype The DNS record type to query.\n * @param name The name to query, in DNS label-sequence format.\n * @return inception The unix timestamp (wrapped) at which the signature for this RRSET was created.\n * @return expiration The unix timestamp (wrapped) at which the signature for this RRSET expires.\n * @return hash The hash of the RRset.\n */\n function rrdata(uint16 dnstype, bytes calldata name) external override view returns (uint32, uint32, bytes20) {\n RRSet storage result = rrsets[keccak256(name)][dnstype];\n return (result.inception, result.expiration, result.hash);\n }\n\n function _submitRRSet(RRSetWithSignature memory input, bytes memory proof) internal returns (bytes memory) {\n RRUtils.SignedSet memory rrset;\n rrset = validateSignedSet(input, proof);\n\n RRSet storage storedSet = rrsets[keccak256(rrset.name)][rrset.typeCovered];\n if (storedSet.hash != bytes20(0)) {\n // To replace an existing rrset, the signature must be at least as new\n require(RRUtils.serialNumberGte(rrset.inception, storedSet.inception));\n }\n rrsets[keccak256(rrset.name)][rrset.typeCovered] = RRSet({\n inception: rrset.inception,\n expiration: rrset.expiration,\n hash: bytes20(keccak256(rrset.data))\n });\n\n emit RRSetUpdated(rrset.name, rrset.data);\n\n return rrset.data;\n }\n\n /**\n * @dev Submits a signed set of RRs to the oracle.\n *\n * RRSETs are only accepted if they are signed with a key that is already\n * trusted, or if they are self-signed, and the signing key is identified by\n * a DS record that is already trusted.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against. Must Already\n * have been submitted and proved previously.\n */\n function validateSignedSet(RRSetWithSignature memory input, bytes memory proof) internal view returns(RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n require(validProof(rrset.signerName, proof));\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n require(name.labelCount(0) == rrset.labels);\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n require(RRUtils.serialNumberGte(rrset.expiration, uint32(block.timestamp)));\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n require(RRUtils.serialNumberGte(uint32(block.timestamp), rrset.inception));\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n function validProof(bytes memory name, bytes memory proof) internal view returns(bool) {\n uint16 dnstype = proof.readUint16(proof.nameLength(0));\n return rrsets[keccak256(name)][dnstype].hash == bytes20(keccak256(proof));\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(RRUtils.SignedSet memory rrset, uint16 typecovered) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\n // We only support class IN (Internet)\n require(iter.class == DNSCLASS_IN);\n\n if(name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n require(name.length == iter.data.nameLength(iter.offset));\n require(name.equals(0, iter.data, iter.offset, name.length));\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n require(iter.dnstype == typecovered);\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(bytes memory name, RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, bytes memory proof) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n require(rrset.signerName.length <= name.length);\n require(rrset.signerName.equals(0, name, name.length - rrset.signerName.length));\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n require(verifyWithDS(rrset, data, proofRR));\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n require(verifyWithKnownKey(rrset, data, proofRR));\n } else {\n revert(\"No valid proof found\");\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n * @return True if the RRSET could be verified, false otherwise.\n */\n function verifyWithKnownKey(RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, RRUtils.RRIterator memory proof) internal view returns(bool) {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n require(proof.name().equals(rrset.signerName));\n for(; !proof.done(); proof.next()) {\n require(proof.name().equals(rrset.signerName));\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(0, keyrdata.length);\n if(verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(RRUtils.DNSKEY memory dnskey, bytes memory keyrdata, RRUtils.SignedSet memory rrset, RRSetWithSignature memory data)\n internal\n view\n returns (bool)\n {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if(dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if(dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = computeKeytag(keyrdata);\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n return algorithms[dnskey.algorithm].verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record \n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n * @return True if the RRSET could be verified, false otherwise.\n */\n function verifyWithDS(RRUtils.SignedSet memory rrset, RRSetWithSignature memory data, RRUtils.RRIterator memory proof) internal view returns(bool) {\n for(RRUtils.RRIterator memory iter = rrset.rrs(); !iter.done(); iter.next()) {\n require(iter.dnstype == DNSTYPE_DNSKEY);\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(0, keyrdata.length);\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n return verifyKeyWithDS(iter.name(), proof, dnskey, keyrdata);\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(bytes memory keyname, RRUtils.RRIterator memory dsrrs, RRUtils.DNSKEY memory dnskey, bytes memory keyrdata)\n internal view returns (bool)\n {\n uint16 keytag = computeKeytag(keyrdata);\n for (; !dsrrs.done(); dsrrs.next()) {\n RRUtils.DS memory ds = dsrrs.data.readDS(dsrrs.rdataOffset, dsrrs.nextOffset - dsrrs.rdataOffset);\n if(ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(uint8 digesttype, bytes memory data, bytes memory digest) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n uint ac;\n for (uint i = 0; i < data.length; i++) {\n ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n }\n return uint16(ac + (ac >> 16));\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev Contract mixin for 'owned' contracts.\n*/\ncontract Owned {\n address public owner;\n \n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n*/\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external virtual view returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev An interface for contracts implementing a DNSSEC digest.\n*/\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(bytes calldata data, bytes calldata hash) external virtual pure returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/nsec3digests/NSEC3Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Interface for contracts that implement NSEC3 digest algorithms.\n */\ninterface NSEC3Digest {\n /**\n * @dev Performs an NSEC3 iterated hash.\n * @param salt The salt value to use on each iteration.\n * @param data The data to hash.\n * @param iterations The number of iterations to perform.\n * @return The result of the iterated hash operation.\n */\n function hash(bytes calldata salt, bytes calldata data, uint iterations) external virtual pure returns (bytes32);\n}\n" + }, + "contracts/dnssec-oracle/nsec3digests/SHA1NSEC3Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./NSEC3Digest.sol\";\nimport \"../SHA1.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n/**\n* @dev Implements the DNSSEC iterated SHA1 digest used for NSEC3 records.\n*/\ncontract SHA1NSEC3Digest is NSEC3Digest {\n using Buffer for Buffer.buffer;\n\n function hash(bytes calldata salt, bytes calldata data, uint iterations) external override pure returns (bytes32) {\n Buffer.buffer memory buf;\n buf.init(salt.length + data.length + 16);\n\n buf.append(data);\n buf.append(salt);\n bytes20 h = SHA1.sha1(buf.buf);\n if (iterations > 0) {\n buf.truncate();\n buf.appendBytes20(bytes20(0));\n buf.append(salt);\n\n for (uint i = 0; i < iterations; i++) {\n buf.writeBytes20(0, h);\n h = SHA1.sha1(buf.buf);\n }\n }\n\n return bytes32(h);\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n\nlibrary ModexpPrecompile {\n using Buffer for *;\n\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(bytes memory base, bytes memory exponent, bytes memory modulus) internal view returns (bool success, bytes memory output) {\n uint size = (32 * 3) + base.length + exponent.length + modulus.length;\n\n Buffer.buffer memory input;\n input.init(size);\n\n input.appendBytes32(bytes32(base.length));\n input.appendBytes32(bytes32(exponent.length));\n input.appendBytes32(bytes32(modulus.length));\n input.append(base);\n input.append(exponent);\n input.append(modulus);\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(gas(), 5, add(mload(input), 32), size, add(output, 32), mload(modulus))\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(bytes memory N, bytes memory E, bytes memory S) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n* @dev Implements the DNSSEC RSASHA256 algorithm.\n*/\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(bytes calldata key, bytes calldata data, bytes calldata sig) external override view returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(exponentLen + 5, key.length - exponentLen - 5);\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(exponentLen + 7, key.length - exponentLen - 7);\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n* @dev Implements the DNSSEC RSASHA1 algorithm.\n*/\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(bytes calldata key, bytes calldata data, bytes calldata sig) external override view returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(exponentLen + 5, key.length - exponentLen - 5);\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(exponentLen + 7, key.length - exponentLen - 7);\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n* @dev Implements the DNSSEC SHA1 digest.\n*/\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(bytes calldata data, bytes calldata hash) external override pure returns (bool) {\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n* @dev Implements the DNSSEC SHA256 digest.\n*/\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(bytes calldata data, bytes calldata hash) external override pure returns (bool) {\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n* @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n*/\ncontract DummyDigest is Digest {\n function verify(bytes calldata, bytes calldata) external override pure returns (bool) { return true; }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external override view returns (bool) {\n return validateSignature(sha256(data), parseSignature(signature), parseKey(key));\n }\n\n function parseSignature(bytes memory data) internal pure returns (uint256[2] memory) {\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(bytes memory data) internal pure returns (uint256[2] memory) {\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n\n // Set parameters for curve.\n uint constant a = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint constant b = 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint constant gx = 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint constant gy = 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint constant p = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint constant n = 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint constant lowSmax = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint u, uint m) internal pure\n returns (uint)\n {\n unchecked {\n if (u == 0 || u == m || m == 0)\n return 0;\n if (u > m)\n u = u % m;\n\n int t1;\n int t2 = 1;\n uint r1 = m;\n uint r2 = u;\n uint q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0)\n return (m - uint(-t1));\n\n return uint(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(uint x0, uint y0) internal pure\n returns (uint[3] memory P)\n {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(uint x1, uint y1, uint x2, uint y2) internal pure\n returns (uint[3] memory P)\n {\n uint x;\n uint y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(uint x0, uint y0, uint z0) internal pure\n returns (uint x1, uint y1)\n {\n uint z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj() internal pure\n returns (uint x, uint y, uint z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure\n returns (uint x, uint y)\n {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(uint x0, uint y0) internal pure\n returns (bool isZero)\n {\n if(x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint x, uint y) internal pure\n returns (bool)\n {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint LHS = mulmod(y, y, p); // y^2\n uint RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(uint x0, uint y0, uint z0) internal pure\n returns (uint x1, uint y1, uint z1)\n {\n uint t;\n uint u;\n uint v;\n uint w;\n\n if(isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p-x0, p);\n\n x0 = addmod(v, p-w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p-y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(uint x0, uint y0, uint z0, uint x1, uint y1, uint z1) internal pure\n returns (uint x2, uint y2, uint z2)\n {\n uint t0;\n uint t1;\n uint u0;\n uint u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n }\n else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n }\n else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(uint v, uint u0, uint u1, uint t1, uint t0) private pure\n returns (uint x2, uint y2, uint z2)\n {\n uint u;\n uint u2;\n uint u3;\n uint w;\n uint t;\n\n t = addmod(t0, p-t1, p);\n u = addmod(u0, p-u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p-u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p-w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p-t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(uint x0, uint y0, uint x1, uint y1) internal pure\n returns (uint, uint)\n {\n uint z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(uint x0, uint y0) internal pure\n returns (uint, uint)\n {\n uint z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(uint x0, uint y0, uint exp) internal pure\n returns (uint, uint)\n {\n uint base2X = x0;\n uint base2Y = y0;\n uint base2Z = 1;\n\n for(uint i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(uint x0, uint y0, uint scalar) internal pure\n returns (uint x1, uint y1)\n {\n if(scalar == 0) {\n return zeroAffine();\n }\n else if (scalar == 1) {\n return (x0, y0);\n }\n else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint base2X = x0;\n uint base2Y = y0;\n uint base2Z = 1;\n uint z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if(scalar%2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while(scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if(scalar%2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(uint scalar) internal pure\n returns (uint, uint)\n {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(bytes32 message, uint[2] memory rs, uint[2] memory Q) internal pure\n returns (bool)\n {\n\n // To disambiguate between public key solutions, include comment below.\n if(rs[0] == 0 || rs[0] >= n || rs[1] == 0) {// || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint x1;\n uint x2;\n uint y1;\n uint y2;\n\n uint sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n* @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n* signatures, for testing.\n*/\ncontract DummyAlgorithm is Algorithm {\n function verify(bytes calldata, bytes calldata, bytes calldata) external override view returns (bool) { return true; }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyDNSSEC.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../../registry/ENSRegistry.sol\";\nimport \"../../dnssec-oracle/DNSSEC.sol\";\n\ncontract DummyDnsRegistrarDNSSEC {\n\n struct Data {\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n }\n\n mapping (bytes32 => Data) private datas;\n\n function setData(uint16 _expectedType, bytes memory _expectedName, uint32 _inception, uint64 _inserted, bytes memory _proof) public {\n Data storage rr = datas[keccak256(abi.encodePacked(_expectedType, _expectedName))];\n rr.inception = _inception;\n rr.inserted = _inserted;\n\n if (_proof.length != 0) {\n rr.hash = bytes20(keccak256(_proof));\n } else {\n rr.hash = bytes20(0);\n }\n }\n\n function rrdata(uint16 dnstype, bytes memory name) public view returns (uint32, uint64, bytes20) {\n Data storage rr = datas[keccak256(abi.encodePacked(dnstype, name))];\n return (rr.inception, rr.inserted, rr.hash);\n }\n\n function submitRRSets(DNSSEC.RRSetWithSignature[] memory input, bytes calldata) public virtual returns (bytes memory) {\n return input[input.length - 1].rrset;\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public override view returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public override view returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public override view returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/resolvers/DefaultReverseResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"../registry/ReverseRegistrar.sol\";\n\n/**\n * @dev Provides a default implementation of a resolver for reverse records,\n * which permits only the owner to update it.\n */\ncontract DefaultReverseResolver {\n // namehash('addr.reverse')\n bytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n ENS public ens;\n mapping (bytes32 => string) public name;\n\n /**\n * @dev Only permits calls by the reverse registrar.\n * @param node The node permission is required for.\n */\n modifier onlyOwner(bytes32 node) {\n require(msg.sender == ens.owner(node));\n _;\n }\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar registrar = ReverseRegistrar(ens.owner(ADDR_REVERSE_NODE));\n if (address(registrar) != address(0x0)) {\n registrar.claim(msg.sender);\n }\n }\n\n /**\n * @dev Sets the name for a node.\n * @param node The node to update.\n * @param _name The name to set.\n */\n function setName(bytes32 node, string memory _name) public onlyOwner(node) {\n name[node] = _name;\n }\n}\n" + }, + "contracts/registry/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\ncontract ReverseRegistrar is Ownable, Controllable {\n // namehash('addr.reverse')\n\n ENS public ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n * @param resolverAddr The address of the default reverse resolver.\n */\n constructor(ENS ensAddr, NameResolver resolverAddr) {\n ens = ensAddr;\n defaultResolver = resolverAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public returns (bytes32) {\n return _claimWithResolver(msg.sender, owner, address(0x0));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(address addr, address owner)\n public\n authorised(addr)\n returns (bytes32)\n {\n return _claimWithResolver(addr, owner, address(0x0));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(address owner, address resolver)\n public\n returns (bytes32)\n {\n return _claimWithResolver(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record specified with the\n * address provided\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolverForAddr(\n address addr,\n address owner,\n address resolver\n ) public authorised(addr) returns (bytes32) {\n return _claimWithResolver(addr, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public returns (bytes32) {\n bytes32 node = _claimWithResolver(\n msg.sender,\n address(this),\n address(defaultResolver)\n );\n defaultResolver.setName(node, name);\n return node;\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. First updates the resolver to the default reverse\n * resolver if necessary.\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n string memory name\n ) public authorised(addr) returns (bytes32) {\n bytes32 node = _claimWithResolver(\n addr,\n address(this),\n address(defaultResolver)\n );\n defaultResolver.setName(node, name);\n ens.setSubnodeOwner(ADDR_REVERSE_NODE, sha3HexAddress(addr), owner);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n /* Internal functions */\n\n function _claimWithResolver(\n address addr,\n address owner,\n address resolver\n ) internal returns (bytes32) {\n bytes32 label = sha3HexAddress(addr);\n bytes32 node = keccak256(abi.encodePacked(ADDR_REVERSE_NODE, label));\n address currentResolver = ens.resolver(node);\n bool shouldUpdateResolver = (resolver != address(0x0) &&\n resolver != currentResolver);\n address newResolver = shouldUpdateResolver ? resolver : currentResolver;\n\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, label, owner, newResolver, 0);\n\n emit ReverseClaimed(addr, node);\n\n return node;\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./PriceOracle.sol\";\nimport \"./SafeMath.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is Ownable, PriceOracle {\n using SafeMath for *;\n using StringUtils for *;\n\n // Rent in base price units by length. Element 0 is for 1-length names, and so on.\n uint[] public rentPrices;\n\n // Oracle address\n AggregatorInterface public usdOracle;\n\n event OracleChanged(address oracle);\n\n event RentPriceChanged(uint[] prices);\n\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 constant private ORACLE_ID = bytes4(keccak256(\"price(string,uint256,uint256)\") ^ keccak256(\"premium(string,uint256,uint256)\"));\n\n constructor(AggregatorInterface _usdOracle, uint[] memory _rentPrices) public {\n usdOracle = _usdOracle;\n setPrices(_rentPrices);\n }\n\n function price(string calldata name, uint expires, uint duration) external view override returns(uint) {\n uint len = name.strlen();\n if(len > rentPrices.length) {\n len = rentPrices.length;\n }\n require(len > 0);\n \n uint basePrice = rentPrices[len - 1].mul(duration);\n basePrice = basePrice.add(_premium(name, expires, duration));\n\n return attoUSDToWei(basePrice);\n }\n\n /**\n * @dev Sets rent prices.\n * @param _rentPrices The price array. Each element corresponds to a specific\n * name length; names longer than the length of the array\n * default to the price of the last element. Values are\n * in base price units, equal to one attodollar (1e-18\n * dollar) each.\n */\n function setPrices(uint[] memory _rentPrices) public onlyOwner {\n rentPrices = _rentPrices;\n emit RentPriceChanged(_rentPrices);\n }\n\n /**\n * @dev Sets the price oracle address\n * @param _usdOracle The address of the price oracle to use.\n */\n function setOracle(AggregatorInterface _usdOracle) public onlyOwner {\n usdOracle = _usdOracle;\n emit OracleChanged(address(_usdOracle));\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(string calldata name, uint expires, uint duration) external view returns(uint) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(string memory name, uint expires, uint duration) virtual internal view returns(uint) {\n return 0;\n }\n\n function attoUSDToWei(uint amount) internal view returns(uint) {\n uint ethPrice = uint(usdOracle.latestAnswer());\n return amount.mul(1e8).div(ethPrice);\n }\n\n function weiToAttoUSD(uint amount) internal view returns(uint) {\n uint ethPrice = uint(usdOracle.latestAnswer());\n return amount.mul(ethPrice).div(1e8);\n }\n\n function supportsInterface(bytes4 interfaceID) public view virtual returns (bool) {\n return interfaceID == INTERFACE_META_ID || interfaceID == ORACLE_ID;\n }\n}\n" + }, + "contracts/ethregistrar/PriceOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface PriceOracle {\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return The price of this renewal or registration, in wei.\n */\n function price(string calldata name, uint expires, uint duration) external view returns(uint);\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint) {\n uint len;\n uint i = 0;\n uint bytelength = bytes(s).length;\n for(len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if(b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./PriceOracle.sol\";\nimport \"./BaseRegistrarImplementation.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../resolvers/Resolver.sol\";\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is Ownable {\n using StringUtils for *;\n\n uint constant public MIN_REGISTRATION_DURATION = 28 days;\n\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 constant private COMMITMENT_CONTROLLER_ID = bytes4(\n keccak256(\"rentPrice(string,uint256)\") ^\n keccak256(\"available(string)\") ^\n keccak256(\"makeCommitment(string,address,bytes32)\") ^\n keccak256(\"commit(bytes32)\") ^\n keccak256(\"register(string,address,uint256,bytes32)\") ^\n keccak256(\"renew(string,uint256)\")\n );\n\n bytes4 constant private COMMITMENT_WITH_CONFIG_CONTROLLER_ID = bytes4(\n keccak256(\"registerWithConfig(string,address,uint256,bytes32,address,address)\") ^\n keccak256(\"makeCommitmentWithConfig(string,address,bytes32,address,address)\")\n );\n\n BaseRegistrarImplementation base;\n PriceOracle prices;\n uint public minCommitmentAge;\n uint public maxCommitmentAge;\n\n mapping(bytes32=>uint) public commitments;\n\n event NameRegistered(string name, bytes32 indexed label, address indexed owner, uint cost, uint expires);\n event NameRenewed(string name, bytes32 indexed label, uint cost, uint expires);\n event NewPriceOracle(address indexed oracle);\n\n constructor(BaseRegistrarImplementation _base, PriceOracle _prices, uint _minCommitmentAge, uint _maxCommitmentAge) public {\n require(_maxCommitmentAge > _minCommitmentAge);\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n }\n\n function rentPrice(string memory name, uint duration) view public returns(uint) {\n bytes32 hash = keccak256(bytes(name));\n return prices.price(name, base.nameExpires(uint256(hash)), duration);\n }\n\n function valid(string memory name) public pure returns(bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view returns(bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(string memory name, address owner, bytes32 secret) pure public returns(bytes32) {\n return makeCommitmentWithConfig(name, owner, secret, address(0), address(0));\n }\n\n function makeCommitmentWithConfig(string memory name, address owner, bytes32 secret, address resolver, address addr) pure public returns(bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (resolver == address(0) && addr == address(0)) {\n return keccak256(abi.encodePacked(label, owner, secret));\n }\n require(resolver != address(0));\n return keccak256(abi.encodePacked(label, owner, resolver, addr, secret));\n }\n\n function commit(bytes32 commitment) public {\n require(commitments[commitment] + maxCommitmentAge < block.timestamp);\n commitments[commitment] = block.timestamp;\n }\n\n function register(string calldata name, address owner, uint duration, bytes32 secret) external payable {\n registerWithConfig(name, owner, duration, secret, address(0), address(0));\n }\n\n function registerWithConfig(string memory name, address owner, uint duration, bytes32 secret, address resolver, address addr) public payable {\n bytes32 commitment = makeCommitmentWithConfig(name, owner, secret, resolver, addr);\n uint cost = _consumeCommitment(name, duration, commitment);\n\n bytes32 label = keccak256(bytes(name));\n uint256 tokenId = uint256(label);\n\n uint expires;\n if(resolver != address(0)) {\n // Set this contract as the (temporary) owner, giving it\n // permission to set up the resolver.\n expires = base.register(tokenId, address(this), duration);\n\n // The nodehash of this label\n bytes32 nodehash = keccak256(abi.encodePacked(base.baseNode(), label));\n\n // Set the resolver\n base.ens().setResolver(nodehash, resolver);\n\n // Configure the resolver\n if (addr != address(0)) {\n Resolver(resolver).setAddr(nodehash, addr);\n }\n\n // Now transfer full ownership to the expeceted owner\n base.reclaim(tokenId, owner);\n base.transferFrom(address(this), owner, tokenId);\n } else {\n require(addr == address(0));\n expires = base.register(tokenId, owner, duration);\n }\n\n emit NameRegistered(name, label, owner, cost, expires);\n\n // Refund any extra payment\n if(msg.value > cost) {\n payable(msg.sender).transfer(msg.value - cost);\n }\n }\n\n function renew(string calldata name, uint duration) external payable {\n uint cost = rentPrice(name, duration);\n require(msg.value >= cost);\n\n bytes32 label = keccak256(bytes(name));\n uint expires = base.renew(uint256(label), duration);\n\n if(msg.value > cost) {\n payable(msg.sender).transfer(msg.value - cost);\n }\n\n emit NameRenewed(name, label, cost, expires);\n }\n\n function setPriceOracle(PriceOracle _prices) public onlyOwner {\n prices = _prices;\n emit NewPriceOracle(address(prices));\n }\n\n function setCommitmentAges(uint _minCommitmentAge, uint _maxCommitmentAge) public onlyOwner {\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n }\n\n function withdraw() public onlyOwner {\n payable(msg.sender).transfer(address(this).balance); \n }\n\n function supportsInterface(bytes4 interfaceID) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID ||\n interfaceID == COMMITMENT_CONTROLLER_ID ||\n interfaceID == COMMITMENT_WITH_CONFIG_CONTROLLER_ID;\n }\n\n function _consumeCommitment(string memory name, uint duration, bytes32 commitment) internal returns (uint256) {\n // Require a valid commitment\n require(commitments[commitment] + minCommitmentAge <= block.timestamp);\n\n // If the commitment is too old, or the name is registered, stop\n require(commitments[commitment] + maxCommitmentAge > block.timestamp);\n require(available(name));\n\n delete(commitments[commitment]);\n\n uint cost = rentPrice(name, duration);\n require(duration >= MIN_REGISTRATION_DURATION);\n require(msg.value >= cost);\n\n return cost;\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\n\nimport \"./BaseRegistrar.sol\";\ncontract BaseRegistrarImplementation is ERC721, BaseRegistrar {\n // A map of expiry times\n mapping(uint256=>uint) expiries;\n\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 constant private ERC721_ID = bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 constant private RECLAIM_ID = bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\",\"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(uint256 tokenId) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns(uint) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns(bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(uint256 id, address owner, uint duration) external override returns(uint) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(uint256 id, address owner, uint duration) external returns(uint) {\n return _register(id, owner, duration, false);\n }\n\n function _register(uint256 id, address owner, uint duration, bool updateRegistry) internal live onlyController returns(uint) {\n require(available(id));\n require(block.timestamp + duration + GRACE_PERIOD > block.timestamp + GRACE_PERIOD); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if(_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if(updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(uint256 id, uint duration) external override live onlyController returns(uint) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(bytes4 interfaceID) public override(ERC721, IERC165) view returns (bool) {\n return interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "pragma solidity >=0.8.4;\npragma experimental ABIEncoderV2;\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver{\n event AddrChanged(bytes32 indexed node, address a);\n event AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress);\n event NameChanged(bytes32 indexed node, string name);\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n event TextChanged(bytes32 indexed node, string indexed indexedKey, string key);\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function ABI(bytes32 node, uint256 contentTypes) external view returns (uint256, bytes memory);\n function addr(bytes32 node) external view returns (address);\n function addr(bytes32 node, uint coinType) external view returns(bytes memory);\n function contenthash(bytes32 node) external view returns (bytes memory);\n function dnsrr(bytes32 node) external view returns (bytes memory);\n function name(bytes32 node) external view returns (string memory);\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n function text(bytes32 node, string calldata key) external view returns (string memory);\n function interfaceImplementer(bytes32 node, bytes4 interfaceID) external view returns (address);\n function setABI(bytes32 node, uint256 contentType, bytes calldata data) external;\n function setAddr(bytes32 node, address addr) external;\n function setAddr(bytes32 node, uint coinType, bytes calldata a) external;\n function setContenthash(bytes32 node, bytes calldata hash) external;\n function setDnsrr(bytes32 node, bytes calldata data) external;\n function setName(bytes32 node, string calldata _name) external;\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n function setText(bytes32 node, string calldata key, string calldata value) external;\n function setInterface(bytes32 node, bytes4 interfaceID, address implementer) external;\n function supportsInterface(bytes4 interfaceID) external pure returns (bool);\n function multicall(bytes[] calldata data) external returns(bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n function multihash(bytes32 node) external view returns (bytes memory);\n function setContent(bytes32 node, bytes32 hash) external;\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping (uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping (address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping (uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping (address => mapping (address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor (string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IERC721).interfaceId\n || interfaceId == type(IERC721Metadata).interfaceId\n || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: balance query for the zero address\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"ERC721: owner query for nonexistent token\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n require(_exists(tokenId), \"ERC721Metadata: URI query for nonexistent token\");\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0\n ? string(abi.encodePacked(baseURI, tokenId.toString()))\n : '';\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. Empty by default, can be overriden\n * in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n require(_exists(tokenId), \"ERC721: approved query for nonexistent token\");\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n require(operator != _msgSender(), \"ERC721: approve to caller\");\n\n _operatorApprovals[_msgSender()][operator] = approved;\n emit ApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n _safeTransfer(from, to, tokenId, _data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `_data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, _data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n require(_exists(tokenId), \"ERC721: operator query for nonexistent token\");\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {\n _mint(to, tokenId);\n require(_checkOnERC721Received(address(0), to, tokenId, _data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Clear approvals\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer of token that is not own\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits a {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param _data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)\n private returns (bool)\n {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {\n return retval == IERC721Receiver(to).onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrar.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\nabstract contract BaseRegistrar is Ownable, IERC721 {\n uint constant public GRACE_PERIOD = 90 days;\n\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(uint256 indexed id, address indexed owner, uint expires);\n event NameRegistered(uint256 indexed id, address indexed owner, uint expires);\n event NameRenewed(uint256 indexed id, uint expires);\n\n // The ENS registry\n ENS public ens;\n\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n\n // A map of addresses that are authorised to register and renew names.\n mapping(address=>bool) public controllers;\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) virtual external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) virtual external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) virtual external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) virtual external view returns(uint);\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) virtual public view returns(bool);\n\n /**\n * @dev Register a name.\n */\n function register(uint256 id, address owner, uint duration) virtual external returns(uint);\n\n function renew(uint256 id, uint duration) virtual external returns(uint);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) virtual external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n // solhint-disable-next-line no-inline-assembly\n assembly { size := extcodesize(account) }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n (bool success, ) = recipient.call{ value: amount }(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain`call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.staticcall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant alphabet = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = alphabet[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "pragma solidity >=0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\n\ncontract BulkRenewal {\n bytes32 constant private ETH_NAMEHASH = 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes4 constant private REGISTRAR_CONTROLLER_ID = 0x018fac06;\n bytes4 constant private INTERFACE_META_ID = bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 constant public BULK_RENEWAL_ID = bytes4(\n keccak256(\"rentPrice(string[],uint)\") ^\n keccak256(\"renewAll(string[],uint\")\n );\n\n ENS public ens;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function getController() internal view returns(ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return ETHRegistrarController(r.interfaceImplementer(ETH_NAMEHASH, REGISTRAR_CONTROLLER_ID));\n }\n\n function rentPrice(string[] calldata names, uint duration) external view returns(uint total) {\n ETHRegistrarController controller = getController();\n for(uint i = 0; i < names.length; i++) {\n total += controller.rentPrice(names[i], duration);\n }\n }\n\n function renewAll(string[] calldata names, uint duration) external payable {\n ETHRegistrarController controller = getController();\n for(uint i = 0; i < names.length; i++) {\n uint cost = controller.rentPrice(names[i], duration);\n controller.renew{value:cost}(names[i], duration);\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(bytes4 interfaceID) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID || interfaceID == BULK_RENEWAL_ID;\n }\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint GRACE_PERIOD = 90 days;\n\n uint public initialPremium;\n uint public premiumDecreaseRate;\n\n bytes4 constant private TIME_UNTIL_PREMIUM_ID = bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(AggregatorInterface _usdOracle, uint[] memory _rentPrices, uint _initialPremium, uint _premiumDecreaseRate) public\n StablePriceOracle(_usdOracle, _rentPrices)\n {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(string memory name, uint expires, uint /*duration*/) override internal view returns(uint) {\n expires = expires.add(GRACE_PERIOD);\n if(expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint discount = premiumDecreaseRate.mul(block.timestamp.sub(expires));\n\n // If we've run out the premium period, return 0.\n if(discount > initialPremium) {\n return 0;\n }\n \n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(uint expires, uint amount) external view returns(uint) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint discount = initialPremium.sub(amount);\n uint duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(bytes4 interfaceID) public view virtual override returns (bool) {\n return (interfaceID == TIME_UNTIL_PREMIUM_ID) || super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint constant registrationPeriod = 4 weeks;\n\n ENS public ens;\n bytes32 public rootNode;\n mapping (bytes32 => uint) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(keccak256(abi.encodePacked(rootNode, label)));\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(bytes calldata name) external override view returns(bool) {\n uint labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes=>bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for(uint i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(bytes calldata name) external override view returns(bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n\n address public owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n modifier onlyOwner {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(uint16 _expectedType, bytes memory _expectedName, uint32 _inception, uint64 _inserted, bytes memory _proof) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if(_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(uint16 dnstype, bytes memory name) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int value;\n\n constructor(int _value) public {\n set(_value);\n }\n\n function set(int _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns(int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns(address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping (bytes32 => address) addresses;\n\n constructor() public {\n }\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev Implements a dummy NameWrapper which returns the caller's address\n*/\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "test/registry/mocks/DummyResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyResolver {\n\n mapping (bytes32 => string) public name;\n\n function setName(bytes32 node, string memory _name) public {\n name[node] = _name;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": false, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/ropsten/solcInputs/a5ab15037ea2d912526c4e5696fda13f.json b/solidity/dns-contracts/deployments/ropsten/solcInputs/a5ab15037ea2d912526c4e5696fda13f.json new file mode 100644 index 0000000..1d0607c --- /dev/null +++ b/solidity/dns-contracts/deployments/ropsten/solcInputs/a5ab15037ea2d912526c4e5696fda13f.json @@ -0,0 +1,362 @@ +{ + "language": "Solidity", + "sources": { + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(bytes memory name, bytes memory data)\n internal\n pure\n returns (address, bool)\n {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(bytes memory rdata, uint256 idx)\n internal\n pure\n returns (address, bool)\n {\n while (idx < rdata.length) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n if (len < 44) return (address(0x0), false);\n return hexToAddress(str, idx + 4);\n }\n\n function hexToAddress(bytes memory str, uint256 idx)\n internal\n pure\n returns (address, bool)\n {\n if (str.length - idx < 40) return (address(0x0), false);\n uint256 ret = 0;\n for (uint256 i = idx; i < idx + 40; i++) {\n ret <<= 4;\n uint256 x = str.readUint8(i);\n if (x >= 48 && x < 58) {\n ret |= x - 48;\n } else if (x >= 65 && x < 71) {\n ret |= x - 55;\n } else if (x >= 97 && x < 103) {\n ret |= x - 87;\n } else {\n return (address(0x0), false);\n }\n }\n return (address(uint160(ret)), true);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(RRSetWithSignature[] memory input)\n external\n view\n virtual\n returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(RRSetWithSignature[] memory input, uint256 now)\n public\n view\n virtual\n returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(bytes memory self, bytes memory other)\n internal\n pure\n returns (int256)\n {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest > 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2**(8 * (32 - shortest + idx)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length >= offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(bytes memory self, bytes memory other)\n internal\n pure\n returns (bool)\n {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(bytes memory self, uint256 idx)\n internal\n pure\n returns (uint8 ret)\n {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(bytes memory self, uint256 idx)\n internal\n pure\n returns (uint16 ret)\n {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(bytes memory self, uint256 idx)\n internal\n pure\n returns (uint32 ret)\n {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(bytes memory self, uint256 idx)\n internal\n pure\n returns (bytes32 ret)\n {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(bytes memory self, uint256 idx)\n internal\n pure\n returns (bytes20 ret)\n {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(\n uint256 dest,\n uint256 src,\n uint256 len\n ) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256**(32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(bytes memory self, uint256 offset)\n internal\n pure\n returns (uint256)\n {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(bytes memory self, uint256 offset)\n internal\n pure\n returns (bytes memory ret)\n {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(bytes memory self, uint256 offset)\n internal\n pure\n returns (uint256)\n {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(bytes memory data)\n internal\n pure\n returns (SignedSet memory self)\n {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(SignedSet memory rrset)\n internal\n pure\n returns (RRIterator memory)\n {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(bytes memory self, uint256 offset)\n internal\n pure\n returns (RRIterator memory ret)\n {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(RRIterator memory iter)\n internal\n pure\n returns (bytes memory)\n {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function compareNames(bytes memory self, bytes memory other)\n internal\n pure\n returns (int256)\n {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(uint32 i1, uint32 i2)\n internal\n pure\n returns (bool)\n {\n return int32(i1) - int32(i2) >= 0;\n }\n\n function progress(bytes memory body, uint256 off)\n internal\n pure\n returns (uint256)\n {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for writing to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n mstore(0x40, add(32, add(ptr, capacity)))\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n function max(uint a, uint b) private pure returns(uint) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Writes a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The start offset to write to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n if (off + len > buf.capacity) {\n resize(buf, max(buf.capacity, len + off) * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(add(len, off), buflen) {\n mstore(bufptr, add(len, off))\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, len);\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, data.length);\n }\n\n /**\n * @dev Writes a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write the byte at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeUint8(buffer memory buf, uint off, uint8 data) internal pure returns(buffer memory) {\n if (off >= buf.capacity) {\n resize(buf, buf.capacity * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if eq(off, buflen) {\n mstore(bufptr, add(buflen, 1))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n return writeUint8(buf, buf.buf.length, data);\n }\n\n /**\n * @dev Writes up to 32 bytes to the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function write(buffer memory buf, uint off, bytes32 data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Writes a bytes20 to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function writeBytes20(buffer memory buf, uint off, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, off, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return write(buf, buf.buf.length, data, 32);\n }\n\n /**\n * @dev Writes an integer to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param off The offset to write at.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer, for chaining.\n */\n function writeInt(buffer memory buf, uint off, uint data, uint len) private pure returns(buffer memory) {\n if (len + off > buf.capacity) {\n resize(buf, (len + off) * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + off + sizeof(buffer length) + len\n let dest := add(add(bufptr, off), len)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(add(off, len), mload(bufptr)) {\n mstore(bufptr, add(off, len))\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n return writeInt(buf, buf.buf.length, data, len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\n// TODO: Record inception time of any claimed name, so old proofs can't be used to revert changes to a name.\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error StaleProof();\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewOracle(address oracle);\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n oracle = _dnssec;\n emit NewOracle(address(oracle));\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n require(\n msg.sender == owner,\n \"Only owner can call proveAndClaimWithResolver\"\n );\n if (addr != address(0)) {\n require(\n resolver != address(0),\n \"Cannot set addr if resolver is not set\"\n );\n // Set ourselves as the owner so we can set a record on the resolver\n ens.setSubnodeRecord(\n rootNode,\n labelHash,\n address(this),\n resolver,\n 0\n );\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n // Transfer the record to the owner\n ens.setOwner(node, owner);\n } else {\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n }\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n override\n returns (bool)\n {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(bytes memory name, DNSSEC.RRSetWithSignature[] memory input)\n internal\n returns (\n bytes32 parentNode,\n bytes32 labelHash,\n address addr\n )\n {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n // Parent name must be in the public suffix list.\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n require(\n suffixes.isPublicSuffix(parentName),\n \"Parent name must be a public suffix\"\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName, 0);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n (addr, ) = DNSClaimChecker.getOwnerAddress(name, data);\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain, uint256 offset)\n internal\n returns (bytes32 node)\n {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n require(\n owner == address(0) || owner == address(this),\n \"Cannot enable a name owned by someone else\"\n );\n if (owner != address(this)) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n } else {\n ens.setSubnodeOwner(parentNode, label, address(this));\n }\n }\n return node;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(bytes32 node, address owner)\n public\n virtual\n override\n authorised(node)\n {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(bytes32 node, address resolver)\n public\n virtual\n override\n authorised(node)\n {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(bytes32 node, uint64 ttl)\n public\n virtual\n override\n authorised(node)\n {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(address operator, bool approved)\n external\n virtual\n override\n {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node)\n public\n view\n virtual\n override\n returns (address)\n {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node)\n public\n view\n virtual\n override\n returns (address)\n {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(bytes32 node)\n public\n view\n virtual\n override\n returns (bool)\n {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(address owner, address operator)\n external\n view\n virtual\n override\n returns (bool)\n {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(bytes32 label, address owner)\n external\n onlyController\n {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(bytes32 => mapping(uint256 => bytes)) _addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(bytes32 node, address a)\n external\n virtual\n authorised(node)\n {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node)\n public\n view\n virtual\n override\n returns (address payable)\n {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n _addresses[node][coinType] = a;\n }\n\n function addr(bytes32 node, uint256 coinType)\n public\n view\n virtual\n override\n returns (bytes memory)\n {\n return _addresses[node][coinType];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(bytes memory b)\n internal\n pure\n returns (address payable a)\n {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(address owner, address operator)\n external\n view\n returns (bool);\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract ResolverBase is ERC165 {\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(bytes32 node, uint256 coinType)\n external\n view\n returns (bytes memory);\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(RRSetWithSignature[] memory input)\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(RRSetWithSignature[] memory input, uint256 now)\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(RRUtils.SignedSet memory rrset, uint16 typecovered)\n internal\n pure\n returns (bytes memory name)\n {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (\n rrset.signerName.length > name.length ||\n !rrset.signerName.equals(\n 0,\n name,\n name.length - rrset.signerName.length\n )\n ) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n return\n algorithms[dnskey.algorithm].verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(bytes calldata data, bytes calldata hash)\n external\n pure\n virtual\n returns (bool);\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex'00'.nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex'0361626300'.nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex'0361626300'.nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex'00'.labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex'016100'.labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(hex'016201610000'.labelCount(0) == 2, \"labelCount('b.a.') == 2\");\n require(hex'066574686c61620378797a00'.labelCount(6 +1) == 1, \"nameLength('(bthlab).xyz.') == 6\");\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes memory rrs = hex'0161000001000100000e1000047400000101620161000001000100000e100004c0a80101';\n bytes[2] memory names = [bytes(hex'016100'), bytes(hex'0162016100')];\n bytes[2] memory rdatas = [bytes(hex'74000001'), bytes(hex'c0a80101')];\n uint i = 0;\n for(RRUtils.RRIterator memory iter = rrs.iterateRRs(0); !iter.done(); iter.next()) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(keccak256(iter.name()) == keccak256(names[i]), \"Name matches\");\n require(keccak256(iter.rdata()) == keccak256(rdatas[i]), \"Rdata matches\");\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex'066274686c61620378797a00';\n bytes memory ethLabXyz = hex'066574686c61620378797a00';\n bytes memory xyz = hex'0378797a00';\n bytes memory a_b_c = hex'01610162016300';\n bytes memory b_b_c = hex'01620162016300';\n bytes memory c = hex'016300';\n bytes memory d = hex'016400';\n bytes memory a_d_c = hex'01610164016300';\n bytes memory b_a_c = hex'01620161016300';\n bytes memory ab_c_d = hex'0261620163016400';\n bytes memory a_c_d = hex'01610163016400';\n\n require(hex'0301616100'.compareNames(hex'0302616200') < 0, \"label lengths are correctly checked\");\n require(a_b_c.compareNames(c) > 0, \"one name has a difference of >1 label to with the same root name\");\n require(a_b_c.compareNames(d) < 0, \"one name has a difference of >1 label to with different root name\");\n require(a_b_c.compareNames(a_d_c) < 0, \"two names start the same but have differences in later labels\");\n require(a_b_c.compareNames(b_a_c) > 0, \"the first label sorts later, but the first label sorts earlier\");\n require(ab_c_d.compareNames(a_c_d) > 0, \"two names where the first label on one is a prefix of the first label on the other\");\n require(a_b_c.compareNames(b_b_c) < 0, \"two names where the first label on one is a prefix of the first label on the other\");\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(bthLabXyz.compareNames(ethLabXyz) < 0, \"bthLab.xyz comes before ethLab.xyz\");\n require(bthLabXyz.compareNames(bthLabXyz) == 0, \"bthLab.xyz and bthLab.xyz are the same\");\n require(ethLabXyz.compareNames(bthLabXyz) > 0, \"ethLab.xyz comes after bethLab.xyz\");\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA), \"0x11111111 >= 0xAAAAAAAA\");\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(hex'0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d'.computeKeytag() == 19036, \"Invalid keytag\");\n require(hex'010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf'.computeKeytag() == 21693, \"Invalid keytag (2)\");\n require(hex'0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3'.computeKeytag() == 33630);\n require(hex'0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5'.computeKeytag() == 20326, \"Invalid keytag (3)\");\n }\n}" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\"\".keccak(0, 0) == bytes32(0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470), \"Incorrect hash of empty string\");\n require(\"foo\".keccak(0, 3) == bytes32(0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d), \"Incorrect hash of 'foo'\");\n require(\"foo\".keccak(0, 0) == bytes32(0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470), \"Incorrect hash of empty string\");\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\"hello\".equals(1, \"ello\") == true, \"Substring to string equality\");\n require(\"hello\".equals(1, \"jello\", 1, 4) == true, \"Substring to substring equality\");\n require(\"zhello\".equals(1, \"abchello\", 3) == true, \"Compare different value with multiple length\");\n }\n\n function testComparePartial() public pure {\n require(\"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true, \"Compare same length\");\n require(\"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true, \"Compare different length\");\n require(\"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true, \"Compare same with different offset\");\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\"a\".compare(\"b\") < 0 == true, \"Compare different value with same length\");\n require(\"b\".compare(\"a\") > 0 == true, \"Compare different value with same length\");\n require(\"aa\".compare(\"ab\") < 0 == true, \"Compare different value with multiple length\");\n require(\"a\".compare(\"aa\") < 0 == true, \"Compare different value with different length\");\n require(\"aa\".compare(\"a\") > 0 == true, \"Compare different value with different length\");\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(longChar.compare(longChar) == 0 == true, \"Compares more than 32 bytes char\");\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(longChar.compare(otherLongChar) < 0 == true, \"Compare long char with difference at start\");\n }\n\n function testSubstring() public pure {\n require(keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")), \"Copy 0 bytes\");\n require(keccak256(bytes(\"hello\".substring(0, 4))) == keccak256(bytes(\"hell\")), \"Copy substring\");\n require(keccak256(bytes(\"hello\".substring(1, 4))) == keccak256(bytes(\"ello\")), \"Copy substring\");\n require(keccak256(bytes(\"hello\".substring(0, 5))) == keccak256(bytes(\"hello\")), \"Copy whole string\");\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) == bytes32(0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000), \"readBytes20\");\n }\n\n function testReadBytes32() public pure {\n require(\"0123456789abcdef0123456789abcdef\".readBytes32(0) == bytes32(0x3031323334353637383961626364656630313233343536373839616263646566), \"readBytes32\");\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")), \"Decode 'a'\");\n require(\"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")), \"Decode 'aa'\");\n require(\"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")), \"Decode 'aaa'\");\n require(\"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")), \"Decode 'aaaa'\");\n require(\"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")), \"Decode 'aaaaa'\");\n require(\"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")), \"Decode 'aaaaa' lowercase\");\n require(\"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(0, 42) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")), \"Decode alphabet\");\n require(\"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(0, 42) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")), \"Decode alphabet lowercase\");\n require(\"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\".base32HexDecodeWord(0, 52) == bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"), \"Decode 32*'a'\");\n require(\" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\".base32HexDecodeWord(1, 32) == bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"), \"Decode real bytes32hex\");\n }\n}" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(bytes calldata data, bytes calldata hash)\n external\n pure\n override\n returns (bool)\n {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(bytes calldata data, bytes calldata hash)\n external\n pure\n override\n returns (bool)\n {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(bytes memory data)\n internal\n pure\n returns (uint256[2] memory)\n {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(bytes memory data)\n internal\n pure\n returns (uint256[2] memory)\n {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(uint256 x0, uint256 y0)\n internal\n pure\n returns (uint256[3] memory P)\n {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (\n uint256 x,\n uint256 y,\n uint256 z\n )\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(uint256 x0, uint256 y0)\n internal\n pure\n returns (bool isZero)\n {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n )\n internal\n pure\n returns (\n uint256 x1,\n uint256 y1,\n uint256 z1\n )\n {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n )\n internal\n pure\n returns (\n uint256 x2,\n uint256 y2,\n uint256 z2\n )\n {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n )\n private\n pure\n returns (\n uint256 x2,\n uint256 y2,\n uint256 z2\n )\n {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(uint256 x0, uint256 y0)\n internal\n pure\n returns (uint256, uint256)\n {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(uint256 scalar)\n internal\n pure\n returns (uint256, uint256)\n {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(bytes calldata, bytes calldata)\n external\n pure\n override\n returns (bool)\n {\n return true;\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(bytes calldata name)\n external\n view\n override\n returns (bool)\n {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(bytes calldata name)\n external\n view\n override\n returns (bool)\n {\n return suffixes[name];\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (\n bytes memory key,\n bytes memory value,\n uint256 nextOffset\n )\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = input.length;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n nextOffset = terminator + 1;\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(bytes32 => bytes) private zonehashes;\n\n // Version the mapping for each zone. This allows users who have lost\n // track of their entries to effectively delete an entire zone by bumping\n // the version number.\n // node => version\n mapping(bytes32 => uint256) private versions;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(bytes32 => mapping(uint256 => mapping(bytes32 => mapping(uint16 => bytes))))\n private records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(bytes32 => mapping(uint256 => mapping(bytes32 => uint16)))\n private nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(bytes32 node, bytes calldata data)\n external\n virtual\n authorised(node)\n {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return records[node][versions[node]][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(bytes32 node, bytes32 name)\n public\n view\n virtual\n returns (bool)\n {\n return (nameEntriesCount[node][versions[node]][name] != 0);\n }\n\n /**\n * Clear all information for a DNS zone.\n * @param node the namehash of the node for which to clear the zone\n */\n function clearDNSZone(bytes32 node) public virtual authorised(node) {\n versions[node]++;\n emit DNSZoneCleared(node);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(bytes32 node, bytes calldata hash)\n external\n virtual\n authorised(node)\n {\n bytes memory oldhash = zonehashes[node];\n zonehashes[node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node)\n external\n view\n virtual\n override\n returns (bytes memory)\n {\n return zonehashes[node];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord\n ) private {\n uint256 version = versions[node];\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (records[node][version][nameHash][resource].length != 0) {\n nameEntriesCount[node][version][nameHash]--;\n }\n delete (records[node][version][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (records[node][version][nameHash][resource].length == 0) {\n nameEntriesCount[node][version][nameHash]++;\n }\n records[node][version][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n // DNSZoneCleared is emitted whenever a given node's zone information is cleared.\n event DNSZoneCleared(bytes32 indexed node);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\n\ninterface INameWrapper {\n function ownerOf(uint256 id) external view returns (address);\n}\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator)\n public\n view\n returns (bool)\n {\n return _operatorApprovals[account][operator];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return owner == msg.sender || isApprovedForAll(owner, msg.sender);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(bytes32 => mapping(uint256 => bytes)) abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n abis[node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(bytes32 node, uint256 contentTypes)\n external\n view\n virtual\n override\n returns (uint256, bytes memory)\n {\n mapping(uint256 => bytes) storage abiset = abis[node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(bytes32 => bytes) hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(bytes32 node, bytes calldata hash)\n external\n virtual\n authorised(node)\n {\n hashes[node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node)\n external\n view\n virtual\n override\n returns (bytes memory)\n {\n return hashes[node];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(bytes32 => mapping(bytes4 => address)) interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n interfaces[node][interfaceID] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(bytes32 node, bytes4 interfaceID)\n external\n view\n virtual\n override\n returns (address)\n {\n address implementer = interfaces[node][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(bytes32 => string) names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(bytes32 node, string calldata newName)\n external\n virtual\n authorised(node)\n {\n names[node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node)\n external\n view\n virtual\n override\n returns (string memory)\n {\n return names[node];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(bytes32 => PublicKey) pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n pubkeys[node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node)\n external\n view\n virtual\n override\n returns (bytes32 x, bytes32 y)\n {\n return (pubkeys[node].x, pubkeys[node].y);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(bytes32 => mapping(string => string)) texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n texts[node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(bytes32 node, string calldata key)\n external\n view\n virtual\n override\n returns (string memory)\n {\n return texts[node][key];\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(bytes32 nodehash, bytes[] calldata data)\n internal\n returns (bytes[] memory results)\n {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(bytes32 nodehash, bytes[] calldata data)\n external\n returns (bytes[] memory results)\n {\n return _multicall(nodehash, data);\n }\n\n function multicall(bytes[] calldata data)\n public\n override\n returns (bytes[] memory results)\n {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(bytes32 node, uint256 contentTypes)\n external\n view\n returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(bytes32 node, bytes4 interfaceID)\n external\n view\n returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(bytes32 node, string calldata key)\n external\n view\n returns (string memory);\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(bytes[] calldata data)\n external\n returns (bytes[] memory results);\n\n function multicallWithNodeCheck(bytes32, bytes[] calldata data)\n external\n returns (bytes[] memory results);\n}\n" + }, + "test/utils/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata, /* name */\n bytes calldata data\n ) external view returns (bytes memory, address) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function resolveCallback(bytes calldata response, bytes calldata extraData)\n external\n view\n returns (bytes memory)\n {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n return abi.encode(address(this));\n }\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(bytes memory name, bytes memory data)\n external\n view\n returns (bytes memory, address);\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is IExtendedResolver, ERC165 {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n\n ENS public immutable registry;\n\n constructor(address _registry) {\n registry = ENS(_registry);\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(bytes calldata name, bytes memory data)\n external\n view\n override\n returns (bytes memory, address)\n {\n (Resolver resolver, ) = findResolver(name);\n if (address(resolver) == address(0)) {\n return (\"\", address(0));\n }\n\n try\n resolver.supportsInterface(type(IExtendedResolver).interfaceId)\n returns (bool supported) {\n if (supported) {\n return (\n callWithOffchainLookupPropagation(\n address(resolver),\n abi.encodeCall(IExtendedResolver.resolve, (name, data)),\n UniversalResolver.resolveCallback.selector\n ),\n address(resolver)\n );\n }\n } catch {}\n return (\n callWithOffchainLookupPropagation(\n address(resolver),\n data,\n UniversalResolver.resolveCallback.selector\n ),\n address(resolver)\n );\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(bytes calldata reverseName)\n external\n view\n returns (\n string memory,\n address,\n address,\n address\n )\n {\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = this.resolve(\n reverseName,\n abi.encodeCall(INameResolver.name, reverseName.namehash(0))\n );\n\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n (bytes memory resolvedData, address resolverAddress) = this.resolve(\n encodedName,\n abi.encodeCall(IAddrResolver.addr, namehash)\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @param callbackFunction The function ID of a function on this contract to use as an EIP 3668 callback.\n * This function's `extraData` argument will be passed `(address target, bytes4 innerCallback, bytes innerExtraData)`.\n * @return ret If `target` did not revert, contains the return data from the call to `target`.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data,\n bytes4 callbackFunction\n ) internal view returns (bytes memory ret) {\n bool result = LowLevelCallUtils.functionStaticCall(target, data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return LowLevelCallUtils.readReturnData(0, size);\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n if (bytes4(errorId) == OffchainLookup.selector) {\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n (\n address sender,\n string[] memory urls,\n bytes memory callData,\n bytes4 innerCallbackFunction,\n bytes memory extraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (sender == target) {\n revert OffchainLookup(\n address(this),\n urls,\n callData,\n callbackFunction,\n abi.encode(sender, innerCallbackFunction, extraData)\n );\n }\n }\n }\n\n LowLevelCallUtils.propagateRevert();\n }\n\n /**\n * @dev Callback function for `resolve`.\n * @param response Response data returned by the target address that invoked the inner `OffchainData` revert.\n * @param extraData Extra data encoded by `callWithOffchainLookupPropagation` to allow completing the request.\n */\n function resolveCallback(bytes calldata response, bytes calldata extraData)\n external\n view\n returns (bytes memory)\n {\n (\n address target,\n bytes4 innerCallbackFunction,\n bytes memory innerExtraData\n ) = abi.decode(extraData, (address, bytes4, bytes));\n return\n abi.decode(\n target.functionStaticCall(\n abi.encodeWithSelector(\n innerCallbackFunction,\n response,\n innerExtraData\n )\n ),\n (bytes)\n );\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return The Resolver responsible for this name, and the namehash of the full name.\n */\n function findResolver(bytes calldata name)\n public\n view\n returns (Resolver, bytes32)\n {\n (address resolver, bytes32 labelhash) = findResolver(name, 0);\n return (Resolver(resolver), labelhash);\n }\n\n function findResolver(bytes calldata name, uint256 offset)\n internal\n view\n returns (address, bytes32)\n {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0));\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash = keccak256(name[offset + 1:nextLabel]);\n (address parentresolver, bytes32 parentnode) = findResolver(\n name,\n nextLabel\n );\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node);\n }\n return (parentresolver, node);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(address target, bytes memory data)\n internal\n view\n returns (bool success)\n {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(uint256 offset, uint256 length)\n internal\n pure\n returns (bytes memory data)\n {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes calldata a\n ) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(bytes[] calldata data)\n external\n returns (bytes[] memory results);\n\n function multicallWithNodeCheck(bytes32 nodehash, bytes[] calldata data)\n external\n returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(string memory name)\n internal\n pure\n returns (bytes memory dnsName, bytes32 node)\n {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(bytes memory self, uint256 offset)\n internal\n pure\n returns (bytes32)\n {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(bytes memory self, uint256 idx)\n internal\n pure\n returns (bytes32 labelhash, uint256 newIdx)\n {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(bytes calldata name, uint256 offset)\n public\n pure\n returns (bytes32, uint256)\n {\n return name.readLabel(offset);\n }\n\n function namehash(bytes calldata name, uint256 offset)\n public\n pure\n returns (bytes32)\n {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n view\n override\n returns (bool)\n {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant PARENT_CANNOT_CONTROL = 64;\nuint32 constant CAN_DO_EVERYTHING = 0;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 _expiry,\n address resolver\n ) external returns (uint64 expiry);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint32 fuses,\n uint64 expiry\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration,\n uint32 fuses,\n uint64 expiry\n ) external returns (uint256 expires);\n\n function unwrap(\n bytes32 node,\n bytes32 label,\n address owner\n ) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function setFuses(bytes32 node, uint32 fuses)\n external\n returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function isTokenOwnerOrApproved(bytes32 node, address addr)\n external\n returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external returns (address owner);\n\n function allFusesBurned(bytes32 node, uint32 fuseMask)\n external\n view\n returns (bool);\n\n function isWrapped(bytes32 node) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC165, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, OperationProhibited} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror NameNotFound();\nerror IncompatibleParent();\nerror IncompatibleName(bytes name);\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable\n{\n using BytesUtils for bytes;\n ENS public immutable override ens;\n IBaseRegistrar public immutable override registrar;\n IMetadataService public override metadataService;\n mapping(bytes32 => bytes) public override names;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC1155Fuse, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 */\n\n function ownerOf(uint256 id)\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner)\n {\n return super.ownerOf(id);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(IMetadataService _metadataService)\n public\n onlyOwner\n {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(uint256 tokenId) public view override returns (string memory) {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress)\n public\n onlyOwner\n {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or approved by the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!isTokenOwnerOrApproved(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or approved\n */\n\n function isTokenOwnerOrApproved(bytes32 node, address addr)\n public\n view\n override\n returns (bool)\n {\n address owner = ownerOf(uint256(node));\n return owner == addr || isApprovedForAll(owner, addr);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param fuses Initial fuses to set\n * @param expiry When the fuses will expire\n * @param resolver Resolver contract address\n * @return Normalised expiry of when the fuses expire\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public override returns (uint64) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n return _wrapETH2LD(label, wrappedOwner, fuses, expiry, resolver);\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param fuses Initial fuses to set\n * @param expiry When the fuses will expire\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint32 fuses,\n uint64 expiry\n ) external override onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(label, wrappedOwner, fuses, expiry, resolver);\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration,\n uint32 fuses,\n uint64 expiry\n ) external override onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n expires = registrar.renew(tokenId, duration);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n expiry = _normaliseExpiry(expiry, oldExpiry, uint64(expires));\n\n _setData(node, owner, oldFuses | fuses | PARENT_CANNOT_CONTROL, expiry);\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public override {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public override onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public override onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param fuses Fuses to burn (cannot burn PARENT_CANNOT_CONTROL)\n * @return New fuses\n */\n\n function setFuses(bytes32 node, uint32 fuses)\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n _checkForParentCannotControl(node, fuses);\n\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, expiry);\n return fuses;\n }\n\n /**\n * @notice Upgrades a .eth wrapped domain by calling the wrapETH2LD function of the upgradeContract\n * and burning the token of this contract\n * @dev Can be called by the owner of the name in this contract\n * @param label Label as a string of the .eth name to upgrade\n * @param wrappedOwner The owner of the wrapped name\n */\n\n function upgradeETH2LD(\n string calldata label,\n address wrappedOwner,\n address resolver\n ) public {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n (uint32 fuses, uint64 expiry) = _prepareUpgrade(node);\n\n upgradeContract.wrapETH2LD(\n label,\n wrappedOwner,\n fuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @notice Upgrades a non .eth domain of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * Requires upgraded Namewrapper to permit old Namewrapper to call `setSubnodeRecord` for all names\n * @param parentNode Namehash of the parent name\n * @param label Label as a string of the name to upgrade\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract for this name\n */\n\n function upgrade(\n bytes32 parentNode,\n string calldata label,\n address wrappedOwner,\n address resolver\n ) public {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(parentNode, labelhash);\n (uint32 fuses, uint64 expiry) = _prepareUpgrade(node);\n upgradeContract.setSubnodeRecord(\n parentNode,\n label,\n wrappedOwner,\n resolver,\n 0,\n fuses,\n expiry\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of. Can also be called by the owner of a .eth name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the fuses will expire\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n uint64 maxExpiry;\n (, uint32 parentFuses, uint64 parentExpiry) = getData(\n uint256(parentNode)\n );\n if (parentNode == ETH_NODE) {\n if (!isTokenOwnerOrApproved(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n // max expiry is set to the expiry on the registrar\n maxExpiry = uint64(registrar.nameExpires(uint256(labelhash)));\n } else {\n if (!isTokenOwnerOrApproved(parentNode, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n // max expiry is set to the expiry of the parent\n maxExpiry = parentExpiry;\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the fuses will expire\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n )\n public\n onlyTokenOwner(parentNode)\n canCallSetSubnodeOwner(parentNode, keccak256(bytes(label)))\n returns (bytes32 node)\n {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _addLabelAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n _addLabelSetFusesAndTransfer(\n parentNode,\n node,\n label,\n owner,\n fuses,\n expiry\n );\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the regsitry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry expiry date for the domain\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n )\n public\n onlyTokenOwner(parentNode)\n canCallSetSubnodeOwner(parentNode, keccak256(bytes(label)))\n returns (bytes32 node)\n {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _addLabelAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _addLabelSetFusesAndTransfer(\n parentNode,\n node,\n label,\n owner,\n fuses,\n expiry\n );\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n override\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n (address oldOwner, , ) = getData(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(bytes32 node, address resolver)\n public\n override\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_SET_RESOLVER)\n {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(bytes32 node, uint64 ttl)\n public\n override\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_SET_TTL)\n {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param node Namehash of the name to check\n * @param labelhash Labelhash of the name to check\n */\n\n modifier canCallSetSubnodeOwner(bytes32 node, bytes32 labelhash) {\n bytes32 subnode = _makeNode(node, labelhash);\n address owner = ens.owner(subnode);\n\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n (, uint32 subnodeFuses, ) = getData(uint256(subnode));\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n\n _;\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(bytes32 node, uint32 fuseMask)\n public\n view\n override\n returns (bool)\n {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped or not\n * @dev Both of these checks need to be true to be considered wrapped if checked without this contract\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view override returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public override returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) = abi.decode(data, (string, address, uint32, uint64, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n _wrapETH2LD(label, owner, fuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _canTransfer(uint32 fuses) internal pure override returns (bool) {\n return fuses & CANNOT_TRANSFER == 0;\n }\n\n function _makeNode(bytes32 node, bytes32 labelhash)\n private\n pure\n returns (bytes32)\n {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(string memory label, bytes memory name)\n internal\n pure\n returns (bytes memory ret)\n {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n address oldOwner = ownerOf(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n names[node] = name;\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _addLabelAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _prepareUpgrade(bytes32 node)\n private\n returns (uint32 fuses, uint64 expiry)\n {\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!isTokenOwnerOrApproved(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (, fuses, expiry) = getData(uint256(node));\n\n // burn token and fuse data\n _burn(uint256(node));\n }\n\n function _addLabelSetFusesAndTransfer(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n address oldOwner = ownerOf(uint256(node));\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, fuses, expiry);\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningPCC = fuses & PARENT_CANNOT_CONTROL ==\n PARENT_CANNOT_CONTROL;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningPCC && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _getETH2LDDataAndNormaliseExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n )\n internal\n view\n returns (\n address owner,\n uint32 fuses,\n uint64\n )\n {\n uint64 oldExpiry;\n (owner, fuses, oldExpiry) = getData(uint256(node));\n uint64 maxExpiry = uint64(registrar.nameExpires(uint256(labelhash)));\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n return (owner, fuses, expiry);\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) internal pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private returns (uint64) {\n // Mint a new ERC1155 token with fuses\n // Set PARENT_CANNOT_REPLACE to reflect wrapper + registrar control over the 2LD\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n uint32 oldFuses;\n\n (, oldFuses, expiry) = _getETH2LDDataAndNormaliseExpiry(\n node,\n labelhash,\n expiry\n );\n\n _addLabelAndWrap(\n ETH_NODE,\n node,\n label,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL,\n expiry\n );\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n return expiry;\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (owner == address(0x0) || owner == address(this)) {\n revert IncorrectTargetOwner(owner);\n }\n\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses, expiry);\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n if (\n fuses & ~PARENT_CANNOT_CONTROL != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkForParentCannotControl(bytes32 node, uint32 fuses)\n internal\n view\n {\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n // Only the parent can burn the PARENT_CANNOT_CONTROL fuse.\n revert Unauthorised(node, msg.sender);\n }\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _canTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nerror OperationProhibited(bytes32 node);\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(ERC165, IERC165)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id)\n public\n view\n virtual\n override\n returns (uint256)\n {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n (address owner, , ) = getData(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] memory accounts, uint256[] memory ids)\n public\n view\n virtual\n override\n returns (uint256[] memory)\n {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved)\n public\n virtual\n override\n {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator)\n public\n view\n virtual\n override\n returns (bool)\n {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(uint256 tokenId)\n public\n view\n returns (\n address owner,\n uint32 fuses,\n uint64 expiry\n )\n {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n if (block.timestamp > expiry) {\n fuses = 0;\n } else {\n fuses = uint32(t >> 160);\n }\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiration) = getData(id);\n\n if (!_canTransfer(fuses)) {\n revert OperationProhibited(bytes32(id));\n }\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiration);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _canTransfer(uint32 fuses) internal virtual returns (bool);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses | oldFuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address owner, uint32 fuses, uint64 expiry) = getData(tokenId);\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, owner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n if (!_canTransfer(fuses)) {\n revert OperationProhibited(bytes32(id));\n }\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function setSubnodeRecord(\n bytes32 parentNode,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, _allowances[owner][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = _allowances[owner][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Spend `amount` form the allowance of `owner` toward `spender`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: balance query for the zero address\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"ERC721: owner query for nonexistent token\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n require(_exists(tokenId), \"ERC721Metadata: URI query for nonexistent token\");\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overriden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n require(_exists(tokenId), \"ERC721: approved query for nonexistent token\");\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: transfer caller is not owner nor approved\");\n _safeTransfer(from, to, tokenId, _data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `_data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, _data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n require(_exists(tokenId), \"ERC721: operator query for nonexistent token\");\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, _data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Clear approvals\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits a {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits a {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param _data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"./SafeMath.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using SafeMath for *;\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n returns (bool)\n {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(uint256 expires, uint256 amount)\n external\n view\n returns (uint256)\n {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ReverseRegistrar} from \"../registry/ReverseRegistrar.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper\n ) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(string memory name, uint256 duration)\n public\n view\n override\n returns (IPriceOracle.Price memory price)\n {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint32 fuses,\n uint64 wrapperExpiry\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n resolver,\n data,\n secret,\n reverseRecord,\n fuses,\n wrapperExpiry\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint32 fuses,\n uint64 wrapperExpiry\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n fuses,\n wrapperExpiry\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n fuses,\n wrapperExpiry\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(string calldata name, uint256 duration)\n external\n payable\n override\n {\n _renew(name, duration, 0, 0);\n }\n\n function renewWithFuses(\n string calldata name,\n uint256 duration,\n uint32 fuses,\n uint64 wrapperExpiry\n ) external payable {\n bytes32 labelhash = keccak256(bytes(name));\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, labelhash));\n if (!nameWrapper.isTokenOwnerOrApproved(nodehash, msg.sender)) {\n revert Unauthorised(nodehash);\n }\n _renew(name, duration, fuses, wrapperExpiry);\n }\n\n function _renew(\n string calldata name,\n uint256 duration,\n uint32 fuses,\n uint64 wrapperExpiry\n ) internal {\n bytes32 labelhash = keccak256(bytes(name));\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, labelhash));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires;\n if (nameWrapper.isWrapped(nodehash)) {\n expires = nameWrapper.renew(\n tokenId,\n duration,\n fuses,\n wrapperExpiry\n );\n } else {\n expires = base.renew(tokenId, duration);\n }\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId)\n internal\n view\n override\n returns (bool)\n {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(uint256 tokenId)\n public\n view\n override(IERC721, ERC721)\n returns (address)\n {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(uint256 id, uint256 duration)\n external\n override\n live\n onlyController\n returns (uint256)\n {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n override(ERC721, IERC165)\n returns (bool)\n {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/registry/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(address owner, address resolver)\n public\n override\n returns (bytes32)\n {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(string memory, uint256)\n external\n returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint32,\n uint64\n ) external returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint32,\n uint64\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/registry/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(address owner, address resolver)\n external\n returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(string[] calldata names, uint256 duration)\n external\n view\n override\n returns (uint256 total)\n {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(string[] calldata names, uint256 duration)\n external\n payable\n override\n {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(bytes4 interfaceID)\n external\n pure\n returns (bool)\n {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(string[] calldata names, uint256 duration)\n external\n view\n returns (uint256 total);\n\n function renewAll(string[] calldata names, uint256 duration)\n external\n payable;\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../INameWrapper.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\n\ncontract UpgradedNameWrapperMock {\n address public immutable oldNameWrapper;\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(\n address _oldNameWrapper,\n ENS _ens,\n IBaseRegistrar _registrar\n ) {\n oldNameWrapper = _oldNameWrapper;\n ens = _ens;\n registrar = _registrar;\n }\n\n event SetSubnodeRecord(\n bytes32 parentNode,\n string label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n );\n\n event WrapETH2LD(\n string label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n );\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n registrar.transferFrom(registrant, address(this), tokenId);\n registrar.reclaim(tokenId, address(this));\n require(\n registrant == msg.sender ||\n registrar.isApprovedForAll(registrant, msg.sender),\n \"Unauthorised\"\n );\n emit WrapETH2LD(label, wrappedOwner, fuses, expiry, resolver);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelhash));\n address owner = ens.owner(node);\n require(\n msg.sender == oldNameWrapper ||\n owner == msg.sender ||\n ens.isApprovedForAll(owner, msg.sender),\n \"Not owner/approved or previous nameWrapper controller\"\n );\n ens.setOwner(node, address(this));\n emit SetSubnodeRecord(\n parentNode,\n label,\n newOwner,\n resolver,\n ttl,\n fuses,\n expiry\n );\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(uint256 startPremium, uint256 elapsed)\n public\n pure\n returns (uint256)\n {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2**16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(uint256 fraction, uint256 premium)\n internal\n pure\n returns (uint256)\n {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(bytes4 interfaceID)\n public\n view\n virtual\n override\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "test/utils/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10**uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10**uint256(decimals()));\n }\n }\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(string memory name)\n public\n pure\n returns (bytes memory, bytes32)\n {\n return name.dnsEncodeName();\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 10000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/.chainId b/solidity/dns-contracts/deployments/sepolia/.chainId new file mode 100644 index 0000000..bd8d1cd --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/.chainId @@ -0,0 +1 @@ +11155111 \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/.migrations.json b/solidity/dns-contracts/deployments/sepolia/.migrations.json new file mode 100644 index 0000000..d8520a5 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/.migrations.json @@ -0,0 +1,8 @@ +{ + "ens": 1686901718, + "root": 1686901730, + "setupRoot": 1686901813, + "legacy-resolver": 1688028337, + "legacy-controller": 1688029384, + "bulk-renewal": 1689657854 +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/BaseRegistrarImplementation.json b/solidity/dns-contracts/deployments/sepolia/BaseRegistrarImplementation.json new file mode 100644 index 0000000..548db38 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/BaseRegistrarImplementation.json @@ -0,0 +1,1013 @@ +{ + "address": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_baseNode", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "ControllerAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "ControllerRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameMigrated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRenewed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "GRACE_PERIOD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "addController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "available", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "baseNode", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "nameExpires", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "reclaim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "register", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "registerOnly", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "removeController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x7e4f7ebf750eff3786b9818c656f6191667ae56c38bd88ad115ddb1a689259f5", + "receipt": { + "to": null, + "from": "0x4fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8", + "contractAddress": "0xa2c122be93b0074270ebee7f6b7292c7deb45047", + "transactionIndex": "0x43", + "gasUsed": "0x1d57c1", + "logsBloom": "0x00000000000000000000000000000000000000000000200000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000800800000000000040000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000020000000000000000000000000000000020000000000000000000000000000000000", + "blockHash": "0xd4980c5c474966fe6d384da6bb26b9a50fcd84471359e9f2eed4b31cd4868ddd", + "transactionHash": "0x7e4f7ebf750eff3786b9818c656f6191667ae56c38bd88ad115ddb1a689259f5", + "logs": [ + { + "address": "0xa2c122be93b0074270ebee7f6b7292c7deb45047", + "blockHash": "0xd4980c5c474966fe6d384da6bb26b9a50fcd84471359e9f2eed4b31cd4868ddd", + "blockNumber": "0x3881eb", + "data": "0x", + "logIndex": "0x6b", + "removed": false, + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8" + ], + "transactionHash": "0x7e4f7ebf750eff3786b9818c656f6191667ae56c38bd88ad115ddb1a689259f5", + "transactionIndex": "0x43" + } + ], + "blockNumber": "0x3881eb", + "cumulativeGasUsed": "0xa884cd", + "status": "0x1" + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae" + ], + "numDeployments": 2, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_baseNode\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"ControllerAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"ControllerRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameMigrated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameRenewed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"GRACE_PERIOD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"addController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"available\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"baseNode\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"nameExpires\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"reclaim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"register\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"registerOnly\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"removeController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"renew\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"approve(address,uint256)\":{\"details\":\"See {IERC721-approve}.\"},\"balanceOf(address)\":{\"details\":\"See {IERC721-balanceOf}.\"},\"getApproved(uint256)\":{\"details\":\"See {IERC721-getApproved}.\"},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC721-isApprovedForAll}.\"},\"name()\":{\"details\":\"See {IERC721Metadata-name}.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"ownerOf(uint256)\":{\"details\":\"Gets the owner of the specified token ID. Names become unowned when their registration expires.\",\"params\":{\"tokenId\":\"uint256 ID of the token to query the owner of\"},\"returns\":{\"_0\":\"address currently marked as the owner of the given token ID\"}},\"reclaim(uint256,address)\":{\"details\":\"Reclaim ownership of a name in ENS, if you own it in the registrar.\"},\"register(uint256,address,uint256)\":{\"details\":\"Register a name.\",\"params\":{\"duration\":\"Duration in seconds for the registration.\",\"id\":\"The token ID (keccak256 of the label).\",\"owner\":\"The address that should own the registration.\"}},\"registerOnly(uint256,address,uint256)\":{\"details\":\"Register a name, without modifying the registry.\",\"params\":{\"duration\":\"Duration in seconds for the registration.\",\"id\":\"The token ID (keccak256 of the label).\",\"owner\":\"The address that should own the registration.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"safeTransferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-safeTransferFrom}.\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"details\":\"See {IERC721-safeTransferFrom}.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC721-setApprovalForAll}.\"},\"symbol()\":{\"details\":\"See {IERC721Metadata-symbol}.\"},\"tokenURI(uint256)\":{\"details\":\"See {IERC721Metadata-tokenURI}.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-transferFrom}.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/BaseRegistrarImplementation.sol\":\"BaseRegistrarImplementation\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/ERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721.sol\\\";\\nimport \\\"./IERC721Receiver.sol\\\";\\nimport \\\"./extensions/IERC721Metadata.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\nimport \\\"../../utils/Strings.sol\\\";\\nimport \\\"../../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\n * {ERC721Enumerable}.\\n */\\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\\n using Address for address;\\n using Strings for uint256;\\n\\n // Token name\\n string private _name;\\n\\n // Token symbol\\n string private _symbol;\\n\\n // Mapping from token ID to owner address\\n mapping(uint256 => address) private _owners;\\n\\n // Mapping owner address to token count\\n mapping(address => uint256) private _balances;\\n\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) private _tokenApprovals;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IERC721).interfaceId ||\\n interfaceId == type(IERC721Metadata).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721-balanceOf}.\\n */\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\n return _balances[owner];\\n }\\n\\n /**\\n * @dev See {IERC721-ownerOf}.\\n */\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\n address owner = _ownerOf(tokenId);\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n _requireMinted(tokenId);\\n\\n string memory baseURI = _baseURI();\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\n }\\n\\n /**\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\n * by default, can be overridden in child contracts.\\n */\\n function _baseURI() internal view virtual returns (string memory) {\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual override {\\n address owner = ERC721.ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\n _requireMinted(tokenId);\\n\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC721-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC721-isApprovedForAll}.\\n */\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[owner][operator];\\n }\\n\\n /**\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n _safeTransfer(from, to, tokenId, data);\\n }\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\n *\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeTransfer(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) internal virtual {\\n _transfer(from, to, tokenId);\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n }\\n\\n /**\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\n }\\n\\n /**\\n * @dev Returns whether `tokenId` exists.\\n *\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\n *\\n * Tokens start existing when they are minted (`_mint`),\\n * and stop existing when they are burned (`_burn`).\\n */\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\n return _ownerOf(tokenId) != address(0);\\n }\\n\\n /**\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\n address owner = ERC721.ownerOf(tokenId);\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\n }\\n\\n /**\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\n _safeMint(to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\n */\\n function _safeMint(\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) internal virtual {\\n _mint(to, tokenId);\\n require(\\n _checkOnERC721Received(address(0), to, tokenId, data),\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\n );\\n }\\n\\n /**\\n * @dev Mints `tokenId` and transfers it to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - `to` cannot be the zero address.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _mint(address to, uint256 tokenId) internal virtual {\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n _beforeTokenTransfer(address(0), to, tokenId, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _burn(uint256 tokenId) internal virtual {\\n address owner = ERC721.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\n }\\n\\n /**\\n * @dev Transfers `tokenId` from `from` to `to`.\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _transfer(\\n address from,\\n address to,\\n uint256 tokenId\\n ) internal virtual {\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, tokenId, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(\\n address owner,\\n address operator,\\n bool approved\\n ) internal virtual {\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Reverts if the `tokenId` has not been minted yet.\\n */\\n function _requireMinted(uint256 tokenId) internal view virtual {\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\n }\\n\\n /**\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\n * The call is not executed if the target address is not a contract.\\n *\\n * @param from address representing the previous owner of the given token ID\\n * @param to target address that will receive the tokens\\n * @param tokenId uint256 ID of the token to be transferred\\n * @param data bytes optional data to send along with the call\\n * @return bool whether the call correctly returned the expected magic value\\n */\\n function _checkOnERC721Received(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) private returns (bool) {\\n if (to.isContract()) {\\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721Receiver.onERC721Received.selector;\\n } catch (bytes memory reason) {\\n if (reason.length == 0) {\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n } else {\\n /// @solidity memory-safe-assembly\\n assembly {\\n revert(add(32, reason), mload(reason))\\n }\\n }\\n }\\n } else {\\n return true;\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256, /* firstTokenId */\\n uint256 batchSize\\n ) internal virtual {\\n if (batchSize > 1) {\\n if (from != address(0)) {\\n _balances[from] -= batchSize;\\n }\\n if (to != address(0)) {\\n _balances[to] += batchSize;\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 firstTokenId,\\n uint256 batchSize\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0xd89f3585b211fc9e3408384a4c4efdc3a93b2f877a3821046fa01c219d35be1b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xab28a56179c1db258c9bf5235b382698cb650debecb51b23d12be9e241374b68\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721Metadata is IERC721 {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\"},\"contracts/ethregistrar/BaseRegistrarImplementation.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/ERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\\n // A map of expiry times\\n mapping(uint256 => uint256) expiries;\\n // The ENS registry\\n ENS public ens;\\n // The namehash of the TLD this registrar owns (eg, .eth)\\n bytes32 public baseNode;\\n // A map of addresses that are authorised to register and renew names.\\n mapping(address => bool) public controllers;\\n uint256 public constant GRACE_PERIOD = 90 days;\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n bytes4 private constant ERC721_ID =\\n bytes4(\\n keccak256(\\\"balanceOf(address)\\\") ^\\n keccak256(\\\"ownerOf(uint256)\\\") ^\\n keccak256(\\\"approve(address,uint256)\\\") ^\\n keccak256(\\\"getApproved(uint256)\\\") ^\\n keccak256(\\\"setApprovalForAll(address,bool)\\\") ^\\n keccak256(\\\"isApprovedForAll(address,address)\\\") ^\\n keccak256(\\\"transferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256,bytes)\\\")\\n );\\n bytes4 private constant RECLAIM_ID =\\n bytes4(keccak256(\\\"reclaim(uint256,address)\\\"));\\n\\n /**\\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\\n * @dev Returns whether the given spender can transfer a given token ID\\n * @param spender address of the spender to query\\n * @param tokenId uint256 ID of the token to be transferred\\n * @return bool whether the msg.sender is approved for the given token ID,\\n * is an operator of the owner, or is the owner of the token\\n */\\n function _isApprovedOrOwner(\\n address spender,\\n uint256 tokenId\\n ) internal view override returns (bool) {\\n address owner = ownerOf(tokenId);\\n return (spender == owner ||\\n getApproved(tokenId) == spender ||\\n isApprovedForAll(owner, spender));\\n }\\n\\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\\\"\\\", \\\"\\\") {\\n ens = _ens;\\n baseNode = _baseNode;\\n }\\n\\n modifier live() {\\n require(ens.owner(baseNode) == address(this));\\n _;\\n }\\n\\n modifier onlyController() {\\n require(controllers[msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Gets the owner of the specified token ID. Names become unowned\\n * when their registration expires.\\n * @param tokenId uint256 ID of the token to query the owner of\\n * @return address currently marked as the owner of the given token ID\\n */\\n function ownerOf(\\n uint256 tokenId\\n ) public view override(IERC721, ERC721) returns (address) {\\n require(expiries[tokenId] > block.timestamp);\\n return super.ownerOf(tokenId);\\n }\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external override onlyOwner {\\n controllers[controller] = true;\\n emit ControllerAdded(controller);\\n }\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external override onlyOwner {\\n controllers[controller] = false;\\n emit ControllerRemoved(controller);\\n }\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external override onlyOwner {\\n ens.setResolver(baseNode, resolver);\\n }\\n\\n // Returns the expiration timestamp of the specified id.\\n function nameExpires(uint256 id) external view override returns (uint256) {\\n return expiries[id];\\n }\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) public view override returns (bool) {\\n // Not available if it's registered here or in its grace period.\\n return expiries[id] + GRACE_PERIOD < block.timestamp;\\n }\\n\\n /**\\n * @dev Register a name.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external override returns (uint256) {\\n return _register(id, owner, duration, true);\\n }\\n\\n /**\\n * @dev Register a name, without modifying the registry.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function registerOnly(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256) {\\n return _register(id, owner, duration, false);\\n }\\n\\n function _register(\\n uint256 id,\\n address owner,\\n uint256 duration,\\n bool updateRegistry\\n ) internal live onlyController returns (uint256) {\\n require(available(id));\\n require(\\n block.timestamp + duration + GRACE_PERIOD >\\n block.timestamp + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] = block.timestamp + duration;\\n if (_exists(id)) {\\n // Name was previously owned, and expired\\n _burn(id);\\n }\\n _mint(owner, id);\\n if (updateRegistry) {\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n emit NameRegistered(id, owner, block.timestamp + duration);\\n\\n return block.timestamp + duration;\\n }\\n\\n function renew(\\n uint256 id,\\n uint256 duration\\n ) external override live onlyController returns (uint256) {\\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\\n require(\\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] += duration;\\n emit NameRenewed(id, expiries[id]);\\n return expiries[id];\\n }\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external override live {\\n require(_isApprovedOrOwner(msg.sender, id));\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view override(ERC721, IERC165) returns (bool) {\\n return\\n interfaceID == INTERFACE_META_ID ||\\n interfaceID == ERC721_ID ||\\n interfaceID == RECLAIM_ID;\\n }\\n}\\n\",\"keccak256\":\"0xaee6eb36aead449d397b86a02e9c63bc46e3ef378d0a62bfd68beaae1150c9d0\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506040516200232138038062002321833981016040819052620000349162000109565b60408051602080820183526000808352835191820190935282815290916200005d8382620001ea565b5060016200006c8282620001ea565b5050506200008962000083620000b360201b60201c565b620000b7565b600880546001600160a01b0319166001600160a01b039390931692909217909155600955620002b6565b3390565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600080604083850312156200011d57600080fd5b82516001600160a01b03811681146200013557600080fd5b6020939093015192949293505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200017057607f821691505b6020821081036200019157634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620001e557600081815260208120601f850160051c81016020861015620001c05750805b601f850160051c820191505b81811015620001e157828155600101620001cc565b5050505b505050565b81516001600160401b0381111562000206576200020662000145565b6200021e816200021784546200015b565b8462000197565b602080601f8311600181146200025657600084156200023d5750858301515b600019600386901b1c1916600185901b178555620001e1565b600085815260208120601f198616915b82811015620002875788860151825594840194600190910190840162000266565b5085821015620002a65787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b61205b80620002c66000396000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c806395d89b4111610104578063c87b56dd116100a2578063e985e9c511610071578063e985e9c5146103e0578063f2fde38b1461041c578063f6a74ed71461042f578063fca247ac1461044257600080fd5b8063c87b56dd14610381578063d6e4fa8614610394578063da8c229e146103b4578063ddf7fcb0146103d757600080fd5b8063a7fc7a07116100de578063a7fc7a071461033e578063b88d4fde14610351578063c1a287e214610364578063c475abff1461036e57600080fd5b806395d89b411461031057806396e494e814610318578063a22cb4651461032b57600080fd5b80633f15457f116101715780636352211e1161014b5780636352211e146102d157806370a08231146102e4578063715018a6146102f75780638da5cb5b146102ff57600080fd5b80633f15457f1461029857806342842e0e146102ab5780634e543b26146102be57600080fd5b8063095ea7b3116101ad578063095ea7b31461023c5780630e297b451461025157806323b872dd1461027257806328ed4f6c1461028557600080fd5b806301ffc9a7146101d457806306fdde03146101fc578063081812fc14610211575b600080fd5b6101e76101e2366004611be9565b610455565b60405190151581526020015b60405180910390f35b6102046104f2565b6040516101f39190611c56565b61022461021f366004611c69565b610584565b6040516001600160a01b0390911681526020016101f3565b61024f61024a366004611c97565b6105ab565b005b61026461025f366004611cc3565b6106e1565b6040519081526020016101f3565b61024f610280366004611cfb565b6106f8565b61024f610293366004611d2b565b61077f565b600854610224906001600160a01b031681565b61024f6102b9366004611cfb565b610898565b61024f6102cc366004611d5b565b6108b3565b6102246102df366004611c69565b610941565b6102646102f2366004611d5b565b610964565b61024f6109fe565b6006546001600160a01b0316610224565b610204610a12565b6101e7610326366004611c69565b610a21565b61024f610339366004611d78565b610a47565b61024f61034c366004611d5b565b610a56565b61024f61035f366004611dc1565b610aaa565b6102646276a70081565b61026461037c366004611ea1565b610b38565b61020461038f366004611c69565b610cc9565b6102646103a2366004611c69565b60009081526007602052604090205490565b6101e76103c2366004611d5b565b600a6020526000908152604090205460ff1681565b61026460095481565b6101e76103ee366004611ec3565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61024f61042a366004611d5b565b610d3d565b61024f61043d366004611d5b565b610dcd565b610264610450366004611cc3565b610e1e565b60006001600160e01b031982167f01ffc9a70000000000000000000000000000000000000000000000000000000014806104b857506001600160e01b031982167f80ac58cd00000000000000000000000000000000000000000000000000000000145b806104ec57506001600160e01b031982167f28ed4f6c00000000000000000000000000000000000000000000000000000000145b92915050565b60606000805461050190611ef1565b80601f016020809104026020016040519081016040528092919081815260200182805461052d90611ef1565b801561057a5780601f1061054f5761010080835404028352916020019161057a565b820191906000526020600020905b81548152906001019060200180831161055d57829003601f168201915b5050505050905090565b600061058f82610e2d565b506000908152600460205260409020546001600160a01b031690565b60006105b682610e91565b9050806001600160a01b0316836001600160a01b0316036106445760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b0382161480610660575061066081336103ee565b6106d25760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161063b565b6106dc8383610ef6565b505050565b60006106f08484846000610f71565b949350505050565b6107023382611181565b6107745760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f76656400000000000000000000000000000000000000606482015260840161063b565b6106dc8383836111fc565b6008546009546040516302571be360e01b8152600481019190915230916001600160a01b0316906302571be390602401602060405180830381865afa1580156107cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f09190611f2b565b6001600160a01b03161461080357600080fd5b61080d3383611181565b61081657600080fd5b6008546009546040516306ab592360e01b81526004810191909152602481018490526001600160a01b038381166044830152909116906306ab5923906064016020604051808303816000875af1158015610874573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106dc9190611f48565b6106dc83838360405180602001604052806000815250610aaa565b6108bb61140f565b6008546009546040517f1896f70a00000000000000000000000000000000000000000000000000000000815260048101919091526001600160a01b03838116602483015290911690631896f70a90604401600060405180830381600087803b15801561092657600080fd5b505af115801561093a573d6000803e3d6000fd5b5050505050565b600081815260076020526040812054421061095b57600080fd5b6104ec82610e91565b60006001600160a01b0382166109e25760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e65720000000000000000000000000000000000000000000000606482015260840161063b565b506001600160a01b031660009081526003602052604090205490565b610a0661140f565b610a106000611469565b565b60606001805461050190611ef1565b6000818152600760205260408120544290610a40906276a70090611f77565b1092915050565b610a523383836114c8565b5050565b610a5e61140f565b6001600160a01b0381166000818152600a6020526040808220805460ff19166001179055517f0a8bb31534c0ed46f380cb867bd5c803a189ced9a764e30b3a4991a9901d74749190a250565b610ab43383611181565b610b265760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f76656400000000000000000000000000000000000000606482015260840161063b565b610b3284848484611596565b50505050565b6008546009546040516302571be360e01b8152600481019190915260009130916001600160a01b03909116906302571be390602401602060405180830381865afa158015610b8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bae9190611f2b565b6001600160a01b031614610bc157600080fd5b336000908152600a602052604090205460ff16610bdd57600080fd5b6000838152600760205260409020544290610bfc906276a70090611f77565b1015610c0757600080fd5b610c146276a70083611f77565b6000848152600760205260409020546276a70090610c33908590611f77565b610c3d9190611f77565b11610c4757600080fd5b60008381526007602052604081208054849290610c65908490611f77565b90915550506000838152600760205260409081902054905184917f9b87a00e30f1ac65d898f070f8a3488fe60517182d0a2098e1b4b93a54aa9bd691610cad91815260200190565b60405180910390a2505060009081526007602052604090205490565b6060610cd482610e2d565b6000610ceb60408051602081019091526000815290565b90506000815111610d0b5760405180602001604052806000815250610d36565b80610d158461161f565b604051602001610d26929190611f8a565b6040516020818303038152906040525b9392505050565b610d4561140f565b6001600160a01b038116610dc15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161063b565b610dca81611469565b50565b610dd561140f565b6001600160a01b0381166000818152600a6020526040808220805460ff19169055517f33d83959be2573f5453b12eb9d43b3499bc57d96bd2f067ba44803c859e811139190a250565b60006106f08484846001610f71565b6000818152600260205260409020546001600160a01b0316610dca5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161063b565b6000818152600260205260408120546001600160a01b0316806104ec5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161063b565b6000818152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091558190610f3882610e91565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6008546009546040516302571be360e01b8152600481019190915260009130916001600160a01b03909116906302571be390602401602060405180830381865afa158015610fc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe79190611f2b565b6001600160a01b031614610ffa57600080fd5b336000908152600a602052604090205460ff1661101657600080fd5b61101f85610a21565b61102857600080fd5b6110356276a70042611f77565b6276a7006110438542611f77565b61104d9190611f77565b1161105757600080fd5b6110618342611f77565b6000868152600760209081526040808320939093556002905220546001600160a01b03161561109357611093856116bf565b61109d848661176f565b8115611127576008546009546040516306ab592360e01b81526004810191909152602481018790526001600160a01b038681166044830152909116906306ab5923906064016020604051808303816000875af1158015611101573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111259190611f48565b505b6001600160a01b038416857fb3d987963d01b2f68493b4bdb130988f157ea43070d4ad840fee0466ed9370d961115d8642611f77565b60405190815260200160405180910390a36111788342611f77565b95945050505050565b60008061118d83610941565b9050806001600160a01b0316846001600160a01b031614806111c85750836001600160a01b03166111bd84610584565b6001600160a01b0316145b806106f057506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff166106f0565b826001600160a01b031661120f82610e91565b6001600160a01b0316146112735760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161063b565b6001600160a01b0382166112ee5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161063b565b6112fb8383836001611915565b826001600160a01b031661130e82610e91565b6001600160a01b0316146113725760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161063b565b6000818152600460209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6006546001600160a01b03163314610a105760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161063b565b600680546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b0316036115295760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161063b565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6115a18484846111fc565b6115ad8484848461199d565b610b325760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161063b565b6060600061162c83611af1565b600101905060008167ffffffffffffffff81111561164c5761164c611dab565b6040519080825280601f01601f191660200182016040528015611676576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a850494508461168057509392505050565b60006116ca82610e91565b90506116da816000846001611915565b6116e382610e91565b6000838152600460209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b0385168085526003845282852080546000190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6001600160a01b0382166117c55760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161063b565b6000818152600260205260409020546001600160a01b03161561182a5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161063b565b611838600083836001611915565b6000818152600260205260409020546001600160a01b03161561189d5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161063b565b6001600160a01b0382166000818152600360209081526040808320805460010190558483526002909152808220805473ffffffffffffffffffffffffffffffffffffffff19168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001811115610b32576001600160a01b0384161561195b576001600160a01b03841660009081526003602052604081208054839290611955908490611fb9565b90915550505b6001600160a01b03831615610b32576001600160a01b03831660009081526003602052604081208054839290611992908490611f77565b909155505050505050565b60006001600160a01b0384163b15611ae957604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906119e1903390899088908890600401611fcc565b6020604051808303816000875af1925050508015611a1c575060408051601f3d908101601f19168201909252611a1991810190612008565b60015b611acf573d808015611a4a576040519150601f19603f3d011682016040523d82523d6000602084013e611a4f565b606091505b508051600003611ac75760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161063b565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506106f0565b5060016106f0565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310611b3a577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310611b66576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310611b8457662386f26fc10000830492506010015b6305f5e1008310611b9c576305f5e100830492506008015b6127108310611bb057612710830492506004015b60648310611bc2576064830492506002015b600a83106104ec5760010192915050565b6001600160e01b031981168114610dca57600080fd5b600060208284031215611bfb57600080fd5b8135610d3681611bd3565b60005b83811015611c21578181015183820152602001611c09565b50506000910152565b60008151808452611c42816020860160208601611c06565b601f01601f19169290920160200192915050565b602081526000610d366020830184611c2a565b600060208284031215611c7b57600080fd5b5035919050565b6001600160a01b0381168114610dca57600080fd5b60008060408385031215611caa57600080fd5b8235611cb581611c82565b946020939093013593505050565b600080600060608486031215611cd857600080fd5b833592506020840135611cea81611c82565b929592945050506040919091013590565b600080600060608486031215611d1057600080fd5b8335611d1b81611c82565b92506020840135611cea81611c82565b60008060408385031215611d3e57600080fd5b823591506020830135611d5081611c82565b809150509250929050565b600060208284031215611d6d57600080fd5b8135610d3681611c82565b60008060408385031215611d8b57600080fd5b8235611d9681611c82565b915060208301358015158114611d5057600080fd5b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215611dd757600080fd5b8435611de281611c82565b93506020850135611df281611c82565b925060408501359150606085013567ffffffffffffffff80821115611e1657600080fd5b818701915087601f830112611e2a57600080fd5b813581811115611e3c57611e3c611dab565b604051601f8201601f19908116603f01168101908382118183101715611e6457611e64611dab565b816040528281528a6020848701011115611e7d57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215611eb457600080fd5b50508035926020909101359150565b60008060408385031215611ed657600080fd5b8235611ee181611c82565b91506020830135611d5081611c82565b600181811c90821680611f0557607f821691505b602082108103611f2557634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611f3d57600080fd5b8151610d3681611c82565b600060208284031215611f5a57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156104ec576104ec611f61565b60008351611f9c818460208801611c06565b835190830190611fb0818360208801611c06565b01949350505050565b818103818111156104ec576104ec611f61565b60006001600160a01b03808716835280861660208401525083604083015260806060830152611ffe6080830184611c2a565b9695505050505050565b60006020828403121561201a57600080fd5b8151610d3681611bd356fea2646970667358221220c630ba8f4bccefef0d24d6342b73a5a1b846097a660dac3679e4fd4b37d7872e64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c806395d89b4111610104578063c87b56dd116100a2578063e985e9c511610071578063e985e9c5146103e0578063f2fde38b1461041c578063f6a74ed71461042f578063fca247ac1461044257600080fd5b8063c87b56dd14610381578063d6e4fa8614610394578063da8c229e146103b4578063ddf7fcb0146103d757600080fd5b8063a7fc7a07116100de578063a7fc7a071461033e578063b88d4fde14610351578063c1a287e214610364578063c475abff1461036e57600080fd5b806395d89b411461031057806396e494e814610318578063a22cb4651461032b57600080fd5b80633f15457f116101715780636352211e1161014b5780636352211e146102d157806370a08231146102e4578063715018a6146102f75780638da5cb5b146102ff57600080fd5b80633f15457f1461029857806342842e0e146102ab5780634e543b26146102be57600080fd5b8063095ea7b3116101ad578063095ea7b31461023c5780630e297b451461025157806323b872dd1461027257806328ed4f6c1461028557600080fd5b806301ffc9a7146101d457806306fdde03146101fc578063081812fc14610211575b600080fd5b6101e76101e2366004611be9565b610455565b60405190151581526020015b60405180910390f35b6102046104f2565b6040516101f39190611c56565b61022461021f366004611c69565b610584565b6040516001600160a01b0390911681526020016101f3565b61024f61024a366004611c97565b6105ab565b005b61026461025f366004611cc3565b6106e1565b6040519081526020016101f3565b61024f610280366004611cfb565b6106f8565b61024f610293366004611d2b565b61077f565b600854610224906001600160a01b031681565b61024f6102b9366004611cfb565b610898565b61024f6102cc366004611d5b565b6108b3565b6102246102df366004611c69565b610941565b6102646102f2366004611d5b565b610964565b61024f6109fe565b6006546001600160a01b0316610224565b610204610a12565b6101e7610326366004611c69565b610a21565b61024f610339366004611d78565b610a47565b61024f61034c366004611d5b565b610a56565b61024f61035f366004611dc1565b610aaa565b6102646276a70081565b61026461037c366004611ea1565b610b38565b61020461038f366004611c69565b610cc9565b6102646103a2366004611c69565b60009081526007602052604090205490565b6101e76103c2366004611d5b565b600a6020526000908152604090205460ff1681565b61026460095481565b6101e76103ee366004611ec3565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61024f61042a366004611d5b565b610d3d565b61024f61043d366004611d5b565b610dcd565b610264610450366004611cc3565b610e1e565b60006001600160e01b031982167f01ffc9a70000000000000000000000000000000000000000000000000000000014806104b857506001600160e01b031982167f80ac58cd00000000000000000000000000000000000000000000000000000000145b806104ec57506001600160e01b031982167f28ed4f6c00000000000000000000000000000000000000000000000000000000145b92915050565b60606000805461050190611ef1565b80601f016020809104026020016040519081016040528092919081815260200182805461052d90611ef1565b801561057a5780601f1061054f5761010080835404028352916020019161057a565b820191906000526020600020905b81548152906001019060200180831161055d57829003601f168201915b5050505050905090565b600061058f82610e2d565b506000908152600460205260409020546001600160a01b031690565b60006105b682610e91565b9050806001600160a01b0316836001600160a01b0316036106445760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b0382161480610660575061066081336103ee565b6106d25760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161063b565b6106dc8383610ef6565b505050565b60006106f08484846000610f71565b949350505050565b6107023382611181565b6107745760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f76656400000000000000000000000000000000000000606482015260840161063b565b6106dc8383836111fc565b6008546009546040516302571be360e01b8152600481019190915230916001600160a01b0316906302571be390602401602060405180830381865afa1580156107cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f09190611f2b565b6001600160a01b03161461080357600080fd5b61080d3383611181565b61081657600080fd5b6008546009546040516306ab592360e01b81526004810191909152602481018490526001600160a01b038381166044830152909116906306ab5923906064016020604051808303816000875af1158015610874573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106dc9190611f48565b6106dc83838360405180602001604052806000815250610aaa565b6108bb61140f565b6008546009546040517f1896f70a00000000000000000000000000000000000000000000000000000000815260048101919091526001600160a01b03838116602483015290911690631896f70a90604401600060405180830381600087803b15801561092657600080fd5b505af115801561093a573d6000803e3d6000fd5b5050505050565b600081815260076020526040812054421061095b57600080fd5b6104ec82610e91565b60006001600160a01b0382166109e25760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e65720000000000000000000000000000000000000000000000606482015260840161063b565b506001600160a01b031660009081526003602052604090205490565b610a0661140f565b610a106000611469565b565b60606001805461050190611ef1565b6000818152600760205260408120544290610a40906276a70090611f77565b1092915050565b610a523383836114c8565b5050565b610a5e61140f565b6001600160a01b0381166000818152600a6020526040808220805460ff19166001179055517f0a8bb31534c0ed46f380cb867bd5c803a189ced9a764e30b3a4991a9901d74749190a250565b610ab43383611181565b610b265760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f76656400000000000000000000000000000000000000606482015260840161063b565b610b3284848484611596565b50505050565b6008546009546040516302571be360e01b8152600481019190915260009130916001600160a01b03909116906302571be390602401602060405180830381865afa158015610b8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bae9190611f2b565b6001600160a01b031614610bc157600080fd5b336000908152600a602052604090205460ff16610bdd57600080fd5b6000838152600760205260409020544290610bfc906276a70090611f77565b1015610c0757600080fd5b610c146276a70083611f77565b6000848152600760205260409020546276a70090610c33908590611f77565b610c3d9190611f77565b11610c4757600080fd5b60008381526007602052604081208054849290610c65908490611f77565b90915550506000838152600760205260409081902054905184917f9b87a00e30f1ac65d898f070f8a3488fe60517182d0a2098e1b4b93a54aa9bd691610cad91815260200190565b60405180910390a2505060009081526007602052604090205490565b6060610cd482610e2d565b6000610ceb60408051602081019091526000815290565b90506000815111610d0b5760405180602001604052806000815250610d36565b80610d158461161f565b604051602001610d26929190611f8a565b6040516020818303038152906040525b9392505050565b610d4561140f565b6001600160a01b038116610dc15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161063b565b610dca81611469565b50565b610dd561140f565b6001600160a01b0381166000818152600a6020526040808220805460ff19169055517f33d83959be2573f5453b12eb9d43b3499bc57d96bd2f067ba44803c859e811139190a250565b60006106f08484846001610f71565b6000818152600260205260409020546001600160a01b0316610dca5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161063b565b6000818152600260205260408120546001600160a01b0316806104ec5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161063b565b6000818152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091558190610f3882610e91565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6008546009546040516302571be360e01b8152600481019190915260009130916001600160a01b03909116906302571be390602401602060405180830381865afa158015610fc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe79190611f2b565b6001600160a01b031614610ffa57600080fd5b336000908152600a602052604090205460ff1661101657600080fd5b61101f85610a21565b61102857600080fd5b6110356276a70042611f77565b6276a7006110438542611f77565b61104d9190611f77565b1161105757600080fd5b6110618342611f77565b6000868152600760209081526040808320939093556002905220546001600160a01b03161561109357611093856116bf565b61109d848661176f565b8115611127576008546009546040516306ab592360e01b81526004810191909152602481018790526001600160a01b038681166044830152909116906306ab5923906064016020604051808303816000875af1158015611101573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111259190611f48565b505b6001600160a01b038416857fb3d987963d01b2f68493b4bdb130988f157ea43070d4ad840fee0466ed9370d961115d8642611f77565b60405190815260200160405180910390a36111788342611f77565b95945050505050565b60008061118d83610941565b9050806001600160a01b0316846001600160a01b031614806111c85750836001600160a01b03166111bd84610584565b6001600160a01b0316145b806106f057506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff166106f0565b826001600160a01b031661120f82610e91565b6001600160a01b0316146112735760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161063b565b6001600160a01b0382166112ee5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161063b565b6112fb8383836001611915565b826001600160a01b031661130e82610e91565b6001600160a01b0316146113725760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161063b565b6000818152600460209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6006546001600160a01b03163314610a105760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161063b565b600680546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b0316036115295760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161063b565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6115a18484846111fc565b6115ad8484848461199d565b610b325760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161063b565b6060600061162c83611af1565b600101905060008167ffffffffffffffff81111561164c5761164c611dab565b6040519080825280601f01601f191660200182016040528015611676576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a850494508461168057509392505050565b60006116ca82610e91565b90506116da816000846001611915565b6116e382610e91565b6000838152600460209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b0385168085526003845282852080546000190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6001600160a01b0382166117c55760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161063b565b6000818152600260205260409020546001600160a01b03161561182a5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161063b565b611838600083836001611915565b6000818152600260205260409020546001600160a01b03161561189d5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161063b565b6001600160a01b0382166000818152600360209081526040808320805460010190558483526002909152808220805473ffffffffffffffffffffffffffffffffffffffff19168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001811115610b32576001600160a01b0384161561195b576001600160a01b03841660009081526003602052604081208054839290611955908490611fb9565b90915550505b6001600160a01b03831615610b32576001600160a01b03831660009081526003602052604081208054839290611992908490611f77565b909155505050505050565b60006001600160a01b0384163b15611ae957604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906119e1903390899088908890600401611fcc565b6020604051808303816000875af1925050508015611a1c575060408051601f3d908101601f19168201909252611a1991810190612008565b60015b611acf573d808015611a4a576040519150601f19603f3d011682016040523d82523d6000602084013e611a4f565b606091505b508051600003611ac75760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161063b565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506106f0565b5060016106f0565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310611b3a577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310611b66576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310611b8457662386f26fc10000830492506010015b6305f5e1008310611b9c576305f5e100830492506008015b6127108310611bb057612710830492506004015b60648310611bc2576064830492506002015b600a83106104ec5760010192915050565b6001600160e01b031981168114610dca57600080fd5b600060208284031215611bfb57600080fd5b8135610d3681611bd3565b60005b83811015611c21578181015183820152602001611c09565b50506000910152565b60008151808452611c42816020860160208601611c06565b601f01601f19169290920160200192915050565b602081526000610d366020830184611c2a565b600060208284031215611c7b57600080fd5b5035919050565b6001600160a01b0381168114610dca57600080fd5b60008060408385031215611caa57600080fd5b8235611cb581611c82565b946020939093013593505050565b600080600060608486031215611cd857600080fd5b833592506020840135611cea81611c82565b929592945050506040919091013590565b600080600060608486031215611d1057600080fd5b8335611d1b81611c82565b92506020840135611cea81611c82565b60008060408385031215611d3e57600080fd5b823591506020830135611d5081611c82565b809150509250929050565b600060208284031215611d6d57600080fd5b8135610d3681611c82565b60008060408385031215611d8b57600080fd5b8235611d9681611c82565b915060208301358015158114611d5057600080fd5b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215611dd757600080fd5b8435611de281611c82565b93506020850135611df281611c82565b925060408501359150606085013567ffffffffffffffff80821115611e1657600080fd5b818701915087601f830112611e2a57600080fd5b813581811115611e3c57611e3c611dab565b604051601f8201601f19908116603f01168101908382118183101715611e6457611e64611dab565b816040528281528a6020848701011115611e7d57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215611eb457600080fd5b50508035926020909101359150565b60008060408385031215611ed657600080fd5b8235611ee181611c82565b91506020830135611d5081611c82565b600181811c90821680611f0557607f821691505b602082108103611f2557634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611f3d57600080fd5b8151610d3681611c82565b600060208284031215611f5a57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156104ec576104ec611f61565b60008351611f9c818460208801611c06565b835190830190611fb0818360208801611c06565b01949350505050565b818103818111156104ec576104ec611f61565b60006001600160a01b03808716835280861660208401525083604083015260806060830152611ffe6080830184611c2a565b9695505050505050565b60006020828403121561201a57600080fd5b8151610d3681611bd356fea2646970667358221220c630ba8f4bccefef0d24d6342b73a5a1b846097a660dac3679e4fd4b37d7872e64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "approve(address,uint256)": { + "details": "See {IERC721-approve}." + }, + "balanceOf(address)": { + "details": "See {IERC721-balanceOf}." + }, + "getApproved(uint256)": { + "details": "See {IERC721-getApproved}." + }, + "isApprovedForAll(address,address)": { + "details": "See {IERC721-isApprovedForAll}." + }, + "name()": { + "details": "See {IERC721Metadata-name}." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "ownerOf(uint256)": { + "details": "Gets the owner of the specified token ID. Names become unowned when their registration expires.", + "params": { + "tokenId": "uint256 ID of the token to query the owner of" + }, + "returns": { + "_0": "address currently marked as the owner of the given token ID" + } + }, + "reclaim(uint256,address)": { + "details": "Reclaim ownership of a name in ENS, if you own it in the registrar." + }, + "register(uint256,address,uint256)": { + "details": "Register a name.", + "params": { + "duration": "Duration in seconds for the registration.", + "id": "The token ID (keccak256 of the label).", + "owner": "The address that should own the registration." + } + }, + "registerOnly(uint256,address,uint256)": { + "details": "Register a name, without modifying the registry.", + "params": { + "duration": "Duration in seconds for the registration.", + "id": "The token ID (keccak256 of the label).", + "owner": "The address that should own the registration." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "safeTransferFrom(address,address,uint256)": { + "details": "See {IERC721-safeTransferFrom}." + }, + "safeTransferFrom(address,address,uint256,bytes)": { + "details": "See {IERC721-safeTransferFrom}." + }, + "setApprovalForAll(address,bool)": { + "details": "See {IERC721-setApprovalForAll}." + }, + "symbol()": { + "details": "See {IERC721Metadata-symbol}." + }, + "tokenURI(uint256)": { + "details": "See {IERC721Metadata-tokenURI}." + }, + "transferFrom(address,address,uint256)": { + "details": "See {IERC721-transferFrom}." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 1443, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_name", + "offset": 0, + "slot": "0", + "type": "t_string_storage" + }, + { + "astId": 1445, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_symbol", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 1449, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_owners", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint256,t_address)" + }, + { + "astId": 1453, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_balances", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 1457, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_tokenApprovals", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_uint256,t_address)" + }, + { + "astId": 1463, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_operatorApprovals", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" + }, + { + "astId": 444, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_owner", + "offset": 0, + "slot": "6", + "type": "t_address" + }, + { + "astId": 10741, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "expiries", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 10744, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "ens", + "offset": 0, + "slot": "8", + "type": "t_contract(ENS)14086" + }, + { + "astId": 10746, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "baseNode", + "offset": 0, + "slot": "9", + "type": "t_bytes32" + }, + { + "astId": 10750, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "controllers", + "offset": 0, + "slot": "10", + "type": "t_mapping(t_address,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(ENS)14086": { + "encoding": "inplace", + "label": "contract ENS", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_address)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/DNSRegistrar.json b/solidity/dns-contracts/deployments/sepolia/DNSRegistrar.json new file mode 100644 index 0000000..06c9dd9 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/DNSRegistrar.json @@ -0,0 +1,447 @@ +{ + "address": "0x5a07C75Ae469Bf3ee2657B588e8E6ABAC6741b4f", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_previousRegistrar", + "type": "address" + }, + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "contract DNSSEC", + "name": "_dnssec", + "type": "address" + }, + { + "internalType": "contract PublicSuffixList", + "name": "_suffixes", + "type": "address" + }, + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "InvalidPublicSuffix", + "type": "error" + }, + { + "inputs": [], + "name": "NoOwnerRecordFound", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "offset", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "OffsetOutOfBoundsError", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "PermissionDenied", + "type": "error" + }, + { + "inputs": [], + "name": "PreconditionNotMet", + "type": "error" + }, + { + "inputs": [], + "name": "StaleProof", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "dnsname", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "inception", + "type": "uint32" + } + ], + "name": "Claim", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "suffixes", + "type": "address" + } + ], + "name": "NewPublicSuffixList", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "domain", + "type": "bytes" + } + ], + "name": "enableNode", + "outputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "inceptions", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract DNSSEC", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "previousRegistrar", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature[]", + "name": "input", + "type": "tuple[]" + } + ], + "name": "proveAndClaim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature[]", + "name": "input", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "proveAndClaimWithResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "resolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract PublicSuffixList", + "name": "_suffixes", + "type": "address" + } + ], + "name": "setPublicSuffixList", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "suffixes", + "outputs": [ + { + "internalType": "contract PublicSuffixList", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x6f2f0fb6f0a529dfdd4ce9e929ace327b1875b53add07e829214c3fe6987d4a4", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x5a07C75Ae469Bf3ee2657B588e8E6ABAC6741b4f", + "transactionIndex": 79, + "gasUsed": "1957892", + "logsBloom": "0x00000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000008000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x9557c38447ac8136505c3cc7e2ae85545eacde6099295b987c002052b5d77ac7", + "transactionHash": "0x6f2f0fb6f0a529dfdd4ce9e929ace327b1875b53add07e829214c3fe6987d4a4", + "logs": [ + { + "transactionIndex": 79, + "blockNumber": 5010952, + "transactionHash": "0x6f2f0fb6f0a529dfdd4ce9e929ace327b1875b53add07e829214c3fe6987d4a4", + "address": "0x5a07C75Ae469Bf3ee2657B588e8E6ABAC6741b4f", + "topics": [ + "0x9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba8" + ], + "data": "0x000000000000000000000000670ca7456be604b5d5361a20b784aecd23ac514b", + "logIndex": 141, + "blockHash": "0x9557c38447ac8136505c3cc7e2ae85545eacde6099295b987c002052b5d77ac7" + } + ], + "blockNumber": 5010952, + "cumulativeGasUsed": "11944042", + "status": 1, + "byzantium": true + }, + "args": [ + "0xf13fC748601fDc5afA255e9D9166EB43f603a903", + "0x179be112b24ad4cfc392ef8924dfa08c20ad8583", + "0xe62E4b6cE018Ad6e916fcC24545e20a33b9d8653", + "0x670CA7456Be604B5d5361a20B784Aecd23ac514b", + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "numDeployments": 11, + "solcInputHash": "70b6083cd7dd7fa7e3ebaac1755dcba3", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_previousRegistrar\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_resolver\",\"type\":\"address\"},{\"internalType\":\"contract DNSSEC\",\"name\":\"_dnssec\",\"type\":\"address\"},{\"internalType\":\"contract PublicSuffixList\",\"name\":\"_suffixes\",\"type\":\"address\"},{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"InvalidPublicSuffix\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoOwnerRecordFound\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"offset\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"OffsetOutOfBoundsError\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"PermissionDenied\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PreconditionNotMet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StaleProof\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"dnsname\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"inception\",\"type\":\"uint32\"}],\"name\":\"Claim\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"suffixes\",\"type\":\"address\"}],\"name\":\"NewPublicSuffixList\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"domain\",\"type\":\"bytes\"}],\"name\":\"enableNode\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"inceptions\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract DNSSEC\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"previousRegistrar\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature[]\",\"name\":\"input\",\"type\":\"tuple[]\"}],\"name\":\"proveAndClaim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature[]\",\"name\":\"input\",\"type\":\"tuple[]\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"proveAndClaimWithResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"resolver\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract PublicSuffixList\",\"name\":\"_suffixes\",\"type\":\"address\"}],\"name\":\"setPublicSuffixList\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"suffixes\",\"outputs\":[{\"internalType\":\"contract PublicSuffixList\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"An ENS registrar that allows the owner of a DNS name to claim the corresponding name in ENS.\",\"kind\":\"dev\",\"methods\":{\"proveAndClaim(bytes,(bytes,bytes)[])\":{\"details\":\"Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\",\"params\":{\"input\":\"A chain of signed DNS RRSETs ending with a text record.\",\"name\":\"The name to claim, in DNS wire format.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnsregistrar/DNSRegistrar.sol\":\"DNSRegistrar\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-2-Clause\\npragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for appending to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n let fpm := add(32, add(ptr, capacity))\\n if lt(fpm, ptr) {\\n revert(0, 0)\\n }\\n mstore(0x40, fpm)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n uint off = buf.buf.length;\\n uint newCapacity = off + len;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(newCapacity, buflen) {\\n mstore(bufptr, newCapacity)\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return append(buf, data, data.length);\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint offPlusOne = off + 1;\\n if (off >= buf.capacity) {\\n resize(buf, offPlusOne * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if gt(offPlusOne, mload(bufptr)) {\\n mstore(bufptr, offPlusOne)\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return append(buf, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return append(buf, data, 32);\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n return buf;\\n }\\n}\\n\",\"keccak256\":\"0xd6dd3b0b327288f8e1b711a609f4040fea602e2ad4bba9febdf2f33b4e56eb0c\",\"license\":\"BSD-2-Clause\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/dnsregistrar/DNSClaimChecker.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"../dnssec-oracle/DNSSEC.sol\\\";\\nimport \\\"../dnssec-oracle/BytesUtils.sol\\\";\\nimport \\\"../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"../utils/HexUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\nlibrary DNSClaimChecker {\\n using BytesUtils for bytes;\\n using HexUtils for bytes;\\n using RRUtils for *;\\n using Buffer for Buffer.buffer;\\n\\n uint16 constant CLASS_INET = 1;\\n uint16 constant TYPE_TXT = 16;\\n\\n function getOwnerAddress(\\n bytes memory name,\\n bytes memory data\\n ) internal pure returns (address, bool) {\\n // Add \\\"_ens.\\\" to the front of the name.\\n Buffer.buffer memory buf;\\n buf.init(name.length + 5);\\n buf.append(\\\"\\\\x04_ens\\\");\\n buf.append(name);\\n\\n for (\\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\\n !iter.done();\\n iter.next()\\n ) {\\n if (iter.name().compareNames(buf.buf) != 0) continue;\\n bool found;\\n address addr;\\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\\n if (found) {\\n return (addr, true);\\n }\\n }\\n\\n return (address(0x0), false);\\n }\\n\\n function parseRR(\\n bytes memory rdata,\\n uint256 idx,\\n uint256 endIdx\\n ) internal pure returns (address, bool) {\\n while (idx < endIdx) {\\n uint256 len = rdata.readUint8(idx);\\n idx += 1;\\n\\n bool found;\\n address addr;\\n (addr, found) = parseString(rdata, idx, len);\\n\\n if (found) return (addr, true);\\n idx += len;\\n }\\n\\n return (address(0x0), false);\\n }\\n\\n function parseString(\\n bytes memory str,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (address, bool) {\\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\\n return str.hexToAddress(idx + 4, idx + len);\\n }\\n}\\n\",\"keccak256\":\"0x8269236f2a421e278e3e9642d2a5c29545993e8a4586a2592067155822d59069\",\"license\":\"MIT\"},\"contracts/dnsregistrar/DNSRegistrar.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\nimport \\\"../dnssec-oracle/BytesUtils.sol\\\";\\nimport \\\"../dnssec-oracle/DNSSEC.sol\\\";\\nimport \\\"../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"../registry/ENSRegistry.sol\\\";\\nimport \\\"../root/Root.sol\\\";\\nimport \\\"../resolvers/profiles/AddrResolver.sol\\\";\\nimport \\\"./DNSClaimChecker.sol\\\";\\nimport \\\"./PublicSuffixList.sol\\\";\\nimport \\\"./IDNSRegistrar.sol\\\";\\n\\n/**\\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\\n * corresponding name in ENS.\\n */\\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\\n using BytesUtils for bytes;\\n using Buffer for Buffer.buffer;\\n using RRUtils for *;\\n\\n ENS public immutable ens;\\n DNSSEC public immutable oracle;\\n PublicSuffixList public suffixes;\\n address public immutable previousRegistrar;\\n address public immutable resolver;\\n // A mapping of the most recent signatures seen for each claimed domain.\\n mapping(bytes32 => uint32) public inceptions;\\n\\n error NoOwnerRecordFound();\\n error PermissionDenied(address caller, address owner);\\n error PreconditionNotMet();\\n error StaleProof();\\n error InvalidPublicSuffix(bytes name);\\n\\n struct OwnerRecord {\\n bytes name;\\n address owner;\\n address resolver;\\n uint64 ttl;\\n }\\n\\n event Claim(\\n bytes32 indexed node,\\n address indexed owner,\\n bytes dnsname,\\n uint32 inception\\n );\\n event NewPublicSuffixList(address suffixes);\\n\\n constructor(\\n address _previousRegistrar,\\n address _resolver,\\n DNSSEC _dnssec,\\n PublicSuffixList _suffixes,\\n ENS _ens\\n ) {\\n previousRegistrar = _previousRegistrar;\\n resolver = _resolver;\\n oracle = _dnssec;\\n suffixes = _suffixes;\\n emit NewPublicSuffixList(address(suffixes));\\n ens = _ens;\\n }\\n\\n /**\\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\\n */\\n modifier onlyOwner() {\\n Root root = Root(ens.owner(bytes32(0)));\\n address owner = root.owner();\\n require(msg.sender == owner);\\n _;\\n }\\n\\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\\n suffixes = _suffixes;\\n emit NewPublicSuffixList(address(suffixes));\\n }\\n\\n /**\\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\\n * @param name The name to claim, in DNS wire format.\\n * @param input A chain of signed DNS RRSETs ending with a text record.\\n */\\n function proveAndClaim(\\n bytes memory name,\\n DNSSEC.RRSetWithSignature[] memory input\\n ) public override {\\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\\n name,\\n input\\n );\\n ens.setSubnodeOwner(rootNode, labelHash, addr);\\n }\\n\\n function proveAndClaimWithResolver(\\n bytes memory name,\\n DNSSEC.RRSetWithSignature[] memory input,\\n address resolver,\\n address addr\\n ) public override {\\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\\n name,\\n input\\n );\\n if (msg.sender != owner) {\\n revert PermissionDenied(msg.sender, owner);\\n }\\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\\n if (addr != address(0)) {\\n if (resolver == address(0)) {\\n revert PreconditionNotMet();\\n }\\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\\n // Set the resolver record\\n AddrResolver(resolver).setAddr(node, addr);\\n }\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure override returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IDNSRegistrar).interfaceId;\\n }\\n\\n function _claim(\\n bytes memory name,\\n DNSSEC.RRSetWithSignature[] memory input\\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\\n\\n // Get the first label\\n uint256 labelLen = name.readUint8(0);\\n labelHash = name.keccak(1, labelLen);\\n\\n bytes memory parentName = name.substring(\\n labelLen + 1,\\n name.length - labelLen - 1\\n );\\n\\n // Make sure the parent name is enabled\\n parentNode = enableNode(parentName);\\n\\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\\n revert StaleProof();\\n }\\n inceptions[node] = inception;\\n\\n bool found;\\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\\n if (!found) {\\n revert NoOwnerRecordFound();\\n }\\n\\n emit Claim(node, addr, name, inception);\\n }\\n\\n function enableNode(bytes memory domain) public returns (bytes32 node) {\\n // Name must be in the public suffix list.\\n if (!suffixes.isPublicSuffix(domain)) {\\n revert InvalidPublicSuffix(domain);\\n }\\n return _enableNode(domain, 0);\\n }\\n\\n function _enableNode(\\n bytes memory domain,\\n uint256 offset\\n ) internal returns (bytes32 node) {\\n uint256 len = domain.readUint8(offset);\\n if (len == 0) {\\n return bytes32(0);\\n }\\n\\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\\n bytes32 label = domain.keccak(offset + 1, len);\\n node = keccak256(abi.encodePacked(parentNode, label));\\n address owner = ens.owner(node);\\n if (owner == address(0) || owner == previousRegistrar) {\\n if (parentNode == bytes32(0)) {\\n Root root = Root(ens.owner(bytes32(0)));\\n root.setSubnodeOwner(label, address(this));\\n ens.setResolver(node, resolver);\\n } else {\\n ens.setSubnodeRecord(\\n parentNode,\\n label,\\n address(this),\\n resolver,\\n 0\\n );\\n }\\n } else if (owner != address(this)) {\\n revert PreconditionNotMet();\\n }\\n return node;\\n }\\n}\\n\",\"keccak256\":\"0x9140c28eee7f8dff1cc0a2380e9b57db3203c8c0d187245ab3595f4e4cbdebce\",\"license\":\"MIT\"},\"contracts/dnsregistrar/IDNSRegistrar.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"../dnssec-oracle/DNSSEC.sol\\\";\\n\\ninterface IDNSRegistrar {\\n function proveAndClaim(\\n bytes memory name,\\n DNSSEC.RRSetWithSignature[] memory input\\n ) external;\\n\\n function proveAndClaimWithResolver(\\n bytes memory name,\\n DNSSEC.RRSetWithSignature[] memory input,\\n address resolver,\\n address addr\\n ) external;\\n}\\n\",\"keccak256\":\"0xcf6607fe4918cabb1c4c2130597dd9cc0f63492564b05de60496eb46873a73b7\",\"license\":\"MIT\"},\"contracts/dnsregistrar/PublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\ninterface PublicSuffixList {\\n function isPublicSuffix(bytes calldata name) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x12158ba8838ee2b1ebb0178a52d2f4d54dcc68282d569226e62afc2b0dccbbac\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/DNSSEC.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nabstract contract DNSSEC {\\n bytes public anchors;\\n\\n struct RRSetWithSignature {\\n bytes rrset;\\n bytes sig;\\n }\\n\\n event AlgorithmUpdated(uint8 id, address addr);\\n event DigestUpdated(uint8 id, address addr);\\n\\n function verifyRRSet(\\n RRSetWithSignature[] memory input\\n ) external view virtual returns (bytes memory rrs, uint32 inception);\\n\\n function verifyRRSet(\\n RRSetWithSignature[] memory input,\\n uint256 now\\n ) public view virtual returns (bytes memory rrs, uint32 inception);\\n}\\n\",\"keccak256\":\"0xee6a236a59e5db8418c98ee4640a91987d26533c02d305cc6c7a37a3ac4ee907\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n */\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint256 labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes memory ret) {\\n uint256 len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint256 labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint256 constant RRSIG_TYPE = 0;\\n uint256 constant RRSIG_ALGORITHM = 2;\\n uint256 constant RRSIG_LABELS = 3;\\n uint256 constant RRSIG_TTL = 4;\\n uint256 constant RRSIG_EXPIRATION = 8;\\n uint256 constant RRSIG_INCEPTION = 12;\\n uint256 constant RRSIG_KEY_TAG = 16;\\n uint256 constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(\\n bytes memory data\\n ) internal pure returns (SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(\\n RRSIG_SIGNER_NAME + self.signerName.length,\\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\\n );\\n }\\n\\n function rrs(\\n SignedSet memory rrset\\n ) internal pure returns (RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint256 offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint256 rdataOffset;\\n uint256 nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns (bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint256 rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.offset,\\n nameLength(iter.data, iter.offset)\\n );\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(\\n RRIterator memory iter\\n ) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.rdataOffset,\\n iter.nextOffset - iter.rdataOffset\\n );\\n }\\n\\n uint256 constant DNSKEY_FLAGS = 0;\\n uint256 constant DNSKEY_PROTOCOL = 2;\\n uint256 constant DNSKEY_ALGORITHM = 3;\\n uint256 constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(\\n offset + DNSKEY_PUBKEY,\\n length - DNSKEY_PUBKEY\\n );\\n }\\n\\n uint256 constant DS_KEY_TAG = 0;\\n uint256 constant DS_ALGORITHM = 2;\\n uint256 constant DS_DIGEST_TYPE = 3;\\n uint256 constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n function isSubdomainOf(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n uint256 off = 0;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n while (counts > othercounts) {\\n off = progress(self, off);\\n counts--;\\n }\\n\\n return self.equals(off, other, 0);\\n }\\n\\n function compareNames(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint256 off;\\n uint256 otheroff;\\n uint256 prevoff;\\n uint256 otherprevoff;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if (otheroff == 0) {\\n return 1;\\n }\\n\\n return\\n self.compare(\\n prevoff + 1,\\n self.readUint8(prevoff),\\n other,\\n otherprevoff + 1,\\n other.readUint8(otherprevoff)\\n );\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(\\n uint32 i1,\\n uint32 i2\\n ) internal pure returns (bool) {\\n unchecked {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n }\\n\\n function progress(\\n bytes memory body,\\n uint256 off\\n ) internal pure returns (uint256) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint256 ac1;\\n uint256 ac2;\\n for (uint256 i = 0; i < data.length + 31; i += 32) {\\n uint256 word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if (i + 32 > data.length) {\\n uint256 unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 +=\\n (word &\\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\\n 8;\\n ac2 += (word &\\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 =\\n (ac1 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac1 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac2 =\\n (ac2 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac2 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 =\\n (ac1 &\\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\\n 32);\\n ac1 =\\n (ac1 &\\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\\n 64);\\n ac1 =\\n (ac1 &\\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\\n (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4dd68a6efd7c38f6b0e95ca0c056ecb74f88583da650b1a8639e6e78be36fede\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/registry/ENSRegistry.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"./ENS.sol\\\";\\n\\n/**\\n * The ENS registry contract.\\n */\\ncontract ENSRegistry is ENS {\\n struct Record {\\n address owner;\\n address resolver;\\n uint64 ttl;\\n }\\n\\n mapping(bytes32 => Record) records;\\n mapping(address => mapping(address => bool)) operators;\\n\\n // Permits modifications only by the owner of the specified node.\\n modifier authorised(bytes32 node) {\\n address owner = records[node].owner;\\n require(owner == msg.sender || operators[owner][msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Constructs a new ENS registry.\\n */\\n constructor() public {\\n records[0x0].owner = msg.sender;\\n }\\n\\n /**\\n * @dev Sets the record for a node.\\n * @param node The node to update.\\n * @param owner The address of the new owner.\\n * @param resolver The address of the resolver.\\n * @param ttl The TTL in seconds.\\n */\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external virtual override {\\n setOwner(node, owner);\\n _setResolverAndTTL(node, resolver, ttl);\\n }\\n\\n /**\\n * @dev Sets the record for a subnode.\\n * @param node The parent node.\\n * @param label The hash of the label specifying the subnode.\\n * @param owner The address of the new owner.\\n * @param resolver The address of the resolver.\\n * @param ttl The TTL in seconds.\\n */\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external virtual override {\\n bytes32 subnode = setSubnodeOwner(node, label, owner);\\n _setResolverAndTTL(subnode, resolver, ttl);\\n }\\n\\n /**\\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\\n * @param node The node to transfer ownership of.\\n * @param owner The address of the new owner.\\n */\\n function setOwner(\\n bytes32 node,\\n address owner\\n ) public virtual override authorised(node) {\\n _setOwner(node, owner);\\n emit Transfer(node, owner);\\n }\\n\\n /**\\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\\n * @param node The parent node.\\n * @param label The hash of the label specifying the subnode.\\n * @param owner The address of the new owner.\\n */\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) public virtual override authorised(node) returns (bytes32) {\\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\\n _setOwner(subnode, owner);\\n emit NewOwner(node, label, owner);\\n return subnode;\\n }\\n\\n /**\\n * @dev Sets the resolver address for the specified node.\\n * @param node The node to update.\\n * @param resolver The address of the resolver.\\n */\\n function setResolver(\\n bytes32 node,\\n address resolver\\n ) public virtual override authorised(node) {\\n emit NewResolver(node, resolver);\\n records[node].resolver = resolver;\\n }\\n\\n /**\\n * @dev Sets the TTL for the specified node.\\n * @param node The node to update.\\n * @param ttl The TTL in seconds.\\n */\\n function setTTL(\\n bytes32 node,\\n uint64 ttl\\n ) public virtual override authorised(node) {\\n emit NewTTL(node, ttl);\\n records[node].ttl = ttl;\\n }\\n\\n /**\\n * @dev Enable or disable approval for a third party (\\\"operator\\\") to manage\\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\\n * @param operator Address to add to the set of authorized operators.\\n * @param approved True if the operator is approved, false to revoke approval.\\n */\\n function setApprovalForAll(\\n address operator,\\n bool approved\\n ) external virtual override {\\n operators[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev Returns the address that owns the specified node.\\n * @param node The specified node.\\n * @return address of the owner.\\n */\\n function owner(\\n bytes32 node\\n ) public view virtual override returns (address) {\\n address addr = records[node].owner;\\n if (addr == address(this)) {\\n return address(0x0);\\n }\\n\\n return addr;\\n }\\n\\n /**\\n * @dev Returns the address of the resolver for the specified node.\\n * @param node The specified node.\\n * @return address of the resolver.\\n */\\n function resolver(\\n bytes32 node\\n ) public view virtual override returns (address) {\\n return records[node].resolver;\\n }\\n\\n /**\\n * @dev Returns the TTL of a node, and any records associated with it.\\n * @param node The specified node.\\n * @return ttl of the node.\\n */\\n function ttl(bytes32 node) public view virtual override returns (uint64) {\\n return records[node].ttl;\\n }\\n\\n /**\\n * @dev Returns whether a record has been imported to the registry.\\n * @param node The specified node.\\n * @return Bool if record exists\\n */\\n function recordExists(\\n bytes32 node\\n ) public view virtual override returns (bool) {\\n return records[node].owner != address(0x0);\\n }\\n\\n /**\\n * @dev Query if an address is an authorized operator for another address.\\n * @param owner The address that owns the records.\\n * @param operator The address that acts on behalf of the owner.\\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\\n */\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view virtual override returns (bool) {\\n return operators[owner][operator];\\n }\\n\\n function _setOwner(bytes32 node, address owner) internal virtual {\\n records[node].owner = owner;\\n }\\n\\n function _setResolverAndTTL(\\n bytes32 node,\\n address resolver,\\n uint64 ttl\\n ) internal {\\n if (resolver != records[node].resolver) {\\n records[node].resolver = resolver;\\n emit NewResolver(node, resolver);\\n }\\n\\n if (ttl != records[node].ttl) {\\n records[node].ttl = ttl;\\n emit NewTTL(node, ttl);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa7a7a64fb980e521c991415e416fd4106a42f892479805e1daa51ecb0e2e5198\"},\"contracts/resolvers/ResolverBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"./profiles/IVersionableResolver.sol\\\";\\n\\nabstract contract ResolverBase is ERC165, IVersionableResolver {\\n mapping(bytes32 => uint64) public recordVersions;\\n\\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\\n\\n modifier authorised(bytes32 node) {\\n require(isAuthorised(node));\\n _;\\n }\\n\\n /**\\n * Increments the record version associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function clearRecords(bytes32 node) public virtual authorised(node) {\\n recordVersions[node]++;\\n emit VersionChanged(node, recordVersions[node]);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IVersionableResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x893049fffd6feee06d7acef1680f6e26505bedff62a9f7a17e921c0ba2f66307\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/AddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IAddrResolver.sol\\\";\\nimport \\\"./IAddressResolver.sol\\\";\\n\\nabstract contract AddrResolver is\\n IAddrResolver,\\n IAddressResolver,\\n ResolverBase\\n{\\n uint256 private constant COIN_TYPE_ETH = 60;\\n\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\\n\\n /**\\n * Sets the address associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param a The address to set.\\n */\\n function setAddr(\\n bytes32 node,\\n address a\\n ) external virtual authorised(node) {\\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\\n }\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(\\n bytes32 node\\n ) public view virtual override returns (address payable) {\\n bytes memory a = addr(node, COIN_TYPE_ETH);\\n if (a.length == 0) {\\n return payable(0);\\n }\\n return bytesToAddress(a);\\n }\\n\\n function setAddr(\\n bytes32 node,\\n uint256 coinType,\\n bytes memory a\\n ) public virtual authorised(node) {\\n emit AddressChanged(node, coinType, a);\\n if (coinType == COIN_TYPE_ETH) {\\n emit AddrChanged(node, bytesToAddress(a));\\n }\\n versionable_addresses[recordVersions[node]][node][coinType] = a;\\n }\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) public view virtual override returns (bytes memory) {\\n return versionable_addresses[recordVersions[node]][node][coinType];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IAddrResolver).interfaceId ||\\n interfaceID == type(IAddressResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function bytesToAddress(\\n bytes memory b\\n ) internal pure returns (address payable a) {\\n require(b.length == 20);\\n assembly {\\n a := div(mload(add(b, 32)), exp(256, 12))\\n }\\n }\\n\\n function addressToBytes(address a) internal pure returns (bytes memory b) {\\n b = new bytes(20);\\n assembly {\\n mstore(add(b, 32), mul(a, exp(256, 12)))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7f6ebb3144530a02db03379f33ade869c8408eceed36dfbd751aaff198735b55\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IVersionableResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IVersionableResolver {\\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\\n\\n function recordVersions(bytes32 node) external view returns (uint64);\\n}\\n\",\"keccak256\":\"0xd0d09596f20c57bafb2ffa8521a8c57120e9af6c6b194f9c689d4da56f91a57c\",\"license\":\"MIT\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"},\"contracts/root/Root.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"./Controllable.sol\\\";\\n\\ncontract Root is Ownable, Controllable {\\n bytes32 private constant ROOT_NODE = bytes32(0);\\n\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n\\n event TLDLocked(bytes32 indexed label);\\n\\n ENS public ens;\\n mapping(bytes32 => bool) public locked;\\n\\n constructor(ENS _ens) public {\\n ens = _ens;\\n }\\n\\n function setSubnodeOwner(\\n bytes32 label,\\n address owner\\n ) external onlyController {\\n require(!locked[label]);\\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\\n }\\n\\n function setResolver(address resolver) external onlyOwner {\\n ens.setResolver(ROOT_NODE, resolver);\\n }\\n\\n function lock(bytes32 label) external onlyOwner {\\n emit TLDLocked(label);\\n locked[label] = true;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return interfaceID == INTERFACE_META_ID;\\n }\\n}\\n\",\"keccak256\":\"0x469b281e1a9e1c3dad9c860a4ab3a7299a48355b0b0243713e0829193c39f50c\"},\"contracts/utils/HexUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary HexUtils {\\n /**\\n * @dev Attempts to parse bytes32 from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexStringToBytes32(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (bytes32 r, bool valid) {\\n uint256 hexLength = lastIdx - idx;\\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\\n revert(\\\"Invalid string length\\\");\\n }\\n valid = true;\\n assembly {\\n // check that the index to read to is not past the end of the string\\n if gt(lastIdx, mload(str)) {\\n revert(0, 0)\\n }\\n\\n function getHex(c) -> ascii {\\n // chars 48-57: 0-9\\n if and(gt(c, 47), lt(c, 58)) {\\n ascii := sub(c, 48)\\n leave\\n }\\n // chars 65-70: A-F\\n if and(gt(c, 64), lt(c, 71)) {\\n ascii := add(sub(c, 65), 10)\\n leave\\n }\\n // chars 97-102: a-f\\n if and(gt(c, 96), lt(c, 103)) {\\n ascii := add(sub(c, 97), 10)\\n leave\\n }\\n // invalid char\\n ascii := 0xff\\n }\\n\\n let ptr := add(str, 32)\\n for {\\n let i := idx\\n } lt(i, lastIdx) {\\n i := add(i, 2)\\n } {\\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\\n // if either byte is invalid, set invalid and break loop\\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\\n valid := false\\n break\\n }\\n let combined := or(shl(4, byte1), byte2)\\n r := or(shl(8, r), combined)\\n }\\n }\\n }\\n\\n /**\\n * @dev Attempts to parse an address from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexToAddress(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (address, bool) {\\n if (lastIdx - idx < 40) return (address(0x0), false);\\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\\n return (address(uint160(uint256(r))), valid);\\n }\\n}\\n\",\"keccak256\":\"0x4a8a9c72d6f3effb80b310faa6dc273e7adbc3b949df9c7a42e290e5b13519f3\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101006040523480156200001257600080fd5b50604051620023e1380380620023e18339810160408190526200003591620000c8565b6001600160a01b0385811660c05284811660e05283811660a052600080546001600160a01b03191691841691821790556040519081527f9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba89060200160405180910390a16001600160a01b0316608052506200014892505050565b6001600160a01b0381168114620000c557600080fd5b50565b600080600080600060a08688031215620000e157600080fd5b8551620000ee81620000af565b60208701519095506200010181620000af565b60408701519094506200011481620000af565b60608701519093506200012781620000af565b60808701519092506200013a81620000af565b809150509295509295909350565b60805160a05160c05160e051612213620001ce6000396000818160fb01528181610cde0152610d950152600081816102320152610b6301526000818161020b01526108020152600081816101c301528181610397015281816104f8015281816106b301528181610ae301528181610bba01528181610d060152610dc401526122136000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c806329d56630116100815780636f9512211161005b5780636f951221146101e55780637dc0d1d014610206578063ab14ec591461022d57600080fd5b806329d566301461019857806330349ebe146101ab5780633f15457f146101be57600080fd5b806306963218116100b257806306963218146101355780631ecfc4111461014a57806325916d411461015d57600080fd5b806301ffc9a7146100ce57806304f3bcec146100f6575b600080fd5b6100e16100dc366004611a75565b610254565b60405190151581526020015b60405180910390f35b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100ed565b610148610143366004611cb7565b6102ed565b005b610148610158366004611d40565b6104df565b61018361016b366004611d5d565b60016020526000908152604090205463ffffffff1681565b60405163ffffffff90911681526020016100ed565b6101486101a6366004611d76565b610656565b60005461011d906001600160a01b031681565b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b6101f86101f3366004611dda565b61072a565b6040519081526020016100ed565b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a70000000000000000000000000000000000000000000000000000000014806102e757507fffffffff0000000000000000000000000000000000000000000000000000000082167f2f43542800000000000000000000000000000000000000000000000000000000145b92915050565b60008060006102fc87876107f8565b91945092509050336001600160a01b0382161461035b576040517fe03f60240000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03821660248201526044015b60405180910390fd5b6040516305ef2c7f60e41b815260048101849052602481018390526001600160a01b0382811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156103db57600080fd5b505af11580156103ef573d6000803e3d6000fd5b505050506001600160a01b038416156104d6576001600160a01b03851661042957604051633c584f1360e21b815260040160405180910390fd5b604080516020810185905290810183905260009060600160408051808303601f190181529082905280516020909101207fd5fa2b00000000000000000000000000000000000000000000000000000000008252600482018190526001600160a01b03878116602484015290925087169063d5fa2b0090604401600060405180830381600087803b1580156104bc57600080fd5b505af11580156104d0573d6000803e3d6000fd5b50505050505b50505050505050565b6040516302571be360e01b8152600060048201819052907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610547573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056b9190611e0f565b90506000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d19190611e0f565b9050336001600160a01b038216146105e857600080fd5b600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0385169081179091556040519081527f9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba89060200160405180910390a1505050565b600080600061066585856107f8565b6040517f06ab592300000000000000000000000000000000000000000000000000000000815260048101849052602481018390526001600160a01b03828116604483015293965091945092507f0000000000000000000000000000000000000000000000000000000000000000909116906306ab5923906064016020604051808303816000875af11580156106fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107229190611e2c565b505050505050565b600080546040517f4f89059e0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690634f89059e90610774908590600401611e95565b602060405180830381865afa158015610791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b59190611ea8565b6107ed57816040517f396e24b80000000000000000000000000000000000000000000000000000000081526004016103529190611e95565b6102e7826000610a35565b60008060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bdf95fef876040518263ffffffff1660e01b815260040161084c9190611eca565b600060405180830381865afa158015610869573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108919190810190611f4f565b909250905060006108a28882610e58565b60ff1690506108b388600183610e7c565b945060006108e66108c5836001611ffc565b6001848c516108d4919061200f565b6108de919061200f565b8b9190610ea0565b90506108f18161072a565b965060008787604051602001610911929190918252602082015260400190565b60408051808303601f190181529181528151602092830120600081815260019093529082205490925063ffffffff16850360030b121561097d576040517f2dd6a7af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600160205260408120805463ffffffff191663ffffffff87161790556109a88b87610f22565b9097509050806109e4576040517f6260f6f800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b866001600160a01b0316827f87db02a0e483e2818060eddcbb3488ce44e35aff49a70d92c2aa6c8046cf01e28d88604051610a20929190612022565b60405180910390a35050505050509250925092565b600080610a428484610e58565b60ff16905080600003610a595750600090506102e7565b6000610a7985610a698487611ffc565b610a74906001611ffc565b610a35565b90506000610a93610a8b866001611ffc565b879085610e7c565b604080516020810185905290810182905290915060600160408051601f198184030181529082905280516020909101206302571be360e01b82526004820181905294506000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015610b2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4e9190611e0f565b90506001600160a01b0381161580610b9757507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b0316145b15610e255782610d6a576040516302571be360e01b8152600060048201819052907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d9190611e0f565b6040517f8cb8ecec000000000000000000000000000000000000000000000000000000008152600481018590523060248201529091506001600160a01b03821690638cb8ecec90604401600060405180830381600087803b158015610c9157600080fd5b505af1158015610ca5573d6000803e3d6000fd5b50506040517f1896f70a000000000000000000000000000000000000000000000000000000008152600481018990526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660248301527f0000000000000000000000000000000000000000000000000000000000000000169250631896f70a9150604401600060405180830381600087803b158015610d4c57600080fd5b505af1158015610d60573d6000803e3d6000fd5b5050505050610e4e565b6040516305ef2c7f60e41b815260048101849052602481018390523060448201526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b158015610e0857600080fd5b505af1158015610e1c573d6000803e3d6000fd5b50505050610e4e565b6001600160a01b0381163014610e4e57604051633c584f1360e21b815260040160405180910390fd5b5050505092915050565b6000828281518110610e6c57610e6c61204a565b016020015160f81c905092915050565b8251600090610e8b8385611ffc565b1115610e9657600080fd5b5091016020012090565b8251606090610eaf8385611ffc565b1115610eba57600080fd5b60008267ffffffffffffffff811115610ed557610ed5611ab7565b6040519080825280601f01601f191660200182016040528015610eff576020820181803683370190505b50905060208082019086860101610f17828287611030565b509095945050505050565b600080610f42604051806040016040528060608152602001600081525090565b610f5a85516005610f539190611ffc565b8290611086565b5060408051808201909152600581527f045f656e730000000000000000000000000000000000000000000000000000006020820152610f9a9082906110fd565b50610fa581866110fd565b506000610fb28582611125565b90505b8051516020820151101561101f578151610fd890610fd283611186565b906111a7565b60000361101157600080610ff5878460a001518560c00151611300565b92509050811561100e5794506001935061102992505050565b50505b61101a81611373565b610fb5565b5060008092509250505b9250929050565b602081106110685781518352611047602084611ffc565b9250611054602083611ffc565b915061106160208261200f565b9050611030565b905182516020929092036101000a6000190180199091169116179052565b6040805180820190915260608152600060208201526110a6602083612060565b156110ce576110b6602083612060565b6110c190602061200f565b6110cb9083611ffc565b91505b6020808401839052604051808552600081529081840101818110156110f257600080fd5b604052509192915050565b60408051808201909152606081526000602082015261111e8383845161145b565b9392505050565b6111736040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c081018290526102e781611373565b602081015181516060916102e79161119e9082611531565b84519190610ea0565b60006111b38383611593565b156111c0575060006102e7565b60008060008060006111d38860006115b1565b905060006111e28860006115b1565b90505b8082111561120e578593506111fa898761160e565b95508161120681612082565b9250506111e5565b8181111561123757849250611223888661160e565b94508061122f81612082565b91505061120e565b600082118015611250575061124e89878a88611632565b155b1561128557859350611262898761160e565b9550849250611271888661160e565b945061127e60018361200f565b9150611237565b8560000361129d5760001996505050505050506102e7565b846000036112b457600196505050505050506102e7565b6112f36112c2856001611ffc565b6112cc8b87610e58565b60ff168a6112db876001611ffc565b6112e58d89610e58565b8e949392919060ff16611667565b9998505050505050505050565b6000805b828410156113645760006113188686610e58565b60ff169050611328600186611ffc565b94506000806113388888856117e5565b9250905081156113505793506001925061136b915050565b61135a8388611ffc565b9650505050611304565b5060009050805b935093915050565b60c0810151602082018190528151511161138a5750565b600061139e82600001518360200151611531565b82602001516113ad9190611ffc565b82519091506113bc9082611839565b61ffff1660408301526113d0600282611ffc565b82519091506113df9082611839565b61ffff1660608301526113f3600282611ffc565b82519091506114029082611861565b63ffffffff166080830152611418600482611ffc565b825190915060009061142a9083611839565b61ffff16905061143b600283611ffc565b60a08401819052915061144e8183611ffc565b60c0909301929092525050565b604080518082019091526060815260006020820152825182111561147e57600080fd5b835151600061148d8483611ffc565b905085602001518111156114af576114af866114aa836002612099565b61188b565b8551805183820160200191600091808511156114c9578482525b505050602086015b6020861061150957805182526114e8602083611ffc565b91506114f5602082611ffc565b905061150260208761200f565b95506114d1565b51815160001960208890036101000a0190811690199190911617905250849150509392505050565b6000815b83518110611545576115456120b0565b60006115518583610e58565b60ff169050611561816001611ffc565b61156b9083611ffc565b91508060000361157b5750611581565b50611535565b61158b838261200f565b949350505050565b60008151835114801561111e575061111e83600084600087516118a8565b6000805b835183106115c5576115c56120b0565b60006115d18585610e58565b60ff1690506115e1816001611ffc565b6115eb9085611ffc565b9350806000036115fb575061111e565b611606600183611ffc565b9150506115b5565b600061161a8383610e58565b60ff16611628836001611ffc565b61111e9190611ffc565b600061164b8383848651611646919061200f565b610e7c565b61165d8686878951611646919061200f565b1495945050505050565b85516000906116768688611ffc565b11156116aa576116868587611ffc565b8751604051638a3c1cfb60e01b815260048101929092526024820152604401610352565b83516116b68385611ffc565b11156116ea576116c68284611ffc565b8451604051638a3c1cfb60e01b815260048101929092526024820152604401610352565b84808310156116f65750815b60208789018101908587010160005b838110156117ca578251825180821461179a5760006020611726858961200f565b106117345750600019611770565b600187611742866020611ffc565b61174c919061200f565b611757906008612099565b6117629060026121aa565b61176c919061200f565b1990505b60006117808383168584166121b6565b905080156117975797506117db9650505050505050565b50505b6117a5602086611ffc565b94506117b2602085611ffc565b935050506020816117c39190611ffc565b9050611705565b506117d585896121b6565b93505050505b9695505050505050565b6000806117f28585611861565b63ffffffff1663613d30781461180d5750600090508061136b565b61182d61181b856004611ffc565b6118258587611ffc565b8791906118cb565b91509150935093915050565b8151600090611849836002611ffc565b111561185457600080fd5b50016002015161ffff1690565b8151600090611871836004611ffc565b111561187c57600080fd5b50016004015163ffffffff1690565b81516118978383611086565b506118a283826110fd565b50505050565b60006118b5848484610e7c565b6118c0878785610e7c565b149695505050505050565b60008060286118da858561200f565b10156118eb5750600090508061136b565b6000806118f9878787611907565b909890975095505050505050565b60008080611915858561200f565b905080604014158015611929575080602814155b8061193e575061193a600282612060565b6001145b156119a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610352565b6001915085518411156119b757600080fd5b611a08565b6000603a8210602f831116156119d45750602f190190565b604782106040831116156119ea57506036190190565b60678210606083111615611a0057506056190190565b5060ff919050565b60208601855b85811015611a6a57611a258183015160001a6119bc565b611a376001830184015160001a6119bc565b60ff811460ff83141715611a5057600095505050611a6a565b60049190911b1760089590951b9490941793600201611a0e565b505050935093915050565b600060208284031215611a8757600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461111e57600080fd5b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715611af057611af0611ab7565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611b1f57611b1f611ab7565b604052919050565b600067ffffffffffffffff821115611b4157611b41611ab7565b50601f01601f191660200190565b600082601f830112611b6057600080fd5b8135611b73611b6e82611b27565b611af6565b818152846020838601011115611b8857600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112611bb657600080fd5b8135602067ffffffffffffffff80831115611bd357611bd3611ab7565b8260051b611be2838201611af6565b9384528581018301938381019088861115611bfc57600080fd5b84880192505b85831015611c9357823584811115611c1a5760008081fd5b88016040818b03601f1901811315611c325760008081fd5b611c3a611acd565b8783013587811115611c4c5760008081fd5b611c5a8d8a83870101611b4f565b825250908201359086821115611c705760008081fd5b611c7e8c8984860101611b4f565b81890152845250509184019190840190611c02565b98975050505050505050565b6001600160a01b0381168114611cb457600080fd5b50565b60008060008060808587031215611ccd57600080fd5b843567ffffffffffffffff80821115611ce557600080fd5b611cf188838901611b4f565b95506020870135915080821115611d0757600080fd5b50611d1487828801611ba5565b9350506040850135611d2581611c9f565b91506060850135611d3581611c9f565b939692955090935050565b600060208284031215611d5257600080fd5b813561111e81611c9f565b600060208284031215611d6f57600080fd5b5035919050565b60008060408385031215611d8957600080fd5b823567ffffffffffffffff80821115611da157600080fd5b611dad86838701611b4f565b93506020850135915080821115611dc357600080fd5b50611dd085828601611ba5565b9150509250929050565b600060208284031215611dec57600080fd5b813567ffffffffffffffff811115611e0357600080fd5b61158b84828501611b4f565b600060208284031215611e2157600080fd5b815161111e81611c9f565b600060208284031215611e3e57600080fd5b5051919050565b60005b83811015611e60578181015183820152602001611e48565b50506000910152565b60008151808452611e81816020860160208601611e45565b601f01601f19169290920160200192915050565b60208152600061111e6020830184611e69565b600060208284031215611eba57600080fd5b8151801515811461111e57600080fd5b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015611f4157888303603f1901855281518051878552611f1588860182611e69565b91890151858303868b0152919050611f2d8183611e69565b968901969450505090860190600101611ef1565b509098975050505050505050565b60008060408385031215611f6257600080fd5b825167ffffffffffffffff811115611f7957600080fd5b8301601f81018513611f8a57600080fd5b8051611f98611b6e82611b27565b818152866020838501011115611fad57600080fd5b611fbe826020830160208601611e45565b809450505050602083015163ffffffff81168114611fdb57600080fd5b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b808201808211156102e7576102e7611fe6565b818103818111156102e7576102e7611fe6565b6040815260006120356040830185611e69565b905063ffffffff831660208301529392505050565b634e487b7160e01b600052603260045260246000fd5b60008261207d57634e487b7160e01b600052601260045260246000fd5b500690565b60008161209157612091611fe6565b506000190190565b80820281158282048414176102e7576102e7611fe6565b634e487b7160e01b600052600160045260246000fd5b600181815b808511156121015781600019048211156120e7576120e7611fe6565b808516156120f457918102915b93841c93908002906120cb565b509250929050565b600082612118575060016102e7565b81612125575060006102e7565b816001811461213b576002811461214557612161565b60019150506102e7565b60ff84111561215657612156611fe6565b50506001821b6102e7565b5060208310610133831016604e8410600b8410161715612184575081810a6102e7565b61218e83836120c6565b80600019048211156121a2576121a2611fe6565b029392505050565b600061111e8383612109565b81810360008312801583831316838312821617156121d6576121d6611fe6565b509291505056fea26469706673582212204fd3172855fc29f1ee29f5099e32e8c1f163dcac07aa16324d9f13cbd4f6ee7164736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100c95760003560e01c806329d56630116100815780636f9512211161005b5780636f951221146101e55780637dc0d1d014610206578063ab14ec591461022d57600080fd5b806329d566301461019857806330349ebe146101ab5780633f15457f146101be57600080fd5b806306963218116100b257806306963218146101355780631ecfc4111461014a57806325916d411461015d57600080fd5b806301ffc9a7146100ce57806304f3bcec146100f6575b600080fd5b6100e16100dc366004611a75565b610254565b60405190151581526020015b60405180910390f35b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100ed565b610148610143366004611cb7565b6102ed565b005b610148610158366004611d40565b6104df565b61018361016b366004611d5d565b60016020526000908152604090205463ffffffff1681565b60405163ffffffff90911681526020016100ed565b6101486101a6366004611d76565b610656565b60005461011d906001600160a01b031681565b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b6101f86101f3366004611dda565b61072a565b6040519081526020016100ed565b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b61011d7f000000000000000000000000000000000000000000000000000000000000000081565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a70000000000000000000000000000000000000000000000000000000014806102e757507fffffffff0000000000000000000000000000000000000000000000000000000082167f2f43542800000000000000000000000000000000000000000000000000000000145b92915050565b60008060006102fc87876107f8565b91945092509050336001600160a01b0382161461035b576040517fe03f60240000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03821660248201526044015b60405180910390fd5b6040516305ef2c7f60e41b815260048101849052602481018390526001600160a01b0382811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156103db57600080fd5b505af11580156103ef573d6000803e3d6000fd5b505050506001600160a01b038416156104d6576001600160a01b03851661042957604051633c584f1360e21b815260040160405180910390fd5b604080516020810185905290810183905260009060600160408051808303601f190181529082905280516020909101207fd5fa2b00000000000000000000000000000000000000000000000000000000008252600482018190526001600160a01b03878116602484015290925087169063d5fa2b0090604401600060405180830381600087803b1580156104bc57600080fd5b505af11580156104d0573d6000803e3d6000fd5b50505050505b50505050505050565b6040516302571be360e01b8152600060048201819052907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610547573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056b9190611e0f565b90506000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d19190611e0f565b9050336001600160a01b038216146105e857600080fd5b600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0385169081179091556040519081527f9176b7f47e4504df5e5516c99d90d82ac7cbd49cc77e7f22ba2ac2f2e3a3eba89060200160405180910390a1505050565b600080600061066585856107f8565b6040517f06ab592300000000000000000000000000000000000000000000000000000000815260048101849052602481018390526001600160a01b03828116604483015293965091945092507f0000000000000000000000000000000000000000000000000000000000000000909116906306ab5923906064016020604051808303816000875af11580156106fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107229190611e2c565b505050505050565b600080546040517f4f89059e0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690634f89059e90610774908590600401611e95565b602060405180830381865afa158015610791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b59190611ea8565b6107ed57816040517f396e24b80000000000000000000000000000000000000000000000000000000081526004016103529190611e95565b6102e7826000610a35565b60008060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bdf95fef876040518263ffffffff1660e01b815260040161084c9190611eca565b600060405180830381865afa158015610869573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108919190810190611f4f565b909250905060006108a28882610e58565b60ff1690506108b388600183610e7c565b945060006108e66108c5836001611ffc565b6001848c516108d4919061200f565b6108de919061200f565b8b9190610ea0565b90506108f18161072a565b965060008787604051602001610911929190918252602082015260400190565b60408051808303601f190181529181528151602092830120600081815260019093529082205490925063ffffffff16850360030b121561097d576040517f2dd6a7af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600160205260408120805463ffffffff191663ffffffff87161790556109a88b87610f22565b9097509050806109e4576040517f6260f6f800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b866001600160a01b0316827f87db02a0e483e2818060eddcbb3488ce44e35aff49a70d92c2aa6c8046cf01e28d88604051610a20929190612022565b60405180910390a35050505050509250925092565b600080610a428484610e58565b60ff16905080600003610a595750600090506102e7565b6000610a7985610a698487611ffc565b610a74906001611ffc565b610a35565b90506000610a93610a8b866001611ffc565b879085610e7c565b604080516020810185905290810182905290915060600160408051601f198184030181529082905280516020909101206302571be360e01b82526004820181905294506000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015610b2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4e9190611e0f565b90506001600160a01b0381161580610b9757507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b0316145b15610e255782610d6a576040516302571be360e01b8152600060048201819052907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610c09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2d9190611e0f565b6040517f8cb8ecec000000000000000000000000000000000000000000000000000000008152600481018590523060248201529091506001600160a01b03821690638cb8ecec90604401600060405180830381600087803b158015610c9157600080fd5b505af1158015610ca5573d6000803e3d6000fd5b50506040517f1896f70a000000000000000000000000000000000000000000000000000000008152600481018990526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660248301527f0000000000000000000000000000000000000000000000000000000000000000169250631896f70a9150604401600060405180830381600087803b158015610d4c57600080fd5b505af1158015610d60573d6000803e3d6000fd5b5050505050610e4e565b6040516305ef2c7f60e41b815260048101849052602481018390523060448201526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b158015610e0857600080fd5b505af1158015610e1c573d6000803e3d6000fd5b50505050610e4e565b6001600160a01b0381163014610e4e57604051633c584f1360e21b815260040160405180910390fd5b5050505092915050565b6000828281518110610e6c57610e6c61204a565b016020015160f81c905092915050565b8251600090610e8b8385611ffc565b1115610e9657600080fd5b5091016020012090565b8251606090610eaf8385611ffc565b1115610eba57600080fd5b60008267ffffffffffffffff811115610ed557610ed5611ab7565b6040519080825280601f01601f191660200182016040528015610eff576020820181803683370190505b50905060208082019086860101610f17828287611030565b509095945050505050565b600080610f42604051806040016040528060608152602001600081525090565b610f5a85516005610f539190611ffc565b8290611086565b5060408051808201909152600581527f045f656e730000000000000000000000000000000000000000000000000000006020820152610f9a9082906110fd565b50610fa581866110fd565b506000610fb28582611125565b90505b8051516020820151101561101f578151610fd890610fd283611186565b906111a7565b60000361101157600080610ff5878460a001518560c00151611300565b92509050811561100e5794506001935061102992505050565b50505b61101a81611373565b610fb5565b5060008092509250505b9250929050565b602081106110685781518352611047602084611ffc565b9250611054602083611ffc565b915061106160208261200f565b9050611030565b905182516020929092036101000a6000190180199091169116179052565b6040805180820190915260608152600060208201526110a6602083612060565b156110ce576110b6602083612060565b6110c190602061200f565b6110cb9083611ffc565b91505b6020808401839052604051808552600081529081840101818110156110f257600080fd5b604052509192915050565b60408051808201909152606081526000602082015261111e8383845161145b565b9392505050565b6111736040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c081018290526102e781611373565b602081015181516060916102e79161119e9082611531565b84519190610ea0565b60006111b38383611593565b156111c0575060006102e7565b60008060008060006111d38860006115b1565b905060006111e28860006115b1565b90505b8082111561120e578593506111fa898761160e565b95508161120681612082565b9250506111e5565b8181111561123757849250611223888661160e565b94508061122f81612082565b91505061120e565b600082118015611250575061124e89878a88611632565b155b1561128557859350611262898761160e565b9550849250611271888661160e565b945061127e60018361200f565b9150611237565b8560000361129d5760001996505050505050506102e7565b846000036112b457600196505050505050506102e7565b6112f36112c2856001611ffc565b6112cc8b87610e58565b60ff168a6112db876001611ffc565b6112e58d89610e58565b8e949392919060ff16611667565b9998505050505050505050565b6000805b828410156113645760006113188686610e58565b60ff169050611328600186611ffc565b94506000806113388888856117e5565b9250905081156113505793506001925061136b915050565b61135a8388611ffc565b9650505050611304565b5060009050805b935093915050565b60c0810151602082018190528151511161138a5750565b600061139e82600001518360200151611531565b82602001516113ad9190611ffc565b82519091506113bc9082611839565b61ffff1660408301526113d0600282611ffc565b82519091506113df9082611839565b61ffff1660608301526113f3600282611ffc565b82519091506114029082611861565b63ffffffff166080830152611418600482611ffc565b825190915060009061142a9083611839565b61ffff16905061143b600283611ffc565b60a08401819052915061144e8183611ffc565b60c0909301929092525050565b604080518082019091526060815260006020820152825182111561147e57600080fd5b835151600061148d8483611ffc565b905085602001518111156114af576114af866114aa836002612099565b61188b565b8551805183820160200191600091808511156114c9578482525b505050602086015b6020861061150957805182526114e8602083611ffc565b91506114f5602082611ffc565b905061150260208761200f565b95506114d1565b51815160001960208890036101000a0190811690199190911617905250849150509392505050565b6000815b83518110611545576115456120b0565b60006115518583610e58565b60ff169050611561816001611ffc565b61156b9083611ffc565b91508060000361157b5750611581565b50611535565b61158b838261200f565b949350505050565b60008151835114801561111e575061111e83600084600087516118a8565b6000805b835183106115c5576115c56120b0565b60006115d18585610e58565b60ff1690506115e1816001611ffc565b6115eb9085611ffc565b9350806000036115fb575061111e565b611606600183611ffc565b9150506115b5565b600061161a8383610e58565b60ff16611628836001611ffc565b61111e9190611ffc565b600061164b8383848651611646919061200f565b610e7c565b61165d8686878951611646919061200f565b1495945050505050565b85516000906116768688611ffc565b11156116aa576116868587611ffc565b8751604051638a3c1cfb60e01b815260048101929092526024820152604401610352565b83516116b68385611ffc565b11156116ea576116c68284611ffc565b8451604051638a3c1cfb60e01b815260048101929092526024820152604401610352565b84808310156116f65750815b60208789018101908587010160005b838110156117ca578251825180821461179a5760006020611726858961200f565b106117345750600019611770565b600187611742866020611ffc565b61174c919061200f565b611757906008612099565b6117629060026121aa565b61176c919061200f565b1990505b60006117808383168584166121b6565b905080156117975797506117db9650505050505050565b50505b6117a5602086611ffc565b94506117b2602085611ffc565b935050506020816117c39190611ffc565b9050611705565b506117d585896121b6565b93505050505b9695505050505050565b6000806117f28585611861565b63ffffffff1663613d30781461180d5750600090508061136b565b61182d61181b856004611ffc565b6118258587611ffc565b8791906118cb565b91509150935093915050565b8151600090611849836002611ffc565b111561185457600080fd5b50016002015161ffff1690565b8151600090611871836004611ffc565b111561187c57600080fd5b50016004015163ffffffff1690565b81516118978383611086565b506118a283826110fd565b50505050565b60006118b5848484610e7c565b6118c0878785610e7c565b149695505050505050565b60008060286118da858561200f565b10156118eb5750600090508061136b565b6000806118f9878787611907565b909890975095505050505050565b60008080611915858561200f565b905080604014158015611929575080602814155b8061193e575061193a600282612060565b6001145b156119a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610352565b6001915085518411156119b757600080fd5b611a08565b6000603a8210602f831116156119d45750602f190190565b604782106040831116156119ea57506036190190565b60678210606083111615611a0057506056190190565b5060ff919050565b60208601855b85811015611a6a57611a258183015160001a6119bc565b611a376001830184015160001a6119bc565b60ff811460ff83141715611a5057600095505050611a6a565b60049190911b1760089590951b9490941793600201611a0e565b505050935093915050565b600060208284031215611a8757600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461111e57600080fd5b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715611af057611af0611ab7565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611b1f57611b1f611ab7565b604052919050565b600067ffffffffffffffff821115611b4157611b41611ab7565b50601f01601f191660200190565b600082601f830112611b6057600080fd5b8135611b73611b6e82611b27565b611af6565b818152846020838601011115611b8857600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112611bb657600080fd5b8135602067ffffffffffffffff80831115611bd357611bd3611ab7565b8260051b611be2838201611af6565b9384528581018301938381019088861115611bfc57600080fd5b84880192505b85831015611c9357823584811115611c1a5760008081fd5b88016040818b03601f1901811315611c325760008081fd5b611c3a611acd565b8783013587811115611c4c5760008081fd5b611c5a8d8a83870101611b4f565b825250908201359086821115611c705760008081fd5b611c7e8c8984860101611b4f565b81890152845250509184019190840190611c02565b98975050505050505050565b6001600160a01b0381168114611cb457600080fd5b50565b60008060008060808587031215611ccd57600080fd5b843567ffffffffffffffff80821115611ce557600080fd5b611cf188838901611b4f565b95506020870135915080821115611d0757600080fd5b50611d1487828801611ba5565b9350506040850135611d2581611c9f565b91506060850135611d3581611c9f565b939692955090935050565b600060208284031215611d5257600080fd5b813561111e81611c9f565b600060208284031215611d6f57600080fd5b5035919050565b60008060408385031215611d8957600080fd5b823567ffffffffffffffff80821115611da157600080fd5b611dad86838701611b4f565b93506020850135915080821115611dc357600080fd5b50611dd085828601611ba5565b9150509250929050565b600060208284031215611dec57600080fd5b813567ffffffffffffffff811115611e0357600080fd5b61158b84828501611b4f565b600060208284031215611e2157600080fd5b815161111e81611c9f565b600060208284031215611e3e57600080fd5b5051919050565b60005b83811015611e60578181015183820152602001611e48565b50506000910152565b60008151808452611e81816020860160208601611e45565b601f01601f19169290920160200192915050565b60208152600061111e6020830184611e69565b600060208284031215611eba57600080fd5b8151801515811461111e57600080fd5b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015611f4157888303603f1901855281518051878552611f1588860182611e69565b91890151858303868b0152919050611f2d8183611e69565b968901969450505090860190600101611ef1565b509098975050505050505050565b60008060408385031215611f6257600080fd5b825167ffffffffffffffff811115611f7957600080fd5b8301601f81018513611f8a57600080fd5b8051611f98611b6e82611b27565b818152866020838501011115611fad57600080fd5b611fbe826020830160208601611e45565b809450505050602083015163ffffffff81168114611fdb57600080fd5b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b808201808211156102e7576102e7611fe6565b818103818111156102e7576102e7611fe6565b6040815260006120356040830185611e69565b905063ffffffff831660208301529392505050565b634e487b7160e01b600052603260045260246000fd5b60008261207d57634e487b7160e01b600052601260045260246000fd5b500690565b60008161209157612091611fe6565b506000190190565b80820281158282048414176102e7576102e7611fe6565b634e487b7160e01b600052600160045260246000fd5b600181815b808511156121015781600019048211156120e7576120e7611fe6565b808516156120f457918102915b93841c93908002906120cb565b509250929050565b600082612118575060016102e7565b81612125575060006102e7565b816001811461213b576002811461214557612161565b60019150506102e7565b60ff84111561215657612156611fe6565b50506001821b6102e7565b5060208310610133831016604e8410600b8410161715612184575081810a6102e7565b61218e83836120c6565b80600019048211156121a2576121a2611fe6565b029392505050565b600061111e8383612109565b81810360008312801583831316838312821617156121d6576121d6611fe6565b509291505056fea26469706673582212204fd3172855fc29f1ee29f5099e32e8c1f163dcac07aa16324d9f13cbd4f6ee7164736f6c63430008110033", + "devdoc": { + "details": "An ENS registrar that allows the owner of a DNS name to claim the corresponding name in ENS.", + "kind": "dev", + "methods": { + "proveAndClaim(bytes,(bytes,bytes)[])": { + "details": "Submits proofs to the DNSSEC oracle, then claims a name using those proofs.", + "params": { + "input": "A chain of signed DNS RRSETs ending with a text record.", + "name": "The name to claim, in DNS wire format." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 4358, + "contract": "contracts/dnsregistrar/DNSRegistrar.sol:DNSRegistrar", + "label": "suffixes", + "offset": 0, + "slot": "0", + "type": "t_contract(PublicSuffixList)5847" + }, + { + "astId": 4366, + "contract": "contracts/dnsregistrar/DNSRegistrar.sol:DNSRegistrar", + "label": "inceptions", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_uint32)" + } + ], + "types": { + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(PublicSuffixList)5847": { + "encoding": "inplace", + "label": "contract PublicSuffixList", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes32,t_uint32)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint32)", + "numberOfBytes": "32", + "value": "t_uint32" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/DNSSECImpl.json b/solidity/dns-contracts/deployments/sepolia/DNSSECImpl.json new file mode 100644 index 0000000..eeee27c --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/DNSSECImpl.json @@ -0,0 +1,531 @@ +{ + "address": "0xe62E4b6cE018Ad6e916fcC24545e20a33b9d8653", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "_anchors", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "class", + "type": "uint16" + } + ], + "name": "InvalidClass", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "labelsExpected", + "type": "uint256" + } + ], + "name": "InvalidLabelCount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "proofType", + "type": "uint16" + } + ], + "name": "InvalidProofType", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidRRSet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "rrsetName", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signerName", + "type": "bytes" + } + ], + "name": "InvalidSignerName", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "signerName", + "type": "bytes" + } + ], + "name": "NoMatchingProof", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "signerName", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "proofName", + "type": "bytes" + } + ], + "name": "ProofNameMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "expiration", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "now", + "type": "uint32" + } + ], + "name": "SignatureExpired", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "inception", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "now", + "type": "uint32" + } + ], + "name": "SignatureNotValidYet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "rrsetType", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "sigType", + "type": "uint16" + } + ], + "name": "SignatureTypeMismatch", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "AlgorithmUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "DigestUpdated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "algorithms", + "outputs": [ + { + "internalType": "contract Algorithm", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "anchors", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "digests", + "outputs": [ + { + "internalType": "contract Digest", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "internalType": "contract Algorithm", + "name": "algo", + "type": "address" + } + ], + "name": "setAlgorithm", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "id", + "type": "uint8" + }, + { + "internalType": "contract Digest", + "name": "digest", + "type": "address" + } + ], + "name": "setDigest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature[]", + "name": "input", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "now", + "type": "uint256" + } + ], + "name": "verifyRRSet", + "outputs": [ + { + "internalType": "bytes", + "name": "rrs", + "type": "bytes" + }, + { + "internalType": "uint32", + "name": "inception", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "rrset", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "internalType": "struct DNSSEC.RRSetWithSignature[]", + "name": "input", + "type": "tuple[]" + } + ], + "name": "verifyRRSet", + "outputs": [ + { + "internalType": "bytes", + "name": "rrs", + "type": "bytes" + }, + { + "internalType": "uint32", + "name": "inception", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x8be3f83c80bb919033066e5ecf6c7cd9b232d4184886d44f771ab06900a43764", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0xe62E4b6cE018Ad6e916fcC24545e20a33b9d8653", + "transactionIndex": 107, + "gasUsed": "1832859", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x0143a182756069acaa2b572b19bbe5c4dc79d503cd936652a96dffafb5be1e72", + "transactionHash": "0x8be3f83c80bb919033066e5ecf6c7cd9b232d4184886d44f771ab06900a43764", + "logs": [], + "blockNumber": 4141622, + "cumulativeGasUsed": "12974790", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00002b000100000e1000244a5c080249aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb500002b000100000e1000244f660802e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d00002b000100000e10000404fefdfd" + ], + "numDeployments": 1, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_anchors\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"class\",\"type\":\"uint16\"}],\"name\":\"InvalidClass\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"labelsExpected\",\"type\":\"uint256\"}],\"name\":\"InvalidLabelCount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"proofType\",\"type\":\"uint16\"}],\"name\":\"InvalidProofType\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRRSet\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"rrsetName\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signerName\",\"type\":\"bytes\"}],\"name\":\"InvalidSignerName\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signerName\",\"type\":\"bytes\"}],\"name\":\"NoMatchingProof\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signerName\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"proofName\",\"type\":\"bytes\"}],\"name\":\"ProofNameMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"expiration\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"now\",\"type\":\"uint32\"}],\"name\":\"SignatureExpired\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"inception\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"now\",\"type\":\"uint32\"}],\"name\":\"SignatureNotValidYet\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"rrsetType\",\"type\":\"uint16\"},{\"internalType\":\"uint16\",\"name\":\"sigType\",\"type\":\"uint16\"}],\"name\":\"SignatureTypeMismatch\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"AlgorithmUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"DigestUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"algorithms\",\"outputs\":[{\"internalType\":\"contract Algorithm\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"anchors\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"name\":\"digests\",\"outputs\":[{\"internalType\":\"contract Digest\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"internalType\":\"contract Algorithm\",\"name\":\"algo\",\"type\":\"address\"}],\"name\":\"setAlgorithm\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"id\",\"type\":\"uint8\"},{\"internalType\":\"contract Digest\",\"name\":\"digest\",\"type\":\"address\"}],\"name\":\"setDigest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature[]\",\"name\":\"input\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"now\",\"type\":\"uint256\"}],\"name\":\"verifyRRSet\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"rrs\",\"type\":\"bytes\"},{\"internalType\":\"uint32\",\"name\":\"inception\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"rrset\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"internalType\":\"struct DNSSEC.RRSetWithSignature[]\",\"name\":\"input\",\"type\":\"tuple[]\"}],\"name\":\"verifyRRSet\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"rrs\",\"type\":\"bytes\"},{\"internalType\":\"uint32\",\"name\":\"inception\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_anchors\":\"The binary format RR entries for the root DS records.\"}},\"setAlgorithm(uint8,address)\":{\"details\":\"Sets the contract address for a signature verification algorithm. Callable only by the owner.\",\"params\":{\"algo\":\"The address of the algorithm contract.\",\"id\":\"The algorithm ID\"}},\"setDigest(uint8,address)\":{\"details\":\"Sets the contract address for a digest verification algorithm. Callable only by the owner.\",\"params\":{\"digest\":\"The address of the digest contract.\",\"id\":\"The digest ID\"}},\"verifyRRSet((bytes,bytes)[])\":{\"details\":\"Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain. Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\",\"params\":{\"input\":\"A list of signed RRSets.\"},\"returns\":{\"inception\":\"The inception time of the signed record set.\",\"rrs\":\"The RRData from the last RRSet in the chain.\"}},\"verifyRRSet((bytes,bytes)[],uint256)\":{\"details\":\"Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain. Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\",\"params\":{\"input\":\"A list of signed RRSets.\",\"now\":\"The Unix timestamp to validate the records at.\"},\"returns\":{\"inception\":\"The inception time of the signed record set.\",\"rrs\":\"The RRData from the last RRSet in the chain.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/DNSSECImpl.sol\":\"DNSSECImpl\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-2-Clause\\npragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for appending to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n let fpm := add(32, add(ptr, capacity))\\n if lt(fpm, ptr) {\\n revert(0, 0)\\n }\\n mstore(0x40, fpm)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n uint off = buf.buf.length;\\n uint newCapacity = off + len;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(newCapacity, buflen) {\\n mstore(bufptr, newCapacity)\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return append(buf, data, data.length);\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint offPlusOne = off + 1;\\n if (off >= buf.capacity) {\\n resize(buf, offPlusOne * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if gt(offPlusOne, mload(bufptr)) {\\n mstore(bufptr, offPlusOne)\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return append(buf, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return append(buf, data, 32);\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n return buf;\\n }\\n}\\n\",\"keccak256\":\"0xd6dd3b0b327288f8e1b711a609f4040fea602e2ad4bba9febdf2f33b4e56eb0c\",\"license\":\"BSD-2-Clause\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/DNSSEC.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nabstract contract DNSSEC {\\n bytes public anchors;\\n\\n struct RRSetWithSignature {\\n bytes rrset;\\n bytes sig;\\n }\\n\\n event AlgorithmUpdated(uint8 id, address addr);\\n event DigestUpdated(uint8 id, address addr);\\n\\n function verifyRRSet(\\n RRSetWithSignature[] memory input\\n ) external view virtual returns (bytes memory rrs, uint32 inception);\\n\\n function verifyRRSet(\\n RRSetWithSignature[] memory input,\\n uint256 now\\n ) public view virtual returns (bytes memory rrs, uint32 inception);\\n}\\n\",\"keccak256\":\"0xee6a236a59e5db8418c98ee4640a91987d26533c02d305cc6c7a37a3ac4ee907\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/DNSSECImpl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nimport \\\"./Owned.sol\\\";\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"./RRUtils.sol\\\";\\nimport \\\"./DNSSEC.sol\\\";\\nimport \\\"./algorithms/Algorithm.sol\\\";\\nimport \\\"./digests/Digest.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/*\\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\\n * - Proofs involving wildcard names will not validate.\\n * - TTLs on records are ignored, as data is not stored persistently.\\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\\n */\\ncontract DNSSECImpl is DNSSEC, Owned {\\n using Buffer for Buffer.buffer;\\n using BytesUtils for bytes;\\n using RRUtils for *;\\n\\n uint16 constant DNSCLASS_IN = 1;\\n\\n uint16 constant DNSTYPE_DS = 43;\\n uint16 constant DNSTYPE_DNSKEY = 48;\\n\\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\\n\\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\\n error SignatureNotValidYet(uint32 inception, uint32 now);\\n error SignatureExpired(uint32 expiration, uint32 now);\\n error InvalidClass(uint16 class);\\n error InvalidRRSet();\\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\\n error InvalidSignerName(bytes rrsetName, bytes signerName);\\n error InvalidProofType(uint16 proofType);\\n error ProofNameMismatch(bytes signerName, bytes proofName);\\n error NoMatchingProof(bytes signerName);\\n\\n mapping(uint8 => Algorithm) public algorithms;\\n mapping(uint8 => Digest) public digests;\\n\\n /**\\n * @dev Constructor.\\n * @param _anchors The binary format RR entries for the root DS records.\\n */\\n constructor(bytes memory _anchors) {\\n // Insert the 'trust anchors' - the key hashes that start the chain\\n // of trust for all other records.\\n anchors = _anchors;\\n }\\n\\n /**\\n * @dev Sets the contract address for a signature verification algorithm.\\n * Callable only by the owner.\\n * @param id The algorithm ID\\n * @param algo The address of the algorithm contract.\\n */\\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\\n algorithms[id] = algo;\\n emit AlgorithmUpdated(id, address(algo));\\n }\\n\\n /**\\n * @dev Sets the contract address for a digest verification algorithm.\\n * Callable only by the owner.\\n * @param id The digest ID\\n * @param digest The address of the digest contract.\\n */\\n function setDigest(uint8 id, Digest digest) public owner_only {\\n digests[id] = digest;\\n emit DigestUpdated(id, address(digest));\\n }\\n\\n /**\\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\\n * @param input A list of signed RRSets.\\n * @return rrs The RRData from the last RRSet in the chain.\\n * @return inception The inception time of the signed record set.\\n */\\n function verifyRRSet(\\n RRSetWithSignature[] memory input\\n )\\n external\\n view\\n virtual\\n override\\n returns (bytes memory rrs, uint32 inception)\\n {\\n return verifyRRSet(input, block.timestamp);\\n }\\n\\n /**\\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\\n * @param input A list of signed RRSets.\\n * @param now The Unix timestamp to validate the records at.\\n * @return rrs The RRData from the last RRSet in the chain.\\n * @return inception The inception time of the signed record set.\\n */\\n function verifyRRSet(\\n RRSetWithSignature[] memory input,\\n uint256 now\\n )\\n public\\n view\\n virtual\\n override\\n returns (bytes memory rrs, uint32 inception)\\n {\\n bytes memory proof = anchors;\\n for (uint256 i = 0; i < input.length; i++) {\\n RRUtils.SignedSet memory rrset = validateSignedSet(\\n input[i],\\n proof,\\n now\\n );\\n proof = rrset.data;\\n inception = rrset.inception;\\n }\\n return (proof, inception);\\n }\\n\\n /**\\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\\n *\\n * @param input The signed RR set. This is in the format described in section\\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\\n * data, followed by a series of canonicalised RR records that the signature\\n * applies to.\\n * @param proof The DNSKEY or DS to validate the signature against.\\n * @param now The current timestamp.\\n */\\n function validateSignedSet(\\n RRSetWithSignature memory input,\\n bytes memory proof,\\n uint256 now\\n ) internal view returns (RRUtils.SignedSet memory rrset) {\\n rrset = input.rrset.readSignedSet();\\n\\n // Do some basic checks on the RRs and extract the name\\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\\n if (name.labelCount(0) != rrset.labels) {\\n revert InvalidLabelCount(name, rrset.labels);\\n }\\n rrset.name = name;\\n\\n // All comparisons involving the Signature Expiration and\\n // Inception fields MUST use \\\"serial number arithmetic\\\", as\\n // defined in RFC 1982\\n\\n // o The validator's notion of the current time MUST be less than or\\n // equal to the time listed in the RRSIG RR's Expiration field.\\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\\n revert SignatureExpired(rrset.expiration, uint32(now));\\n }\\n\\n // o The validator's notion of the current time MUST be greater than or\\n // equal to the time listed in the RRSIG RR's Inception field.\\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\\n revert SignatureNotValidYet(rrset.inception, uint32(now));\\n }\\n\\n // Validate the signature\\n verifySignature(name, rrset, input, proof);\\n\\n return rrset;\\n }\\n\\n /**\\n * @dev Validates a set of RRs.\\n * @param rrset The RR set.\\n * @param typecovered The type covered by the RRSIG record.\\n */\\n function validateRRs(\\n RRUtils.SignedSet memory rrset,\\n uint16 typecovered\\n ) internal pure returns (bytes memory name) {\\n // Iterate over all the RRs\\n for (\\n RRUtils.RRIterator memory iter = rrset.rrs();\\n !iter.done();\\n iter.next()\\n ) {\\n // We only support class IN (Internet)\\n if (iter.class != DNSCLASS_IN) {\\n revert InvalidClass(iter.class);\\n }\\n\\n if (name.length == 0) {\\n name = iter.name();\\n } else {\\n // Name must be the same on all RRs. We do things this way to avoid copying the name\\n // repeatedly.\\n if (\\n name.length != iter.data.nameLength(iter.offset) ||\\n !name.equals(0, iter.data, iter.offset, name.length)\\n ) {\\n revert InvalidRRSet();\\n }\\n }\\n\\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\\n if (iter.dnstype != typecovered) {\\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\\n }\\n }\\n }\\n\\n /**\\n * @dev Performs signature verification.\\n *\\n * Throws or reverts if unable to verify the record.\\n *\\n * @param name The name of the RRSIG record, in DNS label-sequence format.\\n * @param data The original data to verify.\\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\\n */\\n function verifySignature(\\n bytes memory name,\\n RRUtils.SignedSet memory rrset,\\n RRSetWithSignature memory data,\\n bytes memory proof\\n ) internal view {\\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\\n // that contains the RRset.\\n if (!name.isSubdomainOf(rrset.signerName)) {\\n revert InvalidSignerName(name, rrset.signerName);\\n }\\n\\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\\n // Check the proof\\n if (proofRR.dnstype == DNSTYPE_DS) {\\n verifyWithDS(rrset, data, proofRR);\\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\\n verifyWithKnownKey(rrset, data, proofRR);\\n } else {\\n revert InvalidProofType(proofRR.dnstype);\\n }\\n }\\n\\n /**\\n * @dev Attempts to verify a signed RRSET against an already known public key.\\n * @param rrset The signed set to verify.\\n * @param data The original data the signed set was read from.\\n * @param proof The serialized DS or DNSKEY record to use as proof.\\n */\\n function verifyWithKnownKey(\\n RRUtils.SignedSet memory rrset,\\n RRSetWithSignature memory data,\\n RRUtils.RRIterator memory proof\\n ) internal view {\\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\\n for (; !proof.done(); proof.next()) {\\n bytes memory proofName = proof.name();\\n if (!proofName.equals(rrset.signerName)) {\\n revert ProofNameMismatch(rrset.signerName, proofName);\\n }\\n\\n bytes memory keyrdata = proof.rdata();\\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\\n 0,\\n keyrdata.length\\n );\\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\\n return;\\n }\\n }\\n revert NoMatchingProof(rrset.signerName);\\n }\\n\\n /**\\n * @dev Attempts to verify some data using a provided key and a signature.\\n * @param dnskey The dns key record to verify the signature with.\\n * @param rrset The signed RRSET being verified.\\n * @param data The original data `rrset` was decoded from.\\n * @return True iff the key verifies the signature.\\n */\\n function verifySignatureWithKey(\\n RRUtils.DNSKEY memory dnskey,\\n bytes memory keyrdata,\\n RRUtils.SignedSet memory rrset,\\n RRSetWithSignature memory data\\n ) internal view returns (bool) {\\n // TODO: Check key isn't expired, unless updating key itself\\n\\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\\n if (dnskey.protocol != 3) {\\n return false;\\n }\\n\\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\\n // the zone's apex DNSKEY RRset.\\n if (dnskey.algorithm != rrset.algorithm) {\\n return false;\\n }\\n uint16 computedkeytag = keyrdata.computeKeytag();\\n if (computedkeytag != rrset.keytag) {\\n return false;\\n }\\n\\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\\n // set.\\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\\n return false;\\n }\\n\\n Algorithm algorithm = algorithms[dnskey.algorithm];\\n if (address(algorithm) == address(0)) {\\n return false;\\n }\\n return algorithm.verify(keyrdata, data.rrset, data.sig);\\n }\\n\\n /**\\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\\n * that the record\\n * @param rrset The signed set to verify.\\n * @param data The original data the signed set was read from.\\n * @param proof The serialized DS or DNSKEY record to use as proof.\\n */\\n function verifyWithDS(\\n RRUtils.SignedSet memory rrset,\\n RRSetWithSignature memory data,\\n RRUtils.RRIterator memory proof\\n ) internal view {\\n uint256 proofOffset = proof.offset;\\n for (\\n RRUtils.RRIterator memory iter = rrset.rrs();\\n !iter.done();\\n iter.next()\\n ) {\\n if (iter.dnstype != DNSTYPE_DNSKEY) {\\n revert InvalidProofType(iter.dnstype);\\n }\\n\\n bytes memory keyrdata = iter.rdata();\\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\\n 0,\\n keyrdata.length\\n );\\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\\n // It's self-signed - look for a DS record to verify it.\\n if (\\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\\n ) {\\n return;\\n }\\n // Rewind proof iterator to the start for the next loop iteration.\\n proof.nextOffset = proofOffset;\\n proof.next();\\n }\\n }\\n revert NoMatchingProof(rrset.signerName);\\n }\\n\\n /**\\n * @dev Attempts to verify a key using DS records.\\n * @param keyname The DNS name of the key, in DNS label-sequence format.\\n * @param dsrrs The DS records to use in verification.\\n * @param dnskey The dnskey to verify.\\n * @param keyrdata The RDATA section of the key.\\n * @return True if a DS record verifies this key.\\n */\\n function verifyKeyWithDS(\\n bytes memory keyname,\\n RRUtils.RRIterator memory dsrrs,\\n RRUtils.DNSKEY memory dnskey,\\n bytes memory keyrdata\\n ) internal view returns (bool) {\\n uint16 keytag = keyrdata.computeKeytag();\\n for (; !dsrrs.done(); dsrrs.next()) {\\n bytes memory proofName = dsrrs.name();\\n if (!proofName.equals(keyname)) {\\n revert ProofNameMismatch(keyname, proofName);\\n }\\n\\n RRUtils.DS memory ds = dsrrs.data.readDS(\\n dsrrs.rdataOffset,\\n dsrrs.nextOffset - dsrrs.rdataOffset\\n );\\n if (ds.keytag != keytag) {\\n continue;\\n }\\n if (ds.algorithm != dnskey.algorithm) {\\n continue;\\n }\\n\\n Buffer.buffer memory buf;\\n buf.init(keyname.length + keyrdata.length);\\n buf.append(keyname);\\n buf.append(keyrdata);\\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\\n return true;\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Attempts to verify a DS record's hash value against some data.\\n * @param digesttype The digest ID from the DS record.\\n * @param data The data to digest.\\n * @param digest The digest data to check against.\\n * @return True iff the digest matches.\\n */\\n function verifyDSHash(\\n uint8 digesttype,\\n bytes memory data,\\n bytes memory digest\\n ) internal view returns (bool) {\\n if (address(digests[digesttype]) == address(0)) {\\n return false;\\n }\\n return digests[digesttype].verify(data, digest);\\n }\\n}\\n\",\"keccak256\":\"0x671fea3a3332453eecc08c082f264011aa8cfa99fb3c03adf73443843aed5128\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/Owned.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev Contract mixin for 'owned' contracts.\\n */\\ncontract Owned {\\n address public owner;\\n\\n modifier owner_only() {\\n require(msg.sender == owner);\\n _;\\n }\\n\\n constructor() public {\\n owner = msg.sender;\\n }\\n\\n function setOwner(address newOwner) public owner_only {\\n owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x49f57dcb9d79015f917e569b4318b766bee9920f72e11a1f5331eabebfc1eb24\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n */\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint256 labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes memory ret) {\\n uint256 len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint256 labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint256 constant RRSIG_TYPE = 0;\\n uint256 constant RRSIG_ALGORITHM = 2;\\n uint256 constant RRSIG_LABELS = 3;\\n uint256 constant RRSIG_TTL = 4;\\n uint256 constant RRSIG_EXPIRATION = 8;\\n uint256 constant RRSIG_INCEPTION = 12;\\n uint256 constant RRSIG_KEY_TAG = 16;\\n uint256 constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(\\n bytes memory data\\n ) internal pure returns (SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(\\n RRSIG_SIGNER_NAME + self.signerName.length,\\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\\n );\\n }\\n\\n function rrs(\\n SignedSet memory rrset\\n ) internal pure returns (RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint256 offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint256 rdataOffset;\\n uint256 nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns (bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint256 rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.offset,\\n nameLength(iter.data, iter.offset)\\n );\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(\\n RRIterator memory iter\\n ) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.rdataOffset,\\n iter.nextOffset - iter.rdataOffset\\n );\\n }\\n\\n uint256 constant DNSKEY_FLAGS = 0;\\n uint256 constant DNSKEY_PROTOCOL = 2;\\n uint256 constant DNSKEY_ALGORITHM = 3;\\n uint256 constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(\\n offset + DNSKEY_PUBKEY,\\n length - DNSKEY_PUBKEY\\n );\\n }\\n\\n uint256 constant DS_KEY_TAG = 0;\\n uint256 constant DS_ALGORITHM = 2;\\n uint256 constant DS_DIGEST_TYPE = 3;\\n uint256 constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n function isSubdomainOf(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n uint256 off = 0;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n while (counts > othercounts) {\\n off = progress(self, off);\\n counts--;\\n }\\n\\n return self.equals(off, other, 0);\\n }\\n\\n function compareNames(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint256 off;\\n uint256 otheroff;\\n uint256 prevoff;\\n uint256 otherprevoff;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if (otheroff == 0) {\\n return 1;\\n }\\n\\n return\\n self.compare(\\n prevoff + 1,\\n self.readUint8(prevoff),\\n other,\\n otherprevoff + 1,\\n other.readUint8(otherprevoff)\\n );\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(\\n uint32 i1,\\n uint32 i2\\n ) internal pure returns (bool) {\\n unchecked {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n }\\n\\n function progress(\\n bytes memory body,\\n uint256 off\\n ) internal pure returns (uint256) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint256 ac1;\\n uint256 ac2;\\n for (uint256 i = 0; i < data.length + 31; i += 32) {\\n uint256 word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if (i + 32 > data.length) {\\n uint256 unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 +=\\n (word &\\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\\n 8;\\n ac2 += (word &\\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 =\\n (ac1 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac1 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac2 =\\n (ac2 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac2 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 =\\n (ac1 &\\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\\n 32);\\n ac1 =\\n (ac1 &\\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\\n 64);\\n ac1 =\\n (ac1 &\\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\\n (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4dd68a6efd7c38f6b0e95ca0c056ecb74f88583da650b1a8639e6e78be36fede\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n */\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata signature\\n ) external view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xaf6825f9852c69f8e36540821d067b4550dd2263497af9d645309b6a0c457ba6\"},\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC digest.\\n */\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(\\n bytes calldata data,\\n bytes calldata hash\\n ) external pure virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x8ea926b2db0578c4ad7fce4582fc0f6f0f9efee8dca2085dbdb9984f18941e28\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506040516200205638038062002056833981016040819052620000349162000072565b600180546001600160a01b031916331790556000620000548282620001d6565b5050620002a2565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156200008657600080fd5b82516001600160401b03808211156200009e57600080fd5b818501915085601f830112620000b357600080fd5b815181811115620000c857620000c86200005c565b604051601f8201601f19908116603f01168101908382118183101715620000f357620000f36200005c565b8160405282815288868487010111156200010c57600080fd5b600093505b8284101562000130578484018601518185018701529285019262000111565b600086848301015280965050505050505092915050565b600181811c908216806200015c57607f821691505b6020821081036200017d57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620001d157600081815260208120601f850160051c81016020861015620001ac5750805b601f850160051c820191505b81811015620001cd57828155600101620001b8565b5050505b505050565b81516001600160401b03811115620001f257620001f26200005c565b6200020a8162000203845462000147565b8462000183565b602080601f831160018114620002425760008415620002295750858301515b600019600386901b1c1916600185901b178555620001cd565b600085815260208120601f198616915b82811015620002735788860151825594840194600190910190840162000252565b5085821015620002925787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b611da480620002b26000396000f3fe608060405234801561001057600080fd5b50600436106100a35760003560e01c806373cc48a61161007657806398d35f201161005b57806398d35f2014610161578063bdf95fef14610176578063c327deef1461018957600080fd5b806373cc48a61461010d5780638da5cb5b1461014e57600080fd5b8063020ed8d3146100a857806313af4035146100bd57806328e7677d146100d0578063440f3d42146100e3575b600080fd5b6100bb6100b6366004611871565b6101b2565b005b6100bb6100cb3660046118a8565b610241565b6100bb6100de366004611871565b610287565b6100f66100f1366004611a9f565b61030e565b604051610104929190611b2a565b60405180910390f35b61013661011b366004611b52565b6003602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610104565b600154610136906001600160a01b031681565b610169610400565b6040516101049190611b6d565b6100f6610184366004611b80565b61048e565b610136610197366004611b52565b6002602052600090815260409020546001600160a01b031681565b6001546001600160a01b031633146101c957600080fd5b60ff8216600081815260026020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386169081179091558251938452908301527ff73c3c226af96b7f1ba666a21b3ceaf2be3ee6a365e3178fd9cd1eaae0075aa891015b60405180910390a15050565b6001546001600160a01b0316331461025857600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001546001600160a01b0316331461029e57600080fd5b60ff8216600081815260036020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386169081179091558251938452908301527f2fcc274c3b72dd483ab201bfa87295e3817e8b9b10693219873b722ca1af00c79101610235565b60606000806000805461032090611bb5565b80601f016020809104026020016040519081016040528092919081815260200182805461034c90611bb5565b80156103995780601f1061036e57610100808354040283529160200191610399565b820191906000526020600020905b81548152906001019060200180831161037c57829003601f168201915b5050505050905060005b85518110156103f65760006103d28783815181106103c3576103c3611bef565b602002602001015184886104a5565b61010081015160a090910151945092508190506103ee81611c1b565b9150506103a3565b5091509250929050565b6000805461040d90611bb5565b80601f016020809104026020016040519081016040528092919081815260200182805461043990611bb5565b80156104865780601f1061045b57610100808354040283529160200191610486565b820191906000526020600020905b81548152906001019060200180831161046957829003601f168201915b505050505081565b6060600061049c834261030e565b91509150915091565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c082019290925260e081018290526101008101829052610120810191909152835161050390610647565b90506000610515828360000151610789565b604083015190915060ff1661052b8260006108e6565b14610573578082604001516040517fe861b2bd00000000000000000000000000000000000000000000000000000000815260040161056a929190611c34565b60405180910390fd5b6101208201819052608082015160009084900360030b12156105d75760808201516040517fa784f87e00000000000000000000000000000000000000000000000000000000815263ffffffff9182166004820152908416602482015260440161056a565b60a0820151600090840360030b12156106325760a08201516040517fbd41036a00000000000000000000000000000000000000000000000000000000815263ffffffff9182166004820152908416602482015260440161056a565b61063e8183878761094c565b505b9392505050565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e082018190526101008201819052610120820152906106a2908390610a16565b61ffff1681526106b3826002610a3e565b60ff1660208201526106c6826003610a3e565b60ff1660408201526106d9826004610a62565b63ffffffff90811660608301526106f5908390600890610a6216565b63ffffffff9081166080830152610711908390600c90610a6216565b63ffffffff90811660a083015261072d908390601090610a1616565b61ffff1660c0820152610741826012610a8c565b60e082018190525161077e90610758906012611c59565b8260e00151516012855161076c9190611c6c565b6107769190611c6c565b849190610aaf565b610100820152919050565b6060600061079684610b31565b90505b805151602082015110156108df57606081015161ffff166001146107f55760608101516040517f98a5f31a00000000000000000000000000000000000000000000000000000000815261ffff909116600482015260240161056a565b815160000361080e5761080781610b8f565b9150610878565b6020810151815161081e91610bb0565b8251141580610841575080516020820151835161083f928592600092610c0a565b155b15610878576040517fcbceee6f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8261ffff16816040015161ffff16146108d15760408082015190517fa6ff8a8a00000000000000000000000000000000000000000000000000000000815261ffff9182166004820152908416602482015260440161056a565b6108da81610c2d565b610799565b5092915050565b6000805b835183106108fa576108fa611c7f565b60006109068585610a3e565b60ff169050610916816001611c59565b6109209085611c59565b9350806000036109305750610943565b61093b600183611c59565b9150506108ea565b90505b92915050565b60e083015161095c908590610d15565b6109995760e08301516040517feaafc59b00000000000000000000000000000000000000000000000000000000815261056a918691600401611c95565b60006109a58282610d72565b9050602b61ffff16816040015161ffff16036109cb576109c6848483610dd3565b610a0f565b603061ffff16816040015161ffff16036109ea576109c6848483610ec0565b60408082015190516361529e8760e01b815261ffff909116600482015260240161056a565b5050505050565b8151600090610a26836002611c59565b1115610a3157600080fd5b50016002015161ffff1690565b6000828281518110610a5257610a52611bef565b016020015160f81c905092915050565b8151600090610a72836004611c59565b1115610a7d57600080fd5b50016004015163ffffffff1690565b60606000610a9a8484610bb0565b9050610aa7848483610aaf565b949350505050565b8251606090610abe8385611c59565b1115610ac957600080fd5b60008267ffffffffffffffff811115610ae457610ae46118c5565b6040519080825280601f01601f191660200182016040528015610b0e576020820181803683370190505b50905060208082019086860101610b26828287610f88565b509095945050505050565b610b7f6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b6109468261010001516000610d72565b6020810151815160609161094691610ba79082610bb0565b84519190610aaf565b6000815b83518110610bc457610bc4611c7f565b6000610bd08583610a3e565b60ff169050610be0816001611c59565b610bea9083611c59565b915080600003610bfa5750610c00565b50610bb4565b610aa78382611c6c565b6000610c17848484610fde565b610c22878785610fde565b149695505050505050565b60c08101516020820181905281515111610c445750565b6000610c5882600001518360200151610bb0565b8260200151610c679190611c59565b8251909150610c769082610a16565b61ffff166040830152610c8a600282611c59565b8251909150610c999082610a16565b61ffff166060830152610cad600282611c59565b8251909150610cbc9082610a62565b63ffffffff166080830152610cd2600482611c59565b8251909150600090610ce49083610a16565b61ffff169050610cf5600283611c59565b60a084018190529150610d088183611c59565b60c0909301929092525050565b60008080610d2385826108e6565b90506000610d328560006108e6565b90505b80821115610d5b57610d478684611002565b925081610d5381611cc3565b925050610d35565b610d688684876000611026565b9695505050505050565b610dc06040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261094681610c2d565b60208101516000610de385610b31565b90505b80515160208201511015610ea057604081015161ffff16603014610e295760408082015190516361529e8760e01b815261ffff909116600482015260240161056a565b6000610e348261105b565b90506000610e4f60008351846110779092919063ffffffff16565b9050610e5d81838989611115565b15610e9057610e728760e00151868385611254565b15610e805750505050505050565b60c08501849052610e9085610c2d565b5050610e9b81610c2d565b610de6565b508360e001516040516306cde0f360e01b815260040161056a9190611b6d565b80515160208201511015610f69576000610ed982610b8f565b9050610ef28460e001518261139190919063ffffffff16565b610f17578360e0015181604051636b80573f60e11b815260040161056a929190611c95565b6000610f228361105b565b90506000610f3d60008351846110779092919063ffffffff16565b9050610f4b81838888611115565b15610f5857505050505050565b505050610f6481610c2d565b610ec0565b8260e001516040516306cde0f360e01b815260040161056a9190611b6d565b60208110610fc05781518352610f9f602084611c59565b9250610fac602083611c59565b9150610fb9602082611c6c565b9050610f88565b905182516020929092036101000a6000190180199091169116179052565b8251600090610fed8385611c59565b1115610ff857600080fd5b5091016020012090565b600061100e8383610a3e565b60ff1661101c836001611c59565b6109439190611c59565b600061103f838384865161103a9190611c6c565b610fde565b611051868687895161103a9190611c6c565b1495945050505050565b60a081015160c082015160609161094691610ba7908290611c6c565b60408051608081018252600080825260208201819052918101919091526060808201526110af6110a8600085611c59565b8590610a16565b61ffff1681526110ca6110c3600285611c59565b8590610a3e565b60ff1660208201526110e06110c3600385611c59565b60ff1660408201526111096110f6600485611c59565b611101600485611c6c565b869190610aaf565b60608201529392505050565b6000846020015160ff1660031461112e57506000610aa7565b826020015160ff16856040015160ff161461114b57506000610aa7565b6000611156856113af565b90508360c0015161ffff168161ffff1614611175576000915050610aa7565b85516101001660000361118c576000915050610aa7565b60408087015160ff166000908152600260205220546001600160a01b0316806111ba57600092505050610aa7565b835160208501516040517fde8f50a10000000000000000000000000000000000000000000000000000000081526001600160a01b0384169263de8f50a192611208928b929190600401611cda565b602060405180830381865afa158015611225573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112499190611d13565b979650505050505050565b600080611260836113af565b90505b8451516020860151101561138557600061127c86610b8f565b90506112888188611391565b6112a9578681604051636b80573f60e11b815260040161056a929190611c95565b60a086015160c08701516000916112ce916112c5908290611c6c565b89519190611077565b90508261ffff16816000015161ffff16146112ea575050611377565b856040015160ff16816020015160ff1614611306575050611377565b60408051808201909152606081526000602082015261133386518a5161132c9190611c59565b82906115f3565b5061133e818a61166a565b50611349818761166a565b5061136182604001518260000151846060015161168b565b15611373576001945050505050610aa7565b5050505b61138085610c2d565b611263565b50600095945050505050565b60008151835114801561094357506109438360008460008751610c0a565b60006120008251111561141e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4c6f6e67206b657973206e6f74207065726d6974746564000000000000000000604482015260640161056a565b60008060005b8451601f0181101561149357600081602087010151905085518260200111156114595785518290036008026101000390811c901b5b7eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff600882901c81169490940193169190910190602001611424565b506010827fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff000016901c827dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff160191506010817fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff000016901c817dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff1601905080600883901b0191506020827fffffffff00000000ffffffff00000000ffffffff00000000ffffffff0000000016901c827bffffffff00000000ffffffff00000000ffffffff00000000ffffffff160191506040827fffffffffffffffff0000000000000000ffffffffffffffff000000000000000016901c8277ffffffffffffffff0000000000000000ffffffffffffffff16019150608082901c826fffffffffffffffffffffffffffffffff16019150601082901c61ffff16820191508192505050919050565b604080518082019091526060815260006020820152611613602083611d35565b1561163b57611623602083611d35565b61162e906020611c6c565b6116389083611c59565b91505b60208084018390526040518085526000815290818401018181101561165f57600080fd5b604052509192915050565b60408051808201909152606081526000602082015261094383838451611750565b60ff83166000908152600360205260408120546001600160a01b03166116b357506000610640565b60ff8416600090815260036020526040908190205490517ff7e83aee0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063f7e83aee9061170f9086908690600401611c95565b602060405180830381865afa15801561172c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa79190611d13565b604080518082019091526060815260006020820152825182111561177357600080fd5b83515160006117828483611c59565b905085602001518111156117a4576117a48661179f836002611d57565b611826565b8551805183820160200191600091808511156117be578482525b505050602086015b602086106117fe57805182526117dd602083611c59565b91506117ea602082611c59565b90506117f7602087611c6c565b95506117c6565b51815160001960208890036101000a0190811690199190911617905250849150509392505050565b815161183283836115f3565b5061183d838261166a565b50505050565b803560ff8116811461185457600080fd5b919050565b6001600160a01b038116811461186e57600080fd5b50565b6000806040838503121561188457600080fd5b61188d83611843565b9150602083013561189d81611859565b809150509250929050565b6000602082840312156118ba57600080fd5b813561094381611859565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156118fe576118fe6118c5565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561192d5761192d6118c5565b604052919050565b600082601f83011261194657600080fd5b813567ffffffffffffffff811115611960576119606118c5565b611973601f8201601f1916602001611904565b81815284602083860101111561198857600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f8301126119b657600080fd5b8135602067ffffffffffffffff808311156119d3576119d36118c5565b8260051b6119e2838201611904565b93845285810183019383810190888611156119fc57600080fd5b84880192505b85831015611a9357823584811115611a1a5760008081fd5b88016040818b03601f1901811315611a325760008081fd5b611a3a6118db565b8783013587811115611a4c5760008081fd5b611a5a8d8a83870101611935565b825250908201359086821115611a705760008081fd5b611a7e8c8984860101611935565b81890152845250509184019190840190611a02565b98975050505050505050565b60008060408385031215611ab257600080fd5b823567ffffffffffffffff811115611ac957600080fd5b611ad5858286016119a5565b95602094909401359450505050565b6000815180845260005b81811015611b0a57602081850181015186830182015201611aee565b506000602082860101526020601f19601f83011685010191505092915050565b604081526000611b3d6040830185611ae4565b905063ffffffff831660208301529392505050565b600060208284031215611b6457600080fd5b61094382611843565b6020815260006109436020830184611ae4565b600060208284031215611b9257600080fd5b813567ffffffffffffffff811115611ba957600080fd5b610aa7848285016119a5565b600181811c90821680611bc957607f821691505b602082108103611be957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c2d57611c2d611c05565b5060010190565b604081526000611c476040830185611ae4565b905060ff831660208301529392505050565b8082018082111561094657610946611c05565b8181038181111561094657610946611c05565b634e487b7160e01b600052600160045260246000fd5b604081526000611ca86040830185611ae4565b8281036020840152611cba8185611ae4565b95945050505050565b600081611cd257611cd2611c05565b506000190190565b606081526000611ced6060830186611ae4565b8281036020840152611cff8186611ae4565b90508281036040840152610d688185611ae4565b600060208284031215611d2557600080fd5b8151801515811461094357600080fd5b600082611d5257634e487b7160e01b600052601260045260246000fd5b500690565b808202811582820484141761094657610946611c0556fea2646970667358221220a36fa1213f53338776d2c9565e9a8b3482299a2c13495ac6aaeebf00585273ff64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a35760003560e01c806373cc48a61161007657806398d35f201161005b57806398d35f2014610161578063bdf95fef14610176578063c327deef1461018957600080fd5b806373cc48a61461010d5780638da5cb5b1461014e57600080fd5b8063020ed8d3146100a857806313af4035146100bd57806328e7677d146100d0578063440f3d42146100e3575b600080fd5b6100bb6100b6366004611871565b6101b2565b005b6100bb6100cb3660046118a8565b610241565b6100bb6100de366004611871565b610287565b6100f66100f1366004611a9f565b61030e565b604051610104929190611b2a565b60405180910390f35b61013661011b366004611b52565b6003602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610104565b600154610136906001600160a01b031681565b610169610400565b6040516101049190611b6d565b6100f6610184366004611b80565b61048e565b610136610197366004611b52565b6002602052600090815260409020546001600160a01b031681565b6001546001600160a01b031633146101c957600080fd5b60ff8216600081815260026020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386169081179091558251938452908301527ff73c3c226af96b7f1ba666a21b3ceaf2be3ee6a365e3178fd9cd1eaae0075aa891015b60405180910390a15050565b6001546001600160a01b0316331461025857600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001546001600160a01b0316331461029e57600080fd5b60ff8216600081815260036020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386169081179091558251938452908301527f2fcc274c3b72dd483ab201bfa87295e3817e8b9b10693219873b722ca1af00c79101610235565b60606000806000805461032090611bb5565b80601f016020809104026020016040519081016040528092919081815260200182805461034c90611bb5565b80156103995780601f1061036e57610100808354040283529160200191610399565b820191906000526020600020905b81548152906001019060200180831161037c57829003601f168201915b5050505050905060005b85518110156103f65760006103d28783815181106103c3576103c3611bef565b602002602001015184886104a5565b61010081015160a090910151945092508190506103ee81611c1b565b9150506103a3565b5091509250929050565b6000805461040d90611bb5565b80601f016020809104026020016040519081016040528092919081815260200182805461043990611bb5565b80156104865780601f1061045b57610100808354040283529160200191610486565b820191906000526020600020905b81548152906001019060200180831161046957829003601f168201915b505050505081565b6060600061049c834261030e565b91509150915091565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c082019290925260e081018290526101008101829052610120810191909152835161050390610647565b90506000610515828360000151610789565b604083015190915060ff1661052b8260006108e6565b14610573578082604001516040517fe861b2bd00000000000000000000000000000000000000000000000000000000815260040161056a929190611c34565b60405180910390fd5b6101208201819052608082015160009084900360030b12156105d75760808201516040517fa784f87e00000000000000000000000000000000000000000000000000000000815263ffffffff9182166004820152908416602482015260440161056a565b60a0820151600090840360030b12156106325760a08201516040517fbd41036a00000000000000000000000000000000000000000000000000000000815263ffffffff9182166004820152908416602482015260440161056a565b61063e8183878761094c565b505b9392505050565b604080516101408101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e082018190526101008201819052610120820152906106a2908390610a16565b61ffff1681526106b3826002610a3e565b60ff1660208201526106c6826003610a3e565b60ff1660408201526106d9826004610a62565b63ffffffff90811660608301526106f5908390600890610a6216565b63ffffffff9081166080830152610711908390600c90610a6216565b63ffffffff90811660a083015261072d908390601090610a1616565b61ffff1660c0820152610741826012610a8c565b60e082018190525161077e90610758906012611c59565b8260e00151516012855161076c9190611c6c565b6107769190611c6c565b849190610aaf565b610100820152919050565b6060600061079684610b31565b90505b805151602082015110156108df57606081015161ffff166001146107f55760608101516040517f98a5f31a00000000000000000000000000000000000000000000000000000000815261ffff909116600482015260240161056a565b815160000361080e5761080781610b8f565b9150610878565b6020810151815161081e91610bb0565b8251141580610841575080516020820151835161083f928592600092610c0a565b155b15610878576040517fcbceee6f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8261ffff16816040015161ffff16146108d15760408082015190517fa6ff8a8a00000000000000000000000000000000000000000000000000000000815261ffff9182166004820152908416602482015260440161056a565b6108da81610c2d565b610799565b5092915050565b6000805b835183106108fa576108fa611c7f565b60006109068585610a3e565b60ff169050610916816001611c59565b6109209085611c59565b9350806000036109305750610943565b61093b600183611c59565b9150506108ea565b90505b92915050565b60e083015161095c908590610d15565b6109995760e08301516040517feaafc59b00000000000000000000000000000000000000000000000000000000815261056a918691600401611c95565b60006109a58282610d72565b9050602b61ffff16816040015161ffff16036109cb576109c6848483610dd3565b610a0f565b603061ffff16816040015161ffff16036109ea576109c6848483610ec0565b60408082015190516361529e8760e01b815261ffff909116600482015260240161056a565b5050505050565b8151600090610a26836002611c59565b1115610a3157600080fd5b50016002015161ffff1690565b6000828281518110610a5257610a52611bef565b016020015160f81c905092915050565b8151600090610a72836004611c59565b1115610a7d57600080fd5b50016004015163ffffffff1690565b60606000610a9a8484610bb0565b9050610aa7848483610aaf565b949350505050565b8251606090610abe8385611c59565b1115610ac957600080fd5b60008267ffffffffffffffff811115610ae457610ae46118c5565b6040519080825280601f01601f191660200182016040528015610b0e576020820181803683370190505b50905060208082019086860101610b26828287610f88565b509095945050505050565b610b7f6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b6109468261010001516000610d72565b6020810151815160609161094691610ba79082610bb0565b84519190610aaf565b6000815b83518110610bc457610bc4611c7f565b6000610bd08583610a3e565b60ff169050610be0816001611c59565b610bea9083611c59565b915080600003610bfa5750610c00565b50610bb4565b610aa78382611c6c565b6000610c17848484610fde565b610c22878785610fde565b149695505050505050565b60c08101516020820181905281515111610c445750565b6000610c5882600001518360200151610bb0565b8260200151610c679190611c59565b8251909150610c769082610a16565b61ffff166040830152610c8a600282611c59565b8251909150610c999082610a16565b61ffff166060830152610cad600282611c59565b8251909150610cbc9082610a62565b63ffffffff166080830152610cd2600482611c59565b8251909150600090610ce49083610a16565b61ffff169050610cf5600283611c59565b60a084018190529150610d088183611c59565b60c0909301929092525050565b60008080610d2385826108e6565b90506000610d328560006108e6565b90505b80821115610d5b57610d478684611002565b925081610d5381611cc3565b925050610d35565b610d688684876000611026565b9695505050505050565b610dc06040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261094681610c2d565b60208101516000610de385610b31565b90505b80515160208201511015610ea057604081015161ffff16603014610e295760408082015190516361529e8760e01b815261ffff909116600482015260240161056a565b6000610e348261105b565b90506000610e4f60008351846110779092919063ffffffff16565b9050610e5d81838989611115565b15610e9057610e728760e00151868385611254565b15610e805750505050505050565b60c08501849052610e9085610c2d565b5050610e9b81610c2d565b610de6565b508360e001516040516306cde0f360e01b815260040161056a9190611b6d565b80515160208201511015610f69576000610ed982610b8f565b9050610ef28460e001518261139190919063ffffffff16565b610f17578360e0015181604051636b80573f60e11b815260040161056a929190611c95565b6000610f228361105b565b90506000610f3d60008351846110779092919063ffffffff16565b9050610f4b81838888611115565b15610f5857505050505050565b505050610f6481610c2d565b610ec0565b8260e001516040516306cde0f360e01b815260040161056a9190611b6d565b60208110610fc05781518352610f9f602084611c59565b9250610fac602083611c59565b9150610fb9602082611c6c565b9050610f88565b905182516020929092036101000a6000190180199091169116179052565b8251600090610fed8385611c59565b1115610ff857600080fd5b5091016020012090565b600061100e8383610a3e565b60ff1661101c836001611c59565b6109439190611c59565b600061103f838384865161103a9190611c6c565b610fde565b611051868687895161103a9190611c6c565b1495945050505050565b60a081015160c082015160609161094691610ba7908290611c6c565b60408051608081018252600080825260208201819052918101919091526060808201526110af6110a8600085611c59565b8590610a16565b61ffff1681526110ca6110c3600285611c59565b8590610a3e565b60ff1660208201526110e06110c3600385611c59565b60ff1660408201526111096110f6600485611c59565b611101600485611c6c565b869190610aaf565b60608201529392505050565b6000846020015160ff1660031461112e57506000610aa7565b826020015160ff16856040015160ff161461114b57506000610aa7565b6000611156856113af565b90508360c0015161ffff168161ffff1614611175576000915050610aa7565b85516101001660000361118c576000915050610aa7565b60408087015160ff166000908152600260205220546001600160a01b0316806111ba57600092505050610aa7565b835160208501516040517fde8f50a10000000000000000000000000000000000000000000000000000000081526001600160a01b0384169263de8f50a192611208928b929190600401611cda565b602060405180830381865afa158015611225573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112499190611d13565b979650505050505050565b600080611260836113af565b90505b8451516020860151101561138557600061127c86610b8f565b90506112888188611391565b6112a9578681604051636b80573f60e11b815260040161056a929190611c95565b60a086015160c08701516000916112ce916112c5908290611c6c565b89519190611077565b90508261ffff16816000015161ffff16146112ea575050611377565b856040015160ff16816020015160ff1614611306575050611377565b60408051808201909152606081526000602082015261133386518a5161132c9190611c59565b82906115f3565b5061133e818a61166a565b50611349818761166a565b5061136182604001518260000151846060015161168b565b15611373576001945050505050610aa7565b5050505b61138085610c2d565b611263565b50600095945050505050565b60008151835114801561094357506109438360008460008751610c0a565b60006120008251111561141e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4c6f6e67206b657973206e6f74207065726d6974746564000000000000000000604482015260640161056a565b60008060005b8451601f0181101561149357600081602087010151905085518260200111156114595785518290036008026101000390811c901b5b7eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff600882901c81169490940193169190910190602001611424565b506010827fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff000016901c827dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff160191506010817fffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff000016901c817dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff1601905080600883901b0191506020827fffffffff00000000ffffffff00000000ffffffff00000000ffffffff0000000016901c827bffffffff00000000ffffffff00000000ffffffff00000000ffffffff160191506040827fffffffffffffffff0000000000000000ffffffffffffffff000000000000000016901c8277ffffffffffffffff0000000000000000ffffffffffffffff16019150608082901c826fffffffffffffffffffffffffffffffff16019150601082901c61ffff16820191508192505050919050565b604080518082019091526060815260006020820152611613602083611d35565b1561163b57611623602083611d35565b61162e906020611c6c565b6116389083611c59565b91505b60208084018390526040518085526000815290818401018181101561165f57600080fd5b604052509192915050565b60408051808201909152606081526000602082015261094383838451611750565b60ff83166000908152600360205260408120546001600160a01b03166116b357506000610640565b60ff8416600090815260036020526040908190205490517ff7e83aee0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063f7e83aee9061170f9086908690600401611c95565b602060405180830381865afa15801561172c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa79190611d13565b604080518082019091526060815260006020820152825182111561177357600080fd5b83515160006117828483611c59565b905085602001518111156117a4576117a48661179f836002611d57565b611826565b8551805183820160200191600091808511156117be578482525b505050602086015b602086106117fe57805182526117dd602083611c59565b91506117ea602082611c59565b90506117f7602087611c6c565b95506117c6565b51815160001960208890036101000a0190811690199190911617905250849150509392505050565b815161183283836115f3565b5061183d838261166a565b50505050565b803560ff8116811461185457600080fd5b919050565b6001600160a01b038116811461186e57600080fd5b50565b6000806040838503121561188457600080fd5b61188d83611843565b9150602083013561189d81611859565b809150509250929050565b6000602082840312156118ba57600080fd5b813561094381611859565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156118fe576118fe6118c5565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561192d5761192d6118c5565b604052919050565b600082601f83011261194657600080fd5b813567ffffffffffffffff811115611960576119606118c5565b611973601f8201601f1916602001611904565b81815284602083860101111561198857600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f8301126119b657600080fd5b8135602067ffffffffffffffff808311156119d3576119d36118c5565b8260051b6119e2838201611904565b93845285810183019383810190888611156119fc57600080fd5b84880192505b85831015611a9357823584811115611a1a5760008081fd5b88016040818b03601f1901811315611a325760008081fd5b611a3a6118db565b8783013587811115611a4c5760008081fd5b611a5a8d8a83870101611935565b825250908201359086821115611a705760008081fd5b611a7e8c8984860101611935565b81890152845250509184019190840190611a02565b98975050505050505050565b60008060408385031215611ab257600080fd5b823567ffffffffffffffff811115611ac957600080fd5b611ad5858286016119a5565b95602094909401359450505050565b6000815180845260005b81811015611b0a57602081850181015186830182015201611aee565b506000602082860101526020601f19601f83011685010191505092915050565b604081526000611b3d6040830185611ae4565b905063ffffffff831660208301529392505050565b600060208284031215611b6457600080fd5b61094382611843565b6020815260006109436020830184611ae4565b600060208284031215611b9257600080fd5b813567ffffffffffffffff811115611ba957600080fd5b610aa7848285016119a5565b600181811c90821680611bc957607f821691505b602082108103611be957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c2d57611c2d611c05565b5060010190565b604081526000611c476040830185611ae4565b905060ff831660208301529392505050565b8082018082111561094657610946611c05565b8181038181111561094657610946611c05565b634e487b7160e01b600052600160045260246000fd5b604081526000611ca86040830185611ae4565b8281036020840152611cba8185611ae4565b95945050505050565b600081611cd257611cd2611c05565b506000190190565b606081526000611ced6060830186611ae4565b8281036020840152611cff8186611ae4565b90508281036040840152610d688185611ae4565b600060208284031215611d2557600080fd5b8151801515811461094357600080fd5b600082611d5257634e487b7160e01b600052601260045260246000fd5b500690565b808202811582820484141761094657610946611c0556fea2646970667358221220a36fa1213f53338776d2c9565e9a8b3482299a2c13495ac6aaeebf00585273ff64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "constructor": { + "details": "Constructor.", + "params": { + "_anchors": "The binary format RR entries for the root DS records." + } + }, + "setAlgorithm(uint8,address)": { + "details": "Sets the contract address for a signature verification algorithm. Callable only by the owner.", + "params": { + "algo": "The address of the algorithm contract.", + "id": "The algorithm ID" + } + }, + "setDigest(uint8,address)": { + "details": "Sets the contract address for a digest verification algorithm. Callable only by the owner.", + "params": { + "digest": "The address of the digest contract.", + "id": "The digest ID" + } + }, + "verifyRRSet((bytes,bytes)[])": { + "details": "Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain. Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.", + "params": { + "input": "A list of signed RRSets." + }, + "returns": { + "inception": "The inception time of the signed record set.", + "rrs": "The RRData from the last RRSet in the chain." + } + }, + "verifyRRSet((bytes,bytes)[],uint256)": { + "details": "Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain. Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.", + "params": { + "input": "A list of signed RRSets.", + "now": "The Unix timestamp to validate the records at." + }, + "returns": { + "inception": "The inception time of the signed record set.", + "rrs": "The RRData from the last RRSet in the chain." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 6638, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "anchors", + "offset": 0, + "slot": "0", + "type": "t_bytes_storage" + }, + { + "astId": 7615, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "owner", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 6770, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "algorithms", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint8,t_contract(Algorithm)8778)" + }, + { + "astId": 6775, + "contract": "contracts/dnssec-oracle/DNSSECImpl.sol:DNSSECImpl", + "label": "digests", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint8,t_contract(Digest)10619)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(Algorithm)8778": { + "encoding": "inplace", + "label": "contract Algorithm", + "numberOfBytes": "20" + }, + "t_contract(Digest)10619": { + "encoding": "inplace", + "label": "contract Digest", + "numberOfBytes": "20" + }, + "t_mapping(t_uint8,t_contract(Algorithm)8778)": { + "encoding": "mapping", + "key": "t_uint8", + "label": "mapping(uint8 => contract Algorithm)", + "numberOfBytes": "32", + "value": "t_contract(Algorithm)8778" + }, + "t_mapping(t_uint8,t_contract(Digest)10619)": { + "encoding": "mapping", + "key": "t_uint8", + "label": "mapping(uint8 => contract Digest)", + "numberOfBytes": "32", + "value": "t_contract(Digest)10619" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/DummyAlgorithm.json b/solidity/dns-contracts/deployments/sepolia/DummyAlgorithm.json new file mode 100644 index 0000000..e19a094 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/DummyAlgorithm.json @@ -0,0 +1,71 @@ +{ + "address": "0x9f71e0eb3DdaD8187638ba5893Df04a87b463329", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x42f391e4991f7d2a2a3aaae45c6700a74856845ea383aa03bc139e0d0ce9d397", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x9f71e0eb3DdaD8187638ba5893Df04a87b463329", + "transactionIndex": 125, + "gasUsed": "134217", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x2c10cef6db1a05e518f5031fc3323469beb0b07d68a737f5da0f50cf5d324f8e", + "transactionHash": "0x42f391e4991f7d2a2a3aaae45c6700a74856845ea383aa03bc139e0d0ce9d397", + "logs": [], + "blockNumber": 4141618, + "cumulativeGasUsed": "12587290", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements a dummy DNSSEC (signing) algorithm that approves all signatures, for testing.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol\":\"DummyAlgorithm\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n */\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata signature\\n ) external view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xaf6825f9852c69f8e36540821d067b4550dd2263497af9d645309b6a0c457ba6\"},\"contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\n\\n/**\\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\\n * signatures, for testing.\\n */\\ncontract DummyAlgorithm is Algorithm {\\n function verify(\\n bytes calldata,\\n bytes calldata,\\n bytes calldata\\n ) external view override returns (bool) {\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x0df474d4178b1659d2869aefe90ee6680b966d9432c5b28ef388134ea6d67b58\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610177806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004a61003e3660046100a7565b60019695505050505050565b604051901515815260200160405180910390f35b60008083601f84011261007057600080fd5b50813567ffffffffffffffff81111561008857600080fd5b6020830191508360208285010111156100a057600080fd5b9250929050565b600080600080600080606087890312156100c057600080fd5b863567ffffffffffffffff808211156100d857600080fd5b6100e48a838b0161005e565b909850965060208901359150808211156100fd57600080fd5b6101098a838b0161005e565b9096509450604089013591508082111561012257600080fd5b5061012f89828a0161005e565b979a969950949750929593949250505056fea26469706673582212201d6169f54d5644e6220fe6e528677b0fc01f94f6ab546738c10ff226848cce1b64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004a61003e3660046100a7565b60019695505050505050565b604051901515815260200160405180910390f35b60008083601f84011261007057600080fd5b50813567ffffffffffffffff81111561008857600080fd5b6020830191508360208285010111156100a057600080fd5b9250929050565b600080600080600080606087890312156100c057600080fd5b863567ffffffffffffffff808211156100d857600080fd5b6100e48a838b0161005e565b909850965060208901359150808211156100fd57600080fd5b6101098a838b0161005e565b9096509450604089013591508082111561012257600080fd5b5061012f89828a0161005e565b979a969950949750929593949250505056fea26469706673582212201d6169f54d5644e6220fe6e528677b0fc01f94f6ab546738c10ff226848cce1b64736f6c63430008110033", + "devdoc": { + "details": "Implements a dummy DNSSEC (signing) algorithm that approves all signatures, for testing.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/DummyDigest.json b/solidity/dns-contracts/deployments/sepolia/DummyDigest.json new file mode 100644 index 0000000..565879d --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/DummyDigest.json @@ -0,0 +1,66 @@ +{ + "address": "0x6BB46Ad53880e666C10441a5df81FdAf178E3014", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0xe6e95e4d687dbdd9e6e1dcd5a877bf9f4f7fe7c6f3ee1cd285b7719609128897", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x6BB46Ad53880e666C10441a5df81FdAf178E3014", + "transactionIndex": 269, + "gasUsed": "123877", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x04dab168221b5c2c70fc140fe7f83ca80f3e4827c5144cc793b21f9df01e1015", + "transactionHash": "0xe6e95e4d687dbdd9e6e1dcd5a877bf9f4f7fe7c6f3ee1cd285b7719609128897", + "logs": [], + "blockNumber": 4141621, + "cumulativeGasUsed": "19866539", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements a dummy DNSSEC digest that approves all hashes, for testing.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/digests/DummyDigest.sol\":\"DummyDigest\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC digest.\\n */\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(\\n bytes calldata data,\\n bytes calldata hash\\n ) external pure virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x8ea926b2db0578c4ad7fce4582fc0f6f0f9efee8dca2085dbdb9984f18941e28\"},\"contracts/dnssec-oracle/digests/DummyDigest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Digest.sol\\\";\\n\\n/**\\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\\n */\\ncontract DummyDigest is Digest {\\n function verify(\\n bytes calldata,\\n bytes calldata\\n ) external pure override returns (bool) {\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x17c0c424aa79b138b918234d4d1c9b95bebad1e26e37c651628a61ef389d75e6\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610147806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004861003e3660046100a5565b6001949350505050565b604051901515815260200160405180910390f35b60008083601f84011261006e57600080fd5b50813567ffffffffffffffff81111561008657600080fd5b60208301915083602082850101111561009e57600080fd5b9250929050565b600080600080604085870312156100bb57600080fd5b843567ffffffffffffffff808211156100d357600080fd5b6100df8883890161005c565b909650945060208701359150808211156100f857600080fd5b506101058782880161005c565b9598949750955050505056fea2646970667358221220a959cf756a6d6f65fdf946b8ea188d413eae01a3fa027905c50b03b966d25ef764736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004861003e3660046100a5565b6001949350505050565b604051901515815260200160405180910390f35b60008083601f84011261006e57600080fd5b50813567ffffffffffffffff81111561008657600080fd5b60208301915083602082850101111561009e57600080fd5b9250929050565b600080600080604085870312156100bb57600080fd5b843567ffffffffffffffff808211156100d357600080fd5b6100df8883890161005c565b909650945060208701359150808211156100f857600080fd5b506101058782880161005c565b9598949750955050505056fea2646970667358221220a959cf756a6d6f65fdf946b8ea188d413eae01a3fa027905c50b03b966d25ef764736f6c63430008110033", + "devdoc": { + "details": "Implements a dummy DNSSEC digest that approves all hashes, for testing.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/DummyOracle.json b/solidity/dns-contracts/deployments/sepolia/DummyOracle.json new file mode 100644 index 0000000..47a3a91 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/DummyOracle.json @@ -0,0 +1,95 @@ +{ + "address": "0x10E7e7D64d7dA687f7DcF8443Df58A0415329b15", + "abi": [ + { + "inputs": [ + { + "internalType": "int256", + "name": "_value", + "type": "int256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "latestAnswer", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int256", + "name": "_value", + "type": "int256" + } + ], + "name": "set", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xa34a20651d778cbb32a1af23257d589a65e378c7a1e5c2fba7304d15966991ba", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x10E7e7D64d7dA687f7DcF8443Df58A0415329b15", + "transactionIndex": 151, + "gasUsed": "114029", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xa00d7f57cf9d2a122b629ef47904b56ccb2f087fadd90de9e234bef0775b32cf", + "transactionHash": "0xa34a20651d778cbb32a1af23257d589a65e378c7a1e5c2fba7304d15966991ba", + "logs": [], + "blockNumber": 3790176, + "cumulativeGasUsed": "29971655", + "status": 1, + "byzantium": true + }, + "args": [ + "160000000000" + ], + "numDeployments": 1, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"_value\",\"type\":\"int256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"_value\",\"type\":\"int256\"}],\"name\":\"set\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/DummyOracle.sol\":\"DummyOracle\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/ethregistrar/DummyOracle.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ncontract DummyOracle {\\n int256 value;\\n\\n constructor(int256 _value) public {\\n set(_value);\\n }\\n\\n function set(int256 _value) public {\\n value = _value;\\n }\\n\\n function latestAnswer() public view returns (int256) {\\n return value;\\n }\\n}\\n\",\"keccak256\":\"0x8f0d88c42c074c3fb80710f7639cb455a582fa96629e26a974dd6a19c15678ff\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161011138038061011183398101604081905261002f9161003e565b61003881600055565b50610057565b60006020828403121561005057600080fd5b5051919050565b60ac806100656000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806350d25bcd146037578063e5c19b2d14604c575b600080fd5b60005460405190815260200160405180910390f35b605c6057366004605e565b600055565b005b600060208284031215606f57600080fd5b503591905056fea2646970667358221220c9677f45270b9ac03675a2089e9811608e10c406f30909f69dc2348311f7468264736f6c63430008110033", + "deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060325760003560e01c806350d25bcd146037578063e5c19b2d14604c575b600080fd5b60005460405190815260200160405180910390f35b605c6057366004605e565b600055565b005b600060208284031215606f57600080fd5b503591905056fea2646970667358221220c9677f45270b9ac03675a2089e9811608e10c406f30909f69dc2348311f7468264736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 11471, + "contract": "contracts/ethregistrar/DummyOracle.sol:DummyOracle", + "label": "value", + "offset": 0, + "slot": "0", + "type": "t_int256" + } + ], + "types": { + "t_int256": { + "encoding": "inplace", + "label": "int256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/ENSRegistry.json b/solidity/dns-contracts/deployments/sepolia/ENSRegistry.json new file mode 100644 index 0000000..ccbec44 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/ENSRegistry.json @@ -0,0 +1,420 @@ +{ + "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_old", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NewOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "NewResolver", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "NewTTL", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "old", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "recordExists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "resolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "ttl", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x3a2e7874ae2b5a081b44ea944f46fed95dfdf1dec6939f4b71081c9e9ffa43a5", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "transactionIndex": 72, + "gasUsed": "785195", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x30130fc8a318c57156306acaf6c5b016fdb6b9dfed00560a92dd360ec346a964", + "transactionHash": "0x3a2e7874ae2b5a081b44ea944f46fed95dfdf1dec6939f4b71081c9e9ffa43a5", + "logs": [], + "blockNumber": 3702728, + "cumulativeGasUsed": "7336236", + "status": 1, + "byzantium": true + }, + "args": [ + "0x94f523b8261B815b87EFfCf4d18E6aBeF18d6e4b" + ], + "numDeployments": 1, + "bytecode": "0x608060405234801561001057600080fd5b50604051610d2e380380610d2e83398101604081905261002f91610089565b60008080526020527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb58054336001600160a01b031991821617909155600280549091166001600160a01b03929092169190911790556100b9565b60006020828403121561009b57600080fd5b81516001600160a01b03811681146100b257600080fd5b9392505050565b610c66806100c86000396000f3fe608060405234801561001057600080fd5b50600436106100df5760003560e01c80635b0fc9c31161008c578063b83f866311610066578063b83f8663146101d5578063cf408823146101e8578063e985e9c5146101fb578063f79fe5381461024757600080fd5b80635b0fc9c31461019c5780635ef2c7f0146101af578063a22cb465146101c257600080fd5b806314ab9038116100bd57806314ab90381461014857806316a25cbd1461015d5780631896f70a1461018957600080fd5b80630178b8bf146100e457806302571be31461011457806306ab592314610127575b600080fd5b6100f76100f2366004610a07565b610272565b6040516001600160a01b0390911681526020015b60405180910390f35b6100f7610122366004610a07565b61033b565b61013a610135366004610a38565b6103aa565b60405190815260200161010b565b61015b610156366004610a87565b61047a565b005b61017061016b366004610a07565b610561565b60405167ffffffffffffffff909116815260200161010b565b61015b610197366004610ab7565b61062b565b61015b6101aa366004610ab7565b6106fd565b61015b6101bd366004610adc565b61079f565b61015b6101d0366004610b3b565b6107c1565b6002546100f7906001600160a01b031681565b61015b6101f6366004610b6e565b61082d565b610237610209366004610bc1565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b604051901515815260200161010b565b610237610255366004610a07565b6000908152602081905260409020546001600160a01b0316151590565b6000818152602081905260408120546001600160a01b031661031b576002546040517f0178b8bf000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b0390911690630178b8bf906024015b602060405180830381865afa1580156102f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103159190610bef565b92915050565b6000828152602081905260409020600101546001600160a01b0316610315565b6000818152602081905260408120546001600160a01b03166103a1576002546040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b03909116906302571be3906024016102d4565b61031582610848565b60008381526020819052604081205484906001600160a01b0316338114806103f557506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6103fe57600080fd5b604080516020808201899052818301889052825180830384018152606090920190925280519101206104308186610870565b6040516001600160a01b0386168152869088907fce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e829060200160405180910390a39695505050505050565b60008281526020819052604090205482906001600160a01b0316338114806104c557506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6104ce57600080fd5b60405167ffffffffffffffff8416815284907f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa689060200160405180910390a25050600091825260208290526040909120600101805467ffffffffffffffff909216600160a01b027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff909216919091179055565b6000818152602081905260408120546001600160a01b0316610603576002546040517f16a25cbd000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b03909116906316a25cbd90602401602060405180830381865afa1580156105df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103159190610c13565b600082815260208190526040902060010154600160a01b900467ffffffffffffffff16610315565b60008281526020819052604090205482906001600160a01b03163381148061067657506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61067f57600080fd5b6040516001600160a01b038416815284907f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a09060200160405180910390a25050600091825260208290526040909120600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909216919091179055565b60008281526020819052604090205482906001600160a01b03163381148061074857506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61075157600080fd5b61075b8484610870565b6040516001600160a01b038416815284907fd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d2669060200160405180910390a250505050565b60006107ac8686866103aa565b90506107b98184846108c0565b505050505050565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61083784846106fd565b6108428483836108c0565b50505050565b6000818152602081905260408120546001600160a01b03163081036103155750600092915050565b806001600160a01b0381166108825750305b6000838152602081905260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316179055505050565b505050565b6000838152602081905260409020600101546001600160a01b038381169116146109535760008381526020818152604091829020600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038616908117909155915191825284917f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0910160405180910390a25b60008381526020819052604090206001015467ffffffffffffffff828116600160a01b90920416146108bb576000838152602081815260409182902060010180547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff16600160a01b67ffffffffffffffff861690810291909117909155915191825284917f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa68910160405180910390a2505050565b600060208284031215610a1957600080fd5b5035919050565b6001600160a01b0381168114610a3557600080fd5b50565b600080600060608486031215610a4d57600080fd5b83359250602084013591506040840135610a6681610a20565b809150509250925092565b67ffffffffffffffff81168114610a3557600080fd5b60008060408385031215610a9a57600080fd5b823591506020830135610aac81610a71565b809150509250929050565b60008060408385031215610aca57600080fd5b823591506020830135610aac81610a20565b600080600080600060a08688031215610af457600080fd5b85359450602086013593506040860135610b0d81610a20565b92506060860135610b1d81610a20565b91506080860135610b2d81610a71565b809150509295509295909350565b60008060408385031215610b4e57600080fd5b8235610b5981610a20565b915060208301358015158114610aac57600080fd5b60008060008060808587031215610b8457600080fd5b843593506020850135610b9681610a20565b92506040850135610ba681610a20565b91506060850135610bb681610a71565b939692955090935050565b60008060408385031215610bd457600080fd5b8235610bdf81610a20565b91506020830135610aac81610a20565b600060208284031215610c0157600080fd5b8151610c0c81610a20565b9392505050565b600060208284031215610c2557600080fd5b8151610c0c81610a7156fea26469706673582212200ca228106ebfbcf2a8f9809dd6a6e8feb568201ac730c6e7305d2a35fd19942e64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100df5760003560e01c80635b0fc9c31161008c578063b83f866311610066578063b83f8663146101d5578063cf408823146101e8578063e985e9c5146101fb578063f79fe5381461024757600080fd5b80635b0fc9c31461019c5780635ef2c7f0146101af578063a22cb465146101c257600080fd5b806314ab9038116100bd57806314ab90381461014857806316a25cbd1461015d5780631896f70a1461018957600080fd5b80630178b8bf146100e457806302571be31461011457806306ab592314610127575b600080fd5b6100f76100f2366004610a07565b610272565b6040516001600160a01b0390911681526020015b60405180910390f35b6100f7610122366004610a07565b61033b565b61013a610135366004610a38565b6103aa565b60405190815260200161010b565b61015b610156366004610a87565b61047a565b005b61017061016b366004610a07565b610561565b60405167ffffffffffffffff909116815260200161010b565b61015b610197366004610ab7565b61062b565b61015b6101aa366004610ab7565b6106fd565b61015b6101bd366004610adc565b61079f565b61015b6101d0366004610b3b565b6107c1565b6002546100f7906001600160a01b031681565b61015b6101f6366004610b6e565b61082d565b610237610209366004610bc1565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b604051901515815260200161010b565b610237610255366004610a07565b6000908152602081905260409020546001600160a01b0316151590565b6000818152602081905260408120546001600160a01b031661031b576002546040517f0178b8bf000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b0390911690630178b8bf906024015b602060405180830381865afa1580156102f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103159190610bef565b92915050565b6000828152602081905260409020600101546001600160a01b0316610315565b6000818152602081905260408120546001600160a01b03166103a1576002546040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b03909116906302571be3906024016102d4565b61031582610848565b60008381526020819052604081205484906001600160a01b0316338114806103f557506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6103fe57600080fd5b604080516020808201899052818301889052825180830384018152606090920190925280519101206104308186610870565b6040516001600160a01b0386168152869088907fce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e829060200160405180910390a39695505050505050565b60008281526020819052604090205482906001600160a01b0316338114806104c557506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6104ce57600080fd5b60405167ffffffffffffffff8416815284907f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa689060200160405180910390a25050600091825260208290526040909120600101805467ffffffffffffffff909216600160a01b027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff909216919091179055565b6000818152602081905260408120546001600160a01b0316610603576002546040517f16a25cbd000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b03909116906316a25cbd90602401602060405180830381865afa1580156105df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103159190610c13565b600082815260208190526040902060010154600160a01b900467ffffffffffffffff16610315565b60008281526020819052604090205482906001600160a01b03163381148061067657506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61067f57600080fd5b6040516001600160a01b038416815284907f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a09060200160405180910390a25050600091825260208290526040909120600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909216919091179055565b60008281526020819052604090205482906001600160a01b03163381148061074857506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61075157600080fd5b61075b8484610870565b6040516001600160a01b038416815284907fd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d2669060200160405180910390a250505050565b60006107ac8686866103aa565b90506107b98184846108c0565b505050505050565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61083784846106fd565b6108428483836108c0565b50505050565b6000818152602081905260408120546001600160a01b03163081036103155750600092915050565b806001600160a01b0381166108825750305b6000838152602081905260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316179055505050565b505050565b6000838152602081905260409020600101546001600160a01b038381169116146109535760008381526020818152604091829020600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038616908117909155915191825284917f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0910160405180910390a25b60008381526020819052604090206001015467ffffffffffffffff828116600160a01b90920416146108bb576000838152602081815260409182902060010180547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff16600160a01b67ffffffffffffffff861690810291909117909155915191825284917f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa68910160405180910390a2505050565b600060208284031215610a1957600080fd5b5035919050565b6001600160a01b0381168114610a3557600080fd5b50565b600080600060608486031215610a4d57600080fd5b83359250602084013591506040840135610a6681610a20565b809150509250925092565b67ffffffffffffffff81168114610a3557600080fd5b60008060408385031215610a9a57600080fd5b823591506020830135610aac81610a71565b809150509250929050565b60008060408385031215610aca57600080fd5b823591506020830135610aac81610a20565b600080600080600060a08688031215610af457600080fd5b85359450602086013593506040860135610b0d81610a20565b92506060860135610b1d81610a20565b91506080860135610b2d81610a71565b809150509295509295909350565b60008060408385031215610b4e57600080fd5b8235610b5981610a20565b915060208301358015158114610aac57600080fd5b60008060008060808587031215610b8457600080fd5b843593506020850135610b9681610a20565b92506040850135610ba681610a20565b91506060850135610bb681610a71565b939692955090935050565b60008060408385031215610bd457600080fd5b8235610bdf81610a20565b91506020830135610aac81610a20565b600060208284031215610c0157600080fd5b8151610c0c81610a20565b9392505050565b600060208284031215610c2557600080fd5b8151610c0c81610a7156fea26469706673582212200ca228106ebfbcf2a8f9809dd6a6e8feb568201ac730c6e7305d2a35fd19942e64736f6c63430008110033" +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/ETHRegistrarController.json b/solidity/dns-contracts/deployments/sepolia/ETHRegistrarController.json new file mode 100644 index 0000000..5972307 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/ETHRegistrarController.json @@ -0,0 +1,750 @@ +{ + "address": "0xFED6a969AaA60E4961FCD3EBF1A2e8913ac65B72", + "abi": [ + { + "inputs": [ + { + "internalType": "contract BaseRegistrarImplementation", + "name": "_base", + "type": "address" + }, + { + "internalType": "contract IPriceOracle", + "name": "_prices", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minCommitmentAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxCommitmentAge", + "type": "uint256" + }, + { + "internalType": "contract ReverseRegistrar", + "name": "_reverseRegistrar", + "type": "address" + }, + { + "internalType": "contract INameWrapper", + "name": "_nameWrapper", + "type": "address" + }, + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "CommitmentTooNew", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "CommitmentTooOld", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "DurationTooShort", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientValue", + "type": "error" + }, + { + "inputs": [], + "name": "MaxCommitmentAgeTooHigh", + "type": "error" + }, + { + "inputs": [], + "name": "MaxCommitmentAgeTooLow", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameNotAvailable", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverRequiredWhenDataSupplied", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "UnexpiredCommitmentExists", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "baseCost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "premium", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRenewed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "MIN_REGISTRATION_DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "available", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "commit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "commitments", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "bool", + "name": "reverseRecord", + "type": "bool" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "name": "makeCommitment", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "maxCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nameWrapper", + "outputs": [ + { + "internalType": "contract INameWrapper", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "prices", + "outputs": [ + { + "internalType": "contract IPriceOracle", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "recoverFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "bool", + "name": "reverseRecord", + "type": "bool" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "rentPrice", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "base", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "premium", + "type": "uint256" + } + ], + "internalType": "struct IPriceOracle.Price", + "name": "price", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "reverseRegistrar", + "outputs": [ + { + "internalType": "contract ReverseRegistrar", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "valid", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x842b96cea2171ff612001f026b252a880b2c23332c1f6112ec692fb9c6fbccc2", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0xFED6a969AaA60E4961FCD3EBF1A2e8913ac65B72", + "transactionIndex": 72, + "gasUsed": "1771825", + "logsBloom": "0x00000000000002000000000000000000000000000000200000800000000000000000000000000000000000000000000000000002000010000000000000000000000000000000000000000000008000000001000000000000000008000080000000000000020000000000100000000800000002000000000000000000000002400000210000000000000000000000000000000000000010200000000000004000002000000000040008000019000000000000000000000000008000040000000000000000000000000000000000005040000000000000000400000000000020000000000000000000000020000100000000000000001000000000000000000000", + "blockHash": "0x12d41439f68bb1d4eb1b323ce22c9257f85f214ec6a4ff53e7c68d2a5c4664e2", + "transactionHash": "0x842b96cea2171ff612001f026b252a880b2c23332c1f6112ec692fb9c6fbccc2", + "logs": [ + { + "transactionIndex": 72, + "blockNumber": 3790244, + "transactionHash": "0x842b96cea2171ff612001f026b252a880b2c23332c1f6112ec692fb9c6fbccc2", + "address": "0xFED6a969AaA60E4961FCD3EBF1A2e8913ac65B72", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8" + ], + "data": "0x", + "logIndex": 97, + "blockHash": "0x12d41439f68bb1d4eb1b323ce22c9257f85f214ec6a4ff53e7c68d2a5c4664e2" + }, + { + "transactionIndex": 72, + "blockNumber": 3790244, + "transactionHash": "0x842b96cea2171ff612001f026b252a880b2c23332c1f6112ec692fb9c6fbccc2", + "address": "0xA0a1AbcDAe1a2a4A2EF8e9113Ff0e02DD81DC0C6", + "topics": [ + "0x6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e92", + "0x000000000000000000000000fed6a969aaa60e4961fcd3ebf1a2e8913ac65b72", + "0x7661589aea842197032e762e8f0a927a61f732c0235a27b33ddcdf27c050c519" + ], + "data": "0x", + "logIndex": 98, + "blockHash": "0x12d41439f68bb1d4eb1b323ce22c9257f85f214ec6a4ff53e7c68d2a5c4664e2" + }, + { + "transactionIndex": 72, + "blockNumber": 3790244, + "transactionHash": "0x842b96cea2171ff612001f026b252a880b2c23332c1f6112ec692fb9c6fbccc2", + "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "topics": [ + "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", + "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2", + "0xbfb76a16c3870a1757f8cacff8a15cce937fbb7fd09a9877dea0457abe6ebd31" + ], + "data": "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8", + "logIndex": 99, + "blockHash": "0x12d41439f68bb1d4eb1b323ce22c9257f85f214ec6a4ff53e7c68d2a5c4664e2" + } + ], + "blockNumber": 3790244, + "cumulativeGasUsed": "13921997", + "status": 1, + "byzantium": true + }, + "args": [ + "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85", + "0x6810dbce73c67506f785a225f818b30d8f209aab", + 60, + 86400, + "0xA0a1AbcDAe1a2a4A2EF8e9113Ff0e02DD81DC0C6", + "0x0635513f179D50A207757E05759CbD106d7dFcE8", + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "numDeployments": 1, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract BaseRegistrarImplementation\",\"name\":\"_base\",\"type\":\"address\"},{\"internalType\":\"contract IPriceOracle\",\"name\":\"_prices\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_minCommitmentAge\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxCommitmentAge\",\"type\":\"uint256\"},{\"internalType\":\"contract ReverseRegistrar\",\"name\":\"_reverseRegistrar\",\"type\":\"address\"},{\"internalType\":\"contract INameWrapper\",\"name\":\"_nameWrapper\",\"type\":\"address\"},{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"CommitmentTooNew\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"CommitmentTooOld\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"DurationTooShort\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxCommitmentAgeTooHigh\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxCommitmentAgeTooLow\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NameNotAvailable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverRequiredWhenDataSupplied\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"UnexpiredCommitmentExists\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"baseCost\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameRenewed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MIN_REGISTRATION_DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"available\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"commit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"commitments\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"bool\",\"name\":\"reverseRecord\",\"type\":\"bool\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"name\":\"makeCommitment\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxCommitmentAge\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minCommitmentAge\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nameWrapper\",\"outputs\":[{\"internalType\":\"contract INameWrapper\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"prices\",\"outputs\":[{\"internalType\":\"contract IPriceOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"recoverFunds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"bool\",\"name\":\"reverseRecord\",\"type\":\"bool\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"renew\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"rentPrice\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"base\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"}],\"internalType\":\"struct IPriceOracle.Price\",\"name\":\"price\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"reverseRegistrar\",\"outputs\":[{\"internalType\":\"contract ReverseRegistrar\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"valid\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"A registrar controller for registering and renewing names at fixed cost.\",\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"recoverFunds(address,address,uint256)\":{\"details\":\"The contract is Ownable and only the owner can call the recover function.\",\"params\":{\"_amount\":\"The amount of tokens to recover.\",\"_to\":\"The address to send the tokens to.\",\"_token\":\"The address of the ERC20 token to recover\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"recoverFunds(address,address,uint256)\":{\"notice\":\"Recover ERC20 tokens sent to the contract by mistake.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/ETHRegistrarController.sol\":\"ETHRegistrarController\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6392f2cfe3a5ee802227fe7a2dfd47096d881aec89bddd214b35c5b46d3cd941\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/ERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721.sol\\\";\\nimport \\\"./IERC721Receiver.sol\\\";\\nimport \\\"./extensions/IERC721Metadata.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\nimport \\\"../../utils/Strings.sol\\\";\\nimport \\\"../../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\n * {ERC721Enumerable}.\\n */\\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\\n using Address for address;\\n using Strings for uint256;\\n\\n // Token name\\n string private _name;\\n\\n // Token symbol\\n string private _symbol;\\n\\n // Mapping from token ID to owner address\\n mapping(uint256 => address) private _owners;\\n\\n // Mapping owner address to token count\\n mapping(address => uint256) private _balances;\\n\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) private _tokenApprovals;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IERC721).interfaceId ||\\n interfaceId == type(IERC721Metadata).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721-balanceOf}.\\n */\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\n return _balances[owner];\\n }\\n\\n /**\\n * @dev See {IERC721-ownerOf}.\\n */\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\n address owner = _ownerOf(tokenId);\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n _requireMinted(tokenId);\\n\\n string memory baseURI = _baseURI();\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\n }\\n\\n /**\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\n * by default, can be overridden in child contracts.\\n */\\n function _baseURI() internal view virtual returns (string memory) {\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual override {\\n address owner = ERC721.ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\n _requireMinted(tokenId);\\n\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC721-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC721-isApprovedForAll}.\\n */\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[owner][operator];\\n }\\n\\n /**\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n _safeTransfer(from, to, tokenId, data);\\n }\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\n *\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeTransfer(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) internal virtual {\\n _transfer(from, to, tokenId);\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n }\\n\\n /**\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\n }\\n\\n /**\\n * @dev Returns whether `tokenId` exists.\\n *\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\n *\\n * Tokens start existing when they are minted (`_mint`),\\n * and stop existing when they are burned (`_burn`).\\n */\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\n return _ownerOf(tokenId) != address(0);\\n }\\n\\n /**\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\n address owner = ERC721.ownerOf(tokenId);\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\n }\\n\\n /**\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\n _safeMint(to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\n */\\n function _safeMint(\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) internal virtual {\\n _mint(to, tokenId);\\n require(\\n _checkOnERC721Received(address(0), to, tokenId, data),\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\n );\\n }\\n\\n /**\\n * @dev Mints `tokenId` and transfers it to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - `to` cannot be the zero address.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _mint(address to, uint256 tokenId) internal virtual {\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n _beforeTokenTransfer(address(0), to, tokenId, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _burn(uint256 tokenId) internal virtual {\\n address owner = ERC721.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\n }\\n\\n /**\\n * @dev Transfers `tokenId` from `from` to `to`.\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _transfer(\\n address from,\\n address to,\\n uint256 tokenId\\n ) internal virtual {\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, tokenId, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(\\n address owner,\\n address operator,\\n bool approved\\n ) internal virtual {\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Reverts if the `tokenId` has not been minted yet.\\n */\\n function _requireMinted(uint256 tokenId) internal view virtual {\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\n }\\n\\n /**\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\n * The call is not executed if the target address is not a contract.\\n *\\n * @param from address representing the previous owner of the given token ID\\n * @param to target address that will receive the tokens\\n * @param tokenId uint256 ID of the token to be transferred\\n * @param data bytes optional data to send along with the call\\n * @return bool whether the call correctly returned the expected magic value\\n */\\n function _checkOnERC721Received(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) private returns (bool) {\\n if (to.isContract()) {\\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721Receiver.onERC721Received.selector;\\n } catch (bytes memory reason) {\\n if (reason.length == 0) {\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n } else {\\n /// @solidity memory-safe-assembly\\n assembly {\\n revert(add(32, reason), mload(reason))\\n }\\n }\\n }\\n } else {\\n return true;\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256, /* firstTokenId */\\n uint256 batchSize\\n ) internal virtual {\\n if (batchSize > 1) {\\n if (from != address(0)) {\\n _balances[from] -= batchSize;\\n }\\n if (to != address(0)) {\\n _balances[to] += batchSize;\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 firstTokenId,\\n uint256 batchSize\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0xd89f3585b211fc9e3408384a4c4efdc3a93b2f877a3821046fa01c219d35be1b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xab28a56179c1db258c9bf5235b382698cb650debecb51b23d12be9e241374b68\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721Metadata is IERC721 {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\"},\"contracts/ethregistrar/BaseRegistrarImplementation.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/ERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\\n // A map of expiry times\\n mapping(uint256 => uint256) expiries;\\n // The ENS registry\\n ENS public ens;\\n // The namehash of the TLD this registrar owns (eg, .eth)\\n bytes32 public baseNode;\\n // A map of addresses that are authorised to register and renew names.\\n mapping(address => bool) public controllers;\\n uint256 public constant GRACE_PERIOD = 90 days;\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n bytes4 private constant ERC721_ID =\\n bytes4(\\n keccak256(\\\"balanceOf(address)\\\") ^\\n keccak256(\\\"ownerOf(uint256)\\\") ^\\n keccak256(\\\"approve(address,uint256)\\\") ^\\n keccak256(\\\"getApproved(uint256)\\\") ^\\n keccak256(\\\"setApprovalForAll(address,bool)\\\") ^\\n keccak256(\\\"isApprovedForAll(address,address)\\\") ^\\n keccak256(\\\"transferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256,bytes)\\\")\\n );\\n bytes4 private constant RECLAIM_ID =\\n bytes4(keccak256(\\\"reclaim(uint256,address)\\\"));\\n\\n /**\\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\\n * @dev Returns whether the given spender can transfer a given token ID\\n * @param spender address of the spender to query\\n * @param tokenId uint256 ID of the token to be transferred\\n * @return bool whether the msg.sender is approved for the given token ID,\\n * is an operator of the owner, or is the owner of the token\\n */\\n function _isApprovedOrOwner(\\n address spender,\\n uint256 tokenId\\n ) internal view override returns (bool) {\\n address owner = ownerOf(tokenId);\\n return (spender == owner ||\\n getApproved(tokenId) == spender ||\\n isApprovedForAll(owner, spender));\\n }\\n\\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\\\"\\\", \\\"\\\") {\\n ens = _ens;\\n baseNode = _baseNode;\\n }\\n\\n modifier live() {\\n require(ens.owner(baseNode) == address(this));\\n _;\\n }\\n\\n modifier onlyController() {\\n require(controllers[msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Gets the owner of the specified token ID. Names become unowned\\n * when their registration expires.\\n * @param tokenId uint256 ID of the token to query the owner of\\n * @return address currently marked as the owner of the given token ID\\n */\\n function ownerOf(\\n uint256 tokenId\\n ) public view override(IERC721, ERC721) returns (address) {\\n require(expiries[tokenId] > block.timestamp);\\n return super.ownerOf(tokenId);\\n }\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external override onlyOwner {\\n controllers[controller] = true;\\n emit ControllerAdded(controller);\\n }\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external override onlyOwner {\\n controllers[controller] = false;\\n emit ControllerRemoved(controller);\\n }\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external override onlyOwner {\\n ens.setResolver(baseNode, resolver);\\n }\\n\\n // Returns the expiration timestamp of the specified id.\\n function nameExpires(uint256 id) external view override returns (uint256) {\\n return expiries[id];\\n }\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) public view override returns (bool) {\\n // Not available if it's registered here or in its grace period.\\n return expiries[id] + GRACE_PERIOD < block.timestamp;\\n }\\n\\n /**\\n * @dev Register a name.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external override returns (uint256) {\\n return _register(id, owner, duration, true);\\n }\\n\\n /**\\n * @dev Register a name, without modifying the registry.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function registerOnly(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256) {\\n return _register(id, owner, duration, false);\\n }\\n\\n function _register(\\n uint256 id,\\n address owner,\\n uint256 duration,\\n bool updateRegistry\\n ) internal live onlyController returns (uint256) {\\n require(available(id));\\n require(\\n block.timestamp + duration + GRACE_PERIOD >\\n block.timestamp + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] = block.timestamp + duration;\\n if (_exists(id)) {\\n // Name was previously owned, and expired\\n _burn(id);\\n }\\n _mint(owner, id);\\n if (updateRegistry) {\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n emit NameRegistered(id, owner, block.timestamp + duration);\\n\\n return block.timestamp + duration;\\n }\\n\\n function renew(\\n uint256 id,\\n uint256 duration\\n ) external override live onlyController returns (uint256) {\\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\\n require(\\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] += duration;\\n emit NameRenewed(id, expiries[id]);\\n return expiries[id];\\n }\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external override live {\\n require(_isApprovedOrOwner(msg.sender, id));\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view override(ERC721, IERC165) returns (bool) {\\n return\\n interfaceID == INTERFACE_META_ID ||\\n interfaceID == ERC721_ID ||\\n interfaceID == RECLAIM_ID;\\n }\\n}\\n\",\"keccak256\":\"0xaee6eb36aead449d397b86a02e9c63bc46e3ef378d0a62bfd68beaae1150c9d0\"},\"contracts/ethregistrar/ETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport {BaseRegistrarImplementation} from \\\"./BaseRegistrarImplementation.sol\\\";\\nimport {StringUtils} from \\\"./StringUtils.sol\\\";\\nimport {Resolver} from \\\"../resolvers/Resolver.sol\\\";\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {ReverseRegistrar} from \\\"../reverseRegistrar/ReverseRegistrar.sol\\\";\\nimport {ReverseClaimer} from \\\"../reverseRegistrar/ReverseClaimer.sol\\\";\\nimport {IETHRegistrarController, IPriceOracle} from \\\"./IETHRegistrarController.sol\\\";\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {INameWrapper} from \\\"../wrapper/INameWrapper.sol\\\";\\nimport {ERC20Recoverable} from \\\"../utils/ERC20Recoverable.sol\\\";\\n\\nerror CommitmentTooNew(bytes32 commitment);\\nerror CommitmentTooOld(bytes32 commitment);\\nerror NameNotAvailable(string name);\\nerror DurationTooShort(uint256 duration);\\nerror ResolverRequiredWhenDataSupplied();\\nerror UnexpiredCommitmentExists(bytes32 commitment);\\nerror InsufficientValue();\\nerror Unauthorised(bytes32 node);\\nerror MaxCommitmentAgeTooLow();\\nerror MaxCommitmentAgeTooHigh();\\n\\n/**\\n * @dev A registrar controller for registering and renewing names at fixed cost.\\n */\\ncontract ETHRegistrarController is\\n Ownable,\\n IETHRegistrarController,\\n IERC165,\\n ERC20Recoverable,\\n ReverseClaimer\\n{\\n using StringUtils for *;\\n using Address for address;\\n\\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\\n bytes32 private constant ETH_NODE =\\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\\n uint64 private constant MAX_EXPIRY = type(uint64).max;\\n BaseRegistrarImplementation immutable base;\\n IPriceOracle public immutable prices;\\n uint256 public immutable minCommitmentAge;\\n uint256 public immutable maxCommitmentAge;\\n ReverseRegistrar public immutable reverseRegistrar;\\n INameWrapper public immutable nameWrapper;\\n\\n mapping(bytes32 => uint256) public commitments;\\n\\n event NameRegistered(\\n string name,\\n bytes32 indexed label,\\n address indexed owner,\\n uint256 baseCost,\\n uint256 premium,\\n uint256 expires\\n );\\n event NameRenewed(\\n string name,\\n bytes32 indexed label,\\n uint256 cost,\\n uint256 expires\\n );\\n\\n constructor(\\n BaseRegistrarImplementation _base,\\n IPriceOracle _prices,\\n uint256 _minCommitmentAge,\\n uint256 _maxCommitmentAge,\\n ReverseRegistrar _reverseRegistrar,\\n INameWrapper _nameWrapper,\\n ENS _ens\\n ) ReverseClaimer(_ens, msg.sender) {\\n if (_maxCommitmentAge <= _minCommitmentAge) {\\n revert MaxCommitmentAgeTooLow();\\n }\\n\\n if (_maxCommitmentAge > block.timestamp) {\\n revert MaxCommitmentAgeTooHigh();\\n }\\n\\n base = _base;\\n prices = _prices;\\n minCommitmentAge = _minCommitmentAge;\\n maxCommitmentAge = _maxCommitmentAge;\\n reverseRegistrar = _reverseRegistrar;\\n nameWrapper = _nameWrapper;\\n }\\n\\n function rentPrice(\\n string memory name,\\n uint256 duration\\n ) public view override returns (IPriceOracle.Price memory price) {\\n bytes32 label = keccak256(bytes(name));\\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\\n }\\n\\n function valid(string memory name) public pure returns (bool) {\\n return name.strlen() >= 3;\\n }\\n\\n function available(string memory name) public view override returns (bool) {\\n bytes32 label = keccak256(bytes(name));\\n return valid(name) && base.available(uint256(label));\\n }\\n\\n function makeCommitment(\\n string memory name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] calldata data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses\\n ) public pure override returns (bytes32) {\\n bytes32 label = keccak256(bytes(name));\\n if (data.length > 0 && resolver == address(0)) {\\n revert ResolverRequiredWhenDataSupplied();\\n }\\n return\\n keccak256(\\n abi.encode(\\n label,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses\\n )\\n );\\n }\\n\\n function commit(bytes32 commitment) public override {\\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\\n revert UnexpiredCommitmentExists(commitment);\\n }\\n commitments[commitment] = block.timestamp;\\n }\\n\\n function register(\\n string calldata name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] calldata data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses\\n ) public payable override {\\n IPriceOracle.Price memory price = rentPrice(name, duration);\\n if (msg.value < price.base + price.premium) {\\n revert InsufficientValue();\\n }\\n\\n _consumeCommitment(\\n name,\\n duration,\\n makeCommitment(\\n name,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses\\n )\\n );\\n\\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\\n name,\\n owner,\\n duration,\\n resolver,\\n ownerControlledFuses\\n );\\n\\n if (data.length > 0) {\\n _setRecords(resolver, keccak256(bytes(name)), data);\\n }\\n\\n if (reverseRecord) {\\n _setReverseRecord(name, resolver, msg.sender);\\n }\\n\\n emit NameRegistered(\\n name,\\n keccak256(bytes(name)),\\n owner,\\n price.base,\\n price.premium,\\n expires\\n );\\n\\n if (msg.value > (price.base + price.premium)) {\\n payable(msg.sender).transfer(\\n msg.value - (price.base + price.premium)\\n );\\n }\\n }\\n\\n function renew(\\n string calldata name,\\n uint256 duration\\n ) external payable override {\\n bytes32 labelhash = keccak256(bytes(name));\\n uint256 tokenId = uint256(labelhash);\\n IPriceOracle.Price memory price = rentPrice(name, duration);\\n if (msg.value < price.base) {\\n revert InsufficientValue();\\n }\\n uint256 expires = nameWrapper.renew(tokenId, duration);\\n\\n if (msg.value > price.base) {\\n payable(msg.sender).transfer(msg.value - price.base);\\n }\\n\\n emit NameRenewed(name, labelhash, msg.value, expires);\\n }\\n\\n function withdraw() public {\\n payable(owner()).transfer(address(this).balance);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IETHRegistrarController).interfaceId;\\n }\\n\\n /* Internal functions */\\n\\n function _consumeCommitment(\\n string memory name,\\n uint256 duration,\\n bytes32 commitment\\n ) internal {\\n // Require an old enough commitment.\\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\\n revert CommitmentTooNew(commitment);\\n }\\n\\n // If the commitment is too old, or the name is registered, stop\\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\\n revert CommitmentTooOld(commitment);\\n }\\n if (!available(name)) {\\n revert NameNotAvailable(name);\\n }\\n\\n delete (commitments[commitment]);\\n\\n if (duration < MIN_REGISTRATION_DURATION) {\\n revert DurationTooShort(duration);\\n }\\n }\\n\\n function _setRecords(\\n address resolverAddress,\\n bytes32 label,\\n bytes[] calldata data\\n ) internal {\\n // use hardcoded .eth namehash\\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\\n Resolver resolver = Resolver(resolverAddress);\\n resolver.multicallWithNodeCheck(nodehash, data);\\n }\\n\\n function _setReverseRecord(\\n string memory name,\\n address resolver,\\n address owner\\n ) internal {\\n reverseRegistrar.setNameForAddr(\\n msg.sender,\\n owner,\\n resolver,\\n string.concat(name, \\\".eth\\\")\\n );\\n }\\n}\\n\",\"keccak256\":\"0x2ba2cab655f9128ae5c803540b8712be9bdfee1a28b9623a06c02c2435d0ce8b\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/ethregistrar/IETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./IPriceOracle.sol\\\";\\n\\ninterface IETHRegistrarController {\\n function rentPrice(\\n string memory,\\n uint256\\n ) external view returns (IPriceOracle.Price memory);\\n\\n function available(string memory) external returns (bool);\\n\\n function makeCommitment(\\n string memory,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16\\n ) external pure returns (bytes32);\\n\\n function commit(bytes32) external;\\n\\n function register(\\n string calldata,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16\\n ) external payable;\\n\\n function renew(string calldata, uint256) external payable;\\n}\\n\",\"keccak256\":\"0x54575cc2e4245c0ba79e42a58086335ec0522f4cbeb8c92d71b886593c97060e\",\"license\":\"MIT\"},\"contracts/ethregistrar/IPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\ninterface IPriceOracle {\\n struct Price {\\n uint256 base;\\n uint256 premium;\\n }\\n\\n /**\\n * @dev Returns the price to register or renew a name.\\n * @param name The name being registered or renewed.\\n * @param expires When the name presently expires (0 if this is a new registration).\\n * @param duration How long the name is being registered or extended for, in seconds.\\n * @return base premium tuple of base price + premium price\\n */\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (Price calldata);\\n}\\n\",\"keccak256\":\"0x1ec537b4c7f9cc40363b39dcc7ade8c29bf94662e6b01d38e681487637bd577e\",\"license\":\"MIT\"},\"contracts/ethregistrar/StringUtils.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary StringUtils {\\n /**\\n * @dev Returns the length of a given string\\n *\\n * @param s The string to measure the length of\\n * @return The length of the input string\\n */\\n function strlen(string memory s) internal pure returns (uint256) {\\n uint256 len;\\n uint256 i = 0;\\n uint256 bytelength = bytes(s).length;\\n for (len = 0; i < bytelength; len++) {\\n bytes1 b = bytes(s)[i];\\n if (b < 0x80) {\\n i += 1;\\n } else if (b < 0xE0) {\\n i += 2;\\n } else if (b < 0xF0) {\\n i += 3;\\n } else if (b < 0xF8) {\\n i += 4;\\n } else if (b < 0xFC) {\\n i += 5;\\n } else {\\n i += 6;\\n }\\n }\\n return len;\\n }\\n}\\n\",\"keccak256\":\"0x4cc8363a850dc9130c433ee50e7c97e29a45ae5d9bd0808205ac7134b34f24e4\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/resolvers/Resolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"./profiles/IABIResolver.sol\\\";\\nimport \\\"./profiles/IAddressResolver.sol\\\";\\nimport \\\"./profiles/IAddrResolver.sol\\\";\\nimport \\\"./profiles/IContentHashResolver.sol\\\";\\nimport \\\"./profiles/IDNSRecordResolver.sol\\\";\\nimport \\\"./profiles/IDNSZoneResolver.sol\\\";\\nimport \\\"./profiles/IInterfaceResolver.sol\\\";\\nimport \\\"./profiles/INameResolver.sol\\\";\\nimport \\\"./profiles/IPubkeyResolver.sol\\\";\\nimport \\\"./profiles/ITextResolver.sol\\\";\\nimport \\\"./profiles/IExtendedResolver.sol\\\";\\n\\n/**\\n * A generic resolver interface which includes all the functions including the ones deprecated\\n */\\ninterface Resolver is\\n IERC165,\\n IABIResolver,\\n IAddressResolver,\\n IAddrResolver,\\n IContentHashResolver,\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n IInterfaceResolver,\\n INameResolver,\\n IPubkeyResolver,\\n ITextResolver,\\n IExtendedResolver\\n{\\n /* Deprecated events */\\n event ContentChanged(bytes32 indexed node, bytes32 hash);\\n\\n function setApprovalForAll(address, bool) external;\\n\\n function approve(bytes32 node, address delegate, bool approved) external;\\n\\n function isApprovedForAll(address account, address operator) external;\\n\\n function isApprovedFor(\\n address owner,\\n bytes32 node,\\n address delegate\\n ) external;\\n\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external;\\n\\n function setAddr(bytes32 node, address addr) external;\\n\\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\\n\\n function setContenthash(bytes32 node, bytes calldata hash) external;\\n\\n function setDnsrr(bytes32 node, bytes calldata data) external;\\n\\n function setName(bytes32 node, string calldata _name) external;\\n\\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\\n\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external;\\n\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external;\\n\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n /* Deprecated functions */\\n function content(bytes32 node) external view returns (bytes32);\\n\\n function multihash(bytes32 node) external view returns (bytes memory);\\n\\n function setContent(bytes32 node, bytes32 hash) external;\\n\\n function setMultihash(bytes32 node, bytes calldata hash) external;\\n}\\n\",\"keccak256\":\"0xfc77ab6b7c59c3ebfe1c720bdebf9b08c2488ff7ac9501a9aa056c5d6d5b50c5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseClaimer.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\n\\ncontract ReverseClaimer {\\n bytes32 constant ADDR_REVERSE_NODE =\\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n constructor(ENS ens, address claimant) {\\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\\n ens.owner(ADDR_REVERSE_NODE)\\n );\\n reverseRegistrar.claim(claimant);\\n }\\n}\\n\",\"keccak256\":\"0x78a28627241535b595f6fff476a1fa7acc90c80684fe7784734920fc8af6fc22\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/ReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IReverseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"../root/Controllable.sol\\\";\\n\\nabstract contract NameResolver {\\n function setName(bytes32 node, string memory name) public virtual;\\n}\\n\\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\\n\\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n// namehash('addr.reverse')\\n\\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\\n ENS public immutable ens;\\n NameResolver public defaultResolver;\\n\\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\\n event DefaultResolverChanged(NameResolver indexed resolver);\\n\\n /**\\n * @dev Constructor\\n * @param ensAddr The address of the ENS registry.\\n */\\n constructor(ENS ensAddr) {\\n ens = ensAddr;\\n\\n // Assign ownership of the reverse record to our deployer\\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\\n ensAddr.owner(ADDR_REVERSE_NODE)\\n );\\n if (address(oldRegistrar) != address(0x0)) {\\n oldRegistrar.claim(msg.sender);\\n }\\n }\\n\\n modifier authorised(address addr) {\\n require(\\n addr == msg.sender ||\\n controllers[msg.sender] ||\\n ens.isApprovedForAll(addr, msg.sender) ||\\n ownsContract(addr),\\n \\\"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\\\"\\n );\\n _;\\n }\\n\\n function setDefaultResolver(address resolver) public override onlyOwner {\\n require(\\n address(resolver) != address(0),\\n \\\"ReverseRegistrar: Resolver address must not be 0\\\"\\n );\\n defaultResolver = NameResolver(resolver);\\n emit DefaultResolverChanged(NameResolver(resolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claim(address owner) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, address(defaultResolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param addr The reverse record to set\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The resolver of the reverse node\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) public override authorised(addr) returns (bytes32) {\\n bytes32 labelHash = sha3HexAddress(addr);\\n bytes32 reverseNode = keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\\n );\\n emit ReverseClaimed(addr, reverseNode);\\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\\n return reverseNode;\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, resolver);\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the calling account. First updates the resolver to the default reverse\\n * resolver if necessary.\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setName(string memory name) public override returns (bytes32) {\\n return\\n setNameForAddr(\\n msg.sender,\\n msg.sender,\\n address(defaultResolver),\\n name\\n );\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the account provided. Updates the resolver to a designated resolver\\n * Only callable by controllers and authorised users\\n * @param addr The reverse record to set\\n * @param owner The owner of the reverse node\\n * @param resolver The resolver of the reverse node\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) public override returns (bytes32) {\\n bytes32 node = claimForAddr(addr, owner, resolver);\\n NameResolver(resolver).setName(node, name);\\n return node;\\n }\\n\\n /**\\n * @dev Returns the node hash for a given account's reverse records.\\n * @param addr The address to hash\\n * @return The ENS node hash.\\n */\\n function node(address addr) public pure override returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\\n );\\n }\\n\\n /**\\n * @dev An optimised function to compute the sha3 of the lower-case\\n * hexadecimal representation of an Ethereum address.\\n * @param addr The address to hash\\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\\n * input address.\\n */\\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\\n assembly {\\n for {\\n let i := 40\\n } gt(i, 0) {\\n\\n } {\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n }\\n\\n ret := keccak256(0, 40)\\n }\\n }\\n\\n function ownsContract(address addr) internal view returns (bool) {\\n try Ownable(addr).owner() returns (address owner) {\\n return owner == msg.sender;\\n } catch {\\n return false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd57d28e5791b4b44650a00f5ef6c725af53698ec33faeeaa3591f0dbd939559a\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"},\"contracts/utils/ERC20Recoverable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\\n */\\n\\ncontract ERC20Recoverable is Ownable {\\n /**\\n @notice Recover ERC20 tokens sent to the contract by mistake.\\n @dev The contract is Ownable and only the owner can call the recover function.\\n @param _to The address to send the tokens to.\\n@param _token The address of the ERC20 token to recover\\n @param _amount The amount of tokens to recover.\\n */\\n function recoverFunds(\\n address _token,\\n address _to,\\n uint256 _amount\\n ) external onlyOwner {\\n IERC20(_token).transfer(_to, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x793a38091e1f81499a29ddba82c2b2f3cdd07071b81a832886e8e02a45ff352a\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_ETH = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x70310eb67146d7290731c31841399640ac3b6a949eadc6598bc150123d185c57\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101406040523480156200001257600080fd5b506040516200215038038062002150833981016040819052620000359162000222565b80336200004281620001b9565b6040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e260048201526000906001600160a01b038416906302571be390602401602060405180830381865afa158015620000aa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000d09190620002b6565b604051630f41a04d60e11b81526001600160a01b03848116600483015291925090821690631e83409a906024016020604051808303816000875af11580156200011d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001439190620002dd565b5050505084841162000168576040516307cb550760e31b815260040160405180910390fd5b428411156200018a57604051630b4319e560e21b815260040160405180910390fd5b506001600160a01b0395861660805293851660a05260c09290925260e0528216610100521661012052620002f7565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200021f57600080fd5b50565b600080600080600080600060e0888a0312156200023e57600080fd5b87516200024b8162000209565b60208901519097506200025e8162000209565b8096505060408801519450606088015193506080880151620002808162000209565b60a0890151909350620002938162000209565b60c0890151909250620002a68162000209565b8091505092959891949750929550565b600060208284031215620002c957600080fd5b8151620002d68162000209565b9392505050565b600060208284031215620002f057600080fd5b5051919050565b60805160a05160c05160e0516101005161012051611dd16200037f60003960008181610375015281816107e00152610bd501526000818161023801526111e00152600081816103dc01528181610db301526110070152600081816103030152610f9001526000818161041001526109fa015260008181610a2f0152610d220152611dd16000f3fe60806040526004361061015f5760003560e01c80638d839ffe116100c0578063aeb8ce9b11610074578063d3419bf311610059578063d3419bf3146103fe578063f14fcbc814610432578063f2fde38b1461045257600080fd5b8063aeb8ce9b146103aa578063ce1e09c0146103ca57600080fd5b80639791c097116100a55780639791c09714610343578063a8e5fbc014610363578063acf1a8411461039757600080fd5b80638d839ffe146102f15780638da5cb5b1461032557600080fd5b806374694a2b11610117578063839df945116100fc578063839df9451461027257806383e7f6ff1461029f5780638a95b09f146102da57600080fd5b806374694a2b14610213578063808698531461022657600080fd5b80635d3590d5116101485780635d3590d5146101b057806365a69dcf146101d0578063715018a6146101fe57600080fd5b806301ffc9a7146101645780633ccfd60b14610199575b600080fd5b34801561017057600080fd5b5061018461017f366004611421565b610472565b60405190151581526020015b60405180910390f35b3480156101a557600080fd5b506101ae61050b565b005b3480156101bc57600080fd5b506101ae6101cb36600461147f565b610548565b3480156101dc57600080fd5b506101f06101eb3660046115ec565b6105e2565b604051908152602001610190565b34801561020a57600080fd5b506101ae610680565b6101ae6102213660046116ef565b610694565b34801561023257600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610190565b34801561027e57600080fd5b506101f061028d3660046117b9565b60016020526000908152604090205481565b3480156102ab57600080fd5b506102bf6102ba3660046117d2565b6109b0565b60408051825181526020928301519281019290925201610190565b3480156102e657600080fd5b506101f06224ea0081565b3480156102fd57600080fd5b506101f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561033157600080fd5b506000546001600160a01b031661025a565b34801561034f57600080fd5b5061018461035e366004611817565b610b03565b34801561036f57600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b6101ae6103a536600461184c565b610b18565b3480156103b657600080fd5b506101846103c5366004611817565b610cd9565b3480156103d657600080fd5b506101f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561040a57600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b34801561043e57600080fd5b506101ae61044d3660046117b9565b610d9c565b34801561045e57600080fd5b506101ae61046d366004611898565b610e2a565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061050557507fffffffff0000000000000000000000000000000000000000000000000000000082167f612e8c0900000000000000000000000000000000000000000000000000000000145b92915050565b600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015610545573d6000803e3d6000fd5b50565b610550610eb7565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af11580156105b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dc91906118b3565b50505050565b885160208a0120600090841580159061060257506001600160a01b038716155b15610639576040517fd3f605c400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808a8a8a8a8a8a8a8a60405160200161065a9998979695949392919061198b565b604051602081830303815290604052805190602001209150509998505050505050505050565b610688610eb7565b6106926000610f11565b565b60006106d78b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92506109b0915050565b602081015181519192506106ea91611a03565b34101561070a5760405163044044a560e21b815260040160405180910390fd5b6107ad8b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050896107a88e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d8d8d8d8d8d8d8d6105e2565b610f79565b6040517fa40149820000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a40149829061081f908f908f908f908f908e908b90600401611a16565b6020604051808303816000875af115801561083e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108629190611a60565b9050841561088d5761088d878d8d60405161087e929190611a79565b604051809103902088886110fb565b83156108d6576108d68c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508b92503391506111de9050565b896001600160a01b03168c8c6040516108f0929190611a79565b60405180910390207f69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf278e8e8660000151876020015187604051610937959493929190611a89565b60405180910390a3602082015182516109509190611a03565b3411156109a2576020820151825133916108fc9161096e9190611a03565b6109789034611aba565b6040518115909202916000818181858888f193505050501580156109a0573d6000803e3d6000fd5b505b505050505050505050505050565b6040805180820190915260008082526020820152825160208401206040517fd6e4fa86000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03908116916350e9a7159187917f00000000000000000000000000000000000000000000000000000000000000009091169063d6e4fa8690602401602060405180830381865afa158015610a78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9c9190611a60565b866040518463ffffffff1660e01b8152600401610abb93929190611b1d565b6040805180830381865afa158015610ad7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afb9190611b42565b949350505050565b60006003610b1083611292565b101592915050565b60008383604051610b2a929190611a79565b604080519182900382206020601f870181900481028401810190925285835292508291600091610b77919088908890819084018382808284376000920191909152508892506109b0915050565b8051909150341015610b9c5760405163044044a560e21b815260040160405180910390fd5b6040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101839052602481018590526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c475abff906044016020604051808303816000875af1158015610c26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4a9190611a60565b8251909150341115610c9257815133906108fc90610c689034611aba565b6040518115909202916000818181858888f19350505050158015610c90573d6000803e3d6000fd5b505b837f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae88883485604051610cc89493929190611b91565b60405180910390a250505050505050565b80516020820120600090610cec83610b03565b8015610d9557506040517f96e494e8000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906396e494e890602401602060405180830381865afa158015610d71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9591906118b3565b9392505050565b6000818152600160205260409020544290610dd8907f000000000000000000000000000000000000000000000000000000000000000090611a03565b10610e17576040517f0a059d71000000000000000000000000000000000000000000000000000000008152600481018290526024015b60405180910390fd5b6000908152600160205260409020429055565b610e32610eb7565b6001600160a01b038116610eae5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610e0e565b61054581610f11565b6000546001600160a01b031633146106925760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610e0e565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000818152600160205260409020544290610fb5907f000000000000000000000000000000000000000000000000000000000000000090611a03565b1115610ff0576040517f5320bcf900000000000000000000000000000000000000000000000000000000815260048101829052602401610e0e565b600081815260016020526040902054429061102c907f000000000000000000000000000000000000000000000000000000000000000090611a03565b11611066576040517fcb7690d700000000000000000000000000000000000000000000000000000000815260048101829052602401610e0e565b61106f83610cd9565b6110a757826040517f477707e8000000000000000000000000000000000000000000000000000000008152600401610e0e9190611bb8565b6000818152600160205260408120556224ea008210156110f6576040517f9a71997b00000000000000000000000000000000000000000000000000000000815260048101839052602401610e0e565b505050565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301869052825180830384018152606083019384905280519101207fe32954eb0000000000000000000000000000000000000000000000000000000090925285906001600160a01b0382169063e32954eb9061118e90859088908890606401611bcb565b6000604051808303816000875af11580156111ad573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111d59190810190611bee565b50505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637a806d6b338385876040516020016112219190611ced565b6040516020818303038152906040526040518563ffffffff1660e01b815260040161124f9493929190611d2e565b6020604051808303816000875af115801561126e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dc9190611a60565b8051600090819081905b808210156114185760008583815181106112b8576112b8611d6c565b01602001516001600160f81b03191690507f8000000000000000000000000000000000000000000000000000000000000000811015611303576112fc600184611a03565b9250611405565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015611340576112fc600284611a03565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561137d576112fc600384611a03565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156113ba576112fc600484611a03565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156113f7576112fc600584611a03565b611402600684611a03565b92505b508261141081611d82565b93505061129c565b50909392505050565b60006020828403121561143357600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610d9557600080fd5b80356001600160a01b038116811461147a57600080fd5b919050565b60008060006060848603121561149457600080fd5b61149d84611463565b92506114ab60208501611463565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156114fa576114fa6114bb565b604052919050565b600067ffffffffffffffff82111561151c5761151c6114bb565b50601f01601f191660200190565b600082601f83011261153b57600080fd5b813561154e61154982611502565b6114d1565b81815284602083860101111561156357600080fd5b816020850160208301376000918101602001919091529392505050565b60008083601f84011261159257600080fd5b50813567ffffffffffffffff8111156115aa57600080fd5b6020830191508360208260051b85010111156115c557600080fd5b9250929050565b801515811461054557600080fd5b803561ffff8116811461147a57600080fd5b60008060008060008060008060006101008a8c03121561160b57600080fd5b893567ffffffffffffffff8082111561162357600080fd5b61162f8d838e0161152a565b9a5061163d60208d01611463565b995060408c0135985060608c0135975061165960808d01611463565b965060a08c013591508082111561166f57600080fd5b5061167c8c828d01611580565b90955093505060c08a0135611690816115cc565b915061169e60e08b016115da565b90509295985092959850929598565b60008083601f8401126116bf57600080fd5b50813567ffffffffffffffff8111156116d757600080fd5b6020830191508360208285010111156115c557600080fd5b6000806000806000806000806000806101008b8d03121561170f57600080fd5b8a3567ffffffffffffffff8082111561172757600080fd5b6117338e838f016116ad565b909c509a508a915061174760208e01611463565b995060408d0135985060608d0135975061176360808e01611463565b965060a08d013591508082111561177957600080fd5b506117868d828e01611580565b90955093505060c08b013561179a816115cc565b91506117a860e08c016115da565b90509295989b9194979a5092959850565b6000602082840312156117cb57600080fd5b5035919050565b600080604083850312156117e557600080fd5b823567ffffffffffffffff8111156117fc57600080fd5b6118088582860161152a565b95602094909401359450505050565b60006020828403121561182957600080fd5b813567ffffffffffffffff81111561184057600080fd5b610afb8482850161152a565b60008060006040848603121561186157600080fd5b833567ffffffffffffffff81111561187857600080fd5b611884868287016116ad565b909790965060209590950135949350505050565b6000602082840312156118aa57600080fd5b610d9582611463565b6000602082840312156118c557600080fd5b8151610d95816115cc565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b81835260006020808501808196508560051b810191508460005b8781101561197e5782840389528135601e1988360301811261193457600080fd5b8701858101903567ffffffffffffffff81111561195057600080fd5b80360382131561195f57600080fd5b61196a8682846118d0565b9a87019a9550505090840190600101611913565b5091979650505050505050565b60006101008b83526001600160a01b03808c1660208501528a60408501528960608501528089166080850152508060a08401526119cb81840187896118f9565b94151560c0840152505061ffff9190911660e090910152979650505050505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610505576105056119ed565b60a081526000611a2a60a08301888a6118d0565b90506001600160a01b03808716602084015285604084015280851660608401525061ffff83166080830152979650505050505050565b600060208284031215611a7257600080fd5b5051919050565b8183823760009101908152919050565b608081526000611a9d6080830187896118d0565b602083019590955250604081019290925260609091015292915050565b81810381811115610505576105056119ed565b60005b83811015611ae8578181015183820152602001611ad0565b50506000910152565b60008151808452611b09816020860160208601611acd565b601f01601f19169290920160200192915050565b606081526000611b306060830186611af1565b60208301949094525060400152919050565b600060408284031215611b5457600080fd5b6040516040810181811067ffffffffffffffff82111715611b7757611b776114bb565b604052825181526020928301519281019290925250919050565b606081526000611ba56060830186886118d0565b6020830194909452506040015292915050565b602081526000610d956020830184611af1565b838152604060208201526000611be56040830184866118f9565b95945050505050565b60006020808385031215611c0157600080fd5b825167ffffffffffffffff80821115611c1957600080fd5b818501915085601f830112611c2d57600080fd5b815181811115611c3f57611c3f6114bb565b8060051b611c4e8582016114d1565b9182528381018501918581019089841115611c6857600080fd5b86860192505b83831015611ce057825185811115611c865760008081fd5b8601603f81018b13611c985760008081fd5b878101516040611caa61154983611502565b8281528d82848601011115611cbf5760008081fd5b611cce838c8301848701611acd565b85525050509186019190860190611c6e565b9998505050505050505050565b60008251611cff818460208701611acd565b7f2e65746800000000000000000000000000000000000000000000000000000000920191825250600401919050565b60006001600160a01b038087168352808616602084015280851660408401525060806060830152611d626080830184611af1565b9695505050505050565b634e487b7160e01b600052603260045260246000fd5b600060018201611d9457611d946119ed565b506001019056fea26469706673582212207ae2447e86de3ca2bc735ab92d80b5b18a28129026feb199229bbdaf93ed05d564736f6c63430008110033", + "deployedBytecode": "0x60806040526004361061015f5760003560e01c80638d839ffe116100c0578063aeb8ce9b11610074578063d3419bf311610059578063d3419bf3146103fe578063f14fcbc814610432578063f2fde38b1461045257600080fd5b8063aeb8ce9b146103aa578063ce1e09c0146103ca57600080fd5b80639791c097116100a55780639791c09714610343578063a8e5fbc014610363578063acf1a8411461039757600080fd5b80638d839ffe146102f15780638da5cb5b1461032557600080fd5b806374694a2b11610117578063839df945116100fc578063839df9451461027257806383e7f6ff1461029f5780638a95b09f146102da57600080fd5b806374694a2b14610213578063808698531461022657600080fd5b80635d3590d5116101485780635d3590d5146101b057806365a69dcf146101d0578063715018a6146101fe57600080fd5b806301ffc9a7146101645780633ccfd60b14610199575b600080fd5b34801561017057600080fd5b5061018461017f366004611421565b610472565b60405190151581526020015b60405180910390f35b3480156101a557600080fd5b506101ae61050b565b005b3480156101bc57600080fd5b506101ae6101cb36600461147f565b610548565b3480156101dc57600080fd5b506101f06101eb3660046115ec565b6105e2565b604051908152602001610190565b34801561020a57600080fd5b506101ae610680565b6101ae6102213660046116ef565b610694565b34801561023257600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610190565b34801561027e57600080fd5b506101f061028d3660046117b9565b60016020526000908152604090205481565b3480156102ab57600080fd5b506102bf6102ba3660046117d2565b6109b0565b60408051825181526020928301519281019290925201610190565b3480156102e657600080fd5b506101f06224ea0081565b3480156102fd57600080fd5b506101f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561033157600080fd5b506000546001600160a01b031661025a565b34801561034f57600080fd5b5061018461035e366004611817565b610b03565b34801561036f57600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b6101ae6103a536600461184c565b610b18565b3480156103b657600080fd5b506101846103c5366004611817565b610cd9565b3480156103d657600080fd5b506101f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561040a57600080fd5b5061025a7f000000000000000000000000000000000000000000000000000000000000000081565b34801561043e57600080fd5b506101ae61044d3660046117b9565b610d9c565b34801561045e57600080fd5b506101ae61046d366004611898565b610e2a565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061050557507fffffffff0000000000000000000000000000000000000000000000000000000082167f612e8c0900000000000000000000000000000000000000000000000000000000145b92915050565b600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015610545573d6000803e3d6000fd5b50565b610550610eb7565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af11580156105b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dc91906118b3565b50505050565b885160208a0120600090841580159061060257506001600160a01b038716155b15610639576040517fd3f605c400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808a8a8a8a8a8a8a8a60405160200161065a9998979695949392919061198b565b604051602081830303815290604052805190602001209150509998505050505050505050565b610688610eb7565b6106926000610f11565b565b60006106d78b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92506109b0915050565b602081015181519192506106ea91611a03565b34101561070a5760405163044044a560e21b815260040160405180910390fd5b6107ad8b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050896107a88e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d8d8d8d8d8d8d8d6105e2565b610f79565b6040517fa40149820000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a40149829061081f908f908f908f908f908e908b90600401611a16565b6020604051808303816000875af115801561083e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108629190611a60565b9050841561088d5761088d878d8d60405161087e929190611a79565b604051809103902088886110fb565b83156108d6576108d68c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508b92503391506111de9050565b896001600160a01b03168c8c6040516108f0929190611a79565b60405180910390207f69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf278e8e8660000151876020015187604051610937959493929190611a89565b60405180910390a3602082015182516109509190611a03565b3411156109a2576020820151825133916108fc9161096e9190611a03565b6109789034611aba565b6040518115909202916000818181858888f193505050501580156109a0573d6000803e3d6000fd5b505b505050505050505050505050565b6040805180820190915260008082526020820152825160208401206040517fd6e4fa86000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03908116916350e9a7159187917f00000000000000000000000000000000000000000000000000000000000000009091169063d6e4fa8690602401602060405180830381865afa158015610a78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9c9190611a60565b866040518463ffffffff1660e01b8152600401610abb93929190611b1d565b6040805180830381865afa158015610ad7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afb9190611b42565b949350505050565b60006003610b1083611292565b101592915050565b60008383604051610b2a929190611a79565b604080519182900382206020601f870181900481028401810190925285835292508291600091610b77919088908890819084018382808284376000920191909152508892506109b0915050565b8051909150341015610b9c5760405163044044a560e21b815260040160405180910390fd5b6040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101839052602481018590526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c475abff906044016020604051808303816000875af1158015610c26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4a9190611a60565b8251909150341115610c9257815133906108fc90610c689034611aba565b6040518115909202916000818181858888f19350505050158015610c90573d6000803e3d6000fd5b505b837f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae88883485604051610cc89493929190611b91565b60405180910390a250505050505050565b80516020820120600090610cec83610b03565b8015610d9557506040517f96e494e8000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906396e494e890602401602060405180830381865afa158015610d71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9591906118b3565b9392505050565b6000818152600160205260409020544290610dd8907f000000000000000000000000000000000000000000000000000000000000000090611a03565b10610e17576040517f0a059d71000000000000000000000000000000000000000000000000000000008152600481018290526024015b60405180910390fd5b6000908152600160205260409020429055565b610e32610eb7565b6001600160a01b038116610eae5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610e0e565b61054581610f11565b6000546001600160a01b031633146106925760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610e0e565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000818152600160205260409020544290610fb5907f000000000000000000000000000000000000000000000000000000000000000090611a03565b1115610ff0576040517f5320bcf900000000000000000000000000000000000000000000000000000000815260048101829052602401610e0e565b600081815260016020526040902054429061102c907f000000000000000000000000000000000000000000000000000000000000000090611a03565b11611066576040517fcb7690d700000000000000000000000000000000000000000000000000000000815260048101829052602401610e0e565b61106f83610cd9565b6110a757826040517f477707e8000000000000000000000000000000000000000000000000000000008152600401610e0e9190611bb8565b6000818152600160205260408120556224ea008210156110f6576040517f9a71997b00000000000000000000000000000000000000000000000000000000815260048101839052602401610e0e565b505050565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301869052825180830384018152606083019384905280519101207fe32954eb0000000000000000000000000000000000000000000000000000000090925285906001600160a01b0382169063e32954eb9061118e90859088908890606401611bcb565b6000604051808303816000875af11580156111ad573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111d59190810190611bee565b50505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637a806d6b338385876040516020016112219190611ced565b6040516020818303038152906040526040518563ffffffff1660e01b815260040161124f9493929190611d2e565b6020604051808303816000875af115801561126e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dc9190611a60565b8051600090819081905b808210156114185760008583815181106112b8576112b8611d6c565b01602001516001600160f81b03191690507f8000000000000000000000000000000000000000000000000000000000000000811015611303576112fc600184611a03565b9250611405565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015611340576112fc600284611a03565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561137d576112fc600384611a03565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156113ba576112fc600484611a03565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156113f7576112fc600584611a03565b611402600684611a03565b92505b508261141081611d82565b93505061129c565b50909392505050565b60006020828403121561143357600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610d9557600080fd5b80356001600160a01b038116811461147a57600080fd5b919050565b60008060006060848603121561149457600080fd5b61149d84611463565b92506114ab60208501611463565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156114fa576114fa6114bb565b604052919050565b600067ffffffffffffffff82111561151c5761151c6114bb565b50601f01601f191660200190565b600082601f83011261153b57600080fd5b813561154e61154982611502565b6114d1565b81815284602083860101111561156357600080fd5b816020850160208301376000918101602001919091529392505050565b60008083601f84011261159257600080fd5b50813567ffffffffffffffff8111156115aa57600080fd5b6020830191508360208260051b85010111156115c557600080fd5b9250929050565b801515811461054557600080fd5b803561ffff8116811461147a57600080fd5b60008060008060008060008060006101008a8c03121561160b57600080fd5b893567ffffffffffffffff8082111561162357600080fd5b61162f8d838e0161152a565b9a5061163d60208d01611463565b995060408c0135985060608c0135975061165960808d01611463565b965060a08c013591508082111561166f57600080fd5b5061167c8c828d01611580565b90955093505060c08a0135611690816115cc565b915061169e60e08b016115da565b90509295985092959850929598565b60008083601f8401126116bf57600080fd5b50813567ffffffffffffffff8111156116d757600080fd5b6020830191508360208285010111156115c557600080fd5b6000806000806000806000806000806101008b8d03121561170f57600080fd5b8a3567ffffffffffffffff8082111561172757600080fd5b6117338e838f016116ad565b909c509a508a915061174760208e01611463565b995060408d0135985060608d0135975061176360808e01611463565b965060a08d013591508082111561177957600080fd5b506117868d828e01611580565b90955093505060c08b013561179a816115cc565b91506117a860e08c016115da565b90509295989b9194979a5092959850565b6000602082840312156117cb57600080fd5b5035919050565b600080604083850312156117e557600080fd5b823567ffffffffffffffff8111156117fc57600080fd5b6118088582860161152a565b95602094909401359450505050565b60006020828403121561182957600080fd5b813567ffffffffffffffff81111561184057600080fd5b610afb8482850161152a565b60008060006040848603121561186157600080fd5b833567ffffffffffffffff81111561187857600080fd5b611884868287016116ad565b909790965060209590950135949350505050565b6000602082840312156118aa57600080fd5b610d9582611463565b6000602082840312156118c557600080fd5b8151610d95816115cc565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b81835260006020808501808196508560051b810191508460005b8781101561197e5782840389528135601e1988360301811261193457600080fd5b8701858101903567ffffffffffffffff81111561195057600080fd5b80360382131561195f57600080fd5b61196a8682846118d0565b9a87019a9550505090840190600101611913565b5091979650505050505050565b60006101008b83526001600160a01b03808c1660208501528a60408501528960608501528089166080850152508060a08401526119cb81840187896118f9565b94151560c0840152505061ffff9190911660e090910152979650505050505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610505576105056119ed565b60a081526000611a2a60a08301888a6118d0565b90506001600160a01b03808716602084015285604084015280851660608401525061ffff83166080830152979650505050505050565b600060208284031215611a7257600080fd5b5051919050565b8183823760009101908152919050565b608081526000611a9d6080830187896118d0565b602083019590955250604081019290925260609091015292915050565b81810381811115610505576105056119ed565b60005b83811015611ae8578181015183820152602001611ad0565b50506000910152565b60008151808452611b09816020860160208601611acd565b601f01601f19169290920160200192915050565b606081526000611b306060830186611af1565b60208301949094525060400152919050565b600060408284031215611b5457600080fd5b6040516040810181811067ffffffffffffffff82111715611b7757611b776114bb565b604052825181526020928301519281019290925250919050565b606081526000611ba56060830186886118d0565b6020830194909452506040015292915050565b602081526000610d956020830184611af1565b838152604060208201526000611be56040830184866118f9565b95945050505050565b60006020808385031215611c0157600080fd5b825167ffffffffffffffff80821115611c1957600080fd5b818501915085601f830112611c2d57600080fd5b815181811115611c3f57611c3f6114bb565b8060051b611c4e8582016114d1565b9182528381018501918581019089841115611c6857600080fd5b86860192505b83831015611ce057825185811115611c865760008081fd5b8601603f81018b13611c985760008081fd5b878101516040611caa61154983611502565b8281528d82848601011115611cbf5760008081fd5b611cce838c8301848701611acd565b85525050509186019190860190611c6e565b9998505050505050505050565b60008251611cff818460208701611acd565b7f2e65746800000000000000000000000000000000000000000000000000000000920191825250600401919050565b60006001600160a01b038087168352808616602084015280851660408401525060806060830152611d626080830184611af1565b9695505050505050565b634e487b7160e01b600052603260045260246000fd5b600060018201611d9457611d946119ed565b506001019056fea26469706673582212207ae2447e86de3ca2bc735ab92d80b5b18a28129026feb199229bbdaf93ed05d564736f6c63430008110033", + "devdoc": { + "details": "A registrar controller for registering and renewing names at fixed cost.", + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "recoverFunds(address,address,uint256)": { + "details": "The contract is Ownable and only the owner can call the recover function.", + "params": { + "_amount": "The amount of tokens to recover.", + "_to": "The address to send the tokens to.", + "_token": "The address of the ERC20 token to recover" + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "recoverFunds(address,address,uint256)": { + "notice": "Recover ERC20 tokens sent to the contract by mistake." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 444, + "contract": "contracts/ethregistrar/ETHRegistrarController.sol:ETHRegistrarController", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 11608, + "contract": "contracts/ethregistrar/ETHRegistrarController.sol:ETHRegistrarController", + "label": "commitments", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_uint256)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_uint256)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/ExponentialPremiumPriceOracle.json b/solidity/dns-contracts/deployments/sepolia/ExponentialPremiumPriceOracle.json new file mode 100644 index 0000000..b80c7ee --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/ExponentialPremiumPriceOracle.json @@ -0,0 +1,303 @@ +{ + "address": "0x6810dbce73c67506f785a225f818b30d8f209aab", + "abi": [ + { + "inputs": [ + { + "internalType": "contract AggregatorInterface", + "name": "_usdOracle", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "_rentPrices", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "_startPremium", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalDays", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256[]", + "name": "prices", + "type": "uint256[]" + } + ], + "name": "RentPriceChanged", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "startPremium", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "elapsed", + "type": "uint256" + } + ], + "name": "decayedPremium", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "premium", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "price", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "base", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "premium", + "type": "uint256" + } + ], + "internalType": "struct IPriceOracle.Price", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price1Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price2Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price3Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price4Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price5Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "usdOracle", + "outputs": [ + { + "internalType": "contract AggregatorInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x623bf8e77831e366f128c93fd7c508a128c64da99bb76f496139c09e6eb8210f", + "receipt": { + "to": null, + "from": "0x4fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8", + "contractAddress": "0x6810dbce73c67506f785a225f818b30d8f209aab", + "transactionIndex": "0x66", + "gasUsed": "0xc6f1e", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x760ebf479b57149e76a8a17ea5edefd07cf57a6635ffec6730e0846fbb047138", + "transactionHash": "0x99ed028d68f268c7b1340446f1c1d83669af4588ce81c0c8fd52f1f0d59318bc", + "logs": [], + "blockNumber": "0x39d572", + "cumulativeGasUsed": "0x978204", + "status": "0x1" + }, + "args": [ + "0x10E7e7D64d7dA687f7DcF8443Df58A0415329b15", + [ + 0, + 0, + "20294266869609", + "5073566717402", + "158548959919" + ], + "100000000000000000000000000", + 21 + ], + "numDeployments": 1, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract AggregatorInterface\",\"name\":\"_usdOracle\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"_rentPrices\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_startPremium\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalDays\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"prices\",\"type\":\"uint256[]\"}],\"name\":\"RentPriceChanged\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"startPremium\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"elapsed\",\"type\":\"uint256\"}],\"name\":\"decayedPremium\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"premium\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"price\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"base\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"}],\"internalType\":\"struct IPriceOracle.Price\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price1Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price2Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price3Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price4Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price5Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"usdOracle\",\"outputs\":[{\"internalType\":\"contract AggregatorInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"decayedPremium(uint256,uint256)\":{\"details\":\"Returns the premium price at current time elapsed\",\"params\":{\"elapsed\":\"time past since expiry\",\"startPremium\":\"starting price\"}},\"premium(string,uint256,uint256)\":{\"details\":\"Returns the pricing premium in wei.\"},\"price(string,uint256,uint256)\":{\"details\":\"Returns the price to register or renew a name.\",\"params\":{\"duration\":\"How long the name is being registered or extended for, in seconds.\",\"expires\":\"When the name presently expires (0 if this is a new registration).\",\"name\":\"The name being registered or renewed.\"},\"returns\":{\"_0\":\"base premium tuple of base price + premium price\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/ExponentialPremiumPriceOracle.sol\":\"ExponentialPremiumPriceOracle\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/ethregistrar/ExponentialPremiumPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./StablePriceOracle.sol\\\";\\n\\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\\n uint256 constant GRACE_PERIOD = 90 days;\\n uint256 immutable startPremium;\\n uint256 immutable endValue;\\n\\n constructor(\\n AggregatorInterface _usdOracle,\\n uint256[] memory _rentPrices,\\n uint256 _startPremium,\\n uint256 totalDays\\n ) StablePriceOracle(_usdOracle, _rentPrices) {\\n startPremium = _startPremium;\\n endValue = _startPremium >> totalDays;\\n }\\n\\n uint256 constant PRECISION = 1e18;\\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\\n uint256 constant bit3 = 999957694548431104;\\n uint256 constant bit4 = 999915390886613504;\\n uint256 constant bit5 = 999830788931929088;\\n uint256 constant bit6 = 999661606496243712;\\n uint256 constant bit7 = 999323327502650752;\\n uint256 constant bit8 = 998647112890970240;\\n uint256 constant bit9 = 997296056085470080;\\n uint256 constant bit10 = 994599423483633152;\\n uint256 constant bit11 = 989228013193975424;\\n uint256 constant bit12 = 978572062087700096;\\n uint256 constant bit13 = 957603280698573696;\\n uint256 constant bit14 = 917004043204671232;\\n uint256 constant bit15 = 840896415253714560;\\n uint256 constant bit16 = 707106781186547584;\\n\\n /**\\n * @dev Returns the pricing premium in internal base units.\\n */\\n function _premium(\\n string memory,\\n uint256 expires,\\n uint256\\n ) internal view override returns (uint256) {\\n expires = expires + GRACE_PERIOD;\\n if (expires > block.timestamp) {\\n return 0;\\n }\\n\\n uint256 elapsed = block.timestamp - expires;\\n uint256 premium = decayedPremium(startPremium, elapsed);\\n if (premium >= endValue) {\\n return premium - endValue;\\n }\\n return 0;\\n }\\n\\n /**\\n * @dev Returns the premium price at current time elapsed\\n * @param startPremium starting price\\n * @param elapsed time past since expiry\\n */\\n function decayedPremium(\\n uint256 startPremium,\\n uint256 elapsed\\n ) public pure returns (uint256) {\\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\\n uint256 intDays = daysPast / PRECISION;\\n uint256 premium = startPremium >> intDays;\\n uint256 partDay = (daysPast - intDays * PRECISION);\\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\\n uint256 totalPremium = addFractionalPremium(fraction, premium);\\n return totalPremium;\\n }\\n\\n function addFractionalPremium(\\n uint256 fraction,\\n uint256 premium\\n ) internal pure returns (uint256) {\\n if (fraction & (1 << 0) != 0) {\\n premium = (premium * bit1) / PRECISION;\\n }\\n if (fraction & (1 << 1) != 0) {\\n premium = (premium * bit2) / PRECISION;\\n }\\n if (fraction & (1 << 2) != 0) {\\n premium = (premium * bit3) / PRECISION;\\n }\\n if (fraction & (1 << 3) != 0) {\\n premium = (premium * bit4) / PRECISION;\\n }\\n if (fraction & (1 << 4) != 0) {\\n premium = (premium * bit5) / PRECISION;\\n }\\n if (fraction & (1 << 5) != 0) {\\n premium = (premium * bit6) / PRECISION;\\n }\\n if (fraction & (1 << 6) != 0) {\\n premium = (premium * bit7) / PRECISION;\\n }\\n if (fraction & (1 << 7) != 0) {\\n premium = (premium * bit8) / PRECISION;\\n }\\n if (fraction & (1 << 8) != 0) {\\n premium = (premium * bit9) / PRECISION;\\n }\\n if (fraction & (1 << 9) != 0) {\\n premium = (premium * bit10) / PRECISION;\\n }\\n if (fraction & (1 << 10) != 0) {\\n premium = (premium * bit11) / PRECISION;\\n }\\n if (fraction & (1 << 11) != 0) {\\n premium = (premium * bit12) / PRECISION;\\n }\\n if (fraction & (1 << 12) != 0) {\\n premium = (premium * bit13) / PRECISION;\\n }\\n if (fraction & (1 << 13) != 0) {\\n premium = (premium * bit14) / PRECISION;\\n }\\n if (fraction & (1 << 14) != 0) {\\n premium = (premium * bit15) / PRECISION;\\n }\\n if (fraction & (1 << 15) != 0) {\\n premium = (premium * bit16) / PRECISION;\\n }\\n return premium;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x09149a39e7660d65873e5160971cf0904630b266cbec4f02721dad0aad28320b\",\"license\":\"MIT\"},\"contracts/ethregistrar/IPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\ninterface IPriceOracle {\\n struct Price {\\n uint256 base;\\n uint256 premium;\\n }\\n\\n /**\\n * @dev Returns the price to register or renew a name.\\n * @param name The name being registered or renewed.\\n * @param expires When the name presently expires (0 if this is a new registration).\\n * @param duration How long the name is being registered or extended for, in seconds.\\n * @return base premium tuple of base price + premium price\\n */\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (Price calldata);\\n}\\n\",\"keccak256\":\"0x1ec537b4c7f9cc40363b39dcc7ade8c29bf94662e6b01d38e681487637bd577e\",\"license\":\"MIT\"},\"contracts/ethregistrar/StablePriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./IPriceOracle.sol\\\";\\nimport \\\"./StringUtils.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\ninterface AggregatorInterface {\\n function latestAnswer() external view returns (int256);\\n}\\n\\n// StablePriceOracle sets a price in USD, based on an oracle.\\ncontract StablePriceOracle is IPriceOracle {\\n using StringUtils for *;\\n\\n // Rent in base price units by length\\n uint256 public immutable price1Letter;\\n uint256 public immutable price2Letter;\\n uint256 public immutable price3Letter;\\n uint256 public immutable price4Letter;\\n uint256 public immutable price5Letter;\\n\\n // Oracle address\\n AggregatorInterface public immutable usdOracle;\\n\\n event RentPriceChanged(uint256[] prices);\\n\\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\\n usdOracle = _usdOracle;\\n price1Letter = _rentPrices[0];\\n price2Letter = _rentPrices[1];\\n price3Letter = _rentPrices[2];\\n price4Letter = _rentPrices[3];\\n price5Letter = _rentPrices[4];\\n }\\n\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view override returns (IPriceOracle.Price memory) {\\n uint256 len = name.strlen();\\n uint256 basePrice;\\n\\n if (len >= 5) {\\n basePrice = price5Letter * duration;\\n } else if (len == 4) {\\n basePrice = price4Letter * duration;\\n } else if (len == 3) {\\n basePrice = price3Letter * duration;\\n } else if (len == 2) {\\n basePrice = price2Letter * duration;\\n } else {\\n basePrice = price1Letter * duration;\\n }\\n\\n return\\n IPriceOracle.Price({\\n base: attoUSDToWei(basePrice),\\n premium: attoUSDToWei(_premium(name, expires, duration))\\n });\\n }\\n\\n /**\\n * @dev Returns the pricing premium in wei.\\n */\\n function premium(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (uint256) {\\n return attoUSDToWei(_premium(name, expires, duration));\\n }\\n\\n /**\\n * @dev Returns the pricing premium in internal base units.\\n */\\n function _premium(\\n string memory name,\\n uint256 expires,\\n uint256 duration\\n ) internal view virtual returns (uint256) {\\n return 0;\\n }\\n\\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\\n return (amount * 1e8) / ethPrice;\\n }\\n\\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\\n return (amount * ethPrice) / 1e8;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IPriceOracle).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0x23a3d1eb3021080f20eb5f6af941b2d29a5d252a0a6119ba74f595da9c1ae1d6\",\"license\":\"MIT\"},\"contracts/ethregistrar/StringUtils.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary StringUtils {\\n /**\\n * @dev Returns the length of a given string\\n *\\n * @param s The string to measure the length of\\n * @return The length of the input string\\n */\\n function strlen(string memory s) internal pure returns (uint256) {\\n uint256 len;\\n uint256 i = 0;\\n uint256 bytelength = bytes(s).length;\\n for (len = 0; i < bytelength; len++) {\\n bytes1 b = bytes(s)[i];\\n if (b < 0x80) {\\n i += 1;\\n } else if (b < 0xE0) {\\n i += 2;\\n } else if (b < 0xF0) {\\n i += 3;\\n } else if (b < 0xF8) {\\n i += 4;\\n } else if (b < 0xFC) {\\n i += 5;\\n } else {\\n i += 6;\\n }\\n }\\n return len;\\n }\\n}\\n\",\"keccak256\":\"0x4cc8363a850dc9130c433ee50e7c97e29a45ae5d9bd0808205ac7134b34f24e4\"}},\"version\":1}", + "bytecode": "0x6101806040523480156200001257600080fd5b50604051620010863803806200108683398101604081905262000035916200012c565b6001600160a01b0384166101205282518490849081906000906200005d576200005d62000227565b6020026020010151608081815250508060018151811062000082576200008262000227565b602002602001015160a0818152505080600281518110620000a757620000a762000227565b602002602001015160c0818152505080600381518110620000cc57620000cc62000227565b602002602001015160e0818152505080600481518110620000f157620000f162000227565b60209081029190910101516101005250506101408290521c61016052506200023d9050565b634e487b7160e01b600052604160045260246000fd5b600080600080608085870312156200014357600080fd5b84516001600160a01b03811681146200015b57600080fd5b602086810151919550906001600160401b03808211156200017b57600080fd5b818801915088601f8301126200019057600080fd5b815181811115620001a557620001a562000116565b8060051b604051601f19603f83011681018181108582111715620001cd57620001cd62000116565b60405291825284820192508381018501918b831115620001ec57600080fd5b938501935b828510156200020c57845184529385019392850192620001f1565b60408b01516060909b0151999c909b50975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60805160a05160c05160e05161010051610120516101405161016051610db3620002d3600039600081816108590152610883015260006108300152600081816101c7015261074b01526000818161015301526102d401526000818161023a015261030d01526000818161018d015261033f015260008181610213015261037101526000818160f0015261039b0152610db36000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c8063a200e15311610076578063c8a4271f1161005b578063c8a4271f146101c2578063cd5d2c741461020e578063d820ed421461023557600080fd5b8063a200e15314610188578063a34e3596146101af57600080fd5b806350e9a715116100a757806350e9a7151461012057806359b6b86c1461014e57806359e1777c1461017557600080fd5b806301ffc9a7146100c35780632c0fd74c146100eb575b600080fd5b6100d66100d1366004610bdd565b61025c565b60405190151581526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016100e2565b61013361012e366004610c1f565b61026d565b604080518251815260209283015192810192909252016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b610112610183366004610c9e565b610433565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101126101bd366004610c1f565b6104ce565b6101e97f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b60006102678261051f565b92915050565b604080518082019091526000808252602082015260006102c286868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506105b792505050565b90506000600582106102ff576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b90506103c2565b81600403610331576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b81600303610363576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b81600203610395576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b6103bf847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b90505b60405180604001604052806103d683610746565b81526020016104266104218a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92508b91506107fa9050565b610746565b9052979650505050505050565b6000806201518061044c670de0b6b3a764000085610cd6565b6104569190610ced565b9050600061046c670de0b6b3a764000083610ced565b905084811c6000610485670de0b6b3a764000084610cd6565b61048f9085610d0f565b90506000670de0b6b3a76400006104a98362010000610cd6565b6104b39190610ced565b905060006104c182856108bd565b9998505050505050505050565b600061051661042186868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508892508791506107fa9050565b95945050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061026757507fffffffff0000000000000000000000000000000000000000000000000000000082167f50e9a715000000000000000000000000000000000000000000000000000000001492915050565b8051600090819081905b8082101561073d5760008583815181106105dd576105dd610d22565b01602001516001600160f81b03191690507f800000000000000000000000000000000000000000000000000000000000000081101561062857610621600184610d38565b925061072a565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561066557610621600284610d38565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156106a257610621600384610d38565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156106df57610621600484610d38565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561071c57610621600584610d38565b610727600684610d38565b92505b508261073581610d4b565b9350506105c1565b50909392505050565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d89190610d64565b9050806107e9846305f5e100610cd6565b6107f39190610ced565b9392505050565b60006108096276a70084610d38565b92504283111561081b575060006107f3565b60006108278442610d0f565b905060006108557f000000000000000000000000000000000000000000000000000000000000000083610433565b90507f000000000000000000000000000000000000000000000000000000000000000081106108b1576108a87f000000000000000000000000000000000000000000000000000000000000000082610d0f565b925050506107f3565b50600095945050505050565b600060018316156108f057670de0b6b3a76400006108e3670de0ad151d09418084610cd6565b6108ed9190610ced565b91505b600283161561092157670de0b6b3a7640000610914670de0a3769959680084610cd6565b61091e9190610ced565b91505b600483161561095257670de0b6b3a7640000610945670de09039a5fa510084610cd6565b61094f9190610ced565b91505b600883161561098357670de0b6b3a7640000610976670de069c00f3e120084610cd6565b6109809190610ced565b91505b60108316156109b457670de0b6b3a76400006109a7670de01cce21c9440084610cd6565b6109b19190610ced565b91505b60208316156109e557670de0b6b3a76400006109d8670ddf82ef46ce100084610cd6565b6109e29190610ced565b91505b6040831615610a1657670de0b6b3a7640000610a09670dde4f458f8e8d8084610cd6565b610a139190610ced565b91505b6080831615610a4757670de0b6b3a7640000610a3a670ddbe84213d5f08084610cd6565b610a449190610ced565b91505b610100831615610a7957670de0b6b3a7640000610a6c670dd71b7aa6df5b8084610cd6565b610a769190610ced565b91505b610200831615610aab57670de0b6b3a7640000610a9e670dcd86e7f28cde0084610cd6565b610aa89190610ced565b91505b610400831615610add57670de0b6b3a7640000610ad0670dba71a3084ad68084610cd6565b610ada9190610ced565b91505b610800831615610b0f57670de0b6b3a7640000610b02670d94961b13dbde8084610cd6565b610b0c9190610ced565b91505b611000831615610b4157670de0b6b3a7640000610b34670d4a171c35c9838084610cd6565b610b3e9190610ced565b91505b612000831615610b7357670de0b6b3a7640000610b66670cb9da519ccfb70084610cd6565b610b709190610ced565b91505b614000831615610ba557670de0b6b3a7640000610b98670bab76d59c18d68084610cd6565b610ba29190610ced565b91505b618000831615610bd757670de0b6b3a7640000610bca6709d025defee4df8084610cd6565b610bd49190610ced565b91505b50919050565b600060208284031215610bef57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146107f357600080fd5b60008060008060608587031215610c3557600080fd5b843567ffffffffffffffff80821115610c4d57600080fd5b818701915087601f830112610c6157600080fd5b813581811115610c7057600080fd5b886020828501011115610c8257600080fd5b6020928301999098509187013596604001359550909350505050565b60008060408385031215610cb157600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761026757610267610cc0565b600082610d0a57634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561026757610267610cc0565b634e487b7160e01b600052603260045260246000fd5b8082018082111561026757610267610cc0565b600060018201610d5d57610d5d610cc0565b5060010190565b600060208284031215610d7657600080fd5b505191905056fea264697066735822122095ea709e43eb75c836bb5d49037267e7991bd32558f18152c7cebb8e85e3f2f064736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100be5760003560e01c8063a200e15311610076578063c8a4271f1161005b578063c8a4271f146101c2578063cd5d2c741461020e578063d820ed421461023557600080fd5b8063a200e15314610188578063a34e3596146101af57600080fd5b806350e9a715116100a757806350e9a7151461012057806359b6b86c1461014e57806359e1777c1461017557600080fd5b806301ffc9a7146100c35780632c0fd74c146100eb575b600080fd5b6100d66100d1366004610bdd565b61025c565b60405190151581526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016100e2565b61013361012e366004610c1f565b61026d565b604080518251815260209283015192810192909252016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b610112610183366004610c9e565b610433565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101126101bd366004610c1f565b6104ce565b6101e97f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b60006102678261051f565b92915050565b604080518082019091526000808252602082015260006102c286868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506105b792505050565b90506000600582106102ff576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b90506103c2565b81600403610331576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b81600303610363576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b81600203610395576102f8847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b6103bf847f0000000000000000000000000000000000000000000000000000000000000000610cd6565b90505b60405180604001604052806103d683610746565b81526020016104266104218a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92508b91506107fa9050565b610746565b9052979650505050505050565b6000806201518061044c670de0b6b3a764000085610cd6565b6104569190610ced565b9050600061046c670de0b6b3a764000083610ced565b905084811c6000610485670de0b6b3a764000084610cd6565b61048f9085610d0f565b90506000670de0b6b3a76400006104a98362010000610cd6565b6104b39190610ced565b905060006104c182856108bd565b9998505050505050505050565b600061051661042186868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508892508791506107fa9050565b95945050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061026757507fffffffff0000000000000000000000000000000000000000000000000000000082167f50e9a715000000000000000000000000000000000000000000000000000000001492915050565b8051600090819081905b8082101561073d5760008583815181106105dd576105dd610d22565b01602001516001600160f81b03191690507f800000000000000000000000000000000000000000000000000000000000000081101561062857610621600184610d38565b925061072a565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561066557610621600284610d38565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156106a257610621600384610d38565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156106df57610621600484610d38565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b03198216101561071c57610621600584610d38565b610727600684610d38565b92505b508261073581610d4b565b9350506105c1565b50909392505050565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d89190610d64565b9050806107e9846305f5e100610cd6565b6107f39190610ced565b9392505050565b60006108096276a70084610d38565b92504283111561081b575060006107f3565b60006108278442610d0f565b905060006108557f000000000000000000000000000000000000000000000000000000000000000083610433565b90507f000000000000000000000000000000000000000000000000000000000000000081106108b1576108a87f000000000000000000000000000000000000000000000000000000000000000082610d0f565b925050506107f3565b50600095945050505050565b600060018316156108f057670de0b6b3a76400006108e3670de0ad151d09418084610cd6565b6108ed9190610ced565b91505b600283161561092157670de0b6b3a7640000610914670de0a3769959680084610cd6565b61091e9190610ced565b91505b600483161561095257670de0b6b3a7640000610945670de09039a5fa510084610cd6565b61094f9190610ced565b91505b600883161561098357670de0b6b3a7640000610976670de069c00f3e120084610cd6565b6109809190610ced565b91505b60108316156109b457670de0b6b3a76400006109a7670de01cce21c9440084610cd6565b6109b19190610ced565b91505b60208316156109e557670de0b6b3a76400006109d8670ddf82ef46ce100084610cd6565b6109e29190610ced565b91505b6040831615610a1657670de0b6b3a7640000610a09670dde4f458f8e8d8084610cd6565b610a139190610ced565b91505b6080831615610a4757670de0b6b3a7640000610a3a670ddbe84213d5f08084610cd6565b610a449190610ced565b91505b610100831615610a7957670de0b6b3a7640000610a6c670dd71b7aa6df5b8084610cd6565b610a769190610ced565b91505b610200831615610aab57670de0b6b3a7640000610a9e670dcd86e7f28cde0084610cd6565b610aa89190610ced565b91505b610400831615610add57670de0b6b3a7640000610ad0670dba71a3084ad68084610cd6565b610ada9190610ced565b91505b610800831615610b0f57670de0b6b3a7640000610b02670d94961b13dbde8084610cd6565b610b0c9190610ced565b91505b611000831615610b4157670de0b6b3a7640000610b34670d4a171c35c9838084610cd6565b610b3e9190610ced565b91505b612000831615610b7357670de0b6b3a7640000610b66670cb9da519ccfb70084610cd6565b610b709190610ced565b91505b614000831615610ba557670de0b6b3a7640000610b98670bab76d59c18d68084610cd6565b610ba29190610ced565b91505b618000831615610bd757670de0b6b3a7640000610bca6709d025defee4df8084610cd6565b610bd49190610ced565b91505b50919050565b600060208284031215610bef57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146107f357600080fd5b60008060008060608587031215610c3557600080fd5b843567ffffffffffffffff80821115610c4d57600080fd5b818701915087601f830112610c6157600080fd5b813581811115610c7057600080fd5b886020828501011115610c8257600080fd5b6020928301999098509187013596604001359550909350505050565b60008060408385031215610cb157600080fd5b50508035926020909101359150565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761026757610267610cc0565b600082610d0a57634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561026757610267610cc0565b634e487b7160e01b600052603260045260246000fd5b8082018082111561026757610267610cc0565b600060018201610d5d57610d5d610cc0565b5060010190565b600060208284031215610d7657600080fd5b505191905056fea264697066735822122095ea709e43eb75c836bb5d49037267e7991bd32558f18152c7cebb8e85e3f2f064736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "decayedPremium(uint256,uint256)": { + "details": "Returns the premium price at current time elapsed", + "params": { + "elapsed": "time past since expiry", + "startPremium": "starting price" + } + }, + "premium(string,uint256,uint256)": { + "details": "Returns the pricing premium in wei." + }, + "price(string,uint256,uint256)": { + "details": "Returns the price to register or renew a name.", + "params": { + "duration": "How long the name is being registered or extended for, in seconds.", + "expires": "When the name presently expires (0 if this is a new registration).", + "name": "The name being registered or renewed." + }, + "returns": { + "_0": "base premium tuple of base price + premium price" + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/ExtendedDNSResolver.json b/solidity/dns-contracts/deployments/sepolia/ExtendedDNSResolver.json new file mode 100644 index 0000000..ebee33f --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/ExtendedDNSResolver.json @@ -0,0 +1,110 @@ +{ + "address": "0xebD6b1881639E560BDB37f235DC34C88B9a16b6A", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "addr", + "type": "bytes" + } + ], + "name": "InvalidAddressFormat", + "type": "error" + }, + { + "inputs": [], + "name": "NotImplemented", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "context", + "type": "bytes" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xa73c871a367d94bbee6bba67324c6d344d16996344821a9fb644af42a6bd9c85", + "receipt": { + "to": null, + "from": "0x0904Dac3347eA47d208F3Fd67402D039a3b99859", + "contractAddress": "0xebD6b1881639E560BDB37f235DC34C88B9a16b6A", + "transactionIndex": 41, + "gasUsed": "1116071", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x8263d6ac09f39b0e4f6b73ce397e5d6eb1731af33705fd8f5d256d1c410cd7bf", + "transactionHash": "0xa73c871a367d94bbee6bba67324c6d344d16996344821a9fb644af42a6bd9c85", + "logs": [], + "blockNumber": 6410258, + "cumulativeGasUsed": "9577878", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 2, + "solcInputHash": "96d118177ae253bdd3815d2757c11cd9", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"addr\",\"type\":\"bytes\"}],\"name\":\"InvalidAddressFormat\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotImplemented\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"context\",\"type\":\"bytes\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Resolves names on ENS by interpreting record data stored in a DNS TXT record. This resolver implements the IExtendedDNSResolver interface, meaning that when a DNS name specifies it as the resolver via a TXT record, this resolver's resolve() method is invoked, and is passed any additional information from that text record. This resolver implements a simple text parser allowing a variety of records to be specified in text, which will then be used to resolve the name in ENS. To use this, set a TXT record on your DNS name in the following format: ENS1
For example: ENS1 2.dnsname.ens.eth a[60]=0x1234... The record data consists of a series of key=value pairs, separated by spaces. Keys may have an optional argument in square brackets, and values may be either unquoted - in which case they may not contain spaces - or single-quoted. Single quotes in a quoted value may be backslash-escaped. \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510 \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2534\\u2500\\u2524\\\" \\\"\\u2502\\u25c4\\u2500\\u2534\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u2502 ^\\u2500\\u2534\\u2500\\u25ba\\u2502key\\u251c\\u2500\\u252c\\u2500\\u25ba\\u2502\\\"[\\\"\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502arg\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502\\\"]\\\"\\u251c\\u2500\\u252c\\u2500\\u25ba\\u2502\\\"=\\\"\\u251c\\u2500\\u252c\\u2500\\u25ba\\u2502\\\"'\\\"\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502quoted_value\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502\\\"'\\\"\\u251c\\u2500\\u253c\\u2500$ \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u25ba\\u2502unquoted_value\\u251c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518 Record types: - a[] - Specifies how an `addr()` request should be resolved for the specified `coinType`. Ethereum has `coinType` 60. The value must be 0x-prefixed hexadecimal, and will be returned unmodified; this means that non-EVM addresses will need to be translated into binary format and then encoded in hex. Examples: - a[60]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7 - a[0]=0x00149010587f8364b964fcaa70687216b53bd2cbd798 - a[e] - Specifies how an `addr()` request should be resolved for the specified `chainId`. The value must be 0x-prefixed hexadecimal. When encoding an address for an EVM-based cryptocurrency that uses a chainId instead of a coinType, this syntax *must* be used in place of the coin type - eg, Optimism is `a[e10]`, not `a[2147483658]`. A list of supported cryptocurrencies for both syntaxes can be found here: https://github.com/ensdomains/address-encoder/blob/master/docs/supported-cryptocurrencies.md Example: - a[e10]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7 - t[] - Specifies how a `text()` request should be resolved for the specified `key`. Examples: - t[com.twitter]=nicksdjohnson - t[url]='https://ens.domains/' - t[note]='I\\\\'m great'\",\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/resolvers/profiles/ExtendedDNSResolver.sol\":\"ExtendedDNSResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ExtendedDNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"../../resolvers/profiles/IExtendedDNSResolver.sol\\\";\\nimport \\\"../../resolvers/profiles/IAddressResolver.sol\\\";\\nimport \\\"../../resolvers/profiles/IAddrResolver.sol\\\";\\nimport \\\"../../resolvers/profiles/ITextResolver.sol\\\";\\nimport \\\"../../utils/HexUtils.sol\\\";\\nimport \\\"../../utils/BytesUtils.sol\\\";\\n\\n/**\\n * @dev Resolves names on ENS by interpreting record data stored in a DNS TXT record.\\n * This resolver implements the IExtendedDNSResolver interface, meaning that when\\n * a DNS name specifies it as the resolver via a TXT record, this resolver's\\n * resolve() method is invoked, and is passed any additional information from that\\n * text record. This resolver implements a simple text parser allowing a variety\\n * of records to be specified in text, which will then be used to resolve the name\\n * in ENS.\\n *\\n * To use this, set a TXT record on your DNS name in the following format:\\n * ENS1
\\n *\\n * For example:\\n * ENS1 2.dnsname.ens.eth a[60]=0x1234...\\n *\\n * The record data consists of a series of key=value pairs, separated by spaces. Keys\\n * may have an optional argument in square brackets, and values may be either unquoted\\n * - in which case they may not contain spaces - or single-quoted. Single quotes in\\n * a quoted value may be backslash-escaped.\\n *\\n *\\n * \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510\\n * \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u2502\\n * \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2534\\u2500\\u2524\\\" \\\"\\u2502\\u25c4\\u2500\\u2534\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510\\n * \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502\\n * \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u2502\\n * ^\\u2500\\u2534\\u2500\\u25ba\\u2502key\\u251c\\u2500\\u252c\\u2500\\u25ba\\u2502\\\"[\\\"\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502arg\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502\\\"]\\\"\\u251c\\u2500\\u252c\\u2500\\u25ba\\u2502\\\"=\\\"\\u251c\\u2500\\u252c\\u2500\\u25ba\\u2502\\\"'\\\"\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502quoted_value\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502\\\"'\\\"\\u251c\\u2500\\u253c\\u2500$\\n * \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502\\n * \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510 \\u2502\\n * \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u25ba\\u2502unquoted_value\\u251c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518\\n * \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518\\n *\\n * Record types:\\n * - a[] - Specifies how an `addr()` request should be resolved for the specified\\n * `coinType`. Ethereum has `coinType` 60. The value must be 0x-prefixed hexadecimal, and will\\n * be returned unmodified; this means that non-EVM addresses will need to be translated\\n * into binary format and then encoded in hex.\\n * Examples:\\n * - a[60]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7\\n * - a[0]=0x00149010587f8364b964fcaa70687216b53bd2cbd798\\n * - a[e] - Specifies how an `addr()` request should be resolved for the specified\\n * `chainId`. The value must be 0x-prefixed hexadecimal. When encoding an address for an\\n * EVM-based cryptocurrency that uses a chainId instead of a coinType, this syntax *must*\\n * be used in place of the coin type - eg, Optimism is `a[e10]`, not `a[2147483658]`.\\n * A list of supported cryptocurrencies for both syntaxes can be found here:\\n * https://github.com/ensdomains/address-encoder/blob/master/docs/supported-cryptocurrencies.md\\n * Example:\\n * - a[e10]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7\\n * - t[] - Specifies how a `text()` request should be resolved for the specified `key`.\\n * Examples:\\n * - t[com.twitter]=nicksdjohnson\\n * - t[url]='https://ens.domains/'\\n * - t[note]='I\\\\'m great'\\n */\\ncontract ExtendedDNSResolver is IExtendedDNSResolver, IERC165 {\\n using HexUtils for *;\\n using BytesUtils for *;\\n using Strings for *;\\n\\n uint256 private constant COIN_TYPE_ETH = 60;\\n\\n error NotImplemented();\\n error InvalidAddressFormat(bytes addr);\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) external view virtual override returns (bool) {\\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\\n }\\n\\n function resolve(\\n bytes calldata /* name */,\\n bytes calldata data,\\n bytes calldata context\\n ) external pure override returns (bytes memory) {\\n bytes4 selector = bytes4(data);\\n if (selector == IAddrResolver.addr.selector) {\\n return _resolveAddr(context);\\n } else if (selector == IAddressResolver.addr.selector) {\\n return _resolveAddress(data, context);\\n } else if (selector == ITextResolver.text.selector) {\\n return _resolveText(data, context);\\n }\\n revert NotImplemented();\\n }\\n\\n function _resolveAddress(\\n bytes calldata data,\\n bytes calldata context\\n ) internal pure returns (bytes memory) {\\n (, uint256 coinType) = abi.decode(data[4:], (bytes32, uint256));\\n bytes memory value;\\n // Per https://docs.ens.domains/ensip/11#specification\\n if (coinType & 0x80000000 != 0) {\\n value = _findValue(\\n context,\\n bytes.concat(\\n \\\"a[e\\\",\\n bytes((coinType & 0x7fffffff).toString()),\\n \\\"]=\\\"\\n )\\n );\\n } else {\\n value = _findValue(\\n context,\\n bytes.concat(\\\"a[\\\", bytes(coinType.toString()), \\\"]=\\\")\\n );\\n }\\n if (value.length == 0) {\\n return value;\\n }\\n (bytes memory record, bool valid) = value.hexToBytes(2, value.length);\\n if (!valid) revert InvalidAddressFormat(value);\\n return record;\\n }\\n\\n function _resolveAddr(\\n bytes calldata context\\n ) internal pure returns (bytes memory) {\\n bytes memory value = _findValue(context, \\\"a[60]=\\\");\\n if (value.length == 0) {\\n return value;\\n }\\n (bytes memory record, bool valid) = value.hexToBytes(2, value.length);\\n if (!valid) revert InvalidAddressFormat(value);\\n return record;\\n }\\n\\n function _resolveText(\\n bytes calldata data,\\n bytes calldata context\\n ) internal pure returns (bytes memory) {\\n (, string memory key) = abi.decode(data[4:], (bytes32, string));\\n bytes memory value = _findValue(\\n context,\\n bytes.concat(\\\"t[\\\", bytes(key), \\\"]=\\\")\\n );\\n return value;\\n }\\n\\n uint256 constant STATE_START = 0;\\n uint256 constant STATE_IGNORED_KEY = 1;\\n uint256 constant STATE_IGNORED_KEY_ARG = 2;\\n uint256 constant STATE_VALUE = 3;\\n uint256 constant STATE_QUOTED_VALUE = 4;\\n uint256 constant STATE_UNQUOTED_VALUE = 5;\\n uint256 constant STATE_IGNORED_VALUE = 6;\\n uint256 constant STATE_IGNORED_QUOTED_VALUE = 7;\\n uint256 constant STATE_IGNORED_UNQUOTED_VALUE = 8;\\n\\n /**\\n * @dev Implements a DFA to parse the text record, looking for an entry\\n * matching `key`.\\n * @param data The text record to parse.\\n * @param key The exact key to search for.\\n * @return value The value if found, or an empty string if `key` does not exist.\\n */\\n function _findValue(\\n bytes memory data,\\n bytes memory key\\n ) internal pure returns (bytes memory value) {\\n // Here we use a simple state machine to parse the text record. We\\n // process characters one at a time; each character can trigger a\\n // transition to a new state, or terminate the DFA and return a value.\\n // For states that expect to process a number of tokens, we use\\n // inner loops for efficiency reasons, to avoid the need to go\\n // through the outer loop and switch statement for every character.\\n uint256 state = STATE_START;\\n uint256 len = data.length;\\n for (uint256 i = 0; i < len; ) {\\n if (state == STATE_START) {\\n // Look for a matching key.\\n if (data.equals(i, key, 0, key.length)) {\\n i += key.length;\\n state = STATE_VALUE;\\n } else {\\n state = STATE_IGNORED_KEY;\\n }\\n } else if (state == STATE_IGNORED_KEY) {\\n for (; i < len; i++) {\\n if (data[i] == \\\"=\\\") {\\n state = STATE_IGNORED_VALUE;\\n i += 1;\\n break;\\n } else if (data[i] == \\\"[\\\") {\\n state = STATE_IGNORED_KEY_ARG;\\n i += 1;\\n break;\\n }\\n }\\n } else if (state == STATE_IGNORED_KEY_ARG) {\\n for (; i < len; i++) {\\n if (data[i] == \\\"]\\\") {\\n state = STATE_IGNORED_VALUE;\\n i += 1;\\n if (data[i] == \\\"=\\\") {\\n i += 1;\\n }\\n break;\\n }\\n }\\n } else if (state == STATE_VALUE) {\\n if (data[i] == \\\"'\\\") {\\n state = STATE_QUOTED_VALUE;\\n i += 1;\\n } else {\\n state = STATE_UNQUOTED_VALUE;\\n }\\n } else if (state == STATE_QUOTED_VALUE) {\\n uint256 start = i;\\n uint256 valueLen = 0;\\n bool escaped = false;\\n for (; i < len; i++) {\\n if (escaped) {\\n data[start + valueLen] = data[i];\\n valueLen += 1;\\n escaped = false;\\n } else {\\n if (data[i] == \\\"\\\\\\\\\\\") {\\n escaped = true;\\n } else if (data[i] == \\\"'\\\") {\\n return data.substring(start, valueLen);\\n } else {\\n data[start + valueLen] = data[i];\\n valueLen += 1;\\n }\\n }\\n }\\n } else if (state == STATE_UNQUOTED_VALUE) {\\n uint256 start = i;\\n for (; i < len; i++) {\\n if (data[i] == \\\" \\\") {\\n return data.substring(start, i - start);\\n }\\n }\\n return data.substring(start, len - start);\\n } else if (state == STATE_IGNORED_VALUE) {\\n if (data[i] == \\\"'\\\") {\\n state = STATE_IGNORED_QUOTED_VALUE;\\n i += 1;\\n } else {\\n state = STATE_IGNORED_UNQUOTED_VALUE;\\n }\\n } else if (state == STATE_IGNORED_QUOTED_VALUE) {\\n bool escaped = false;\\n for (; i < len; i++) {\\n if (escaped) {\\n escaped = false;\\n } else {\\n if (data[i] == \\\"\\\\\\\\\\\") {\\n escaped = true;\\n } else if (data[i] == \\\"'\\\") {\\n i += 1;\\n while (data[i] == \\\" \\\") {\\n i += 1;\\n }\\n state = STATE_START;\\n break;\\n }\\n }\\n }\\n } else {\\n assert(state == STATE_IGNORED_UNQUOTED_VALUE);\\n for (; i < len; i++) {\\n if (data[i] == \\\" \\\") {\\n while (data[i] == \\\" \\\") {\\n i += 1;\\n }\\n state = STATE_START;\\n break;\\n }\\n }\\n }\\n }\\n return \\\"\\\";\\n }\\n}\\n\",\"keccak256\":\"0xb8954b152d8fb29cd7239e33d0c17c3dfb52ff7cd6d4c060bb72e62b0ae8e197\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedDNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedDNSResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data,\\n bytes memory context\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x541f8799c34ff9e7035d09f06ae0f0f8a16b6065e9b60a15670b957321630f72\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/utils/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes32) {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0xc566a3569af880a096a9bfb2fbb77060ef7aecde1a205dc26446a58877412060\",\"license\":\"MIT\"},\"contracts/utils/HexUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary HexUtils {\\n /**\\n * @dev Attempts to parse bytes32 from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexStringToBytes32(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (bytes32, bool) {\\n require(lastIdx - idx <= 64);\\n (bytes memory r, bool valid) = hexToBytes(str, idx, lastIdx);\\n if (!valid) {\\n return (bytes32(0), false);\\n }\\n bytes32 ret;\\n assembly {\\n ret := shr(mul(4, sub(64, sub(lastIdx, idx))), mload(add(r, 32)))\\n }\\n return (ret, true);\\n }\\n\\n function hexToBytes(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (bytes memory r, bool valid) {\\n uint256 hexLength = lastIdx - idx;\\n if (hexLength % 2 == 1) {\\n revert(\\\"Invalid string length\\\");\\n }\\n r = new bytes(hexLength / 2);\\n valid = true;\\n assembly {\\n // check that the index to read to is not past the end of the string\\n if gt(lastIdx, mload(str)) {\\n revert(0, 0)\\n }\\n\\n function getHex(c) -> ascii {\\n // chars 48-57: 0-9\\n if and(gt(c, 47), lt(c, 58)) {\\n ascii := sub(c, 48)\\n leave\\n }\\n // chars 65-70: A-F\\n if and(gt(c, 64), lt(c, 71)) {\\n ascii := add(sub(c, 65), 10)\\n leave\\n }\\n // chars 97-102: a-f\\n if and(gt(c, 96), lt(c, 103)) {\\n ascii := add(sub(c, 97), 10)\\n leave\\n }\\n // invalid char\\n ascii := 0xff\\n }\\n\\n let ptr := add(str, 32)\\n for {\\n let i := idx\\n } lt(i, lastIdx) {\\n i := add(i, 2)\\n } {\\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\\n // if either byte is invalid, set invalid and break loop\\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\\n valid := false\\n break\\n }\\n let combined := or(shl(4, byte1), byte2)\\n mstore8(add(add(r, 32), div(sub(i, idx), 2)), combined)\\n }\\n }\\n }\\n\\n /**\\n * @dev Attempts to parse an address from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexToAddress(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (address, bool) {\\n if (lastIdx - idx < 40) return (address(0x0), false);\\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\\n return (address(uint160(uint256(r))), valid);\\n }\\n\\n /**\\n * @dev Attempts to convert an address to a hex string\\n * @param addr The _addr to parse\\n */\\n function addressToHex(address addr) internal pure returns (string memory) {\\n bytes memory hexString = new bytes(40);\\n for (uint i = 0; i < 20; i++) {\\n bytes1 byteValue = bytes1(uint8(uint160(addr) >> (8 * (19 - i))));\\n bytes1 highNibble = bytes1(uint8(byteValue) / 16);\\n bytes1 lowNibble = bytes1(\\n uint8(byteValue) - 16 * uint8(highNibble)\\n );\\n hexString[2 * i] = _nibbleToHexChar(highNibble);\\n hexString[2 * i + 1] = _nibbleToHexChar(lowNibble);\\n }\\n return string(hexString);\\n }\\n\\n function _nibbleToHexChar(\\n bytes1 nibble\\n ) internal pure returns (bytes1 hexChar) {\\n if (uint8(nibble) < 10) return bytes1(uint8(nibble) + 0x30);\\n else return bytes1(uint8(nibble) + 0x57);\\n }\\n}\\n\",\"keccak256\":\"0xd6a9ab6d19632f634ee0f29173278fb4ba1d90fbbb470e779d76f278a8a2b90d\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061134e806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806301ffc9a71461003b5780638ef98a7e1461008d575b600080fd5b610078610049366004610ec7565b6001600160e01b0319167f8ef98a7e000000000000000000000000000000000000000000000000000000001490565b60405190151581526020015b60405180910390f35b6100a061009b366004610f41565b6100ad565b6040516100849190610fff565b606060006100bb8587611032565b90507fc4c4a822000000000000000000000000000000000000000000000000000000006001600160e01b0319821601610100576100f884846101b6565b9150506101ac565b7f0e3481fa000000000000000000000000000000000000000000000000000000006001600160e01b031982160161013d576100f886868686610292565b7fa62e2bc4000000000000000000000000000000000000000000000000000000006001600160e01b031982160161017a576100f8868686866103ed565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9695505050505050565b6060600061022e84848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060408051808201909152600681527f615b36305d3d0000000000000000000000000000000000000000000000000000602082015291506104659050565b9050805160000361024057905061028c565b60008061025a6002845185610a7e9092919063ffffffff16565b91509150806102875782604051630f79e00960e21b815260040161027e9190610fff565b60405180910390fd5b509150505b92915050565b606060006102a38560048189611062565b8101906102b0919061108c565b9150506060816380000000166000146103375761033085858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061030c92505050637fffffff8516610c26565b60405160200161031c91906110ae565b604051602081830303815290604052610465565b905061038f565b61038c85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061037c9250869150610c269050565b60405160200161031c91906110ff565b90505b80516000036103a15791506103e59050565b6000806103bb6002845185610a7e9092919063ffffffff16565b91509150806103df5782604051630f79e00960e21b815260040161027e9190610fff565b50925050505b949350505050565b606060006103fe8560048189611062565b81019061040b9190611166565b915050600061045a85858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060405161031c9250869150602001611221565b979650505050505050565b8151606090600090815b81811015610a6557826104b557845161049090879083908890600090610cc6565b156104ac5784516104a1908261126f565b90506003925061046f565b6001925061046f565b60018303610574575b8181101561056f578581815181106104d8576104d8611282565b01602001516001600160f81b031916603d60f81b03610507576006925061050060018261126f565b905061046f565b85818151811061051957610519611282565b01602001516001600160f81b0319167f5b000000000000000000000000000000000000000000000000000000000000000361055d576002925061050060018261126f565b8061056781611298565b9150506104be565b61046f565b60028303610625575b8181101561056f5785818151811061059757610597611282565b01602001516001600160f81b0319167f5d000000000000000000000000000000000000000000000000000000000000000361061357600692506105db60018261126f565b90508581815181106105ef576105ef611282565b01602001516001600160f81b031916603d60f81b0361056f5761050060018261126f565b8061061d81611298565b91505061057d565b600383036106705785818151811061063f5761063f611282565b01602001516001600160f81b031916602760f81b03610667576004925061050060018261126f565b6005925061046f565b6004830361081557806000805b8484101561080d57801561070c5788848151811061069d5761069d611282565b01602001516001600160f81b031916896106b7848661126f565b815181106106c7576106c7611282565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061070160018361126f565b9150600090506107fb565b88848151811061071e5761071e611282565b01602001516001600160f81b031916601760fa1b0361073f575060016107fb565b88848151811061075157610751611282565b01602001516001600160f81b031916602760f81b0361078257610775898484610ce9565b965050505050505061028c565b88848151811061079457610794611282565b01602001516001600160f81b031916896107ae848661126f565b815181106107be576107be611282565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506107f860018361126f565b91505b8361080581611298565b94505061067d565b50505061046f565b6005830361089357805b828210156108855786828151811061083957610839611282565b01602001516001600160f81b031916600160fd1b03610873576108688161086081856112b1565b899190610ce9565b94505050505061028c565b8161087d81611298565b92505061081f565b6108688161086081866112b1565b600683036108de578581815181106108ad576108ad611282565b01602001516001600160f81b031916602760f81b036108d5576007925061050060018261126f565b6008925061046f565b600783036109c95760005b828210156109c35780156108ff575060006109b1565b86828151811061091157610911611282565b01602001516001600160f81b031916601760fa1b03610932575060016109b1565b86828151811061094457610944611282565b01602001516001600160f81b031916602760f81b036109b15761096860018361126f565b91505b86828151811061097d5761097d611282565b01602001516001600160f81b031916600160fd1b036109a8576109a160018361126f565b915061096b565b600093506109c3565b816109bb81611298565b9250506108e9565b5061046f565b600883146109d9576109d96112c4565b8181101561056f578581815181106109f3576109f3611282565b01602001516001600160f81b031916600160fd1b03610a53575b858181518110610a1f57610a1f611282565b01602001516001600160f81b031916600160fd1b03610a4a57610a4360018261126f565b9050610a0d565b6000925061046f565b80610a5d81611298565b9150506109d9565b5050604080516020810190915260008152949350505050565b6060600080610a8d85856112b1565b9050610a9a6002826112f0565b600103610b03576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f496e76616c696420737472696e67206c656e6774680000000000000000000000604482015260640161027e565b610b0e600282611304565b67ffffffffffffffff811115610b2657610b26611150565b6040519080825280601f01601f191660200182016040528015610b50576020820181803683370190505b509250600191508551841115610b6557600080fd5b610bb6565b6000603a8210602f83111615610b825750602f190190565b60478210604083111615610b9857506036190190565b60678210606083111615610bae57506056190190565b5060ff919050565b60208601855b85811015610c1b57610bd38183015160001a610b6a565b610be56001830184015160001a610b6a565b60ff811460ff83141715610bfe57600095505050610c1b565b60049190911b178060028984030487016020015350600201610bbc565b505050935093915050565b60606000610c3383610d6b565b600101905060008167ffffffffffffffff811115610c5357610c53611150565b6040519080825280601f01601f191660200182016040528015610c7d576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084610c8757509392505050565b6000610cd3848484610e4d565b610cde878785610e4d565b149695505050505050565b8251606090610cf8838561126f565b1115610d0357600080fd5b60008267ffffffffffffffff811115610d1e57610d1e611150565b6040519080825280601f01601f191660200182016040528015610d48576020820181803683370190505b50905060208082019086860101610d60828287610e71565b509095945050505050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310610db4577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310610de0576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610dfe57662386f26fc10000830492506010015b6305f5e1008310610e16576305f5e100830492506008015b6127108310610e2a57612710830492506004015b60648310610e3c576064830492506002015b600a831061028c5760010192915050565b8251600090610e5c838561126f565b1115610e6757600080fd5b5091016020012090565b60208110610ea95781518352610e8860208461126f565b9250610e9560208361126f565b9150610ea26020826112b1565b9050610e71565b905182516020929092036101000a6000190180199091169116179052565b600060208284031215610ed957600080fd5b81356001600160e01b031981168114610ef157600080fd5b9392505050565b60008083601f840112610f0a57600080fd5b50813567ffffffffffffffff811115610f2257600080fd5b602083019150836020828501011115610f3a57600080fd5b9250929050565b60008060008060008060608789031215610f5a57600080fd5b863567ffffffffffffffff80821115610f7257600080fd5b610f7e8a838b01610ef8565b90985096506020890135915080821115610f9757600080fd5b610fa38a838b01610ef8565b90965094506040890135915080821115610fbc57600080fd5b50610fc989828a01610ef8565b979a9699509497509295939492505050565b60005b83811015610ff6578181015183820152602001610fde565b50506000910152565b602081526000825180602084015261101e816040850160208701610fdb565b601f01601f19169190910160400192915050565b6001600160e01b0319813581811691600485101561105a5780818660040360031b1b83161692505b505092915050565b6000808585111561107257600080fd5b8386111561107f57600080fd5b5050820193919092039150565b6000806040838503121561109f57600080fd5b50508035926020909101359150565b7f615b6500000000000000000000000000000000000000000000000000000000008152600082516110e6816003850160208701610fdb565b615d3d60f01b6003939091019283015250600501919050565b7f615b000000000000000000000000000000000000000000000000000000000000815260008251611137816002850160208701610fdb565b615d3d60f01b6002939091019283015250600401919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561117957600080fd5b82359150602083013567ffffffffffffffff8082111561119857600080fd5b818501915085601f8301126111ac57600080fd5b8135818111156111be576111be611150565b604051601f8201601f19908116603f011681019083821181831017156111e6576111e6611150565b816040528281528860208487010111156111ff57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b7f745b000000000000000000000000000000000000000000000000000000000000815260008251611137816002850160208701610fdb565b634e487b7160e01b600052601160045260246000fd5b8082018082111561028c5761028c611259565b634e487b7160e01b600052603260045260246000fd5b6000600182016112aa576112aa611259565b5060010190565b8181038181111561028c5761028c611259565b634e487b7160e01b600052600160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6000826112ff576112ff6112da565b500690565b600082611313576113136112da565b50049056fea26469706673582212203572cfc5fcb1ebedbb66aca92142c81b01bd1363a5a1c1b46d18a861668d369764736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806301ffc9a71461003b5780638ef98a7e1461008d575b600080fd5b610078610049366004610ec7565b6001600160e01b0319167f8ef98a7e000000000000000000000000000000000000000000000000000000001490565b60405190151581526020015b60405180910390f35b6100a061009b366004610f41565b6100ad565b6040516100849190610fff565b606060006100bb8587611032565b90507fc4c4a822000000000000000000000000000000000000000000000000000000006001600160e01b0319821601610100576100f884846101b6565b9150506101ac565b7f0e3481fa000000000000000000000000000000000000000000000000000000006001600160e01b031982160161013d576100f886868686610292565b7fa62e2bc4000000000000000000000000000000000000000000000000000000006001600160e01b031982160161017a576100f8868686866103ed565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9695505050505050565b6060600061022e84848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060408051808201909152600681527f615b36305d3d0000000000000000000000000000000000000000000000000000602082015291506104659050565b9050805160000361024057905061028c565b60008061025a6002845185610a7e9092919063ffffffff16565b91509150806102875782604051630f79e00960e21b815260040161027e9190610fff565b60405180910390fd5b509150505b92915050565b606060006102a38560048189611062565b8101906102b0919061108c565b9150506060816380000000166000146103375761033085858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061030c92505050637fffffff8516610c26565b60405160200161031c91906110ae565b604051602081830303815290604052610465565b905061038f565b61038c85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061037c9250869150610c269050565b60405160200161031c91906110ff565b90505b80516000036103a15791506103e59050565b6000806103bb6002845185610a7e9092919063ffffffff16565b91509150806103df5782604051630f79e00960e21b815260040161027e9190610fff565b50925050505b949350505050565b606060006103fe8560048189611062565b81019061040b9190611166565b915050600061045a85858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060405161031c9250869150602001611221565b979650505050505050565b8151606090600090815b81811015610a6557826104b557845161049090879083908890600090610cc6565b156104ac5784516104a1908261126f565b90506003925061046f565b6001925061046f565b60018303610574575b8181101561056f578581815181106104d8576104d8611282565b01602001516001600160f81b031916603d60f81b03610507576006925061050060018261126f565b905061046f565b85818151811061051957610519611282565b01602001516001600160f81b0319167f5b000000000000000000000000000000000000000000000000000000000000000361055d576002925061050060018261126f565b8061056781611298565b9150506104be565b61046f565b60028303610625575b8181101561056f5785818151811061059757610597611282565b01602001516001600160f81b0319167f5d000000000000000000000000000000000000000000000000000000000000000361061357600692506105db60018261126f565b90508581815181106105ef576105ef611282565b01602001516001600160f81b031916603d60f81b0361056f5761050060018261126f565b8061061d81611298565b91505061057d565b600383036106705785818151811061063f5761063f611282565b01602001516001600160f81b031916602760f81b03610667576004925061050060018261126f565b6005925061046f565b6004830361081557806000805b8484101561080d57801561070c5788848151811061069d5761069d611282565b01602001516001600160f81b031916896106b7848661126f565b815181106106c7576106c7611282565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061070160018361126f565b9150600090506107fb565b88848151811061071e5761071e611282565b01602001516001600160f81b031916601760fa1b0361073f575060016107fb565b88848151811061075157610751611282565b01602001516001600160f81b031916602760f81b0361078257610775898484610ce9565b965050505050505061028c565b88848151811061079457610794611282565b01602001516001600160f81b031916896107ae848661126f565b815181106107be576107be611282565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506107f860018361126f565b91505b8361080581611298565b94505061067d565b50505061046f565b6005830361089357805b828210156108855786828151811061083957610839611282565b01602001516001600160f81b031916600160fd1b03610873576108688161086081856112b1565b899190610ce9565b94505050505061028c565b8161087d81611298565b92505061081f565b6108688161086081866112b1565b600683036108de578581815181106108ad576108ad611282565b01602001516001600160f81b031916602760f81b036108d5576007925061050060018261126f565b6008925061046f565b600783036109c95760005b828210156109c35780156108ff575060006109b1565b86828151811061091157610911611282565b01602001516001600160f81b031916601760fa1b03610932575060016109b1565b86828151811061094457610944611282565b01602001516001600160f81b031916602760f81b036109b15761096860018361126f565b91505b86828151811061097d5761097d611282565b01602001516001600160f81b031916600160fd1b036109a8576109a160018361126f565b915061096b565b600093506109c3565b816109bb81611298565b9250506108e9565b5061046f565b600883146109d9576109d96112c4565b8181101561056f578581815181106109f3576109f3611282565b01602001516001600160f81b031916600160fd1b03610a53575b858181518110610a1f57610a1f611282565b01602001516001600160f81b031916600160fd1b03610a4a57610a4360018261126f565b9050610a0d565b6000925061046f565b80610a5d81611298565b9150506109d9565b5050604080516020810190915260008152949350505050565b6060600080610a8d85856112b1565b9050610a9a6002826112f0565b600103610b03576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f496e76616c696420737472696e67206c656e6774680000000000000000000000604482015260640161027e565b610b0e600282611304565b67ffffffffffffffff811115610b2657610b26611150565b6040519080825280601f01601f191660200182016040528015610b50576020820181803683370190505b509250600191508551841115610b6557600080fd5b610bb6565b6000603a8210602f83111615610b825750602f190190565b60478210604083111615610b9857506036190190565b60678210606083111615610bae57506056190190565b5060ff919050565b60208601855b85811015610c1b57610bd38183015160001a610b6a565b610be56001830184015160001a610b6a565b60ff811460ff83141715610bfe57600095505050610c1b565b60049190911b178060028984030487016020015350600201610bbc565b505050935093915050565b60606000610c3383610d6b565b600101905060008167ffffffffffffffff811115610c5357610c53611150565b6040519080825280601f01601f191660200182016040528015610c7d576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084610c8757509392505050565b6000610cd3848484610e4d565b610cde878785610e4d565b149695505050505050565b8251606090610cf8838561126f565b1115610d0357600080fd5b60008267ffffffffffffffff811115610d1e57610d1e611150565b6040519080825280601f01601f191660200182016040528015610d48576020820181803683370190505b50905060208082019086860101610d60828287610e71565b509095945050505050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310610db4577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310610de0576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610dfe57662386f26fc10000830492506010015b6305f5e1008310610e16576305f5e100830492506008015b6127108310610e2a57612710830492506004015b60648310610e3c576064830492506002015b600a831061028c5760010192915050565b8251600090610e5c838561126f565b1115610e6757600080fd5b5091016020012090565b60208110610ea95781518352610e8860208461126f565b9250610e9560208361126f565b9150610ea26020826112b1565b9050610e71565b905182516020929092036101000a6000190180199091169116179052565b600060208284031215610ed957600080fd5b81356001600160e01b031981168114610ef157600080fd5b9392505050565b60008083601f840112610f0a57600080fd5b50813567ffffffffffffffff811115610f2257600080fd5b602083019150836020828501011115610f3a57600080fd5b9250929050565b60008060008060008060608789031215610f5a57600080fd5b863567ffffffffffffffff80821115610f7257600080fd5b610f7e8a838b01610ef8565b90985096506020890135915080821115610f9757600080fd5b610fa38a838b01610ef8565b90965094506040890135915080821115610fbc57600080fd5b50610fc989828a01610ef8565b979a9699509497509295939492505050565b60005b83811015610ff6578181015183820152602001610fde565b50506000910152565b602081526000825180602084015261101e816040850160208701610fdb565b601f01601f19169190910160400192915050565b6001600160e01b0319813581811691600485101561105a5780818660040360031b1b83161692505b505092915050565b6000808585111561107257600080fd5b8386111561107f57600080fd5b5050820193919092039150565b6000806040838503121561109f57600080fd5b50508035926020909101359150565b7f615b6500000000000000000000000000000000000000000000000000000000008152600082516110e6816003850160208701610fdb565b615d3d60f01b6003939091019283015250600501919050565b7f615b000000000000000000000000000000000000000000000000000000000000815260008251611137816002850160208701610fdb565b615d3d60f01b6002939091019283015250600401919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561117957600080fd5b82359150602083013567ffffffffffffffff8082111561119857600080fd5b818501915085601f8301126111ac57600080fd5b8135818111156111be576111be611150565b604051601f8201601f19908116603f011681019083821181831017156111e6576111e6611150565b816040528281528860208487010111156111ff57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b7f745b000000000000000000000000000000000000000000000000000000000000815260008251611137816002850160208701610fdb565b634e487b7160e01b600052601160045260246000fd5b8082018082111561028c5761028c611259565b634e487b7160e01b600052603260045260246000fd5b6000600182016112aa576112aa611259565b5060010190565b8181038181111561028c5761028c611259565b634e487b7160e01b600052600160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6000826112ff576112ff6112da565b500690565b600082611313576113136112da565b50049056fea26469706673582212203572cfc5fcb1ebedbb66aca92142c81b01bd1363a5a1c1b46d18a861668d369764736f6c63430008110033", + "devdoc": { + "details": "Resolves names on ENS by interpreting record data stored in a DNS TXT record. This resolver implements the IExtendedDNSResolver interface, meaning that when a DNS name specifies it as the resolver via a TXT record, this resolver's resolve() method is invoked, and is passed any additional information from that text record. This resolver implements a simple text parser allowing a variety of records to be specified in text, which will then be used to resolve the name in ENS. To use this, set a TXT record on your DNS name in the following format: ENS1
For example: ENS1 2.dnsname.ens.eth a[60]=0x1234... The record data consists of a series of key=value pairs, separated by spaces. Keys may have an optional argument in square brackets, and values may be either unquoted - in which case they may not contain spaces - or single-quoted. Single quotes in a quoted value may be backslash-escaped. ┌────────┐ │ ┌───┐ │ ┌──────────────────────────────┴─┤\" \"│◄─┴────────────────────────────────────────┐ │ └───┘ │ │ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌────────────┐ ┌───┐ │ ^─┴─►│key├─┬─►│\"[\"├───►│arg├───►│\"]\"├─┬─►│\"=\"├─┬─►│\"'\"├───►│quoted_value├───►│\"'\"├─┼─$ └───┘ │ └───┘ └───┘ └───┘ │ └───┘ │ └───┘ └────────────┘ └───┘ │ └──────────────────────────┘ │ ┌──────────────┐ │ └─────────►│unquoted_value├─────────┘ └──────────────┘ Record types: - a[] - Specifies how an `addr()` request should be resolved for the specified `coinType`. Ethereum has `coinType` 60. The value must be 0x-prefixed hexadecimal, and will be returned unmodified; this means that non-EVM addresses will need to be translated into binary format and then encoded in hex. Examples: - a[60]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7 - a[0]=0x00149010587f8364b964fcaa70687216b53bd2cbd798 - a[e] - Specifies how an `addr()` request should be resolved for the specified `chainId`. The value must be 0x-prefixed hexadecimal. When encoding an address for an EVM-based cryptocurrency that uses a chainId instead of a coinType, this syntax *must* be used in place of the coin type - eg, Optimism is `a[e10]`, not `a[2147483658]`. A list of supported cryptocurrencies for both syntaxes can be found here: https://github.com/ensdomains/address-encoder/blob/master/docs/supported-cryptocurrencies.md Example: - a[e10]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7 - t[] - Specifies how a `text()` request should be resolved for the specified `key`. Examples: - t[com.twitter]=nicksdjohnson - t[url]='https://ens.domains/' - t[note]='I\\'m great'", + "kind": "dev", + "methods": { + "supportsInterface(bytes4)": { + "details": "Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/LegacyENSRegistry.json b/solidity/dns-contracts/deployments/sepolia/LegacyENSRegistry.json new file mode 100644 index 0000000..cf482c6 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/LegacyENSRegistry.json @@ -0,0 +1,399 @@ +{ + "address": "0x94f523b8261B815b87EFfCf4d18E6aBeF18d6e4b", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NewOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "NewResolver", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "NewTTL", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "recordExists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "resolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "ttl", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x7cdead963bc81e17a784cee8b5d278b01ab75722732a72b24c2783453a1314c5", + "receipt": { + "to": null, + "from": "0x0F32b753aFc8ABad9Ca6fE589F707755f4df2353", + "contractAddress": "0x94f523b8261B815b87EFfCf4d18E6aBeF18d6e4b", + "transactionIndex": 103, + "gasUsed": "643649", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x073960db096940bde9583ce199eb65a828bed004f92fc3c5bd1159515456f5a5", + "transactionHash": "0x7cdead963bc81e17a784cee8b5d278b01ab75722732a72b24c2783453a1314c5", + "logs": [], + "blockNumber": 3702721, + "cumulativeGasUsed": "9966264", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "bytecode": "0x608060405234801561001057600080fd5b5060008080526020527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb580546001600160a01b03191633179055610a43806100596000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c80635b0fc9c311610081578063cf4088231161005b578063cf40882314610204578063e985e9c514610217578063f79fe5381461026357600080fd5b80635b0fc9c3146101cb5780635ef2c7f0146101de578063a22cb465146101f157600080fd5b806314ab9038116100b257806314ab90381461015657806316a25cbd1461016b5780631896f70a146101b857600080fd5b80630178b8bf146100d957806302571be31461012257806306ab592314610135575b600080fd5b6101056100e7366004610832565b6000908152602081905260409020600101546001600160a01b031690565b6040516001600160a01b0390911681526020015b60405180910390f35b610105610130366004610832565b61028e565b610148610143366004610867565b6102bc565b604051908152602001610119565b6101696101643660046108b4565b6103bc565b005b61019f610179366004610832565b600090815260208190526040902060010154600160a01b900467ffffffffffffffff1690565b60405167ffffffffffffffff9091168152602001610119565b6101696101c63660046108e0565b6104a3565b6101696101d93660046108e0565b610575565b6101696101ec366004610903565b610641565b6101696101ff36600461095a565b610663565b610169610212366004610996565b6106cf565b6102536102253660046109e3565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b6040519015158152602001610119565b610253610271366004610832565b6000908152602081905260409020546001600160a01b0316151590565b6000818152602081905260408120546001600160a01b03163081036102b65750600092915050565b92915050565b60008381526020819052604081205484906001600160a01b03163381148061030757506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61031057600080fd5b604080516020810188905290810186905260009060600160408051601f1981840301815291815281516020928301206000818152928390529120805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03881617905590506040516001600160a01b0386168152869088907fce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e829060200160405180910390a39695505050505050565b60008281526020819052604090205482906001600160a01b03163381148061040757506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61041057600080fd5b60405167ffffffffffffffff8416815284907f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa689060200160405180910390a25050600091825260208290526040909120600101805467ffffffffffffffff909216600160a01b027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff909216919091179055565b60008281526020819052604090205482906001600160a01b0316338114806104ee57506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6104f757600080fd5b6040516001600160a01b038416815284907f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a09060200160405180910390a25050600091825260208290526040909120600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909216919091179055565b60008281526020819052604090205482906001600160a01b0316338114806105c057506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6105c957600080fd5b6000848152602081905260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385161790556040516001600160a01b038416815284907fd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d2669060200160405180910390a250505050565b600061064e8686866102bc565b905061065b8184846106ea565b505050505050565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6106d98484610575565b6106e48483836106ea565b50505050565b6000838152602081905260409020600101546001600160a01b0383811691161461077d5760008381526020818152604091829020600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038616908117909155915191825284917f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0910160405180910390a25b60008381526020819052604090206001015467ffffffffffffffff828116600160a01b909204161461082d576000838152602081815260409182902060010180547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff16600160a01b67ffffffffffffffff861690810291909117909155915191825284917f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa68910160405180910390a25b505050565b60006020828403121561084457600080fd5b5035919050565b80356001600160a01b038116811461086257600080fd5b919050565b60008060006060848603121561087c57600080fd5b83359250602084013591506108936040850161084b565b90509250925092565b803567ffffffffffffffff8116811461086257600080fd5b600080604083850312156108c757600080fd5b823591506108d76020840161089c565b90509250929050565b600080604083850312156108f357600080fd5b823591506108d76020840161084b565b600080600080600060a0868803121561091b57600080fd5b85359450602086013593506109326040870161084b565b92506109406060870161084b565b915061094e6080870161089c565b90509295509295909350565b6000806040838503121561096d57600080fd5b6109768361084b565b91506020830135801515811461098b57600080fd5b809150509250929050565b600080600080608085870312156109ac57600080fd5b843593506109bc6020860161084b565b92506109ca6040860161084b565b91506109d86060860161089c565b905092959194509250565b600080604083850312156109f657600080fd5b6109ff8361084b565b91506108d76020840161084b56fea2646970667358221220d84b48b092515b90ab37b81060fd4db1dbc781903a719013c152ed8151eacd2c64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100d45760003560e01c80635b0fc9c311610081578063cf4088231161005b578063cf40882314610204578063e985e9c514610217578063f79fe5381461026357600080fd5b80635b0fc9c3146101cb5780635ef2c7f0146101de578063a22cb465146101f157600080fd5b806314ab9038116100b257806314ab90381461015657806316a25cbd1461016b5780631896f70a146101b857600080fd5b80630178b8bf146100d957806302571be31461012257806306ab592314610135575b600080fd5b6101056100e7366004610832565b6000908152602081905260409020600101546001600160a01b031690565b6040516001600160a01b0390911681526020015b60405180910390f35b610105610130366004610832565b61028e565b610148610143366004610867565b6102bc565b604051908152602001610119565b6101696101643660046108b4565b6103bc565b005b61019f610179366004610832565b600090815260208190526040902060010154600160a01b900467ffffffffffffffff1690565b60405167ffffffffffffffff9091168152602001610119565b6101696101c63660046108e0565b6104a3565b6101696101d93660046108e0565b610575565b6101696101ec366004610903565b610641565b6101696101ff36600461095a565b610663565b610169610212366004610996565b6106cf565b6102536102253660046109e3565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b6040519015158152602001610119565b610253610271366004610832565b6000908152602081905260409020546001600160a01b0316151590565b6000818152602081905260408120546001600160a01b03163081036102b65750600092915050565b92915050565b60008381526020819052604081205484906001600160a01b03163381148061030757506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61031057600080fd5b604080516020810188905290810186905260009060600160408051601f1981840301815291815281516020928301206000818152928390529120805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03881617905590506040516001600160a01b0386168152869088907fce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e829060200160405180910390a39695505050505050565b60008281526020819052604090205482906001600160a01b03163381148061040757506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61041057600080fd5b60405167ffffffffffffffff8416815284907f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa689060200160405180910390a25050600091825260208290526040909120600101805467ffffffffffffffff909216600160a01b027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff909216919091179055565b60008281526020819052604090205482906001600160a01b0316338114806104ee57506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6104f757600080fd5b6040516001600160a01b038416815284907f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a09060200160405180910390a25050600091825260208290526040909120600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909216919091179055565b60008281526020819052604090205482906001600160a01b0316338114806105c057506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6105c957600080fd5b6000848152602081905260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385161790556040516001600160a01b038416815284907fd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d2669060200160405180910390a250505050565b600061064e8686866102bc565b905061065b8184846106ea565b505050505050565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6106d98484610575565b6106e48483836106ea565b50505050565b6000838152602081905260409020600101546001600160a01b0383811691161461077d5760008381526020818152604091829020600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038616908117909155915191825284917f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0910160405180910390a25b60008381526020819052604090206001015467ffffffffffffffff828116600160a01b909204161461082d576000838152602081815260409182902060010180547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff16600160a01b67ffffffffffffffff861690810291909117909155915191825284917f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa68910160405180910390a25b505050565b60006020828403121561084457600080fd5b5035919050565b80356001600160a01b038116811461086257600080fd5b919050565b60008060006060848603121561087c57600080fd5b83359250602084013591506108936040850161084b565b90509250925092565b803567ffffffffffffffff8116811461086257600080fd5b600080604083850312156108c757600080fd5b823591506108d76020840161089c565b90509250929050565b600080604083850312156108f357600080fd5b823591506108d76020840161084b565b600080600080600060a0868803121561091b57600080fd5b85359450602086013593506109326040870161084b565b92506109406060870161084b565b915061094e6080870161089c565b90509295509295909350565b6000806040838503121561096d57600080fd5b6109768361084b565b91506020830135801515811461098b57600080fd5b809150509250929050565b600080600080608085870312156109ac57600080fd5b843593506109bc6020860161084b565b92506109ca6040860161084b565b91506109d86060860161089c565b905092959194509250565b600080604083850312156109f657600080fd5b6109ff8361084b565b91506108d76020840161084b56fea2646970667358221220d84b48b092515b90ab37b81060fd4db1dbc781903a719013c152ed8151eacd2c64736f6c63430008110033" +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/LegacyETHRegistrarController.json b/solidity/dns-contracts/deployments/sepolia/LegacyETHRegistrarController.json new file mode 100644 index 0000000..1f4a2f6 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/LegacyETHRegistrarController.json @@ -0,0 +1,602 @@ +{ + "address": "0x7e02892cfc2Bfd53a75275451d73cF620e793fc0", + "abi": [ + { + "inputs": [ + { + "internalType": "contract BaseRegistrar", + "name": "_base", + "type": "address" + }, + { + "internalType": "contract PriceOracle", + "name": "_prices", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minCommitmentAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxCommitmentAge", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRenewed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oracle", + "type": "address" + } + ], + "name": "NewPriceOracle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "MIN_REGISTRATION_DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "available", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "commit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "commitments", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + } + ], + "name": "makeCommitment", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "makeCommitmentWithConfig", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "maxCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "minCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + } + ], + "name": "register", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "registerWithConfig", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "rentPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_minCommitmentAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxCommitmentAge", + "type": "uint256" + } + ], + "name": "setCommitmentAges", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract PriceOracle", + "name": "_prices", + "type": "address" + } + ], + "name": "setPriceOracle", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "valid", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "withdraw", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x3d289ffcfda7cd24dc7a2a833e297323ab7e9aa4410f685ed7fd16f6a49ffdbc", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x7e02892cfc2Bfd53a75275451d73cF620e793fc0", + "transactionIndex": 99, + "gasUsed": "1854573", + "logsBloom": "0x00000000000000000000000000000000000000000000200080800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000004000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000008000000000000000000000000000040000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xe06eafbfccaa921d3bac3c1eb96aac0de6512c199082ea45414e4900c16b5fa5", + "transactionHash": "0x3d289ffcfda7cd24dc7a2a833e297323ab7e9aa4410f685ed7fd16f6a49ffdbc", + "logs": [ + { + "transactionIndex": 99, + "blockNumber": 3790197, + "transactionHash": "0x3d289ffcfda7cd24dc7a2a833e297323ab7e9aa4410f685ed7fd16f6a49ffdbc", + "address": "0x7e02892cfc2Bfd53a75275451d73cF620e793fc0", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8" + ], + "data": "0x", + "logIndex": 1147, + "blockHash": "0xe06eafbfccaa921d3bac3c1eb96aac0de6512c199082ea45414e4900c16b5fa5" + } + ], + "blockNumber": 3790197, + "cumulativeGasUsed": "15120176", + "status": 1, + "byzantium": true + }, + "args": [ + "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85", + "0x6810dbce73c67506f785a225f818b30d8f209aab", + 60, + 86400 + ], + "numDeployments": 1, + "bytecode": "0x608060405234801561001057600080fd5b50604051611f8c380380611f8c8339818101604052608081101561003357600080fd5b5080516020820151604080840151606090940151600080546001600160a01b031916331780825592519495939491926001600160a01b0316917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a381811161009d57600080fd5b600180546001600160a01b039586166001600160a01b0319918216179091556002805494909516931692909217909255600391909155600455611ea7806100e56000396000f3fe60806040526004361061016a5760003560e01c80638d839ffe116100cb578063aeb8ce9b1161007f578063f2fde38b11610059578063f2fde38b1461075f578063f49826be1461079f578063f7a169631461086d5761016a565b8063aeb8ce9b1461066d578063ce1e09c014610720578063f14fcbc8146107355761016a565b80638f32d59b116100b05780638f32d59b146105355780639791c0971461054a578063acf1a841146105fd5761016a565b80638d839ffe146104e25780638da5cb5b146104f75761016a565b80637e3244791161012257806383e7f6ff1161010757806383e7f6ff1461038657806385f6d1551461043b5780638a95b09f146104cd5761016a565b80637e3244791461032c578063839df9451461035c5761016a565b80633d86c52f116101535780633d86c52f146101e6578063530e784f146102d7578063715018a6146103175761016a565b806301ffc9a71461016f5780633ccfd60b146101cf575b600080fd5b34801561017b57600080fd5b506101bb6004803603602081101561019257600080fd5b50357fffffffff0000000000000000000000000000000000000000000000000000000016610944565b604080519115158252519081900360200190f35b3480156101db57600080fd5b506101e4610b63565b005b3480156101f257600080fd5b506102c5600480360360a081101561020957600080fd5b81019060208101813564010000000081111561022457600080fd5b82018360208201111561023657600080fd5b8035906020019184600183028401116401000000008311171561025857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff83358116945060208401359360408101358216935060600135169050610ba3565b60408051918252519081900360200190f35b3480156102e357600080fd5b506101e4600480360360208110156102fa57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610cdf565b34801561032357600080fd5b506101e4610d65565b34801561033857600080fd5b506101e46004803603604081101561034f57600080fd5b5080359060200135610de5565b34801561036857600080fd5b506102c56004803603602081101561037f57600080fd5b5035610e01565b34801561039257600080fd5b506102c5600480360360408110156103a957600080fd5b8101906020810181356401000000008111156103c457600080fd5b8201836020820111156103d657600080fd5b803590602001918460018302840111640100000000831117156103f857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610e13915050565b6101e46004803603608081101561045157600080fd5b81019060208101813564010000000081111561046c57600080fd5b82018360208201111561047e57600080fd5b803590602001918460018302840111640100000000831117156104a057600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff8135169060208101359060400135610fc3565b3480156104d957600080fd5b506102c561100e565b3480156104ee57600080fd5b506102c5611015565b34801561050357600080fd5b5061050c61101b565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561054157600080fd5b506101bb611037565b34801561055657600080fd5b506101bb6004803603602081101561056d57600080fd5b81019060208101813564010000000081111561058857600080fd5b82018360208201111561059a57600080fd5b803590602001918460018302840111640100000000831117156105bc57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611055945050505050565b6101e46004803603604081101561061357600080fd5b81019060208101813564010000000081111561062e57600080fd5b82018360208201111561064057600080fd5b8035906020019184600183028401116401000000008311171561066257600080fd5b91935091503561106a565b34801561067957600080fd5b506101bb6004803603602081101561069057600080fd5b8101906020810181356401000000008111156106ab57600080fd5b8201836020820111156106bd57600080fd5b803590602001918460018302840111640100000000831117156106df57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611252945050505050565b34801561072c57600080fd5b506102c5611312565b34801561074157600080fd5b506101e46004803603602081101561075857600080fd5b5035611318565b34801561076b57600080fd5b506101e46004803603602081101561078257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661134a565b3480156107ab57600080fd5b506102c5600480360360608110156107c257600080fd5b8101906020810181356401000000008111156107dd57600080fd5b8201836020820111156107ef57600080fd5b8035906020019184600183028401116401000000008311171561081157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff8335169350505060200135611364565b6101e4600480360360c081101561088357600080fd5b81019060208101813564010000000081111561089e57600080fd5b8201836020820111156108b057600080fd5b803590602001918460018302840111640100000000831117156108d257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff83358116945060208401359360408101359350606081013582169250608001351661137c565b604080517f737570706f727473496e74657266616365286279746573342900000000000000815290519081900360190190206000907fffffffff0000000000000000000000000000000000000000000000000000000083811691161480610ae75750604080517f72656e657728737472696e672c75696e743235362900000000000000000000008152905190819003601501812090806028611de38239604080519182900360280182207f636f6d6d697428627974657333322900000000000000000000000000000000008352905191829003600f01822090925090806026611e0b82396026019050604051809103902060405180807f617661696c61626c6528737472696e67290000000000000000000000000000008152506011019050604051809103902060405180807f72656e74507269636528737472696e672c75696e7432353629000000000000008152506019019050604051809103902018181818187bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610b5d57506040518080611da36040913960408051918290030181209150806042611e31823960420190506040518091039020187bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b92915050565b610b6b611037565b610b7457600080fd5b60405133904780156108fc02916000818181858888f19350505050158015610ba0573d6000803e3d6000fd5b50565b8451602086012060009073ffffffffffffffffffffffffffffffffffffffff8416158015610be5575073ffffffffffffffffffffffffffffffffffffffff8316155b15610c4857604080516020808201939093527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089901b1681830152605480820188905282518083039091018152607490910190915280519101209050610cd6565b73ffffffffffffffffffffffffffffffffffffffff8416610c6857600080fd5b604080516020808201939093527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b82168385015287811b8216605484015286901b166068820152607c80820188905282518083039091018152609c909101909152805191012090505b95945050505050565b610ce7611037565b610cf057600080fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691909117918290556040519116907ff261845a790fe29bbd6631e2ca4a5bdc83e6eed7c3271d9590d97287e00e912390600090a250565b610d6d611037565b610d7657600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b610ded611037565b610df657600080fd5b600391909155600455565b60056020526000908152604090205481565b8151602080840191909120600254600154604080517fd6e4fa8600000000000000000000000000000000000000000000000000000000815260048101859052905160009573ffffffffffffffffffffffffffffffffffffffff948516946350e9a715948a9491169263d6e4fa8692602480840193919291829003018186803b158015610e9e57600080fd5b505afa158015610eb2573d6000803e3d6000fd5b505050506040513d6020811015610ec857600080fd5b50516040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152602481018290526044810188905260606004820190815283516064830152835189928291608490910190602087019080838360005b83811015610f43578181015183820152602001610f2b565b50505050905090810190601f168015610f705780820380516001836020036101000a031916815260200191505b5094505050505060206040518083038186803b158015610f8f57600080fd5b505afa158015610fa3573d6000803e3d6000fd5b505050506040513d6020811015610fb957600080fd5b5051949350505050565b61100785858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508893508792508691508061137c565b5050505050565b6224ea0081565b60035481565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60005473ffffffffffffffffffffffffffffffffffffffff16331490565b6000600361106283611a7c565b101592915050565b60006110ad84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869250610e13915050565b9050803410156110bc57600080fd5b6000848460405180838380828437604080519390910183900383206001547fc475abff00000000000000000000000000000000000000000000000000000000855260048501829052602485018b905291519097506000965073ffffffffffffffffffffffffffffffffffffffff909116945063c475abff93506044808401936020935082900301818787803b15801561115457600080fd5b505af1158015611168573d6000803e3d6000fd5b505050506040513d602081101561117e57600080fd5b50519050348310156111bb5760405133903485900380156108fc02916000818181858888f193505050501580156111b9573d6000803e3d6000fd5b505b817f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae8787868560405180806020018481526020018381526020018281038252868682818152602001925080828437600083820152604051601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690920182900397509095505050505050a2505050505050565b8051602082012060009061126583611055565b801561130b5750600154604080517f96e494e800000000000000000000000000000000000000000000000000000000815260048101849052905173ffffffffffffffffffffffffffffffffffffffff909216916396e494e891602480820192602092909190829003018186803b1580156112de57600080fd5b505afa1580156112f2573d6000803e3d6000fd5b505050506040513d602081101561130857600080fd5b50515b9392505050565b60045481565b6004546000828152600560205260409020544291011061133757600080fd5b6000908152600560205260409020429055565b611352611037565b61135b57600080fd5b610ba081611c68565b6000611374848484600080610ba3565b949350505050565b600061138b8787868686610ba3565b9050600061139a888784611d15565b885160208a012090915080600073ffffffffffffffffffffffffffffffffffffffff8716156118a257600154604080517ffca247ac00000000000000000000000000000000000000000000000000000000815260048101859052306024820152604481018c9052905173ffffffffffffffffffffffffffffffffffffffff9092169163fca247ac916064808201926020929091908290030181600087803b15801561144457600080fd5b505af1158015611458573d6000803e3d6000fd5b505050506040513d602081101561146e57600080fd5b5051600154604080517fddf7fcb0000000000000000000000000000000000000000000000000000000008152905192935060009273ffffffffffffffffffffffffffffffffffffffff9092169163ddf7fcb091600480820192602092909190829003018186803b1580156114e157600080fd5b505afa1580156114f5573d6000803e3d6000fd5b505050506040513d602081101561150b57600080fd5b505160408051602081810193909352808201879052815180820383018152606082018084528151918501919091206001547f3f15457f00000000000000000000000000000000000000000000000000000000909252925192945073ffffffffffffffffffffffffffffffffffffffff1692633f15457f92606480840193829003018186803b15801561159c57600080fd5b505afa1580156115b0573d6000803e3d6000fd5b505050506040513d60208110156115c657600080fd5b5051604080517f1896f70a0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8b8116602483015291519190921691631896f70a91604480830192600092919082900301818387803b15801561164057600080fd5b505af1158015611654573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff871615611714578773ffffffffffffffffffffffffffffffffffffffff1663d5fa2b0082896040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050600060405180830381600087803b1580156116fb57600080fd5b505af115801561170f573d6000803e3d6000fd5b505050505b600154604080517f28ed4f6c0000000000000000000000000000000000000000000000000000000081526004810186905273ffffffffffffffffffffffffffffffffffffffff8e81166024830152915191909216916328ed4f6c91604480830192600092919082900301818387803b15801561178f57600080fd5b505af11580156117a3573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd308d866040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561188457600080fd5b505af1158015611898573d6000803e3d6000fd5b5050505050611975565b73ffffffffffffffffffffffffffffffffffffffff8616156118c357600080fd5b600154604080517ffca247ac0000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff8d81166024830152604482018d90529151919092169163fca247ac9160648083019260209291908290030181600087803b15801561194657600080fd5b505af115801561195a573d6000803e3d6000fd5b505050506040513d602081101561197057600080fd5b505190505b8973ffffffffffffffffffffffffffffffffffffffff16837fca6abbe9d7f11422cb6ca7629fbf6fe9efb1c621f71ce8f02b9f2a230097404f8d87856040518080602001848152602001838152602001828103825285818151815260200191508051906020019080838360005b838110156119fa5781810151838201526020016119e2565b50505050905090810190601f168015611a275780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a383341115611a6f5760405133903486900380156108fc02916000818181858888f19350505050158015611a6d573d6000803e3d6000fd5b505b5050505050505050505050565b8051600090819081905b80821015611c5f576000858381518110611a9c57fe5b01602001517fff000000000000000000000000000000000000000000000000000000000000001690507f8000000000000000000000000000000000000000000000000000000000000000811015611af857600183019250611c53565b7fe0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611b4d57600283019250611c53565b7ff0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611ba257600383019250611c53565b7ff8000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611bf757600483019250611c53565b7ffc000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611c4c57600583019250611c53565b6006830192505b50600190920191611a86565b50909392505050565b73ffffffffffffffffffffffffffffffffffffffff8116611c8857600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60035460008281526005602052604081205490914291011115611d3757600080fd5b60045460008381526005602052604090205442910111611d5657600080fd5b611d5f84611252565b611d6857600080fd5b6000828152600560205260408120819055611d838585610e13565b90506224ea00841015611d9557600080fd5b8034101561137457600080fdfe6d616b65436f6d6d69746d656e7457697468436f6e66696728737472696e672c616464726573732c627974657333322c616464726573732c6164647265737329726567697374657228737472696e672c616464726573732c75696e743235362c62797465733332296d616b65436f6d6d69746d656e7428737472696e672c616464726573732c6279746573333229726567697374657257697468436f6e66696728737472696e672c616464726573732c75696e743235362c627974657333322c616464726573732c6164647265737329a265627a7a7231582053a253c3d59287a7d8afcbca61f9a34825e2003361654c7f2350c82db76d3db764736f6c63430005110032", + "deployedBytecode": "0x60806040526004361061016a5760003560e01c80638d839ffe116100cb578063aeb8ce9b1161007f578063f2fde38b11610059578063f2fde38b1461075f578063f49826be1461079f578063f7a169631461086d5761016a565b8063aeb8ce9b1461066d578063ce1e09c014610720578063f14fcbc8146107355761016a565b80638f32d59b116100b05780638f32d59b146105355780639791c0971461054a578063acf1a841146105fd5761016a565b80638d839ffe146104e25780638da5cb5b146104f75761016a565b80637e3244791161012257806383e7f6ff1161010757806383e7f6ff1461038657806385f6d1551461043b5780638a95b09f146104cd5761016a565b80637e3244791461032c578063839df9451461035c5761016a565b80633d86c52f116101535780633d86c52f146101e6578063530e784f146102d7578063715018a6146103175761016a565b806301ffc9a71461016f5780633ccfd60b146101cf575b600080fd5b34801561017b57600080fd5b506101bb6004803603602081101561019257600080fd5b50357fffffffff0000000000000000000000000000000000000000000000000000000016610944565b604080519115158252519081900360200190f35b3480156101db57600080fd5b506101e4610b63565b005b3480156101f257600080fd5b506102c5600480360360a081101561020957600080fd5b81019060208101813564010000000081111561022457600080fd5b82018360208201111561023657600080fd5b8035906020019184600183028401116401000000008311171561025857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff83358116945060208401359360408101358216935060600135169050610ba3565b60408051918252519081900360200190f35b3480156102e357600080fd5b506101e4600480360360208110156102fa57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610cdf565b34801561032357600080fd5b506101e4610d65565b34801561033857600080fd5b506101e46004803603604081101561034f57600080fd5b5080359060200135610de5565b34801561036857600080fd5b506102c56004803603602081101561037f57600080fd5b5035610e01565b34801561039257600080fd5b506102c5600480360360408110156103a957600080fd5b8101906020810181356401000000008111156103c457600080fd5b8201836020820111156103d657600080fd5b803590602001918460018302840111640100000000831117156103f857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610e13915050565b6101e46004803603608081101561045157600080fd5b81019060208101813564010000000081111561046c57600080fd5b82018360208201111561047e57600080fd5b803590602001918460018302840111640100000000831117156104a057600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff8135169060208101359060400135610fc3565b3480156104d957600080fd5b506102c561100e565b3480156104ee57600080fd5b506102c5611015565b34801561050357600080fd5b5061050c61101b565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561054157600080fd5b506101bb611037565b34801561055657600080fd5b506101bb6004803603602081101561056d57600080fd5b81019060208101813564010000000081111561058857600080fd5b82018360208201111561059a57600080fd5b803590602001918460018302840111640100000000831117156105bc57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611055945050505050565b6101e46004803603604081101561061357600080fd5b81019060208101813564010000000081111561062e57600080fd5b82018360208201111561064057600080fd5b8035906020019184600183028401116401000000008311171561066257600080fd5b91935091503561106a565b34801561067957600080fd5b506101bb6004803603602081101561069057600080fd5b8101906020810181356401000000008111156106ab57600080fd5b8201836020820111156106bd57600080fd5b803590602001918460018302840111640100000000831117156106df57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611252945050505050565b34801561072c57600080fd5b506102c5611312565b34801561074157600080fd5b506101e46004803603602081101561075857600080fd5b5035611318565b34801561076b57600080fd5b506101e46004803603602081101561078257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661134a565b3480156107ab57600080fd5b506102c5600480360360608110156107c257600080fd5b8101906020810181356401000000008111156107dd57600080fd5b8201836020820111156107ef57600080fd5b8035906020019184600183028401116401000000008311171561081157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff8335169350505060200135611364565b6101e4600480360360c081101561088357600080fd5b81019060208101813564010000000081111561089e57600080fd5b8201836020820111156108b057600080fd5b803590602001918460018302840111640100000000831117156108d257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff83358116945060208401359360408101359350606081013582169250608001351661137c565b604080517f737570706f727473496e74657266616365286279746573342900000000000000815290519081900360190190206000907fffffffff0000000000000000000000000000000000000000000000000000000083811691161480610ae75750604080517f72656e657728737472696e672c75696e743235362900000000000000000000008152905190819003601501812090806028611de38239604080519182900360280182207f636f6d6d697428627974657333322900000000000000000000000000000000008352905191829003600f01822090925090806026611e0b82396026019050604051809103902060405180807f617661696c61626c6528737472696e67290000000000000000000000000000008152506011019050604051809103902060405180807f72656e74507269636528737472696e672c75696e7432353629000000000000008152506019019050604051809103902018181818187bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610b5d57506040518080611da36040913960408051918290030181209150806042611e31823960420190506040518091039020187bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b92915050565b610b6b611037565b610b7457600080fd5b60405133904780156108fc02916000818181858888f19350505050158015610ba0573d6000803e3d6000fd5b50565b8451602086012060009073ffffffffffffffffffffffffffffffffffffffff8416158015610be5575073ffffffffffffffffffffffffffffffffffffffff8316155b15610c4857604080516020808201939093527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089901b1681830152605480820188905282518083039091018152607490910190915280519101209050610cd6565b73ffffffffffffffffffffffffffffffffffffffff8416610c6857600080fd5b604080516020808201939093527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b82168385015287811b8216605484015286901b166068820152607c80820188905282518083039091018152609c909101909152805191012090505b95945050505050565b610ce7611037565b610cf057600080fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691909117918290556040519116907ff261845a790fe29bbd6631e2ca4a5bdc83e6eed7c3271d9590d97287e00e912390600090a250565b610d6d611037565b610d7657600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b610ded611037565b610df657600080fd5b600391909155600455565b60056020526000908152604090205481565b8151602080840191909120600254600154604080517fd6e4fa8600000000000000000000000000000000000000000000000000000000815260048101859052905160009573ffffffffffffffffffffffffffffffffffffffff948516946350e9a715948a9491169263d6e4fa8692602480840193919291829003018186803b158015610e9e57600080fd5b505afa158015610eb2573d6000803e3d6000fd5b505050506040513d6020811015610ec857600080fd5b50516040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152602481018290526044810188905260606004820190815283516064830152835189928291608490910190602087019080838360005b83811015610f43578181015183820152602001610f2b565b50505050905090810190601f168015610f705780820380516001836020036101000a031916815260200191505b5094505050505060206040518083038186803b158015610f8f57600080fd5b505afa158015610fa3573d6000803e3d6000fd5b505050506040513d6020811015610fb957600080fd5b5051949350505050565b61100785858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508893508792508691508061137c565b5050505050565b6224ea0081565b60035481565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60005473ffffffffffffffffffffffffffffffffffffffff16331490565b6000600361106283611a7c565b101592915050565b60006110ad84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869250610e13915050565b9050803410156110bc57600080fd5b6000848460405180838380828437604080519390910183900383206001547fc475abff00000000000000000000000000000000000000000000000000000000855260048501829052602485018b905291519097506000965073ffffffffffffffffffffffffffffffffffffffff909116945063c475abff93506044808401936020935082900301818787803b15801561115457600080fd5b505af1158015611168573d6000803e3d6000fd5b505050506040513d602081101561117e57600080fd5b50519050348310156111bb5760405133903485900380156108fc02916000818181858888f193505050501580156111b9573d6000803e3d6000fd5b505b817f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae8787868560405180806020018481526020018381526020018281038252868682818152602001925080828437600083820152604051601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690920182900397509095505050505050a2505050505050565b8051602082012060009061126583611055565b801561130b5750600154604080517f96e494e800000000000000000000000000000000000000000000000000000000815260048101849052905173ffffffffffffffffffffffffffffffffffffffff909216916396e494e891602480820192602092909190829003018186803b1580156112de57600080fd5b505afa1580156112f2573d6000803e3d6000fd5b505050506040513d602081101561130857600080fd5b50515b9392505050565b60045481565b6004546000828152600560205260409020544291011061133757600080fd5b6000908152600560205260409020429055565b611352611037565b61135b57600080fd5b610ba081611c68565b6000611374848484600080610ba3565b949350505050565b600061138b8787868686610ba3565b9050600061139a888784611d15565b885160208a012090915080600073ffffffffffffffffffffffffffffffffffffffff8716156118a257600154604080517ffca247ac00000000000000000000000000000000000000000000000000000000815260048101859052306024820152604481018c9052905173ffffffffffffffffffffffffffffffffffffffff9092169163fca247ac916064808201926020929091908290030181600087803b15801561144457600080fd5b505af1158015611458573d6000803e3d6000fd5b505050506040513d602081101561146e57600080fd5b5051600154604080517fddf7fcb0000000000000000000000000000000000000000000000000000000008152905192935060009273ffffffffffffffffffffffffffffffffffffffff9092169163ddf7fcb091600480820192602092909190829003018186803b1580156114e157600080fd5b505afa1580156114f5573d6000803e3d6000fd5b505050506040513d602081101561150b57600080fd5b505160408051602081810193909352808201879052815180820383018152606082018084528151918501919091206001547f3f15457f00000000000000000000000000000000000000000000000000000000909252925192945073ffffffffffffffffffffffffffffffffffffffff1692633f15457f92606480840193829003018186803b15801561159c57600080fd5b505afa1580156115b0573d6000803e3d6000fd5b505050506040513d60208110156115c657600080fd5b5051604080517f1896f70a0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8b8116602483015291519190921691631896f70a91604480830192600092919082900301818387803b15801561164057600080fd5b505af1158015611654573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff871615611714578773ffffffffffffffffffffffffffffffffffffffff1663d5fa2b0082896040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050600060405180830381600087803b1580156116fb57600080fd5b505af115801561170f573d6000803e3d6000fd5b505050505b600154604080517f28ed4f6c0000000000000000000000000000000000000000000000000000000081526004810186905273ffffffffffffffffffffffffffffffffffffffff8e81166024830152915191909216916328ed4f6c91604480830192600092919082900301818387803b15801561178f57600080fd5b505af11580156117a3573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd308d866040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561188457600080fd5b505af1158015611898573d6000803e3d6000fd5b5050505050611975565b73ffffffffffffffffffffffffffffffffffffffff8616156118c357600080fd5b600154604080517ffca247ac0000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff8d81166024830152604482018d90529151919092169163fca247ac9160648083019260209291908290030181600087803b15801561194657600080fd5b505af115801561195a573d6000803e3d6000fd5b505050506040513d602081101561197057600080fd5b505190505b8973ffffffffffffffffffffffffffffffffffffffff16837fca6abbe9d7f11422cb6ca7629fbf6fe9efb1c621f71ce8f02b9f2a230097404f8d87856040518080602001848152602001838152602001828103825285818151815260200191508051906020019080838360005b838110156119fa5781810151838201526020016119e2565b50505050905090810190601f168015611a275780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a383341115611a6f5760405133903486900380156108fc02916000818181858888f19350505050158015611a6d573d6000803e3d6000fd5b505b5050505050505050505050565b8051600090819081905b80821015611c5f576000858381518110611a9c57fe5b01602001517fff000000000000000000000000000000000000000000000000000000000000001690507f8000000000000000000000000000000000000000000000000000000000000000811015611af857600183019250611c53565b7fe0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611b4d57600283019250611c53565b7ff0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611ba257600383019250611c53565b7ff8000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611bf757600483019250611c53565b7ffc000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611c4c57600583019250611c53565b6006830192505b50600190920191611a86565b50909392505050565b73ffffffffffffffffffffffffffffffffffffffff8116611c8857600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60035460008281526005602052604081205490914291011115611d3757600080fd5b60045460008381526005602052604090205442910111611d5657600080fd5b611d5f84611252565b611d6857600080fd5b6000828152600560205260408120819055611d838585610e13565b90506224ea00841015611d9557600080fd5b8034101561137457600080fdfe6d616b65436f6d6d69746d656e7457697468436f6e66696728737472696e672c616464726573732c627974657333322c616464726573732c6164647265737329726567697374657228737472696e672c616464726573732c75696e743235362c62797465733332296d616b65436f6d6d69746d656e7428737472696e672c616464726573732c6279746573333229726567697374657257697468436f6e66696728737472696e672c616464726573732c75696e743235362c627974657333322c616464726573732c6164647265737329a265627a7a7231582053a253c3d59287a7d8afcbca61f9a34825e2003361654c7f2350c82db76d3db764736f6c63430005110032" +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/LegacyPublicResolver.json b/solidity/dns-contracts/deployments/sepolia/LegacyPublicResolver.json new file mode 100644 index 0000000..307cc99 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/LegacyPublicResolver.json @@ -0,0 +1,888 @@ +{ + "address": "0x0CeEC524b2807841739D3B5E161F5bf1430FFA48", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + } + ], + "name": "ABIChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "AddrChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isAuthorised", + "type": "bool" + } + ], + "name": "AuthorisationChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "ContenthashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "record", + "type": "bytes" + } + ], + "name": "DNSRecordChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "DNSRecordDeleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "DNSZoneCleared", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "InterfaceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "PubkeyChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "string", + "name": "indexedKey", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "TextChanged", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentTypes", + "type": "uint256" + } + ], + "name": "ABI", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "authorisations", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "clearDNSZone", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "contenthash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "dnsRecord", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + } + ], + "name": "hasDNSRecords", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "interfaceImplementer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "pubkey", + "outputs": [ + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setABI", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "a", + "type": "bytes" + } + ], + "name": "setAddr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "setAddr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bool", + "name": "isAuthorised", + "type": "bool" + } + ], + "name": "setAuthorisation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setContenthash", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setDNSRecords", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "setInterface", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "setPubkey", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "setText", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "text", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x8c91c98c3308a3a14ec741a5e5890d9253466a82e345d11a1ac922f121423461", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x0CeEC524b2807841739D3B5E161F5bf1430FFA48", + "transactionIndex": 122, + "gasUsed": "2382812", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x24f66f1b0652c26f44660cb37de7a62ecf1a31514798249765d93b22daaaa155", + "transactionHash": "0x8c91c98c3308a3a14ec741a5e5890d9253466a82e345d11a1ac922f121423461", + "logs": [], + "blockNumber": 3790166, + "cumulativeGasUsed": "23665216", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "numDeployments": 1, + "bytecode": "0x60806040523480156200001157600080fd5b5060405162002abe38038062002abe83398101604081905262000034916200006d565b600a80546001600160a01b0319166001600160a01b0392909216919091179055620000d6565b80516200006781620000bc565b92915050565b6000602082840312156200008057600080fd5b60006200008e84846200005a565b949350505050565b60006200006782620000b0565b6000620000678262000096565b6001600160a01b031690565b620000c781620000a3565b8114620000d357600080fd5b50565b6129d880620000e66000396000f3fe608060405234801561001057600080fd5b50600436106101985760003560e01c8063691f3431116100e3578063bc1c58d11161008c578063e59d895d11610066578063e59d895d14610387578063f1cb7e061461039a578063f86bc879146103ad57610198565b8063bc1c58d114610340578063c869023314610353578063d5fa2b001461037457610198565b8063a8fa5682116100bd578063a8fa5682146102fa578063ac9650d81461030d578063ad5780af1461032d57610198565b8063691f3431146102c157806377372213146102d45780638b95dd71146102e757610198565b8063304e6ade116101455780634cbf6ba41161011f5780634cbf6ba41461027b57806359d1d43c1461028e578063623195b0146102ae57610198565b8063304e6ade146102425780633b3b57de146102555780633e9ce7941461026857610198565b8063124a319c11610176578063124a319c146101ee5780632203ab561461020e57806329cd62ea1461022f57610198565b806301ffc9a71461019d5780630af179d7146101c657806310f13a8c146101db575b600080fd5b6101b06101ab366004612504565b6103c0565b6040516101bd9190612730565b60405180910390f35b6101d96101d4366004612364565b61041e565b005b6101d96101e93660046123ba565b61060b565b6102016101fc366004612302565b6106b8565b6040516101bd9190612703565b61022161021c36600461224c565b6109f7565b6040516101bd9291906127f3565b6101d961023d36600461227c565b610b16565b6101d9610250366004612364565b610b96565b610201610263366004612164565b610bf5565b6101d9610276366004612209565b610c2a565b6101b061028936600461224c565b610ccf565b6102a161029c366004612364565b610d01565b6040516101bd9190612787565b6101d96102bc366004612441565b610dc3565b6102a16102cf366004612164565b610e3e565b6101d96102e2366004612364565b610edf565b6101d96102f53660046124a9565b610f3e565b6102a16103083660046122bf565b611003565b61032061031b366004612122565b611090565b6040516101bd919061271f565b6101d961033b366004612164565b6111d4565b6102a161034e366004612164565b611227565b610366610361366004612164565b61128f565b6040516101bd92919061274c565b6101d9610382366004612182565b6112a9565b6101d9610395366004612332565b6112d0565b6102a16103a836600461224c565b61139d565b6101b06103bb3660046121bc565b611446565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f59d1d43c00000000000000000000000000000000000000000000000000000000148061041657506104168261146c565b90505b919050565b82610428816114c2565b61043157600080fd5b60008060608082610440611e30565b61048a60008a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505063ffffffff6115d1169050565b90505b610496816115ec565b6105ae5761ffff86166104ee57806040015195506104b3816115fa565b9350836040516020016104c691906126ec565b6040516020818303038152906040528051906020012091506104e781611621565b92506105a0565b60606104f9826115fa565b9050816040015161ffff168761ffff161415806105235750610521858263ffffffff61164216565b155b1561059e576105778b86898d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505050602087015189518c918290039015611660565b81604001519650816020015195508094508480519060200120925061059b82611621565b93505b505b6105a9816118c7565b61048d565b50825115610600576106008984878b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505088518b9250828f03915015611660565b505050505050505050565b84610615816114c2565b61061e57600080fd5b82826009600089815260200190815260200160002087876040516106439291906126df565b90815260405190819003602001902061065d929091611e7b565b50848460405161066e9291906126df565b6040518091039020867fd8c9334b1a9c2f9da342a0a2b32629c1a229b6445dad78947f674b44444a755087876040516106a8929190612775565b60405180910390a3505050505050565b60008281526006602090815260408083207fffffffff000000000000000000000000000000000000000000000000000000008516845290915281205473ffffffffffffffffffffffffffffffffffffffff1680156107175790506109f1565b600061072285610bf5565b905073ffffffffffffffffffffffffffffffffffffffff811661074a576000925050506109f1565b600060608273ffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b60405160240161077d9190612767565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a700000000000000000000000000000000000000000000000000000000179052516107fe91906126ec565b600060405180830381855afa9150503d8060008114610839576040519150601f19603f3d011682016040523d82523d6000602084013e61083e565b606091505b5091509150811580610851575060208151105b8061088d575080601f8151811061086457fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b1561089f5760009450505050506109f1565b8273ffffffffffffffffffffffffffffffffffffffff16866040516024016108c79190612767565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001790525161094891906126ec565b600060405180830381855afa9150503d8060008114610983576040519150601f19603f3d011682016040523d82523d6000602084013e610988565b606091505b50909250905081158061099c575060208151105b806109d8575080601f815181106109af57fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109ea5760009450505050506109f1565b5090925050505b92915050565b600082815260208190526040812060609060015b848111610af85780851615801590610a4357506000818152602083905260409020546002600019610100600184161502019091160415155b15610af0576000818152602083815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845284939192839190830182828015610ade5780601f10610ab357610100808354040283529160200191610ade565b820191906000526020600020905b815481529060010190602001808311610ac157829003601f168201915b50505050509050935093505050610b0f565b60011b610a0b565b505060408051602081019091526000808252925090505b9250929050565b82610b20816114c2565b610b2957600080fd5b6040805180820182528481526020808201858152600088815260089092529083902091518255516001909101555184907f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4690610b88908690869061274c565b60405180910390a250505050565b82610ba0816114c2565b610ba957600080fd5b6000848152600260205260409020610bc2908484611e7b565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610b88929190612775565b60006060610c0483603c61139d565b9050805160001415610c1a576000915050610419565b610c238161199a565b9392505050565b6000838152600b602090815260408083203380855290835281842073ffffffffffffffffffffffffffffffffffffffff871680865293529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515151790555190919085907fe1c5610a6e0cbe10764ecd182adcef1ec338dc4e199c99c32ce98f38e12791df90610cc2908690612730565b60405180910390a4505050565b600091825260056020908152604080842060038352818520548552825280842092845291905290205461ffff16151590565b6060600960008581526020019081526020016000208383604051610d269291906126df565b9081526040805160209281900383018120805460026001821615610100026000190190911604601f81018590048502830185019093528282529092909190830182828015610db55780601f10610d8a57610100808354040283529160200191610db5565b820191906000526020600020905b815481529060010190602001808311610d9857829003601f168201915b505050505090509392505050565b83610dcd816114c2565b610dd657600080fd5b6000198401841615610de757600080fd5b6000858152602081815260408083208784529091529020610e09908484611e7b565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b60008181526007602090815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610ed35780601f10610ea857610100808354040283529160200191610ed3565b820191906000526020600020905b815481529060010190602001808311610eb657829003601f168201915b50505050509050919050565b82610ee9816114c2565b610ef257600080fd5b6000848152600760205260409020610f0b908484611e7b565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610b88929190612775565b82610f48816114c2565b610f5157600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af7528484604051610f839291906127f3565b60405180910390a2603c831415610fd557837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd2610fbf8461199a565b604051610fcc9190612711565b60405180910390a25b600084815260016020908152604080832086845282529091208351610ffc92850190611f17565b5050505050565b6000838152600460209081526040808320600383528184205484528252808320858452825280832061ffff8516845282529182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610db55780601f10610d8a57610100808354040283529160200191610db5565b6040805182815260208084028201019091526060908280156110c657816020015b60608152602001906001900390816110b15790505b50905060005b828110156111cd5760006060308686858181106110e557fe5b6020028201905080357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe13684900301811261111f57600080fd5b9091016020810191503567ffffffffffffffff81111561113e57600080fd5b3681900382131561114e57600080fd5b60405161115c9291906126df565b600060405180830381855af49150503d8060008114611197576040519150601f19603f3d011682016040523d82523d6000602084013e61119c565b606091505b5091509150816111ab57600080fd5b808484815181106111b857fe5b602090810291909101015250506001016110cc565b5092915050565b806111de816114c2565b6111e757600080fd5b600082815260036020526040808220805460010190555183917fb757169b8492ca2f1c6619d9d76ce22803035c3b1d5f6930dffe7b127c1a198391a25050565b600081815260026020818152604092839020805484516001821615610100026000190190911693909304601f81018390048302840183019094528383526060939091830182828015610ed35780601f10610ea857610100808354040283529160200191610ed3565b600090815260086020526040902080546001909101549091565b816112b3816114c2565b6112bc57600080fd5b6112cb83603c6102f5856119c2565b505050565b826112da816114c2565b6112e357600080fd5b60008481526006602090815260408083207fffffffff00000000000000000000000000000000000000000000000000000000871680855292529182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616179055905185907f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa9061138f908690612703565b60405180910390a350505050565b600082815260016020818152604080842085855282529283902080548451600294821615610100026000190190911693909304601f810183900483028401830190945283835260609390918301828280156114395780601f1061140e57610100808354040283529160200191611439565b820191906000526020600020905b81548152906001019060200180831161141c57829003601f168201915b5050505050905092915050565b600b60209081526000938452604080852082529284528284209052825290205460ff1681565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fc86902330000000000000000000000000000000000000000000000000000000014806104165750610416826119fb565b600a546040517f02571be3000000000000000000000000000000000000000000000000000000008152600091829173ffffffffffffffffffffffffffffffffffffffff909116906302571be39061151d90869060040161273e565b60206040518083038186803b15801561153557600080fd5b505afa158015611549573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061156d91908101906120fc565b905073ffffffffffffffffffffffffffffffffffffffff8116331480610c2357506000838152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452825280832033845290915290205460ff16915050919050565b6115d9611e30565b82815260c081018290526109f1816118c7565b805151602090910151101590565b60208101518151606091610416916116129082611a51565b8451919063ffffffff611a9816565b60a081015160c082015182516060926104169281900363ffffffff611a9816565b600081518351148015610c235750610c238360008460008751611afa565b600087815260036020908152604090912054875191880191909120606061168e87878763ffffffff611a9816565b905083156117a85760008a81526004602090815260408083208684528252808320858452825280832061ffff8c16845290915290205460026000196101006001841615020190911604156117335760008a81526005602090815260408083208684528252808320858452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000811661ffff918216600019019091161790555b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c168452909152812061176991611f85565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a60405161179b929190612798565b60405180910390a26118bb565b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c168452909152902054600260001961010060018416150201909116046118425760008a815260056020908152604080832086845282528083208584529091529020805461ffff808216600101167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00009091161790555b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c1684528252909120825161187d92840190611f17565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a846040516118b2939291906127b8565b60405180910390a25b50505050505050505050565b60c081015160208201819052815151116118e057611997565b60006118f482600001518360200151611a51565b602083015183519101915061190f908263ffffffff611b1d16565b61ffff166040830152815160029190910190611931908263ffffffff611b1d16565b61ffff166060830152815160029190910190611953908263ffffffff611b3d16565b63ffffffff908116608084015282516004929092019160009161197991908490611b1d16565b600283810160a086015261ffff9190911690920190910160c0830152505b50565b600081516014146119aa57600080fd5b50602001516c01000000000000000000000000900490565b6040805160148082528183019092526060916020820181803883395050506c010000000000000000000000009290920260208301525090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f691f3431000000000000000000000000000000000000000000000000000000001480610416575061041682611b5f565b6000815b83518110611a5f57fe5b6000611a71858363ffffffff611bc416565b60ff1691820160010191905080611a885750611a8e565b50611a55565b9190910392915050565b606083518284011115611aaa57600080fd5b6060826040519080825280601f01601f191660200182016040528015611ad7576020820181803883390190505b50905060208082019086860101611aef828287611be2565b509095945050505050565b6000611b07848484611c3e565b611b12878785611c3e565b149695505050505050565b60008251826002011115611b3057600080fd5b50016002015161ffff1690565b60008251826004011115611b5057600080fd5b50016004015163ffffffff1690565b6000604051611b6d906126f8565b60405180910390207bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610416575061041682611c5a565b6000828281518110611bd257fe5b016020015160f81c905092915050565b5b60208110611c205781518352602092830192909101907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001611be3565b905182516020929092036101000a6000190180199091169116179052565b600083518284011115611c5057600080fd5b5091016020012090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fa8fa568200000000000000000000000000000000000000000000000000000000148061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167fbc1c58d100000000000000000000000000000000000000000000000000000000148061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167f3b3b57de000000000000000000000000000000000000000000000000000000001480611d8f57507fffffffff0000000000000000000000000000000000000000000000000000000082167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167f2203ab5600000000000000000000000000000000000000000000000000000000148061041657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610416565b6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611eda578280017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00823516178555611f07565b82800160010185558215611f07579182015b82811115611f07578235825591602001919060010190611eec565b50611f13929150611fc5565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611f5857805160ff1916838001178555611f07565b82800160010185558215611f07579182015b82811115611f07578251825591602001919060010190611f6a565b50805460018160011615610100020316600290046000825580601f10611fab5750611997565b601f01602090049060005260206000209081019061199791905b611fdf91905b80821115611f135760008155600101611fcb565b90565b80356109f18161295d565b80516109f18161295d565b60008083601f84011261200a57600080fd5b50813567ffffffffffffffff81111561202257600080fd5b602083019150836020820283011115610b0f57600080fd5b80356109f181612971565b80356109f18161297a565b80356109f181612983565b60008083601f84011261206d57600080fd5b50813567ffffffffffffffff81111561208557600080fd5b602083019150836001820283011115610b0f57600080fd5b600082601f8301126120ae57600080fd5b81356120c16120bc8261283a565b612813565b915080825260208301602083018583830111156120dd57600080fd5b6120e88382846128f9565b50505092915050565b80356109f18161298c565b60006020828403121561210e57600080fd5b600061211a8484611fed565b949350505050565b6000806020838503121561213557600080fd5b823567ffffffffffffffff81111561214c57600080fd5b61215885828601611ff8565b92509250509250929050565b60006020828403121561217657600080fd5b600061211a8484612045565b6000806040838503121561219557600080fd5b60006121a18585612045565b92505060206121b285828601611fe2565b9150509250929050565b6000806000606084860312156121d157600080fd5b60006121dd8686612045565b93505060206121ee86828701611fe2565b92505060406121ff86828701611fe2565b9150509250925092565b60008060006060848603121561221e57600080fd5b600061222a8686612045565b935050602061223b86828701611fe2565b92505060406121ff8682870161203a565b6000806040838503121561225f57600080fd5b600061226b8585612045565b92505060206121b285828601612045565b60008060006060848603121561229157600080fd5b600061229d8686612045565b93505060206122ae86828701612045565b92505060406121ff86828701612045565b6000806000606084860312156122d457600080fd5b60006122e08686612045565b93505060206122f186828701612045565b92505060406121ff868287016120f1565b6000806040838503121561231557600080fd5b60006123218585612045565b92505060206121b285828601612050565b60008060006060848603121561234757600080fd5b60006123538686612045565b93505060206121ee86828701612050565b60008060006040848603121561237957600080fd5b60006123858686612045565b935050602084013567ffffffffffffffff8111156123a257600080fd5b6123ae8682870161205b565b92509250509250925092565b6000806000806000606086880312156123d257600080fd5b60006123de8888612045565b955050602086013567ffffffffffffffff8111156123fb57600080fd5b6124078882890161205b565b9450945050604086013567ffffffffffffffff81111561242657600080fd5b6124328882890161205b565b92509250509295509295909350565b6000806000806060858703121561245757600080fd5b60006124638787612045565b945050602061247487828801612045565b935050604085013567ffffffffffffffff81111561249157600080fd5b61249d8782880161205b565b95989497509550505050565b6000806000606084860312156124be57600080fd5b60006124ca8686612045565b93505060206124db86828701612045565b925050604084013567ffffffffffffffff8111156124f857600080fd5b6121ff8682870161209d565b60006020828403121561251657600080fd5b600061211a8484612050565b6000610c23838361261a565b612537816128e8565b82525050565b61253781612893565b600061255182612886565b61255b818561288a565b93508360208202850161256d85612880565b8060005b858110156125a7578484038952815161258a8582612522565b945061259583612880565b60209a909a0199925050600101612571565b5091979650505050505050565b6125378161289e565b61253781611fdf565b612537816128a3565b60006125db838561288a565b93506125e88385846128f9565b6125f183612935565b9093019392505050565b60006126078385610419565b93506126148385846128f9565b50500190565b600061262582612886565b61262f818561288a565b935061263f818560208601612905565b6125f181612935565b600061265382612886565b61265d8185610419565b935061266d818560208601612905565b9290920192915050565b6000612684602483610419565b7f696e74657266616365496d706c656d656e74657228627974657333322c62797481527f6573342900000000000000000000000000000000000000000000000000000000602082015260240192915050565b612537816128c8565b600061211a8284866125fb565b6000610c238284612648565b60006109f182612677565b602081016109f1828461253d565b602081016109f1828461252e565b60208082528101610c238184612546565b602081016109f182846125b4565b602081016109f182846125bd565b6040810161275a82856125bd565b610c2360208301846125bd565b602081016109f182846125c6565b6020808252810161211a8184866125cf565b60208082528101610c23818461261a565b604080825281016127a9818561261a565b9050610c2360208301846126d6565b606080825281016127c9818661261a565b90506127d860208301856126d6565b81810360408301526127ea818461261a565b95945050505050565b6040810161280182856125bd565b818103602083015261211a818461261a565b60405181810167ffffffffffffffff8111828210171561283257600080fd5b604052919050565b600067ffffffffffffffff82111561285157600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b90815260200190565b6000610416826128cf565b151590565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b61ffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b600061041682600061041682612893565b82818337506000910152565b60005b83811015612920578181015183820152602001612908565b8381111561292f576000848401525b50505050565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b61296681612893565b811461199757600080fd5b6129668161289e565b61296681611fdf565b612966816128a3565b612966816128c856fea365627a7a7231582082927c55ed80cd2c2b4af3ecca0340c755f0257fadbdd76a4c4b6458f1c8eefc6c6578706572696d656e74616cf564736f6c63430005110040", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101985760003560e01c8063691f3431116100e3578063bc1c58d11161008c578063e59d895d11610066578063e59d895d14610387578063f1cb7e061461039a578063f86bc879146103ad57610198565b8063bc1c58d114610340578063c869023314610353578063d5fa2b001461037457610198565b8063a8fa5682116100bd578063a8fa5682146102fa578063ac9650d81461030d578063ad5780af1461032d57610198565b8063691f3431146102c157806377372213146102d45780638b95dd71146102e757610198565b8063304e6ade116101455780634cbf6ba41161011f5780634cbf6ba41461027b57806359d1d43c1461028e578063623195b0146102ae57610198565b8063304e6ade146102425780633b3b57de146102555780633e9ce7941461026857610198565b8063124a319c11610176578063124a319c146101ee5780632203ab561461020e57806329cd62ea1461022f57610198565b806301ffc9a71461019d5780630af179d7146101c657806310f13a8c146101db575b600080fd5b6101b06101ab366004612504565b6103c0565b6040516101bd9190612730565b60405180910390f35b6101d96101d4366004612364565b61041e565b005b6101d96101e93660046123ba565b61060b565b6102016101fc366004612302565b6106b8565b6040516101bd9190612703565b61022161021c36600461224c565b6109f7565b6040516101bd9291906127f3565b6101d961023d36600461227c565b610b16565b6101d9610250366004612364565b610b96565b610201610263366004612164565b610bf5565b6101d9610276366004612209565b610c2a565b6101b061028936600461224c565b610ccf565b6102a161029c366004612364565b610d01565b6040516101bd9190612787565b6101d96102bc366004612441565b610dc3565b6102a16102cf366004612164565b610e3e565b6101d96102e2366004612364565b610edf565b6101d96102f53660046124a9565b610f3e565b6102a16103083660046122bf565b611003565b61032061031b366004612122565b611090565b6040516101bd919061271f565b6101d961033b366004612164565b6111d4565b6102a161034e366004612164565b611227565b610366610361366004612164565b61128f565b6040516101bd92919061274c565b6101d9610382366004612182565b6112a9565b6101d9610395366004612332565b6112d0565b6102a16103a836600461224c565b61139d565b6101b06103bb3660046121bc565b611446565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f59d1d43c00000000000000000000000000000000000000000000000000000000148061041657506104168261146c565b90505b919050565b82610428816114c2565b61043157600080fd5b60008060608082610440611e30565b61048a60008a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505063ffffffff6115d1169050565b90505b610496816115ec565b6105ae5761ffff86166104ee57806040015195506104b3816115fa565b9350836040516020016104c691906126ec565b6040516020818303038152906040528051906020012091506104e781611621565b92506105a0565b60606104f9826115fa565b9050816040015161ffff168761ffff161415806105235750610521858263ffffffff61164216565b155b1561059e576105778b86898d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505050602087015189518c918290039015611660565b81604001519650816020015195508094508480519060200120925061059b82611621565b93505b505b6105a9816118c7565b61048d565b50825115610600576106008984878b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505088518b9250828f03915015611660565b505050505050505050565b84610615816114c2565b61061e57600080fd5b82826009600089815260200190815260200160002087876040516106439291906126df565b90815260405190819003602001902061065d929091611e7b565b50848460405161066e9291906126df565b6040518091039020867fd8c9334b1a9c2f9da342a0a2b32629c1a229b6445dad78947f674b44444a755087876040516106a8929190612775565b60405180910390a3505050505050565b60008281526006602090815260408083207fffffffff000000000000000000000000000000000000000000000000000000008516845290915281205473ffffffffffffffffffffffffffffffffffffffff1680156107175790506109f1565b600061072285610bf5565b905073ffffffffffffffffffffffffffffffffffffffff811661074a576000925050506109f1565b600060608273ffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b60405160240161077d9190612767565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a700000000000000000000000000000000000000000000000000000000179052516107fe91906126ec565b600060405180830381855afa9150503d8060008114610839576040519150601f19603f3d011682016040523d82523d6000602084013e61083e565b606091505b5091509150811580610851575060208151105b8061088d575080601f8151811061086457fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b1561089f5760009450505050506109f1565b8273ffffffffffffffffffffffffffffffffffffffff16866040516024016108c79190612767565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001790525161094891906126ec565b600060405180830381855afa9150503d8060008114610983576040519150601f19603f3d011682016040523d82523d6000602084013e610988565b606091505b50909250905081158061099c575060208151105b806109d8575080601f815181106109af57fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109ea5760009450505050506109f1565b5090925050505b92915050565b600082815260208190526040812060609060015b848111610af85780851615801590610a4357506000818152602083905260409020546002600019610100600184161502019091160415155b15610af0576000818152602083815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845284939192839190830182828015610ade5780601f10610ab357610100808354040283529160200191610ade565b820191906000526020600020905b815481529060010190602001808311610ac157829003601f168201915b50505050509050935093505050610b0f565b60011b610a0b565b505060408051602081019091526000808252925090505b9250929050565b82610b20816114c2565b610b2957600080fd5b6040805180820182528481526020808201858152600088815260089092529083902091518255516001909101555184907f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4690610b88908690869061274c565b60405180910390a250505050565b82610ba0816114c2565b610ba957600080fd5b6000848152600260205260409020610bc2908484611e7b565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610b88929190612775565b60006060610c0483603c61139d565b9050805160001415610c1a576000915050610419565b610c238161199a565b9392505050565b6000838152600b602090815260408083203380855290835281842073ffffffffffffffffffffffffffffffffffffffff871680865293529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515151790555190919085907fe1c5610a6e0cbe10764ecd182adcef1ec338dc4e199c99c32ce98f38e12791df90610cc2908690612730565b60405180910390a4505050565b600091825260056020908152604080842060038352818520548552825280842092845291905290205461ffff16151590565b6060600960008581526020019081526020016000208383604051610d269291906126df565b9081526040805160209281900383018120805460026001821615610100026000190190911604601f81018590048502830185019093528282529092909190830182828015610db55780601f10610d8a57610100808354040283529160200191610db5565b820191906000526020600020905b815481529060010190602001808311610d9857829003601f168201915b505050505090509392505050565b83610dcd816114c2565b610dd657600080fd5b6000198401841615610de757600080fd5b6000858152602081815260408083208784529091529020610e09908484611e7b565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b60008181526007602090815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610ed35780601f10610ea857610100808354040283529160200191610ed3565b820191906000526020600020905b815481529060010190602001808311610eb657829003601f168201915b50505050509050919050565b82610ee9816114c2565b610ef257600080fd5b6000848152600760205260409020610f0b908484611e7b565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610b88929190612775565b82610f48816114c2565b610f5157600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af7528484604051610f839291906127f3565b60405180910390a2603c831415610fd557837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd2610fbf8461199a565b604051610fcc9190612711565b60405180910390a25b600084815260016020908152604080832086845282529091208351610ffc92850190611f17565b5050505050565b6000838152600460209081526040808320600383528184205484528252808320858452825280832061ffff8516845282529182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610db55780601f10610d8a57610100808354040283529160200191610db5565b6040805182815260208084028201019091526060908280156110c657816020015b60608152602001906001900390816110b15790505b50905060005b828110156111cd5760006060308686858181106110e557fe5b6020028201905080357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe13684900301811261111f57600080fd5b9091016020810191503567ffffffffffffffff81111561113e57600080fd5b3681900382131561114e57600080fd5b60405161115c9291906126df565b600060405180830381855af49150503d8060008114611197576040519150601f19603f3d011682016040523d82523d6000602084013e61119c565b606091505b5091509150816111ab57600080fd5b808484815181106111b857fe5b602090810291909101015250506001016110cc565b5092915050565b806111de816114c2565b6111e757600080fd5b600082815260036020526040808220805460010190555183917fb757169b8492ca2f1c6619d9d76ce22803035c3b1d5f6930dffe7b127c1a198391a25050565b600081815260026020818152604092839020805484516001821615610100026000190190911693909304601f81018390048302840183019094528383526060939091830182828015610ed35780601f10610ea857610100808354040283529160200191610ed3565b600090815260086020526040902080546001909101549091565b816112b3816114c2565b6112bc57600080fd5b6112cb83603c6102f5856119c2565b505050565b826112da816114c2565b6112e357600080fd5b60008481526006602090815260408083207fffffffff00000000000000000000000000000000000000000000000000000000871680855292529182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616179055905185907f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa9061138f908690612703565b60405180910390a350505050565b600082815260016020818152604080842085855282529283902080548451600294821615610100026000190190911693909304601f810183900483028401830190945283835260609390918301828280156114395780601f1061140e57610100808354040283529160200191611439565b820191906000526020600020905b81548152906001019060200180831161141c57829003601f168201915b5050505050905092915050565b600b60209081526000938452604080852082529284528284209052825290205460ff1681565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fc86902330000000000000000000000000000000000000000000000000000000014806104165750610416826119fb565b600a546040517f02571be3000000000000000000000000000000000000000000000000000000008152600091829173ffffffffffffffffffffffffffffffffffffffff909116906302571be39061151d90869060040161273e565b60206040518083038186803b15801561153557600080fd5b505afa158015611549573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061156d91908101906120fc565b905073ffffffffffffffffffffffffffffffffffffffff8116331480610c2357506000838152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452825280832033845290915290205460ff16915050919050565b6115d9611e30565b82815260c081018290526109f1816118c7565b805151602090910151101590565b60208101518151606091610416916116129082611a51565b8451919063ffffffff611a9816565b60a081015160c082015182516060926104169281900363ffffffff611a9816565b600081518351148015610c235750610c238360008460008751611afa565b600087815260036020908152604090912054875191880191909120606061168e87878763ffffffff611a9816565b905083156117a85760008a81526004602090815260408083208684528252808320858452825280832061ffff8c16845290915290205460026000196101006001841615020190911604156117335760008a81526005602090815260408083208684528252808320858452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000811661ffff918216600019019091161790555b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c168452909152812061176991611f85565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a60405161179b929190612798565b60405180910390a26118bb565b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c168452909152902054600260001961010060018416150201909116046118425760008a815260056020908152604080832086845282528083208584529091529020805461ffff808216600101167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00009091161790555b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c1684528252909120825161187d92840190611f17565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a846040516118b2939291906127b8565b60405180910390a25b50505050505050505050565b60c081015160208201819052815151116118e057611997565b60006118f482600001518360200151611a51565b602083015183519101915061190f908263ffffffff611b1d16565b61ffff166040830152815160029190910190611931908263ffffffff611b1d16565b61ffff166060830152815160029190910190611953908263ffffffff611b3d16565b63ffffffff908116608084015282516004929092019160009161197991908490611b1d16565b600283810160a086015261ffff9190911690920190910160c0830152505b50565b600081516014146119aa57600080fd5b50602001516c01000000000000000000000000900490565b6040805160148082528183019092526060916020820181803883395050506c010000000000000000000000009290920260208301525090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f691f3431000000000000000000000000000000000000000000000000000000001480610416575061041682611b5f565b6000815b83518110611a5f57fe5b6000611a71858363ffffffff611bc416565b60ff1691820160010191905080611a885750611a8e565b50611a55565b9190910392915050565b606083518284011115611aaa57600080fd5b6060826040519080825280601f01601f191660200182016040528015611ad7576020820181803883390190505b50905060208082019086860101611aef828287611be2565b509095945050505050565b6000611b07848484611c3e565b611b12878785611c3e565b149695505050505050565b60008251826002011115611b3057600080fd5b50016002015161ffff1690565b60008251826004011115611b5057600080fd5b50016004015163ffffffff1690565b6000604051611b6d906126f8565b60405180910390207bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610416575061041682611c5a565b6000828281518110611bd257fe5b016020015160f81c905092915050565b5b60208110611c205781518352602092830192909101907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001611be3565b905182516020929092036101000a6000190180199091169116179052565b600083518284011115611c5057600080fd5b5091016020012090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fa8fa568200000000000000000000000000000000000000000000000000000000148061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167fbc1c58d100000000000000000000000000000000000000000000000000000000148061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167f3b3b57de000000000000000000000000000000000000000000000000000000001480611d8f57507fffffffff0000000000000000000000000000000000000000000000000000000082167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167f2203ab5600000000000000000000000000000000000000000000000000000000148061041657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610416565b6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611eda578280017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00823516178555611f07565b82800160010185558215611f07579182015b82811115611f07578235825591602001919060010190611eec565b50611f13929150611fc5565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611f5857805160ff1916838001178555611f07565b82800160010185558215611f07579182015b82811115611f07578251825591602001919060010190611f6a565b50805460018160011615610100020316600290046000825580601f10611fab5750611997565b601f01602090049060005260206000209081019061199791905b611fdf91905b80821115611f135760008155600101611fcb565b90565b80356109f18161295d565b80516109f18161295d565b60008083601f84011261200a57600080fd5b50813567ffffffffffffffff81111561202257600080fd5b602083019150836020820283011115610b0f57600080fd5b80356109f181612971565b80356109f18161297a565b80356109f181612983565b60008083601f84011261206d57600080fd5b50813567ffffffffffffffff81111561208557600080fd5b602083019150836001820283011115610b0f57600080fd5b600082601f8301126120ae57600080fd5b81356120c16120bc8261283a565b612813565b915080825260208301602083018583830111156120dd57600080fd5b6120e88382846128f9565b50505092915050565b80356109f18161298c565b60006020828403121561210e57600080fd5b600061211a8484611fed565b949350505050565b6000806020838503121561213557600080fd5b823567ffffffffffffffff81111561214c57600080fd5b61215885828601611ff8565b92509250509250929050565b60006020828403121561217657600080fd5b600061211a8484612045565b6000806040838503121561219557600080fd5b60006121a18585612045565b92505060206121b285828601611fe2565b9150509250929050565b6000806000606084860312156121d157600080fd5b60006121dd8686612045565b93505060206121ee86828701611fe2565b92505060406121ff86828701611fe2565b9150509250925092565b60008060006060848603121561221e57600080fd5b600061222a8686612045565b935050602061223b86828701611fe2565b92505060406121ff8682870161203a565b6000806040838503121561225f57600080fd5b600061226b8585612045565b92505060206121b285828601612045565b60008060006060848603121561229157600080fd5b600061229d8686612045565b93505060206122ae86828701612045565b92505060406121ff86828701612045565b6000806000606084860312156122d457600080fd5b60006122e08686612045565b93505060206122f186828701612045565b92505060406121ff868287016120f1565b6000806040838503121561231557600080fd5b60006123218585612045565b92505060206121b285828601612050565b60008060006060848603121561234757600080fd5b60006123538686612045565b93505060206121ee86828701612050565b60008060006040848603121561237957600080fd5b60006123858686612045565b935050602084013567ffffffffffffffff8111156123a257600080fd5b6123ae8682870161205b565b92509250509250925092565b6000806000806000606086880312156123d257600080fd5b60006123de8888612045565b955050602086013567ffffffffffffffff8111156123fb57600080fd5b6124078882890161205b565b9450945050604086013567ffffffffffffffff81111561242657600080fd5b6124328882890161205b565b92509250509295509295909350565b6000806000806060858703121561245757600080fd5b60006124638787612045565b945050602061247487828801612045565b935050604085013567ffffffffffffffff81111561249157600080fd5b61249d8782880161205b565b95989497509550505050565b6000806000606084860312156124be57600080fd5b60006124ca8686612045565b93505060206124db86828701612045565b925050604084013567ffffffffffffffff8111156124f857600080fd5b6121ff8682870161209d565b60006020828403121561251657600080fd5b600061211a8484612050565b6000610c23838361261a565b612537816128e8565b82525050565b61253781612893565b600061255182612886565b61255b818561288a565b93508360208202850161256d85612880565b8060005b858110156125a7578484038952815161258a8582612522565b945061259583612880565b60209a909a0199925050600101612571565b5091979650505050505050565b6125378161289e565b61253781611fdf565b612537816128a3565b60006125db838561288a565b93506125e88385846128f9565b6125f183612935565b9093019392505050565b60006126078385610419565b93506126148385846128f9565b50500190565b600061262582612886565b61262f818561288a565b935061263f818560208601612905565b6125f181612935565b600061265382612886565b61265d8185610419565b935061266d818560208601612905565b9290920192915050565b6000612684602483610419565b7f696e74657266616365496d706c656d656e74657228627974657333322c62797481527f6573342900000000000000000000000000000000000000000000000000000000602082015260240192915050565b612537816128c8565b600061211a8284866125fb565b6000610c238284612648565b60006109f182612677565b602081016109f1828461253d565b602081016109f1828461252e565b60208082528101610c238184612546565b602081016109f182846125b4565b602081016109f182846125bd565b6040810161275a82856125bd565b610c2360208301846125bd565b602081016109f182846125c6565b6020808252810161211a8184866125cf565b60208082528101610c23818461261a565b604080825281016127a9818561261a565b9050610c2360208301846126d6565b606080825281016127c9818661261a565b90506127d860208301856126d6565b81810360408301526127ea818461261a565b95945050505050565b6040810161280182856125bd565b818103602083015261211a818461261a565b60405181810167ffffffffffffffff8111828210171561283257600080fd5b604052919050565b600067ffffffffffffffff82111561285157600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b90815260200190565b6000610416826128cf565b151590565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b61ffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b600061041682600061041682612893565b82818337506000910152565b60005b83811015612920578181015183820152602001612908565b8381111561292f576000848401525b50505050565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b61296681612893565b811461199757600080fd5b6129668161289e565b61296681611fdf565b612966816128a3565b612966816128c856fea365627a7a7231582082927c55ed80cd2c2b4af3ecca0340c755f0257fadbdd76a4c4b6458f1c8eefc6c6578706572696d656e74616cf564736f6c63430005110040" +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/NameWrapper.json b/solidity/dns-contracts/deployments/sepolia/NameWrapper.json new file mode 100644 index 0000000..9306768 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/NameWrapper.json @@ -0,0 +1,2026 @@ +{ + "address": "0x0635513f179D50A207757E05759CbD106d7dFcE8", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract IBaseRegistrar", + "name": "_registrar", + "type": "address" + }, + { + "internalType": "contract IMetadataService", + "name": "_metadataService", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "CannotUpgrade", + "type": "error" + }, + { + "inputs": [], + "name": "IncompatibleParent", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "IncorrectTargetOwner", + "type": "error" + }, + { + "inputs": [], + "name": "IncorrectTokenType", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "labelHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "expectedLabelhash", + "type": "bytes32" + } + ], + "name": "LabelMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + } + ], + "name": "LabelTooLong", + "type": "error" + }, + { + "inputs": [], + "name": "LabelTooShort", + "type": "error" + }, + { + "inputs": [], + "name": "NameIsNotWrapped", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "OperationProhibited", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "Unauthorised", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "ControllerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "ExpiryExtended", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + } + ], + "name": "FusesSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NameUnwrapped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "NameWrapped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + } + ], + "name": "TransferBatch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "TransferSingle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "value", + "type": "string" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "URI", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "_tokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint32", + "name": "fuseMask", + "type": "uint32" + } + ], + "name": "allFusesBurned", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "accounts", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + } + ], + "name": "balanceOfBatch", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "canExtendSubnames", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "canModifyName", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "extendExpiry", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "getData", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + } + ], + "name": "isWrapped", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "isWrapped", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "metadataService", + "outputs": [ + { + "internalType": "contract IMetadataService", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "names", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "recoverFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "name": "registerAndWrapETH2LD", + "outputs": [ + { + "internalType": "uint256", + "name": "registrarExpiry", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "registrar", + "outputs": [ + { + "internalType": "contract IBaseRegistrar", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [ + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeBatchTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setChildFuses", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "name": "setFuses", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IMetadataService", + "name": "_metadataService", + "type": "address" + } + ], + "name": "setMetadataService", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setSubnodeOwner", + "outputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract INameWrapperUpgrade", + "name": "_upgradeAddress", + "type": "address" + } + ], + "name": "setUpgradeContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "unwrap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "unwrapETH2LD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "upgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "upgradeContract", + "outputs": [ + { + "internalType": "contract INameWrapperUpgrade", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "uri", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "wrap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "wrapETH2LD", + "outputs": [ + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x60f94207da794ed2a42bef84ad3ffbe39aab7a08501fc6cc35b9bddacb182144", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x0635513f179D50A207757E05759CbD106d7dFcE8", + "transactionIndex": 62, + "gasUsed": "5487360", + "logsBloom": "0x00001000000000400000000000000000000000000000200000800000000004000000000000000000100000000000000000000000000010000000000000000000000000000000000000000000008000000001000000000000100000000000000000000000020000000000000004000800000000000000000000001000000000400000010000000000000000000000000000000000000010200000000000000000000000000000040000000019000000000000000000000000008000240000000080000000000000000002000000005040000000000000000020000000000020000000000000000000000020000100000000000000001000000000000008000000", + "blockHash": "0xa14ab7b389c1fa6e5c0635638d9aed3123472664c873a1296a4c3ce8cc5c6839", + "transactionHash": "0x60f94207da794ed2a42bef84ad3ffbe39aab7a08501fc6cc35b9bddacb182144", + "logs": [ + { + "transactionIndex": 62, + "blockNumber": 3790153, + "transactionHash": "0x60f94207da794ed2a42bef84ad3ffbe39aab7a08501fc6cc35b9bddacb182144", + "address": "0x0635513f179D50A207757E05759CbD106d7dFcE8", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8" + ], + "data": "0x", + "logIndex": 94, + "blockHash": "0xa14ab7b389c1fa6e5c0635638d9aed3123472664c873a1296a4c3ce8cc5c6839" + }, + { + "transactionIndex": 62, + "blockNumber": 3790153, + "transactionHash": "0x60f94207da794ed2a42bef84ad3ffbe39aab7a08501fc6cc35b9bddacb182144", + "address": "0xA0a1AbcDAe1a2a4A2EF8e9113Ff0e02DD81DC0C6", + "topics": [ + "0x6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e92", + "0x0000000000000000000000000635513f179d50a207757e05759cbd106d7dfce8", + "0x4ef5377426f026cf8bf8e26532753941a1216caa1729302267b8c57117310271" + ], + "data": "0x", + "logIndex": 95, + "blockHash": "0xa14ab7b389c1fa6e5c0635638d9aed3123472664c873a1296a4c3ce8cc5c6839" + }, + { + "transactionIndex": 62, + "blockNumber": 3790153, + "transactionHash": "0x60f94207da794ed2a42bef84ad3ffbe39aab7a08501fc6cc35b9bddacb182144", + "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "topics": [ + "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", + "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2", + "0x3b2f093329dda9e8020bdae7615b2d0825e7b39a6b72263a3119df90765c2f95" + ], + "data": "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8", + "logIndex": 96, + "blockHash": "0xa14ab7b389c1fa6e5c0635638d9aed3123472664c873a1296a4c3ce8cc5c6839" + } + ], + "blockNumber": 3790153, + "cumulativeGasUsed": "20337800", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85", + "0x2e9736e109a2745628a5915983f8d9172414f1ac" + ], + "numDeployments": 1, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"_registrar\",\"type\":\"address\"},{\"internalType\":\"contract IMetadataService\",\"name\":\"_metadataService\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CannotUpgrade\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncompatibleParent\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"IncorrectTargetOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncorrectTokenType\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"labelHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"expectedLabelhash\",\"type\":\"bytes32\"}],\"name\":\"LabelMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"}],\"name\":\"LabelTooLong\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LabelTooShort\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NameIsNotWrapped\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"OperationProhibited\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"Unauthorised\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"}],\"name\":\"ControllerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"ExpiryExtended\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"}],\"name\":\"FusesSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"NameUnwrapped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"NameWrapped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"name\":\"TransferBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"TransferSingle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"URI\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"_tokens\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"fuseMask\",\"type\":\"uint32\"}],\"name\":\"allFusesBurned\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"balanceOfBatch\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"canExtendSubnames\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"canModifyName\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"extendExpiry\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getData\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"}],\"name\":\"isWrapped\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"isWrapped\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"metadataService\",\"outputs\":[{\"internalType\":\"contract IMetadataService\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"names\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"onERC721Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"recoverFunds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"name\":\"registerAndWrapETH2LD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"registrarExpiry\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"registrar\",\"outputs\":[{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"renew\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeBatchTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setChildFuses\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"name\":\"setFuses\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IMetadataService\",\"name\":\"_metadataService\",\"type\":\"address\"}],\"name\":\"setMetadataService\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"}],\"name\":\"setRecord\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setSubnodeOwner\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setSubnodeRecord\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"}],\"name\":\"setTTL\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract INameWrapperUpgrade\",\"name\":\"_upgradeAddress\",\"type\":\"address\"}],\"name\":\"setUpgradeContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"unwrap\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"registrant\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"unwrapETH2LD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"upgrade\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"upgradeContract\",\"outputs\":[{\"internalType\":\"contract INameWrapperUpgrade\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"wrap\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"wrapETH2LD\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"allFusesBurned(bytes32,uint32)\":{\"params\":{\"fuseMask\":\"The fuses you want to check\",\"node\":\"Namehash of the name\"},\"returns\":{\"_0\":\"Boolean of whether or not all the selected fuses are burned\"}},\"approve(address,uint256)\":{\"params\":{\"to\":\"address to approve\",\"tokenId\":\"name to approve\"}},\"balanceOf(address,uint256)\":{\"details\":\"See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address.\"},\"balanceOfBatch(address[],uint256[])\":{\"details\":\"See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length.\"},\"canExtendSubnames(bytes32,address)\":{\"params\":{\"addr\":\"which address to check permissions for\",\"node\":\"namehash of the name to check\"},\"returns\":{\"_0\":\"whether or not is owner/operator or approved\"}},\"canModifyName(bytes32,address)\":{\"params\":{\"addr\":\"which address to check permissions for\",\"node\":\"namehash of the name to check\"},\"returns\":{\"_0\":\"whether or not is owner or operator\"}},\"extendExpiry(bytes32,bytes32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"labelhash\":\"Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\",\"parentNode\":\"Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\"},\"returns\":{\"_0\":\"New expiry\"}},\"getApproved(uint256)\":{\"params\":{\"id\":\"Namehash of the name\"},\"returns\":{\"operator\":\"Approved operator of a name\"}},\"getData(uint256)\":{\"params\":{\"id\":\"Namehash of the name\"},\"returns\":{\"expiry\":\"Expiry of the name\",\"fuses\":\"Fuses of the name\",\"owner\":\"Owner of the name\"}},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC1155-isApprovedForAll}.\"},\"isWrapped(bytes32)\":{\"params\":{\"node\":\"Namehash of the name\"},\"returns\":{\"_0\":\"Boolean of whether or not the name is wrapped\"}},\"isWrapped(bytes32,bytes32)\":{\"params\":{\"labelhash\":\"Namehash of the name\",\"parentNode\":\"Namehash of the name\"},\"returns\":{\"_0\":\"Boolean of whether or not the name is wrapped\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"ownerOf(uint256)\":{\"params\":{\"id\":\"Label as a string of the .eth domain to wrap\"},\"returns\":{\"owner\":\"The owner of the name\"}},\"recoverFunds(address,address,uint256)\":{\"details\":\"The contract is Ownable and only the owner can call the recover function.\",\"params\":{\"_amount\":\"The amount of tokens to recover.\",\"_to\":\"The address to send the tokens to.\",\"_token\":\"The address of the ERC20 token to recover\"}},\"registerAndWrapETH2LD(string,address,uint256,address,uint16)\":{\"details\":\"Registers a new .eth second-level domain and wraps it. Only callable by authorised controllers.\",\"params\":{\"duration\":\"The duration, in seconds, to register the name for.\",\"label\":\"The label to register (Eg, 'foo' for 'foo.eth').\",\"ownerControlledFuses\":\"Initial owner-controlled fuses to set\",\"resolver\":\"The resolver address to set on the ENS registry (optional).\",\"wrappedOwner\":\"The owner of the wrapped name.\"},\"returns\":{\"registrarExpiry\":\"The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\"}},\"renew(uint256,uint256)\":{\"details\":\"Only callable by authorised controllers.\",\"params\":{\"duration\":\"The number of seconds to renew the name for.\",\"tokenId\":\"The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\"},\"returns\":{\"expires\":\"The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)\":{\"details\":\"See {IERC1155-safeBatchTransferFrom}.\"},\"safeTransferFrom(address,address,uint256,uint256,bytes)\":{\"details\":\"See {IERC1155-safeTransferFrom}.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC1155-setApprovalForAll}.\"},\"setChildFuses(bytes32,bytes32,uint32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"fuses\":\"Fuses to burn\",\"labelhash\":\"Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\",\"parentNode\":\"Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\"}},\"setFuses(bytes32,uint16)\":{\"params\":{\"node\":\"Namehash of the name\",\"ownerControlledFuses\":\"Owner-controlled fuses to burn\"},\"returns\":{\"_0\":\"Old fuses\"}},\"setMetadataService(address)\":{\"params\":{\"_metadataService\":\"The new metadata service\"}},\"setRecord(bytes32,address,address,uint64)\":{\"params\":{\"node\":\"Namehash of the name to set a record for\",\"owner\":\"New owner in the registry\",\"resolver\":\"Resolver contract\",\"ttl\":\"Time to live in the registry\"}},\"setResolver(bytes32,address)\":{\"params\":{\"node\":\"namehash of the name\",\"resolver\":\"the resolver contract\"}},\"setSubnodeOwner(bytes32,string,address,uint32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"fuses\":\"Initial fuses for the wrapped subdomain\",\"label\":\"Label of the subdomain as a string\",\"owner\":\"New owner in the wrapper\",\"parentNode\":\"Parent namehash of the subdomain\"},\"returns\":{\"node\":\"Namehash of the subdomain\"}},\"setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"fuses\":\"initial fuses for the wrapped subdomain\",\"label\":\"label of the subdomain as a string\",\"owner\":\"new owner in the wrapper\",\"parentNode\":\"parent namehash of the subdomain\",\"resolver\":\"resolver contract in the registry\",\"ttl\":\"ttl in the registry\"},\"returns\":{\"node\":\"Namehash of the subdomain\"}},\"setTTL(bytes32,uint64)\":{\"params\":{\"node\":\"Namehash of the name\",\"ttl\":\"TTL in the registry\"}},\"setUpgradeContract(address)\":{\"details\":\"The default value of upgradeContract is the 0 address. Use the 0 address at any time to make the contract not upgradable.\",\"params\":{\"_upgradeAddress\":\"address of an upgraded contract\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"unwrap(bytes32,bytes32,address)\":{\"details\":\"Can be called by the owner in the wrapper or an authorised caller in the wrapper\",\"params\":{\"controller\":\"Sets the owner in the registry to this address\",\"labelhash\":\"Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\",\"parentNode\":\"Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\"}},\"unwrapETH2LD(bytes32,address,address)\":{\"details\":\"Can be called by the owner in the wrapper or an authorised caller in the wrapper\",\"params\":{\"controller\":\"Sets the owner in the registry to this address\",\"labelhash\":\"Labelhash of the .eth domain\",\"registrant\":\"Sets the owner in the .eth registrar to this address\"}},\"upgrade(bytes,bytes)\":{\"details\":\"Can be called by the owner or an authorised caller\",\"params\":{\"extraData\":\"Extra data to pass to the upgrade contract\",\"name\":\"The name to upgrade, in DNS format\"}},\"uri(uint256)\":{\"params\":{\"tokenId\":\"The id of the token\"},\"returns\":{\"_0\":\"string uri of the metadata service\"}},\"wrap(bytes,address,address)\":{\"details\":\"Can be called by the owner in the registry or an authorised caller in the registry\",\"params\":{\"name\":\"The name to wrap, in DNS format\",\"resolver\":\"Resolver contract\",\"wrappedOwner\":\"Owner of the name in this contract\"}},\"wrapETH2LD(string,address,uint16,address)\":{\"details\":\"Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\",\"params\":{\"label\":\"Label as a string of the .eth domain to wrap\",\"ownerControlledFuses\":\"Initial owner-controlled fuses to set\",\"resolver\":\"Resolver contract address\",\"wrappedOwner\":\"Owner of the name in this contract\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"allFusesBurned(bytes32,uint32)\":{\"notice\":\"Checks all Fuses in the mask are burned for the node\"},\"approve(address,uint256)\":{\"notice\":\"Approves an address for a name\"},\"canExtendSubnames(bytes32,address)\":{\"notice\":\"Checks if owner/operator or approved by owner\"},\"canModifyName(bytes32,address)\":{\"notice\":\"Checks if owner or operator of the owner\"},\"extendExpiry(bytes32,bytes32,uint64)\":{\"notice\":\"Extends expiry for a name\"},\"getApproved(uint256)\":{\"notice\":\"Gets the owner of a name\"},\"getData(uint256)\":{\"notice\":\"Gets the data for a name\"},\"isWrapped(bytes32)\":{\"notice\":\"Checks if a name is wrapped\"},\"isWrapped(bytes32,bytes32)\":{\"notice\":\"Checks if a name is wrapped in a more gas efficient way\"},\"ownerOf(uint256)\":{\"notice\":\"Gets the owner of a name\"},\"recoverFunds(address,address,uint256)\":{\"notice\":\"Recover ERC20 tokens sent to the contract by mistake.\"},\"renew(uint256,uint256)\":{\"notice\":\"Renews a .eth second-level domain.\"},\"setChildFuses(bytes32,bytes32,uint32,uint64)\":{\"notice\":\"Sets fuses of a name that you own the parent of\"},\"setFuses(bytes32,uint16)\":{\"notice\":\"Sets fuses of a name\"},\"setMetadataService(address)\":{\"notice\":\"Set the metadata service. Only the owner can do this\"},\"setRecord(bytes32,address,address,uint64)\":{\"notice\":\"Sets records for the name in the ENS Registry\"},\"setResolver(bytes32,address)\":{\"notice\":\"Sets resolver contract in the registry\"},\"setSubnodeOwner(bytes32,string,address,uint32,uint64)\":{\"notice\":\"Sets the subdomain owner in the registry and then wraps the subdomain\"},\"setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)\":{\"notice\":\"Sets the subdomain owner in the registry with records and then wraps the subdomain\"},\"setTTL(bytes32,uint64)\":{\"notice\":\"Sets TTL in the registry\"},\"setUpgradeContract(address)\":{\"notice\":\"Set the address of the upgradeContract of the contract. only admin can do this\"},\"unwrap(bytes32,bytes32,address)\":{\"notice\":\"Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\"},\"unwrapETH2LD(bytes32,address,address)\":{\"notice\":\"Unwraps a .eth domain. e.g. vitalik.eth\"},\"upgrade(bytes,bytes)\":{\"notice\":\"Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\"},\"uri(uint256)\":{\"notice\":\"Get the metadata uri\"},\"wrap(bytes,address,address)\":{\"notice\":\"Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\"},\"wrapETH2LD(string,address,uint16,address)\":{\"notice\":\"Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/wrapper/NameWrapper.sol\":\"NameWrapper\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6392f2cfe3a5ee802227fe7a2dfd47096d881aec89bddd214b35c5b46d3cd941\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\ninterface IERC1155Receiver is IERC165 {\\n /**\\n * @dev Handles the receipt of a single ERC1155 token type. This function is\\n * called at the end of a `safeTransferFrom` after the balance has been updated.\\n *\\n * NOTE: To accept the transfer, this must return\\n * `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))`\\n * (i.e. 0xf23a6e61, or its own function selector).\\n *\\n * @param operator The address which initiated the transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param id The ID of the token being transferred\\n * @param value The amount of tokens being transferred\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155Received(\\n address operator,\\n address from,\\n uint256 id,\\n uint256 value,\\n bytes calldata data\\n ) external returns (bytes4);\\n\\n /**\\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\\n * is called at the end of a `safeBatchTransferFrom` after the balances have\\n * been updated.\\n *\\n * NOTE: To accept the transfer(s), this must return\\n * `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))`\\n * (i.e. 0xbc197c81, or its own function selector).\\n *\\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xeb373f1fdc7b755c6a750123a9b9e3a8a02c1470042fd6505d875000a80bde0b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC1155.sol\\\";\\n\\n/**\\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155MetadataURI is IERC1155 {\\n /**\\n * @dev Returns the URI for token type `id`.\\n *\\n * If the `\\\\{id\\\\}` substring is present in the URI, it must be replaced by\\n * clients with the actual token type ID.\\n */\\n function uri(uint256 id) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xa66d18b9a85458d28fc3304717964502ae36f7f8a2ff35bc83f6f85d74b03574\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xab28a56179c1db258c9bf5235b382698cb650debecb51b23d12be9e241374b68\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseClaimer.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\n\\ncontract ReverseClaimer {\\n bytes32 constant ADDR_REVERSE_NODE =\\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n constructor(ENS ens, address claimant) {\\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\\n ens.owner(ADDR_REVERSE_NODE)\\n );\\n reverseRegistrar.claim(claimant);\\n }\\n}\\n\",\"keccak256\":\"0x78a28627241535b595f6fff476a1fa7acc90c80684fe7784734920fc8af6fc22\",\"license\":\"MIT\"},\"contracts/utils/ERC20Recoverable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\\n */\\n\\ncontract ERC20Recoverable is Ownable {\\n /**\\n @notice Recover ERC20 tokens sent to the contract by mistake.\\n @dev The contract is Ownable and only the owner can call the recover function.\\n @param _to The address to send the tokens to.\\n@param _token The address of the ERC20 token to recover\\n @param _amount The amount of tokens to recover.\\n */\\n function recoverFunds(\\n address _token,\\n address _to,\\n uint256 _amount\\n ) external onlyOwner {\\n IERC20(_token).transfer(_to, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x793a38091e1f81499a29ddba82c2b2f3cdd07071b81a832886e8e02a45ff352a\",\"license\":\"MIT\"},\"contracts/wrapper/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes32) {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n}\\n\",\"keccak256\":\"0xf862cd86d749158a554e3cb517efa9097331ec0cf7225117f21e96fb50c67edb\",\"license\":\"MIT\"},\"contracts/wrapper/Controllable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool active);\\n\\n function setController(address controller, bool active) public onlyOwner {\\n controllers[controller] = active;\\n emit ControllerChanged(controller, active);\\n }\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x9a9191656a82eda6763cda29ce893ddbfddb6c43559ff3b90c00a184e14e1fa1\",\"license\":\"MIT\"},\"contracts/wrapper/ERC1155Fuse.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\\n\\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\\n using Address for address;\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(\\n address indexed owner,\\n address indexed approved,\\n uint256 indexed tokenId\\n );\\n mapping(uint256 => uint256) public _tokens;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) internal _tokenApprovals;\\n\\n /**************************************************************************\\n * ERC721 methods\\n *************************************************************************/\\n\\n function ownerOf(uint256 id) public view virtual returns (address) {\\n (address owner, , ) = getData(id);\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual {\\n address owner = ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(\\n uint256 tokenId\\n ) public view virtual returns (address) {\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IERC1155).interfaceId ||\\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(\\n address account,\\n uint256 id\\n ) public view virtual override returns (uint256) {\\n require(\\n account != address(0),\\n \\\"ERC1155: balance query for the zero address\\\"\\n );\\n address owner = ownerOf(id);\\n if (owner == account) {\\n return 1;\\n }\\n return 0;\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOfBatch}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] memory accounts,\\n uint256[] memory ids\\n ) public view virtual override returns (uint256[] memory) {\\n require(\\n accounts.length == ids.length,\\n \\\"ERC1155: accounts and ids length mismatch\\\"\\n );\\n\\n uint256[] memory batchBalances = new uint256[](accounts.length);\\n\\n for (uint256 i = 0; i < accounts.length; ++i) {\\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\\n }\\n\\n return batchBalances;\\n }\\n\\n /**\\n * @dev See {IERC1155-setApprovalForAll}.\\n */\\n function setApprovalForAll(\\n address operator,\\n bool approved\\n ) public virtual override {\\n require(\\n msg.sender != operator,\\n \\\"ERC1155: setting approval status for self\\\"\\n );\\n\\n _operatorApprovals[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC1155-isApprovedForAll}.\\n */\\n function isApprovedForAll(\\n address account,\\n address operator\\n ) public view virtual override returns (bool) {\\n return _operatorApprovals[account][operator];\\n }\\n\\n /**\\n * @dev Returns the Name's owner address and fuses\\n */\\n function getData(\\n uint256 tokenId\\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\\n uint256 t = _tokens[tokenId];\\n owner = address(uint160(t));\\n expiry = uint64(t >> 192);\\n fuses = uint32(t >> 160);\\n }\\n\\n /**\\n * @dev See {IERC1155-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) public virtual override {\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n require(\\n from == msg.sender || isApprovedForAll(from, msg.sender),\\n \\\"ERC1155: caller is not owner nor approved\\\"\\n );\\n\\n _transfer(from, to, id, amount, data);\\n }\\n\\n /**\\n * @dev See {IERC1155-safeBatchTransferFrom}.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) public virtual override {\\n require(\\n ids.length == amounts.length,\\n \\\"ERC1155: ids and amounts length mismatch\\\"\\n );\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n require(\\n from == msg.sender || isApprovedForAll(from, msg.sender),\\n \\\"ERC1155: transfer caller is not owner nor approved\\\"\\n );\\n\\n for (uint256 i = 0; i < ids.length; ++i) {\\n uint256 id = ids[i];\\n uint256 amount = amounts[i];\\n\\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\\n\\n _beforeTransfer(id, fuses, expiry);\\n\\n require(\\n amount == 1 && oldOwner == from,\\n \\\"ERC1155: insufficient balance for transfer\\\"\\n );\\n _setData(id, to, fuses, expiry);\\n }\\n\\n emit TransferBatch(msg.sender, from, to, ids, amounts);\\n\\n _doSafeBatchTransferAcceptanceCheck(\\n msg.sender,\\n from,\\n to,\\n ids,\\n amounts,\\n data\\n );\\n }\\n\\n /**************************************************************************\\n * Internal/private methods\\n *************************************************************************/\\n\\n /**\\n * @dev Sets the Name's owner address and fuses\\n */\\n function _setData(\\n uint256 tokenId,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual {\\n _tokens[tokenId] =\\n uint256(uint160(owner)) |\\n (uint256(fuses) << 160) |\\n (uint256(expiry) << 192);\\n }\\n\\n function _beforeTransfer(\\n uint256 id,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual;\\n\\n function _clearOwnerAndFuses(\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual returns (address, uint32);\\n\\n function _mint(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual {\\n uint256 tokenId = uint256(node);\\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n\\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\\n oldFuses;\\n\\n if (oldExpiry > expiry) {\\n expiry = oldExpiry;\\n }\\n\\n if (oldExpiry >= block.timestamp) {\\n fuses = fuses | parentControlledFuses;\\n }\\n\\n require(oldOwner == address(0), \\\"ERC1155: mint of existing token\\\");\\n require(owner != address(0), \\\"ERC1155: mint to the zero address\\\");\\n require(\\n owner != address(this),\\n \\\"ERC1155: newOwner cannot be the NameWrapper contract\\\"\\n );\\n\\n _setData(tokenId, owner, fuses, expiry);\\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\\n _doSafeTransferAcceptanceCheck(\\n msg.sender,\\n address(0),\\n owner,\\n tokenId,\\n 1,\\n \\\"\\\"\\n );\\n }\\n\\n function _burn(uint256 tokenId) internal virtual {\\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\\n tokenId\\n );\\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n // Fuses and expiry are kept on burn\\n _setData(tokenId, address(0x0), fuses, expiry);\\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\\n }\\n\\n function _transfer(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) internal {\\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\\n\\n _beforeTransfer(id, fuses, expiry);\\n\\n require(\\n amount == 1 && oldOwner == from,\\n \\\"ERC1155: insufficient balance for transfer\\\"\\n );\\n\\n if (oldOwner == to) {\\n return;\\n }\\n\\n _setData(id, to, fuses, expiry);\\n\\n emit TransferSingle(msg.sender, from, to, id, amount);\\n\\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\\n }\\n\\n function _doSafeTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try\\n IERC1155Receiver(to).onERC1155Received(\\n operator,\\n from,\\n id,\\n amount,\\n data\\n )\\n returns (bytes4 response) {\\n if (\\n response != IERC1155Receiver(to).onERC1155Received.selector\\n ) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n function _doSafeBatchTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try\\n IERC1155Receiver(to).onERC1155BatchReceived(\\n operator,\\n from,\\n ids,\\n amounts,\\n data\\n )\\n returns (bytes4 response) {\\n if (\\n response !=\\n IERC1155Receiver(to).onERC1155BatchReceived.selector\\n ) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n /* ERC721 internal functions */\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ownerOf(tokenId), to, tokenId);\\n }\\n}\\n\",\"keccak256\":\"0xfbbd36e7f5df0fe7a8e9199783af99ac61ab24122e4a9fdb072bbd4cd676a88b\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_ETH = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x70310eb67146d7290731c31841399640ac3b6a949eadc6598bc150123d185c57\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"},\"contracts/wrapper/NameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \\\"./ERC1155Fuse.sol\\\";\\nimport {Controllable} from \\\"./Controllable.sol\\\";\\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \\\"./INameWrapper.sol\\\";\\nimport {INameWrapperUpgrade} from \\\"./INameWrapperUpgrade.sol\\\";\\nimport {IMetadataService} from \\\"./IMetadataService.sol\\\";\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\nimport {ReverseClaimer} from \\\"../reverseRegistrar/ReverseClaimer.sol\\\";\\nimport {IBaseRegistrar} from \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport {IERC721Receiver} from \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {BytesUtils} from \\\"./BytesUtils.sol\\\";\\nimport {ERC20Recoverable} from \\\"../utils/ERC20Recoverable.sol\\\";\\n\\nerror Unauthorised(bytes32 node, address addr);\\nerror IncompatibleParent();\\nerror IncorrectTokenType();\\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\\nerror LabelTooShort();\\nerror LabelTooLong(string label);\\nerror IncorrectTargetOwner(address owner);\\nerror CannotUpgrade();\\nerror OperationProhibited(bytes32 node);\\nerror NameIsNotWrapped();\\nerror NameIsStillExpired();\\n\\ncontract NameWrapper is\\n Ownable,\\n ERC1155Fuse,\\n INameWrapper,\\n Controllable,\\n IERC721Receiver,\\n ERC20Recoverable,\\n ReverseClaimer\\n{\\n using BytesUtils for bytes;\\n\\n ENS public immutable ens;\\n IBaseRegistrar public immutable registrar;\\n IMetadataService public metadataService;\\n mapping(bytes32 => bytes) public names;\\n string public constant name = \\\"NameWrapper\\\";\\n\\n uint64 private constant GRACE_PERIOD = 90 days;\\n bytes32 private constant ETH_NODE =\\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\\n bytes32 private constant ETH_LABELHASH =\\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\\n bytes32 private constant ROOT_NODE =\\n 0x0000000000000000000000000000000000000000000000000000000000000000;\\n\\n INameWrapperUpgrade public upgradeContract;\\n uint64 private constant MAX_EXPIRY = type(uint64).max;\\n\\n constructor(\\n ENS _ens,\\n IBaseRegistrar _registrar,\\n IMetadataService _metadataService\\n ) ReverseClaimer(_ens, msg.sender) {\\n ens = _ens;\\n registrar = _registrar;\\n metadataService = _metadataService;\\n\\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE and set expiry to max */\\n\\n _setData(\\n uint256(ETH_NODE),\\n address(0),\\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\\n MAX_EXPIRY\\n );\\n _setData(\\n uint256(ROOT_NODE),\\n address(0),\\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\\n MAX_EXPIRY\\n );\\n names[ROOT_NODE] = \\\"\\\\x00\\\";\\n names[ETH_NODE] = \\\"\\\\x03eth\\\\x00\\\";\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\\n return\\n interfaceId == type(INameWrapper).interfaceId ||\\n interfaceId == type(IERC721Receiver).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /* ERC1155 Fuse */\\n\\n /**\\n * @notice Gets the owner of a name\\n * @param id Label as a string of the .eth domain to wrap\\n * @return owner The owner of the name\\n */\\n\\n function ownerOf(\\n uint256 id\\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\\n return super.ownerOf(id);\\n }\\n\\n /**\\n * @notice Gets the owner of a name\\n * @param id Namehash of the name\\n * @return operator Approved operator of a name\\n */\\n\\n function getApproved(\\n uint256 id\\n )\\n public\\n view\\n override(ERC1155Fuse, INameWrapper)\\n returns (address operator)\\n {\\n address owner = ownerOf(id);\\n if (owner == address(0)) {\\n return address(0);\\n }\\n return super.getApproved(id);\\n }\\n\\n /**\\n * @notice Approves an address for a name\\n * @param to address to approve\\n * @param tokenId name to approve\\n */\\n\\n function approve(\\n address to,\\n uint256 tokenId\\n ) public override(ERC1155Fuse, INameWrapper) {\\n (, uint32 fuses, ) = getData(tokenId);\\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\\n revert OperationProhibited(bytes32(tokenId));\\n }\\n super.approve(to, tokenId);\\n }\\n\\n /**\\n * @notice Gets the data for a name\\n * @param id Namehash of the name\\n * @return owner Owner of the name\\n * @return fuses Fuses of the name\\n * @return expiry Expiry of the name\\n */\\n\\n function getData(\\n uint256 id\\n )\\n public\\n view\\n override(ERC1155Fuse, INameWrapper)\\n returns (address owner, uint32 fuses, uint64 expiry)\\n {\\n (owner, fuses, expiry) = super.getData(id);\\n\\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\\n }\\n\\n /* Metadata service */\\n\\n /**\\n * @notice Set the metadata service. Only the owner can do this\\n * @param _metadataService The new metadata service\\n */\\n\\n function setMetadataService(\\n IMetadataService _metadataService\\n ) public onlyOwner {\\n metadataService = _metadataService;\\n }\\n\\n /**\\n * @notice Get the metadata uri\\n * @param tokenId The id of the token\\n * @return string uri of the metadata service\\n */\\n\\n function uri(\\n uint256 tokenId\\n )\\n public\\n view\\n override(INameWrapper, IERC1155MetadataURI)\\n returns (string memory)\\n {\\n return metadataService.uri(tokenId);\\n }\\n\\n /**\\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\\n * to make the contract not upgradable.\\n * @param _upgradeAddress address of an upgraded contract\\n */\\n\\n function setUpgradeContract(\\n INameWrapperUpgrade _upgradeAddress\\n ) public onlyOwner {\\n if (address(upgradeContract) != address(0)) {\\n registrar.setApprovalForAll(address(upgradeContract), false);\\n ens.setApprovalForAll(address(upgradeContract), false);\\n }\\n\\n upgradeContract = _upgradeAddress;\\n\\n if (address(upgradeContract) != address(0)) {\\n registrar.setApprovalForAll(address(upgradeContract), true);\\n ens.setApprovalForAll(address(upgradeContract), true);\\n }\\n }\\n\\n /**\\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\\n * @param node namehash of the name to check\\n */\\n\\n modifier onlyTokenOwner(bytes32 node) {\\n if (!canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n _;\\n }\\n\\n /**\\n * @notice Checks if owner or operator of the owner\\n * @param node namehash of the name to check\\n * @param addr which address to check permissions for\\n * @return whether or not is owner or operator\\n */\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) public view returns (bool) {\\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\\n return\\n (owner == addr || isApprovedForAll(owner, addr)) &&\\n !_isETH2LDInGracePeriod(fuses, expiry);\\n }\\n\\n /**\\n * @notice Checks if owner/operator or approved by owner\\n * @param node namehash of the name to check\\n * @param addr which address to check permissions for\\n * @return whether or not is owner/operator or approved\\n */\\n\\n function canExtendSubnames(\\n bytes32 node,\\n address addr\\n ) public view returns (bool) {\\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\\n return\\n (owner == addr ||\\n isApprovedForAll(owner, addr) ||\\n getApproved(uint256(node)) == addr) &&\\n !_isETH2LDInGracePeriod(fuses, expiry);\\n }\\n\\n /**\\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\\n * @param label Label as a string of the .eth domain to wrap\\n * @param wrappedOwner Owner of the name in this contract\\n * @param ownerControlledFuses Initial owner-controlled fuses to set\\n * @param resolver Resolver contract address\\n */\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) public returns (uint64 expiry) {\\n uint256 tokenId = uint256(keccak256(bytes(label)));\\n address registrant = registrar.ownerOf(tokenId);\\n if (\\n registrant != msg.sender &&\\n !registrar.isApprovedForAll(registrant, msg.sender)\\n ) {\\n revert Unauthorised(\\n _makeNode(ETH_NODE, bytes32(tokenId)),\\n msg.sender\\n );\\n }\\n\\n // transfer the token from the user to this contract\\n registrar.transferFrom(registrant, address(this), tokenId);\\n\\n // transfer the ens record back to the new owner (this contract)\\n registrar.reclaim(tokenId, address(this));\\n\\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\\n\\n _wrapETH2LD(\\n label,\\n wrappedOwner,\\n ownerControlledFuses,\\n expiry,\\n resolver\\n );\\n }\\n\\n /**\\n * @dev Registers a new .eth second-level domain and wraps it.\\n * Only callable by authorised controllers.\\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\\n * @param wrappedOwner The owner of the wrapped name.\\n * @param duration The duration, in seconds, to register the name for.\\n * @param resolver The resolver address to set on the ENS registry (optional).\\n * @param ownerControlledFuses Initial owner-controlled fuses to set\\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\\n */\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external onlyController returns (uint256 registrarExpiry) {\\n uint256 tokenId = uint256(keccak256(bytes(label)));\\n registrarExpiry = registrar.register(tokenId, address(this), duration);\\n _wrapETH2LD(\\n label,\\n wrappedOwner,\\n ownerControlledFuses,\\n uint64(registrarExpiry) + GRACE_PERIOD,\\n resolver\\n );\\n }\\n\\n /**\\n * @notice Renews a .eth second-level domain.\\n * @dev Only callable by authorised controllers.\\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\\n * @param duration The number of seconds to renew the name for.\\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\\n */\\n\\n function renew(\\n uint256 tokenId,\\n uint256 duration\\n ) external onlyController returns (uint256 expires) {\\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\\n\\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\\n\\n // Do not set anything in wrapper if name is not wrapped\\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\\n if (\\n registrarOwner != address(this) ||\\n ens.owner(node) != address(this)\\n ) {\\n return registrarExpiry;\\n }\\n } catch {\\n return registrarExpiry;\\n }\\n\\n // Set expiry in Wrapper\\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\\n\\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\\n _setData(node, owner, fuses, expiry);\\n\\n return registrarExpiry;\\n }\\n\\n /**\\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\\n * @param name The name to wrap, in DNS format\\n * @param wrappedOwner Owner of the name in this contract\\n * @param resolver Resolver contract\\n */\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) public {\\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\\n bytes32 parentNode = name.namehash(offset);\\n bytes32 node = _makeNode(parentNode, labelhash);\\n\\n names[node] = name;\\n\\n if (parentNode == ETH_NODE) {\\n revert IncompatibleParent();\\n }\\n\\n address owner = ens.owner(node);\\n\\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n if (resolver != address(0)) {\\n ens.setResolver(node, resolver);\\n }\\n\\n ens.setOwner(node, address(this));\\n\\n _wrap(node, name, wrappedOwner, 0, 0);\\n }\\n\\n /**\\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\\n * @param labelhash Labelhash of the .eth domain\\n * @param registrant Sets the owner in the .eth registrar to this address\\n * @param controller Sets the owner in the registry to this address\\n */\\n\\n function unwrapETH2LD(\\n bytes32 labelhash,\\n address registrant,\\n address controller\\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\\n if (registrant == address(this)) {\\n revert IncorrectTargetOwner(registrant);\\n }\\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\\n registrar.safeTransferFrom(\\n address(this),\\n registrant,\\n uint256(labelhash)\\n );\\n }\\n\\n /**\\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\\n * @param controller Sets the owner in the registry to this address\\n */\\n\\n function unwrap(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n address controller\\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\\n if (parentNode == ETH_NODE) {\\n revert IncompatibleParent();\\n }\\n if (controller == address(0x0) || controller == address(this)) {\\n revert IncorrectTargetOwner(controller);\\n }\\n _unwrap(_makeNode(parentNode, labelhash), controller);\\n }\\n\\n /**\\n * @notice Sets fuses of a name\\n * @param node Namehash of the name\\n * @param ownerControlledFuses Owner-controlled fuses to burn\\n * @return Old fuses\\n */\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n )\\n public\\n onlyTokenOwner(node)\\n operationAllowed(node, CANNOT_BURN_FUSES)\\n returns (uint32)\\n {\\n // owner protected by onlyTokenOwner\\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\\n uint256(node)\\n );\\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\\n return oldFuses;\\n }\\n\\n /**\\n * @notice Extends expiry for a name\\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\\n * @param expiry When the name will expire in seconds since the Unix epoch\\n * @return New expiry\\n */\\n\\n function extendExpiry(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint64 expiry\\n ) public returns (uint64) {\\n bytes32 node = _makeNode(parentNode, labelhash);\\n\\n if (!_isWrapped(node)) {\\n revert NameIsNotWrapped();\\n }\\n\\n // this flag is used later, when checking fuses\\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\\n // only allow the owner of the name or owner of the parent name\\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n\\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\\n revert OperationProhibited(node);\\n }\\n\\n // Max expiry is set to the expiry of the parent\\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\\n\\n _setData(node, owner, fuses, expiry);\\n emit ExpiryExtended(node, expiry);\\n return expiry;\\n }\\n\\n /**\\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\\n * @dev Can be called by the owner or an authorised caller\\n * @param name The name to upgrade, in DNS format\\n * @param extraData Extra data to pass to the upgrade contract\\n */\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) public {\\n bytes32 node = name.namehash(0);\\n\\n if (address(upgradeContract) == address(0)) {\\n revert CannotUpgrade();\\n }\\n\\n if (!canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\\n uint256(node)\\n );\\n\\n address approved = getApproved(uint256(node));\\n\\n _burn(uint256(node));\\n\\n upgradeContract.wrapFromUpgrade(\\n name,\\n currentOwner,\\n fuses,\\n expiry,\\n approved,\\n extraData\\n );\\n }\\n\\n /** \\n /* @notice Sets fuses of a name that you own the parent of\\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\\n * @param fuses Fuses to burn\\n * @param expiry When the name will expire in seconds since the Unix epoch\\n */\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) public {\\n bytes32 node = _makeNode(parentNode, labelhash);\\n _checkFusesAreSettable(node, fuses);\\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n if (owner == address(0) || ens.owner(node) != address(this)) {\\n revert NameIsNotWrapped();\\n }\\n // max expiry is set to the expiry of the parent\\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\\n if (parentNode == ROOT_NODE) {\\n if (!canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n } else {\\n if (!canModifyName(parentNode, msg.sender)) {\\n revert Unauthorised(parentNode, msg.sender);\\n }\\n }\\n\\n _checkParentFuses(node, fuses, parentFuses);\\n\\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\\n\\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\\n if (\\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\\n oldFuses | fuses != oldFuses\\n ) {\\n revert OperationProhibited(node);\\n }\\n fuses |= oldFuses;\\n _setFuses(node, owner, fuses, oldExpiry, expiry);\\n }\\n\\n /**\\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\\n * @param parentNode Parent namehash of the subdomain\\n * @param label Label of the subdomain as a string\\n * @param owner New owner in the wrapper\\n * @param fuses Initial fuses for the wrapped subdomain\\n * @param expiry When the name will expire in seconds since the Unix epoch\\n * @return node Namehash of the subdomain\\n */\\n\\n function setSubnodeOwner(\\n bytes32 parentNode,\\n string calldata label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\\n bytes32 labelhash = keccak256(bytes(label));\\n node = _makeNode(parentNode, labelhash);\\n _checkCanCallSetSubnodeOwner(parentNode, node);\\n _checkFusesAreSettable(node, fuses);\\n bytes memory name = _saveLabel(parentNode, node, label);\\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\\n\\n if (!_isWrapped(node)) {\\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\\n _wrap(node, name, owner, fuses, expiry);\\n } else {\\n _updateName(parentNode, node, label, owner, fuses, expiry);\\n }\\n }\\n\\n /**\\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\\n * @param parentNode parent namehash of the subdomain\\n * @param label label of the subdomain as a string\\n * @param owner new owner in the wrapper\\n * @param resolver resolver contract in the registry\\n * @param ttl ttl in the registry\\n * @param fuses initial fuses for the wrapped subdomain\\n * @param expiry When the name will expire in seconds since the Unix epoch\\n * @return node Namehash of the subdomain\\n */\\n\\n function setSubnodeRecord(\\n bytes32 parentNode,\\n string memory label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\\n bytes32 labelhash = keccak256(bytes(label));\\n node = _makeNode(parentNode, labelhash);\\n _checkCanCallSetSubnodeOwner(parentNode, node);\\n _checkFusesAreSettable(node, fuses);\\n _saveLabel(parentNode, node, label);\\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\\n if (!_isWrapped(node)) {\\n ens.setSubnodeRecord(\\n parentNode,\\n labelhash,\\n address(this),\\n resolver,\\n ttl\\n );\\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\\n } else {\\n ens.setSubnodeRecord(\\n parentNode,\\n labelhash,\\n address(this),\\n resolver,\\n ttl\\n );\\n _updateName(parentNode, node, label, owner, fuses, expiry);\\n }\\n }\\n\\n /**\\n * @notice Sets records for the name in the ENS Registry\\n * @param node Namehash of the name to set a record for\\n * @param owner New owner in the registry\\n * @param resolver Resolver contract\\n * @param ttl Time to live in the registry\\n */\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n )\\n public\\n onlyTokenOwner(node)\\n operationAllowed(\\n node,\\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\\n )\\n {\\n ens.setRecord(node, address(this), resolver, ttl);\\n if (owner == address(0)) {\\n (, uint32 fuses, ) = getData(uint256(node));\\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\\n revert IncorrectTargetOwner(owner);\\n }\\n _unwrap(node, address(0));\\n } else {\\n address oldOwner = ownerOf(uint256(node));\\n _transfer(oldOwner, owner, uint256(node), 1, \\\"\\\");\\n }\\n }\\n\\n /**\\n * @notice Sets resolver contract in the registry\\n * @param node namehash of the name\\n * @param resolver the resolver contract\\n */\\n\\n function setResolver(\\n bytes32 node,\\n address resolver\\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\\n ens.setResolver(node, resolver);\\n }\\n\\n /**\\n * @notice Sets TTL in the registry\\n * @param node Namehash of the name\\n * @param ttl TTL in the registry\\n */\\n\\n function setTTL(\\n bytes32 node,\\n uint64 ttl\\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\\n ens.setTTL(node, ttl);\\n }\\n\\n /**\\n * @dev Allows an operation only if none of the specified fuses are burned.\\n * @param node The namehash of the name to check fuses on.\\n * @param fuseMask A bitmask of fuses that must not be burned.\\n */\\n\\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\\n (, uint32 fuses, ) = getData(uint256(node));\\n if (fuses & fuseMask != 0) {\\n revert OperationProhibited(node);\\n }\\n _;\\n }\\n\\n /**\\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\\n * replacing a subdomain. If either conditions are true, then it is possible to call\\n * setSubnodeOwner\\n * @param parentNode Namehash of the parent name to check\\n * @param subnode Namehash of the subname to check\\n */\\n\\n function _checkCanCallSetSubnodeOwner(\\n bytes32 parentNode,\\n bytes32 subnode\\n ) internal view {\\n (\\n address subnodeOwner,\\n uint32 subnodeFuses,\\n uint64 subnodeExpiry\\n ) = getData(uint256(subnode));\\n\\n // check if the registry owner is 0 and expired\\n // check if the wrapper owner is 0 and expired\\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\\n bool expired = subnodeExpiry < block.timestamp;\\n if (\\n expired &&\\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\\n (subnodeOwner == address(0) ||\\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\\n ens.owner(subnode) == address(0))\\n ) {\\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\\n revert OperationProhibited(subnode);\\n }\\n } else {\\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\\n revert OperationProhibited(subnode);\\n }\\n }\\n }\\n\\n /**\\n * @notice Checks all Fuses in the mask are burned for the node\\n * @param node Namehash of the name\\n * @param fuseMask The fuses you want to check\\n * @return Boolean of whether or not all the selected fuses are burned\\n */\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) public view returns (bool) {\\n (, uint32 fuses, ) = getData(uint256(node));\\n return fuses & fuseMask == fuseMask;\\n }\\n\\n /**\\n * @notice Checks if a name is wrapped\\n * @param node Namehash of the name\\n * @return Boolean of whether or not the name is wrapped\\n */\\n\\n function isWrapped(bytes32 node) public view returns (bool) {\\n bytes memory name = names[node];\\n if (name.length == 0) {\\n return false;\\n }\\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\\n bytes32 parentNode = name.namehash(offset);\\n return isWrapped(parentNode, labelhash);\\n }\\n\\n /**\\n * @notice Checks if a name is wrapped in a more gas efficient way\\n * @param parentNode Namehash of the name\\n * @param labelhash Namehash of the name\\n * @return Boolean of whether or not the name is wrapped\\n */\\n\\n function isWrapped(\\n bytes32 parentNode,\\n bytes32 labelhash\\n ) public view returns (bool) {\\n bytes32 node = _makeNode(parentNode, labelhash);\\n bool wrapped = _isWrapped(node);\\n if (parentNode != ETH_NODE) {\\n return wrapped;\\n }\\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\\n return owner == address(this);\\n } catch {\\n return false;\\n }\\n }\\n\\n function onERC721Received(\\n address to,\\n address,\\n uint256 tokenId,\\n bytes calldata data\\n ) public returns (bytes4) {\\n //check if it's the eth registrar ERC721\\n if (msg.sender != address(registrar)) {\\n revert IncorrectTokenType();\\n }\\n\\n (\\n string memory label,\\n address owner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) = abi.decode(data, (string, address, uint16, address));\\n\\n bytes32 labelhash = bytes32(tokenId);\\n bytes32 labelhashFromData = keccak256(bytes(label));\\n\\n if (labelhashFromData != labelhash) {\\n revert LabelMismatch(labelhashFromData, labelhash);\\n }\\n\\n // transfer the ens record back to the new owner (this contract)\\n registrar.reclaim(uint256(labelhash), address(this));\\n\\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\\n\\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\\n\\n return IERC721Receiver(to).onERC721Received.selector;\\n }\\n\\n /***** Internal functions */\\n\\n function _beforeTransfer(\\n uint256 id,\\n uint32 fuses,\\n uint64 expiry\\n ) internal override {\\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\\n expiry -= GRACE_PERIOD;\\n }\\n\\n if (expiry < block.timestamp) {\\n // Transferable if the name was not emancipated\\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\\n revert(\\\"ERC1155: insufficient balance for transfer\\\");\\n }\\n } else {\\n // Transferable if CANNOT_TRANSFER is unburned\\n if (fuses & CANNOT_TRANSFER != 0) {\\n revert OperationProhibited(bytes32(id));\\n }\\n }\\n\\n // delete token approval if CANNOT_APPROVE has not been burnt\\n if (fuses & CANNOT_APPROVE == 0) {\\n delete _tokenApprovals[id];\\n }\\n }\\n\\n function _clearOwnerAndFuses(\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal view override returns (address, uint32) {\\n if (expiry < block.timestamp) {\\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\\n owner = address(0);\\n }\\n fuses = 0;\\n }\\n\\n return (owner, fuses);\\n }\\n\\n function _makeNode(\\n bytes32 node,\\n bytes32 labelhash\\n ) private pure returns (bytes32) {\\n return keccak256(abi.encodePacked(node, labelhash));\\n }\\n\\n function _addLabel(\\n string memory label,\\n bytes memory name\\n ) internal pure returns (bytes memory ret) {\\n if (bytes(label).length < 1) {\\n revert LabelTooShort();\\n }\\n if (bytes(label).length > 255) {\\n revert LabelTooLong(label);\\n }\\n return abi.encodePacked(uint8(bytes(label).length), label, name);\\n }\\n\\n function _mint(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal override {\\n _canFusesBeBurned(node, fuses);\\n (address oldOwner, , ) = super.getData(uint256(node));\\n if (oldOwner != address(0)) {\\n // burn and unwrap old token of old owner\\n _burn(uint256(node));\\n emit NameUnwrapped(node, address(0));\\n }\\n super._mint(node, owner, fuses, expiry);\\n }\\n\\n function _wrap(\\n bytes32 node,\\n bytes memory name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n _mint(node, wrappedOwner, fuses, expiry);\\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\\n }\\n\\n function _storeNameAndWrap(\\n bytes32 parentNode,\\n bytes32 node,\\n string memory label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n bytes memory name = _addLabel(label, names[parentNode]);\\n _wrap(node, name, owner, fuses, expiry);\\n }\\n\\n function _saveLabel(\\n bytes32 parentNode,\\n bytes32 node,\\n string memory label\\n ) internal returns (bytes memory) {\\n bytes memory name = _addLabel(label, names[parentNode]);\\n names[node] = name;\\n return name;\\n }\\n\\n function _updateName(\\n bytes32 parentNode,\\n bytes32 node,\\n string memory label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n bytes memory name = _addLabel(label, names[parentNode]);\\n if (names[node].length == 0) {\\n names[node] = name;\\n }\\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\\n if (owner == address(0)) {\\n _unwrap(node, address(0));\\n } else {\\n _transfer(oldOwner, owner, uint256(node), 1, \\\"\\\");\\n }\\n }\\n\\n // wrapper function for stack limit\\n function _checkParentFusesAndExpiry(\\n bytes32 parentNode,\\n bytes32 node,\\n uint32 fuses,\\n uint64 expiry\\n ) internal view returns (uint64) {\\n (, , uint64 oldExpiry) = getData(uint256(node));\\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\\n _checkParentFuses(node, fuses, parentFuses);\\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\\n }\\n\\n function _checkParentFuses(\\n bytes32 node,\\n uint32 fuses,\\n uint32 parentFuses\\n ) internal pure {\\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\\n 0;\\n\\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\\n\\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\\n revert OperationProhibited(node);\\n }\\n }\\n\\n function _normaliseExpiry(\\n uint64 expiry,\\n uint64 oldExpiry,\\n uint64 maxExpiry\\n ) private pure returns (uint64) {\\n // Expiry cannot be more than maximum allowed\\n // .eth names will check registrar, non .eth check parent\\n if (expiry > maxExpiry) {\\n expiry = maxExpiry;\\n }\\n // Expiry cannot be less than old expiry\\n if (expiry < oldExpiry) {\\n expiry = oldExpiry;\\n }\\n\\n return expiry;\\n }\\n\\n function _wrapETH2LD(\\n string memory label,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address resolver\\n ) private {\\n bytes32 labelhash = keccak256(bytes(label));\\n bytes32 node = _makeNode(ETH_NODE, labelhash);\\n // hardcode dns-encoded eth string for gas savings\\n bytes memory name = _addLabel(label, \\\"\\\\x03eth\\\\x00\\\");\\n names[node] = name;\\n\\n _wrap(\\n node,\\n name,\\n wrappedOwner,\\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\\n expiry\\n );\\n\\n if (resolver != address(0)) {\\n ens.setResolver(node, resolver);\\n }\\n }\\n\\n function _unwrap(bytes32 node, address owner) private {\\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\\n revert OperationProhibited(node);\\n }\\n\\n // Burn token and fuse data\\n _burn(uint256(node));\\n ens.setOwner(node, owner);\\n\\n emit NameUnwrapped(node, owner);\\n }\\n\\n function _setFuses(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 oldExpiry,\\n uint64 expiry\\n ) internal {\\n _setData(node, owner, fuses, expiry);\\n emit FusesSet(node, fuses);\\n if (expiry > oldExpiry) {\\n emit ExpiryExtended(node, expiry);\\n }\\n }\\n\\n function _setData(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n _canFusesBeBurned(node, fuses);\\n super._setData(uint256(node), owner, fuses, expiry);\\n }\\n\\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\\n if (\\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\\n ) {\\n revert OperationProhibited(node);\\n }\\n }\\n\\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\\n // Cannot directly burn other non-user settable fuses\\n revert OperationProhibited(node);\\n }\\n }\\n\\n function _isWrapped(bytes32 node) internal view returns (bool) {\\n return\\n ownerOf(uint256(node)) != address(0) &&\\n ens.owner(node) == address(this);\\n }\\n\\n function _isETH2LDInGracePeriod(\\n uint32 fuses,\\n uint64 expiry\\n ) internal view returns (bool) {\\n return\\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\\n expiry - GRACE_PERIOD < block.timestamp;\\n }\\n}\\n\",\"keccak256\":\"0x91ee0a58d8ecf132c4e7fba9a25bbf45bbfc3634f2024b30a6a2eea4a151ed0c\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c06040523480156200001157600080fd5b5060405162006502380380620065028339810160408190526200003491620002f8565b823362000041816200028f565b6040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e260048201526000906001600160a01b038416906302571be390602401602060405180830381865afa158015620000a9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000cf91906200034c565b604051630f41a04d60e11b81526001600160a01b03848116600483015291925090821690631e83409a906024016020604051808303816000875af11580156200011c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000142919062000373565b505050506001600160a01b0383811660805282811660a052600580546001600160a01b031916918316919091179055600163fffeffff60a01b03197fafa26c20e8b3d9a2853d642cfe1021dae26242ffedfac91c97aab212c1a4b93b8190557fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb4955604080518082019091526001815260006020808301829052908052600690527f54cdd369e4e8a8515e52ca72ec816c2101831ad1f18bf44102ed171459c9b4f89062000210908262000432565b506040805180820190915260058152626cae8d60e31b6020808301919091527f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae600052600690527ffb9e8e321b8a5ec48f12a7b41f22c6e595d761285c9eb19d8dda7c99edf1b54f9062000285908262000432565b50505050620004fe565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114620002f557600080fd5b50565b6000806000606084860312156200030e57600080fd5b83516200031b81620002df565b60208501519093506200032e81620002df565b60408501519092506200034181620002df565b809150509250925092565b6000602082840312156200035f57600080fd5b81516200036c81620002df565b9392505050565b6000602082840312156200038657600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620003b857607f821691505b602082108103620003d957634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200042d57600081815260208120601f850160051c81016020861015620004085750805b601f850160051c820191505b81811015620004295782815560010162000414565b5050505b505050565b81516001600160401b038111156200044e576200044e6200038d565b62000466816200045f8454620003a3565b84620003df565b602080601f8311600181146200049e5760008415620004855750858301515b600019600386901b1c1916600185901b17855562000429565b600085815260208120601f198616915b82811015620004cf57888601518255948401946001909101908401620004ae565b5085821015620004ee5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a051615ef76200060b6000396000818161050601528181610c1501528181610cef01528181610d7901528181611c6601528181611cfc01528181611daa01528181611ecc01528181611f4201528181611fc20152818161224401528181612380015281816124b2015281816126970152818161271d0152612f5201526000818161055301528181610b9b01528181610ed70152818161108b0152818161113d015281816115550152818161240501528181612537015281816127c8015281816129bf01528181612ccd0152818161317d0152818161322b015281816132f40152818161336d015281816139ca01528181613ae501528181613d4d015261438d0152615ef76000f3fe608060405234801561001057600080fd5b506004361061031f5760003560e01c80636352211e116101a7578063c93ab3fd116100ee578063e985e9c511610097578063f242432a11610071578063f242432a146107d7578063f2fde38b146107ea578063fd0cd0d9146107fd57600080fd5b8063e985e9c514610768578063eb8ae530146107a4578063ed70554d146107b757600080fd5b8063d9a50c12116100c8578063d9a50c121461071f578063da8c229e14610732578063e0dba60f1461075557600080fd5b8063c93ab3fd146106e6578063cf408823146106f9578063d8c9921a1461070c57600080fd5b8063a22cb46511610150578063b6bcad261161012a578063b6bcad26146106ad578063c475abff146106c0578063c658e086146106d357600080fd5b8063a22cb46514610674578063a401498214610687578063adf4960a1461069a57600080fd5b80638b4dfa75116101815780638b4dfa751461063d5780638cf8b41e146106505780638da5cb5b1461066357600080fd5b80636352211e146105f65780636e5d6ad214610609578063715018a61461063557600080fd5b80631f4e15041161026b5780633f15457f116102145780634e1273f4116101ee5780634e1273f4146105b057806353095467146105d05780635d3590d5146105e357600080fd5b80633f15457f1461054e578063402906fc1461057557806341415eab1461059d57600080fd5b80632b20e397116102455780632b20e397146105015780632eb2c2d61461052857806333c69ea91461053b57600080fd5b80631f4e1504146104c857806320c38e2b146104db57806324c1af44146104ee57600080fd5b80630e4cd725116102cd578063150b7a02116102a7578063150b7a02146104765780631534e177146104a25780631896f70a146104b557600080fd5b80630e4cd7251461043d5780630e89341c1461045057806314ab90381461046357600080fd5b806306fdde03116102fe57806306fdde03146103b4578063081812fc146103fd578063095ea7b31461042857600080fd5b8062fdd58e146103245780630178fe3f1461034a57806301ffc9a714610391575b600080fd5b610337610332366004614d26565b610810565b6040519081526020015b60405180910390f35b61035d610358366004614d52565b6108cf565b604080516001600160a01b03909416845263ffffffff909216602084015267ffffffffffffffff1690820152606001610341565b6103a461039f366004614d81565b6108ff565b6040519015158152602001610341565b6103f06040518060400160405280600b81526020017f4e616d655772617070657200000000000000000000000000000000000000000081525081565b6040516103419190614dee565b61041061040b366004614d52565b610958565b6040516001600160a01b039091168152602001610341565b61043b610436366004614d26565b61099d565b005b6103a461044b366004614e01565b6109e3565b6103f061045e366004614d52565b610a7d565b61043b610471366004614e4e565b610aef565b610489610484366004614ec3565b610c08565b6040516001600160e01b03199091168152602001610341565b61043b6104b0366004614f36565b610e1a565b61043b6104c3366004614e01565b610e44565b600754610410906001600160a01b031681565b6103f06104e9366004614d52565b610f06565b6103376104fc36600461502e565b610fa0565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b61043b610536366004615156565b6111b4565b61043b610549366004615204565b6114de565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b61058861058336600461525c565b6116d3565b60405163ffffffff9091168152602001610341565b6103a46105ab366004614e01565b611775565b6105c36105be36600461527f565b6117d2565b604051610341919061537d565b600554610410906001600160a01b031681565b61043b6105f1366004615390565b611910565b610410610604366004614d52565b6119aa565b61061c6106173660046153d1565b6119b5565b60405167ffffffffffffffff9091168152602001610341565b61043b611b0a565b61043b61064b366004615406565b611b1e565b61061c61065e366004615448565b611cc8565b6000546001600160a01b0316610410565b61043b6106823660046154d1565b612094565b6103376106953660046154ff565b61217e565b6103a46106a8366004615580565b612319565b61043b6106bb366004614f36565b61233e565b6103376106ce3660046155a3565b612596565b6103376106e13660046155c5565b61288d565b61043b6106f4366004615638565b612a9a565b61043b6107073660046156a4565b612c0b565b61043b61071a3660046156dc565b612dc4565b6103a461072d3660046155a3565b612ed4565b6103a4610740366004614f36565b60046020526000908152604090205460ff1681565b61043b6107633660046154d1565b612fe1565b6103a461077636600461570a565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b61043b6107b2366004615738565b613049565b6103376107c5366004614d52565b60016020526000908152604090205481565b61043b6107e53660046157a0565b613414565b61043b6107f8366004614f36565b613531565b6103a461080b366004614d52565b6135be565b60006001600160a01b0383166108935760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084015b60405180910390fd5b600061089e836119aa565b9050836001600160a01b0316816001600160a01b0316036108c35760019150506108c9565b60009150505b92915050565b60008181526001602052604090205460a081901c60c082901c6108f3838383613696565b90959094509092509050565b60006001600160e01b031982167fd82c42d800000000000000000000000000000000000000000000000000000000148061094957506001600160e01b03198216630a85bd0160e11b145b806108c957506108c9826136cd565b600080610964836119aa565b90506001600160a01b03811661097d5750600092915050565b6000838152600360205260409020546001600160a01b03165b9392505050565b60006109a8826108cf565b50915050603f1960408216016109d45760405163a2a7201360e01b81526004810183905260240161088a565b6109de838361374f565b505050565b60008080806109f1866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a3c57506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff165b80610a6057506001600160a01b038516610a5587610958565b6001600160a01b0316145b8015610a735750610a718282613899565b155b9695505050505050565b6005546040516303a24d0760e21b8152600481018390526060916001600160a01b031690630e89341c90602401600060405180830381865afa158015610ac7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108c99190810190615809565b81610afa8133611775565b610b205760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260106000610b2e836108cf565b5091505063ffffffff8282161615610b5c5760405163a2a7201360e01b81526004810184905260240161088a565b6040517f14ab90380000000000000000000000000000000000000000000000000000000081526004810187905267ffffffffffffffff861660248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906314ab9038906044015b600060405180830381600087803b158015610be857600080fd5b505af1158015610bfc573d6000803e3d6000fd5b50505050505050505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610c6c576040517f1931a53800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080610c7d86880188615881565b83516020850120939750919550935091508890808214610cd3576040517fc65c3ccc000000000000000000000000000000000000000000000000000000008152600481018290526024810183905260440161088a565b604051630a3b53db60e21b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906328ed4f6c90604401600060405180830381600087803b158015610d3b57600080fd5b505af1158015610d4f573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018d9052600092506276a70091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d6e4fa8690602401602060405180830381865afa158015610dc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de491906158e9565b610dee9190615918565b9050610e0187878761ffff1684886138ca565b50630a85bd0160e11b9c9b505050505050505050505050565b610e22613a30565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b81610e4f8133611775565b610e755760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260086000610e83836108cf565b5091505063ffffffff8282161615610eb15760405163a2a7201360e01b81526004810184905260240161088a565b604051630c4b7b8560e11b8152600481018790526001600160a01b0386811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401610bce565b60066020526000908152604090208054610f1f90615940565b80601f0160208091040260200160405190810160405280929190818152602001828054610f4b90615940565b8015610f985780601f10610f6d57610100808354040283529160200191610f98565b820191906000526020600020905b815481529060010190602001808311610f7b57829003601f168201915b505050505081565b600087610fad8133611775565b610fd35760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8751602089012061100b8a82604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506110178a84613a8a565b6110218386613bc9565b61102c8a848b613bfc565b506110398a848787613cc9565b935061104483613d0f565b6110fa576040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156110cf57600080fd5b505af11580156110e3573d6000803e3d6000fd5b505050506110f58a848b8b8989613dc8565b6111a7565b6040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561118157600080fd5b505af1158015611195573d6000803e3d6000fd5b505050506111a78a848b8b8989613dff565b5050979650505050505050565b815183511461122b5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060448201527f6d69736d61746368000000000000000000000000000000000000000000000000606482015260840161088a565b6001600160a01b03841661128f5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b0385163314806112c957506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b61133b5760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000606482015260840161088a565b60005b835181101561147157600084828151811061135b5761135b61597a565b6020026020010151905060008483815181106113795761137961597a565b602002602001015190506000806000611391856108cf565b9250925092506113a2858383613ec3565b8360011480156113c357508a6001600160a01b0316836001600160a01b0316145b6114225760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b60008581526001602052604090206001600160a01b038b1663ffffffff60a01b60a085901b16176001600160c01b031960c084901b1617905550505050508061146a90615990565b905061133e565b50836001600160a01b0316856001600160a01b0316336001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516114c19291906159a9565b60405180910390a46114d7338686868686613fb0565b5050505050565b604080516020808201879052818301869052825180830384018152606090920190925280519101206115108184613bc9565b6000808061151d846108cf565b919450925090506001600160a01b03831615806115cc57506040516302571be360e01b81526004810185905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa15801561159c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c091906159d7565b6001600160a01b031614155b156115ea57604051635374b59960e01b815260040160405180910390fd5b6000806115f68a6108cf565b90935091508a90506116375761160c8633611775565b6116325760405163168ab55d60e31b81526004810187905233602482015260440161088a565b611667565b6116418a33611775565b6116675760405163168ab55d60e31b8152600481018b905233602482015260440161088a565b611672868984614155565b61167d878483614190565b9650620100008416158015906116a157508363ffffffff1688851763ffffffff1614155b156116c25760405163a2a7201360e01b81526004810187905260240161088a565b96831796610bfc86868a868b6141da565b6000826116e08133611775565b6117065760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8360026000611714836108cf565b5091505063ffffffff82821616156117425760405163a2a7201360e01b81526004810184905260240161088a565b6000808061174f8a6108cf565b9250925092506117688a84848c61ffff161784856141da565b5098975050505050505050565b6000808080611783866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a6057506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff16610a60565b6060815183511461184b5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d617463680000000000000000000000000000000000000000000000606482015260840161088a565b6000835167ffffffffffffffff81111561186757611867614f53565b604051908082528060200260200182016040528015611890578160200160208202803683370190505b50905060005b8451811015611908576118db8582815181106118b4576118b461597a565b60200260200101518583815181106118ce576118ce61597a565b6020026020010151610810565b8282815181106118ed576118ed61597a565b602090810291909101015261190181615990565b9050611896565b509392505050565b611918613a30565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015611980573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a491906159f4565b50505050565b60006108c982614284565b604080516020808201869052818301859052825180830384018152606090920190925280519101206000906119e981613d0f565b611a0657604051635374b59960e01b815260040160405180910390fd5b6000611a1286336109e3565b905080158015611a295750611a278233611775565b155b15611a505760405163168ab55d60e31b81526004810183905233602482015260440161088a565b60008080611a5d856108cf565b92509250925083158015611a745750620400008216155b15611a955760405163a2a7201360e01b81526004810186905260240161088a565b6000611aa08a6108cf565b92505050611aaf888383614190565b9750611abd8685858b61429a565b60405167ffffffffffffffff8916815286907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b1329060200160405180910390a2509598975050505050505050565b611b12613a30565b611b1c60006142e2565b565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830186905282518083038401815260609092019092528051910120611b728133611775565b611b985760405163168ab55d60e31b81526004810182905233602482015260440161088a565b306001600160a01b03841603611bcc57604051632ca49b0d60e11b81526001600160a01b038416600482015260240161088a565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830187905282518083038401815260609092019092528051910120611c21905b83614332565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038481166024830152604482018690527f000000000000000000000000000000000000000000000000000000000000000016906342842e0e90606401600060405180830381600087803b158015611caa57600080fd5b505af1158015611cbe573d6000803e3d6000fd5b5050505050505050565b6000808686604051611cdb929190615a11565b6040519081900381206331a9108f60e11b82526004820181905291506000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611d4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6f91906159d7565b90506001600160a01b0381163314801590611e17575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015611df1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e1591906159f4565b155b15611e8757604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae6020808301919091528183018590528251808303840181526060830193849052805191012063168ab55d60e31b909252606481019190915233608482015260a40161088a565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152306024830152604482018490527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90606401600060405180830381600087803b158015611f1057600080fd5b505af1158015611f24573d6000803e3d6000fd5b5050604051630a3b53db60e21b8152600481018590523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506328ed4f6c9150604401600060405180830381600087803b158015611f9057600080fd5b505af1158015611fa4573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018590526276a70092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316915063d6e4fa8690602401602060405180830381865afa158015612012573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203691906158e9565b6120409190615918565b925061208988888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff881686886138ca565b505095945050505050565b6001600160a01b03821633036121125760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c660000000000000000000000000000000000000000000000606482015260840161088a565b3360008181526002602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b3360009081526004602052604081205460ff166121ee5760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f604482015267373a3937b63632b960c11b606482015260840161088a565b60008787604051612200929190615a11565b6040519081900381207ffca247ac000000000000000000000000000000000000000000000000000000008252600482018190523060248301526044820187905291507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fca247ac906064016020604051808303816000875af1158015612295573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b991906158e9565b915061230e88888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff86166123086276a70087615918565b886138ca565b509695505050505050565b600080612325846108cf565b50841663ffffffff908116908516149250505092915050565b612346613a30565b6007546001600160a01b0316156124665760075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156123c657600080fd5b505af11580156123da573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561244d57600080fd5b505af1158015612461573d6000803e3d6000fd5b505050505b600780546001600160a01b0319166001600160a01b038316908117909155156125935760075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156124f857600080fd5b505af115801561250c573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561257f57600080fd5b505af11580156114d7573d6000803e3d6000fd5b50565b3360009081526004602052604081205460ff166126065760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f604482015267373a3937b63632b960c11b606482015260840161088a565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301869052825180830384018152606090920190925280519101206000906040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101869052602481018590529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c475abff906044016020604051808303816000875af11580156126e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061270491906158e9565b6040516331a9108f60e11b8152600481018790529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa925050508015612788575060408051601f3d908101601f19168201909252612785918101906159d7565b60015b6127955791506108c99050565b6001600160a01b0381163014158061283f57506040516302571be360e01b81526004810184905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa15801561280f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061283391906159d7565b6001600160a01b031614155b1561284e575091506108c99050565b50600061285e6276a70083615918565b60008481526001602052604090205490915060a081901c6128818583838661429a565b50919695505050505050565b60008661289a8133611775565b6128c05760405163168ab55d60e31b81526004810182905233602482015260440161088a565b600087876040516128d2929190615a11565b6040518091039020905061290d8982604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506129198984613a8a565b6129238386613bc9565b60006129668a858b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613bfc92505050565b90506129748a858888613cc9565b945061297f84613d0f565b612a47576040517f06ab5923000000000000000000000000000000000000000000000000000000008152600481018b9052602481018390523060448201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906306ab5923906064016020604051808303816000875af1158015612a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a3491906158e9565b50612a428482898989614424565b612a8d565b612a8d8a858b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d92508c91508b9050613dff565b5050509695505050505050565b6000612ae0600086868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506144669050565b6007549091506001600160a01b0316612b25576040517f24c1d6d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612b2f8133611775565b612b555760405163168ab55d60e31b81526004810182905233602482015260440161088a565b60008080612b62846108cf565b919450925090506000612b7485610958565b9050612b7f85614525565b600760009054906101000a90046001600160a01b03166001600160a01b0316639198c2768a8a878787878e8e6040518963ffffffff1660e01b8152600401612bce989796959493929190615a4a565b600060405180830381600087803b158015612be857600080fd5b505af1158015612bfc573d6000803e3d6000fd5b50505050505050505050505050565b83612c168133611775565b612c3c5760405163168ab55d60e31b81526004810182905233602482015260440161088a565b84601c6000612c4a836108cf565b5091505063ffffffff8282161615612c785760405163a2a7201360e01b81526004810184905260240161088a565b6040517fcf408823000000000000000000000000000000000000000000000000000000008152600481018990523060248201526001600160a01b03878116604483015267ffffffffffffffff871660648301527f0000000000000000000000000000000000000000000000000000000000000000169063cf40882390608401600060405180830381600087803b158015612d1157600080fd5b505af1158015612d25573d6000803e3d6000fd5b5050506001600160a01b0388169050612d8c576000612d43896108cf565b509150506201ffff1962020000821601612d7b57604051632ca49b0d60e11b81526001600160a01b038916600482015260240161088a565b612d86896000614332565b50611cbe565b6000612d97896119aa565b9050612db981898b60001c6001604051806020016040528060008152506145e7565b505050505050505050565b60408051602080820186905281830185905282518083038401815260609092019092528051910120612df68133611775565b612e1c5760405163168ab55d60e31b81526004810182905233602482015260440161088a565b7f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b528401612e5c5760405163615a470360e01b815260040160405180910390fd5b6001600160a01b0382161580612e7a57506001600160a01b03821630145b15612ea357604051632ca49b0d60e11b81526001600160a01b038316600482015260240161088a565b604080516020808201879052818301869052825180830384018152606090920190925280519101206119a490611c1b565b604080516020808201859052818301849052825180830384018152606090920190925280519101206000906000612f0a82613d0f565b90507f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae8514612f3c5791506108c99050565b6040516331a9108f60e11b8152600481018590527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa925050508015612fbd575060408051601f3d908101601f19168201909252612fba918101906159d7565b60015b612fcc576000925050506108c9565b6001600160a01b0316301492506108c9915050565b612fe9613a30565b6001600160a01b038216600081815260046020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf8791015b60405180910390a25050565b600080613090600087878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506147399050565b9150915060006130d98288888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506144669050565b604080516020808201849052818301879052825180830384018152606090920190925280519101209091506000906000818152600660205260409020909150613123888a83615af9565b507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b5282016131645760405163615a470360e01b815260040160405180910390fd5b6040516302571be360e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa1580156131cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131f091906159d7565b90506001600160a01b0381163314801590613298575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015613272573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061329691906159f4565b155b156132bf5760405163168ab55d60e31b81526004810183905233602482015260440161088a565b6001600160a01b0386161561335157604051630c4b7b8560e11b8152600481018390526001600160a01b0387811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b15801561333857600080fd5b505af115801561334c573d6000803e3d6000fd5b505050505b604051635b0fc9c360e01b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635b0fc9c390604401600060405180830381600087803b1580156133b957600080fd5b505af11580156133cd573d6000803e3d6000fd5b50505050612db9828a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508d93509150819050614424565b6001600160a01b0384166134785760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b0385163314806134b257506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b6135245760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201527f20617070726f7665640000000000000000000000000000000000000000000000606482015260840161088a565b6114d785858585856145e7565b613539613a30565b6001600160a01b0381166135b55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161088a565b612593816142e2565b600081815260066020526040812080548291906135da90615940565b80601f016020809104026020016040519081016040528092919081815260200182805461360690615940565b80156136535780601f1061362857610100808354040283529160200191613653565b820191906000526020600020905b81548152906001019060200180831161363657829003601f168201915b50505050509050805160000361366c5750600092915050565b6000806136798382614739565b9092509050600061368a8483614466565b9050610a738184612ed4565b600080428367ffffffffffffffff1610156136c45761ffff19620100008516016136bf57600094505b600093505b50929391925050565b60006001600160e01b031982167fd9b67a2600000000000000000000000000000000000000000000000000000000148061371757506001600160e01b031982166303a24d0760e21b145b806108c957507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146108c9565b600061375a826119aa565b9050806001600160a01b0316836001600160a01b0316036137e35760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f7200000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b336001600160a01b038216148061381d57506001600160a01b038116600090815260026020908152604080832033845290915290205460ff165b61388f5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161088a565b6109de83836147f0565b6000620200008381161480156109965750426138b86276a70084615bb9565b67ffffffffffffffff16109392505050565b8451602086012060006139247f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae83604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b90506000613967886040518060400160405280600581526020017f036574680000000000000000000000000000000000000000000000000000000081525061485e565b60008381526006602052604090209091506139828282615bda565b50613995828289620300008a1789614424565b6001600160a01b03841615611cbe57604051630c4b7b8560e11b8152600481018390526001600160a01b0385811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b158015613a0e57600080fd5b505af1158015613a22573d6000803e3d6000fd5b505050505050505050505050565b6000546001600160a01b03163314611b1c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161088a565b60008080613a97846108cf565b919450925090504267ffffffffffffffff821610808015613b5b57506001600160a01b0384161580613b5b57506040516302571be360e01b8152600481018690526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b5091906159d7565b6001600160a01b0316145b15613b9a576000613b6b876108cf565b509150506020811615613b945760405163a2a7201360e01b81526004810187905260240161088a565b50613bc1565b62010000831615613bc15760405163a2a7201360e01b81526004810186905260240161088a565b505050505050565b63fffdffff81811763ffffffff1614613bf85760405163a2a7201360e01b81526004810183905260240161088a565b5050565b60606000613ca583600660008881526020019081526020016000208054613c2290615940565b80601f0160208091040260200160405190810160405280929190818152602001828054613c4e90615940565b8015613c9b5780601f10613c7057610100808354040283529160200191613c9b565b820191906000526020600020905b815481529060010190602001808311613c7e57829003601f168201915b505050505061485e565b6000858152600660205260409020909150613cc08282615bda565b50949350505050565b600080613cd5856108cf565b92505050600080613ce88860001c6108cf565b9250925050613cf8878784614155565b613d03858483614190565b98975050505050505050565b600080613d1b836119aa565b6001600160a01b0316141580156108c957506040516302571be360e01b81526004810183905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613d94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613db891906159d7565b6001600160a01b03161492915050565b60008681526006602052604081208054613de7918791613c2290615940565b9050613df68682868686614424565b50505050505050565b60008080613e0c886108cf565b9250925092506000613e3688600660008d81526020019081526020016000208054613c2290615940565b60008a8152600660205260409020805491925090613e5390615940565b9050600003613e76576000898152600660205260409020613e748282615bda565b505b613e85898588861785896141da565b6001600160a01b038716613ea357613e9e896000614332565b610bfc565b610bfc84888b60001c6001604051806020016040528060008152506145e7565b6201ffff1962020000831601613ee357613ee06276a70082615bb9565b90505b428167ffffffffffffffff161015613f605762010000821615613f5b5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b613f85565b6004821615613f855760405163a2a7201360e01b81526004810184905260240161088a565b604082166000036109de575050600090815260036020526040902080546001600160a01b0319169055565b6001600160a01b0384163b15613bc15760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190613ff49089908990889088908890600401615c9a565b6020604051808303816000875af192505050801561402f575060408051601f3d908101601f1916820190925261402c91810190615cec565b60015b6140e45761403b615d09565b806308c379a003614074575061404f615d25565b8061405a5750614076565b8060405162461bcd60e51b815260040161088a9190614dee565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560448201527f526563656976657220696d706c656d656e746572000000000000000000000000606482015260840161088a565b6001600160e01b0319811663bc197c8160e01b14613df65760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161088a565b63ffff0000821615801590600183161590829061416f5750805b156114d75760405163a2a7201360e01b81526004810186905260240161088a565b60008167ffffffffffffffff168467ffffffffffffffff1611156141b2578193505b8267ffffffffffffffff168467ffffffffffffffff1610156141d2578293505b509192915050565b6141e68585858461429a565b60405163ffffffff8416815285907f39873f00c80f4f94b7bd1594aebcf650f003545b74824d57ddf4939e3ff3a34b9060200160405180910390a28167ffffffffffffffff168167ffffffffffffffff1611156114d75760405167ffffffffffffffff8216815285907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b132906020015b60405180910390a25050505050565b600080614290836108cf565b5090949350505050565b6142a48483614907565b60008481526001602052604090206001600160a01b03841663ffffffff60a01b60a085901b16176001600160c01b031960c084901b161790556119a4565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61433d826001612319565b1561435e5760405163a2a7201360e01b81526004810183905260240161088a565b61436782614525565b604051635b0fc9c360e01b8152600481018390526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b1580156143d157600080fd5b505af11580156143e5573d6000803e3d6000fd5b50506040516001600160a01b03841681528492507fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c4915060200161303d565b61443085848484614940565b847f8ce7013e8abebc55c3890a68f5a27c67c3f7efa64e584de5fb22363c606fd340858585856040516142759493929190615daf565b60008060006144758585614739565b9092509050816144e7576001855161448d9190615df7565b84146144db5760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d65000000604482015260640161088a565b50600091506108c99050565b6144f18582614466565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b60008181526001602052604090205460a081901c60c082901c614549838383613696565b600086815260036020908152604080832080546001600160a01b03191690556001909152902063ffffffff60a01b60a083901b166001600160c01b031960c086901b1617905592506145989050565b60408051858152600160208201526000916001600160a01b0386169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a450505050565b60008060006145f5866108cf565b925092509250614606868383613ec3565b8460011480156146275750876001600160a01b0316836001600160a01b0316145b6146865760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b866001600160a01b0316836001600160a01b0316036146a7575050506114d7565b60008681526001602052604090206001600160a01b03881663ffffffff60a01b60a085901b16176001600160c01b031960c084901b1617905560408051878152602081018790526001600160a01b03808a1692908b169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611cbe3389898989896149b4565b6000808351831061478c5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e64730000604482015260640161088a565b60008484815181106147a0576147a061597a565b016020015160f81c905080156147cc576147c5856147bf866001615e0a565b83614ab0565b92506147d1565b600092505b6147db8185615e0a565b6147e6906001615e0a565b9150509250929050565b600081815260036020526040902080546001600160a01b0319166001600160a01b0384169081179091558190614825826119aa565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b606060018351101561489c576040517f280dacb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60ff835111156148da57826040517fe3ba295f00000000000000000000000000000000000000000000000000000000815260040161088a9190614dee565b825183836040516020016148f093929190615e1d565b604051602081830303815290604052905092915050565b61ffff81161580159061491f57506201000181811614155b15613bf85760405163a2a7201360e01b81526004810183905260240161088a565b61494a8483614907565b6000848152600160205260409020546001600160a01b038116156149a85761497185614525565b6040516000815285907fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49060200160405180910390a25b6114d785858585614ad4565b6001600160a01b0384163b15613bc15760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906149f89089908990889088908890600401615e7e565b6020604051808303816000875af1925050508015614a33575060408051601f3d908101601f19168201909252614a3091810190615cec565b60015b614a3f5761403b615d09565b6001600160e01b0319811663f23a6e6160e01b14613df65760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161088a565b8251600090614abf8385615e0a565b1115614aca57600080fd5b5091016020012090565b8360008080614ae2846108cf565b9194509250905063ffff0000821667ffffffffffffffff8087169083161115614b09578195505b428267ffffffffffffffff1610614b1f57958617955b6001600160a01b03841615614b765760405162461bcd60e51b815260206004820152601f60248201527f455243313135353a206d696e74206f66206578697374696e6720746f6b656e00604482015260640161088a565b6001600160a01b038816614bf25760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b306001600160a01b03891603614c705760405162461bcd60e51b815260206004820152603460248201527f455243313135353a206e65774f776e65722063616e6e6f74206265207468652060448201527f4e616d655772617070657220636f6e7472616374000000000000000000000000606482015260840161088a565b60008581526001602052604090206001600160a01b03891663ffffffff60a01b60a08a901b16176001600160c01b031960c089901b1617905560408051868152600160208201526001600160a01b038a169160009133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4612db93360008a886001604051806020016040528060008152506149b4565b6001600160a01b038116811461259357600080fd5b60008060408385031215614d3957600080fd5b8235614d4481614d11565b946020939093013593505050565b600060208284031215614d6457600080fd5b5035919050565b6001600160e01b03198116811461259357600080fd5b600060208284031215614d9357600080fd5b813561099681614d6b565b60005b83811015614db9578181015183820152602001614da1565b50506000910152565b60008151808452614dda816020860160208601614d9e565b601f01601f19169290920160200192915050565b6020815260006109966020830184614dc2565b60008060408385031215614e1457600080fd5b823591506020830135614e2681614d11565b809150509250929050565b803567ffffffffffffffff81168114614e4957600080fd5b919050565b60008060408385031215614e6157600080fd5b82359150614e7160208401614e31565b90509250929050565b60008083601f840112614e8c57600080fd5b50813567ffffffffffffffff811115614ea457600080fd5b602083019150836020828501011115614ebc57600080fd5b9250929050565b600080600080600060808688031215614edb57600080fd5b8535614ee681614d11565b94506020860135614ef681614d11565b935060408601359250606086013567ffffffffffffffff811115614f1957600080fd5b614f2588828901614e7a565b969995985093965092949392505050565b600060208284031215614f4857600080fd5b813561099681614d11565b634e487b7160e01b600052604160045260246000fd5b601f8201601f1916810167ffffffffffffffff81118282101715614f8f57614f8f614f53565b6040525050565b600067ffffffffffffffff821115614fb057614fb0614f53565b50601f01601f191660200190565b600082601f830112614fcf57600080fd5b8135614fda81614f96565b604051614fe78282614f69565b828152856020848701011115614ffc57600080fd5b82602086016020830137600092810160200192909252509392505050565b803563ffffffff81168114614e4957600080fd5b600080600080600080600060e0888a03121561504957600080fd5b87359650602088013567ffffffffffffffff81111561506757600080fd5b6150738a828b01614fbe565b965050604088013561508481614d11565b9450606088013561509481614d11565b93506150a260808901614e31565b92506150b060a0890161501a565b91506150be60c08901614e31565b905092959891949750929550565b600067ffffffffffffffff8211156150e6576150e6614f53565b5060051b60200190565b600082601f83011261510157600080fd5b8135602061510e826150cc565b60405161511b8282614f69565b83815260059390931b850182019282810191508684111561513b57600080fd5b8286015b8481101561230e578035835291830191830161513f565b600080600080600060a0868803121561516e57600080fd5b853561517981614d11565b9450602086013561518981614d11565b9350604086013567ffffffffffffffff808211156151a657600080fd5b6151b289838a016150f0565b945060608801359150808211156151c857600080fd5b6151d489838a016150f0565b935060808801359150808211156151ea57600080fd5b506151f788828901614fbe565b9150509295509295909350565b6000806000806080858703121561521a57600080fd5b84359350602085013592506152316040860161501a565b915061523f60608601614e31565b905092959194509250565b803561ffff81168114614e4957600080fd5b6000806040838503121561526f57600080fd5b82359150614e716020840161524a565b6000806040838503121561529257600080fd5b823567ffffffffffffffff808211156152aa57600080fd5b818501915085601f8301126152be57600080fd5b813560206152cb826150cc565b6040516152d88282614f69565b83815260059390931b85018201928281019150898411156152f857600080fd5b948201945b8386101561531f57853561531081614d11565b825294820194908201906152fd565b9650508601359250508082111561533557600080fd5b506147e6858286016150f0565b600081518084526020808501945080840160005b8381101561537257815187529582019590820190600101615356565b509495945050505050565b6020815260006109966020830184615342565b6000806000606084860312156153a557600080fd5b83356153b081614d11565b925060208401356153c081614d11565b929592945050506040919091013590565b6000806000606084860312156153e657600080fd5b83359250602084013591506153fd60408501614e31565b90509250925092565b60008060006060848603121561541b57600080fd5b83359250602084013561542d81614d11565b9150604084013561543d81614d11565b809150509250925092565b60008060008060006080868803121561546057600080fd5b853567ffffffffffffffff81111561547757600080fd5b61548388828901614e7a565b909650945050602086013561549781614d11565b92506154a56040870161524a565b915060608601356154b581614d11565b809150509295509295909350565b801515811461259357600080fd5b600080604083850312156154e457600080fd5b82356154ef81614d11565b91506020830135614e26816154c3565b60008060008060008060a0878903121561551857600080fd5b863567ffffffffffffffff81111561552f57600080fd5b61553b89828a01614e7a565b909750955050602087013561554f81614d11565b935060408701359250606087013561556681614d11565b91506155746080880161524a565b90509295509295509295565b6000806040838503121561559357600080fd5b82359150614e716020840161501a565b600080604083850312156155b657600080fd5b50508035926020909101359150565b60008060008060008060a087890312156155de57600080fd5b86359550602087013567ffffffffffffffff8111156155fc57600080fd5b61560889828a01614e7a565b909650945050604087013561561c81614d11565b925061562a6060880161501a565b915061557460808801614e31565b6000806000806040858703121561564e57600080fd5b843567ffffffffffffffff8082111561566657600080fd5b61567288838901614e7a565b9096509450602087013591508082111561568b57600080fd5b5061569887828801614e7a565b95989497509550505050565b600080600080608085870312156156ba57600080fd5b8435935060208501356156cc81614d11565b9250604085013561523181614d11565b6000806000606084860312156156f157600080fd5b8335925060208401359150604084013561543d81614d11565b6000806040838503121561571d57600080fd5b823561572881614d11565b91506020830135614e2681614d11565b6000806000806060858703121561574e57600080fd5b843567ffffffffffffffff81111561576557600080fd5b61577187828801614e7a565b909550935050602085013561578581614d11565b9150604085013561579581614d11565b939692955090935050565b600080600080600060a086880312156157b857600080fd5b85356157c381614d11565b945060208601356157d381614d11565b93506040860135925060608601359150608086013567ffffffffffffffff8111156157fd57600080fd5b6151f788828901614fbe565b60006020828403121561581b57600080fd5b815167ffffffffffffffff81111561583257600080fd5b8201601f8101841361584357600080fd5b805161584e81614f96565b60405161585b8282614f69565b82815286602084860101111561587057600080fd5b610a73836020830160208701614d9e565b6000806000806080858703121561589757600080fd5b843567ffffffffffffffff8111156158ae57600080fd5b6158ba87828801614fbe565b94505060208501356158cb81614d11565b92506158d96040860161524a565b9150606085013561579581614d11565b6000602082840312156158fb57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b67ffffffffffffffff81811683821601908082111561593957615939615902565b5092915050565b600181811c9082168061595457607f821691505b60208210810361597457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b6000600182016159a2576159a2615902565b5060010190565b6040815260006159bc6040830185615342565b82810360208401526159ce8185615342565b95945050505050565b6000602082840312156159e957600080fd5b815161099681614d11565b600060208284031215615a0657600080fd5b8151610996816154c3565b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60c081526000615a5e60c083018a8c615a21565b6001600160a01b03898116602085015263ffffffff8916604085015267ffffffffffffffff881660608501528616608084015282810360a0840152615aa4818587615a21565b9b9a5050505050505050505050565b601f8211156109de57600081815260208120601f850160051c81016020861015615ada5750805b601f850160051c820191505b81811015613bc157828155600101615ae6565b67ffffffffffffffff831115615b1157615b11614f53565b615b2583615b1f8354615940565b83615ab3565b6000601f841160018114615b595760008515615b415750838201355b600019600387901b1c1916600186901b1783556114d7565b600083815260209020601f19861690835b82811015615b8a5786850135825560209485019460019092019101615b6a565b5086821015615ba75760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b67ffffffffffffffff82811682821603908082111561593957615939615902565b815167ffffffffffffffff811115615bf457615bf4614f53565b615c0881615c028454615940565b84615ab3565b602080601f831160018114615c3d5760008415615c255750858301515b600019600386901b1c1916600185901b178555613bc1565b600085815260208120601f198616915b82811015615c6c57888601518255948401946001909101908401615c4d565b5085821015615c8a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006001600160a01b03808816835280871660208401525060a06040830152615cc660a0830186615342565b8281036060840152615cd88186615342565b90508281036080840152613d038185614dc2565b600060208284031215615cfe57600080fd5b815161099681614d6b565b600060033d1115615d225760046000803e5060005160e01c5b90565b600060443d1015615d335790565b6040516003193d81016004833e81513d67ffffffffffffffff8160248401118184111715615d6357505050505090565b8285019150815181811115615d7b5750505050505090565b843d8701016020828501011115615d955750505050505090565b615da460208286010187614f69565b509095945050505050565b608081526000615dc26080830187614dc2565b6001600160a01b039590951660208301525063ffffffff92909216604083015267ffffffffffffffff16606090910152919050565b818103818111156108c9576108c9615902565b808201808211156108c9576108c9615902565b7fff000000000000000000000000000000000000000000000000000000000000008460f81b16815260008351615e5a816001850160208801614d9e565b835190830190615e71816001840160208801614d9e565b0160010195945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152615eb660a0830184614dc2565b97965050505050505056fea26469706673582212204f37b28dc45c53fb37759a47de9637b4ff115b46e39238a82dadf100cccbc4dc64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061031f5760003560e01c80636352211e116101a7578063c93ab3fd116100ee578063e985e9c511610097578063f242432a11610071578063f242432a146107d7578063f2fde38b146107ea578063fd0cd0d9146107fd57600080fd5b8063e985e9c514610768578063eb8ae530146107a4578063ed70554d146107b757600080fd5b8063d9a50c12116100c8578063d9a50c121461071f578063da8c229e14610732578063e0dba60f1461075557600080fd5b8063c93ab3fd146106e6578063cf408823146106f9578063d8c9921a1461070c57600080fd5b8063a22cb46511610150578063b6bcad261161012a578063b6bcad26146106ad578063c475abff146106c0578063c658e086146106d357600080fd5b8063a22cb46514610674578063a401498214610687578063adf4960a1461069a57600080fd5b80638b4dfa75116101815780638b4dfa751461063d5780638cf8b41e146106505780638da5cb5b1461066357600080fd5b80636352211e146105f65780636e5d6ad214610609578063715018a61461063557600080fd5b80631f4e15041161026b5780633f15457f116102145780634e1273f4116101ee5780634e1273f4146105b057806353095467146105d05780635d3590d5146105e357600080fd5b80633f15457f1461054e578063402906fc1461057557806341415eab1461059d57600080fd5b80632b20e397116102455780632b20e397146105015780632eb2c2d61461052857806333c69ea91461053b57600080fd5b80631f4e1504146104c857806320c38e2b146104db57806324c1af44146104ee57600080fd5b80630e4cd725116102cd578063150b7a02116102a7578063150b7a02146104765780631534e177146104a25780631896f70a146104b557600080fd5b80630e4cd7251461043d5780630e89341c1461045057806314ab90381461046357600080fd5b806306fdde03116102fe57806306fdde03146103b4578063081812fc146103fd578063095ea7b31461042857600080fd5b8062fdd58e146103245780630178fe3f1461034a57806301ffc9a714610391575b600080fd5b610337610332366004614d26565b610810565b6040519081526020015b60405180910390f35b61035d610358366004614d52565b6108cf565b604080516001600160a01b03909416845263ffffffff909216602084015267ffffffffffffffff1690820152606001610341565b6103a461039f366004614d81565b6108ff565b6040519015158152602001610341565b6103f06040518060400160405280600b81526020017f4e616d655772617070657200000000000000000000000000000000000000000081525081565b6040516103419190614dee565b61041061040b366004614d52565b610958565b6040516001600160a01b039091168152602001610341565b61043b610436366004614d26565b61099d565b005b6103a461044b366004614e01565b6109e3565b6103f061045e366004614d52565b610a7d565b61043b610471366004614e4e565b610aef565b610489610484366004614ec3565b610c08565b6040516001600160e01b03199091168152602001610341565b61043b6104b0366004614f36565b610e1a565b61043b6104c3366004614e01565b610e44565b600754610410906001600160a01b031681565b6103f06104e9366004614d52565b610f06565b6103376104fc36600461502e565b610fa0565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b61043b610536366004615156565b6111b4565b61043b610549366004615204565b6114de565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b61058861058336600461525c565b6116d3565b60405163ffffffff9091168152602001610341565b6103a46105ab366004614e01565b611775565b6105c36105be36600461527f565b6117d2565b604051610341919061537d565b600554610410906001600160a01b031681565b61043b6105f1366004615390565b611910565b610410610604366004614d52565b6119aa565b61061c6106173660046153d1565b6119b5565b60405167ffffffffffffffff9091168152602001610341565b61043b611b0a565b61043b61064b366004615406565b611b1e565b61061c61065e366004615448565b611cc8565b6000546001600160a01b0316610410565b61043b6106823660046154d1565b612094565b6103376106953660046154ff565b61217e565b6103a46106a8366004615580565b612319565b61043b6106bb366004614f36565b61233e565b6103376106ce3660046155a3565b612596565b6103376106e13660046155c5565b61288d565b61043b6106f4366004615638565b612a9a565b61043b6107073660046156a4565b612c0b565b61043b61071a3660046156dc565b612dc4565b6103a461072d3660046155a3565b612ed4565b6103a4610740366004614f36565b60046020526000908152604090205460ff1681565b61043b6107633660046154d1565b612fe1565b6103a461077636600461570a565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b61043b6107b2366004615738565b613049565b6103376107c5366004614d52565b60016020526000908152604090205481565b61043b6107e53660046157a0565b613414565b61043b6107f8366004614f36565b613531565b6103a461080b366004614d52565b6135be565b60006001600160a01b0383166108935760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084015b60405180910390fd5b600061089e836119aa565b9050836001600160a01b0316816001600160a01b0316036108c35760019150506108c9565b60009150505b92915050565b60008181526001602052604090205460a081901c60c082901c6108f3838383613696565b90959094509092509050565b60006001600160e01b031982167fd82c42d800000000000000000000000000000000000000000000000000000000148061094957506001600160e01b03198216630a85bd0160e11b145b806108c957506108c9826136cd565b600080610964836119aa565b90506001600160a01b03811661097d5750600092915050565b6000838152600360205260409020546001600160a01b03165b9392505050565b60006109a8826108cf565b50915050603f1960408216016109d45760405163a2a7201360e01b81526004810183905260240161088a565b6109de838361374f565b505050565b60008080806109f1866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a3c57506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff165b80610a6057506001600160a01b038516610a5587610958565b6001600160a01b0316145b8015610a735750610a718282613899565b155b9695505050505050565b6005546040516303a24d0760e21b8152600481018390526060916001600160a01b031690630e89341c90602401600060405180830381865afa158015610ac7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108c99190810190615809565b81610afa8133611775565b610b205760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260106000610b2e836108cf565b5091505063ffffffff8282161615610b5c5760405163a2a7201360e01b81526004810184905260240161088a565b6040517f14ab90380000000000000000000000000000000000000000000000000000000081526004810187905267ffffffffffffffff861660248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906314ab9038906044015b600060405180830381600087803b158015610be857600080fd5b505af1158015610bfc573d6000803e3d6000fd5b50505050505050505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610c6c576040517f1931a53800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080610c7d86880188615881565b83516020850120939750919550935091508890808214610cd3576040517fc65c3ccc000000000000000000000000000000000000000000000000000000008152600481018290526024810183905260440161088a565b604051630a3b53db60e21b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906328ed4f6c90604401600060405180830381600087803b158015610d3b57600080fd5b505af1158015610d4f573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018d9052600092506276a70091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d6e4fa8690602401602060405180830381865afa158015610dc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de491906158e9565b610dee9190615918565b9050610e0187878761ffff1684886138ca565b50630a85bd0160e11b9c9b505050505050505050505050565b610e22613a30565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b81610e4f8133611775565b610e755760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260086000610e83836108cf565b5091505063ffffffff8282161615610eb15760405163a2a7201360e01b81526004810184905260240161088a565b604051630c4b7b8560e11b8152600481018790526001600160a01b0386811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401610bce565b60066020526000908152604090208054610f1f90615940565b80601f0160208091040260200160405190810160405280929190818152602001828054610f4b90615940565b8015610f985780601f10610f6d57610100808354040283529160200191610f98565b820191906000526020600020905b815481529060010190602001808311610f7b57829003601f168201915b505050505081565b600087610fad8133611775565b610fd35760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8751602089012061100b8a82604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506110178a84613a8a565b6110218386613bc9565b61102c8a848b613bfc565b506110398a848787613cc9565b935061104483613d0f565b6110fa576040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156110cf57600080fd5b505af11580156110e3573d6000803e3d6000fd5b505050506110f58a848b8b8989613dc8565b6111a7565b6040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561118157600080fd5b505af1158015611195573d6000803e3d6000fd5b505050506111a78a848b8b8989613dff565b5050979650505050505050565b815183511461122b5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060448201527f6d69736d61746368000000000000000000000000000000000000000000000000606482015260840161088a565b6001600160a01b03841661128f5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b0385163314806112c957506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b61133b5760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000606482015260840161088a565b60005b835181101561147157600084828151811061135b5761135b61597a565b6020026020010151905060008483815181106113795761137961597a565b602002602001015190506000806000611391856108cf565b9250925092506113a2858383613ec3565b8360011480156113c357508a6001600160a01b0316836001600160a01b0316145b6114225760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b60008581526001602052604090206001600160a01b038b1663ffffffff60a01b60a085901b16176001600160c01b031960c084901b1617905550505050508061146a90615990565b905061133e565b50836001600160a01b0316856001600160a01b0316336001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516114c19291906159a9565b60405180910390a46114d7338686868686613fb0565b5050505050565b604080516020808201879052818301869052825180830384018152606090920190925280519101206115108184613bc9565b6000808061151d846108cf565b919450925090506001600160a01b03831615806115cc57506040516302571be360e01b81526004810185905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa15801561159c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c091906159d7565b6001600160a01b031614155b156115ea57604051635374b59960e01b815260040160405180910390fd5b6000806115f68a6108cf565b90935091508a90506116375761160c8633611775565b6116325760405163168ab55d60e31b81526004810187905233602482015260440161088a565b611667565b6116418a33611775565b6116675760405163168ab55d60e31b8152600481018b905233602482015260440161088a565b611672868984614155565b61167d878483614190565b9650620100008416158015906116a157508363ffffffff1688851763ffffffff1614155b156116c25760405163a2a7201360e01b81526004810187905260240161088a565b96831796610bfc86868a868b6141da565b6000826116e08133611775565b6117065760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8360026000611714836108cf565b5091505063ffffffff82821616156117425760405163a2a7201360e01b81526004810184905260240161088a565b6000808061174f8a6108cf565b9250925092506117688a84848c61ffff161784856141da565b5098975050505050505050565b6000808080611783866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a6057506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff16610a60565b6060815183511461184b5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d617463680000000000000000000000000000000000000000000000606482015260840161088a565b6000835167ffffffffffffffff81111561186757611867614f53565b604051908082528060200260200182016040528015611890578160200160208202803683370190505b50905060005b8451811015611908576118db8582815181106118b4576118b461597a565b60200260200101518583815181106118ce576118ce61597a565b6020026020010151610810565b8282815181106118ed576118ed61597a565b602090810291909101015261190181615990565b9050611896565b509392505050565b611918613a30565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015611980573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a491906159f4565b50505050565b60006108c982614284565b604080516020808201869052818301859052825180830384018152606090920190925280519101206000906119e981613d0f565b611a0657604051635374b59960e01b815260040160405180910390fd5b6000611a1286336109e3565b905080158015611a295750611a278233611775565b155b15611a505760405163168ab55d60e31b81526004810183905233602482015260440161088a565b60008080611a5d856108cf565b92509250925083158015611a745750620400008216155b15611a955760405163a2a7201360e01b81526004810186905260240161088a565b6000611aa08a6108cf565b92505050611aaf888383614190565b9750611abd8685858b61429a565b60405167ffffffffffffffff8916815286907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b1329060200160405180910390a2509598975050505050505050565b611b12613a30565b611b1c60006142e2565b565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830186905282518083038401815260609092019092528051910120611b728133611775565b611b985760405163168ab55d60e31b81526004810182905233602482015260440161088a565b306001600160a01b03841603611bcc57604051632ca49b0d60e11b81526001600160a01b038416600482015260240161088a565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae60208083019190915281830187905282518083038401815260609092019092528051910120611c21905b83614332565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038481166024830152604482018690527f000000000000000000000000000000000000000000000000000000000000000016906342842e0e90606401600060405180830381600087803b158015611caa57600080fd5b505af1158015611cbe573d6000803e3d6000fd5b5050505050505050565b6000808686604051611cdb929190615a11565b6040519081900381206331a9108f60e11b82526004820181905291506000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611d4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6f91906159d7565b90506001600160a01b0381163314801590611e17575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015611df1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e1591906159f4565b155b15611e8757604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae6020808301919091528183018590528251808303840181526060830193849052805191012063168ab55d60e31b909252606481019190915233608482015260a40161088a565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152306024830152604482018490527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90606401600060405180830381600087803b158015611f1057600080fd5b505af1158015611f24573d6000803e3d6000fd5b5050604051630a3b53db60e21b8152600481018590523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506328ed4f6c9150604401600060405180830381600087803b158015611f9057600080fd5b505af1158015611fa4573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018590526276a70092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316915063d6e4fa8690602401602060405180830381865afa158015612012573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203691906158e9565b6120409190615918565b925061208988888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff881686886138ca565b505095945050505050565b6001600160a01b03821633036121125760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c660000000000000000000000000000000000000000000000606482015260840161088a565b3360008181526002602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b3360009081526004602052604081205460ff166121ee5760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f604482015267373a3937b63632b960c11b606482015260840161088a565b60008787604051612200929190615a11565b6040519081900381207ffca247ac000000000000000000000000000000000000000000000000000000008252600482018190523060248301526044820187905291507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fca247ac906064016020604051808303816000875af1158015612295573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b991906158e9565b915061230e88888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff86166123086276a70087615918565b886138ca565b509695505050505050565b600080612325846108cf565b50841663ffffffff908116908516149250505092915050565b612346613a30565b6007546001600160a01b0316156124665760075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156123c657600080fd5b505af11580156123da573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561244d57600080fd5b505af1158015612461573d6000803e3d6000fd5b505050505b600780546001600160a01b0319166001600160a01b038316908117909155156125935760075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156124f857600080fd5b505af115801561250c573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561257f57600080fd5b505af11580156114d7573d6000803e3d6000fd5b50565b3360009081526004602052604081205460ff166126065760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f604482015267373a3937b63632b960c11b606482015260840161088a565b604080517f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae602080830191909152818301869052825180830384018152606090920190925280519101206000906040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101869052602481018590529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c475abff906044016020604051808303816000875af11580156126e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061270491906158e9565b6040516331a9108f60e11b8152600481018790529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa925050508015612788575060408051601f3d908101601f19168201909252612785918101906159d7565b60015b6127955791506108c99050565b6001600160a01b0381163014158061283f57506040516302571be360e01b81526004810184905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa15801561280f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061283391906159d7565b6001600160a01b031614155b1561284e575091506108c99050565b50600061285e6276a70083615918565b60008481526001602052604090205490915060a081901c6128818583838661429a565b50919695505050505050565b60008661289a8133611775565b6128c05760405163168ab55d60e31b81526004810182905233602482015260440161088a565b600087876040516128d2929190615a11565b6040518091039020905061290d8982604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506129198984613a8a565b6129238386613bc9565b60006129668a858b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613bfc92505050565b90506129748a858888613cc9565b945061297f84613d0f565b612a47576040517f06ab5923000000000000000000000000000000000000000000000000000000008152600481018b9052602481018390523060448201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906306ab5923906064016020604051808303816000875af1158015612a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a3491906158e9565b50612a428482898989614424565b612a8d565b612a8d8a858b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d92508c91508b9050613dff565b5050509695505050505050565b6000612ae0600086868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506144669050565b6007549091506001600160a01b0316612b25576040517f24c1d6d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612b2f8133611775565b612b555760405163168ab55d60e31b81526004810182905233602482015260440161088a565b60008080612b62846108cf565b919450925090506000612b7485610958565b9050612b7f85614525565b600760009054906101000a90046001600160a01b03166001600160a01b0316639198c2768a8a878787878e8e6040518963ffffffff1660e01b8152600401612bce989796959493929190615a4a565b600060405180830381600087803b158015612be857600080fd5b505af1158015612bfc573d6000803e3d6000fd5b50505050505050505050505050565b83612c168133611775565b612c3c5760405163168ab55d60e31b81526004810182905233602482015260440161088a565b84601c6000612c4a836108cf565b5091505063ffffffff8282161615612c785760405163a2a7201360e01b81526004810184905260240161088a565b6040517fcf408823000000000000000000000000000000000000000000000000000000008152600481018990523060248201526001600160a01b03878116604483015267ffffffffffffffff871660648301527f0000000000000000000000000000000000000000000000000000000000000000169063cf40882390608401600060405180830381600087803b158015612d1157600080fd5b505af1158015612d25573d6000803e3d6000fd5b5050506001600160a01b0388169050612d8c576000612d43896108cf565b509150506201ffff1962020000821601612d7b57604051632ca49b0d60e11b81526001600160a01b038916600482015260240161088a565b612d86896000614332565b50611cbe565b6000612d97896119aa565b9050612db981898b60001c6001604051806020016040528060008152506145e7565b505050505050505050565b60408051602080820186905281830185905282518083038401815260609092019092528051910120612df68133611775565b612e1c5760405163168ab55d60e31b81526004810182905233602482015260440161088a565b7f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b528401612e5c5760405163615a470360e01b815260040160405180910390fd5b6001600160a01b0382161580612e7a57506001600160a01b03821630145b15612ea357604051632ca49b0d60e11b81526001600160a01b038316600482015260240161088a565b604080516020808201879052818301869052825180830384018152606090920190925280519101206119a490611c1b565b604080516020808201859052818301849052825180830384018152606090920190925280519101206000906000612f0a82613d0f565b90507f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae8514612f3c5791506108c99050565b6040516331a9108f60e11b8152600481018590527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa925050508015612fbd575060408051601f3d908101601f19168201909252612fba918101906159d7565b60015b612fcc576000925050506108c9565b6001600160a01b0316301492506108c9915050565b612fe9613a30565b6001600160a01b038216600081815260046020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf8791015b60405180910390a25050565b600080613090600087878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506147399050565b9150915060006130d98288888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506144669050565b604080516020808201849052818301879052825180830384018152606090920190925280519101209091506000906000818152600660205260409020909150613123888a83615af9565b507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b5282016131645760405163615a470360e01b815260040160405180910390fd5b6040516302571be360e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa1580156131cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131f091906159d7565b90506001600160a01b0381163314801590613298575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015613272573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061329691906159f4565b155b156132bf5760405163168ab55d60e31b81526004810183905233602482015260440161088a565b6001600160a01b0386161561335157604051630c4b7b8560e11b8152600481018390526001600160a01b0387811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b15801561333857600080fd5b505af115801561334c573d6000803e3d6000fd5b505050505b604051635b0fc9c360e01b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635b0fc9c390604401600060405180830381600087803b1580156133b957600080fd5b505af11580156133cd573d6000803e3d6000fd5b50505050612db9828a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508d93509150819050614424565b6001600160a01b0384166134785760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b0385163314806134b257506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b6135245760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201527f20617070726f7665640000000000000000000000000000000000000000000000606482015260840161088a565b6114d785858585856145e7565b613539613a30565b6001600160a01b0381166135b55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161088a565b612593816142e2565b600081815260066020526040812080548291906135da90615940565b80601f016020809104026020016040519081016040528092919081815260200182805461360690615940565b80156136535780601f1061362857610100808354040283529160200191613653565b820191906000526020600020905b81548152906001019060200180831161363657829003601f168201915b50505050509050805160000361366c5750600092915050565b6000806136798382614739565b9092509050600061368a8483614466565b9050610a738184612ed4565b600080428367ffffffffffffffff1610156136c45761ffff19620100008516016136bf57600094505b600093505b50929391925050565b60006001600160e01b031982167fd9b67a2600000000000000000000000000000000000000000000000000000000148061371757506001600160e01b031982166303a24d0760e21b145b806108c957507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146108c9565b600061375a826119aa565b9050806001600160a01b0316836001600160a01b0316036137e35760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f7200000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b336001600160a01b038216148061381d57506001600160a01b038116600090815260026020908152604080832033845290915290205460ff165b61388f5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161088a565b6109de83836147f0565b6000620200008381161480156109965750426138b86276a70084615bb9565b67ffffffffffffffff16109392505050565b8451602086012060006139247f93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae83604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b90506000613967886040518060400160405280600581526020017f036574680000000000000000000000000000000000000000000000000000000081525061485e565b60008381526006602052604090209091506139828282615bda565b50613995828289620300008a1789614424565b6001600160a01b03841615611cbe57604051630c4b7b8560e11b8152600481018390526001600160a01b0385811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b158015613a0e57600080fd5b505af1158015613a22573d6000803e3d6000fd5b505050505050505050505050565b6000546001600160a01b03163314611b1c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161088a565b60008080613a97846108cf565b919450925090504267ffffffffffffffff821610808015613b5b57506001600160a01b0384161580613b5b57506040516302571be360e01b8152600481018690526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b5091906159d7565b6001600160a01b0316145b15613b9a576000613b6b876108cf565b509150506020811615613b945760405163a2a7201360e01b81526004810187905260240161088a565b50613bc1565b62010000831615613bc15760405163a2a7201360e01b81526004810186905260240161088a565b505050505050565b63fffdffff81811763ffffffff1614613bf85760405163a2a7201360e01b81526004810183905260240161088a565b5050565b60606000613ca583600660008881526020019081526020016000208054613c2290615940565b80601f0160208091040260200160405190810160405280929190818152602001828054613c4e90615940565b8015613c9b5780601f10613c7057610100808354040283529160200191613c9b565b820191906000526020600020905b815481529060010190602001808311613c7e57829003601f168201915b505050505061485e565b6000858152600660205260409020909150613cc08282615bda565b50949350505050565b600080613cd5856108cf565b92505050600080613ce88860001c6108cf565b9250925050613cf8878784614155565b613d03858483614190565b98975050505050505050565b600080613d1b836119aa565b6001600160a01b0316141580156108c957506040516302571be360e01b81526004810183905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613d94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613db891906159d7565b6001600160a01b03161492915050565b60008681526006602052604081208054613de7918791613c2290615940565b9050613df68682868686614424565b50505050505050565b60008080613e0c886108cf565b9250925092506000613e3688600660008d81526020019081526020016000208054613c2290615940565b60008a8152600660205260409020805491925090613e5390615940565b9050600003613e76576000898152600660205260409020613e748282615bda565b505b613e85898588861785896141da565b6001600160a01b038716613ea357613e9e896000614332565b610bfc565b610bfc84888b60001c6001604051806020016040528060008152506145e7565b6201ffff1962020000831601613ee357613ee06276a70082615bb9565b90505b428167ffffffffffffffff161015613f605762010000821615613f5b5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b613f85565b6004821615613f855760405163a2a7201360e01b81526004810184905260240161088a565b604082166000036109de575050600090815260036020526040902080546001600160a01b0319169055565b6001600160a01b0384163b15613bc15760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190613ff49089908990889088908890600401615c9a565b6020604051808303816000875af192505050801561402f575060408051601f3d908101601f1916820190925261402c91810190615cec565b60015b6140e45761403b615d09565b806308c379a003614074575061404f615d25565b8061405a5750614076565b8060405162461bcd60e51b815260040161088a9190614dee565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560448201527f526563656976657220696d706c656d656e746572000000000000000000000000606482015260840161088a565b6001600160e01b0319811663bc197c8160e01b14613df65760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161088a565b63ffff0000821615801590600183161590829061416f5750805b156114d75760405163a2a7201360e01b81526004810186905260240161088a565b60008167ffffffffffffffff168467ffffffffffffffff1611156141b2578193505b8267ffffffffffffffff168467ffffffffffffffff1610156141d2578293505b509192915050565b6141e68585858461429a565b60405163ffffffff8416815285907f39873f00c80f4f94b7bd1594aebcf650f003545b74824d57ddf4939e3ff3a34b9060200160405180910390a28167ffffffffffffffff168167ffffffffffffffff1611156114d75760405167ffffffffffffffff8216815285907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b132906020015b60405180910390a25050505050565b600080614290836108cf565b5090949350505050565b6142a48483614907565b60008481526001602052604090206001600160a01b03841663ffffffff60a01b60a085901b16176001600160c01b031960c084901b161790556119a4565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61433d826001612319565b1561435e5760405163a2a7201360e01b81526004810183905260240161088a565b61436782614525565b604051635b0fc9c360e01b8152600481018390526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b1580156143d157600080fd5b505af11580156143e5573d6000803e3d6000fd5b50506040516001600160a01b03841681528492507fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c4915060200161303d565b61443085848484614940565b847f8ce7013e8abebc55c3890a68f5a27c67c3f7efa64e584de5fb22363c606fd340858585856040516142759493929190615daf565b60008060006144758585614739565b9092509050816144e7576001855161448d9190615df7565b84146144db5760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d65000000604482015260640161088a565b50600091506108c99050565b6144f18582614466565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b60008181526001602052604090205460a081901c60c082901c614549838383613696565b600086815260036020908152604080832080546001600160a01b03191690556001909152902063ffffffff60a01b60a083901b166001600160c01b031960c086901b1617905592506145989050565b60408051858152600160208201526000916001600160a01b0386169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a450505050565b60008060006145f5866108cf565b925092509250614606868383613ec3565b8460011480156146275750876001600160a01b0316836001600160a01b0316145b6146865760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b866001600160a01b0316836001600160a01b0316036146a7575050506114d7565b60008681526001602052604090206001600160a01b03881663ffffffff60a01b60a085901b16176001600160c01b031960c084901b1617905560408051878152602081018790526001600160a01b03808a1692908b169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611cbe3389898989896149b4565b6000808351831061478c5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e64730000604482015260640161088a565b60008484815181106147a0576147a061597a565b016020015160f81c905080156147cc576147c5856147bf866001615e0a565b83614ab0565b92506147d1565b600092505b6147db8185615e0a565b6147e6906001615e0a565b9150509250929050565b600081815260036020526040902080546001600160a01b0319166001600160a01b0384169081179091558190614825826119aa565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b606060018351101561489c576040517f280dacb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60ff835111156148da57826040517fe3ba295f00000000000000000000000000000000000000000000000000000000815260040161088a9190614dee565b825183836040516020016148f093929190615e1d565b604051602081830303815290604052905092915050565b61ffff81161580159061491f57506201000181811614155b15613bf85760405163a2a7201360e01b81526004810183905260240161088a565b61494a8483614907565b6000848152600160205260409020546001600160a01b038116156149a85761497185614525565b6040516000815285907fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49060200160405180910390a25b6114d785858585614ad4565b6001600160a01b0384163b15613bc15760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906149f89089908990889088908890600401615e7e565b6020604051808303816000875af1925050508015614a33575060408051601f3d908101601f19168201909252614a3091810190615cec565b60015b614a3f5761403b615d09565b6001600160e01b0319811663f23a6e6160e01b14613df65760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161088a565b8251600090614abf8385615e0a565b1115614aca57600080fd5b5091016020012090565b8360008080614ae2846108cf565b9194509250905063ffff0000821667ffffffffffffffff8087169083161115614b09578195505b428267ffffffffffffffff1610614b1f57958617955b6001600160a01b03841615614b765760405162461bcd60e51b815260206004820152601f60248201527f455243313135353a206d696e74206f66206578697374696e6720746f6b656e00604482015260640161088a565b6001600160a01b038816614bf25760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b306001600160a01b03891603614c705760405162461bcd60e51b815260206004820152603460248201527f455243313135353a206e65774f776e65722063616e6e6f74206265207468652060448201527f4e616d655772617070657220636f6e7472616374000000000000000000000000606482015260840161088a565b60008581526001602052604090206001600160a01b03891663ffffffff60a01b60a08a901b16176001600160c01b031960c089901b1617905560408051868152600160208201526001600160a01b038a169160009133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4612db93360008a886001604051806020016040528060008152506149b4565b6001600160a01b038116811461259357600080fd5b60008060408385031215614d3957600080fd5b8235614d4481614d11565b946020939093013593505050565b600060208284031215614d6457600080fd5b5035919050565b6001600160e01b03198116811461259357600080fd5b600060208284031215614d9357600080fd5b813561099681614d6b565b60005b83811015614db9578181015183820152602001614da1565b50506000910152565b60008151808452614dda816020860160208601614d9e565b601f01601f19169290920160200192915050565b6020815260006109966020830184614dc2565b60008060408385031215614e1457600080fd5b823591506020830135614e2681614d11565b809150509250929050565b803567ffffffffffffffff81168114614e4957600080fd5b919050565b60008060408385031215614e6157600080fd5b82359150614e7160208401614e31565b90509250929050565b60008083601f840112614e8c57600080fd5b50813567ffffffffffffffff811115614ea457600080fd5b602083019150836020828501011115614ebc57600080fd5b9250929050565b600080600080600060808688031215614edb57600080fd5b8535614ee681614d11565b94506020860135614ef681614d11565b935060408601359250606086013567ffffffffffffffff811115614f1957600080fd5b614f2588828901614e7a565b969995985093965092949392505050565b600060208284031215614f4857600080fd5b813561099681614d11565b634e487b7160e01b600052604160045260246000fd5b601f8201601f1916810167ffffffffffffffff81118282101715614f8f57614f8f614f53565b6040525050565b600067ffffffffffffffff821115614fb057614fb0614f53565b50601f01601f191660200190565b600082601f830112614fcf57600080fd5b8135614fda81614f96565b604051614fe78282614f69565b828152856020848701011115614ffc57600080fd5b82602086016020830137600092810160200192909252509392505050565b803563ffffffff81168114614e4957600080fd5b600080600080600080600060e0888a03121561504957600080fd5b87359650602088013567ffffffffffffffff81111561506757600080fd5b6150738a828b01614fbe565b965050604088013561508481614d11565b9450606088013561509481614d11565b93506150a260808901614e31565b92506150b060a0890161501a565b91506150be60c08901614e31565b905092959891949750929550565b600067ffffffffffffffff8211156150e6576150e6614f53565b5060051b60200190565b600082601f83011261510157600080fd5b8135602061510e826150cc565b60405161511b8282614f69565b83815260059390931b850182019282810191508684111561513b57600080fd5b8286015b8481101561230e578035835291830191830161513f565b600080600080600060a0868803121561516e57600080fd5b853561517981614d11565b9450602086013561518981614d11565b9350604086013567ffffffffffffffff808211156151a657600080fd5b6151b289838a016150f0565b945060608801359150808211156151c857600080fd5b6151d489838a016150f0565b935060808801359150808211156151ea57600080fd5b506151f788828901614fbe565b9150509295509295909350565b6000806000806080858703121561521a57600080fd5b84359350602085013592506152316040860161501a565b915061523f60608601614e31565b905092959194509250565b803561ffff81168114614e4957600080fd5b6000806040838503121561526f57600080fd5b82359150614e716020840161524a565b6000806040838503121561529257600080fd5b823567ffffffffffffffff808211156152aa57600080fd5b818501915085601f8301126152be57600080fd5b813560206152cb826150cc565b6040516152d88282614f69565b83815260059390931b85018201928281019150898411156152f857600080fd5b948201945b8386101561531f57853561531081614d11565b825294820194908201906152fd565b9650508601359250508082111561533557600080fd5b506147e6858286016150f0565b600081518084526020808501945080840160005b8381101561537257815187529582019590820190600101615356565b509495945050505050565b6020815260006109966020830184615342565b6000806000606084860312156153a557600080fd5b83356153b081614d11565b925060208401356153c081614d11565b929592945050506040919091013590565b6000806000606084860312156153e657600080fd5b83359250602084013591506153fd60408501614e31565b90509250925092565b60008060006060848603121561541b57600080fd5b83359250602084013561542d81614d11565b9150604084013561543d81614d11565b809150509250925092565b60008060008060006080868803121561546057600080fd5b853567ffffffffffffffff81111561547757600080fd5b61548388828901614e7a565b909650945050602086013561549781614d11565b92506154a56040870161524a565b915060608601356154b581614d11565b809150509295509295909350565b801515811461259357600080fd5b600080604083850312156154e457600080fd5b82356154ef81614d11565b91506020830135614e26816154c3565b60008060008060008060a0878903121561551857600080fd5b863567ffffffffffffffff81111561552f57600080fd5b61553b89828a01614e7a565b909750955050602087013561554f81614d11565b935060408701359250606087013561556681614d11565b91506155746080880161524a565b90509295509295509295565b6000806040838503121561559357600080fd5b82359150614e716020840161501a565b600080604083850312156155b657600080fd5b50508035926020909101359150565b60008060008060008060a087890312156155de57600080fd5b86359550602087013567ffffffffffffffff8111156155fc57600080fd5b61560889828a01614e7a565b909650945050604087013561561c81614d11565b925061562a6060880161501a565b915061557460808801614e31565b6000806000806040858703121561564e57600080fd5b843567ffffffffffffffff8082111561566657600080fd5b61567288838901614e7a565b9096509450602087013591508082111561568b57600080fd5b5061569887828801614e7a565b95989497509550505050565b600080600080608085870312156156ba57600080fd5b8435935060208501356156cc81614d11565b9250604085013561523181614d11565b6000806000606084860312156156f157600080fd5b8335925060208401359150604084013561543d81614d11565b6000806040838503121561571d57600080fd5b823561572881614d11565b91506020830135614e2681614d11565b6000806000806060858703121561574e57600080fd5b843567ffffffffffffffff81111561576557600080fd5b61577187828801614e7a565b909550935050602085013561578581614d11565b9150604085013561579581614d11565b939692955090935050565b600080600080600060a086880312156157b857600080fd5b85356157c381614d11565b945060208601356157d381614d11565b93506040860135925060608601359150608086013567ffffffffffffffff8111156157fd57600080fd5b6151f788828901614fbe565b60006020828403121561581b57600080fd5b815167ffffffffffffffff81111561583257600080fd5b8201601f8101841361584357600080fd5b805161584e81614f96565b60405161585b8282614f69565b82815286602084860101111561587057600080fd5b610a73836020830160208701614d9e565b6000806000806080858703121561589757600080fd5b843567ffffffffffffffff8111156158ae57600080fd5b6158ba87828801614fbe565b94505060208501356158cb81614d11565b92506158d96040860161524a565b9150606085013561579581614d11565b6000602082840312156158fb57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b67ffffffffffffffff81811683821601908082111561593957615939615902565b5092915050565b600181811c9082168061595457607f821691505b60208210810361597457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b6000600182016159a2576159a2615902565b5060010190565b6040815260006159bc6040830185615342565b82810360208401526159ce8185615342565b95945050505050565b6000602082840312156159e957600080fd5b815161099681614d11565b600060208284031215615a0657600080fd5b8151610996816154c3565b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60c081526000615a5e60c083018a8c615a21565b6001600160a01b03898116602085015263ffffffff8916604085015267ffffffffffffffff881660608501528616608084015282810360a0840152615aa4818587615a21565b9b9a5050505050505050505050565b601f8211156109de57600081815260208120601f850160051c81016020861015615ada5750805b601f850160051c820191505b81811015613bc157828155600101615ae6565b67ffffffffffffffff831115615b1157615b11614f53565b615b2583615b1f8354615940565b83615ab3565b6000601f841160018114615b595760008515615b415750838201355b600019600387901b1c1916600186901b1783556114d7565b600083815260209020601f19861690835b82811015615b8a5786850135825560209485019460019092019101615b6a565b5086821015615ba75760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b67ffffffffffffffff82811682821603908082111561593957615939615902565b815167ffffffffffffffff811115615bf457615bf4614f53565b615c0881615c028454615940565b84615ab3565b602080601f831160018114615c3d5760008415615c255750858301515b600019600386901b1c1916600185901b178555613bc1565b600085815260208120601f198616915b82811015615c6c57888601518255948401946001909101908401615c4d565b5085821015615c8a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006001600160a01b03808816835280871660208401525060a06040830152615cc660a0830186615342565b8281036060840152615cd88186615342565b90508281036080840152613d038185614dc2565b600060208284031215615cfe57600080fd5b815161099681614d6b565b600060033d1115615d225760046000803e5060005160e01c5b90565b600060443d1015615d335790565b6040516003193d81016004833e81513d67ffffffffffffffff8160248401118184111715615d6357505050505090565b8285019150815181811115615d7b5750505050505090565b843d8701016020828501011115615d955750505050505090565b615da460208286010187614f69565b509095945050505050565b608081526000615dc26080830187614dc2565b6001600160a01b039590951660208301525063ffffffff92909216604083015267ffffffffffffffff16606090910152919050565b818103818111156108c9576108c9615902565b808201808211156108c9576108c9615902565b7fff000000000000000000000000000000000000000000000000000000000000008460f81b16815260008351615e5a816001850160208801614d9e565b835190830190615e71816001840160208801614d9e565b0160010195945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152615eb660a0830184614dc2565b97965050505050505056fea26469706673582212204f37b28dc45c53fb37759a47de9637b4ff115b46e39238a82dadf100cccbc4dc64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "allFusesBurned(bytes32,uint32)": { + "params": { + "fuseMask": "The fuses you want to check", + "node": "Namehash of the name" + }, + "returns": { + "_0": "Boolean of whether or not all the selected fuses are burned" + } + }, + "approve(address,uint256)": { + "params": { + "to": "address to approve", + "tokenId": "name to approve" + } + }, + "balanceOf(address,uint256)": { + "details": "See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address." + }, + "balanceOfBatch(address[],uint256[])": { + "details": "See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length." + }, + "canExtendSubnames(bytes32,address)": { + "params": { + "addr": "which address to check permissions for", + "node": "namehash of the name to check" + }, + "returns": { + "_0": "whether or not is owner/operator or approved" + } + }, + "canModifyName(bytes32,address)": { + "params": { + "addr": "which address to check permissions for", + "node": "namehash of the name to check" + }, + "returns": { + "_0": "whether or not is owner or operator" + } + }, + "extendExpiry(bytes32,bytes32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "labelhash": "Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')", + "parentNode": "Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')" + }, + "returns": { + "_0": "New expiry" + } + }, + "getApproved(uint256)": { + "params": { + "id": "Namehash of the name" + }, + "returns": { + "operator": "Approved operator of a name" + } + }, + "getData(uint256)": { + "params": { + "id": "Namehash of the name" + }, + "returns": { + "expiry": "Expiry of the name", + "fuses": "Fuses of the name", + "owner": "Owner of the name" + } + }, + "isApprovedForAll(address,address)": { + "details": "See {IERC1155-isApprovedForAll}." + }, + "isWrapped(bytes32)": { + "params": { + "node": "Namehash of the name" + }, + "returns": { + "_0": "Boolean of whether or not the name is wrapped" + } + }, + "isWrapped(bytes32,bytes32)": { + "params": { + "labelhash": "Namehash of the name", + "parentNode": "Namehash of the name" + }, + "returns": { + "_0": "Boolean of whether or not the name is wrapped" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "ownerOf(uint256)": { + "params": { + "id": "Label as a string of the .eth domain to wrap" + }, + "returns": { + "owner": "The owner of the name" + } + }, + "recoverFunds(address,address,uint256)": { + "details": "The contract is Ownable and only the owner can call the recover function.", + "params": { + "_amount": "The amount of tokens to recover.", + "_to": "The address to send the tokens to.", + "_token": "The address of the ERC20 token to recover" + } + }, + "registerAndWrapETH2LD(string,address,uint256,address,uint16)": { + "details": "Registers a new .eth second-level domain and wraps it. Only callable by authorised controllers.", + "params": { + "duration": "The duration, in seconds, to register the name for.", + "label": "The label to register (Eg, 'foo' for 'foo.eth').", + "ownerControlledFuses": "Initial owner-controlled fuses to set", + "resolver": "The resolver address to set on the ENS registry (optional).", + "wrappedOwner": "The owner of the wrapped name." + }, + "returns": { + "registrarExpiry": "The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch." + } + }, + "renew(uint256,uint256)": { + "details": "Only callable by authorised controllers.", + "params": { + "duration": "The number of seconds to renew the name for.", + "tokenId": "The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth')." + }, + "returns": { + "expires": "The expiry date of the name on the .eth registrar, in seconds since the Unix epoch." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)": { + "details": "See {IERC1155-safeBatchTransferFrom}." + }, + "safeTransferFrom(address,address,uint256,uint256,bytes)": { + "details": "See {IERC1155-safeTransferFrom}." + }, + "setApprovalForAll(address,bool)": { + "details": "See {IERC1155-setApprovalForAll}." + }, + "setChildFuses(bytes32,bytes32,uint32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "fuses": "Fuses to burn", + "labelhash": "Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')", + "parentNode": "Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')" + } + }, + "setFuses(bytes32,uint16)": { + "params": { + "node": "Namehash of the name", + "ownerControlledFuses": "Owner-controlled fuses to burn" + }, + "returns": { + "_0": "Old fuses" + } + }, + "setMetadataService(address)": { + "params": { + "_metadataService": "The new metadata service" + } + }, + "setRecord(bytes32,address,address,uint64)": { + "params": { + "node": "Namehash of the name to set a record for", + "owner": "New owner in the registry", + "resolver": "Resolver contract", + "ttl": "Time to live in the registry" + } + }, + "setResolver(bytes32,address)": { + "params": { + "node": "namehash of the name", + "resolver": "the resolver contract" + } + }, + "setSubnodeOwner(bytes32,string,address,uint32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "fuses": "Initial fuses for the wrapped subdomain", + "label": "Label of the subdomain as a string", + "owner": "New owner in the wrapper", + "parentNode": "Parent namehash of the subdomain" + }, + "returns": { + "node": "Namehash of the subdomain" + } + }, + "setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "fuses": "initial fuses for the wrapped subdomain", + "label": "label of the subdomain as a string", + "owner": "new owner in the wrapper", + "parentNode": "parent namehash of the subdomain", + "resolver": "resolver contract in the registry", + "ttl": "ttl in the registry" + }, + "returns": { + "node": "Namehash of the subdomain" + } + }, + "setTTL(bytes32,uint64)": { + "params": { + "node": "Namehash of the name", + "ttl": "TTL in the registry" + } + }, + "setUpgradeContract(address)": { + "details": "The default value of upgradeContract is the 0 address. Use the 0 address at any time to make the contract not upgradable.", + "params": { + "_upgradeAddress": "address of an upgraded contract" + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "unwrap(bytes32,bytes32,address)": { + "details": "Can be called by the owner in the wrapper or an authorised caller in the wrapper", + "params": { + "controller": "Sets the owner in the registry to this address", + "labelhash": "Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')", + "parentNode": "Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')" + } + }, + "unwrapETH2LD(bytes32,address,address)": { + "details": "Can be called by the owner in the wrapper or an authorised caller in the wrapper", + "params": { + "controller": "Sets the owner in the registry to this address", + "labelhash": "Labelhash of the .eth domain", + "registrant": "Sets the owner in the .eth registrar to this address" + } + }, + "upgrade(bytes,bytes)": { + "details": "Can be called by the owner or an authorised caller", + "params": { + "extraData": "Extra data to pass to the upgrade contract", + "name": "The name to upgrade, in DNS format" + } + }, + "uri(uint256)": { + "params": { + "tokenId": "The id of the token" + }, + "returns": { + "_0": "string uri of the metadata service" + } + }, + "wrap(bytes,address,address)": { + "details": "Can be called by the owner in the registry or an authorised caller in the registry", + "params": { + "name": "The name to wrap, in DNS format", + "resolver": "Resolver contract", + "wrappedOwner": "Owner of the name in this contract" + } + }, + "wrapETH2LD(string,address,uint16,address)": { + "details": "Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar", + "params": { + "label": "Label as a string of the .eth domain to wrap", + "ownerControlledFuses": "Initial owner-controlled fuses to set", + "resolver": "Resolver contract address", + "wrappedOwner": "Owner of the name in this contract" + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "allFusesBurned(bytes32,uint32)": { + "notice": "Checks all Fuses in the mask are burned for the node" + }, + "approve(address,uint256)": { + "notice": "Approves an address for a name" + }, + "canExtendSubnames(bytes32,address)": { + "notice": "Checks if owner/operator or approved by owner" + }, + "canModifyName(bytes32,address)": { + "notice": "Checks if owner or operator of the owner" + }, + "extendExpiry(bytes32,bytes32,uint64)": { + "notice": "Extends expiry for a name" + }, + "getApproved(uint256)": { + "notice": "Gets the owner of a name" + }, + "getData(uint256)": { + "notice": "Gets the data for a name" + }, + "isWrapped(bytes32)": { + "notice": "Checks if a name is wrapped" + }, + "isWrapped(bytes32,bytes32)": { + "notice": "Checks if a name is wrapped in a more gas efficient way" + }, + "ownerOf(uint256)": { + "notice": "Gets the owner of a name" + }, + "recoverFunds(address,address,uint256)": { + "notice": "Recover ERC20 tokens sent to the contract by mistake." + }, + "renew(uint256,uint256)": { + "notice": "Renews a .eth second-level domain." + }, + "setChildFuses(bytes32,bytes32,uint32,uint64)": { + "notice": "Sets fuses of a name that you own the parent of" + }, + "setFuses(bytes32,uint16)": { + "notice": "Sets fuses of a name" + }, + "setMetadataService(address)": { + "notice": "Set the metadata service. Only the owner can do this" + }, + "setRecord(bytes32,address,address,uint64)": { + "notice": "Sets records for the name in the ENS Registry" + }, + "setResolver(bytes32,address)": { + "notice": "Sets resolver contract in the registry" + }, + "setSubnodeOwner(bytes32,string,address,uint32,uint64)": { + "notice": "Sets the subdomain owner in the registry and then wraps the subdomain" + }, + "setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)": { + "notice": "Sets the subdomain owner in the registry with records and then wraps the subdomain" + }, + "setTTL(bytes32,uint64)": { + "notice": "Sets TTL in the registry" + }, + "setUpgradeContract(address)": { + "notice": "Set the address of the upgradeContract of the contract. only admin can do this" + }, + "unwrap(bytes32,bytes32,address)": { + "notice": "Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain" + }, + "unwrapETH2LD(bytes32,address,address)": { + "notice": "Unwraps a .eth domain. e.g. vitalik.eth" + }, + "upgrade(bytes,bytes)": { + "notice": "Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain" + }, + "uri(uint256)": { + "notice": "Get the metadata uri" + }, + "wrap(bytes,address,address)": { + "notice": "Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain" + }, + "wrapETH2LD(string,address,uint16,address)": { + "notice": "Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 444, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 20114, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_tokens", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 20120, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_operatorApprovals", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" + }, + { + "astId": 20124, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_tokenApprovals", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_address)" + }, + { + "astId": 20045, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "controllers", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 21586, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "metadataService", + "offset": 0, + "slot": "5", + "type": "t_contract(IMetadataService)21088" + }, + { + "astId": 21590, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "names", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_bytes32,t_bytes_storage)" + }, + { + "astId": 21608, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "upgradeContract", + "offset": 0, + "slot": "7", + "type": "t_contract(INameWrapperUpgrade)21480" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(IMetadataService)21088": { + "encoding": "inplace", + "label": "contract IMetadataService", + "numberOfBytes": "20" + }, + "t_contract(INameWrapperUpgrade)21480": { + "encoding": "inplace", + "label": "contract INameWrapperUpgrade", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_bytes32,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint256,t_address)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/OffchainDNSResolver.json b/solidity/dns-contracts/deployments/sepolia/OffchainDNSResolver.json new file mode 100644 index 0000000..1de1399 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/OffchainDNSResolver.json @@ -0,0 +1,237 @@ +{ + "address": "0x179be112b24ad4cfc392ef8924dfa08c20ad8583", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract DNSSEC", + "name": "_oracle", + "type": "address" + }, + { + "internalType": "string", + "name": "_gatewayURL", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "CouldNotResolve", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidOperation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "string[]", + "name": "urls", + "type": "string[]" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes4", + "name": "callbackFunction", + "type": "bytes4" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "OffchainLookup", + "type": "error" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gatewayURL", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract DNSSEC", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "response", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "resolveCallback", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x4aeea6039460559676db3f8dc61e71b5ab98e4a80c9abeb010dd30ac8a01ff0e", + "receipt": { + "to": null, + "from": "0x4fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8", + "contractAddress": "0x179be112b24ad4cfc392ef8924dfa08c20ad8583", + "transactionIndex": "0x51", + "gasUsed": "0x1c6350", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x77ccc246a90f068119000aabca95c2eea092a39f7d09a85ebe65cc8397b1af6c", + "transactionHash": "0x27a57653992cc2b0f7ad44d05805acd6164b8ab3166f7def4b4c283be89806c5", + "logs": [], + "blockNumber": "0x4c7606", + "cumulativeGasUsed": "0x75cddb", + "status": "0x1" + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0xe62E4b6cE018Ad6e916fcC24545e20a33b9d8653", + "https://dnssec-oracle.ens.domains/" + ], + "numDeployments": 3, + "solcInputHash": "70b6083cd7dd7fa7e3ebaac1755dcba3", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract DNSSEC\",\"name\":\"_oracle\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_gatewayURL\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"CouldNotResolve\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidOperation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"string[]\",\"name\":\"urls\",\"type\":\"string[]\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes4\",\"name\":\"callbackFunction\",\"type\":\"bytes4\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"OffchainLookup\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gatewayURL\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract DNSSEC\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"response\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"resolveCallback\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnsregistrar/OffchainDNSResolver.sol\":\"OffchainDNSResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-2-Clause\\npragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for appending to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n let fpm := add(32, add(ptr, capacity))\\n if lt(fpm, ptr) {\\n revert(0, 0)\\n }\\n mstore(0x40, fpm)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n uint off = buf.buf.length;\\n uint newCapacity = off + len;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(newCapacity, buflen) {\\n mstore(bufptr, newCapacity)\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return append(buf, data, data.length);\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint offPlusOne = off + 1;\\n if (off >= buf.capacity) {\\n resize(buf, offPlusOne * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if gt(offPlusOne, mload(bufptr)) {\\n mstore(bufptr, offPlusOne)\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return append(buf, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return append(buf, data, 32);\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n return buf;\\n }\\n}\\n\",\"keccak256\":\"0xd6dd3b0b327288f8e1b711a609f4040fea602e2ad4bba9febdf2f33b4e56eb0c\",\"license\":\"BSD-2-Clause\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/dnsregistrar/OffchainDNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"../../contracts/resolvers/profiles/IAddrResolver.sol\\\";\\nimport \\\"../../contracts/resolvers/profiles/IExtendedResolver.sol\\\";\\nimport \\\"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"../dnssec-oracle/BytesUtils.sol\\\";\\nimport \\\"../dnssec-oracle/DNSSEC.sol\\\";\\nimport \\\"../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"../registry/ENSRegistry.sol\\\";\\nimport \\\"../utils/HexUtils.sol\\\";\\n\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {LowLevelCallUtils} from \\\"../utils/LowLevelCallUtils.sol\\\";\\n\\nerror InvalidOperation();\\nerror OffchainLookup(\\n address sender,\\n string[] urls,\\n bytes callData,\\n bytes4 callbackFunction,\\n bytes extraData\\n);\\n\\ninterface IDNSGateway {\\n function resolve(\\n bytes memory name,\\n uint16 qtype\\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\\n}\\n\\nuint16 constant CLASS_INET = 1;\\nuint16 constant TYPE_TXT = 16;\\n\\ncontract OffchainDNSResolver is IExtendedResolver, IERC165 {\\n using RRUtils for *;\\n using Address for address;\\n using BytesUtils for bytes;\\n using HexUtils for bytes;\\n\\n ENS public immutable ens;\\n DNSSEC public immutable oracle;\\n string public gatewayURL;\\n\\n error CouldNotResolve(bytes name);\\n\\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\\n ens = _ens;\\n oracle = _oracle;\\n gatewayURL = _gatewayURL;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) external pure override returns (bool) {\\n return interfaceId == type(IExtendedResolver).interfaceId;\\n }\\n\\n function resolve(\\n bytes calldata name,\\n bytes calldata data\\n ) external view returns (bytes memory) {\\n revertWithDefaultOffchainLookup(name, data);\\n }\\n\\n function resolveCallback(\\n bytes calldata response,\\n bytes calldata extraData\\n ) external view returns (bytes memory) {\\n (bytes memory name, bytes memory query, bytes4 selector) = abi.decode(\\n extraData,\\n (bytes, bytes, bytes4)\\n );\\n\\n if (selector != bytes4(0)) {\\n (bytes memory targetData, address targetResolver) = abi.decode(\\n query,\\n (bytes, address)\\n );\\n return\\n callWithOffchainLookupPropagation(\\n targetResolver,\\n name,\\n query,\\n abi.encodeWithSelector(\\n selector,\\n response,\\n abi.encode(targetData, address(this))\\n )\\n );\\n }\\n\\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\\n response,\\n (DNSSEC.RRSetWithSignature[])\\n );\\n\\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\\n for (\\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\\n !iter.done();\\n iter.next()\\n ) {\\n // Ignore records with wrong name, type, or class\\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\\n if (\\n !rrname.equals(name) ||\\n iter.class != CLASS_INET ||\\n iter.dnstype != TYPE_TXT\\n ) {\\n continue;\\n }\\n\\n // Look for a valid ENS-DNS TXT record\\n (address dnsresolver, bytes memory context) = parseRR(\\n iter.data,\\n iter.rdataOffset,\\n iter.nextOffset\\n );\\n\\n // If we found a valid record, try to resolve it\\n if (dnsresolver != address(0)) {\\n if (\\n IERC165(dnsresolver).supportsInterface(\\n IExtendedDNSResolver.resolve.selector\\n )\\n ) {\\n return\\n callWithOffchainLookupPropagation(\\n dnsresolver,\\n name,\\n query,\\n abi.encodeCall(\\n IExtendedDNSResolver.resolve,\\n (name, query, context)\\n )\\n );\\n } else if (\\n IERC165(dnsresolver).supportsInterface(\\n IExtendedResolver.resolve.selector\\n )\\n ) {\\n return\\n callWithOffchainLookupPropagation(\\n dnsresolver,\\n name,\\n query,\\n abi.encodeCall(\\n IExtendedResolver.resolve,\\n (name, query)\\n )\\n );\\n } else {\\n (bool ok, bytes memory ret) = address(dnsresolver)\\n .staticcall(query);\\n if (ok) {\\n return ret;\\n } else {\\n revert CouldNotResolve(name);\\n }\\n }\\n }\\n }\\n\\n // No valid records; revert.\\n revert CouldNotResolve(name);\\n }\\n\\n function parseRR(\\n bytes memory data,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal view returns (address, bytes memory) {\\n bytes memory txt = readTXT(data, idx, lastIdx);\\n\\n // Must start with the magic word\\n if (txt.length < 5 || !txt.equals(0, \\\"ENS1 \\\", 0, 5)) {\\n return (address(0), \\\"\\\");\\n }\\n\\n // Parse the name or address\\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \\\" \\\");\\n if (lastTxtIdx > txt.length) {\\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\\n return (dnsResolver, \\\"\\\");\\n } else {\\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\\n return (\\n dnsResolver,\\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\\n );\\n }\\n }\\n\\n function readTXT(\\n bytes memory data,\\n uint256 startIdx,\\n uint256 lastIdx\\n ) internal pure returns (bytes memory) {\\n // TODO: Concatenate multiple text fields\\n uint256 fieldLength = data.readUint8(startIdx);\\n assert(startIdx + fieldLength < lastIdx);\\n return data.substring(startIdx + 1, fieldLength);\\n }\\n\\n function parseAndResolve(\\n bytes memory nameOrAddress,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal view returns (address) {\\n if (nameOrAddress[idx] == \\\"0\\\" && nameOrAddress[idx + 1] == \\\"x\\\") {\\n (address ret, bool valid) = nameOrAddress.hexToAddress(\\n idx + 2,\\n lastIdx\\n );\\n if (valid) {\\n return ret;\\n }\\n }\\n return resolveName(nameOrAddress, idx, lastIdx);\\n }\\n\\n function resolveName(\\n bytes memory name,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal view returns (address) {\\n bytes32 node = textNamehash(name, idx, lastIdx);\\n address resolver = ens.resolver(node);\\n if (resolver == address(0)) {\\n return address(0);\\n }\\n return IAddrResolver(resolver).addr(node);\\n }\\n\\n /**\\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\\n * @param name Name to hash\\n * @param idx Index to start at\\n * @param lastIdx Index to end at\\n */\\n function textNamehash(\\n bytes memory name,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal view returns (bytes32) {\\n uint256 separator = name.find(idx, name.length - idx, bytes1(\\\".\\\"));\\n bytes32 parentNode = bytes32(0);\\n if (separator < lastIdx) {\\n parentNode = textNamehash(name, separator + 1, lastIdx);\\n } else {\\n separator = lastIdx;\\n }\\n return\\n keccak256(\\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\\n );\\n }\\n\\n function callWithOffchainLookupPropagation(\\n address target,\\n bytes memory name,\\n bytes memory innerdata,\\n bytes memory data\\n ) internal view returns (bytes memory) {\\n if (!target.isContract()) {\\n revertWithDefaultOffchainLookup(name, innerdata);\\n }\\n\\n bool result = LowLevelCallUtils.functionStaticCall(\\n address(target),\\n data\\n );\\n uint256 size = LowLevelCallUtils.returnDataSize();\\n if (result) {\\n bytes memory returnData = LowLevelCallUtils.readReturnData(0, size);\\n return abi.decode(returnData, (bytes));\\n }\\n // Failure\\n if (size >= 4) {\\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\\n if (bytes4(errorId) == OffchainLookup.selector) {\\n // Offchain lookup. Decode the revert message and create our own that nests it.\\n bytes memory revertData = LowLevelCallUtils.readReturnData(\\n 4,\\n size - 4\\n );\\n handleOffchainLookupError(revertData, target, name);\\n }\\n }\\n LowLevelCallUtils.propagateRevert();\\n }\\n\\n function revertWithDefaultOffchainLookup(\\n bytes memory name,\\n bytes memory data\\n ) internal view {\\n string[] memory urls = new string[](1);\\n urls[0] = gatewayURL;\\n\\n revert OffchainLookup(\\n address(this),\\n urls,\\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\\n OffchainDNSResolver.resolveCallback.selector,\\n abi.encode(name, data, bytes4(0))\\n );\\n }\\n\\n function handleOffchainLookupError(\\n bytes memory returnData,\\n address target,\\n bytes memory name\\n ) internal view {\\n (\\n address sender,\\n string[] memory urls,\\n bytes memory callData,\\n bytes4 innerCallbackFunction,\\n bytes memory extraData\\n ) = abi.decode(returnData, (address, string[], bytes, bytes4, bytes));\\n\\n if (sender != target) {\\n revert InvalidOperation();\\n }\\n\\n revert OffchainLookup(\\n address(this),\\n urls,\\n callData,\\n OffchainDNSResolver.resolveCallback.selector,\\n abi.encode(name, extraData, innerCallbackFunction)\\n );\\n }\\n}\\n\",\"keccak256\":\"0xdd7f8c44e6e73d5c90a942e8059296c5781cd4e2257623aa1eeb5fd3e60aec85\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/DNSSEC.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nabstract contract DNSSEC {\\n bytes public anchors;\\n\\n struct RRSetWithSignature {\\n bytes rrset;\\n bytes sig;\\n }\\n\\n event AlgorithmUpdated(uint8 id, address addr);\\n event DigestUpdated(uint8 id, address addr);\\n\\n function verifyRRSet(\\n RRSetWithSignature[] memory input\\n ) external view virtual returns (bytes memory rrs, uint32 inception);\\n\\n function verifyRRSet(\\n RRSetWithSignature[] memory input,\\n uint256 now\\n ) public view virtual returns (bytes memory rrs, uint32 inception);\\n}\\n\",\"keccak256\":\"0xee6a236a59e5db8418c98ee4640a91987d26533c02d305cc6c7a37a3ac4ee907\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n */\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint256 labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes memory ret) {\\n uint256 len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint256 labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint256 constant RRSIG_TYPE = 0;\\n uint256 constant RRSIG_ALGORITHM = 2;\\n uint256 constant RRSIG_LABELS = 3;\\n uint256 constant RRSIG_TTL = 4;\\n uint256 constant RRSIG_EXPIRATION = 8;\\n uint256 constant RRSIG_INCEPTION = 12;\\n uint256 constant RRSIG_KEY_TAG = 16;\\n uint256 constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(\\n bytes memory data\\n ) internal pure returns (SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(\\n RRSIG_SIGNER_NAME + self.signerName.length,\\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\\n );\\n }\\n\\n function rrs(\\n SignedSet memory rrset\\n ) internal pure returns (RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint256 offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint256 rdataOffset;\\n uint256 nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns (bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint256 rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.offset,\\n nameLength(iter.data, iter.offset)\\n );\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(\\n RRIterator memory iter\\n ) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.rdataOffset,\\n iter.nextOffset - iter.rdataOffset\\n );\\n }\\n\\n uint256 constant DNSKEY_FLAGS = 0;\\n uint256 constant DNSKEY_PROTOCOL = 2;\\n uint256 constant DNSKEY_ALGORITHM = 3;\\n uint256 constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(\\n offset + DNSKEY_PUBKEY,\\n length - DNSKEY_PUBKEY\\n );\\n }\\n\\n uint256 constant DS_KEY_TAG = 0;\\n uint256 constant DS_ALGORITHM = 2;\\n uint256 constant DS_DIGEST_TYPE = 3;\\n uint256 constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n function isSubdomainOf(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n uint256 off = 0;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n while (counts > othercounts) {\\n off = progress(self, off);\\n counts--;\\n }\\n\\n return self.equals(off, other, 0);\\n }\\n\\n function compareNames(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint256 off;\\n uint256 otheroff;\\n uint256 prevoff;\\n uint256 otherprevoff;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if (otheroff == 0) {\\n return 1;\\n }\\n\\n return\\n self.compare(\\n prevoff + 1,\\n self.readUint8(prevoff),\\n other,\\n otherprevoff + 1,\\n other.readUint8(otherprevoff)\\n );\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(\\n uint32 i1,\\n uint32 i2\\n ) internal pure returns (bool) {\\n unchecked {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n }\\n\\n function progress(\\n bytes memory body,\\n uint256 off\\n ) internal pure returns (uint256) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint256 ac1;\\n uint256 ac2;\\n for (uint256 i = 0; i < data.length + 31; i += 32) {\\n uint256 word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if (i + 32 > data.length) {\\n uint256 unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 +=\\n (word &\\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\\n 8;\\n ac2 += (word &\\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 =\\n (ac1 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac1 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac2 =\\n (ac2 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac2 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 =\\n (ac1 &\\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\\n 32);\\n ac1 =\\n (ac1 &\\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\\n 64);\\n ac1 =\\n (ac1 &\\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\\n (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4dd68a6efd7c38f6b0e95ca0c056ecb74f88583da650b1a8639e6e78be36fede\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/registry/ENSRegistry.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"./ENS.sol\\\";\\n\\n/**\\n * The ENS registry contract.\\n */\\ncontract ENSRegistry is ENS {\\n struct Record {\\n address owner;\\n address resolver;\\n uint64 ttl;\\n }\\n\\n mapping(bytes32 => Record) records;\\n mapping(address => mapping(address => bool)) operators;\\n\\n // Permits modifications only by the owner of the specified node.\\n modifier authorised(bytes32 node) {\\n address owner = records[node].owner;\\n require(owner == msg.sender || operators[owner][msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Constructs a new ENS registry.\\n */\\n constructor() public {\\n records[0x0].owner = msg.sender;\\n }\\n\\n /**\\n * @dev Sets the record for a node.\\n * @param node The node to update.\\n * @param owner The address of the new owner.\\n * @param resolver The address of the resolver.\\n * @param ttl The TTL in seconds.\\n */\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external virtual override {\\n setOwner(node, owner);\\n _setResolverAndTTL(node, resolver, ttl);\\n }\\n\\n /**\\n * @dev Sets the record for a subnode.\\n * @param node The parent node.\\n * @param label The hash of the label specifying the subnode.\\n * @param owner The address of the new owner.\\n * @param resolver The address of the resolver.\\n * @param ttl The TTL in seconds.\\n */\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external virtual override {\\n bytes32 subnode = setSubnodeOwner(node, label, owner);\\n _setResolverAndTTL(subnode, resolver, ttl);\\n }\\n\\n /**\\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\\n * @param node The node to transfer ownership of.\\n * @param owner The address of the new owner.\\n */\\n function setOwner(\\n bytes32 node,\\n address owner\\n ) public virtual override authorised(node) {\\n _setOwner(node, owner);\\n emit Transfer(node, owner);\\n }\\n\\n /**\\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\\n * @param node The parent node.\\n * @param label The hash of the label specifying the subnode.\\n * @param owner The address of the new owner.\\n */\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) public virtual override authorised(node) returns (bytes32) {\\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\\n _setOwner(subnode, owner);\\n emit NewOwner(node, label, owner);\\n return subnode;\\n }\\n\\n /**\\n * @dev Sets the resolver address for the specified node.\\n * @param node The node to update.\\n * @param resolver The address of the resolver.\\n */\\n function setResolver(\\n bytes32 node,\\n address resolver\\n ) public virtual override authorised(node) {\\n emit NewResolver(node, resolver);\\n records[node].resolver = resolver;\\n }\\n\\n /**\\n * @dev Sets the TTL for the specified node.\\n * @param node The node to update.\\n * @param ttl The TTL in seconds.\\n */\\n function setTTL(\\n bytes32 node,\\n uint64 ttl\\n ) public virtual override authorised(node) {\\n emit NewTTL(node, ttl);\\n records[node].ttl = ttl;\\n }\\n\\n /**\\n * @dev Enable or disable approval for a third party (\\\"operator\\\") to manage\\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\\n * @param operator Address to add to the set of authorized operators.\\n * @param approved True if the operator is approved, false to revoke approval.\\n */\\n function setApprovalForAll(\\n address operator,\\n bool approved\\n ) external virtual override {\\n operators[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev Returns the address that owns the specified node.\\n * @param node The specified node.\\n * @return address of the owner.\\n */\\n function owner(\\n bytes32 node\\n ) public view virtual override returns (address) {\\n address addr = records[node].owner;\\n if (addr == address(this)) {\\n return address(0x0);\\n }\\n\\n return addr;\\n }\\n\\n /**\\n * @dev Returns the address of the resolver for the specified node.\\n * @param node The specified node.\\n * @return address of the resolver.\\n */\\n function resolver(\\n bytes32 node\\n ) public view virtual override returns (address) {\\n return records[node].resolver;\\n }\\n\\n /**\\n * @dev Returns the TTL of a node, and any records associated with it.\\n * @param node The specified node.\\n * @return ttl of the node.\\n */\\n function ttl(bytes32 node) public view virtual override returns (uint64) {\\n return records[node].ttl;\\n }\\n\\n /**\\n * @dev Returns whether a record has been imported to the registry.\\n * @param node The specified node.\\n * @return Bool if record exists\\n */\\n function recordExists(\\n bytes32 node\\n ) public view virtual override returns (bool) {\\n return records[node].owner != address(0x0);\\n }\\n\\n /**\\n * @dev Query if an address is an authorized operator for another address.\\n * @param owner The address that owns the records.\\n * @param operator The address that acts on behalf of the owner.\\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\\n */\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view virtual override returns (bool) {\\n return operators[owner][operator];\\n }\\n\\n function _setOwner(bytes32 node, address owner) internal virtual {\\n records[node].owner = owner;\\n }\\n\\n function _setResolverAndTTL(\\n bytes32 node,\\n address resolver,\\n uint64 ttl\\n ) internal {\\n if (resolver != records[node].resolver) {\\n records[node].resolver = resolver;\\n emit NewResolver(node, resolver);\\n }\\n\\n if (ttl != records[node].ttl) {\\n records[node].ttl = ttl;\\n emit NewTTL(node, ttl);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa7a7a64fb980e521c991415e416fd4106a42f892479805e1daa51ecb0e2e5198\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedDNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedDNSResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data,\\n bytes memory context\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x541f8799c34ff9e7035d09f06ae0f0f8a16b6065e9b60a15670b957321630f72\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"contracts/utils/HexUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary HexUtils {\\n /**\\n * @dev Attempts to parse bytes32 from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexStringToBytes32(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (bytes32 r, bool valid) {\\n uint256 hexLength = lastIdx - idx;\\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\\n revert(\\\"Invalid string length\\\");\\n }\\n valid = true;\\n assembly {\\n // check that the index to read to is not past the end of the string\\n if gt(lastIdx, mload(str)) {\\n revert(0, 0)\\n }\\n\\n function getHex(c) -> ascii {\\n // chars 48-57: 0-9\\n if and(gt(c, 47), lt(c, 58)) {\\n ascii := sub(c, 48)\\n leave\\n }\\n // chars 65-70: A-F\\n if and(gt(c, 64), lt(c, 71)) {\\n ascii := add(sub(c, 65), 10)\\n leave\\n }\\n // chars 97-102: a-f\\n if and(gt(c, 96), lt(c, 103)) {\\n ascii := add(sub(c, 97), 10)\\n leave\\n }\\n // invalid char\\n ascii := 0xff\\n }\\n\\n let ptr := add(str, 32)\\n for {\\n let i := idx\\n } lt(i, lastIdx) {\\n i := add(i, 2)\\n } {\\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\\n // if either byte is invalid, set invalid and break loop\\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\\n valid := false\\n break\\n }\\n let combined := or(shl(4, byte1), byte2)\\n r := or(shl(8, r), combined)\\n }\\n }\\n }\\n\\n /**\\n * @dev Attempts to parse an address from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexToAddress(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (address, bool) {\\n if (lastIdx - idx < 40) return (address(0x0), false);\\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\\n return (address(uint160(uint256(r))), valid);\\n }\\n}\\n\",\"keccak256\":\"0x4a8a9c72d6f3effb80b310faa6dc273e7adbc3b949df9c7a42e290e5b13519f3\",\"license\":\"MIT\"},\"contracts/utils/LowLevelCallUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.13;\\n\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nlibrary LowLevelCallUtils {\\n using Address for address;\\n\\n /**\\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\\n * `returnDataSize` and `readReturnData`.\\n * @param target The address to staticcall.\\n * @param data The data to pass to the call.\\n * @return success True if the call succeeded, or false if it reverts.\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data\\n ) internal view returns (bool success) {\\n require(\\n target.isContract(),\\n \\\"LowLevelCallUtils: static call to non-contract\\\"\\n );\\n assembly {\\n success := staticcall(\\n gas(),\\n target,\\n add(data, 32),\\n mload(data),\\n 0,\\n 0\\n )\\n }\\n }\\n\\n /**\\n * @dev Returns the size of the return data of the most recent external call.\\n */\\n function returnDataSize() internal pure returns (uint256 len) {\\n assembly {\\n len := returndatasize()\\n }\\n }\\n\\n /**\\n * @dev Reads return data from the most recent external call.\\n * @param offset Offset into the return data.\\n * @param length Number of bytes to return.\\n */\\n function readReturnData(\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (bytes memory data) {\\n data = new bytes(length);\\n assembly {\\n returndatacopy(add(data, 32), offset, length)\\n }\\n }\\n\\n /**\\n * @dev Reverts with the return data from the most recent external call.\\n */\\n function propagateRevert() internal pure {\\n assembly {\\n returndatacopy(0, 0, returndatasize())\\n revert(0, returndatasize())\\n }\\n }\\n}\\n\",\"keccak256\":\"0x20d3d0d14fab6fc079f90d630a51bb8e274431ca929591ec8d62383ce946cb3a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c06040523480156200001157600080fd5b50604051620022743803806200227483398101604081905262000034916200008e565b6001600160a01b03808416608052821660a05260006200005582826200021d565b50505050620002e9565b6001600160a01b03811681146200007557600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215620000a457600080fd5b8351620000b1816200005f565b80935050602080850151620000c6816200005f565b60408601519093506001600160401b0380821115620000e457600080fd5b818701915087601f830112620000f957600080fd5b8151818111156200010e576200010e62000078565b604051601f8201601f19908116603f0116810190838211818310171562000139576200013962000078565b816040528281528a868487010111156200015257600080fd5b600093505b8284101562000176578484018601518185018701529285019262000157565b60008684830101528096505050505050509250925092565b600181811c90821680620001a357607f821691505b602082108103620001c457634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200021857600081815260208120601f850160051c81016020861015620001f35750805b601f850160051c820191505b818110156200021457828155600101620001ff565b5050505b505050565b81516001600160401b0381111562000239576200023962000078565b62000251816200024a84546200018e565b84620001ca565b602080601f831160018114620002895760008415620002705750858301515b600019600386901b1c1916600185901b17855562000214565b600085815260208120601f198616915b82811015620002ba5788860151825594840194600190910190840162000299565b5085821015620002d95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a051611f586200031c60003960008181610109015261033201526000818160b501526111d50152611f586000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c80637dc0d1d0116100505780637dc0d1d0146101045780639061b9231461012b578063b4a858011461013e57600080fd5b806301ffc9a7146100775780633f15457f146100b057806352539968146100ef575b600080fd5b61009b610085366004611507565b6001600160e01b031916639061b92360e01b1490565b60405190151581526020015b60405180910390f35b6100d77f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a7565b6100f7610151565b6040516100a79190611574565b6100d77f000000000000000000000000000000000000000000000000000000000000000081565b6100f76101393660046115d0565b6101df565b6100f761014c3660046115d0565b61025c565b6000805461015e9061163c565b80601f016020809104026020016040519081016040528092919081815260200182805461018a9061163c565b80156101d75780601f106101ac576101008083540402835291602001916101d7565b820191906000526020600020905b8154815290600101906020018083116101ba57829003601f168201915b505050505081565b606061025485858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f890181900481028201810190925287815292508791508690819084018382808284376000920191909152506106b792505050565b949350505050565b60606000808061026e85870187611764565b919450925090506001600160e01b031981161561031e576000808380602001905181019061029c9190611841565b91509150610312818686868e8e88306040516020016102bc929190611893565b60408051601f19818403018152908290526102db9392916024016118be565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610848565b95505050505050610254565b600061032c888a018a611920565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bdf95fef836040518263ffffffff1660e01b815260040161037c9190611a2c565b600060405180830381865afa158015610399573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103c19190810190611ab1565b50905060006103d08282610916565b90505b8051516020820151101561069b5760006103f58260000151836020015161097d565b90506104018188610998565b15806104165750606082015161ffff16600114155b8061042a5750604082015161ffff16601014155b15610435575061068d565b60008061044f84600001518560a001518660c001516109bd565b90925090506001600160a01b03821615610689576040516301ffc9a760e01b815263477cc53f60e11b60048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa1580156104ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d29190611b01565b1561053157610521828a8a8c8c866040516024016104f293929190611b23565b60408051601f198184030181529190526020810180516001600160e01b031663477cc53f60e11b179052610848565b9950505050505050505050610254565b6040516301ffc9a760e01b8152639061b92360e01b60048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa15801561057c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a09190611b01565b156105ed57610521828a8a8c8c6040516024016105be929190611b5c565b60408051601f198184030181529190526020810180516001600160e01b0316639061b92360e01b179052610848565b600080836001600160a01b03168a6040516106089190611b81565b600060405180830381855afa9150503d8060008114610643576040519150601f19603f3d011682016040523d82523d6000602084013e610648565b606091505b50915091508115610665579a506102549950505050505050505050565b8a6040516314d3b60360e11b81526004016106809190611574565b60405180910390fd5b5050505b61069681610b05565b6103d3565b50846040516314d3b60360e11b81526004016106809190611574565b604080516001808252818301909252600091816020015b60608152602001906001900390816106ce579050509050600080546106f29061163c565b80601f016020809104026020016040519081016040528092919081815260200182805461071e9061163c565b801561076b5780601f106107405761010080835404028352916020019161076b565b820191906000526020600020905b81548152906001019060200180831161074e57829003601f168201915b50505050508160008151811061078357610783611b9d565b602002602001018190525030818460106040516024016107a4929190611bb3565b60408051601f19818403018152918152602080830180516001600160e01b03167f31b137b90000000000000000000000000000000000000000000000000000000017905290517fb4a85801000000000000000000000000000000000000000000000000000000009161081d918991899160009101611bd9565b60408051601f1981840301815290829052630556f18360e41b82526106809594939291600401611c19565b60606001600160a01b0385163b6108635761086384846106b7565b600061086f8684610bed565b90503d81156108a5576000610885600083610c7f565b90508080602001905181019061089b9190611cc5565b9350505050610254565b600481106109045760006108bb60006004610c7f565b9050630556f18360e41b6108ce82611cfa565b6001600160e01b031916036109025760006108f360046108ee8186611d48565b610c7f565b9050610900818a8a610cd4565b505b505b61090c610d65565b5050949350505050565b6109646040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261097781610b05565b92915050565b6060600061098b8484610d6f565b9050610254848483610dc9565b6000815183511480156109b657506109b68360008460008751610e4b565b9392505050565b6000606060006109ce868686610e6e565b9050600581511080610a2357506040805180820190915260058082527f454e5331200000000000000000000000000000000000000000000000000000006020830152610a21918391600091908290610e4b565b155b15610a41575050604080516020810190915260008082529150610afd565b6000610a7e6005808451610a559190611d48565b8491907f2000000000000000000000000000000000000000000000000000000000000000610eb8565b90508151811115610ab5576000610a988360058551610f54565b6040805160208101909152600081529095509350610afd92505050565b6000610ac383600584610f54565b905080610af5610ad4846001611d5b565b6001858751610ae39190611d48565b610aed9190611d48565b869190610dc9565b945094505050505b935093915050565b60c08101516020820181905281515111610b1c5750565b6000610b3082600001518360200151610d6f565b8260200151610b3f9190611d5b565b8251909150610b4e908261105e565b61ffff166040830152610b62600282611d5b565b8251909150610b71908261105e565b61ffff166060830152610b85600282611d5b565b8251909150610b949082611086565b63ffffffff166080830152610baa600482611d5b565b8251909150600090610bbc908361105e565b61ffff169050610bcd600283611d5b565b60a084018190529150610be08183611d5b565b60c0909301929092525050565b60006001600160a01b0383163b610c6c5760405162461bcd60e51b815260206004820152602e60248201527f4c6f774c6576656c43616c6c5574696c733a207374617469632063616c6c207460448201527f6f206e6f6e2d636f6e74726163740000000000000000000000000000000000006064820152608401610680565b600080835160208501865afa9392505050565b60608167ffffffffffffffff811115610c9a57610c9a611676565b6040519080825280601f01601f191660200182016040528015610cc4576020820181803683370190505b5090508183602083013e92915050565b600080600080600087806020019051810190610cf09190611d7e565b94509450945094509450866001600160a01b0316856001600160a01b031614610d45576040517f398d4d3200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b30848463b4a8580160e01b89858760405160200161081d93929190611bd9565b3d6000803e3d6000fd5b6000815b83518110610d8357610d83611eb4565b6000610d8f85836110b0565b60ff169050610d9f816001611d5b565b610da99083611d5b565b915080600003610db95750610dbf565b50610d73565b6102548382611d48565b8251606090610dd88385611d5b565b1115610de357600080fd5b60008267ffffffffffffffff811115610dfe57610dfe611676565b6040519080825280601f01601f191660200182016040528015610e28576020820181803683370190505b50905060208082019086860101610e408282876110d4565b509095945050505050565b6000610e5884848461112a565b610e6387878561112a565b149695505050505050565b60606000610e7c85856110b0565b60ff16905082610e8c8286611d5b565b10610e9957610e99611eb4565b610eaf610ea7856001611d5b565b869083610dc9565b95945050505050565b6000835b610ec68486611d5b565b811015610f4757827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916868281518110610f0257610f02611b9d565b01602001517fff000000000000000000000000000000000000000000000000000000000000001603610f35579050610254565b80610f3f81611eca565b915050610ebc565b5060001995945050505050565b6000838381518110610f6857610f68611b9d565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f3000000000000000000000000000000000000000000000000000000000000000148015611020575083610fc5846001611d5b565b81518110610fd557610fd5611b9d565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f7800000000000000000000000000000000000000000000000000000000000000145b156110535760008061103e611036866002611d5b565b87908661114e565b915091508015611050575090506109b6565b50505b61025484848461118a565b815160009061106e836002611d5b565b111561107957600080fd5b50016002015161ffff1690565b8151600090611096836004611d5b565b11156110a157600080fd5b50016004015163ffffffff1690565b60008282815181106110c4576110c4611b9d565b016020015160f81c905092915050565b6020811061110c57815183526110eb602084611d5b565b92506110f8602083611d5b565b9150611105602082611d48565b90506110d4565b905182516020929092036101000a6000190180199091169116179052565b82516000906111398385611d5b565b111561114457600080fd5b5091016020012090565b600080602861115d8585611d48565b101561116e57506000905080610afd565b60008061117c8787876112e7565b909890975095505050505050565b60008061119885858561143b565b6040517f0178b8bf000000000000000000000000000000000000000000000000000000008152600481018290529091506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630178b8bf90602401602060405180830381865afa15801561121c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112409190611ee3565b90506001600160a01b03811661125b576000925050506109b6565b6040517f3b3b57de000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b03821690633b3b57de90602401602060405180830381865afa1580156112b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112dd9190611ee3565b9695505050505050565b600080806112f58585611d48565b905080604014158015611309575080602814155b8061131e575061131a600282611f00565b6001145b1561136b5760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610680565b60019150855184111561137d57600080fd5b6113ce565b6000603a8210602f8311161561139a5750602f190190565b604782106040831116156113b057506036190190565b606782106060831116156113c657506056190190565b5060ff919050565b60208601855b85811015611430576113eb8183015160001a611382565b6113fd6001830184015160001a611382565b60ff811460ff8314171561141657600095505050611430565b60049190911b1760089590951b94909417936002016113d4565b505050935093915050565b6000806114788485875161144f9190611d48565b8791907f2e00000000000000000000000000000000000000000000000000000000000000610eb8565b90506000838210156114a05761149986611493846001611d5b565b8661143b565b90506114a4565b8391505b806114bb866114b38186611d48565b89919061112a565b60408051602081019390935282015260600160405160208183030381529060405280519060200120925050509392505050565b6001600160e01b03198116811461150457600080fd5b50565b60006020828403121561151957600080fd5b81356109b6816114ee565b60005b8381101561153f578181015183820152602001611527565b50506000910152565b60008151808452611560816020860160208601611524565b601f01601f19169290920160200192915050565b6020815260006109b66020830184611548565b60008083601f84011261159957600080fd5b50813567ffffffffffffffff8111156115b157600080fd5b6020830191508360208285010111156115c957600080fd5b9250929050565b600080600080604085870312156115e657600080fd5b843567ffffffffffffffff808211156115fe57600080fd5b61160a88838901611587565b9096509450602087013591508082111561162357600080fd5b5061163087828801611587565b95989497509550505050565b600181811c9082168061165057607f821691505b60208210810361167057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156116af576116af611676565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156116de576116de611676565b604052919050565b600067ffffffffffffffff82111561170057611700611676565b50601f01601f191660200190565b600082601f83011261171f57600080fd5b813561173261172d826116e6565b6116b5565b81815284602083860101111561174757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561177957600080fd5b833567ffffffffffffffff8082111561179157600080fd5b61179d8783880161170e565b945060208601359150808211156117b357600080fd5b506117c08682870161170e565b92505060408401356117d1816114ee565b809150509250925092565b60006117ea61172d846116e6565b90508281528383830111156117fe57600080fd5b6109b6836020830184611524565b600082601f83011261181d57600080fd5b6109b6838351602085016117dc565b6001600160a01b038116811461150457600080fd5b6000806040838503121561185457600080fd5b825167ffffffffffffffff81111561186b57600080fd5b6118778582860161180c565b92505060208301516118888161182c565b809150509250929050565b6040815260006118a66040830185611548565b90506001600160a01b03831660208301529392505050565b60408152826040820152828460608301376000606084830101526000601f19601f850116820160608382030160208401526112dd6060820185611548565b600067ffffffffffffffff82111561191657611916611676565b5060051b60200190565b6000602080838503121561193357600080fd5b823567ffffffffffffffff8082111561194b57600080fd5b818501915085601f83011261195f57600080fd5b813561196d61172d826118fc565b81815260059190911b8301840190848101908883111561198c57600080fd5b8585015b83811015611a1f578035858111156119a85760008081fd5b86016040818c03601f19018113156119c05760008081fd5b6119c861168c565b89830135888111156119da5760008081fd5b6119e88e8c8387010161170e565b8252509082013590878211156119fe5760008081fd5b611a0c8d8b8486010161170e565b818b015285525050918601918601611990565b5098975050505050505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015611aa357888303603f1901855281518051878552611a7788860182611548565b91890151858303868b0152919050611a8f8183611548565b968901969450505090860190600101611a53565b509098975050505050505050565b60008060408385031215611ac457600080fd5b825167ffffffffffffffff811115611adb57600080fd5b611ae78582860161180c565b925050602083015163ffffffff8116811461188857600080fd5b600060208284031215611b1357600080fd5b815180151581146109b657600080fd5b606081526000611b366060830186611548565b8281036020840152611b488186611548565b905082810360408401526112dd8185611548565b604081526000611b6f6040830185611548565b8281036020840152610eaf8185611548565b60008251611b93818460208701611524565b9190910192915050565b634e487b7160e01b600052603260045260246000fd5b604081526000611bc66040830185611548565b905061ffff831660208301529392505050565b606081526000611bec6060830186611548565b8281036020840152611bfe8186611548565b9150506001600160e01b031983166040830152949350505050565b600060a082016001600160a01b0388168352602060a08185015281885180845260c08601915060c08160051b8701019350828a0160005b82811015611c7e5760bf19888703018452611c6c868351611548565b95509284019290840190600101611c50565b50505050508281036040840152611c958187611548565b6001600160e01b03198616606085015290508281036080840152611cb98185611548565b98975050505050505050565b600060208284031215611cd757600080fd5b815167ffffffffffffffff811115611cee57600080fd5b6102548482850161180c565b6000815160208301516001600160e01b031980821693506004831015611d2a5780818460040360031b1b83161693505b505050919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561097757610977611d32565b8082018082111561097757610977611d32565b8051611d79816114ee565b919050565b600080600080600060a08688031215611d9657600080fd5b8551611da18161182c565b8095505060208087015167ffffffffffffffff80821115611dc157600080fd5b818901915089601f830112611dd557600080fd5b8151611de361172d826118fc565b81815260059190911b8301840190848101908c831115611e0257600080fd5b8585015b83811015611e4f57805185811115611e1e5760008081fd5b8601603f81018f13611e305760008081fd5b611e418f89830151604084016117dc565b845250918601918601611e06565b5060408c01519099509450505080831115611e6957600080fd5b611e758a848b0161180c565b9550611e8360608a01611d6e565b94506080890151925080831115611e9957600080fd5b5050611ea78882890161180c565b9150509295509295909350565b634e487b7160e01b600052600160045260246000fd5b600060018201611edc57611edc611d32565b5060010190565b600060208284031215611ef557600080fd5b81516109b68161182c565b600082611f1d57634e487b7160e01b600052601260045260246000fd5b50069056fea2646970667358221220b936cbd1a155e7bc5dec1045b9de33f1540fc221b15ffde3b586c5a2aeb57d0464736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100725760003560e01c80637dc0d1d0116100505780637dc0d1d0146101045780639061b9231461012b578063b4a858011461013e57600080fd5b806301ffc9a7146100775780633f15457f146100b057806352539968146100ef575b600080fd5b61009b610085366004611507565b6001600160e01b031916639061b92360e01b1490565b60405190151581526020015b60405180910390f35b6100d77f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a7565b6100f7610151565b6040516100a79190611574565b6100d77f000000000000000000000000000000000000000000000000000000000000000081565b6100f76101393660046115d0565b6101df565b6100f761014c3660046115d0565b61025c565b6000805461015e9061163c565b80601f016020809104026020016040519081016040528092919081815260200182805461018a9061163c565b80156101d75780601f106101ac576101008083540402835291602001916101d7565b820191906000526020600020905b8154815290600101906020018083116101ba57829003601f168201915b505050505081565b606061025485858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f890181900481028201810190925287815292508791508690819084018382808284376000920191909152506106b792505050565b949350505050565b60606000808061026e85870187611764565b919450925090506001600160e01b031981161561031e576000808380602001905181019061029c9190611841565b91509150610312818686868e8e88306040516020016102bc929190611893565b60408051601f19818403018152908290526102db9392916024016118be565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610848565b95505050505050610254565b600061032c888a018a611920565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bdf95fef836040518263ffffffff1660e01b815260040161037c9190611a2c565b600060405180830381865afa158015610399573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103c19190810190611ab1565b50905060006103d08282610916565b90505b8051516020820151101561069b5760006103f58260000151836020015161097d565b90506104018188610998565b15806104165750606082015161ffff16600114155b8061042a5750604082015161ffff16601014155b15610435575061068d565b60008061044f84600001518560a001518660c001516109bd565b90925090506001600160a01b03821615610689576040516301ffc9a760e01b815263477cc53f60e11b60048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa1580156104ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d29190611b01565b1561053157610521828a8a8c8c866040516024016104f293929190611b23565b60408051601f198184030181529190526020810180516001600160e01b031663477cc53f60e11b179052610848565b9950505050505050505050610254565b6040516301ffc9a760e01b8152639061b92360e01b60048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa15801561057c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a09190611b01565b156105ed57610521828a8a8c8c6040516024016105be929190611b5c565b60408051601f198184030181529190526020810180516001600160e01b0316639061b92360e01b179052610848565b600080836001600160a01b03168a6040516106089190611b81565b600060405180830381855afa9150503d8060008114610643576040519150601f19603f3d011682016040523d82523d6000602084013e610648565b606091505b50915091508115610665579a506102549950505050505050505050565b8a6040516314d3b60360e11b81526004016106809190611574565b60405180910390fd5b5050505b61069681610b05565b6103d3565b50846040516314d3b60360e11b81526004016106809190611574565b604080516001808252818301909252600091816020015b60608152602001906001900390816106ce579050509050600080546106f29061163c565b80601f016020809104026020016040519081016040528092919081815260200182805461071e9061163c565b801561076b5780601f106107405761010080835404028352916020019161076b565b820191906000526020600020905b81548152906001019060200180831161074e57829003601f168201915b50505050508160008151811061078357610783611b9d565b602002602001018190525030818460106040516024016107a4929190611bb3565b60408051601f19818403018152918152602080830180516001600160e01b03167f31b137b90000000000000000000000000000000000000000000000000000000017905290517fb4a85801000000000000000000000000000000000000000000000000000000009161081d918991899160009101611bd9565b60408051601f1981840301815290829052630556f18360e41b82526106809594939291600401611c19565b60606001600160a01b0385163b6108635761086384846106b7565b600061086f8684610bed565b90503d81156108a5576000610885600083610c7f565b90508080602001905181019061089b9190611cc5565b9350505050610254565b600481106109045760006108bb60006004610c7f565b9050630556f18360e41b6108ce82611cfa565b6001600160e01b031916036109025760006108f360046108ee8186611d48565b610c7f565b9050610900818a8a610cd4565b505b505b61090c610d65565b5050949350505050565b6109646040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261097781610b05565b92915050565b6060600061098b8484610d6f565b9050610254848483610dc9565b6000815183511480156109b657506109b68360008460008751610e4b565b9392505050565b6000606060006109ce868686610e6e565b9050600581511080610a2357506040805180820190915260058082527f454e5331200000000000000000000000000000000000000000000000000000006020830152610a21918391600091908290610e4b565b155b15610a41575050604080516020810190915260008082529150610afd565b6000610a7e6005808451610a559190611d48565b8491907f2000000000000000000000000000000000000000000000000000000000000000610eb8565b90508151811115610ab5576000610a988360058551610f54565b6040805160208101909152600081529095509350610afd92505050565b6000610ac383600584610f54565b905080610af5610ad4846001611d5b565b6001858751610ae39190611d48565b610aed9190611d48565b869190610dc9565b945094505050505b935093915050565b60c08101516020820181905281515111610b1c5750565b6000610b3082600001518360200151610d6f565b8260200151610b3f9190611d5b565b8251909150610b4e908261105e565b61ffff166040830152610b62600282611d5b565b8251909150610b71908261105e565b61ffff166060830152610b85600282611d5b565b8251909150610b949082611086565b63ffffffff166080830152610baa600482611d5b565b8251909150600090610bbc908361105e565b61ffff169050610bcd600283611d5b565b60a084018190529150610be08183611d5b565b60c0909301929092525050565b60006001600160a01b0383163b610c6c5760405162461bcd60e51b815260206004820152602e60248201527f4c6f774c6576656c43616c6c5574696c733a207374617469632063616c6c207460448201527f6f206e6f6e2d636f6e74726163740000000000000000000000000000000000006064820152608401610680565b600080835160208501865afa9392505050565b60608167ffffffffffffffff811115610c9a57610c9a611676565b6040519080825280601f01601f191660200182016040528015610cc4576020820181803683370190505b5090508183602083013e92915050565b600080600080600087806020019051810190610cf09190611d7e565b94509450945094509450866001600160a01b0316856001600160a01b031614610d45576040517f398d4d3200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b30848463b4a8580160e01b89858760405160200161081d93929190611bd9565b3d6000803e3d6000fd5b6000815b83518110610d8357610d83611eb4565b6000610d8f85836110b0565b60ff169050610d9f816001611d5b565b610da99083611d5b565b915080600003610db95750610dbf565b50610d73565b6102548382611d48565b8251606090610dd88385611d5b565b1115610de357600080fd5b60008267ffffffffffffffff811115610dfe57610dfe611676565b6040519080825280601f01601f191660200182016040528015610e28576020820181803683370190505b50905060208082019086860101610e408282876110d4565b509095945050505050565b6000610e5884848461112a565b610e6387878561112a565b149695505050505050565b60606000610e7c85856110b0565b60ff16905082610e8c8286611d5b565b10610e9957610e99611eb4565b610eaf610ea7856001611d5b565b869083610dc9565b95945050505050565b6000835b610ec68486611d5b565b811015610f4757827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916868281518110610f0257610f02611b9d565b01602001517fff000000000000000000000000000000000000000000000000000000000000001603610f35579050610254565b80610f3f81611eca565b915050610ebc565b5060001995945050505050565b6000838381518110610f6857610f68611b9d565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f3000000000000000000000000000000000000000000000000000000000000000148015611020575083610fc5846001611d5b565b81518110610fd557610fd5611b9d565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f7800000000000000000000000000000000000000000000000000000000000000145b156110535760008061103e611036866002611d5b565b87908661114e565b915091508015611050575090506109b6565b50505b61025484848461118a565b815160009061106e836002611d5b565b111561107957600080fd5b50016002015161ffff1690565b8151600090611096836004611d5b565b11156110a157600080fd5b50016004015163ffffffff1690565b60008282815181106110c4576110c4611b9d565b016020015160f81c905092915050565b6020811061110c57815183526110eb602084611d5b565b92506110f8602083611d5b565b9150611105602082611d48565b90506110d4565b905182516020929092036101000a6000190180199091169116179052565b82516000906111398385611d5b565b111561114457600080fd5b5091016020012090565b600080602861115d8585611d48565b101561116e57506000905080610afd565b60008061117c8787876112e7565b909890975095505050505050565b60008061119885858561143b565b6040517f0178b8bf000000000000000000000000000000000000000000000000000000008152600481018290529091506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630178b8bf90602401602060405180830381865afa15801561121c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112409190611ee3565b90506001600160a01b03811661125b576000925050506109b6565b6040517f3b3b57de000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b03821690633b3b57de90602401602060405180830381865afa1580156112b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112dd9190611ee3565b9695505050505050565b600080806112f58585611d48565b905080604014158015611309575080602814155b8061131e575061131a600282611f00565b6001145b1561136b5760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610680565b60019150855184111561137d57600080fd5b6113ce565b6000603a8210602f8311161561139a5750602f190190565b604782106040831116156113b057506036190190565b606782106060831116156113c657506056190190565b5060ff919050565b60208601855b85811015611430576113eb8183015160001a611382565b6113fd6001830184015160001a611382565b60ff811460ff8314171561141657600095505050611430565b60049190911b1760089590951b94909417936002016113d4565b505050935093915050565b6000806114788485875161144f9190611d48565b8791907f2e00000000000000000000000000000000000000000000000000000000000000610eb8565b90506000838210156114a05761149986611493846001611d5b565b8661143b565b90506114a4565b8391505b806114bb866114b38186611d48565b89919061112a565b60408051602081019390935282015260600160405160208183030381529060405280519060200120925050509392505050565b6001600160e01b03198116811461150457600080fd5b50565b60006020828403121561151957600080fd5b81356109b6816114ee565b60005b8381101561153f578181015183820152602001611527565b50506000910152565b60008151808452611560816020860160208601611524565b601f01601f19169290920160200192915050565b6020815260006109b66020830184611548565b60008083601f84011261159957600080fd5b50813567ffffffffffffffff8111156115b157600080fd5b6020830191508360208285010111156115c957600080fd5b9250929050565b600080600080604085870312156115e657600080fd5b843567ffffffffffffffff808211156115fe57600080fd5b61160a88838901611587565b9096509450602087013591508082111561162357600080fd5b5061163087828801611587565b95989497509550505050565b600181811c9082168061165057607f821691505b60208210810361167057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156116af576116af611676565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156116de576116de611676565b604052919050565b600067ffffffffffffffff82111561170057611700611676565b50601f01601f191660200190565b600082601f83011261171f57600080fd5b813561173261172d826116e6565b6116b5565b81815284602083860101111561174757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561177957600080fd5b833567ffffffffffffffff8082111561179157600080fd5b61179d8783880161170e565b945060208601359150808211156117b357600080fd5b506117c08682870161170e565b92505060408401356117d1816114ee565b809150509250925092565b60006117ea61172d846116e6565b90508281528383830111156117fe57600080fd5b6109b6836020830184611524565b600082601f83011261181d57600080fd5b6109b6838351602085016117dc565b6001600160a01b038116811461150457600080fd5b6000806040838503121561185457600080fd5b825167ffffffffffffffff81111561186b57600080fd5b6118778582860161180c565b92505060208301516118888161182c565b809150509250929050565b6040815260006118a66040830185611548565b90506001600160a01b03831660208301529392505050565b60408152826040820152828460608301376000606084830101526000601f19601f850116820160608382030160208401526112dd6060820185611548565b600067ffffffffffffffff82111561191657611916611676565b5060051b60200190565b6000602080838503121561193357600080fd5b823567ffffffffffffffff8082111561194b57600080fd5b818501915085601f83011261195f57600080fd5b813561196d61172d826118fc565b81815260059190911b8301840190848101908883111561198c57600080fd5b8585015b83811015611a1f578035858111156119a85760008081fd5b86016040818c03601f19018113156119c05760008081fd5b6119c861168c565b89830135888111156119da5760008081fd5b6119e88e8c8387010161170e565b8252509082013590878211156119fe5760008081fd5b611a0c8d8b8486010161170e565b818b015285525050918601918601611990565b5098975050505050505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015611aa357888303603f1901855281518051878552611a7788860182611548565b91890151858303868b0152919050611a8f8183611548565b968901969450505090860190600101611a53565b509098975050505050505050565b60008060408385031215611ac457600080fd5b825167ffffffffffffffff811115611adb57600080fd5b611ae78582860161180c565b925050602083015163ffffffff8116811461188857600080fd5b600060208284031215611b1357600080fd5b815180151581146109b657600080fd5b606081526000611b366060830186611548565b8281036020840152611b488186611548565b905082810360408401526112dd8185611548565b604081526000611b6f6040830185611548565b8281036020840152610eaf8185611548565b60008251611b93818460208701611524565b9190910192915050565b634e487b7160e01b600052603260045260246000fd5b604081526000611bc66040830185611548565b905061ffff831660208301529392505050565b606081526000611bec6060830186611548565b8281036020840152611bfe8186611548565b9150506001600160e01b031983166040830152949350505050565b600060a082016001600160a01b0388168352602060a08185015281885180845260c08601915060c08160051b8701019350828a0160005b82811015611c7e5760bf19888703018452611c6c868351611548565b95509284019290840190600101611c50565b50505050508281036040840152611c958187611548565b6001600160e01b03198616606085015290508281036080840152611cb98185611548565b98975050505050505050565b600060208284031215611cd757600080fd5b815167ffffffffffffffff811115611cee57600080fd5b6102548482850161180c565b6000815160208301516001600160e01b031980821693506004831015611d2a5780818460040360031b1b83161693505b505050919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561097757610977611d32565b8082018082111561097757610977611d32565b8051611d79816114ee565b919050565b600080600080600060a08688031215611d9657600080fd5b8551611da18161182c565b8095505060208087015167ffffffffffffffff80821115611dc157600080fd5b818901915089601f830112611dd557600080fd5b8151611de361172d826118fc565b81815260059190911b8301840190848101908c831115611e0257600080fd5b8585015b83811015611e4f57805185811115611e1e5760008081fd5b8601603f81018f13611e305760008081fd5b611e418f89830151604084016117dc565b845250918601918601611e06565b5060408c01519099509450505080831115611e6957600080fd5b611e758a848b0161180c565b9550611e8360608a01611d6e565b94506080890151925080831115611e9957600080fd5b5050611ea78882890161180c565b9150509295509295909350565b634e487b7160e01b600052600160045260246000fd5b600060018201611edc57611edc611d32565b5060010190565b600060208284031215611ef557600080fd5b81516109b68161182c565b600082611f1d57634e487b7160e01b600052601260045260246000fd5b50069056fea2646970667358221220b936cbd1a155e7bc5dec1045b9de33f1540fc221b15ffde3b586c5a2aeb57d0464736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "supportsInterface(bytes4)": { + "details": "Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 5020, + "contract": "contracts/dnsregistrar/OffchainDNSResolver.sol:OffchainDNSResolver", + "label": "gatewayURL", + "offset": 0, + "slot": "0", + "type": "t_string_storage" + } + ], + "types": { + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/OwnedResolver.json b/solidity/dns-contracts/deployments/sepolia/OwnedResolver.json new file mode 100644 index 0000000..a6d8f86 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/OwnedResolver.json @@ -0,0 +1,1470 @@ +{ + "address": "0x15222A1C2Bf3A4c24eAd1634B8Ee399fd95c3aaf", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + } + ], + "name": "ABIChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "AddrChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "ContenthashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "record", + "type": "bytes" + } + ], + "name": "DNSRecordChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "DNSRecordDeleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "lastzonehash", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "zonehash", + "type": "bytes" + } + ], + "name": "DNSZonehashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "InterfaceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "PubkeyChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "string", + "name": "indexedKey", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "TextChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "newVersion", + "type": "uint64" + } + ], + "name": "VersionChanged", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentTypes", + "type": "uint256" + } + ], + "name": "ABI", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "clearRecords", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "contenthash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "dnsRecord", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + } + ], + "name": "hasDNSRecords", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "interfaceImplementer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "pubkey", + "outputs": [ + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "recordVersions", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setABI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "a", + "type": "bytes" + } + ], + "name": "setAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "setAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setContenthash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setDNSRecords", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "setInterface", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "newName", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "setPubkey", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "setText", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setZonehash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "text", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "zonehash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xdbd6176317ff46ffb2a7f4e627c92ad9334f2363b354725fc8a91663cffc9e42", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x15222A1C2Bf3A4c24eAd1634B8Ee399fd95c3aaf", + "transactionIndex": 100, + "gasUsed": "2349764", + "logsBloom": "0x00000000000000000008000000000000000000000000200000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000001000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000040008000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xa1c5cb305cb936f0ecda7c3be41307c024b6fa9c69e420b4d5d02a26c1922969", + "transactionHash": "0xdbd6176317ff46ffb2a7f4e627c92ad9334f2363b354725fc8a91663cffc9e42", + "logs": [ + { + "transactionIndex": 100, + "blockNumber": 3790128, + "transactionHash": "0xdbd6176317ff46ffb2a7f4e627c92ad9334f2363b354725fc8a91663cffc9e42", + "address": "0x15222A1C2Bf3A4c24eAd1634B8Ee399fd95c3aaf", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8" + ], + "data": "0x", + "logIndex": 193, + "blockHash": "0xa1c5cb305cb936f0ecda7c3be41307c024b6fa9c69e420b4d5d02a26c1922969" + } + ], + "blockNumber": 3790128, + "cumulativeGasUsed": "11479488", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 2, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"}],\"name\":\"ABIChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"AddrChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"newAddress\",\"type\":\"bytes\"}],\"name\":\"AddressChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"ContenthashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"record\",\"type\":\"bytes\"}],\"name\":\"DNSRecordChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"DNSRecordDeleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"lastzonehash\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"zonehash\",\"type\":\"bytes\"}],\"name\":\"DNSZonehashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"InterfaceChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NameChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"PubkeyChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"indexedKey\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"TextChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"newVersion\",\"type\":\"uint64\"}],\"name\":\"VersionChanged\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentTypes\",\"type\":\"uint256\"}],\"name\":\"ABI\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"clearRecords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"contenthash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"dnsRecord\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"hasDNSRecords\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"interfaceImplementer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"pubkey\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"recordVersions\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setABI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"a\",\"type\":\"bytes\"}],\"name\":\"setAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"setAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setContenthash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setDNSRecords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"setInterface\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"newName\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"setPubkey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"setText\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setZonehash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"}],\"name\":\"text\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"zonehash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"ABI(bytes32,uint256)\":{\"params\":{\"contentTypes\":\"A bitwise OR of the ABI formats accepted by the caller.\",\"node\":\"The ENS node to query\"},\"returns\":{\"_0\":\"contentType The content type of the return value\",\"_1\":\"data The ABI data\"}},\"addr(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated address.\"}},\"clearRecords(bytes32)\":{\"params\":{\"node\":\"The node to update.\"}},\"contenthash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated contenthash.\"}},\"dnsRecord(bytes32,bytes32,uint16)\":{\"params\":{\"name\":\"the keccak-256 hash of the fully-qualified name for which to fetch the record\",\"node\":\"the namehash of the node for which to fetch the record\",\"resource\":\"the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\"},\"returns\":{\"_0\":\"the DNS record in wire format if present, otherwise empty\"}},\"hasDNSRecords(bytes32,bytes32)\":{\"params\":{\"name\":\"the namehash of the node for which to check the records\",\"node\":\"the namehash of the node for which to check the records\"}},\"interfaceImplementer(bytes32,bytes4)\":{\"params\":{\"interfaceID\":\"The EIP 165 interface ID to check for.\",\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The address that implements this interface, or 0 if the interface is unsupported.\"}},\"name(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated name.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pubkey(bytes32)\":{\"params\":{\"node\":\"The ENS node to query\"},\"returns\":{\"x\":\"The X coordinate of the curve point for the public key.\",\"y\":\"The Y coordinate of the curve point for the public key.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setABI(bytes32,uint256,bytes)\":{\"params\":{\"contentType\":\"The content type of the ABI\",\"data\":\"The ABI data.\",\"node\":\"The node to update.\"}},\"setAddr(bytes32,address)\":{\"params\":{\"a\":\"The address to set.\",\"node\":\"The node to update.\"}},\"setContenthash(bytes32,bytes)\":{\"params\":{\"hash\":\"The contenthash to set\",\"node\":\"The node to update.\"}},\"setDNSRecords(bytes32,bytes)\":{\"params\":{\"data\":\"the DNS wire format records to set\",\"node\":\"the namehash of the node for which to set the records\"}},\"setInterface(bytes32,bytes4,address)\":{\"params\":{\"implementer\":\"The address of a contract that implements this interface for this node.\",\"interfaceID\":\"The EIP 165 interface ID.\",\"node\":\"The node to update.\"}},\"setName(bytes32,string)\":{\"params\":{\"node\":\"The node to update.\"}},\"setPubkey(bytes32,bytes32,bytes32)\":{\"params\":{\"node\":\"The ENS node to query\",\"x\":\"the X coordinate of the curve point for the public key.\",\"y\":\"the Y coordinate of the curve point for the public key.\"}},\"setText(bytes32,string,string)\":{\"params\":{\"key\":\"The key to set.\",\"node\":\"The node to update.\",\"value\":\"The text data value to set.\"}},\"setZonehash(bytes32,bytes)\":{\"params\":{\"hash\":\"The zonehash to set\",\"node\":\"The node to update.\"}},\"text(bytes32,string)\":{\"params\":{\"key\":\"The text data key to query.\",\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated text data.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"zonehash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated contenthash.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"ABI(bytes32,uint256)\":{\"notice\":\"Returns the ABI associated with an ENS node. Defined in EIP205.\"},\"addr(bytes32)\":{\"notice\":\"Returns the address associated with an ENS node.\"},\"clearRecords(bytes32)\":{\"notice\":\"Increments the record version associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"contenthash(bytes32)\":{\"notice\":\"Returns the contenthash associated with an ENS node.\"},\"dnsRecord(bytes32,bytes32,uint16)\":{\"notice\":\"Obtain a DNS record.\"},\"hasDNSRecords(bytes32,bytes32)\":{\"notice\":\"Check if a given node has records.\"},\"interfaceImplementer(bytes32,bytes4)\":{\"notice\":\"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.\"},\"name(bytes32)\":{\"notice\":\"Returns the name associated with an ENS node, for reverse records. Defined in EIP181.\"},\"pubkey(bytes32)\":{\"notice\":\"Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619.\"},\"setABI(bytes32,uint256,bytes)\":{\"notice\":\"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.\"},\"setAddr(bytes32,address)\":{\"notice\":\"Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setContenthash(bytes32,bytes)\":{\"notice\":\"Sets the contenthash associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setDNSRecords(bytes32,bytes)\":{\"notice\":\"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.\"},\"setInterface(bytes32,bytes4,address)\":{\"notice\":\"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.\"},\"setName(bytes32,string)\":{\"notice\":\"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.\"},\"setPubkey(bytes32,bytes32,bytes32)\":{\"notice\":\"Sets the SECP256k1 public key associated with an ENS node.\"},\"setText(bytes32,string,string)\":{\"notice\":\"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.\"},\"setZonehash(bytes32,bytes)\":{\"notice\":\"setZonehash sets the hash for the zone. May only be called by the owner of that node in the ENS registry.\"},\"text(bytes32,string)\":{\"notice\":\"Returns the text data associated with an ENS node and key.\"},\"zonehash(bytes32)\":{\"notice\":\"zonehash obtains the hash for the zone.\"}},\"notice\":\"A simple resolver anyone can use; only allows the owner of a node to set its address.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/resolvers/OwnedResolver.sol\":\"OwnedResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-2-Clause\\npragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for appending to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n let fpm := add(32, add(ptr, capacity))\\n if lt(fpm, ptr) {\\n revert(0, 0)\\n }\\n mstore(0x40, fpm)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n uint off = buf.buf.length;\\n uint newCapacity = off + len;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(newCapacity, buflen) {\\n mstore(bufptr, newCapacity)\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return append(buf, data, data.length);\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint offPlusOne = off + 1;\\n if (off >= buf.capacity) {\\n resize(buf, offPlusOne * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if gt(offPlusOne, mload(bufptr)) {\\n mstore(bufptr, offPlusOne)\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return append(buf, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return append(buf, data, 32);\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n return buf;\\n }\\n}\\n\",\"keccak256\":\"0xd6dd3b0b327288f8e1b711a609f4040fea602e2ad4bba9febdf2f33b4e56eb0c\",\"license\":\"BSD-2-Clause\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n */\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint256 labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes memory ret) {\\n uint256 len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint256 labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint256 constant RRSIG_TYPE = 0;\\n uint256 constant RRSIG_ALGORITHM = 2;\\n uint256 constant RRSIG_LABELS = 3;\\n uint256 constant RRSIG_TTL = 4;\\n uint256 constant RRSIG_EXPIRATION = 8;\\n uint256 constant RRSIG_INCEPTION = 12;\\n uint256 constant RRSIG_KEY_TAG = 16;\\n uint256 constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(\\n bytes memory data\\n ) internal pure returns (SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(\\n RRSIG_SIGNER_NAME + self.signerName.length,\\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\\n );\\n }\\n\\n function rrs(\\n SignedSet memory rrset\\n ) internal pure returns (RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint256 offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint256 rdataOffset;\\n uint256 nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns (bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint256 rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.offset,\\n nameLength(iter.data, iter.offset)\\n );\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(\\n RRIterator memory iter\\n ) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.rdataOffset,\\n iter.nextOffset - iter.rdataOffset\\n );\\n }\\n\\n uint256 constant DNSKEY_FLAGS = 0;\\n uint256 constant DNSKEY_PROTOCOL = 2;\\n uint256 constant DNSKEY_ALGORITHM = 3;\\n uint256 constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(\\n offset + DNSKEY_PUBKEY,\\n length - DNSKEY_PUBKEY\\n );\\n }\\n\\n uint256 constant DS_KEY_TAG = 0;\\n uint256 constant DS_ALGORITHM = 2;\\n uint256 constant DS_DIGEST_TYPE = 3;\\n uint256 constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n function isSubdomainOf(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n uint256 off = 0;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n while (counts > othercounts) {\\n off = progress(self, off);\\n counts--;\\n }\\n\\n return self.equals(off, other, 0);\\n }\\n\\n function compareNames(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint256 off;\\n uint256 otheroff;\\n uint256 prevoff;\\n uint256 otherprevoff;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if (otheroff == 0) {\\n return 1;\\n }\\n\\n return\\n self.compare(\\n prevoff + 1,\\n self.readUint8(prevoff),\\n other,\\n otherprevoff + 1,\\n other.readUint8(otherprevoff)\\n );\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(\\n uint32 i1,\\n uint32 i2\\n ) internal pure returns (bool) {\\n unchecked {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n }\\n\\n function progress(\\n bytes memory body,\\n uint256 off\\n ) internal pure returns (uint256) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint256 ac1;\\n uint256 ac2;\\n for (uint256 i = 0; i < data.length + 31; i += 32) {\\n uint256 word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if (i + 32 > data.length) {\\n uint256 unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 +=\\n (word &\\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\\n 8;\\n ac2 += (word &\\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 =\\n (ac1 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac1 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac2 =\\n (ac2 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac2 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 =\\n (ac1 &\\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\\n 32);\\n ac1 =\\n (ac1 &\\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\\n 64);\\n ac1 =\\n (ac1 &\\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\\n (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4dd68a6efd7c38f6b0e95ca0c056ecb74f88583da650b1a8639e6e78be36fede\"},\"contracts/resolvers/OwnedResolver.sol\":{\"content\":\"pragma solidity >=0.8.4;\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"./profiles/ABIResolver.sol\\\";\\nimport \\\"./profiles/AddrResolver.sol\\\";\\nimport \\\"./profiles/ContentHashResolver.sol\\\";\\nimport \\\"./profiles/DNSResolver.sol\\\";\\nimport \\\"./profiles/InterfaceResolver.sol\\\";\\nimport \\\"./profiles/NameResolver.sol\\\";\\nimport \\\"./profiles/PubkeyResolver.sol\\\";\\nimport \\\"./profiles/TextResolver.sol\\\";\\nimport \\\"./profiles/ExtendedResolver.sol\\\";\\n\\n/**\\n * A simple resolver anyone can use; only allows the owner of a node to set its\\n * address.\\n */\\ncontract OwnedResolver is\\n Ownable,\\n ABIResolver,\\n AddrResolver,\\n ContentHashResolver,\\n DNSResolver,\\n InterfaceResolver,\\n NameResolver,\\n PubkeyResolver,\\n TextResolver,\\n ExtendedResolver\\n{\\n function isAuthorised(bytes32) internal view override returns (bool) {\\n return msg.sender == owner();\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n )\\n public\\n view\\n virtual\\n override(\\n ABIResolver,\\n AddrResolver,\\n ContentHashResolver,\\n DNSResolver,\\n InterfaceResolver,\\n NameResolver,\\n PubkeyResolver,\\n TextResolver\\n )\\n returns (bool)\\n {\\n return super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x598216380f029db0101c75ebb00a7ccc04bd26c738537238d7f67d9e35603e8b\"},\"contracts/resolvers/ResolverBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"./profiles/IVersionableResolver.sol\\\";\\n\\nabstract contract ResolverBase is ERC165, IVersionableResolver {\\n mapping(bytes32 => uint64) public recordVersions;\\n\\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\\n\\n modifier authorised(bytes32 node) {\\n require(isAuthorised(node));\\n _;\\n }\\n\\n /**\\n * Increments the record version associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function clearRecords(bytes32 node) public virtual authorised(node) {\\n recordVersions[node]++;\\n emit VersionChanged(node, recordVersions[node]);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IVersionableResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x893049fffd6feee06d7acef1680f6e26505bedff62a9f7a17e921c0ba2f66307\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"./IABIResolver.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\n\\nabstract contract ABIResolver is IABIResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\\n\\n /**\\n * Sets the ABI associated with an ENS node.\\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\\n * the empty string.\\n * @param node The node to update.\\n * @param contentType The content type of the ABI\\n * @param data The ABI data.\\n */\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external virtual authorised(node) {\\n // Content types must be powers of 2\\n require(((contentType - 1) & contentType) == 0);\\n\\n versionable_abis[recordVersions[node]][node][contentType] = data;\\n emit ABIChanged(node, contentType);\\n }\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view virtual override returns (uint256, bytes memory) {\\n mapping(uint256 => bytes) storage abiset = versionable_abis[\\n recordVersions[node]\\n ][node];\\n\\n for (\\n uint256 contentType = 1;\\n contentType <= contentTypes;\\n contentType <<= 1\\n ) {\\n if (\\n (contentType & contentTypes) != 0 &&\\n abiset[contentType].length > 0\\n ) {\\n return (contentType, abiset[contentType]);\\n }\\n }\\n\\n return (0, bytes(\\\"\\\"));\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IABIResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x2da96d7750786afe3be019fc6ff768e2d98a5e61d360bd92d8d7bc3c7c1dcc27\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/AddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IAddrResolver.sol\\\";\\nimport \\\"./IAddressResolver.sol\\\";\\n\\nabstract contract AddrResolver is\\n IAddrResolver,\\n IAddressResolver,\\n ResolverBase\\n{\\n uint256 private constant COIN_TYPE_ETH = 60;\\n\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\\n\\n /**\\n * Sets the address associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param a The address to set.\\n */\\n function setAddr(\\n bytes32 node,\\n address a\\n ) external virtual authorised(node) {\\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\\n }\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(\\n bytes32 node\\n ) public view virtual override returns (address payable) {\\n bytes memory a = addr(node, COIN_TYPE_ETH);\\n if (a.length == 0) {\\n return payable(0);\\n }\\n return bytesToAddress(a);\\n }\\n\\n function setAddr(\\n bytes32 node,\\n uint256 coinType,\\n bytes memory a\\n ) public virtual authorised(node) {\\n emit AddressChanged(node, coinType, a);\\n if (coinType == COIN_TYPE_ETH) {\\n emit AddrChanged(node, bytesToAddress(a));\\n }\\n versionable_addresses[recordVersions[node]][node][coinType] = a;\\n }\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) public view virtual override returns (bytes memory) {\\n return versionable_addresses[recordVersions[node]][node][coinType];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IAddrResolver).interfaceId ||\\n interfaceID == type(IAddressResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function bytesToAddress(\\n bytes memory b\\n ) internal pure returns (address payable a) {\\n require(b.length == 20);\\n assembly {\\n a := div(mload(add(b, 32)), exp(256, 12))\\n }\\n }\\n\\n function addressToBytes(address a) internal pure returns (bytes memory b) {\\n b = new bytes(20);\\n assembly {\\n mstore(add(b, 32), mul(a, exp(256, 12)))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7f6ebb3144530a02db03379f33ade869c8408eceed36dfbd751aaff198735b55\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IContentHashResolver.sol\\\";\\n\\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\\n\\n /**\\n * Sets the contenthash associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param hash The contenthash to set\\n */\\n function setContenthash(\\n bytes32 node,\\n bytes calldata hash\\n ) external virtual authorised(node) {\\n versionable_hashes[recordVersions[node]][node] = hash;\\n emit ContenthashChanged(node, hash);\\n }\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(\\n bytes32 node\\n ) external view virtual override returns (bytes memory) {\\n return versionable_hashes[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IContentHashResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xc9755bfb77985375ded880ecab5af41f2b9e8280f30d3e523fe5042ea59f93ea\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/DNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"../../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"./IDNSRecordResolver.sol\\\";\\nimport \\\"./IDNSZoneResolver.sol\\\";\\n\\nabstract contract DNSResolver is\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n ResolverBase\\n{\\n using RRUtils for *;\\n using BytesUtils for bytes;\\n\\n // Zone hashes for the domains.\\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\\n // resource containing a single zonefile.\\n // node => contenthash\\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\\n\\n // The records themselves. Stored as binary RRSETs\\n // node => version => name => resource => data\\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\\n private versionable_records;\\n\\n // Count of number of entries for a given name. Required for DNS resolvers\\n // when resolving wildcards.\\n // node => version => name => number of records\\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\\n private versionable_nameEntriesCount;\\n\\n /**\\n * Set one or more DNS records. Records are supplied in wire-format.\\n * Records with the same node/name/resource must be supplied one after the\\n * other to ensure the data is updated correctly. For example, if the data\\n * was supplied:\\n * a.example.com IN A 1.2.3.4\\n * a.example.com IN A 5.6.7.8\\n * www.example.com IN CNAME a.example.com.\\n * then this would store the two A records for a.example.com correctly as a\\n * single RRSET, however if the data was supplied:\\n * a.example.com IN A 1.2.3.4\\n * www.example.com IN CNAME a.example.com.\\n * a.example.com IN A 5.6.7.8\\n * then this would store the first A record, the CNAME, then the second A\\n * record which would overwrite the first.\\n *\\n * @param node the namehash of the node for which to set the records\\n * @param data the DNS wire format records to set\\n */\\n function setDNSRecords(\\n bytes32 node,\\n bytes calldata data\\n ) external virtual authorised(node) {\\n uint16 resource = 0;\\n uint256 offset = 0;\\n bytes memory name;\\n bytes memory value;\\n bytes32 nameHash;\\n uint64 version = recordVersions[node];\\n // Iterate over the data to add the resource records\\n for (\\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\\n !iter.done();\\n iter.next()\\n ) {\\n if (resource == 0) {\\n resource = iter.dnstype;\\n name = iter.name();\\n nameHash = keccak256(abi.encodePacked(name));\\n value = bytes(iter.rdata());\\n } else {\\n bytes memory newName = iter.name();\\n if (resource != iter.dnstype || !name.equals(newName)) {\\n setDNSRRSet(\\n node,\\n name,\\n resource,\\n data,\\n offset,\\n iter.offset - offset,\\n value.length == 0,\\n version\\n );\\n resource = iter.dnstype;\\n offset = iter.offset;\\n name = newName;\\n nameHash = keccak256(name);\\n value = bytes(iter.rdata());\\n }\\n }\\n }\\n if (name.length > 0) {\\n setDNSRRSet(\\n node,\\n name,\\n resource,\\n data,\\n offset,\\n data.length - offset,\\n value.length == 0,\\n version\\n );\\n }\\n }\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) public view virtual override returns (bytes memory) {\\n return versionable_records[recordVersions[node]][node][name][resource];\\n }\\n\\n /**\\n * Check if a given node has records.\\n * @param node the namehash of the node for which to check the records\\n * @param name the namehash of the node for which to check the records\\n */\\n function hasDNSRecords(\\n bytes32 node,\\n bytes32 name\\n ) public view virtual returns (bool) {\\n return (versionable_nameEntriesCount[recordVersions[node]][node][\\n name\\n ] != 0);\\n }\\n\\n /**\\n * setZonehash sets the hash for the zone.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param hash The zonehash to set\\n */\\n function setZonehash(\\n bytes32 node,\\n bytes calldata hash\\n ) external virtual authorised(node) {\\n uint64 currentRecordVersion = recordVersions[node];\\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\\n node\\n ];\\n versionable_zonehashes[currentRecordVersion][node] = hash;\\n emit DNSZonehashChanged(node, oldhash, hash);\\n }\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(\\n bytes32 node\\n ) external view virtual override returns (bytes memory) {\\n return versionable_zonehashes[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IDNSRecordResolver).interfaceId ||\\n interfaceID == type(IDNSZoneResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function setDNSRRSet(\\n bytes32 node,\\n bytes memory name,\\n uint16 resource,\\n bytes memory data,\\n uint256 offset,\\n uint256 size,\\n bool deleteRecord,\\n uint64 version\\n ) private {\\n bytes32 nameHash = keccak256(name);\\n bytes memory rrData = data.substring(offset, size);\\n if (deleteRecord) {\\n if (\\n versionable_records[version][node][nameHash][resource].length !=\\n 0\\n ) {\\n versionable_nameEntriesCount[version][node][nameHash]--;\\n }\\n delete (versionable_records[version][node][nameHash][resource]);\\n emit DNSRecordDeleted(node, name, resource);\\n } else {\\n if (\\n versionable_records[version][node][nameHash][resource].length ==\\n 0\\n ) {\\n versionable_nameEntriesCount[version][node][nameHash]++;\\n }\\n versionable_records[version][node][nameHash][resource] = rrData;\\n emit DNSRecordChanged(node, name, resource, rrData);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7233e4d2edca222ce6e1cdb07adf127ab52ecaea599fa5369971a7b28dbc59ac\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ncontract ExtendedResolver {\\n function resolve(\\n bytes memory /* name */,\\n bytes memory data\\n ) external view returns (bytes memory) {\\n (bool success, bytes memory result) = address(this).staticcall(data);\\n if (success) {\\n return result;\\n } else {\\n // Revert with the reason provided by the call\\n assembly {\\n revert(add(result, 0x20), mload(result))\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd0e5c93ac9f4d21a0278282e2a32a9c5606a0053ce4781773b7faade57a4a54e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IVersionableResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IVersionableResolver {\\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\\n\\n function recordVersions(bytes32 node) external view returns (uint64);\\n}\\n\",\"keccak256\":\"0xd0d09596f20c57bafb2ffa8521a8c57120e9af6c6b194f9c689d4da56f91a57c\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/InterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./AddrResolver.sol\\\";\\nimport \\\"./IInterfaceResolver.sol\\\";\\n\\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\\n\\n /**\\n * Sets an interface associated with a name.\\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\\n * @param node The node to update.\\n * @param interfaceID The EIP 165 interface ID.\\n * @param implementer The address of a contract that implements this interface for this node.\\n */\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external virtual authorised(node) {\\n versionable_interfaces[recordVersions[node]][node][\\n interfaceID\\n ] = implementer;\\n emit InterfaceChanged(node, interfaceID, implementer);\\n }\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view virtual override returns (address) {\\n address implementer = versionable_interfaces[recordVersions[node]][\\n node\\n ][interfaceID];\\n if (implementer != address(0)) {\\n return implementer;\\n }\\n\\n address a = addr(node);\\n if (a == address(0)) {\\n return address(0);\\n }\\n\\n (bool success, bytes memory returnData) = a.staticcall(\\n abi.encodeWithSignature(\\n \\\"supportsInterface(bytes4)\\\",\\n type(IERC165).interfaceId\\n )\\n );\\n if (!success || returnData.length < 32 || returnData[31] == 0) {\\n // EIP 165 not supported by target\\n return address(0);\\n }\\n\\n (success, returnData) = a.staticcall(\\n abi.encodeWithSignature(\\\"supportsInterface(bytes4)\\\", interfaceID)\\n );\\n if (!success || returnData.length < 32 || returnData[31] == 0) {\\n // Specified interface not supported by target\\n return address(0);\\n }\\n\\n return a;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IInterfaceResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x820ec60183e7a49a4ee399cf4708acb776725c8e4ad275d1f316c152eace0a59\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/NameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./INameResolver.sol\\\";\\n\\nabstract contract NameResolver is INameResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\\n\\n /**\\n * Sets the name associated with an ENS node, for reverse records.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function setName(\\n bytes32 node,\\n string calldata newName\\n ) external virtual authorised(node) {\\n versionable_names[recordVersions[node]][node] = newName;\\n emit NameChanged(node, newName);\\n }\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(\\n bytes32 node\\n ) external view virtual override returns (string memory) {\\n return versionable_names[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(INameResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x52d0bbb8f9dd33fae471ef2f5f6b3118b221954e5bb7ba724885d4562e75b8e2\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/PubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IPubkeyResolver.sol\\\";\\n\\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\\n struct PublicKey {\\n bytes32 x;\\n bytes32 y;\\n }\\n\\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\\n\\n /**\\n * Sets the SECP256k1 public key associated with an ENS node.\\n * @param node The ENS node to query\\n * @param x the X coordinate of the curve point for the public key.\\n * @param y the Y coordinate of the curve point for the public key.\\n */\\n function setPubkey(\\n bytes32 node,\\n bytes32 x,\\n bytes32 y\\n ) external virtual authorised(node) {\\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\\n emit PubkeyChanged(node, x, y);\\n }\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(\\n bytes32 node\\n ) external view virtual override returns (bytes32 x, bytes32 y) {\\n uint64 currentRecordVersion = recordVersions[node];\\n return (\\n versionable_pubkeys[currentRecordVersion][node].x,\\n versionable_pubkeys[currentRecordVersion][node].y\\n );\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IPubkeyResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x1a1f10a0e40520c998a9296fc81c092c81521e05a784e9bd9ee44cc4c62c8c78\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/TextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./ITextResolver.sol\\\";\\n\\nabstract contract TextResolver is ITextResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\\n\\n /**\\n * Sets the text data associated with an ENS node and key.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param key The key to set.\\n * @param value The text data value to set.\\n */\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external virtual authorised(node) {\\n versionable_texts[recordVersions[node]][node][key] = value;\\n emit TextChanged(node, key, key, value);\\n }\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view virtual override returns (string memory) {\\n return versionable_texts[recordVersions[node]][node][key];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(ITextResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xf9bedd807add38136779d84083ac2fa4f8c92d017c9e1a72fbc9003fa5074379\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61292b8061007e6000396000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c8063715018a6116100f9578063c869023311610097578063d700ff3311610071578063d700ff3314610450578063e59d895d14610493578063f1cb7e06146104a6578063f2fde38b146104b957600080fd5b8063c8690233146103d0578063ce3decdc1461042a578063d5fa2b001461043d57600080fd5b80638da5cb5b116100d35780638da5cb5b146103865780639061b92314610397578063a8fa5682146103aa578063bc1c58d1146103bd57600080fd5b8063715018a61461035857806377372213146103605780638b95dd711461037357600080fd5b80633603d7581161016657806359d1d43c1161014057806359d1d43c146102ff5780635c98042b1461031f578063623195b014610332578063691f34311461034557600080fd5b80633603d7581461028b5780633b3b57de1461029e5780634cbf6ba4146102b157600080fd5b8063124a319c116101a2578063124a319c146102195780632203ab561461024457806329cd62ea14610265578063304e6ade1461027857600080fd5b806301ffc9a7146101c95780630af179d7146101f157806310f13a8c14610206575b600080fd5b6101dc6101d736600461205c565b6104cc565b60405190151581526020015b60405180910390f35b6102046101ff3660046120b9565b6104dd565b005b610204610214366004612105565b6106ef565b61022c61022736600461217f565b6107c4565b6040516001600160a01b0390911681526020016101e8565b6102576102523660046121ab565b610a72565b6040516101e892919061221d565b610204610273366004612236565b610baa565b6102046102863660046120b9565b610c52565b610204610299366004612262565b610cd6565b61022c6102ac366004612262565b610d81565b6101dc6102bf3660046121ab565b60008281526001602090815260408083205467ffffffffffffffff1683526007825280832094835293815283822092825291909152205461ffff16151590565b61031261030d3660046120b9565b610db3565b6040516101e8919061227b565b61031261032d366004612262565b610e95565b61020461034036600461228e565b610f56565b610312610353366004612262565b610ffb565b610204611037565b61020461036e3660046120b9565b61104b565b610204610381366004612384565b6110cf565b6000546001600160a01b031661022c565b6103126103a53660046123d4565b6111b7565b6103126103b8366004612438565b611230565b6103126103cb366004612262565b611280565b6104156103de366004612262565b60008181526001602081815260408084205467ffffffffffffffff168452600a825280842094845293905291902080549101549091565b604080519283526020830191909152016101e8565b6102046104383660046120b9565b6112bc565b61020461044b36600461248f565b611407565b61047a61045e366004612262565b60016020526000908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016101e8565b6102046104a13660046124b2565b611434565b6103126104b43660046121ab565b6114f0565b6102046104c73660046124ee565b6115ba565b60006104d78261164f565b92915050565b60005483906001600160a01b031633146104f657600080fd5b6000848152600160209081526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff90911691839161055e9183918d908d9081908401838280828437600092019190915250929392505061168d9050565b90505b80515160208201511015610688578661ffff166000036105c6578060400151965061058b816116ee565b94508460405160200161059e9190612509565b6040516020818303038152906040528051906020012092506105bf8161170f565b935061067a565b60006105d1826116ee565b9050816040015161ffff168861ffff161415806105f557506105f3868261172b565b155b15610678576106518c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d915061064890829061253b565b8b51158a611749565b8160400151975081602001519650809550858051906020012093506106758261170f565b94505b505b610683816119b6565b610561565b508351156106e3576106e38a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92506106da91508290508f61253b565b89511588611749565b50505050505050505050565b60005485906001600160a01b0316331461070857600080fd5b60008681526001602090815260408083205467ffffffffffffffff168352600b82528083208984529091529081902090518491849161074a908990899061254e565b908152602001604051809103902091826107659291906125e6565b50848460405161077692919061254e565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516107b494939291906126cf565b60405180910390a3505050505050565b60008281526001602090815260408083205467ffffffffffffffff1683526008825280832085845282528083206001600160e01b0319851684529091528120546001600160a01b0316801561081a5790506104d7565b600061082585610d81565b90506001600160a01b038116610840576000925050506104d7565b6040516301ffc9a760e01b602482015260009081906001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516108ad9190612509565b600060405180830381855afa9150503d80600081146108e8576040519150601f19603f3d011682016040523d82523d6000602084013e6108ed565b606091505b5091509150811580610900575060208151105b80610942575080601f8151811061091957610919612701565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109545760009450505050506104d7565b6040516001600160e01b0319871660248201526001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516109bf9190612509565b600060405180830381855afa9150503d80600081146109fa576040519150601f19603f3d011682016040523d82523d6000602084013e6109ff565b606091505b509092509050811580610a13575060208151105b80610a55575080601f81518110610a2c57610a2c612701565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610a675760009450505050506104d7565b509095945050505050565b60008281526001602081815260408084205467ffffffffffffffff1684526002825280842086855290915282206060915b848111610b8a5780851615801590610ad3575060008181526020839052604081208054610acf9061255e565b9050115b15610b825780826000838152602001908152602001600020808054610af79061255e565b80601f0160208091040260200160405190810160405280929190818152602001828054610b239061255e565b8015610b705780601f10610b4557610100808354040283529160200191610b70565b820191906000526020600020905b815481529060010190602001808311610b5357829003601f168201915b50505050509050935093505050610ba3565b60011b610aa3565b5060006040518060200160405280600081525092509250505b9250929050565b60005483906001600160a01b03163314610bc357600080fd5b6040805180820182528481526020808201858152600088815260018084528582205467ffffffffffffffff168252600a84528582208a835290935284902092518355519101555184907f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4690610c449086908690918252602082015260400190565b60405180910390a250505050565b60005483906001600160a01b03163314610c6b57600080fd5b60008481526001602090815260408083205467ffffffffffffffff168352600482528083208784529091529020610ca38385836125e6565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610c44929190612717565b60005481906001600160a01b03163314610cef57600080fd5b6000828152600160205260408120805467ffffffffffffffff1691610d138361272b565b82546101009290920a67ffffffffffffffff8181021990931691831602179091556000848152600160209081526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610d8f83603c6114f0565b90508051600003610da35750600092915050565b610dac81611a9e565b9392505050565b60008381526001602090815260408083205467ffffffffffffffff168352600b825280832086845290915290819020905160609190610df5908590859061254e565b90815260200160405180910390208054610e0e9061255e565b80601f0160208091040260200160405190810160405280929190818152602001828054610e3a9061255e565b8015610e875780601f10610e5c57610100808354040283529160200191610e87565b820191906000526020600020905b815481529060010190602001808311610e6a57829003601f168201915b505050505090509392505050565b60008181526001602090815260408083205467ffffffffffffffff168352600582528083208484529091529020805460609190610ed19061255e565b80601f0160208091040260200160405190810160405280929190818152602001828054610efd9061255e565b8015610f4a5780601f10610f1f57610100808354040283529160200191610f4a565b820191906000526020600020905b815481529060010190602001808311610f2d57829003601f168201915b50505050509050919050565b60005484906001600160a01b03163314610f6f57600080fd5b83610f7b60018261253b565b1615610f8657600080fd5b60008581526001602090815260408083205467ffffffffffffffff1683526002825280832088845282528083208784529091529020610fc68385836125e6565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b60008181526001602090815260408083205467ffffffffffffffff168352600982528083208484529091529020805460609190610ed19061255e565b61103f611ac6565b6110496000611b20565b565b60005483906001600160a01b0316331461106457600080fd5b60008481526001602090815260408083205467ffffffffffffffff16835260098252808320878452909152902061109c8385836125e6565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610c44929190612717565b60005483906001600160a01b031633146110e857600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af752848460405161111a92919061221d565b60405180910390a2603c830361117157837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd261115584611a9e565b6040516001600160a01b03909116815260200160405180910390a25b60008481526001602090815260408083205467ffffffffffffffff16835260038252808320878452825280832086845290915290206111b08382612752565b5050505050565b6060600080306001600160a01b0316846040516111d49190612509565b600060405180830381855afa9150503d806000811461120f576040519150601f19603f3d011682016040523d82523d6000602084013e611214565b606091505b509150915081156112285791506104d79050565b805160208201fd5b60008381526001602090815260408083205467ffffffffffffffff168352600682528083208684528252808320858452825280832061ffff851684529091529020805460609190610e0e9061255e565b60008181526001602090815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610ed19061255e565b60005483906001600160a01b031633146112d557600080fd5b60008481526001602090815260408083205467ffffffffffffffff1680845260058352818420888552909252822080549192916113119061255e565b80601f016020809104026020016040519081016040528092919081815260200182805461133d9061255e565b801561138a5780601f1061135f5761010080835404028352916020019161138a565b820191906000526020600020905b81548152906001019060200180831161136d57829003601f168201915b5050505067ffffffffffffffff841660009081526005602090815260408083208b845290915290209192506113c290508587836125e6565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f858287876040516113f793929190612812565b60405180910390a2505050505050565b60005482906001600160a01b0316331461142057600080fd5b61142f83603c61038185611b7d565b505050565b60005483906001600160a01b0316331461144d57600080fd5b60008481526001602090815260408083205467ffffffffffffffff1683526008825280832087845282528083206001600160e01b0319871680855290835292819020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b60008281526001602090815260408083205467ffffffffffffffff16835260038252808320858452825280832084845290915290208054606091906115349061255e565b80601f01602080910402602001604051908101604052809291908181526020018280546115609061255e565b80156115ad5780601f10611582576101008083540402835291602001916115ad565b820191906000526020600020905b81548152906001019060200180831161159057829003601f168201915b5050505050905092915050565b6115c2611ac6565b6001600160a01b0381166116435760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61164c81611b20565b50565b60006001600160e01b031982167f59d1d43c0000000000000000000000000000000000000000000000000000000014806104d757506104d782611bb6565b6116db6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c081018290526104d7816119b6565b602081015181516060916104d7916117069082611bf4565b84519190611c56565b60a081015160c08201516060916104d79161170690829061253b565b600081518351148015610dac5750610dac8360008460008751611ccd565b86516020880120600061175d878787611c56565b905083156118875767ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152902080546117a89061255e565b1590506118075767ffffffffffffffff831660009081526007602090815260408083208d845282528083208584529091528120805461ffff16916117eb83612842565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152812061184891611ff1565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a60405161187a929190612860565b60405180910390a26106e3565b67ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152902080546118ca9061255e565b905060000361192b5767ffffffffffffffff831660009081526007602090815260408083208d845282528083208584529091528120805461ffff169161190f83612886565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152902061196d8282612752565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a846040516119a29392919061289d565b60405180910390a250505050505050505050565b60c081015160208201819052815151116119cd5750565b60006119e182600001518360200151611bf4565b82602001516119f091906128cc565b82519091506119ff9082611cf0565b61ffff166040830152611a136002826128cc565b8251909150611a229082611cf0565b61ffff166060830152611a366002826128cc565b8251909150611a459082611d18565b63ffffffff166080830152611a5b6004826128cc565b8251909150600090611a6d9083611cf0565b61ffff169050611a7e6002836128cc565b60a084018190529150611a9181836128cc565b60c0909301929092525050565b60008151601414611aae57600080fd5b50602001516c01000000000000000000000000900490565b6000546001600160a01b031633146110495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161163a565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60006001600160e01b031982167fc86902330000000000000000000000000000000000000000000000000000000014806104d757506104d782611d42565b6000815b83518110611c0857611c086128df565b6000611c148583611d80565b60ff169050611c248160016128cc565b611c2e90836128cc565b915080600003611c3e5750611c44565b50611bf8565b611c4e838261253b565b949350505050565b8251606090611c6583856128cc565b1115611c7057600080fd5b60008267ffffffffffffffff811115611c8b57611c8b6122e1565b6040519080825280601f01601f191660200182016040528015611cb5576020820181803683370190505b50905060208082019086860101610a67828287611da4565b6000611cda848484611dfa565b611ce5878785611dfa565b149695505050505050565b8151600090611d008360026128cc565b1115611d0b57600080fd5b50016002015161ffff1690565b8151600090611d288360046128cc565b1115611d3357600080fd5b50016004015163ffffffff1690565b60006001600160e01b031982167f691f34310000000000000000000000000000000000000000000000000000000014806104d757506104d782611e1e565b6000828281518110611d9457611d94612701565b016020015160f81c905092915050565b60208110611ddc5781518352611dbb6020846128cc565b9250611dc86020836128cc565b9150611dd560208261253b565b9050611da4565b905182516020929092036101000a6000190180199091169116179052565b8251600090611e0983856128cc565b1115611e1457600080fd5b5091016020012090565b60006001600160e01b031982167f124a319c0000000000000000000000000000000000000000000000000000000014806104d757506104d78260006001600160e01b031982167fa8fa5682000000000000000000000000000000000000000000000000000000001480611eba57506001600160e01b031982167f5c98042b00000000000000000000000000000000000000000000000000000000145b806104d757506104d78260006001600160e01b031982167fbc1c58d10000000000000000000000000000000000000000000000000000000014806104d757506104d78260006001600160e01b031982167f3b3b57de000000000000000000000000000000000000000000000000000000001480611f6057506001600160e01b031982167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b806104d757506104d78260006001600160e01b031982167f2203ab560000000000000000000000000000000000000000000000000000000014806104d757506104d78260006001600160e01b031982167fd700ff330000000000000000000000000000000000000000000000000000000014806104d757506301ffc9a760e01b6001600160e01b03198316146104d7565b508054611ffd9061255e565b6000825580601f1061200d575050565b601f01602090049060005260206000209081019061164c91905b8082111561203b5760008155600101612027565b5090565b80356001600160e01b03198116811461205757600080fd5b919050565b60006020828403121561206e57600080fd5b610dac8261203f565b60008083601f84011261208957600080fd5b50813567ffffffffffffffff8111156120a157600080fd5b602083019150836020828501011115610ba357600080fd5b6000806000604084860312156120ce57600080fd5b83359250602084013567ffffffffffffffff8111156120ec57600080fd5b6120f886828701612077565b9497909650939450505050565b60008060008060006060868803121561211d57600080fd5b85359450602086013567ffffffffffffffff8082111561213c57600080fd5b61214889838a01612077565b9096509450604088013591508082111561216157600080fd5b5061216e88828901612077565b969995985093965092949392505050565b6000806040838503121561219257600080fd5b823591506121a26020840161203f565b90509250929050565b600080604083850312156121be57600080fd5b50508035926020909101359150565b60005b838110156121e85781810151838201526020016121d0565b50506000910152565b600081518084526122098160208601602086016121cd565b601f01601f19169290920160200192915050565b828152604060208201526000611c4e60408301846121f1565b60008060006060848603121561224b57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561227457600080fd5b5035919050565b602081526000610dac60208301846121f1565b600080600080606085870312156122a457600080fd5b8435935060208501359250604085013567ffffffffffffffff8111156122c957600080fd5b6122d587828801612077565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261230857600080fd5b813567ffffffffffffffff80821115612323576123236122e1565b604051601f8301601f19908116603f0116810190828211818310171561234b5761234b6122e1565b8160405283815286602085880101111561236457600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561239957600080fd5b8335925060208401359150604084013567ffffffffffffffff8111156123be57600080fd5b6123ca868287016122f7565b9150509250925092565b600080604083850312156123e757600080fd5b823567ffffffffffffffff808211156123ff57600080fd5b61240b868387016122f7565b9350602085013591508082111561242157600080fd5b5061242e858286016122f7565b9150509250929050565b60008060006060848603121561244d57600080fd5b8335925060208401359150604084013561ffff8116811461246d57600080fd5b809150509250925092565b80356001600160a01b038116811461205757600080fd5b600080604083850312156124a257600080fd5b823591506121a260208401612478565b6000806000606084860312156124c757600080fd5b833592506124d76020850161203f565b91506124e560408501612478565b90509250925092565b60006020828403121561250057600080fd5b610dac82612478565b6000825161251b8184602087016121cd565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b818103818111156104d7576104d7612525565b8183823760009101908152919050565b600181811c9082168061257257607f821691505b60208210810361259257634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561142f57600081815260208120601f850160051c810160208610156125bf5750805b601f850160051c820191505b818110156125de578281556001016125cb565b505050505050565b67ffffffffffffffff8311156125fe576125fe6122e1565b6126128361260c835461255e565b83612598565b6000601f841160018114612646576000851561262e5750838201355b600019600387901b1c1916600186901b1783556111b0565b600083815260209020601f19861690835b828110156126775786850135825560209485019460019092019101612657565b50868210156126945760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6040815260006126e36040830186886126a6565b82810360208401526126f68185876126a6565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b602081526000611c4e6020830184866126a6565b600067ffffffffffffffff80831681810361274857612748612525565b6001019392505050565b815167ffffffffffffffff81111561276c5761276c6122e1565b6127808161277a845461255e565b84612598565b602080601f8311600181146127b5576000841561279d5750858301515b600019600386901b1c1916600185901b1785556125de565b600085815260208120601f198616915b828110156127e4578886015182559484019460019091019084016127c5565b50858210156128025787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60408152600061282560408301866121f1565b82810360208401526128388185876126a6565b9695505050505050565b600061ffff82168061285657612856612525565b6000190192915050565b60408152600061287360408301856121f1565b905061ffff831660208301529392505050565b600061ffff80831681810361274857612748612525565b6060815260006128b060608301866121f1565b61ffff85166020840152828103604084015261283881856121f1565b808201808211156104d7576104d7612525565b634e487b7160e01b600052600160045260246000fdfea2646970667358221220d63de109e6c80b38d1403d6423ad4efae0eced77107190ecf76f02ee79060a1864736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101c45760003560e01c8063715018a6116100f9578063c869023311610097578063d700ff3311610071578063d700ff3314610450578063e59d895d14610493578063f1cb7e06146104a6578063f2fde38b146104b957600080fd5b8063c8690233146103d0578063ce3decdc1461042a578063d5fa2b001461043d57600080fd5b80638da5cb5b116100d35780638da5cb5b146103865780639061b92314610397578063a8fa5682146103aa578063bc1c58d1146103bd57600080fd5b8063715018a61461035857806377372213146103605780638b95dd711461037357600080fd5b80633603d7581161016657806359d1d43c1161014057806359d1d43c146102ff5780635c98042b1461031f578063623195b014610332578063691f34311461034557600080fd5b80633603d7581461028b5780633b3b57de1461029e5780634cbf6ba4146102b157600080fd5b8063124a319c116101a2578063124a319c146102195780632203ab561461024457806329cd62ea14610265578063304e6ade1461027857600080fd5b806301ffc9a7146101c95780630af179d7146101f157806310f13a8c14610206575b600080fd5b6101dc6101d736600461205c565b6104cc565b60405190151581526020015b60405180910390f35b6102046101ff3660046120b9565b6104dd565b005b610204610214366004612105565b6106ef565b61022c61022736600461217f565b6107c4565b6040516001600160a01b0390911681526020016101e8565b6102576102523660046121ab565b610a72565b6040516101e892919061221d565b610204610273366004612236565b610baa565b6102046102863660046120b9565b610c52565b610204610299366004612262565b610cd6565b61022c6102ac366004612262565b610d81565b6101dc6102bf3660046121ab565b60008281526001602090815260408083205467ffffffffffffffff1683526007825280832094835293815283822092825291909152205461ffff16151590565b61031261030d3660046120b9565b610db3565b6040516101e8919061227b565b61031261032d366004612262565b610e95565b61020461034036600461228e565b610f56565b610312610353366004612262565b610ffb565b610204611037565b61020461036e3660046120b9565b61104b565b610204610381366004612384565b6110cf565b6000546001600160a01b031661022c565b6103126103a53660046123d4565b6111b7565b6103126103b8366004612438565b611230565b6103126103cb366004612262565b611280565b6104156103de366004612262565b60008181526001602081815260408084205467ffffffffffffffff168452600a825280842094845293905291902080549101549091565b604080519283526020830191909152016101e8565b6102046104383660046120b9565b6112bc565b61020461044b36600461248f565b611407565b61047a61045e366004612262565b60016020526000908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016101e8565b6102046104a13660046124b2565b611434565b6103126104b43660046121ab565b6114f0565b6102046104c73660046124ee565b6115ba565b60006104d78261164f565b92915050565b60005483906001600160a01b031633146104f657600080fd5b6000848152600160209081526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff90911691839161055e9183918d908d9081908401838280828437600092019190915250929392505061168d9050565b90505b80515160208201511015610688578661ffff166000036105c6578060400151965061058b816116ee565b94508460405160200161059e9190612509565b6040516020818303038152906040528051906020012092506105bf8161170f565b935061067a565b60006105d1826116ee565b9050816040015161ffff168861ffff161415806105f557506105f3868261172b565b155b15610678576106518c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d915061064890829061253b565b8b51158a611749565b8160400151975081602001519650809550858051906020012093506106758261170f565b94505b505b610683816119b6565b610561565b508351156106e3576106e38a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92506106da91508290508f61253b565b89511588611749565b50505050505050505050565b60005485906001600160a01b0316331461070857600080fd5b60008681526001602090815260408083205467ffffffffffffffff168352600b82528083208984529091529081902090518491849161074a908990899061254e565b908152602001604051809103902091826107659291906125e6565b50848460405161077692919061254e565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516107b494939291906126cf565b60405180910390a3505050505050565b60008281526001602090815260408083205467ffffffffffffffff1683526008825280832085845282528083206001600160e01b0319851684529091528120546001600160a01b0316801561081a5790506104d7565b600061082585610d81565b90506001600160a01b038116610840576000925050506104d7565b6040516301ffc9a760e01b602482015260009081906001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516108ad9190612509565b600060405180830381855afa9150503d80600081146108e8576040519150601f19603f3d011682016040523d82523d6000602084013e6108ed565b606091505b5091509150811580610900575060208151105b80610942575080601f8151811061091957610919612701565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109545760009450505050506104d7565b6040516001600160e01b0319871660248201526001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516109bf9190612509565b600060405180830381855afa9150503d80600081146109fa576040519150601f19603f3d011682016040523d82523d6000602084013e6109ff565b606091505b509092509050811580610a13575060208151105b80610a55575080601f81518110610a2c57610a2c612701565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610a675760009450505050506104d7565b509095945050505050565b60008281526001602081815260408084205467ffffffffffffffff1684526002825280842086855290915282206060915b848111610b8a5780851615801590610ad3575060008181526020839052604081208054610acf9061255e565b9050115b15610b825780826000838152602001908152602001600020808054610af79061255e565b80601f0160208091040260200160405190810160405280929190818152602001828054610b239061255e565b8015610b705780601f10610b4557610100808354040283529160200191610b70565b820191906000526020600020905b815481529060010190602001808311610b5357829003601f168201915b50505050509050935093505050610ba3565b60011b610aa3565b5060006040518060200160405280600081525092509250505b9250929050565b60005483906001600160a01b03163314610bc357600080fd5b6040805180820182528481526020808201858152600088815260018084528582205467ffffffffffffffff168252600a84528582208a835290935284902092518355519101555184907f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4690610c449086908690918252602082015260400190565b60405180910390a250505050565b60005483906001600160a01b03163314610c6b57600080fd5b60008481526001602090815260408083205467ffffffffffffffff168352600482528083208784529091529020610ca38385836125e6565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610c44929190612717565b60005481906001600160a01b03163314610cef57600080fd5b6000828152600160205260408120805467ffffffffffffffff1691610d138361272b565b82546101009290920a67ffffffffffffffff8181021990931691831602179091556000848152600160209081526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610d8f83603c6114f0565b90508051600003610da35750600092915050565b610dac81611a9e565b9392505050565b60008381526001602090815260408083205467ffffffffffffffff168352600b825280832086845290915290819020905160609190610df5908590859061254e565b90815260200160405180910390208054610e0e9061255e565b80601f0160208091040260200160405190810160405280929190818152602001828054610e3a9061255e565b8015610e875780601f10610e5c57610100808354040283529160200191610e87565b820191906000526020600020905b815481529060010190602001808311610e6a57829003601f168201915b505050505090509392505050565b60008181526001602090815260408083205467ffffffffffffffff168352600582528083208484529091529020805460609190610ed19061255e565b80601f0160208091040260200160405190810160405280929190818152602001828054610efd9061255e565b8015610f4a5780601f10610f1f57610100808354040283529160200191610f4a565b820191906000526020600020905b815481529060010190602001808311610f2d57829003601f168201915b50505050509050919050565b60005484906001600160a01b03163314610f6f57600080fd5b83610f7b60018261253b565b1615610f8657600080fd5b60008581526001602090815260408083205467ffffffffffffffff1683526002825280832088845282528083208784529091529020610fc68385836125e6565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b60008181526001602090815260408083205467ffffffffffffffff168352600982528083208484529091529020805460609190610ed19061255e565b61103f611ac6565b6110496000611b20565b565b60005483906001600160a01b0316331461106457600080fd5b60008481526001602090815260408083205467ffffffffffffffff16835260098252808320878452909152902061109c8385836125e6565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610c44929190612717565b60005483906001600160a01b031633146110e857600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af752848460405161111a92919061221d565b60405180910390a2603c830361117157837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd261115584611a9e565b6040516001600160a01b03909116815260200160405180910390a25b60008481526001602090815260408083205467ffffffffffffffff16835260038252808320878452825280832086845290915290206111b08382612752565b5050505050565b6060600080306001600160a01b0316846040516111d49190612509565b600060405180830381855afa9150503d806000811461120f576040519150601f19603f3d011682016040523d82523d6000602084013e611214565b606091505b509150915081156112285791506104d79050565b805160208201fd5b60008381526001602090815260408083205467ffffffffffffffff168352600682528083208684528252808320858452825280832061ffff851684529091529020805460609190610e0e9061255e565b60008181526001602090815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610ed19061255e565b60005483906001600160a01b031633146112d557600080fd5b60008481526001602090815260408083205467ffffffffffffffff1680845260058352818420888552909252822080549192916113119061255e565b80601f016020809104026020016040519081016040528092919081815260200182805461133d9061255e565b801561138a5780601f1061135f5761010080835404028352916020019161138a565b820191906000526020600020905b81548152906001019060200180831161136d57829003601f168201915b5050505067ffffffffffffffff841660009081526005602090815260408083208b845290915290209192506113c290508587836125e6565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f858287876040516113f793929190612812565b60405180910390a2505050505050565b60005482906001600160a01b0316331461142057600080fd5b61142f83603c61038185611b7d565b505050565b60005483906001600160a01b0316331461144d57600080fd5b60008481526001602090815260408083205467ffffffffffffffff1683526008825280832087845282528083206001600160e01b0319871680855290835292819020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b60008281526001602090815260408083205467ffffffffffffffff16835260038252808320858452825280832084845290915290208054606091906115349061255e565b80601f01602080910402602001604051908101604052809291908181526020018280546115609061255e565b80156115ad5780601f10611582576101008083540402835291602001916115ad565b820191906000526020600020905b81548152906001019060200180831161159057829003601f168201915b5050505050905092915050565b6115c2611ac6565b6001600160a01b0381166116435760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61164c81611b20565b50565b60006001600160e01b031982167f59d1d43c0000000000000000000000000000000000000000000000000000000014806104d757506104d782611bb6565b6116db6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c081018290526104d7816119b6565b602081015181516060916104d7916117069082611bf4565b84519190611c56565b60a081015160c08201516060916104d79161170690829061253b565b600081518351148015610dac5750610dac8360008460008751611ccd565b86516020880120600061175d878787611c56565b905083156118875767ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152902080546117a89061255e565b1590506118075767ffffffffffffffff831660009081526007602090815260408083208d845282528083208584529091528120805461ffff16916117eb83612842565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152812061184891611ff1565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a60405161187a929190612860565b60405180910390a26106e3565b67ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152902080546118ca9061255e565b905060000361192b5767ffffffffffffffff831660009081526007602090815260408083208d845282528083208584529091528120805461ffff169161190f83612886565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152902061196d8282612752565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a846040516119a29392919061289d565b60405180910390a250505050505050505050565b60c081015160208201819052815151116119cd5750565b60006119e182600001518360200151611bf4565b82602001516119f091906128cc565b82519091506119ff9082611cf0565b61ffff166040830152611a136002826128cc565b8251909150611a229082611cf0565b61ffff166060830152611a366002826128cc565b8251909150611a459082611d18565b63ffffffff166080830152611a5b6004826128cc565b8251909150600090611a6d9083611cf0565b61ffff169050611a7e6002836128cc565b60a084018190529150611a9181836128cc565b60c0909301929092525050565b60008151601414611aae57600080fd5b50602001516c01000000000000000000000000900490565b6000546001600160a01b031633146110495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161163a565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60006001600160e01b031982167fc86902330000000000000000000000000000000000000000000000000000000014806104d757506104d782611d42565b6000815b83518110611c0857611c086128df565b6000611c148583611d80565b60ff169050611c248160016128cc565b611c2e90836128cc565b915080600003611c3e5750611c44565b50611bf8565b611c4e838261253b565b949350505050565b8251606090611c6583856128cc565b1115611c7057600080fd5b60008267ffffffffffffffff811115611c8b57611c8b6122e1565b6040519080825280601f01601f191660200182016040528015611cb5576020820181803683370190505b50905060208082019086860101610a67828287611da4565b6000611cda848484611dfa565b611ce5878785611dfa565b149695505050505050565b8151600090611d008360026128cc565b1115611d0b57600080fd5b50016002015161ffff1690565b8151600090611d288360046128cc565b1115611d3357600080fd5b50016004015163ffffffff1690565b60006001600160e01b031982167f691f34310000000000000000000000000000000000000000000000000000000014806104d757506104d782611e1e565b6000828281518110611d9457611d94612701565b016020015160f81c905092915050565b60208110611ddc5781518352611dbb6020846128cc565b9250611dc86020836128cc565b9150611dd560208261253b565b9050611da4565b905182516020929092036101000a6000190180199091169116179052565b8251600090611e0983856128cc565b1115611e1457600080fd5b5091016020012090565b60006001600160e01b031982167f124a319c0000000000000000000000000000000000000000000000000000000014806104d757506104d78260006001600160e01b031982167fa8fa5682000000000000000000000000000000000000000000000000000000001480611eba57506001600160e01b031982167f5c98042b00000000000000000000000000000000000000000000000000000000145b806104d757506104d78260006001600160e01b031982167fbc1c58d10000000000000000000000000000000000000000000000000000000014806104d757506104d78260006001600160e01b031982167f3b3b57de000000000000000000000000000000000000000000000000000000001480611f6057506001600160e01b031982167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b806104d757506104d78260006001600160e01b031982167f2203ab560000000000000000000000000000000000000000000000000000000014806104d757506104d78260006001600160e01b031982167fd700ff330000000000000000000000000000000000000000000000000000000014806104d757506301ffc9a760e01b6001600160e01b03198316146104d7565b508054611ffd9061255e565b6000825580601f1061200d575050565b601f01602090049060005260206000209081019061164c91905b8082111561203b5760008155600101612027565b5090565b80356001600160e01b03198116811461205757600080fd5b919050565b60006020828403121561206e57600080fd5b610dac8261203f565b60008083601f84011261208957600080fd5b50813567ffffffffffffffff8111156120a157600080fd5b602083019150836020828501011115610ba357600080fd5b6000806000604084860312156120ce57600080fd5b83359250602084013567ffffffffffffffff8111156120ec57600080fd5b6120f886828701612077565b9497909650939450505050565b60008060008060006060868803121561211d57600080fd5b85359450602086013567ffffffffffffffff8082111561213c57600080fd5b61214889838a01612077565b9096509450604088013591508082111561216157600080fd5b5061216e88828901612077565b969995985093965092949392505050565b6000806040838503121561219257600080fd5b823591506121a26020840161203f565b90509250929050565b600080604083850312156121be57600080fd5b50508035926020909101359150565b60005b838110156121e85781810151838201526020016121d0565b50506000910152565b600081518084526122098160208601602086016121cd565b601f01601f19169290920160200192915050565b828152604060208201526000611c4e60408301846121f1565b60008060006060848603121561224b57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561227457600080fd5b5035919050565b602081526000610dac60208301846121f1565b600080600080606085870312156122a457600080fd5b8435935060208501359250604085013567ffffffffffffffff8111156122c957600080fd5b6122d587828801612077565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261230857600080fd5b813567ffffffffffffffff80821115612323576123236122e1565b604051601f8301601f19908116603f0116810190828211818310171561234b5761234b6122e1565b8160405283815286602085880101111561236457600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561239957600080fd5b8335925060208401359150604084013567ffffffffffffffff8111156123be57600080fd5b6123ca868287016122f7565b9150509250925092565b600080604083850312156123e757600080fd5b823567ffffffffffffffff808211156123ff57600080fd5b61240b868387016122f7565b9350602085013591508082111561242157600080fd5b5061242e858286016122f7565b9150509250929050565b60008060006060848603121561244d57600080fd5b8335925060208401359150604084013561ffff8116811461246d57600080fd5b809150509250925092565b80356001600160a01b038116811461205757600080fd5b600080604083850312156124a257600080fd5b823591506121a260208401612478565b6000806000606084860312156124c757600080fd5b833592506124d76020850161203f565b91506124e560408501612478565b90509250925092565b60006020828403121561250057600080fd5b610dac82612478565b6000825161251b8184602087016121cd565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b818103818111156104d7576104d7612525565b8183823760009101908152919050565b600181811c9082168061257257607f821691505b60208210810361259257634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561142f57600081815260208120601f850160051c810160208610156125bf5750805b601f850160051c820191505b818110156125de578281556001016125cb565b505050505050565b67ffffffffffffffff8311156125fe576125fe6122e1565b6126128361260c835461255e565b83612598565b6000601f841160018114612646576000851561262e5750838201355b600019600387901b1c1916600186901b1783556111b0565b600083815260209020601f19861690835b828110156126775786850135825560209485019460019092019101612657565b50868210156126945760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6040815260006126e36040830186886126a6565b82810360208401526126f68185876126a6565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b602081526000611c4e6020830184866126a6565b600067ffffffffffffffff80831681810361274857612748612525565b6001019392505050565b815167ffffffffffffffff81111561276c5761276c6122e1565b6127808161277a845461255e565b84612598565b602080601f8311600181146127b5576000841561279d5750858301515b600019600386901b1c1916600185901b1785556125de565b600085815260208120601f198616915b828110156127e4578886015182559484019460019091019084016127c5565b50858210156128025787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60408152600061282560408301866121f1565b82810360208401526128388185876126a6565b9695505050505050565b600061ffff82168061285657612856612525565b6000190192915050565b60408152600061287360408301856121f1565b905061ffff831660208301529392505050565b600061ffff80831681810361274857612748612525565b6060815260006128b060608301866121f1565b61ffff85166020840152828103604084015261283881856121f1565b808201808211156104d7576104d7612525565b634e487b7160e01b600052600160045260246000fdfea2646970667358221220d63de109e6c80b38d1403d6423ad4efae0eced77107190ecf76f02ee79060a1864736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "ABI(bytes32,uint256)": { + "params": { + "contentTypes": "A bitwise OR of the ABI formats accepted by the caller.", + "node": "The ENS node to query" + }, + "returns": { + "_0": "contentType The content type of the return value", + "_1": "data The ABI data" + } + }, + "addr(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated address." + } + }, + "clearRecords(bytes32)": { + "params": { + "node": "The node to update." + } + }, + "contenthash(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated contenthash." + } + }, + "dnsRecord(bytes32,bytes32,uint16)": { + "params": { + "name": "the keccak-256 hash of the fully-qualified name for which to fetch the record", + "node": "the namehash of the node for which to fetch the record", + "resource": "the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types" + }, + "returns": { + "_0": "the DNS record in wire format if present, otherwise empty" + } + }, + "hasDNSRecords(bytes32,bytes32)": { + "params": { + "name": "the namehash of the node for which to check the records", + "node": "the namehash of the node for which to check the records" + } + }, + "interfaceImplementer(bytes32,bytes4)": { + "params": { + "interfaceID": "The EIP 165 interface ID to check for.", + "node": "The ENS node to query." + }, + "returns": { + "_0": "The address that implements this interface, or 0 if the interface is unsupported." + } + }, + "name(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated name." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pubkey(bytes32)": { + "params": { + "node": "The ENS node to query" + }, + "returns": { + "x": "The X coordinate of the curve point for the public key.", + "y": "The Y coordinate of the curve point for the public key." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "setABI(bytes32,uint256,bytes)": { + "params": { + "contentType": "The content type of the ABI", + "data": "The ABI data.", + "node": "The node to update." + } + }, + "setAddr(bytes32,address)": { + "params": { + "a": "The address to set.", + "node": "The node to update." + } + }, + "setContenthash(bytes32,bytes)": { + "params": { + "hash": "The contenthash to set", + "node": "The node to update." + } + }, + "setDNSRecords(bytes32,bytes)": { + "params": { + "data": "the DNS wire format records to set", + "node": "the namehash of the node for which to set the records" + } + }, + "setInterface(bytes32,bytes4,address)": { + "params": { + "implementer": "The address of a contract that implements this interface for this node.", + "interfaceID": "The EIP 165 interface ID.", + "node": "The node to update." + } + }, + "setName(bytes32,string)": { + "params": { + "node": "The node to update." + } + }, + "setPubkey(bytes32,bytes32,bytes32)": { + "params": { + "node": "The ENS node to query", + "x": "the X coordinate of the curve point for the public key.", + "y": "the Y coordinate of the curve point for the public key." + } + }, + "setText(bytes32,string,string)": { + "params": { + "key": "The key to set.", + "node": "The node to update.", + "value": "The text data value to set." + } + }, + "setZonehash(bytes32,bytes)": { + "params": { + "hash": "The zonehash to set", + "node": "The node to update." + } + }, + "text(bytes32,string)": { + "params": { + "key": "The text data key to query.", + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated text data." + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "zonehash(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated contenthash." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "ABI(bytes32,uint256)": { + "notice": "Returns the ABI associated with an ENS node. Defined in EIP205." + }, + "addr(bytes32)": { + "notice": "Returns the address associated with an ENS node." + }, + "clearRecords(bytes32)": { + "notice": "Increments the record version associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "contenthash(bytes32)": { + "notice": "Returns the contenthash associated with an ENS node." + }, + "dnsRecord(bytes32,bytes32,uint16)": { + "notice": "Obtain a DNS record." + }, + "hasDNSRecords(bytes32,bytes32)": { + "notice": "Check if a given node has records." + }, + "interfaceImplementer(bytes32,bytes4)": { + "notice": "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." + }, + "name(bytes32)": { + "notice": "Returns the name associated with an ENS node, for reverse records. Defined in EIP181." + }, + "pubkey(bytes32)": { + "notice": "Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619." + }, + "setABI(bytes32,uint256,bytes)": { + "notice": "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." + }, + "setAddr(bytes32,address)": { + "notice": "Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "setContenthash(bytes32,bytes)": { + "notice": "Sets the contenthash associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "setDNSRecords(bytes32,bytes)": { + "notice": "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." + }, + "setInterface(bytes32,bytes4,address)": { + "notice": "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." + }, + "setName(bytes32,string)": { + "notice": "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." + }, + "setPubkey(bytes32,bytes32,bytes32)": { + "notice": "Sets the SECP256k1 public key associated with an ENS node." + }, + "setText(bytes32,string,string)": { + "notice": "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." + }, + "setZonehash(bytes32,bytes)": { + "notice": "setZonehash sets the hash for the zone. May only be called by the owner of that node in the ENS registry." + }, + "text(bytes32,string)": { + "notice": "Returns the text data associated with an ENS node and key." + }, + "zonehash(bytes32)": { + "notice": "zonehash obtains the hash for the zone." + } + }, + "notice": "A simple resolver anyone can use; only allows the owner of a node to set its address.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 444, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 15571, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "recordVersions", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_uint64)" + }, + { + "astId": 15665, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_abis", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))" + }, + { + "astId": 15819, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_addresses", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))" + }, + { + "astId": 16010, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_hashes", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))" + }, + { + "astId": 16100, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_zonehashes", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))" + }, + { + "astId": 16110, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_records", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))))" + }, + { + "astId": 16118, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_nameEntriesCount", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16)))" + }, + { + "astId": 16856, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_interfaces", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes4,t_address)))" + }, + { + "astId": 17048, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_names", + "offset": 0, + "slot": "9", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_string_storage))" + }, + { + "astId": 17135, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_pubkeys", + "offset": 0, + "slot": "10", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_struct(PublicKey)17128_storage))" + }, + { + "astId": 17238, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_texts", + "offset": 0, + "slot": "11", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage)))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes4": { + "encoding": "inplace", + "label": "bytes4", + "numberOfBytes": "4" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage)))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes32 => uint16))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_uint16)" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes4,t_address))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes4 => address))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes4,t_address)" + }, + "t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(string => string))", + "numberOfBytes": "32", + "value": "t_mapping(t_string_memory_ptr,t_string_storage)" + }, + "t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint16 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint16,t_bytes_storage)" + }, + "t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint256 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_bytes_storage)" + }, + "t_mapping(t_bytes32,t_string_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_bytes32,t_struct(PublicKey)17128_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct PubkeyResolver.PublicKey)", + "numberOfBytes": "32", + "value": "t_struct(PublicKey)17128_storage" + }, + "t_mapping(t_bytes32,t_uint16)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint16)", + "numberOfBytes": "32", + "value": "t_uint16" + }, + "t_mapping(t_bytes32,t_uint64)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint64)", + "numberOfBytes": "32", + "value": "t_uint64" + }, + "t_mapping(t_bytes4,t_address)": { + "encoding": "mapping", + "key": "t_bytes4", + "label": "mapping(bytes4 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_string_memory_ptr,t_string_storage)": { + "encoding": "mapping", + "key": "t_string_memory_ptr", + "label": "mapping(string => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_uint16,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint256,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_bytes_storage)" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage)))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes4,t_address)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes4,t_address))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(string => string)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_string_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => string))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_string_storage)" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_struct(PublicKey)17128_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => struct PubkeyResolver.PublicKey))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_struct(PublicKey)17128_storage)" + }, + "t_string_memory_ptr": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(PublicKey)17128_storage": { + "encoding": "inplace", + "label": "struct PubkeyResolver.PublicKey", + "members": [ + { + "astId": 17125, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "x", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 17127, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "y", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint16": { + "encoding": "inplace", + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint64": { + "encoding": "inplace", + "label": "uint64", + "numberOfBytes": "8" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/P256SHA256Algorithm.json b/solidity/dns-contracts/deployments/sepolia/P256SHA256Algorithm.json new file mode 100644 index 0000000..9f8dd13 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/P256SHA256Algorithm.json @@ -0,0 +1,82 @@ +{ + "address": "0x5C4Eb1af37a535A8E733Df47a291aAC6fC80E497", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "key", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xadc9be7cf7a7d455269dc5b215bc8e6d46e109972666f892a11fe0ee9f0ad0cd", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x5C4Eb1af37a535A8E733Df47a291aAC6fC80E497", + "transactionIndex": 59, + "gasUsed": "896222", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x503455574876450ba13901830b82805a51ac49e5c70a32596408536ddaf20079", + "transactionHash": "0xadc9be7cf7a7d455269dc5b215bc8e6d46e109972666f892a11fe0ee9f0ad0cd", + "logs": [], + "blockNumber": 4141617, + "cumulativeGasUsed": "11666046", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"verify(bytes,bytes,bytes)\":{\"details\":\"Verifies a signature.\",\"params\":{\"data\":\"The signed data to verify.\",\"key\":\"The public key to verify with.\",\"signature\":\"The signature to verify.\"},\"returns\":{\"_0\":\"True iff the signature is valid.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol\":\"P256SHA256Algorithm\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n */\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata signature\\n ) external view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xaf6825f9852c69f8e36540821d067b4550dd2263497af9d645309b6a0c457ba6\"},\"contracts/dnssec-oracle/algorithms/EllipticCurve.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @title EllipticCurve\\n *\\n * @author Tilman Drerup;\\n *\\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\\n *\\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\\n * (https://github.com/orbs-network/elliptic-curve-solidity)\\n *\\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\\n *\\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\\n * condition 'rs[1] > lowSmax' in validateSignature().\\n */\\ncontract EllipticCurve {\\n // Set parameters for curve.\\n uint256 constant a =\\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\\n uint256 constant b =\\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\\n uint256 constant gx =\\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\\n uint256 constant gy =\\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\\n uint256 constant p =\\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\\n uint256 constant n =\\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\\n\\n uint256 constant lowSmax =\\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\\n\\n /**\\n * @dev Inverse of u in the field of modulo m.\\n */\\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\\n unchecked {\\n if (u == 0 || u == m || m == 0) return 0;\\n if (u > m) u = u % m;\\n\\n int256 t1;\\n int256 t2 = 1;\\n uint256 r1 = m;\\n uint256 r2 = u;\\n uint256 q;\\n\\n while (r2 != 0) {\\n q = r1 / r2;\\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\\n }\\n\\n if (t1 < 0) return (m - uint256(-t1));\\n\\n return uint256(t1);\\n }\\n }\\n\\n /**\\n * @dev Transform affine coordinates into projective coordinates.\\n */\\n function toProjectivePoint(\\n uint256 x0,\\n uint256 y0\\n ) internal pure returns (uint256[3] memory P) {\\n P[2] = addmod(0, 1, p);\\n P[0] = mulmod(x0, P[2], p);\\n P[1] = mulmod(y0, P[2], p);\\n }\\n\\n /**\\n * @dev Add two points in affine coordinates and return projective point.\\n */\\n function addAndReturnProjectivePoint(\\n uint256 x1,\\n uint256 y1,\\n uint256 x2,\\n uint256 y2\\n ) internal pure returns (uint256[3] memory P) {\\n uint256 x;\\n uint256 y;\\n (x, y) = add(x1, y1, x2, y2);\\n P = toProjectivePoint(x, y);\\n }\\n\\n /**\\n * @dev Transform from projective to affine coordinates.\\n */\\n function toAffinePoint(\\n uint256 x0,\\n uint256 y0,\\n uint256 z0\\n ) internal pure returns (uint256 x1, uint256 y1) {\\n uint256 z0Inv;\\n z0Inv = inverseMod(z0, p);\\n x1 = mulmod(x0, z0Inv, p);\\n y1 = mulmod(y0, z0Inv, p);\\n }\\n\\n /**\\n * @dev Return the zero curve in projective coordinates.\\n */\\n function zeroProj()\\n internal\\n pure\\n returns (uint256 x, uint256 y, uint256 z)\\n {\\n return (0, 1, 0);\\n }\\n\\n /**\\n * @dev Return the zero curve in affine coordinates.\\n */\\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\\n return (0, 0);\\n }\\n\\n /**\\n * @dev Check if the curve is the zero curve.\\n */\\n function isZeroCurve(\\n uint256 x0,\\n uint256 y0\\n ) internal pure returns (bool isZero) {\\n if (x0 == 0 && y0 == 0) {\\n return true;\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Check if a point in affine coordinates is on the curve.\\n */\\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\\n if (0 == x || x == p || 0 == y || y == p) {\\n return false;\\n }\\n\\n uint256 LHS = mulmod(y, y, p); // y^2\\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\\n\\n if (a != 0) {\\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\\n }\\n if (b != 0) {\\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\\n }\\n\\n return LHS == RHS;\\n }\\n\\n /**\\n * @dev Double an elliptic curve point in projective coordinates. See\\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\\n */\\n function twiceProj(\\n uint256 x0,\\n uint256 y0,\\n uint256 z0\\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\\n uint256 t;\\n uint256 u;\\n uint256 v;\\n uint256 w;\\n\\n if (isZeroCurve(x0, y0)) {\\n return zeroProj();\\n }\\n\\n u = mulmod(y0, z0, p);\\n u = mulmod(u, 2, p);\\n\\n v = mulmod(u, x0, p);\\n v = mulmod(v, y0, p);\\n v = mulmod(v, 2, p);\\n\\n x0 = mulmod(x0, x0, p);\\n t = mulmod(x0, 3, p);\\n\\n z0 = mulmod(z0, z0, p);\\n z0 = mulmod(z0, a, p);\\n t = addmod(t, z0, p);\\n\\n w = mulmod(t, t, p);\\n x0 = mulmod(2, v, p);\\n w = addmod(w, p - x0, p);\\n\\n x0 = addmod(v, p - w, p);\\n x0 = mulmod(t, x0, p);\\n y0 = mulmod(y0, u, p);\\n y0 = mulmod(y0, y0, p);\\n y0 = mulmod(2, y0, p);\\n y1 = addmod(x0, p - y0, p);\\n\\n x1 = mulmod(u, w, p);\\n\\n z1 = mulmod(u, u, p);\\n z1 = mulmod(z1, u, p);\\n }\\n\\n /**\\n * @dev Add two elliptic curve points in projective coordinates. See\\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\\n */\\n function addProj(\\n uint256 x0,\\n uint256 y0,\\n uint256 z0,\\n uint256 x1,\\n uint256 y1,\\n uint256 z1\\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\\n uint256 t0;\\n uint256 t1;\\n uint256 u0;\\n uint256 u1;\\n\\n if (isZeroCurve(x0, y0)) {\\n return (x1, y1, z1);\\n } else if (isZeroCurve(x1, y1)) {\\n return (x0, y0, z0);\\n }\\n\\n t0 = mulmod(y0, z1, p);\\n t1 = mulmod(y1, z0, p);\\n\\n u0 = mulmod(x0, z1, p);\\n u1 = mulmod(x1, z0, p);\\n\\n if (u0 == u1) {\\n if (t0 == t1) {\\n return twiceProj(x0, y0, z0);\\n } else {\\n return zeroProj();\\n }\\n }\\n\\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\\n }\\n\\n /**\\n * @dev Helper function that splits addProj to avoid too many local variables.\\n */\\n function addProj2(\\n uint256 v,\\n uint256 u0,\\n uint256 u1,\\n uint256 t1,\\n uint256 t0\\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\\n uint256 u;\\n uint256 u2;\\n uint256 u3;\\n uint256 w;\\n uint256 t;\\n\\n t = addmod(t0, p - t1, p);\\n u = addmod(u0, p - u1, p);\\n u2 = mulmod(u, u, p);\\n\\n w = mulmod(t, t, p);\\n w = mulmod(w, v, p);\\n u1 = addmod(u1, u0, p);\\n u1 = mulmod(u1, u2, p);\\n w = addmod(w, p - u1, p);\\n\\n x2 = mulmod(u, w, p);\\n\\n u3 = mulmod(u2, u, p);\\n u0 = mulmod(u0, u2, p);\\n u0 = addmod(u0, p - w, p);\\n t = mulmod(t, u0, p);\\n t0 = mulmod(t0, u3, p);\\n\\n y2 = addmod(t, p - t0, p);\\n\\n z2 = mulmod(u3, v, p);\\n }\\n\\n /**\\n * @dev Add two elliptic curve points in affine coordinates.\\n */\\n function add(\\n uint256 x0,\\n uint256 y0,\\n uint256 x1,\\n uint256 y1\\n ) internal pure returns (uint256, uint256) {\\n uint256 z0;\\n\\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\\n\\n return toAffinePoint(x0, y0, z0);\\n }\\n\\n /**\\n * @dev Double an elliptic curve point in affine coordinates.\\n */\\n function twice(\\n uint256 x0,\\n uint256 y0\\n ) internal pure returns (uint256, uint256) {\\n uint256 z0;\\n\\n (x0, y0, z0) = twiceProj(x0, y0, 1);\\n\\n return toAffinePoint(x0, y0, z0);\\n }\\n\\n /**\\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\\n */\\n function multiplyPowerBase2(\\n uint256 x0,\\n uint256 y0,\\n uint256 exp\\n ) internal pure returns (uint256, uint256) {\\n uint256 base2X = x0;\\n uint256 base2Y = y0;\\n uint256 base2Z = 1;\\n\\n for (uint256 i = 0; i < exp; i++) {\\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\\n }\\n\\n return toAffinePoint(base2X, base2Y, base2Z);\\n }\\n\\n /**\\n * @dev Multiply an elliptic curve point by a scalar.\\n */\\n function multiplyScalar(\\n uint256 x0,\\n uint256 y0,\\n uint256 scalar\\n ) internal pure returns (uint256 x1, uint256 y1) {\\n if (scalar == 0) {\\n return zeroAffine();\\n } else if (scalar == 1) {\\n return (x0, y0);\\n } else if (scalar == 2) {\\n return twice(x0, y0);\\n }\\n\\n uint256 base2X = x0;\\n uint256 base2Y = y0;\\n uint256 base2Z = 1;\\n uint256 z1 = 1;\\n x1 = x0;\\n y1 = y0;\\n\\n if (scalar % 2 == 0) {\\n x1 = y1 = 0;\\n }\\n\\n scalar = scalar >> 1;\\n\\n while (scalar > 0) {\\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\\n\\n if (scalar % 2 == 1) {\\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\\n }\\n\\n scalar = scalar >> 1;\\n }\\n\\n return toAffinePoint(x1, y1, z1);\\n }\\n\\n /**\\n * @dev Multiply the curve's generator point by a scalar.\\n */\\n function multipleGeneratorByScalar(\\n uint256 scalar\\n ) internal pure returns (uint256, uint256) {\\n return multiplyScalar(gx, gy, scalar);\\n }\\n\\n /**\\n * @dev Validate combination of message, signature, and public key.\\n */\\n function validateSignature(\\n bytes32 message,\\n uint256[2] memory rs,\\n uint256[2] memory Q\\n ) internal pure returns (bool) {\\n // To disambiguate between public key solutions, include comment below.\\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\\n // || rs[1] > lowSmax)\\n return false;\\n }\\n if (!isOnCurve(Q[0], Q[1])) {\\n return false;\\n }\\n\\n uint256 x1;\\n uint256 x2;\\n uint256 y1;\\n uint256 y2;\\n\\n uint256 sInv = inverseMod(rs[1], n);\\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\\n\\n if (P[2] == 0) {\\n return false;\\n }\\n\\n uint256 Px = inverseMod(P[2], p);\\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\\n\\n return Px % n == rs[0];\\n }\\n}\\n\",\"keccak256\":\"0xdee968ffbfcb9a05b7ed7845e2c55f438f5e09a80fc6024c751a1718137e1838\"},\"contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\nimport \\\"./EllipticCurve.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\n\\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\\n using BytesUtils for *;\\n\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata signature\\n ) external view override returns (bool) {\\n return\\n validateSignature(\\n sha256(data),\\n parseSignature(signature),\\n parseKey(key)\\n );\\n }\\n\\n function parseSignature(\\n bytes memory data\\n ) internal pure returns (uint256[2] memory) {\\n require(data.length == 64, \\\"Invalid p256 signature length\\\");\\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\\n }\\n\\n function parseKey(\\n bytes memory data\\n ) internal pure returns (uint256[2] memory) {\\n require(data.length == 68, \\\"Invalid p256 key length\\\");\\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\\n }\\n}\\n\",\"keccak256\":\"0x406e394eb659ee8c75345b9d3795e0061de2bd6567dd8035e76a19588850f0ea\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610f41806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e366004610dd4565b610057565b604051901515815260200160405180910390f35b60006101316002868660405161006e929190610e6e565b602060405180830381855afa15801561008b573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906100ae9190610e7e565b6100ed85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061013c92505050565b61012c8a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101cb92505050565b61024a565b979650505050505050565b610144610d56565b815160401461019a5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642070323536207369676e6174757265206c656e67746800000060448201526064015b60405180910390fd5b60408051808201909152806101b0846000610445565b81526020908101906101c3908590610445565b905292915050565b6101d3610d56565b81516044146102245760405162461bcd60e51b815260206004820152601760248201527f496e76616c69642070323536206b6579206c656e6774680000000000000000006044820152606401610191565b604080518082019091528061023a846004610445565b81526020016101c3846024610445565b8151600090158061027c575082517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc63255111155b8061028957506020830151155b156102965750600061043e565b815160208301516102a79190610469565b6102b35750600061043e565b6000808080806102ea88600160200201517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551610565565b905061035a7f6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c2967f4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f57fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551848d096105ff565b885160208a01518b5193985091955061039a929091907fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551908590096105ff565b909450915060006103ad868587866106cf565b60408101519091506000036103cb576000965050505050505061043e565b60006103ec8260026020020151600160601b63ffffffff60c01b0319610565565b9050600160601b63ffffffff60c01b0319808283098351098a519091506104337fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc63255183610ead565b149750505050505050505b9392505050565b8151600090610455836020610ee5565b111561046057600080fd5b50016020015190565b60008215806104855750600160601b63ffffffff60c01b031983145b8061048e575081155b806104a65750600160601b63ffffffff60c01b031982145b156104b35750600061055f565b6000600160601b63ffffffff60c01b031983840990506000600160601b63ffffffff60c01b031985600160601b63ffffffff60c01b0319878809099050600160601b63ffffffff60c01b0319807fffffffff00000001000000000000000000000000fffffffffffffffffffffffc870982089050600160601b63ffffffff60c01b03197f5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b820890501490505b92915050565b600082158061057357508183145b8061057c575081155b156105895750600061055f565b818311156105a4578183816105a0576105a0610e97565b0692505b600060018385835b81156105db578183816105c1576105c1610e97565b9495940485810290940393919283830290039190506105ac565b60008512156105f357505050908301915061055f9050565b50929695505050505050565b60008082600003610617576000805b915091506106c7565b826001036106295750839050826106c7565b8260020361063b5761060e85856106f5565b50839050828181600180610650600288610ead565b60000361065f57600094508495505b600187901c96505b86156106b357610678848484610725565b9195509350915061068a600288610ead565b6001036106a75761069f848484898986610983565b919750955090505b600187901c9650610667565b6106be868683610a88565b95509550505050505b935093915050565b6106d7610d74565b6000806106e687878787610ad8565b90925090506101318282610b0d565b600080600061070685856001610725565b91965094509050610718858583610a88565b92509250505b9250929050565b600080600080600080600061073a8a8a610b66565b156107535760006001819650965096505050505061097a565b600160601b63ffffffff60c01b0319888a099250600160601b63ffffffff60c01b0319600284099250600160601b63ffffffff60c01b03198a84099150600160601b63ffffffff60c01b03198983099150600160601b63ffffffff60c01b0319600283099150600160601b63ffffffff60c01b03198a8b099950600160601b63ffffffff60c01b031960038b099350600160601b63ffffffff60c01b03198889099750600160601b63ffffffff60c01b03197fffffffff00000001000000000000000000000000fffffffffffffffffffffffc89099750600160601b63ffffffff60c01b03198885089350600160601b63ffffffff60c01b03198485099050600160601b63ffffffff60c01b0319826002099950600160601b63ffffffff60c01b031961088e8b600160601b63ffffffff60c01b0319610ef8565b82089050600160601b63ffffffff60c01b03196108b982600160601b63ffffffff60c01b0319610ef8565b83089950600160601b63ffffffff60c01b03198a85099950600160601b63ffffffff60c01b0319838a099850600160601b63ffffffff60c01b0319898a099850600160601b63ffffffff60c01b0319896002099850600160601b63ffffffff60c01b03196109358a600160601b63ffffffff60c01b0319610ef8565b8b089550600160601b63ffffffff60c01b03198184099650600160601b63ffffffff60c01b03198384099450600160601b63ffffffff60c01b03198386099450505050505b93509350939050565b60008060008060008060006109988d8d610b66565b156109af5789898996509650965050505050610a7c565b6109b98a8a610b66565b156109d0578c8c8c96509650965050505050610a7c565b600160601b63ffffffff60c01b0319888d099350600160601b63ffffffff60c01b03198b8a099250600160601b63ffffffff60c01b0319888e099150600160601b63ffffffff60c01b03198b8b099050808203610a5257828403610a4857610a398d8d8d610725565b96509650965050505050610a7c565b6000600181610a39565b610a70600160601b63ffffffff60c01b0319898d0983838688610b8a565b91985096509450505050505b96509650969350505050565b6000806000610aa584600160601b63ffffffff60c01b0319610565565b9050600160601b63ffffffff60c01b03198187099250600160601b63ffffffff60c01b0319818609915050935093915050565b6000806000610aed8787600188886001610983565b91985096509050610aff878783610a88565b925092505094509492505050565b610b15610d74565b600160601b63ffffffff60c01b0319600160000860408201819052600160601b63ffffffff60c01b031990840981526040810151600160601b63ffffffff60c01b0319908309602082015292915050565b600082158015610b74575081155b15610b815750600161055f565b50600092915050565b600080808080808080600160601b63ffffffff60c01b0319610bba8b600160601b63ffffffff60c01b0319610ef8565b8a089050600160601b63ffffffff60c01b0319610be58c600160601b63ffffffff60c01b0319610ef8565b8d089450600160601b63ffffffff60c01b03198586099350600160601b63ffffffff60c01b03198182099150600160601b63ffffffff60c01b03198d83099150600160601b63ffffffff60c01b03198c8c089a50600160601b63ffffffff60c01b0319848c099a50600160601b63ffffffff60c01b0319610c748c600160601b63ffffffff60c01b0319610ef8565b83089150600160601b63ffffffff60c01b03198286099750600160601b63ffffffff60c01b03198585099250600160601b63ffffffff60c01b0319848d099b50600160601b63ffffffff60c01b0319610cdb83600160601b63ffffffff60c01b0319610ef8565b8d089b50600160601b63ffffffff60c01b03198c82099050600160601b63ffffffff60c01b0319838a099850600160601b63ffffffff60c01b0319610d2e8a600160601b63ffffffff60c01b0319610ef8565b82089650600160601b63ffffffff60c01b03198d840995505050505050955095509592505050565b60405180604001604052806002906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60008083601f840112610da457600080fd5b50813567ffffffffffffffff811115610dbc57600080fd5b60208301915083602082850101111561071e57600080fd5b60008060008060008060608789031215610ded57600080fd5b863567ffffffffffffffff80821115610e0557600080fd5b610e118a838b01610d92565b90985096506020890135915080821115610e2a57600080fd5b610e368a838b01610d92565b90965094506040890135915080821115610e4f57600080fd5b50610e5c89828a01610d92565b979a9699509497509295939492505050565b8183823760009101908152919050565b600060208284031215610e9057600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b600082610eca57634e487b7160e01b600052601260045260246000fd5b500690565b634e487b7160e01b600052601160045260246000fd5b8082018082111561055f5761055f610ecf565b8181038181111561055f5761055f610ecf56fea26469706673582212200a7cdc61343825b33e51ff653c60245b511afc3bf209bfd7831b5eded2744b1c64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e366004610dd4565b610057565b604051901515815260200160405180910390f35b60006101316002868660405161006e929190610e6e565b602060405180830381855afa15801561008b573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906100ae9190610e7e565b6100ed85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061013c92505050565b61012c8a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101cb92505050565b61024a565b979650505050505050565b610144610d56565b815160401461019a5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642070323536207369676e6174757265206c656e67746800000060448201526064015b60405180910390fd5b60408051808201909152806101b0846000610445565b81526020908101906101c3908590610445565b905292915050565b6101d3610d56565b81516044146102245760405162461bcd60e51b815260206004820152601760248201527f496e76616c69642070323536206b6579206c656e6774680000000000000000006044820152606401610191565b604080518082019091528061023a846004610445565b81526020016101c3846024610445565b8151600090158061027c575082517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc63255111155b8061028957506020830151155b156102965750600061043e565b815160208301516102a79190610469565b6102b35750600061043e565b6000808080806102ea88600160200201517fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551610565565b905061035a7f6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c2967f4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f57fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551848d096105ff565b885160208a01518b5193985091955061039a929091907fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551908590096105ff565b909450915060006103ad868587866106cf565b60408101519091506000036103cb576000965050505050505061043e565b60006103ec8260026020020151600160601b63ffffffff60c01b0319610565565b9050600160601b63ffffffff60c01b0319808283098351098a519091506104337fffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc63255183610ead565b149750505050505050505b9392505050565b8151600090610455836020610ee5565b111561046057600080fd5b50016020015190565b60008215806104855750600160601b63ffffffff60c01b031983145b8061048e575081155b806104a65750600160601b63ffffffff60c01b031982145b156104b35750600061055f565b6000600160601b63ffffffff60c01b031983840990506000600160601b63ffffffff60c01b031985600160601b63ffffffff60c01b0319878809099050600160601b63ffffffff60c01b0319807fffffffff00000001000000000000000000000000fffffffffffffffffffffffc870982089050600160601b63ffffffff60c01b03197f5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b820890501490505b92915050565b600082158061057357508183145b8061057c575081155b156105895750600061055f565b818311156105a4578183816105a0576105a0610e97565b0692505b600060018385835b81156105db578183816105c1576105c1610e97565b9495940485810290940393919283830290039190506105ac565b60008512156105f357505050908301915061055f9050565b50929695505050505050565b60008082600003610617576000805b915091506106c7565b826001036106295750839050826106c7565b8260020361063b5761060e85856106f5565b50839050828181600180610650600288610ead565b60000361065f57600094508495505b600187901c96505b86156106b357610678848484610725565b9195509350915061068a600288610ead565b6001036106a75761069f848484898986610983565b919750955090505b600187901c9650610667565b6106be868683610a88565b95509550505050505b935093915050565b6106d7610d74565b6000806106e687878787610ad8565b90925090506101318282610b0d565b600080600061070685856001610725565b91965094509050610718858583610a88565b92509250505b9250929050565b600080600080600080600061073a8a8a610b66565b156107535760006001819650965096505050505061097a565b600160601b63ffffffff60c01b0319888a099250600160601b63ffffffff60c01b0319600284099250600160601b63ffffffff60c01b03198a84099150600160601b63ffffffff60c01b03198983099150600160601b63ffffffff60c01b0319600283099150600160601b63ffffffff60c01b03198a8b099950600160601b63ffffffff60c01b031960038b099350600160601b63ffffffff60c01b03198889099750600160601b63ffffffff60c01b03197fffffffff00000001000000000000000000000000fffffffffffffffffffffffc89099750600160601b63ffffffff60c01b03198885089350600160601b63ffffffff60c01b03198485099050600160601b63ffffffff60c01b0319826002099950600160601b63ffffffff60c01b031961088e8b600160601b63ffffffff60c01b0319610ef8565b82089050600160601b63ffffffff60c01b03196108b982600160601b63ffffffff60c01b0319610ef8565b83089950600160601b63ffffffff60c01b03198a85099950600160601b63ffffffff60c01b0319838a099850600160601b63ffffffff60c01b0319898a099850600160601b63ffffffff60c01b0319896002099850600160601b63ffffffff60c01b03196109358a600160601b63ffffffff60c01b0319610ef8565b8b089550600160601b63ffffffff60c01b03198184099650600160601b63ffffffff60c01b03198384099450600160601b63ffffffff60c01b03198386099450505050505b93509350939050565b60008060008060008060006109988d8d610b66565b156109af5789898996509650965050505050610a7c565b6109b98a8a610b66565b156109d0578c8c8c96509650965050505050610a7c565b600160601b63ffffffff60c01b0319888d099350600160601b63ffffffff60c01b03198b8a099250600160601b63ffffffff60c01b0319888e099150600160601b63ffffffff60c01b03198b8b099050808203610a5257828403610a4857610a398d8d8d610725565b96509650965050505050610a7c565b6000600181610a39565b610a70600160601b63ffffffff60c01b0319898d0983838688610b8a565b91985096509450505050505b96509650969350505050565b6000806000610aa584600160601b63ffffffff60c01b0319610565565b9050600160601b63ffffffff60c01b03198187099250600160601b63ffffffff60c01b0319818609915050935093915050565b6000806000610aed8787600188886001610983565b91985096509050610aff878783610a88565b925092505094509492505050565b610b15610d74565b600160601b63ffffffff60c01b0319600160000860408201819052600160601b63ffffffff60c01b031990840981526040810151600160601b63ffffffff60c01b0319908309602082015292915050565b600082158015610b74575081155b15610b815750600161055f565b50600092915050565b600080808080808080600160601b63ffffffff60c01b0319610bba8b600160601b63ffffffff60c01b0319610ef8565b8a089050600160601b63ffffffff60c01b0319610be58c600160601b63ffffffff60c01b0319610ef8565b8d089450600160601b63ffffffff60c01b03198586099350600160601b63ffffffff60c01b03198182099150600160601b63ffffffff60c01b03198d83099150600160601b63ffffffff60c01b03198c8c089a50600160601b63ffffffff60c01b0319848c099a50600160601b63ffffffff60c01b0319610c748c600160601b63ffffffff60c01b0319610ef8565b83089150600160601b63ffffffff60c01b03198286099750600160601b63ffffffff60c01b03198585099250600160601b63ffffffff60c01b0319848d099b50600160601b63ffffffff60c01b0319610cdb83600160601b63ffffffff60c01b0319610ef8565b8d089b50600160601b63ffffffff60c01b03198c82099050600160601b63ffffffff60c01b0319838a099850600160601b63ffffffff60c01b0319610d2e8a600160601b63ffffffff60c01b0319610ef8565b82089650600160601b63ffffffff60c01b03198d840995505050505050955095509592505050565b60405180604001604052806002906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60008083601f840112610da457600080fd5b50813567ffffffffffffffff811115610dbc57600080fd5b60208301915083602082850101111561071e57600080fd5b60008060008060008060608789031215610ded57600080fd5b863567ffffffffffffffff80821115610e0557600080fd5b610e118a838b01610d92565b90985096506020890135915080821115610e2a57600080fd5b610e368a838b01610d92565b90965094506040890135915080821115610e4f57600080fd5b50610e5c89828a01610d92565b979a9699509497509295939492505050565b8183823760009101908152919050565b600060208284031215610e9057600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b600082610eca57634e487b7160e01b600052601260045260246000fd5b500690565b634e487b7160e01b600052601160045260246000fd5b8082018082111561055f5761055f610ecf565b8181038181111561055f5761055f610ecf56fea26469706673582212200a7cdc61343825b33e51ff653c60245b511afc3bf209bfd7831b5eded2744b1c64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "verify(bytes,bytes,bytes)": { + "details": "Verifies a signature.", + "params": { + "data": "The signed data to verify.", + "key": "The public key to verify with.", + "signature": "The signature to verify." + }, + "returns": { + "_0": "True iff the signature is valid." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/PublicResolver.json b/solidity/dns-contracts/deployments/sepolia/PublicResolver.json new file mode 100644 index 0000000..07fa1e4 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/PublicResolver.json @@ -0,0 +1,1676 @@ +{ + "address": "0x8FADE66B79cC9f707aB26799354482EB93a5B7dD", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract INameWrapper", + "name": "wrapperAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_trustedETHController", + "type": "address" + }, + { + "internalType": "address", + "name": "_trustedReverseRegistrar", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + } + ], + "name": "ABIChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "AddrChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "Approved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "ContenthashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "record", + "type": "bytes" + } + ], + "name": "DNSRecordChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "DNSRecordDeleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "lastzonehash", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "zonehash", + "type": "bytes" + } + ], + "name": "DNSZonehashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "InterfaceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "PubkeyChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "string", + "name": "indexedKey", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "TextChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "newVersion", + "type": "uint64" + } + ], + "name": "VersionChanged", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentTypes", + "type": "uint256" + } + ], + "name": "ABI", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "clearRecords", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "contenthash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "dnsRecord", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + } + ], + "name": "hasDNSRecords", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "interfaceImplementer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "delegate", + "type": "address" + } + ], + "name": "isApprovedFor", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "nodehash", + "type": "bytes32" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicallWithNodeCheck", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "pubkey", + "outputs": [ + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "recordVersions", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setABI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "a", + "type": "bytes" + } + ], + "name": "setAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "setAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setContenthash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setDNSRecords", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "setInterface", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "newName", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "setPubkey", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "setText", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setZonehash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "text", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "zonehash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xf613ca298ad5405e61f8f0e52e550e3b99fb120c8cb762bc2acabdca0a1d9643", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x8FADE66B79cC9f707aB26799354482EB93a5B7dD", + "transactionIndex": 40, + "gasUsed": "2764151", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000004080000000000000000000000001000010000000000000000000000000000000000000000000008000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000010200000000000000000000000000000040000000018000000000000000000000000008000040000000000000000000000000000020000005000000000000000000100000000000000000000000400000000000020000100000000200000001000000000080000000000", + "blockHash": "0x574928ca607e35eb33265beb0b585f66f05e6f8f8ceb4329a1e17f89d1d8fd89", + "transactionHash": "0xf613ca298ad5405e61f8f0e52e550e3b99fb120c8cb762bc2acabdca0a1d9643", + "logs": [ + { + "transactionIndex": 40, + "blockNumber": 3790251, + "transactionHash": "0xf613ca298ad5405e61f8f0e52e550e3b99fb120c8cb762bc2acabdca0a1d9643", + "address": "0xA0a1AbcDAe1a2a4A2EF8e9113Ff0e02DD81DC0C6", + "topics": [ + "0x6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e92", + "0x0000000000000000000000008fade66b79cc9f707ab26799354482eb93a5b7dd", + "0x98dd6c4977da46b36248a3187e784448ad54166b4b5ee41160f52f31e87c51a5" + ], + "data": "0x", + "logIndex": 95, + "blockHash": "0x574928ca607e35eb33265beb0b585f66f05e6f8f8ceb4329a1e17f89d1d8fd89" + }, + { + "transactionIndex": 40, + "blockNumber": 3790251, + "transactionHash": "0xf613ca298ad5405e61f8f0e52e550e3b99fb120c8cb762bc2acabdca0a1d9643", + "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "topics": [ + "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", + "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2", + "0xbbcf857a065936fbc59ed33e4bc898ed6a35991ec8a87400a8e5bae21ec29e4a" + ], + "data": "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8", + "logIndex": 96, + "blockHash": "0x574928ca607e35eb33265beb0b585f66f05e6f8f8ceb4329a1e17f89d1d8fd89" + } + ], + "blockNumber": 3790251, + "cumulativeGasUsed": "8834286", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0x0635513f179D50A207757E05759CbD106d7dFcE8", + "0xFED6a969AaA60E4961FCD3EBF1A2e8913ac65B72", + "0xA0a1AbcDAe1a2a4A2EF8e9113Ff0e02DD81DC0C6" + ], + "numDeployments": 1, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract INameWrapper\",\"name\":\"wrapperAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_trustedETHController\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_trustedReverseRegistrar\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"}],\"name\":\"ABIChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"AddrChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"newAddress\",\"type\":\"bytes\"}],\"name\":\"AddressChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"Approved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"ContenthashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"record\",\"type\":\"bytes\"}],\"name\":\"DNSRecordChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"DNSRecordDeleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"lastzonehash\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"zonehash\",\"type\":\"bytes\"}],\"name\":\"DNSZonehashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"InterfaceChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NameChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"PubkeyChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"indexedKey\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"TextChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"newVersion\",\"type\":\"uint64\"}],\"name\":\"VersionChanged\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentTypes\",\"type\":\"uint256\"}],\"name\":\"ABI\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"clearRecords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"contenthash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"dnsRecord\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"hasDNSRecords\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"interfaceImplementer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"}],\"name\":\"isApprovedFor\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nodehash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicallWithNodeCheck\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"pubkey\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"recordVersions\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setABI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"a\",\"type\":\"bytes\"}],\"name\":\"setAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"setAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setContenthash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setDNSRecords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"setInterface\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"newName\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"setPubkey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"setText\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setZonehash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"}],\"name\":\"text\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"zonehash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"ABI(bytes32,uint256)\":{\"params\":{\"contentTypes\":\"A bitwise OR of the ABI formats accepted by the caller.\",\"node\":\"The ENS node to query\"},\"returns\":{\"_0\":\"contentType The content type of the return value\",\"_1\":\"data The ABI data\"}},\"addr(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated address.\"}},\"approve(bytes32,address,bool)\":{\"details\":\"Approve a delegate to be able to updated records on a node.\"},\"clearRecords(bytes32)\":{\"params\":{\"node\":\"The node to update.\"}},\"contenthash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated contenthash.\"}},\"dnsRecord(bytes32,bytes32,uint16)\":{\"params\":{\"name\":\"the keccak-256 hash of the fully-qualified name for which to fetch the record\",\"node\":\"the namehash of the node for which to fetch the record\",\"resource\":\"the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\"},\"returns\":{\"_0\":\"the DNS record in wire format if present, otherwise empty\"}},\"hasDNSRecords(bytes32,bytes32)\":{\"params\":{\"name\":\"the namehash of the node for which to check the records\",\"node\":\"the namehash of the node for which to check the records\"}},\"interfaceImplementer(bytes32,bytes4)\":{\"params\":{\"interfaceID\":\"The EIP 165 interface ID to check for.\",\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The address that implements this interface, or 0 if the interface is unsupported.\"}},\"isApprovedFor(address,bytes32,address)\":{\"details\":\"Check to see if the delegate has been approved by the owner for the node.\"},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC1155-isApprovedForAll}.\"},\"name(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated name.\"}},\"pubkey(bytes32)\":{\"params\":{\"node\":\"The ENS node to query\"},\"returns\":{\"x\":\"The X coordinate of the curve point for the public key.\",\"y\":\"The Y coordinate of the curve point for the public key.\"}},\"setABI(bytes32,uint256,bytes)\":{\"params\":{\"contentType\":\"The content type of the ABI\",\"data\":\"The ABI data.\",\"node\":\"The node to update.\"}},\"setAddr(bytes32,address)\":{\"params\":{\"a\":\"The address to set.\",\"node\":\"The node to update.\"}},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC1155-setApprovalForAll}.\"},\"setContenthash(bytes32,bytes)\":{\"params\":{\"hash\":\"The contenthash to set\",\"node\":\"The node to update.\"}},\"setDNSRecords(bytes32,bytes)\":{\"params\":{\"data\":\"the DNS wire format records to set\",\"node\":\"the namehash of the node for which to set the records\"}},\"setInterface(bytes32,bytes4,address)\":{\"params\":{\"implementer\":\"The address of a contract that implements this interface for this node.\",\"interfaceID\":\"The EIP 165 interface ID.\",\"node\":\"The node to update.\"}},\"setName(bytes32,string)\":{\"params\":{\"node\":\"The node to update.\"}},\"setPubkey(bytes32,bytes32,bytes32)\":{\"params\":{\"node\":\"The ENS node to query\",\"x\":\"the X coordinate of the curve point for the public key.\",\"y\":\"the Y coordinate of the curve point for the public key.\"}},\"setText(bytes32,string,string)\":{\"params\":{\"key\":\"The key to set.\",\"node\":\"The node to update.\",\"value\":\"The text data value to set.\"}},\"setZonehash(bytes32,bytes)\":{\"params\":{\"hash\":\"The zonehash to set\",\"node\":\"The node to update.\"}},\"text(bytes32,string)\":{\"params\":{\"key\":\"The text data key to query.\",\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated text data.\"}},\"zonehash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated contenthash.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"ABI(bytes32,uint256)\":{\"notice\":\"Returns the ABI associated with an ENS node. Defined in EIP205.\"},\"addr(bytes32)\":{\"notice\":\"Returns the address associated with an ENS node.\"},\"clearRecords(bytes32)\":{\"notice\":\"Increments the record version associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"contenthash(bytes32)\":{\"notice\":\"Returns the contenthash associated with an ENS node.\"},\"dnsRecord(bytes32,bytes32,uint16)\":{\"notice\":\"Obtain a DNS record.\"},\"hasDNSRecords(bytes32,bytes32)\":{\"notice\":\"Check if a given node has records.\"},\"interfaceImplementer(bytes32,bytes4)\":{\"notice\":\"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.\"},\"name(bytes32)\":{\"notice\":\"Returns the name associated with an ENS node, for reverse records. Defined in EIP181.\"},\"pubkey(bytes32)\":{\"notice\":\"Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619.\"},\"setABI(bytes32,uint256,bytes)\":{\"notice\":\"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.\"},\"setAddr(bytes32,address)\":{\"notice\":\"Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setContenthash(bytes32,bytes)\":{\"notice\":\"Sets the contenthash associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setDNSRecords(bytes32,bytes)\":{\"notice\":\"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.\"},\"setInterface(bytes32,bytes4,address)\":{\"notice\":\"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.\"},\"setName(bytes32,string)\":{\"notice\":\"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.\"},\"setPubkey(bytes32,bytes32,bytes32)\":{\"notice\":\"Sets the SECP256k1 public key associated with an ENS node.\"},\"setText(bytes32,string,string)\":{\"notice\":\"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.\"},\"setZonehash(bytes32,bytes)\":{\"notice\":\"setZonehash sets the hash for the zone. May only be called by the owner of that node in the ENS registry.\"},\"text(bytes32,string)\":{\"notice\":\"Returns the text data associated with an ENS node and key.\"},\"zonehash(bytes32)\":{\"notice\":\"zonehash obtains the hash for the zone.\"}},\"notice\":\"A simple resolver anyone can use; only allows the owner of a node to set its address.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/resolvers/PublicResolver.sol\":\"PublicResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-2-Clause\\npragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for appending to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n let fpm := add(32, add(ptr, capacity))\\n if lt(fpm, ptr) {\\n revert(0, 0)\\n }\\n mstore(0x40, fpm)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n uint off = buf.buf.length;\\n uint newCapacity = off + len;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(newCapacity, buflen) {\\n mstore(bufptr, newCapacity)\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return append(buf, data, data.length);\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint offPlusOne = off + 1;\\n if (off >= buf.capacity) {\\n resize(buf, offPlusOne * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if gt(offPlusOne, mload(bufptr)) {\\n mstore(bufptr, offPlusOne)\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return append(buf, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return append(buf, data, 32);\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n return buf;\\n }\\n}\\n\",\"keccak256\":\"0xd6dd3b0b327288f8e1b711a609f4040fea602e2ad4bba9febdf2f33b4e56eb0c\",\"license\":\"BSD-2-Clause\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6392f2cfe3a5ee802227fe7a2dfd47096d881aec89bddd214b35c5b46d3cd941\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xab28a56179c1db258c9bf5235b382698cb650debecb51b23d12be9e241374b68\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n */\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint256 labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes memory ret) {\\n uint256 len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint256 labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint256 constant RRSIG_TYPE = 0;\\n uint256 constant RRSIG_ALGORITHM = 2;\\n uint256 constant RRSIG_LABELS = 3;\\n uint256 constant RRSIG_TTL = 4;\\n uint256 constant RRSIG_EXPIRATION = 8;\\n uint256 constant RRSIG_INCEPTION = 12;\\n uint256 constant RRSIG_KEY_TAG = 16;\\n uint256 constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(\\n bytes memory data\\n ) internal pure returns (SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(\\n RRSIG_SIGNER_NAME + self.signerName.length,\\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\\n );\\n }\\n\\n function rrs(\\n SignedSet memory rrset\\n ) internal pure returns (RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint256 offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint256 rdataOffset;\\n uint256 nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns (bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint256 rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.offset,\\n nameLength(iter.data, iter.offset)\\n );\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(\\n RRIterator memory iter\\n ) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.rdataOffset,\\n iter.nextOffset - iter.rdataOffset\\n );\\n }\\n\\n uint256 constant DNSKEY_FLAGS = 0;\\n uint256 constant DNSKEY_PROTOCOL = 2;\\n uint256 constant DNSKEY_ALGORITHM = 3;\\n uint256 constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(\\n offset + DNSKEY_PUBKEY,\\n length - DNSKEY_PUBKEY\\n );\\n }\\n\\n uint256 constant DS_KEY_TAG = 0;\\n uint256 constant DS_ALGORITHM = 2;\\n uint256 constant DS_DIGEST_TYPE = 3;\\n uint256 constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n function isSubdomainOf(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n uint256 off = 0;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n while (counts > othercounts) {\\n off = progress(self, off);\\n counts--;\\n }\\n\\n return self.equals(off, other, 0);\\n }\\n\\n function compareNames(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint256 off;\\n uint256 otheroff;\\n uint256 prevoff;\\n uint256 otherprevoff;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if (otheroff == 0) {\\n return 1;\\n }\\n\\n return\\n self.compare(\\n prevoff + 1,\\n self.readUint8(prevoff),\\n other,\\n otherprevoff + 1,\\n other.readUint8(otherprevoff)\\n );\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(\\n uint32 i1,\\n uint32 i2\\n ) internal pure returns (bool) {\\n unchecked {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n }\\n\\n function progress(\\n bytes memory body,\\n uint256 off\\n ) internal pure returns (uint256) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint256 ac1;\\n uint256 ac2;\\n for (uint256 i = 0; i < data.length + 31; i += 32) {\\n uint256 word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if (i + 32 > data.length) {\\n uint256 unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 +=\\n (word &\\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\\n 8;\\n ac2 += (word &\\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 =\\n (ac1 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac1 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac2 =\\n (ac2 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac2 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 =\\n (ac1 &\\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\\n 32);\\n ac1 =\\n (ac1 &\\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\\n 64);\\n ac1 =\\n (ac1 &\\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\\n (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4dd68a6efd7c38f6b0e95ca0c056ecb74f88583da650b1a8639e6e78be36fede\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/resolvers/IMulticallable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IMulticallable {\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n}\\n\",\"keccak256\":\"0x0334202e20bb11995997083d05963f5e8e7ed6194cba494e7f9371ab7bf4e2c3\",\"license\":\"MIT\"},\"contracts/resolvers/Multicallable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"./IMulticallable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nabstract contract Multicallable is IMulticallable, ERC165 {\\n function _multicall(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) internal returns (bytes[] memory results) {\\n results = new bytes[](data.length);\\n for (uint256 i = 0; i < data.length; i++) {\\n if (nodehash != bytes32(0)) {\\n bytes32 txNamehash = bytes32(data[i][4:36]);\\n require(\\n txNamehash == nodehash,\\n \\\"multicall: All records must have a matching namehash\\\"\\n );\\n }\\n (bool success, bytes memory result) = address(this).delegatecall(\\n data[i]\\n );\\n require(success);\\n results[i] = result;\\n }\\n return results;\\n }\\n\\n // This function provides an extra security check when called\\n // from priviledged contracts (such as EthRegistrarController)\\n // that can set records on behalf of the node owners\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results) {\\n return _multicall(nodehash, data);\\n }\\n\\n function multicall(\\n bytes[] calldata data\\n ) public override returns (bytes[] memory results) {\\n return _multicall(bytes32(0), data);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IMulticallable).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x1063a9dd3b94ba304624d5ec6deb43c1916640758ae970eece4d4e3ef8b2fcb1\",\"license\":\"MIT\"},\"contracts/resolvers/PublicResolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./profiles/ABIResolver.sol\\\";\\nimport \\\"./profiles/AddrResolver.sol\\\";\\nimport \\\"./profiles/ContentHashResolver.sol\\\";\\nimport \\\"./profiles/DNSResolver.sol\\\";\\nimport \\\"./profiles/InterfaceResolver.sol\\\";\\nimport \\\"./profiles/NameResolver.sol\\\";\\nimport \\\"./profiles/PubkeyResolver.sol\\\";\\nimport \\\"./profiles/TextResolver.sol\\\";\\nimport \\\"./Multicallable.sol\\\";\\nimport {ReverseClaimer} from \\\"../reverseRegistrar/ReverseClaimer.sol\\\";\\nimport {INameWrapper} from \\\"../wrapper/INameWrapper.sol\\\";\\n\\n/**\\n * A simple resolver anyone can use; only allows the owner of a node to set its\\n * address.\\n */\\ncontract PublicResolver is\\n Multicallable,\\n ABIResolver,\\n AddrResolver,\\n ContentHashResolver,\\n DNSResolver,\\n InterfaceResolver,\\n NameResolver,\\n PubkeyResolver,\\n TextResolver,\\n ReverseClaimer\\n{\\n ENS immutable ens;\\n INameWrapper immutable nameWrapper;\\n address immutable trustedETHController;\\n address immutable trustedReverseRegistrar;\\n\\n /**\\n * A mapping of operators. An address that is authorised for an address\\n * may make any changes to the name that the owner could, but may not update\\n * the set of authorisations.\\n * (owner, operator) => approved\\n */\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * A mapping of delegates. A delegate that is authorised by an owner\\n * for a name may make changes to the name's resolver, but may not update\\n * the set of token approvals.\\n * (owner, name, delegate) => approved\\n */\\n mapping(address => mapping(bytes32 => mapping(address => bool)))\\n private _tokenApprovals;\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n // Logged when a delegate is approved or an approval is revoked.\\n event Approved(\\n address owner,\\n bytes32 indexed node,\\n address indexed delegate,\\n bool indexed approved\\n );\\n\\n constructor(\\n ENS _ens,\\n INameWrapper wrapperAddress,\\n address _trustedETHController,\\n address _trustedReverseRegistrar\\n ) ReverseClaimer(_ens, msg.sender) {\\n ens = _ens;\\n nameWrapper = wrapperAddress;\\n trustedETHController = _trustedETHController;\\n trustedReverseRegistrar = _trustedReverseRegistrar;\\n }\\n\\n /**\\n * @dev See {IERC1155-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) external {\\n require(\\n msg.sender != operator,\\n \\\"ERC1155: setting approval status for self\\\"\\n );\\n\\n _operatorApprovals[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC1155-isApprovedForAll}.\\n */\\n function isApprovedForAll(\\n address account,\\n address operator\\n ) public view returns (bool) {\\n return _operatorApprovals[account][operator];\\n }\\n\\n /**\\n * @dev Approve a delegate to be able to updated records on a node.\\n */\\n function approve(bytes32 node, address delegate, bool approved) external {\\n require(msg.sender != delegate, \\\"Setting delegate status for self\\\");\\n\\n _tokenApprovals[msg.sender][node][delegate] = approved;\\n emit Approved(msg.sender, node, delegate, approved);\\n }\\n\\n /**\\n * @dev Check to see if the delegate has been approved by the owner for the node.\\n */\\n function isApprovedFor(\\n address owner,\\n bytes32 node,\\n address delegate\\n ) public view returns (bool) {\\n return _tokenApprovals[owner][node][delegate];\\n }\\n\\n function isAuthorised(bytes32 node) internal view override returns (bool) {\\n if (\\n msg.sender == trustedETHController ||\\n msg.sender == trustedReverseRegistrar\\n ) {\\n return true;\\n }\\n address owner = ens.owner(node);\\n if (owner == address(nameWrapper)) {\\n owner = nameWrapper.ownerOf(uint256(node));\\n }\\n return\\n owner == msg.sender ||\\n isApprovedForAll(owner, msg.sender) ||\\n isApprovedFor(owner, node, msg.sender);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n )\\n public\\n view\\n override(\\n Multicallable,\\n ABIResolver,\\n AddrResolver,\\n ContentHashResolver,\\n DNSResolver,\\n InterfaceResolver,\\n NameResolver,\\n PubkeyResolver,\\n TextResolver\\n )\\n returns (bool)\\n {\\n return super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x24c839eb7118da8eea65d07401cc26bad0444a3e651b2cb19749c43065bd24de\",\"license\":\"MIT\"},\"contracts/resolvers/ResolverBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"./profiles/IVersionableResolver.sol\\\";\\n\\nabstract contract ResolverBase is ERC165, IVersionableResolver {\\n mapping(bytes32 => uint64) public recordVersions;\\n\\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\\n\\n modifier authorised(bytes32 node) {\\n require(isAuthorised(node));\\n _;\\n }\\n\\n /**\\n * Increments the record version associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function clearRecords(bytes32 node) public virtual authorised(node) {\\n recordVersions[node]++;\\n emit VersionChanged(node, recordVersions[node]);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IVersionableResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x893049fffd6feee06d7acef1680f6e26505bedff62a9f7a17e921c0ba2f66307\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"./IABIResolver.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\n\\nabstract contract ABIResolver is IABIResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\\n\\n /**\\n * Sets the ABI associated with an ENS node.\\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\\n * the empty string.\\n * @param node The node to update.\\n * @param contentType The content type of the ABI\\n * @param data The ABI data.\\n */\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external virtual authorised(node) {\\n // Content types must be powers of 2\\n require(((contentType - 1) & contentType) == 0);\\n\\n versionable_abis[recordVersions[node]][node][contentType] = data;\\n emit ABIChanged(node, contentType);\\n }\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view virtual override returns (uint256, bytes memory) {\\n mapping(uint256 => bytes) storage abiset = versionable_abis[\\n recordVersions[node]\\n ][node];\\n\\n for (\\n uint256 contentType = 1;\\n contentType <= contentTypes;\\n contentType <<= 1\\n ) {\\n if (\\n (contentType & contentTypes) != 0 &&\\n abiset[contentType].length > 0\\n ) {\\n return (contentType, abiset[contentType]);\\n }\\n }\\n\\n return (0, bytes(\\\"\\\"));\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IABIResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x2da96d7750786afe3be019fc6ff768e2d98a5e61d360bd92d8d7bc3c7c1dcc27\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/AddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IAddrResolver.sol\\\";\\nimport \\\"./IAddressResolver.sol\\\";\\n\\nabstract contract AddrResolver is\\n IAddrResolver,\\n IAddressResolver,\\n ResolverBase\\n{\\n uint256 private constant COIN_TYPE_ETH = 60;\\n\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\\n\\n /**\\n * Sets the address associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param a The address to set.\\n */\\n function setAddr(\\n bytes32 node,\\n address a\\n ) external virtual authorised(node) {\\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\\n }\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(\\n bytes32 node\\n ) public view virtual override returns (address payable) {\\n bytes memory a = addr(node, COIN_TYPE_ETH);\\n if (a.length == 0) {\\n return payable(0);\\n }\\n return bytesToAddress(a);\\n }\\n\\n function setAddr(\\n bytes32 node,\\n uint256 coinType,\\n bytes memory a\\n ) public virtual authorised(node) {\\n emit AddressChanged(node, coinType, a);\\n if (coinType == COIN_TYPE_ETH) {\\n emit AddrChanged(node, bytesToAddress(a));\\n }\\n versionable_addresses[recordVersions[node]][node][coinType] = a;\\n }\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) public view virtual override returns (bytes memory) {\\n return versionable_addresses[recordVersions[node]][node][coinType];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IAddrResolver).interfaceId ||\\n interfaceID == type(IAddressResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function bytesToAddress(\\n bytes memory b\\n ) internal pure returns (address payable a) {\\n require(b.length == 20);\\n assembly {\\n a := div(mload(add(b, 32)), exp(256, 12))\\n }\\n }\\n\\n function addressToBytes(address a) internal pure returns (bytes memory b) {\\n b = new bytes(20);\\n assembly {\\n mstore(add(b, 32), mul(a, exp(256, 12)))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7f6ebb3144530a02db03379f33ade869c8408eceed36dfbd751aaff198735b55\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IContentHashResolver.sol\\\";\\n\\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\\n\\n /**\\n * Sets the contenthash associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param hash The contenthash to set\\n */\\n function setContenthash(\\n bytes32 node,\\n bytes calldata hash\\n ) external virtual authorised(node) {\\n versionable_hashes[recordVersions[node]][node] = hash;\\n emit ContenthashChanged(node, hash);\\n }\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(\\n bytes32 node\\n ) external view virtual override returns (bytes memory) {\\n return versionable_hashes[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IContentHashResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xc9755bfb77985375ded880ecab5af41f2b9e8280f30d3e523fe5042ea59f93ea\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/DNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"../../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"./IDNSRecordResolver.sol\\\";\\nimport \\\"./IDNSZoneResolver.sol\\\";\\n\\nabstract contract DNSResolver is\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n ResolverBase\\n{\\n using RRUtils for *;\\n using BytesUtils for bytes;\\n\\n // Zone hashes for the domains.\\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\\n // resource containing a single zonefile.\\n // node => contenthash\\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\\n\\n // The records themselves. Stored as binary RRSETs\\n // node => version => name => resource => data\\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\\n private versionable_records;\\n\\n // Count of number of entries for a given name. Required for DNS resolvers\\n // when resolving wildcards.\\n // node => version => name => number of records\\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\\n private versionable_nameEntriesCount;\\n\\n /**\\n * Set one or more DNS records. Records are supplied in wire-format.\\n * Records with the same node/name/resource must be supplied one after the\\n * other to ensure the data is updated correctly. For example, if the data\\n * was supplied:\\n * a.example.com IN A 1.2.3.4\\n * a.example.com IN A 5.6.7.8\\n * www.example.com IN CNAME a.example.com.\\n * then this would store the two A records for a.example.com correctly as a\\n * single RRSET, however if the data was supplied:\\n * a.example.com IN A 1.2.3.4\\n * www.example.com IN CNAME a.example.com.\\n * a.example.com IN A 5.6.7.8\\n * then this would store the first A record, the CNAME, then the second A\\n * record which would overwrite the first.\\n *\\n * @param node the namehash of the node for which to set the records\\n * @param data the DNS wire format records to set\\n */\\n function setDNSRecords(\\n bytes32 node,\\n bytes calldata data\\n ) external virtual authorised(node) {\\n uint16 resource = 0;\\n uint256 offset = 0;\\n bytes memory name;\\n bytes memory value;\\n bytes32 nameHash;\\n uint64 version = recordVersions[node];\\n // Iterate over the data to add the resource records\\n for (\\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\\n !iter.done();\\n iter.next()\\n ) {\\n if (resource == 0) {\\n resource = iter.dnstype;\\n name = iter.name();\\n nameHash = keccak256(abi.encodePacked(name));\\n value = bytes(iter.rdata());\\n } else {\\n bytes memory newName = iter.name();\\n if (resource != iter.dnstype || !name.equals(newName)) {\\n setDNSRRSet(\\n node,\\n name,\\n resource,\\n data,\\n offset,\\n iter.offset - offset,\\n value.length == 0,\\n version\\n );\\n resource = iter.dnstype;\\n offset = iter.offset;\\n name = newName;\\n nameHash = keccak256(name);\\n value = bytes(iter.rdata());\\n }\\n }\\n }\\n if (name.length > 0) {\\n setDNSRRSet(\\n node,\\n name,\\n resource,\\n data,\\n offset,\\n data.length - offset,\\n value.length == 0,\\n version\\n );\\n }\\n }\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) public view virtual override returns (bytes memory) {\\n return versionable_records[recordVersions[node]][node][name][resource];\\n }\\n\\n /**\\n * Check if a given node has records.\\n * @param node the namehash of the node for which to check the records\\n * @param name the namehash of the node for which to check the records\\n */\\n function hasDNSRecords(\\n bytes32 node,\\n bytes32 name\\n ) public view virtual returns (bool) {\\n return (versionable_nameEntriesCount[recordVersions[node]][node][\\n name\\n ] != 0);\\n }\\n\\n /**\\n * setZonehash sets the hash for the zone.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param hash The zonehash to set\\n */\\n function setZonehash(\\n bytes32 node,\\n bytes calldata hash\\n ) external virtual authorised(node) {\\n uint64 currentRecordVersion = recordVersions[node];\\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\\n node\\n ];\\n versionable_zonehashes[currentRecordVersion][node] = hash;\\n emit DNSZonehashChanged(node, oldhash, hash);\\n }\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(\\n bytes32 node\\n ) external view virtual override returns (bytes memory) {\\n return versionable_zonehashes[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IDNSRecordResolver).interfaceId ||\\n interfaceID == type(IDNSZoneResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function setDNSRRSet(\\n bytes32 node,\\n bytes memory name,\\n uint16 resource,\\n bytes memory data,\\n uint256 offset,\\n uint256 size,\\n bool deleteRecord,\\n uint64 version\\n ) private {\\n bytes32 nameHash = keccak256(name);\\n bytes memory rrData = data.substring(offset, size);\\n if (deleteRecord) {\\n if (\\n versionable_records[version][node][nameHash][resource].length !=\\n 0\\n ) {\\n versionable_nameEntriesCount[version][node][nameHash]--;\\n }\\n delete (versionable_records[version][node][nameHash][resource]);\\n emit DNSRecordDeleted(node, name, resource);\\n } else {\\n if (\\n versionable_records[version][node][nameHash][resource].length ==\\n 0\\n ) {\\n versionable_nameEntriesCount[version][node][nameHash]++;\\n }\\n versionable_records[version][node][nameHash][resource] = rrData;\\n emit DNSRecordChanged(node, name, resource, rrData);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7233e4d2edca222ce6e1cdb07adf127ab52ecaea599fa5369971a7b28dbc59ac\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IVersionableResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IVersionableResolver {\\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\\n\\n function recordVersions(bytes32 node) external view returns (uint64);\\n}\\n\",\"keccak256\":\"0xd0d09596f20c57bafb2ffa8521a8c57120e9af6c6b194f9c689d4da56f91a57c\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/InterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./AddrResolver.sol\\\";\\nimport \\\"./IInterfaceResolver.sol\\\";\\n\\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\\n\\n /**\\n * Sets an interface associated with a name.\\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\\n * @param node The node to update.\\n * @param interfaceID The EIP 165 interface ID.\\n * @param implementer The address of a contract that implements this interface for this node.\\n */\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external virtual authorised(node) {\\n versionable_interfaces[recordVersions[node]][node][\\n interfaceID\\n ] = implementer;\\n emit InterfaceChanged(node, interfaceID, implementer);\\n }\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view virtual override returns (address) {\\n address implementer = versionable_interfaces[recordVersions[node]][\\n node\\n ][interfaceID];\\n if (implementer != address(0)) {\\n return implementer;\\n }\\n\\n address a = addr(node);\\n if (a == address(0)) {\\n return address(0);\\n }\\n\\n (bool success, bytes memory returnData) = a.staticcall(\\n abi.encodeWithSignature(\\n \\\"supportsInterface(bytes4)\\\",\\n type(IERC165).interfaceId\\n )\\n );\\n if (!success || returnData.length < 32 || returnData[31] == 0) {\\n // EIP 165 not supported by target\\n return address(0);\\n }\\n\\n (success, returnData) = a.staticcall(\\n abi.encodeWithSignature(\\\"supportsInterface(bytes4)\\\", interfaceID)\\n );\\n if (!success || returnData.length < 32 || returnData[31] == 0) {\\n // Specified interface not supported by target\\n return address(0);\\n }\\n\\n return a;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IInterfaceResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x820ec60183e7a49a4ee399cf4708acb776725c8e4ad275d1f316c152eace0a59\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/NameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./INameResolver.sol\\\";\\n\\nabstract contract NameResolver is INameResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\\n\\n /**\\n * Sets the name associated with an ENS node, for reverse records.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function setName(\\n bytes32 node,\\n string calldata newName\\n ) external virtual authorised(node) {\\n versionable_names[recordVersions[node]][node] = newName;\\n emit NameChanged(node, newName);\\n }\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(\\n bytes32 node\\n ) external view virtual override returns (string memory) {\\n return versionable_names[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(INameResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x52d0bbb8f9dd33fae471ef2f5f6b3118b221954e5bb7ba724885d4562e75b8e2\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/PubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IPubkeyResolver.sol\\\";\\n\\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\\n struct PublicKey {\\n bytes32 x;\\n bytes32 y;\\n }\\n\\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\\n\\n /**\\n * Sets the SECP256k1 public key associated with an ENS node.\\n * @param node The ENS node to query\\n * @param x the X coordinate of the curve point for the public key.\\n * @param y the Y coordinate of the curve point for the public key.\\n */\\n function setPubkey(\\n bytes32 node,\\n bytes32 x,\\n bytes32 y\\n ) external virtual authorised(node) {\\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\\n emit PubkeyChanged(node, x, y);\\n }\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(\\n bytes32 node\\n ) external view virtual override returns (bytes32 x, bytes32 y) {\\n uint64 currentRecordVersion = recordVersions[node];\\n return (\\n versionable_pubkeys[currentRecordVersion][node].x,\\n versionable_pubkeys[currentRecordVersion][node].y\\n );\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IPubkeyResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x1a1f10a0e40520c998a9296fc81c092c81521e05a784e9bd9ee44cc4c62c8c78\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/TextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./ITextResolver.sol\\\";\\n\\nabstract contract TextResolver is ITextResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\\n\\n /**\\n * Sets the text data associated with an ENS node and key.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param key The key to set.\\n * @param value The text data value to set.\\n */\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external virtual authorised(node) {\\n versionable_texts[recordVersions[node]][node][key] = value;\\n emit TextChanged(node, key, key, value);\\n }\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view virtual override returns (string memory) {\\n return versionable_texts[recordVersions[node]][node][key];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(ITextResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xf9bedd807add38136779d84083ac2fa4f8c92d017c9e1a72fbc9003fa5074379\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseClaimer.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\n\\ncontract ReverseClaimer {\\n bytes32 constant ADDR_REVERSE_NODE =\\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n constructor(ENS ens, address claimant) {\\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\\n ens.owner(ADDR_REVERSE_NODE)\\n );\\n reverseRegistrar.claim(claimant);\\n }\\n}\\n\",\"keccak256\":\"0x78a28627241535b595f6fff476a1fa7acc90c80684fe7784734920fc8af6fc22\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_ETH = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x70310eb67146d7290731c31841399640ac3b6a949eadc6598bc150123d185c57\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101006040523480156200001257600080fd5b50604051620032943803806200329483398101604081905262000035916200017a565b6040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152849033906000906001600160a01b038416906302571be390602401602060405180830381865afa158015620000a1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000c79190620001e2565b604051630f41a04d60e11b81526001600160a01b03848116600483015291925090821690631e83409a906024016020604051808303816000875af115801562000114573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200013a919062000209565b5050506001600160a01b039485166080525091831660a052821660c0521660e05262000223565b6001600160a01b03811681146200017757600080fd5b50565b600080600080608085870312156200019157600080fd5b84516200019e8162000161565b6020860151909450620001b18162000161565b6040860151909350620001c48162000161565b6060860151909250620001d78162000161565b939692955090935050565b600060208284031215620001f557600080fd5b8151620002028162000161565b9392505050565b6000602082840312156200021c57600080fd5b5051919050565b60805160a05160c05160e0516130306200026460003960006117d7015260006117a50152600081816118af01526119150152600061183801526130306000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c80638b95dd7111610104578063c8690233116100a2578063e32954eb11610071578063e32954eb14610504578063e59d895d14610517578063e985e9c51461052a578063f1cb7e061461056657600080fd5b8063c869023314610442578063ce3decdc1461049b578063d5fa2b00146104ae578063d700ff33146104c157600080fd5b8063a8fa5682116100de578063a8fa5682146103b8578063a9784b3e146103cb578063ac9650d81461040f578063bc1c58d11461042f57600080fd5b80638b95dd711461037f578063a22cb46514610392578063a4b91a01146103a557600080fd5b80633603d7581161017c5780635c98042b1161014b5780635c98042b14610333578063623195b014610346578063691f343114610359578063773722131461036c57600080fd5b80633603d758146102a15780633b3b57de146102b45780634cbf6ba4146102c757806359d1d43c1461031357600080fd5b8063124a319c116101b8578063124a319c1461022f5780632203ab561461025a57806329cd62ea1461027b578063304e6ade1461028e57600080fd5b806301ffc9a7146101df5780630af179d71461020757806310f13a8c1461021c575b600080fd5b6101f26101ed366004612529565b610579565b60405190151581526020015b60405180910390f35b61021a610215366004612586565b61058a565b005b61021a61022a3660046125d2565b610794565b61024261023d36600461264c565b610861565b6040516001600160a01b0390911681526020016101fe565b61026d610268366004612678565b610b0d565b6040516101fe9291906126ea565b61021a610289366004612703565b610c44565b61021a61029c366004612586565b610cdf565b61021a6102af36600461272f565b610d5b565b6102426102c236600461272f565b610dfe565b6101f26102d5366004612678565b6000828152602081815260408083205467ffffffffffffffff1683526006825280832094835293815283822092825291909152205461ffff16151590565b610326610321366004612586565b610e30565b6040516101fe9190612748565b61032661034136600461272f565b610f10565b61021a61035436600461275b565b610fcf565b61032661036736600461272f565b61106c565b61021a61037a366004612586565b6110a6565b61021a61038d3660046127c4565b611122565b61021a6103a03660046128ad565b611202565b61021a6103b33660046128d9565b6112f1565b6103266103c6366004612917565b6113be565b6101f26103d9366004612957565b6001600160a01b039283166000908152600c60209081526040808320948352938152838220929094168152925290205460ff1690565b61042261041d3660046129d3565b61140c565b6040516101fe9190612a15565b61032661043d36600461272f565b61141a565b61048661045036600461272f565b6000818152602081815260408083205467ffffffffffffffff168352600982528083209383529290522080546001909101549091565b604080519283526020830191909152016101fe565b61021a6104a9366004612586565b611454565b61021a6104bc366004612a77565b611597565b6104eb6104cf36600461272f565b60006020819052908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016101fe565b610422610512366004612aa7565b6115be565b61021a610525366004612ae6565b6115d3565b6101f2610538366004612b1b565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b610326610574366004612678565b611692565b60006105848261175a565b92915050565b8261059481611798565b61059d57600080fd5b600084815260208181526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff9091169183916106039183918d908d908190840183828082843760009201919091525092939250506119ff9050565b90505b8051516020820151101561072d578661ffff1660000361066b578060400151965061063081611a60565b9450846040516020016106439190612b49565b60405160208183030381529060405280519060200120925061066481611a81565b935061071f565b600061067682611a60565b9050816040015161ffff168861ffff1614158061069a57506106988682611a9d565b155b1561071d576106f68c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d91506106ed908290612b7b565b8b51158a611abb565b81604001519750816020015196508095508580519060200120935061071a82611a81565b94505b505b61072881611d28565b610606565b50835115610788576107888a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c925061077f91508290508f612b7b565b89511588611abb565b50505050505050505050565b8461079e81611798565b6107a757600080fd5b6000868152602081815260408083205467ffffffffffffffff168352600a8252808320898452909152908190209051849184916107e79089908990612b8e565b90815260200160405180910390209182610802929190612c26565b508484604051610813929190612b8e565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516108519493929190612d0f565b60405180910390a3505050505050565b6000828152602081815260408083205467ffffffffffffffff1683526007825280832085845282528083206001600160e01b0319851684529091528120546001600160a01b031680156108b5579050610584565b60006108c085610dfe565b90506001600160a01b0381166108db57600092505050610584565b6040516301ffc9a760e01b602482015260009081906001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516109489190612b49565b600060405180830381855afa9150503d8060008114610983576040519150601f19603f3d011682016040523d82523d6000602084013e610988565b606091505b509150915081158061099b575060208151105b806109dd575080601f815181106109b4576109b4612d41565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109ef576000945050505050610584565b6040516001600160e01b0319871660248201526001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b17905251610a5a9190612b49565b600060405180830381855afa9150503d8060008114610a95576040519150601f19603f3d011682016040523d82523d6000602084013e610a9a565b606091505b509092509050811580610aae575060208151105b80610af0575080601f81518110610ac757610ac7612d41565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610b02576000945050505050610584565b509095945050505050565b6000828152602081815260408083205467ffffffffffffffff168352600180835281842086855290925282206060915b848111610c245780851615801590610b6d575060008181526020839052604081208054610b6990612b9e565b9050115b15610c1c5780826000838152602001908152602001600020808054610b9190612b9e565b80601f0160208091040260200160405190810160405280929190818152602001828054610bbd90612b9e565b8015610c0a5780601f10610bdf57610100808354040283529160200191610c0a565b820191906000526020600020905b815481529060010190602001808311610bed57829003601f168201915b50505050509050935093505050610c3d565b60011b610b3d565b5060006040518060200160405280600081525092509250505b9250929050565b82610c4e81611798565b610c5757600080fd5b604080518082018252848152602080820185815260008881528083528481205467ffffffffffffffff1681526009835284812089825283528490209251835551600190920191909155815185815290810184905285917f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4691015b60405180910390a250505050565b82610ce981611798565b610cf257600080fd5b6000848152602081815260408083205467ffffffffffffffff168352600382528083208784529091529020610d28838583612c26565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610cd1929190612d57565b80610d6581611798565b610d6e57600080fd5b6000828152602081905260408120805467ffffffffffffffff1691610d9283612d6b565b82546101009290920a67ffffffffffffffff818102199093169183160217909155600084815260208181526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610e0c83603c611692565b90508051600003610e205750600092915050565b610e2981611e10565b9392505050565b6000838152602081815260408083205467ffffffffffffffff168352600a825280832086845290915290819020905160609190610e709085908590612b8e565b90815260200160405180910390208054610e8990612b9e565b80601f0160208091040260200160405190810160405280929190818152602001828054610eb590612b9e565b8015610f025780601f10610ed757610100808354040283529160200191610f02565b820191906000526020600020905b815481529060010190602001808311610ee557829003601f168201915b505050505090509392505050565b6000818152602081815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610f4a90612b9e565b80601f0160208091040260200160405190810160405280929190818152602001828054610f7690612b9e565b8015610fc35780601f10610f9857610100808354040283529160200191610fc3565b820191906000526020600020905b815481529060010190602001808311610fa657829003601f168201915b50505050509050919050565b83610fd981611798565b610fe257600080fd5b83610fee600182612b7b565b1615610ff957600080fd5b6000858152602081815260408083205467ffffffffffffffff1683526001825280832088845282528083208784529091529020611037838583612c26565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b6000818152602081815260408083205467ffffffffffffffff168352600882528083208484529091529020805460609190610f4a90612b9e565b826110b081611798565b6110b957600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526008825280832087845290915290206110ef838583612c26565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610cd1929190612d57565b8261112c81611798565b61113557600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af75284846040516111679291906126ea565b60405180910390a2603c83036111be57837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd26111a284611e10565b6040516001600160a01b03909116815260200160405180910390a25b6000848152602081815260408083205467ffffffffffffffff16835260028252808320878452825280832086845290915290206111fb8382612d92565b5050505050565b6001600160a01b03821633036112855760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336000818152600b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6001600160a01b03821633036113495760405162461bcd60e51b815260206004820181905260248201527f53657474696e672064656c65676174652073746174757320666f722073656c66604482015260640161127c565b336000818152600c6020908152604080832087845282528083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519384529286917ff0ddb3b04746704017f9aa8bd728fcc2c1d11675041205350018915f5e4750a0910160405180910390a4505050565b6000838152602081815260408083205467ffffffffffffffff168352600582528083208684528252808320858452825280832061ffff851684529091529020805460609190610e8990612b9e565b6060610e2960008484611e38565b6000818152602081815260408083205467ffffffffffffffff168352600382528083208484529091529020805460609190610f4a90612b9e565b8261145e81611798565b61146757600080fd5b6000848152602081815260408083205467ffffffffffffffff1680845260048352818420888552909252822080549192916114a190612b9e565b80601f01602080910402602001604051908101604052809291908181526020018280546114cd90612b9e565b801561151a5780601f106114ef5761010080835404028352916020019161151a565b820191906000526020600020905b8154815290600101906020018083116114fd57829003601f168201915b5050505067ffffffffffffffff841660009081526004602090815260408083208b845290915290209192506115529050858783612c26565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f8582878760405161158793929190612e52565b60405180910390a2505050505050565b816115a181611798565b6115aa57600080fd5b6115b983603c61038d85612011565b505050565b60606115cb848484611e38565b949350505050565b826115dd81611798565b6115e657600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526007825280832087845282528083206001600160e01b031987168085529083529281902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b6000828152602081815260408083205467ffffffffffffffff16835260028252808320858452825280832084845290915290208054606091906116d490612b9e565b80601f016020809104026020016040519081016040528092919081815260200182805461170090612b9e565b801561174d5780601f106117225761010080835404028352916020019161174d565b820191906000526020600020905b81548152906001019060200180831161173057829003601f168201915b5050505050905092915050565b60006001600160e01b031982167f59d1d43c00000000000000000000000000000000000000000000000000000000148061058457506105848261204a565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806117f95750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b1561180657506001919050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015611887573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ab9190612e82565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b03160361198b576040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611964573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119889190612e82565b90505b6001600160a01b0381163314806119c557506001600160a01b0381166000908152600b6020908152604080832033845290915290205460ff165b80610e2957506001600160a01b0381166000908152600c60209081526040808320868452825280832033845290915290205460ff16610e29565b611a4d6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261058481611d28565b6020810151815160609161058491611a789082612088565b845191906120e2565b60a081015160c082015160609161058491611a78908290612b7b565b600081518351148015610e295750610e298360008460008751612159565b865160208801206000611acf8787876120e2565b90508315611bf95767ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611b1a90612b9e565b159050611b795767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611b5d83612e9f565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091528120611bba916124b6565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a604051611bec929190612ebd565b60405180910390a2610788565b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611c3c90612b9e565b9050600003611c9d5767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611c8183612ee3565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091529020611cdf8282612d92565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a84604051611d1493929190612efa565b60405180910390a250505050505050505050565b60c08101516020820181905281515111611d3f5750565b6000611d5382600001518360200151612088565b8260200151611d629190612f29565b8251909150611d71908261217c565b61ffff166040830152611d85600282612f29565b8251909150611d94908261217c565b61ffff166060830152611da8600282612f29565b8251909150611db790826121a4565b63ffffffff166080830152611dcd600482612f29565b8251909150600090611ddf908361217c565b61ffff169050611df0600283612f29565b60a084018190529150611e038183612f29565b60c0909301929092525050565b60008151601414611e2057600080fd5b50602001516c01000000000000000000000000900490565b60608167ffffffffffffffff811115611e5357611e536127ae565b604051908082528060200260200182016040528015611e8657816020015b6060815260200190600190039081611e715790505b50905060005b82811015612009578415611f51576000848483818110611eae57611eae612d41565b9050602002810190611ec09190612f3c565b611ecf91602491600491612f83565b611ed891612fad565b9050858114611f4f5760405162461bcd60e51b815260206004820152603460248201527f6d756c746963616c6c3a20416c6c207265636f726473206d757374206861766560448201527f2061206d61746368696e67206e616d6568617368000000000000000000000000606482015260840161127c565b505b60008030868685818110611f6757611f67612d41565b9050602002810190611f799190612f3c565b604051611f87929190612b8e565b600060405180830381855af49150503d8060008114611fc2576040519150601f19603f3d011682016040523d82523d6000602084013e611fc7565b606091505b509150915081611fd657600080fd5b80848481518110611fe957611fe9612d41565b60200260200101819052505050808061200190612fcb565b915050611e8c565b509392505050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60006001600160e01b031982167fc86902330000000000000000000000000000000000000000000000000000000014806105845750610584826121ce565b6000815b8351811061209c5761209c612fe4565b60006120a8858361220c565b60ff1690506120b8816001612f29565b6120c29083612f29565b9150806000036120d257506120d8565b5061208c565b6115cb8382612b7b565b82516060906120f18385612f29565b11156120fc57600080fd5b60008267ffffffffffffffff811115612117576121176127ae565b6040519080825280601f01601f191660200182016040528015612141576020820181803683370190505b50905060208082019086860101610b02828287612230565b6000612166848484612286565b612171878785612286565b149695505050505050565b815160009061218c836002612f29565b111561219757600080fd5b50016002015161ffff1690565b81516000906121b4836004612f29565b11156121bf57600080fd5b50016004015163ffffffff1690565b60006001600160e01b031982167f691f34310000000000000000000000000000000000000000000000000000000014806105845750610584826122aa565b600082828151811061222057612220612d41565b016020015160f81c905092915050565b602081106122685781518352612247602084612f29565b9250612254602083612f29565b9150612261602082612b7b565b9050612230565b905182516020929092036101000a6000190180199091169116179052565b82516000906122958385612f29565b11156122a057600080fd5b5091016020012090565b60006001600160e01b031982167f124a319c00000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167fa8fa568200000000000000000000000000000000000000000000000000000000148061234657506001600160e01b031982167f5c98042b00000000000000000000000000000000000000000000000000000000145b8061058457506105848260006001600160e01b031982167fbc1c58d100000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167f3b3b57de0000000000000000000000000000000000000000000000000000000014806123ec57506001600160e01b031982167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061058457506105848260006001600160e01b031982167f2203ab5600000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167fd700ff3300000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167f4fbf043300000000000000000000000000000000000000000000000000000000148061058457506301ffc9a760e01b6001600160e01b0319831614610584565b5080546124c290612b9e565b6000825580601f106124d2575050565b601f0160209004906000526020600020908101906124f091906124f3565b50565b5b8082111561250857600081556001016124f4565b5090565b80356001600160e01b03198116811461252457600080fd5b919050565b60006020828403121561253b57600080fd5b610e298261250c565b60008083601f84011261255657600080fd5b50813567ffffffffffffffff81111561256e57600080fd5b602083019150836020828501011115610c3d57600080fd5b60008060006040848603121561259b57600080fd5b83359250602084013567ffffffffffffffff8111156125b957600080fd5b6125c586828701612544565b9497909650939450505050565b6000806000806000606086880312156125ea57600080fd5b85359450602086013567ffffffffffffffff8082111561260957600080fd5b61261589838a01612544565b9096509450604088013591508082111561262e57600080fd5b5061263b88828901612544565b969995985093965092949392505050565b6000806040838503121561265f57600080fd5b8235915061266f6020840161250c565b90509250929050565b6000806040838503121561268b57600080fd5b50508035926020909101359150565b60005b838110156126b557818101518382015260200161269d565b50506000910152565b600081518084526126d681602086016020860161269a565b601f01601f19169290920160200192915050565b8281526040602082015260006115cb60408301846126be565b60008060006060848603121561271857600080fd5b505081359360208301359350604090920135919050565b60006020828403121561274157600080fd5b5035919050565b602081526000610e2960208301846126be565b6000806000806060858703121561277157600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561279657600080fd5b6127a287828801612544565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b6000806000606084860312156127d957600080fd5b8335925060208401359150604084013567ffffffffffffffff808211156127ff57600080fd5b818601915086601f83011261281357600080fd5b813581811115612825576128256127ae565b604051601f8201601f19908116603f0116810190838211818310171561284d5761284d6127ae565b8160405282815289602084870101111561286657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b6001600160a01b03811681146124f057600080fd5b8035801515811461252457600080fd5b600080604083850312156128c057600080fd5b82356128cb81612888565b915061266f6020840161289d565b6000806000606084860312156128ee57600080fd5b83359250602084013561290081612888565b915061290e6040850161289d565b90509250925092565b60008060006060848603121561292c57600080fd5b8335925060208401359150604084013561ffff8116811461294c57600080fd5b809150509250925092565b60008060006060848603121561296c57600080fd5b833561297781612888565b925060208401359150604084013561294c81612888565b60008083601f8401126129a057600080fd5b50813567ffffffffffffffff8111156129b857600080fd5b6020830191508360208260051b8501011115610c3d57600080fd5b600080602083850312156129e657600080fd5b823567ffffffffffffffff8111156129fd57600080fd5b612a098582860161298e565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612a6a57603f19888603018452612a588583516126be565b94509285019290850190600101612a3c565b5092979650505050505050565b60008060408385031215612a8a57600080fd5b823591506020830135612a9c81612888565b809150509250929050565b600080600060408486031215612abc57600080fd5b83359250602084013567ffffffffffffffff811115612ada57600080fd5b6125c58682870161298e565b600080600060608486031215612afb57600080fd5b83359250612b0b6020850161250c565b9150604084013561294c81612888565b60008060408385031215612b2e57600080fd5b8235612b3981612888565b91506020830135612a9c81612888565b60008251612b5b81846020870161269a565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561058457610584612b65565b8183823760009101908152919050565b600181811c90821680612bb257607f821691505b602082108103612bd257634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156115b957600081815260208120601f850160051c81016020861015612bff5750805b601f850160051c820191505b81811015612c1e57828155600101612c0b565b505050505050565b67ffffffffffffffff831115612c3e57612c3e6127ae565b612c5283612c4c8354612b9e565b83612bd8565b6000601f841160018114612c865760008515612c6e5750838201355b600019600387901b1c1916600186901b1783556111fb565b600083815260209020601f19861690835b82811015612cb75786850135825560209485019460019092019101612c97565b5086821015612cd45760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b604081526000612d23604083018688612ce6565b8281036020840152612d36818587612ce6565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b6020815260006115cb602083018486612ce6565b600067ffffffffffffffff808316818103612d8857612d88612b65565b6001019392505050565b815167ffffffffffffffff811115612dac57612dac6127ae565b612dc081612dba8454612b9e565b84612bd8565b602080601f831160018114612df55760008415612ddd5750858301515b600019600386901b1c1916600185901b178555612c1e565b600085815260208120601f198616915b82811015612e2457888601518255948401946001909101908401612e05565b5085821015612e425787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000612e6560408301866126be565b8281036020840152612e78818587612ce6565b9695505050505050565b600060208284031215612e9457600080fd5b8151610e2981612888565b600061ffff821680612eb357612eb3612b65565b6000190192915050565b604081526000612ed060408301856126be565b905061ffff831660208301529392505050565b600061ffff808316818103612d8857612d88612b65565b606081526000612f0d60608301866126be565b61ffff851660208401528281036040840152612e7881856126be565b8082018082111561058457610584612b65565b6000808335601e19843603018112612f5357600080fd5b83018035915067ffffffffffffffff821115612f6e57600080fd5b602001915036819003821315610c3d57600080fd5b60008085851115612f9357600080fd5b83861115612fa057600080fd5b5050820193919092039150565b8035602083101561058457600019602084900360031b1b1692915050565b600060018201612fdd57612fdd612b65565b5060010190565b634e487b7160e01b600052600160045260246000fdfea26469706673582212201d1412fb11ca63e400758ea40508854e4bda3b2851a29ecc9f3b2b3977dd2e4464736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101da5760003560e01c80638b95dd7111610104578063c8690233116100a2578063e32954eb11610071578063e32954eb14610504578063e59d895d14610517578063e985e9c51461052a578063f1cb7e061461056657600080fd5b8063c869023314610442578063ce3decdc1461049b578063d5fa2b00146104ae578063d700ff33146104c157600080fd5b8063a8fa5682116100de578063a8fa5682146103b8578063a9784b3e146103cb578063ac9650d81461040f578063bc1c58d11461042f57600080fd5b80638b95dd711461037f578063a22cb46514610392578063a4b91a01146103a557600080fd5b80633603d7581161017c5780635c98042b1161014b5780635c98042b14610333578063623195b014610346578063691f343114610359578063773722131461036c57600080fd5b80633603d758146102a15780633b3b57de146102b45780634cbf6ba4146102c757806359d1d43c1461031357600080fd5b8063124a319c116101b8578063124a319c1461022f5780632203ab561461025a57806329cd62ea1461027b578063304e6ade1461028e57600080fd5b806301ffc9a7146101df5780630af179d71461020757806310f13a8c1461021c575b600080fd5b6101f26101ed366004612529565b610579565b60405190151581526020015b60405180910390f35b61021a610215366004612586565b61058a565b005b61021a61022a3660046125d2565b610794565b61024261023d36600461264c565b610861565b6040516001600160a01b0390911681526020016101fe565b61026d610268366004612678565b610b0d565b6040516101fe9291906126ea565b61021a610289366004612703565b610c44565b61021a61029c366004612586565b610cdf565b61021a6102af36600461272f565b610d5b565b6102426102c236600461272f565b610dfe565b6101f26102d5366004612678565b6000828152602081815260408083205467ffffffffffffffff1683526006825280832094835293815283822092825291909152205461ffff16151590565b610326610321366004612586565b610e30565b6040516101fe9190612748565b61032661034136600461272f565b610f10565b61021a61035436600461275b565b610fcf565b61032661036736600461272f565b61106c565b61021a61037a366004612586565b6110a6565b61021a61038d3660046127c4565b611122565b61021a6103a03660046128ad565b611202565b61021a6103b33660046128d9565b6112f1565b6103266103c6366004612917565b6113be565b6101f26103d9366004612957565b6001600160a01b039283166000908152600c60209081526040808320948352938152838220929094168152925290205460ff1690565b61042261041d3660046129d3565b61140c565b6040516101fe9190612a15565b61032661043d36600461272f565b61141a565b61048661045036600461272f565b6000818152602081815260408083205467ffffffffffffffff168352600982528083209383529290522080546001909101549091565b604080519283526020830191909152016101fe565b61021a6104a9366004612586565b611454565b61021a6104bc366004612a77565b611597565b6104eb6104cf36600461272f565b60006020819052908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016101fe565b610422610512366004612aa7565b6115be565b61021a610525366004612ae6565b6115d3565b6101f2610538366004612b1b565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b610326610574366004612678565b611692565b60006105848261175a565b92915050565b8261059481611798565b61059d57600080fd5b600084815260208181526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff9091169183916106039183918d908d908190840183828082843760009201919091525092939250506119ff9050565b90505b8051516020820151101561072d578661ffff1660000361066b578060400151965061063081611a60565b9450846040516020016106439190612b49565b60405160208183030381529060405280519060200120925061066481611a81565b935061071f565b600061067682611a60565b9050816040015161ffff168861ffff1614158061069a57506106988682611a9d565b155b1561071d576106f68c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d91506106ed908290612b7b565b8b51158a611abb565b81604001519750816020015196508095508580519060200120935061071a82611a81565b94505b505b61072881611d28565b610606565b50835115610788576107888a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c925061077f91508290508f612b7b565b89511588611abb565b50505050505050505050565b8461079e81611798565b6107a757600080fd5b6000868152602081815260408083205467ffffffffffffffff168352600a8252808320898452909152908190209051849184916107e79089908990612b8e565b90815260200160405180910390209182610802929190612c26565b508484604051610813929190612b8e565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516108519493929190612d0f565b60405180910390a3505050505050565b6000828152602081815260408083205467ffffffffffffffff1683526007825280832085845282528083206001600160e01b0319851684529091528120546001600160a01b031680156108b5579050610584565b60006108c085610dfe565b90506001600160a01b0381166108db57600092505050610584565b6040516301ffc9a760e01b602482015260009081906001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516109489190612b49565b600060405180830381855afa9150503d8060008114610983576040519150601f19603f3d011682016040523d82523d6000602084013e610988565b606091505b509150915081158061099b575060208151105b806109dd575080601f815181106109b4576109b4612d41565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109ef576000945050505050610584565b6040516001600160e01b0319871660248201526001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b17905251610a5a9190612b49565b600060405180830381855afa9150503d8060008114610a95576040519150601f19603f3d011682016040523d82523d6000602084013e610a9a565b606091505b509092509050811580610aae575060208151105b80610af0575080601f81518110610ac757610ac7612d41565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610b02576000945050505050610584565b509095945050505050565b6000828152602081815260408083205467ffffffffffffffff168352600180835281842086855290925282206060915b848111610c245780851615801590610b6d575060008181526020839052604081208054610b6990612b9e565b9050115b15610c1c5780826000838152602001908152602001600020808054610b9190612b9e565b80601f0160208091040260200160405190810160405280929190818152602001828054610bbd90612b9e565b8015610c0a5780601f10610bdf57610100808354040283529160200191610c0a565b820191906000526020600020905b815481529060010190602001808311610bed57829003601f168201915b50505050509050935093505050610c3d565b60011b610b3d565b5060006040518060200160405280600081525092509250505b9250929050565b82610c4e81611798565b610c5757600080fd5b604080518082018252848152602080820185815260008881528083528481205467ffffffffffffffff1681526009835284812089825283528490209251835551600190920191909155815185815290810184905285917f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4691015b60405180910390a250505050565b82610ce981611798565b610cf257600080fd5b6000848152602081815260408083205467ffffffffffffffff168352600382528083208784529091529020610d28838583612c26565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610cd1929190612d57565b80610d6581611798565b610d6e57600080fd5b6000828152602081905260408120805467ffffffffffffffff1691610d9283612d6b565b82546101009290920a67ffffffffffffffff818102199093169183160217909155600084815260208181526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610e0c83603c611692565b90508051600003610e205750600092915050565b610e2981611e10565b9392505050565b6000838152602081815260408083205467ffffffffffffffff168352600a825280832086845290915290819020905160609190610e709085908590612b8e565b90815260200160405180910390208054610e8990612b9e565b80601f0160208091040260200160405190810160405280929190818152602001828054610eb590612b9e565b8015610f025780601f10610ed757610100808354040283529160200191610f02565b820191906000526020600020905b815481529060010190602001808311610ee557829003601f168201915b505050505090509392505050565b6000818152602081815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610f4a90612b9e565b80601f0160208091040260200160405190810160405280929190818152602001828054610f7690612b9e565b8015610fc35780601f10610f9857610100808354040283529160200191610fc3565b820191906000526020600020905b815481529060010190602001808311610fa657829003601f168201915b50505050509050919050565b83610fd981611798565b610fe257600080fd5b83610fee600182612b7b565b1615610ff957600080fd5b6000858152602081815260408083205467ffffffffffffffff1683526001825280832088845282528083208784529091529020611037838583612c26565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b6000818152602081815260408083205467ffffffffffffffff168352600882528083208484529091529020805460609190610f4a90612b9e565b826110b081611798565b6110b957600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526008825280832087845290915290206110ef838583612c26565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610cd1929190612d57565b8261112c81611798565b61113557600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af75284846040516111679291906126ea565b60405180910390a2603c83036111be57837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd26111a284611e10565b6040516001600160a01b03909116815260200160405180910390a25b6000848152602081815260408083205467ffffffffffffffff16835260028252808320878452825280832086845290915290206111fb8382612d92565b5050505050565b6001600160a01b03821633036112855760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336000818152600b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6001600160a01b03821633036113495760405162461bcd60e51b815260206004820181905260248201527f53657474696e672064656c65676174652073746174757320666f722073656c66604482015260640161127c565b336000818152600c6020908152604080832087845282528083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519384529286917ff0ddb3b04746704017f9aa8bd728fcc2c1d11675041205350018915f5e4750a0910160405180910390a4505050565b6000838152602081815260408083205467ffffffffffffffff168352600582528083208684528252808320858452825280832061ffff851684529091529020805460609190610e8990612b9e565b6060610e2960008484611e38565b6000818152602081815260408083205467ffffffffffffffff168352600382528083208484529091529020805460609190610f4a90612b9e565b8261145e81611798565b61146757600080fd5b6000848152602081815260408083205467ffffffffffffffff1680845260048352818420888552909252822080549192916114a190612b9e565b80601f01602080910402602001604051908101604052809291908181526020018280546114cd90612b9e565b801561151a5780601f106114ef5761010080835404028352916020019161151a565b820191906000526020600020905b8154815290600101906020018083116114fd57829003601f168201915b5050505067ffffffffffffffff841660009081526004602090815260408083208b845290915290209192506115529050858783612c26565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f8582878760405161158793929190612e52565b60405180910390a2505050505050565b816115a181611798565b6115aa57600080fd5b6115b983603c61038d85612011565b505050565b60606115cb848484611e38565b949350505050565b826115dd81611798565b6115e657600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526007825280832087845282528083206001600160e01b031987168085529083529281902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b6000828152602081815260408083205467ffffffffffffffff16835260028252808320858452825280832084845290915290208054606091906116d490612b9e565b80601f016020809104026020016040519081016040528092919081815260200182805461170090612b9e565b801561174d5780601f106117225761010080835404028352916020019161174d565b820191906000526020600020905b81548152906001019060200180831161173057829003601f168201915b5050505050905092915050565b60006001600160e01b031982167f59d1d43c00000000000000000000000000000000000000000000000000000000148061058457506105848261204a565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806117f95750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b1561180657506001919050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015611887573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ab9190612e82565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b03160361198b576040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611964573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119889190612e82565b90505b6001600160a01b0381163314806119c557506001600160a01b0381166000908152600b6020908152604080832033845290915290205460ff165b80610e2957506001600160a01b0381166000908152600c60209081526040808320868452825280832033845290915290205460ff16610e29565b611a4d6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261058481611d28565b6020810151815160609161058491611a789082612088565b845191906120e2565b60a081015160c082015160609161058491611a78908290612b7b565b600081518351148015610e295750610e298360008460008751612159565b865160208801206000611acf8787876120e2565b90508315611bf95767ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611b1a90612b9e565b159050611b795767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611b5d83612e9f565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091528120611bba916124b6565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a604051611bec929190612ebd565b60405180910390a2610788565b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611c3c90612b9e565b9050600003611c9d5767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611c8183612ee3565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091529020611cdf8282612d92565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a84604051611d1493929190612efa565b60405180910390a250505050505050505050565b60c08101516020820181905281515111611d3f5750565b6000611d5382600001518360200151612088565b8260200151611d629190612f29565b8251909150611d71908261217c565b61ffff166040830152611d85600282612f29565b8251909150611d94908261217c565b61ffff166060830152611da8600282612f29565b8251909150611db790826121a4565b63ffffffff166080830152611dcd600482612f29565b8251909150600090611ddf908361217c565b61ffff169050611df0600283612f29565b60a084018190529150611e038183612f29565b60c0909301929092525050565b60008151601414611e2057600080fd5b50602001516c01000000000000000000000000900490565b60608167ffffffffffffffff811115611e5357611e536127ae565b604051908082528060200260200182016040528015611e8657816020015b6060815260200190600190039081611e715790505b50905060005b82811015612009578415611f51576000848483818110611eae57611eae612d41565b9050602002810190611ec09190612f3c565b611ecf91602491600491612f83565b611ed891612fad565b9050858114611f4f5760405162461bcd60e51b815260206004820152603460248201527f6d756c746963616c6c3a20416c6c207265636f726473206d757374206861766560448201527f2061206d61746368696e67206e616d6568617368000000000000000000000000606482015260840161127c565b505b60008030868685818110611f6757611f67612d41565b9050602002810190611f799190612f3c565b604051611f87929190612b8e565b600060405180830381855af49150503d8060008114611fc2576040519150601f19603f3d011682016040523d82523d6000602084013e611fc7565b606091505b509150915081611fd657600080fd5b80848481518110611fe957611fe9612d41565b60200260200101819052505050808061200190612fcb565b915050611e8c565b509392505050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60006001600160e01b031982167fc86902330000000000000000000000000000000000000000000000000000000014806105845750610584826121ce565b6000815b8351811061209c5761209c612fe4565b60006120a8858361220c565b60ff1690506120b8816001612f29565b6120c29083612f29565b9150806000036120d257506120d8565b5061208c565b6115cb8382612b7b565b82516060906120f18385612f29565b11156120fc57600080fd5b60008267ffffffffffffffff811115612117576121176127ae565b6040519080825280601f01601f191660200182016040528015612141576020820181803683370190505b50905060208082019086860101610b02828287612230565b6000612166848484612286565b612171878785612286565b149695505050505050565b815160009061218c836002612f29565b111561219757600080fd5b50016002015161ffff1690565b81516000906121b4836004612f29565b11156121bf57600080fd5b50016004015163ffffffff1690565b60006001600160e01b031982167f691f34310000000000000000000000000000000000000000000000000000000014806105845750610584826122aa565b600082828151811061222057612220612d41565b016020015160f81c905092915050565b602081106122685781518352612247602084612f29565b9250612254602083612f29565b9150612261602082612b7b565b9050612230565b905182516020929092036101000a6000190180199091169116179052565b82516000906122958385612f29565b11156122a057600080fd5b5091016020012090565b60006001600160e01b031982167f124a319c00000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167fa8fa568200000000000000000000000000000000000000000000000000000000148061234657506001600160e01b031982167f5c98042b00000000000000000000000000000000000000000000000000000000145b8061058457506105848260006001600160e01b031982167fbc1c58d100000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167f3b3b57de0000000000000000000000000000000000000000000000000000000014806123ec57506001600160e01b031982167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061058457506105848260006001600160e01b031982167f2203ab5600000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167fd700ff3300000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167f4fbf043300000000000000000000000000000000000000000000000000000000148061058457506301ffc9a760e01b6001600160e01b0319831614610584565b5080546124c290612b9e565b6000825580601f106124d2575050565b601f0160209004906000526020600020908101906124f091906124f3565b50565b5b8082111561250857600081556001016124f4565b5090565b80356001600160e01b03198116811461252457600080fd5b919050565b60006020828403121561253b57600080fd5b610e298261250c565b60008083601f84011261255657600080fd5b50813567ffffffffffffffff81111561256e57600080fd5b602083019150836020828501011115610c3d57600080fd5b60008060006040848603121561259b57600080fd5b83359250602084013567ffffffffffffffff8111156125b957600080fd5b6125c586828701612544565b9497909650939450505050565b6000806000806000606086880312156125ea57600080fd5b85359450602086013567ffffffffffffffff8082111561260957600080fd5b61261589838a01612544565b9096509450604088013591508082111561262e57600080fd5b5061263b88828901612544565b969995985093965092949392505050565b6000806040838503121561265f57600080fd5b8235915061266f6020840161250c565b90509250929050565b6000806040838503121561268b57600080fd5b50508035926020909101359150565b60005b838110156126b557818101518382015260200161269d565b50506000910152565b600081518084526126d681602086016020860161269a565b601f01601f19169290920160200192915050565b8281526040602082015260006115cb60408301846126be565b60008060006060848603121561271857600080fd5b505081359360208301359350604090920135919050565b60006020828403121561274157600080fd5b5035919050565b602081526000610e2960208301846126be565b6000806000806060858703121561277157600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561279657600080fd5b6127a287828801612544565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b6000806000606084860312156127d957600080fd5b8335925060208401359150604084013567ffffffffffffffff808211156127ff57600080fd5b818601915086601f83011261281357600080fd5b813581811115612825576128256127ae565b604051601f8201601f19908116603f0116810190838211818310171561284d5761284d6127ae565b8160405282815289602084870101111561286657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b6001600160a01b03811681146124f057600080fd5b8035801515811461252457600080fd5b600080604083850312156128c057600080fd5b82356128cb81612888565b915061266f6020840161289d565b6000806000606084860312156128ee57600080fd5b83359250602084013561290081612888565b915061290e6040850161289d565b90509250925092565b60008060006060848603121561292c57600080fd5b8335925060208401359150604084013561ffff8116811461294c57600080fd5b809150509250925092565b60008060006060848603121561296c57600080fd5b833561297781612888565b925060208401359150604084013561294c81612888565b60008083601f8401126129a057600080fd5b50813567ffffffffffffffff8111156129b857600080fd5b6020830191508360208260051b8501011115610c3d57600080fd5b600080602083850312156129e657600080fd5b823567ffffffffffffffff8111156129fd57600080fd5b612a098582860161298e565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612a6a57603f19888603018452612a588583516126be565b94509285019290850190600101612a3c565b5092979650505050505050565b60008060408385031215612a8a57600080fd5b823591506020830135612a9c81612888565b809150509250929050565b600080600060408486031215612abc57600080fd5b83359250602084013567ffffffffffffffff811115612ada57600080fd5b6125c58682870161298e565b600080600060608486031215612afb57600080fd5b83359250612b0b6020850161250c565b9150604084013561294c81612888565b60008060408385031215612b2e57600080fd5b8235612b3981612888565b91506020830135612a9c81612888565b60008251612b5b81846020870161269a565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561058457610584612b65565b8183823760009101908152919050565b600181811c90821680612bb257607f821691505b602082108103612bd257634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156115b957600081815260208120601f850160051c81016020861015612bff5750805b601f850160051c820191505b81811015612c1e57828155600101612c0b565b505050505050565b67ffffffffffffffff831115612c3e57612c3e6127ae565b612c5283612c4c8354612b9e565b83612bd8565b6000601f841160018114612c865760008515612c6e5750838201355b600019600387901b1c1916600186901b1783556111fb565b600083815260209020601f19861690835b82811015612cb75786850135825560209485019460019092019101612c97565b5086821015612cd45760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b604081526000612d23604083018688612ce6565b8281036020840152612d36818587612ce6565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b6020815260006115cb602083018486612ce6565b600067ffffffffffffffff808316818103612d8857612d88612b65565b6001019392505050565b815167ffffffffffffffff811115612dac57612dac6127ae565b612dc081612dba8454612b9e565b84612bd8565b602080601f831160018114612df55760008415612ddd5750858301515b600019600386901b1c1916600185901b178555612c1e565b600085815260208120601f198616915b82811015612e2457888601518255948401946001909101908401612e05565b5085821015612e425787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000612e6560408301866126be565b8281036020840152612e78818587612ce6565b9695505050505050565b600060208284031215612e9457600080fd5b8151610e2981612888565b600061ffff821680612eb357612eb3612b65565b6000190192915050565b604081526000612ed060408301856126be565b905061ffff831660208301529392505050565b600061ffff808316818103612d8857612d88612b65565b606081526000612f0d60608301866126be565b61ffff851660208401528281036040840152612e7881856126be565b8082018082111561058457610584612b65565b6000808335601e19843603018112612f5357600080fd5b83018035915067ffffffffffffffff821115612f6e57600080fd5b602001915036819003821315610c3d57600080fd5b60008085851115612f9357600080fd5b83861115612fa057600080fd5b5050820193919092039150565b8035602083101561058457600019602084900360031b1b1692915050565b600060018201612fdd57612fdd612b65565b5060010190565b634e487b7160e01b600052600160045260246000fdfea26469706673582212201d1412fb11ca63e400758ea40508854e4bda3b2851a29ecc9f3b2b3977dd2e4464736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "ABI(bytes32,uint256)": { + "params": { + "contentTypes": "A bitwise OR of the ABI formats accepted by the caller.", + "node": "The ENS node to query" + }, + "returns": { + "_0": "contentType The content type of the return value", + "_1": "data The ABI data" + } + }, + "addr(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated address." + } + }, + "approve(bytes32,address,bool)": { + "details": "Approve a delegate to be able to updated records on a node." + }, + "clearRecords(bytes32)": { + "params": { + "node": "The node to update." + } + }, + "contenthash(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated contenthash." + } + }, + "dnsRecord(bytes32,bytes32,uint16)": { + "params": { + "name": "the keccak-256 hash of the fully-qualified name for which to fetch the record", + "node": "the namehash of the node for which to fetch the record", + "resource": "the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types" + }, + "returns": { + "_0": "the DNS record in wire format if present, otherwise empty" + } + }, + "hasDNSRecords(bytes32,bytes32)": { + "params": { + "name": "the namehash of the node for which to check the records", + "node": "the namehash of the node for which to check the records" + } + }, + "interfaceImplementer(bytes32,bytes4)": { + "params": { + "interfaceID": "The EIP 165 interface ID to check for.", + "node": "The ENS node to query." + }, + "returns": { + "_0": "The address that implements this interface, or 0 if the interface is unsupported." + } + }, + "isApprovedFor(address,bytes32,address)": { + "details": "Check to see if the delegate has been approved by the owner for the node." + }, + "isApprovedForAll(address,address)": { + "details": "See {IERC1155-isApprovedForAll}." + }, + "name(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated name." + } + }, + "pubkey(bytes32)": { + "params": { + "node": "The ENS node to query" + }, + "returns": { + "x": "The X coordinate of the curve point for the public key.", + "y": "The Y coordinate of the curve point for the public key." + } + }, + "setABI(bytes32,uint256,bytes)": { + "params": { + "contentType": "The content type of the ABI", + "data": "The ABI data.", + "node": "The node to update." + } + }, + "setAddr(bytes32,address)": { + "params": { + "a": "The address to set.", + "node": "The node to update." + } + }, + "setApprovalForAll(address,bool)": { + "details": "See {IERC1155-setApprovalForAll}." + }, + "setContenthash(bytes32,bytes)": { + "params": { + "hash": "The contenthash to set", + "node": "The node to update." + } + }, + "setDNSRecords(bytes32,bytes)": { + "params": { + "data": "the DNS wire format records to set", + "node": "the namehash of the node for which to set the records" + } + }, + "setInterface(bytes32,bytes4,address)": { + "params": { + "implementer": "The address of a contract that implements this interface for this node.", + "interfaceID": "The EIP 165 interface ID.", + "node": "The node to update." + } + }, + "setName(bytes32,string)": { + "params": { + "node": "The node to update." + } + }, + "setPubkey(bytes32,bytes32,bytes32)": { + "params": { + "node": "The ENS node to query", + "x": "the X coordinate of the curve point for the public key.", + "y": "the Y coordinate of the curve point for the public key." + } + }, + "setText(bytes32,string,string)": { + "params": { + "key": "The key to set.", + "node": "The node to update.", + "value": "The text data value to set." + } + }, + "setZonehash(bytes32,bytes)": { + "params": { + "hash": "The zonehash to set", + "node": "The node to update." + } + }, + "text(bytes32,string)": { + "params": { + "key": "The text data key to query.", + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated text data." + } + }, + "zonehash(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated contenthash." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "ABI(bytes32,uint256)": { + "notice": "Returns the ABI associated with an ENS node. Defined in EIP205." + }, + "addr(bytes32)": { + "notice": "Returns the address associated with an ENS node." + }, + "clearRecords(bytes32)": { + "notice": "Increments the record version associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "contenthash(bytes32)": { + "notice": "Returns the contenthash associated with an ENS node." + }, + "dnsRecord(bytes32,bytes32,uint16)": { + "notice": "Obtain a DNS record." + }, + "hasDNSRecords(bytes32,bytes32)": { + "notice": "Check if a given node has records." + }, + "interfaceImplementer(bytes32,bytes4)": { + "notice": "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." + }, + "name(bytes32)": { + "notice": "Returns the name associated with an ENS node, for reverse records. Defined in EIP181." + }, + "pubkey(bytes32)": { + "notice": "Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619." + }, + "setABI(bytes32,uint256,bytes)": { + "notice": "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." + }, + "setAddr(bytes32,address)": { + "notice": "Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "setContenthash(bytes32,bytes)": { + "notice": "Sets the contenthash associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "setDNSRecords(bytes32,bytes)": { + "notice": "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." + }, + "setInterface(bytes32,bytes4,address)": { + "notice": "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." + }, + "setName(bytes32,string)": { + "notice": "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." + }, + "setPubkey(bytes32,bytes32,bytes32)": { + "notice": "Sets the SECP256k1 public key associated with an ENS node." + }, + "setText(bytes32,string,string)": { + "notice": "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." + }, + "setZonehash(bytes32,bytes)": { + "notice": "setZonehash sets the hash for the zone. May only be called by the owner of that node in the ENS registry." + }, + "text(bytes32,string)": { + "notice": "Returns the text data associated with an ENS node and key." + }, + "zonehash(bytes32)": { + "notice": "zonehash obtains the hash for the zone." + } + }, + "notice": "A simple resolver anyone can use; only allows the owner of a node to set its address.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 15571, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "recordVersions", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_bytes32,t_uint64)" + }, + { + "astId": 15665, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_abis", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))" + }, + { + "astId": 15819, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_addresses", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))" + }, + { + "astId": 16010, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_hashes", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))" + }, + { + "astId": 16100, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_zonehashes", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))" + }, + { + "astId": 16110, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_records", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))))" + }, + { + "astId": 16118, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_nameEntriesCount", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16)))" + }, + { + "astId": 16856, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_interfaces", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes4,t_address)))" + }, + { + "astId": 17048, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_names", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_string_storage))" + }, + { + "astId": 17135, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_pubkeys", + "offset": 0, + "slot": "9", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_struct(PublicKey)17128_storage))" + }, + { + "astId": 17238, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_texts", + "offset": 0, + "slot": "10", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage)))" + }, + { + "astId": 15100, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "_operatorApprovals", + "offset": 0, + "slot": "11", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" + }, + { + "astId": 15109, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "_tokenApprovals", + "offset": 0, + "slot": "12", + "type": "t_mapping(t_address,t_mapping(t_bytes32,t_mapping(t_address,t_bool)))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes4": { + "encoding": "inplace", + "label": "bytes4", + "numberOfBytes": "4" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_address,t_mapping(t_bytes32,t_mapping(t_address,t_bool)))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(bytes32 => mapping(address => bool)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_address,t_bool))" + }, + "t_mapping(t_bytes32,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_bytes32,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage)))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes32 => uint16))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_uint16)" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes4,t_address))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes4 => address))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes4,t_address)" + }, + "t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(string => string))", + "numberOfBytes": "32", + "value": "t_mapping(t_string_memory_ptr,t_string_storage)" + }, + "t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint16 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint16,t_bytes_storage)" + }, + "t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint256 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_bytes_storage)" + }, + "t_mapping(t_bytes32,t_string_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_bytes32,t_struct(PublicKey)17128_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct PubkeyResolver.PublicKey)", + "numberOfBytes": "32", + "value": "t_struct(PublicKey)17128_storage" + }, + "t_mapping(t_bytes32,t_uint16)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint16)", + "numberOfBytes": "32", + "value": "t_uint16" + }, + "t_mapping(t_bytes32,t_uint64)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint64)", + "numberOfBytes": "32", + "value": "t_uint64" + }, + "t_mapping(t_bytes4,t_address)": { + "encoding": "mapping", + "key": "t_bytes4", + "label": "mapping(bytes4 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_string_memory_ptr,t_string_storage)": { + "encoding": "mapping", + "key": "t_string_memory_ptr", + "label": "mapping(string => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_uint16,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint256,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_bytes_storage)" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage)))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes4,t_address)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes4,t_address))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(string => string)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_string_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => string))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_string_storage)" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_struct(PublicKey)17128_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => struct PubkeyResolver.PublicKey))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_struct(PublicKey)17128_storage)" + }, + "t_string_memory_ptr": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(PublicKey)17128_storage": { + "encoding": "inplace", + "label": "struct PubkeyResolver.PublicKey", + "members": [ + { + "astId": 17125, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "x", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 17127, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "y", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint16": { + "encoding": "inplace", + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint64": { + "encoding": "inplace", + "label": "uint64", + "numberOfBytes": "8" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/RSASHA1Algorithm.json b/solidity/dns-contracts/deployments/sepolia/RSASHA1Algorithm.json new file mode 100644 index 0000000..dd39f55 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/RSASHA1Algorithm.json @@ -0,0 +1,71 @@ +{ + "address": "0x8FD4107AE8b27B9A83E0BF312Ce414DeEa04Fe94", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "key", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xf507480f13718306198224b0859057394b345085a9c2e7e89a3179fb0f99e0ff", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x8FD4107AE8b27B9A83E0BF312Ce414DeEa04Fe94", + "transactionIndex": 91, + "gasUsed": "695194", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x4e10ab00e4a0df8fc18916c429bb6e75159a421899aa90ef69e8eeedc5919588", + "transactionHash": "0xf507480f13718306198224b0859057394b345085a9c2e7e89a3179fb0f99e0ff", + "logs": [], + "blockNumber": 4141613, + "cumulativeGasUsed": "28008584", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC RSASHA1 algorithm.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol\":\"RSASHA1Algorithm\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/solsha1/contracts/SHA1.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary SHA1 {\\n event Debug(bytes32 x);\\n\\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\\n assembly {\\n // Get a safe scratch location\\n let scratch := mload(0x40)\\n\\n // Get the data length, and point data at the first byte\\n let len := mload(data)\\n data := add(data, 32)\\n\\n // Find the length after padding\\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\\n switch lt(sub(totallen, len), 9)\\n case 1 { totallen := add(totallen, 64) }\\n\\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\\n\\n function readword(ptr, off, count) -> result {\\n result := 0\\n if lt(off, count) {\\n result := mload(add(ptr, off))\\n count := sub(count, off)\\n if lt(count, 32) {\\n let mask := not(sub(exp(256, sub(32, count)), 1))\\n result := and(result, mask)\\n }\\n }\\n }\\n\\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\\n mstore(scratch, readword(data, i, len))\\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\\n\\n // If we loaded the last byte, store the terminator byte\\n switch lt(sub(len, i), 64)\\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\\n\\n // If this is the last block, store the length\\n switch eq(i, sub(totallen, 64))\\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\\n\\n // Expand the 16 32-bit words into 80\\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\\n mstore(add(scratch, j), temp)\\n }\\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\\n mstore(add(scratch, j), temp)\\n }\\n\\n let x := h\\n let f := 0\\n let k := 0\\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\\n switch div(j, 20)\\n case 0 {\\n // f = d xor (b and (c xor d))\\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\\n f := and(div(x, 0x1000000000000000000000000000000), f)\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x5A827999\\n }\\n case 1{\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x6ED9EBA1\\n }\\n case 2 {\\n // f = (b and c) or (d and (b or c))\\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := and(div(x, 0x10000000000), f)\\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\\n k := 0x8F1BBCDC\\n }\\n case 3 {\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0xCA62C1D6\\n }\\n // temp = (a leftrotate 5) + f + e + k + w[i]\\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\\n temp := add(f, temp)\\n temp := add(and(x, 0xFFFFFFFF), temp)\\n temp := add(k, temp)\\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\\n }\\n\\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\\n }\\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x746d9b85de197afbc13182cbe4ba4f7917f19594e07c655d6a0c85fdf7460a8a\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n */\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata signature\\n ) external view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xaf6825f9852c69f8e36540821d067b4550dd2263497af9d645309b6a0c457ba6\"},\"contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary ModexpPrecompile {\\n /**\\n * @dev Computes (base ^ exponent) % modulus over big numbers.\\n */\\n function modexp(\\n bytes memory base,\\n bytes memory exponent,\\n bytes memory modulus\\n ) internal view returns (bool success, bytes memory output) {\\n bytes memory input = abi.encodePacked(\\n uint256(base.length),\\n uint256(exponent.length),\\n uint256(modulus.length),\\n base,\\n exponent,\\n modulus\\n );\\n\\n output = new bytes(modulus.length);\\n\\n assembly {\\n success := staticcall(\\n gas(),\\n 5,\\n add(input, 32),\\n mload(input),\\n add(output, 32),\\n mload(modulus)\\n )\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb3d46284534eb99061d4c79968c2d0420b63a6649d118ef2ea3608396b85de3f\"},\"contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./RSAVerify.sol\\\";\\nimport \\\"@ensdomains/solsha1/contracts/SHA1.sol\\\";\\n\\n/**\\n * @dev Implements the DNSSEC RSASHA1 algorithm.\\n */\\ncontract RSASHA1Algorithm is Algorithm {\\n using BytesUtils for *;\\n\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata sig\\n ) external view override returns (bool) {\\n bytes memory exponent;\\n bytes memory modulus;\\n\\n uint16 exponentLen = uint16(key.readUint8(4));\\n if (exponentLen != 0) {\\n exponent = key.substring(5, exponentLen);\\n modulus = key.substring(\\n exponentLen + 5,\\n key.length - exponentLen - 5\\n );\\n } else {\\n exponentLen = key.readUint16(5);\\n exponent = key.substring(7, exponentLen);\\n modulus = key.substring(\\n exponentLen + 7,\\n key.length - exponentLen - 7\\n );\\n }\\n\\n // Recover the message from the signature\\n bool ok;\\n bytes memory result;\\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\\n\\n // Verify it ends with the hash of our data\\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\\n }\\n}\\n\",\"keccak256\":\"0x5dee71f5a212ef48761ab4154fd68fb738eaefe145ee6c3a30d0ed6c63782b55\"},\"contracts/dnssec-oracle/algorithms/RSAVerify.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./ModexpPrecompile.sol\\\";\\n\\nlibrary RSAVerify {\\n /**\\n * @dev Recovers the input data from an RSA signature, returning the result in S.\\n * @param N The RSA public modulus.\\n * @param E The RSA public exponent.\\n * @param S The signature to recover.\\n * @return True if the recovery succeeded.\\n */\\n function rsarecover(\\n bytes memory N,\\n bytes memory E,\\n bytes memory S\\n ) internal view returns (bool, bytes memory) {\\n return ModexpPrecompile.modexp(S, E, N);\\n }\\n}\\n\",\"keccak256\":\"0xb386daa80070f79399a2cb97a534f31660161ccd50662fabcf63e26cce064506\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610bac806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e3660046109e6565b610057565b604051901515815260200160405180910390f35b600060608060006100a260048b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506103009050565b60ff169050801561016e576100f760058261ffff168c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103259050565b9250610167610107826005610a96565b61ffff9081169060059061011d9085168d610ab8565b6101279190610ab8565b8c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103259050565b9150610227565b6101b260058b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506103a99050565b90506101fe60078261ffff168c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103259050565b925061022461020e826007610a96565b61ffff9081169060079061011d9085168d610ab8565b91505b6000606061026c84868a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103d192505050565b90925090508180156102f057506102916014825161028a9190610ab8565b82906103ec565b6bffffffffffffffffffffffff19166102df8b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061041f92505050565b6bffffffffffffffffffffffff1916145b9c9b505050505050505050505050565b600082828151811061031457610314610acb565b016020015160f81c90505b92915050565b82516060906103348385610ae1565b111561033f57600080fd5b60008267ffffffffffffffff81111561035a5761035a610af4565b6040519080825280601f01601f191660200182016040528015610384576020820181803683370190505b5090506020808201908686010161039c8282876108b0565b50909150505b9392505050565b81516000906103b9836002610ae1565b11156103c457600080fd5b50016002015161ffff1690565b600060606103e0838587610906565b91509150935093915050565b81516000906103fc836014610ae1565b111561040757600080fd5b5001602001516bffffffffffffffffffffffff191690565b60006040518251602084019350604067ffffffffffffffc060018301160160098282031060018103610452576040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f06104a4565b6000838310156103a2575080820151928290039260208410156103a25760001960208590036101000a0119169392505050565b60005b82811015610830576104ba848289610471565b85526104ca846020830189610471565b6020860152604081850310600181036104e65760808286038701535b506040830381146001810361050357602086018051600887021790525b5060405b608081101561058b57858101603f19810151603719820151601f19830151600b198401516002911891909218189081027ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe1663800000009091047c010000000100000001000000010000000100000001000000010000000116179052600c01610507565b5060805b61014081101561061457858101607f19810151606f19820151603f198301516017198401516004911891909218189081027ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc1663400000009091047c03000000030000000300000003000000030000000300000003000000031617905260180161058f565b508160008060005b60508110156108065760148104801561064c576001811461067c57600281146106aa57600381146106dd57610707565b6501000000000085046a010000000000000000000086048118600160781b870416189350635a8279999250610707565b650100000000008504600160781b86046a0100000000000000000000870418189350636ed9eba19250610707565b6a01000000000000000000008504600160781b8604818117650100000000008804169116179350638f1bbcdc9250610707565b650100000000008504600160781b86046a010000000000000000000087041818935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c015104019050740100000000000000000000000000000000000000008102650100000000008604179450506a0100000000000000000000633fffffff6a040000000000000000000086041663c00000006604000000000000870416170277ffffffff00ffffffff000000000000ffffffff00ffffffff851617935060018101905061061c565b5050509190910177ffffffff00ffffffff00ffffffff00ffffffff00ffffffff16906040016104a7565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b602081106108e857815183526108c7602084610ae1565b92506108d4602083610ae1565b91506108e1602082610ab8565b90506108b0565b905182516020929092036101000a6000190180199091169116179052565b60006060600085518551855188888860405160200161092a96959493929190610b3a565b6040516020818303038152906040529050835167ffffffffffffffff81111561095557610955610af4565b6040519080825280601f01601f19166020018201604052801561097f576020820181803683370190505b50915083516020830182516020840160055afa925050935093915050565b60008083601f8401126109af57600080fd5b50813567ffffffffffffffff8111156109c757600080fd5b6020830191508360208285010111156109df57600080fd5b9250929050565b600080600080600080606087890312156109ff57600080fd5b863567ffffffffffffffff80821115610a1757600080fd5b610a238a838b0161099d565b90985096506020890135915080821115610a3c57600080fd5b610a488a838b0161099d565b90965094506040890135915080821115610a6157600080fd5b50610a6e89828a0161099d565b979a9699509497509295939492505050565b634e487b7160e01b600052601160045260246000fd5b61ffff818116838216019080821115610ab157610ab1610a80565b5092915050565b8181038181111561031f5761031f610a80565b634e487b7160e01b600052603260045260246000fd5b8082018082111561031f5761031f610a80565b634e487b7160e01b600052604160045260246000fd5b6000815160005b81811015610b2b5760208185018101518683015201610b11565b50600093019283525090919050565b8681528560208201528460408201526000610b6a610b64610b5e6060850188610b0a565b86610b0a565b84610b0a565b9897505050505050505056fea26469706673582212207857b7c8a67e5fd64e3ccb8e7b2e6fbd8ac879a5659d7498b1bc12aeeba36c9764736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e3660046109e6565b610057565b604051901515815260200160405180910390f35b600060608060006100a260048b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506103009050565b60ff169050801561016e576100f760058261ffff168c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103259050565b9250610167610107826005610a96565b61ffff9081169060059061011d9085168d610ab8565b6101279190610ab8565b8c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103259050565b9150610227565b6101b260058b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506103a99050565b90506101fe60078261ffff168c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294939250506103259050565b925061022461020e826007610a96565b61ffff9081169060079061011d9085168d610ab8565b91505b6000606061026c84868a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103d192505050565b90925090508180156102f057506102916014825161028a9190610ab8565b82906103ec565b6bffffffffffffffffffffffff19166102df8b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061041f92505050565b6bffffffffffffffffffffffff1916145b9c9b505050505050505050505050565b600082828151811061031457610314610acb565b016020015160f81c90505b92915050565b82516060906103348385610ae1565b111561033f57600080fd5b60008267ffffffffffffffff81111561035a5761035a610af4565b6040519080825280601f01601f191660200182016040528015610384576020820181803683370190505b5090506020808201908686010161039c8282876108b0565b50909150505b9392505050565b81516000906103b9836002610ae1565b11156103c457600080fd5b50016002015161ffff1690565b600060606103e0838587610906565b91509150935093915050565b81516000906103fc836014610ae1565b111561040757600080fd5b5001602001516bffffffffffffffffffffffff191690565b60006040518251602084019350604067ffffffffffffffc060018301160160098282031060018103610452576040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f06104a4565b6000838310156103a2575080820151928290039260208410156103a25760001960208590036101000a0119169392505050565b60005b82811015610830576104ba848289610471565b85526104ca846020830189610471565b6020860152604081850310600181036104e65760808286038701535b506040830381146001810361050357602086018051600887021790525b5060405b608081101561058b57858101603f19810151603719820151601f19830151600b198401516002911891909218189081027ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe1663800000009091047c010000000100000001000000010000000100000001000000010000000116179052600c01610507565b5060805b61014081101561061457858101607f19810151606f19820151603f198301516017198401516004911891909218189081027ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc1663400000009091047c03000000030000000300000003000000030000000300000003000000031617905260180161058f565b508160008060005b60508110156108065760148104801561064c576001811461067c57600281146106aa57600381146106dd57610707565b6501000000000085046a010000000000000000000086048118600160781b870416189350635a8279999250610707565b650100000000008504600160781b86046a0100000000000000000000870418189350636ed9eba19250610707565b6a01000000000000000000008504600160781b8604818117650100000000008804169116179350638f1bbcdc9250610707565b650100000000008504600160781b86046a010000000000000000000087041818935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c015104019050740100000000000000000000000000000000000000008102650100000000008604179450506a0100000000000000000000633fffffff6a040000000000000000000086041663c00000006604000000000000870416170277ffffffff00ffffffff000000000000ffffffff00ffffffff851617935060018101905061061c565b5050509190910177ffffffff00ffffffff00ffffffff00ffffffff00ffffffff16906040016104a7565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b602081106108e857815183526108c7602084610ae1565b92506108d4602083610ae1565b91506108e1602082610ab8565b90506108b0565b905182516020929092036101000a6000190180199091169116179052565b60006060600085518551855188888860405160200161092a96959493929190610b3a565b6040516020818303038152906040529050835167ffffffffffffffff81111561095557610955610af4565b6040519080825280601f01601f19166020018201604052801561097f576020820181803683370190505b50915083516020830182516020840160055afa925050935093915050565b60008083601f8401126109af57600080fd5b50813567ffffffffffffffff8111156109c757600080fd5b6020830191508360208285010111156109df57600080fd5b9250929050565b600080600080600080606087890312156109ff57600080fd5b863567ffffffffffffffff80821115610a1757600080fd5b610a238a838b0161099d565b90985096506020890135915080821115610a3c57600080fd5b610a488a838b0161099d565b90965094506040890135915080821115610a6157600080fd5b50610a6e89828a0161099d565b979a9699509497509295939492505050565b634e487b7160e01b600052601160045260246000fd5b61ffff818116838216019080821115610ab157610ab1610a80565b5092915050565b8181038181111561031f5761031f610a80565b634e487b7160e01b600052603260045260246000fd5b8082018082111561031f5761031f610a80565b634e487b7160e01b600052604160045260246000fd5b6000815160005b81811015610b2b5760208185018101518683015201610b11565b50600093019283525090919050565b8681528560208201528460408201526000610b6a610b64610b5e6060850188610b0a565b86610b0a565b84610b0a565b9897505050505050505056fea26469706673582212207857b7c8a67e5fd64e3ccb8e7b2e6fbd8ac879a5659d7498b1bc12aeeba36c9764736f6c63430008110033", + "devdoc": { + "details": "Implements the DNSSEC RSASHA1 algorithm.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/RSASHA256Algorithm.json b/solidity/dns-contracts/deployments/sepolia/RSASHA256Algorithm.json new file mode 100644 index 0000000..48b7f5f --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/RSASHA256Algorithm.json @@ -0,0 +1,71 @@ +{ + "address": "0xd63a22BB8076022373E0577E10e3585A53B3b9Ce", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "key", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x3cb1273130bb057b878a138a2b3e6368b27ad4f1b703bf1fa9330fc8c2f0f010", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0xd63a22BB8076022373E0577E10e3585A53B3b9Ce", + "transactionIndex": 157, + "gasUsed": "448967", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x6e84cefadfc39dff680deeb73b9d73a961cdaa4cdbfd5327f1ed0baf6f845360", + "transactionHash": "0x3cb1273130bb057b878a138a2b3e6368b27ad4f1b703bf1fa9330fc8c2f0f010", + "logs": [], + "blockNumber": 4141616, + "cumulativeGasUsed": "19003956", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"sig\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC RSASHA256 algorithm.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol\":\"RSASHA256Algorithm\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/algorithms/Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\\n */\\ninterface Algorithm {\\n /**\\n * @dev Verifies a signature.\\n * @param key The public key to verify with.\\n * @param data The signed data to verify.\\n * @param signature The signature to verify.\\n * @return True iff the signature is valid.\\n */\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata signature\\n ) external view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xaf6825f9852c69f8e36540821d067b4550dd2263497af9d645309b6a0c457ba6\"},\"contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary ModexpPrecompile {\\n /**\\n * @dev Computes (base ^ exponent) % modulus over big numbers.\\n */\\n function modexp(\\n bytes memory base,\\n bytes memory exponent,\\n bytes memory modulus\\n ) internal view returns (bool success, bytes memory output) {\\n bytes memory input = abi.encodePacked(\\n uint256(base.length),\\n uint256(exponent.length),\\n uint256(modulus.length),\\n base,\\n exponent,\\n modulus\\n );\\n\\n output = new bytes(modulus.length);\\n\\n assembly {\\n success := staticcall(\\n gas(),\\n 5,\\n add(input, 32),\\n mload(input),\\n add(output, 32),\\n mload(modulus)\\n )\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb3d46284534eb99061d4c79968c2d0420b63a6649d118ef2ea3608396b85de3f\"},\"contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Algorithm.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./RSAVerify.sol\\\";\\n\\n/**\\n * @dev Implements the DNSSEC RSASHA256 algorithm.\\n */\\ncontract RSASHA256Algorithm is Algorithm {\\n using BytesUtils for *;\\n\\n function verify(\\n bytes calldata key,\\n bytes calldata data,\\n bytes calldata sig\\n ) external view override returns (bool) {\\n bytes memory exponent;\\n bytes memory modulus;\\n\\n uint16 exponentLen = uint16(key.readUint8(4));\\n if (exponentLen != 0) {\\n exponent = key.substring(5, exponentLen);\\n modulus = key.substring(\\n exponentLen + 5,\\n key.length - exponentLen - 5\\n );\\n } else {\\n exponentLen = key.readUint16(5);\\n exponent = key.substring(7, exponentLen);\\n modulus = key.substring(\\n exponentLen + 7,\\n key.length - exponentLen - 7\\n );\\n }\\n\\n // Recover the message from the signature\\n bool ok;\\n bytes memory result;\\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\\n\\n // Verify it ends with the hash of our data\\n return ok && sha256(data) == result.readBytes32(result.length - 32);\\n }\\n}\\n\",\"keccak256\":\"0x1d6ba44f41e957f9c53e6e5b88150cbb6c9f46e9da196502984ee0a53e9ac5a9\"},\"contracts/dnssec-oracle/algorithms/RSAVerify.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"./ModexpPrecompile.sol\\\";\\n\\nlibrary RSAVerify {\\n /**\\n * @dev Recovers the input data from an RSA signature, returning the result in S.\\n * @param N The RSA public modulus.\\n * @param E The RSA public exponent.\\n * @param S The signature to recover.\\n * @return True if the recovery succeeded.\\n */\\n function rsarecover(\\n bytes memory N,\\n bytes memory E,\\n bytes memory S\\n ) internal view returns (bool, bytes memory) {\\n return ModexpPrecompile.modexp(S, E, N);\\n }\\n}\\n\",\"keccak256\":\"0xb386daa80070f79399a2cb97a534f31660161ccd50662fabcf63e26cce064506\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610728806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e366004610539565b610057565b604051901515815260200160405180910390f35b600060608060006100a260048b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506102f59050565b60ff169050801561016e576100f760058261ffff168c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061031a9050565b92506101676101078260056105e9565b61ffff9081169060059061011d9085168d61060b565b610127919061060b565b8c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061031a9050565b9150610227565b6101b260058b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061039c9050565b90506101fe60078261ffff168c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061031a9050565b925061022461020e8260076105e9565b61ffff9081169060079061011d9085168d61060b565b91505b6000606061026c84868a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103c492505050565b90925090508180156102e557506102916020825161028a919061060b565b82906103df565b60028b8b6040516102a392919061061e565b602060405180830381855afa1580156102c0573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906102e3919061062e565b145b9c9b505050505050505050505050565b600082828151811061030957610309610647565b016020015160f81c90505b92915050565b8251606090610329838561065d565b111561033457600080fd5b60008267ffffffffffffffff81111561034f5761034f610670565b6040519080825280601f01601f191660200182016040528015610379576020820181803683370190505b50905060208082019086860101610391828287610403565b509095945050505050565b81516000906103ac83600261065d565b11156103b757600080fd5b50016002015161ffff1690565b600060606103d3838587610459565b91509150935093915050565b81516000906103ef83602061065d565b11156103fa57600080fd5b50016020015190565b6020811061043b578151835261041a60208461065d565b925061042760208361065d565b915061043460208261060b565b9050610403565b905182516020929092036101000a6000190180199091169116179052565b60006060600085518551855188888860405160200161047d969594939291906106b6565b6040516020818303038152906040529050835167ffffffffffffffff8111156104a8576104a8610670565b6040519080825280601f01601f1916602001820160405280156104d2576020820181803683370190505b50915083516020830182516020840160055afa925050935093915050565b60008083601f84011261050257600080fd5b50813567ffffffffffffffff81111561051a57600080fd5b60208301915083602082850101111561053257600080fd5b9250929050565b6000806000806000806060878903121561055257600080fd5b863567ffffffffffffffff8082111561056a57600080fd5b6105768a838b016104f0565b9098509650602089013591508082111561058f57600080fd5b61059b8a838b016104f0565b909650945060408901359150808211156105b457600080fd5b506105c189828a016104f0565b979a9699509497509295939492505050565b634e487b7160e01b600052601160045260246000fd5b61ffff818116838216019080821115610604576106046105d3565b5092915050565b81810381811115610314576103146105d3565b8183823760009101908152919050565b60006020828403121561064057600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b80820180821115610314576103146105d3565b634e487b7160e01b600052604160045260246000fd5b6000815160005b818110156106a7576020818501810151868301520161068d565b50600093019283525090919050565b86815285602082015284604082015260006106e66106e06106da6060850188610686565b86610686565b84610686565b9897505050505050505056fea264697066735822122081d54f6872821586c976d8d9aa106e2ea811afa445a713b0da099f753dd8e48364736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063de8f50a114610030575b600080fd5b61004361003e366004610539565b610057565b604051901515815260200160405180910390f35b600060608060006100a260048b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506102f59050565b60ff169050801561016e576100f760058261ffff168c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061031a9050565b92506101676101078260056105e9565b61ffff9081169060059061011d9085168d61060b565b610127919061060b565b8c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061031a9050565b9150610227565b6101b260058b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061039c9050565b90506101fe60078261ffff168c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505061031a9050565b925061022461020e8260076105e9565b61ffff9081169060079061011d9085168d61060b565b91505b6000606061026c84868a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103c492505050565b90925090508180156102e557506102916020825161028a919061060b565b82906103df565b60028b8b6040516102a392919061061e565b602060405180830381855afa1580156102c0573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906102e3919061062e565b145b9c9b505050505050505050505050565b600082828151811061030957610309610647565b016020015160f81c90505b92915050565b8251606090610329838561065d565b111561033457600080fd5b60008267ffffffffffffffff81111561034f5761034f610670565b6040519080825280601f01601f191660200182016040528015610379576020820181803683370190505b50905060208082019086860101610391828287610403565b509095945050505050565b81516000906103ac83600261065d565b11156103b757600080fd5b50016002015161ffff1690565b600060606103d3838587610459565b91509150935093915050565b81516000906103ef83602061065d565b11156103fa57600080fd5b50016020015190565b6020811061043b578151835261041a60208461065d565b925061042760208361065d565b915061043460208261060b565b9050610403565b905182516020929092036101000a6000190180199091169116179052565b60006060600085518551855188888860405160200161047d969594939291906106b6565b6040516020818303038152906040529050835167ffffffffffffffff8111156104a8576104a8610670565b6040519080825280601f01601f1916602001820160405280156104d2576020820181803683370190505b50915083516020830182516020840160055afa925050935093915050565b60008083601f84011261050257600080fd5b50813567ffffffffffffffff81111561051a57600080fd5b60208301915083602082850101111561053257600080fd5b9250929050565b6000806000806000806060878903121561055257600080fd5b863567ffffffffffffffff8082111561056a57600080fd5b6105768a838b016104f0565b9098509650602089013591508082111561058f57600080fd5b61059b8a838b016104f0565b909650945060408901359150808211156105b457600080fd5b506105c189828a016104f0565b979a9699509497509295939492505050565b634e487b7160e01b600052601160045260246000fd5b61ffff818116838216019080821115610604576106046105d3565b5092915050565b81810381811115610314576103146105d3565b8183823760009101908152919050565b60006020828403121561064057600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b80820180821115610314576103146105d3565b634e487b7160e01b600052604160045260246000fd5b6000815160005b818110156106a7576020818501810151868301520161068d565b50600093019283525090919050565b86815285602082015284604082015260006106e66106e06106da6060850188610686565b86610686565b84610686565b9897505050505050505056fea264697066735822122081d54f6872821586c976d8d9aa106e2ea811afa445a713b0da099f753dd8e48364736f6c63430008110033", + "devdoc": { + "details": "Implements the DNSSEC RSASHA256 algorithm.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/ReverseRegistrar.json b/solidity/dns-contracts/deployments/sepolia/ReverseRegistrar.json new file mode 100644 index 0000000..133865d --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/ReverseRegistrar.json @@ -0,0 +1,516 @@ +{ + "address": "0xA0a1AbcDAe1a2a4A2EF8e9113Ff0e02DD81DC0C6", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "ensAddr", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "ControllerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract NameResolver", + "name": "resolver", + "type": "address" + } + ], + "name": "DefaultResolverChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "ReverseClaimed", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "claim", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "claimForAddr", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "claimWithResolver", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "defaultResolver", + "outputs": [ + { + "internalType": "contract NameResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "node", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setDefaultResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "setName", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "setNameForAddr", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xf94c991d0d40013b455f2c4ed64805f6fe39d00e567c716782215a82dc65557e", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0xA0a1AbcDAe1a2a4A2EF8e9113Ff0e02DD81DC0C6", + "transactionIndex": 64, + "gasUsed": "825844", + "logsBloom": "0x00000000000000000000000000000000000000000000200000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000010000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000020000000000000000000000020000000000000000000000000000000000000000000", + "blockHash": "0x948e29d7ba4fda83fd0293504a7e03d6e64e13e2785335f75270d1878cdb69a0", + "transactionHash": "0xf94c991d0d40013b455f2c4ed64805f6fe39d00e567c716782215a82dc65557e", + "logs": [ + { + "transactionIndex": 64, + "blockNumber": 3789411, + "transactionHash": "0xf94c991d0d40013b455f2c4ed64805f6fe39d00e567c716782215a82dc65557e", + "address": "0xA0a1AbcDAe1a2a4A2EF8e9113Ff0e02DD81DC0C6", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8" + ], + "data": "0x", + "logIndex": 113, + "blockHash": "0x948e29d7ba4fda83fd0293504a7e03d6e64e13e2785335f75270d1878cdb69a0" + } + ], + "blockNumber": 3789411, + "cumulativeGasUsed": "7409741", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "numDeployments": 2, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"ensAddr\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"ControllerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract NameResolver\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"DefaultResolverChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"ReverseClaimed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"claimForAddr\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"claimWithResolver\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"defaultResolver\",\"outputs\":[{\"internalType\":\"contract NameResolver\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"node\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setDefaultResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"setNameForAddr\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"claim(address)\":{\"details\":\"Transfers ownership of the reverse ENS record associated with the calling account.\",\"params\":{\"owner\":\"The address to set as the owner of the reverse record in ENS.\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"claimForAddr(address,address,address)\":{\"details\":\"Transfers ownership of the reverse ENS record associated with the calling account.\",\"params\":{\"addr\":\"The reverse record to set\",\"owner\":\"The address to set as the owner of the reverse record in ENS.\",\"resolver\":\"The resolver of the reverse node\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"claimWithResolver(address,address)\":{\"details\":\"Transfers ownership of the reverse ENS record associated with the calling account.\",\"params\":{\"owner\":\"The address to set as the owner of the reverse record in ENS.\",\"resolver\":\"The address of the resolver to set; 0 to leave unchanged.\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"constructor\":{\"details\":\"Constructor\",\"params\":{\"ensAddr\":\"The address of the ENS registry.\"}},\"node(address)\":{\"details\":\"Returns the node hash for a given account's reverse records.\",\"params\":{\"addr\":\"The address to hash\"},\"returns\":{\"_0\":\"The ENS node hash.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setName(string)\":{\"details\":\"Sets the `name()` record for the reverse ENS record associated with the calling account. First updates the resolver to the default reverse resolver if necessary.\",\"params\":{\"name\":\"The name to set for this address.\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"setNameForAddr(address,address,address,string)\":{\"details\":\"Sets the `name()` record for the reverse ENS record associated with the account provided. Updates the resolver to a designated resolver Only callable by controllers and authorised users\",\"params\":{\"addr\":\"The reverse record to set\",\"name\":\"The name to set for this address.\",\"owner\":\"The owner of the reverse node\",\"resolver\":\"The resolver of the reverse node\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/reverseRegistrar/ReverseRegistrar.sol\":\"ReverseRegistrar\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IReverseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"../root/Controllable.sol\\\";\\n\\nabstract contract NameResolver {\\n function setName(bytes32 node, string memory name) public virtual;\\n}\\n\\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\\n\\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n// namehash('addr.reverse')\\n\\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\\n ENS public immutable ens;\\n NameResolver public defaultResolver;\\n\\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\\n event DefaultResolverChanged(NameResolver indexed resolver);\\n\\n /**\\n * @dev Constructor\\n * @param ensAddr The address of the ENS registry.\\n */\\n constructor(ENS ensAddr) {\\n ens = ensAddr;\\n\\n // Assign ownership of the reverse record to our deployer\\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\\n ensAddr.owner(ADDR_REVERSE_NODE)\\n );\\n if (address(oldRegistrar) != address(0x0)) {\\n oldRegistrar.claim(msg.sender);\\n }\\n }\\n\\n modifier authorised(address addr) {\\n require(\\n addr == msg.sender ||\\n controllers[msg.sender] ||\\n ens.isApprovedForAll(addr, msg.sender) ||\\n ownsContract(addr),\\n \\\"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\\\"\\n );\\n _;\\n }\\n\\n function setDefaultResolver(address resolver) public override onlyOwner {\\n require(\\n address(resolver) != address(0),\\n \\\"ReverseRegistrar: Resolver address must not be 0\\\"\\n );\\n defaultResolver = NameResolver(resolver);\\n emit DefaultResolverChanged(NameResolver(resolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claim(address owner) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, address(defaultResolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param addr The reverse record to set\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The resolver of the reverse node\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) public override authorised(addr) returns (bytes32) {\\n bytes32 labelHash = sha3HexAddress(addr);\\n bytes32 reverseNode = keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\\n );\\n emit ReverseClaimed(addr, reverseNode);\\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\\n return reverseNode;\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, resolver);\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the calling account. First updates the resolver to the default reverse\\n * resolver if necessary.\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setName(string memory name) public override returns (bytes32) {\\n return\\n setNameForAddr(\\n msg.sender,\\n msg.sender,\\n address(defaultResolver),\\n name\\n );\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the account provided. Updates the resolver to a designated resolver\\n * Only callable by controllers and authorised users\\n * @param addr The reverse record to set\\n * @param owner The owner of the reverse node\\n * @param resolver The resolver of the reverse node\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) public override returns (bytes32) {\\n bytes32 node = claimForAddr(addr, owner, resolver);\\n NameResolver(resolver).setName(node, name);\\n return node;\\n }\\n\\n /**\\n * @dev Returns the node hash for a given account's reverse records.\\n * @param addr The address to hash\\n * @return The ENS node hash.\\n */\\n function node(address addr) public pure override returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\\n );\\n }\\n\\n /**\\n * @dev An optimised function to compute the sha3 of the lower-case\\n * hexadecimal representation of an Ethereum address.\\n * @param addr The address to hash\\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\\n * input address.\\n */\\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\\n assembly {\\n for {\\n let i := 40\\n } gt(i, 0) {\\n\\n } {\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n }\\n\\n ret := keccak256(0, 40)\\n }\\n }\\n\\n function ownsContract(address addr) internal view returns (bool) {\\n try Ownable(addr).owner() returns (address owner) {\\n return owner == msg.sender;\\n } catch {\\n return false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd57d28e5791b4b44650a00f5ef6c725af53698ec33faeeaa3591f0dbd939559a\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"}},\"version\":1}", + "bytecode": "0x60a060405234801561001057600080fd5b5060405162000f5338038062000f53833981016040819052610031916101b6565b61003a3361014e565b6001600160a01b03811660808190526040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152600091906302571be390602401602060405180830381865afa1580156100a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ca91906101b6565b90506001600160a01b0381161561014757604051630f41a04d60e11b81523360048201526001600160a01b03821690631e83409a906024016020604051808303816000875af1158015610121573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061014591906101da565b505b50506101f3565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146101b357600080fd5b50565b6000602082840312156101c857600080fd5b81516101d38161019e565b9392505050565b6000602082840312156101ec57600080fd5b5051919050565b608051610d366200021d6000396000818161012d015281816102f001526105070152610d366000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063c66485b211610066578063c66485b2146101e1578063da8c229e146101f4578063e0dba60f14610227578063f2fde38b1461023a57600080fd5b80638da5cb5b146101aa578063bffbe61c146101bb578063c47f0027146101ce57600080fd5b806365669631116100c85780636566963114610167578063715018a61461017a5780637a806d6b14610184578063828eab0e1461019757600080fd5b80630f5a5466146100ef5780631e83409a146101155780633f15457f14610128575b600080fd5b6101026100fd366004610a25565b61024d565b6040519081526020015b60405180910390f35b610102610123366004610a5e565b610261565b61014f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b610102610175366004610a7b565b610283565b61018261056e565b005b610102610192366004610b82565b610582565b60025461014f906001600160a01b031681565b6000546001600160a01b031661014f565b6101026101c9366004610a5e565b610616565b6101026101dc366004610bf7565b610671565b6101826101ef366004610a5e565b61068e565b610217610202366004610a5e565b60016020526000908152604090205460ff1681565b604051901515815260200161010c565b610182610235366004610c42565b610769565b610182610248366004610a5e565b6107d0565b600061025a338484610283565b9392505050565b60025460009061027d90339084906001600160a01b0316610283565b92915050565b6000836001600160a01b0381163314806102ac57503360009081526001602052604090205460ff165b8061035b57506040517fe985e9c50000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610337573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035b9190610c70565b8061036a575061036a81610860565b6104075760405162461bcd60e51b815260206004820152605b60248201527f526576657273655265676973747261723a2043616c6c6572206973206e6f742060448201527f6120636f6e74726f6c6c6572206f7220617574686f726973656420627920616460648201527f6472657373206f7220746865206164647265737320697473656c660000000000608482015260a4015b60405180910390fd5b6000610412866108d9565b604080517f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2602080830191909152818301849052825180830384018152606090920192839052815191012091925081906001600160a01b038916907f6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e9290600090a36040517f5ef2c7f00000000000000000000000000000000000000000000000000000000081527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152602481018390526001600160a01b0387811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561054b57600080fd5b505af115801561055f573d6000803e3d6000fd5b50929998505050505050505050565b610576610959565b61058060006109b3565b565b600080610590868686610283565b6040517f773722130000000000000000000000000000000000000000000000000000000081529091506001600160a01b038516906377372213906105da9084908790600401610c8d565b600060405180830381600087803b1580156105f457600080fd5b505af1158015610608573d6000803e3d6000fd5b509298975050505050505050565b60007f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2610642836108d9565b604080516020810193909352820152606001604051602081830303815290604052805190602001209050919050565b60025460009061027d90339081906001600160a01b031685610582565b610696610959565b6001600160a01b0381166107125760405162461bcd60e51b815260206004820152603060248201527f526576657273655265676973747261723a205265736f6c76657220616464726560448201527f7373206d757374206e6f7420626520300000000000000000000000000000000060648201526084016103fe565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517feae17a84d9eb83d8c8eb317f9e7d64857bc363fa51674d996c023f4340c577cf90600090a250565b610771610959565b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b6107d8610959565b6001600160a01b0381166108545760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103fe565b61085d816109b3565b50565b6000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156108bc575060408051601f3d908101601f191682019092526108b991810190610ce3565b60015b6108c857506000919050565b6001600160a01b0316331492915050565b600060285b801561094d57600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a8153601090920491600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a81536010830492506108de565b50506028600020919050565b6000546001600160a01b031633146105805760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103fe565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461085d57600080fd5b60008060408385031215610a3857600080fd5b8235610a4381610a10565b91506020830135610a5381610a10565b809150509250929050565b600060208284031215610a7057600080fd5b813561025a81610a10565b600080600060608486031215610a9057600080fd5b8335610a9b81610a10565b92506020840135610aab81610a10565b91506040840135610abb81610a10565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112610b0657600080fd5b813567ffffffffffffffff80821115610b2157610b21610ac6565b604051601f8301601f19908116603f01168101908282118183101715610b4957610b49610ac6565b81604052838152866020858801011115610b6257600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060808587031215610b9857600080fd5b8435610ba381610a10565b93506020850135610bb381610a10565b92506040850135610bc381610a10565b9150606085013567ffffffffffffffff811115610bdf57600080fd5b610beb87828801610af5565b91505092959194509250565b600060208284031215610c0957600080fd5b813567ffffffffffffffff811115610c2057600080fd5b610c2c84828501610af5565b949350505050565b801515811461085d57600080fd5b60008060408385031215610c5557600080fd5b8235610c6081610a10565b91506020830135610a5381610c34565b600060208284031215610c8257600080fd5b815161025a81610c34565b82815260006020604081840152835180604085015260005b81811015610cc157858101830151858201606001528201610ca5565b506000606082860101526060601f19601f830116850101925050509392505050565b600060208284031215610cf557600080fd5b815161025a81610a1056fea2646970667358221220beab0412e54fd175ddb6fc54aabebbad253b933d875cac9f5991b7575afa240764736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063c66485b211610066578063c66485b2146101e1578063da8c229e146101f4578063e0dba60f14610227578063f2fde38b1461023a57600080fd5b80638da5cb5b146101aa578063bffbe61c146101bb578063c47f0027146101ce57600080fd5b806365669631116100c85780636566963114610167578063715018a61461017a5780637a806d6b14610184578063828eab0e1461019757600080fd5b80630f5a5466146100ef5780631e83409a146101155780633f15457f14610128575b600080fd5b6101026100fd366004610a25565b61024d565b6040519081526020015b60405180910390f35b610102610123366004610a5e565b610261565b61014f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b610102610175366004610a7b565b610283565b61018261056e565b005b610102610192366004610b82565b610582565b60025461014f906001600160a01b031681565b6000546001600160a01b031661014f565b6101026101c9366004610a5e565b610616565b6101026101dc366004610bf7565b610671565b6101826101ef366004610a5e565b61068e565b610217610202366004610a5e565b60016020526000908152604090205460ff1681565b604051901515815260200161010c565b610182610235366004610c42565b610769565b610182610248366004610a5e565b6107d0565b600061025a338484610283565b9392505050565b60025460009061027d90339084906001600160a01b0316610283565b92915050565b6000836001600160a01b0381163314806102ac57503360009081526001602052604090205460ff165b8061035b57506040517fe985e9c50000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610337573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035b9190610c70565b8061036a575061036a81610860565b6104075760405162461bcd60e51b815260206004820152605b60248201527f526576657273655265676973747261723a2043616c6c6572206973206e6f742060448201527f6120636f6e74726f6c6c6572206f7220617574686f726973656420627920616460648201527f6472657373206f7220746865206164647265737320697473656c660000000000608482015260a4015b60405180910390fd5b6000610412866108d9565b604080517f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2602080830191909152818301849052825180830384018152606090920192839052815191012091925081906001600160a01b038916907f6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e9290600090a36040517f5ef2c7f00000000000000000000000000000000000000000000000000000000081527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152602481018390526001600160a01b0387811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561054b57600080fd5b505af115801561055f573d6000803e3d6000fd5b50929998505050505050505050565b610576610959565b61058060006109b3565b565b600080610590868686610283565b6040517f773722130000000000000000000000000000000000000000000000000000000081529091506001600160a01b038516906377372213906105da9084908790600401610c8d565b600060405180830381600087803b1580156105f457600080fd5b505af1158015610608573d6000803e3d6000fd5b509298975050505050505050565b60007f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2610642836108d9565b604080516020810193909352820152606001604051602081830303815290604052805190602001209050919050565b60025460009061027d90339081906001600160a01b031685610582565b610696610959565b6001600160a01b0381166107125760405162461bcd60e51b815260206004820152603060248201527f526576657273655265676973747261723a205265736f6c76657220616464726560448201527f7373206d757374206e6f7420626520300000000000000000000000000000000060648201526084016103fe565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517feae17a84d9eb83d8c8eb317f9e7d64857bc363fa51674d996c023f4340c577cf90600090a250565b610771610959565b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b6107d8610959565b6001600160a01b0381166108545760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103fe565b61085d816109b3565b50565b6000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156108bc575060408051601f3d908101601f191682019092526108b991810190610ce3565b60015b6108c857506000919050565b6001600160a01b0316331492915050565b600060285b801561094d57600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a8153601090920491600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a81536010830492506108de565b50506028600020919050565b6000546001600160a01b031633146105805760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103fe565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461085d57600080fd5b60008060408385031215610a3857600080fd5b8235610a4381610a10565b91506020830135610a5381610a10565b809150509250929050565b600060208284031215610a7057600080fd5b813561025a81610a10565b600080600060608486031215610a9057600080fd5b8335610a9b81610a10565b92506020840135610aab81610a10565b91506040840135610abb81610a10565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112610b0657600080fd5b813567ffffffffffffffff80821115610b2157610b21610ac6565b604051601f8301601f19908116603f01168101908282118183101715610b4957610b49610ac6565b81604052838152866020858801011115610b6257600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060808587031215610b9857600080fd5b8435610ba381610a10565b93506020850135610bb381610a10565b92506040850135610bc381610a10565b9150606085013567ffffffffffffffff811115610bdf57600080fd5b610beb87828801610af5565b91505092959194509250565b600060208284031215610c0957600080fd5b813567ffffffffffffffff811115610c2057600080fd5b610c2c84828501610af5565b949350505050565b801515811461085d57600080fd5b60008060408385031215610c5557600080fd5b8235610c6081610a10565b91506020830135610a5381610c34565b600060208284031215610c8257600080fd5b815161025a81610c34565b82815260006020604081840152835180604085015260005b81811015610cc157858101830151858201606001528201610ca5565b506000606082860101526060601f19601f830116850101925050509392505050565b600060208284031215610cf557600080fd5b815161025a81610a1056fea2646970667358221220beab0412e54fd175ddb6fc54aabebbad253b933d875cac9f5991b7575afa240764736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "claim(address)": { + "details": "Transfers ownership of the reverse ENS record associated with the calling account.", + "params": { + "owner": "The address to set as the owner of the reverse record in ENS." + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "claimForAddr(address,address,address)": { + "details": "Transfers ownership of the reverse ENS record associated with the calling account.", + "params": { + "addr": "The reverse record to set", + "owner": "The address to set as the owner of the reverse record in ENS.", + "resolver": "The resolver of the reverse node" + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "claimWithResolver(address,address)": { + "details": "Transfers ownership of the reverse ENS record associated with the calling account.", + "params": { + "owner": "The address to set as the owner of the reverse record in ENS.", + "resolver": "The address of the resolver to set; 0 to leave unchanged." + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "constructor": { + "details": "Constructor", + "params": { + "ensAddr": "The address of the ENS registry." + } + }, + "node(address)": { + "details": "Returns the node hash for a given account's reverse records.", + "params": { + "addr": "The address to hash" + }, + "returns": { + "_0": "The ENS node hash." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "setName(string)": { + "details": "Sets the `name()` record for the reverse ENS record associated with the calling account. First updates the resolver to the default reverse resolver if necessary.", + "params": { + "name": "The name to set for this address." + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "setNameForAddr(address,address,address,string)": { + "details": "Sets the `name()` record for the reverse ENS record associated with the account provided. Updates the resolver to a designated resolver Only callable by controllers and authorised users", + "params": { + "addr": "The reverse record to set", + "name": "The name to set for this address.", + "owner": "The owner of the reverse node", + "resolver": "The resolver of the reverse node" + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 444, + "contract": "contracts/reverseRegistrar/ReverseRegistrar.sol:ReverseRegistrar", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 17772, + "contract": "contracts/reverseRegistrar/ReverseRegistrar.sol:ReverseRegistrar", + "label": "controllers", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 17444, + "contract": "contracts/reverseRegistrar/ReverseRegistrar.sol:ReverseRegistrar", + "label": "defaultResolver", + "offset": 0, + "slot": "2", + "type": "t_contract(NameResolver)17426" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(NameResolver)17426": { + "encoding": "inplace", + "label": "contract NameResolver", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/Root.json b/solidity/dns-contracts/deployments/sepolia/Root.json new file mode 100644 index 0000000..c0296c8 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/Root.json @@ -0,0 +1,363 @@ +{ + "address": "0xDaaF96c344f63131acadD0Ea35170E7892d3dfBA", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "ControllerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + } + ], + "name": "TLDLocked", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + } + ], + "name": "lock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "locked", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xe433fa12e9b945a28e43b67f0ce5969d97d88ba81774ee00bb14cd3c3c4a0ec1", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0xDaaF96c344f63131acadD0Ea35170E7892d3dfBA", + "transactionIndex": 103, + "gasUsed": "506765", + "logsBloom": "0x00000000000000000000000000000000000000000000200000800000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000001000000000000000000000002000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x693b2d9cb2f77de9eb950474d56ebf01169f139beb902ad546aeb01a967dac74", + "transactionHash": "0xe433fa12e9b945a28e43b67f0ce5969d97d88ba81774ee00bb14cd3c3c4a0ec1", + "logs": [ + { + "transactionIndex": 103, + "blockNumber": 3702729, + "transactionHash": "0xe433fa12e9b945a28e43b67f0ce5969d97d88ba81774ee00bb14cd3c3c4a0ec1", + "address": "0xDaaF96c344f63131acadD0Ea35170E7892d3dfBA", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8" + ], + "data": "0x", + "logIndex": 209, + "blockHash": "0x693b2d9cb2f77de9eb950474d56ebf01169f139beb902ad546aeb01a967dac74" + } + ], + "blockNumber": 3702729, + "cumulativeGasUsed": "9809764", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" + ], + "numDeployments": 1, + "solcInputHash": "d9c9257453e2e2db50b4d0f9157288b3", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"ControllerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"}],\"name\":\"TLDLocked\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"}],\"name\":\"lock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"locked\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setSubnodeOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/root/Root.sol\":\"Root\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1300},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"},\"contracts/root/Root.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"./Controllable.sol\\\";\\n\\ncontract Root is Ownable, Controllable {\\n bytes32 private constant ROOT_NODE = bytes32(0);\\n\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n\\n event TLDLocked(bytes32 indexed label);\\n\\n ENS public ens;\\n mapping(bytes32 => bool) public locked;\\n\\n constructor(ENS _ens) public {\\n ens = _ens;\\n }\\n\\n function setSubnodeOwner(\\n bytes32 label,\\n address owner\\n ) external onlyController {\\n require(!locked[label]);\\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\\n }\\n\\n function setResolver(address resolver) external onlyOwner {\\n ens.setResolver(ROOT_NODE, resolver);\\n }\\n\\n function lock(bytes32 label) external onlyOwner {\\n emit TLDLocked(label);\\n locked[label] = true;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return interfaceID == INTERFACE_META_ID;\\n }\\n}\\n\",\"keccak256\":\"0x469b281e1a9e1c3dad9c860a4ab3a7299a48355b0b0243713e0829193c39f50c\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161084638038061084683398101604081905261002f916100ad565b6100383361005d565b600280546001600160a01b0319166001600160a01b03929092169190911790556100dd565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100bf57600080fd5b81516001600160a01b03811681146100d657600080fd5b9392505050565b61075a806100ec6000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80638cb8ecec11610081578063da8c229e1161005b578063da8c229e146101da578063e0dba60f146101fd578063f2fde38b1461021057600080fd5b80638cb8ecec146101935780638da5cb5b146101a6578063cbe9e764146101b757600080fd5b80633f15457f116100b25780633f15457f1461014d5780634e543b2614610178578063715018a61461018b57600080fd5b806301670ba9146100ce57806301ffc9a7146100e3575b600080fd5b6100e16100dc36600461060a565b610223565b005b6101386100f1366004610623565b7fffffffff00000000000000000000000000000000000000000000000000000000167f01ffc9a7000000000000000000000000000000000000000000000000000000001490565b60405190151581526020015b60405180910390f35b600254610160906001600160a01b031681565b6040516001600160a01b039091168152602001610144565b6100e1610186366004610688565b610271565b6100e16102fb565b6100e16101a13660046106a3565b61030f565b6000546001600160a01b0316610160565b6101386101c536600461060a565b60036020526000908152604090205460ff1681565b6101386101e8366004610688565b60016020526000908152604090205460ff1681565b6100e161020b3660046106cf565b610451565b6100e161021e366004610688565b6104b8565b61022b610548565b60405181907f1764176cfa565853ba1ded547a830a9f9bff95231ef6fd228b3ddd617577756990600090a26000908152600360205260409020805460ff19166001179055565b610279610548565b6002546040517f1896f70a000000000000000000000000000000000000000000000000000000008152600060048201526001600160a01b03838116602483015290911690631896f70a90604401600060405180830381600087803b1580156102e057600080fd5b505af11580156102f4573d6000803e3d6000fd5b5050505050565b610303610548565b61030d60006105a2565b565b3360009081526001602052604090205460ff166103995760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f60448201527f6e74726f6c6c657200000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60008281526003602052604090205460ff16156103b557600080fd5b6002546040517f06ab592300000000000000000000000000000000000000000000000000000000815260006004820152602481018490526001600160a01b038381166044830152909116906306ab5923906064016020604051808303816000875af1158015610428573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044c919061070b565b505050565b610459610548565b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b6104c0610548565b6001600160a01b03811661053c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610390565b610545816105a2565b50565b6000546001600160a01b0316331461030d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610390565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561061c57600080fd5b5035919050565b60006020828403121561063557600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461066557600080fd5b9392505050565b80356001600160a01b038116811461068357600080fd5b919050565b60006020828403121561069a57600080fd5b6106658261066c565b600080604083850312156106b657600080fd5b823591506106c66020840161066c565b90509250929050565b600080604083850312156106e257600080fd5b6106eb8361066c565b91506020830135801515811461070057600080fd5b809150509250929050565b60006020828403121561071d57600080fd5b505191905056fea264697066735822122075c1888db9969e60d080343c0cb845ac9b7090b6cf77404f5597731d5717c03a64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100c95760003560e01c80638cb8ecec11610081578063da8c229e1161005b578063da8c229e146101da578063e0dba60f146101fd578063f2fde38b1461021057600080fd5b80638cb8ecec146101935780638da5cb5b146101a6578063cbe9e764146101b757600080fd5b80633f15457f116100b25780633f15457f1461014d5780634e543b2614610178578063715018a61461018b57600080fd5b806301670ba9146100ce57806301ffc9a7146100e3575b600080fd5b6100e16100dc36600461060a565b610223565b005b6101386100f1366004610623565b7fffffffff00000000000000000000000000000000000000000000000000000000167f01ffc9a7000000000000000000000000000000000000000000000000000000001490565b60405190151581526020015b60405180910390f35b600254610160906001600160a01b031681565b6040516001600160a01b039091168152602001610144565b6100e1610186366004610688565b610271565b6100e16102fb565b6100e16101a13660046106a3565b61030f565b6000546001600160a01b0316610160565b6101386101c536600461060a565b60036020526000908152604090205460ff1681565b6101386101e8366004610688565b60016020526000908152604090205460ff1681565b6100e161020b3660046106cf565b610451565b6100e161021e366004610688565b6104b8565b61022b610548565b60405181907f1764176cfa565853ba1ded547a830a9f9bff95231ef6fd228b3ddd617577756990600090a26000908152600360205260409020805460ff19166001179055565b610279610548565b6002546040517f1896f70a000000000000000000000000000000000000000000000000000000008152600060048201526001600160a01b03838116602483015290911690631896f70a90604401600060405180830381600087803b1580156102e057600080fd5b505af11580156102f4573d6000803e3d6000fd5b5050505050565b610303610548565b61030d60006105a2565b565b3360009081526001602052604090205460ff166103995760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f60448201527f6e74726f6c6c657200000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60008281526003602052604090205460ff16156103b557600080fd5b6002546040517f06ab592300000000000000000000000000000000000000000000000000000000815260006004820152602481018490526001600160a01b038381166044830152909116906306ab5923906064016020604051808303816000875af1158015610428573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044c919061070b565b505050565b610459610548565b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b6104c0610548565b6001600160a01b03811661053c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610390565b610545816105a2565b50565b6000546001600160a01b0316331461030d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610390565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561061c57600080fd5b5035919050565b60006020828403121561063557600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461066557600080fd5b9392505050565b80356001600160a01b038116811461068357600080fd5b919050565b60006020828403121561069a57600080fd5b6106658261066c565b600080604083850312156106b657600080fd5b823591506106c66020840161066c565b90509250929050565b600080604083850312156106e257600080fd5b6106eb8361066c565b91506020830135801515811461070057600080fd5b809150509250929050565b60006020828403121561071d57600080fd5b505191905056fea264697066735822122075c1888db9969e60d080343c0cb845ac9b7090b6cf77404f5597731d5717c03a64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 444, + "contract": "contracts/root/Root.sol:Root", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 17772, + "contract": "contracts/root/Root.sol:Root", + "label": "controllers", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 17902, + "contract": "contracts/root/Root.sol:Root", + "label": "ens", + "offset": 0, + "slot": "2", + "type": "t_contract(ENS)14086" + }, + { + "astId": 17906, + "contract": "contracts/root/Root.sol:Root", + "label": "locked", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_bytes32,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(ENS)14086": { + "encoding": "inplace", + "label": "contract ENS", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_bytes32,t_bool)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/SHA1Digest.json b/solidity/dns-contracts/deployments/sepolia/SHA1Digest.json new file mode 100644 index 0000000..f371e59 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/SHA1Digest.json @@ -0,0 +1,77 @@ +{ + "address": "0x0e3656B31D7b1DD662cCf73C0547A73e5dD79B71", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x278cd6b89c45dec7af54320c065254cb3d8f48bd7974732dfc14f4ab613fa2d5", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x0e3656B31D7b1DD662cCf73C0547A73e5dD79B71", + "transactionIndex": 48, + "gasUsed": "459448", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x792761abb509fa9d6bf11cf800d241ddbdbfa83c3f3ee98d9a393e2f26305671", + "transactionHash": "0x278cd6b89c45dec7af54320c065254cb3d8f48bd7974732dfc14f4ab613fa2d5", + "logs": [], + "blockNumber": 4141619, + "cumulativeGasUsed": "11084998", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC SHA1 digest.\",\"kind\":\"dev\",\"methods\":{\"verify(bytes,bytes)\":{\"details\":\"Verifies a cryptographic hash.\",\"params\":{\"data\":\"The data to hash.\",\"hash\":\"The hash to compare to.\"},\"returns\":{\"_0\":\"True iff the hashed data matches the provided hash value.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/digests/SHA1Digest.sol\":\"SHA1Digest\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/solsha1/contracts/SHA1.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary SHA1 {\\n event Debug(bytes32 x);\\n\\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\\n assembly {\\n // Get a safe scratch location\\n let scratch := mload(0x40)\\n\\n // Get the data length, and point data at the first byte\\n let len := mload(data)\\n data := add(data, 32)\\n\\n // Find the length after padding\\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\\n switch lt(sub(totallen, len), 9)\\n case 1 { totallen := add(totallen, 64) }\\n\\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\\n\\n function readword(ptr, off, count) -> result {\\n result := 0\\n if lt(off, count) {\\n result := mload(add(ptr, off))\\n count := sub(count, off)\\n if lt(count, 32) {\\n let mask := not(sub(exp(256, sub(32, count)), 1))\\n result := and(result, mask)\\n }\\n }\\n }\\n\\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\\n mstore(scratch, readword(data, i, len))\\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\\n\\n // If we loaded the last byte, store the terminator byte\\n switch lt(sub(len, i), 64)\\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\\n\\n // If this is the last block, store the length\\n switch eq(i, sub(totallen, 64))\\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\\n\\n // Expand the 16 32-bit words into 80\\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\\n mstore(add(scratch, j), temp)\\n }\\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\\n mstore(add(scratch, j), temp)\\n }\\n\\n let x := h\\n let f := 0\\n let k := 0\\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\\n switch div(j, 20)\\n case 0 {\\n // f = d xor (b and (c xor d))\\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\\n f := and(div(x, 0x1000000000000000000000000000000), f)\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x5A827999\\n }\\n case 1{\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0x6ED9EBA1\\n }\\n case 2 {\\n // f = (b and c) or (d and (b or c))\\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := and(div(x, 0x10000000000), f)\\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\\n k := 0x8F1BBCDC\\n }\\n case 3 {\\n // f = b xor c xor d\\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\\n f := xor(div(x, 0x10000000000), f)\\n k := 0xCA62C1D6\\n }\\n // temp = (a leftrotate 5) + f + e + k + w[i]\\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\\n temp := add(f, temp)\\n temp := add(and(x, 0xFFFFFFFF), temp)\\n temp := add(k, temp)\\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\\n }\\n\\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\\n }\\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x746d9b85de197afbc13182cbe4ba4f7917f19594e07c655d6a0c85fdf7460a8a\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC digest.\\n */\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(\\n bytes calldata data,\\n bytes calldata hash\\n ) external pure virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x8ea926b2db0578c4ad7fce4582fc0f6f0f9efee8dca2085dbdb9984f18941e28\"},\"contracts/dnssec-oracle/digests/SHA1Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Digest.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\nimport \\\"@ensdomains/solsha1/contracts/SHA1.sol\\\";\\n\\n/**\\n * @dev Implements the DNSSEC SHA1 digest.\\n */\\ncontract SHA1Digest is Digest {\\n using BytesUtils for *;\\n\\n function verify(\\n bytes calldata data,\\n bytes calldata hash\\n ) external pure override returns (bool) {\\n require(hash.length == 20, \\\"Invalid sha1 hash length\\\");\\n bytes32 expected = hash.readBytes20(0);\\n bytes20 computed = SHA1.sha1(data);\\n return expected == computed;\\n }\\n}\\n\",\"keccak256\":\"0x56f4e188f9c5ea120354ff4d00555c3b76b5837be00a1564fed608e22a7dc8aa\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061076c806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004361003e36600461068a565b610057565b604051901515815260200160405180910390f35b6000601482146100c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e76616c696420736861312068617368206c656e6774680000000000000000604482015260640160405180910390fd5b600061010d600085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061017c9050565b6bffffffffffffffffffffffff19169050600061015f87878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101af92505050565b6bffffffffffffffffffffffff1916919091149695505050505050565b815160009061018c8360146106f6565b111561019757600080fd5b5001602001516bffffffffffffffffffffffff191690565b60006040518251602084019350604067ffffffffffffffc0600183011601600982820310600181036101e2576040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f0610235565b60008383101561022e5750808201519282900392602084101561022e5760001960208590036101000a0119165b9392505050565b60005b828110156105c15761024b848289610201565b855261025b846020830189610201565b6020860152604081850310600181036102775760808286038701535b506040830381146001810361029457602086018051600887021790525b5060405b608081101561031c57858101603f19810151603719820151601f19830151600b198401516002911891909218189081027ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe1663800000009091047c010000000100000001000000010000000100000001000000010000000116179052600c01610298565b5060805b6101408110156103a557858101607f19810151606f19820151603f198301516017198401516004911891909218189081027ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc1663400000009091047c030000000300000003000000030000000300000003000000030000000316179052601801610320565b508160008060005b6050811015610597576014810480156103dd576001811461040d576002811461043b576003811461046e57610498565b6501000000000085046a010000000000000000000086048118600160781b870416189350635a8279999250610498565b650100000000008504600160781b86046a0100000000000000000000870418189350636ed9eba19250610498565b6a01000000000000000000008504600160781b8604818117650100000000008804169116179350638f1bbcdc9250610498565b650100000000008504600160781b86046a010000000000000000000087041818935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c015104019050740100000000000000000000000000000000000000008102650100000000008604179450506a0100000000000000000000633fffffff6a040000000000000000000086041663c00000006604000000000000870416170277ffffffff00ffffffff000000000000ffffffff00ffffffff85161793506001810190506103ad565b5050509190910177ffffffff00ffffffff00ffffffff00ffffffff00ffffffff1690604001610238565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b60008083601f84011261065357600080fd5b50813567ffffffffffffffff81111561066b57600080fd5b60208301915083602082850101111561068357600080fd5b9250929050565b600080600080604085870312156106a057600080fd5b843567ffffffffffffffff808211156106b857600080fd5b6106c488838901610641565b909650945060208701359150808211156106dd57600080fd5b506106ea87828801610641565b95989497509550505050565b80820180821115610730577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea26469706673582212201eb056a89a6b6b67ba5acc9d1d278299eadfc218cf0f5baba761aa60461f441964736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004361003e36600461068a565b610057565b604051901515815260200160405180910390f35b6000601482146100c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f496e76616c696420736861312068617368206c656e6774680000000000000000604482015260640160405180910390fd5b600061010d600085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061017c9050565b6bffffffffffffffffffffffff19169050600061015f87878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101af92505050565b6bffffffffffffffffffffffff1916919091149695505050505050565b815160009061018c8360146106f6565b111561019757600080fd5b5001602001516bffffffffffffffffffffffff191690565b60006040518251602084019350604067ffffffffffffffc0600183011601600982820310600181036101e2576040820191505b50776745230100efcdab890098badcfe001032547600c3d2e1f0610235565b60008383101561022e5750808201519282900392602084101561022e5760001960208590036101000a0119165b9392505050565b60005b828110156105c15761024b848289610201565b855261025b846020830189610201565b6020860152604081850310600181036102775760808286038701535b506040830381146001810361029457602086018051600887021790525b5060405b608081101561031c57858101603f19810151603719820151601f19830151600b198401516002911891909218189081027ffffffffefffffffefffffffefffffffefffffffefffffffefffffffefffffffe1663800000009091047c010000000100000001000000010000000100000001000000010000000116179052600c01610298565b5060805b6101408110156103a557858101607f19810151606f19820151603f198301516017198401516004911891909218189081027ffffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffcfffffffc1663400000009091047c030000000300000003000000030000000300000003000000030000000316179052601801610320565b508160008060005b6050811015610597576014810480156103dd576001811461040d576002811461043b576003811461046e57610498565b6501000000000085046a010000000000000000000086048118600160781b870416189350635a8279999250610498565b650100000000008504600160781b86046a0100000000000000000000870418189350636ed9eba19250610498565b6a01000000000000000000008504600160781b8604818117650100000000008804169116179350638f1bbcdc9250610498565b650100000000008504600160781b86046a010000000000000000000087041818935063ca62c1d692505b50601f770800000000000000000000000000000000000000000000008504168063ffffffe073080000000000000000000000000000000000000087041617905080840190508063ffffffff86160190508083019050807c0100000000000000000000000000000000000000000000000000000000600484028c015104019050740100000000000000000000000000000000000000008102650100000000008604179450506a0100000000000000000000633fffffff6a040000000000000000000086041663c00000006604000000000000870416170277ffffffff00ffffffff000000000000ffffffff00ffffffff85161793506001810190506103ad565b5050509190910177ffffffff00ffffffff00ffffffff00ffffffff00ffffffff1690604001610238565b506c0100000000000000000000000063ffffffff821667ffffffff000000006101008404166bffffffff0000000000000000620100008504166fffffffff000000000000000000000000630100000086041673ffffffff000000000000000000000000000000006401000000008704161717171702945050505050919050565b60008083601f84011261065357600080fd5b50813567ffffffffffffffff81111561066b57600080fd5b60208301915083602082850101111561068357600080fd5b9250929050565b600080600080604085870312156106a057600080fd5b843567ffffffffffffffff808211156106b857600080fd5b6106c488838901610641565b909650945060208701359150808211156106dd57600080fd5b506106ea87828801610641565b95989497509550505050565b80820180821115610730577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea26469706673582212201eb056a89a6b6b67ba5acc9d1d278299eadfc218cf0f5baba761aa60461f441964736f6c63430008110033", + "devdoc": { + "details": "Implements the DNSSEC SHA1 digest.", + "kind": "dev", + "methods": { + "verify(bytes,bytes)": { + "details": "Verifies a cryptographic hash.", + "params": { + "data": "The data to hash.", + "hash": "The hash to compare to." + }, + "returns": { + "_0": "True iff the hashed data matches the provided hash value." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/SHA256Digest.json b/solidity/dns-contracts/deployments/sepolia/SHA256Digest.json new file mode 100644 index 0000000..cf12194 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/SHA256Digest.json @@ -0,0 +1,77 @@ +{ + "address": "0x975E539780920aE80314B64A9aDf9996cbc71bA4", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0xc1445f64a1b384de31bf17e7c56dfea02b0502b82522b99b064421a367caafcc", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x975E539780920aE80314B64A9aDf9996cbc71bA4", + "transactionIndex": 59, + "gasUsed": "211310", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x50fe9c936f8084feb85872b05e864d547cdbb1f9e6fc2cc0308c7546aef0f9ab", + "transactionHash": "0xc1445f64a1b384de31bf17e7c56dfea02b0502b82522b99b064421a367caafcc", + "logs": [], + "blockNumber": 4141620, + "cumulativeGasUsed": "9866379", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implements the DNSSEC SHA256 digest.\",\"kind\":\"dev\",\"methods\":{\"verify(bytes,bytes)\":{\"details\":\"Verifies a cryptographic hash.\",\"params\":{\"data\":\"The data to hash.\",\"hash\":\"The hash to compare to.\"},\"returns\":{\"_0\":\"True iff the hashed data matches the provided hash value.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnssec-oracle/digests/SHA256Digest.sol\":\"SHA256Digest\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"},\"contracts/dnssec-oracle/digests/Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\n/**\\n * @dev An interface for contracts implementing a DNSSEC digest.\\n */\\ninterface Digest {\\n /**\\n * @dev Verifies a cryptographic hash.\\n * @param data The data to hash.\\n * @param hash The hash to compare to.\\n * @return True iff the hashed data matches the provided hash value.\\n */\\n function verify(\\n bytes calldata data,\\n bytes calldata hash\\n ) external pure virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x8ea926b2db0578c4ad7fce4582fc0f6f0f9efee8dca2085dbdb9984f18941e28\"},\"contracts/dnssec-oracle/digests/SHA256Digest.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"./Digest.sol\\\";\\nimport \\\"../BytesUtils.sol\\\";\\n\\n/**\\n * @dev Implements the DNSSEC SHA256 digest.\\n */\\ncontract SHA256Digest is Digest {\\n using BytesUtils for *;\\n\\n function verify(\\n bytes calldata data,\\n bytes calldata hash\\n ) external pure override returns (bool) {\\n require(hash.length == 32, \\\"Invalid sha256 hash length\\\");\\n return sha256(data) == hash.readBytes32(0);\\n }\\n}\\n\",\"keccak256\":\"0x0531c6764434ea17d967f079ed2299b1f83606e891dbdaa92500d43ef64cf126\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506102df806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004361003e3660046101d4565b610057565b604051901515815260200160405180910390f35b6000602082146100c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f496e76616c6964207368613235362068617368206c656e677468000000000000604482015260640160405180910390fd5b61010b600084848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506101679050565b6002868660405161011d929190610240565b602060405180830381855afa15801561013a573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061015d9190610250565b1495945050505050565b8151600090610177836020610269565b111561018257600080fd5b50016020015190565b60008083601f84011261019d57600080fd5b50813567ffffffffffffffff8111156101b557600080fd5b6020830191508360208285010111156101cd57600080fd5b9250929050565b600080600080604085870312156101ea57600080fd5b843567ffffffffffffffff8082111561020257600080fd5b61020e8883890161018b565b9096509450602087013591508082111561022757600080fd5b506102348782880161018b565b95989497509550505050565b8183823760009101908152919050565b60006020828403121561026257600080fd5b5051919050565b808201808211156102a3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea26469706673582212202348aaafc43a5bd6086d9011d799efff422cd74c984a03fe13c85cc4d45e842b64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063f7e83aee14610030575b600080fd5b61004361003e3660046101d4565b610057565b604051901515815260200160405180910390f35b6000602082146100c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f496e76616c6964207368613235362068617368206c656e677468000000000000604482015260640160405180910390fd5b61010b600084848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506101679050565b6002868660405161011d929190610240565b602060405180830381855afa15801561013a573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061015d9190610250565b1495945050505050565b8151600090610177836020610269565b111561018257600080fd5b50016020015190565b60008083601f84011261019d57600080fd5b50813567ffffffffffffffff8111156101b557600080fd5b6020830191508360208285010111156101cd57600080fd5b9250929050565b600080600080604085870312156101ea57600080fd5b843567ffffffffffffffff8082111561020257600080fd5b61020e8883890161018b565b9096509450602087013591508082111561022757600080fd5b506102348782880161018b565b95989497509550505050565b8183823760009101908152919050565b60006020828403121561026257600080fd5b5051919050565b808201808211156102a3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea26469706673582212202348aaafc43a5bd6086d9011d799efff422cd74c984a03fe13c85cc4d45e842b64736f6c63430008110033", + "devdoc": { + "details": "Implements the DNSSEC SHA256 digest.", + "kind": "dev", + "methods": { + "verify(bytes,bytes)": { + "details": "Verifies a cryptographic hash.", + "params": { + "data": "The data to hash.", + "hash": "The hash to compare to." + }, + "returns": { + "_0": "True iff the hashed data matches the provided hash value." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/SimplePublicSuffixList.json b/solidity/dns-contracts/deployments/sepolia/SimplePublicSuffixList.json new file mode 100644 index 0000000..d3765c1 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/SimplePublicSuffixList.json @@ -0,0 +1,190 @@ +{ + "address": "0x378079741D25489F7c131968b3CEaf93614F02a7", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "suffix", + "type": "bytes" + } + ], + "name": "SuffixAdded", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "names", + "type": "bytes[]" + } + ], + "name": "addPublicSuffixes", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "isPublicSuffix", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x5161da983c75517735d3d4e6eca462e91079296bf539ede5f75b95cc40a5137c", + "receipt": { + "to": null, + "from": "0xb6B8B9dD5Ad1582f854bB7e7CBE49B9E4EC60eb7", + "contractAddress": "0x378079741D25489F7c131968b3CEaf93614F02a7", + "transactionIndex": 30, + "gasUsed": "383265", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xe5aabda3e182bf1b47fdf559a8e9265932eba13e565da40d7e8c1dc07e5a1365", + "transactionHash": "0x5161da983c75517735d3d4e6eca462e91079296bf539ede5f75b95cc40a5137c", + "logs": [], + "blockNumber": 5107919, + "cumulativeGasUsed": "3160597", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "92997fb6810aa29dfb8513e2c431e302", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"SuffixAdded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"names\",\"type\":\"bytes[]\"}],\"name\":\"addPublicSuffixes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"isPublicSuffix\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnsregistrar/SimplePublicSuffixList.sol\":\"SimplePublicSuffixList\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/dnsregistrar/PublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\ninterface PublicSuffixList {\\n function isPublicSuffix(bytes calldata name) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x12158ba8838ee2b1ebb0178a52d2f4d54dcc68282d569226e62afc2b0dccbbac\"},\"contracts/dnsregistrar/SimplePublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\npragma experimental ABIEncoderV2;\\n\\nimport \\\"../root/Ownable.sol\\\";\\nimport \\\"./PublicSuffixList.sol\\\";\\n\\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\\n mapping(bytes => bool) suffixes;\\n\\n event SuffixAdded(bytes suffix);\\n\\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\\n for (uint256 i = 0; i < names.length; i++) {\\n suffixes[names[i]] = true;\\n emit SuffixAdded(names[i]);\\n }\\n }\\n\\n function isPublicSuffix(\\n bytes calldata name\\n ) external view override returns (bool) {\\n return suffixes[name];\\n }\\n}\\n\",\"keccak256\":\"0x0cafa3192dc3731329cf74678829cc1bf578c3db2492a829417c0301fd09f3a2\"},\"contracts/root/Ownable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\ncontract Ownable {\\n address public owner;\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n modifier onlyOwner() {\\n require(isOwner(msg.sender));\\n _;\\n }\\n\\n constructor() public {\\n owner = msg.sender;\\n }\\n\\n function transferOwnership(address newOwner) public onlyOwner {\\n emit OwnershipTransferred(owner, newOwner);\\n owner = newOwner;\\n }\\n\\n function isOwner(address addr) public view returns (bool) {\\n return owner == addr;\\n }\\n}\\n\",\"keccak256\":\"0xd06845ede20815e1a6d5b36fec21d7b90ea24390f24a9b31e4220c90b2ff3252\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50600080546001600160a01b03191633179055610592806100326000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80636329cdfc116100505780636329cdfc146100b65780638da5cb5b146100cb578063f2fde38b146100f657600080fd5b80632f54bf6e1461006c5780634f89059e146100a3575b600080fd5b61008e61007a36600461029a565b6000546001600160a01b0390811691161490565b60405190151581526020015b60405180910390f35b61008e6100b13660046102ca565b610109565b6100c96100c4366004610383565b610138565b005b6000546100de906001600160a01b031681565b6040516001600160a01b03909116815260200161009a565b6100c961010436600461029a565b610210565b60006001838360405161011d92919061049c565b9081526040519081900360200190205460ff16905092915050565b6000546001600160a01b0316331461014f57600080fd5b60005b815181101561020c57600180838381518110610170576101706104ac565b602002602001015160405161018591906104e6565b908152602001604051809103902060006101000a81548160ff0219169083151502179055507f7cad7c0907646b87ae240d676052692501082856f06ba8e2589e239a77453b098282815181106101dd576101dd6104ac565b60200260200101516040516101f29190610502565b60405180910390a18061020481610535565b915050610152565b5050565b6000546001600160a01b0316331461022757600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6000602082840312156102ac57600080fd5b81356001600160a01b03811681146102c357600080fd5b9392505050565b600080602083850312156102dd57600080fd5b823567ffffffffffffffff808211156102f557600080fd5b818501915085601f83011261030957600080fd5b81358181111561031857600080fd5b86602082850101111561032a57600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561037b5761037b61033c565b604052919050565b6000602080838503121561039657600080fd5b823567ffffffffffffffff808211156103ae57600080fd5b8185019150601f86818401126103c357600080fd5b8235828111156103d5576103d561033c565b8060051b6103e4868201610352565b918252848101860191868101908a8411156103fe57600080fd5b87870192505b8383101561048e5782358681111561041c5760008081fd5b8701603f81018c1361042e5760008081fd5b888101356040888211156104445761044461033c565b610455828901601f19168c01610352565b8281528e8284860101111561046a5760008081fd5b828285018d83013760009281018c0192909252508352509187019190870190610404565b9a9950505050505050505050565b8183823760009101908152919050565b634e487b7160e01b600052603260045260246000fd5b60005b838110156104dd5781810151838201526020016104c5565b50506000910152565b600082516104f88184602087016104c2565b9190910192915050565b60208152600082518060208401526105218160408501602087016104c2565b601f01601f19169190910160400192915050565b60006001820161055557634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220c01b7cf9f606016ad0718eed2ea7820c75cfc73137245ea92220d234e7703dc264736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100675760003560e01c80636329cdfc116100505780636329cdfc146100b65780638da5cb5b146100cb578063f2fde38b146100f657600080fd5b80632f54bf6e1461006c5780634f89059e146100a3575b600080fd5b61008e61007a36600461029a565b6000546001600160a01b0390811691161490565b60405190151581526020015b60405180910390f35b61008e6100b13660046102ca565b610109565b6100c96100c4366004610383565b610138565b005b6000546100de906001600160a01b031681565b6040516001600160a01b03909116815260200161009a565b6100c961010436600461029a565b610210565b60006001838360405161011d92919061049c565b9081526040519081900360200190205460ff16905092915050565b6000546001600160a01b0316331461014f57600080fd5b60005b815181101561020c57600180838381518110610170576101706104ac565b602002602001015160405161018591906104e6565b908152602001604051809103902060006101000a81548160ff0219169083151502179055507f7cad7c0907646b87ae240d676052692501082856f06ba8e2589e239a77453b098282815181106101dd576101dd6104ac565b60200260200101516040516101f29190610502565b60405180910390a18061020481610535565b915050610152565b5050565b6000546001600160a01b0316331461022757600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6000602082840312156102ac57600080fd5b81356001600160a01b03811681146102c357600080fd5b9392505050565b600080602083850312156102dd57600080fd5b823567ffffffffffffffff808211156102f557600080fd5b818501915085601f83011261030957600080fd5b81358181111561031857600080fd5b86602082850101111561032a57600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561037b5761037b61033c565b604052919050565b6000602080838503121561039657600080fd5b823567ffffffffffffffff808211156103ae57600080fd5b8185019150601f86818401126103c357600080fd5b8235828111156103d5576103d561033c565b8060051b6103e4868201610352565b918252848101860191868101908a8411156103fe57600080fd5b87870192505b8383101561048e5782358681111561041c5760008081fd5b8701603f81018c1361042e5760008081fd5b888101356040888211156104445761044461033c565b610455828901601f19168c01610352565b8281528e8284860101111561046a5760008081fd5b828285018d83013760009281018c0192909252508352509187019190870190610404565b9a9950505050505050505050565b8183823760009101908152919050565b634e487b7160e01b600052603260045260246000fd5b60005b838110156104dd5781810151838201526020016104c5565b50506000910152565b600082516104f88184602087016104c2565b9190910192915050565b60208152600082518060208401526105218160408501602087016104c2565b601f01601f19169190910160400192915050565b60006001820161055557634e487b7160e01b600052601160045260246000fd5b506001019056fea2646970667358221220c01b7cf9f606016ad0718eed2ea7820c75cfc73137245ea92220d234e7703dc264736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 80, + "contract": "contracts/dnsregistrar/SimplePublicSuffixList.sol:SimplePublicSuffixList", + "label": "owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 22, + "contract": "contracts/dnsregistrar/SimplePublicSuffixList.sol:SimplePublicSuffixList", + "label": "suffixes", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes_memory_ptr,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes_memory_ptr": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes_memory_ptr,t_bool)": { + "encoding": "mapping", + "key": "t_bytes_memory_ptr", + "label": "mapping(bytes => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/StaticBulkRenewal.json b/solidity/dns-contracts/deployments/sepolia/StaticBulkRenewal.json new file mode 100644 index 0000000..e88244e --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/StaticBulkRenewal.json @@ -0,0 +1,130 @@ +{ + "address": "0x4EF77b90762Eddb33C8Eba5B5a19558DaE53D7a1", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ETHRegistrarController", + "name": "_controller", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "names", + "type": "string[]" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renewAll", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "names", + "type": "string[]" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "rentPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "total", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x25fed620ee97bb93ba94b97b4670eac8ebf4347c6a3a49809a968de63fded854", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x4EF77b90762Eddb33C8Eba5B5a19558DaE53D7a1", + "transactionIndex": 45, + "gasUsed": "396872", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x15ca0a028e68b6f72d21a463cc6e03304c007b46e42fe4fb8bc2e92fdc85165e", + "transactionHash": "0x25fed620ee97bb93ba94b97b4670eac8ebf4347c6a3a49809a968de63fded854", + "logs": [], + "blockNumber": 3914901, + "cumulativeGasUsed": "12909136", + "status": 1, + "byzantium": true + }, + "args": [ + "0xFED6a969AaA60E4961FCD3EBF1A2e8913ac65B72" + ], + "numDeployments": 1, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ETHRegistrarController\",\"name\":\"_controller\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"names\",\"type\":\"string[]\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"renewAll\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"names\",\"type\":\"string[]\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"rentPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/StaticBulkRenewal.sol\":\"StaticBulkRenewal\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x6392f2cfe3a5ee802227fe7a2dfd47096d881aec89bddd214b35c5b46d3cd941\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/ERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721.sol\\\";\\nimport \\\"./IERC721Receiver.sol\\\";\\nimport \\\"./extensions/IERC721Metadata.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\nimport \\\"../../utils/Strings.sol\\\";\\nimport \\\"../../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\n * {ERC721Enumerable}.\\n */\\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\\n using Address for address;\\n using Strings for uint256;\\n\\n // Token name\\n string private _name;\\n\\n // Token symbol\\n string private _symbol;\\n\\n // Mapping from token ID to owner address\\n mapping(uint256 => address) private _owners;\\n\\n // Mapping owner address to token count\\n mapping(address => uint256) private _balances;\\n\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) private _tokenApprovals;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IERC721).interfaceId ||\\n interfaceId == type(IERC721Metadata).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721-balanceOf}.\\n */\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\n return _balances[owner];\\n }\\n\\n /**\\n * @dev See {IERC721-ownerOf}.\\n */\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\n address owner = _ownerOf(tokenId);\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n _requireMinted(tokenId);\\n\\n string memory baseURI = _baseURI();\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\n }\\n\\n /**\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\n * by default, can be overridden in child contracts.\\n */\\n function _baseURI() internal view virtual returns (string memory) {\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual override {\\n address owner = ERC721.ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\n _requireMinted(tokenId);\\n\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC721-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC721-isApprovedForAll}.\\n */\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[owner][operator];\\n }\\n\\n /**\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n _safeTransfer(from, to, tokenId, data);\\n }\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\n *\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeTransfer(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) internal virtual {\\n _transfer(from, to, tokenId);\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n }\\n\\n /**\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\n }\\n\\n /**\\n * @dev Returns whether `tokenId` exists.\\n *\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\n *\\n * Tokens start existing when they are minted (`_mint`),\\n * and stop existing when they are burned (`_burn`).\\n */\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\n return _ownerOf(tokenId) != address(0);\\n }\\n\\n /**\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\n address owner = ERC721.ownerOf(tokenId);\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\n }\\n\\n /**\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\n _safeMint(to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\n */\\n function _safeMint(\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) internal virtual {\\n _mint(to, tokenId);\\n require(\\n _checkOnERC721Received(address(0), to, tokenId, data),\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\n );\\n }\\n\\n /**\\n * @dev Mints `tokenId` and transfers it to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - `to` cannot be the zero address.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _mint(address to, uint256 tokenId) internal virtual {\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n _beforeTokenTransfer(address(0), to, tokenId, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _burn(uint256 tokenId) internal virtual {\\n address owner = ERC721.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\n }\\n\\n /**\\n * @dev Transfers `tokenId` from `from` to `to`.\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _transfer(\\n address from,\\n address to,\\n uint256 tokenId\\n ) internal virtual {\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, tokenId, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(\\n address owner,\\n address operator,\\n bool approved\\n ) internal virtual {\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Reverts if the `tokenId` has not been minted yet.\\n */\\n function _requireMinted(uint256 tokenId) internal view virtual {\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\n }\\n\\n /**\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\n * The call is not executed if the target address is not a contract.\\n *\\n * @param from address representing the previous owner of the given token ID\\n * @param to target address that will receive the tokens\\n * @param tokenId uint256 ID of the token to be transferred\\n * @param data bytes optional data to send along with the call\\n * @return bool whether the call correctly returned the expected magic value\\n */\\n function _checkOnERC721Received(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) private returns (bool) {\\n if (to.isContract()) {\\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721Receiver.onERC721Received.selector;\\n } catch (bytes memory reason) {\\n if (reason.length == 0) {\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n } else {\\n /// @solidity memory-safe-assembly\\n assembly {\\n revert(add(32, reason), mload(reason))\\n }\\n }\\n }\\n } else {\\n return true;\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256, /* firstTokenId */\\n uint256 batchSize\\n ) internal virtual {\\n if (batchSize > 1) {\\n if (from != address(0)) {\\n _balances[from] -= batchSize;\\n }\\n if (to != address(0)) {\\n _balances[to] += batchSize;\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 firstTokenId,\\n uint256 batchSize\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0xd89f3585b211fc9e3408384a4c4efdc3a93b2f877a3821046fa01c219d35be1b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xab28a56179c1db258c9bf5235b382698cb650debecb51b23d12be9e241374b68\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721Metadata is IERC721 {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xa4d1d62251f8574deb032a35fc948386a9b4de74b812d4f545a1ac120486b48a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\"},\"contracts/ethregistrar/BaseRegistrarImplementation.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/ERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\\n // A map of expiry times\\n mapping(uint256 => uint256) expiries;\\n // The ENS registry\\n ENS public ens;\\n // The namehash of the TLD this registrar owns (eg, .eth)\\n bytes32 public baseNode;\\n // A map of addresses that are authorised to register and renew names.\\n mapping(address => bool) public controllers;\\n uint256 public constant GRACE_PERIOD = 90 days;\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n bytes4 private constant ERC721_ID =\\n bytes4(\\n keccak256(\\\"balanceOf(address)\\\") ^\\n keccak256(\\\"ownerOf(uint256)\\\") ^\\n keccak256(\\\"approve(address,uint256)\\\") ^\\n keccak256(\\\"getApproved(uint256)\\\") ^\\n keccak256(\\\"setApprovalForAll(address,bool)\\\") ^\\n keccak256(\\\"isApprovedForAll(address,address)\\\") ^\\n keccak256(\\\"transferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256,bytes)\\\")\\n );\\n bytes4 private constant RECLAIM_ID =\\n bytes4(keccak256(\\\"reclaim(uint256,address)\\\"));\\n\\n /**\\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\\n * @dev Returns whether the given spender can transfer a given token ID\\n * @param spender address of the spender to query\\n * @param tokenId uint256 ID of the token to be transferred\\n * @return bool whether the msg.sender is approved for the given token ID,\\n * is an operator of the owner, or is the owner of the token\\n */\\n function _isApprovedOrOwner(\\n address spender,\\n uint256 tokenId\\n ) internal view override returns (bool) {\\n address owner = ownerOf(tokenId);\\n return (spender == owner ||\\n getApproved(tokenId) == spender ||\\n isApprovedForAll(owner, spender));\\n }\\n\\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\\\"\\\", \\\"\\\") {\\n ens = _ens;\\n baseNode = _baseNode;\\n }\\n\\n modifier live() {\\n require(ens.owner(baseNode) == address(this));\\n _;\\n }\\n\\n modifier onlyController() {\\n require(controllers[msg.sender]);\\n _;\\n }\\n\\n /**\\n * @dev Gets the owner of the specified token ID. Names become unowned\\n * when their registration expires.\\n * @param tokenId uint256 ID of the token to query the owner of\\n * @return address currently marked as the owner of the given token ID\\n */\\n function ownerOf(\\n uint256 tokenId\\n ) public view override(IERC721, ERC721) returns (address) {\\n require(expiries[tokenId] > block.timestamp);\\n return super.ownerOf(tokenId);\\n }\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external override onlyOwner {\\n controllers[controller] = true;\\n emit ControllerAdded(controller);\\n }\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external override onlyOwner {\\n controllers[controller] = false;\\n emit ControllerRemoved(controller);\\n }\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external override onlyOwner {\\n ens.setResolver(baseNode, resolver);\\n }\\n\\n // Returns the expiration timestamp of the specified id.\\n function nameExpires(uint256 id) external view override returns (uint256) {\\n return expiries[id];\\n }\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) public view override returns (bool) {\\n // Not available if it's registered here or in its grace period.\\n return expiries[id] + GRACE_PERIOD < block.timestamp;\\n }\\n\\n /**\\n * @dev Register a name.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external override returns (uint256) {\\n return _register(id, owner, duration, true);\\n }\\n\\n /**\\n * @dev Register a name, without modifying the registry.\\n * @param id The token ID (keccak256 of the label).\\n * @param owner The address that should own the registration.\\n * @param duration Duration in seconds for the registration.\\n */\\n function registerOnly(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256) {\\n return _register(id, owner, duration, false);\\n }\\n\\n function _register(\\n uint256 id,\\n address owner,\\n uint256 duration,\\n bool updateRegistry\\n ) internal live onlyController returns (uint256) {\\n require(available(id));\\n require(\\n block.timestamp + duration + GRACE_PERIOD >\\n block.timestamp + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] = block.timestamp + duration;\\n if (_exists(id)) {\\n // Name was previously owned, and expired\\n _burn(id);\\n }\\n _mint(owner, id);\\n if (updateRegistry) {\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n emit NameRegistered(id, owner, block.timestamp + duration);\\n\\n return block.timestamp + duration;\\n }\\n\\n function renew(\\n uint256 id,\\n uint256 duration\\n ) external override live onlyController returns (uint256) {\\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\\n require(\\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] += duration;\\n emit NameRenewed(id, expiries[id]);\\n return expiries[id];\\n }\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external override live {\\n require(_isApprovedOrOwner(msg.sender, id));\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view override(ERC721, IERC165) returns (bool) {\\n return\\n interfaceID == INTERFACE_META_ID ||\\n interfaceID == ERC721_ID ||\\n interfaceID == RECLAIM_ID;\\n }\\n}\\n\",\"keccak256\":\"0xaee6eb36aead449d397b86a02e9c63bc46e3ef378d0a62bfd68beaae1150c9d0\"},\"contracts/ethregistrar/ETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport {BaseRegistrarImplementation} from \\\"./BaseRegistrarImplementation.sol\\\";\\nimport {StringUtils} from \\\"./StringUtils.sol\\\";\\nimport {Resolver} from \\\"../resolvers/Resolver.sol\\\";\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {ReverseRegistrar} from \\\"../reverseRegistrar/ReverseRegistrar.sol\\\";\\nimport {ReverseClaimer} from \\\"../reverseRegistrar/ReverseClaimer.sol\\\";\\nimport {IETHRegistrarController, IPriceOracle} from \\\"./IETHRegistrarController.sol\\\";\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {INameWrapper} from \\\"../wrapper/INameWrapper.sol\\\";\\nimport {ERC20Recoverable} from \\\"../utils/ERC20Recoverable.sol\\\";\\n\\nerror CommitmentTooNew(bytes32 commitment);\\nerror CommitmentTooOld(bytes32 commitment);\\nerror NameNotAvailable(string name);\\nerror DurationTooShort(uint256 duration);\\nerror ResolverRequiredWhenDataSupplied();\\nerror UnexpiredCommitmentExists(bytes32 commitment);\\nerror InsufficientValue();\\nerror Unauthorised(bytes32 node);\\nerror MaxCommitmentAgeTooLow();\\nerror MaxCommitmentAgeTooHigh();\\n\\n/**\\n * @dev A registrar controller for registering and renewing names at fixed cost.\\n */\\ncontract ETHRegistrarController is\\n Ownable,\\n IETHRegistrarController,\\n IERC165,\\n ERC20Recoverable,\\n ReverseClaimer\\n{\\n using StringUtils for *;\\n using Address for address;\\n\\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\\n bytes32 private constant ETH_NODE =\\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\\n uint64 private constant MAX_EXPIRY = type(uint64).max;\\n BaseRegistrarImplementation immutable base;\\n IPriceOracle public immutable prices;\\n uint256 public immutable minCommitmentAge;\\n uint256 public immutable maxCommitmentAge;\\n ReverseRegistrar public immutable reverseRegistrar;\\n INameWrapper public immutable nameWrapper;\\n\\n mapping(bytes32 => uint256) public commitments;\\n\\n event NameRegistered(\\n string name,\\n bytes32 indexed label,\\n address indexed owner,\\n uint256 baseCost,\\n uint256 premium,\\n uint256 expires\\n );\\n event NameRenewed(\\n string name,\\n bytes32 indexed label,\\n uint256 cost,\\n uint256 expires\\n );\\n\\n constructor(\\n BaseRegistrarImplementation _base,\\n IPriceOracle _prices,\\n uint256 _minCommitmentAge,\\n uint256 _maxCommitmentAge,\\n ReverseRegistrar _reverseRegistrar,\\n INameWrapper _nameWrapper,\\n ENS _ens\\n ) ReverseClaimer(_ens, msg.sender) {\\n if (_maxCommitmentAge <= _minCommitmentAge) {\\n revert MaxCommitmentAgeTooLow();\\n }\\n\\n if (_maxCommitmentAge > block.timestamp) {\\n revert MaxCommitmentAgeTooHigh();\\n }\\n\\n base = _base;\\n prices = _prices;\\n minCommitmentAge = _minCommitmentAge;\\n maxCommitmentAge = _maxCommitmentAge;\\n reverseRegistrar = _reverseRegistrar;\\n nameWrapper = _nameWrapper;\\n }\\n\\n function rentPrice(\\n string memory name,\\n uint256 duration\\n ) public view override returns (IPriceOracle.Price memory price) {\\n bytes32 label = keccak256(bytes(name));\\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\\n }\\n\\n function valid(string memory name) public pure returns (bool) {\\n return name.strlen() >= 3;\\n }\\n\\n function available(string memory name) public view override returns (bool) {\\n bytes32 label = keccak256(bytes(name));\\n return valid(name) && base.available(uint256(label));\\n }\\n\\n function makeCommitment(\\n string memory name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] calldata data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses\\n ) public pure override returns (bytes32) {\\n bytes32 label = keccak256(bytes(name));\\n if (data.length > 0 && resolver == address(0)) {\\n revert ResolverRequiredWhenDataSupplied();\\n }\\n return\\n keccak256(\\n abi.encode(\\n label,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses\\n )\\n );\\n }\\n\\n function commit(bytes32 commitment) public override {\\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\\n revert UnexpiredCommitmentExists(commitment);\\n }\\n commitments[commitment] = block.timestamp;\\n }\\n\\n function register(\\n string calldata name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] calldata data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses\\n ) public payable override {\\n IPriceOracle.Price memory price = rentPrice(name, duration);\\n if (msg.value < price.base + price.premium) {\\n revert InsufficientValue();\\n }\\n\\n _consumeCommitment(\\n name,\\n duration,\\n makeCommitment(\\n name,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses\\n )\\n );\\n\\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\\n name,\\n owner,\\n duration,\\n resolver,\\n ownerControlledFuses\\n );\\n\\n if (data.length > 0) {\\n _setRecords(resolver, keccak256(bytes(name)), data);\\n }\\n\\n if (reverseRecord) {\\n _setReverseRecord(name, resolver, msg.sender);\\n }\\n\\n emit NameRegistered(\\n name,\\n keccak256(bytes(name)),\\n owner,\\n price.base,\\n price.premium,\\n expires\\n );\\n\\n if (msg.value > (price.base + price.premium)) {\\n payable(msg.sender).transfer(\\n msg.value - (price.base + price.premium)\\n );\\n }\\n }\\n\\n function renew(\\n string calldata name,\\n uint256 duration\\n ) external payable override {\\n bytes32 labelhash = keccak256(bytes(name));\\n uint256 tokenId = uint256(labelhash);\\n IPriceOracle.Price memory price = rentPrice(name, duration);\\n if (msg.value < price.base) {\\n revert InsufficientValue();\\n }\\n uint256 expires = nameWrapper.renew(tokenId, duration);\\n\\n if (msg.value > price.base) {\\n payable(msg.sender).transfer(msg.value - price.base);\\n }\\n\\n emit NameRenewed(name, labelhash, msg.value, expires);\\n }\\n\\n function withdraw() public {\\n payable(owner()).transfer(address(this).balance);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IETHRegistrarController).interfaceId;\\n }\\n\\n /* Internal functions */\\n\\n function _consumeCommitment(\\n string memory name,\\n uint256 duration,\\n bytes32 commitment\\n ) internal {\\n // Require an old enough commitment.\\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\\n revert CommitmentTooNew(commitment);\\n }\\n\\n // If the commitment is too old, or the name is registered, stop\\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\\n revert CommitmentTooOld(commitment);\\n }\\n if (!available(name)) {\\n revert NameNotAvailable(name);\\n }\\n\\n delete (commitments[commitment]);\\n\\n if (duration < MIN_REGISTRATION_DURATION) {\\n revert DurationTooShort(duration);\\n }\\n }\\n\\n function _setRecords(\\n address resolverAddress,\\n bytes32 label,\\n bytes[] calldata data\\n ) internal {\\n // use hardcoded .eth namehash\\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\\n Resolver resolver = Resolver(resolverAddress);\\n resolver.multicallWithNodeCheck(nodehash, data);\\n }\\n\\n function _setReverseRecord(\\n string memory name,\\n address resolver,\\n address owner\\n ) internal {\\n reverseRegistrar.setNameForAddr(\\n msg.sender,\\n owner,\\n resolver,\\n string.concat(name, \\\".eth\\\")\\n );\\n }\\n}\\n\",\"keccak256\":\"0x2ba2cab655f9128ae5c803540b8712be9bdfee1a28b9623a06c02c2435d0ce8b\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/ethregistrar/IBulkRenewal.sol\":{\"content\":\"interface IBulkRenewal {\\n function rentPrice(\\n string[] calldata names,\\n uint256 duration\\n ) external view returns (uint256 total);\\n\\n function renewAll(\\n string[] calldata names,\\n uint256 duration\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x45d72e0464af5165831210496cd293cc7ceeb7307f2bdad679f64613a6bcf029\"},\"contracts/ethregistrar/IETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./IPriceOracle.sol\\\";\\n\\ninterface IETHRegistrarController {\\n function rentPrice(\\n string memory,\\n uint256\\n ) external view returns (IPriceOracle.Price memory);\\n\\n function available(string memory) external returns (bool);\\n\\n function makeCommitment(\\n string memory,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16\\n ) external pure returns (bytes32);\\n\\n function commit(bytes32) external;\\n\\n function register(\\n string calldata,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16\\n ) external payable;\\n\\n function renew(string calldata, uint256) external payable;\\n}\\n\",\"keccak256\":\"0x54575cc2e4245c0ba79e42a58086335ec0522f4cbeb8c92d71b886593c97060e\",\"license\":\"MIT\"},\"contracts/ethregistrar/IPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\ninterface IPriceOracle {\\n struct Price {\\n uint256 base;\\n uint256 premium;\\n }\\n\\n /**\\n * @dev Returns the price to register or renew a name.\\n * @param name The name being registered or renewed.\\n * @param expires When the name presently expires (0 if this is a new registration).\\n * @param duration How long the name is being registered or extended for, in seconds.\\n * @return base premium tuple of base price + premium price\\n */\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (Price calldata);\\n}\\n\",\"keccak256\":\"0x1ec537b4c7f9cc40363b39dcc7ade8c29bf94662e6b01d38e681487637bd577e\",\"license\":\"MIT\"},\"contracts/ethregistrar/StaticBulkRenewal.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./ETHRegistrarController.sol\\\";\\nimport \\\"./IBulkRenewal.sol\\\";\\nimport \\\"./IPriceOracle.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\ncontract StaticBulkRenewal is IBulkRenewal {\\n ETHRegistrarController controller;\\n\\n constructor(ETHRegistrarController _controller) {\\n controller = _controller;\\n }\\n\\n function rentPrice(\\n string[] calldata names,\\n uint256 duration\\n ) external view override returns (uint256 total) {\\n uint256 length = names.length;\\n for (uint256 i = 0; i < length; ) {\\n IPriceOracle.Price memory price = controller.rentPrice(\\n names[i],\\n duration\\n );\\n unchecked {\\n ++i;\\n total += (price.base + price.premium);\\n }\\n }\\n }\\n\\n function renewAll(\\n string[] calldata names,\\n uint256 duration\\n ) external payable override {\\n uint256 length = names.length;\\n uint256 total;\\n for (uint256 i = 0; i < length; ) {\\n IPriceOracle.Price memory price = controller.rentPrice(\\n names[i],\\n duration\\n );\\n uint256 totalPrice = price.base + price.premium;\\n controller.renew{value: totalPrice}(names[i], duration);\\n unchecked {\\n ++i;\\n total += totalPrice;\\n }\\n }\\n // Send any excess funds back\\n payable(msg.sender).transfer(address(this).balance);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IBulkRenewal).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xa4c30f4d395dec3d252e8b9e46710fe38038cfdc3e33a3bdd0ea54e046e91f48\",\"license\":\"MIT\"},\"contracts/ethregistrar/StringUtils.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary StringUtils {\\n /**\\n * @dev Returns the length of a given string\\n *\\n * @param s The string to measure the length of\\n * @return The length of the input string\\n */\\n function strlen(string memory s) internal pure returns (uint256) {\\n uint256 len;\\n uint256 i = 0;\\n uint256 bytelength = bytes(s).length;\\n for (len = 0; i < bytelength; len++) {\\n bytes1 b = bytes(s)[i];\\n if (b < 0x80) {\\n i += 1;\\n } else if (b < 0xE0) {\\n i += 2;\\n } else if (b < 0xF0) {\\n i += 3;\\n } else if (b < 0xF8) {\\n i += 4;\\n } else if (b < 0xFC) {\\n i += 5;\\n } else {\\n i += 6;\\n }\\n }\\n return len;\\n }\\n}\\n\",\"keccak256\":\"0x4cc8363a850dc9130c433ee50e7c97e29a45ae5d9bd0808205ac7134b34f24e4\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/resolvers/Resolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"./profiles/IABIResolver.sol\\\";\\nimport \\\"./profiles/IAddressResolver.sol\\\";\\nimport \\\"./profiles/IAddrResolver.sol\\\";\\nimport \\\"./profiles/IContentHashResolver.sol\\\";\\nimport \\\"./profiles/IDNSRecordResolver.sol\\\";\\nimport \\\"./profiles/IDNSZoneResolver.sol\\\";\\nimport \\\"./profiles/IInterfaceResolver.sol\\\";\\nimport \\\"./profiles/INameResolver.sol\\\";\\nimport \\\"./profiles/IPubkeyResolver.sol\\\";\\nimport \\\"./profiles/ITextResolver.sol\\\";\\nimport \\\"./profiles/IExtendedResolver.sol\\\";\\n\\n/**\\n * A generic resolver interface which includes all the functions including the ones deprecated\\n */\\ninterface Resolver is\\n IERC165,\\n IABIResolver,\\n IAddressResolver,\\n IAddrResolver,\\n IContentHashResolver,\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n IInterfaceResolver,\\n INameResolver,\\n IPubkeyResolver,\\n ITextResolver,\\n IExtendedResolver\\n{\\n /* Deprecated events */\\n event ContentChanged(bytes32 indexed node, bytes32 hash);\\n\\n function setApprovalForAll(address, bool) external;\\n\\n function approve(bytes32 node, address delegate, bool approved) external;\\n\\n function isApprovedForAll(address account, address operator) external;\\n\\n function isApprovedFor(\\n address owner,\\n bytes32 node,\\n address delegate\\n ) external;\\n\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external;\\n\\n function setAddr(bytes32 node, address addr) external;\\n\\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\\n\\n function setContenthash(bytes32 node, bytes calldata hash) external;\\n\\n function setDnsrr(bytes32 node, bytes calldata data) external;\\n\\n function setName(bytes32 node, string calldata _name) external;\\n\\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\\n\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external;\\n\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external;\\n\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n /* Deprecated functions */\\n function content(bytes32 node) external view returns (bytes32);\\n\\n function multihash(bytes32 node) external view returns (bytes memory);\\n\\n function setContent(bytes32 node, bytes32 hash) external;\\n\\n function setMultihash(bytes32 node, bytes calldata hash) external;\\n}\\n\",\"keccak256\":\"0xfc77ab6b7c59c3ebfe1c720bdebf9b08c2488ff7ac9501a9aa056c5d6d5b50c5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseClaimer.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\n\\ncontract ReverseClaimer {\\n bytes32 constant ADDR_REVERSE_NODE =\\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n constructor(ENS ens, address claimant) {\\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\\n ens.owner(ADDR_REVERSE_NODE)\\n );\\n reverseRegistrar.claim(claimant);\\n }\\n}\\n\",\"keccak256\":\"0x78a28627241535b595f6fff476a1fa7acc90c80684fe7784734920fc8af6fc22\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/ReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IReverseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"../root/Controllable.sol\\\";\\n\\nabstract contract NameResolver {\\n function setName(bytes32 node, string memory name) public virtual;\\n}\\n\\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\\n\\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n// namehash('addr.reverse')\\n\\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\\n ENS public immutable ens;\\n NameResolver public defaultResolver;\\n\\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\\n event DefaultResolverChanged(NameResolver indexed resolver);\\n\\n /**\\n * @dev Constructor\\n * @param ensAddr The address of the ENS registry.\\n */\\n constructor(ENS ensAddr) {\\n ens = ensAddr;\\n\\n // Assign ownership of the reverse record to our deployer\\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\\n ensAddr.owner(ADDR_REVERSE_NODE)\\n );\\n if (address(oldRegistrar) != address(0x0)) {\\n oldRegistrar.claim(msg.sender);\\n }\\n }\\n\\n modifier authorised(address addr) {\\n require(\\n addr == msg.sender ||\\n controllers[msg.sender] ||\\n ens.isApprovedForAll(addr, msg.sender) ||\\n ownsContract(addr),\\n \\\"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\\\"\\n );\\n _;\\n }\\n\\n function setDefaultResolver(address resolver) public override onlyOwner {\\n require(\\n address(resolver) != address(0),\\n \\\"ReverseRegistrar: Resolver address must not be 0\\\"\\n );\\n defaultResolver = NameResolver(resolver);\\n emit DefaultResolverChanged(NameResolver(resolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claim(address owner) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, address(defaultResolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param addr The reverse record to set\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The resolver of the reverse node\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) public override authorised(addr) returns (bytes32) {\\n bytes32 labelHash = sha3HexAddress(addr);\\n bytes32 reverseNode = keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\\n );\\n emit ReverseClaimed(addr, reverseNode);\\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\\n return reverseNode;\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, resolver);\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the calling account. First updates the resolver to the default reverse\\n * resolver if necessary.\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setName(string memory name) public override returns (bytes32) {\\n return\\n setNameForAddr(\\n msg.sender,\\n msg.sender,\\n address(defaultResolver),\\n name\\n );\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the account provided. Updates the resolver to a designated resolver\\n * Only callable by controllers and authorised users\\n * @param addr The reverse record to set\\n * @param owner The owner of the reverse node\\n * @param resolver The resolver of the reverse node\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) public override returns (bytes32) {\\n bytes32 node = claimForAddr(addr, owner, resolver);\\n NameResolver(resolver).setName(node, name);\\n return node;\\n }\\n\\n /**\\n * @dev Returns the node hash for a given account's reverse records.\\n * @param addr The address to hash\\n * @return The ENS node hash.\\n */\\n function node(address addr) public pure override returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\\n );\\n }\\n\\n /**\\n * @dev An optimised function to compute the sha3 of the lower-case\\n * hexadecimal representation of an Ethereum address.\\n * @param addr The address to hash\\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\\n * input address.\\n */\\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\\n assembly {\\n for {\\n let i := 40\\n } gt(i, 0) {\\n\\n } {\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n }\\n\\n ret := keccak256(0, 40)\\n }\\n }\\n\\n function ownsContract(address addr) internal view returns (bool) {\\n try Ownable(addr).owner() returns (address owner) {\\n return owner == msg.sender;\\n } catch {\\n return false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd57d28e5791b4b44650a00f5ef6c725af53698ec33faeeaa3591f0dbd939559a\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"},\"contracts/utils/ERC20Recoverable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\\n */\\n\\ncontract ERC20Recoverable is Ownable {\\n /**\\n @notice Recover ERC20 tokens sent to the contract by mistake.\\n @dev The contract is Ownable and only the owner can call the recover function.\\n @param _to The address to send the tokens to.\\n@param _token The address of the ERC20 token to recover\\n @param _amount The amount of tokens to recover.\\n */\\n function recoverFunds(\\n address _token,\\n address _to,\\n uint256 _amount\\n ) external onlyOwner {\\n IERC20(_token).transfer(_to, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x793a38091e1f81499a29ddba82c2b2f3cdd07071b81a832886e8e02a45ff352a\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_ETH = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x70310eb67146d7290731c31841399640ac3b6a949eadc6598bc150123d185c57\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161066138038061066183398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b6105ce806100936000396000f3fe6080604052600436106100345760003560e01c806301ffc9a7146100395780633971d4671461006e578063e8d6dbb41461009c575b600080fd5b34801561004557600080fd5b506100596100543660046103b9565b6100b1565b60405190151581526020015b60405180910390f35b34801561007a57600080fd5b5061008e610089366004610402565b61014a565b604051908152602001610065565b6100af6100aa366004610402565b610218565b005b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061014457507fffffffff0000000000000000000000000000000000000000000000000000000082167fd1a70fd300000000000000000000000000000000000000000000000000000000145b92915050565b600082815b8181101561020f576000805473ffffffffffffffffffffffffffffffffffffffff166383e7f6ff8888858181106101885761018861047d565b905060200281019061019a9190610493565b886040518463ffffffff1660e01b81526004016101b9939291906104e1565b6040805180830381865afa1580156101d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f9919061051a565b602081015190510193909301925060010161014f565b50509392505050565b816000805b82811015610384576000805473ffffffffffffffffffffffffffffffffffffffff166383e7f6ff8888858181106102565761025661047d565b90506020028101906102689190610493565b886040518463ffffffff1660e01b8152600401610287939291906104e1565b6040805180830381865afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c7919061051a565b90506000816020015182600001516102df9190610577565b60005490915073ffffffffffffffffffffffffffffffffffffffff1663acf1a841828a8a878181106103135761031361047d565b90506020028101906103259190610493565b8a6040518563ffffffff1660e01b8152600401610344939291906104e1565b6000604051808303818588803b15801561035d57600080fd5b505af1158015610371573d6000803e3d6000fd5b505050919094019350505060010161021d565b5060405133904780156108fc02916000818181858888f193505050501580156103b1573d6000803e3d6000fd5b505050505050565b6000602082840312156103cb57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146103fb57600080fd5b9392505050565b60008060006040848603121561041757600080fd5b833567ffffffffffffffff8082111561042f57600080fd5b818601915086601f83011261044357600080fd5b81358181111561045257600080fd5b8760208260051b850101111561046757600080fd5b6020928301989097509590910135949350505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126104aa57600080fd5b83018035915067ffffffffffffffff8211156104c557600080fd5b6020019150368190038213156104da57600080fd5b9250929050565b604081528260408201528284606083013760006060848301015260006060601f19601f8601168301019050826020830152949350505050565b60006040828403121561052c57600080fd5b6040516040810181811067ffffffffffffffff8211171561055d57634e487b7160e01b600052604160045260246000fd5b604052825181526020928301519281019290925250919050565b8082018082111561014457634e487b7160e01b600052601160045260246000fdfea26469706673582212206beee4d224b9a42f792157c3418272e9634b6bb43a4d662d725ed7cb938d88ba64736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106100345760003560e01c806301ffc9a7146100395780633971d4671461006e578063e8d6dbb41461009c575b600080fd5b34801561004557600080fd5b506100596100543660046103b9565b6100b1565b60405190151581526020015b60405180910390f35b34801561007a57600080fd5b5061008e610089366004610402565b61014a565b604051908152602001610065565b6100af6100aa366004610402565b610218565b005b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061014457507fffffffff0000000000000000000000000000000000000000000000000000000082167fd1a70fd300000000000000000000000000000000000000000000000000000000145b92915050565b600082815b8181101561020f576000805473ffffffffffffffffffffffffffffffffffffffff166383e7f6ff8888858181106101885761018861047d565b905060200281019061019a9190610493565b886040518463ffffffff1660e01b81526004016101b9939291906104e1565b6040805180830381865afa1580156101d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f9919061051a565b602081015190510193909301925060010161014f565b50509392505050565b816000805b82811015610384576000805473ffffffffffffffffffffffffffffffffffffffff166383e7f6ff8888858181106102565761025661047d565b90506020028101906102689190610493565b886040518463ffffffff1660e01b8152600401610287939291906104e1565b6040805180830381865afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c7919061051a565b90506000816020015182600001516102df9190610577565b60005490915073ffffffffffffffffffffffffffffffffffffffff1663acf1a841828a8a878181106103135761031361047d565b90506020028101906103259190610493565b8a6040518563ffffffff1660e01b8152600401610344939291906104e1565b6000604051808303818588803b15801561035d57600080fd5b505af1158015610371573d6000803e3d6000fd5b505050919094019350505060010161021d565b5060405133904780156108fc02916000818181858888f193505050501580156103b1573d6000803e3d6000fd5b505050505050565b6000602082840312156103cb57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146103fb57600080fd5b9392505050565b60008060006040848603121561041757600080fd5b833567ffffffffffffffff8082111561042f57600080fd5b818601915086601f83011261044357600080fd5b81358181111561045257600080fd5b8760208260051b850101111561046757600080fd5b6020928301989097509590910135949350505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126104aa57600080fd5b83018035915067ffffffffffffffff8211156104c557600080fd5b6020019150368190038213156104da57600080fd5b9250929050565b604081528260408201528284606083013760006060848301015260006060601f19601f8601168301019050826020830152949350505050565b60006040828403121561052c57600080fd5b6040516040810181811067ffffffffffffffff8211171561055d57634e487b7160e01b600052604160045260246000fd5b604052825181526020928301519281019290925250919050565b8082018082111561014457634e487b7160e01b600052601160045260246000fdfea26469706673582212206beee4d224b9a42f792157c3418272e9634b6bb43a4d662d725ed7cb938d88ba64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 13604, + "contract": "contracts/ethregistrar/StaticBulkRenewal.sol:StaticBulkRenewal", + "label": "controller", + "offset": 0, + "slot": "0", + "type": "t_contract(ETHRegistrarController)12258" + } + ], + "types": { + "t_contract(ETHRegistrarController)12258": { + "encoding": "inplace", + "label": "contract ETHRegistrarController", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/StaticMetadataService.json b/solidity/dns-contracts/deployments/sepolia/StaticMetadataService.json new file mode 100644 index 0000000..9d4a64d --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/StaticMetadataService.json @@ -0,0 +1,87 @@ +{ + "address": "0x2e9736e109a2745628a5915983f8d9172414f1ac", + "abi": [ + { + "inputs": [ + { + "internalType": "string", + "name": "_metaDataUri", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "uri", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x420aa6eb11f56155c09b76e51d915a8dd99ad127f408f3db44f2c05573c66a81", + "receipt": { + "to": null, + "from": "0x4fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8", + "contractAddress": "0x2e9736e109a2745628a5915983f8d9172414f1ac", + "transactionIndex": "0x2f", + "gasUsed": "0x39162", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x05e9f3bdd9cb14031203bb7b6a66de576446e0368d5f366b73c91115299c1586", + "transactionHash": "0x160e2e664e35006ac889329a05b34c64cf3168f02829cd07668898429db4d0dd", + "logs": [], + "blockNumber": "0x39d262", + "cumulativeGasUsed": "0x7648b4", + "status": "0x1" + }, + "args": [ + "ens-metadata-service.appspot.com/name/0x{id}" + ], + "numDeployments": 4, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_metaDataUri\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/wrapper/StaticMetadataService.sol\":\"StaticMetadataService\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/wrapper/StaticMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ncontract StaticMetadataService {\\n string private _uri;\\n\\n constructor(string memory _metaDataUri) {\\n _uri = _metaDataUri;\\n }\\n\\n function uri(uint256) public view returns (string memory) {\\n return _uri;\\n }\\n}\\n\",\"keccak256\":\"0x28aad4cb829118de64965e06af8e785e6b2efa5207859d2efc63e404c26cfea3\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161045538038061045583398101604081905261002f91610058565b600061003b82826101aa565b5050610269565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561006b57600080fd5b82516001600160401b038082111561008257600080fd5b818501915085601f83011261009657600080fd5b8151818111156100a8576100a8610042565b604051601f8201601f19908116603f011681019083821181831017156100d0576100d0610042565b8160405282815288868487010111156100e857600080fd5b600093505b8284101561010a57848401860151818501870152928501926100ed565b600086848301015280965050505050505092915050565b600181811c9082168061013557607f821691505b60208210810361015557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156101a557600081815260208120601f850160051c810160208610156101825750805b601f850160051c820191505b818110156101a15782815560010161018e565b5050505b505050565b81516001600160401b038111156101c3576101c3610042565b6101d7816101d18454610121565b8461015b565b602080601f83116001811461020c57600084156101f45750858301515b600019600386901b1c1916600185901b1785556101a1565b600085815260208120601f198616915b8281101561023b5788860151825594840194600190910190840161021c565b50858210156102595787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6101dd806102786000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80630e89341c14610030575b600080fd5b61004361003e3660046100ed565b610059565b6040516100509190610106565b60405180910390f35b60606000805461006890610154565b80601f016020809104026020016040519081016040528092919081815260200182805461009490610154565b80156100e15780601f106100b6576101008083540402835291602001916100e1565b820191906000526020600020905b8154815290600101906020018083116100c457829003601f168201915b50505050509050919050565b6000602082840312156100ff57600080fd5b5035919050565b600060208083528351808285015260005b8181101561013357858101830151858201604001528201610117565b506000604082860101526040601f19601f8301168501019250505092915050565b600181811c9082168061016857607f821691505b6020821081036101a1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea2646970667358221220dee5977a2693f04a6202db215bcb6c19eee7b94993ae966733d3658597220ef964736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80630e89341c14610030575b600080fd5b61004361003e3660046100ed565b610059565b6040516100509190610106565b60405180910390f35b60606000805461006890610154565b80601f016020809104026020016040519081016040528092919081815260200182805461009490610154565b80156100e15780601f106100b6576101008083540402835291602001916100e1565b820191906000526020600020905b8154815290600101906020018083116100c457829003601f168201915b50505050509050919050565b6000602082840312156100ff57600080fd5b5035919050565b600060208083528351808285015260005b8181101561013357858101830151858201604001528201610117565b506000604082860101526040601f19601f8301168501019250505092915050565b600181811c9082168061016857607f821691505b6020821081036101a1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea2646970667358221220dee5977a2693f04a6202db215bcb6c19eee7b94993ae966733d3658597220ef964736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 24430, + "contract": "contracts/wrapper/StaticMetadataService.sol:StaticMetadataService", + "label": "_uri", + "offset": 0, + "slot": "0", + "type": "t_string_storage" + } + ], + "types": { + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/TLDPublicSuffixList.json b/solidity/dns-contracts/deployments/sepolia/TLDPublicSuffixList.json new file mode 100644 index 0000000..61b2087 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/TLDPublicSuffixList.json @@ -0,0 +1,61 @@ +{ + "address": "0x670CA7456Be604B5d5361a20B784Aecd23ac514b", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "isPublicSuffix", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xd95846876e4068e5138ff2d10d0f239026fa28ef17ffe3712d07d294f878d3da", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0x670CA7456Be604B5d5361a20B784Aecd23ac514b", + "transactionIndex": 53, + "gasUsed": "166669", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x03b7c60c9268310c9085c6dc210477d42a45fbcef65a9bd7d9029262d9dcef54", + "transactionHash": "0xd95846876e4068e5138ff2d10d0f239026fa28ef17ffe3712d07d294f878d3da", + "logs": [], + "blockNumber": 4141627, + "cumulativeGasUsed": "9161329", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"isPublicSuffix\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"A public suffix list that treats all TLDs as public suffixes.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/dnsregistrar/TLDPublicSuffixList.sol\":\"TLDPublicSuffixList\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/dnsregistrar/PublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\ninterface PublicSuffixList {\\n function isPublicSuffix(bytes calldata name) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x12158ba8838ee2b1ebb0178a52d2f4d54dcc68282d569226e62afc2b0dccbbac\"},\"contracts/dnsregistrar/TLDPublicSuffixList.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../dnssec-oracle/BytesUtils.sol\\\";\\nimport \\\"./PublicSuffixList.sol\\\";\\n\\n/**\\n * @dev A public suffix list that treats all TLDs as public suffixes.\\n */\\ncontract TLDPublicSuffixList is PublicSuffixList {\\n using BytesUtils for bytes;\\n\\n function isPublicSuffix(\\n bytes calldata name\\n ) external view override returns (bool) {\\n uint256 labellen = name.readUint8(0);\\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\\n }\\n}\\n\",\"keccak256\":\"0x0e64dc888396ef3c88e64afbf4e35fb107fa416174b97223d0b4894e5e085e53\"},\"contracts/dnssec-oracle/BytesUtils.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0x4f10902639b85a17ae10745264feff322e793bfb1bc130a9a90efa7dda47c6cc\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061020d806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80634f89059e14610030575b600080fd5b61004361003e36600461012e565b610057565b604051901515815260200160405180910390f35b60008061009e600085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061010a9050565b60ff16905060008111801561010057506100fb6100bc8260016101a0565b85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061010a9050565b60ff16155b9150505b92915050565b600082828151811061011e5761011e6101c1565b016020015160f81c905092915050565b6000806020838503121561014157600080fd5b823567ffffffffffffffff8082111561015957600080fd5b818501915085601f83011261016d57600080fd5b81358181111561017c57600080fd5b86602082850101111561018e57600080fd5b60209290920196919550909350505050565b8082018082111561010457634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fdfea2646970667358221220bd314730014c3187d1d82d4d375c5edf3ba7a6a9750141e8ca0924a3c4dec52b64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80634f89059e14610030575b600080fd5b61004361003e36600461012e565b610057565b604051901515815260200160405180910390f35b60008061009e600085858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061010a9050565b60ff16905060008111801561010057506100fb6100bc8260016101a0565b85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061010a9050565b60ff16155b9150505b92915050565b600082828151811061011e5761011e6101c1565b016020015160f81c905092915050565b6000806020838503121561014157600080fd5b823567ffffffffffffffff8082111561015957600080fd5b818501915085601f83011261016d57600080fd5b81358181111561017c57600080fd5b86602082850101111561018e57600080fd5b60209290920196919550909350505050565b8082018082111561010457634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fdfea2646970667358221220bd314730014c3187d1d82d4d375c5edf3ba7a6a9750141e8ca0924a3c4dec52b64736f6c63430008110033", + "devdoc": { + "details": "A public suffix list that treats all TLDs as public suffixes.", + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/TestUnwrap.json b/solidity/dns-contracts/deployments/sepolia/TestUnwrap.json new file mode 100644 index 0000000..f0b9070 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/TestUnwrap.json @@ -0,0 +1,349 @@ +{ + "address": "0xCAB401f869793d7A2238FD9dF780Cd647BE71D15", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract IBaseRegistrar", + "name": "_registrar", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "approvedWrapper", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "registrar", + "outputs": [ + { + "internalType": "contract IBaseRegistrar", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "newOwner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "wrapper", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setWrapperApproval", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "wrapETH2LD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + }, + { + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "wrapFromUpgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x826a29b5ad7b5e90a75d6b92e7010514512da6544e9cb5dd760fde9b1cbbf941", + "receipt": { + "to": null, + "from": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", + "contractAddress": "0xCAB401f869793d7A2238FD9dF780Cd647BE71D15", + "transactionIndex": 114, + "gasUsed": "970609", + "logsBloom": "0x00000000000000000000000000000000000000000000200000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000001000000400000000000020000000000000000000800004000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x1146d5ac1bd64bed37a765e79e65468503186da612bda5bd7469e347a2adc72b", + "transactionHash": "0x826a29b5ad7b5e90a75d6b92e7010514512da6544e9cb5dd760fde9b1cbbf941", + "logs": [ + { + "transactionIndex": 114, + "blockNumber": 3790164, + "transactionHash": "0x826a29b5ad7b5e90a75d6b92e7010514512da6544e9cb5dd760fde9b1cbbf941", + "address": "0xCAB401f869793d7A2238FD9dF780Cd647BE71D15", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004fe4e666be5752f1fdd210f4ab5de2cc26e3e0e8" + ], + "data": "0x", + "logIndex": 237, + "blockHash": "0x1146d5ac1bd64bed37a765e79e65468503186da612bda5bd7469e347a2adc72b" + } + ], + "blockNumber": 3790164, + "cumulativeGasUsed": "18763842", + "status": 1, + "byzantium": true + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85" + ], + "numDeployments": 1, + "solcInputHash": "e04502f562d98d0455f6c1c453418cdd", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"_registrar\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"approvedWrapper\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"registrar\",\"outputs\":[{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setSubnodeRecord\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"wrapper\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setWrapperApproval\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"wrapETH2LD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"wrapFromUpgrade\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/wrapper/mocks/TestUnwrap.sol\":\"TestUnwrap\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xab28a56179c1db258c9bf5235b382698cb650debecb51b23d12be9e241374b68\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/wrapper/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes32) {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n}\\n\",\"keccak256\":\"0xf862cd86d749158a554e3cb517efa9097331ec0cf7225117f21e96fb50c67edb\",\"license\":\"MIT\"},\"contracts/wrapper/mocks/TestUnwrap.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\nimport \\\"../../registry/ENS.sol\\\";\\nimport \\\"../../ethregistrar/IBaseRegistrar.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {BytesUtils} from \\\"../BytesUtils.sol\\\";\\n\\ncontract TestUnwrap is Ownable {\\n using BytesUtils for bytes;\\n\\n bytes32 private constant ETH_NODE =\\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\\n\\n ENS public immutable ens;\\n IBaseRegistrar public immutable registrar;\\n mapping(address => bool) public approvedWrapper;\\n\\n constructor(ENS _ens, IBaseRegistrar _registrar) {\\n ens = _ens;\\n registrar = _registrar;\\n }\\n\\n function setWrapperApproval(\\n address wrapper,\\n bool approved\\n ) public onlyOwner {\\n approvedWrapper[wrapper] = approved;\\n }\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address resolver\\n ) public {\\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\\n }\\n\\n function setSubnodeRecord(\\n bytes32 parentNode,\\n string memory label,\\n address newOwner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) public {\\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\\n _unwrapSubnode(node, newOwner, msg.sender);\\n }\\n\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) public {\\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\\n bytes32 parentNode = name.namehash(offset);\\n bytes32 node = _makeNode(parentNode, labelhash);\\n\\n if (parentNode == ETH_NODE) {\\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\\n } else {\\n _unwrapSubnode(node, wrappedOwner, msg.sender);\\n }\\n }\\n\\n function _unwrapETH2LD(\\n bytes32 labelhash,\\n address wrappedOwner,\\n address sender\\n ) private {\\n uint256 tokenId = uint256(labelhash);\\n address registrant = registrar.ownerOf(tokenId);\\n\\n require(\\n approvedWrapper[sender] &&\\n sender == registrant &&\\n registrar.isApprovedForAll(registrant, address(this)),\\n \\\"Unauthorised\\\"\\n );\\n\\n registrar.reclaim(tokenId, wrappedOwner);\\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\\n }\\n\\n function _unwrapSubnode(\\n bytes32 node,\\n address newOwner,\\n address sender\\n ) private {\\n address owner = ens.owner(node);\\n\\n require(\\n approvedWrapper[sender] &&\\n owner == sender &&\\n ens.isApprovedForAll(owner, address(this)),\\n \\\"Unauthorised\\\"\\n );\\n\\n ens.setOwner(node, newOwner);\\n }\\n\\n function _makeNode(\\n bytes32 node,\\n bytes32 labelhash\\n ) private pure returns (bytes32) {\\n return keccak256(abi.encodePacked(node, labelhash));\\n }\\n}\\n\",\"keccak256\":\"0x738180fe6f0caae045c82df1d5a7088d07ebbf299c5c8b402a3cf04079980014\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c060405234801561001057600080fd5b5060405161117238038061117283398101604081905261002f916100b7565b6100383361004f565b6001600160a01b039182166080521660a0526100f1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146100b457600080fd5b50565b600080604083850312156100ca57600080fd5b82516100d58161009f565b60208401519092506100e68161009f565b809150509250929050565b60805160a05161102c6101466000396000818160f0015281816108f1015281816109cc01528181610ac20152610b63015260008181610134015281816104b6015281816105910152610687015261102c6000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80638da5cb5b11610076578063c6d6d7c11161005b578063c6d6d7c114610182578063f2fde38b146101b5578063f9547a9e146101c857600080fd5b80638da5cb5b1461015e5780639198c2761461016f57600080fd5b80632b20e397116100a75780632b20e397146100eb5780633f15457f1461012f578063715018a61461015657600080fd5b80630cc17365146100c357806324c1af44146100d8575b600080fd5b6100d66100d1366004610c1f565b6101db565b005b6100d66100e6366004610c9a565b61020e565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6100d6610238565b6000546001600160a01b0316610112565b6100d661017d366004610df1565b61024c565b6101a5610190366004610eac565b60016020526000908152604090205460ff1681565b6040519015158152602001610126565b6100d66101c3366004610eac565b61033c565b6100d66101d6366004610ed0565b6103d1565b6101e36103fb565b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b6000610221888880519060200120610455565b905061022e818733610484565b5050505050505050565b6102406103fb565b61024a60006106df565b565b60008061029360008b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506107479050565b9150915060006102dc828c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506107fe9050565b905060006102ea8285610455565b90507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b5282016103235761031e848b336108bd565b61032e565b61032e818b33610484565b505050505050505050505050565b6103446103fb565b6001600160a01b0381166103c55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6103ce816106df565b50565b6103f386866040516103e4929190610f5a565b604051809103902085336108bd565b505050505050565b6000546001600160a01b0316331461024a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103bc565b604080516020808201859052818301849052825180830384018152606090920190925280519101205b92915050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018490526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610505573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105299190610f6a565b6001600160a01b03831660009081526001602052604090205490915060ff1680156105655750816001600160a01b0316816001600160a01b0316145b80156105fc575060405163e985e9c560e01b81526001600160a01b0382811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa1580156105d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fc9190610f87565b6106485760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f7269736564000000000000000000000000000000000000000060448201526064016103bc565b6040517f5b0fc9c3000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b0384811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b1580156106cb57600080fd5b505af115801561022e573d6000803e3d6000fd5b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000808351831061079a5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e6473000060448201526064016103bc565b60008484815181106107ae576107ae610fa4565b016020015160f81c905080156107da576107d3856107cd866001610fd0565b83610bc8565b92506107df565b600092505b6107e98185610fd0565b6107f4906001610fd0565b9150509250929050565b600080600061080d8585610747565b90925090508161087f57600185516108259190610fe3565b84146108735760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d6500000060448201526064016103bc565b506000915061047e9050565b61088985826107fe565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b6040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810184905283906000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015610940573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109649190610f6a565b6001600160a01b03841660009081526001602052604090205490915060ff1680156109a05750806001600160a01b0316836001600160a01b0316145b8015610a37575060405163e985e9c560e01b81526001600160a01b0382811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610a13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a379190610f87565b610a835760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f7269736564000000000000000000000000000000000000000060448201526064016103bc565b6040517f28ed4f6c000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b0385811660248301527f000000000000000000000000000000000000000000000000000000000000000016906328ed4f6c90604401600060405180830381600087803b158015610b0657600080fd5b505af1158015610b1a573d6000803e3d6000fd5b50506040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528781166024830152604482018690527f00000000000000000000000000000000000000000000000000000000000000001692506323b872dd9150606401600060405180830381600087803b158015610ba957600080fd5b505af1158015610bbd573d6000803e3d6000fd5b505050505050505050565b8251600090610bd78385610fd0565b1115610be257600080fd5b5091016020012090565b6001600160a01b03811681146103ce57600080fd5b8035610c0c81610bec565b919050565b80151581146103ce57600080fd5b60008060408385031215610c3257600080fd5b8235610c3d81610bec565b91506020830135610c4d81610c11565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b803567ffffffffffffffff81168114610c0c57600080fd5b803563ffffffff81168114610c0c57600080fd5b600080600080600080600060e0888a031215610cb557600080fd5b87359650602088013567ffffffffffffffff80821115610cd457600080fd5b818a0191508a601f830112610ce857600080fd5b813581811115610cfa57610cfa610c58565b604051601f8201601f19908116603f01168101908382118183101715610d2257610d22610c58565b816040528281528d6020848701011115610d3b57600080fd5b82602086016020830137600060208483010152809a505050505050610d6260408901610c01565b9450610d7060608901610c01565b9350610d7e60808901610c6e565b9250610d8c60a08901610c86565b9150610d9a60c08901610c6e565b905092959891949750929550565b60008083601f840112610dba57600080fd5b50813567ffffffffffffffff811115610dd257600080fd5b602083019150836020828501011115610dea57600080fd5b9250929050565b60008060008060008060008060c0898b031215610e0d57600080fd5b883567ffffffffffffffff80821115610e2557600080fd5b610e318c838d01610da8565b909a50985060208b01359150610e4682610bec565b819750610e5560408c01610c86565b9650610e6360608c01610c6e565b955060808b01359150610e7582610bec565b90935060a08a01359080821115610e8b57600080fd5b50610e988b828c01610da8565b999c989b5096995094979396929594505050565b600060208284031215610ebe57600080fd5b8135610ec981610bec565b9392505050565b60008060008060008060a08789031215610ee957600080fd5b863567ffffffffffffffff811115610f0057600080fd5b610f0c89828a01610da8565b9097509550506020870135610f2081610bec565b9350610f2e60408801610c86565b9250610f3c60608801610c6e565b91506080870135610f4c81610bec565b809150509295509295509295565b8183823760009101908152919050565b600060208284031215610f7c57600080fd5b8151610ec981610bec565b600060208284031215610f9957600080fd5b8151610ec981610c11565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561047e5761047e610fba565b8181038181111561047e5761047e610fba56fea26469706673582212200d03c4139275e356bdf5747a80f6b61b271f2b7ff551603efb6b19ffb5b13ffe64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100be5760003560e01c80638da5cb5b11610076578063c6d6d7c11161005b578063c6d6d7c114610182578063f2fde38b146101b5578063f9547a9e146101c857600080fd5b80638da5cb5b1461015e5780639198c2761461016f57600080fd5b80632b20e397116100a75780632b20e397146100eb5780633f15457f1461012f578063715018a61461015657600080fd5b80630cc17365146100c357806324c1af44146100d8575b600080fd5b6100d66100d1366004610c1f565b6101db565b005b6100d66100e6366004610c9a565b61020e565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6100d6610238565b6000546001600160a01b0316610112565b6100d661017d366004610df1565b61024c565b6101a5610190366004610eac565b60016020526000908152604090205460ff1681565b6040519015158152602001610126565b6100d66101c3366004610eac565b61033c565b6100d66101d6366004610ed0565b6103d1565b6101e36103fb565b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b6000610221888880519060200120610455565b905061022e818733610484565b5050505050505050565b6102406103fb565b61024a60006106df565b565b60008061029360008b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506107479050565b9150915060006102dc828c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506107fe9050565b905060006102ea8285610455565b90507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b5282016103235761031e848b336108bd565b61032e565b61032e818b33610484565b505050505050505050505050565b6103446103fb565b6001600160a01b0381166103c55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6103ce816106df565b50565b6103f386866040516103e4929190610f5a565b604051809103902085336108bd565b505050505050565b6000546001600160a01b0316331461024a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103bc565b604080516020808201859052818301849052825180830384018152606090920190925280519101205b92915050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018490526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610505573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105299190610f6a565b6001600160a01b03831660009081526001602052604090205490915060ff1680156105655750816001600160a01b0316816001600160a01b0316145b80156105fc575060405163e985e9c560e01b81526001600160a01b0382811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa1580156105d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fc9190610f87565b6106485760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f7269736564000000000000000000000000000000000000000060448201526064016103bc565b6040517f5b0fc9c3000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b0384811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b1580156106cb57600080fd5b505af115801561022e573d6000803e3d6000fd5b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000808351831061079a5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e6473000060448201526064016103bc565b60008484815181106107ae576107ae610fa4565b016020015160f81c905080156107da576107d3856107cd866001610fd0565b83610bc8565b92506107df565b600092505b6107e98185610fd0565b6107f4906001610fd0565b9150509250929050565b600080600061080d8585610747565b90925090508161087f57600185516108259190610fe3565b84146108735760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d6500000060448201526064016103bc565b506000915061047e9050565b61088985826107fe565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b6040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810184905283906000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015610940573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109649190610f6a565b6001600160a01b03841660009081526001602052604090205490915060ff1680156109a05750806001600160a01b0316836001600160a01b0316145b8015610a37575060405163e985e9c560e01b81526001600160a01b0382811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610a13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a379190610f87565b610a835760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f7269736564000000000000000000000000000000000000000060448201526064016103bc565b6040517f28ed4f6c000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b0385811660248301527f000000000000000000000000000000000000000000000000000000000000000016906328ed4f6c90604401600060405180830381600087803b158015610b0657600080fd5b505af1158015610b1a573d6000803e3d6000fd5b50506040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528781166024830152604482018690527f00000000000000000000000000000000000000000000000000000000000000001692506323b872dd9150606401600060405180830381600087803b158015610ba957600080fd5b505af1158015610bbd573d6000803e3d6000fd5b505050505050505050565b8251600090610bd78385610fd0565b1115610be257600080fd5b5091016020012090565b6001600160a01b03811681146103ce57600080fd5b8035610c0c81610bec565b919050565b80151581146103ce57600080fd5b60008060408385031215610c3257600080fd5b8235610c3d81610bec565b91506020830135610c4d81610c11565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b803567ffffffffffffffff81168114610c0c57600080fd5b803563ffffffff81168114610c0c57600080fd5b600080600080600080600060e0888a031215610cb557600080fd5b87359650602088013567ffffffffffffffff80821115610cd457600080fd5b818a0191508a601f830112610ce857600080fd5b813581811115610cfa57610cfa610c58565b604051601f8201601f19908116603f01168101908382118183101715610d2257610d22610c58565b816040528281528d6020848701011115610d3b57600080fd5b82602086016020830137600060208483010152809a505050505050610d6260408901610c01565b9450610d7060608901610c01565b9350610d7e60808901610c6e565b9250610d8c60a08901610c86565b9150610d9a60c08901610c6e565b905092959891949750929550565b60008083601f840112610dba57600080fd5b50813567ffffffffffffffff811115610dd257600080fd5b602083019150836020828501011115610dea57600080fd5b9250929050565b60008060008060008060008060c0898b031215610e0d57600080fd5b883567ffffffffffffffff80821115610e2557600080fd5b610e318c838d01610da8565b909a50985060208b01359150610e4682610bec565b819750610e5560408c01610c86565b9650610e6360608c01610c6e565b955060808b01359150610e7582610bec565b90935060a08a01359080821115610e8b57600080fd5b50610e988b828c01610da8565b999c989b5096995094979396929594505050565b600060208284031215610ebe57600080fd5b8135610ec981610bec565b9392505050565b60008060008060008060a08789031215610ee957600080fd5b863567ffffffffffffffff811115610f0057600080fd5b610f0c89828a01610da8565b9097509550506020870135610f2081610bec565b9350610f2e60408801610c86565b9250610f3c60608801610c6e565b91506080870135610f4c81610bec565b809150509295509295509295565b8183823760009101908152919050565b600060208284031215610f7c57600080fd5b8151610ec981610bec565b600060208284031215610f9957600080fd5b8151610ec981610c11565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561047e5761047e610fba565b8181038181111561047e5761047e610fba56fea26469706673582212200d03c4139275e356bdf5747a80f6b61b271f2b7ff551603efb6b19ffb5b13ffe64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 444, + "contract": "contracts/wrapper/mocks/TestUnwrap.sol:TestUnwrap", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 24616, + "contract": "contracts/wrapper/mocks/TestUnwrap.sol:TestUnwrap", + "label": "approvedWrapper", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/UniversalResolver.json b/solidity/dns-contracts/deployments/sepolia/UniversalResolver.json new file mode 100644 index 0000000..06825a9 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/UniversalResolver.json @@ -0,0 +1,733 @@ +{ + "address": "0xc8af999e38273d658be1b921b88a9ddf005769cc", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_registry", + "type": "address" + }, + { + "internalType": "string[]", + "name": "_urls", + "type": "string[]" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "string[]", + "name": "urls", + "type": "string[]" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "bytes4", + "name": "callbackFunction", + "type": "bytes4" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "OffchainLookup", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "name": "ResolverError", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverNotContract", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverNotFound", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverWildcardNotSupported", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "string[]", + "name": "gateways", + "type": "string[]" + }, + { + "internalType": "bytes4", + "name": "callbackFunction", + "type": "bytes4" + }, + { + "internalType": "bytes", + "name": "metaData", + "type": "bytes" + } + ], + "name": "_resolveSingle", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "batchGatewayURLs", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + } + ], + "name": "findResolver", + "outputs": [ + { + "internalType": "contract Resolver", + "name": "", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "registry", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "string[]", + "name": "gateways", + "type": "string[]" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "resolve", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "internalType": "struct Result[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "string[]", + "name": "gateways", + "type": "string[]" + } + ], + "name": "resolve", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "internalType": "struct Result[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "response", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "resolveCallback", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "internalType": "struct Result[]", + "name": "", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "response", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "resolveSingleCallback", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "reverseName", + "type": "bytes" + }, + { + "internalType": "string[]", + "name": "gateways", + "type": "string[]" + } + ], + "name": "reverse", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "reverseName", + "type": "bytes" + } + ], + "name": "reverse", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "response", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "reverseCallback", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "_urls", + "type": "string[]" + } + ], + "name": "setGatewayURLs", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x3bb62376ac60bc8e9138c5861c6a62ba0b6b9324040c08c44bcb5250f123e501", + "receipt": { + "to": null, + "from": "0x69420f05a11f617b4b74ffe2e04b2d300dfa556f", + "contractAddress": "0xc8af999e38273d658be1b921b88a9ddf005769cc", + "transactionIndex": "0x66", + "gasUsed": "0x2fe6fe", + "logsBloom": "0x00000000010000000400000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000040000000000000008000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x25e7f3d78538093ee023c6a495b423671065539c55907f9f9d91791f1765af2e", + "transactionHash": "0x7e9dca6d913dc0b14b42df843fd75c420ff1b73bfb9941a7eb92b40e6881c006", + "logs": [ + { + "address": "0xc8af999e38273d658be1b921b88a9ddf005769cc", + "blockHash": "0x25e7f3d78538093ee023c6a495b423671065539c55907f9f9d91791f1765af2e", + "blockNumber": "0x5121d8", + "data": "0x", + "logIndex": "0x9a", + "removed": false, + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000069420f05a11f617b4b74ffe2e04b2d300dfa556f" + ], + "transactionHash": "0x7e9dca6d913dc0b14b42df843fd75c420ff1b73bfb9941a7eb92b40e6881c006", + "transactionIndex": "0x66" + } + ], + "blockNumber": "0x5121d8", + "cumulativeGasUsed": "0xcc252a", + "status": "0x1" + }, + "args": [ + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + [ + "https://ccip-v2.ens.xyz" + ] + ], + "numDeployments": 5, + "solcInputHash": "49f758ec505ff69b72f3179ac11d7cfc", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_registry\",\"type\":\"address\"},{\"internalType\":\"string[]\",\"name\":\"_urls\",\"type\":\"string[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"string[]\",\"name\":\"urls\",\"type\":\"string[]\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"bytes4\",\"name\":\"callbackFunction\",\"type\":\"bytes4\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"OffchainLookup\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"name\":\"ResolverError\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverNotContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverWildcardNotSupported\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string[]\",\"name\":\"gateways\",\"type\":\"string[]\"},{\"internalType\":\"bytes4\",\"name\":\"callbackFunction\",\"type\":\"bytes4\"},{\"internalType\":\"bytes\",\"name\":\"metaData\",\"type\":\"bytes\"}],\"name\":\"_resolveSingle\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"batchGatewayURLs\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"}],\"name\":\"findResolver\",\"outputs\":[{\"internalType\":\"contract Resolver\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"registry\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string[]\",\"name\":\"gateways\",\"type\":\"string[]\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"resolve\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"internalType\":\"struct Result[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"string[]\",\"name\":\"gateways\",\"type\":\"string[]\"}],\"name\":\"resolve\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"internalType\":\"struct Result[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"response\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"resolveCallback\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"internalType\":\"struct Result[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"response\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"resolveSingleCallback\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"reverseName\",\"type\":\"bytes\"},{\"internalType\":\"string[]\",\"name\":\"gateways\",\"type\":\"string[]\"}],\"name\":\"reverse\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"reverseName\",\"type\":\"bytes\"}],\"name\":\"reverse\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"response\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"reverseCallback\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"_urls\",\"type\":\"string[]\"}],\"name\":\"setGatewayURLs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"findResolver(bytes)\":{\"details\":\"Finds a resolver by recursively querying the registry, starting at the longest name and progressively removing labels until it finds a result.\",\"params\":{\"name\":\"The name to resolve, in DNS-encoded and normalised form.\"},\"returns\":{\"_0\":\"resolver The Resolver responsible for this name.\",\"_1\":\"namehash The namehash of the full name.\",\"_2\":\"finalOffset The offset of the first label with a resolver.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"resolve(bytes,bytes)\":{\"details\":\"Performs ENS name resolution for the supplied name and resolution data.\",\"params\":{\"data\":\"The resolution data, as specified in ENSIP-10.\",\"name\":\"The name to resolve, in normalised and DNS-encoded form.\"},\"returns\":{\"_0\":\"The result of resolving the name.\"}},\"reverse(bytes,string[])\":{\"details\":\"Performs ENS name reverse resolution for the supplied reverse name.\",\"params\":{\"reverseName\":\"The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\"},\"returns\":{\"_0\":\"The resolved name, the resolved address, the reverse resolver address, and the resolver address.\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"The Universal Resolver is a contract that handles the work of resolving a name entirely onchain, making it possible to make a single smart contract call to resolve an ENS name.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/utils/UniversalResolver.sol\":\"UniversalResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf96f969e24029d43d0df89e59d365f277021dac62b48e1c1e3ebe0acdd7f1ca1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/registry/ENS.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7cb1158c7d268b63de1468e28e2711b28d686e2628ddb22da2149cd93ddeafda\"},\"contracts/resolvers/Resolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"./profiles/IABIResolver.sol\\\";\\nimport \\\"./profiles/IAddressResolver.sol\\\";\\nimport \\\"./profiles/IAddrResolver.sol\\\";\\nimport \\\"./profiles/IContentHashResolver.sol\\\";\\nimport \\\"./profiles/IDNSRecordResolver.sol\\\";\\nimport \\\"./profiles/IDNSZoneResolver.sol\\\";\\nimport \\\"./profiles/IInterfaceResolver.sol\\\";\\nimport \\\"./profiles/INameResolver.sol\\\";\\nimport \\\"./profiles/IPubkeyResolver.sol\\\";\\nimport \\\"./profiles/ITextResolver.sol\\\";\\nimport \\\"./profiles/IExtendedResolver.sol\\\";\\n\\n/**\\n * A generic resolver interface which includes all the functions including the ones deprecated\\n */\\ninterface Resolver is\\n IERC165,\\n IABIResolver,\\n IAddressResolver,\\n IAddrResolver,\\n IContentHashResolver,\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n IInterfaceResolver,\\n INameResolver,\\n IPubkeyResolver,\\n ITextResolver,\\n IExtendedResolver\\n{\\n /* Deprecated events */\\n event ContentChanged(bytes32 indexed node, bytes32 hash);\\n\\n function setApprovalForAll(address, bool) external;\\n\\n function approve(bytes32 node, address delegate, bool approved) external;\\n\\n function isApprovedForAll(address account, address operator) external;\\n\\n function isApprovedFor(\\n address owner,\\n bytes32 node,\\n address delegate\\n ) external;\\n\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external;\\n\\n function setAddr(bytes32 node, address addr) external;\\n\\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\\n\\n function setContenthash(bytes32 node, bytes calldata hash) external;\\n\\n function setDnsrr(bytes32 node, bytes calldata data) external;\\n\\n function setName(bytes32 node, string calldata _name) external;\\n\\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\\n\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external;\\n\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external;\\n\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n /* Deprecated functions */\\n function content(bytes32 node) external view returns (bytes32);\\n\\n function multihash(bytes32 node) external view returns (bytes memory);\\n\\n function setContent(bytes32 node, bytes32 hash) external;\\n\\n function setMultihash(bytes32 node, bytes calldata hash) external;\\n}\\n\",\"keccak256\":\"0xfc77ab6b7c59c3ebfe1c720bdebf9b08c2488ff7ac9501a9aa056c5d6d5b50c5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/utils/HexUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary HexUtils {\\n /**\\n * @dev Attempts to parse bytes32 from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexStringToBytes32(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (bytes32 r, bool valid) {\\n uint256 hexLength = lastIdx - idx;\\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\\n revert(\\\"Invalid string length\\\");\\n }\\n valid = true;\\n assembly {\\n // check that the index to read to is not past the end of the string\\n if gt(lastIdx, mload(str)) {\\n revert(0, 0)\\n }\\n\\n function getHex(c) -> ascii {\\n // chars 48-57: 0-9\\n if and(gt(c, 47), lt(c, 58)) {\\n ascii := sub(c, 48)\\n leave\\n }\\n // chars 65-70: A-F\\n if and(gt(c, 64), lt(c, 71)) {\\n ascii := add(sub(c, 65), 10)\\n leave\\n }\\n // chars 97-102: a-f\\n if and(gt(c, 96), lt(c, 103)) {\\n ascii := add(sub(c, 97), 10)\\n leave\\n }\\n // invalid char\\n ascii := 0xff\\n }\\n\\n let ptr := add(str, 32)\\n for {\\n let i := idx\\n } lt(i, lastIdx) {\\n i := add(i, 2)\\n } {\\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\\n // if either byte is invalid, set invalid and break loop\\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\\n valid := false\\n break\\n }\\n let combined := or(shl(4, byte1), byte2)\\n r := or(shl(8, r), combined)\\n }\\n }\\n }\\n\\n /**\\n * @dev Attempts to parse an address from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexToAddress(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (address, bool) {\\n if (lastIdx - idx < 40) return (address(0x0), false);\\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\\n return (address(uint160(uint256(r))), valid);\\n }\\n}\\n\",\"keccak256\":\"0x4a8a9c72d6f3effb80b310faa6dc273e7adbc3b949df9c7a42e290e5b13519f3\",\"license\":\"MIT\"},\"contracts/utils/LowLevelCallUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.13;\\n\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nlibrary LowLevelCallUtils {\\n using Address for address;\\n\\n /**\\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\\n * `returnDataSize` and `readReturnData`.\\n * @param target The address to staticcall.\\n * @param data The data to pass to the call.\\n * @return success True if the call succeeded, or false if it reverts.\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data\\n ) internal view returns (bool success) {\\n return functionStaticCall(target, data, gasleft());\\n }\\n\\n /**\\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\\n * `returnDataSize` and `readReturnData`.\\n * @param target The address to staticcall.\\n * @param data The data to pass to the call.\\n * @param gasLimit The gas limit to use for the call.\\n * @return success True if the call succeeded, or false if it reverts.\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n uint256 gasLimit\\n ) internal view returns (bool success) {\\n require(\\n target.isContract(),\\n \\\"LowLevelCallUtils: static call to non-contract\\\"\\n );\\n assembly {\\n success := staticcall(\\n gasLimit,\\n target,\\n add(data, 32),\\n mload(data),\\n 0,\\n 0\\n )\\n }\\n }\\n\\n /**\\n * @dev Returns the size of the return data of the most recent external call.\\n */\\n function returnDataSize() internal pure returns (uint256 len) {\\n assembly {\\n len := returndatasize()\\n }\\n }\\n\\n /**\\n * @dev Reads return data from the most recent external call.\\n * @param offset Offset into the return data.\\n * @param length Number of bytes to return.\\n */\\n function readReturnData(\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (bytes memory data) {\\n data = new bytes(length);\\n assembly {\\n returndatacopy(add(data, 32), offset, length)\\n }\\n }\\n\\n /**\\n * @dev Reverts with the return data from the most recent external call.\\n */\\n function propagateRevert() internal pure {\\n assembly {\\n returndatacopy(0, 0, returndatasize())\\n revert(0, returndatasize())\\n }\\n }\\n}\\n\",\"keccak256\":\"0xba30d0a44a6a2f1557e4913108b25d8b36cb40a54f44ac98086465d6bf77c5e6\",\"license\":\"MIT\"},\"contracts/utils/NameEncoder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.13;\\n\\nimport {BytesUtils} from \\\"../wrapper/BytesUtils.sol\\\";\\n\\nlibrary NameEncoder {\\n using BytesUtils for bytes;\\n\\n function dnsEncodeName(\\n string memory name\\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\\n uint8 labelLength = 0;\\n bytes memory bytesName = bytes(name);\\n uint256 length = bytesName.length;\\n dnsName = new bytes(length + 2);\\n node = 0;\\n if (length == 0) {\\n dnsName[0] = 0;\\n return (dnsName, node);\\n }\\n\\n // use unchecked to save gas since we check for an underflow\\n // and we check for the length before the loop\\n unchecked {\\n for (uint256 i = length - 1; i >= 0; i--) {\\n if (bytesName[i] == \\\".\\\") {\\n dnsName[i + 1] = bytes1(labelLength);\\n node = keccak256(\\n abi.encodePacked(\\n node,\\n bytesName.keccak(i + 1, labelLength)\\n )\\n );\\n labelLength = 0;\\n } else {\\n labelLength += 1;\\n dnsName[i + 1] = bytesName[i];\\n }\\n if (i == 0) {\\n break;\\n }\\n }\\n }\\n\\n node = keccak256(\\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\\n );\\n\\n dnsName[0] = bytes1(labelLength);\\n return (dnsName, node);\\n }\\n}\\n\",\"keccak256\":\"0x63fd5f360cef8c9b8b8cfdff20d3f0e955b4c8ac7dfac758788223c61678aad1\",\"license\":\"MIT\"},\"contracts/utils/UniversalResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ERC165} from \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {LowLevelCallUtils} from \\\"./LowLevelCallUtils.sol\\\";\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IExtendedResolver} from \\\"../resolvers/profiles/IExtendedResolver.sol\\\";\\nimport {Resolver, INameResolver, IAddrResolver} from \\\"../resolvers/Resolver.sol\\\";\\nimport {NameEncoder} from \\\"./NameEncoder.sol\\\";\\nimport {BytesUtils} from \\\"../wrapper/BytesUtils.sol\\\";\\nimport {HexUtils} from \\\"./HexUtils.sol\\\";\\n\\nerror OffchainLookup(\\n address sender,\\n string[] urls,\\n bytes callData,\\n bytes4 callbackFunction,\\n bytes extraData\\n);\\n\\nerror ResolverNotFound();\\n\\nerror ResolverWildcardNotSupported();\\n\\nerror ResolverNotContract();\\n\\nerror ResolverError(bytes returnData);\\n\\nerror HttpError(HttpErrorItem[] errors);\\n\\nstruct HttpErrorItem {\\n uint16 status;\\n string message;\\n}\\n\\nstruct MulticallData {\\n bytes name;\\n bytes[] data;\\n string[] gateways;\\n bytes4 callbackFunction;\\n bool isWildcard;\\n address resolver;\\n bytes metaData;\\n bool[] failures;\\n}\\n\\nstruct MulticallChecks {\\n bool isCallback;\\n bool hasExtendedResolver;\\n}\\n\\nstruct OffchainLookupCallData {\\n address sender;\\n string[] urls;\\n bytes callData;\\n}\\n\\nstruct OffchainLookupExtraData {\\n bytes4 callbackFunction;\\n bytes data;\\n}\\n\\nstruct Result {\\n bool success;\\n bytes returnData;\\n}\\n\\ninterface BatchGateway {\\n function query(\\n OffchainLookupCallData[] memory data\\n ) external returns (bool[] memory failures, bytes[] memory responses);\\n}\\n\\n/**\\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\\n * making it possible to make a single smart contract call to resolve an ENS name.\\n */\\ncontract UniversalResolver is ERC165, Ownable {\\n using Address for address;\\n using NameEncoder for string;\\n using BytesUtils for bytes;\\n using HexUtils for bytes;\\n\\n string[] public batchGatewayURLs;\\n ENS public immutable registry;\\n\\n constructor(address _registry, string[] memory _urls) {\\n registry = ENS(_registry);\\n batchGatewayURLs = _urls;\\n }\\n\\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\\n batchGatewayURLs = _urls;\\n }\\n\\n /**\\n * @dev Performs ENS name resolution for the supplied name and resolution data.\\n * @param name The name to resolve, in normalised and DNS-encoded form.\\n * @param data The resolution data, as specified in ENSIP-10.\\n * @return The result of resolving the name.\\n */\\n function resolve(\\n bytes calldata name,\\n bytes memory data\\n ) external view returns (bytes memory, address) {\\n return\\n _resolveSingle(\\n name,\\n data,\\n batchGatewayURLs,\\n this.resolveSingleCallback.selector,\\n \\\"\\\"\\n );\\n }\\n\\n function resolve(\\n bytes calldata name,\\n bytes[] memory data\\n ) external view returns (Result[] memory, address) {\\n return resolve(name, data, batchGatewayURLs);\\n }\\n\\n function resolve(\\n bytes calldata name,\\n bytes memory data,\\n string[] memory gateways\\n ) external view returns (bytes memory, address) {\\n return\\n _resolveSingle(\\n name,\\n data,\\n gateways,\\n this.resolveSingleCallback.selector,\\n \\\"\\\"\\n );\\n }\\n\\n function resolve(\\n bytes calldata name,\\n bytes[] memory data,\\n string[] memory gateways\\n ) public view returns (Result[] memory, address) {\\n return\\n _resolve(name, data, gateways, this.resolveCallback.selector, \\\"\\\");\\n }\\n\\n function _resolveSingle(\\n bytes calldata name,\\n bytes memory data,\\n string[] memory gateways,\\n bytes4 callbackFunction,\\n bytes memory metaData\\n ) public view returns (bytes memory, address) {\\n bytes[] memory dataArr = new bytes[](1);\\n dataArr[0] = data;\\n (Result[] memory results, address resolver) = _resolve(\\n name,\\n dataArr,\\n gateways,\\n callbackFunction,\\n metaData\\n );\\n\\n Result memory result = results[0];\\n\\n _checkResolveSingle(result);\\n\\n return (result.returnData, resolver);\\n }\\n\\n function _resolve(\\n bytes calldata name,\\n bytes[] memory data,\\n string[] memory gateways,\\n bytes4 callbackFunction,\\n bytes memory metaData\\n ) internal view returns (Result[] memory results, address resolverAddress) {\\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\\n resolverAddress = address(resolver);\\n if (resolverAddress == address(0)) {\\n revert ResolverNotFound();\\n }\\n\\n if (!resolverAddress.isContract()) {\\n revert ResolverNotContract();\\n }\\n\\n bool isWildcard = finalOffset != 0;\\n\\n results = _multicall(\\n MulticallData(\\n name,\\n data,\\n gateways,\\n callbackFunction,\\n isWildcard,\\n resolverAddress,\\n metaData,\\n new bool[](data.length)\\n )\\n );\\n }\\n\\n function reverse(\\n bytes calldata reverseName\\n ) external view returns (string memory, address, address, address) {\\n return reverse(reverseName, batchGatewayURLs);\\n }\\n\\n /**\\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\\n */\\n function reverse(\\n bytes calldata reverseName,\\n string[] memory gateways\\n ) public view returns (string memory, address, address, address) {\\n bytes memory encodedCall = abi.encodeCall(\\n INameResolver.name,\\n reverseName.namehash(0)\\n );\\n (\\n bytes memory reverseResolvedData,\\n address reverseResolverAddress\\n ) = _resolveSingle(\\n reverseName,\\n encodedCall,\\n gateways,\\n this.reverseCallback.selector,\\n \\\"\\\"\\n );\\n\\n return\\n getForwardDataFromReverse(\\n reverseResolvedData,\\n reverseResolverAddress,\\n gateways\\n );\\n }\\n\\n function getForwardDataFromReverse(\\n bytes memory resolvedReverseData,\\n address reverseResolverAddress,\\n string[] memory gateways\\n ) internal view returns (string memory, address, address, address) {\\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\\n\\n (bytes memory encodedName, bytes32 namehash) = resolvedName\\n .dnsEncodeName();\\n\\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\\n bytes memory metaData = abi.encode(\\n resolvedName,\\n reverseResolverAddress\\n );\\n (bytes memory resolvedData, address resolverAddress) = this\\n ._resolveSingle(\\n encodedName,\\n encodedCall,\\n gateways,\\n this.reverseCallback.selector,\\n metaData\\n );\\n\\n address resolvedAddress = abi.decode(resolvedData, (address));\\n\\n return (\\n resolvedName,\\n resolvedAddress,\\n reverseResolverAddress,\\n resolverAddress\\n );\\n }\\n\\n function resolveSingleCallback(\\n bytes calldata response,\\n bytes calldata extraData\\n ) external view returns (bytes memory, address) {\\n (Result[] memory results, address resolver, , ) = _resolveCallback(\\n response,\\n extraData,\\n this.resolveSingleCallback.selector\\n );\\n Result memory result = results[0];\\n\\n _checkResolveSingle(result);\\n\\n return (result.returnData, resolver);\\n }\\n\\n function resolveCallback(\\n bytes calldata response,\\n bytes calldata extraData\\n ) external view returns (Result[] memory, address) {\\n (Result[] memory results, address resolver, , ) = _resolveCallback(\\n response,\\n extraData,\\n this.resolveCallback.selector\\n );\\n return (results, resolver);\\n }\\n\\n function reverseCallback(\\n bytes calldata response,\\n bytes calldata extraData\\n ) external view returns (string memory, address, address, address) {\\n (\\n Result[] memory results,\\n address resolverAddress,\\n string[] memory gateways,\\n bytes memory metaData\\n ) = _resolveCallback(\\n response,\\n extraData,\\n this.reverseCallback.selector\\n );\\n\\n Result memory result = results[0];\\n\\n _checkResolveSingle(result);\\n\\n if (metaData.length > 0) {\\n (string memory resolvedName, address reverseResolverAddress) = abi\\n .decode(metaData, (string, address));\\n address resolvedAddress = abi.decode(result.returnData, (address));\\n return (\\n resolvedName,\\n resolvedAddress,\\n reverseResolverAddress,\\n resolverAddress\\n );\\n }\\n\\n return\\n getForwardDataFromReverse(\\n result.returnData,\\n resolverAddress,\\n gateways\\n );\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override returns (bool) {\\n return\\n interfaceId == type(IExtendedResolver).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n function _resolveCallback(\\n bytes calldata response,\\n bytes calldata extraData,\\n bytes4 callbackFunction\\n )\\n internal\\n view\\n returns (Result[] memory, address, string[] memory, bytes memory)\\n {\\n MulticallData memory multicallData;\\n multicallData.callbackFunction = callbackFunction;\\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\\n response,\\n (bool[], bytes[])\\n );\\n OffchainLookupExtraData[] memory extraDatas;\\n (\\n multicallData.isWildcard,\\n multicallData.resolver,\\n multicallData.gateways,\\n multicallData.metaData,\\n extraDatas\\n ) = abi.decode(\\n extraData,\\n (bool, address, string[], bytes, OffchainLookupExtraData[])\\n );\\n require(responses.length <= extraDatas.length);\\n multicallData.data = new bytes[](extraDatas.length);\\n multicallData.failures = new bool[](extraDatas.length);\\n uint256 offchainCount = 0;\\n for (uint256 i = 0; i < extraDatas.length; i++) {\\n if (extraDatas[i].callbackFunction == bytes4(0)) {\\n // This call did not require an offchain lookup; use the previous input data.\\n multicallData.data[i] = extraDatas[i].data;\\n } else {\\n if (failures[offchainCount]) {\\n multicallData.failures[i] = true;\\n multicallData.data[i] = responses[offchainCount];\\n } else {\\n multicallData.data[i] = abi.encodeWithSelector(\\n extraDatas[i].callbackFunction,\\n responses[offchainCount],\\n extraDatas[i].data\\n );\\n }\\n offchainCount = offchainCount + 1;\\n }\\n }\\n\\n return (\\n _multicall(multicallData),\\n multicallData.resolver,\\n multicallData.gateways,\\n multicallData.metaData\\n );\\n }\\n\\n /**\\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\\n * the error with the data necessary to continue the request where it left off.\\n * @param target The address to call.\\n * @param data The data to call `target` with.\\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\\n * @return result Whether the call succeeded.\\n */\\n function callWithOffchainLookupPropagation(\\n address target,\\n bytes memory data,\\n bool isSafe\\n )\\n internal\\n view\\n returns (\\n bool offchain,\\n bytes memory returnData,\\n OffchainLookupExtraData memory extraData,\\n bool result\\n )\\n {\\n if (isSafe) {\\n result = LowLevelCallUtils.functionStaticCall(target, data);\\n } else {\\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\\n }\\n uint256 size = LowLevelCallUtils.returnDataSize();\\n\\n if (result) {\\n return (\\n false,\\n LowLevelCallUtils.readReturnData(0, size),\\n extraData,\\n true\\n );\\n }\\n\\n // Failure\\n if (size >= 4) {\\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\\n // Offchain lookup. Decode the revert message and create our own that nests it.\\n bytes memory revertData = LowLevelCallUtils.readReturnData(\\n 4,\\n size - 4\\n );\\n if (bytes4(errorId) == OffchainLookup.selector) {\\n (\\n address wrappedSender,\\n string[] memory wrappedUrls,\\n bytes memory wrappedCallData,\\n bytes4 wrappedCallbackFunction,\\n bytes memory wrappedExtraData\\n ) = abi.decode(\\n revertData,\\n (address, string[], bytes, bytes4, bytes)\\n );\\n if (wrappedSender == target) {\\n returnData = abi.encode(\\n OffchainLookupCallData(\\n wrappedSender,\\n wrappedUrls,\\n wrappedCallData\\n )\\n );\\n extraData = OffchainLookupExtraData(\\n wrappedCallbackFunction,\\n wrappedExtraData\\n );\\n return (true, returnData, extraData, false);\\n }\\n } else {\\n returnData = bytes.concat(errorId, revertData);\\n return (false, returnData, extraData, false);\\n }\\n }\\n }\\n\\n /**\\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\\n * removing labels until it finds a result.\\n * @param name The name to resolve, in DNS-encoded and normalised form.\\n * @return resolver The Resolver responsible for this name.\\n * @return namehash The namehash of the full name.\\n * @return finalOffset The offset of the first label with a resolver.\\n */\\n function findResolver(\\n bytes calldata name\\n ) public view returns (Resolver, bytes32, uint256) {\\n (\\n address resolver,\\n bytes32 namehash,\\n uint256 finalOffset\\n ) = findResolver(name, 0);\\n return (Resolver(resolver), namehash, finalOffset);\\n }\\n\\n function findResolver(\\n bytes calldata name,\\n uint256 offset\\n ) internal view returns (address, bytes32, uint256) {\\n uint256 labelLength = uint256(uint8(name[offset]));\\n if (labelLength == 0) {\\n return (address(0), bytes32(0), offset);\\n }\\n uint256 nextLabel = offset + labelLength + 1;\\n bytes32 labelHash;\\n if (\\n labelLength == 66 &&\\n // 0x5b == '['\\n name[offset + 1] == 0x5b &&\\n // 0x5d == ']'\\n name[nextLabel - 1] == 0x5d\\n ) {\\n // Encrypted label\\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\\n .hexStringToBytes32(0, 64);\\n } else {\\n labelHash = keccak256(name[offset + 1:nextLabel]);\\n }\\n (\\n address parentresolver,\\n bytes32 parentnode,\\n uint256 parentoffset\\n ) = findResolver(name, nextLabel);\\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\\n address resolver = registry.resolver(node);\\n if (resolver != address(0)) {\\n return (resolver, node, offset);\\n }\\n return (parentresolver, node, parentoffset);\\n }\\n\\n function _checkInterface(\\n address resolver,\\n bytes4 interfaceId\\n ) internal view returns (bool) {\\n try\\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\\n returns (bool supported) {\\n return supported;\\n } catch {\\n return false;\\n }\\n }\\n\\n function _checkSafetyAndItem(\\n bytes memory name,\\n bytes memory item,\\n address resolver,\\n MulticallChecks memory multicallChecks\\n ) internal view returns (bool, bytes memory) {\\n if (!multicallChecks.isCallback) {\\n if (multicallChecks.hasExtendedResolver) {\\n return (\\n true,\\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\\n );\\n }\\n return (_checkInterface(resolver, bytes4(item)), item);\\n }\\n return (true, item);\\n }\\n\\n function _checkMulticall(\\n MulticallData memory multicallData\\n ) internal view returns (MulticallChecks memory) {\\n bool isCallback = multicallData.name.length == 0;\\n bool hasExtendedResolver = _checkInterface(\\n multicallData.resolver,\\n type(IExtendedResolver).interfaceId\\n );\\n\\n if (multicallData.isWildcard && !hasExtendedResolver) {\\n revert ResolverWildcardNotSupported();\\n }\\n\\n return MulticallChecks(isCallback, hasExtendedResolver);\\n }\\n\\n function _checkResolveSingle(Result memory result) internal pure {\\n if (!result.success) {\\n if (bytes4(result.returnData) == HttpError.selector) {\\n bytes memory returnData = result.returnData;\\n assembly {\\n revert(add(returnData, 32), mload(returnData))\\n }\\n }\\n revert ResolverError(result.returnData);\\n }\\n }\\n\\n function _multicall(\\n MulticallData memory multicallData\\n ) internal view returns (Result[] memory results) {\\n uint256 length = multicallData.data.length;\\n uint256 offchainCount = 0;\\n OffchainLookupCallData[]\\n memory callDatas = new OffchainLookupCallData[](length);\\n OffchainLookupExtraData[]\\n memory extraDatas = new OffchainLookupExtraData[](length);\\n results = new Result[](length);\\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\\n\\n for (uint256 i = 0; i < length; i++) {\\n bytes memory item = multicallData.data[i];\\n bool failure = multicallData.failures[i];\\n\\n if (failure) {\\n results[i] = Result(false, item);\\n continue;\\n }\\n\\n bool isSafe = false;\\n (isSafe, item) = _checkSafetyAndItem(\\n multicallData.name,\\n item,\\n multicallData.resolver,\\n multicallChecks\\n );\\n\\n (\\n bool offchain,\\n bytes memory returnData,\\n OffchainLookupExtraData memory extraData,\\n bool success\\n ) = callWithOffchainLookupPropagation(\\n multicallData.resolver,\\n item,\\n isSafe\\n );\\n\\n if (offchain) {\\n callDatas[offchainCount] = abi.decode(\\n returnData,\\n (OffchainLookupCallData)\\n );\\n extraDatas[i] = extraData;\\n offchainCount += 1;\\n continue;\\n }\\n\\n if (success && multicallChecks.hasExtendedResolver) {\\n // if this is a successful resolve() call, unwrap the result\\n returnData = abi.decode(returnData, (bytes));\\n }\\n results[i] = Result(success, returnData);\\n extraDatas[i].data = item;\\n }\\n\\n if (offchainCount == 0) {\\n return results;\\n }\\n\\n // Trim callDatas if offchain data exists\\n assembly {\\n mstore(callDatas, offchainCount)\\n }\\n\\n revert OffchainLookup(\\n address(this),\\n multicallData.gateways,\\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\\n multicallData.callbackFunction,\\n abi.encode(\\n multicallData.isWildcard,\\n multicallData.resolver,\\n multicallData.gateways,\\n multicallData.metaData,\\n extraDatas\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x2a03a3a94a411b599690e58634c2c5695561cbe4a16fae60cbfefa872a6c2f7b\",\"license\":\"MIT\"},\"contracts/wrapper/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nlibrary BytesUtils {\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes32) {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n}\\n\",\"keccak256\":\"0xf862cd86d749158a554e3cb517efa9097331ec0cf7225117f21e96fb50c67edb\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040523480156200001157600080fd5b5060405162003b0f38038062003b0f8339810160408190526200003491620001da565b6200003f336200006a565b6001600160a01b038216608052805162000061906001906020840190620000ba565b5050506200049c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b82805482825590600052602060002090810192821562000105579160200282015b82811115620001055782518290620000f49082620003d0565b5091602001919060010190620000db565b506200011392915062000117565b5090565b80821115620001135760006200012e828262000138565b5060010162000117565b508054620001469062000341565b6000825580601f1062000157575050565b601f0160209004906000526020600020908101906200017791906200017a565b50565b5b808211156200011357600081556001016200017b565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620001d257620001d262000191565b604052919050565b6000806040808486031215620001ef57600080fd5b83516001600160a01b03811681146200020757600080fd5b602085810151919450906001600160401b03808211156200022757600080fd5b8187019150601f88818401126200023d57600080fd5b82518281111562000252576200025262000191565b8060051b62000263868201620001a7565b918252848101860191868101908c8411156200027e57600080fd5b87870192505b838310156200032e578251868111156200029e5760008081fd5b8701603f81018e13620002b15760008081fd5b8881015187811115620002c857620002c862000191565b620002db818801601f19168b01620001a7565b8181528f8c838501011115620002f15760008081fd5b60005b8281101562000311578381018d01518282018d01528b01620002f4565b5060009181018b0191909152835250918701919087019062000284565b8099505050505050505050509250929050565b600181811c908216806200035657607f821691505b6020821081036200037757634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003cb57600081815260208120601f850160051c81016020861015620003a65750805b601f850160051c820191505b81811015620003c757828155600101620003b2565b5050505b505050565b81516001600160401b03811115620003ec57620003ec62000191565b6200040481620003fd845462000341565b846200037d565b602080601f8311600181146200043c5760008415620004235750858301515b600019600386901b1c1916600185901b178555620003c7565b600085815260208120601f198616915b828110156200046d578886015182559484019460019091019084016200044c565b50858210156200048c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b608051613650620004bf600039600081816101ea01526114fc01526136506000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c80638e5ea8df116100b2578063b241d0d311610081578063e0a8541211610066578063e0a85412146102ec578063ec11c823146102ff578063f2fde38b1461031257600080fd5b8063b241d0d3146102c6578063b4a85801146102d957600080fd5b80638e5ea8df146102485780639061b9231461025b578063a1cbcbaf1461026e578063a6b16419146102a657600080fd5b8063715018a6116101095780637b103999116100ee5780637b103999146101e55780638da5cb5b146102245780638e25a0f31461023557600080fd5b8063715018a6146101c857806376286c00146101d257600080fd5b806301ffc9a71461013b5780630667cfea14610163578063206c74c9146101845780636dc4fb73146101a5575b600080fd5b61014e6101493660046123d3565b610325565b60405190151581526020015b60405180910390f35b6101766101713660046125f3565b61035c565b60405161015a9291906126d1565b61019761019236600461277c565b610392565b60405161015a9291906127e5565b6101b86101b336600461286e565b61047f565b60405161015a94939291906128da565b6101d0610547565b005b6101976101e0366004612916565b61055b565b61020c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161015a565b6000546001600160a01b031661020c565b610176610243366004612975565b610583565b6101d0610256366004612a3b565b610626565b610176610269366004612a78565b610645565b61028161027c366004612ad7565b61073e565b604080516001600160a01b03909416845260208401929092529082015260600161015a565b6102b96102b4366004612b19565b610764565b60405161015a9190612b32565b6101b86102d4366004612b45565b610810565b6101976102e736600461286e565b610902565b6101766102fa36600461286e565b610946565b6101b861030d366004612ad7565b6109b8565b6101d0610320366004612bb9565b610aab565b60006001600160e01b03198216639061b92360e01b148061035657506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060006103848686868663e0a8541260e01b60405180602001604052806000815250610583565b915091505b94509492505050565b606060006104738585856001805480602002602001604051908101604052809291908181526020016000905b8282101561046a5783829060005260206000200180546103dd90612bd6565b80601f016020809104026020016040519081016040528092919081815260200182805461040990612bd6565b80156104565780601f1061042b57610100808354040283529160200191610456565b820191906000526020600020905b81548152906001019060200180831161043957829003601f168201915b5050505050815260200190600101906103be565b5050505061055b565b91509150935093915050565b6060600080808080808061049d8c8c8c8c636dc4fb7360e01b610b40565b93509350935093506000846000815181106104ba576104ba612c10565b602002602001015190506104cd81610ec6565b81511561051f57600080838060200190518101906104eb9190612c6b565b91509150600083602001518060200190518101906105099190612cbd565b929b50919950975093955061053c945050505050565b61052e81602001518585610f51565b985098509850985050505050505b945094509450949050565b61054f6110b2565b610559600061110c565b565b606060006103848686868663b4a8580160e01b60405180602001604052806000815250611174565b6040805160018082528183019092526060916000918291816020015b606081526020019060019003908161059f57905050905086816000815181106105ca576105ca612c10565b60200260200101819052506000806105e68b8b858b8b8b611174565b915091506000826000815181106105ff576105ff612c10565b6020026020010151905061061281610ec6565b602001519b909a5098505050505050505050565b61062e6110b2565b8051610641906001906020840190612300565b5050565b606060006104738585856001805480602002602001604051908101604052809291908181526020016000905b8282101561071d57838290600052602060002001805461069090612bd6565b80601f01602080910402602001604051908101604052809291908181526020018280546106bc90612bd6565b80156107095780601f106106de57610100808354040283529160200191610709565b820191906000526020600020905b8154815290600101906020018083116106ec57829003601f168201915b505050505081526020019060010190610671565b5050505063e0a8541260e01b60405180602001604052806000815250610583565b600080600080600080610753888860006112f5565b919750955093505050509250925092565b6001818154811061077457600080fd5b90600052602060002001600091509050805461078f90612bd6565b80601f01602080910402602001604051908101604052809291908181526020018280546107bb90612bd6565b80156108085780601f106107dd57610100808354040283529160200191610808565b820191906000526020600020905b8154815290600101906020018083116107eb57829003601f168201915b505050505081565b606060008060008061085c600089898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506115a39050565b60405160240161086e91815260200190565b60408051601f19818403018152918152602080830180516001600160e01b03167f691f3431000000000000000000000000000000000000000000000000000000001790528151908101909152600080825291925081906108de908b908b9086908c90636dc4fb7360e01b90610583565b915091506108ed82828a610f51565b96509650965096505050505b93509350935093565b606060008080610935888888887fb4a8580100000000000000000000000000000000000000000000000000000000610b40565b50919a909950975050505050505050565b606060008080610979888888887fe0a8541200000000000000000000000000000000000000000000000000000000610b40565b50509150915060008260008151811061099457610994612c10565b602002602001015190506109a781610ec6565b602001519890975095505050505050565b60606000806000610a9b86866001805480602002602001604051908101604052809291908181526020016000905b82821015610a92578382906000526020600020018054610a0590612bd6565b80601f0160208091040260200160405190810160405280929190818152602001828054610a3190612bd6565b8015610a7e5780601f10610a5357610100808354040283529160200191610a7e565b820191906000526020600020905b815481529060010190602001808311610a6157829003601f168201915b5050505050815260200190600101906109e6565b50505050610810565b9299919850965090945092505050565b610ab36110b2565b6001600160a01b038116610b345760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610b3d8161110c565b50565b60606000606080610ba460405180610100016040528060608152602001606081526020016060815260200160006001600160e01b031916815260200160001515815260200160006001600160a01b0316815260200160608152602001606081525090565b6001600160e01b031986166060820152600080610bc38b8d018d612ce8565b90925090506060610bd68a8c018c612da0565b60c089019190915260408801919091526001600160a01b0390911660a08701529015156080860152805183519192501015610c1057600080fd5b805167ffffffffffffffff811115610c2a57610c2a612439565b604051908082528060200260200182016040528015610c5d57816020015b6060815260200190600190039081610c485790505b506020850152805167ffffffffffffffff811115610c7d57610c7d612439565b604051908082528060200260200182016040528015610ca6578160200160208202803683370190505b5060e08501526000805b8251811015610e94578251600090849083908110610cd057610cd0612c10565b6020026020010151600001516001600160e01b03191603610d2f57828181518110610cfd57610cfd612c10565b60200260200101516020015186602001518281518110610d1f57610d1f612c10565b6020026020010181905250610e82565b848281518110610d4157610d41612c10565b602002602001015115610db85760018660e001518281518110610d6657610d66612c10565b602002602001019015159081151581525050838281518110610d8a57610d8a612c10565b602002602001015186602001518281518110610da857610da8612c10565b6020026020010181905250610e74565b828181518110610dca57610dca612c10565b602002602001015160000151848381518110610de857610de8612c10565b6020026020010151848381518110610e0257610e02612c10565b602002602001015160200151604051602401610e1f929190612f24565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b03838183161783525050505086602001518281518110610e6857610e68612c10565b60200260200101819052505b610e7f826001612f68565b91505b80610e8c81612f7b565b915050610cb0565b50610e9e85611662565b8560a0015186604001518760c001519850985098509850505050505095509550955095915050565b8051610b3d5760208101517fca7a4e750000000000000000000000000000000000000000000000000000000090610efc90612f94565b6001600160e01b03191603610f1957602080820151805190918201fd5b80602001516040517f95c0c752000000000000000000000000000000000000000000000000000000008152600401610b2b9190612b32565b606060008060008087806020019051810190610f6d9190612fcc565b9050600080610f7b83611a50565b91509150600081604051602401610f9491815260200190565b60408051601f19818403018152918152602080830180516001600160e01b03167f3b3b57de000000000000000000000000000000000000000000000000000000001790529051919250600091610fee9187918e91016126d1565b6040516020818303038152906040529050600080306001600160a01b0316638e25a0f387868f636dc4fb7360e01b886040518663ffffffff1660e01b815260040161103d959493929190613056565b600060405180830381865afa15801561105a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110829190810190612c6b565b9150915060008280602001905181019061109c9190612cbd565b979f979e50909b50959950505050505050505050565b6000546001600160a01b031633146105595760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b2b565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606060008060006111858a8a61073e565b919450849350909150506001600160a01b0382166111cf576040517f7199966d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0383163b611210576040517f4981ac0500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516101206020601f8d01819004028201810190925261010081018b8152831515926112e5929182918f908f9081908501838280828437600092019190915250505090825250602081018c9052604081018b90526001600160e01b03198a16606082015283151560808201526001600160a01b03871660a082015260c081018990528b5160e09091019067ffffffffffffffff8111156112b4576112b4612439565b6040519080825280602002602001820160405280156112dd578160200160208202803683370190505b509052611662565b9450505050965096945050505050565b60008060008086868681811061130d5761130d612c10565b919091013560f81c915050600081900361133157506000925082915083905061159a565b600061133d8287612f68565b611348906001612f68565b9050600082604214801561138e57508888611364896001612f68565b81811061137357611373612c10565b9050013560f81c60f81b6001600160f81b031916605b60f81b145b80156113cc575088886113a26001856130bf565b8181106113b1576113b1612c10565b9050013560f81c60f81b6001600160f81b031916605d60f81b145b156114445761143c600060408b8b6113e58c6002612f68565b906113f16001896130bf565b926113fe939291906130d2565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929493925050611c799050565b509050611476565b8888611451896001612f68565b61145d928592906130d2565b60405161146b9291906130fc565b604051809103902090505b60008060006114868c8c876112f5565b925092509250600082856040516020016114aa929190918252602082015260400190565b60408051601f198184030181529082905280516020909101207f0178b8bf0000000000000000000000000000000000000000000000000000000082526004820181905291506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630178b8bf90602401602060405180830381865afa158015611543573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115679190612cbd565b90506001600160a01b0381161561158b579950975089965061159a95505050505050565b50929850919650909450505050505b93509350939050565b60008060006115b28585611dcd565b90925090508161162457600185516115ca91906130bf565b84146116185760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d650000006044820152606401610b2b565b50600091506103569050565b61162e85826115a3565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b6020810151516060906000808267ffffffffffffffff81111561168757611687612439565b6040519080825280602002602001820160405280156116e557816020015b6116d2604051806060016040528060006001600160a01b0316815260200160608152602001606081525090565b8152602001906001900390816116a55790505b50905060008367ffffffffffffffff81111561170357611703612439565b60405190808252806020026020018201604052801561174957816020015b6040805180820190915260008152606060208201528152602001906001900390816117215790505b5090508367ffffffffffffffff81111561176557611765612439565b6040519080825280602002602001820160405280156117ab57816020015b6040805180820190915260008152606060208201528152602001906001900390816117835790505b50945060006117b987611e84565b905060005b8581101561198f576000886020015182815181106117de576117de612c10565b6020026020010151905060008960e00151838151811061180057611800612c10565b60200260200101519050801561184c5760405180604001604052806000151581526020018381525089848151811061183a5761183a612c10565b6020026020010181905250505061197d565b60006118628b60000151848d60a0015188611f1b565b809450819250505060008060008061187f8f60a001518887611fa3565b935093509350935083156118f557828060200190518101906118a1919061318c565b8b8d815181106118b3576118b3612c10565b6020026020010181905250818a89815181106118d1576118d1612c10565b60209081029190910101526118e760018d612f68565b9b505050505050505061197d565b808015611903575088602001515b1561191f578280602001905181019061191c9190612fcc565b92505b60405180604001604052808215158152602001848152508e898151811061194857611948612c10565b6020026020010181905250868a898151811061196657611966612c10565b602002602001015160200181905250505050505050505b8061198781612f7b565b9150506117be565b50836000036119a2575050505050919050565b83835230876040015163a780bab660e01b856040516024016119c49190613287565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b03838183161783525050505089606001518a608001518b60a001518c604001518d60c0015189604051602001611a259594939291906132e9565b60408051601f1981840301815290829052630556f18360e41b8252610b2b95949392916004016133a6565b805160609060009081908490611a67816002612f68565b67ffffffffffffffff811115611a7f57611a7f612439565b6040519080825280601f01601f191660200182016040528015611aa9576020820181803683370190505b50945060009350808403611aee57600060f81b85600081518110611acf57611acf612c10565b60200101906001600160f81b031916908160001a905350505050915091565b60001981015b828181518110611b0657611b06612c10565b01602001517fff00000000000000000000000000000000000000000000000000000000000000167f2e0000000000000000000000000000000000000000000000000000000000000003611bc8578360f81b868260010181518110611b6c57611b6c612c10565b60200101906001600160f81b031916908160001a90535084611b95846001840160ff881661215b565b60408051602081019390935282015260600160405160208183030381529060405280519060200120945060009350611c18565b600184019350828181518110611be057611be0612c10565b602001015160f81c60f81b868260010181518110611c0057611c00612c10565b60200101906001600160f81b031916908160001a9053505b8015611c275760001901611af4565b5083611c3883600060ff871661215b565b6040805160208101939093528201526060016040516020818303038152906040528051906020012093508260f81b85600081518110611acf57611acf612c10565b60008080611c8785856130bf565b905080604014158015611c9b575080602814155b80611cb05750611cac6002826133da565b6001145b15611cfd5760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610b2b565b600191508551841115611d0f57600080fd5b611d60565b6000603a8210602f83111615611d2c5750602f190190565b60478210604083111615611d4257506036190190565b60678210606083111615611d5857506056190190565b5060ff919050565b60208601855b85811015611dc257611d7d8183015160001a611d14565b611d8f6001830184015160001a611d14565b60ff811460ff83141715611da857600095505050611dc2565b60049190911b1760089590951b9490941793600201611d66565b505050935093915050565b60008083518310611e205760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e647300006044820152606401610b2b565b6000848481518110611e3457611e34612c10565b016020015160f81c90508015611e6057611e5985611e53866001612f68565b8361215b565b9250611e65565b600092505b611e6f8185612f68565b611e7a906001612f68565b9150509250929050565b604080518082019091526000808252602082015281515160a0830151901590600090611eb790639061b92360e01b61217f565b905083608001518015611ec8575080155b15611eff576040517f82c2c72800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805180820190915291151582521515602082015292915050565b600060608260000151611f9757826020015115611f7b5760018686604051602401611f47929190612f24565b60408051601f198184030181529190526020810180516001600160e01b0316639061b92360e01b1790529092509050610389565b611f8d84611f8887612f94565b61217f565b8591509150610389565b50600195939450505050565b604080518082019091526000808252606060208301819052909160008415611fd657611fcf8787612204565b9050611fe6565b611fe3878761c350612218565b90505b3d811561200a576000611ffa6000836122ab565b9095509350600191506108f99050565b60048110612151576000612020600060046122ab565b90506000612038600461203381866130bf565b6122ab565b9050630556f18360e41b61204b83612f94565b6001600160e01b031916036121195760008060008060008580602001905181019061207691906133fc565b945094509450945094508e6001600160a01b0316856001600160a01b03160361210f576040518060600160405280866001600160a01b03168152602001858152602001848152506040516020016120cd91906134ac565b60408051601f198184030181528282019091526001600160e01b03199093168152602081019190915260019b509099509750600096506108f995505050505050565b505050505061214e565b818160405160200161212c9291906134bf565b60408051601f198184030181529190526000975095508693506108f992505050565b50505b5093509350935093565b825160009061216a8385612f68565b111561217557600080fd5b5091016020012090565b6040516301ffc9a760e01b81526001600160e01b0319821660048201526000906001600160a01b038416906301ffc9a79061c350906024016020604051808303818786fa935050505080156121f1575060408051601f3d908101601f191682019092526121ee918101906134ee565b60015b6121fd57506000610356565b9050610356565b600061221183835a612218565b9392505050565b60006001600160a01b0384163b6122975760405162461bcd60e51b815260206004820152602e60248201527f4c6f774c6576656c43616c6c5574696c733a207374617469632063616c6c207460448201527f6f206e6f6e2d636f6e74726163740000000000000000000000000000000000006064820152608401610b2b565b6000808451602086018786fa949350505050565b60608167ffffffffffffffff8111156122c6576122c6612439565b6040519080825280601f01601f1916602001820160405280156122f0576020820181803683370190505b5090508183602083013e92915050565b828054828255906000526020600020908101928215612346579160200282015b828111156123465782518290612336908261355a565b5091602001919060010190612320565b50612352929150612356565b5090565b8082111561235257600061236a8282612373565b50600101612356565b50805461237f90612bd6565b6000825580601f1061238f575050565b601f016020900490600052602060002090810190610b3d91905b8082111561235257600081556001016123a9565b6001600160e01b031981168114610b3d57600080fd5b6000602082840312156123e557600080fd5b8135612211816123bd565b60008083601f84011261240257600080fd5b50813567ffffffffffffffff81111561241a57600080fd5b60208301915083602082850101111561243257600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561247257612472612439565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156124a1576124a1612439565b604052919050565b600067ffffffffffffffff8211156124c3576124c3612439565b50601f01601f191660200190565b60006124e46124df846124a9565b612478565b90508281528383830111156124f857600080fd5b828260208301376000602084830101529392505050565b600082601f83011261252057600080fd5b612211838335602085016124d1565b600067ffffffffffffffff82111561254957612549612439565b5060051b60200190565b600082601f83011261256457600080fd5b813560206125746124df8361252f565b82815260059290921b8401810191818101908684111561259357600080fd5b8286015b848110156125e857803567ffffffffffffffff8111156125b75760008081fd5b8701603f810189136125c95760008081fd5b6125da8986830135604084016124d1565b845250918301918301612597565b509695505050505050565b6000806000806060858703121561260957600080fd5b843567ffffffffffffffff8082111561262157600080fd5b61262d888389016123f0565b9096509450602087013591508082111561264657600080fd5b6126528883890161250f565b9350604087013591508082111561266857600080fd5b5061267587828801612553565b91505092959194509250565b60005b8381101561269c578181015183820152602001612684565b50506000910152565b600081518084526126bd816020860160208601612681565b601f01601f19169290920160200192915050565b6040815260006126e460408301856126a5565b90506001600160a01b03831660208301529392505050565b600082601f83011261270d57600080fd5b8135602061271d6124df8361252f565b82815260059290921b8401810191818101908684111561273c57600080fd5b8286015b848110156125e857803567ffffffffffffffff8111156127605760008081fd5b61276e8986838b010161250f565b845250918301918301612740565b60008060006040848603121561279157600080fd5b833567ffffffffffffffff808211156127a957600080fd5b6127b5878388016123f0565b909550935060208601359150808211156127ce57600080fd5b506127db868287016126fc565b9150509250925092565b6000604080830181845280865180835260608601915060608160051b8701019250602080890160005b8381101561284f57888603605f19018552815180511515875283015183870188905261283c888801826126a5565b965050938201939082019060010161280e565b50508395506001600160a01b0388168188015250505050509392505050565b6000806000806040858703121561288457600080fd5b843567ffffffffffffffff8082111561289c57600080fd5b6128a8888389016123f0565b909650945060208701359150808211156128c157600080fd5b506128ce878288016123f0565b95989497509550505050565b6080815260006128ed60808301876126a5565b6001600160a01b0395861660208401529385166040830152509216606090920191909152919050565b6000806000806060858703121561292c57600080fd5b843567ffffffffffffffff8082111561294457600080fd5b612950888389016123f0565b9096509450602087013591508082111561296957600080fd5b612652888389016126fc565b60008060008060008060a0878903121561298e57600080fd5b863567ffffffffffffffff808211156129a657600080fd5b6129b28a838b016123f0565b909850965060208901359150808211156129cb57600080fd5b6129d78a838b0161250f565b955060408901359150808211156129ed57600080fd5b6129f98a838b01612553565b945060608901359150612a0b826123bd565b90925060808801359080821115612a2157600080fd5b50612a2e89828a0161250f565b9150509295509295509295565b600060208284031215612a4d57600080fd5b813567ffffffffffffffff811115612a6457600080fd5b612a7084828501612553565b949350505050565b600080600060408486031215612a8d57600080fd5b833567ffffffffffffffff80821115612aa557600080fd5b612ab1878388016123f0565b90955093506020860135915080821115612aca57600080fd5b506127db8682870161250f565b60008060208385031215612aea57600080fd5b823567ffffffffffffffff811115612b0157600080fd5b612b0d858286016123f0565b90969095509350505050565b600060208284031215612b2b57600080fd5b5035919050565b60208152600061221160208301846126a5565b600080600060408486031215612b5a57600080fd5b833567ffffffffffffffff80821115612b7257600080fd5b612b7e878388016123f0565b90955093506020860135915080821115612b9757600080fd5b506127db86828701612553565b6001600160a01b0381168114610b3d57600080fd5b600060208284031215612bcb57600080fd5b813561221181612ba4565b600181811c90821680612bea57607f821691505b602082108103612c0a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b600082601f830112612c3757600080fd5b8151612c456124df826124a9565b818152846020838601011115612c5a57600080fd5b612a70826020830160208701612681565b60008060408385031215612c7e57600080fd5b825167ffffffffffffffff811115612c9557600080fd5b612ca185828601612c26565b9250506020830151612cb281612ba4565b809150509250929050565b600060208284031215612ccf57600080fd5b815161221181612ba4565b8015158114610b3d57600080fd5b60008060408385031215612cfb57600080fd5b823567ffffffffffffffff80821115612d1357600080fd5b818501915085601f830112612d2757600080fd5b81356020612d376124df8361252f565b82815260059290921b84018101918181019089841115612d5657600080fd5b948201945b83861015612d7d578535612d6e81612cda565b82529482019490820190612d5b565b96505086013592505080821115612d9357600080fd5b50611e7a858286016126fc565b600080600080600060a08688031215612db857600080fd5b612dc28635612cda565b85359450612dd36020870135612ba4565b6020860135935067ffffffffffffffff8060408801351115612df457600080fd5b612e048860408901358901612553565b93508060608801351115612e1757600080fd5b612e27886060890135890161250f565b92508060808801351115612e3a57600080fd5b6080870135870188601f820112612e5057600080fd5b612e5d6124df823561252f565b81358082526020808301929160051b8401018b1015612e7b57600080fd5b602083015b6020843560051b850101811015612f12578481351115612e9f57600080fd5b803584016040818e03601f19011215612eb757600080fd5b612ebf61244f565b612ecc60208301356123bd565b602082013581528660408301351115612ee457600080fd5b612ef78e6020604085013585010161250f565b60208201528085525050602083019250602081019050612e80565b50809450505050509295509295909350565b604081526000612f3760408301856126a5565b8281036020840152612f4981856126a5565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561035657610356612f52565b600060018201612f8d57612f8d612f52565b5060010190565b6000815160208301516001600160e01b031980821693506004831015612fc45780818460040360031b1b83161693505b505050919050565b600060208284031215612fde57600080fd5b815167ffffffffffffffff811115612ff557600080fd5b612a7084828501612c26565b600081518084526020808501808196508360051b8101915082860160005b858110156130495782840389526130378483516126a5565b9885019893509084019060010161301f565b5091979650505050505050565b60a08152600061306960a08301886126a5565b828103602084015261307b81886126a5565b9050828103604084015261308f8187613001565b90506001600160e01b03198516606084015282810360808401526130b381856126a5565b98975050505050505050565b8181038181111561035657610356612f52565b600080858511156130e257600080fd5b838611156130ef57600080fd5b5050820193919092039150565b8183823760009101908152919050565b600082601f83011261311d57600080fd5b8151602061312d6124df8361252f565b82815260059290921b8401810191818101908684111561314c57600080fd5b8286015b848110156125e857805167ffffffffffffffff8111156131705760008081fd5b61317e8986838b0101612c26565b845250918301918301613150565b60006020828403121561319e57600080fd5b815167ffffffffffffffff808211156131b657600080fd5b90830190606082860312156131ca57600080fd5b6040516060810181811083821117156131e5576131e5612439565b60405282516131f381612ba4565b815260208301518281111561320757600080fd5b6132138782860161310c565b60208301525060408301518281111561322b57600080fd5b61323787828601612c26565b60408301525095945050505050565b6001600160a01b038151168252600060208201516060602085015261326e6060850182613001565b905060408301518482036040860152612f4982826126a5565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156132dc57603f198886030184526132ca858351613246565b945092850192908501906001016132ae565b5092979650505050505050565b8515158152600060206001600160a01b03871681840152604060a08185015261331560a0850188613001565b848103606086015261332781886126a5565b905084810360808601528086518083528483019150848160051b84010185890160005b8381101561339357858303601f19018552815180516001600160e01b0319168452880151888401889052613380888501826126a5565b958901959350509087019060010161334a565b50909d9c50505050505050505050505050565b6001600160a01b038616815260a0602082015260006133c860a0830187613001565b828103604084015261308f81876126a5565b6000826133f757634e487b7160e01b600052601260045260246000fd5b500690565b600080600080600060a0868803121561341457600080fd5b855161341f81612ba4565b602087015190955067ffffffffffffffff8082111561343d57600080fd5b61344989838a0161310c565b9550604088015191508082111561345f57600080fd5b61346b89838a01612c26565b94506060880151915061347d826123bd565b60808801519193508082111561349257600080fd5b5061349f88828901612c26565b9150509295509295909350565b6020815260006122116020830184613246565b600083516134d1818460208801612681565b8351908301906134e5818360208801612681565b01949350505050565b60006020828403121561350057600080fd5b815161221181612cda565b601f82111561355557600081815260208120601f850160051c810160208610156135325750805b601f850160051c820191505b818110156135515782815560010161353e565b5050505b505050565b815167ffffffffffffffff81111561357457613574612439565b613588816135828454612bd6565b8461350b565b602080601f8311600181146135bd57600084156135a55750858301515b600019600386901b1c1916600185901b178555613551565b600085815260208120601f198616915b828110156135ec578886015182559484019460019091019084016135cd565b508582101561360a5787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fea2646970667358221220e80dfb43e469138d4ae0942cde3bd29b693f1811b97ac87db578fe698aaae86764736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101365760003560e01c80638e5ea8df116100b2578063b241d0d311610081578063e0a8541211610066578063e0a85412146102ec578063ec11c823146102ff578063f2fde38b1461031257600080fd5b8063b241d0d3146102c6578063b4a85801146102d957600080fd5b80638e5ea8df146102485780639061b9231461025b578063a1cbcbaf1461026e578063a6b16419146102a657600080fd5b8063715018a6116101095780637b103999116100ee5780637b103999146101e55780638da5cb5b146102245780638e25a0f31461023557600080fd5b8063715018a6146101c857806376286c00146101d257600080fd5b806301ffc9a71461013b5780630667cfea14610163578063206c74c9146101845780636dc4fb73146101a5575b600080fd5b61014e6101493660046123d3565b610325565b60405190151581526020015b60405180910390f35b6101766101713660046125f3565b61035c565b60405161015a9291906126d1565b61019761019236600461277c565b610392565b60405161015a9291906127e5565b6101b86101b336600461286e565b61047f565b60405161015a94939291906128da565b6101d0610547565b005b6101976101e0366004612916565b61055b565b61020c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161015a565b6000546001600160a01b031661020c565b610176610243366004612975565b610583565b6101d0610256366004612a3b565b610626565b610176610269366004612a78565b610645565b61028161027c366004612ad7565b61073e565b604080516001600160a01b03909416845260208401929092529082015260600161015a565b6102b96102b4366004612b19565b610764565b60405161015a9190612b32565b6101b86102d4366004612b45565b610810565b6101976102e736600461286e565b610902565b6101766102fa36600461286e565b610946565b6101b861030d366004612ad7565b6109b8565b6101d0610320366004612bb9565b610aab565b60006001600160e01b03198216639061b92360e01b148061035657506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060006103848686868663e0a8541260e01b60405180602001604052806000815250610583565b915091505b94509492505050565b606060006104738585856001805480602002602001604051908101604052809291908181526020016000905b8282101561046a5783829060005260206000200180546103dd90612bd6565b80601f016020809104026020016040519081016040528092919081815260200182805461040990612bd6565b80156104565780601f1061042b57610100808354040283529160200191610456565b820191906000526020600020905b81548152906001019060200180831161043957829003601f168201915b5050505050815260200190600101906103be565b5050505061055b565b91509150935093915050565b6060600080808080808061049d8c8c8c8c636dc4fb7360e01b610b40565b93509350935093506000846000815181106104ba576104ba612c10565b602002602001015190506104cd81610ec6565b81511561051f57600080838060200190518101906104eb9190612c6b565b91509150600083602001518060200190518101906105099190612cbd565b929b50919950975093955061053c945050505050565b61052e81602001518585610f51565b985098509850985050505050505b945094509450949050565b61054f6110b2565b610559600061110c565b565b606060006103848686868663b4a8580160e01b60405180602001604052806000815250611174565b6040805160018082528183019092526060916000918291816020015b606081526020019060019003908161059f57905050905086816000815181106105ca576105ca612c10565b60200260200101819052506000806105e68b8b858b8b8b611174565b915091506000826000815181106105ff576105ff612c10565b6020026020010151905061061281610ec6565b602001519b909a5098505050505050505050565b61062e6110b2565b8051610641906001906020840190612300565b5050565b606060006104738585856001805480602002602001604051908101604052809291908181526020016000905b8282101561071d57838290600052602060002001805461069090612bd6565b80601f01602080910402602001604051908101604052809291908181526020018280546106bc90612bd6565b80156107095780601f106106de57610100808354040283529160200191610709565b820191906000526020600020905b8154815290600101906020018083116106ec57829003601f168201915b505050505081526020019060010190610671565b5050505063e0a8541260e01b60405180602001604052806000815250610583565b600080600080600080610753888860006112f5565b919750955093505050509250925092565b6001818154811061077457600080fd5b90600052602060002001600091509050805461078f90612bd6565b80601f01602080910402602001604051908101604052809291908181526020018280546107bb90612bd6565b80156108085780601f106107dd57610100808354040283529160200191610808565b820191906000526020600020905b8154815290600101906020018083116107eb57829003601f168201915b505050505081565b606060008060008061085c600089898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506115a39050565b60405160240161086e91815260200190565b60408051601f19818403018152918152602080830180516001600160e01b03167f691f3431000000000000000000000000000000000000000000000000000000001790528151908101909152600080825291925081906108de908b908b9086908c90636dc4fb7360e01b90610583565b915091506108ed82828a610f51565b96509650965096505050505b93509350935093565b606060008080610935888888887fb4a8580100000000000000000000000000000000000000000000000000000000610b40565b50919a909950975050505050505050565b606060008080610979888888887fe0a8541200000000000000000000000000000000000000000000000000000000610b40565b50509150915060008260008151811061099457610994612c10565b602002602001015190506109a781610ec6565b602001519890975095505050505050565b60606000806000610a9b86866001805480602002602001604051908101604052809291908181526020016000905b82821015610a92578382906000526020600020018054610a0590612bd6565b80601f0160208091040260200160405190810160405280929190818152602001828054610a3190612bd6565b8015610a7e5780601f10610a5357610100808354040283529160200191610a7e565b820191906000526020600020905b815481529060010190602001808311610a6157829003601f168201915b5050505050815260200190600101906109e6565b50505050610810565b9299919850965090945092505050565b610ab36110b2565b6001600160a01b038116610b345760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610b3d8161110c565b50565b60606000606080610ba460405180610100016040528060608152602001606081526020016060815260200160006001600160e01b031916815260200160001515815260200160006001600160a01b0316815260200160608152602001606081525090565b6001600160e01b031986166060820152600080610bc38b8d018d612ce8565b90925090506060610bd68a8c018c612da0565b60c089019190915260408801919091526001600160a01b0390911660a08701529015156080860152805183519192501015610c1057600080fd5b805167ffffffffffffffff811115610c2a57610c2a612439565b604051908082528060200260200182016040528015610c5d57816020015b6060815260200190600190039081610c485790505b506020850152805167ffffffffffffffff811115610c7d57610c7d612439565b604051908082528060200260200182016040528015610ca6578160200160208202803683370190505b5060e08501526000805b8251811015610e94578251600090849083908110610cd057610cd0612c10565b6020026020010151600001516001600160e01b03191603610d2f57828181518110610cfd57610cfd612c10565b60200260200101516020015186602001518281518110610d1f57610d1f612c10565b6020026020010181905250610e82565b848281518110610d4157610d41612c10565b602002602001015115610db85760018660e001518281518110610d6657610d66612c10565b602002602001019015159081151581525050838281518110610d8a57610d8a612c10565b602002602001015186602001518281518110610da857610da8612c10565b6020026020010181905250610e74565b828181518110610dca57610dca612c10565b602002602001015160000151848381518110610de857610de8612c10565b6020026020010151848381518110610e0257610e02612c10565b602002602001015160200151604051602401610e1f929190612f24565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b03838183161783525050505086602001518281518110610e6857610e68612c10565b60200260200101819052505b610e7f826001612f68565b91505b80610e8c81612f7b565b915050610cb0565b50610e9e85611662565b8560a0015186604001518760c001519850985098509850505050505095509550955095915050565b8051610b3d5760208101517fca7a4e750000000000000000000000000000000000000000000000000000000090610efc90612f94565b6001600160e01b03191603610f1957602080820151805190918201fd5b80602001516040517f95c0c752000000000000000000000000000000000000000000000000000000008152600401610b2b9190612b32565b606060008060008087806020019051810190610f6d9190612fcc565b9050600080610f7b83611a50565b91509150600081604051602401610f9491815260200190565b60408051601f19818403018152918152602080830180516001600160e01b03167f3b3b57de000000000000000000000000000000000000000000000000000000001790529051919250600091610fee9187918e91016126d1565b6040516020818303038152906040529050600080306001600160a01b0316638e25a0f387868f636dc4fb7360e01b886040518663ffffffff1660e01b815260040161103d959493929190613056565b600060405180830381865afa15801561105a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110829190810190612c6b565b9150915060008280602001905181019061109c9190612cbd565b979f979e50909b50959950505050505050505050565b6000546001600160a01b031633146105595760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b2b565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606060008060006111858a8a61073e565b919450849350909150506001600160a01b0382166111cf576040517f7199966d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0383163b611210576040517f4981ac0500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516101206020601f8d01819004028201810190925261010081018b8152831515926112e5929182918f908f9081908501838280828437600092019190915250505090825250602081018c9052604081018b90526001600160e01b03198a16606082015283151560808201526001600160a01b03871660a082015260c081018990528b5160e09091019067ffffffffffffffff8111156112b4576112b4612439565b6040519080825280602002602001820160405280156112dd578160200160208202803683370190505b509052611662565b9450505050965096945050505050565b60008060008086868681811061130d5761130d612c10565b919091013560f81c915050600081900361133157506000925082915083905061159a565b600061133d8287612f68565b611348906001612f68565b9050600082604214801561138e57508888611364896001612f68565b81811061137357611373612c10565b9050013560f81c60f81b6001600160f81b031916605b60f81b145b80156113cc575088886113a26001856130bf565b8181106113b1576113b1612c10565b9050013560f81c60f81b6001600160f81b031916605d60f81b145b156114445761143c600060408b8b6113e58c6002612f68565b906113f16001896130bf565b926113fe939291906130d2565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929493925050611c799050565b509050611476565b8888611451896001612f68565b61145d928592906130d2565b60405161146b9291906130fc565b604051809103902090505b60008060006114868c8c876112f5565b925092509250600082856040516020016114aa929190918252602082015260400190565b60408051601f198184030181529082905280516020909101207f0178b8bf0000000000000000000000000000000000000000000000000000000082526004820181905291506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630178b8bf90602401602060405180830381865afa158015611543573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115679190612cbd565b90506001600160a01b0381161561158b579950975089965061159a95505050505050565b50929850919650909450505050505b93509350939050565b60008060006115b28585611dcd565b90925090508161162457600185516115ca91906130bf565b84146116185760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d650000006044820152606401610b2b565b50600091506103569050565b61162e85826115a3565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b6020810151516060906000808267ffffffffffffffff81111561168757611687612439565b6040519080825280602002602001820160405280156116e557816020015b6116d2604051806060016040528060006001600160a01b0316815260200160608152602001606081525090565b8152602001906001900390816116a55790505b50905060008367ffffffffffffffff81111561170357611703612439565b60405190808252806020026020018201604052801561174957816020015b6040805180820190915260008152606060208201528152602001906001900390816117215790505b5090508367ffffffffffffffff81111561176557611765612439565b6040519080825280602002602001820160405280156117ab57816020015b6040805180820190915260008152606060208201528152602001906001900390816117835790505b50945060006117b987611e84565b905060005b8581101561198f576000886020015182815181106117de576117de612c10565b6020026020010151905060008960e00151838151811061180057611800612c10565b60200260200101519050801561184c5760405180604001604052806000151581526020018381525089848151811061183a5761183a612c10565b6020026020010181905250505061197d565b60006118628b60000151848d60a0015188611f1b565b809450819250505060008060008061187f8f60a001518887611fa3565b935093509350935083156118f557828060200190518101906118a1919061318c565b8b8d815181106118b3576118b3612c10565b6020026020010181905250818a89815181106118d1576118d1612c10565b60209081029190910101526118e760018d612f68565b9b505050505050505061197d565b808015611903575088602001515b1561191f578280602001905181019061191c9190612fcc565b92505b60405180604001604052808215158152602001848152508e898151811061194857611948612c10565b6020026020010181905250868a898151811061196657611966612c10565b602002602001015160200181905250505050505050505b8061198781612f7b565b9150506117be565b50836000036119a2575050505050919050565b83835230876040015163a780bab660e01b856040516024016119c49190613287565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b03838183161783525050505089606001518a608001518b60a001518c604001518d60c0015189604051602001611a259594939291906132e9565b60408051601f1981840301815290829052630556f18360e41b8252610b2b95949392916004016133a6565b805160609060009081908490611a67816002612f68565b67ffffffffffffffff811115611a7f57611a7f612439565b6040519080825280601f01601f191660200182016040528015611aa9576020820181803683370190505b50945060009350808403611aee57600060f81b85600081518110611acf57611acf612c10565b60200101906001600160f81b031916908160001a905350505050915091565b60001981015b828181518110611b0657611b06612c10565b01602001517fff00000000000000000000000000000000000000000000000000000000000000167f2e0000000000000000000000000000000000000000000000000000000000000003611bc8578360f81b868260010181518110611b6c57611b6c612c10565b60200101906001600160f81b031916908160001a90535084611b95846001840160ff881661215b565b60408051602081019390935282015260600160405160208183030381529060405280519060200120945060009350611c18565b600184019350828181518110611be057611be0612c10565b602001015160f81c60f81b868260010181518110611c0057611c00612c10565b60200101906001600160f81b031916908160001a9053505b8015611c275760001901611af4565b5083611c3883600060ff871661215b565b6040805160208101939093528201526060016040516020818303038152906040528051906020012093508260f81b85600081518110611acf57611acf612c10565b60008080611c8785856130bf565b905080604014158015611c9b575080602814155b80611cb05750611cac6002826133da565b6001145b15611cfd5760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420737472696e67206c656e67746800000000000000000000006044820152606401610b2b565b600191508551841115611d0f57600080fd5b611d60565b6000603a8210602f83111615611d2c5750602f190190565b60478210604083111615611d4257506036190190565b60678210606083111615611d5857506056190190565b5060ff919050565b60208601855b85811015611dc257611d7d8183015160001a611d14565b611d8f6001830184015160001a611d14565b60ff811460ff83141715611da857600095505050611dc2565b60049190911b1760089590951b9490941793600201611d66565b505050935093915050565b60008083518310611e205760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e647300006044820152606401610b2b565b6000848481518110611e3457611e34612c10565b016020015160f81c90508015611e6057611e5985611e53866001612f68565b8361215b565b9250611e65565b600092505b611e6f8185612f68565b611e7a906001612f68565b9150509250929050565b604080518082019091526000808252602082015281515160a0830151901590600090611eb790639061b92360e01b61217f565b905083608001518015611ec8575080155b15611eff576040517f82c2c72800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805180820190915291151582521515602082015292915050565b600060608260000151611f9757826020015115611f7b5760018686604051602401611f47929190612f24565b60408051601f198184030181529190526020810180516001600160e01b0316639061b92360e01b1790529092509050610389565b611f8d84611f8887612f94565b61217f565b8591509150610389565b50600195939450505050565b604080518082019091526000808252606060208301819052909160008415611fd657611fcf8787612204565b9050611fe6565b611fe3878761c350612218565b90505b3d811561200a576000611ffa6000836122ab565b9095509350600191506108f99050565b60048110612151576000612020600060046122ab565b90506000612038600461203381866130bf565b6122ab565b9050630556f18360e41b61204b83612f94565b6001600160e01b031916036121195760008060008060008580602001905181019061207691906133fc565b945094509450945094508e6001600160a01b0316856001600160a01b03160361210f576040518060600160405280866001600160a01b03168152602001858152602001848152506040516020016120cd91906134ac565b60408051601f198184030181528282019091526001600160e01b03199093168152602081019190915260019b509099509750600096506108f995505050505050565b505050505061214e565b818160405160200161212c9291906134bf565b60408051601f198184030181529190526000975095508693506108f992505050565b50505b5093509350935093565b825160009061216a8385612f68565b111561217557600080fd5b5091016020012090565b6040516301ffc9a760e01b81526001600160e01b0319821660048201526000906001600160a01b038416906301ffc9a79061c350906024016020604051808303818786fa935050505080156121f1575060408051601f3d908101601f191682019092526121ee918101906134ee565b60015b6121fd57506000610356565b9050610356565b600061221183835a612218565b9392505050565b60006001600160a01b0384163b6122975760405162461bcd60e51b815260206004820152602e60248201527f4c6f774c6576656c43616c6c5574696c733a207374617469632063616c6c207460448201527f6f206e6f6e2d636f6e74726163740000000000000000000000000000000000006064820152608401610b2b565b6000808451602086018786fa949350505050565b60608167ffffffffffffffff8111156122c6576122c6612439565b6040519080825280601f01601f1916602001820160405280156122f0576020820181803683370190505b5090508183602083013e92915050565b828054828255906000526020600020908101928215612346579160200282015b828111156123465782518290612336908261355a565b5091602001919060010190612320565b50612352929150612356565b5090565b8082111561235257600061236a8282612373565b50600101612356565b50805461237f90612bd6565b6000825580601f1061238f575050565b601f016020900490600052602060002090810190610b3d91905b8082111561235257600081556001016123a9565b6001600160e01b031981168114610b3d57600080fd5b6000602082840312156123e557600080fd5b8135612211816123bd565b60008083601f84011261240257600080fd5b50813567ffffffffffffffff81111561241a57600080fd5b60208301915083602082850101111561243257600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561247257612472612439565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156124a1576124a1612439565b604052919050565b600067ffffffffffffffff8211156124c3576124c3612439565b50601f01601f191660200190565b60006124e46124df846124a9565b612478565b90508281528383830111156124f857600080fd5b828260208301376000602084830101529392505050565b600082601f83011261252057600080fd5b612211838335602085016124d1565b600067ffffffffffffffff82111561254957612549612439565b5060051b60200190565b600082601f83011261256457600080fd5b813560206125746124df8361252f565b82815260059290921b8401810191818101908684111561259357600080fd5b8286015b848110156125e857803567ffffffffffffffff8111156125b75760008081fd5b8701603f810189136125c95760008081fd5b6125da8986830135604084016124d1565b845250918301918301612597565b509695505050505050565b6000806000806060858703121561260957600080fd5b843567ffffffffffffffff8082111561262157600080fd5b61262d888389016123f0565b9096509450602087013591508082111561264657600080fd5b6126528883890161250f565b9350604087013591508082111561266857600080fd5b5061267587828801612553565b91505092959194509250565b60005b8381101561269c578181015183820152602001612684565b50506000910152565b600081518084526126bd816020860160208601612681565b601f01601f19169290920160200192915050565b6040815260006126e460408301856126a5565b90506001600160a01b03831660208301529392505050565b600082601f83011261270d57600080fd5b8135602061271d6124df8361252f565b82815260059290921b8401810191818101908684111561273c57600080fd5b8286015b848110156125e857803567ffffffffffffffff8111156127605760008081fd5b61276e8986838b010161250f565b845250918301918301612740565b60008060006040848603121561279157600080fd5b833567ffffffffffffffff808211156127a957600080fd5b6127b5878388016123f0565b909550935060208601359150808211156127ce57600080fd5b506127db868287016126fc565b9150509250925092565b6000604080830181845280865180835260608601915060608160051b8701019250602080890160005b8381101561284f57888603605f19018552815180511515875283015183870188905261283c888801826126a5565b965050938201939082019060010161280e565b50508395506001600160a01b0388168188015250505050509392505050565b6000806000806040858703121561288457600080fd5b843567ffffffffffffffff8082111561289c57600080fd5b6128a8888389016123f0565b909650945060208701359150808211156128c157600080fd5b506128ce878288016123f0565b95989497509550505050565b6080815260006128ed60808301876126a5565b6001600160a01b0395861660208401529385166040830152509216606090920191909152919050565b6000806000806060858703121561292c57600080fd5b843567ffffffffffffffff8082111561294457600080fd5b612950888389016123f0565b9096509450602087013591508082111561296957600080fd5b612652888389016126fc565b60008060008060008060a0878903121561298e57600080fd5b863567ffffffffffffffff808211156129a657600080fd5b6129b28a838b016123f0565b909850965060208901359150808211156129cb57600080fd5b6129d78a838b0161250f565b955060408901359150808211156129ed57600080fd5b6129f98a838b01612553565b945060608901359150612a0b826123bd565b90925060808801359080821115612a2157600080fd5b50612a2e89828a0161250f565b9150509295509295509295565b600060208284031215612a4d57600080fd5b813567ffffffffffffffff811115612a6457600080fd5b612a7084828501612553565b949350505050565b600080600060408486031215612a8d57600080fd5b833567ffffffffffffffff80821115612aa557600080fd5b612ab1878388016123f0565b90955093506020860135915080821115612aca57600080fd5b506127db8682870161250f565b60008060208385031215612aea57600080fd5b823567ffffffffffffffff811115612b0157600080fd5b612b0d858286016123f0565b90969095509350505050565b600060208284031215612b2b57600080fd5b5035919050565b60208152600061221160208301846126a5565b600080600060408486031215612b5a57600080fd5b833567ffffffffffffffff80821115612b7257600080fd5b612b7e878388016123f0565b90955093506020860135915080821115612b9757600080fd5b506127db86828701612553565b6001600160a01b0381168114610b3d57600080fd5b600060208284031215612bcb57600080fd5b813561221181612ba4565b600181811c90821680612bea57607f821691505b602082108103612c0a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b600082601f830112612c3757600080fd5b8151612c456124df826124a9565b818152846020838601011115612c5a57600080fd5b612a70826020830160208701612681565b60008060408385031215612c7e57600080fd5b825167ffffffffffffffff811115612c9557600080fd5b612ca185828601612c26565b9250506020830151612cb281612ba4565b809150509250929050565b600060208284031215612ccf57600080fd5b815161221181612ba4565b8015158114610b3d57600080fd5b60008060408385031215612cfb57600080fd5b823567ffffffffffffffff80821115612d1357600080fd5b818501915085601f830112612d2757600080fd5b81356020612d376124df8361252f565b82815260059290921b84018101918181019089841115612d5657600080fd5b948201945b83861015612d7d578535612d6e81612cda565b82529482019490820190612d5b565b96505086013592505080821115612d9357600080fd5b50611e7a858286016126fc565b600080600080600060a08688031215612db857600080fd5b612dc28635612cda565b85359450612dd36020870135612ba4565b6020860135935067ffffffffffffffff8060408801351115612df457600080fd5b612e048860408901358901612553565b93508060608801351115612e1757600080fd5b612e27886060890135890161250f565b92508060808801351115612e3a57600080fd5b6080870135870188601f820112612e5057600080fd5b612e5d6124df823561252f565b81358082526020808301929160051b8401018b1015612e7b57600080fd5b602083015b6020843560051b850101811015612f12578481351115612e9f57600080fd5b803584016040818e03601f19011215612eb757600080fd5b612ebf61244f565b612ecc60208301356123bd565b602082013581528660408301351115612ee457600080fd5b612ef78e6020604085013585010161250f565b60208201528085525050602083019250602081019050612e80565b50809450505050509295509295909350565b604081526000612f3760408301856126a5565b8281036020840152612f4981856126a5565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561035657610356612f52565b600060018201612f8d57612f8d612f52565b5060010190565b6000815160208301516001600160e01b031980821693506004831015612fc45780818460040360031b1b83161693505b505050919050565b600060208284031215612fde57600080fd5b815167ffffffffffffffff811115612ff557600080fd5b612a7084828501612c26565b600081518084526020808501808196508360051b8101915082860160005b858110156130495782840389526130378483516126a5565b9885019893509084019060010161301f565b5091979650505050505050565b60a08152600061306960a08301886126a5565b828103602084015261307b81886126a5565b9050828103604084015261308f8187613001565b90506001600160e01b03198516606084015282810360808401526130b381856126a5565b98975050505050505050565b8181038181111561035657610356612f52565b600080858511156130e257600080fd5b838611156130ef57600080fd5b5050820193919092039150565b8183823760009101908152919050565b600082601f83011261311d57600080fd5b8151602061312d6124df8361252f565b82815260059290921b8401810191818101908684111561314c57600080fd5b8286015b848110156125e857805167ffffffffffffffff8111156131705760008081fd5b61317e8986838b0101612c26565b845250918301918301613150565b60006020828403121561319e57600080fd5b815167ffffffffffffffff808211156131b657600080fd5b90830190606082860312156131ca57600080fd5b6040516060810181811083821117156131e5576131e5612439565b60405282516131f381612ba4565b815260208301518281111561320757600080fd5b6132138782860161310c565b60208301525060408301518281111561322b57600080fd5b61323787828601612c26565b60408301525095945050505050565b6001600160a01b038151168252600060208201516060602085015261326e6060850182613001565b905060408301518482036040860152612f4982826126a5565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156132dc57603f198886030184526132ca858351613246565b945092850192908501906001016132ae565b5092979650505050505050565b8515158152600060206001600160a01b03871681840152604060a08185015261331560a0850188613001565b848103606086015261332781886126a5565b905084810360808601528086518083528483019150848160051b84010185890160005b8381101561339357858303601f19018552815180516001600160e01b0319168452880151888401889052613380888501826126a5565b958901959350509087019060010161334a565b50909d9c50505050505050505050505050565b6001600160a01b038616815260a0602082015260006133c860a0830187613001565b828103604084015261308f81876126a5565b6000826133f757634e487b7160e01b600052601260045260246000fd5b500690565b600080600080600060a0868803121561341457600080fd5b855161341f81612ba4565b602087015190955067ffffffffffffffff8082111561343d57600080fd5b61344989838a0161310c565b9550604088015191508082111561345f57600080fd5b61346b89838a01612c26565b94506060880151915061347d826123bd565b60808801519193508082111561349257600080fd5b5061349f88828901612c26565b9150509295509295909350565b6020815260006122116020830184613246565b600083516134d1818460208801612681565b8351908301906134e5818360208801612681565b01949350505050565b60006020828403121561350057600080fd5b815161221181612cda565b601f82111561355557600081815260208120601f850160051c810160208610156135325750805b601f850160051c820191505b818110156135515782815560010161353e565b5050505b505050565b815167ffffffffffffffff81111561357457613574612439565b613588816135828454612bd6565b8461350b565b602080601f8311600181146135bd57600084156135a55750858301515b600019600386901b1c1916600185901b178555613551565b600085815260208120601f198616915b828110156135ec578886015182559484019460019091019084016135cd565b508582101561360a5787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fea2646970667358221220e80dfb43e469138d4ae0942cde3bd29b693f1811b97ac87db578fe698aaae86764736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "findResolver(bytes)": { + "details": "Finds a resolver by recursively querying the registry, starting at the longest name and progressively removing labels until it finds a result.", + "params": { + "name": "The name to resolve, in DNS-encoded and normalised form." + }, + "returns": { + "_0": "resolver The Resolver responsible for this name.", + "_1": "namehash The namehash of the full name.", + "_2": "finalOffset The offset of the first label with a resolver." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, + "resolve(bytes,bytes)": { + "details": "Performs ENS name resolution for the supplied name and resolution data.", + "params": { + "data": "The resolution data, as specified in ENSIP-10.", + "name": "The name to resolve, in normalised and DNS-encoded form." + }, + "returns": { + "_0": "The result of resolving the name." + } + }, + "reverse(bytes,string[])": { + "details": "Performs ENS name reverse resolution for the supplied reverse name.", + "params": { + "reverseName": "The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse" + }, + "returns": { + "_0": "The resolved name, the resolved address, the reverse resolver address, and the resolver address." + } + }, + "supportsInterface(bytes4)": { + "details": "See {IERC165-supportsInterface}." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "notice": "The Universal Resolver is a contract that handles the work of resolving a name entirely onchain, making it possible to make a single smart contract call to resolve an ENS name.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 7, + "contract": "contracts/utils/UniversalResolver.sol:UniversalResolver", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 1537, + "contract": "contracts/utils/UniversalResolver.sol:UniversalResolver", + "label": "batchGatewayURLs", + "offset": 0, + "slot": "1", + "type": "t_array(t_string_storage)dyn_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_string_storage)dyn_storage": { + "base": "t_string_storage", + "encoding": "dynamic_array", + "label": "string[]", + "numberOfBytes": "32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/solcInputs/06d6118bf6ec6ea4985b6b7b8d101933.json b/solidity/dns-contracts/deployments/sepolia/solcInputs/06d6118bf6ec6ea4985b6b7b8d101933.json new file mode 100644 index 0000000..af9d6e8 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/solcInputs/06d6118bf6ec6ea4985b6b7b8d101933.json @@ -0,0 +1,443 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (iter.name().compareNames(buf.buf) != 0) continue;\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(\n uint16 _expectedType,\n bytes memory _expectedName,\n uint32 _inception,\n uint64 _inserted,\n bytes memory _proof\n ) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if (_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(\n uint16 dnstype,\n bytes memory name\n ) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyExtendedDNSSECResolver is IExtendedDNSResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes memory /* name */,\n bytes memory /* data */,\n bytes memory context\n ) external view override returns (bytes memory) {\n return abi.encode(context);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyLegacyTextResolver is ITextResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(ITextResolver).interfaceId;\n }\n\n function text(\n bytes32 /* node */,\n string calldata key\n ) external view override returns (string memory) {\n return key;\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyNonCCIPAwareResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../OffchainDNSResolver.sol\";\nimport \"../../resolvers/profiles/IExtendedResolver.sol\";\n\ncontract DummyNonCCIPAwareResolver is IExtendedResolver, ERC165 {\n OffchainDNSResolver dnsResolver;\n\n constructor(OffchainDNSResolver _dnsResolver) {\n dnsResolver = _dnsResolver;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(dnsResolver),\n urls,\n data,\n OffchainDNSResolver.resolveCallback.selector,\n data\n );\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyParser.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../dnssec-oracle/BytesUtils.sol\";\nimport \"../RecordParser.sol\";\n\ncontract DummyParser {\n using BytesUtils for bytes;\n\n // parse data in format: name;key1=value1 key2=value2;url\n function parseData(\n bytes memory data,\n uint256 kvCount\n )\n external\n pure\n returns (\n string memory name,\n string[] memory keys,\n string[] memory values,\n string memory url\n )\n {\n uint256 len = data.length;\n // retrieve name\n uint256 sep1 = data.find(0, len, \";\");\n name = string(data.substring(0, sep1));\n\n // retrieve url\n uint256 sep2 = data.find(sep1 + 1, len - sep1, \";\");\n url = string(data.substring(sep2 + 1, len - sep2 - 1));\n\n keys = new string[](kvCount);\n values = new string[](kvCount);\n // retrieve keys and values\n uint256 offset = sep1 + 1;\n for (uint256 i; i < kvCount && offset < len; i++) {\n (\n bytes memory key,\n bytes memory val,\n uint256 nextOffset\n ) = RecordParser.readKeyValue(data, offset, sep2 - offset);\n keys[i] = string(key);\n values[i] = string(val);\n offset = nextOffset;\n }\n }\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"../utils/LowLevelCallUtils.sol\";\n\nerror InvalidOperation();\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver, IERC165 {\n using RRUtils for *;\n using Address for address;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedResolver).interfaceId;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n return\n callWithOffchainLookupPropagation(\n msg.sender,\n name,\n data,\n abi.encodeCall(IExtendedResolver.resolve, (name, data))\n );\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query) = abi.decode(\n extraData,\n (bytes, bytes)\n );\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n callWithOffchainLookupPropagation(\n dnsresolver,\n name,\n query,\n abi.encodeCall(\n IExtendedDNSResolver.resolve,\n (name, query, context)\n )\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return\n callWithOffchainLookupPropagation(\n dnsresolver,\n name,\n query,\n abi.encodeCall(\n IExtendedResolver.resolve,\n (name, query)\n )\n );\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory name,\n bytes memory innerdata,\n bytes memory data\n ) internal view returns (bytes memory) {\n if (target.isContract()) {\n bool result = LowLevelCallUtils.functionStaticCall(\n address(target),\n data\n );\n uint256 size = LowLevelCallUtils.returnDataSize();\n if (result) {\n bytes memory returnData = LowLevelCallUtils.readReturnData(\n 0,\n size\n );\n return abi.decode(returnData, (bytes));\n }\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n if (bytes4(errorId) == OffchainLookup.selector) {\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n (\n address sender,\n string[] memory urls,\n bytes memory callData,\n bytes4 innerCallbackFunction,\n bytes memory extraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n\n if (sender != target) {\n revert InvalidOperation();\n }\n\n revert OffchainLookup(\n address(this),\n urls,\n callData,\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(sender, innerCallbackFunction, extraData)\n );\n }\n }\n LowLevelCallUtils.propagateRevert();\n } else {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, innerdata)\n );\n }\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (bytes memory key, bytes memory value, uint256 nextOffset)\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = len + offset;\n nextOffset = terminator;\n } else {\n nextOffset = terminator + 1;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256[3] memory P) {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (uint256 x, uint256 y, uint256 z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(\n uint256 x0,\n uint256 y0\n ) internal pure returns (bool isZero) {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(\n uint256 scalar\n ) internal pure returns (uint256, uint256) {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(\n bytes calldata,\n bytes calldata\n ) external pure override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input\n )\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n )\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(\n RRUtils.SignedSet memory rrset,\n uint16 typecovered\n ) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if (address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns (bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 {\n totallen := add(totallen, 64)\n }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for {\n let i := 0\n } lt(i, totallen) {\n i := add(i, 64)\n } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 {\n mstore8(add(scratch, sub(len, i)), 0x80)\n }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 {\n mstore(\n add(scratch, 32),\n or(mload(add(scratch, 32)), mul(len, 8))\n )\n }\n\n // Expand the 16 32-bit words into 80\n for {\n let j := 64\n } lt(j, 128) {\n j := add(j, 12)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 12))),\n mload(add(scratch, sub(j, 32)))\n ),\n xor(\n mload(add(scratch, sub(j, 56))),\n mload(add(scratch, sub(j, 64)))\n )\n )\n temp := or(\n and(\n mul(temp, 2),\n 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE\n ),\n and(\n div(temp, 0x80000000),\n 0x0000000100000001000000010000000100000001000000010000000100000001\n )\n )\n mstore(add(scratch, j), temp)\n }\n for {\n let j := 128\n } lt(j, 320) {\n j := add(j, 24)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 24))),\n mload(add(scratch, sub(j, 64)))\n ),\n xor(\n mload(add(scratch, sub(j, 112))),\n mload(add(scratch, sub(j, 128)))\n )\n )\n temp := or(\n and(\n mul(temp, 4),\n 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC\n ),\n and(\n div(temp, 0x40000000),\n 0x0000000300000003000000030000000300000003000000030000000300000003\n )\n )\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for {\n let j := 0\n } lt(j, 80) {\n j := add(j, 1)\n } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(\n div(x, 0x100000000000000000000),\n div(x, 0x10000000000)\n )\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := and(div(x, 0x10000000000), f)\n f := or(\n and(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n ),\n f\n )\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(\n div(\n x,\n 0x80000000000000000000000000000000000000000000000\n ),\n 0x1F\n )\n temp := or(\n and(\n div(x, 0x800000000000000000000000000000000000000),\n 0xFFFFFFE0\n ),\n temp\n )\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(\n div(\n mload(add(scratch, mul(j, 4))),\n 0x100000000000000000000000000000000000000000000000000000000\n ),\n temp\n )\n x := or(\n div(x, 0x10000000000),\n mul(temp, 0x10000000000000000000000000000000000000000)\n )\n x := or(\n and(\n x,\n 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF\n ),\n mul(\n or(\n and(div(x, 0x4000000000000), 0xC0000000),\n and(div(x, 0x400000000000000000000), 0x3FFFFFFF)\n ),\n 0x100000000000000000000\n )\n )\n }\n\n h := and(\n add(h, x),\n 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF\n )\n }\n ret := mul(\n or(\n or(\n or(\n or(\n and(\n div(h, 0x100000000),\n 0xFFFFFFFF00000000000000000000000000000000\n ),\n and(\n div(h, 0x1000000),\n 0xFFFFFFFF000000000000000000000000\n )\n ),\n and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)\n ),\n and(div(h, 0x100), 0xFFFFFFFF00000000)\n ),\n and(h, 0xFFFFFFFF)\n ),\n 0x1000000000000000000000000\n )\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/ILinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface ILinearPremiumPriceOracle {\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256);\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns (address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping(bytes32 => address) addresses;\n\n constructor() public {}\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Implements a dummy NameWrapper which returns the caller's address\n */\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"../../resolvers/profiles/IAddressResolver.sol\";\nimport \"../../resolvers/profiles/IAddrResolver.sol\";\nimport \"../../utils/HexUtils.sol\";\n\ncontract ExtendedDNSResolver is IExtendedDNSResolver, IERC165 {\n using HexUtils for *;\n\n uint256 private constant COIN_TYPE_ETH = 60;\n\n error NotImplemented();\n error InvalidAddressFormat();\n\n function supportsInterface(\n bytes4 interfaceId\n ) external view virtual override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data,\n bytes calldata context\n ) external pure override returns (bytes memory) {\n bytes4 selector = bytes4(data);\n if (\n selector == IAddrResolver.addr.selector ||\n selector == IAddressResolver.addr.selector\n ) {\n if (selector == IAddressResolver.addr.selector) {\n (, uint256 coinType) = abi.decode(data[4:], (bytes32, uint256));\n if (coinType != COIN_TYPE_ETH) return abi.encode(\"\");\n }\n (address record, bool valid) = context.hexToAddress(\n 2,\n context.length\n );\n if (!valid) revert InvalidAddressFormat();\n return abi.encode(record);\n }\n revert NotImplemented();\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ReverseClaimer\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/utils/DummyRevertResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ncontract DummyRevertResolver {\n function resolve(\n bytes calldata,\n bytes calldata\n ) external pure returns (bytes memory) {\n revert(\"Not Supported\");\n }\n\n function supportsInterface(bytes4) external pure returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n uint256 hexLength = lastIdx - idx;\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\n revert(\"Invalid string length\");\n }\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/TestHexUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {HexUtils} from \"./HexUtils.sol\";\n\ncontract TestHexUtils {\n using HexUtils for *;\n\n function hexStringToBytes32(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes32, bool) {\n return name.hexStringToBytes32(idx, lastInx);\n }\n\n function hexToAddress(\n bytes calldata input,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (address, bool) {\n return input.hexToAddress(idx, lastInx);\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(\n string memory name\n ) public pure returns (bytes memory, bytes32) {\n return name.dnsEncodeName();\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (bytes[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes[] memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (bytes[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n result = LowLevelCallUtils.functionStaticCall(address(target), data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _hasExtendedResolver(\n address resolver\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(\n type(IExtendedResolver).interfaceId\n )\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (bytes[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _hasExtendedResolver(multicallData.resolver);\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = item;\n continue;\n }\n if (!isCallback && hasExtendedResolver) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = returnData;\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(\n name,\n wrappedOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable,\n ReverseClaimer\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE and set expiry to max */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the owner of a name\n * @param id Namehash of the name\n * @return operator Approved operator of a name\n */\n\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /**\n * @notice Approves an address for a name\n * @param to address to approve\n * @param tokenId name to approve\n */\n\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or operator of the owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or operator\n */\n\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Checks if owner/operator or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner/operator or approved\n */\n\n function canExtendSubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public returns (uint64 expiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // Set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (!_isWrapped(node)) {\n revert NameIsNotWrapped();\n }\n\n // this flag is used later, when checking fuses\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // Max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n address approved = getApproved(uint256(node));\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(parentNode, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /**\n * @notice Checks if a name is wrapped in a more gas efficient way\n * @param parentNode Namehash of the name\n * @param labelhash Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != ETH_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + }, + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external view override returns (bool) {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32, uint256) {\n return name.readLabel(offset);\n }\n\n function namehash(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32) {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\n \"\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n require(\n \"foo\".keccak(0, 3) ==\n bytes32(\n 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d\n ),\n \"Incorrect hash of 'foo'\"\n );\n require(\n \"foo\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\n \"hello\".equals(1, \"ello\") == true,\n \"Substring to string equality\"\n );\n require(\n \"hello\".equals(1, \"jello\", 1, 4) == true,\n \"Substring to substring equality\"\n );\n require(\n \"zhello\".equals(1, \"abchello\", 3) == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"0x0102030000\".equals(0, \"0x010203\") == false,\n \"Compare with offset and trailing bytes\"\n );\n }\n\n function testComparePartial() public pure {\n require(\n \"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true,\n \"Compare same length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true,\n \"Compare different length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true,\n \"Compare same with different offset\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 33\n ) ==\n 0 ==\n true,\n \"Compare different long strings same length smaller partial length which must be equal\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 34\n ) <\n 0 ==\n true,\n \"Compare long strings same length different partial length\"\n );\n require(\n \"0123456789012345012345678901234a\".compare(\n 0,\n 32,\n \"0123456789012345012345678901234b\",\n 0,\n 32\n ) <\n 0 ==\n true,\n \"Compare strings exactly 32 characters long\"\n );\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\n \"a\".compare(\"b\") < 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"b\".compare(\"a\") > 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"aa\".compare(\"ab\") < 0 == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"a\".compare(\"aa\") < 0 == true,\n \"Compare different value with different length\"\n );\n require(\n \"aa\".compare(\"a\") > 0 == true,\n \"Compare different value with different length\"\n );\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(\n longChar.compare(longChar) == 0 == true,\n \"Compares more than 32 bytes char\"\n );\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(\n longChar.compare(otherLongChar) < 0 == true,\n \"Compare long char with difference at start\"\n );\n }\n\n function testSubstring() public pure {\n require(\n keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")),\n \"Copy 0 bytes\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 4))) ==\n keccak256(bytes(\"hell\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(1, 4))) ==\n keccak256(bytes(\"ello\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 5))) ==\n keccak256(bytes(\"hello\")),\n \"Copy whole string\"\n );\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(\n bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) ==\n bytes32(\n 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000\n ),\n \"readBytes20\"\n );\n }\n\n function testReadBytes32() public pure {\n require(\n \"0123456789abcdef0123456789abcdef\".readBytes32(0) ==\n bytes32(\n 0x3031323334353637383961626364656630313233343536373839616263646566\n ),\n \"readBytes32\"\n );\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\n \"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")),\n \"Decode 'a'\"\n );\n require(\n \"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")),\n \"Decode 'aa'\"\n );\n require(\n \"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")),\n \"Decode 'aaa'\"\n );\n require(\n \"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")),\n \"Decode 'aaaa'\"\n );\n require(\n \"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa'\"\n );\n require(\n \"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa' lowercase\"\n );\n require(\n \"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet\"\n );\n require(\n \"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet lowercase\"\n );\n require(\n \"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\"\n .base32HexDecodeWord(0, 52) ==\n bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"),\n \"Decode 32*'a'\"\n );\n require(\n \" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\"\n .base32HexDecodeWord(1, 32) ==\n bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"),\n \"Decode real bytes32hex\"\n );\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex\"00\".nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex\"00\".labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex\"016100\".labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(\n hex\"016201610000\".labelCount(0) == 2,\n \"labelCount('b.a.') == 2\"\n );\n require(\n hex\"066574686c61620378797a00\".labelCount(6 + 1) == 1,\n \"nameLength('(bthlab).xyz.') == 6\"\n );\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes\n memory rrs = hex\"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101\";\n bytes[2] memory names = [bytes(hex\"016100\"), bytes(hex\"0162016100\")];\n bytes[2] memory rdatas = [bytes(hex\"74000001\"), bytes(hex\"c0a80101\")];\n uint i = 0;\n for (\n RRUtils.RRIterator memory iter = rrs.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(\n keccak256(iter.name()) == keccak256(names[i]),\n \"Name matches\"\n );\n require(\n keccak256(iter.rdata()) == keccak256(rdatas[i]),\n \"Rdata matches\"\n );\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex\"066274686c61620378797a00\";\n bytes memory ethLabXyz = hex\"066574686c61620378797a00\";\n bytes memory xyz = hex\"0378797a00\";\n bytes memory a_b_c = hex\"01610162016300\";\n bytes memory b_b_c = hex\"01620162016300\";\n bytes memory c = hex\"016300\";\n bytes memory d = hex\"016400\";\n bytes memory a_d_c = hex\"01610164016300\";\n bytes memory b_a_c = hex\"01620161016300\";\n bytes memory ab_c_d = hex\"0261620163016400\";\n bytes memory a_c_d = hex\"01610163016400\";\n bytes\n memory verylong1_eth = hex\"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n bytes\n memory verylong2_eth = hex\"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n\n require(\n hex\"0301616100\".compareNames(hex\"0302616200\") < 0,\n \"label lengths are correctly checked\"\n );\n require(\n a_b_c.compareNames(c) > 0,\n \"one name has a difference of >1 label to with the same root name\"\n );\n require(\n a_b_c.compareNames(d) < 0,\n \"one name has a difference of >1 label to with different root name\"\n );\n require(\n a_b_c.compareNames(a_d_c) < 0,\n \"two names start the same but have differences in later labels\"\n );\n require(\n a_b_c.compareNames(b_a_c) > 0,\n \"the first label sorts later, but the first label sorts earlier\"\n );\n require(\n ab_c_d.compareNames(a_c_d) > 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(\n a_b_c.compareNames(b_b_c) < 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(\n bthLabXyz.compareNames(ethLabXyz) < 0,\n \"bthLab.xyz comes before ethLab.xyz\"\n );\n require(\n bthLabXyz.compareNames(bthLabXyz) == 0,\n \"bthLab.xyz and bthLab.xyz are the same\"\n );\n require(\n ethLabXyz.compareNames(bthLabXyz) > 0,\n \"ethLab.xyz comes after bethLab.xyz\"\n );\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(\n verylong1_eth.compareNames(verylong2_eth) > 0,\n \"longa.vlong.eth comes after long.vlong.eth\"\n );\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(\n RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA),\n \"0x11111111 >= 0xAAAAAAAA\"\n );\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(\n hex\"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d\"\n .computeKeytag() == 19036,\n \"Invalid keytag\"\n );\n require(\n hex\"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf\"\n .computeKeytag() == 21693,\n \"Invalid keytag (2)\"\n );\n require(\n hex\"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3\"\n .computeKeytag() == 33630\n );\n require(\n hex\"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5\"\n .computeKeytag() == 20326,\n \"Invalid keytag (3)\"\n );\n }\n}\n" + }, + "test/registry/mocks/DummyResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyResolver {\n mapping(bytes32 => string) public name;\n\n function setName(bytes32 node, string memory _name) public {\n name[node] = _name;\n }\n}\n" + }, + "test/reverseRegistrar/mocks/MockReverseClaimerImplementer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../../../contracts/registry/ENS.sol\";\nimport {ReverseClaimer} from \"../../../contracts/reverseRegistrar/ReverseClaimer.sol\";\n\ncontract MockReverseClaimerImplementer is ReverseClaimer {\n constructor(ENS ens, address claimant) ReverseClaimer(ens, claimant) {}\n}\n" + }, + "test/utils/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n if (bytes4(extraData) == bytes4(keccak256(\"name(bytes32)\"))) {\n return abi.encode(\"offchain.test.eth\");\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "test/utils/mocks/LegacyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\ncontract LegacyResolver {\n function addr(bytes32 /* node */) public view returns (address) {\n return address(this);\n }\n}\n" + }, + "test/utils/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10 ** uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10 ** uint256(decimals()));\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/solcInputs/49f758ec505ff69b72f3179ac11d7cfc.json b/solidity/dns-contracts/deployments/sepolia/solcInputs/49f758ec505ff69b72f3179ac11d7cfc.json new file mode 100644 index 0000000..51bd823 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/solcInputs/49f758ec505ff69b72f3179ac11d7cfc.json @@ -0,0 +1,101 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n uint256 hexLength = lastIdx - idx;\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\n revert(\"Invalid string length\");\n }\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n return functionStaticCall(target, data, gasleft());\n }\n\n /**\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @param gasLimit The gas limit to use for the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n uint256 gasLimit\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gasLimit,\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nerror ResolverNotContract();\n\nerror ResolverError(bytes returnData);\n\nerror HttpError(HttpErrorItem[] errors);\n\nstruct HttpErrorItem {\n uint16 status;\n string message;\n}\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct MulticallChecks {\n bool isCallback;\n bool hasExtendedResolver;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\nstruct Result {\n bool success;\n bytes returnData;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (Result[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (Result[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (Result[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (Result[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n if (!resolverAddress.isContract()) {\n revert ResolverNotContract();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory reverseResolvedData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n reverseResolvedData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (Result[] memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n Result[] memory results,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(result.returnData, (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n result.returnData,\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (Result[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data,\n bool isSafe\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n if (isSafe) {\n result = LowLevelCallUtils.functionStaticCall(target, data);\n } else {\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\n }\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _checkInterface(\n address resolver,\n bytes4 interfaceId\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _checkSafetyAndItem(\n bytes memory name,\n bytes memory item,\n address resolver,\n MulticallChecks memory multicallChecks\n ) internal view returns (bool, bytes memory) {\n if (!multicallChecks.isCallback) {\n if (multicallChecks.hasExtendedResolver) {\n return (\n true,\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\n );\n }\n return (_checkInterface(resolver, bytes4(item)), item);\n }\n return (true, item);\n }\n\n function _checkMulticall(\n MulticallData memory multicallData\n ) internal view returns (MulticallChecks memory) {\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _checkInterface(\n multicallData.resolver,\n type(IExtendedResolver).interfaceId\n );\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n return MulticallChecks(isCallback, hasExtendedResolver);\n }\n\n function _checkResolveSingle(Result memory result) internal pure {\n if (!result.success) {\n if (bytes4(result.returnData) == HttpError.selector) {\n bytes memory returnData = result.returnData;\n assembly {\n revert(add(returnData, 32), mload(returnData))\n }\n }\n revert ResolverError(result.returnData);\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (Result[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new Result[](length);\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n\n if (failure) {\n results[i] = Result(false, item);\n continue;\n }\n\n bool isSafe = false;\n (isSafe, item) = _checkSafetyAndItem(\n multicallData.name,\n item,\n multicallData.resolver,\n multicallChecks\n );\n\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(\n multicallData.resolver,\n item,\n isSafe\n );\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && multicallChecks.hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = Result(success, returnData);\n extraDatas[i].data = item;\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/solcInputs/70b6083cd7dd7fa7e3ebaac1755dcba3.json b/solidity/dns-contracts/deployments/sepolia/solcInputs/70b6083cd7dd7fa7e3ebaac1755dcba3.json new file mode 100644 index 0000000..1a33ab3 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/solcInputs/70b6083cd7dd7fa7e3ebaac1755dcba3.json @@ -0,0 +1,449 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (iter.name().compareNames(buf.buf) != 0) continue;\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(\n uint16 _expectedType,\n bytes memory _expectedName,\n uint32 _inception,\n uint64 _inserted,\n bytes memory _proof\n ) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if (_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(\n uint16 dnstype,\n bytes memory name\n ) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyExtendedDNSSECResolver is IExtendedDNSResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes memory /* name */,\n bytes memory /* data */,\n bytes memory context\n ) external view override returns (bytes memory) {\n return abi.encode(context);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyLegacyTextResolver is ITextResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(ITextResolver).interfaceId;\n }\n\n function text(\n bytes32 /* node */,\n string calldata key\n ) external view override returns (string memory) {\n return key;\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyNonCCIPAwareResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../OffchainDNSResolver.sol\";\nimport \"../../resolvers/profiles/IExtendedResolver.sol\";\n\ncontract DummyNonCCIPAwareResolver is IExtendedResolver, ERC165 {\n OffchainDNSResolver dnsResolver;\n\n constructor(OffchainDNSResolver _dnsResolver) {\n dnsResolver = _dnsResolver;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(dnsResolver),\n urls,\n data,\n OffchainDNSResolver.resolveCallback.selector,\n data\n );\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyParser.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../dnssec-oracle/BytesUtils.sol\";\nimport \"../RecordParser.sol\";\n\ncontract DummyParser {\n using BytesUtils for bytes;\n\n // parse data in format: name;key1=value1 key2=value2;url\n function parseData(\n bytes memory data,\n uint256 kvCount\n )\n external\n pure\n returns (\n string memory name,\n string[] memory keys,\n string[] memory values,\n string memory url\n )\n {\n uint256 len = data.length;\n // retrieve name\n uint256 sep1 = data.find(0, len, \";\");\n name = string(data.substring(0, sep1));\n\n // retrieve url\n uint256 sep2 = data.find(sep1 + 1, len - sep1, \";\");\n url = string(data.substring(sep2 + 1, len - sep2 - 1));\n\n keys = new string[](kvCount);\n values = new string[](kvCount);\n // retrieve keys and values\n uint256 offset = sep1 + 1;\n for (uint256 i; i < kvCount && offset < len; i++) {\n (\n bytes memory key,\n bytes memory val,\n uint256 nextOffset\n ) = RecordParser.readKeyValue(data, offset, sep2 - offset);\n keys[i] = string(key);\n values[i] = string(val);\n offset = nextOffset;\n }\n }\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"../utils/LowLevelCallUtils.sol\";\n\nerror InvalidOperation();\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver, IERC165 {\n using RRUtils for *;\n using Address for address;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedResolver).interfaceId;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n revertWithDefaultOffchainLookup(name, data);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query, bytes4 selector) = abi.decode(\n extraData,\n (bytes, bytes, bytes4)\n );\n\n if (selector != bytes4(0)) {\n (bytes memory targetData, address targetResolver) = abi.decode(\n query,\n (bytes, address)\n );\n return\n callWithOffchainLookupPropagation(\n targetResolver,\n name,\n query,\n abi.encodeWithSelector(\n selector,\n response,\n abi.encode(targetData, address(this))\n )\n );\n }\n\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n callWithOffchainLookupPropagation(\n dnsresolver,\n name,\n query,\n abi.encodeCall(\n IExtendedDNSResolver.resolve,\n (name, query, context)\n )\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return\n callWithOffchainLookupPropagation(\n dnsresolver,\n name,\n query,\n abi.encodeCall(\n IExtendedResolver.resolve,\n (name, query)\n )\n );\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory name,\n bytes memory innerdata,\n bytes memory data\n ) internal view returns (bytes memory) {\n if (!target.isContract()) {\n revertWithDefaultOffchainLookup(name, innerdata);\n }\n\n bool result = LowLevelCallUtils.functionStaticCall(\n address(target),\n data\n );\n uint256 size = LowLevelCallUtils.returnDataSize();\n if (result) {\n bytes memory returnData = LowLevelCallUtils.readReturnData(0, size);\n return abi.decode(returnData, (bytes));\n }\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n if (bytes4(errorId) == OffchainLookup.selector) {\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n handleOffchainLookupError(revertData, target, name);\n }\n }\n LowLevelCallUtils.propagateRevert();\n }\n\n function revertWithDefaultOffchainLookup(\n bytes memory name,\n bytes memory data\n ) internal view {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, data, bytes4(0))\n );\n }\n\n function handleOffchainLookupError(\n bytes memory returnData,\n address target,\n bytes memory name\n ) internal view {\n (\n address sender,\n string[] memory urls,\n bytes memory callData,\n bytes4 innerCallbackFunction,\n bytes memory extraData\n ) = abi.decode(returnData, (address, string[], bytes, bytes4, bytes));\n\n if (sender != target) {\n revert InvalidOperation();\n }\n\n revert OffchainLookup(\n address(this),\n urls,\n callData,\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, extraData, innerCallbackFunction)\n );\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (bytes memory key, bytes memory value, uint256 nextOffset)\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = len + offset;\n nextOffset = terminator;\n } else {\n nextOffset = terminator + 1;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256[3] memory P) {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (uint256 x, uint256 y, uint256 z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(\n uint256 x0,\n uint256 y0\n ) internal pure returns (bool isZero) {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(\n uint256 scalar\n ) internal pure returns (uint256, uint256) {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(\n bytes calldata,\n bytes calldata\n ) external pure override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input\n )\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n )\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(\n RRUtils.SignedSet memory rrset,\n uint16 typecovered\n ) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if (address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns (bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 {\n totallen := add(totallen, 64)\n }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for {\n let i := 0\n } lt(i, totallen) {\n i := add(i, 64)\n } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 {\n mstore8(add(scratch, sub(len, i)), 0x80)\n }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 {\n mstore(\n add(scratch, 32),\n or(mload(add(scratch, 32)), mul(len, 8))\n )\n }\n\n // Expand the 16 32-bit words into 80\n for {\n let j := 64\n } lt(j, 128) {\n j := add(j, 12)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 12))),\n mload(add(scratch, sub(j, 32)))\n ),\n xor(\n mload(add(scratch, sub(j, 56))),\n mload(add(scratch, sub(j, 64)))\n )\n )\n temp := or(\n and(\n mul(temp, 2),\n 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE\n ),\n and(\n div(temp, 0x80000000),\n 0x0000000100000001000000010000000100000001000000010000000100000001\n )\n )\n mstore(add(scratch, j), temp)\n }\n for {\n let j := 128\n } lt(j, 320) {\n j := add(j, 24)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 24))),\n mload(add(scratch, sub(j, 64)))\n ),\n xor(\n mload(add(scratch, sub(j, 112))),\n mload(add(scratch, sub(j, 128)))\n )\n )\n temp := or(\n and(\n mul(temp, 4),\n 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC\n ),\n and(\n div(temp, 0x40000000),\n 0x0000000300000003000000030000000300000003000000030000000300000003\n )\n )\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for {\n let j := 0\n } lt(j, 80) {\n j := add(j, 1)\n } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(\n div(x, 0x100000000000000000000),\n div(x, 0x10000000000)\n )\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := and(div(x, 0x10000000000), f)\n f := or(\n and(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n ),\n f\n )\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(\n div(\n x,\n 0x80000000000000000000000000000000000000000000000\n ),\n 0x1F\n )\n temp := or(\n and(\n div(x, 0x800000000000000000000000000000000000000),\n 0xFFFFFFE0\n ),\n temp\n )\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(\n div(\n mload(add(scratch, mul(j, 4))),\n 0x100000000000000000000000000000000000000000000000000000000\n ),\n temp\n )\n x := or(\n div(x, 0x10000000000),\n mul(temp, 0x10000000000000000000000000000000000000000)\n )\n x := or(\n and(\n x,\n 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF\n ),\n mul(\n or(\n and(div(x, 0x4000000000000), 0xC0000000),\n and(div(x, 0x400000000000000000000), 0x3FFFFFFF)\n ),\n 0x100000000000000000000\n )\n )\n }\n\n h := and(\n add(h, x),\n 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF\n )\n }\n ret := mul(\n or(\n or(\n or(\n or(\n and(\n div(h, 0x100000000),\n 0xFFFFFFFF00000000000000000000000000000000\n ),\n and(\n div(h, 0x1000000),\n 0xFFFFFFFF000000000000000000000000\n )\n ),\n and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)\n ),\n and(div(h, 0x100), 0xFFFFFFFF00000000)\n ),\n and(h, 0xFFFFFFFF)\n ),\n 0x1000000000000000000000000\n )\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/ILinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface ILinearPremiumPriceOracle {\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256);\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns (address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping(bytes32 => address) addresses;\n\n constructor() public {}\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Implements a dummy NameWrapper which returns the caller's address\n */\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"../../resolvers/profiles/IAddressResolver.sol\";\nimport \"../../resolvers/profiles/IAddrResolver.sol\";\nimport \"../../utils/HexUtils.sol\";\n\ncontract ExtendedDNSResolver is IExtendedDNSResolver, IERC165 {\n using HexUtils for *;\n\n uint256 private constant COIN_TYPE_ETH = 60;\n\n error NotImplemented();\n error InvalidAddressFormat();\n\n function supportsInterface(\n bytes4 interfaceId\n ) external view virtual override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data,\n bytes calldata context\n ) external pure override returns (bytes memory) {\n bytes4 selector = bytes4(data);\n if (\n selector == IAddrResolver.addr.selector ||\n selector == IAddressResolver.addr.selector\n ) {\n if (selector == IAddressResolver.addr.selector) {\n (, uint256 coinType) = abi.decode(data[4:], (bytes32, uint256));\n if (coinType != COIN_TYPE_ETH) return abi.encode(\"\");\n }\n (address record, bool valid) = context.hexToAddress(\n 2,\n context.length\n );\n if (!valid) revert InvalidAddressFormat();\n return abi.encode(record);\n }\n revert NotImplemented();\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ReverseClaimer\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/utils/DummyRevertResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ncontract DummyRevertResolver {\n function resolve(\n bytes calldata,\n bytes calldata\n ) external pure returns (bytes memory) {\n revert(\"Not Supported\");\n }\n\n function supportsInterface(bytes4) external pure returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n uint256 hexLength = lastIdx - idx;\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\n revert(\"Invalid string length\");\n }\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/TestHexUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {HexUtils} from \"./HexUtils.sol\";\n\ncontract TestHexUtils {\n using HexUtils for *;\n\n function hexStringToBytes32(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes32, bool) {\n return name.hexStringToBytes32(idx, lastInx);\n }\n\n function hexToAddress(\n bytes calldata input,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (address, bool) {\n return input.hexToAddress(idx, lastInx);\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(\n string memory name\n ) public pure returns (bytes memory, bytes32) {\n return name.dnsEncodeName();\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (bytes[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes[] memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (bytes[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n result = LowLevelCallUtils.functionStaticCall(address(target), data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _hasExtendedResolver(\n address resolver\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(\n type(IExtendedResolver).interfaceId\n )\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (bytes[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _hasExtendedResolver(multicallData.resolver);\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = item;\n continue;\n }\n if (!isCallback && hasExtendedResolver) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = returnData;\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(\n name,\n wrappedOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable,\n ReverseClaimer\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE and set expiry to max */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the owner of a name\n * @param id Namehash of the name\n * @return operator Approved operator of a name\n */\n\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /**\n * @notice Approves an address for a name\n * @param to address to approve\n * @param tokenId name to approve\n */\n\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or operator of the owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or operator\n */\n\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Checks if owner/operator or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner/operator or approved\n */\n\n function canExtendSubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public returns (uint64 expiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // Set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (!_isWrapped(node)) {\n revert NameIsNotWrapped();\n }\n\n // this flag is used later, when checking fuses\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // Max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n address approved = getApproved(uint256(node));\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(parentNode, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /**\n * @notice Checks if a name is wrapped in a more gas efficient way\n * @param parentNode Namehash of the name\n * @param labelhash Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != ETH_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + }, + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external view override returns (bool) {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32, uint256) {\n return name.readLabel(offset);\n }\n\n function namehash(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32) {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\n \"\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n require(\n \"foo\".keccak(0, 3) ==\n bytes32(\n 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d\n ),\n \"Incorrect hash of 'foo'\"\n );\n require(\n \"foo\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\n \"hello\".equals(1, \"ello\") == true,\n \"Substring to string equality\"\n );\n require(\n \"hello\".equals(1, \"jello\", 1, 4) == true,\n \"Substring to substring equality\"\n );\n require(\n \"zhello\".equals(1, \"abchello\", 3) == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"0x0102030000\".equals(0, \"0x010203\") == false,\n \"Compare with offset and trailing bytes\"\n );\n }\n\n function testComparePartial() public pure {\n require(\n \"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true,\n \"Compare same length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true,\n \"Compare different length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true,\n \"Compare same with different offset\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 33\n ) ==\n 0 ==\n true,\n \"Compare different long strings same length smaller partial length which must be equal\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 34\n ) <\n 0 ==\n true,\n \"Compare long strings same length different partial length\"\n );\n require(\n \"0123456789012345012345678901234a\".compare(\n 0,\n 32,\n \"0123456789012345012345678901234b\",\n 0,\n 32\n ) <\n 0 ==\n true,\n \"Compare strings exactly 32 characters long\"\n );\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\n \"a\".compare(\"b\") < 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"b\".compare(\"a\") > 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"aa\".compare(\"ab\") < 0 == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"a\".compare(\"aa\") < 0 == true,\n \"Compare different value with different length\"\n );\n require(\n \"aa\".compare(\"a\") > 0 == true,\n \"Compare different value with different length\"\n );\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(\n longChar.compare(longChar) == 0 == true,\n \"Compares more than 32 bytes char\"\n );\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(\n longChar.compare(otherLongChar) < 0 == true,\n \"Compare long char with difference at start\"\n );\n }\n\n function testSubstring() public pure {\n require(\n keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")),\n \"Copy 0 bytes\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 4))) ==\n keccak256(bytes(\"hell\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(1, 4))) ==\n keccak256(bytes(\"ello\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 5))) ==\n keccak256(bytes(\"hello\")),\n \"Copy whole string\"\n );\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(\n bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) ==\n bytes32(\n 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000\n ),\n \"readBytes20\"\n );\n }\n\n function testReadBytes32() public pure {\n require(\n \"0123456789abcdef0123456789abcdef\".readBytes32(0) ==\n bytes32(\n 0x3031323334353637383961626364656630313233343536373839616263646566\n ),\n \"readBytes32\"\n );\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\n \"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")),\n \"Decode 'a'\"\n );\n require(\n \"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")),\n \"Decode 'aa'\"\n );\n require(\n \"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")),\n \"Decode 'aaa'\"\n );\n require(\n \"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")),\n \"Decode 'aaaa'\"\n );\n require(\n \"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa'\"\n );\n require(\n \"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa' lowercase\"\n );\n require(\n \"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet\"\n );\n require(\n \"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet lowercase\"\n );\n require(\n \"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\"\n .base32HexDecodeWord(0, 52) ==\n bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"),\n \"Decode 32*'a'\"\n );\n require(\n \" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\"\n .base32HexDecodeWord(1, 32) ==\n bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"),\n \"Decode real bytes32hex\"\n );\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex\"00\".nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex\"00\".labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex\"016100\".labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(\n hex\"016201610000\".labelCount(0) == 2,\n \"labelCount('b.a.') == 2\"\n );\n require(\n hex\"066574686c61620378797a00\".labelCount(6 + 1) == 1,\n \"nameLength('(bthlab).xyz.') == 6\"\n );\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes\n memory rrs = hex\"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101\";\n bytes[2] memory names = [bytes(hex\"016100\"), bytes(hex\"0162016100\")];\n bytes[2] memory rdatas = [bytes(hex\"74000001\"), bytes(hex\"c0a80101\")];\n uint i = 0;\n for (\n RRUtils.RRIterator memory iter = rrs.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(\n keccak256(iter.name()) == keccak256(names[i]),\n \"Name matches\"\n );\n require(\n keccak256(iter.rdata()) == keccak256(rdatas[i]),\n \"Rdata matches\"\n );\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex\"066274686c61620378797a00\";\n bytes memory ethLabXyz = hex\"066574686c61620378797a00\";\n bytes memory xyz = hex\"0378797a00\";\n bytes memory a_b_c = hex\"01610162016300\";\n bytes memory b_b_c = hex\"01620162016300\";\n bytes memory c = hex\"016300\";\n bytes memory d = hex\"016400\";\n bytes memory a_d_c = hex\"01610164016300\";\n bytes memory b_a_c = hex\"01620161016300\";\n bytes memory ab_c_d = hex\"0261620163016400\";\n bytes memory a_c_d = hex\"01610163016400\";\n bytes\n memory verylong1_eth = hex\"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n bytes\n memory verylong2_eth = hex\"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n\n require(\n hex\"0301616100\".compareNames(hex\"0302616200\") < 0,\n \"label lengths are correctly checked\"\n );\n require(\n a_b_c.compareNames(c) > 0,\n \"one name has a difference of >1 label to with the same root name\"\n );\n require(\n a_b_c.compareNames(d) < 0,\n \"one name has a difference of >1 label to with different root name\"\n );\n require(\n a_b_c.compareNames(a_d_c) < 0,\n \"two names start the same but have differences in later labels\"\n );\n require(\n a_b_c.compareNames(b_a_c) > 0,\n \"the first label sorts later, but the first label sorts earlier\"\n );\n require(\n ab_c_d.compareNames(a_c_d) > 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(\n a_b_c.compareNames(b_b_c) < 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(\n bthLabXyz.compareNames(ethLabXyz) < 0,\n \"bthLab.xyz comes before ethLab.xyz\"\n );\n require(\n bthLabXyz.compareNames(bthLabXyz) == 0,\n \"bthLab.xyz and bthLab.xyz are the same\"\n );\n require(\n ethLabXyz.compareNames(bthLabXyz) > 0,\n \"ethLab.xyz comes after bethLab.xyz\"\n );\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(\n verylong1_eth.compareNames(verylong2_eth) > 0,\n \"longa.vlong.eth comes after long.vlong.eth\"\n );\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(\n RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA),\n \"0x11111111 >= 0xAAAAAAAA\"\n );\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(\n hex\"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d\"\n .computeKeytag() == 19036,\n \"Invalid keytag\"\n );\n require(\n hex\"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf\"\n .computeKeytag() == 21693,\n \"Invalid keytag (2)\"\n );\n require(\n hex\"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3\"\n .computeKeytag() == 33630\n );\n require(\n hex\"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5\"\n .computeKeytag() == 20326,\n \"Invalid keytag (3)\"\n );\n }\n}\n" + }, + "test/registry/mocks/DummyResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyResolver {\n mapping(bytes32 => string) public name;\n\n function setName(bytes32 node, string memory _name) public {\n name[node] = _name;\n }\n}\n" + }, + "test/reverseRegistrar/mocks/MockReverseClaimerImplementer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../../../contracts/registry/ENS.sol\";\nimport {ReverseClaimer} from \"../../../contracts/reverseRegistrar/ReverseClaimer.sol\";\n\ncontract MockReverseClaimerImplementer is ReverseClaimer {\n constructor(ENS ens, address claimant) ReverseClaimer(ens, claimant) {}\n}\n" + }, + "test/utils/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n if (bytes4(extraData) == bytes4(keccak256(\"name(bytes32)\"))) {\n return abi.encode(\"offchain.test.eth\");\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "test/utils/mocks/LegacyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\ncontract LegacyResolver {\n function addr(bytes32 /* node */) public view returns (address) {\n return address(this);\n }\n}\n" + }, + "test/utils/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10 ** uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10 ** uint256(decimals()));\n }\n }\n}\n" + }, + "test/utils/mocks/MockOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract MockOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n MockOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (, bytes memory callData, ) = abi.decode(\n extraData,\n (bytes, bytes, bytes4)\n );\n if (bytes4(callData) == bytes4(keccak256(\"addr(bytes32)\"))) {\n (bytes memory result, , ) = abi.decode(\n response,\n (bytes, uint64, bytes)\n );\n return result;\n }\n return abi.encode(address(this));\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/solcInputs/92997fb6810aa29dfb8513e2c431e302.json b/solidity/dns-contracts/deployments/sepolia/solcInputs/92997fb6810aa29dfb8513e2c431e302.json new file mode 100644 index 0000000..1b927f2 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/solcInputs/92997fb6810aa29dfb8513e2c431e302.json @@ -0,0 +1,41 @@ +{ + "language": "Solidity", + "sources": { + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n event SuffixAdded(bytes suffix);\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n emit SuffixAdded(names[i]);\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/solcInputs/96d118177ae253bdd3815d2757c11cd9.json b/solidity/dns-contracts/deployments/sepolia/solcInputs/96d118177ae253bdd3815d2757c11cd9.json new file mode 100644 index 0000000..4ad6d18 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/solcInputs/96d118177ae253bdd3815d2757c11cd9.json @@ -0,0 +1,446 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/BytesUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (iter.name().compareNames(buf.buf) != 0) continue;\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"../utils/BytesUtils.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(\n uint16 _expectedType,\n bytes memory _expectedName,\n uint32 _inception,\n uint64 _inserted,\n bytes memory _proof\n ) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if (_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(\n uint16 dnstype,\n bytes memory name\n ) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyExtendedDNSSECResolver is IExtendedDNSResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes memory /* name */,\n bytes memory /* data */,\n bytes memory context\n ) external view override returns (bytes memory) {\n return abi.encode(context);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyLegacyTextResolver is ITextResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(ITextResolver).interfaceId;\n }\n\n function text(\n bytes32 /* node */,\n string calldata key\n ) external view override returns (string memory) {\n return key;\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyNonCCIPAwareResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../OffchainDNSResolver.sol\";\nimport \"../../resolvers/profiles/IExtendedResolver.sol\";\n\ncontract DummyNonCCIPAwareResolver is IExtendedResolver, ERC165 {\n OffchainDNSResolver dnsResolver;\n\n constructor(OffchainDNSResolver _dnsResolver) {\n dnsResolver = _dnsResolver;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(dnsResolver),\n urls,\n data,\n OffchainDNSResolver.resolveCallback.selector,\n data\n );\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyParser.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../utils/BytesUtils.sol\";\nimport \"../RecordParser.sol\";\n\ncontract DummyParser {\n using BytesUtils for bytes;\n\n // parse data in format: name;key1=value1 key2=value2;url\n function parseData(\n bytes memory data,\n uint256 kvCount\n )\n external\n pure\n returns (\n string memory name,\n string[] memory keys,\n string[] memory values,\n string memory url\n )\n {\n uint256 len = data.length;\n // retrieve name\n uint256 sep1 = data.find(0, len, \";\");\n name = string(data.substring(0, sep1));\n\n // retrieve url\n uint256 sep2 = data.find(sep1 + 1, len - sep1, \";\");\n url = string(data.substring(sep2 + 1, len - sep2 - 1));\n\n keys = new string[](kvCount);\n values = new string[](kvCount);\n // retrieve keys and values\n uint256 offset = sep1 + 1;\n for (uint256 i; i < kvCount && offset < len; i++) {\n (\n bytes memory key,\n bytes memory val,\n uint256 nextOffset\n ) = RecordParser.readKeyValue(data, offset, sep2 - offset);\n keys[i] = string(key);\n values[i] = string(val);\n offset = nextOffset;\n }\n }\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"../utils/BytesUtils.sol\";\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"../utils/LowLevelCallUtils.sol\";\n\nerror InvalidOperation();\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver, IERC165 {\n using RRUtils for *;\n using Address for address;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedResolver).interfaceId;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n revertWithDefaultOffchainLookup(name, data);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query, bytes4 selector) = abi.decode(\n extraData,\n (bytes, bytes, bytes4)\n );\n\n if (selector != bytes4(0)) {\n (bytes memory targetData, address targetResolver) = abi.decode(\n query,\n (bytes, address)\n );\n return\n callWithOffchainLookupPropagation(\n targetResolver,\n name,\n query,\n abi.encodeWithSelector(\n selector,\n response,\n abi.encode(targetData, address(this))\n )\n );\n }\n\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n callWithOffchainLookupPropagation(\n dnsresolver,\n name,\n query,\n abi.encodeCall(\n IExtendedDNSResolver.resolve,\n (name, query, context)\n )\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return\n callWithOffchainLookupPropagation(\n dnsresolver,\n name,\n query,\n abi.encodeCall(\n IExtendedResolver.resolve,\n (name, query)\n )\n );\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory name,\n bytes memory innerdata,\n bytes memory data\n ) internal view returns (bytes memory) {\n if (!target.isContract()) {\n revertWithDefaultOffchainLookup(name, innerdata);\n }\n\n bool result = LowLevelCallUtils.functionStaticCall(\n address(target),\n data\n );\n uint256 size = LowLevelCallUtils.returnDataSize();\n if (result) {\n bytes memory returnData = LowLevelCallUtils.readReturnData(0, size);\n return abi.decode(returnData, (bytes));\n }\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n if (bytes4(errorId) == OffchainLookup.selector) {\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n handleOffchainLookupError(revertData, target, name);\n }\n }\n LowLevelCallUtils.propagateRevert();\n }\n\n function revertWithDefaultOffchainLookup(\n bytes memory name,\n bytes memory data\n ) internal view {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, data, bytes4(0))\n );\n }\n\n function handleOffchainLookupError(\n bytes memory returnData,\n address target,\n bytes memory name\n ) internal view {\n (\n address sender,\n string[] memory urls,\n bytes memory callData,\n bytes4 innerCallbackFunction,\n bytes memory extraData\n ) = abi.decode(returnData, (address, string[], bytes, bytes4, bytes));\n\n if (sender != target) {\n revert InvalidOperation();\n }\n\n revert OffchainLookup(\n address(this),\n urls,\n callData,\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, extraData, innerCallbackFunction)\n );\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../utils/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (bytes memory key, bytes memory value, uint256 nextOffset)\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = len + offset;\n nextOffset = terminator;\n } else {\n nextOffset = terminator + 1;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n event SuffixAdded(bytes suffix);\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n emit SuffixAdded(names[i]);\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../utils/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256[3] memory P) {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (uint256 x, uint256 y, uint256 z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(\n uint256 x0,\n uint256 y0\n ) internal pure returns (bool isZero) {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(\n uint256 scalar\n ) internal pure returns (uint256, uint256) {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../../utils/BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./RSAVerify.sol\";\nimport \"../../utils/BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./RSAVerify.sol\";\nimport \"../../utils/BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./ModexpPrecompile.sol\";\nimport \"../../utils/BytesUtils.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(\n bytes calldata,\n bytes calldata\n ) external pure override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../../utils/BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../../utils/BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"../utils/BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input\n )\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n )\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(\n RRUtils.SignedSet memory rrset,\n uint16 typecovered\n ) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if (address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../utils/BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns (bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 {\n totallen := add(totallen, 64)\n }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for {\n let i := 0\n } lt(i, totallen) {\n i := add(i, 64)\n } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 {\n mstore8(add(scratch, sub(len, i)), 0x80)\n }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 {\n mstore(\n add(scratch, 32),\n or(mload(add(scratch, 32)), mul(len, 8))\n )\n }\n\n // Expand the 16 32-bit words into 80\n for {\n let j := 64\n } lt(j, 128) {\n j := add(j, 12)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 12))),\n mload(add(scratch, sub(j, 32)))\n ),\n xor(\n mload(add(scratch, sub(j, 56))),\n mload(add(scratch, sub(j, 64)))\n )\n )\n temp := or(\n and(\n mul(temp, 2),\n 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE\n ),\n and(\n div(temp, 0x80000000),\n 0x0000000100000001000000010000000100000001000000010000000100000001\n )\n )\n mstore(add(scratch, j), temp)\n }\n for {\n let j := 128\n } lt(j, 320) {\n j := add(j, 24)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 24))),\n mload(add(scratch, sub(j, 64)))\n ),\n xor(\n mload(add(scratch, sub(j, 112))),\n mload(add(scratch, sub(j, 128)))\n )\n )\n temp := or(\n and(\n mul(temp, 4),\n 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC\n ),\n and(\n div(temp, 0x40000000),\n 0x0000000300000003000000030000000300000003000000030000000300000003\n )\n )\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for {\n let j := 0\n } lt(j, 80) {\n j := add(j, 1)\n } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(\n div(x, 0x100000000000000000000),\n div(x, 0x10000000000)\n )\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := and(div(x, 0x10000000000), f)\n f := or(\n and(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n ),\n f\n )\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(\n div(\n x,\n 0x80000000000000000000000000000000000000000000000\n ),\n 0x1F\n )\n temp := or(\n and(\n div(x, 0x800000000000000000000000000000000000000),\n 0xFFFFFFE0\n ),\n temp\n )\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(\n div(\n mload(add(scratch, mul(j, 4))),\n 0x100000000000000000000000000000000000000000000000000000000\n ),\n temp\n )\n x := or(\n div(x, 0x10000000000),\n mul(temp, 0x10000000000000000000000000000000000000000)\n )\n x := or(\n and(\n x,\n 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF\n ),\n mul(\n or(\n and(div(x, 0x4000000000000), 0xC0000000),\n and(div(x, 0x400000000000000000000), 0x3FFFFFFF)\n ),\n 0x100000000000000000000\n )\n )\n }\n\n h := and(\n add(h, x),\n 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF\n )\n }\n ret := mul(\n or(\n or(\n or(\n or(\n and(\n div(h, 0x100000000),\n 0xFFFFFFFF00000000000000000000000000000000\n ),\n and(\n div(h, 0x1000000),\n 0xFFFFFFFF000000000000000000000000\n )\n ),\n and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)\n ),\n and(div(h, 0x100), 0xFFFFFFFF00000000)\n ),\n and(h, 0xFFFFFFFF)\n ),\n 0x1000000000000000000000000\n )\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"../utils/StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/ILinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface ILinearPremiumPriceOracle {\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256);\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns (address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"../utils/StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping(bytes32 => address) addresses;\n\n constructor() public {}\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Implements a dummy NameWrapper which returns the caller's address\n */\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"../../resolvers/profiles/IAddressResolver.sol\";\nimport \"../../resolvers/profiles/IAddrResolver.sol\";\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"../../utils/HexUtils.sol\";\nimport \"../../utils/BytesUtils.sol\";\n\n/**\n * @dev Resolves names on ENS by interpreting record data stored in a DNS TXT record.\n * This resolver implements the IExtendedDNSResolver interface, meaning that when\n * a DNS name specifies it as the resolver via a TXT record, this resolver's\n * resolve() method is invoked, and is passed any additional information from that\n * text record. This resolver implements a simple text parser allowing a variety\n * of records to be specified in text, which will then be used to resolve the name\n * in ENS.\n *\n * To use this, set a TXT record on your DNS name in the following format:\n * ENS1
\n *\n * For example:\n * ENS1 2.dnsname.ens.eth a[60]=0x1234...\n *\n * The record data consists of a series of key=value pairs, separated by spaces. Keys\n * may have an optional argument in square brackets, and values may be either unquoted\n * - in which case they may not contain spaces - or single-quoted. Single quotes in\n * a quoted value may be backslash-escaped.\n *\n *\n * ┌────────┐\n * │ ┌───┐ │\n * ┌──────────────────────────────┴─┤\" \"│◄─┴────────────────────────────────────────┐\n * │ └───┘ │\n * │ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌────────────┐ ┌───┐ │\n * ^─┴─►│key├─┬─►│\"[\"├───►│arg├───►│\"]\"├─┬─►│\"=\"├─┬─►│\"'\"├───►│quoted_value├───►│\"'\"├─┼─$\n * └───┘ │ └───┘ └───┘ └───┘ │ └───┘ │ └───┘ └────────────┘ └───┘ │\n * └──────────────────────────┘ │ ┌──────────────┐ │\n * └─────────►│unquoted_value├─────────┘\n * └──────────────┘\n *\n * Record types:\n * - a[] - Specifies how an `addr()` request should be resolved for the specified\n * `coinType`. Ethereum has `coinType` 60. The value must be 0x-prefixed hexadecimal, and will\n * be returned unmodified; this means that non-EVM addresses will need to be translated\n * into binary format and then encoded in hex.\n * Examples:\n * - a[60]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7\n * - a[0]=0x00149010587f8364b964fcaa70687216b53bd2cbd798\n * - a[e] - Specifies how an `addr()` request should be resolved for the specified\n * `chainId`. The value must be 0x-prefixed hexadecimal. When encoding an address for an\n * EVM-based cryptocurrency that uses a chainId instead of a coinType, this syntax *must*\n * be used in place of the coin type - eg, Optimism is `a[e10]`, not `a[2147483658]`.\n * A list of supported cryptocurrencies for both syntaxes can be found here:\n * https://github.com/ensdomains/address-encoder/blob/master/docs/supported-cryptocurrencies.md\n * Example:\n * - a[e10]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7\n * - t[] - Specifies how a `text()` request should be resolved for the specified `key`.\n * Examples:\n * - t[com.twitter]=nicksdjohnson\n * - t[url]='https://ens.domains/'\n * - t[note]='I\\'m great'\n */\ncontract ExtendedDNSResolver is IExtendedDNSResolver, IERC165 {\n using HexUtils for *;\n using BytesUtils for *;\n using Strings for *;\n\n uint256 private constant COIN_TYPE_ETH = 60;\n\n error NotImplemented();\n error InvalidAddressFormat(bytes addr);\n\n function supportsInterface(\n bytes4 interfaceId\n ) external view virtual override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data,\n bytes calldata context\n ) external pure override returns (bytes memory) {\n bytes4 selector = bytes4(data);\n if (selector == IAddrResolver.addr.selector) {\n return _resolveAddr(context);\n } else if (selector == IAddressResolver.addr.selector) {\n return _resolveAddress(data, context);\n } else if (selector == ITextResolver.text.selector) {\n return _resolveText(data, context);\n }\n revert NotImplemented();\n }\n\n function _resolveAddress(\n bytes calldata data,\n bytes calldata context\n ) internal pure returns (bytes memory) {\n (, uint256 coinType) = abi.decode(data[4:], (bytes32, uint256));\n bytes memory value;\n // Per https://docs.ens.domains/ensip/11#specification\n if (coinType & 0x80000000 != 0) {\n value = _findValue(\n context,\n bytes.concat(\n \"a[e\",\n bytes((coinType & 0x7fffffff).toString()),\n \"]=\"\n )\n );\n } else {\n value = _findValue(\n context,\n bytes.concat(\"a[\", bytes(coinType.toString()), \"]=\")\n );\n }\n if (value.length == 0) {\n return value;\n }\n (bytes memory record, bool valid) = value.hexToBytes(2, value.length);\n if (!valid) revert InvalidAddressFormat(value);\n return record;\n }\n\n function _resolveAddr(\n bytes calldata context\n ) internal pure returns (bytes memory) {\n bytes memory value = _findValue(context, \"a[60]=\");\n if (value.length == 0) {\n return value;\n }\n (bytes memory record, bool valid) = value.hexToBytes(2, value.length);\n if (!valid) revert InvalidAddressFormat(value);\n return record;\n }\n\n function _resolveText(\n bytes calldata data,\n bytes calldata context\n ) internal pure returns (bytes memory) {\n (, string memory key) = abi.decode(data[4:], (bytes32, string));\n bytes memory value = _findValue(\n context,\n bytes.concat(\"t[\", bytes(key), \"]=\")\n );\n return value;\n }\n\n uint256 constant STATE_START = 0;\n uint256 constant STATE_IGNORED_KEY = 1;\n uint256 constant STATE_IGNORED_KEY_ARG = 2;\n uint256 constant STATE_VALUE = 3;\n uint256 constant STATE_QUOTED_VALUE = 4;\n uint256 constant STATE_UNQUOTED_VALUE = 5;\n uint256 constant STATE_IGNORED_VALUE = 6;\n uint256 constant STATE_IGNORED_QUOTED_VALUE = 7;\n uint256 constant STATE_IGNORED_UNQUOTED_VALUE = 8;\n\n /**\n * @dev Implements a DFA to parse the text record, looking for an entry\n * matching `key`.\n * @param data The text record to parse.\n * @param key The exact key to search for.\n * @return value The value if found, or an empty string if `key` does not exist.\n */\n function _findValue(\n bytes memory data,\n bytes memory key\n ) internal pure returns (bytes memory value) {\n // Here we use a simple state machine to parse the text record. We\n // process characters one at a time; each character can trigger a\n // transition to a new state, or terminate the DFA and return a value.\n // For states that expect to process a number of tokens, we use\n // inner loops for efficiency reasons, to avoid the need to go\n // through the outer loop and switch statement for every character.\n uint256 state = STATE_START;\n uint256 len = data.length;\n for (uint256 i = 0; i < len; ) {\n if (state == STATE_START) {\n // Look for a matching key.\n if (data.equals(i, key, 0, key.length)) {\n i += key.length;\n state = STATE_VALUE;\n } else {\n state = STATE_IGNORED_KEY;\n }\n } else if (state == STATE_IGNORED_KEY) {\n for (; i < len; i++) {\n if (data[i] == \"=\") {\n state = STATE_IGNORED_VALUE;\n i += 1;\n break;\n } else if (data[i] == \"[\") {\n state = STATE_IGNORED_KEY_ARG;\n i += 1;\n break;\n }\n }\n } else if (state == STATE_IGNORED_KEY_ARG) {\n for (; i < len; i++) {\n if (data[i] == \"]\") {\n state = STATE_IGNORED_VALUE;\n i += 1;\n if (data[i] == \"=\") {\n i += 1;\n }\n break;\n }\n }\n } else if (state == STATE_VALUE) {\n if (data[i] == \"'\") {\n state = STATE_QUOTED_VALUE;\n i += 1;\n } else {\n state = STATE_UNQUOTED_VALUE;\n }\n } else if (state == STATE_QUOTED_VALUE) {\n uint256 start = i;\n uint256 valueLen = 0;\n bool escaped = false;\n for (; i < len; i++) {\n if (escaped) {\n data[start + valueLen] = data[i];\n valueLen += 1;\n escaped = false;\n } else {\n if (data[i] == \"\\\\\") {\n escaped = true;\n } else if (data[i] == \"'\") {\n return data.substring(start, valueLen);\n } else {\n data[start + valueLen] = data[i];\n valueLen += 1;\n }\n }\n }\n } else if (state == STATE_UNQUOTED_VALUE) {\n uint256 start = i;\n for (; i < len; i++) {\n if (data[i] == \" \") {\n return data.substring(start, i - start);\n }\n }\n return data.substring(start, len - start);\n } else if (state == STATE_IGNORED_VALUE) {\n if (data[i] == \"'\") {\n state = STATE_IGNORED_QUOTED_VALUE;\n i += 1;\n } else {\n state = STATE_IGNORED_UNQUOTED_VALUE;\n }\n } else if (state == STATE_IGNORED_QUOTED_VALUE) {\n bool escaped = false;\n for (; i < len; i++) {\n if (escaped) {\n escaped = false;\n } else {\n if (data[i] == \"\\\\\") {\n escaped = true;\n } else if (data[i] == \"'\") {\n i += 1;\n while (data[i] == \" \") {\n i += 1;\n }\n state = STATE_START;\n break;\n }\n }\n }\n } else {\n assert(state == STATE_IGNORED_UNQUOTED_VALUE);\n for (; i < len; i++) {\n if (data[i] == \" \") {\n while (data[i] == \" \") {\n i += 1;\n }\n state = STATE_START;\n break;\n }\n }\n }\n }\n return \"\";\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ReverseClaimer\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/test/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/ITextResolver.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n\n if (bytes4(data) == bytes4(0x12345678)) {\n return abi.encode(\"foo\");\n }\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (address) {\n return 0x69420f05A11f617B4B74fFe2E04B2D300dFA556F;\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n if (bytes4(extraData) == bytes4(keccak256(\"name(bytes32)\"))) {\n return abi.encode(\"offchain.test.eth\");\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "contracts/test/mocks/LegacyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\ncontract LegacyResolver {\n function addr(bytes32 /* node */) public view returns (address) {\n return address(this);\n }\n}\n" + }, + "contracts/test/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10 ** uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10 ** uint256(decimals()));\n }\n }\n}\n" + }, + "contracts/test/mocks/MockOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract MockOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n MockOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (, bytes memory callData, ) = abi.decode(\n extraData,\n (bytes, bytes, bytes4)\n );\n if (bytes4(callData) == bytes4(keccak256(\"addr(bytes32)\"))) {\n (bytes memory result, , ) = abi.decode(\n response,\n (bytes, uint64, bytes)\n );\n return result;\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "contracts/test/mocks/MockReverseClaimerImplementer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../../../contracts/registry/ENS.sol\";\nimport {ReverseClaimer} from \"../../../contracts/reverseRegistrar/ReverseClaimer.sol\";\n\ncontract MockReverseClaimerImplementer is ReverseClaimer {\n constructor(ENS ens, address claimant) ReverseClaimer(ens, claimant) {}\n}\n" + }, + "contracts/test/mocks/StringUtilsTest.sol": { + "content": "// SPDX-License-Identifier: MIT\nimport \"../../../contracts/utils/StringUtils.sol\";\n\nlibrary StringUtilsTest {\n function testEscape(\n string calldata testStr\n ) public pure returns (string memory) {\n return StringUtils.escape(testStr);\n }\n}\n" + }, + "contracts/test/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/utils/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\n \"\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n require(\n \"foo\".keccak(0, 3) ==\n bytes32(\n 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d\n ),\n \"Incorrect hash of 'foo'\"\n );\n require(\n \"foo\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\n \"hello\".equals(1, \"ello\") == true,\n \"Substring to string equality\"\n );\n require(\n \"hello\".equals(1, \"jello\", 1, 4) == true,\n \"Substring to substring equality\"\n );\n require(\n \"zhello\".equals(1, \"abchello\", 3) == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"0x0102030000\".equals(0, \"0x010203\") == false,\n \"Compare with offset and trailing bytes\"\n );\n }\n\n function testComparePartial() public pure {\n require(\n \"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true,\n \"Compare same length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true,\n \"Compare different length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true,\n \"Compare same with different offset\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 33\n ) ==\n 0 ==\n true,\n \"Compare different long strings same length smaller partial length which must be equal\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 34\n ) <\n 0 ==\n true,\n \"Compare long strings same length different partial length\"\n );\n require(\n \"0123456789012345012345678901234a\".compare(\n 0,\n 32,\n \"0123456789012345012345678901234b\",\n 0,\n 32\n ) <\n 0 ==\n true,\n \"Compare strings exactly 32 characters long\"\n );\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\n \"a\".compare(\"b\") < 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"b\".compare(\"a\") > 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"aa\".compare(\"ab\") < 0 == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"a\".compare(\"aa\") < 0 == true,\n \"Compare different value with different length\"\n );\n require(\n \"aa\".compare(\"a\") > 0 == true,\n \"Compare different value with different length\"\n );\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(\n longChar.compare(longChar) == 0 == true,\n \"Compares more than 32 bytes char\"\n );\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(\n longChar.compare(otherLongChar) < 0 == true,\n \"Compare long char with difference at start\"\n );\n }\n\n function testSubstring() public pure {\n require(\n keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")),\n \"Copy 0 bytes\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 4))) ==\n keccak256(bytes(\"hell\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(1, 4))) ==\n keccak256(bytes(\"ello\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 5))) ==\n keccak256(bytes(\"hello\")),\n \"Copy whole string\"\n );\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(\n bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) ==\n bytes32(\n 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000\n ),\n \"readBytes20\"\n );\n }\n\n function testReadBytes32() public pure {\n require(\n \"0123456789abcdef0123456789abcdef\".readBytes32(0) ==\n bytes32(\n 0x3031323334353637383961626364656630313233343536373839616263646566\n ),\n \"readBytes32\"\n );\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\n \"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")),\n \"Decode 'a'\"\n );\n require(\n \"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")),\n \"Decode 'aa'\"\n );\n require(\n \"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")),\n \"Decode 'aaa'\"\n );\n require(\n \"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")),\n \"Decode 'aaaa'\"\n );\n require(\n \"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa'\"\n );\n require(\n \"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa' lowercase\"\n );\n require(\n \"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet\"\n );\n require(\n \"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet lowercase\"\n );\n require(\n \"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\"\n .base32HexDecodeWord(0, 52) ==\n bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"),\n \"Decode 32*'a'\"\n );\n require(\n \" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\"\n .base32HexDecodeWord(1, 32) ==\n bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"),\n \"Decode real bytes32hex\"\n );\n }\n}\n" + }, + "contracts/test/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/utils/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex\"00\".nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex\"00\".labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex\"016100\".labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(\n hex\"016201610000\".labelCount(0) == 2,\n \"labelCount('b.a.') == 2\"\n );\n require(\n hex\"066574686c61620378797a00\".labelCount(6 + 1) == 1,\n \"nameLength('(bthlab).xyz.') == 6\"\n );\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes\n memory rrs = hex\"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101\";\n bytes[2] memory names = [bytes(hex\"016100\"), bytes(hex\"0162016100\")];\n bytes[2] memory rdatas = [bytes(hex\"74000001\"), bytes(hex\"c0a80101\")];\n uint i = 0;\n for (\n RRUtils.RRIterator memory iter = rrs.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(\n keccak256(iter.name()) == keccak256(names[i]),\n \"Name matches\"\n );\n require(\n keccak256(iter.rdata()) == keccak256(rdatas[i]),\n \"Rdata matches\"\n );\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex\"066274686c61620378797a00\";\n bytes memory ethLabXyz = hex\"066574686c61620378797a00\";\n bytes memory xyz = hex\"0378797a00\";\n bytes memory a_b_c = hex\"01610162016300\";\n bytes memory b_b_c = hex\"01620162016300\";\n bytes memory c = hex\"016300\";\n bytes memory d = hex\"016400\";\n bytes memory a_d_c = hex\"01610164016300\";\n bytes memory b_a_c = hex\"01620161016300\";\n bytes memory ab_c_d = hex\"0261620163016400\";\n bytes memory a_c_d = hex\"01610163016400\";\n bytes\n memory verylong1_eth = hex\"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n bytes\n memory verylong2_eth = hex\"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n\n require(\n hex\"0301616100\".compareNames(hex\"0302616200\") < 0,\n \"label lengths are correctly checked\"\n );\n require(\n a_b_c.compareNames(c) > 0,\n \"one name has a difference of >1 label to with the same root name\"\n );\n require(\n a_b_c.compareNames(d) < 0,\n \"one name has a difference of >1 label to with different root name\"\n );\n require(\n a_b_c.compareNames(a_d_c) < 0,\n \"two names start the same but have differences in later labels\"\n );\n require(\n a_b_c.compareNames(b_a_c) > 0,\n \"the first label sorts later, but the first label sorts earlier\"\n );\n require(\n ab_c_d.compareNames(a_c_d) > 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(\n a_b_c.compareNames(b_b_c) < 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(\n bthLabXyz.compareNames(ethLabXyz) < 0,\n \"bthLab.xyz comes before ethLab.xyz\"\n );\n require(\n bthLabXyz.compareNames(bthLabXyz) == 0,\n \"bthLab.xyz and bthLab.xyz are the same\"\n );\n require(\n ethLabXyz.compareNames(bthLabXyz) > 0,\n \"ethLab.xyz comes after bethLab.xyz\"\n );\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(\n verylong1_eth.compareNames(verylong2_eth) > 0,\n \"longa.vlong.eth comes after long.vlong.eth\"\n );\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(\n RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA),\n \"0x11111111 >= 0xAAAAAAAA\"\n );\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(\n hex\"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d\"\n .computeKeytag() == 19036,\n \"Invalid keytag\"\n );\n require(\n hex\"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf\"\n .computeKeytag() == 21693,\n \"Invalid keytag (2)\"\n );\n require(\n hex\"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3\"\n .computeKeytag() == 33630\n );\n require(\n hex\"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5\"\n .computeKeytag() == 20326,\n \"Invalid keytag (3)\"\n );\n }\n}\n" + }, + "contracts/utils/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/utils/DummyRevertResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ncontract DummyRevertResolver {\n function resolve(\n bytes calldata,\n bytes calldata\n ) external pure returns (bytes memory) {\n revert(\"Not Supported\");\n }\n\n function supportsInterface(bytes4) external pure returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32, bool) {\n require(lastIdx - idx <= 64);\n (bytes memory r, bool valid) = hexToBytes(str, idx, lastIdx);\n if (!valid) {\n return (bytes32(0), false);\n }\n bytes32 ret;\n assembly {\n ret := shr(mul(4, sub(64, sub(lastIdx, idx))), mload(add(r, 32)))\n }\n return (ret, true);\n }\n\n function hexToBytes(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes memory r, bool valid) {\n uint256 hexLength = lastIdx - idx;\n if (hexLength % 2 == 1) {\n revert(\"Invalid string length\");\n }\n r = new bytes(hexLength / 2);\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n mstore8(add(add(r, 32), div(sub(i, idx), 2)), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n\n /**\n * @dev Attempts to convert an address to a hex string\n * @param addr The _addr to parse\n */\n function addressToHex(address addr) internal pure returns (string memory) {\n bytes memory hexString = new bytes(40);\n for (uint i = 0; i < 20; i++) {\n bytes1 byteValue = bytes1(uint8(uint160(addr) >> (8 * (19 - i))));\n bytes1 highNibble = bytes1(uint8(byteValue) / 16);\n bytes1 lowNibble = bytes1(\n uint8(byteValue) - 16 * uint8(highNibble)\n );\n hexString[2 * i] = _nibbleToHexChar(highNibble);\n hexString[2 * i + 1] = _nibbleToHexChar(lowNibble);\n }\n return string(hexString);\n }\n\n function _nibbleToHexChar(\n bytes1 nibble\n ) internal pure returns (bytes1 hexChar) {\n if (uint8(nibble) < 10) return bytes1(uint8(nibble) + 0x30);\n else return bytes1(uint8(nibble) + 0x57);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n return functionStaticCall(target, data, gasleft());\n }\n\n /**\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @param gasLimit The gas limit to use for the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n uint256 gasLimit\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gasLimit,\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../utils/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n\n /**\n * @dev Escapes special characters in a given string\n *\n * @param str The string to escape\n * @return The escaped string\n */\n function escape(string memory str) internal pure returns (string memory) {\n bytes memory strBytes = bytes(str);\n uint extraChars = 0;\n\n // count extra space needed for escaping\n for (uint i = 0; i < strBytes.length; i++) {\n if (_needsEscaping(strBytes[i])) {\n extraChars++;\n }\n }\n\n // allocate buffer with the exact size needed\n bytes memory buffer = new bytes(strBytes.length + extraChars);\n uint index = 0;\n\n // escape characters\n for (uint i = 0; i < strBytes.length; i++) {\n if (_needsEscaping(strBytes[i])) {\n buffer[index++] = \"\\\\\";\n buffer[index++] = _getEscapedChar(strBytes[i]);\n } else {\n buffer[index++] = strBytes[i];\n }\n }\n\n return string(buffer);\n }\n\n // determine if a character needs escaping\n function _needsEscaping(bytes1 char) private pure returns (bool) {\n return\n char == '\"' ||\n char == \"/\" ||\n char == \"\\\\\" ||\n char == \"\\n\" ||\n char == \"\\r\" ||\n char == \"\\t\";\n }\n\n // get the escaped character\n function _getEscapedChar(bytes1 char) private pure returns (bytes1) {\n if (char == \"\\n\") return \"n\";\n if (char == \"\\r\") return \"r\";\n if (char == \"\\t\") return \"t\";\n return char;\n }\n}\n" + }, + "contracts/utils/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"./BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32, uint256) {\n return name.readLabel(offset);\n }\n\n function namehash(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32) {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/utils/TestHexUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {HexUtils} from \"./HexUtils.sol\";\n\ncontract TestHexUtils {\n using HexUtils for *;\n\n function hexToBytes(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes memory, bool) {\n return name.hexToBytes(idx, lastInx);\n }\n\n function hexStringToBytes32(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes32, bool) {\n return name.hexStringToBytes32(idx, lastInx);\n }\n\n function hexToAddress(\n bytes calldata input,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (address, bool) {\n return input.hexToAddress(idx, lastInx);\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(\n string memory name\n ) public pure returns (bytes memory, bytes32) {\n return name.dnsEncodeName();\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {BytesUtils} from \"../utils/BytesUtils.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nerror ResolverNotContract();\n\nerror ResolverError(bytes returnData);\n\nerror HttpError(HttpErrorItem[] errors);\n\nstruct HttpErrorItem {\n uint16 status;\n string message;\n}\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct MulticallChecks {\n bool isCallback;\n bool hasExtendedResolver;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\nstruct Result {\n bool success;\n bytes returnData;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (Result[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (Result[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (Result[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (Result[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n if (!resolverAddress.isContract()) {\n revert ResolverNotContract();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory reverseResolvedData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n reverseResolvedData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (Result[] memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n Result[] memory results,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(result.returnData, (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n result.returnData,\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (Result[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data,\n bool isSafe\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n if (isSafe) {\n result = LowLevelCallUtils.functionStaticCall(target, data);\n } else {\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\n }\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _checkInterface(\n address resolver,\n bytes4 interfaceId\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _checkSafetyAndItem(\n bytes memory name,\n bytes memory item,\n address resolver,\n MulticallChecks memory multicallChecks\n ) internal view returns (bool, bytes memory) {\n if (!multicallChecks.isCallback) {\n if (multicallChecks.hasExtendedResolver) {\n return (\n true,\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\n );\n }\n return (_checkInterface(resolver, bytes4(item)), item);\n }\n return (true, item);\n }\n\n function _checkMulticall(\n MulticallData memory multicallData\n ) internal view returns (MulticallChecks memory) {\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _checkInterface(\n multicallData.resolver,\n type(IExtendedResolver).interfaceId\n );\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n return MulticallChecks(isCallback, hasExtendedResolver);\n }\n\n function _checkResolveSingle(Result memory result) internal pure {\n if (!result.success) {\n if (bytes4(result.returnData) == HttpError.selector) {\n bytes memory returnData = result.returnData;\n assembly {\n revert(add(returnData, 32), mload(returnData))\n }\n }\n revert ResolverError(result.returnData);\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (Result[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new Result[](length);\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n\n if (failure) {\n results[i] = Result(false, item);\n continue;\n }\n\n bool isSafe = false;\n (isSafe, item) = _checkSafetyAndItem(\n multicallData.name,\n item,\n multicallData.resolver,\n multicallChecks\n );\n\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(\n multicallData.resolver,\n item,\n isSafe\n );\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && multicallChecks.hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = Result(success, returnData);\n extraDatas[i].data = item;\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../../utils/BytesUtils.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../../utils/BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(\n name,\n wrappedOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../utils/BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable,\n ReverseClaimer\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE and set expiry to max */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the owner of a name\n * @param id Namehash of the name\n * @return operator Approved operator of a name\n */\n\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /**\n * @notice Approves an address for a name\n * @param to address to approve\n * @param tokenId name to approve\n */\n\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or operator of the owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or operator\n */\n\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Checks if owner/operator or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner/operator or approved\n */\n\n function canExtendSubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public returns (uint64 expiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // Set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (!_isWrapped(node)) {\n revert NameIsNotWrapped();\n }\n\n // this flag is used later, when checking fuses\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // Max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n address approved = getApproved(uint256(node));\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(parentNode, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /**\n * @notice Checks if a name is wrapped in a more gas efficient way\n * @param parentNode Namehash of the name\n * @param labelhash Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != ETH_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + }, + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {BytesUtils} from \"../../utils/BytesUtils.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external view override returns (bool) {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/solcInputs/a268c4117fbf03c1acd17a54ea249795.json b/solidity/dns-contracts/deployments/sepolia/solcInputs/a268c4117fbf03c1acd17a54ea249795.json new file mode 100644 index 0000000..f271bb7 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/solcInputs/a268c4117fbf03c1acd17a54ea249795.json @@ -0,0 +1,101 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n return functionStaticCall(target, data, gasleft());\n }\n\n /**\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @param gasLimit The gas limit to use for the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n uint256 gasLimit\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gasLimit,\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nerror ResolverNotContract();\n\nerror ResolverError(bytes returnData);\n\nerror HttpError(HttpErrorItem[] errors);\n\nstruct HttpErrorItem {\n uint16 status;\n string message;\n}\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct MulticallChecks {\n bool isCallback;\n bool hasExtendedResolver;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\nstruct Result {\n bool success;\n bytes returnData;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (Result[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (Result[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (Result[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (Result[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n if (!resolverAddress.isContract()) {\n revert ResolverNotContract();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory reverseResolvedData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n reverseResolvedData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (Result[] memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n Result[] memory results,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n Result memory result = results[0];\n\n if (!result.success) {\n revert ResolverError(result.returnData);\n }\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(result.returnData, (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n result.returnData,\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (Result[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data,\n bool isSafe\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n if (isSafe) {\n result = LowLevelCallUtils.functionStaticCall(target, data);\n } else {\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\n }\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _checkInterface(\n address resolver,\n bytes4 interfaceId\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _checkSafetyAndItem(\n bytes memory name,\n bytes memory item,\n address resolver,\n MulticallChecks memory multicallChecks\n ) internal view returns (bool, bytes memory) {\n if (!multicallChecks.isCallback) {\n if (multicallChecks.hasExtendedResolver) {\n return (\n true,\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\n );\n }\n return (_checkInterface(resolver, bytes4(item)), item);\n }\n return (true, item);\n }\n\n function _checkMulticall(\n MulticallData memory multicallData\n ) internal view returns (MulticallChecks memory) {\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _checkInterface(\n multicallData.resolver,\n type(IExtendedResolver).interfaceId\n );\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n return MulticallChecks(isCallback, hasExtendedResolver);\n }\n\n function _checkResolveSingle(Result memory result) internal pure {\n if (!result.success) {\n if (bytes4(result.returnData) == HttpError.selector) {\n (, HttpErrorItem[] memory errors) = abi.decode(\n result.returnData,\n (bytes4, HttpErrorItem[])\n );\n revert HttpError(errors);\n }\n revert ResolverError(result.returnData);\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (Result[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new Result[](length);\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n\n if (failure) {\n results[i] = Result(false, item);\n continue;\n }\n\n bool isSafe = false;\n (isSafe, item) = _checkSafetyAndItem(\n multicallData.name,\n item,\n multicallData.resolver,\n multicallChecks\n );\n\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(\n multicallData.resolver,\n item,\n isSafe\n );\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && multicallChecks.hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = Result(success, returnData);\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/solcInputs/b8a92c9207ae2a5ea22df4d7303f97f4.json b/solidity/dns-contracts/deployments/sepolia/solcInputs/b8a92c9207ae2a5ea22df4d7303f97f4.json new file mode 100644 index 0000000..068c6c5 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/solcInputs/b8a92c9207ae2a5ea22df4d7303f97f4.json @@ -0,0 +1,101 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n return functionStaticCall(target, data, gasleft());\n }\n\n /**\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @param gasLimit The gas limit to use for the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n uint256 gasLimit\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gasLimit,\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nerror ResolverNotContract();\n\nerror ResolverError(bytes returnData);\n\nerror HttpError(HttpErrorItem[] errors);\n\nstruct HttpErrorItem {\n uint16 status;\n string message;\n}\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct MulticallChecks {\n bool isCallback;\n bool hasExtendedResolver;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\nstruct Result {\n bool success;\n bytes returnData;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (Result[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (Result[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (Result[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (Result[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n if (!resolverAddress.isContract()) {\n revert ResolverNotContract();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory reverseResolvedData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n reverseResolvedData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (Result[] memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n Result[] memory results,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n Result memory result = results[0];\n\n if (!result.success) {\n revert ResolverError(result.returnData);\n }\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(result.returnData, (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n result.returnData,\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (Result[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data,\n bool isSafe\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n if (isSafe) {\n result = LowLevelCallUtils.functionStaticCall(target, data);\n } else {\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\n }\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _checkInterface(\n address resolver,\n bytes4 interfaceId\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _checkSafetyAndItem(\n bytes memory name,\n bytes memory item,\n address resolver,\n MulticallChecks memory multicallChecks\n ) internal view returns (bool, bytes memory) {\n if (!multicallChecks.isCallback) {\n if (multicallChecks.hasExtendedResolver) {\n return (\n true,\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\n );\n }\n return (_checkInterface(resolver, bytes4(item)), item);\n }\n return (true, item);\n }\n\n function _checkMulticall(\n MulticallData memory multicallData\n ) internal view returns (MulticallChecks memory) {\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _checkInterface(\n multicallData.resolver,\n type(IExtendedResolver).interfaceId\n );\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n return MulticallChecks(isCallback, hasExtendedResolver);\n }\n\n function _checkResolveSingle(Result memory result) internal pure {\n if (!result.success) {\n if (bytes4(result.returnData) == HttpError.selector) {\n bytes memory returnData = result.returnData;\n assembly {\n revert(add(returnData, 32), mload(returnData))\n }\n }\n revert ResolverError(result.returnData);\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (Result[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new Result[](length);\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n\n if (failure) {\n results[i] = Result(false, item);\n continue;\n }\n\n bool isSafe = false;\n (isSafe, item) = _checkSafetyAndItem(\n multicallData.name,\n item,\n multicallData.resolver,\n multicallChecks\n );\n\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(\n multicallData.resolver,\n item,\n isSafe\n );\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && multicallChecks.hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = Result(success, returnData);\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/solcInputs/d9c9257453e2e2db50b4d0f9157288b3.json b/solidity/dns-contracts/deployments/sepolia/solcInputs/d9c9257453e2e2db50b4d0f9157288b3.json new file mode 100644 index 0000000..c3d20f5 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/solcInputs/d9c9257453e2e2db50b4d0f9157288b3.json @@ -0,0 +1,431 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (iter.name().compareNames(buf.buf) != 0) continue;\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(\n uint16 _expectedType,\n bytes memory _expectedName,\n uint32 _inception,\n uint64 _inserted,\n bytes memory _proof\n ) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if (_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(\n uint16 dnstype,\n bytes memory name\n ) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyExtendedDNSSECResolver is IExtendedDNSResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes memory /* name */,\n bytes memory /* data */,\n bytes memory context\n ) external view override returns (bytes memory) {\n return abi.encode(context);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyLegacyTextResolver is ITextResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(ITextResolver).interfaceId;\n }\n\n function text(\n bytes32 /* node */,\n string calldata key\n ) external view override returns (string memory) {\n return key;\n }\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver {\n using RRUtils for *;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, data)\n );\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query) = abi.decode(\n extraData,\n (bytes, bytes)\n );\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n IExtendedDNSResolver(dnsresolver).resolve(\n name,\n query,\n context\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return IExtendedResolver(dnsresolver).resolve(name, query);\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (bytes memory key, bytes memory value, uint256 nextOffset)\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = input.length;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n nextOffset = terminator + 1;\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256[3] memory P) {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (uint256 x, uint256 y, uint256 z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(\n uint256 x0,\n uint256 y0\n ) internal pure returns (bool isZero) {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(\n uint256 scalar\n ) internal pure returns (uint256, uint256) {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(\n bytes calldata,\n bytes calldata\n ) external pure override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input\n )\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n )\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(\n RRUtils.SignedSet memory rrset,\n uint16 typecovered\n ) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if (address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns (bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 {\n totallen := add(totallen, 64)\n }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for {\n let i := 0\n } lt(i, totallen) {\n i := add(i, 64)\n } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 {\n mstore8(add(scratch, sub(len, i)), 0x80)\n }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 {\n mstore(\n add(scratch, 32),\n or(mload(add(scratch, 32)), mul(len, 8))\n )\n }\n\n // Expand the 16 32-bit words into 80\n for {\n let j := 64\n } lt(j, 128) {\n j := add(j, 12)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 12))),\n mload(add(scratch, sub(j, 32)))\n ),\n xor(\n mload(add(scratch, sub(j, 56))),\n mload(add(scratch, sub(j, 64)))\n )\n )\n temp := or(\n and(\n mul(temp, 2),\n 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE\n ),\n and(\n div(temp, 0x80000000),\n 0x0000000100000001000000010000000100000001000000010000000100000001\n )\n )\n mstore(add(scratch, j), temp)\n }\n for {\n let j := 128\n } lt(j, 320) {\n j := add(j, 24)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 24))),\n mload(add(scratch, sub(j, 64)))\n ),\n xor(\n mload(add(scratch, sub(j, 112))),\n mload(add(scratch, sub(j, 128)))\n )\n )\n temp := or(\n and(\n mul(temp, 4),\n 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC\n ),\n and(\n div(temp, 0x40000000),\n 0x0000000300000003000000030000000300000003000000030000000300000003\n )\n )\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for {\n let j := 0\n } lt(j, 80) {\n j := add(j, 1)\n } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(\n div(x, 0x100000000000000000000),\n div(x, 0x10000000000)\n )\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := and(div(x, 0x10000000000), f)\n f := or(\n and(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n ),\n f\n )\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(\n div(\n x,\n 0x80000000000000000000000000000000000000000000000\n ),\n 0x1F\n )\n temp := or(\n and(\n div(x, 0x800000000000000000000000000000000000000),\n 0xFFFFFFE0\n ),\n temp\n )\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(\n div(\n mload(add(scratch, mul(j, 4))),\n 0x100000000000000000000000000000000000000000000000000000000\n ),\n temp\n )\n x := or(\n div(x, 0x10000000000),\n mul(temp, 0x10000000000000000000000000000000000000000)\n )\n x := or(\n and(\n x,\n 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF\n ),\n mul(\n or(\n and(div(x, 0x4000000000000), 0xC0000000),\n and(div(x, 0x400000000000000000000), 0x3FFFFFFF)\n ),\n 0x100000000000000000000\n )\n )\n }\n\n h := and(\n add(h, x),\n 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF\n )\n }\n ret := mul(\n or(\n or(\n or(\n or(\n and(\n div(h, 0x100000000),\n 0xFFFFFFFF00000000000000000000000000000000\n ),\n and(\n div(h, 0x1000000),\n 0xFFFFFFFF000000000000000000000000\n )\n ),\n and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)\n ),\n and(div(h, 0x100), 0xFFFFFFFF00000000)\n ),\n and(h, 0xFFFFFFFF)\n ),\n 0x1000000000000000000000000\n )\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/ILinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface ILinearPremiumPriceOracle {\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256);\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns (address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping(bytes32 => address) addresses;\n\n constructor() public {}\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Implements a dummy NameWrapper which returns the caller's address\n */\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ReverseClaimer\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/TestHexUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {HexUtils} from \"./HexUtils.sol\";\n\ncontract TestHexUtils {\n using HexUtils for *;\n\n function hexStringToBytes32(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes32, bool) {\n return name.hexStringToBytes32(idx, lastInx);\n }\n\n function hexToAddress(\n bytes calldata input,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (address, bool) {\n return input.hexToAddress(idx, lastInx);\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(\n string memory name\n ) public pure returns (bytes memory, bytes32) {\n return name.dnsEncodeName();\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (bytes[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n return (results, address(0));\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes[] memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (bytes[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n result = LowLevelCallUtils.functionStaticCall(address(target), data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = revertData;\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _hasExtendedResolver(\n address resolver\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(\n type(IExtendedResolver).interfaceId\n )\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (bytes[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _hasExtendedResolver(multicallData.resolver);\n\n require(\n !multicallData.isWildcard || hasExtendedResolver,\n \"UniversalResolver: Wildcard on non-extended resolvers is not supported\"\n );\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = item;\n continue;\n }\n if (!isCallback && hasExtendedResolver) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = returnData;\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(\n name,\n wrappedOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable,\n ReverseClaimer\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE and set expiry to max */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the owner of a name\n * @param id Namehash of the name\n * @return operator Approved operator of a name\n */\n\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /**\n * @notice Approves an address for a name\n * @param to address to approve\n * @param tokenId name to approve\n */\n\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or operator of the owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or operator\n */\n\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Checks if owner/operator or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner/operator or approved\n */\n\n function canExtendSubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public returns (uint64 expiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // Set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (!_isWrapped(node)) {\n revert NameIsNotWrapped();\n }\n\n // this flag is used later, when checking fuses\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // Max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n address approved = getApproved(uint256(node));\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(parentNode, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /**\n * @notice Checks if a name is wrapped in a more gas efficient way\n * @param parentNode Namehash of the name\n * @param labelhash Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != ETH_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + }, + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external view override returns (bool) {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32, uint256) {\n return name.readLabel(offset);\n }\n\n function namehash(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32) {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\n \"\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n require(\n \"foo\".keccak(0, 3) ==\n bytes32(\n 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d\n ),\n \"Incorrect hash of 'foo'\"\n );\n require(\n \"foo\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\n \"hello\".equals(1, \"ello\") == true,\n \"Substring to string equality\"\n );\n require(\n \"hello\".equals(1, \"jello\", 1, 4) == true,\n \"Substring to substring equality\"\n );\n require(\n \"zhello\".equals(1, \"abchello\", 3) == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"0x0102030000\".equals(0, \"0x010203\") == false,\n \"Compare with offset and trailing bytes\"\n );\n }\n\n function testComparePartial() public pure {\n require(\n \"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true,\n \"Compare same length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true,\n \"Compare different length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true,\n \"Compare same with different offset\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 33\n ) ==\n 0 ==\n true,\n \"Compare different long strings same length smaller partial length which must be equal\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 34\n ) <\n 0 ==\n true,\n \"Compare long strings same length different partial length\"\n );\n require(\n \"0123456789012345012345678901234a\".compare(\n 0,\n 32,\n \"0123456789012345012345678901234b\",\n 0,\n 32\n ) <\n 0 ==\n true,\n \"Compare strings exactly 32 characters long\"\n );\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\n \"a\".compare(\"b\") < 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"b\".compare(\"a\") > 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"aa\".compare(\"ab\") < 0 == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"a\".compare(\"aa\") < 0 == true,\n \"Compare different value with different length\"\n );\n require(\n \"aa\".compare(\"a\") > 0 == true,\n \"Compare different value with different length\"\n );\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(\n longChar.compare(longChar) == 0 == true,\n \"Compares more than 32 bytes char\"\n );\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(\n longChar.compare(otherLongChar) < 0 == true,\n \"Compare long char with difference at start\"\n );\n }\n\n function testSubstring() public pure {\n require(\n keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")),\n \"Copy 0 bytes\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 4))) ==\n keccak256(bytes(\"hell\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(1, 4))) ==\n keccak256(bytes(\"ello\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 5))) ==\n keccak256(bytes(\"hello\")),\n \"Copy whole string\"\n );\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(\n bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) ==\n bytes32(\n 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000\n ),\n \"readBytes20\"\n );\n }\n\n function testReadBytes32() public pure {\n require(\n \"0123456789abcdef0123456789abcdef\".readBytes32(0) ==\n bytes32(\n 0x3031323334353637383961626364656630313233343536373839616263646566\n ),\n \"readBytes32\"\n );\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\n \"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")),\n \"Decode 'a'\"\n );\n require(\n \"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")),\n \"Decode 'aa'\"\n );\n require(\n \"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")),\n \"Decode 'aaa'\"\n );\n require(\n \"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")),\n \"Decode 'aaaa'\"\n );\n require(\n \"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa'\"\n );\n require(\n \"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa' lowercase\"\n );\n require(\n \"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet\"\n );\n require(\n \"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet lowercase\"\n );\n require(\n \"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\"\n .base32HexDecodeWord(0, 52) ==\n bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"),\n \"Decode 32*'a'\"\n );\n require(\n \" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\"\n .base32HexDecodeWord(1, 32) ==\n bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"),\n \"Decode real bytes32hex\"\n );\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex\"00\".nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex\"00\".labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex\"016100\".labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(\n hex\"016201610000\".labelCount(0) == 2,\n \"labelCount('b.a.') == 2\"\n );\n require(\n hex\"066574686c61620378797a00\".labelCount(6 + 1) == 1,\n \"nameLength('(bthlab).xyz.') == 6\"\n );\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes\n memory rrs = hex\"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101\";\n bytes[2] memory names = [bytes(hex\"016100\"), bytes(hex\"0162016100\")];\n bytes[2] memory rdatas = [bytes(hex\"74000001\"), bytes(hex\"c0a80101\")];\n uint i = 0;\n for (\n RRUtils.RRIterator memory iter = rrs.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(\n keccak256(iter.name()) == keccak256(names[i]),\n \"Name matches\"\n );\n require(\n keccak256(iter.rdata()) == keccak256(rdatas[i]),\n \"Rdata matches\"\n );\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex\"066274686c61620378797a00\";\n bytes memory ethLabXyz = hex\"066574686c61620378797a00\";\n bytes memory xyz = hex\"0378797a00\";\n bytes memory a_b_c = hex\"01610162016300\";\n bytes memory b_b_c = hex\"01620162016300\";\n bytes memory c = hex\"016300\";\n bytes memory d = hex\"016400\";\n bytes memory a_d_c = hex\"01610164016300\";\n bytes memory b_a_c = hex\"01620161016300\";\n bytes memory ab_c_d = hex\"0261620163016400\";\n bytes memory a_c_d = hex\"01610163016400\";\n bytes\n memory verylong1_eth = hex\"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n bytes\n memory verylong2_eth = hex\"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n\n require(\n hex\"0301616100\".compareNames(hex\"0302616200\") < 0,\n \"label lengths are correctly checked\"\n );\n require(\n a_b_c.compareNames(c) > 0,\n \"one name has a difference of >1 label to with the same root name\"\n );\n require(\n a_b_c.compareNames(d) < 0,\n \"one name has a difference of >1 label to with different root name\"\n );\n require(\n a_b_c.compareNames(a_d_c) < 0,\n \"two names start the same but have differences in later labels\"\n );\n require(\n a_b_c.compareNames(b_a_c) > 0,\n \"the first label sorts later, but the first label sorts earlier\"\n );\n require(\n ab_c_d.compareNames(a_c_d) > 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(\n a_b_c.compareNames(b_b_c) < 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(\n bthLabXyz.compareNames(ethLabXyz) < 0,\n \"bthLab.xyz comes before ethLab.xyz\"\n );\n require(\n bthLabXyz.compareNames(bthLabXyz) == 0,\n \"bthLab.xyz and bthLab.xyz are the same\"\n );\n require(\n ethLabXyz.compareNames(bthLabXyz) > 0,\n \"ethLab.xyz comes after bethLab.xyz\"\n );\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(\n verylong1_eth.compareNames(verylong2_eth) > 0,\n \"longa.vlong.eth comes after long.vlong.eth\"\n );\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(\n RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA),\n \"0x11111111 >= 0xAAAAAAAA\"\n );\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(\n hex\"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d\"\n .computeKeytag() == 19036,\n \"Invalid keytag\"\n );\n require(\n hex\"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf\"\n .computeKeytag() == 21693,\n \"Invalid keytag (2)\"\n );\n require(\n hex\"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3\"\n .computeKeytag() == 33630\n );\n require(\n hex\"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5\"\n .computeKeytag() == 20326,\n \"Invalid keytag (3)\"\n );\n }\n}\n" + }, + "test/registry/mocks/DummyResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyResolver {\n mapping(bytes32 => string) public name;\n\n function setName(bytes32 node, string memory _name) public {\n name[node] = _name;\n }\n}\n" + }, + "test/reverseRegistrar/mocks/MockReverseClaimerImplementer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../../../contracts/registry/ENS.sol\";\nimport {ReverseClaimer} from \"../../../contracts/reverseRegistrar/ReverseClaimer.sol\";\n\ncontract MockReverseClaimerImplementer is ReverseClaimer {\n constructor(ENS ens, address claimant) ReverseClaimer(ens, claimant) {}\n}\n" + }, + "test/utils/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n if (bytes4(extraData) == bytes4(keccak256(\"name(bytes32)\"))) {\n return abi.encode(\"offchain.test.eth\");\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "test/utils/mocks/LegacyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\ncontract LegacyResolver {\n function addr(bytes32 /* node */) public view returns (address) {\n return address(this);\n }\n}\n" + }, + "test/utils/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10 ** uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10 ** uint256(decimals()));\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1300 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/solcInputs/e04502f562d98d0455f6c1c453418cdd.json b/solidity/dns-contracts/deployments/sepolia/solcInputs/e04502f562d98d0455f6c1c453418cdd.json new file mode 100644 index 0000000..c0e2878 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/solcInputs/e04502f562d98d0455f6c1c453418cdd.json @@ -0,0 +1,431 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (iter.name().compareNames(buf.buf) != 0) continue;\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(\n uint16 _expectedType,\n bytes memory _expectedName,\n uint32 _inception,\n uint64 _inserted,\n bytes memory _proof\n ) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if (_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(\n uint16 dnstype,\n bytes memory name\n ) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyExtendedDNSSECResolver is IExtendedDNSResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes memory /* name */,\n bytes memory /* data */,\n bytes memory context\n ) external view override returns (bytes memory) {\n return abi.encode(context);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyLegacyTextResolver is ITextResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(ITextResolver).interfaceId;\n }\n\n function text(\n bytes32 /* node */,\n string calldata key\n ) external view override returns (string memory) {\n return key;\n }\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver {\n using RRUtils for *;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, data)\n );\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query) = abi.decode(\n extraData,\n (bytes, bytes)\n );\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n IExtendedDNSResolver(dnsresolver).resolve(\n name,\n query,\n context\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return IExtendedResolver(dnsresolver).resolve(name, query);\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (bytes memory key, bytes memory value, uint256 nextOffset)\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = input.length;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n nextOffset = terminator + 1;\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256[3] memory P) {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (uint256 x, uint256 y, uint256 z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(\n uint256 x0,\n uint256 y0\n ) internal pure returns (bool isZero) {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(\n uint256 scalar\n ) internal pure returns (uint256, uint256) {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"../BytesUtils.sol\";\nimport \"./RSAVerify.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../BytesUtils.sol\";\nimport \"./ModexpPrecompile.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(\n bytes calldata,\n bytes calldata\n ) external pure override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./BytesUtils.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input\n )\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n )\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(\n RRUtils.SignedSet memory rrset,\n uint16 typecovered\n ) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if (address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns (bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 {\n totallen := add(totallen, 64)\n }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for {\n let i := 0\n } lt(i, totallen) {\n i := add(i, 64)\n } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 {\n mstore8(add(scratch, sub(len, i)), 0x80)\n }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 {\n mstore(\n add(scratch, 32),\n or(mload(add(scratch, 32)), mul(len, 8))\n )\n }\n\n // Expand the 16 32-bit words into 80\n for {\n let j := 64\n } lt(j, 128) {\n j := add(j, 12)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 12))),\n mload(add(scratch, sub(j, 32)))\n ),\n xor(\n mload(add(scratch, sub(j, 56))),\n mload(add(scratch, sub(j, 64)))\n )\n )\n temp := or(\n and(\n mul(temp, 2),\n 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE\n ),\n and(\n div(temp, 0x80000000),\n 0x0000000100000001000000010000000100000001000000010000000100000001\n )\n )\n mstore(add(scratch, j), temp)\n }\n for {\n let j := 128\n } lt(j, 320) {\n j := add(j, 24)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 24))),\n mload(add(scratch, sub(j, 64)))\n ),\n xor(\n mload(add(scratch, sub(j, 112))),\n mload(add(scratch, sub(j, 128)))\n )\n )\n temp := or(\n and(\n mul(temp, 4),\n 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC\n ),\n and(\n div(temp, 0x40000000),\n 0x0000000300000003000000030000000300000003000000030000000300000003\n )\n )\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for {\n let j := 0\n } lt(j, 80) {\n j := add(j, 1)\n } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(\n div(x, 0x100000000000000000000),\n div(x, 0x10000000000)\n )\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := and(div(x, 0x10000000000), f)\n f := or(\n and(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n ),\n f\n )\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(\n div(\n x,\n 0x80000000000000000000000000000000000000000000000\n ),\n 0x1F\n )\n temp := or(\n and(\n div(x, 0x800000000000000000000000000000000000000),\n 0xFFFFFFE0\n ),\n temp\n )\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(\n div(\n mload(add(scratch, mul(j, 4))),\n 0x100000000000000000000000000000000000000000000000000000000\n ),\n temp\n )\n x := or(\n div(x, 0x10000000000),\n mul(temp, 0x10000000000000000000000000000000000000000)\n )\n x := or(\n and(\n x,\n 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF\n ),\n mul(\n or(\n and(div(x, 0x4000000000000), 0xC0000000),\n and(div(x, 0x400000000000000000000), 0x3FFFFFFF)\n ),\n 0x100000000000000000000\n )\n )\n }\n\n h := and(\n add(h, x),\n 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF\n )\n }\n ret := mul(\n or(\n or(\n or(\n or(\n and(\n div(h, 0x100000000),\n 0xFFFFFFFF00000000000000000000000000000000\n ),\n and(\n div(h, 0x1000000),\n 0xFFFFFFFF000000000000000000000000\n )\n ),\n and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)\n ),\n and(div(h, 0x100), 0xFFFFFFFF00000000)\n ),\n and(h, 0xFFFFFFFF)\n ),\n 0x1000000000000000000000000\n )\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /**\n * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n * @dev Returns whether the given spender can transfer a given token ID\n * @param spender address of the spender to query\n * @param tokenId uint256 ID of the token to be transferred\n * @return bool whether the msg.sender is approved for the given token ID,\n * is an operator of the owner, or is the owner of the token\n */\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /**\n * @dev Gets the owner of the specified token ID. Names become unowned\n * when their registration expires.\n * @param tokenId uint256 ID of the token to query the owner of\n * @return address currently marked as the owner of the given token ID\n */\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /**\n * @dev Register a name.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /**\n * @dev Register a name, without modifying the registry.\n * @param id The token ID (keccak256 of the label).\n * @param owner The address that should own the registration.\n * @param duration Duration in seconds for the registration.\n */\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] = block.timestamp + duration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"./StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/**\n * @dev A registrar controller for registering and renewing names at fixed cost.\n */\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override returns (IPriceOracle.Price memory price) {\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".eth\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/ILinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface ILinearPremiumPriceOracle {\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256);\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorInterface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns (address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"./StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface AggregatorInterface {\n function latestAnswer() external view returns (int256);\n}\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n AggregatorInterface public immutable usdOracle;\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorInterface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * 1e8) / ethPrice;\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n uint256 ethPrice = uint256(usdOracle.latestAnswer());\n return (amount * ethPrice) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping(bytes32 => address) addresses;\n\n constructor() public {}\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Implements a dummy NameWrapper which returns the caller's address\n */\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "pragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ReverseClaimer\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/TestHexUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {HexUtils} from \"./HexUtils.sol\";\n\ncontract TestHexUtils {\n using HexUtils for *;\n\n function hexStringToBytes32(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes32, bool) {\n return name.hexStringToBytes32(idx, lastInx);\n }\n\n function hexToAddress(\n bytes calldata input,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (address, bool) {\n return input.hexToAddress(idx, lastInx);\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(\n string memory name\n ) public pure returns (bytes memory, bytes32) {\n return name.dnsEncodeName();\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (bytes[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n return (results, address(0));\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes[] memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (bytes[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n result = LowLevelCallUtils.functionStaticCall(address(target), data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = revertData;\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _hasExtendedResolver(\n address resolver\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(\n type(IExtendedResolver).interfaceId\n )\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (bytes[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _hasExtendedResolver(multicallData.resolver);\n\n require(\n !multicallData.isWildcard || hasExtendedResolver,\n \"UniversalResolver: Wildcard on non-extended resolvers is not supported\"\n );\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = item;\n continue;\n }\n if (!isCallback && hasExtendedResolver) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = returnData;\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_ETH = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(\n name,\n wrappedOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_ETH, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"./BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable,\n ReverseClaimer\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n bytes32 private constant ETH_LABELHASH =\n 0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and ETH_NODE and set expiry to max */\n\n _setData(\n uint256(ETH_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[ETH_NODE] = \"\\x03eth\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /**\n * @notice Gets the owner of a name\n * @param id Label as a string of the .eth domain to wrap\n * @return owner The owner of the name\n */\n\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /**\n * @notice Gets the owner of a name\n * @param id Namehash of the name\n * @return operator Approved operator of a name\n */\n\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /**\n * @notice Approves an address for a name\n * @param to address to approve\n * @param tokenId name to approve\n */\n\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /**\n * @notice Gets the data for a name\n * @param id Namehash of the name\n * @return owner Owner of the name\n * @return fuses Fuses of the name\n * @return expiry Expiry of the name\n */\n\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /**\n * @notice Set the metadata service. Only the owner can do this\n * @param _metadataService The new metadata service\n */\n\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /**\n * @notice Get the metadata uri\n * @param tokenId The id of the token\n * @return string uri of the metadata service\n */\n\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /**\n * @notice Set the address of the upgradeContract of the contract. only admin can do this\n * @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n * to make the contract not upgradable.\n * @param _upgradeAddress address of an upgraded contract\n */\n\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /**\n * @notice Checks if msg.sender is the owner or operator of the owner of a name\n * @param node namehash of the name to check\n */\n\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /**\n * @notice Checks if owner or operator of the owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner or operator\n */\n\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Checks if owner/operator or approved by owner\n * @param node namehash of the name to check\n * @param addr which address to check permissions for\n * @return whether or not is owner/operator or approved\n */\n\n function canExtendSubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /**\n * @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n * @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n * @param label Label as a string of the .eth domain to wrap\n * @param wrappedOwner Owner of the name in this contract\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @param resolver Resolver contract address\n */\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public returns (uint64 expiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(ETH_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /**\n * @dev Registers a new .eth second-level domain and wraps it.\n * Only callable by authorised controllers.\n * @param label The label to register (Eg, 'foo' for 'foo.eth').\n * @param wrappedOwner The owner of the wrapped name.\n * @param duration The duration, in seconds, to register the name for.\n * @param resolver The resolver address to set on the ENS registry (optional).\n * @param ownerControlledFuses Initial owner-controlled fuses to set\n * @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /**\n * @notice Renews a .eth second-level domain.\n * @dev Only callable by authorised controllers.\n * @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n * @param duration The number of seconds to renew the name for.\n * @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n */\n\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(ETH_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // Set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /**\n * @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the registry or an authorised caller in the registry\n * @param name The name to wrap, in DNS format\n * @param wrappedOwner Owner of the name in this contract\n * @param resolver Resolver contract\n */\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /**\n * @notice Unwraps a .eth domain. e.g. vitalik.eth\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param labelhash Labelhash of the .eth domain\n * @param registrant Sets the owner in the .eth registrar to this address\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(ETH_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(ETH_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /**\n * @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n * @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param controller Sets the owner in the registry to this address\n */\n\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == ETH_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /**\n * @notice Sets fuses of a name\n * @param node Namehash of the name\n * @param ownerControlledFuses Owner-controlled fuses to burn\n * @return Old fuses\n */\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /**\n * @notice Extends expiry for a name\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return New expiry\n */\n\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (!_isWrapped(node)) {\n revert NameIsNotWrapped();\n }\n\n // this flag is used later, when checking fuses\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // Max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /**\n * @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n * @dev Can be called by the owner or an authorised caller\n * @param name The name to upgrade, in DNS format\n * @param extraData Extra data to pass to the upgrade contract\n */\n\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n address approved = getApproved(uint256(node));\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n /** \n /* @notice Sets fuses of a name that you own the parent of\n * @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n * @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n * @param fuses Fuses to burn\n * @param expiry When the name will expire in seconds since the Unix epoch\n */\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(parentNode, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /**\n * @notice Sets the subdomain owner in the registry and then wraps the subdomain\n * @param parentNode Parent namehash of the subdomain\n * @param label Label of the subdomain as a string\n * @param owner New owner in the wrapper\n * @param fuses Initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n * @param parentNode parent namehash of the subdomain\n * @param label label of the subdomain as a string\n * @param owner new owner in the wrapper\n * @param resolver resolver contract in the registry\n * @param ttl ttl in the registry\n * @param fuses initial fuses for the wrapped subdomain\n * @param expiry When the name will expire in seconds since the Unix epoch\n * @return node Namehash of the subdomain\n */\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /**\n * @notice Sets records for the name in the ENS Registry\n * @param node Namehash of the name to set a record for\n * @param owner New owner in the registry\n * @param resolver Resolver contract\n * @param ttl Time to live in the registry\n */\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /**\n * @notice Sets resolver contract in the registry\n * @param node namehash of the name\n * @param resolver the resolver contract\n */\n\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /**\n * @notice Sets TTL in the registry\n * @param node Namehash of the name\n * @param ttl TTL in the registry\n */\n\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /**\n * @dev Allows an operation only if none of the specified fuses are burned.\n * @param node The namehash of the name to check fuses on.\n * @param fuseMask A bitmask of fuses that must not be burned.\n */\n\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /**\n * @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n * @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n * and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n * replacing a subdomain. If either conditions are true, then it is possible to call\n * setSubnodeOwner\n * @param parentNode Namehash of the parent name to check\n * @param subnode Namehash of the subname to check\n */\n\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /**\n * @notice Checks all Fuses in the mask are burned for the node\n * @param node Namehash of the name\n * @param fuseMask The fuses you want to check\n * @return Boolean of whether or not all the selected fuses are burned\n */\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /**\n * @notice Checks if a name is wrapped\n * @param node Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /**\n * @notice Checks if a name is wrapped in a more gas efficient way\n * @param parentNode Namehash of the name\n * @param labelhash Namehash of the name\n * @return Boolean of whether or not the name is wrapped\n */\n\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != ETH_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_ETH == IS_DOT_ETH) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(ETH_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x03eth\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_ETH,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_ETH == IS_DOT_ETH &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + }, + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external view override returns (bool) {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"../BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32, uint256) {\n return name.readLabel(offset);\n }\n\n function namehash(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32) {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + }, + "test/dnssec-oracle/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\n \"\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n require(\n \"foo\".keccak(0, 3) ==\n bytes32(\n 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d\n ),\n \"Incorrect hash of 'foo'\"\n );\n require(\n \"foo\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\n \"hello\".equals(1, \"ello\") == true,\n \"Substring to string equality\"\n );\n require(\n \"hello\".equals(1, \"jello\", 1, 4) == true,\n \"Substring to substring equality\"\n );\n require(\n \"zhello\".equals(1, \"abchello\", 3) == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"0x0102030000\".equals(0, \"0x010203\") == false,\n \"Compare with offset and trailing bytes\"\n );\n }\n\n function testComparePartial() public pure {\n require(\n \"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true,\n \"Compare same length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true,\n \"Compare different length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true,\n \"Compare same with different offset\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 33\n ) ==\n 0 ==\n true,\n \"Compare different long strings same length smaller partial length which must be equal\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 34\n ) <\n 0 ==\n true,\n \"Compare long strings same length different partial length\"\n );\n require(\n \"0123456789012345012345678901234a\".compare(\n 0,\n 32,\n \"0123456789012345012345678901234b\",\n 0,\n 32\n ) <\n 0 ==\n true,\n \"Compare strings exactly 32 characters long\"\n );\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\n \"a\".compare(\"b\") < 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"b\".compare(\"a\") > 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"aa\".compare(\"ab\") < 0 == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"a\".compare(\"aa\") < 0 == true,\n \"Compare different value with different length\"\n );\n require(\n \"aa\".compare(\"a\") > 0 == true,\n \"Compare different value with different length\"\n );\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(\n longChar.compare(longChar) == 0 == true,\n \"Compares more than 32 bytes char\"\n );\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(\n longChar.compare(otherLongChar) < 0 == true,\n \"Compare long char with difference at start\"\n );\n }\n\n function testSubstring() public pure {\n require(\n keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")),\n \"Copy 0 bytes\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 4))) ==\n keccak256(bytes(\"hell\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(1, 4))) ==\n keccak256(bytes(\"ello\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 5))) ==\n keccak256(bytes(\"hello\")),\n \"Copy whole string\"\n );\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(\n bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) ==\n bytes32(\n 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000\n ),\n \"readBytes20\"\n );\n }\n\n function testReadBytes32() public pure {\n require(\n \"0123456789abcdef0123456789abcdef\".readBytes32(0) ==\n bytes32(\n 0x3031323334353637383961626364656630313233343536373839616263646566\n ),\n \"readBytes32\"\n );\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\n \"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")),\n \"Decode 'a'\"\n );\n require(\n \"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")),\n \"Decode 'aa'\"\n );\n require(\n \"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")),\n \"Decode 'aaa'\"\n );\n require(\n \"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")),\n \"Decode 'aaaa'\"\n );\n require(\n \"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa'\"\n );\n require(\n \"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa' lowercase\"\n );\n require(\n \"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet\"\n );\n require(\n \"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet lowercase\"\n );\n require(\n \"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\"\n .base32HexDecodeWord(0, 52) ==\n bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"),\n \"Decode 32*'a'\"\n );\n require(\n \" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\"\n .base32HexDecodeWord(1, 32) ==\n bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"),\n \"Decode real bytes32hex\"\n );\n }\n}\n" + }, + "test/dnssec-oracle/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/dnssec-oracle/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex\"00\".nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex\"00\".labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex\"016100\".labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(\n hex\"016201610000\".labelCount(0) == 2,\n \"labelCount('b.a.') == 2\"\n );\n require(\n hex\"066574686c61620378797a00\".labelCount(6 + 1) == 1,\n \"nameLength('(bthlab).xyz.') == 6\"\n );\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes\n memory rrs = hex\"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101\";\n bytes[2] memory names = [bytes(hex\"016100\"), bytes(hex\"0162016100\")];\n bytes[2] memory rdatas = [bytes(hex\"74000001\"), bytes(hex\"c0a80101\")];\n uint i = 0;\n for (\n RRUtils.RRIterator memory iter = rrs.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(\n keccak256(iter.name()) == keccak256(names[i]),\n \"Name matches\"\n );\n require(\n keccak256(iter.rdata()) == keccak256(rdatas[i]),\n \"Rdata matches\"\n );\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex\"066274686c61620378797a00\";\n bytes memory ethLabXyz = hex\"066574686c61620378797a00\";\n bytes memory xyz = hex\"0378797a00\";\n bytes memory a_b_c = hex\"01610162016300\";\n bytes memory b_b_c = hex\"01620162016300\";\n bytes memory c = hex\"016300\";\n bytes memory d = hex\"016400\";\n bytes memory a_d_c = hex\"01610164016300\";\n bytes memory b_a_c = hex\"01620161016300\";\n bytes memory ab_c_d = hex\"0261620163016400\";\n bytes memory a_c_d = hex\"01610163016400\";\n bytes\n memory verylong1_eth = hex\"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n bytes\n memory verylong2_eth = hex\"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n\n require(\n hex\"0301616100\".compareNames(hex\"0302616200\") < 0,\n \"label lengths are correctly checked\"\n );\n require(\n a_b_c.compareNames(c) > 0,\n \"one name has a difference of >1 label to with the same root name\"\n );\n require(\n a_b_c.compareNames(d) < 0,\n \"one name has a difference of >1 label to with different root name\"\n );\n require(\n a_b_c.compareNames(a_d_c) < 0,\n \"two names start the same but have differences in later labels\"\n );\n require(\n a_b_c.compareNames(b_a_c) > 0,\n \"the first label sorts later, but the first label sorts earlier\"\n );\n require(\n ab_c_d.compareNames(a_c_d) > 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(\n a_b_c.compareNames(b_b_c) < 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(\n bthLabXyz.compareNames(ethLabXyz) < 0,\n \"bthLab.xyz comes before ethLab.xyz\"\n );\n require(\n bthLabXyz.compareNames(bthLabXyz) == 0,\n \"bthLab.xyz and bthLab.xyz are the same\"\n );\n require(\n ethLabXyz.compareNames(bthLabXyz) > 0,\n \"ethLab.xyz comes after bethLab.xyz\"\n );\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(\n verylong1_eth.compareNames(verylong2_eth) > 0,\n \"longa.vlong.eth comes after long.vlong.eth\"\n );\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(\n RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA),\n \"0x11111111 >= 0xAAAAAAAA\"\n );\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(\n hex\"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d\"\n .computeKeytag() == 19036,\n \"Invalid keytag\"\n );\n require(\n hex\"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf\"\n .computeKeytag() == 21693,\n \"Invalid keytag (2)\"\n );\n require(\n hex\"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3\"\n .computeKeytag() == 33630\n );\n require(\n hex\"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5\"\n .computeKeytag() == 20326,\n \"Invalid keytag (3)\"\n );\n }\n}\n" + }, + "test/registry/mocks/DummyResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyResolver {\n mapping(bytes32 => string) public name;\n\n function setName(bytes32 node, string memory _name) public {\n name[node] = _name;\n }\n}\n" + }, + "test/reverseRegistrar/mocks/MockReverseClaimerImplementer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../../../contracts/registry/ENS.sol\";\nimport {ReverseClaimer} from \"../../../contracts/reverseRegistrar/ReverseClaimer.sol\";\n\ncontract MockReverseClaimerImplementer is ReverseClaimer {\n constructor(ENS ens, address claimant) ReverseClaimer(ens, claimant) {}\n}\n" + }, + "test/utils/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n if (bytes4(extraData) == bytes4(keccak256(\"name(bytes32)\"))) {\n return abi.encode(\"offchain.test.eth\");\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "test/utils/mocks/LegacyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\ncontract LegacyResolver {\n function addr(bytes32 /* node */) public view returns (address) {\n return address(this);\n }\n}\n" + }, + "test/utils/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10 ** uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10 ** uint256(decimals()));\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } + } \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/sepolia/solcInputs/ea9be46ec701408bd25e3fccf2728148.json b/solidity/dns-contracts/deployments/sepolia/solcInputs/ea9be46ec701408bd25e3fccf2728148.json new file mode 100644 index 0000000..32fd169 --- /dev/null +++ b/solidity/dns-contracts/deployments/sepolia/solcInputs/ea9be46ec701408bd25e3fccf2728148.json @@ -0,0 +1,164 @@ +{ + "language": "Solidity", + "sources": { + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (iter.name().compareNames(buf.buf) != 0) continue;\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyNonCCIPAwareResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../OffchainDNSResolver.sol\";\nimport \"../../resolvers/profiles/IExtendedResolver.sol\";\n\ncontract DummyNonCCIPAwareResolver is IExtendedResolver, ERC165 {\n OffchainDNSResolver dnsResolver;\n\n constructor(OffchainDNSResolver _dnsResolver) {\n dnsResolver = _dnsResolver;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(dnsResolver),\n urls,\n data,\n OffchainDNSResolver.resolveCallback.selector,\n data\n );\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyParser.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../dnssec-oracle/BytesUtils.sol\";\nimport \"../RecordParser.sol\";\n\ncontract DummyParser {\n using BytesUtils for bytes;\n\n // parse data in format: name;key1=value1 key2=value2;url\n function parseData(\n bytes memory data,\n uint256 kvCount\n )\n external\n pure\n returns (\n string memory name,\n string[] memory keys,\n string[] memory values,\n string memory url\n )\n {\n uint256 len = data.length;\n // retrieve name\n uint256 sep1 = data.find(0, len, \";\");\n name = string(data.substring(0, sep1));\n\n // retrieve url\n uint256 sep2 = data.find(sep1 + 1, len - sep1, \";\");\n url = string(data.substring(sep2 + 1, len - sep2 - 1));\n\n keys = new string[](kvCount);\n values = new string[](kvCount);\n // retrieve keys and values\n uint256 offset = sep1 + 1;\n for (uint256 i; i < kvCount && offset < len; i++) {\n (\n bytes memory key,\n bytes memory val,\n uint256 nextOffset\n ) = RecordParser.readKeyValue(data, offset, sep2 - offset);\n keys[i] = string(key);\n values[i] = string(val);\n offset = nextOffset;\n }\n }\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/BytesUtils.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"../utils/LowLevelCallUtils.sol\";\n\nerror InvalidOperation();\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver {\n using RRUtils for *;\n using Address for address;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n return\n callWithOffchainLookupPropagation(\n msg.sender,\n name,\n data,\n abi.encodeCall(IExtendedResolver.resolve, (name, data))\n );\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query) = abi.decode(\n extraData,\n (bytes, bytes)\n );\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n callWithOffchainLookupPropagation(\n dnsresolver,\n name,\n query,\n abi.encodeCall(\n IExtendedDNSResolver.resolve,\n (name, query, context)\n )\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return\n callWithOffchainLookupPropagation(\n dnsresolver,\n name,\n query,\n abi.encodeCall(\n IExtendedResolver.resolve,\n (name, query)\n )\n );\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory name,\n bytes memory innerdata,\n bytes memory data\n ) internal view returns (bytes memory) {\n if (target.isContract()) {\n bool result = LowLevelCallUtils.functionStaticCall(\n address(target),\n data\n );\n uint256 size = LowLevelCallUtils.returnDataSize();\n if (result) {\n bytes memory returnData = LowLevelCallUtils.readReturnData(\n 0,\n size\n );\n return abi.decode(returnData, (bytes));\n }\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n if (bytes4(errorId) == OffchainLookup.selector) {\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n (\n address sender,\n string[] memory urls,\n bytes memory callData,\n bytes4 innerCallbackFunction,\n bytes memory extraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n\n if (sender != target) {\n revert InvalidOperation();\n }\n\n revert OffchainLookup(\n address(this),\n urls,\n callData,\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(sender, innerCallbackFunction, extraData)\n );\n }\n }\n LowLevelCallUtils.propagateRevert();\n } else {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, innerdata)\n );\n }\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../dnssec-oracle/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (bytes memory key, bytes memory value, uint256 nextOffset)\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = len + offset;\n nextOffset = terminator;\n } else {\n nextOffset = terminator + 1;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n }\n}\n" + }, + "contracts/dnssec-oracle/BytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 60;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"../../resolvers/profiles/IAddressResolver.sol\";\nimport \"../../resolvers/profiles/IAddrResolver.sol\";\nimport \"../../utils/HexUtils.sol\";\n\ncontract ExtendedDNSResolver is IExtendedDNSResolver, IERC165 {\n using HexUtils for *;\n\n uint256 private constant COIN_TYPE_ETH = 60;\n\n error NotImplemented();\n error InvalidAddressFormat();\n\n function supportsInterface(\n bytes4 interfaceId\n ) external view virtual override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data,\n bytes calldata context\n ) external pure override returns (bytes memory) {\n bytes4 selector = bytes4(data);\n if (\n selector == IAddrResolver.addr.selector ||\n selector == IAddressResolver.addr.selector\n ) {\n if (selector == IAddressResolver.addr.selector) {\n (, uint256 coinType) = abi.decode(data[4:], (bytes32, uint256));\n if (coinType != COIN_TYPE_ETH) return abi.encode(\"\");\n }\n (address record, bool valid) = context.hexToAddress(\n 2,\n context.length\n );\n if (!valid) revert InvalidAddressFormat();\n return abi.encode(record);\n }\n revert NotImplemented();\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32 r, bool valid) {\n uint256 hexLength = lastIdx - idx;\n if ((hexLength != 64 && hexLength != 40) || hexLength % 2 == 1) {\n revert(\"Invalid string length\");\n }\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n r := or(shl(8, r), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gas(),\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/TestHexUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {HexUtils} from \"./HexUtils.sol\";\n\ncontract TestHexUtils {\n using HexUtils for *;\n\n function hexStringToBytes32(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes32, bool) {\n return name.hexStringToBytes32(idx, lastInx);\n }\n\n function hexToAddress(\n bytes calldata input,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (address, bool) {\n return input.hexToAddress(idx, lastInx);\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {BytesUtils} from \"../wrapper/BytesUtils.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (bytes[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (bytes[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (bytes[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n return (results[0], resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (bytes[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory resolvedReverseData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n resolvedReverseData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n return (results[0], resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes[] memory, address) {\n (bytes[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n bytes[] memory resolvedData,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(resolvedData[0], (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n resolvedData[0],\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (bytes[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n result = LowLevelCallUtils.functionStaticCall(address(target), data);\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _hasExtendedResolver(\n address resolver\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(\n type(IExtendedResolver).interfaceId\n )\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (bytes[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new bytes[](length);\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _hasExtendedResolver(multicallData.resolver);\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n if (failure) {\n results[i] = item;\n continue;\n }\n if (!isCallback && hasExtendedResolver) {\n item = abi.encodeCall(\n IExtendedResolver.resolve,\n (multicallData.name, item)\n );\n }\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(multicallData.resolver, item);\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = returnData;\n extraDatas[i].data = multicallData.data[i];\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nlibrary BytesUtils {\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/.chainId b/solidity/dns-contracts/deployments/testnet/.chainId new file mode 100644 index 0000000..c4fbb1c --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/.chainId @@ -0,0 +1 @@ +97 \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/.migrations.json b/solidity/dns-contracts/deployments/testnet/.migrations.json new file mode 100644 index 0000000..7cf4ab4 --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/.migrations.json @@ -0,0 +1,8 @@ +{ + "ens": 1751981536, + "root": 1751981539, + "setupRoot": 1751981553, + "legacy-resolver": 1751981615, + "legacy-controller": 1751981634, + "bulk-renewal": 1751981703 +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/BaseRegistrarImplementation.json b/solidity/dns-contracts/deployments/testnet/BaseRegistrarImplementation.json new file mode 100644 index 0000000..55d9d38 --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/BaseRegistrarImplementation.json @@ -0,0 +1,1026 @@ +{ + "address": "0x0393da9525982Be4C8b9812f8D2A877796fCA90b", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_baseNode", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "ControllerAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "ControllerRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameMigrated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRenewed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "GRACE_PERIOD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LIFETIME", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "addController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "available", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "baseNode", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "nameExpires", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "reclaim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "register", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "registerOnly", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "removeController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xf6af52d55b1dc889a9a2ae7ef03b80112a6adeb48eedd4de2c9dae1b0f9f024d", + "receipt": { + "to": null, + "from": "0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B", + "contractAddress": "0x0393da9525982Be4C8b9812f8D2A877796fCA90b", + "transactionIndex": 2, + "gasUsed": "1901152", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000400000000000000000000000020000000000000000000800000000000000000000000000000000400000000000010000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000800008000000000000000000000000000000000000000000000000000000000000000000020000000000002000000000000000000000000000000000000000000000000000000", + "blockHash": "0x3cfd5d819bec2f04c88ecb97a1187492909e93159d727c7f4f1e980efe1822d7", + "transactionHash": "0xf6af52d55b1dc889a9a2ae7ef03b80112a6adeb48eedd4de2c9dae1b0f9f024d", + "logs": [ + { + "transactionIndex": 2, + "blockNumber": 57534938, + "transactionHash": "0xf6af52d55b1dc889a9a2ae7ef03b80112a6adeb48eedd4de2c9dae1b0f9f024d", + "address": "0x0393da9525982Be4C8b9812f8D2A877796fCA90b", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000002a0d7311fa7e9ac2890cfd8219b2def0c206e79b" + ], + "data": "0x", + "logIndex": 3, + "blockHash": "0x3cfd5d819bec2f04c88ecb97a1187492909e93159d727c7f4f1e980efe1822d7" + } + ], + "blockNumber": 57534938, + "cumulativeGasUsed": "2080810", + "status": 1, + "byzantium": true + }, + "args": [ + "0x8390D472587cCAe988dD06Ccd456Ac70CcF39038", + "0x4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454" + ], + "numDeployments": 1, + "solcInputHash": "724226d00d816bea68b816df3bb6223c", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_baseNode\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"ControllerAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"ControllerRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameMigrated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameRenewed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"GRACE_PERIOD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"LIFETIME\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"addController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"available\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"baseNode\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"nameExpires\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"reclaim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"register\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"registerOnly\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"removeController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"renew\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"approve(address,uint256)\":{\"details\":\"See {IERC721-approve}.\"},\"balanceOf(address)\":{\"details\":\"See {IERC721-balanceOf}.\"},\"getApproved(uint256)\":{\"details\":\"See {IERC721-getApproved}.\"},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC721-isApprovedForAll}.\"},\"name()\":{\"details\":\"See {IERC721Metadata-name}.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"ownerOf(uint256)\":{\"details\":\"Gets the owner of the specified token ID. Names become unowned when their registration expires.\",\"params\":{\"tokenId\":\"uint256 ID of the token to query the owner of\"},\"returns\":{\"_0\":\"address currently marked as the owner of the given token ID\"}},\"reclaim(uint256,address)\":{\"details\":\"Reclaim ownership of a name in ENS, if you own it in the registrar.\"},\"register(uint256,address,uint256)\":{\"details\":\"Register a name.\",\"params\":{\"duration\":\"Duration in seconds for the registration.\",\"id\":\"The token ID (keccak256 of the label).\",\"owner\":\"The address that should own the registration.\"}},\"registerOnly(uint256,address,uint256)\":{\"details\":\"Register a name, without modifying the registry.\",\"params\":{\"duration\":\"Duration in seconds for the registration.\",\"id\":\"The token ID (keccak256 of the label).\",\"owner\":\"The address that should own the registration.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"safeTransferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-safeTransferFrom}.\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"details\":\"See {IERC721-safeTransferFrom}.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC721-setApprovalForAll}.\"},\"symbol()\":{\"details\":\"See {IERC721Metadata-symbol}.\"},\"tokenURI(uint256)\":{\"details\":\"See {IERC721Metadata-tokenURI}.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-transferFrom}.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/BaseRegistrarImplementation.sol\":\"BaseRegistrarImplementation\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/ERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721.sol\\\";\\nimport \\\"./IERC721Receiver.sol\\\";\\nimport \\\"./extensions/IERC721Metadata.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\nimport \\\"../../utils/Strings.sol\\\";\\nimport \\\"../../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\n * {ERC721Enumerable}.\\n */\\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\\n using Address for address;\\n using Strings for uint256;\\n\\n // Token name\\n string private _name;\\n\\n // Token symbol\\n string private _symbol;\\n\\n // Mapping from token ID to owner address\\n mapping(uint256 => address) private _owners;\\n\\n // Mapping owner address to token count\\n mapping(address => uint256) private _balances;\\n\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) private _tokenApprovals;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IERC721).interfaceId ||\\n interfaceId == type(IERC721Metadata).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721-balanceOf}.\\n */\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\n return _balances[owner];\\n }\\n\\n /**\\n * @dev See {IERC721-ownerOf}.\\n */\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\n address owner = _ownerOf(tokenId);\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n _requireMinted(tokenId);\\n\\n string memory baseURI = _baseURI();\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\n }\\n\\n /**\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\n * by default, can be overridden in child contracts.\\n */\\n function _baseURI() internal view virtual returns (string memory) {\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual override {\\n address owner = ERC721.ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\n _requireMinted(tokenId);\\n\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC721-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC721-isApprovedForAll}.\\n */\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[owner][operator];\\n }\\n\\n /**\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n _safeTransfer(from, to, tokenId, data);\\n }\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\n *\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\\n _transfer(from, to, tokenId);\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n }\\n\\n /**\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\n }\\n\\n /**\\n * @dev Returns whether `tokenId` exists.\\n *\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\n *\\n * Tokens start existing when they are minted (`_mint`),\\n * and stop existing when they are burned (`_burn`).\\n */\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\n return _ownerOf(tokenId) != address(0);\\n }\\n\\n /**\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\n address owner = ERC721.ownerOf(tokenId);\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\n }\\n\\n /**\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\n _safeMint(to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\n */\\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\\n _mint(to, tokenId);\\n require(\\n _checkOnERC721Received(address(0), to, tokenId, data),\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\n );\\n }\\n\\n /**\\n * @dev Mints `tokenId` and transfers it to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - `to` cannot be the zero address.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _mint(address to, uint256 tokenId) internal virtual {\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n _beforeTokenTransfer(address(0), to, tokenId, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _burn(uint256 tokenId) internal virtual {\\n address owner = ERC721.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\n }\\n\\n /**\\n * @dev Transfers `tokenId` from `from` to `to`.\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, tokenId, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Reverts if the `tokenId` has not been minted yet.\\n */\\n function _requireMinted(uint256 tokenId) internal view virtual {\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\n }\\n\\n /**\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\n * The call is not executed if the target address is not a contract.\\n *\\n * @param from address representing the previous owner of the given token ID\\n * @param to target address that will receive the tokens\\n * @param tokenId uint256 ID of the token to be transferred\\n * @param data bytes optional data to send along with the call\\n * @return bool whether the call correctly returned the expected magic value\\n */\\n function _checkOnERC721Received(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) private returns (bool) {\\n if (to.isContract()) {\\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721Receiver.onERC721Received.selector;\\n } catch (bytes memory reason) {\\n if (reason.length == 0) {\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n } else {\\n /// @solidity memory-safe-assembly\\n assembly {\\n revert(add(32, reason), mload(reason))\\n }\\n }\\n }\\n } else {\\n return true;\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\n }\\n}\\n\",\"keccak256\":\"0x2c309e7df9e05e6ce15bedfe74f3c61b467fc37e0fae9eab496acf5ea0bbd7ff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721Metadata is IERC721 {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/ethregistrar/BaseRegistrarImplementation.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/ERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\\n // A map of expiry times\\n mapping(uint256 => uint256) expiries;\\n // The ENS registry\\n ENS public ens;\\n // The namehash of the TLD this registrar owns (eg, .eth)\\n bytes32 public baseNode;\\n // A map of addresses that are authorised to register and renew names.\\n mapping(address => bool) public controllers;\\n uint256 public constant GRACE_PERIOD = 30 days;\\n uint256 public constant LIFETIME = type(uint256).max;\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n bytes4 private constant ERC721_ID =\\n bytes4(\\n keccak256(\\\"balanceOf(address)\\\") ^\\n keccak256(\\\"ownerOf(uint256)\\\") ^\\n keccak256(\\\"approve(address,uint256)\\\") ^\\n keccak256(\\\"getApproved(uint256)\\\") ^\\n keccak256(\\\"setApprovalForAll(address,bool)\\\") ^\\n keccak256(\\\"isApprovedForAll(address,address)\\\") ^\\n keccak256(\\\"transferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256,bytes)\\\")\\n );\\n bytes4 private constant RECLAIM_ID =\\n bytes4(keccak256(\\\"reclaim(uint256,address)\\\"));\\n\\n /// v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\\n /// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\\n /// @dev Returns whether the given spender can transfer a given token ID\\n /// @param spender address of the spender to query\\n /// @param tokenId uint256 ID of the token to be transferred\\n /// @return bool whether the msg.sender is approved for the given token ID,\\n /// is an operator of the owner, or is the owner of the token\\n function _isApprovedOrOwner(\\n address spender,\\n uint256 tokenId\\n ) internal view override returns (bool) {\\n address owner = ownerOf(tokenId);\\n return (spender == owner ||\\n getApproved(tokenId) == spender ||\\n isApprovedForAll(owner, spender));\\n }\\n\\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\\\"\\\", \\\"\\\") {\\n ens = _ens;\\n baseNode = _baseNode;\\n Ownable(msg.sender);\\n }\\n\\n modifier live() {\\n require(ens.owner(baseNode) == address(this));\\n _;\\n }\\n\\n modifier onlyController() {\\n require(controllers[msg.sender]);\\n _;\\n }\\n\\n /// @dev Gets the owner of the specified token ID. Names become unowned\\n /// when their registration expires.\\n /// @param tokenId uint256 ID of the token to query the owner of\\n /// @return address currently marked as the owner of the given token ID\\n function ownerOf(\\n uint256 tokenId\\n ) public view override(IERC721, ERC721) returns (address) {\\n require(expiries[tokenId] > block.timestamp);\\n return super.ownerOf(tokenId);\\n }\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external override onlyOwner {\\n controllers[controller] = true;\\n emit ControllerAdded(controller);\\n }\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external override onlyOwner {\\n controllers[controller] = false;\\n emit ControllerRemoved(controller);\\n }\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external override onlyOwner {\\n ens.setResolver(baseNode, resolver);\\n }\\n\\n // Returns the expiration timestamp of the specified id.\\n function nameExpires(uint256 id) external view override returns (uint256) {\\n return expiries[id];\\n }\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) public view override returns (bool) {\\n // Not available if it's registered here or in its grace period.\\n return expiries[id] + GRACE_PERIOD < block.timestamp;\\n }\\n\\n /// @dev Register a name.\\n /// @param id The token ID (keccak256 of the label).\\n /// @param owner The address that should own the registration.\\n /// @param duration Duration in seconds for the registration.\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external override virtual returns (uint256) {\\n return _register(id, owner, duration, true);\\n }\\n\\n /// @dev Register a name, without modifying the registry.\\n /// @param id The token ID (keccak256 of the label).\\n /// @param owner The address that should own the registration.\\n /// @param duration Duration in seconds for the registration.\\n function registerOnly(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256) {\\n return _register(id, owner, duration, false);\\n }\\n\\n function _register(\\n uint256 id,\\n address owner,\\n uint256 duration,\\n bool updateRegistry\\n ) internal live onlyController returns (uint256) {\\n require(available(id));\\n require(\\n block.timestamp + duration + GRACE_PERIOD >\\n block.timestamp + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n\\n uint256 expiration;\\n\\n if (duration == 31536000000) {\\n // Lifetime registration\\n expiration = LIFETIME;\\n } else {\\n // Annual registration\\n expiration = block.timestamp + duration;\\n }\\n\\n expiries[id] = expiration;\\n if (_exists(id)) {\\n // Name was previously owned, and expired\\n _burn(id);\\n }\\n _mint(owner, id);\\n if (updateRegistry) {\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n emit NameRegistered(id, owner, expiration);\\n\\n return expiration;\\n }\\n\\n function renew(\\n uint256 id,\\n uint256 duration\\n ) external override virtual live onlyController returns (uint256) {\\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\\n require(expiries[id] != LIFETIME, \\\"Lifetime names cannot be renewed\\\");\\n require(\\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] += duration;\\n emit NameRenewed(id, expiries[id]);\\n return expiries[id];\\n }\\n\\n /// @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n function reclaim(uint256 id, address owner) external override live {\\n require(_isApprovedOrOwner(msg.sender, id));\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view override(ERC721, IERC165) returns (bool) {\\n return\\n interfaceID == INTERFACE_META_ID ||\\n interfaceID == ERC721_ID ||\\n interfaceID == RECLAIM_ID;\\n }\\n\\n function _exists(uint256 tokenId) internal view override returns (bool) {\\n return super._exists(tokenId);\\n }\\n\\n}\\n\",\"keccak256\":\"0x0fbe9558e5bde9149cb2217db09eba430e9c6bdca70d72576a73d3a75886dd65\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/registry/ENS.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x8e208b44d5dbf22552fe72d79b45c640855b84fbc9ee21f4c3bb4bfe81cbe8db\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620022bc380380620022bc833981016040819052620000349162000109565b60408051602080820183526000808352835191820190935282815290916200005d8382620001ea565b5060016200006c8282620001ea565b5050506200008962000083620000b360201b60201c565b620000b7565b600880546001600160a01b0319166001600160a01b039390931692909217909155600955620002b6565b3390565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600080604083850312156200011d57600080fd5b82516001600160a01b03811681146200013557600080fd5b6020939093015192949293505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200017057607f821691505b6020821081036200019157634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620001e557600081815260208120601f850160051c81016020861015620001c05750805b601f850160051c820191505b81811015620001e157828155600101620001cc565b5050505b505050565b81516001600160401b0381111562000206576200020662000145565b6200021e816200021784546200015b565b8462000197565b602080601f8311600181146200025657600084156200023d5750858301515b600019600386901b1c1916600185901b178555620001e1565b600085815260208120601f198616915b82811015620002875788860151825594840194600190910190840162000266565b5085821015620002a65787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b611ff680620002c66000396000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c806396e494e811610104578063d3c576d8116100a2578063e985e9c511610071578063e985e9c5146103f4578063f2fde38b14610430578063f6a74ed714610443578063fca247ac1461045657600080fd5b8063d3c576d81461039f578063d6e4fa86146103a8578063da8c229e146103c8578063ddf7fcb0146103eb57600080fd5b8063b88d4fde116100de578063b88d4fde1461035c578063c1a287e21461036f578063c475abff14610379578063c87b56dd1461038c57600080fd5b806396e494e814610323578063a22cb46514610336578063a7fc7a071461034957600080fd5b80633f15457f1161017c57806370a082311161014b57806370a08231146102ef578063715018a6146103025780638da5cb5b1461030a57806395d89b411461031b57600080fd5b80633f15457f146102a357806342842e0e146102b65780634e543b26146102c95780636352211e146102dc57600080fd5b8063095ea7b3116101b8578063095ea7b3146102475780630e297b451461025c57806323b872dd1461027d57806328ed4f6c1461029057600080fd5b806301ffc9a7146101df57806306fdde0314610207578063081812fc1461021c575b600080fd5b6101f26101ed366004611b9f565b610469565b60405190151581526020015b60405180910390f35b61020f610506565b6040516101fe9190611c0c565b61022f61022a366004611c1f565b610598565b6040516001600160a01b0390911681526020016101fe565b61025a610255366004611c4d565b6105bf565b005b61026f61026a366004611c79565b6106f5565b6040519081526020016101fe565b61025a61028b366004611cb1565b61070c565b61025a61029e366004611ce1565b610793565b60085461022f906001600160a01b031681565b61025a6102c4366004611cb1565b6108ac565b61025a6102d7366004611d11565b6108c7565b61022f6102ea366004611c1f565b610955565b61026f6102fd366004611d11565b610978565b61025a610a12565b6006546001600160a01b031661022f565b61020f610a26565b6101f2610331366004611c1f565b610a35565b61025a610344366004611d2e565b610a5b565b61025a610357366004611d11565b610a6a565b61025a61036a366004611d77565b610abe565b61026f62278d0081565b61026f610387366004611e57565b610b4c565b61020f61039a366004611c1f565b610d3b565b61026f60001981565b61026f6103b6366004611c1f565b60009081526007602052604090205490565b6101f26103d6366004611d11565b600a6020526000908152604090205460ff1681565b61026f60095481565b6101f2610402366004611e79565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61025a61043e366004611d11565b610daf565b61025a610451366004611d11565b610e3f565b61026f610464366004611c79565b610e90565b60006001600160e01b031982167f01ffc9a70000000000000000000000000000000000000000000000000000000014806104cc57506001600160e01b031982167f80ac58cd00000000000000000000000000000000000000000000000000000000145b8061050057506001600160e01b031982167f28ed4f6c00000000000000000000000000000000000000000000000000000000145b92915050565b60606000805461051590611ea7565b80601f016020809104026020016040519081016040528092919081815260200182805461054190611ea7565b801561058e5780601f106105635761010080835404028352916020019161058e565b820191906000526020600020905b81548152906001019060200180831161057157829003601f168201915b5050505050905090565b60006105a382610e9f565b506000908152600460205260409020546001600160a01b031690565b60006105ca82610ef4565b9050806001600160a01b0316836001600160a01b0316036106585760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b038216148061067457506106748133610402565b6106e65760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161064f565b6106f08383610f59565b505050565b60006107048484846000610fd4565b949350505050565b61071633826111e7565b6107885760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f76656400000000000000000000000000000000000000606482015260840161064f565b6106f0838383611262565b6008546009546040516302571be360e01b8152600481019190915230916001600160a01b0316906302571be390602401602060405180830381865afa1580156107e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108049190611ee1565b6001600160a01b03161461081757600080fd5b61082133836111e7565b61082a57600080fd5b6008546009546040516306ab592360e01b81526004810191909152602481018490526001600160a01b038381166044830152909116906306ab5923906064016020604051808303816000875af1158015610888573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f09190611efe565b6106f083838360405180602001604052806000815250610abe565b6108cf611468565b6008546009546040517f1896f70a00000000000000000000000000000000000000000000000000000000815260048101919091526001600160a01b03838116602483015290911690631896f70a90604401600060405180830381600087803b15801561093a57600080fd5b505af115801561094e573d6000803e3d6000fd5b5050505050565b600081815260076020526040812054421061096f57600080fd5b61050082610ef4565b60006001600160a01b0382166109f65760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e65720000000000000000000000000000000000000000000000606482015260840161064f565b506001600160a01b031660009081526003602052604090205490565b610a1a611468565b610a2460006114c2565b565b60606001805461051590611ea7565b6000818152600760205260408120544290610a549062278d0090611f17565b1092915050565b610a66338383611521565b5050565b610a72611468565b6001600160a01b0381166000818152600a6020526040808220805460ff19166001179055517f0a8bb31534c0ed46f380cb867bd5c803a189ced9a764e30b3a4991a9901d74749190a250565b610ac833836111e7565b610b3a5760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f76656400000000000000000000000000000000000000606482015260840161064f565b610b46848484846115ef565b50505050565b6008546009546040516302571be360e01b8152600481019190915260009130916001600160a01b03909116906302571be390602401602060405180830381865afa158015610b9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc29190611ee1565b6001600160a01b031614610bd557600080fd5b336000908152600a602052604090205460ff16610bf157600080fd5b6000838152600760205260409020544290610c109062278d0090611f17565b1015610c1b57600080fd5b600083815260076020526040902054600101610c795760405162461bcd60e51b815260206004820181905260248201527f4c69666574696d65206e616d65732063616e6e6f742062652072656e65776564604482015260640161064f565b610c8662278d0083611f17565b60008481526007602052604090205462278d0090610ca5908590611f17565b610caf9190611f17565b11610cb957600080fd5b60008381526007602052604081208054849290610cd7908490611f17565b90915550506000838152600760205260409081902054905184917f9b87a00e30f1ac65d898f070f8a3488fe60517182d0a2098e1b4b93a54aa9bd691610d1f91815260200190565b60405180910390a2505060009081526007602052604090205490565b6060610d4682610e9f565b6000610d5d60408051602081019091526000815290565b90506000815111610d7d5760405180602001604052806000815250610da8565b80610d8784611678565b604051602001610d98929190611f38565b6040516020818303038152906040525b9392505050565b610db7611468565b6001600160a01b038116610e335760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161064f565b610e3c816114c2565b50565b610e47611468565b6001600160a01b0381166000818152600a6020526040808220805460ff19169055517f33d83959be2573f5453b12eb9d43b3499bc57d96bd2f067ba44803c859e811139190a250565b60006107048484846001610fd4565b610ea881611718565b610e3c5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161064f565b6000818152600260205260408120546001600160a01b0316806105005760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161064f565b6000818152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091558190610f9b82610ef4565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6008546009546040516302571be360e01b8152600481019190915260009130916001600160a01b03909116906302571be390602401602060405180830381865afa158015611026573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104a9190611ee1565b6001600160a01b03161461105d57600080fd5b336000908152600a602052604090205460ff1661107957600080fd5b61108285610a35565b61108b57600080fd5b61109862278d0042611f17565b62278d006110a68542611f17565b6110b09190611f17565b116110ba57600080fd5b600083640757b12c00036110d157506000196110de565b6110db8442611f17565b90505b60008681526007602052604090208190556110f886611718565b156111065761110686611737565b61111085876117d9565b821561119a576008546009546040516306ab592360e01b81526004810191909152602481018890526001600160a01b038781166044830152909116906306ab5923906064016020604051808303816000875af1158015611174573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111989190611efe565b505b846001600160a01b0316867fb3d987963d01b2f68493b4bdb130988f157ea43070d4ad840fee0466ed9370d9836040516111d691815260200190565b60405180910390a395945050505050565b6000806111f383610955565b9050806001600160a01b0316846001600160a01b0316148061122e5750836001600160a01b031661122384610598565b6001600160a01b0316145b8061070457506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff16610704565b826001600160a01b031661127582610ef4565b6001600160a01b0316146112d95760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161064f565b6001600160a01b0382166113545760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161064f565b826001600160a01b031661136782610ef4565b6001600160a01b0316146113cb5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161064f565b6000818152600460209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6006546001600160a01b03163314610a245760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161064f565b600680546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b0316036115825760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161064f565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6115fa848484611262565b61160684848484611953565b610b465760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161064f565b6060600061168583611aa7565b600101905060008167ffffffffffffffff8111156116a5576116a5611d61565b6040519080825280601f01601f1916602001820160405280156116cf576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85049450846116d957509392505050565b6000818152600260205260408120546001600160a01b03161515610500565b600061174282610ef4565b905061174d82610ef4565b6000838152600460209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b0385168085526003845282852080546000190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6001600160a01b03821661182f5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161064f565b61183881611718565b156118855760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161064f565b61188e81611718565b156118db5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161064f565b6001600160a01b0382166000818152600360209081526040808320805460010190558483526002909152808220805473ffffffffffffffffffffffffffffffffffffffff19168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160a01b0384163b15611a9f57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611997903390899088908890600401611f67565b6020604051808303816000875af19250505080156119d2575060408051601f3d908101601f191682019092526119cf91810190611fa3565b60015b611a85573d808015611a00576040519150601f19603f3d011682016040523d82523d6000602084013e611a05565b606091505b508051600003611a7d5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161064f565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610704565b506001610704565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310611af0577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310611b1c576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310611b3a57662386f26fc10000830492506010015b6305f5e1008310611b52576305f5e100830492506008015b6127108310611b6657612710830492506004015b60648310611b78576064830492506002015b600a83106105005760010192915050565b6001600160e01b031981168114610e3c57600080fd5b600060208284031215611bb157600080fd5b8135610da881611b89565b60005b83811015611bd7578181015183820152602001611bbf565b50506000910152565b60008151808452611bf8816020860160208601611bbc565b601f01601f19169290920160200192915050565b602081526000610da86020830184611be0565b600060208284031215611c3157600080fd5b5035919050565b6001600160a01b0381168114610e3c57600080fd5b60008060408385031215611c6057600080fd5b8235611c6b81611c38565b946020939093013593505050565b600080600060608486031215611c8e57600080fd5b833592506020840135611ca081611c38565b929592945050506040919091013590565b600080600060608486031215611cc657600080fd5b8335611cd181611c38565b92506020840135611ca081611c38565b60008060408385031215611cf457600080fd5b823591506020830135611d0681611c38565b809150509250929050565b600060208284031215611d2357600080fd5b8135610da881611c38565b60008060408385031215611d4157600080fd5b8235611d4c81611c38565b915060208301358015158114611d0657600080fd5b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215611d8d57600080fd5b8435611d9881611c38565b93506020850135611da881611c38565b925060408501359150606085013567ffffffffffffffff80821115611dcc57600080fd5b818701915087601f830112611de057600080fd5b813581811115611df257611df2611d61565b604051601f8201601f19908116603f01168101908382118183101715611e1a57611e1a611d61565b816040528281528a6020848701011115611e3357600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215611e6a57600080fd5b50508035926020909101359150565b60008060408385031215611e8c57600080fd5b8235611e9781611c38565b91506020830135611d0681611c38565b600181811c90821680611ebb57607f821691505b602082108103611edb57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611ef357600080fd5b8151610da881611c38565b600060208284031215611f1057600080fd5b5051919050565b8082018082111561050057634e487b7160e01b600052601160045260246000fd5b60008351611f4a818460208801611bbc565b835190830190611f5e818360208801611bbc565b01949350505050565b60006001600160a01b03808716835280861660208401525083604083015260806060830152611f996080830184611be0565b9695505050505050565b600060208284031215611fb557600080fd5b8151610da881611b8956fea26469706673582212207f6f29706d5de52fc554d1fba0f5eabab2475d9c3d19baee7552fed626e1866e64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101da5760003560e01c806396e494e811610104578063d3c576d8116100a2578063e985e9c511610071578063e985e9c5146103f4578063f2fde38b14610430578063f6a74ed714610443578063fca247ac1461045657600080fd5b8063d3c576d81461039f578063d6e4fa86146103a8578063da8c229e146103c8578063ddf7fcb0146103eb57600080fd5b8063b88d4fde116100de578063b88d4fde1461035c578063c1a287e21461036f578063c475abff14610379578063c87b56dd1461038c57600080fd5b806396e494e814610323578063a22cb46514610336578063a7fc7a071461034957600080fd5b80633f15457f1161017c57806370a082311161014b57806370a08231146102ef578063715018a6146103025780638da5cb5b1461030a57806395d89b411461031b57600080fd5b80633f15457f146102a357806342842e0e146102b65780634e543b26146102c95780636352211e146102dc57600080fd5b8063095ea7b3116101b8578063095ea7b3146102475780630e297b451461025c57806323b872dd1461027d57806328ed4f6c1461029057600080fd5b806301ffc9a7146101df57806306fdde0314610207578063081812fc1461021c575b600080fd5b6101f26101ed366004611b9f565b610469565b60405190151581526020015b60405180910390f35b61020f610506565b6040516101fe9190611c0c565b61022f61022a366004611c1f565b610598565b6040516001600160a01b0390911681526020016101fe565b61025a610255366004611c4d565b6105bf565b005b61026f61026a366004611c79565b6106f5565b6040519081526020016101fe565b61025a61028b366004611cb1565b61070c565b61025a61029e366004611ce1565b610793565b60085461022f906001600160a01b031681565b61025a6102c4366004611cb1565b6108ac565b61025a6102d7366004611d11565b6108c7565b61022f6102ea366004611c1f565b610955565b61026f6102fd366004611d11565b610978565b61025a610a12565b6006546001600160a01b031661022f565b61020f610a26565b6101f2610331366004611c1f565b610a35565b61025a610344366004611d2e565b610a5b565b61025a610357366004611d11565b610a6a565b61025a61036a366004611d77565b610abe565b61026f62278d0081565b61026f610387366004611e57565b610b4c565b61020f61039a366004611c1f565b610d3b565b61026f60001981565b61026f6103b6366004611c1f565b60009081526007602052604090205490565b6101f26103d6366004611d11565b600a6020526000908152604090205460ff1681565b61026f60095481565b6101f2610402366004611e79565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61025a61043e366004611d11565b610daf565b61025a610451366004611d11565b610e3f565b61026f610464366004611c79565b610e90565b60006001600160e01b031982167f01ffc9a70000000000000000000000000000000000000000000000000000000014806104cc57506001600160e01b031982167f80ac58cd00000000000000000000000000000000000000000000000000000000145b8061050057506001600160e01b031982167f28ed4f6c00000000000000000000000000000000000000000000000000000000145b92915050565b60606000805461051590611ea7565b80601f016020809104026020016040519081016040528092919081815260200182805461054190611ea7565b801561058e5780601f106105635761010080835404028352916020019161058e565b820191906000526020600020905b81548152906001019060200180831161057157829003601f168201915b5050505050905090565b60006105a382610e9f565b506000908152600460205260409020546001600160a01b031690565b60006105ca82610ef4565b9050806001600160a01b0316836001600160a01b0316036106585760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b038216148061067457506106748133610402565b6106e65760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161064f565b6106f08383610f59565b505050565b60006107048484846000610fd4565b949350505050565b61071633826111e7565b6107885760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f76656400000000000000000000000000000000000000606482015260840161064f565b6106f0838383611262565b6008546009546040516302571be360e01b8152600481019190915230916001600160a01b0316906302571be390602401602060405180830381865afa1580156107e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108049190611ee1565b6001600160a01b03161461081757600080fd5b61082133836111e7565b61082a57600080fd5b6008546009546040516306ab592360e01b81526004810191909152602481018490526001600160a01b038381166044830152909116906306ab5923906064016020604051808303816000875af1158015610888573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f09190611efe565b6106f083838360405180602001604052806000815250610abe565b6108cf611468565b6008546009546040517f1896f70a00000000000000000000000000000000000000000000000000000000815260048101919091526001600160a01b03838116602483015290911690631896f70a90604401600060405180830381600087803b15801561093a57600080fd5b505af115801561094e573d6000803e3d6000fd5b5050505050565b600081815260076020526040812054421061096f57600080fd5b61050082610ef4565b60006001600160a01b0382166109f65760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e65720000000000000000000000000000000000000000000000606482015260840161064f565b506001600160a01b031660009081526003602052604090205490565b610a1a611468565b610a2460006114c2565b565b60606001805461051590611ea7565b6000818152600760205260408120544290610a549062278d0090611f17565b1092915050565b610a66338383611521565b5050565b610a72611468565b6001600160a01b0381166000818152600a6020526040808220805460ff19166001179055517f0a8bb31534c0ed46f380cb867bd5c803a189ced9a764e30b3a4991a9901d74749190a250565b610ac833836111e7565b610b3a5760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f76656400000000000000000000000000000000000000606482015260840161064f565b610b46848484846115ef565b50505050565b6008546009546040516302571be360e01b8152600481019190915260009130916001600160a01b03909116906302571be390602401602060405180830381865afa158015610b9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc29190611ee1565b6001600160a01b031614610bd557600080fd5b336000908152600a602052604090205460ff16610bf157600080fd5b6000838152600760205260409020544290610c109062278d0090611f17565b1015610c1b57600080fd5b600083815260076020526040902054600101610c795760405162461bcd60e51b815260206004820181905260248201527f4c69666574696d65206e616d65732063616e6e6f742062652072656e65776564604482015260640161064f565b610c8662278d0083611f17565b60008481526007602052604090205462278d0090610ca5908590611f17565b610caf9190611f17565b11610cb957600080fd5b60008381526007602052604081208054849290610cd7908490611f17565b90915550506000838152600760205260409081902054905184917f9b87a00e30f1ac65d898f070f8a3488fe60517182d0a2098e1b4b93a54aa9bd691610d1f91815260200190565b60405180910390a2505060009081526007602052604090205490565b6060610d4682610e9f565b6000610d5d60408051602081019091526000815290565b90506000815111610d7d5760405180602001604052806000815250610da8565b80610d8784611678565b604051602001610d98929190611f38565b6040516020818303038152906040525b9392505050565b610db7611468565b6001600160a01b038116610e335760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161064f565b610e3c816114c2565b50565b610e47611468565b6001600160a01b0381166000818152600a6020526040808220805460ff19169055517f33d83959be2573f5453b12eb9d43b3499bc57d96bd2f067ba44803c859e811139190a250565b60006107048484846001610fd4565b610ea881611718565b610e3c5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161064f565b6000818152600260205260408120546001600160a01b0316806105005760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e2049440000000000000000604482015260640161064f565b6000818152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091558190610f9b82610ef4565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6008546009546040516302571be360e01b8152600481019190915260009130916001600160a01b03909116906302571be390602401602060405180830381865afa158015611026573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104a9190611ee1565b6001600160a01b03161461105d57600080fd5b336000908152600a602052604090205460ff1661107957600080fd5b61108285610a35565b61108b57600080fd5b61109862278d0042611f17565b62278d006110a68542611f17565b6110b09190611f17565b116110ba57600080fd5b600083640757b12c00036110d157506000196110de565b6110db8442611f17565b90505b60008681526007602052604090208190556110f886611718565b156111065761110686611737565b61111085876117d9565b821561119a576008546009546040516306ab592360e01b81526004810191909152602481018890526001600160a01b038781166044830152909116906306ab5923906064016020604051808303816000875af1158015611174573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111989190611efe565b505b846001600160a01b0316867fb3d987963d01b2f68493b4bdb130988f157ea43070d4ad840fee0466ed9370d9836040516111d691815260200190565b60405180910390a395945050505050565b6000806111f383610955565b9050806001600160a01b0316846001600160a01b0316148061122e5750836001600160a01b031661122384610598565b6001600160a01b0316145b8061070457506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff16610704565b826001600160a01b031661127582610ef4565b6001600160a01b0316146112d95760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161064f565b6001600160a01b0382166113545760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161064f565b826001600160a01b031661136782610ef4565b6001600160a01b0316146113cb5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161064f565b6000818152600460209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6006546001600160a01b03163314610a245760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161064f565b600680546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b0316036115825760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161064f565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6115fa848484611262565b61160684848484611953565b610b465760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161064f565b6060600061168583611aa7565b600101905060008167ffffffffffffffff8111156116a5576116a5611d61565b6040519080825280601f01601f1916602001820160405280156116cf576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85049450846116d957509392505050565b6000818152600260205260408120546001600160a01b03161515610500565b600061174282610ef4565b905061174d82610ef4565b6000838152600460209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b0385168085526003845282852080546000190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6001600160a01b03821661182f5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161064f565b61183881611718565b156118855760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161064f565b61188e81611718565b156118db5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161064f565b6001600160a01b0382166000818152600360209081526040808320805460010190558483526002909152808220805473ffffffffffffffffffffffffffffffffffffffff19168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160a01b0384163b15611a9f57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611997903390899088908890600401611f67565b6020604051808303816000875af19250505080156119d2575060408051601f3d908101601f191682019092526119cf91810190611fa3565b60015b611a85573d808015611a00576040519150601f19603f3d011682016040523d82523d6000602084013e611a05565b606091505b508051600003611a7d5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161064f565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610704565b506001610704565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310611af0577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310611b1c576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310611b3a57662386f26fc10000830492506010015b6305f5e1008310611b52576305f5e100830492506008015b6127108310611b6657612710830492506004015b60648310611b78576064830492506002015b600a83106105005760010192915050565b6001600160e01b031981168114610e3c57600080fd5b600060208284031215611bb157600080fd5b8135610da881611b89565b60005b83811015611bd7578181015183820152602001611bbf565b50506000910152565b60008151808452611bf8816020860160208601611bbc565b601f01601f19169290920160200192915050565b602081526000610da86020830184611be0565b600060208284031215611c3157600080fd5b5035919050565b6001600160a01b0381168114610e3c57600080fd5b60008060408385031215611c6057600080fd5b8235611c6b81611c38565b946020939093013593505050565b600080600060608486031215611c8e57600080fd5b833592506020840135611ca081611c38565b929592945050506040919091013590565b600080600060608486031215611cc657600080fd5b8335611cd181611c38565b92506020840135611ca081611c38565b60008060408385031215611cf457600080fd5b823591506020830135611d0681611c38565b809150509250929050565b600060208284031215611d2357600080fd5b8135610da881611c38565b60008060408385031215611d4157600080fd5b8235611d4c81611c38565b915060208301358015158114611d0657600080fd5b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215611d8d57600080fd5b8435611d9881611c38565b93506020850135611da881611c38565b925060408501359150606085013567ffffffffffffffff80821115611dcc57600080fd5b818701915087601f830112611de057600080fd5b813581811115611df257611df2611d61565b604051601f8201601f19908116603f01168101908382118183101715611e1a57611e1a611d61565b816040528281528a6020848701011115611e3357600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215611e6a57600080fd5b50508035926020909101359150565b60008060408385031215611e8c57600080fd5b8235611e9781611c38565b91506020830135611d0681611c38565b600181811c90821680611ebb57607f821691505b602082108103611edb57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611ef357600080fd5b8151610da881611c38565b600060208284031215611f1057600080fd5b5051919050565b8082018082111561050057634e487b7160e01b600052601160045260246000fd5b60008351611f4a818460208801611bbc565b835190830190611f5e818360208801611bbc565b01949350505050565b60006001600160a01b03808716835280861660208401525083604083015260806060830152611f996080830184611be0565b9695505050505050565b600060208284031215611fb557600080fd5b8151610da881611b8956fea26469706673582212207f6f29706d5de52fc554d1fba0f5eabab2475d9c3d19baee7552fed626e1866e64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "approve(address,uint256)": { + "details": "See {IERC721-approve}." + }, + "balanceOf(address)": { + "details": "See {IERC721-balanceOf}." + }, + "getApproved(uint256)": { + "details": "See {IERC721-getApproved}." + }, + "isApprovedForAll(address,address)": { + "details": "See {IERC721-isApprovedForAll}." + }, + "name()": { + "details": "See {IERC721Metadata-name}." + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "ownerOf(uint256)": { + "details": "Gets the owner of the specified token ID. Names become unowned when their registration expires.", + "params": { + "tokenId": "uint256 ID of the token to query the owner of" + }, + "returns": { + "_0": "address currently marked as the owner of the given token ID" + } + }, + "reclaim(uint256,address)": { + "details": "Reclaim ownership of a name in ENS, if you own it in the registrar." + }, + "register(uint256,address,uint256)": { + "details": "Register a name.", + "params": { + "duration": "Duration in seconds for the registration.", + "id": "The token ID (keccak256 of the label).", + "owner": "The address that should own the registration." + } + }, + "registerOnly(uint256,address,uint256)": { + "details": "Register a name, without modifying the registry.", + "params": { + "duration": "Duration in seconds for the registration.", + "id": "The token ID (keccak256 of the label).", + "owner": "The address that should own the registration." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "safeTransferFrom(address,address,uint256)": { + "details": "See {IERC721-safeTransferFrom}." + }, + "safeTransferFrom(address,address,uint256,bytes)": { + "details": "See {IERC721-safeTransferFrom}." + }, + "setApprovalForAll(address,bool)": { + "details": "See {IERC721-setApprovalForAll}." + }, + "symbol()": { + "details": "See {IERC721Metadata-symbol}." + }, + "tokenURI(uint256)": { + "details": "See {IERC721Metadata-tokenURI}." + }, + "transferFrom(address,address,uint256)": { + "details": "See {IERC721-transferFrom}." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 796, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_name", + "offset": 0, + "slot": "0", + "type": "t_string_storage" + }, + { + "astId": 798, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_symbol", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 802, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_owners", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint256,t_address)" + }, + { + "astId": 806, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_balances", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 810, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_tokenApprovals", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_uint256,t_address)" + }, + { + "astId": 816, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_operatorApprovals", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" + }, + { + "astId": 53, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "_owner", + "offset": 0, + "slot": "6", + "type": "t_address" + }, + { + "astId": 3462, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "expiries", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 3465, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "ens", + "offset": 0, + "slot": "8", + "type": "t_contract(ENS)9436" + }, + { + "astId": 3467, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "baseNode", + "offset": 0, + "slot": "9", + "type": "t_bytes32" + }, + { + "astId": 3471, + "contract": "contracts/ethregistrar/BaseRegistrarImplementation.sol:BaseRegistrarImplementation", + "label": "controllers", + "offset": 0, + "slot": "10", + "type": "t_mapping(t_address,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(ENS)9436": { + "encoding": "inplace", + "label": "contract ENS", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_address)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/ENSRegistry.json b/solidity/dns-contracts/deployments/testnet/ENSRegistry.json new file mode 100644 index 0000000..ea48527 --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/ENSRegistry.json @@ -0,0 +1,420 @@ +{ + "address": "0x8390D472587cCAe988dD06Ccd456Ac70CcF39038", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_old", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NewOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "NewResolver", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "NewTTL", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "old", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "recordExists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "resolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "ttl", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xcc399d21ec0ef604acf01288d1646dd66a782925895149efd4ed7f86e175ec7d", + "receipt": { + "to": null, + "from": "0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B", + "contractAddress": "0x8390D472587cCAe988dD06Ccd456Ac70CcF39038", + "transactionIndex": 3, + "gasUsed": "785195", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x65c2f29da293c6184a29650eb64d2c1f3bd03469b07c548cdc2b04af0723a5ff", + "transactionHash": "0xcc399d21ec0ef604acf01288d1646dd66a782925895149efd4ed7f86e175ec7d", + "logs": [], + "blockNumber": 57534930, + "cumulativeGasUsed": "1117312", + "status": 1, + "byzantium": true + }, + "args": [ + "0xDD41A110833F7d892dEe36d39fe421C22E853F45" + ], + "numDeployments": 1, + "bytecode": "0x608060405234801561001057600080fd5b50604051610d2e380380610d2e83398101604081905261002f91610089565b60008080526020527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb58054336001600160a01b031991821617909155600280549091166001600160a01b03929092169190911790556100b9565b60006020828403121561009b57600080fd5b81516001600160a01b03811681146100b257600080fd5b9392505050565b610c66806100c86000396000f3fe608060405234801561001057600080fd5b50600436106100df5760003560e01c80635b0fc9c31161008c578063b83f866311610066578063b83f8663146101d5578063cf408823146101e8578063e985e9c5146101fb578063f79fe5381461024757600080fd5b80635b0fc9c31461019c5780635ef2c7f0146101af578063a22cb465146101c257600080fd5b806314ab9038116100bd57806314ab90381461014857806316a25cbd1461015d5780631896f70a1461018957600080fd5b80630178b8bf146100e457806302571be31461011457806306ab592314610127575b600080fd5b6100f76100f2366004610a07565b610272565b6040516001600160a01b0390911681526020015b60405180910390f35b6100f7610122366004610a07565b61033b565b61013a610135366004610a38565b6103aa565b60405190815260200161010b565b61015b610156366004610a87565b61047a565b005b61017061016b366004610a07565b610561565b60405167ffffffffffffffff909116815260200161010b565b61015b610197366004610ab7565b61062b565b61015b6101aa366004610ab7565b6106fd565b61015b6101bd366004610adc565b61079f565b61015b6101d0366004610b3b565b6107c1565b6002546100f7906001600160a01b031681565b61015b6101f6366004610b6e565b61082d565b610237610209366004610bc1565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b604051901515815260200161010b565b610237610255366004610a07565b6000908152602081905260409020546001600160a01b0316151590565b6000818152602081905260408120546001600160a01b031661031b576002546040517f0178b8bf000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b0390911690630178b8bf906024015b602060405180830381865afa1580156102f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103159190610bef565b92915050565b6000828152602081905260409020600101546001600160a01b0316610315565b6000818152602081905260408120546001600160a01b03166103a1576002546040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b03909116906302571be3906024016102d4565b61031582610848565b60008381526020819052604081205484906001600160a01b0316338114806103f557506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6103fe57600080fd5b604080516020808201899052818301889052825180830384018152606090920190925280519101206104308186610870565b6040516001600160a01b0386168152869088907fce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e829060200160405180910390a39695505050505050565b60008281526020819052604090205482906001600160a01b0316338114806104c557506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6104ce57600080fd5b60405167ffffffffffffffff8416815284907f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa689060200160405180910390a25050600091825260208290526040909120600101805467ffffffffffffffff909216600160a01b027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff909216919091179055565b6000818152602081905260408120546001600160a01b0316610603576002546040517f16a25cbd000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b03909116906316a25cbd90602401602060405180830381865afa1580156105df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103159190610c13565b600082815260208190526040902060010154600160a01b900467ffffffffffffffff16610315565b60008281526020819052604090205482906001600160a01b03163381148061067657506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61067f57600080fd5b6040516001600160a01b038416815284907f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a09060200160405180910390a25050600091825260208290526040909120600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909216919091179055565b60008281526020819052604090205482906001600160a01b03163381148061074857506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61075157600080fd5b61075b8484610870565b6040516001600160a01b038416815284907fd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d2669060200160405180910390a250505050565b60006107ac8686866103aa565b90506107b98184846108c0565b505050505050565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61083784846106fd565b6108428483836108c0565b50505050565b6000818152602081905260408120546001600160a01b03163081036103155750600092915050565b806001600160a01b0381166108825750305b6000838152602081905260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316179055505050565b505050565b6000838152602081905260409020600101546001600160a01b038381169116146109535760008381526020818152604091829020600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038616908117909155915191825284917f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0910160405180910390a25b60008381526020819052604090206001015467ffffffffffffffff828116600160a01b90920416146108bb576000838152602081815260409182902060010180547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff16600160a01b67ffffffffffffffff861690810291909117909155915191825284917f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa68910160405180910390a2505050565b600060208284031215610a1957600080fd5b5035919050565b6001600160a01b0381168114610a3557600080fd5b50565b600080600060608486031215610a4d57600080fd5b83359250602084013591506040840135610a6681610a20565b809150509250925092565b67ffffffffffffffff81168114610a3557600080fd5b60008060408385031215610a9a57600080fd5b823591506020830135610aac81610a71565b809150509250929050565b60008060408385031215610aca57600080fd5b823591506020830135610aac81610a20565b600080600080600060a08688031215610af457600080fd5b85359450602086013593506040860135610b0d81610a20565b92506060860135610b1d81610a20565b91506080860135610b2d81610a71565b809150509295509295909350565b60008060408385031215610b4e57600080fd5b8235610b5981610a20565b915060208301358015158114610aac57600080fd5b60008060008060808587031215610b8457600080fd5b843593506020850135610b9681610a20565b92506040850135610ba681610a20565b91506060850135610bb681610a71565b939692955090935050565b60008060408385031215610bd457600080fd5b8235610bdf81610a20565b91506020830135610aac81610a20565b600060208284031215610c0157600080fd5b8151610c0c81610a20565b9392505050565b600060208284031215610c2557600080fd5b8151610c0c81610a7156fea2646970667358221220c7f6f27cf23711b751f3e6f40e5676136843e4e9eba4ed6a981b710d505108d964736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100df5760003560e01c80635b0fc9c31161008c578063b83f866311610066578063b83f8663146101d5578063cf408823146101e8578063e985e9c5146101fb578063f79fe5381461024757600080fd5b80635b0fc9c31461019c5780635ef2c7f0146101af578063a22cb465146101c257600080fd5b806314ab9038116100bd57806314ab90381461014857806316a25cbd1461015d5780631896f70a1461018957600080fd5b80630178b8bf146100e457806302571be31461011457806306ab592314610127575b600080fd5b6100f76100f2366004610a07565b610272565b6040516001600160a01b0390911681526020015b60405180910390f35b6100f7610122366004610a07565b61033b565b61013a610135366004610a38565b6103aa565b60405190815260200161010b565b61015b610156366004610a87565b61047a565b005b61017061016b366004610a07565b610561565b60405167ffffffffffffffff909116815260200161010b565b61015b610197366004610ab7565b61062b565b61015b6101aa366004610ab7565b6106fd565b61015b6101bd366004610adc565b61079f565b61015b6101d0366004610b3b565b6107c1565b6002546100f7906001600160a01b031681565b61015b6101f6366004610b6e565b61082d565b610237610209366004610bc1565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b604051901515815260200161010b565b610237610255366004610a07565b6000908152602081905260409020546001600160a01b0316151590565b6000818152602081905260408120546001600160a01b031661031b576002546040517f0178b8bf000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b0390911690630178b8bf906024015b602060405180830381865afa1580156102f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103159190610bef565b92915050565b6000828152602081905260409020600101546001600160a01b0316610315565b6000818152602081905260408120546001600160a01b03166103a1576002546040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b03909116906302571be3906024016102d4565b61031582610848565b60008381526020819052604081205484906001600160a01b0316338114806103f557506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6103fe57600080fd5b604080516020808201899052818301889052825180830384018152606090920190925280519101206104308186610870565b6040516001600160a01b0386168152869088907fce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e829060200160405180910390a39695505050505050565b60008281526020819052604090205482906001600160a01b0316338114806104c557506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6104ce57600080fd5b60405167ffffffffffffffff8416815284907f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa689060200160405180910390a25050600091825260208290526040909120600101805467ffffffffffffffff909216600160a01b027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff909216919091179055565b6000818152602081905260408120546001600160a01b0316610603576002546040517f16a25cbd000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b03909116906316a25cbd90602401602060405180830381865afa1580156105df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103159190610c13565b600082815260208190526040902060010154600160a01b900467ffffffffffffffff16610315565b60008281526020819052604090205482906001600160a01b03163381148061067657506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61067f57600080fd5b6040516001600160a01b038416815284907f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a09060200160405180910390a25050600091825260208290526040909120600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909216919091179055565b60008281526020819052604090205482906001600160a01b03163381148061074857506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61075157600080fd5b61075b8484610870565b6040516001600160a01b038416815284907fd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d2669060200160405180910390a250505050565b60006107ac8686866103aa565b90506107b98184846108c0565b505050505050565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61083784846106fd565b6108428483836108c0565b50505050565b6000818152602081905260408120546001600160a01b03163081036103155750600092915050565b806001600160a01b0381166108825750305b6000838152602081905260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316179055505050565b505050565b6000838152602081905260409020600101546001600160a01b038381169116146109535760008381526020818152604091829020600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038616908117909155915191825284917f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0910160405180910390a25b60008381526020819052604090206001015467ffffffffffffffff828116600160a01b90920416146108bb576000838152602081815260409182902060010180547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff16600160a01b67ffffffffffffffff861690810291909117909155915191825284917f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa68910160405180910390a2505050565b600060208284031215610a1957600080fd5b5035919050565b6001600160a01b0381168114610a3557600080fd5b50565b600080600060608486031215610a4d57600080fd5b83359250602084013591506040840135610a6681610a20565b809150509250925092565b67ffffffffffffffff81168114610a3557600080fd5b60008060408385031215610a9a57600080fd5b823591506020830135610aac81610a71565b809150509250929050565b60008060408385031215610aca57600080fd5b823591506020830135610aac81610a20565b600080600080600060a08688031215610af457600080fd5b85359450602086013593506040860135610b0d81610a20565b92506060860135610b1d81610a20565b91506080860135610b2d81610a71565b809150509295509295909350565b60008060408385031215610b4e57600080fd5b8235610b5981610a20565b915060208301358015158114610aac57600080fd5b60008060008060808587031215610b8457600080fd5b843593506020850135610b9681610a20565b92506040850135610ba681610a20565b91506060850135610bb681610a71565b939692955090935050565b60008060408385031215610bd457600080fd5b8235610bdf81610a20565b91506020830135610aac81610a20565b600060208284031215610c0157600080fd5b8151610c0c81610a20565b9392505050565b600060208284031215610c2557600080fd5b8151610c0c81610a7156fea2646970667358221220c7f6f27cf23711b751f3e6f40e5676136843e4e9eba4ed6a981b710d505108d964736f6c63430008110033" +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/ETHRegistrarController.json b/solidity/dns-contracts/deployments/testnet/ETHRegistrarController.json new file mode 100644 index 0000000..a9b50f5 --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/ETHRegistrarController.json @@ -0,0 +1,1069 @@ +{ + "address": "0xB85759dd66E5554bf4Fc0e19cc71eC11e0f3FE2E", + "abi": [ + { + "inputs": [ + { + "internalType": "contract BaseRegistrarImplementation", + "name": "_base", + "type": "address" + }, + { + "internalType": "contract TokenPriceOracle", + "name": "_prices", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minCommitmentAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxCommitmentAge", + "type": "uint256" + }, + { + "internalType": "contract ReverseRegistrar", + "name": "_reverseRegistrar", + "type": "address" + }, + { + "internalType": "contract INameWrapper", + "name": "_nameWrapper", + "type": "address" + }, + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "address", + "name": "_infoFi", + "type": "address" + }, + { + "internalType": "contract ReferralController", + "name": "_referralController", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "CommitmentTooNew", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "CommitmentTooOld", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "DurationTooShort", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientValue", + "type": "error" + }, + { + "inputs": [], + "name": "MaxCommitmentAgeTooHigh", + "type": "error" + }, + { + "inputs": [], + "name": "MaxCommitmentAgeTooLow", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameNotAvailable", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverRequiredWhenDataSupplied", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "UnexpiredCommitmentExists", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "baseCost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "premium", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRenewed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "MIN_REGISTRATION_DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "available", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "backendWallet", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "commit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "commitments", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "infoFi", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "bool", + "name": "reverseRecord", + "type": "bool" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + }, + { + "internalType": "bool", + "name": "lifetime", + "type": "bool" + } + ], + "name": "makeCommitment", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "maxCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nameWrapper", + "outputs": [ + { + "internalType": "contract INameWrapper", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "prices", + "outputs": [ + { + "internalType": "contract TokenPriceOracle", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "recoverFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "referralController", + "outputs": [ + { + "internalType": "contract ReferralController", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "bool", + "name": "reverseRecord", + "type": "bool" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + }, + { + "internalType": "bool", + "name": "lifetime", + "type": "bool" + }, + { + "internalType": "string", + "name": "referree", + "type": "string" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "bool", + "name": "reverseRecord", + "type": "bool" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + }, + { + "internalType": "bool", + "name": "lifetime", + "type": "bool" + }, + { + "internalType": "string", + "name": "referree", + "type": "string" + } + ], + "name": "registerWithCard", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "bool", + "name": "reverseRecord", + "type": "bool" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "internalType": "struct IETHRegistrarController.RegisterParams", + "name": "registerParams", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "string", + "name": "token", + "type": "string" + }, + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + } + ], + "internalType": "struct IETHRegistrarController.TokenParams", + "name": "tokenParams", + "type": "tuple" + }, + { + "internalType": "bool", + "name": "lifetime", + "type": "bool" + }, + { + "internalType": "string", + "name": "referree", + "type": "string" + } + ], + "name": "registerWithToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "lifetime", + "type": "bool" + } + ], + "name": "renew", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "lifetime", + "type": "bool" + } + ], + "name": "renewCard", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "string", + "name": "token", + "type": "string" + }, + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "lifetime", + "type": "bool" + } + ], + "name": "renewTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "lifetime", + "type": "bool" + } + ], + "name": "rentPrice", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "base", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "premium", + "type": "uint256" + } + ], + "internalType": "struct IPriceOracle.Price", + "name": "price", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "string", + "name": "token", + "type": "string" + }, + { + "internalType": "bool", + "name": "lifetime", + "type": "bool" + } + ], + "name": "rentPriceToken", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "base", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "premium", + "type": "uint256" + } + ], + "internalType": "struct IPriceOracle.Price", + "name": "price", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "resetInfoFi", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "reverseRegistrar", + "outputs": [ + { + "internalType": "contract ReverseRegistrar", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "wallet", + "type": "address" + } + ], + "name": "setBackend", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + } + ], + "name": "setToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "untrackedInfoFi", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "valid", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "verifiedTokens", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + } + ], + "name": "withdrawTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xb4cc6c6a9c5cbb4fd7b8fee823b07f496eaf2bf33ad9c152fedc01a710e3b366", + "receipt": { + "to": null, + "from": "0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B", + "contractAddress": "0xB85759dd66E5554bf4Fc0e19cc71eC11e0f3FE2E", + "transactionIndex": 4, + "gasUsed": "4242096", + "logsBloom": "0x00000000000000000000000000000000208000000000000000800000000000000000000000000000000000000000000000000000000010000010000000800000400000000000000000000000208000000001000000000000440000000000000000000800024000000000000000000800000000000000000000000000000000400000000000010000000000000000800000000000000000200000000000000000000000000040000000000010020000000000000000000000008000040000200000004000000000000000000000005000000000010400000000000000000021000001000000000000000000000000000000010000001000000000000000000000", + "blockHash": "0x1a62e47808a3eca68ee47075e6cfbd5099418be25dcbcfb23e969639bddecb3e", + "transactionHash": "0xb4cc6c6a9c5cbb4fd7b8fee823b07f496eaf2bf33ad9c152fedc01a710e3b366", + "logs": [ + { + "transactionIndex": 4, + "blockNumber": 57535089, + "transactionHash": "0xb4cc6c6a9c5cbb4fd7b8fee823b07f496eaf2bf33ad9c152fedc01a710e3b366", + "address": "0xB85759dd66E5554bf4Fc0e19cc71eC11e0f3FE2E", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000002a0d7311fa7e9ac2890cfd8219b2def0c206e79b" + ], + "data": "0x", + "logIndex": 8, + "blockHash": "0x1a62e47808a3eca68ee47075e6cfbd5099418be25dcbcfb23e969639bddecb3e" + }, + { + "transactionIndex": 4, + "blockNumber": 57535089, + "transactionHash": "0xb4cc6c6a9c5cbb4fd7b8fee823b07f496eaf2bf33ad9c152fedc01a710e3b366", + "address": "0x2E5ba310fDa0aD5dfA4CC5656FAEDDd4CC4c162b", + "topics": [ + "0x6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e92", + "0x000000000000000000000000b85759dd66e5554bf4fc0e19cc71ec11e0f3fe2e", + "0xb3f3066dedce0d1c19e7b443e6188acba68931470d2c867e35e983a5887ef9c2" + ], + "data": "0x", + "logIndex": 9, + "blockHash": "0x1a62e47808a3eca68ee47075e6cfbd5099418be25dcbcfb23e969639bddecb3e" + }, + { + "transactionIndex": 4, + "blockNumber": 57535089, + "transactionHash": "0xb4cc6c6a9c5cbb4fd7b8fee823b07f496eaf2bf33ad9c152fedc01a710e3b366", + "address": "0x8390D472587cCAe988dD06Ccd456Ac70CcF39038", + "topics": [ + "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", + "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2", + "0xfe8cc720ecf4de344490767656973e1f295b8f4c8b894ac693c22792542a99c5" + ], + "data": "0x0000000000000000000000002a0d7311fa7e9ac2890cfd8219b2def0c206e79b", + "logIndex": 10, + "blockHash": "0x1a62e47808a3eca68ee47075e6cfbd5099418be25dcbcfb23e969639bddecb3e" + } + ], + "blockNumber": 57535089, + "cumulativeGasUsed": "4699677", + "status": 1, + "byzantium": true + }, + "args": [ + "0x0393da9525982Be4C8b9812f8D2A877796fCA90b", + "0xBc9aCd5592ac75cd4F2A83e97C736A2b1E22b466", + "60", + "86400", + "0x2E5ba310fDa0aD5dfA4CC5656FAEDDd4CC4c162b", + "0x399c16D8156E1145912c106DD811702440242B93", + "0x8390D472587cCAe988dD06Ccd456Ac70CcF39038", + "0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B", + "0xf5F507D2a48B62082e3440B185f9e10a47156554" + ], + "numDeployments": 1, + "solcInputHash": "877591c0c7c8cc635cf9fe0b1c3ee358", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract BaseRegistrarImplementation\",\"name\":\"_base\",\"type\":\"address\"},{\"internalType\":\"contract TokenPriceOracle\",\"name\":\"_prices\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_minCommitmentAge\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxCommitmentAge\",\"type\":\"uint256\"},{\"internalType\":\"contract ReverseRegistrar\",\"name\":\"_reverseRegistrar\",\"type\":\"address\"},{\"internalType\":\"contract INameWrapper\",\"name\":\"_nameWrapper\",\"type\":\"address\"},{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_infoFi\",\"type\":\"address\"},{\"internalType\":\"contract ReferralController\",\"name\":\"_referralController\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"CommitmentTooNew\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"CommitmentTooOld\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"DurationTooShort\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxCommitmentAgeTooHigh\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MaxCommitmentAgeTooLow\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NameNotAvailable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverRequiredWhenDataSupplied\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"UnexpiredCommitmentExists\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"baseCost\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cost\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"name\":\"NameRenewed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MIN_REGISTRATION_DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"available\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"backendWallet\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"commitment\",\"type\":\"bytes32\"}],\"name\":\"commit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"commitments\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"infoFi\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"bool\",\"name\":\"reverseRecord\",\"type\":\"bool\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"},{\"internalType\":\"bool\",\"name\":\"lifetime\",\"type\":\"bool\"}],\"name\":\"makeCommitment\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxCommitmentAge\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minCommitmentAge\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nameWrapper\",\"outputs\":[{\"internalType\":\"contract INameWrapper\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"prices\",\"outputs\":[{\"internalType\":\"contract TokenPriceOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"recoverFunds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"referralController\",\"outputs\":[{\"internalType\":\"contract ReferralController\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"bool\",\"name\":\"reverseRecord\",\"type\":\"bool\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"},{\"internalType\":\"bool\",\"name\":\"lifetime\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"referree\",\"type\":\"string\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"bool\",\"name\":\"reverseRecord\",\"type\":\"bool\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"},{\"internalType\":\"bool\",\"name\":\"lifetime\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"referree\",\"type\":\"string\"}],\"name\":\"registerWithCard\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"bool\",\"name\":\"reverseRecord\",\"type\":\"bool\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"internalType\":\"struct IETHRegistrarController.RegisterParams\",\"name\":\"registerParams\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"token\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"}],\"internalType\":\"struct IETHRegistrarController.TokenParams\",\"name\":\"tokenParams\",\"type\":\"tuple\"},{\"internalType\":\"bool\",\"name\":\"lifetime\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"referree\",\"type\":\"string\"}],\"name\":\"registerWithToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"lifetime\",\"type\":\"bool\"}],\"name\":\"renew\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"lifetime\",\"type\":\"bool\"}],\"name\":\"renewCard\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"token\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"lifetime\",\"type\":\"bool\"}],\"name\":\"renewTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"lifetime\",\"type\":\"bool\"}],\"name\":\"rentPrice\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"base\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"}],\"internalType\":\"struct IPriceOracle.Price\",\"name\":\"price\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"token\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"lifetime\",\"type\":\"bool\"}],\"name\":\"rentPriceToken\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"base\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"}],\"internalType\":\"struct IPriceOracle.Price\",\"name\":\"price\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"resetInfoFi\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"reverseRegistrar\",\"outputs\":[{\"internalType\":\"contract ReverseRegistrar\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"wallet\",\"type\":\"address\"}],\"name\":\"setBackend\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"}],\"name\":\"setToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"untrackedInfoFi\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"valid\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"verifiedTokens\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"}],\"name\":\"withdrawTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"A registrar controller for registering and renewing names at fixed cost.\",\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"recoverFunds(address,address,uint256)\":{\"details\":\"The contract is Ownable and only the owner can call the recover function.\",\"params\":{\"_amount\":\"The amount of tokens to recover.\",\"_to\":\"The address to send the tokens to.\",\"_token\":\"The address of the ERC20 token to recover\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"recoverFunds(address,address,uint256)\":{\"notice\":\"Recover ERC20 tokens sent to the contract by mistake.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/ETHRegistrarController.sol\":\"ETHRegistrarController\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\":{\"keccak256\":\"0x257a8d28fa83d3d942547c8e129ef465e4b5f3f31171e7be4739a4c98da6b4f0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6d39e11b1dc7b9b8ccdabbc9be442ab7cda4a81c748f57e316dcb1bcb4a28bf9\",\"dweb:/ipfs/QmaG6vz6W6iEUBsbHSBob5mdcitYxWjoygxREHpsJHfWrS\"]},\"@openzeppelin/contracts/access/Ownable.sol\":{\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://fc980984badf3984b6303b377711220e067722bbd6a135b24669ff5069ef9f32\",\"dweb:/ipfs/QmPHXMSXj99XjSVM21YsY6aNtLLjLVXDbyN76J5HQYvvrz\"]},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://919c7ea27c77275c3c341da0c4a26a66a20ed27605fbe8becf11f58ec3bc65bf\",\"dweb:/ipfs/QmRLKyVE2n7e2Jo4bLNn8eLgqqhNGYnVQyjJPWdr8poskf\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bd39944e8fc06be6dbe2dd1d8449b5336e23c6a7ba3e8e9ae5ae0f37f35283f5\",\"dweb:/ipfs/QmPV3FGYjVwvKSgAXKUN3r9T9GwniZz83CxBpM7vyj2G53\"]},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"keccak256\":\"0xec63854014a5b4f2b3290ab9103a21bdf902a508d0f41a8573fea49e98bf571a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bc5b5dc12fbc4002f282eaa7a5f06d8310ed62c1c77c5770f6283e058454c39a\",\"dweb:/ipfs/Qme9rE2wS3yBuyJq9GgbmzbsBQsW2M2sVFqYYLw7bosGrv\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0xabefac93435967b4d36a4fabcbdbb918d1f0b7ae3c3d85bc30923b326c927ed1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9d213d3befca47da33f6db0310826bcdb148299805c10d77175ecfe1d06a9a68\",\"dweb:/ipfs/QmRgCn6SP1hbBkExUADFuDo8xkT4UU47yjNF5FhCeRbQmS\"]},\"@openzeppelin/contracts/token/ERC721/ERC721.sol\":{\"keccak256\":\"0x2c309e7df9e05e6ce15bedfe74f3c61b467fc37e0fae9eab496acf5ea0bbd7ff\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7063b5c98711a98018ba4635ac74cee1c1cfa2ea01099498e062699ed9530005\",\"dweb:/ipfs/QmeJ8rGXkcv7RrqLdAW8PCXPAykxVsddfYY6g5NaTwmRFE\"]},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7e66dfde185df46104c11bc89d08fa0760737aa59a2b8546a656473d810a8ea4\",\"dweb:/ipfs/QmXvyqtXPaPss2PD7eqPoSao5Szm2n6UMoiG8TZZDjmChR\"]},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6e75cf83beb757b8855791088546b8337e9d4684e169400c20d44a515353b708\",\"dweb:/ipfs/QmYvPafLfoquiDMEj7CKHtvbgHu7TJNPSVPSCjrtjV8HjV\"]},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a0a107160525724f9e1bbbab031defc2f298296dd9e331f16a6f7130cec32146\",\"dweb:/ipfs/QmemujxSd7gX8A9M8UwmNbz4Ms3U9FG9QfudUgxwvTmPWf\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2455248c8ddd9cc6a7af76a13973cddf222072427e7b0e2a7d1aff345145e931\",\"dweb:/ipfs/QmfYjnjRbWqYpuxurqveE6HtzsY1Xx323J428AKQgtBJZm\"]},\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6df0ddf21ce9f58271bdfaa85cde98b200ef242a05a3f85c2bc10a8294800a92\",\"dweb:/ipfs/QmRK2Y5Yc6BK7tGKkgsgn3aJEQGi5aakeSPZvS65PV8Xp3\"]},\"@openzeppelin/contracts/utils/Strings.sol\":{\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b81d9ff6559ea5c47fc573e17ece6d9ba5d6839e213e6ebc3b4c5c8fe4199d7f\",\"dweb:/ipfs/QmPCW1bFisUzJkyjroY3yipwfism9RRCigCcK1hbXtVM8n\"]},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://fb0048dee081f6fffa5f74afc3fb328483c2a30504e94a0ddd2a5114d731ec4d\",\"dweb:/ipfs/QmZptt1nmYoA5SgjwnSgWqgUSDgm4q52Yos3xhnMv3MV43\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://be161e54f24e5c6fae81a12db1a8ae87bc5ae1b0ddc805d82a1440a68455088f\",\"dweb:/ipfs/QmP7C3CHdY9urF4dEMb9wmsp1wMxHF6nhA2yQE5SKiPAdy\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://cc8841b3cd48ad125e2f46323c8bad3aa0e88e399ec62acb9e57efa7e7c8058c\",\"dweb:/ipfs/QmSqE4mXHA2BXW58deDbXE8MTcsL5JSKNDbm23sVQxRLPS\"]},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c50fcc459e49a9858b6d8ad5f911295cb7c9ab57567845a250bf0153f84a95c7\",\"dweb:/ipfs/QmcEW85JRzvDkQggxiBBLVAasXWdkhEysqypj9EaB6H2g6\"]},\"contracts/ethregistrar/BaseRegistrarImplementation.sol\":{\"keccak256\":\"0x0fbe9558e5bde9149cb2217db09eba430e9c6bdca70d72576a73d3a75886dd65\",\"urls\":[\"bzz-raw://b3ebe9b9d024a8b5fe10bc81397f1f6206731ddef042227ca3a1eec452930a50\",\"dweb:/ipfs/QmSUigsC8W2MLnaSox8D62kPKmEXF1iMaiFSazp7m9vpUB\"]},\"contracts/ethregistrar/ETHRegistrarController.sol\":{\"keccak256\":\"0x42024e6b4ded5b90754373178b97de644e2bf8f11afec1e96fc899d3e094881e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f463e2d25d64b4ea94cc35e8426f680c06f94bab9854718007da12e12e6373c6\",\"dweb:/ipfs/QmbGr19deUY5YGWyEM337yzT8nPH2LSck15r8U4aU8ffmf\"]},\"contracts/ethregistrar/ExponentialPremiumPriceOracle.sol\":{\"keccak256\":\"0xb1216535d04a6cb36d4a184c69755eb64a9e9890c94e83d4407a8f631ae6bfb5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e76cf1acbe1e5778cb93146aa281a1f2d20f92c34dd3574e7d8c3372d5da45b8\",\"dweb:/ipfs/QmbVFgq3ceN4jzmoimBZeTSsKiUNemeHkkk15k5XS1wMRP\"]},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\",\"urls\":[\"bzz-raw://ef8b878d8de60c595017944a41a6feb272a8e0b67c497677dbc005581a7d9e8c\",\"dweb:/ipfs/QmQfDDfqiJiUMWdDtdcqaHX5oGjPKFKY3L26aZV3JqdZC8\"]},\"contracts/ethregistrar/IETHRegistrarController.sol\":{\"keccak256\":\"0x5b063364fa339be07758117e6e53fb7991653c99bfdab24ba200ec805b655190\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e72b029dfc5838f1ec57147a0cea5bd427ea49400000adc98dc09ab094277cc1\",\"dweb:/ipfs/QmctjoRyvprVYh5jJ4Cp3xLw4WGNX7LgvWMVMa3AicyasX\"]},\"contracts/ethregistrar/IPriceOracle.sol\":{\"keccak256\":\"0xc1f749d6238b0e77cc804153b2ce8fc2e082d28129e734839ccc2b2be7ee9d2b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f30dd3f5814414c0cd85f02ce409a5c424337b2b6f6a3bd7cd56cb0806c7ed98\",\"dweb:/ipfs/QmTuo8unqUfq3ckzkuRdjVh1Vay1p7BrY6varTiG4BoJ66\"]},\"contracts/ethregistrar/ReferralController.sol\":{\"keccak256\":\"0xd84283d895a37b233ac7cdda54599c813d163463e99af5dadd708be214a5c8d2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3f6ae0fef5b98f00df7e6d7b790628d06782d65a4da8dbe3d3146fb1fa7fcd44\",\"dweb:/ipfs/QmRxF1FoFQeUfst4S62DwCh4LfxbXjUrCVJuPdGLyES8Lt\"]},\"contracts/ethregistrar/StablePriceOracle.sol\":{\"keccak256\":\"0x54a747b1762c567f40f99603f147789dc03aab46eafb4e0eaac7340092cccea3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://cbbba4284c6e50a2cb1ce2fc6a25812c706d82715c79917ef9f2e702b3eae7c5\",\"dweb:/ipfs/QmdPcRyfDVVZBSZVoWj2BRYVVwN66hDi6kg5yiZ8oNDMF1\"]},\"contracts/ethregistrar/TokenPriceOracle.sol\":{\"keccak256\":\"0x315a2173ce37b23b47f11600bd0ecf1407ba59a52db2c5ec628038bd8d75d4ca\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9af5450becfa59fa2e526c669843a0ae528bdf75de6c1a26018a70311779b120\",\"dweb:/ipfs/QmToWs9fiMMJeBB7rZkQNVpAhfSXQFSdBStQSQdm63meGh\"]},\"contracts/registry/ENS.sol\":{\"keccak256\":\"0x8e208b44d5dbf22552fe72d79b45c640855b84fbc9ee21f4c3bb4bfe81cbe8db\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://fcf03e1a9386d80ff6b8e31870063424454f69d2626c0efb2c8cf55e69151489\",\"dweb:/ipfs/QmVYgfMSc1ve5JWePqiAGSXEfD76emw3oLsCM1krstmJq5\"]},\"contracts/resolvers/Resolver.sol\":{\"keccak256\":\"0xfc77ab6b7c59c3ebfe1c720bdebf9b08c2488ff7ac9501a9aa056c5d6d5b50c5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5d472c5e0de753fe3b0ce8b37b3c10635ad7328fbd34e2b1be05e82aec73b7f7\",\"dweb:/ipfs/QmbPqW3BxytUNqJTxAXF6PngM3X7BNNnQwdSuSdHsKmRvH\"]},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2046ce3d92d29806d7b447f7ab4227f19b0b2e5c75fd5b4a3fcaef7fe2442141\",\"dweb:/ipfs/QmRgnfWjFetrSJngkhU7Yui1ZcK1MeatvZDpvUTYNuYnND\"]},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://43922ba183ff20d87dce7fc5d715e626b26594151e36dcc8d7c6329b9a822963\",\"dweb:/ipfs/QmTg9uHTugTxzqddN68gnhNbGt4bGJBS9mQcss6GYggR4X\"]},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://543aa2756447a428711b69aea79e9f4641c22f8330ba920b2a49fde8d9207f82\",\"dweb:/ipfs/QmTdpcYRWLH3BL7iytnqcSzRojTPe3YettKaTqeCvKPk54\"]},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://daf1fee7770679bd935b8b5686789a4ecc532caeef5a9b8e1b60ae0c285e743e\",\"dweb:/ipfs/QmSaHBAqtDdbQLH6QN4EbupMrq2ah8g6fqE7fLX1u4cjMZ\"]},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2c8355211d58db82660140191678ee342eb8a7ac46fa097ae8e03eef008f592e\",\"dweb:/ipfs/QmYDNiECPd4fJ7Vk9Xywfpg73rUvDpcYqas95ofGcpt7fM\"]},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a4e38d5eb69e236c37e4a013628838070720c9e1923569650b01252868038c7a\",\"dweb:/ipfs/QmV397iZMRxtem79kJy5sueJadXoVL89gNViX2xciQHUrk\"]},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d244d15588785044b54c453ab6dc51c616ab70cb8b9e687d3e54565bcae97760\",\"dweb:/ipfs/QmXz4ZZBTFogdkdTV1mcE3ywvL2agKVZHLNNeRHCKVruYM\"]},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://045d12c6e0e4596b3672614751a9e75188183a89765a6abd938294e0294e9c56\",\"dweb:/ipfs/QmazngvagEoKe29s4M9Rv8KygWD5hrAtNPkYDPJ2pK13yx\"]},\"contracts/resolvers/profiles/INameResolver.sol\":{\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5b2cd9e5339b09f40e82bd91fed7d5f643dd031393eefb9aec588eaba8465049\",\"dweb:/ipfs/QmT2A8eswhJU9YadCs9BtwKNj6YGypntXmFepANQYyGw7x\"]},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bc2f86e50bd17c38fb10feb577d88d8970c585017a391ef10e3aaa3d50f81555\",\"dweb:/ipfs/QmaxLx2pqCUxf9W2dusfviZ9aSiTuVwuekGo73rjvmGifE\"]},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://412e34ae2d84d542ffa6791486963f3fe04432a3ffd51877d441256dc2941914\",\"dweb:/ipfs/QmciS4mGAQ6KJtLiLcBFekHKhYAYMmubDWGkpZ3sUFtJPW\"]},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\",\"urls\":[\"bzz-raw://ca4b52ebdeb0fcddedded0e0027e530df4468c25b438ce0d4699b188603a4560\",\"dweb:/ipfs/QmW3LPwkwcL84rBu8cbLagKQPMGunXnh6cZfm6RRyfXArb\"]},\"contracts/reverseRegistrar/ReverseClaimer.sol\":{\"keccak256\":\"0x78a28627241535b595f6fff476a1fa7acc90c80684fe7784734920fc8af6fc22\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://988e059f54bf387eab677161edf2e0746cc060fb6a2d34f20a283ee9e2e17bb3\",\"dweb:/ipfs/QmUVtTvZ3ijd2zi1pbPcMVyVrLVJwEhAnh5mK3MnJsHUZT\"]},\"contracts/reverseRegistrar/ReverseRegistrar.sol\":{\"keccak256\":\"0xd57d28e5791b4b44650a00f5ef6c725af53698ec33faeeaa3591f0dbd939559a\",\"urls\":[\"bzz-raw://7f27cf1e6e67602c45cbf296d73cbea9382b3c6c9b3440475dd60a9da839ba49\",\"dweb:/ipfs/QmNSHz447MJgMTGb8MHxAPf2RbUQj5fmzBaVKvmD13bM6J\"]},\"contracts/root/Controllable.sol\":{\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\",\"urls\":[\"bzz-raw://cd365d76a131b89fa0f6b4097e63032337d2c071c082f5b9ca4af85cd16b3350\",\"dweb:/ipfs/QmXcgvgArVaK9k4wfzEj2rGu86W6U3BAY8mw8jVaAwJpFH\"]},\"contracts/utils/ERC20Recoverable.sol\":{\"keccak256\":\"0x793a38091e1f81499a29ddba82c2b2f3cdd07071b81a832886e8e02a45ff352a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://41d435f84b1d03daa8a934967d6b01246548b52441c108e48e0fd6a7ade4a0c7\",\"dweb:/ipfs/QmQZX6rurGhMqJuH1GjZ7QC8a8Gvtn2rVBmKwdbM9GPnNb\"]},\"contracts/utils/StringUtils.sol\":{\"keccak256\":\"0xb3838963dcc378d8dde1bd03666ff4fc66c37909a5608950b6ef6eb78f9025c4\",\"urls\":[\"bzz-raw://59d4282e3f78c087b2e7aa65d0aa184aeaa74b44b6007f4fe78cb11efc154805\",\"dweb:/ipfs/QmX7f4SvHfWxeqwviNRY94vNnoV32fosXHyXfvLpRCvJZe\"]},\"contracts/wrapper/IMetadataService.sol\":{\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://71aa1053dd87829c5eb25d32840d7b0d33cd9d54d22e905a01436bf97cc32b8c\",\"dweb:/ipfs/QmeMNnGKqf3oZyYwDQzEuQhti58UCCMRCMAD2EBx5T8dSH\"]},\"contracts/wrapper/INameWrapper.sol\":{\"keccak256\":\"0x18a49abb805da867f3a6f49e1b898ba5b6afe5ae3a4b8f90152c0687ccc68048\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://15130e2e263d7de8b49f259f50b32e8860b14f8b237f700e02933be0e47e4640\",\"dweb:/ipfs/QmbCKTGkmacLoPLuX35UmRgdRAVDEXKxb98v4QKYq1iKD6\"]},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5afeadfdf2232a2333afb5345b65a25f7199b62ed6fde403273b762c91f5e9af\",\"dweb:/ipfs/QmWKhi3FuqX2KgRrBdh65gB3pmiwA2QMYPeiDbsMKv6a88\"]}},\"version\":1}", + "bytecode": "0x6101606040523480156200001257600080fd5b5060405162004f1938038062004f19833981016040819052620000359162000242565b82336200004281620001d9565b6040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e260048201526000906001600160a01b038416906302571be390602401602060405180830381865afa158015620000aa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000d0919062000302565b604051630f41a04d60e11b81526001600160a01b03848116600483015291925090821690631e83409a906024016020604051808303816000875af11580156200011d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000143919062000329565b5050505086861162000168576040516307cb550760e31b815260040160405180910390fd5b428611156200018a57604051630b4319e560e21b815260040160405180910390fd5b6001600160a01b0398891660805296881660a05260c0959095525060e092909252841661010052831661012052600180546001600160a01b031916918416919091179055166101405262000343565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200023f57600080fd5b50565b60008060008060008060008060006101208a8c0312156200026257600080fd5b89516200026f8162000229565b60208b0151909950620002828162000229565b8098505060408a0151965060608a0151955060808a0151620002a48162000229565b60a08b0151909550620002b78162000229565b60c08b0151909450620002ca8162000229565b60e08b0151909350620002dd8162000229565b6101008b0151909250620002f18162000229565b809150509295985092959850929598565b6000602082840312156200031557600080fd5b8151620003228162000229565b9392505050565b6000602082840312156200033c57600080fd5b5051919050565b60805160a05160c05160e051610100516101205161014051614a39620004e060003960008181610347015281816109e201528181610ddd01528181610e7a01528181610f3d01528181610fb701528181611018015281816111f501528181611300015281816113f3015281816114a20152818161151e0152818161174c01528181611879015281816119b001528181611a5f01528181611adb01528181611ce901528181611f0601528181612008015281816120b701528181612154015281816121e301528181612256015281816122b4015281816129a101528181612a7601528181612b2f015281816131c00152818161325d0152818161332001528181613397015261358e0152600081816105ce0152818161090001528181610cad0152818161128f0152818161180001528181611e8d01526128bf01526000818161045601526130ed01526000818161063801528181612d250152612f0c0152600081816104fc0152612e9501526000818161066c015281816124bf015261266b0152600081816124eb015281816126970152612c5d0152614a396000f3fe6080604052600436106102195760003560e01c8063839df9451161011d578063a680baaf116100b0578063ce1e09c01161007f578063da7fc24f11610064578063da7fc24f1461068e578063f14fcbc8146106ae578063f2fde38b146106ce57600080fd5b8063ce1e09c014610626578063d3419bf31461065a57600080fd5b8063a680baaf1461059c578063a8e5fbc0146105bc578063aeb8ce9b146105f0578063c53c0ec11461061057600080fd5b80638da5cb5b116100ec5780638da5cb5b1461051e5780639791c0971461053c578063a0e3aef11461055c578063a31bc89a1461057c57600080fd5b8063839df9451461047857806388cccc09146104b35780638a95b09f146104d35780638d839ffe146104ea57600080fd5b806349df728c116101b05780635d3590d51161017f578063715018a611610164578063715018a61461040f578063786d96a114610424578063808698531461044457600080fd5b80635d3590d5146103b45780636cfc51e2146103d457600080fd5b806349df728c146103155780634ba694bd146103355780634be2b2ec14610381578063569f8ab31461039457600080fd5b806323ed462e116101ec57806323ed462e146102ad57806327cdd135146102c05780633c3a7d35146102e05780633ccfd60b1461030057600080fd5b806301ffc9a71461021e578063094f716d14610253578063144fa6d71461025d5780631baaaffe1461027d575b600080fd5b34801561022a57600080fd5b5061023e610239366004613b59565b6106ee565b60405190151581526020015b60405180910390f35b61025b610757565b005b34801561026957600080fd5b5061025b610278366004613ba8565b61085f565b34801561028957600080fd5b5061023e610298366004613ba8565b60056020526000908152604090205460ff1681565b61025b6102bb366004613dab565b61088b565b3480156102cc57600080fd5b5061025b6102db366004613f15565b610b13565b3480156102ec57600080fd5b5061025b6102fb3660046140a2565b611116565b34801561030c57600080fd5b5061025b6115fc565b34801561032157600080fd5b5061025b610330366004613ba8565b611639565b34801561034157600080fd5b506103697f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161024a565b61025b61038f3660046140a2565b6116c7565b3480156103a057600080fd5b5061025b6103af366004614101565b611c47565b3480156103c057600080fd5b5061025b6103cf36600461419a565b6123a9565b3480156103e057600080fd5b506103f46103ef3660046141db565b61242a565b6040805182518152602092830151928101929092520161024a565b34801561041b57600080fd5b5061025b6125c2565b34801561043057600080fd5b506103f461043f366004614236565b6125d6565b34801561045057600080fd5b506103697f000000000000000000000000000000000000000000000000000000000000000081565b34801561048457600080fd5b506104a56104933660046142ab565b60026020526000908152604090205481565b60405190815260200161024a565b3480156104bf57600080fd5b50600154610369906001600160a01b031681565b3480156104df57600080fd5b506104a56224ea0081565b3480156104f657600080fd5b506104a57f000000000000000000000000000000000000000000000000000000000000000081565b34801561052a57600080fd5b506000546001600160a01b0316610369565b34801561054857600080fd5b5061023e6105573660046142c4565b612771565b34801561056857600080fd5b506104a56105773660046142f9565b612786565b34801561058857600080fd5b5061025b610597366004613dab565b612826565b3480156105a857600080fd5b50600354610369906001600160a01b031681565b3480156105c857600080fd5b506103697f000000000000000000000000000000000000000000000000000000000000000081565b3480156105fc57600080fd5b5061023e61060b3660046142c4565b612c14565b34801561061c57600080fd5b506104a560045481565b34801561063257600080fd5b506104a57f000000000000000000000000000000000000000000000000000000000000000081565b34801561066657600080fd5b506103697f000000000000000000000000000000000000000000000000000000000000000081565b34801561069a57600080fd5b5061025b6106a9366004613ba8565b612cd7565b3480156106ba57600080fd5b5061025b6106c93660046142ab565b612d0e565b3480156106da57600080fd5b5061025b6106e9366004613ba8565b612d97565b60006001600160e01b031982167f01ffc9a700000000000000000000000000000000000000000000000000000000148061075157506001600160e01b031982167ff2d8c3a500000000000000000000000000000000000000000000000000000000145b92915050565b61075f612e24565b600034116107b45760405162461bcd60e51b815260206004820152601f60248201527f4d7573742073656e642076616c756520746f20726573657420696e666f46690060448201526064015b60405180910390fd5b6001546040516000916001600160a01b03169034908381818185875af1925050503d8060008114610801576040519150601f19603f3d011682016040523d82523d6000602084013e610806565b606091505b50509050806108575760405162461bcd60e51b815260206004820152601860248201527f5061796d656e7420746f20696e666f4669206661696c6564000000000000000060448201526064016107ab565b506000600455565b610867612e24565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b60006108988b8a8561242a565b602081015181519192506108ab916143e2565b3410156108cb5760405163044044a560e21b815260040160405180910390fd5b6108e68b8a6108e18e8e8e8e8e8e8e8e8e612786565b612e7e565b604051635200a4c160e11b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a40149829061093d908f908f908f908e908c90600401614445565b6020604051808303816000875af115801561095c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610980919061448d565b87519091501561099c5761099c888d805190602001208961300b565b8515610a3f576109ad8c89336130eb565b8b5160208d0120604051631f8e227160e01b815260048101919091526001600160a01b038c81166024830152604482018390527f00000000000000000000000000000000000000000000000000000000000000001690631f8e227190606401600060405180830381600087803b158015610a2657600080fd5b505af1158015610a3a573d6000803e3d6000fd5b505050505b8a6001600160a01b03168c805190602001207f69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf278e8560000151866020015186604051610a8e94939291906144a6565b60405180910390a360208201518251610aa791906143e2565b341115610af9576020820151825133916108fc91610ac591906143e2565b610acf90346144d5565b6040518115909202916000818181858888f19350505050158015610af7573d6000803e3d6000fd5b505b610b0582848e8e61319f565b505050505050505050505050565b6020808401516001600160a01b031660009081526005909152604090205460ff161515600114610b855760405162461bcd60e51b815260206004820152601860248201527f556e6e6163657074656420546f6b656e2041646472657373000000000000000060448201526064016107ab565b610bc3846000015185604001516108e18760000151886020015189604001518a606001518b608001518c60a001518d60c001518e60e001518d612786565b6000610bdd856000015186604001518660000151866125d6565b60208101518151919250610bf0916143e2565b60208501516040516370a0823160e01b81523360048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610c3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5e919061448d565b1015610c7d5760405163044044a560e21b815260040160405180910390fd5b84516020860151604080880151608089015160e08a01519251635200a4c160e11b81526000956001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169563a401498295610ce49592949193600401614445565b6020604051808303816000875af1158015610d03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d27919061448d565b9050610d4b86600001518760a00151886020015189608001518a60c001518661352f565b610d598560200151836135e6565b85602001516001600160a01b03168660000151805190602001207f69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf2788600001518560000151866020015186604051610db494939291906144a6565b60405180910390a3825160208401206040516376d7cfb760e11b81526000916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163edaf9f6e91610e149160040190815260200190565b602060405180830381865afa158015610e31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5591906144e8565b60405163c08d52af60e01b81526001600160a01b0380831660048301529192506000917f0000000000000000000000000000000000000000000000000000000000000000169063c08d52af90602401602060405180830381865afa158015610ec1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee5919061448d565b604080516020808201909252600090528651908701209091507fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470146110bd576040516344430b6960e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906344430b6990602401602060405180830381865afa158015610f8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb0919061448d565b90506110167f000000000000000000000000000000000000000000000000000000000000000060648388602001518960000151610fed91906143e2565b610ff79190614505565b611001919061451c565b60208b01516001600160a01b03169190613615565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ff8f3947878b600001518c6020015189602001518a6000015161106491906143e2565b8d602001516040518663ffffffff1660e01b815260040161108995949392919061453e565b600060405180830381600087803b1580156110a357600080fd5b505af11580156110b7573d6000803e3d6000fd5b50505050505b6001546020850151855161110c926001600160a01b0316916064916110e291906143e2565b6110ed906023614505565b6110f7919061451c565b60208a01516001600160a01b03169190613615565b5050505050505050565b6003546001600160a01b031633146111705760405162461bcd60e51b815260206004820152600b60248201527f4e6f74204261636b656e6400000000000000000000000000000000000000000060448201526064016107ab565b6000848460405161118292919061458e565b604080519182900382206020601f8801819004810284018101909252868352925082916000916111d19190899089908190840183828082843760009201919091525089925088915061242a9050565b604051630338bc9760e41b8152600481018590529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063338bc97090602401600060405180830381865afa15801561123c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261126491908101906145ce565b60405163c475abff60e01b815260048101859052602481018890529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c475abff906044016020604051808303816000875af11580156112d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112fc919061448d565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638b07795b8a8a60405161133d92919061458e565b60405190819003812060e083901b6001600160e01b0319168252600482015260248101849052604401600060405180830381600087803b15801561138057600080fd5b505af1158015611394573d6000803e3d6000fd5b50505050847f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae8a8a8660000151856040516113d29493929190614617565b60405180910390a2815160208301206040516376d7cfb760e11b81526000917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169163edaf9f6e916114329160040190815260200190565b602060405180830381865afa15801561144f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147391906144e8565b6001600160a01b0316146115b357815160208301206040516376d7cfb760e11b81526000916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163edaf9f6e916114d99160040190815260200190565b602060405180830381865afa1580156114f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151a91906144e8565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663668c91c88560200151866000015161155f91906143e2565b83866040518463ffffffff1660e01b815260040161157f93929190614657565b600060405180830381600087803b15801561159957600080fd5b505af11580156115ad573d6000803e3d6000fd5b50505050505b602083015183516064916115c6916143e2565b6115d1906023614505565b6115db919061451c565b600460008282546115ec91906143e2565b9091555050505050505050505050565b600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015611636573d6000803e3d6000fd5b50565b61163661164e6000546001600160a01b031690565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015611692573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b6919061448d565b6001600160a01b0384169190613615565b600084846040516116d992919061458e565b604080519182900382206020601f8801819004810284018101909252868352925082916000916117289190899089908190840183828082843760009201919091525089925088915061242a9050565b604051630338bc9760e41b8152600481018590529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063338bc97090602401600060405180830381865afa158015611793573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526117bb91908101906145ce565b82519091503410156117e05760405163044044a560e21b815260040160405180910390fd5b60405163c475abff60e01b815260048101849052602481018790526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c475abff906044016020604051808303816000875af1158015611851573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611875919061448d565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638b07795b8a8a6040516118b692919061458e565b60405190819003812060e083901b6001600160e01b0319168252600482015260248101849052604401600060405180830381600087803b1580156118f957600080fd5b505af115801561190d573d6000803e3d6000fd5b50505050826000015134111561195957825133906108fc9061192f90346144d5565b6040518115909202916000818181858888f19350505050158015611957573d6000803e3d6000fd5b505b847f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae8a8a348560405161198f9493929190614617565b60405180910390a2815160208301206040516376d7cfb760e11b81526000917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169163edaf9f6e916119ef9160040190815260200190565b602060405180830381865afa158015611a0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3091906144e8565b6001600160a01b031614611b7057815160208301206040516376d7cfb760e11b81526000916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163edaf9f6e91611a969160040190815260200190565b602060405180830381865afa158015611ab3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ad791906144e8565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e858db0885602001518660000151611b1c91906143e2565b83866040518463ffffffff1660e01b8152600401611b3c93929190614657565b600060405180830381600087803b158015611b5657600080fd5b505af1158015611b6a573d6000803e3d6000fd5b50505050505b600154602084015184516000926001600160a01b031691606491611b9491906143e2565b611b9f906023614505565b611ba9919061451c565b604051600081818185875af1925050503d8060008114611be5576040519150601f19603f3d011682016040523d82523d6000602084013e611bea565b606091505b5050905080611c3b5760405162461bcd60e51b815260206004820152601860248201527f5061796d656e7420746f20696e666f4669206661696c6564000000000000000060448201526064016107ab565b50505050505050505050565b6001600160a01b03821660009081526005602052604090205460ff161515600114611cb45760405162461bcd60e51b815260206004820152601860248201527f556e6e6163657074656420546f6b656e2041646472657373000000000000000060448201526064016107ab565b60008686604051611cc692919061458e565b604051908190038120630338bc9760e41b825260048201819052915081906000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063338bc97090602401600060405180830381865afa158015611d38573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d6091908101906145ce565b90506000611da88a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92508b91508990506125d6565b60208101518151919250611dbb916143e2565b6040516370a0823160e01b81523360048201526001600160a01b038816906370a0823190602401602060405180830381865afa158015611dff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e23919061448d565b1015611e425760405163044044a560e21b815260040160405180910390fd5b611e6d333083602001518460000151611e5b91906143e2565b6001600160a01b038a1692919061368d565b60405163c475abff60e01b815260048101849052602481018990526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c475abff906044016020604051808303816000875af1158015611ede573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f02919061448d565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638b07795b8c8c604051611f4392919061458e565b60405190819003812060e083901b6001600160e01b0319168252600482015260248101849052604401600060405180830381600087803b158015611f8657600080fd5b505af1158015611f9a573d6000803e3d6000fd5b50505050847f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae8c8c85602001518660000151611fd691906143e2565b85604051611fe79493929190614617565b60405180910390a2825160208401206040516376d7cfb760e11b81526000917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169163edaf9f6e916120479160040190815260200190565b602060405180830381865afa158015612064573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061208891906144e8565b6001600160a01b03161461234d57825160208401206040516376d7cfb760e11b81526000916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163edaf9f6e916120ee9160040190815260200190565b602060405180830381865afa15801561210b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061212f91906144e8565b60405163c08d52af60e01b81526001600160a01b0380831660048301529192506000917f0000000000000000000000000000000000000000000000000000000000000000169063c08d52af90602401602060405180830381865afa15801561219b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121bf919061448d565b6040516344430b6960e01b8152600481018290529091506000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906344430b6990602401602060405180830381865afa15801561222a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224e919061448d565b90506122b2307f000000000000000000000000000000000000000000000000000000000000000060648489602001518a6000015161228c91906143e2565b6122969190614505565b6122a0919061451c565b6001600160a01b038e1692919061368d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d184befa866020015187600001516122f591906143e2565b858d8a6040518563ffffffff1660e01b8152600401612317949392919061467f565b600060405180830381600087803b15801561233157600080fd5b505af1158015612345573d6000803e3d6000fd5b505050505050505b6001546020830151835161239c9230926001600160a01b0390911691606491612375916143e2565b612380906023614505565b61238a919061451c565b6001600160a01b038b1692919061368d565b5050505050505050505050565b6123b1612e24565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015612400573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061242491906146b1565b50505050565b604080518082019091526000808252602082015282158061244e57506224ea008310155b61249a5760405162461bcd60e51b815260206004820152601060248201527f496e76616c6964206475726174696f6e0000000000000000000000000000000060448201526064016107ab565b83516020850120604051636b727d4360e11b8152600481018290526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691638416a3749188917f00000000000000000000000000000000000000000000000000000000000000009091169063d6e4fa8690602401602060405180830381865afa158015612534573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612558919061448d565b87876040518563ffffffff1660e01b815260040161257994939291906146ce565b6040805180830381865afa158015612595573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125b991906146ff565b95945050505050565b6125ca612e24565b6125d460006136de565b565b60408051808201909152600080825260208201528315806125fa57506224ea008410155b6126465760405162461bcd60e51b815260206004820152601060248201527f496e76616c6964206475726174696f6e0000000000000000000000000000000060448201526064016107ab565b84516020860120604051636b727d4360e11b8152600481018290526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691638361401d9189917f00000000000000000000000000000000000000000000000000000000000000009091169063d6e4fa8690602401602060405180830381865afa1580156126e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612704919061448d565b8888886040518663ffffffff1660e01b815260040161272795949392919061474e565b6040805180830381865afa158015612743573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061276791906146ff565b9695505050505050565b6000600261277e8361373b565b101592915050565b885160208a0120845160009190158015906127a857506001600160a01b038716155b156127df576040517fd3f605c400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808a8a8a8a8a8a8a8a604051602001612800999897969594939291906147e9565b604051602081830303815290604052805190602001209150509998505050505050505050565b6003546001600160a01b031633146128805760405162461bcd60e51b815260206004820152600b60248201527f4e6f74204261636b656e6400000000000000000000000000000000000000000060448201526064016107ab565b600061288d8b8a8561242a565b90506128a58b8a6108e18e8e8e8e8e8e8e8e8e612786565b604051635200a4c160e11b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a4014982906128fc908f908f908f908e908c90600401614445565b6020604051808303816000875af115801561291b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061293f919061448d565b87519091501561295b5761295b888d805190602001208961300b565b85156129fe5761296c8c898d6130eb565b8b5160208d0120604051631f8e227160e01b815260048101919091526001600160a01b038c81166024830152604482018c90527f00000000000000000000000000000000000000000000000000000000000000001690631f8e227190606401600060405180830381600087803b1580156129e557600080fd5b505af11580156129f9573d6000803e3d6000fd5b505050505b8a6001600160a01b03168c805190602001207f69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf278e8560000151866020015186604051612a4d94939291906144a6565b60405180910390a3825160208401206040516376d7cfb760e11b81526000916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163edaf9f6e91612aad9160040190815260200190565b602060405180830381865afa158015612aca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aee91906144e8565b604080516020808201909252600090528551908601209091507fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47014612bc7577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663898c6495858f8f87602001518860000151612b7391906143e2565b866040518663ffffffff1660e01b8152600401612b9495949392919061453e565b600060405180830381600087803b158015612bae57600080fd5b505af1158015612bc2573d6000803e3d6000fd5b505050505b60208301518351606491612bda916143e2565b612be5906023614505565b612bef919061451c565b60046000828254612c0091906143e2565b909155505050505050505050505050505050565b80516020820120600090612c2783612771565b8015612cd057506040517f96e494e8000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906396e494e890602401602060405180830381865afa158015612cac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cd091906146b1565b9392505050565b612cdf612e24565b6003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000818152600260205260409020544290612d4a907f0000000000000000000000000000000000000000000000000000000000000000906143e2565b10612d84576040517f0a059d71000000000000000000000000000000000000000000000000000000008152600481018290526024016107ab565b6000908152600260205260409020429055565b612d9f612e24565b6001600160a01b038116612e1b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016107ab565b611636816136de565b6000546001600160a01b031633146125d45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107ab565b6000818152600260205260409020544290612eba907f0000000000000000000000000000000000000000000000000000000000000000906143e2565b1115612ef5576040517f5320bcf9000000000000000000000000000000000000000000000000000000008152600481018290526024016107ab565b6000818152600260205260409020544290612f31907f0000000000000000000000000000000000000000000000000000000000000000906143e2565b11612f6b576040517fcb7690d7000000000000000000000000000000000000000000000000000000008152600481018290526024016107ab565b612f7483612c14565b612fac57826040517f477707e80000000000000000000000000000000000000000000000000000000081526004016107ab9190614851565b6000818152600260205260408120558115801590612fcc57506224ea0082105b15613006576040517f9a71997b000000000000000000000000000000000000000000000000000000008152600481018390526024016107ab565b505050565b604080517f4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454602080830191909152818301859052825180830384018152606083019384905280519101207fe32954eb0000000000000000000000000000000000000000000000000000000090925284906001600160a01b0382169063e32954eb9061309c9085908790606401614864565b6000604051808303816000875af11580156130bb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526130e3919081019061487d565b505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637a806d6b3383858760405160200161312e9190614943565b6040516020818303038152906040526040518563ffffffff1660e01b815260040161315c9493929190614984565b6020604051808303816000875af115801561317b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612424919061448d565b825160208401206040516376d7cfb760e11b81526000916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163edaf9f6e916131f79160040190815260200190565b602060405180830381865afa158015613214573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061323891906144e8565b60405163c08d52af60e01b81526001600160a01b0380831660048301529192506000917f0000000000000000000000000000000000000000000000000000000000000000169063c08d52af90602401602060405180830381865afa1580156132a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132c8919061448d565b604080516020808201909252600090528651908701209091507fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701461345b576040516344430b6960e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906344430b6990602401602060405180830381865afa15801561336f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613393919061448d565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637d31266a6064838a602001518b600001516133db91906143e2565b6133e59190614505565b6133ef919061451c565b8888888c602001518d6000015161340691906143e2565b896040518763ffffffff1660e01b815260040161342795949392919061453e565b6000604051808303818588803b15801561344057600080fd5b505af1158015613454573d6000803e3d6000fd5b5050505050505b600154602087015187516000926001600160a01b03169160649161347f91906143e2565b61348a906023614505565b613494919061451c565b604051600081818185875af1925050503d80600081146134d0576040519150601f19603f3d011682016040523d82523d6000602084013e6134d5565b606091505b50509050806135265760405162461bcd60e51b815260206004820152601860248201527f5061796d656e7420746f20696e666f4669206661696c6564000000000000000060448201526064016107ab565b50505050505050565b845115613548576135488387805190602001208761300b565b81156130e3576135598684336130eb565b85516020870120604051631f8e227160e01b815260048101919091526001600160a01b038581166024830152604482018390527f00000000000000000000000000000000000000000000000000000000000000001690631f8e227190606401600060405180830381600087803b1580156135d257600080fd5b505af1158015611c3b573d6000803e3d6000fd5b6136113330836020015184600001516135ff91906143e2565b6001600160a01b03861692919061368d565b5050565b6040516001600160a01b03831660248201526044810182905261300690849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b0319909316929092179091526138ca565b6040516001600160a01b03808516602483015283166044820152606481018290526124249085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401613641565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8051600090819081905b808210156138c1576000858381518110613761576137616149b8565b01602001516001600160f81b03191690507f80000000000000000000000000000000000000000000000000000000000000008110156137ac576137a56001846143e2565b92506138ae565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156137e9576137a56002846143e2565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015613826576137a56003846143e2565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015613863576137a56004846143e2565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156138a0576137a56005846143e2565b6138ab6006846143e2565b92505b50826138b9816149ce565b935050613745565b50909392505050565b600061391f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166139b29092919063ffffffff16565b905080516000148061394057508080602001905181019061394091906146b1565b6130065760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107ab565b60606139c184846000856139c9565b949350505050565b606082471015613a415760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016107ab565b600080866001600160a01b03168587604051613a5d91906149e7565b60006040518083038185875af1925050503d8060008114613a9a576040519150601f19603f3d011682016040523d82523d6000602084013e613a9f565b606091505b5091509150613ab087838387613abb565b979650505050505050565b60608315613b2a578251600003613b23576001600160a01b0385163b613b235760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107ab565b50816139c1565b6139c18383815115613b3f5781518083602001fd5b8060405162461bcd60e51b81526004016107ab9190614851565b600060208284031215613b6b57600080fd5b81356001600160e01b031981168114612cd057600080fd5b6001600160a01b038116811461163657600080fd5b8035613ba381613b83565b919050565b600060208284031215613bba57600080fd5b8135612cd081613b83565b634e487b7160e01b600052604160045260246000fd5b604051610100810167ffffffffffffffff81118282101715613bff57613bff613bc5565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715613c2e57613c2e613bc5565b604052919050565b600067ffffffffffffffff821115613c5057613c50613bc5565b50601f01601f191660200190565b6000613c71613c6c84613c36565b613c05565b9050828152838383011115613c8557600080fd5b828260208301376000602084830101529392505050565b600082601f830112613cad57600080fd5b612cd083833560208501613c5e565b600067ffffffffffffffff821115613cd657613cd6613bc5565b5060051b60200190565b600082601f830112613cf157600080fd5b81356020613d01613c6c83613cbc565b82815260059290921b84018101918181019086841115613d2057600080fd5b8286015b84811015613d7557803567ffffffffffffffff811115613d445760008081fd5b8701603f81018913613d565760008081fd5b613d67898683013560408401613c5e565b845250918301918301613d24565b509695505050505050565b801515811461163657600080fd5b8035613ba381613d80565b803561ffff81168114613ba357600080fd5b6000806000806000806000806000806101408b8d031215613dcb57600080fd5b8a3567ffffffffffffffff80821115613de357600080fd5b613def8e838f01613c9c565b9b50613dfd60208e01613b98565b9a5060408d0135995060608d01359850613e1960808e01613b98565b975060a08d0135915080821115613e2f57600080fd5b613e3b8e838f01613ce0565b9650613e4960c08e01613d8e565b9550613e5760e08e01613d99565b9450613e666101008e01613d8e565b93506101208d0135915080821115613e7d57600080fd5b50613e8a8d828e01613c9c565b9150509295989b9194979a5092959850565b600060408284031215613eae57600080fd5b6040516040810167ffffffffffffffff8282108183111715613ed257613ed2613bc5565b816040528293508435915080821115613eea57600080fd5b50613ef785828601613c9c565b8252506020830135613f0881613b83565b6020919091015292915050565b60008060008060808587031215613f2b57600080fd5b843567ffffffffffffffff80821115613f4357600080fd5b908601906101008289031215613f5857600080fd5b613f60613bdb565b823582811115613f6f57600080fd5b613f7b8a828601613c9c565b825250613f8a60208401613b98565b60208201526040830135604082015260608301356060820152613faf60808401613b98565b608082015260a083013582811115613fc657600080fd5b613fd28a828601613ce0565b60a083015250613fe460c08401613d8e565b60c0820152613ff560e08401613d99565b60e08201529550602087013591508082111561401057600080fd5b61401c88838901613e9c565b945061402a60408801613d8e565b9350606087013591508082111561404057600080fd5b5061404d87828801613c9c565b91505092959194509250565b60008083601f84011261406b57600080fd5b50813567ffffffffffffffff81111561408357600080fd5b60208301915083602082850101111561409b57600080fd5b9250929050565b600080600080606085870312156140b857600080fd5b843567ffffffffffffffff8111156140cf57600080fd5b6140db87828801614059565b9095509350506020850135915060408501356140f681613d80565b939692955090935050565b60008060008060008060a0878903121561411a57600080fd5b863567ffffffffffffffff8082111561413257600080fd5b61413e8a838b01614059565b909850965060208901359550604089013591508082111561415e57600080fd5b5061416b89828a01613c9c565b935050606087013561417c81613b83565b9150608087013561418c81613d80565b809150509295509295509295565b6000806000606084860312156141af57600080fd5b83356141ba81613b83565b925060208401356141ca81613b83565b929592945050506040919091013590565b6000806000606084860312156141f057600080fd5b833567ffffffffffffffff81111561420757600080fd5b61421386828701613c9c565b93505060208401359150604084013561422b81613d80565b809150509250925092565b6000806000806080858703121561424c57600080fd5b843567ffffffffffffffff8082111561426457600080fd5b61427088838901613c9c565b955060208701359450604087013591508082111561428d57600080fd5b5061429a87828801613c9c565b92505060608501356140f681613d80565b6000602082840312156142bd57600080fd5b5035919050565b6000602082840312156142d657600080fd5b813567ffffffffffffffff8111156142ed57600080fd5b6139c184828501613c9c565b60008060008060008060008060006101208a8c03121561431857600080fd5b893567ffffffffffffffff8082111561433057600080fd5b61433c8d838e01613c9c565b9a5060208c0135915061434e82613b83565b90985060408b0135975060608b0135965060808b01359061436e82613b83565b90955060a08b0135908082111561438457600080fd5b506143918c828d01613ce0565b9450506143a060c08b01613d8e565b92506143ae60e08b01613d99565b91506143bd6101008b01613d8e565b90509295985092959850929598565b634e487b7160e01b600052601160045260246000fd5b80820180821115610751576107516143cc565b60005b838110156144105781810151838201526020016143f8565b50506000910152565b600081518084526144318160208601602086016143f5565b601f01601f19169290920160200192915050565b60a08152600061445860a0830188614419565b90506001600160a01b03808716602084015285604084015280851660608401525061ffff831660808301529695505050505050565b60006020828403121561449f57600080fd5b5051919050565b6080815260006144b96080830187614419565b6020830195909552506040810192909252606090910152919050565b81810381811115610751576107516143cc565b6000602082840312156144fa57600080fd5b8151612cd081613b83565b8082028115828204841417610751576107516143cc565b60008261453957634e487b7160e01b600052601260045260246000fd5b500490565b60a08152600061455160a0830188614419565b82810360208401526145638188614419565b6001600160a01b03968716604085015260608401959095525050921660809092019190915292915050565b8183823760009101908152919050565b60006145ac613c6c84613c36565b90508281528383830111156145c057600080fd5b612cd08360208301846143f5565b6000602082840312156145e057600080fd5b815167ffffffffffffffff8111156145f757600080fd5b8201601f8101841361460857600080fd5b6139c18482516020840161459e565b606081528360608201528385608083013760006080858301015260006080601f19601f870116830101905083602083015282604083015295945050505050565b8381526001600160a01b03831660208201526060604082015260006125b96060830184614419565b84815260006001600160a01b038086166020840152808516604084015250608060608301526127676080830184614419565b6000602082840312156146c357600080fd5b8151612cd081613d80565b6080815260006146e16080830187614419565b60208301959095525060408101929092521515606090910152919050565b60006040828403121561471157600080fd5b6040516040810181811067ffffffffffffffff8211171561473457614734613bc5565b604052825181526020928301519281019290925250919050565b60a08152600061476160a0830188614419565b866020840152856040840152828103606084015261477f8186614419565b91505082151560808301529695505050505050565b600081518084526020808501808196508360051b8101915082860160005b858110156147dc5782840389526147ca848351614419565b988501989350908401906001016147b2565b5091979650505050505050565b60006101208b83526001600160a01b03808c1660208501528a60408501528960608501528089166080850152508060a084015261482881840188614794565b95151560c0840152505061ffff9290921660e08301521515610100909101529695505050505050565b602081526000612cd06020830184614419565b8281526040602082015260006139c16040830184614794565b6000602080838503121561489057600080fd5b825167ffffffffffffffff808211156148a857600080fd5b818501915085601f8301126148bc57600080fd5b81516148ca613c6c82613cbc565b81815260059190911b830184019084810190888311156148e957600080fd5b8585015b83811015614936578051858111156149055760008081fd5b8601603f81018b136149175760008081fd5b6149288b898301516040840161459e565b8452509186019186016148ed565b5098975050505050505050565b600082516149558184602087016143f5565b7f2e63726561746f72000000000000000000000000000000000000000000000000920191825250600801919050565b60006001600160a01b0380871683528086166020840152808516604084015250608060608301526127676080830184614419565b634e487b7160e01b600052603260045260246000fd5b6000600182016149e0576149e06143cc565b5060010190565b600082516149f98184602087016143f5565b919091019291505056fea26469706673582212209ee5d903e43e48af6eeb48bd3e33eafaaed65e91963da16c30e9c369a760a71364736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106102195760003560e01c8063839df9451161011d578063a680baaf116100b0578063ce1e09c01161007f578063da7fc24f11610064578063da7fc24f1461068e578063f14fcbc8146106ae578063f2fde38b146106ce57600080fd5b8063ce1e09c014610626578063d3419bf31461065a57600080fd5b8063a680baaf1461059c578063a8e5fbc0146105bc578063aeb8ce9b146105f0578063c53c0ec11461061057600080fd5b80638da5cb5b116100ec5780638da5cb5b1461051e5780639791c0971461053c578063a0e3aef11461055c578063a31bc89a1461057c57600080fd5b8063839df9451461047857806388cccc09146104b35780638a95b09f146104d35780638d839ffe146104ea57600080fd5b806349df728c116101b05780635d3590d51161017f578063715018a611610164578063715018a61461040f578063786d96a114610424578063808698531461044457600080fd5b80635d3590d5146103b45780636cfc51e2146103d457600080fd5b806349df728c146103155780634ba694bd146103355780634be2b2ec14610381578063569f8ab31461039457600080fd5b806323ed462e116101ec57806323ed462e146102ad57806327cdd135146102c05780633c3a7d35146102e05780633ccfd60b1461030057600080fd5b806301ffc9a71461021e578063094f716d14610253578063144fa6d71461025d5780631baaaffe1461027d575b600080fd5b34801561022a57600080fd5b5061023e610239366004613b59565b6106ee565b60405190151581526020015b60405180910390f35b61025b610757565b005b34801561026957600080fd5b5061025b610278366004613ba8565b61085f565b34801561028957600080fd5b5061023e610298366004613ba8565b60056020526000908152604090205460ff1681565b61025b6102bb366004613dab565b61088b565b3480156102cc57600080fd5b5061025b6102db366004613f15565b610b13565b3480156102ec57600080fd5b5061025b6102fb3660046140a2565b611116565b34801561030c57600080fd5b5061025b6115fc565b34801561032157600080fd5b5061025b610330366004613ba8565b611639565b34801561034157600080fd5b506103697f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161024a565b61025b61038f3660046140a2565b6116c7565b3480156103a057600080fd5b5061025b6103af366004614101565b611c47565b3480156103c057600080fd5b5061025b6103cf36600461419a565b6123a9565b3480156103e057600080fd5b506103f46103ef3660046141db565b61242a565b6040805182518152602092830151928101929092520161024a565b34801561041b57600080fd5b5061025b6125c2565b34801561043057600080fd5b506103f461043f366004614236565b6125d6565b34801561045057600080fd5b506103697f000000000000000000000000000000000000000000000000000000000000000081565b34801561048457600080fd5b506104a56104933660046142ab565b60026020526000908152604090205481565b60405190815260200161024a565b3480156104bf57600080fd5b50600154610369906001600160a01b031681565b3480156104df57600080fd5b506104a56224ea0081565b3480156104f657600080fd5b506104a57f000000000000000000000000000000000000000000000000000000000000000081565b34801561052a57600080fd5b506000546001600160a01b0316610369565b34801561054857600080fd5b5061023e6105573660046142c4565b612771565b34801561056857600080fd5b506104a56105773660046142f9565b612786565b34801561058857600080fd5b5061025b610597366004613dab565b612826565b3480156105a857600080fd5b50600354610369906001600160a01b031681565b3480156105c857600080fd5b506103697f000000000000000000000000000000000000000000000000000000000000000081565b3480156105fc57600080fd5b5061023e61060b3660046142c4565b612c14565b34801561061c57600080fd5b506104a560045481565b34801561063257600080fd5b506104a57f000000000000000000000000000000000000000000000000000000000000000081565b34801561066657600080fd5b506103697f000000000000000000000000000000000000000000000000000000000000000081565b34801561069a57600080fd5b5061025b6106a9366004613ba8565b612cd7565b3480156106ba57600080fd5b5061025b6106c93660046142ab565b612d0e565b3480156106da57600080fd5b5061025b6106e9366004613ba8565b612d97565b60006001600160e01b031982167f01ffc9a700000000000000000000000000000000000000000000000000000000148061075157506001600160e01b031982167ff2d8c3a500000000000000000000000000000000000000000000000000000000145b92915050565b61075f612e24565b600034116107b45760405162461bcd60e51b815260206004820152601f60248201527f4d7573742073656e642076616c756520746f20726573657420696e666f46690060448201526064015b60405180910390fd5b6001546040516000916001600160a01b03169034908381818185875af1925050503d8060008114610801576040519150601f19603f3d011682016040523d82523d6000602084013e610806565b606091505b50509050806108575760405162461bcd60e51b815260206004820152601860248201527f5061796d656e7420746f20696e666f4669206661696c6564000000000000000060448201526064016107ab565b506000600455565b610867612e24565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b60006108988b8a8561242a565b602081015181519192506108ab916143e2565b3410156108cb5760405163044044a560e21b815260040160405180910390fd5b6108e68b8a6108e18e8e8e8e8e8e8e8e8e612786565b612e7e565b604051635200a4c160e11b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a40149829061093d908f908f908f908e908c90600401614445565b6020604051808303816000875af115801561095c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610980919061448d565b87519091501561099c5761099c888d805190602001208961300b565b8515610a3f576109ad8c89336130eb565b8b5160208d0120604051631f8e227160e01b815260048101919091526001600160a01b038c81166024830152604482018390527f00000000000000000000000000000000000000000000000000000000000000001690631f8e227190606401600060405180830381600087803b158015610a2657600080fd5b505af1158015610a3a573d6000803e3d6000fd5b505050505b8a6001600160a01b03168c805190602001207f69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf278e8560000151866020015186604051610a8e94939291906144a6565b60405180910390a360208201518251610aa791906143e2565b341115610af9576020820151825133916108fc91610ac591906143e2565b610acf90346144d5565b6040518115909202916000818181858888f19350505050158015610af7573d6000803e3d6000fd5b505b610b0582848e8e61319f565b505050505050505050505050565b6020808401516001600160a01b031660009081526005909152604090205460ff161515600114610b855760405162461bcd60e51b815260206004820152601860248201527f556e6e6163657074656420546f6b656e2041646472657373000000000000000060448201526064016107ab565b610bc3846000015185604001516108e18760000151886020015189604001518a606001518b608001518c60a001518d60c001518e60e001518d612786565b6000610bdd856000015186604001518660000151866125d6565b60208101518151919250610bf0916143e2565b60208501516040516370a0823160e01b81523360048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610c3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5e919061448d565b1015610c7d5760405163044044a560e21b815260040160405180910390fd5b84516020860151604080880151608089015160e08a01519251635200a4c160e11b81526000956001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169563a401498295610ce49592949193600401614445565b6020604051808303816000875af1158015610d03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d27919061448d565b9050610d4b86600001518760a00151886020015189608001518a60c001518661352f565b610d598560200151836135e6565b85602001516001600160a01b03168660000151805190602001207f69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf2788600001518560000151866020015186604051610db494939291906144a6565b60405180910390a3825160208401206040516376d7cfb760e11b81526000916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163edaf9f6e91610e149160040190815260200190565b602060405180830381865afa158015610e31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5591906144e8565b60405163c08d52af60e01b81526001600160a01b0380831660048301529192506000917f0000000000000000000000000000000000000000000000000000000000000000169063c08d52af90602401602060405180830381865afa158015610ec1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee5919061448d565b604080516020808201909252600090528651908701209091507fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470146110bd576040516344430b6960e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906344430b6990602401602060405180830381865afa158015610f8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb0919061448d565b90506110167f000000000000000000000000000000000000000000000000000000000000000060648388602001518960000151610fed91906143e2565b610ff79190614505565b611001919061451c565b60208b01516001600160a01b03169190613615565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ff8f3947878b600001518c6020015189602001518a6000015161106491906143e2565b8d602001516040518663ffffffff1660e01b815260040161108995949392919061453e565b600060405180830381600087803b1580156110a357600080fd5b505af11580156110b7573d6000803e3d6000fd5b50505050505b6001546020850151855161110c926001600160a01b0316916064916110e291906143e2565b6110ed906023614505565b6110f7919061451c565b60208a01516001600160a01b03169190613615565b5050505050505050565b6003546001600160a01b031633146111705760405162461bcd60e51b815260206004820152600b60248201527f4e6f74204261636b656e6400000000000000000000000000000000000000000060448201526064016107ab565b6000848460405161118292919061458e565b604080519182900382206020601f8801819004810284018101909252868352925082916000916111d19190899089908190840183828082843760009201919091525089925088915061242a9050565b604051630338bc9760e41b8152600481018590529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063338bc97090602401600060405180830381865afa15801561123c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261126491908101906145ce565b60405163c475abff60e01b815260048101859052602481018890529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c475abff906044016020604051808303816000875af11580156112d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112fc919061448d565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638b07795b8a8a60405161133d92919061458e565b60405190819003812060e083901b6001600160e01b0319168252600482015260248101849052604401600060405180830381600087803b15801561138057600080fd5b505af1158015611394573d6000803e3d6000fd5b50505050847f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae8a8a8660000151856040516113d29493929190614617565b60405180910390a2815160208301206040516376d7cfb760e11b81526000917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169163edaf9f6e916114329160040190815260200190565b602060405180830381865afa15801561144f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147391906144e8565b6001600160a01b0316146115b357815160208301206040516376d7cfb760e11b81526000916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163edaf9f6e916114d99160040190815260200190565b602060405180830381865afa1580156114f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151a91906144e8565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663668c91c88560200151866000015161155f91906143e2565b83866040518463ffffffff1660e01b815260040161157f93929190614657565b600060405180830381600087803b15801561159957600080fd5b505af11580156115ad573d6000803e3d6000fd5b50505050505b602083015183516064916115c6916143e2565b6115d1906023614505565b6115db919061451c565b600460008282546115ec91906143e2565b9091555050505050505050505050565b600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015611636573d6000803e3d6000fd5b50565b61163661164e6000546001600160a01b031690565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015611692573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b6919061448d565b6001600160a01b0384169190613615565b600084846040516116d992919061458e565b604080519182900382206020601f8801819004810284018101909252868352925082916000916117289190899089908190840183828082843760009201919091525089925088915061242a9050565b604051630338bc9760e41b8152600481018590529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063338bc97090602401600060405180830381865afa158015611793573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526117bb91908101906145ce565b82519091503410156117e05760405163044044a560e21b815260040160405180910390fd5b60405163c475abff60e01b815260048101849052602481018790526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c475abff906044016020604051808303816000875af1158015611851573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611875919061448d565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638b07795b8a8a6040516118b692919061458e565b60405190819003812060e083901b6001600160e01b0319168252600482015260248101849052604401600060405180830381600087803b1580156118f957600080fd5b505af115801561190d573d6000803e3d6000fd5b50505050826000015134111561195957825133906108fc9061192f90346144d5565b6040518115909202916000818181858888f19350505050158015611957573d6000803e3d6000fd5b505b847f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae8a8a348560405161198f9493929190614617565b60405180910390a2815160208301206040516376d7cfb760e11b81526000917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169163edaf9f6e916119ef9160040190815260200190565b602060405180830381865afa158015611a0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3091906144e8565b6001600160a01b031614611b7057815160208301206040516376d7cfb760e11b81526000916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163edaf9f6e91611a969160040190815260200190565b602060405180830381865afa158015611ab3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ad791906144e8565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e858db0885602001518660000151611b1c91906143e2565b83866040518463ffffffff1660e01b8152600401611b3c93929190614657565b600060405180830381600087803b158015611b5657600080fd5b505af1158015611b6a573d6000803e3d6000fd5b50505050505b600154602084015184516000926001600160a01b031691606491611b9491906143e2565b611b9f906023614505565b611ba9919061451c565b604051600081818185875af1925050503d8060008114611be5576040519150601f19603f3d011682016040523d82523d6000602084013e611bea565b606091505b5050905080611c3b5760405162461bcd60e51b815260206004820152601860248201527f5061796d656e7420746f20696e666f4669206661696c6564000000000000000060448201526064016107ab565b50505050505050505050565b6001600160a01b03821660009081526005602052604090205460ff161515600114611cb45760405162461bcd60e51b815260206004820152601860248201527f556e6e6163657074656420546f6b656e2041646472657373000000000000000060448201526064016107ab565b60008686604051611cc692919061458e565b604051908190038120630338bc9760e41b825260048201819052915081906000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063338bc97090602401600060405180830381865afa158015611d38573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d6091908101906145ce565b90506000611da88a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92508b91508990506125d6565b60208101518151919250611dbb916143e2565b6040516370a0823160e01b81523360048201526001600160a01b038816906370a0823190602401602060405180830381865afa158015611dff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e23919061448d565b1015611e425760405163044044a560e21b815260040160405180910390fd5b611e6d333083602001518460000151611e5b91906143e2565b6001600160a01b038a1692919061368d565b60405163c475abff60e01b815260048101849052602481018990526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c475abff906044016020604051808303816000875af1158015611ede573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f02919061448d565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638b07795b8c8c604051611f4392919061458e565b60405190819003812060e083901b6001600160e01b0319168252600482015260248101849052604401600060405180830381600087803b158015611f8657600080fd5b505af1158015611f9a573d6000803e3d6000fd5b50505050847f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae8c8c85602001518660000151611fd691906143e2565b85604051611fe79493929190614617565b60405180910390a2825160208401206040516376d7cfb760e11b81526000917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169163edaf9f6e916120479160040190815260200190565b602060405180830381865afa158015612064573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061208891906144e8565b6001600160a01b03161461234d57825160208401206040516376d7cfb760e11b81526000916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163edaf9f6e916120ee9160040190815260200190565b602060405180830381865afa15801561210b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061212f91906144e8565b60405163c08d52af60e01b81526001600160a01b0380831660048301529192506000917f0000000000000000000000000000000000000000000000000000000000000000169063c08d52af90602401602060405180830381865afa15801561219b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121bf919061448d565b6040516344430b6960e01b8152600481018290529091506000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906344430b6990602401602060405180830381865afa15801561222a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224e919061448d565b90506122b2307f000000000000000000000000000000000000000000000000000000000000000060648489602001518a6000015161228c91906143e2565b6122969190614505565b6122a0919061451c565b6001600160a01b038e1692919061368d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d184befa866020015187600001516122f591906143e2565b858d8a6040518563ffffffff1660e01b8152600401612317949392919061467f565b600060405180830381600087803b15801561233157600080fd5b505af1158015612345573d6000803e3d6000fd5b505050505050505b6001546020830151835161239c9230926001600160a01b0390911691606491612375916143e2565b612380906023614505565b61238a919061451c565b6001600160a01b038b1692919061368d565b5050505050505050505050565b6123b1612e24565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015612400573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061242491906146b1565b50505050565b604080518082019091526000808252602082015282158061244e57506224ea008310155b61249a5760405162461bcd60e51b815260206004820152601060248201527f496e76616c6964206475726174696f6e0000000000000000000000000000000060448201526064016107ab565b83516020850120604051636b727d4360e11b8152600481018290526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691638416a3749188917f00000000000000000000000000000000000000000000000000000000000000009091169063d6e4fa8690602401602060405180830381865afa158015612534573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612558919061448d565b87876040518563ffffffff1660e01b815260040161257994939291906146ce565b6040805180830381865afa158015612595573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125b991906146ff565b95945050505050565b6125ca612e24565b6125d460006136de565b565b60408051808201909152600080825260208201528315806125fa57506224ea008410155b6126465760405162461bcd60e51b815260206004820152601060248201527f496e76616c6964206475726174696f6e0000000000000000000000000000000060448201526064016107ab565b84516020860120604051636b727d4360e11b8152600481018290526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691638361401d9189917f00000000000000000000000000000000000000000000000000000000000000009091169063d6e4fa8690602401602060405180830381865afa1580156126e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612704919061448d565b8888886040518663ffffffff1660e01b815260040161272795949392919061474e565b6040805180830381865afa158015612743573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061276791906146ff565b9695505050505050565b6000600261277e8361373b565b101592915050565b885160208a0120845160009190158015906127a857506001600160a01b038716155b156127df576040517fd3f605c400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808a8a8a8a8a8a8a8a604051602001612800999897969594939291906147e9565b604051602081830303815290604052805190602001209150509998505050505050505050565b6003546001600160a01b031633146128805760405162461bcd60e51b815260206004820152600b60248201527f4e6f74204261636b656e6400000000000000000000000000000000000000000060448201526064016107ab565b600061288d8b8a8561242a565b90506128a58b8a6108e18e8e8e8e8e8e8e8e8e612786565b604051635200a4c160e11b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a4014982906128fc908f908f908f908e908c90600401614445565b6020604051808303816000875af115801561291b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061293f919061448d565b87519091501561295b5761295b888d805190602001208961300b565b85156129fe5761296c8c898d6130eb565b8b5160208d0120604051631f8e227160e01b815260048101919091526001600160a01b038c81166024830152604482018c90527f00000000000000000000000000000000000000000000000000000000000000001690631f8e227190606401600060405180830381600087803b1580156129e557600080fd5b505af11580156129f9573d6000803e3d6000fd5b505050505b8a6001600160a01b03168c805190602001207f69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf278e8560000151866020015186604051612a4d94939291906144a6565b60405180910390a3825160208401206040516376d7cfb760e11b81526000916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163edaf9f6e91612aad9160040190815260200190565b602060405180830381865afa158015612aca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aee91906144e8565b604080516020808201909252600090528551908601209091507fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47014612bc7577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663898c6495858f8f87602001518860000151612b7391906143e2565b866040518663ffffffff1660e01b8152600401612b9495949392919061453e565b600060405180830381600087803b158015612bae57600080fd5b505af1158015612bc2573d6000803e3d6000fd5b505050505b60208301518351606491612bda916143e2565b612be5906023614505565b612bef919061451c565b60046000828254612c0091906143e2565b909155505050505050505050505050505050565b80516020820120600090612c2783612771565b8015612cd057506040517f96e494e8000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906396e494e890602401602060405180830381865afa158015612cac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cd091906146b1565b9392505050565b612cdf612e24565b6003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000818152600260205260409020544290612d4a907f0000000000000000000000000000000000000000000000000000000000000000906143e2565b10612d84576040517f0a059d71000000000000000000000000000000000000000000000000000000008152600481018290526024016107ab565b6000908152600260205260409020429055565b612d9f612e24565b6001600160a01b038116612e1b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016107ab565b611636816136de565b6000546001600160a01b031633146125d45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107ab565b6000818152600260205260409020544290612eba907f0000000000000000000000000000000000000000000000000000000000000000906143e2565b1115612ef5576040517f5320bcf9000000000000000000000000000000000000000000000000000000008152600481018290526024016107ab565b6000818152600260205260409020544290612f31907f0000000000000000000000000000000000000000000000000000000000000000906143e2565b11612f6b576040517fcb7690d7000000000000000000000000000000000000000000000000000000008152600481018290526024016107ab565b612f7483612c14565b612fac57826040517f477707e80000000000000000000000000000000000000000000000000000000081526004016107ab9190614851565b6000818152600260205260408120558115801590612fcc57506224ea0082105b15613006576040517f9a71997b000000000000000000000000000000000000000000000000000000008152600481018390526024016107ab565b505050565b604080517f4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454602080830191909152818301859052825180830384018152606083019384905280519101207fe32954eb0000000000000000000000000000000000000000000000000000000090925284906001600160a01b0382169063e32954eb9061309c9085908790606401614864565b6000604051808303816000875af11580156130bb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526130e3919081019061487d565b505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637a806d6b3383858760405160200161312e9190614943565b6040516020818303038152906040526040518563ffffffff1660e01b815260040161315c9493929190614984565b6020604051808303816000875af115801561317b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612424919061448d565b825160208401206040516376d7cfb760e11b81526000916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163edaf9f6e916131f79160040190815260200190565b602060405180830381865afa158015613214573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061323891906144e8565b60405163c08d52af60e01b81526001600160a01b0380831660048301529192506000917f0000000000000000000000000000000000000000000000000000000000000000169063c08d52af90602401602060405180830381865afa1580156132a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132c8919061448d565b604080516020808201909252600090528651908701209091507fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701461345b576040516344430b6960e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906344430b6990602401602060405180830381865afa15801561336f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613393919061448d565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637d31266a6064838a602001518b600001516133db91906143e2565b6133e59190614505565b6133ef919061451c565b8888888c602001518d6000015161340691906143e2565b896040518763ffffffff1660e01b815260040161342795949392919061453e565b6000604051808303818588803b15801561344057600080fd5b505af1158015613454573d6000803e3d6000fd5b5050505050505b600154602087015187516000926001600160a01b03169160649161347f91906143e2565b61348a906023614505565b613494919061451c565b604051600081818185875af1925050503d80600081146134d0576040519150601f19603f3d011682016040523d82523d6000602084013e6134d5565b606091505b50509050806135265760405162461bcd60e51b815260206004820152601860248201527f5061796d656e7420746f20696e666f4669206661696c6564000000000000000060448201526064016107ab565b50505050505050565b845115613548576135488387805190602001208761300b565b81156130e3576135598684336130eb565b85516020870120604051631f8e227160e01b815260048101919091526001600160a01b038581166024830152604482018390527f00000000000000000000000000000000000000000000000000000000000000001690631f8e227190606401600060405180830381600087803b1580156135d257600080fd5b505af1158015611c3b573d6000803e3d6000fd5b6136113330836020015184600001516135ff91906143e2565b6001600160a01b03861692919061368d565b5050565b6040516001600160a01b03831660248201526044810182905261300690849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b0319909316929092179091526138ca565b6040516001600160a01b03808516602483015283166044820152606481018290526124249085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401613641565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8051600090819081905b808210156138c1576000858381518110613761576137616149b8565b01602001516001600160f81b03191690507f80000000000000000000000000000000000000000000000000000000000000008110156137ac576137a56001846143e2565b92506138ae565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156137e9576137a56002846143e2565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015613826576137a56003846143e2565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015613863576137a56004846143e2565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b0319821610156138a0576137a56005846143e2565b6138ab6006846143e2565b92505b50826138b9816149ce565b935050613745565b50909392505050565b600061391f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166139b29092919063ffffffff16565b905080516000148061394057508080602001905181019061394091906146b1565b6130065760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107ab565b60606139c184846000856139c9565b949350505050565b606082471015613a415760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016107ab565b600080866001600160a01b03168587604051613a5d91906149e7565b60006040518083038185875af1925050503d8060008114613a9a576040519150601f19603f3d011682016040523d82523d6000602084013e613a9f565b606091505b5091509150613ab087838387613abb565b979650505050505050565b60608315613b2a578251600003613b23576001600160a01b0385163b613b235760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107ab565b50816139c1565b6139c18383815115613b3f5781518083602001fd5b8060405162461bcd60e51b81526004016107ab9190614851565b600060208284031215613b6b57600080fd5b81356001600160e01b031981168114612cd057600080fd5b6001600160a01b038116811461163657600080fd5b8035613ba381613b83565b919050565b600060208284031215613bba57600080fd5b8135612cd081613b83565b634e487b7160e01b600052604160045260246000fd5b604051610100810167ffffffffffffffff81118282101715613bff57613bff613bc5565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715613c2e57613c2e613bc5565b604052919050565b600067ffffffffffffffff821115613c5057613c50613bc5565b50601f01601f191660200190565b6000613c71613c6c84613c36565b613c05565b9050828152838383011115613c8557600080fd5b828260208301376000602084830101529392505050565b600082601f830112613cad57600080fd5b612cd083833560208501613c5e565b600067ffffffffffffffff821115613cd657613cd6613bc5565b5060051b60200190565b600082601f830112613cf157600080fd5b81356020613d01613c6c83613cbc565b82815260059290921b84018101918181019086841115613d2057600080fd5b8286015b84811015613d7557803567ffffffffffffffff811115613d445760008081fd5b8701603f81018913613d565760008081fd5b613d67898683013560408401613c5e565b845250918301918301613d24565b509695505050505050565b801515811461163657600080fd5b8035613ba381613d80565b803561ffff81168114613ba357600080fd5b6000806000806000806000806000806101408b8d031215613dcb57600080fd5b8a3567ffffffffffffffff80821115613de357600080fd5b613def8e838f01613c9c565b9b50613dfd60208e01613b98565b9a5060408d0135995060608d01359850613e1960808e01613b98565b975060a08d0135915080821115613e2f57600080fd5b613e3b8e838f01613ce0565b9650613e4960c08e01613d8e565b9550613e5760e08e01613d99565b9450613e666101008e01613d8e565b93506101208d0135915080821115613e7d57600080fd5b50613e8a8d828e01613c9c565b9150509295989b9194979a5092959850565b600060408284031215613eae57600080fd5b6040516040810167ffffffffffffffff8282108183111715613ed257613ed2613bc5565b816040528293508435915080821115613eea57600080fd5b50613ef785828601613c9c565b8252506020830135613f0881613b83565b6020919091015292915050565b60008060008060808587031215613f2b57600080fd5b843567ffffffffffffffff80821115613f4357600080fd5b908601906101008289031215613f5857600080fd5b613f60613bdb565b823582811115613f6f57600080fd5b613f7b8a828601613c9c565b825250613f8a60208401613b98565b60208201526040830135604082015260608301356060820152613faf60808401613b98565b608082015260a083013582811115613fc657600080fd5b613fd28a828601613ce0565b60a083015250613fe460c08401613d8e565b60c0820152613ff560e08401613d99565b60e08201529550602087013591508082111561401057600080fd5b61401c88838901613e9c565b945061402a60408801613d8e565b9350606087013591508082111561404057600080fd5b5061404d87828801613c9c565b91505092959194509250565b60008083601f84011261406b57600080fd5b50813567ffffffffffffffff81111561408357600080fd5b60208301915083602082850101111561409b57600080fd5b9250929050565b600080600080606085870312156140b857600080fd5b843567ffffffffffffffff8111156140cf57600080fd5b6140db87828801614059565b9095509350506020850135915060408501356140f681613d80565b939692955090935050565b60008060008060008060a0878903121561411a57600080fd5b863567ffffffffffffffff8082111561413257600080fd5b61413e8a838b01614059565b909850965060208901359550604089013591508082111561415e57600080fd5b5061416b89828a01613c9c565b935050606087013561417c81613b83565b9150608087013561418c81613d80565b809150509295509295509295565b6000806000606084860312156141af57600080fd5b83356141ba81613b83565b925060208401356141ca81613b83565b929592945050506040919091013590565b6000806000606084860312156141f057600080fd5b833567ffffffffffffffff81111561420757600080fd5b61421386828701613c9c565b93505060208401359150604084013561422b81613d80565b809150509250925092565b6000806000806080858703121561424c57600080fd5b843567ffffffffffffffff8082111561426457600080fd5b61427088838901613c9c565b955060208701359450604087013591508082111561428d57600080fd5b5061429a87828801613c9c565b92505060608501356140f681613d80565b6000602082840312156142bd57600080fd5b5035919050565b6000602082840312156142d657600080fd5b813567ffffffffffffffff8111156142ed57600080fd5b6139c184828501613c9c565b60008060008060008060008060006101208a8c03121561431857600080fd5b893567ffffffffffffffff8082111561433057600080fd5b61433c8d838e01613c9c565b9a5060208c0135915061434e82613b83565b90985060408b0135975060608b0135965060808b01359061436e82613b83565b90955060a08b0135908082111561438457600080fd5b506143918c828d01613ce0565b9450506143a060c08b01613d8e565b92506143ae60e08b01613d99565b91506143bd6101008b01613d8e565b90509295985092959850929598565b634e487b7160e01b600052601160045260246000fd5b80820180821115610751576107516143cc565b60005b838110156144105781810151838201526020016143f8565b50506000910152565b600081518084526144318160208601602086016143f5565b601f01601f19169290920160200192915050565b60a08152600061445860a0830188614419565b90506001600160a01b03808716602084015285604084015280851660608401525061ffff831660808301529695505050505050565b60006020828403121561449f57600080fd5b5051919050565b6080815260006144b96080830187614419565b6020830195909552506040810192909252606090910152919050565b81810381811115610751576107516143cc565b6000602082840312156144fa57600080fd5b8151612cd081613b83565b8082028115828204841417610751576107516143cc565b60008261453957634e487b7160e01b600052601260045260246000fd5b500490565b60a08152600061455160a0830188614419565b82810360208401526145638188614419565b6001600160a01b03968716604085015260608401959095525050921660809092019190915292915050565b8183823760009101908152919050565b60006145ac613c6c84613c36565b90508281528383830111156145c057600080fd5b612cd08360208301846143f5565b6000602082840312156145e057600080fd5b815167ffffffffffffffff8111156145f757600080fd5b8201601f8101841361460857600080fd5b6139c18482516020840161459e565b606081528360608201528385608083013760006080858301015260006080601f19601f870116830101905083602083015282604083015295945050505050565b8381526001600160a01b03831660208201526060604082015260006125b96060830184614419565b84815260006001600160a01b038086166020840152808516604084015250608060608301526127676080830184614419565b6000602082840312156146c357600080fd5b8151612cd081613d80565b6080815260006146e16080830187614419565b60208301959095525060408101929092521515606090910152919050565b60006040828403121561471157600080fd5b6040516040810181811067ffffffffffffffff8211171561473457614734613bc5565b604052825181526020928301519281019290925250919050565b60a08152600061476160a0830188614419565b866020840152856040840152828103606084015261477f8186614419565b91505082151560808301529695505050505050565b600081518084526020808501808196508360051b8101915082860160005b858110156147dc5782840389526147ca848351614419565b988501989350908401906001016147b2565b5091979650505050505050565b60006101208b83526001600160a01b03808c1660208501528a60408501528960608501528089166080850152508060a084015261482881840188614794565b95151560c0840152505061ffff9290921660e08301521515610100909101529695505050505050565b602081526000612cd06020830184614419565b8281526040602082015260006139c16040830184614794565b6000602080838503121561489057600080fd5b825167ffffffffffffffff808211156148a857600080fd5b818501915085601f8301126148bc57600080fd5b81516148ca613c6c82613cbc565b81815260059190911b830184019084810190888311156148e957600080fd5b8585015b83811015614936578051858111156149055760008081fd5b8601603f81018b136149175760008081fd5b6149288b898301516040840161459e565b8452509186019186016148ed565b5098975050505050505050565b600082516149558184602087016143f5565b7f2e63726561746f72000000000000000000000000000000000000000000000000920191825250600801919050565b60006001600160a01b0380871683528086166020840152808516604084015250608060608301526127676080830184614419565b634e487b7160e01b600052603260045260246000fd5b6000600182016149e0576149e06143cc565b5060010190565b600082516149f98184602087016143f5565b919091019291505056fea26469706673582212209ee5d903e43e48af6eeb48bd3e33eafaaed65e91963da16c30e9c369a760a71364736f6c63430008110033" +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/ExtendedDNSResolver.json b/solidity/dns-contracts/deployments/testnet/ExtendedDNSResolver.json new file mode 100644 index 0000000..7ccac8f --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/ExtendedDNSResolver.json @@ -0,0 +1,110 @@ +{ + "address": "0x3027D3E1708240AfF03103a4dD6ACe78eff4B534", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "addr", + "type": "bytes" + } + ], + "name": "InvalidAddressFormat", + "type": "error" + }, + { + "inputs": [], + "name": "NotImplemented", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "context", + "type": "bytes" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x4ac604d1f1b840f45f7de0c64360a94f04852ac56e553b5f194088dec189d39b", + "receipt": { + "to": null, + "from": "0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B", + "contractAddress": "0x3027D3E1708240AfF03103a4dD6ACe78eff4B534", + "transactionIndex": 0, + "gasUsed": "1178309", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x69944225f60ca0349c14ee015c15182701ac22bff2b3a7568dc8acd53c773c5a", + "transactionHash": "0x4ac604d1f1b840f45f7de0c64360a94f04852ac56e553b5f194088dec189d39b", + "logs": [], + "blockNumber": 57535156, + "cumulativeGasUsed": "1178309", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "7ef7523a40dd1de60e38563e79c7448b", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"addr\",\"type\":\"bytes\"}],\"name\":\"InvalidAddressFormat\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotImplemented\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"context\",\"type\":\"bytes\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Resolves names on ENS by interpreting record data stored in a DNS TXT record. This resolver implements the IExtendedDNSResolver interface, meaning that when a DNS name specifies it as the resolver via a TXT record, this resolver's resolve() method is invoked, and is passed any additional information from that text record. This resolver implements a simple text parser allowing a variety of records to be specified in text, which will then be used to resolve the name in ENS. To use this, set a TXT record on your DNS name in the following format: ENS1
For example: ENS1 2.dnsname.ens.eth a[60]=0x1234... The record data consists of a series of key=value pairs, separated by spaces. Keys may have an optional argument in square brackets, and values may be either unquoted - in which case they may not contain spaces - or single-quoted. Single quotes in a quoted value may be backslash-escaped. \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510 \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2534\\u2500\\u2524\\\" \\\"\\u2502\\u25c4\\u2500\\u2534\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u2502 ^\\u2500\\u2534\\u2500\\u25ba\\u2502key\\u251c\\u2500\\u252c\\u2500\\u25ba\\u2502\\\"[\\\"\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502arg\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502\\\"]\\\"\\u251c\\u2500\\u252c\\u2500\\u25ba\\u2502\\\"=\\\"\\u251c\\u2500\\u252c\\u2500\\u25ba\\u2502\\\"'\\\"\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502quoted_value\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502\\\"'\\\"\\u251c\\u2500\\u253c\\u2500$ \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u25ba\\u2502unquoted_value\\u251c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518 Record types: - a[] - Specifies how an `addr()` request should be resolved for the specified `coinType`. Ethereum has `coinType` 60. The value must be 0x-prefixed hexadecimal, and will be returned unmodified; this means that non-EVM addresses will need to be translated into binary format and then encoded in hex. Examples: - a[60]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7 - a[0]=0x00149010587f8364b964fcaa70687216b53bd2cbd798 - a[e] - Specifies how an `addr()` request should be resolved for the specified `chainId`. The value must be 0x-prefixed hexadecimal. When encoding an address for an EVM-based cryptocurrency that uses a chainId instead of a coinType, this syntax *must* be used in place of the coin type - eg, Optimism is `a[e10]`, not `a[2147483658]`. A list of supported cryptocurrencies for both syntaxes can be found here: https://github.com/ensdomains/address-encoder/blob/master/docs/supported-cryptocurrencies.md Example: - a[e10]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7 - t[] - Specifies how a `text()` request should be resolved for the specified `key`. Examples: - t[com.twitter]=nicksdjohnson - t[url]='https://ens.domains/' - t[note]='I\\\\'m great'\",\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/resolvers/profiles/ExtendedDNSResolver.sol\":\"ExtendedDNSResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ExtendedDNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"../../resolvers/profiles/IExtendedDNSResolver.sol\\\";\\nimport \\\"../../resolvers/profiles/IAddressResolver.sol\\\";\\nimport \\\"../../resolvers/profiles/IAddrResolver.sol\\\";\\nimport \\\"../../resolvers/profiles/ITextResolver.sol\\\";\\nimport \\\"../../utils/HexUtils.sol\\\";\\nimport \\\"../../utils/BytesUtils.sol\\\";\\n\\n/**\\n * @dev Resolves names on ENS by interpreting record data stored in a DNS TXT record.\\n * This resolver implements the IExtendedDNSResolver interface, meaning that when\\n * a DNS name specifies it as the resolver via a TXT record, this resolver's\\n * resolve() method is invoked, and is passed any additional information from that\\n * text record. This resolver implements a simple text parser allowing a variety\\n * of records to be specified in text, which will then be used to resolve the name\\n * in ENS.\\n *\\n * To use this, set a TXT record on your DNS name in the following format:\\n * ENS1
\\n *\\n * For example:\\n * ENS1 2.dnsname.ens.eth a[60]=0x1234...\\n *\\n * The record data consists of a series of key=value pairs, separated by spaces. Keys\\n * may have an optional argument in square brackets, and values may be either unquoted\\n * - in which case they may not contain spaces - or single-quoted. Single quotes in\\n * a quoted value may be backslash-escaped.\\n *\\n *\\n * \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510\\n * \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u2502\\n * \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2534\\u2500\\u2524\\\" \\\"\\u2502\\u25c4\\u2500\\u2534\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510\\n * \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502\\n * \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510 \\u250c\\u2500\\u2500\\u2500\\u2510 \\u2502\\n * ^\\u2500\\u2534\\u2500\\u25ba\\u2502key\\u251c\\u2500\\u252c\\u2500\\u25ba\\u2502\\\"[\\\"\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502arg\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502\\\"]\\\"\\u251c\\u2500\\u252c\\u2500\\u25ba\\u2502\\\"=\\\"\\u251c\\u2500\\u252c\\u2500\\u25ba\\u2502\\\"'\\\"\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502quoted_value\\u251c\\u2500\\u2500\\u2500\\u25ba\\u2502\\\"'\\\"\\u251c\\u2500\\u253c\\u2500$\\n * \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518 \\u2514\\u2500\\u2500\\u2500\\u2518 \\u2502\\n * \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518 \\u2502 \\u250c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2510 \\u2502\\n * \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u25ba\\u2502unquoted_value\\u251c\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518\\n * \\u2514\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2500\\u2518\\n *\\n * Record types:\\n * - a[] - Specifies how an `addr()` request should be resolved for the specified\\n * `coinType`. Ethereum has `coinType` 60. The value must be 0x-prefixed hexadecimal, and will\\n * be returned unmodified; this means that non-EVM addresses will need to be translated\\n * into binary format and then encoded in hex.\\n * Examples:\\n * - a[60]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7\\n * - a[0]=0x00149010587f8364b964fcaa70687216b53bd2cbd798\\n * - a[e] - Specifies how an `addr()` request should be resolved for the specified\\n * `chainId`. The value must be 0x-prefixed hexadecimal. When encoding an address for an\\n * EVM-based cryptocurrency that uses a chainId instead of a coinType, this syntax *must*\\n * be used in place of the coin type - eg, Optimism is `a[e10]`, not `a[2147483658]`.\\n * A list of supported cryptocurrencies for both syntaxes can be found here:\\n * https://github.com/ensdomains/address-encoder/blob/master/docs/supported-cryptocurrencies.md\\n * Example:\\n * - a[e10]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7\\n * - t[] - Specifies how a `text()` request should be resolved for the specified `key`.\\n * Examples:\\n * - t[com.twitter]=nicksdjohnson\\n * - t[url]='https://ens.domains/'\\n * - t[note]='I\\\\'m great'\\n */\\ncontract ExtendedDNSResolver is IExtendedDNSResolver, IERC165 {\\n using HexUtils for *;\\n using BytesUtils for *;\\n using Strings for *;\\n\\n uint256 private constant COIN_TYPE_ETH = 60;\\n\\n error NotImplemented();\\n error InvalidAddressFormat(bytes addr);\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) external view virtual override returns (bool) {\\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\\n }\\n\\n function resolve(\\n bytes calldata /* name */,\\n bytes calldata data,\\n bytes calldata context\\n ) external pure override returns (bytes memory) {\\n bytes4 selector = bytes4(data);\\n if (selector == IAddrResolver.addr.selector) {\\n return _resolveAddr(context);\\n } else if (selector == IAddressResolver.addr.selector) {\\n return _resolveAddress(data, context);\\n } else if (selector == ITextResolver.text.selector) {\\n return _resolveText(data, context);\\n }\\n revert NotImplemented();\\n }\\n\\n function _resolveAddress(\\n bytes calldata data,\\n bytes calldata context\\n ) internal pure returns (bytes memory) {\\n (, uint256 coinType) = abi.decode(data[4:], (bytes32, uint256));\\n bytes memory value;\\n // Per https://docs.ens.domains/ensip/11#specification\\n if (coinType & 0x80000000 != 0) {\\n value = _findValue(\\n context,\\n bytes.concat(\\n \\\"a[e\\\",\\n bytes((coinType & 0x7fffffff).toString()),\\n \\\"]=\\\"\\n )\\n );\\n } else {\\n value = _findValue(\\n context,\\n bytes.concat(\\\"a[\\\", bytes(coinType.toString()), \\\"]=\\\")\\n );\\n }\\n if (value.length == 0) {\\n return value;\\n }\\n (address record, bool valid) = value.hexToAddress(2, value.length);\\n if (!valid) revert InvalidAddressFormat(value);\\n return abi.encode(record);\\n }\\n\\n function _resolveAddr(\\n bytes calldata context\\n ) internal pure returns (bytes memory) {\\n bytes memory value = _findValue(context, \\\"a[60]=\\\");\\n if (value.length == 0) {\\n return value;\\n }\\n (address record, bool valid) = value.hexToAddress(2, value.length);\\n if (!valid) revert InvalidAddressFormat(value);\\n return abi.encode(record);\\n }\\n\\n function _resolveText(\\n bytes calldata data,\\n bytes calldata context\\n ) internal pure returns (bytes memory) {\\n (, string memory key) = abi.decode(data[4:], (bytes32, string));\\n bytes memory value = _findValue(\\n context,\\n bytes.concat(\\\"t[\\\", bytes(key), \\\"]=\\\")\\n );\\n return abi.encode(value);\\n }\\n\\n uint256 constant STATE_START = 0;\\n uint256 constant STATE_IGNORED_KEY = 1;\\n uint256 constant STATE_IGNORED_KEY_ARG = 2;\\n uint256 constant STATE_VALUE = 3;\\n uint256 constant STATE_QUOTED_VALUE = 4;\\n uint256 constant STATE_UNQUOTED_VALUE = 5;\\n uint256 constant STATE_IGNORED_VALUE = 6;\\n uint256 constant STATE_IGNORED_QUOTED_VALUE = 7;\\n uint256 constant STATE_IGNORED_UNQUOTED_VALUE = 8;\\n\\n /**\\n * @dev Implements a DFA to parse the text record, looking for an entry\\n * matching `key`.\\n * @param data The text record to parse.\\n * @param key The exact key to search for.\\n * @return value The value if found, or an empty string if `key` does not exist.\\n */\\n function _findValue(\\n bytes memory data,\\n bytes memory key\\n ) internal pure returns (bytes memory value) {\\n // Here we use a simple state machine to parse the text record. We\\n // process characters one at a time; each character can trigger a\\n // transition to a new state, or terminate the DFA and return a value.\\n // For states that expect to process a number of tokens, we use\\n // inner loops for efficiency reasons, to avoid the need to go\\n // through the outer loop and switch statement for every character.\\n uint256 state = STATE_START;\\n uint256 len = data.length;\\n for (uint256 i = 0; i < len; ) {\\n if (state == STATE_START) {\\n // Look for a matching key.\\n if (data.equals(i, key, 0, key.length)) {\\n i += key.length;\\n state = STATE_VALUE;\\n } else {\\n state = STATE_IGNORED_KEY;\\n }\\n } else if (state == STATE_IGNORED_KEY) {\\n for (; i < len; i++) {\\n if (data[i] == \\\"=\\\") {\\n state = STATE_IGNORED_VALUE;\\n i += 1;\\n break;\\n } else if (data[i] == \\\"[\\\") {\\n state = STATE_IGNORED_KEY_ARG;\\n i += 1;\\n break;\\n }\\n }\\n } else if (state == STATE_IGNORED_KEY_ARG) {\\n for (; i < len; i++) {\\n if (data[i] == \\\"]\\\") {\\n state = STATE_IGNORED_VALUE;\\n i += 1;\\n if (data[i] == \\\"=\\\") {\\n i += 1;\\n }\\n break;\\n }\\n }\\n } else if (state == STATE_VALUE) {\\n if (data[i] == \\\"'\\\") {\\n state = STATE_QUOTED_VALUE;\\n i += 1;\\n } else {\\n state = STATE_UNQUOTED_VALUE;\\n }\\n } else if (state == STATE_QUOTED_VALUE) {\\n uint256 start = i;\\n uint256 valueLen = 0;\\n bool escaped = false;\\n for (; i < len; i++) {\\n if (escaped) {\\n data[start + valueLen] = data[i];\\n valueLen += 1;\\n escaped = false;\\n } else {\\n if (data[i] == \\\"\\\\\\\\\\\") {\\n escaped = true;\\n } else if (data[i] == \\\"'\\\") {\\n return data.substring(start, valueLen);\\n } else {\\n data[start + valueLen] = data[i];\\n valueLen += 1;\\n }\\n }\\n }\\n } else if (state == STATE_UNQUOTED_VALUE) {\\n uint256 start = i;\\n for (; i < len; i++) {\\n if (data[i] == \\\" \\\") {\\n return data.substring(start, i - start);\\n }\\n }\\n return data.substring(start, len - start);\\n } else if (state == STATE_IGNORED_VALUE) {\\n if (data[i] == \\\"'\\\") {\\n state = STATE_IGNORED_QUOTED_VALUE;\\n i += 1;\\n } else {\\n state = STATE_IGNORED_UNQUOTED_VALUE;\\n }\\n } else if (state == STATE_IGNORED_QUOTED_VALUE) {\\n bool escaped = false;\\n for (; i < len; i++) {\\n if (escaped) {\\n escaped = false;\\n } else {\\n if (data[i] == \\\"\\\\\\\\\\\") {\\n escaped = true;\\n } else if (data[i] == \\\"'\\\") {\\n i += 1;\\n while (data[i] == \\\" \\\") {\\n i += 1;\\n }\\n state = STATE_START;\\n break;\\n }\\n }\\n }\\n } else {\\n assert(state == STATE_IGNORED_UNQUOTED_VALUE);\\n for (; i < len; i++) {\\n if (data[i] == \\\" \\\") {\\n while (data[i] == \\\" \\\") {\\n i += 1;\\n }\\n state = STATE_START;\\n break;\\n }\\n }\\n }\\n }\\n return \\\"\\\";\\n }\\n}\\n\",\"keccak256\":\"0x18ee781ed6c07577c54fda923b61e77fede11947253fd313a1178325689771ce\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedDNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedDNSResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data,\\n bytes memory context\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x541f8799c34ff9e7035d09f06ae0f0f8a16b6065e9b60a15670b957321630f72\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/utils/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes32) {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0xc566a3569af880a096a9bfb2fbb77060ef7aecde1a205dc26446a58877412060\",\"license\":\"MIT\"},\"contracts/utils/HexUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary HexUtils {\\n /**\\n * @dev Attempts to parse bytes32 from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexStringToBytes32(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (bytes32, bool) {\\n require(lastIdx - idx <= 64);\\n (bytes memory r, bool valid) = hexToBytes(str, idx, lastIdx);\\n if (!valid) {\\n return (bytes32(0), false);\\n }\\n bytes32 ret;\\n assembly {\\n ret := shr(mul(4, sub(64, sub(lastIdx, idx))), mload(add(r, 32)))\\n }\\n return (ret, true);\\n }\\n\\n function hexToBytes(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (bytes memory r, bool valid) {\\n uint256 hexLength = lastIdx - idx;\\n if (hexLength % 2 == 1) {\\n revert(\\\"Invalid string length\\\");\\n }\\n r = new bytes(hexLength / 2);\\n valid = true;\\n assembly {\\n // check that the index to read to is not past the end of the string\\n if gt(lastIdx, mload(str)) {\\n revert(0, 0)\\n }\\n\\n function getHex(c) -> ascii {\\n // chars 48-57: 0-9\\n if and(gt(c, 47), lt(c, 58)) {\\n ascii := sub(c, 48)\\n leave\\n }\\n // chars 65-70: A-F\\n if and(gt(c, 64), lt(c, 71)) {\\n ascii := add(sub(c, 65), 10)\\n leave\\n }\\n // chars 97-102: a-f\\n if and(gt(c, 96), lt(c, 103)) {\\n ascii := add(sub(c, 97), 10)\\n leave\\n }\\n // invalid char\\n ascii := 0xff\\n }\\n\\n let ptr := add(str, 32)\\n for {\\n let i := idx\\n } lt(i, lastIdx) {\\n i := add(i, 2)\\n } {\\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\\n // if either byte is invalid, set invalid and break loop\\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\\n valid := false\\n break\\n }\\n let combined := or(shl(4, byte1), byte2)\\n mstore8(add(add(r, 32), div(sub(i, idx), 2)), combined)\\n }\\n }\\n }\\n\\n /**\\n * @dev Attempts to parse an address from a hex string\\n * @param str The string to parse\\n * @param idx The offset to start parsing at\\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\\n */\\n function hexToAddress(\\n bytes memory str,\\n uint256 idx,\\n uint256 lastIdx\\n ) internal pure returns (address, bool) {\\n if (lastIdx - idx < 40) return (address(0x0), false);\\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\\n return (address(uint160(uint256(r))), valid);\\n }\\n\\n /**\\n * @dev Attempts to convert an address to a hex string\\n * @param addr The _addr to parse\\n */\\n function addressToHex(address addr) internal pure returns (string memory) {\\n bytes memory hexString = new bytes(40);\\n for (uint i = 0; i < 20; i++) {\\n bytes1 byteValue = bytes1(uint8(uint160(addr) >> (8 * (19 - i))));\\n bytes1 highNibble = bytes1(uint8(byteValue) / 16);\\n bytes1 lowNibble = bytes1(\\n uint8(byteValue) - 16 * uint8(highNibble)\\n );\\n hexString[2 * i] = _nibbleToHexChar(highNibble);\\n hexString[2 * i + 1] = _nibbleToHexChar(lowNibble);\\n }\\n return string(hexString);\\n }\\n\\n function _nibbleToHexChar(\\n bytes1 nibble\\n ) internal pure returns (bytes1 hexChar) {\\n if (uint8(nibble) < 10) return bytes1(uint8(nibble) + 0x30);\\n else return bytes1(uint8(nibble) + 0x57);\\n }\\n}\\n\",\"keccak256\":\"0xd6a9ab6d19632f634ee0f29173278fb4ba1d90fbbb470e779d76f278a8a2b90d\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061146e806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806301ffc9a71461003b5780638ef98a7e1461008d575b600080fd5b610078610049366004610fe7565b6001600160e01b0319167f8ef98a7e000000000000000000000000000000000000000000000000000000001490565b60405190151581526020015b60405180910390f35b6100a061009b366004611061565b6100ad565b604051610084919061111f565b606060006100bb8587611152565b90507fc4c4a822000000000000000000000000000000000000000000000000000000006001600160e01b0319821601610100576100f884846101b6565b9150506101ac565b7f0e3481fa000000000000000000000000000000000000000000000000000000006001600160e01b031982160161013d576100f8868686866102c3565b7fa62e2bc4000000000000000000000000000000000000000000000000000000006001600160e01b031982160161017a576100f88686868661044f565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9695505050505050565b6060600061022e84848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060408051808201909152600681527f615b36305d3d0000000000000000000000000000000000000000000000000000602082015291506104ea9050565b905080516000036102405790506102bd565b60008061025a6002845185610b039092919063ffffffff16565b91509150806102875782604051630f79e00960e21b815260040161027e919061111f565b60405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff841660208201520160405160208183030381529060405293505050505b92915050565b606060006102d48560048189611182565b8101906102e191906111ac565b9150506060816380000000166000146103685761036185858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061033d92505050637fffffff8516610b41565b60405160200161034d91906111ce565b6040516020818303038152906040526104ea565b90506103c0565b6103bd85858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103ad9250869150610b419050565b60405160200161034d919061121f565b90505b80516000036103d25791506104479050565b6000806103ec6002845185610b039092919063ffffffff16565b91509150806104105782604051630f79e00960e21b815260040161027e919061111f565b6040805173ffffffffffffffffffffffffffffffffffffffff84166020820152016040516020818303038152906040529450505050505b949350505050565b606060006104608560048189611182565b81019061046d9190611286565b91505060006104bc85858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060405161034d9250869150602001611341565b9050806040516020016104cf919061111f565b60405160208183030381529060405292505050949350505050565b8151606090600090815b81811015610aea578261053a57845161051590879083908890600090610be1565b15610531578451610526908261138f565b9050600392506104f4565b600192506104f4565b600183036105f9575b818110156105f45785818151811061055d5761055d6113a2565b01602001516001600160f81b031916603d60f81b0361058c576006925061058560018261138f565b90506104f4565b85818151811061059e5761059e6113a2565b01602001516001600160f81b0319167f5b00000000000000000000000000000000000000000000000000000000000000036105e2576002925061058560018261138f565b806105ec816113b8565b915050610543565b6104f4565b600283036106aa575b818110156105f45785818151811061061c5761061c6113a2565b01602001516001600160f81b0319167f5d0000000000000000000000000000000000000000000000000000000000000003610698576006925061066060018261138f565b9050858181518110610674576106746113a2565b01602001516001600160f81b031916603d60f81b036105f45761058560018261138f565b806106a2816113b8565b915050610602565b600383036106f5578581815181106106c4576106c46113a2565b01602001516001600160f81b031916602760f81b036106ec576004925061058560018261138f565b600592506104f4565b6004830361089a57806000805b8484101561089257801561079157888481518110610722576107226113a2565b01602001516001600160f81b0319168961073c848661138f565b8151811061074c5761074c6113a2565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061078660018361138f565b915060009050610880565b8884815181106107a3576107a36113a2565b01602001516001600160f81b031916601760fa1b036107c457506001610880565b8884815181106107d6576107d66113a2565b01602001516001600160f81b031916602760f81b03610807576107fa898484610c04565b96505050505050506102bd565b888481518110610819576108196113a2565b01602001516001600160f81b03191689610833848661138f565b81518110610843576108436113a2565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061087d60018361138f565b91505b8361088a816113b8565b945050610702565b5050506104f4565b6005830361091857805b8282101561090a578682815181106108be576108be6113a2565b01602001516001600160f81b031916600160fd1b036108f8576108ed816108e581856113d1565b899190610c04565b9450505050506102bd565b81610902816113b8565b9250506108a4565b6108ed816108e581866113d1565b6006830361096357858181518110610932576109326113a2565b01602001516001600160f81b031916602760f81b0361095a576007925061058560018261138f565b600892506104f4565b60078303610a4e5760005b82821015610a4857801561098457506000610a36565b868281518110610996576109966113a2565b01602001516001600160f81b031916601760fa1b036109b757506001610a36565b8682815181106109c9576109c96113a2565b01602001516001600160f81b031916602760f81b03610a36576109ed60018361138f565b91505b868281518110610a0257610a026113a2565b01602001516001600160f81b031916600160fd1b03610a2d57610a2660018361138f565b91506109f0565b60009350610a48565b81610a40816113b8565b92505061096e565b506104f4565b60088314610a5e57610a5e6113e4565b818110156105f457858181518110610a7857610a786113a2565b01602001516001600160f81b031916600160fd1b03610ad8575b858181518110610aa457610aa46113a2565b01602001516001600160f81b031916600160fd1b03610acf57610ac860018261138f565b9050610a92565b600092506104f4565b80610ae2816113b8565b915050610a5e565b5050604080516020810190915260008152949350505050565b6000806028610b1285856113d1565b1015610b2357506000905080610b39565b600080610b31878787610c86565b909450925050505b935093915050565b60606000610b4e83610ce3565b600101905060008167ffffffffffffffff811115610b6e57610b6e611270565b6040519080825280601f01601f191660200182016040528015610b98576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084610ba257509392505050565b6000610bee848484610dc5565b610bf9878785610dc5565b149695505050505050565b8251606090610c13838561138f565b1115610c1e57600080fd5b60008267ffffffffffffffff811115610c3957610c39611270565b6040519080825280601f01601f191660200182016040528015610c63576020820181803683370190505b50905060208082019086860101610c7b828287610de9565b509095945050505050565b6000806040610c9585856113d1565b1115610ca057600080fd5b600080610cae878787610e3f565b9150915080610cc6575060009250829150610b399050565b50602001516004858503604003021c915060019050935093915050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310610d2c577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310610d58576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610d7657662386f26fc10000830492506010015b6305f5e1008310610d8e576305f5e100830492506008015b6127108310610da257612710830492506004015b60648310610db4576064830492506002015b600a83106102bd5760010192915050565b8251600090610dd4838561138f565b1115610ddf57600080fd5b5091016020012090565b60208110610e215781518352610e0060208461138f565b9250610e0d60208361138f565b9150610e1a6020826113d1565b9050610de9565b905182516020929092036101000a6000190180199091169116179052565b6060600080610e4e85856113d1565b9050610e5b600282611410565b600103610ec4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f496e76616c696420737472696e67206c656e6774680000000000000000000000604482015260640161027e565b610ecf600282611424565b67ffffffffffffffff811115610ee757610ee7611270565b6040519080825280601f01601f191660200182016040528015610f11576020820181803683370190505b509250600191508551841115610f2657600080fd5b610f77565b6000603a8210602f83111615610f435750602f190190565b60478210604083111615610f5957506036190190565b60678210606083111615610f6f57506056190190565b5060ff919050565b60208601855b85811015610fdc57610f948183015160001a610f2b565b610fa66001830184015160001a610f2b565b60ff811460ff83141715610fbf57600095505050610fdc565b60049190911b178060028984030487016020015350600201610f7d565b505050935093915050565b600060208284031215610ff957600080fd5b81356001600160e01b03198116811461101157600080fd5b9392505050565b60008083601f84011261102a57600080fd5b50813567ffffffffffffffff81111561104257600080fd5b60208301915083602082850101111561105a57600080fd5b9250929050565b6000806000806000806060878903121561107a57600080fd5b863567ffffffffffffffff8082111561109257600080fd5b61109e8a838b01611018565b909850965060208901359150808211156110b757600080fd5b6110c38a838b01611018565b909650945060408901359150808211156110dc57600080fd5b506110e989828a01611018565b979a9699509497509295939492505050565b60005b838110156111165781810151838201526020016110fe565b50506000910152565b602081526000825180602084015261113e8160408501602087016110fb565b601f01601f19169190910160400192915050565b6001600160e01b0319813581811691600485101561117a5780818660040360031b1b83161692505b505092915050565b6000808585111561119257600080fd5b8386111561119f57600080fd5b5050820193919092039150565b600080604083850312156111bf57600080fd5b50508035926020909101359150565b7f615b6500000000000000000000000000000000000000000000000000000000008152600082516112068160038501602087016110fb565b615d3d60f01b6003939091019283015250600501919050565b7f615b0000000000000000000000000000000000000000000000000000000000008152600082516112578160028501602087016110fb565b615d3d60f01b6002939091019283015250600401919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561129957600080fd5b82359150602083013567ffffffffffffffff808211156112b857600080fd5b818501915085601f8301126112cc57600080fd5b8135818111156112de576112de611270565b604051601f8201601f19908116603f0116810190838211818310171561130657611306611270565b8160405282815288602084870101111561131f57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b7f745b0000000000000000000000000000000000000000000000000000000000008152600082516112578160028501602087016110fb565b634e487b7160e01b600052601160045260246000fd5b808201808211156102bd576102bd611379565b634e487b7160e01b600052603260045260246000fd5b6000600182016113ca576113ca611379565b5060010190565b818103818111156102bd576102bd611379565b634e487b7160e01b600052600160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b60008261141f5761141f6113fa565b500690565b600082611433576114336113fa565b50049056fea264697066735822122098bdef3cc2d74dda6a34627073442c81d5bac2650303ff50ec19a0fd00cc31a664736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806301ffc9a71461003b5780638ef98a7e1461008d575b600080fd5b610078610049366004610fe7565b6001600160e01b0319167f8ef98a7e000000000000000000000000000000000000000000000000000000001490565b60405190151581526020015b60405180910390f35b6100a061009b366004611061565b6100ad565b604051610084919061111f565b606060006100bb8587611152565b90507fc4c4a822000000000000000000000000000000000000000000000000000000006001600160e01b0319821601610100576100f884846101b6565b9150506101ac565b7f0e3481fa000000000000000000000000000000000000000000000000000000006001600160e01b031982160161013d576100f8868686866102c3565b7fa62e2bc4000000000000000000000000000000000000000000000000000000006001600160e01b031982160161017a576100f88686868661044f565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9695505050505050565b6060600061022e84848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060408051808201909152600681527f615b36305d3d0000000000000000000000000000000000000000000000000000602082015291506104ea9050565b905080516000036102405790506102bd565b60008061025a6002845185610b039092919063ffffffff16565b91509150806102875782604051630f79e00960e21b815260040161027e919061111f565b60405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff841660208201520160405160208183030381529060405293505050505b92915050565b606060006102d48560048189611182565b8101906102e191906111ac565b9150506060816380000000166000146103685761036185858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061033d92505050637fffffff8516610b41565b60405160200161034d91906111ce565b6040516020818303038152906040526104ea565b90506103c0565b6103bd85858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103ad9250869150610b419050565b60405160200161034d919061121f565b90505b80516000036103d25791506104479050565b6000806103ec6002845185610b039092919063ffffffff16565b91509150806104105782604051630f79e00960e21b815260040161027e919061111f565b6040805173ffffffffffffffffffffffffffffffffffffffff84166020820152016040516020818303038152906040529450505050505b949350505050565b606060006104608560048189611182565b81019061046d9190611286565b91505060006104bc85858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060405161034d9250869150602001611341565b9050806040516020016104cf919061111f565b60405160208183030381529060405292505050949350505050565b8151606090600090815b81811015610aea578261053a57845161051590879083908890600090610be1565b15610531578451610526908261138f565b9050600392506104f4565b600192506104f4565b600183036105f9575b818110156105f45785818151811061055d5761055d6113a2565b01602001516001600160f81b031916603d60f81b0361058c576006925061058560018261138f565b90506104f4565b85818151811061059e5761059e6113a2565b01602001516001600160f81b0319167f5b00000000000000000000000000000000000000000000000000000000000000036105e2576002925061058560018261138f565b806105ec816113b8565b915050610543565b6104f4565b600283036106aa575b818110156105f45785818151811061061c5761061c6113a2565b01602001516001600160f81b0319167f5d0000000000000000000000000000000000000000000000000000000000000003610698576006925061066060018261138f565b9050858181518110610674576106746113a2565b01602001516001600160f81b031916603d60f81b036105f45761058560018261138f565b806106a2816113b8565b915050610602565b600383036106f5578581815181106106c4576106c46113a2565b01602001516001600160f81b031916602760f81b036106ec576004925061058560018261138f565b600592506104f4565b6004830361089a57806000805b8484101561089257801561079157888481518110610722576107226113a2565b01602001516001600160f81b0319168961073c848661138f565b8151811061074c5761074c6113a2565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061078660018361138f565b915060009050610880565b8884815181106107a3576107a36113a2565b01602001516001600160f81b031916601760fa1b036107c457506001610880565b8884815181106107d6576107d66113a2565b01602001516001600160f81b031916602760f81b03610807576107fa898484610c04565b96505050505050506102bd565b888481518110610819576108196113a2565b01602001516001600160f81b03191689610833848661138f565b81518110610843576108436113a2565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061087d60018361138f565b91505b8361088a816113b8565b945050610702565b5050506104f4565b6005830361091857805b8282101561090a578682815181106108be576108be6113a2565b01602001516001600160f81b031916600160fd1b036108f8576108ed816108e581856113d1565b899190610c04565b9450505050506102bd565b81610902816113b8565b9250506108a4565b6108ed816108e581866113d1565b6006830361096357858181518110610932576109326113a2565b01602001516001600160f81b031916602760f81b0361095a576007925061058560018261138f565b600892506104f4565b60078303610a4e5760005b82821015610a4857801561098457506000610a36565b868281518110610996576109966113a2565b01602001516001600160f81b031916601760fa1b036109b757506001610a36565b8682815181106109c9576109c96113a2565b01602001516001600160f81b031916602760f81b03610a36576109ed60018361138f565b91505b868281518110610a0257610a026113a2565b01602001516001600160f81b031916600160fd1b03610a2d57610a2660018361138f565b91506109f0565b60009350610a48565b81610a40816113b8565b92505061096e565b506104f4565b60088314610a5e57610a5e6113e4565b818110156105f457858181518110610a7857610a786113a2565b01602001516001600160f81b031916600160fd1b03610ad8575b858181518110610aa457610aa46113a2565b01602001516001600160f81b031916600160fd1b03610acf57610ac860018261138f565b9050610a92565b600092506104f4565b80610ae2816113b8565b915050610a5e565b5050604080516020810190915260008152949350505050565b6000806028610b1285856113d1565b1015610b2357506000905080610b39565b600080610b31878787610c86565b909450925050505b935093915050565b60606000610b4e83610ce3565b600101905060008167ffffffffffffffff811115610b6e57610b6e611270565b6040519080825280601f01601f191660200182016040528015610b98576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084610ba257509392505050565b6000610bee848484610dc5565b610bf9878785610dc5565b149695505050505050565b8251606090610c13838561138f565b1115610c1e57600080fd5b60008267ffffffffffffffff811115610c3957610c39611270565b6040519080825280601f01601f191660200182016040528015610c63576020820181803683370190505b50905060208082019086860101610c7b828287610de9565b509095945050505050565b6000806040610c9585856113d1565b1115610ca057600080fd5b600080610cae878787610e3f565b9150915080610cc6575060009250829150610b399050565b50602001516004858503604003021c915060019050935093915050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310610d2c577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310610d58576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610d7657662386f26fc10000830492506010015b6305f5e1008310610d8e576305f5e100830492506008015b6127108310610da257612710830492506004015b60648310610db4576064830492506002015b600a83106102bd5760010192915050565b8251600090610dd4838561138f565b1115610ddf57600080fd5b5091016020012090565b60208110610e215781518352610e0060208461138f565b9250610e0d60208361138f565b9150610e1a6020826113d1565b9050610de9565b905182516020929092036101000a6000190180199091169116179052565b6060600080610e4e85856113d1565b9050610e5b600282611410565b600103610ec4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f496e76616c696420737472696e67206c656e6774680000000000000000000000604482015260640161027e565b610ecf600282611424565b67ffffffffffffffff811115610ee757610ee7611270565b6040519080825280601f01601f191660200182016040528015610f11576020820181803683370190505b509250600191508551841115610f2657600080fd5b610f77565b6000603a8210602f83111615610f435750602f190190565b60478210604083111615610f5957506036190190565b60678210606083111615610f6f57506056190190565b5060ff919050565b60208601855b85811015610fdc57610f948183015160001a610f2b565b610fa66001830184015160001a610f2b565b60ff811460ff83141715610fbf57600095505050610fdc565b60049190911b178060028984030487016020015350600201610f7d565b505050935093915050565b600060208284031215610ff957600080fd5b81356001600160e01b03198116811461101157600080fd5b9392505050565b60008083601f84011261102a57600080fd5b50813567ffffffffffffffff81111561104257600080fd5b60208301915083602082850101111561105a57600080fd5b9250929050565b6000806000806000806060878903121561107a57600080fd5b863567ffffffffffffffff8082111561109257600080fd5b61109e8a838b01611018565b909850965060208901359150808211156110b757600080fd5b6110c38a838b01611018565b909650945060408901359150808211156110dc57600080fd5b506110e989828a01611018565b979a9699509497509295939492505050565b60005b838110156111165781810151838201526020016110fe565b50506000910152565b602081526000825180602084015261113e8160408501602087016110fb565b601f01601f19169190910160400192915050565b6001600160e01b0319813581811691600485101561117a5780818660040360031b1b83161692505b505092915050565b6000808585111561119257600080fd5b8386111561119f57600080fd5b5050820193919092039150565b600080604083850312156111bf57600080fd5b50508035926020909101359150565b7f615b6500000000000000000000000000000000000000000000000000000000008152600082516112068160038501602087016110fb565b615d3d60f01b6003939091019283015250600501919050565b7f615b0000000000000000000000000000000000000000000000000000000000008152600082516112578160028501602087016110fb565b615d3d60f01b6002939091019283015250600401919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561129957600080fd5b82359150602083013567ffffffffffffffff808211156112b857600080fd5b818501915085601f8301126112cc57600080fd5b8135818111156112de576112de611270565b604051601f8201601f19908116603f0116810190838211818310171561130657611306611270565b8160405282815288602084870101111561131f57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b7f745b0000000000000000000000000000000000000000000000000000000000008152600082516112578160028501602087016110fb565b634e487b7160e01b600052601160045260246000fd5b808201808211156102bd576102bd611379565b634e487b7160e01b600052603260045260246000fd5b6000600182016113ca576113ca611379565b5060010190565b818103818111156102bd576102bd611379565b634e487b7160e01b600052600160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b60008261141f5761141f6113fa565b500690565b600082611433576114336113fa565b50049056fea264697066735822122098bdef3cc2d74dda6a34627073442c81d5bac2650303ff50ec19a0fd00cc31a664736f6c63430008110033", + "devdoc": { + "details": "Resolves names on ENS by interpreting record data stored in a DNS TXT record. This resolver implements the IExtendedDNSResolver interface, meaning that when a DNS name specifies it as the resolver via a TXT record, this resolver's resolve() method is invoked, and is passed any additional information from that text record. This resolver implements a simple text parser allowing a variety of records to be specified in text, which will then be used to resolve the name in ENS. To use this, set a TXT record on your DNS name in the following format: ENS1
For example: ENS1 2.dnsname.ens.eth a[60]=0x1234... The record data consists of a series of key=value pairs, separated by spaces. Keys may have an optional argument in square brackets, and values may be either unquoted - in which case they may not contain spaces - or single-quoted. Single quotes in a quoted value may be backslash-escaped. ┌────────┐ │ ┌───┐ │ ┌──────────────────────────────┴─┤\" \"│◄─┴────────────────────────────────────────┐ │ └───┘ │ │ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌────────────┐ ┌───┐ │ ^─┴─►│key├─┬─►│\"[\"├───►│arg├───►│\"]\"├─┬─►│\"=\"├─┬─►│\"'\"├───►│quoted_value├───►│\"'\"├─┼─$ └───┘ │ └───┘ └───┘ └───┘ │ └───┘ │ └───┘ └────────────┘ └───┘ │ └──────────────────────────┘ │ ┌──────────────┐ │ └─────────►│unquoted_value├─────────┘ └──────────────┘ Record types: - a[] - Specifies how an `addr()` request should be resolved for the specified `coinType`. Ethereum has `coinType` 60. The value must be 0x-prefixed hexadecimal, and will be returned unmodified; this means that non-EVM addresses will need to be translated into binary format and then encoded in hex. Examples: - a[60]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7 - a[0]=0x00149010587f8364b964fcaa70687216b53bd2cbd798 - a[e] - Specifies how an `addr()` request should be resolved for the specified `chainId`. The value must be 0x-prefixed hexadecimal. When encoding an address for an EVM-based cryptocurrency that uses a chainId instead of a coinType, this syntax *must* be used in place of the coin type - eg, Optimism is `a[e10]`, not `a[2147483658]`. A list of supported cryptocurrencies for both syntaxes can be found here: https://github.com/ensdomains/address-encoder/blob/master/docs/supported-cryptocurrencies.md Example: - a[e10]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7 - t[] - Specifies how a `text()` request should be resolved for the specified `key`. Examples: - t[com.twitter]=nicksdjohnson - t[url]='https://ens.domains/' - t[note]='I\\'m great'", + "kind": "dev", + "methods": { + "supportsInterface(bytes4)": { + "details": "Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/LegacyENSRegistry.json b/solidity/dns-contracts/deployments/testnet/LegacyENSRegistry.json new file mode 100644 index 0000000..b0c7d7d --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/LegacyENSRegistry.json @@ -0,0 +1,399 @@ +{ + "address": "0xDD41A110833F7d892dEe36d39fe421C22E853F45", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NewOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "NewResolver", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "NewTTL", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "recordExists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "resolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "ttl", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x2403655c343158a3cb470e1032a68c366ea5bc9b75921242150c5bd17404008b", + "receipt": { + "to": null, + "from": "0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B", + "contractAddress": "0xDD41A110833F7d892dEe36d39fe421C22E853F45", + "transactionIndex": 5, + "gasUsed": "643649", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x7e6484754218548a51459861deb5217c1a4c687420f83345d10f11621e9be9a0", + "transactionHash": "0x2403655c343158a3cb470e1032a68c366ea5bc9b75921242150c5bd17404008b", + "logs": [], + "blockNumber": 57534916, + "cumulativeGasUsed": "1415434", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "bytecode": "0x608060405234801561001057600080fd5b5060008080526020527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb580546001600160a01b03191633179055610a43806100596000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c80635b0fc9c311610081578063cf4088231161005b578063cf40882314610204578063e985e9c514610217578063f79fe5381461026357600080fd5b80635b0fc9c3146101cb5780635ef2c7f0146101de578063a22cb465146101f157600080fd5b806314ab9038116100b257806314ab90381461015657806316a25cbd1461016b5780631896f70a146101b857600080fd5b80630178b8bf146100d957806302571be31461012257806306ab592314610135575b600080fd5b6101056100e7366004610832565b6000908152602081905260409020600101546001600160a01b031690565b6040516001600160a01b0390911681526020015b60405180910390f35b610105610130366004610832565b61028e565b610148610143366004610867565b6102bc565b604051908152602001610119565b6101696101643660046108b4565b6103bc565b005b61019f610179366004610832565b600090815260208190526040902060010154600160a01b900467ffffffffffffffff1690565b60405167ffffffffffffffff9091168152602001610119565b6101696101c63660046108e0565b6104a3565b6101696101d93660046108e0565b610575565b6101696101ec366004610903565b610641565b6101696101ff36600461095a565b610663565b610169610212366004610996565b6106cf565b6102536102253660046109e3565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b6040519015158152602001610119565b610253610271366004610832565b6000908152602081905260409020546001600160a01b0316151590565b6000818152602081905260408120546001600160a01b03163081036102b65750600092915050565b92915050565b60008381526020819052604081205484906001600160a01b03163381148061030757506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61031057600080fd5b604080516020810188905290810186905260009060600160408051601f1981840301815291815281516020928301206000818152928390529120805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03881617905590506040516001600160a01b0386168152869088907fce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e829060200160405180910390a39695505050505050565b60008281526020819052604090205482906001600160a01b03163381148061040757506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61041057600080fd5b60405167ffffffffffffffff8416815284907f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa689060200160405180910390a25050600091825260208290526040909120600101805467ffffffffffffffff909216600160a01b027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff909216919091179055565b60008281526020819052604090205482906001600160a01b0316338114806104ee57506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6104f757600080fd5b6040516001600160a01b038416815284907f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a09060200160405180910390a25050600091825260208290526040909120600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909216919091179055565b60008281526020819052604090205482906001600160a01b0316338114806105c057506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6105c957600080fd5b6000848152602081905260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385161790556040516001600160a01b038416815284907fd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d2669060200160405180910390a250505050565b600061064e8686866102bc565b905061065b8184846106ea565b505050505050565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6106d98484610575565b6106e48483836106ea565b50505050565b6000838152602081905260409020600101546001600160a01b0383811691161461077d5760008381526020818152604091829020600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038616908117909155915191825284917f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0910160405180910390a25b60008381526020819052604090206001015467ffffffffffffffff828116600160a01b909204161461082d576000838152602081815260409182902060010180547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff16600160a01b67ffffffffffffffff861690810291909117909155915191825284917f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa68910160405180910390a25b505050565b60006020828403121561084457600080fd5b5035919050565b80356001600160a01b038116811461086257600080fd5b919050565b60008060006060848603121561087c57600080fd5b83359250602084013591506108936040850161084b565b90509250925092565b803567ffffffffffffffff8116811461086257600080fd5b600080604083850312156108c757600080fd5b823591506108d76020840161089c565b90509250929050565b600080604083850312156108f357600080fd5b823591506108d76020840161084b565b600080600080600060a0868803121561091b57600080fd5b85359450602086013593506109326040870161084b565b92506109406060870161084b565b915061094e6080870161089c565b90509295509295909350565b6000806040838503121561096d57600080fd5b6109768361084b565b91506020830135801515811461098b57600080fd5b809150509250929050565b600080600080608085870312156109ac57600080fd5b843593506109bc6020860161084b565b92506109ca6040860161084b565b91506109d86060860161089c565b905092959194509250565b600080604083850312156109f657600080fd5b6109ff8361084b565b91506108d76020840161084b56fea2646970667358221220391f21217532ab1a3c0a96932e9cae7e3f73e0a95c42fad8fc5a12f9d1f14af864736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100d45760003560e01c80635b0fc9c311610081578063cf4088231161005b578063cf40882314610204578063e985e9c514610217578063f79fe5381461026357600080fd5b80635b0fc9c3146101cb5780635ef2c7f0146101de578063a22cb465146101f157600080fd5b806314ab9038116100b257806314ab90381461015657806316a25cbd1461016b5780631896f70a146101b857600080fd5b80630178b8bf146100d957806302571be31461012257806306ab592314610135575b600080fd5b6101056100e7366004610832565b6000908152602081905260409020600101546001600160a01b031690565b6040516001600160a01b0390911681526020015b60405180910390f35b610105610130366004610832565b61028e565b610148610143366004610867565b6102bc565b604051908152602001610119565b6101696101643660046108b4565b6103bc565b005b61019f610179366004610832565b600090815260208190526040902060010154600160a01b900467ffffffffffffffff1690565b60405167ffffffffffffffff9091168152602001610119565b6101696101c63660046108e0565b6104a3565b6101696101d93660046108e0565b610575565b6101696101ec366004610903565b610641565b6101696101ff36600461095a565b610663565b610169610212366004610996565b6106cf565b6102536102253660046109e3565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b6040519015158152602001610119565b610253610271366004610832565b6000908152602081905260409020546001600160a01b0316151590565b6000818152602081905260408120546001600160a01b03163081036102b65750600092915050565b92915050565b60008381526020819052604081205484906001600160a01b03163381148061030757506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61031057600080fd5b604080516020810188905290810186905260009060600160408051601f1981840301815291815281516020928301206000818152928390529120805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03881617905590506040516001600160a01b0386168152869088907fce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e829060200160405180910390a39695505050505050565b60008281526020819052604090205482906001600160a01b03163381148061040757506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b61041057600080fd5b60405167ffffffffffffffff8416815284907f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa689060200160405180910390a25050600091825260208290526040909120600101805467ffffffffffffffff909216600160a01b027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff909216919091179055565b60008281526020819052604090205482906001600160a01b0316338114806104ee57506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6104f757600080fd5b6040516001600160a01b038416815284907f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a09060200160405180910390a25050600091825260208290526040909120600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909216919091179055565b60008281526020819052604090205482906001600160a01b0316338114806105c057506001600160a01b038116600090815260016020908152604080832033845290915290205460ff165b6105c957600080fd5b6000848152602081905260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385161790556040516001600160a01b038416815284907fd4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d2669060200160405180910390a250505050565b600061064e8686866102bc565b905061065b8184846106ea565b505050505050565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6106d98484610575565b6106e48483836106ea565b50505050565b6000838152602081905260409020600101546001600160a01b0383811691161461077d5760008381526020818152604091829020600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038616908117909155915191825284917f335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0910160405180910390a25b60008381526020819052604090206001015467ffffffffffffffff828116600160a01b909204161461082d576000838152602081815260409182902060010180547fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff16600160a01b67ffffffffffffffff861690810291909117909155915191825284917f1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa68910160405180910390a25b505050565b60006020828403121561084457600080fd5b5035919050565b80356001600160a01b038116811461086257600080fd5b919050565b60008060006060848603121561087c57600080fd5b83359250602084013591506108936040850161084b565b90509250925092565b803567ffffffffffffffff8116811461086257600080fd5b600080604083850312156108c757600080fd5b823591506108d76020840161089c565b90509250929050565b600080604083850312156108f357600080fd5b823591506108d76020840161084b565b600080600080600060a0868803121561091b57600080fd5b85359450602086013593506109326040870161084b565b92506109406060870161084b565b915061094e6080870161089c565b90509295509295909350565b6000806040838503121561096d57600080fd5b6109768361084b565b91506020830135801515811461098b57600080fd5b809150509250929050565b600080600080608085870312156109ac57600080fd5b843593506109bc6020860161084b565b92506109ca6040860161084b565b91506109d86060860161089c565b905092959194509250565b600080604083850312156109f657600080fd5b6109ff8361084b565b91506108d76020840161084b56fea2646970667358221220391f21217532ab1a3c0a96932e9cae7e3f73e0a95c42fad8fc5a12f9d1f14af864736f6c63430008110033" +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/LegacyETHRegistrarController.json b/solidity/dns-contracts/deployments/testnet/LegacyETHRegistrarController.json new file mode 100644 index 0000000..e4160f5 --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/LegacyETHRegistrarController.json @@ -0,0 +1,602 @@ +{ + "address": "0xE420a805aBc22CAb04685D399a5cdcBEb5FEb15B", + "abi": [ + { + "inputs": [ + { + "internalType": "contract BaseRegistrar", + "name": "_base", + "type": "address" + }, + { + "internalType": "contract PriceOracle", + "name": "_prices", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minCommitmentAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxCommitmentAge", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cost", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "name": "NameRenewed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oracle", + "type": "address" + } + ], + "name": "NewPriceOracle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "MIN_REGISTRATION_DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "available", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "commit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "commitments", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + } + ], + "name": "makeCommitment", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "makeCommitmentWithConfig", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "maxCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "minCommitmentAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + } + ], + "name": "register", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "secret", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "registerWithConfig", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "rentPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_minCommitmentAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxCommitmentAge", + "type": "uint256" + } + ], + "name": "setCommitmentAges", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract PriceOracle", + "name": "_prices", + "type": "address" + } + ], + "name": "setPriceOracle", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "valid", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "withdraw", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x8cba5ac7f02f38320c8513c1c01a82f28ab1f00782783ac13852e78380eb3df3", + "receipt": { + "to": null, + "from": "0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B", + "contractAddress": "0xE420a805aBc22CAb04685D399a5cdcBEb5FEb15B", + "transactionIndex": 1, + "gasUsed": "1854573", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000001000000000000400000000000000000000000020000000000000000000800000000000000000000000000000000400000000000010000000000000400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xbae755224004267d10f23c7115b71adf9aa727af9dc23c0a3a5ca328bf97ce8f", + "transactionHash": "0x8cba5ac7f02f38320c8513c1c01a82f28ab1f00782783ac13852e78380eb3df3", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 57535040, + "transactionHash": "0x8cba5ac7f02f38320c8513c1c01a82f28ab1f00782783ac13852e78380eb3df3", + "address": "0xE420a805aBc22CAb04685D399a5cdcBEb5FEb15B", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000002a0d7311fa7e9ac2890cfd8219b2def0c206e79b" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0xbae755224004267d10f23c7115b71adf9aa727af9dc23c0a3a5ca328bf97ce8f" + } + ], + "blockNumber": 57535040, + "cumulativeGasUsed": "1875573", + "status": 1, + "byzantium": true + }, + "args": [ + "0x0393da9525982Be4C8b9812f8D2A877796fCA90b", + "0xBc9aCd5592ac75cd4F2A83e97C736A2b1E22b466", + "60", + "86400" + ], + "numDeployments": 1, + "bytecode": "0x608060405234801561001057600080fd5b50604051611f8c380380611f8c8339818101604052608081101561003357600080fd5b5080516020820151604080840151606090940151600080546001600160a01b031916331780825592519495939491926001600160a01b0316917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a381811161009d57600080fd5b600180546001600160a01b039586166001600160a01b0319918216179091556002805494909516931692909217909255600391909155600455611ea7806100e56000396000f3fe60806040526004361061016a5760003560e01c80638d839ffe116100cb578063aeb8ce9b1161007f578063f2fde38b11610059578063f2fde38b1461075f578063f49826be1461079f578063f7a169631461086d5761016a565b8063aeb8ce9b1461066d578063ce1e09c014610720578063f14fcbc8146107355761016a565b80638f32d59b116100b05780638f32d59b146105355780639791c0971461054a578063acf1a841146105fd5761016a565b80638d839ffe146104e25780638da5cb5b146104f75761016a565b80637e3244791161012257806383e7f6ff1161010757806383e7f6ff1461038657806385f6d1551461043b5780638a95b09f146104cd5761016a565b80637e3244791461032c578063839df9451461035c5761016a565b80633d86c52f116101535780633d86c52f146101e6578063530e784f146102d7578063715018a6146103175761016a565b806301ffc9a71461016f5780633ccfd60b146101cf575b600080fd5b34801561017b57600080fd5b506101bb6004803603602081101561019257600080fd5b50357fffffffff0000000000000000000000000000000000000000000000000000000016610944565b604080519115158252519081900360200190f35b3480156101db57600080fd5b506101e4610b63565b005b3480156101f257600080fd5b506102c5600480360360a081101561020957600080fd5b81019060208101813564010000000081111561022457600080fd5b82018360208201111561023657600080fd5b8035906020019184600183028401116401000000008311171561025857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff83358116945060208401359360408101358216935060600135169050610ba3565b60408051918252519081900360200190f35b3480156102e357600080fd5b506101e4600480360360208110156102fa57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610cdf565b34801561032357600080fd5b506101e4610d65565b34801561033857600080fd5b506101e46004803603604081101561034f57600080fd5b5080359060200135610de5565b34801561036857600080fd5b506102c56004803603602081101561037f57600080fd5b5035610e01565b34801561039257600080fd5b506102c5600480360360408110156103a957600080fd5b8101906020810181356401000000008111156103c457600080fd5b8201836020820111156103d657600080fd5b803590602001918460018302840111640100000000831117156103f857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610e13915050565b6101e46004803603608081101561045157600080fd5b81019060208101813564010000000081111561046c57600080fd5b82018360208201111561047e57600080fd5b803590602001918460018302840111640100000000831117156104a057600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff8135169060208101359060400135610fc3565b3480156104d957600080fd5b506102c561100e565b3480156104ee57600080fd5b506102c5611015565b34801561050357600080fd5b5061050c61101b565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561054157600080fd5b506101bb611037565b34801561055657600080fd5b506101bb6004803603602081101561056d57600080fd5b81019060208101813564010000000081111561058857600080fd5b82018360208201111561059a57600080fd5b803590602001918460018302840111640100000000831117156105bc57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611055945050505050565b6101e46004803603604081101561061357600080fd5b81019060208101813564010000000081111561062e57600080fd5b82018360208201111561064057600080fd5b8035906020019184600183028401116401000000008311171561066257600080fd5b91935091503561106a565b34801561067957600080fd5b506101bb6004803603602081101561069057600080fd5b8101906020810181356401000000008111156106ab57600080fd5b8201836020820111156106bd57600080fd5b803590602001918460018302840111640100000000831117156106df57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611252945050505050565b34801561072c57600080fd5b506102c5611312565b34801561074157600080fd5b506101e46004803603602081101561075857600080fd5b5035611318565b34801561076b57600080fd5b506101e46004803603602081101561078257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661134a565b3480156107ab57600080fd5b506102c5600480360360608110156107c257600080fd5b8101906020810181356401000000008111156107dd57600080fd5b8201836020820111156107ef57600080fd5b8035906020019184600183028401116401000000008311171561081157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff8335169350505060200135611364565b6101e4600480360360c081101561088357600080fd5b81019060208101813564010000000081111561089e57600080fd5b8201836020820111156108b057600080fd5b803590602001918460018302840111640100000000831117156108d257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff83358116945060208401359360408101359350606081013582169250608001351661137c565b604080517f737570706f727473496e74657266616365286279746573342900000000000000815290519081900360190190206000907fffffffff0000000000000000000000000000000000000000000000000000000083811691161480610ae75750604080517f72656e657728737472696e672c75696e743235362900000000000000000000008152905190819003601501812090806028611de38239604080519182900360280182207f636f6d6d697428627974657333322900000000000000000000000000000000008352905191829003600f01822090925090806026611e0b82396026019050604051809103902060405180807f617661696c61626c6528737472696e67290000000000000000000000000000008152506011019050604051809103902060405180807f72656e74507269636528737472696e672c75696e7432353629000000000000008152506019019050604051809103902018181818187bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610b5d57506040518080611da36040913960408051918290030181209150806042611e31823960420190506040518091039020187bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b92915050565b610b6b611037565b610b7457600080fd5b60405133904780156108fc02916000818181858888f19350505050158015610ba0573d6000803e3d6000fd5b50565b8451602086012060009073ffffffffffffffffffffffffffffffffffffffff8416158015610be5575073ffffffffffffffffffffffffffffffffffffffff8316155b15610c4857604080516020808201939093527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089901b1681830152605480820188905282518083039091018152607490910190915280519101209050610cd6565b73ffffffffffffffffffffffffffffffffffffffff8416610c6857600080fd5b604080516020808201939093527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b82168385015287811b8216605484015286901b166068820152607c80820188905282518083039091018152609c909101909152805191012090505b95945050505050565b610ce7611037565b610cf057600080fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691909117918290556040519116907ff261845a790fe29bbd6631e2ca4a5bdc83e6eed7c3271d9590d97287e00e912390600090a250565b610d6d611037565b610d7657600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b610ded611037565b610df657600080fd5b600391909155600455565b60056020526000908152604090205481565b8151602080840191909120600254600154604080517fd6e4fa8600000000000000000000000000000000000000000000000000000000815260048101859052905160009573ffffffffffffffffffffffffffffffffffffffff948516946350e9a715948a9491169263d6e4fa8692602480840193919291829003018186803b158015610e9e57600080fd5b505afa158015610eb2573d6000803e3d6000fd5b505050506040513d6020811015610ec857600080fd5b50516040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152602481018290526044810188905260606004820190815283516064830152835189928291608490910190602087019080838360005b83811015610f43578181015183820152602001610f2b565b50505050905090810190601f168015610f705780820380516001836020036101000a031916815260200191505b5094505050505060206040518083038186803b158015610f8f57600080fd5b505afa158015610fa3573d6000803e3d6000fd5b505050506040513d6020811015610fb957600080fd5b5051949350505050565b61100785858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508893508792508691508061137c565b5050505050565b6224ea0081565b60035481565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60005473ffffffffffffffffffffffffffffffffffffffff16331490565b6000600361106283611a7c565b101592915050565b60006110ad84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869250610e13915050565b9050803410156110bc57600080fd5b6000848460405180838380828437604080519390910183900383206001547fc475abff00000000000000000000000000000000000000000000000000000000855260048501829052602485018b905291519097506000965073ffffffffffffffffffffffffffffffffffffffff909116945063c475abff93506044808401936020935082900301818787803b15801561115457600080fd5b505af1158015611168573d6000803e3d6000fd5b505050506040513d602081101561117e57600080fd5b50519050348310156111bb5760405133903485900380156108fc02916000818181858888f193505050501580156111b9573d6000803e3d6000fd5b505b817f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae8787868560405180806020018481526020018381526020018281038252868682818152602001925080828437600083820152604051601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690920182900397509095505050505050a2505050505050565b8051602082012060009061126583611055565b801561130b5750600154604080517f96e494e800000000000000000000000000000000000000000000000000000000815260048101849052905173ffffffffffffffffffffffffffffffffffffffff909216916396e494e891602480820192602092909190829003018186803b1580156112de57600080fd5b505afa1580156112f2573d6000803e3d6000fd5b505050506040513d602081101561130857600080fd5b50515b9392505050565b60045481565b6004546000828152600560205260409020544291011061133757600080fd5b6000908152600560205260409020429055565b611352611037565b61135b57600080fd5b610ba081611c68565b6000611374848484600080610ba3565b949350505050565b600061138b8787868686610ba3565b9050600061139a888784611d15565b885160208a012090915080600073ffffffffffffffffffffffffffffffffffffffff8716156118a257600154604080517ffca247ac00000000000000000000000000000000000000000000000000000000815260048101859052306024820152604481018c9052905173ffffffffffffffffffffffffffffffffffffffff9092169163fca247ac916064808201926020929091908290030181600087803b15801561144457600080fd5b505af1158015611458573d6000803e3d6000fd5b505050506040513d602081101561146e57600080fd5b5051600154604080517fddf7fcb0000000000000000000000000000000000000000000000000000000008152905192935060009273ffffffffffffffffffffffffffffffffffffffff9092169163ddf7fcb091600480820192602092909190829003018186803b1580156114e157600080fd5b505afa1580156114f5573d6000803e3d6000fd5b505050506040513d602081101561150b57600080fd5b505160408051602081810193909352808201879052815180820383018152606082018084528151918501919091206001547f3f15457f00000000000000000000000000000000000000000000000000000000909252925192945073ffffffffffffffffffffffffffffffffffffffff1692633f15457f92606480840193829003018186803b15801561159c57600080fd5b505afa1580156115b0573d6000803e3d6000fd5b505050506040513d60208110156115c657600080fd5b5051604080517f1896f70a0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8b8116602483015291519190921691631896f70a91604480830192600092919082900301818387803b15801561164057600080fd5b505af1158015611654573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff871615611714578773ffffffffffffffffffffffffffffffffffffffff1663d5fa2b0082896040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050600060405180830381600087803b1580156116fb57600080fd5b505af115801561170f573d6000803e3d6000fd5b505050505b600154604080517f28ed4f6c0000000000000000000000000000000000000000000000000000000081526004810186905273ffffffffffffffffffffffffffffffffffffffff8e81166024830152915191909216916328ed4f6c91604480830192600092919082900301818387803b15801561178f57600080fd5b505af11580156117a3573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd308d866040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561188457600080fd5b505af1158015611898573d6000803e3d6000fd5b5050505050611975565b73ffffffffffffffffffffffffffffffffffffffff8616156118c357600080fd5b600154604080517ffca247ac0000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff8d81166024830152604482018d90529151919092169163fca247ac9160648083019260209291908290030181600087803b15801561194657600080fd5b505af115801561195a573d6000803e3d6000fd5b505050506040513d602081101561197057600080fd5b505190505b8973ffffffffffffffffffffffffffffffffffffffff16837fca6abbe9d7f11422cb6ca7629fbf6fe9efb1c621f71ce8f02b9f2a230097404f8d87856040518080602001848152602001838152602001828103825285818151815260200191508051906020019080838360005b838110156119fa5781810151838201526020016119e2565b50505050905090810190601f168015611a275780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a383341115611a6f5760405133903486900380156108fc02916000818181858888f19350505050158015611a6d573d6000803e3d6000fd5b505b5050505050505050505050565b8051600090819081905b80821015611c5f576000858381518110611a9c57fe5b01602001517fff000000000000000000000000000000000000000000000000000000000000001690507f8000000000000000000000000000000000000000000000000000000000000000811015611af857600183019250611c53565b7fe0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611b4d57600283019250611c53565b7ff0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611ba257600383019250611c53565b7ff8000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611bf757600483019250611c53565b7ffc000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611c4c57600583019250611c53565b6006830192505b50600190920191611a86565b50909392505050565b73ffffffffffffffffffffffffffffffffffffffff8116611c8857600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60035460008281526005602052604081205490914291011115611d3757600080fd5b60045460008381526005602052604090205442910111611d5657600080fd5b611d5f84611252565b611d6857600080fd5b6000828152600560205260408120819055611d838585610e13565b90506224ea00841015611d9557600080fd5b8034101561137457600080fdfe6d616b65436f6d6d69746d656e7457697468436f6e66696728737472696e672c616464726573732c627974657333322c616464726573732c6164647265737329726567697374657228737472696e672c616464726573732c75696e743235362c62797465733332296d616b65436f6d6d69746d656e7428737472696e672c616464726573732c6279746573333229726567697374657257697468436f6e66696728737472696e672c616464726573732c75696e743235362c627974657333322c616464726573732c6164647265737329a265627a7a7231582053a253c3d59287a7d8afcbca61f9a34825e2003361654c7f2350c82db76d3db764736f6c63430005110032", + "deployedBytecode": "0x60806040526004361061016a5760003560e01c80638d839ffe116100cb578063aeb8ce9b1161007f578063f2fde38b11610059578063f2fde38b1461075f578063f49826be1461079f578063f7a169631461086d5761016a565b8063aeb8ce9b1461066d578063ce1e09c014610720578063f14fcbc8146107355761016a565b80638f32d59b116100b05780638f32d59b146105355780639791c0971461054a578063acf1a841146105fd5761016a565b80638d839ffe146104e25780638da5cb5b146104f75761016a565b80637e3244791161012257806383e7f6ff1161010757806383e7f6ff1461038657806385f6d1551461043b5780638a95b09f146104cd5761016a565b80637e3244791461032c578063839df9451461035c5761016a565b80633d86c52f116101535780633d86c52f146101e6578063530e784f146102d7578063715018a6146103175761016a565b806301ffc9a71461016f5780633ccfd60b146101cf575b600080fd5b34801561017b57600080fd5b506101bb6004803603602081101561019257600080fd5b50357fffffffff0000000000000000000000000000000000000000000000000000000016610944565b604080519115158252519081900360200190f35b3480156101db57600080fd5b506101e4610b63565b005b3480156101f257600080fd5b506102c5600480360360a081101561020957600080fd5b81019060208101813564010000000081111561022457600080fd5b82018360208201111561023657600080fd5b8035906020019184600183028401116401000000008311171561025857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff83358116945060208401359360408101358216935060600135169050610ba3565b60408051918252519081900360200190f35b3480156102e357600080fd5b506101e4600480360360208110156102fa57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610cdf565b34801561032357600080fd5b506101e4610d65565b34801561033857600080fd5b506101e46004803603604081101561034f57600080fd5b5080359060200135610de5565b34801561036857600080fd5b506102c56004803603602081101561037f57600080fd5b5035610e01565b34801561039257600080fd5b506102c5600480360360408110156103a957600080fd5b8101906020810181356401000000008111156103c457600080fd5b8201836020820111156103d657600080fd5b803590602001918460018302840111640100000000831117156103f857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610e13915050565b6101e46004803603608081101561045157600080fd5b81019060208101813564010000000081111561046c57600080fd5b82018360208201111561047e57600080fd5b803590602001918460018302840111640100000000831117156104a057600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff8135169060208101359060400135610fc3565b3480156104d957600080fd5b506102c561100e565b3480156104ee57600080fd5b506102c5611015565b34801561050357600080fd5b5061050c61101b565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561054157600080fd5b506101bb611037565b34801561055657600080fd5b506101bb6004803603602081101561056d57600080fd5b81019060208101813564010000000081111561058857600080fd5b82018360208201111561059a57600080fd5b803590602001918460018302840111640100000000831117156105bc57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611055945050505050565b6101e46004803603604081101561061357600080fd5b81019060208101813564010000000081111561062e57600080fd5b82018360208201111561064057600080fd5b8035906020019184600183028401116401000000008311171561066257600080fd5b91935091503561106a565b34801561067957600080fd5b506101bb6004803603602081101561069057600080fd5b8101906020810181356401000000008111156106ab57600080fd5b8201836020820111156106bd57600080fd5b803590602001918460018302840111640100000000831117156106df57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611252945050505050565b34801561072c57600080fd5b506102c5611312565b34801561074157600080fd5b506101e46004803603602081101561075857600080fd5b5035611318565b34801561076b57600080fd5b506101e46004803603602081101561078257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661134a565b3480156107ab57600080fd5b506102c5600480360360608110156107c257600080fd5b8101906020810181356401000000008111156107dd57600080fd5b8201836020820111156107ef57600080fd5b8035906020019184600183028401116401000000008311171561081157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff8335169350505060200135611364565b6101e4600480360360c081101561088357600080fd5b81019060208101813564010000000081111561089e57600080fd5b8201836020820111156108b057600080fd5b803590602001918460018302840111640100000000831117156108d257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505073ffffffffffffffffffffffffffffffffffffffff83358116945060208401359360408101359350606081013582169250608001351661137c565b604080517f737570706f727473496e74657266616365286279746573342900000000000000815290519081900360190190206000907fffffffff0000000000000000000000000000000000000000000000000000000083811691161480610ae75750604080517f72656e657728737472696e672c75696e743235362900000000000000000000008152905190819003601501812090806028611de38239604080519182900360280182207f636f6d6d697428627974657333322900000000000000000000000000000000008352905191829003600f01822090925090806026611e0b82396026019050604051809103902060405180807f617661696c61626c6528737472696e67290000000000000000000000000000008152506011019050604051809103902060405180807f72656e74507269636528737472696e672c75696e7432353629000000000000008152506019019050604051809103902018181818187bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610b5d57506040518080611da36040913960408051918290030181209150806042611e31823960420190506040518091039020187bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b92915050565b610b6b611037565b610b7457600080fd5b60405133904780156108fc02916000818181858888f19350505050158015610ba0573d6000803e3d6000fd5b50565b8451602086012060009073ffffffffffffffffffffffffffffffffffffffff8416158015610be5575073ffffffffffffffffffffffffffffffffffffffff8316155b15610c4857604080516020808201939093527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089901b1681830152605480820188905282518083039091018152607490910190915280519101209050610cd6565b73ffffffffffffffffffffffffffffffffffffffff8416610c6857600080fd5b604080516020808201939093527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b82168385015287811b8216605484015286901b166068820152607c80820188905282518083039091018152609c909101909152805191012090505b95945050505050565b610ce7611037565b610cf057600080fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691909117918290556040519116907ff261845a790fe29bbd6631e2ca4a5bdc83e6eed7c3271d9590d97287e00e912390600090a250565b610d6d611037565b610d7657600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b610ded611037565b610df657600080fd5b600391909155600455565b60056020526000908152604090205481565b8151602080840191909120600254600154604080517fd6e4fa8600000000000000000000000000000000000000000000000000000000815260048101859052905160009573ffffffffffffffffffffffffffffffffffffffff948516946350e9a715948a9491169263d6e4fa8692602480840193919291829003018186803b158015610e9e57600080fd5b505afa158015610eb2573d6000803e3d6000fd5b505050506040513d6020811015610ec857600080fd5b50516040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152602481018290526044810188905260606004820190815283516064830152835189928291608490910190602087019080838360005b83811015610f43578181015183820152602001610f2b565b50505050905090810190601f168015610f705780820380516001836020036101000a031916815260200191505b5094505050505060206040518083038186803b158015610f8f57600080fd5b505afa158015610fa3573d6000803e3d6000fd5b505050506040513d6020811015610fb957600080fd5b5051949350505050565b61100785858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508893508792508691508061137c565b5050505050565b6224ea0081565b60035481565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60005473ffffffffffffffffffffffffffffffffffffffff16331490565b6000600361106283611a7c565b101592915050565b60006110ad84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869250610e13915050565b9050803410156110bc57600080fd5b6000848460405180838380828437604080519390910183900383206001547fc475abff00000000000000000000000000000000000000000000000000000000855260048501829052602485018b905291519097506000965073ffffffffffffffffffffffffffffffffffffffff909116945063c475abff93506044808401936020935082900301818787803b15801561115457600080fd5b505af1158015611168573d6000803e3d6000fd5b505050506040513d602081101561117e57600080fd5b50519050348310156111bb5760405133903485900380156108fc02916000818181858888f193505050501580156111b9573d6000803e3d6000fd5b505b817f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae8787868560405180806020018481526020018381526020018281038252868682818152602001925080828437600083820152604051601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690920182900397509095505050505050a2505050505050565b8051602082012060009061126583611055565b801561130b5750600154604080517f96e494e800000000000000000000000000000000000000000000000000000000815260048101849052905173ffffffffffffffffffffffffffffffffffffffff909216916396e494e891602480820192602092909190829003018186803b1580156112de57600080fd5b505afa1580156112f2573d6000803e3d6000fd5b505050506040513d602081101561130857600080fd5b50515b9392505050565b60045481565b6004546000828152600560205260409020544291011061133757600080fd5b6000908152600560205260409020429055565b611352611037565b61135b57600080fd5b610ba081611c68565b6000611374848484600080610ba3565b949350505050565b600061138b8787868686610ba3565b9050600061139a888784611d15565b885160208a012090915080600073ffffffffffffffffffffffffffffffffffffffff8716156118a257600154604080517ffca247ac00000000000000000000000000000000000000000000000000000000815260048101859052306024820152604481018c9052905173ffffffffffffffffffffffffffffffffffffffff9092169163fca247ac916064808201926020929091908290030181600087803b15801561144457600080fd5b505af1158015611458573d6000803e3d6000fd5b505050506040513d602081101561146e57600080fd5b5051600154604080517fddf7fcb0000000000000000000000000000000000000000000000000000000008152905192935060009273ffffffffffffffffffffffffffffffffffffffff9092169163ddf7fcb091600480820192602092909190829003018186803b1580156114e157600080fd5b505afa1580156114f5573d6000803e3d6000fd5b505050506040513d602081101561150b57600080fd5b505160408051602081810193909352808201879052815180820383018152606082018084528151918501919091206001547f3f15457f00000000000000000000000000000000000000000000000000000000909252925192945073ffffffffffffffffffffffffffffffffffffffff1692633f15457f92606480840193829003018186803b15801561159c57600080fd5b505afa1580156115b0573d6000803e3d6000fd5b505050506040513d60208110156115c657600080fd5b5051604080517f1896f70a0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8b8116602483015291519190921691631896f70a91604480830192600092919082900301818387803b15801561164057600080fd5b505af1158015611654573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff871615611714578773ffffffffffffffffffffffffffffffffffffffff1663d5fa2b0082896040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050600060405180830381600087803b1580156116fb57600080fd5b505af115801561170f573d6000803e3d6000fd5b505050505b600154604080517f28ed4f6c0000000000000000000000000000000000000000000000000000000081526004810186905273ffffffffffffffffffffffffffffffffffffffff8e81166024830152915191909216916328ed4f6c91604480830192600092919082900301818387803b15801561178f57600080fd5b505af11580156117a3573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd308d866040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561188457600080fd5b505af1158015611898573d6000803e3d6000fd5b5050505050611975565b73ffffffffffffffffffffffffffffffffffffffff8616156118c357600080fd5b600154604080517ffca247ac0000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff8d81166024830152604482018d90529151919092169163fca247ac9160648083019260209291908290030181600087803b15801561194657600080fd5b505af115801561195a573d6000803e3d6000fd5b505050506040513d602081101561197057600080fd5b505190505b8973ffffffffffffffffffffffffffffffffffffffff16837fca6abbe9d7f11422cb6ca7629fbf6fe9efb1c621f71ce8f02b9f2a230097404f8d87856040518080602001848152602001838152602001828103825285818151815260200191508051906020019080838360005b838110156119fa5781810151838201526020016119e2565b50505050905090810190601f168015611a275780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a383341115611a6f5760405133903486900380156108fc02916000818181858888f19350505050158015611a6d573d6000803e3d6000fd5b505b5050505050505050505050565b8051600090819081905b80821015611c5f576000858381518110611a9c57fe5b01602001517fff000000000000000000000000000000000000000000000000000000000000001690507f8000000000000000000000000000000000000000000000000000000000000000811015611af857600183019250611c53565b7fe0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611b4d57600283019250611c53565b7ff0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611ba257600383019250611c53565b7ff8000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611bf757600483019250611c53565b7ffc000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611c4c57600583019250611c53565b6006830192505b50600190920191611a86565b50909392505050565b73ffffffffffffffffffffffffffffffffffffffff8116611c8857600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60035460008281526005602052604081205490914291011115611d3757600080fd5b60045460008381526005602052604090205442910111611d5657600080fd5b611d5f84611252565b611d6857600080fd5b6000828152600560205260408120819055611d838585610e13565b90506224ea00841015611d9557600080fd5b8034101561137457600080fdfe6d616b65436f6d6d69746d656e7457697468436f6e66696728737472696e672c616464726573732c627974657333322c616464726573732c6164647265737329726567697374657228737472696e672c616464726573732c75696e743235362c62797465733332296d616b65436f6d6d69746d656e7428737472696e672c616464726573732c6279746573333229726567697374657257697468436f6e66696728737472696e672c616464726573732c75696e743235362c627974657333322c616464726573732c6164647265737329a265627a7a7231582053a253c3d59287a7d8afcbca61f9a34825e2003361654c7f2350c82db76d3db764736f6c63430005110032" +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/LegacyPublicResolver.json b/solidity/dns-contracts/deployments/testnet/LegacyPublicResolver.json new file mode 100644 index 0000000..7b8fbd5 --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/LegacyPublicResolver.json @@ -0,0 +1,888 @@ +{ + "address": "0x32B9d882212320b6E6f43f0C41601a58aa61c7C7", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + } + ], + "name": "ABIChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "AddrChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isAuthorised", + "type": "bool" + } + ], + "name": "AuthorisationChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "ContenthashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "record", + "type": "bytes" + } + ], + "name": "DNSRecordChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "DNSRecordDeleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "DNSZoneCleared", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "InterfaceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "PubkeyChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "string", + "name": "indexedKey", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "TextChanged", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentTypes", + "type": "uint256" + } + ], + "name": "ABI", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "authorisations", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "clearDNSZone", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "contenthash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "dnsRecord", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + } + ], + "name": "hasDNSRecords", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "interfaceImplementer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "pubkey", + "outputs": [ + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setABI", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "a", + "type": "bytes" + } + ], + "name": "setAddr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "setAddr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bool", + "name": "isAuthorised", + "type": "bool" + } + ], + "name": "setAuthorisation", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setContenthash", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setDNSRecords", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "setInterface", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "setPubkey", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "setText", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "text", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x8a03fa7963c01c3734cc1fc77ac9f8e706a57dadd0762996cb7b9493b7185354", + "receipt": { + "to": null, + "from": "0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B", + "contractAddress": "0x32B9d882212320b6E6f43f0C41601a58aa61c7C7", + "transactionIndex": 1, + "gasUsed": "2382872", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x0f0c4334f58ac4a732d5ef1932571f763390c3ebb3d135033696069acbb84ad0", + "transactionHash": "0x8a03fa7963c01c3734cc1fc77ac9f8e706a57dadd0762996cb7b9493b7185354", + "logs": [], + "blockNumber": 57535036, + "cumulativeGasUsed": "2504255", + "status": 1, + "byzantium": true + }, + "args": [ + "0x8390D472587cCAe988dD06Ccd456Ac70CcF39038" + ], + "numDeployments": 1, + "bytecode": "0x60806040523480156200001157600080fd5b5060405162002abe38038062002abe83398101604081905262000034916200006d565b600a80546001600160a01b0319166001600160a01b0392909216919091179055620000d6565b80516200006781620000bc565b92915050565b6000602082840312156200008057600080fd5b60006200008e84846200005a565b949350505050565b60006200006782620000b0565b6000620000678262000096565b6001600160a01b031690565b620000c781620000a3565b8114620000d357600080fd5b50565b6129d880620000e66000396000f3fe608060405234801561001057600080fd5b50600436106101985760003560e01c8063691f3431116100e3578063bc1c58d11161008c578063e59d895d11610066578063e59d895d14610387578063f1cb7e061461039a578063f86bc879146103ad57610198565b8063bc1c58d114610340578063c869023314610353578063d5fa2b001461037457610198565b8063a8fa5682116100bd578063a8fa5682146102fa578063ac9650d81461030d578063ad5780af1461032d57610198565b8063691f3431146102c157806377372213146102d45780638b95dd71146102e757610198565b8063304e6ade116101455780634cbf6ba41161011f5780634cbf6ba41461027b57806359d1d43c1461028e578063623195b0146102ae57610198565b8063304e6ade146102425780633b3b57de146102555780633e9ce7941461026857610198565b8063124a319c11610176578063124a319c146101ee5780632203ab561461020e57806329cd62ea1461022f57610198565b806301ffc9a71461019d5780630af179d7146101c657806310f13a8c146101db575b600080fd5b6101b06101ab366004612504565b6103c0565b6040516101bd9190612730565b60405180910390f35b6101d96101d4366004612364565b61041e565b005b6101d96101e93660046123ba565b61060b565b6102016101fc366004612302565b6106b8565b6040516101bd9190612703565b61022161021c36600461224c565b6109f7565b6040516101bd9291906127f3565b6101d961023d36600461227c565b610b16565b6101d9610250366004612364565b610b96565b610201610263366004612164565b610bf5565b6101d9610276366004612209565b610c2a565b6101b061028936600461224c565b610ccf565b6102a161029c366004612364565b610d01565b6040516101bd9190612787565b6101d96102bc366004612441565b610dc3565b6102a16102cf366004612164565b610e3e565b6101d96102e2366004612364565b610edf565b6101d96102f53660046124a9565b610f3e565b6102a16103083660046122bf565b611003565b61032061031b366004612122565b611090565b6040516101bd919061271f565b6101d961033b366004612164565b6111d4565b6102a161034e366004612164565b611227565b610366610361366004612164565b61128f565b6040516101bd92919061274c565b6101d9610382366004612182565b6112a9565b6101d9610395366004612332565b6112d0565b6102a16103a836600461224c565b61139d565b6101b06103bb3660046121bc565b611446565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f59d1d43c00000000000000000000000000000000000000000000000000000000148061041657506104168261146c565b90505b919050565b82610428816114c2565b61043157600080fd5b60008060608082610440611e30565b61048a60008a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505063ffffffff6115d1169050565b90505b610496816115ec565b6105ae5761ffff86166104ee57806040015195506104b3816115fa565b9350836040516020016104c691906126ec565b6040516020818303038152906040528051906020012091506104e781611621565b92506105a0565b60606104f9826115fa565b9050816040015161ffff168761ffff161415806105235750610521858263ffffffff61164216565b155b1561059e576105778b86898d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505050602087015189518c918290039015611660565b81604001519650816020015195508094508480519060200120925061059b82611621565b93505b505b6105a9816118c7565b61048d565b50825115610600576106008984878b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505088518b9250828f03915015611660565b505050505050505050565b84610615816114c2565b61061e57600080fd5b82826009600089815260200190815260200160002087876040516106439291906126df565b90815260405190819003602001902061065d929091611e7b565b50848460405161066e9291906126df565b6040518091039020867fd8c9334b1a9c2f9da342a0a2b32629c1a229b6445dad78947f674b44444a755087876040516106a8929190612775565b60405180910390a3505050505050565b60008281526006602090815260408083207fffffffff000000000000000000000000000000000000000000000000000000008516845290915281205473ffffffffffffffffffffffffffffffffffffffff1680156107175790506109f1565b600061072285610bf5565b905073ffffffffffffffffffffffffffffffffffffffff811661074a576000925050506109f1565b600060608273ffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b60405160240161077d9190612767565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a700000000000000000000000000000000000000000000000000000000179052516107fe91906126ec565b600060405180830381855afa9150503d8060008114610839576040519150601f19603f3d011682016040523d82523d6000602084013e61083e565b606091505b5091509150811580610851575060208151105b8061088d575080601f8151811061086457fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b1561089f5760009450505050506109f1565b8273ffffffffffffffffffffffffffffffffffffffff16866040516024016108c79190612767565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001790525161094891906126ec565b600060405180830381855afa9150503d8060008114610983576040519150601f19603f3d011682016040523d82523d6000602084013e610988565b606091505b50909250905081158061099c575060208151105b806109d8575080601f815181106109af57fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109ea5760009450505050506109f1565b5090925050505b92915050565b600082815260208190526040812060609060015b848111610af85780851615801590610a4357506000818152602083905260409020546002600019610100600184161502019091160415155b15610af0576000818152602083815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845284939192839190830182828015610ade5780601f10610ab357610100808354040283529160200191610ade565b820191906000526020600020905b815481529060010190602001808311610ac157829003601f168201915b50505050509050935093505050610b0f565b60011b610a0b565b505060408051602081019091526000808252925090505b9250929050565b82610b20816114c2565b610b2957600080fd5b6040805180820182528481526020808201858152600088815260089092529083902091518255516001909101555184907f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4690610b88908690869061274c565b60405180910390a250505050565b82610ba0816114c2565b610ba957600080fd5b6000848152600260205260409020610bc2908484611e7b565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610b88929190612775565b60006060610c0483603c61139d565b9050805160001415610c1a576000915050610419565b610c238161199a565b9392505050565b6000838152600b602090815260408083203380855290835281842073ffffffffffffffffffffffffffffffffffffffff871680865293529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515151790555190919085907fe1c5610a6e0cbe10764ecd182adcef1ec338dc4e199c99c32ce98f38e12791df90610cc2908690612730565b60405180910390a4505050565b600091825260056020908152604080842060038352818520548552825280842092845291905290205461ffff16151590565b6060600960008581526020019081526020016000208383604051610d269291906126df565b9081526040805160209281900383018120805460026001821615610100026000190190911604601f81018590048502830185019093528282529092909190830182828015610db55780601f10610d8a57610100808354040283529160200191610db5565b820191906000526020600020905b815481529060010190602001808311610d9857829003601f168201915b505050505090509392505050565b83610dcd816114c2565b610dd657600080fd5b6000198401841615610de757600080fd5b6000858152602081815260408083208784529091529020610e09908484611e7b565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b60008181526007602090815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610ed35780601f10610ea857610100808354040283529160200191610ed3565b820191906000526020600020905b815481529060010190602001808311610eb657829003601f168201915b50505050509050919050565b82610ee9816114c2565b610ef257600080fd5b6000848152600760205260409020610f0b908484611e7b565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610b88929190612775565b82610f48816114c2565b610f5157600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af7528484604051610f839291906127f3565b60405180910390a2603c831415610fd557837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd2610fbf8461199a565b604051610fcc9190612711565b60405180910390a25b600084815260016020908152604080832086845282529091208351610ffc92850190611f17565b5050505050565b6000838152600460209081526040808320600383528184205484528252808320858452825280832061ffff8516845282529182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610db55780601f10610d8a57610100808354040283529160200191610db5565b6040805182815260208084028201019091526060908280156110c657816020015b60608152602001906001900390816110b15790505b50905060005b828110156111cd5760006060308686858181106110e557fe5b6020028201905080357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe13684900301811261111f57600080fd5b9091016020810191503567ffffffffffffffff81111561113e57600080fd5b3681900382131561114e57600080fd5b60405161115c9291906126df565b600060405180830381855af49150503d8060008114611197576040519150601f19603f3d011682016040523d82523d6000602084013e61119c565b606091505b5091509150816111ab57600080fd5b808484815181106111b857fe5b602090810291909101015250506001016110cc565b5092915050565b806111de816114c2565b6111e757600080fd5b600082815260036020526040808220805460010190555183917fb757169b8492ca2f1c6619d9d76ce22803035c3b1d5f6930dffe7b127c1a198391a25050565b600081815260026020818152604092839020805484516001821615610100026000190190911693909304601f81018390048302840183019094528383526060939091830182828015610ed35780601f10610ea857610100808354040283529160200191610ed3565b600090815260086020526040902080546001909101549091565b816112b3816114c2565b6112bc57600080fd5b6112cb83603c6102f5856119c2565b505050565b826112da816114c2565b6112e357600080fd5b60008481526006602090815260408083207fffffffff00000000000000000000000000000000000000000000000000000000871680855292529182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616179055905185907f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa9061138f908690612703565b60405180910390a350505050565b600082815260016020818152604080842085855282529283902080548451600294821615610100026000190190911693909304601f810183900483028401830190945283835260609390918301828280156114395780601f1061140e57610100808354040283529160200191611439565b820191906000526020600020905b81548152906001019060200180831161141c57829003601f168201915b5050505050905092915050565b600b60209081526000938452604080852082529284528284209052825290205460ff1681565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fc86902330000000000000000000000000000000000000000000000000000000014806104165750610416826119fb565b600a546040517f02571be3000000000000000000000000000000000000000000000000000000008152600091829173ffffffffffffffffffffffffffffffffffffffff909116906302571be39061151d90869060040161273e565b60206040518083038186803b15801561153557600080fd5b505afa158015611549573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061156d91908101906120fc565b905073ffffffffffffffffffffffffffffffffffffffff8116331480610c2357506000838152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452825280832033845290915290205460ff16915050919050565b6115d9611e30565b82815260c081018290526109f1816118c7565b805151602090910151101590565b60208101518151606091610416916116129082611a51565b8451919063ffffffff611a9816565b60a081015160c082015182516060926104169281900363ffffffff611a9816565b600081518351148015610c235750610c238360008460008751611afa565b600087815260036020908152604090912054875191880191909120606061168e87878763ffffffff611a9816565b905083156117a85760008a81526004602090815260408083208684528252808320858452825280832061ffff8c16845290915290205460026000196101006001841615020190911604156117335760008a81526005602090815260408083208684528252808320858452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000811661ffff918216600019019091161790555b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c168452909152812061176991611f85565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a60405161179b929190612798565b60405180910390a26118bb565b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c168452909152902054600260001961010060018416150201909116046118425760008a815260056020908152604080832086845282528083208584529091529020805461ffff808216600101167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00009091161790555b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c1684528252909120825161187d92840190611f17565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a846040516118b2939291906127b8565b60405180910390a25b50505050505050505050565b60c081015160208201819052815151116118e057611997565b60006118f482600001518360200151611a51565b602083015183519101915061190f908263ffffffff611b1d16565b61ffff166040830152815160029190910190611931908263ffffffff611b1d16565b61ffff166060830152815160029190910190611953908263ffffffff611b3d16565b63ffffffff908116608084015282516004929092019160009161197991908490611b1d16565b600283810160a086015261ffff9190911690920190910160c0830152505b50565b600081516014146119aa57600080fd5b50602001516c01000000000000000000000000900490565b6040805160148082528183019092526060916020820181803883395050506c010000000000000000000000009290920260208301525090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f691f3431000000000000000000000000000000000000000000000000000000001480610416575061041682611b5f565b6000815b83518110611a5f57fe5b6000611a71858363ffffffff611bc416565b60ff1691820160010191905080611a885750611a8e565b50611a55565b9190910392915050565b606083518284011115611aaa57600080fd5b6060826040519080825280601f01601f191660200182016040528015611ad7576020820181803883390190505b50905060208082019086860101611aef828287611be2565b509095945050505050565b6000611b07848484611c3e565b611b12878785611c3e565b149695505050505050565b60008251826002011115611b3057600080fd5b50016002015161ffff1690565b60008251826004011115611b5057600080fd5b50016004015163ffffffff1690565b6000604051611b6d906126f8565b60405180910390207bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610416575061041682611c5a565b6000828281518110611bd257fe5b016020015160f81c905092915050565b5b60208110611c205781518352602092830192909101907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001611be3565b905182516020929092036101000a6000190180199091169116179052565b600083518284011115611c5057600080fd5b5091016020012090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fa8fa568200000000000000000000000000000000000000000000000000000000148061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167fbc1c58d100000000000000000000000000000000000000000000000000000000148061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167f3b3b57de000000000000000000000000000000000000000000000000000000001480611d8f57507fffffffff0000000000000000000000000000000000000000000000000000000082167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167f2203ab5600000000000000000000000000000000000000000000000000000000148061041657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610416565b6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611eda578280017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00823516178555611f07565b82800160010185558215611f07579182015b82811115611f07578235825591602001919060010190611eec565b50611f13929150611fc5565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611f5857805160ff1916838001178555611f07565b82800160010185558215611f07579182015b82811115611f07578251825591602001919060010190611f6a565b50805460018160011615610100020316600290046000825580601f10611fab5750611997565b601f01602090049060005260206000209081019061199791905b611fdf91905b80821115611f135760008155600101611fcb565b90565b80356109f18161295d565b80516109f18161295d565b60008083601f84011261200a57600080fd5b50813567ffffffffffffffff81111561202257600080fd5b602083019150836020820283011115610b0f57600080fd5b80356109f181612971565b80356109f18161297a565b80356109f181612983565b60008083601f84011261206d57600080fd5b50813567ffffffffffffffff81111561208557600080fd5b602083019150836001820283011115610b0f57600080fd5b600082601f8301126120ae57600080fd5b81356120c16120bc8261283a565b612813565b915080825260208301602083018583830111156120dd57600080fd5b6120e88382846128f9565b50505092915050565b80356109f18161298c565b60006020828403121561210e57600080fd5b600061211a8484611fed565b949350505050565b6000806020838503121561213557600080fd5b823567ffffffffffffffff81111561214c57600080fd5b61215885828601611ff8565b92509250509250929050565b60006020828403121561217657600080fd5b600061211a8484612045565b6000806040838503121561219557600080fd5b60006121a18585612045565b92505060206121b285828601611fe2565b9150509250929050565b6000806000606084860312156121d157600080fd5b60006121dd8686612045565b93505060206121ee86828701611fe2565b92505060406121ff86828701611fe2565b9150509250925092565b60008060006060848603121561221e57600080fd5b600061222a8686612045565b935050602061223b86828701611fe2565b92505060406121ff8682870161203a565b6000806040838503121561225f57600080fd5b600061226b8585612045565b92505060206121b285828601612045565b60008060006060848603121561229157600080fd5b600061229d8686612045565b93505060206122ae86828701612045565b92505060406121ff86828701612045565b6000806000606084860312156122d457600080fd5b60006122e08686612045565b93505060206122f186828701612045565b92505060406121ff868287016120f1565b6000806040838503121561231557600080fd5b60006123218585612045565b92505060206121b285828601612050565b60008060006060848603121561234757600080fd5b60006123538686612045565b93505060206121ee86828701612050565b60008060006040848603121561237957600080fd5b60006123858686612045565b935050602084013567ffffffffffffffff8111156123a257600080fd5b6123ae8682870161205b565b92509250509250925092565b6000806000806000606086880312156123d257600080fd5b60006123de8888612045565b955050602086013567ffffffffffffffff8111156123fb57600080fd5b6124078882890161205b565b9450945050604086013567ffffffffffffffff81111561242657600080fd5b6124328882890161205b565b92509250509295509295909350565b6000806000806060858703121561245757600080fd5b60006124638787612045565b945050602061247487828801612045565b935050604085013567ffffffffffffffff81111561249157600080fd5b61249d8782880161205b565b95989497509550505050565b6000806000606084860312156124be57600080fd5b60006124ca8686612045565b93505060206124db86828701612045565b925050604084013567ffffffffffffffff8111156124f857600080fd5b6121ff8682870161209d565b60006020828403121561251657600080fd5b600061211a8484612050565b6000610c23838361261a565b612537816128e8565b82525050565b61253781612893565b600061255182612886565b61255b818561288a565b93508360208202850161256d85612880565b8060005b858110156125a7578484038952815161258a8582612522565b945061259583612880565b60209a909a0199925050600101612571565b5091979650505050505050565b6125378161289e565b61253781611fdf565b612537816128a3565b60006125db838561288a565b93506125e88385846128f9565b6125f183612935565b9093019392505050565b60006126078385610419565b93506126148385846128f9565b50500190565b600061262582612886565b61262f818561288a565b935061263f818560208601612905565b6125f181612935565b600061265382612886565b61265d8185610419565b935061266d818560208601612905565b9290920192915050565b6000612684602483610419565b7f696e74657266616365496d706c656d656e74657228627974657333322c62797481527f6573342900000000000000000000000000000000000000000000000000000000602082015260240192915050565b612537816128c8565b600061211a8284866125fb565b6000610c238284612648565b60006109f182612677565b602081016109f1828461253d565b602081016109f1828461252e565b60208082528101610c238184612546565b602081016109f182846125b4565b602081016109f182846125bd565b6040810161275a82856125bd565b610c2360208301846125bd565b602081016109f182846125c6565b6020808252810161211a8184866125cf565b60208082528101610c23818461261a565b604080825281016127a9818561261a565b9050610c2360208301846126d6565b606080825281016127c9818661261a565b90506127d860208301856126d6565b81810360408301526127ea818461261a565b95945050505050565b6040810161280182856125bd565b818103602083015261211a818461261a565b60405181810167ffffffffffffffff8111828210171561283257600080fd5b604052919050565b600067ffffffffffffffff82111561285157600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b90815260200190565b6000610416826128cf565b151590565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b61ffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b600061041682600061041682612893565b82818337506000910152565b60005b83811015612920578181015183820152602001612908565b8381111561292f576000848401525b50505050565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b61296681612893565b811461199757600080fd5b6129668161289e565b61296681611fdf565b612966816128a3565b612966816128c856fea365627a7a7231582082927c55ed80cd2c2b4af3ecca0340c755f0257fadbdd76a4c4b6458f1c8eefc6c6578706572696d656e74616cf564736f6c63430005110040", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101985760003560e01c8063691f3431116100e3578063bc1c58d11161008c578063e59d895d11610066578063e59d895d14610387578063f1cb7e061461039a578063f86bc879146103ad57610198565b8063bc1c58d114610340578063c869023314610353578063d5fa2b001461037457610198565b8063a8fa5682116100bd578063a8fa5682146102fa578063ac9650d81461030d578063ad5780af1461032d57610198565b8063691f3431146102c157806377372213146102d45780638b95dd71146102e757610198565b8063304e6ade116101455780634cbf6ba41161011f5780634cbf6ba41461027b57806359d1d43c1461028e578063623195b0146102ae57610198565b8063304e6ade146102425780633b3b57de146102555780633e9ce7941461026857610198565b8063124a319c11610176578063124a319c146101ee5780632203ab561461020e57806329cd62ea1461022f57610198565b806301ffc9a71461019d5780630af179d7146101c657806310f13a8c146101db575b600080fd5b6101b06101ab366004612504565b6103c0565b6040516101bd9190612730565b60405180910390f35b6101d96101d4366004612364565b61041e565b005b6101d96101e93660046123ba565b61060b565b6102016101fc366004612302565b6106b8565b6040516101bd9190612703565b61022161021c36600461224c565b6109f7565b6040516101bd9291906127f3565b6101d961023d36600461227c565b610b16565b6101d9610250366004612364565b610b96565b610201610263366004612164565b610bf5565b6101d9610276366004612209565b610c2a565b6101b061028936600461224c565b610ccf565b6102a161029c366004612364565b610d01565b6040516101bd9190612787565b6101d96102bc366004612441565b610dc3565b6102a16102cf366004612164565b610e3e565b6101d96102e2366004612364565b610edf565b6101d96102f53660046124a9565b610f3e565b6102a16103083660046122bf565b611003565b61032061031b366004612122565b611090565b6040516101bd919061271f565b6101d961033b366004612164565b6111d4565b6102a161034e366004612164565b611227565b610366610361366004612164565b61128f565b6040516101bd92919061274c565b6101d9610382366004612182565b6112a9565b6101d9610395366004612332565b6112d0565b6102a16103a836600461224c565b61139d565b6101b06103bb3660046121bc565b611446565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f59d1d43c00000000000000000000000000000000000000000000000000000000148061041657506104168261146c565b90505b919050565b82610428816114c2565b61043157600080fd5b60008060608082610440611e30565b61048a60008a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505063ffffffff6115d1169050565b90505b610496816115ec565b6105ae5761ffff86166104ee57806040015195506104b3816115fa565b9350836040516020016104c691906126ec565b6040516020818303038152906040528051906020012091506104e781611621565b92506105a0565b60606104f9826115fa565b9050816040015161ffff168761ffff161415806105235750610521858263ffffffff61164216565b155b1561059e576105778b86898d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505050602087015189518c918290039015611660565b81604001519650816020015195508094508480519060200120925061059b82611621565b93505b505b6105a9816118c7565b61048d565b50825115610600576106008984878b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505088518b9250828f03915015611660565b505050505050505050565b84610615816114c2565b61061e57600080fd5b82826009600089815260200190815260200160002087876040516106439291906126df565b90815260405190819003602001902061065d929091611e7b565b50848460405161066e9291906126df565b6040518091039020867fd8c9334b1a9c2f9da342a0a2b32629c1a229b6445dad78947f674b44444a755087876040516106a8929190612775565b60405180910390a3505050505050565b60008281526006602090815260408083207fffffffff000000000000000000000000000000000000000000000000000000008516845290915281205473ffffffffffffffffffffffffffffffffffffffff1680156107175790506109f1565b600061072285610bf5565b905073ffffffffffffffffffffffffffffffffffffffff811661074a576000925050506109f1565b600060608273ffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b60405160240161077d9190612767565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a700000000000000000000000000000000000000000000000000000000179052516107fe91906126ec565b600060405180830381855afa9150503d8060008114610839576040519150601f19603f3d011682016040523d82523d6000602084013e61083e565b606091505b5091509150811580610851575060208151105b8061088d575080601f8151811061086457fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b1561089f5760009450505050506109f1565b8273ffffffffffffffffffffffffffffffffffffffff16866040516024016108c79190612767565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001790525161094891906126ec565b600060405180830381855afa9150503d8060008114610983576040519150601f19603f3d011682016040523d82523d6000602084013e610988565b606091505b50909250905081158061099c575060208151105b806109d8575080601f815181106109af57fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109ea5760009450505050506109f1565b5090925050505b92915050565b600082815260208190526040812060609060015b848111610af85780851615801590610a4357506000818152602083905260409020546002600019610100600184161502019091160415155b15610af0576000818152602083815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845284939192839190830182828015610ade5780601f10610ab357610100808354040283529160200191610ade565b820191906000526020600020905b815481529060010190602001808311610ac157829003601f168201915b50505050509050935093505050610b0f565b60011b610a0b565b505060408051602081019091526000808252925090505b9250929050565b82610b20816114c2565b610b2957600080fd5b6040805180820182528481526020808201858152600088815260089092529083902091518255516001909101555184907f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4690610b88908690869061274c565b60405180910390a250505050565b82610ba0816114c2565b610ba957600080fd5b6000848152600260205260409020610bc2908484611e7b565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610b88929190612775565b60006060610c0483603c61139d565b9050805160001415610c1a576000915050610419565b610c238161199a565b9392505050565b6000838152600b602090815260408083203380855290835281842073ffffffffffffffffffffffffffffffffffffffff871680865293529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515151790555190919085907fe1c5610a6e0cbe10764ecd182adcef1ec338dc4e199c99c32ce98f38e12791df90610cc2908690612730565b60405180910390a4505050565b600091825260056020908152604080842060038352818520548552825280842092845291905290205461ffff16151590565b6060600960008581526020019081526020016000208383604051610d269291906126df565b9081526040805160209281900383018120805460026001821615610100026000190190911604601f81018590048502830185019093528282529092909190830182828015610db55780601f10610d8a57610100808354040283529160200191610db5565b820191906000526020600020905b815481529060010190602001808311610d9857829003601f168201915b505050505090509392505050565b83610dcd816114c2565b610dd657600080fd5b6000198401841615610de757600080fd5b6000858152602081815260408083208784529091529020610e09908484611e7b565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b60008181526007602090815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610ed35780601f10610ea857610100808354040283529160200191610ed3565b820191906000526020600020905b815481529060010190602001808311610eb657829003601f168201915b50505050509050919050565b82610ee9816114c2565b610ef257600080fd5b6000848152600760205260409020610f0b908484611e7b565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610b88929190612775565b82610f48816114c2565b610f5157600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af7528484604051610f839291906127f3565b60405180910390a2603c831415610fd557837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd2610fbf8461199a565b604051610fcc9190612711565b60405180910390a25b600084815260016020908152604080832086845282529091208351610ffc92850190611f17565b5050505050565b6000838152600460209081526040808320600383528184205484528252808320858452825280832061ffff8516845282529182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610db55780601f10610d8a57610100808354040283529160200191610db5565b6040805182815260208084028201019091526060908280156110c657816020015b60608152602001906001900390816110b15790505b50905060005b828110156111cd5760006060308686858181106110e557fe5b6020028201905080357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe13684900301811261111f57600080fd5b9091016020810191503567ffffffffffffffff81111561113e57600080fd5b3681900382131561114e57600080fd5b60405161115c9291906126df565b600060405180830381855af49150503d8060008114611197576040519150601f19603f3d011682016040523d82523d6000602084013e61119c565b606091505b5091509150816111ab57600080fd5b808484815181106111b857fe5b602090810291909101015250506001016110cc565b5092915050565b806111de816114c2565b6111e757600080fd5b600082815260036020526040808220805460010190555183917fb757169b8492ca2f1c6619d9d76ce22803035c3b1d5f6930dffe7b127c1a198391a25050565b600081815260026020818152604092839020805484516001821615610100026000190190911693909304601f81018390048302840183019094528383526060939091830182828015610ed35780601f10610ea857610100808354040283529160200191610ed3565b600090815260086020526040902080546001909101549091565b816112b3816114c2565b6112bc57600080fd5b6112cb83603c6102f5856119c2565b505050565b826112da816114c2565b6112e357600080fd5b60008481526006602090815260408083207fffffffff00000000000000000000000000000000000000000000000000000000871680855292529182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616179055905185907f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa9061138f908690612703565b60405180910390a350505050565b600082815260016020818152604080842085855282529283902080548451600294821615610100026000190190911693909304601f810183900483028401830190945283835260609390918301828280156114395780601f1061140e57610100808354040283529160200191611439565b820191906000526020600020905b81548152906001019060200180831161141c57829003601f168201915b5050505050905092915050565b600b60209081526000938452604080852082529284528284209052825290205460ff1681565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fc86902330000000000000000000000000000000000000000000000000000000014806104165750610416826119fb565b600a546040517f02571be3000000000000000000000000000000000000000000000000000000008152600091829173ffffffffffffffffffffffffffffffffffffffff909116906302571be39061151d90869060040161273e565b60206040518083038186803b15801561153557600080fd5b505afa158015611549573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061156d91908101906120fc565b905073ffffffffffffffffffffffffffffffffffffffff8116331480610c2357506000838152600b6020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452825280832033845290915290205460ff16915050919050565b6115d9611e30565b82815260c081018290526109f1816118c7565b805151602090910151101590565b60208101518151606091610416916116129082611a51565b8451919063ffffffff611a9816565b60a081015160c082015182516060926104169281900363ffffffff611a9816565b600081518351148015610c235750610c238360008460008751611afa565b600087815260036020908152604090912054875191880191909120606061168e87878763ffffffff611a9816565b905083156117a85760008a81526004602090815260408083208684528252808320858452825280832061ffff8c16845290915290205460026000196101006001841615020190911604156117335760008a81526005602090815260408083208684528252808320858452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000811661ffff918216600019019091161790555b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c168452909152812061176991611f85565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a60405161179b929190612798565b60405180910390a26118bb565b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c168452909152902054600260001961010060018416150201909116046118425760008a815260056020908152604080832086845282528083208584529091529020805461ffff808216600101167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00009091161790555b60008a81526004602090815260408083208684528252808320858452825280832061ffff8c1684528252909120825161187d92840190611f17565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a846040516118b2939291906127b8565b60405180910390a25b50505050505050505050565b60c081015160208201819052815151116118e057611997565b60006118f482600001518360200151611a51565b602083015183519101915061190f908263ffffffff611b1d16565b61ffff166040830152815160029190910190611931908263ffffffff611b1d16565b61ffff166060830152815160029190910190611953908263ffffffff611b3d16565b63ffffffff908116608084015282516004929092019160009161197991908490611b1d16565b600283810160a086015261ffff9190911690920190910160c0830152505b50565b600081516014146119aa57600080fd5b50602001516c01000000000000000000000000900490565b6040805160148082528183019092526060916020820181803883395050506c010000000000000000000000009290920260208301525090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f691f3431000000000000000000000000000000000000000000000000000000001480610416575061041682611b5f565b6000815b83518110611a5f57fe5b6000611a71858363ffffffff611bc416565b60ff1691820160010191905080611a885750611a8e565b50611a55565b9190910392915050565b606083518284011115611aaa57600080fd5b6060826040519080825280601f01601f191660200182016040528015611ad7576020820181803883390190505b50905060208082019086860101611aef828287611be2565b509095945050505050565b6000611b07848484611c3e565b611b12878785611c3e565b149695505050505050565b60008251826002011115611b3057600080fd5b50016002015161ffff1690565b60008251826004011115611b5057600080fd5b50016004015163ffffffff1690565b6000604051611b6d906126f8565b60405180910390207bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610416575061041682611c5a565b6000828281518110611bd257fe5b016020015160f81c905092915050565b5b60208110611c205781518352602092830192909101907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001611be3565b905182516020929092036101000a6000190180199091169116179052565b600083518284011115611c5057600080fd5b5091016020012090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fa8fa568200000000000000000000000000000000000000000000000000000000148061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167fbc1c58d100000000000000000000000000000000000000000000000000000000148061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167f3b3b57de000000000000000000000000000000000000000000000000000000001480611d8f57507fffffffff0000000000000000000000000000000000000000000000000000000082167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061041657506104168260007fffffffff0000000000000000000000000000000000000000000000000000000082167f2203ab5600000000000000000000000000000000000000000000000000000000148061041657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610416565b6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611eda578280017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00823516178555611f07565b82800160010185558215611f07579182015b82811115611f07578235825591602001919060010190611eec565b50611f13929150611fc5565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611f5857805160ff1916838001178555611f07565b82800160010185558215611f07579182015b82811115611f07578251825591602001919060010190611f6a565b50805460018160011615610100020316600290046000825580601f10611fab5750611997565b601f01602090049060005260206000209081019061199791905b611fdf91905b80821115611f135760008155600101611fcb565b90565b80356109f18161295d565b80516109f18161295d565b60008083601f84011261200a57600080fd5b50813567ffffffffffffffff81111561202257600080fd5b602083019150836020820283011115610b0f57600080fd5b80356109f181612971565b80356109f18161297a565b80356109f181612983565b60008083601f84011261206d57600080fd5b50813567ffffffffffffffff81111561208557600080fd5b602083019150836001820283011115610b0f57600080fd5b600082601f8301126120ae57600080fd5b81356120c16120bc8261283a565b612813565b915080825260208301602083018583830111156120dd57600080fd5b6120e88382846128f9565b50505092915050565b80356109f18161298c565b60006020828403121561210e57600080fd5b600061211a8484611fed565b949350505050565b6000806020838503121561213557600080fd5b823567ffffffffffffffff81111561214c57600080fd5b61215885828601611ff8565b92509250509250929050565b60006020828403121561217657600080fd5b600061211a8484612045565b6000806040838503121561219557600080fd5b60006121a18585612045565b92505060206121b285828601611fe2565b9150509250929050565b6000806000606084860312156121d157600080fd5b60006121dd8686612045565b93505060206121ee86828701611fe2565b92505060406121ff86828701611fe2565b9150509250925092565b60008060006060848603121561221e57600080fd5b600061222a8686612045565b935050602061223b86828701611fe2565b92505060406121ff8682870161203a565b6000806040838503121561225f57600080fd5b600061226b8585612045565b92505060206121b285828601612045565b60008060006060848603121561229157600080fd5b600061229d8686612045565b93505060206122ae86828701612045565b92505060406121ff86828701612045565b6000806000606084860312156122d457600080fd5b60006122e08686612045565b93505060206122f186828701612045565b92505060406121ff868287016120f1565b6000806040838503121561231557600080fd5b60006123218585612045565b92505060206121b285828601612050565b60008060006060848603121561234757600080fd5b60006123538686612045565b93505060206121ee86828701612050565b60008060006040848603121561237957600080fd5b60006123858686612045565b935050602084013567ffffffffffffffff8111156123a257600080fd5b6123ae8682870161205b565b92509250509250925092565b6000806000806000606086880312156123d257600080fd5b60006123de8888612045565b955050602086013567ffffffffffffffff8111156123fb57600080fd5b6124078882890161205b565b9450945050604086013567ffffffffffffffff81111561242657600080fd5b6124328882890161205b565b92509250509295509295909350565b6000806000806060858703121561245757600080fd5b60006124638787612045565b945050602061247487828801612045565b935050604085013567ffffffffffffffff81111561249157600080fd5b61249d8782880161205b565b95989497509550505050565b6000806000606084860312156124be57600080fd5b60006124ca8686612045565b93505060206124db86828701612045565b925050604084013567ffffffffffffffff8111156124f857600080fd5b6121ff8682870161209d565b60006020828403121561251657600080fd5b600061211a8484612050565b6000610c23838361261a565b612537816128e8565b82525050565b61253781612893565b600061255182612886565b61255b818561288a565b93508360208202850161256d85612880565b8060005b858110156125a7578484038952815161258a8582612522565b945061259583612880565b60209a909a0199925050600101612571565b5091979650505050505050565b6125378161289e565b61253781611fdf565b612537816128a3565b60006125db838561288a565b93506125e88385846128f9565b6125f183612935565b9093019392505050565b60006126078385610419565b93506126148385846128f9565b50500190565b600061262582612886565b61262f818561288a565b935061263f818560208601612905565b6125f181612935565b600061265382612886565b61265d8185610419565b935061266d818560208601612905565b9290920192915050565b6000612684602483610419565b7f696e74657266616365496d706c656d656e74657228627974657333322c62797481527f6573342900000000000000000000000000000000000000000000000000000000602082015260240192915050565b612537816128c8565b600061211a8284866125fb565b6000610c238284612648565b60006109f182612677565b602081016109f1828461253d565b602081016109f1828461252e565b60208082528101610c238184612546565b602081016109f182846125b4565b602081016109f182846125bd565b6040810161275a82856125bd565b610c2360208301846125bd565b602081016109f182846125c6565b6020808252810161211a8184866125cf565b60208082528101610c23818461261a565b604080825281016127a9818561261a565b9050610c2360208301846126d6565b606080825281016127c9818661261a565b90506127d860208301856126d6565b81810360408301526127ea818461261a565b95945050505050565b6040810161280182856125bd565b818103602083015261211a818461261a565b60405181810167ffffffffffffffff8111828210171561283257600080fd5b604052919050565b600067ffffffffffffffff82111561285157600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b90815260200190565b6000610416826128cf565b151590565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b61ffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b600061041682600061041682612893565b82818337506000910152565b60005b83811015612920578181015183820152602001612908565b8381111561292f576000848401525b50505050565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b61296681612893565b811461199757600080fd5b6129668161289e565b61296681611fdf565b612966816128a3565b612966816128c856fea365627a7a7231582082927c55ed80cd2c2b4af3ecca0340c755f0257fadbdd76a4c4b6458f1c8eefc6c6578706572696d656e74616cf564736f6c63430005110040" +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/NameWrapper.json b/solidity/dns-contracts/deployments/testnet/NameWrapper.json new file mode 100644 index 0000000..9e5b1a3 --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/NameWrapper.json @@ -0,0 +1,2026 @@ +{ + "address": "0x399c16D8156E1145912c106DD811702440242B93", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract IBaseRegistrar", + "name": "_registrar", + "type": "address" + }, + { + "internalType": "contract IMetadataService", + "name": "_metadataService", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "CannotUpgrade", + "type": "error" + }, + { + "inputs": [], + "name": "IncompatibleParent", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "IncorrectTargetOwner", + "type": "error" + }, + { + "inputs": [], + "name": "IncorrectTokenType", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "labelHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "expectedLabelhash", + "type": "bytes32" + } + ], + "name": "LabelMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + } + ], + "name": "LabelTooLong", + "type": "error" + }, + { + "inputs": [], + "name": "LabelTooShort", + "type": "error" + }, + { + "inputs": [], + "name": "NameIsNotWrapped", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "OperationProhibited", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "Unauthorised", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "ControllerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "ExpiryExtended", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + } + ], + "name": "FusesSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NameUnwrapped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "NameWrapped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + } + ], + "name": "TransferBatch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "TransferSingle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "value", + "type": "string" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "URI", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "_tokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint32", + "name": "fuseMask", + "type": "uint32" + } + ], + "name": "allFusesBurned", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "accounts", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + } + ], + "name": "balanceOfBatch", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "canExtendSubnames", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "canModifyName", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "extendExpiry", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "getData", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + } + ], + "name": "isWrapped", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "isWrapped", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "metadataService", + "outputs": [ + { + "internalType": "contract IMetadataService", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "names", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "recoverFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "name": "registerAndWrapETH2LD", + "outputs": [ + { + "internalType": "uint256", + "name": "registrarExpiry", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "registrar", + "outputs": [ + { + "internalType": "contract IBaseRegistrar", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "renew", + "outputs": [ + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeBatchTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setChildFuses", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + } + ], + "name": "setFuses", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IMetadataService", + "name": "_metadataService", + "type": "address" + } + ], + "name": "setMetadataService", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setSubnodeOwner", + "outputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + } + ], + "name": "setTTL", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract INameWrapperUpgrade", + "name": "_upgradeAddress", + "type": "address" + } + ], + "name": "setUpgradeContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "unwrap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "registrant", + "type": "address" + }, + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "unwrapETH2LD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "upgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "upgradeContract", + "outputs": [ + { + "internalType": "contract INameWrapperUpgrade", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "uri", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "wrap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "wrapETH2LD", + "outputs": [ + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x15ed95a01d1edca9d2c7ad295cd98344ffee01a2daf28692f2f741988dbb7a81", + "receipt": { + "to": null, + "from": "0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B", + "contractAddress": "0x399c16D8156E1145912c106DD811702440242B93", + "transactionIndex": 2, + "gasUsed": "5487544", + "logsBloom": "0x00000000000000000000000000000001000000000000000000800000000000000000000000000000000000000000020000000000000010000090000000000000000000000000000000000040008000000001000000000000400000000000000000000000024000000000000000000800000000000000000000000000000000400000000000010000000001000000000000000000000000200000000000000000000000000040000100000030028001000000000000000000008000040004000000000000000000000000000000005000000000010000000000000000000021000000000000000000000000000000000000010000021004000000000000000000", + "blockHash": "0xd0b92d7d2217580c1b2f5de8b2ec096347d00313a814036bb01a6342131d6248", + "transactionHash": "0x15ed95a01d1edca9d2c7ad295cd98344ffee01a2daf28692f2f741988dbb7a81", + "logs": [ + { + "transactionIndex": 2, + "blockNumber": 57535005, + "transactionHash": "0x15ed95a01d1edca9d2c7ad295cd98344ffee01a2daf28692f2f741988dbb7a81", + "address": "0x399c16D8156E1145912c106DD811702440242B93", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000002a0d7311fa7e9ac2890cfd8219b2def0c206e79b" + ], + "data": "0x", + "logIndex": 3, + "blockHash": "0xd0b92d7d2217580c1b2f5de8b2ec096347d00313a814036bb01a6342131d6248" + }, + { + "transactionIndex": 2, + "blockNumber": 57535005, + "transactionHash": "0x15ed95a01d1edca9d2c7ad295cd98344ffee01a2daf28692f2f741988dbb7a81", + "address": "0x2E5ba310fDa0aD5dfA4CC5656FAEDDd4CC4c162b", + "topics": [ + "0x6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e92", + "0x000000000000000000000000399c16d8156e1145912c106dd811702440242b93", + "0x33168db431cea3a99a6697ca027998f9fea517efd902cf8b9f032bfad68fbdbd" + ], + "data": "0x", + "logIndex": 4, + "blockHash": "0xd0b92d7d2217580c1b2f5de8b2ec096347d00313a814036bb01a6342131d6248" + }, + { + "transactionIndex": 2, + "blockNumber": 57535005, + "transactionHash": "0x15ed95a01d1edca9d2c7ad295cd98344ffee01a2daf28692f2f741988dbb7a81", + "address": "0x8390D472587cCAe988dD06Ccd456Ac70CcF39038", + "topics": [ + "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", + "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2", + "0x75e3d8c46d9b94da4272bcb895d3d16bd33cdf33194f2380dfc2ec7680336022" + ], + "data": "0x0000000000000000000000002a0d7311fa7e9ac2890cfd8219b2def0c206e79b", + "logIndex": 5, + "blockHash": "0xd0b92d7d2217580c1b2f5de8b2ec096347d00313a814036bb01a6342131d6248" + } + ], + "blockNumber": 57535005, + "cumulativeGasUsed": "5663694", + "status": 1, + "byzantium": true + }, + "args": [ + "0x8390D472587cCAe988dD06Ccd456Ac70CcF39038", + "0x0393da9525982Be4C8b9812f8D2A877796fCA90b", + "0x96aC152E90C70A2A09D806c8DCE716798BAFa683" + ], + "numDeployments": 1, + "solcInputHash": "c311c3de46948b5831b922985c265742", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"_registrar\",\"type\":\"address\"},{\"internalType\":\"contract IMetadataService\",\"name\":\"_metadataService\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CannotUpgrade\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncompatibleParent\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"IncorrectTargetOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncorrectTokenType\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"labelHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"expectedLabelhash\",\"type\":\"bytes32\"}],\"name\":\"LabelMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"}],\"name\":\"LabelTooLong\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LabelTooShort\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NameIsNotWrapped\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"OperationProhibited\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"Unauthorised\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"}],\"name\":\"ControllerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"ExpiryExtended\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"}],\"name\":\"FusesSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"NameUnwrapped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"NameWrapped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"name\":\"TransferBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"TransferSingle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"URI\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"_tokens\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"fuseMask\",\"type\":\"uint32\"}],\"name\":\"allFusesBurned\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"balanceOfBatch\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"canExtendSubnames\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"canModifyName\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"extendExpiry\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getData\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"}],\"name\":\"isWrapped\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"isWrapped\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"metadataService\",\"outputs\":[{\"internalType\":\"contract IMetadataService\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"names\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"onERC721Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"recoverFunds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"name\":\"registerAndWrapETH2LD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"registrarExpiry\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"registrar\",\"outputs\":[{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"renew\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeBatchTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setChildFuses\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"active\",\"type\":\"bool\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"}],\"name\":\"setFuses\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IMetadataService\",\"name\":\"_metadataService\",\"type\":\"address\"}],\"name\":\"setMetadataService\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"}],\"name\":\"setRecord\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setSubnodeOwner\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setSubnodeRecord\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"}],\"name\":\"setTTL\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract INameWrapperUpgrade\",\"name\":\"_upgradeAddress\",\"type\":\"address\"}],\"name\":\"setUpgradeContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"unwrap\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"labelhash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"registrant\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"unwrapETH2LD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"upgrade\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"upgradeContract\",\"outputs\":[{\"internalType\":\"contract INameWrapperUpgrade\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"wrap\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"ownerControlledFuses\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"wrapETH2LD\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"allFusesBurned(bytes32,uint32)\":{\"params\":{\"fuseMask\":\"The fuses you want to check\",\"node\":\"Namehash of the name\"},\"returns\":{\"_0\":\"Boolean of whether or not all the selected fuses are burned\"}},\"approve(address,uint256)\":{\"params\":{\"to\":\"address to approve\",\"tokenId\":\"name to approve\"}},\"balanceOf(address,uint256)\":{\"details\":\"See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address.\"},\"balanceOfBatch(address[],uint256[])\":{\"details\":\"See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length.\"},\"canExtendSubnames(bytes32,address)\":{\"params\":{\"addr\":\"which address to check permissions for\",\"node\":\"namehash of the name to check\"},\"returns\":{\"_0\":\"whether or not is owner/operator or approved\"}},\"canModifyName(bytes32,address)\":{\"params\":{\"addr\":\"which address to check permissions for\",\"node\":\"namehash of the name to check\"},\"returns\":{\"_0\":\"whether or not is owner or operator\"}},\"extendExpiry(bytes32,bytes32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"labelhash\":\"Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\",\"parentNode\":\"Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\"},\"returns\":{\"_0\":\"New expiry\"}},\"getApproved(uint256)\":{\"params\":{\"id\":\"Namehash of the name\"},\"returns\":{\"operator\":\"Approved operator of a name\"}},\"getData(uint256)\":{\"params\":{\"id\":\"Namehash of the name\"},\"returns\":{\"expiry\":\"Expiry of the name\",\"fuses\":\"Fuses of the name\",\"owner\":\"Owner of the name\"}},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC1155-isApprovedForAll}.\"},\"isWrapped(bytes32)\":{\"params\":{\"node\":\"Namehash of the name\"},\"returns\":{\"_0\":\"Boolean of whether or not the name is wrapped\"}},\"isWrapped(bytes32,bytes32)\":{\"params\":{\"labelhash\":\"Namehash of the name\",\"parentNode\":\"Namehash of the name\"},\"returns\":{\"_0\":\"Boolean of whether or not the name is wrapped\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"ownerOf(uint256)\":{\"params\":{\"id\":\"Label as a string of the .eth domain to wrap\"},\"returns\":{\"owner\":\"The owner of the name\"}},\"recoverFunds(address,address,uint256)\":{\"details\":\"The contract is Ownable and only the owner can call the recover function.\",\"params\":{\"_amount\":\"The amount of tokens to recover.\",\"_to\":\"The address to send the tokens to.\",\"_token\":\"The address of the ERC20 token to recover\"}},\"registerAndWrapETH2LD(string,address,uint256,address,uint16)\":{\"details\":\"Registers a new .eth second-level domain and wraps it. Only callable by authorised controllers.\",\"params\":{\"duration\":\"The duration, in seconds, to register the name for.\",\"label\":\"The label to register (Eg, 'foo' for 'foo.eth').\",\"ownerControlledFuses\":\"Initial owner-controlled fuses to set\",\"resolver\":\"The resolver address to set on the ENS registry (optional).\",\"wrappedOwner\":\"The owner of the wrapped name.\"},\"returns\":{\"registrarExpiry\":\"The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\"}},\"renew(uint256,uint256)\":{\"details\":\"Only callable by authorised controllers.\",\"params\":{\"duration\":\"The number of seconds to renew the name for.\",\"tokenId\":\"The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\"},\"returns\":{\"expires\":\"The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)\":{\"details\":\"See {IERC1155-safeBatchTransferFrom}.\"},\"safeTransferFrom(address,address,uint256,uint256,bytes)\":{\"details\":\"See {IERC1155-safeTransferFrom}.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC1155-setApprovalForAll}.\"},\"setChildFuses(bytes32,bytes32,uint32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"fuses\":\"Fuses to burn\",\"labelhash\":\"Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\",\"parentNode\":\"Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\"}},\"setFuses(bytes32,uint16)\":{\"params\":{\"node\":\"Namehash of the name\",\"ownerControlledFuses\":\"Owner-controlled fuses to burn\"},\"returns\":{\"_0\":\"Old fuses\"}},\"setMetadataService(address)\":{\"params\":{\"_metadataService\":\"The new metadata service\"}},\"setRecord(bytes32,address,address,uint64)\":{\"params\":{\"node\":\"Namehash of the name to set a record for\",\"owner\":\"New owner in the registry\",\"resolver\":\"Resolver contract\",\"ttl\":\"Time to live in the registry\"}},\"setResolver(bytes32,address)\":{\"params\":{\"node\":\"namehash of the name\",\"resolver\":\"the resolver contract\"}},\"setSubnodeOwner(bytes32,string,address,uint32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"fuses\":\"Initial fuses for the wrapped subdomain\",\"label\":\"Label of the subdomain as a string\",\"owner\":\"New owner in the wrapper\",\"parentNode\":\"Parent namehash of the subdomain\"},\"returns\":{\"node\":\"Namehash of the subdomain\"}},\"setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)\":{\"params\":{\"expiry\":\"When the name will expire in seconds since the Unix epoch\",\"fuses\":\"initial fuses for the wrapped subdomain\",\"label\":\"label of the subdomain as a string\",\"owner\":\"new owner in the wrapper\",\"parentNode\":\"parent namehash of the subdomain\",\"resolver\":\"resolver contract in the registry\",\"ttl\":\"ttl in the registry\"},\"returns\":{\"node\":\"Namehash of the subdomain\"}},\"setTTL(bytes32,uint64)\":{\"params\":{\"node\":\"Namehash of the name\",\"ttl\":\"TTL in the registry\"}},\"setUpgradeContract(address)\":{\"details\":\"The default value of upgradeContract is the 0 address. Use the 0 address at any time to make the contract not upgradable.\",\"params\":{\"_upgradeAddress\":\"address of an upgraded contract\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"unwrap(bytes32,bytes32,address)\":{\"details\":\"Can be called by the owner in the wrapper or an authorised caller in the wrapper\",\"params\":{\"controller\":\"Sets the owner in the registry to this address\",\"labelhash\":\"Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\",\"parentNode\":\"Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\"}},\"unwrapETH2LD(bytes32,address,address)\":{\"details\":\"Can be called by the owner in the wrapper or an authorised caller in the wrapper\",\"params\":{\"controller\":\"Sets the owner in the registry to this address\",\"labelhash\":\"Labelhash of the .eth domain\",\"registrant\":\"Sets the owner in the .eth registrar to this address\"}},\"upgrade(bytes,bytes)\":{\"details\":\"Can be called by the owner or an authorised caller\",\"params\":{\"extraData\":\"Extra data to pass to the upgrade contract\",\"name\":\"The name to upgrade, in DNS format\"}},\"uri(uint256)\":{\"params\":{\"tokenId\":\"The id of the token\"},\"returns\":{\"_0\":\"string uri of the metadata service\"}},\"wrap(bytes,address,address)\":{\"details\":\"Can be called by the owner in the registry or an authorised caller in the registry\",\"params\":{\"name\":\"The name to wrap, in DNS format\",\"resolver\":\"Resolver contract\",\"wrappedOwner\":\"Owner of the name in this contract\"}},\"wrapETH2LD(string,address,uint16,address)\":{\"details\":\"Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\",\"params\":{\"label\":\"Label as a string of the .eth domain to wrap\",\"ownerControlledFuses\":\"Initial owner-controlled fuses to set\",\"resolver\":\"Resolver contract address\",\"wrappedOwner\":\"Owner of the name in this contract\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"allFusesBurned(bytes32,uint32)\":{\"notice\":\"Checks all Fuses in the mask are burned for the node\"},\"approve(address,uint256)\":{\"notice\":\"Approves an address for a name\"},\"canExtendSubnames(bytes32,address)\":{\"notice\":\"Checks if owner/operator or approved by owner\"},\"canModifyName(bytes32,address)\":{\"notice\":\"Checks if owner or operator of the owner\"},\"extendExpiry(bytes32,bytes32,uint64)\":{\"notice\":\"Extends expiry for a name\"},\"getApproved(uint256)\":{\"notice\":\"Gets the owner of a name\"},\"getData(uint256)\":{\"notice\":\"Gets the data for a name\"},\"isWrapped(bytes32)\":{\"notice\":\"Checks if a name is wrapped\"},\"isWrapped(bytes32,bytes32)\":{\"notice\":\"Checks if a name is wrapped in a more gas efficient way\"},\"ownerOf(uint256)\":{\"notice\":\"Gets the owner of a name\"},\"recoverFunds(address,address,uint256)\":{\"notice\":\"Recover ERC20 tokens sent to the contract by mistake.\"},\"renew(uint256,uint256)\":{\"notice\":\"Renews a .eth second-level domain.\"},\"setChildFuses(bytes32,bytes32,uint32,uint64)\":{\"notice\":\"Sets fuses of a name that you own the parent of\"},\"setFuses(bytes32,uint16)\":{\"notice\":\"Sets fuses of a name\"},\"setMetadataService(address)\":{\"notice\":\"Set the metadata service. Only the owner can do this\"},\"setRecord(bytes32,address,address,uint64)\":{\"notice\":\"Sets records for the name in the ENS Registry\"},\"setResolver(bytes32,address)\":{\"notice\":\"Sets resolver contract in the registry\"},\"setSubnodeOwner(bytes32,string,address,uint32,uint64)\":{\"notice\":\"Sets the subdomain owner in the registry and then wraps the subdomain\"},\"setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)\":{\"notice\":\"Sets the subdomain owner in the registry with records and then wraps the subdomain\"},\"setTTL(bytes32,uint64)\":{\"notice\":\"Sets TTL in the registry\"},\"setUpgradeContract(address)\":{\"notice\":\"Set the address of the upgradeContract of the contract. only admin can do this\"},\"unwrap(bytes32,bytes32,address)\":{\"notice\":\"Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\"},\"unwrapETH2LD(bytes32,address,address)\":{\"notice\":\"Unwraps a .eth domain. e.g. vitalik.eth\"},\"upgrade(bytes,bytes)\":{\"notice\":\"Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\"},\"uri(uint256)\":{\"notice\":\"Get the metadata uri\"},\"wrap(bytes,address,address)\":{\"notice\":\"Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\"},\"wrapETH2LD(string,address,uint16,address)\":{\"notice\":\"Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/wrapper/NameWrapper.sol\":\"NameWrapper\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\ninterface IERC1155Receiver is IERC165 {\\n /**\\n * @dev Handles the receipt of a single ERC1155 token type. This function is\\n * called at the end of a `safeTransferFrom` after the balance has been updated.\\n *\\n * NOTE: To accept the transfer, this must return\\n * `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))`\\n * (i.e. 0xf23a6e61, or its own function selector).\\n *\\n * @param operator The address which initiated the transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param id The ID of the token being transferred\\n * @param value The amount of tokens being transferred\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155Received(\\n address operator,\\n address from,\\n uint256 id,\\n uint256 value,\\n bytes calldata data\\n ) external returns (bytes4);\\n\\n /**\\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\\n * is called at the end of a `safeBatchTransferFrom` after the balances have\\n * been updated.\\n *\\n * NOTE: To accept the transfer(s), this must return\\n * `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))`\\n * (i.e. 0xbc197c81, or its own function selector).\\n *\\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xeb373f1fdc7b755c6a750123a9b9e3a8a02c1470042fd6505d875000a80bde0b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC1155.sol\\\";\\n\\n/**\\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155MetadataURI is IERC1155 {\\n /**\\n * @dev Returns the URI for token type `id`.\\n *\\n * If the `\\\\{id\\\\}` substring is present in the URI, it must be replaced by\\n * clients with the actual token type ID.\\n */\\n function uri(uint256 id) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xa66d18b9a85458d28fc3304717964502ae36f7f8a2ff35bc83f6f85d74b03574\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/registry/ENS.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x8e208b44d5dbf22552fe72d79b45c640855b84fbc9ee21f4c3bb4bfe81cbe8db\",\"license\":\"MIT\"},\"contracts/resolvers/Resolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"./profiles/IABIResolver.sol\\\";\\nimport \\\"./profiles/IAddressResolver.sol\\\";\\nimport \\\"./profiles/IAddrResolver.sol\\\";\\nimport \\\"./profiles/IContentHashResolver.sol\\\";\\nimport \\\"./profiles/IDNSRecordResolver.sol\\\";\\nimport \\\"./profiles/IDNSZoneResolver.sol\\\";\\nimport \\\"./profiles/IInterfaceResolver.sol\\\";\\nimport \\\"./profiles/INameResolver.sol\\\";\\nimport \\\"./profiles/IPubkeyResolver.sol\\\";\\nimport \\\"./profiles/ITextResolver.sol\\\";\\nimport \\\"./profiles/IExtendedResolver.sol\\\";\\n\\n/**\\n * A generic resolver interface which includes all the functions including the ones deprecated\\n */\\ninterface Resolver is\\n IERC165,\\n IABIResolver,\\n IAddressResolver,\\n IAddrResolver,\\n IContentHashResolver,\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n IInterfaceResolver,\\n INameResolver,\\n IPubkeyResolver,\\n ITextResolver,\\n IExtendedResolver\\n{\\n /* Deprecated events */\\n event ContentChanged(bytes32 indexed node, bytes32 hash);\\n\\n function setApprovalForAll(address, bool) external;\\n\\n function approve(bytes32 node, address delegate, bool approved) external;\\n\\n function isApprovedForAll(address account, address operator) external;\\n\\n function isApprovedFor(\\n address owner,\\n bytes32 node,\\n address delegate\\n ) external;\\n\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external;\\n\\n function setAddr(bytes32 node, address addr) external;\\n\\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\\n\\n function setContenthash(bytes32 node, bytes calldata hash) external;\\n\\n function setDnsrr(bytes32 node, bytes calldata data) external;\\n\\n function setName(bytes32 node, string calldata _name) external;\\n\\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\\n\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external;\\n\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external;\\n\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n /* Deprecated functions */\\n function content(bytes32 node) external view returns (bytes32);\\n\\n function multihash(bytes32 node) external view returns (bytes memory);\\n\\n function setContent(bytes32 node, bytes32 hash) external;\\n\\n function setMultihash(bytes32 node, bytes calldata hash) external;\\n}\\n\",\"keccak256\":\"0xfc77ab6b7c59c3ebfe1c720bdebf9b08c2488ff7ac9501a9aa056c5d6d5b50c5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseClaimer.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\n\\ncontract ReverseClaimer {\\n bytes32 constant ADDR_REVERSE_NODE =\\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n constructor(ENS ens, address claimant) {\\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\\n ens.owner(ADDR_REVERSE_NODE)\\n );\\n reverseRegistrar.claim(claimant);\\n }\\n}\\n\",\"keccak256\":\"0x78a28627241535b595f6fff476a1fa7acc90c80684fe7784734920fc8af6fc22\",\"license\":\"MIT\"},\"contracts/utils/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes32) {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0xc566a3569af880a096a9bfb2fbb77060ef7aecde1a205dc26446a58877412060\",\"license\":\"MIT\"},\"contracts/utils/ERC20Recoverable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\\n */\\n\\ncontract ERC20Recoverable is Ownable {\\n /**\\n @notice Recover ERC20 tokens sent to the contract by mistake.\\n @dev The contract is Ownable and only the owner can call the recover function.\\n @param _to The address to send the tokens to.\\n@param _token The address of the ERC20 token to recover\\n @param _amount The amount of tokens to recover.\\n */\\n function recoverFunds(\\n address _token,\\n address _to,\\n uint256 _amount\\n ) external onlyOwner {\\n IERC20(_token).transfer(_to, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x793a38091e1f81499a29ddba82c2b2f3cdd07071b81a832886e8e02a45ff352a\",\"license\":\"MIT\"},\"contracts/wrapper/Controllable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool active);\\n\\n function setController(address controller, bool active) public onlyOwner {\\n controllers[controller] = active;\\n emit ControllerChanged(controller, active);\\n }\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x9a9191656a82eda6763cda29ce893ddbfddb6c43559ff3b90c00a184e14e1fa1\",\"license\":\"MIT\"},\"contracts/wrapper/ERC1155Fuse.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\\n\\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\\n using Address for address;\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(\\n address indexed owner,\\n address indexed approved,\\n uint256 indexed tokenId\\n );\\n mapping(uint256 => uint256) public _tokens;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) internal _tokenApprovals;\\n\\n /**************************************************************************\\n * ERC721 methods\\n *************************************************************************/\\n\\n function ownerOf(uint256 id) public view virtual returns (address) {\\n (address owner, , ) = getData(id);\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual {\\n address owner = ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(\\n uint256 tokenId\\n ) public view virtual returns (address) {\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IERC1155).interfaceId ||\\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(\\n address account,\\n uint256 id\\n ) public view virtual override returns (uint256) {\\n require(\\n account != address(0),\\n \\\"ERC1155: balance query for the zero address\\\"\\n );\\n address owner = ownerOf(id);\\n if (owner == account) {\\n return 1;\\n }\\n return 0;\\n }\\n\\n /**\\n * @dev See {IERC1155-balanceOfBatch}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] memory accounts,\\n uint256[] memory ids\\n ) public view virtual override returns (uint256[] memory) {\\n require(\\n accounts.length == ids.length,\\n \\\"ERC1155: accounts and ids length mismatch\\\"\\n );\\n\\n uint256[] memory batchBalances = new uint256[](accounts.length);\\n\\n for (uint256 i = 0; i < accounts.length; ++i) {\\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\\n }\\n\\n return batchBalances;\\n }\\n\\n /**\\n * @dev See {IERC1155-setApprovalForAll}.\\n */\\n function setApprovalForAll(\\n address operator,\\n bool approved\\n ) public virtual override {\\n require(\\n msg.sender != operator,\\n \\\"ERC1155: setting approval status for self\\\"\\n );\\n\\n _operatorApprovals[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC1155-isApprovedForAll}.\\n */\\n function isApprovedForAll(\\n address account,\\n address operator\\n ) public view virtual override returns (bool) {\\n return _operatorApprovals[account][operator];\\n }\\n\\n /**\\n * @dev Returns the Name's owner address and fuses\\n */\\n function getData(\\n uint256 tokenId\\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\\n uint256 t = _tokens[tokenId];\\n owner = address(uint160(t));\\n expiry = uint64(t >> 192);\\n fuses = uint32(t >> 160);\\n }\\n\\n /**\\n * @dev See {IERC1155-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) public virtual override {\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n require(\\n from == msg.sender || isApprovedForAll(from, msg.sender),\\n \\\"ERC1155: caller is not owner nor approved\\\"\\n );\\n\\n _transfer(from, to, id, amount, data);\\n }\\n\\n /**\\n * @dev See {IERC1155-safeBatchTransferFrom}.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) public virtual override {\\n require(\\n ids.length == amounts.length,\\n \\\"ERC1155: ids and amounts length mismatch\\\"\\n );\\n require(to != address(0), \\\"ERC1155: transfer to the zero address\\\");\\n require(\\n from == msg.sender || isApprovedForAll(from, msg.sender),\\n \\\"ERC1155: transfer caller is not owner nor approved\\\"\\n );\\n\\n for (uint256 i = 0; i < ids.length; ++i) {\\n uint256 id = ids[i];\\n uint256 amount = amounts[i];\\n\\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\\n\\n _beforeTransfer(id, fuses, expiry);\\n\\n require(\\n amount == 1 && oldOwner == from,\\n \\\"ERC1155: insufficient balance for transfer\\\"\\n );\\n _setData(id, to, fuses, expiry);\\n }\\n\\n emit TransferBatch(msg.sender, from, to, ids, amounts);\\n\\n _doSafeBatchTransferAcceptanceCheck(\\n msg.sender,\\n from,\\n to,\\n ids,\\n amounts,\\n data\\n );\\n }\\n\\n /**************************************************************************\\n * Internal/private methods\\n *************************************************************************/\\n\\n /**\\n * @dev Sets the Name's owner address and fuses\\n */\\n function _setData(\\n uint256 tokenId,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual {\\n _tokens[tokenId] =\\n uint256(uint160(owner)) |\\n (uint256(fuses) << 160) |\\n (uint256(expiry) << 192);\\n }\\n\\n function _beforeTransfer(\\n uint256 id,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual;\\n\\n function _clearOwnerAndFuses(\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual returns (address, uint32);\\n\\n function _mint(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal virtual {\\n uint256 tokenId = uint256(node);\\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n\\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\\n oldFuses;\\n\\n if (oldExpiry > expiry) {\\n expiry = oldExpiry;\\n }\\n\\n if (oldExpiry >= block.timestamp) {\\n fuses = fuses | parentControlledFuses;\\n }\\n\\n require(oldOwner == address(0), \\\"ERC1155: mint of existing token\\\");\\n require(owner != address(0), \\\"ERC1155: mint to the zero address\\\");\\n require(\\n owner != address(this),\\n \\\"ERC1155: newOwner cannot be the NameWrapper contract\\\"\\n );\\n\\n _setData(tokenId, owner, fuses, expiry);\\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\\n _doSafeTransferAcceptanceCheck(\\n msg.sender,\\n address(0),\\n owner,\\n tokenId,\\n 1,\\n \\\"\\\"\\n );\\n }\\n\\n function _burn(uint256 tokenId) internal virtual {\\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\\n tokenId\\n );\\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n // Fuses and expiry are kept on burn\\n _setData(tokenId, address(0x0), fuses, expiry);\\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\\n }\\n\\n function _transfer(\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) internal {\\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\\n\\n _beforeTransfer(id, fuses, expiry);\\n\\n require(\\n amount == 1 && oldOwner == from,\\n \\\"ERC1155: insufficient balance for transfer\\\"\\n );\\n\\n if (oldOwner == to) {\\n return;\\n }\\n\\n _setData(id, to, fuses, expiry);\\n\\n emit TransferSingle(msg.sender, from, to, id, amount);\\n\\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\\n }\\n\\n function _doSafeTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256 id,\\n uint256 amount,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try\\n IERC1155Receiver(to).onERC1155Received(\\n operator,\\n from,\\n id,\\n amount,\\n data\\n )\\n returns (bytes4 response) {\\n if (\\n response != IERC1155Receiver(to).onERC1155Received.selector\\n ) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n function _doSafeBatchTransferAcceptanceCheck(\\n address operator,\\n address from,\\n address to,\\n uint256[] memory ids,\\n uint256[] memory amounts,\\n bytes memory data\\n ) private {\\n if (to.isContract()) {\\n try\\n IERC1155Receiver(to).onERC1155BatchReceived(\\n operator,\\n from,\\n ids,\\n amounts,\\n data\\n )\\n returns (bytes4 response) {\\n if (\\n response !=\\n IERC1155Receiver(to).onERC1155BatchReceived.selector\\n ) {\\n revert(\\\"ERC1155: ERC1155Receiver rejected tokens\\\");\\n }\\n } catch Error(string memory reason) {\\n revert(reason);\\n } catch {\\n revert(\\\"ERC1155: transfer to non ERC1155Receiver implementer\\\");\\n }\\n }\\n }\\n\\n /* ERC721 internal functions */\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ownerOf(tokenId), to, tokenId);\\n }\\n}\\n\",\"keccak256\":\"0xfbbd36e7f5df0fe7a8e9199783af99ac61ab24122e4a9fdb072bbd4cd676a88b\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_CRE8OR = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x18a49abb805da867f3a6f49e1b898ba5b6afe5ae3a4b8f90152c0687ccc68048\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"},\"contracts/wrapper/NameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \\\"./ERC1155Fuse.sol\\\";\\nimport {Controllable} from \\\"./Controllable.sol\\\";\\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_CRE8OR, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \\\"./INameWrapper.sol\\\";\\nimport {INameWrapperUpgrade} from \\\"./INameWrapperUpgrade.sol\\\";\\nimport {IMetadataService} from \\\"./IMetadataService.sol\\\";\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {Resolver} from \\\"../resolvers/Resolver.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\nimport {ReverseClaimer} from \\\"../reverseRegistrar/ReverseClaimer.sol\\\";\\nimport {IBaseRegistrar} from \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport {IERC721Receiver} from \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {BytesUtils} from \\\"../utils/BytesUtils.sol\\\";\\nimport {ERC20Recoverable} from \\\"../utils/ERC20Recoverable.sol\\\";\\n\\nerror Unauthorised(bytes32 node, address addr);\\nerror IncompatibleParent();\\nerror IncorrectTokenType();\\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\\nerror LabelTooShort();\\nerror LabelTooLong(string label);\\nerror IncorrectTargetOwner(address owner);\\nerror CannotUpgrade();\\nerror OperationProhibited(bytes32 node);\\nerror NameIsNotWrapped();\\nerror NameIsStillExpired();\\n\\ncontract NameWrapper is\\n Ownable,\\n ERC1155Fuse,\\n INameWrapper,\\n Controllable,\\n IERC721Receiver,\\n ERC20Recoverable,\\n ReverseClaimer\\n{\\n using BytesUtils for bytes;\\n\\n ENS public immutable ens;\\n IBaseRegistrar public immutable registrar;\\n IMetadataService public metadataService;\\n mapping(bytes32 => bytes) public names;\\n string public constant name = \\\"NameWrapper\\\";\\n\\n uint64 private constant GRACE_PERIOD = 90 days;\\n bytes32 private constant CRE8OR_NODE =\\n 0x4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454;\\n\\n bytes32 private constant CRE8OR_LABELHASH =\\n 0x0d1f301a4d55e328cfe2f78743e489a98cedaf66d744b3ab1bb877ff82930b0b;\\n bytes32 private constant ROOT_NODE =\\n 0x0000000000000000000000000000000000000000000000000000000000000000;\\n\\n INameWrapperUpgrade public upgradeContract;\\n uint64 private constant MAX_EXPIRY = type(uint64).max;\\n\\n constructor(\\n ENS _ens,\\n IBaseRegistrar _registrar,\\n IMetadataService _metadataService\\n ) ReverseClaimer(_ens, msg.sender) {\\n ens = _ens;\\n registrar = _registrar;\\n metadataService = _metadataService;\\n\\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and CRE8OR_NODE and set expiry to max */\\n\\n _setData(\\n uint256(CRE8OR_NODE),\\n address(0),\\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\\n MAX_EXPIRY\\n );\\n _setData(\\n uint256(ROOT_NODE),\\n address(0),\\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\\n MAX_EXPIRY\\n );\\n names[ROOT_NODE] = \\\"\\\\x00\\\";\\n names[CRE8OR_NODE] = \\\"\\\\x06cre8or\\\\x00\\\";\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceId\\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\\n return\\n interfaceId == type(INameWrapper).interfaceId ||\\n interfaceId == type(IERC721Receiver).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /* ERC1155 Fuse */\\n\\n /// @notice Gets the owner of a name\\n /// @param id Label as a string of the .eth domain to wrap\\n /// @return owner The owner of the name\\n function ownerOf(\\n uint256 id\\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\\n return super.ownerOf(id);\\n }\\n\\n /// @notice Gets the owner of a name\\n /// @param id Namehash of the name\\n /// @return operator Approved operator of a name\\n function getApproved(\\n uint256 id\\n )\\n public\\n view\\n override(ERC1155Fuse, INameWrapper)\\n returns (address operator)\\n {\\n address owner = ownerOf(id);\\n if (owner == address(0)) {\\n return address(0);\\n }\\n return super.getApproved(id);\\n }\\n\\n /// @notice Approves an address for a name\\n /// @param to address to approve\\n /// @param tokenId name to approve\\n function approve(\\n address to,\\n uint256 tokenId\\n ) public override(ERC1155Fuse, INameWrapper) {\\n (, uint32 fuses, ) = getData(tokenId);\\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\\n revert OperationProhibited(bytes32(tokenId));\\n }\\n super.approve(to, tokenId);\\n }\\n\\n /// @notice Gets the data for a name\\n /// @param id Namehash of the name\\n /// @return owner Owner of the name\\n /// @return fuses Fuses of the name\\n /// @return expiry Expiry of the name\\n function getData(\\n uint256 id\\n )\\n public\\n view\\n override(ERC1155Fuse, INameWrapper)\\n returns (address owner, uint32 fuses, uint64 expiry)\\n {\\n (owner, fuses, expiry) = super.getData(id);\\n\\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\\n }\\n\\n /* Metadata service */\\n\\n /// @notice Set the metadata service. Only the owner can do this\\n /// @param _metadataService The new metadata service\\n function setMetadataService(\\n IMetadataService _metadataService\\n ) public onlyOwner {\\n metadataService = _metadataService;\\n }\\n\\n /// @notice Get the metadata uri\\n /// @param tokenId The id of the token\\n /// @return string uri of the metadata service\\n function uri(\\n uint256 tokenId\\n )\\n public\\n view\\n override(INameWrapper, IERC1155MetadataURI)\\n returns (string memory)\\n {\\n return metadataService.uri(tokenId);\\n }\\n\\n /// @notice Set the address of the upgradeContract of the contract. only admin can do this\\n /// @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\\n /// to make the contract not upgradable.\\n /// @param _upgradeAddress address of an upgraded contract\\n function setUpgradeContract(\\n INameWrapperUpgrade _upgradeAddress\\n ) public onlyOwner {\\n if (address(upgradeContract) != address(0)) {\\n registrar.setApprovalForAll(address(upgradeContract), false);\\n ens.setApprovalForAll(address(upgradeContract), false);\\n }\\n\\n upgradeContract = _upgradeAddress;\\n\\n if (address(upgradeContract) != address(0)) {\\n registrar.setApprovalForAll(address(upgradeContract), true);\\n ens.setApprovalForAll(address(upgradeContract), true);\\n }\\n }\\n\\n /// @notice Checks if msg.sender is the owner or operator of the owner of a name\\n /// @param node namehash of the name to check\\n modifier onlyTokenOwner(bytes32 node) {\\n if (!canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n _;\\n }\\n\\n /// @notice Checks if owner or operator of the owner\\n /// @param node namehash of the name to check\\n /// @param addr which address to check permissions for\\n /// @return whether or not is owner or operator\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) public view returns (bool) {\\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\\n return\\n (owner == addr || isApprovedForAll(owner, addr)) &&\\n !_isETH2LDInGracePeriod(fuses, expiry);\\n }\\n\\n /// @notice Checks if owner/operator or approved by owner\\n /// @param node namehash of the name to check\\n /// @param addr which address to check permissions for\\n /// @return whether or not is owner/operator or approved\\n function canExtendSubnames(\\n bytes32 node,\\n address addr\\n ) public view returns (bool) {\\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\\n return\\n (owner == addr ||\\n isApprovedForAll(owner, addr) ||\\n getApproved(uint256(node)) == addr) &&\\n !_isETH2LDInGracePeriod(fuses, expiry);\\n }\\n\\n /// @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\\n /// @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\\n /// @param label Label as a string of the .eth domain to wrap\\n /// @param wrappedOwner Owner of the name in this contract\\n /// @param ownerControlledFuses Initial owner-controlled fuses to set\\n /// @param resolver Resolver contract address\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) public returns (uint64 expiry) {\\n uint256 tokenId = uint256(keccak256(bytes(label)));\\n address registrant = registrar.ownerOf(tokenId);\\n if (\\n registrant != msg.sender &&\\n !registrar.isApprovedForAll(registrant, msg.sender)\\n ) {\\n revert Unauthorised(\\n _makeNode(CRE8OR_NODE, bytes32(tokenId)),\\n msg.sender\\n );\\n }\\n\\n // transfer the token from the user to this contract\\n registrar.transferFrom(registrant, address(this), tokenId);\\n\\n // transfer the ens record back to the new owner (this contract)\\n registrar.reclaim(tokenId, address(this));\\n\\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\\n\\n _wrapETH2LD(\\n label,\\n wrappedOwner,\\n ownerControlledFuses,\\n expiry,\\n resolver\\n );\\n }\\n\\n /// @dev Registers a new .eth second-level domain and wraps it.\\n /// Only callable by authorised controllers.\\n /// @param label The label to register (Eg, 'foo' for 'foo.eth').\\n /// @param wrappedOwner The owner of the wrapped name.\\n /// @param duration The duration, in seconds, to register the name for.\\n /// @param resolver The resolver address to set on the ENS registry (optional).\\n /// @param ownerControlledFuses Initial owner-controlled fuses to set\\n /// @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external onlyController returns (uint256 registrarExpiry) {\\n uint256 tokenId = uint256(keccak256(bytes(label)));\\n registrarExpiry = registrar.register(tokenId, address(this), duration);\\n _wrapETH2LD(\\n label,\\n wrappedOwner,\\n ownerControlledFuses,\\n uint64(registrarExpiry) + GRACE_PERIOD,\\n resolver\\n );\\n }\\n\\n /// @notice Renews a .eth second-level domain.\\n /// @dev Only callable by authorised controllers.\\n /// @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\\n /// @param duration The number of seconds to renew the name for.\\n /// @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\\n function renew(\\n uint256 tokenId,\\n uint256 duration\\n ) external onlyController returns (uint256 expires) {\\n bytes32 node = _makeNode(CRE8OR_NODE, bytes32(tokenId));\\n\\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\\n\\n // Do not set anything in wrapper if name is not wrapped\\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\\n if (\\n registrarOwner != address(this) ||\\n ens.owner(node) != address(this)\\n ) {\\n return registrarExpiry;\\n }\\n } catch {\\n return registrarExpiry;\\n }\\n\\n // Set expiry in Wrapper\\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\\n\\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\\n _setData(node, owner, fuses, expiry);\\n\\n return registrarExpiry;\\n }\\n\\n /// @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\\n /// @dev Can be called by the owner in the registry or an authorised caller in the registry\\n /// @param name The name to wrap, in DNS format\\n /// @param wrappedOwner Owner of the name in this contract\\n /// @param resolver Resolver contract\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) public {\\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\\n bytes32 parentNode = name.namehash(offset);\\n bytes32 node = _makeNode(parentNode, labelhash);\\n\\n names[node] = name;\\n\\n if (parentNode == CRE8OR_NODE) {\\n revert IncompatibleParent();\\n }\\n\\n address owner = ens.owner(node);\\n\\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n if (resolver != address(0)) {\\n ens.setResolver(node, resolver);\\n }\\n\\n ens.setOwner(node, address(this));\\n\\n _wrap(node, name, wrappedOwner, 0, 0);\\n }\\n\\n /// @notice Unwraps a .eth domain. e.g. vitalik.eth\\n /// @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\\n /// @param labelhash Labelhash of the .eth domain\\n /// @param registrant Sets the owner in the .eth registrar to this address\\n /// @param controller Sets the owner in the registry to this address\\n function unwrapETH2LD(\\n bytes32 labelhash,\\n address registrant,\\n address controller\\n ) public onlyTokenOwner(_makeNode(CRE8OR_NODE, labelhash)) {\\n if (registrant == address(this)) {\\n revert IncorrectTargetOwner(registrant);\\n }\\n _unwrap(_makeNode(CRE8OR_NODE, labelhash), controller);\\n registrar.safeTransferFrom(\\n address(this),\\n registrant,\\n uint256(labelhash)\\n );\\n }\\n\\n /// @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\\n /// @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\\n /// @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\\n /// @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\\n /// @param controller Sets the owner in the registry to this address\\n function unwrap(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n address controller\\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\\n if (parentNode == CRE8OR_NODE) {\\n revert IncompatibleParent();\\n }\\n if (controller == address(0x0) || controller == address(this)) {\\n revert IncorrectTargetOwner(controller);\\n }\\n _unwrap(_makeNode(parentNode, labelhash), controller);\\n }\\n\\n /// @notice Sets fuses of a name\\n /// @param node Namehash of the name\\n /// @param ownerControlledFuses Owner-controlled fuses to burn\\n /// @return Old fuses\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n )\\n public\\n onlyTokenOwner(node)\\n operationAllowed(node, CANNOT_BURN_FUSES)\\n returns (uint32)\\n {\\n // owner protected by onlyTokenOwner\\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\\n uint256(node)\\n );\\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\\n return oldFuses;\\n }\\n\\n /// @notice Extends expiry for a name\\n /// @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\\n /// @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\\n /// @param expiry When the name will expire in seconds since the Unix epoch\\n /// @return New expiry\\n function extendExpiry(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint64 expiry\\n ) public returns (uint64) {\\n bytes32 node = _makeNode(parentNode, labelhash);\\n\\n if (!_isWrapped(node)) {\\n revert NameIsNotWrapped();\\n }\\n\\n // this flag is used later, when checking fuses\\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\\n // only allow the owner of the name or owner of the parent name\\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n\\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\\n revert OperationProhibited(node);\\n }\\n\\n // Max expiry is set to the expiry of the parent\\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\\n\\n _setData(node, owner, fuses, expiry);\\n emit ExpiryExtended(node, expiry);\\n return expiry;\\n }\\n\\n /// @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\\n /// @dev Can be called by the owner or an authorised caller\\n /// @param name The name to upgrade, in DNS format\\n /// @param extraData Extra data to pass to the upgrade contract\\n function upgrade(bytes calldata name, bytes calldata extraData) public {\\n bytes32 node = name.namehash(0);\\n\\n if (address(upgradeContract) == address(0)) {\\n revert CannotUpgrade();\\n }\\n\\n if (!canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n\\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\\n uint256(node)\\n );\\n\\n address approved = getApproved(uint256(node));\\n\\n _burn(uint256(node));\\n\\n upgradeContract.wrapFromUpgrade(\\n name,\\n currentOwner,\\n fuses,\\n expiry,\\n approved,\\n extraData\\n );\\n }\\n\\n /// /* @notice Sets fuses of a name that you own the parent of\\n /// @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\\n /// @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\\n /// @param fuses Fuses to burn\\n /// @param expiry When the name will expire in seconds since the Unix epoch\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) public {\\n bytes32 node = _makeNode(parentNode, labelhash);\\n _checkFusesAreSettable(node, fuses);\\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n if (owner == address(0) || ens.owner(node) != address(this)) {\\n revert NameIsNotWrapped();\\n }\\n // max expiry is set to the expiry of the parent\\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\\n if (parentNode == ROOT_NODE) {\\n if (!canModifyName(node, msg.sender)) {\\n revert Unauthorised(node, msg.sender);\\n }\\n } else {\\n if (!canModifyName(parentNode, msg.sender)) {\\n revert Unauthorised(parentNode, msg.sender);\\n }\\n }\\n\\n _checkParentFuses(node, fuses, parentFuses);\\n\\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\\n\\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\\n if (\\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\\n oldFuses | fuses != oldFuses\\n ) {\\n revert OperationProhibited(node);\\n }\\n fuses |= oldFuses;\\n _setFuses(node, owner, fuses, oldExpiry, expiry);\\n }\\n\\n /// @notice Sets the subdomain owner in the registry and then wraps the subdomain\\n /// @param parentNode Parent namehash of the subdomain\\n /// @param label Label of the subdomain as a string\\n /// @param owner New owner in the wrapper\\n /// @param fuses Initial fuses for the wrapped subdomain\\n /// @param expiry When the name will expire in seconds since the Unix epoch\\n /// @return node Namehash of the subdomain\\n function setSubnodeOwner(\\n bytes32 parentNode,\\n string calldata label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\\n bytes32 labelhash = keccak256(bytes(label));\\n node = _makeNode(parentNode, labelhash);\\n _checkCanCallSetSubnodeOwner(parentNode, node);\\n _checkFusesAreSettable(node, fuses);\\n bytes memory name = _saveLabel(parentNode, node, label);\\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\\n\\n if (!_isWrapped(node)) {\\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\\n _wrap(node, name, owner, fuses, expiry);\\n } else {\\n _updateName(parentNode, node, label, owner, fuses, expiry);\\n }\\n }\\n\\n /// @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\\n /// @param parentNode parent namehash of the subdomain\\n /// @param label label of the subdomain as a string\\n /// @param owner new owner in the wrapper\\n /// @param resolver resolver contract in the registry\\n /// @param ttl ttl in the registry\\n /// @param fuses initial fuses for the wrapped subdomain\\n /// @param expiry When the name will expire in seconds since the Unix epoch\\n /// @return node Namehash of the subdomain\\n function setSubnodeRecord(\\n bytes32 parentNode,\\n string memory label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\\n bytes32 labelhash = keccak256(bytes(label));\\n node = _makeNode(parentNode, labelhash);\\n _checkCanCallSetSubnodeOwner(parentNode, node);\\n _checkFusesAreSettable(node, fuses);\\n _saveLabel(parentNode, node, label);\\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\\n if (!_isWrapped(node)) {\\n ens.setSubnodeRecord(\\n parentNode,\\n labelhash,\\n address(this),\\n resolver,\\n ttl\\n );\\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\\n } else {\\n ens.setSubnodeRecord(\\n parentNode,\\n labelhash,\\n address(this),\\n resolver,\\n ttl\\n );\\n _updateName(parentNode, node, label, owner, fuses, expiry);\\n }\\n }\\n\\n /// @notice Sets records for the name in the ENS Registry\\n /// @param node Namehash of the name to set a record for\\n /// @param owner New owner in the registry\\n /// @param resolver Resolver contract\\n /// @param ttl Time to live in the registry\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n )\\n public\\n onlyTokenOwner(node)\\n operationAllowed(\\n node,\\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\\n )\\n {\\n ens.setRecord(node, address(this), resolver, ttl);\\n if (owner == address(0)) {\\n (, uint32 fuses, ) = getData(uint256(node));\\n if (fuses & IS_DOT_CRE8OR == IS_DOT_CRE8OR) {\\n revert IncorrectTargetOwner(owner);\\n }\\n _unwrap(node, address(0));\\n } else {\\n address oldOwner = ownerOf(uint256(node));\\n _transfer(oldOwner, owner, uint256(node), 1, \\\"\\\");\\n }\\n }\\n\\n /// @notice Sets resolver contract in the registry\\n /// @param node namehash of the name\\n /// @param resolver the resolver contract\\n function setResolver(\\n bytes32 node,\\n address resolver\\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\\n ens.setResolver(node, resolver);\\n }\\n\\n /// @notice Sets TTL in the registry\\n /// @param node Namehash of the name\\n /// @param ttl TTL in the registry\\n function setTTL(\\n bytes32 node,\\n uint64 ttl\\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\\n ens.setTTL(node, ttl);\\n }\\n\\n /// @dev Allows an operation only if none of the specified fuses are burned.\\n /// @param node The namehash of the name to check fuses on.\\n /// @param fuseMask A bitmask of fuses that must not be burned.\\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\\n (, uint32 fuses, ) = getData(uint256(node));\\n if (fuses & fuseMask != 0) {\\n revert OperationProhibited(node);\\n }\\n _;\\n }\\n\\n /// @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\\n /// @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\\n /// and checks whether the owner of the subdomain is 0x0 for creating or already exists for\\n /// replacing a subdomain. If either conditions are true, then it is possible to call\\n /// setSubnodeOwner\\n /// @param parentNode Namehash of the parent name to check\\n /// @param subnode Namehash of the subname to check\\n function _checkCanCallSetSubnodeOwner(\\n bytes32 parentNode,\\n bytes32 subnode\\n ) internal view {\\n (\\n address subnodeOwner,\\n uint32 subnodeFuses,\\n uint64 subnodeExpiry\\n ) = getData(uint256(subnode));\\n\\n // check if the registry owner is 0 and expired\\n // check if the wrapper owner is 0 and expired\\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\\n bool expired = subnodeExpiry < block.timestamp;\\n if (\\n expired &&\\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\\n (subnodeOwner == address(0) ||\\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\\n ens.owner(subnode) == address(0))\\n ) {\\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\\n revert OperationProhibited(subnode);\\n }\\n } else {\\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\\n revert OperationProhibited(subnode);\\n }\\n }\\n }\\n\\n /// @notice Checks all Fuses in the mask are burned for the node\\n /// @param node Namehash of the name\\n /// @param fuseMask The fuses you want to check\\n /// @return Boolean of whether or not all the selected fuses are burned\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) public view returns (bool) {\\n (, uint32 fuses, ) = getData(uint256(node));\\n return fuses & fuseMask == fuseMask;\\n }\\n\\n /// @notice Checks if a name is wrapped\\n /// @param node Namehash of the name\\n /// @return Boolean of whether or not the name is wrapped\\n function isWrapped(bytes32 node) public view returns (bool) {\\n bytes memory name = names[node];\\n if (name.length == 0) {\\n return false;\\n }\\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\\n bytes32 parentNode = name.namehash(offset);\\n return isWrapped(parentNode, labelhash);\\n }\\n\\n /// @notice Checks if a name is wrapped in a more gas efficient way\\n /// @param parentNode Namehash of the name\\n /// @param labelhash Namehash of the name\\n /// @return Boolean of whether or not the name is wrapped\\n function isWrapped(\\n bytes32 parentNode,\\n bytes32 labelhash\\n ) public view returns (bool) {\\n bytes32 node = _makeNode(parentNode, labelhash);\\n bool wrapped = _isWrapped(node);\\n if (parentNode != CRE8OR_NODE) {\\n return wrapped;\\n }\\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\\n return owner == address(this);\\n } catch {\\n return false;\\n }\\n }\\n\\n function onERC721Received(\\n address to,\\n address,\\n uint256 tokenId,\\n bytes calldata data\\n ) public returns (bytes4) {\\n //check if it's the eth registrar ERC721\\n if (msg.sender != address(registrar)) {\\n revert IncorrectTokenType();\\n }\\n\\n (\\n string memory label,\\n address owner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) = abi.decode(data, (string, address, uint16, address));\\n\\n bytes32 labelhash = bytes32(tokenId);\\n bytes32 labelhashFromData = keccak256(bytes(label));\\n\\n if (labelhashFromData != labelhash) {\\n revert LabelMismatch(labelhashFromData, labelhash);\\n }\\n\\n // transfer the ens record back to the new owner (this contract)\\n registrar.reclaim(uint256(labelhash), address(this));\\n\\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\\n\\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\\n\\n return IERC721Receiver(to).onERC721Received.selector;\\n }\\n\\n /***** Internal functions */\\n\\n function _beforeTransfer(\\n uint256 id,\\n uint32 fuses,\\n uint64 expiry\\n ) internal override {\\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\\n if (fuses & IS_DOT_CRE8OR == IS_DOT_CRE8OR) {\\n expiry -= GRACE_PERIOD;\\n }\\n\\n if (expiry < block.timestamp) {\\n // Transferable if the name was not emancipated\\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\\n revert(\\\"ERC1155: insufficient balance for transfer\\\");\\n }\\n } else {\\n // Transferable if CANNOT_TRANSFER is unburned\\n if (fuses & CANNOT_TRANSFER != 0) {\\n revert OperationProhibited(bytes32(id));\\n }\\n }\\n\\n // delete token approval if CANNOT_APPROVE has not been burnt\\n if (fuses & CANNOT_APPROVE == 0) {\\n delete _tokenApprovals[id];\\n }\\n }\\n\\n function _clearOwnerAndFuses(\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal view override returns (address, uint32) {\\n if (expiry < block.timestamp) {\\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\\n owner = address(0);\\n }\\n fuses = 0;\\n }\\n\\n return (owner, fuses);\\n }\\n\\n function _makeNode(\\n bytes32 node,\\n bytes32 labelhash\\n ) private pure returns (bytes32) {\\n return keccak256(abi.encodePacked(node, labelhash));\\n }\\n\\n function _addLabel(\\n string memory label,\\n bytes memory name\\n ) internal pure returns (bytes memory ret) {\\n if (bytes(label).length < 1) {\\n revert LabelTooShort();\\n }\\n if (bytes(label).length > 255) {\\n revert LabelTooLong(label);\\n }\\n return abi.encodePacked(uint8(bytes(label).length), label, name);\\n }\\n\\n function _mint(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal override {\\n _canFusesBeBurned(node, fuses);\\n (address oldOwner, , ) = super.getData(uint256(node));\\n if (oldOwner != address(0)) {\\n // burn and unwrap old token of old owner\\n _burn(uint256(node));\\n emit NameUnwrapped(node, address(0));\\n }\\n super._mint(node, owner, fuses, expiry);\\n }\\n\\n function _wrap(\\n bytes32 node,\\n bytes memory name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n _mint(node, wrappedOwner, fuses, expiry);\\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\\n }\\n\\n function _storeNameAndWrap(\\n bytes32 parentNode,\\n bytes32 node,\\n string memory label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n bytes memory name = _addLabel(label, names[parentNode]);\\n _wrap(node, name, owner, fuses, expiry);\\n }\\n\\n function _saveLabel(\\n bytes32 parentNode,\\n bytes32 node,\\n string memory label\\n ) internal returns (bytes memory) {\\n bytes memory name = _addLabel(label, names[parentNode]);\\n names[node] = name;\\n return name;\\n }\\n\\n function _updateName(\\n bytes32 parentNode,\\n bytes32 node,\\n string memory label,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\\n uint256(node)\\n );\\n bytes memory name = _addLabel(label, names[parentNode]);\\n if (names[node].length == 0) {\\n names[node] = name;\\n }\\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\\n if (owner == address(0)) {\\n _unwrap(node, address(0));\\n } else {\\n _transfer(oldOwner, owner, uint256(node), 1, \\\"\\\");\\n }\\n }\\n\\n // wrapper function for stack limit\\n function _checkParentFusesAndExpiry(\\n bytes32 parentNode,\\n bytes32 node,\\n uint32 fuses,\\n uint64 expiry\\n ) internal view returns (uint64) {\\n (, , uint64 oldExpiry) = getData(uint256(node));\\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\\n _checkParentFuses(node, fuses, parentFuses);\\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\\n }\\n\\n function _checkParentFuses(\\n bytes32 node,\\n uint32 fuses,\\n uint32 parentFuses\\n ) internal pure {\\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\\n 0;\\n\\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\\n\\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\\n revert OperationProhibited(node);\\n }\\n }\\n\\n function _normaliseExpiry(\\n uint64 expiry,\\n uint64 oldExpiry,\\n uint64 maxExpiry\\n ) private pure returns (uint64) {\\n // Expiry cannot be more than maximum allowed\\n // .eth names will check registrar, non .eth check parent\\n if (expiry > maxExpiry) {\\n expiry = maxExpiry;\\n }\\n // Expiry cannot be less than old expiry\\n if (expiry < oldExpiry) {\\n expiry = oldExpiry;\\n }\\n\\n return expiry;\\n }\\n\\n function _wrapETH2LD(\\n string memory label,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address resolver\\n ) private {\\n bytes32 labelhash = keccak256(bytes(label));\\n bytes32 node = _makeNode(CRE8OR_NODE, labelhash);\\n // hardcode dns-encoded eth string for gas savings\\n bytes memory name = _addLabel(label, \\\"\\\\x07creator\\\\x00\\\");\\n names[node] = name;\\n\\n _wrap(\\n node,\\n name,\\n wrappedOwner,\\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_CRE8OR,\\n expiry\\n );\\n\\n if (resolver != address(0)) {\\n ens.setResolver(node, resolver);\\n }\\n }\\n\\n function _unwrap(bytes32 node, address owner) private {\\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\\n revert OperationProhibited(node);\\n }\\n\\n // Burn token and fuse data\\n _burn(uint256(node));\\n ens.setOwner(node, owner);\\n\\n emit NameUnwrapped(node, owner);\\n }\\n\\n function _setFuses(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 oldExpiry,\\n uint64 expiry\\n ) internal {\\n _setData(node, owner, fuses, expiry);\\n emit FusesSet(node, fuses);\\n if (expiry > oldExpiry) {\\n emit ExpiryExtended(node, expiry);\\n }\\n }\\n\\n function _setData(\\n bytes32 node,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n ) internal {\\n _canFusesBeBurned(node, fuses);\\n super._setData(uint256(node), owner, fuses, expiry);\\n }\\n\\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\\n if (\\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\\n ) {\\n revert OperationProhibited(node);\\n }\\n }\\n\\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\\n // Cannot directly burn other non-user settable fuses\\n revert OperationProhibited(node);\\n }\\n }\\n\\n function _isWrapped(bytes32 node) internal view returns (bool) {\\n return\\n ownerOf(uint256(node)) != address(0) &&\\n ens.owner(node) == address(this);\\n }\\n\\n function _isETH2LDInGracePeriod(\\n uint32 fuses,\\n uint64 expiry\\n ) internal view returns (bool) {\\n return\\n fuses & IS_DOT_CRE8OR == IS_DOT_CRE8OR &&\\n expiry - GRACE_PERIOD < block.timestamp;\\n }\\n}\\n\",\"keccak256\":\"0x461f5e5f3e2a11bef1ce1ae8c88f9dd41c9319ed2458641765d03b549e3e6084\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c06040523480156200001157600080fd5b5060405162006506380380620065068339810160408190526200003491620002fc565b8233620000418162000293565b6040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e260048201526000906001600160a01b038416906302571be390602401602060405180830381865afa158015620000a9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000cf919062000350565b604051630f41a04d60e11b81526001600160a01b03848116600483015291925090821690631e83409a906024016020604051808303816000875af11580156200011c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000142919062000377565b505050506001600160a01b0383811660805282811660a052600580546001600160a01b031916918316919091179055600163fffeffff60a01b03197faede491c79c23125f327becde07a228945ed493c0977157cb2a92919c95cdccb8190557fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb4955604080518082019091526001815260006020808301829052908052600690527f54cdd369e4e8a8515e52ca72ec816c2101831ad1f18bf44102ed171459c9b4f89062000210908262000436565b506040805180820190915260088152660331b9329c37b960c91b6020808301919091527f4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454600052600690527f86ec6a5d405e1419b0a8e09f193c1c367f4804c534dacdd92c659df3c872fc419062000289908262000436565b5050505062000502565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114620002f957600080fd5b50565b6000806000606084860312156200031257600080fd5b83516200031f81620002e3565b60208501519093506200033281620002e3565b60408501519092506200034581620002e3565b809150509250925092565b6000602082840312156200036357600080fd5b81516200037081620002e3565b9392505050565b6000602082840312156200038a57600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620003bc57607f821691505b602082108103620003dd57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200043157600081815260208120601f850160051c810160208610156200040c5750805b601f850160051c820191505b818110156200042d5782815560010162000418565b5050505b505050565b81516001600160401b0381111562000452576200045262000391565b6200046a81620004638454620003a7565b84620003e3565b602080601f831160018114620004a25760008415620004895750858301515b600019600386901b1c1916600185901b1785556200042d565b600085815260208120601f198616915b82811015620004d357888601518255948401946001909101908401620004b2565b5085821015620004f25787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a051615ef76200060f6000396000818161050601528181610c1501528181610cef01528181610d7901528181611c6601528181611cfc01528181611daa01528181611ecc01528181611f4201528181611fc20152818161224401528181612380015281816124b2015281816126970152818161271d0152612f5201526000818161055301528181610b9b01528181610ed70152818161108b0152818161113d015281816115550152818161240501528181612537015281816127c8015281816129bf01528181612ccd0152818161317d0152818161322b015281816132f40152818161336d015281816139ca01528181613ae501528181613d4d015261438d0152615ef76000f3fe608060405234801561001057600080fd5b506004361061031f5760003560e01c80636352211e116101a7578063c93ab3fd116100ee578063e985e9c511610097578063f242432a11610071578063f242432a146107d7578063f2fde38b146107ea578063fd0cd0d9146107fd57600080fd5b8063e985e9c514610768578063eb8ae530146107a4578063ed70554d146107b757600080fd5b8063d9a50c12116100c8578063d9a50c121461071f578063da8c229e14610732578063e0dba60f1461075557600080fd5b8063c93ab3fd146106e6578063cf408823146106f9578063d8c9921a1461070c57600080fd5b8063a22cb46511610150578063b6bcad261161012a578063b6bcad26146106ad578063c475abff146106c0578063c658e086146106d357600080fd5b8063a22cb46514610674578063a401498214610687578063adf4960a1461069a57600080fd5b80638b4dfa75116101815780638b4dfa751461063d5780638cf8b41e146106505780638da5cb5b1461066357600080fd5b80636352211e146105f65780636e5d6ad214610609578063715018a61461063557600080fd5b80631f4e15041161026b5780633f15457f116102145780634e1273f4116101ee5780634e1273f4146105b057806353095467146105d05780635d3590d5146105e357600080fd5b80633f15457f1461054e578063402906fc1461057557806341415eab1461059d57600080fd5b80632b20e397116102455780632b20e397146105015780632eb2c2d61461052857806333c69ea91461053b57600080fd5b80631f4e1504146104c857806320c38e2b146104db57806324c1af44146104ee57600080fd5b80630e4cd725116102cd578063150b7a02116102a7578063150b7a02146104765780631534e177146104a25780631896f70a146104b557600080fd5b80630e4cd7251461043d5780630e89341c1461045057806314ab90381461046357600080fd5b806306fdde03116102fe57806306fdde03146103b4578063081812fc146103fd578063095ea7b31461042857600080fd5b8062fdd58e146103245780630178fe3f1461034a57806301ffc9a714610391575b600080fd5b610337610332366004614d26565b610810565b6040519081526020015b60405180910390f35b61035d610358366004614d52565b6108cf565b604080516001600160a01b03909416845263ffffffff909216602084015267ffffffffffffffff1690820152606001610341565b6103a461039f366004614d81565b6108ff565b6040519015158152602001610341565b6103f06040518060400160405280600b81526020017f4e616d655772617070657200000000000000000000000000000000000000000081525081565b6040516103419190614dee565b61041061040b366004614d52565b610958565b6040516001600160a01b039091168152602001610341565b61043b610436366004614d26565b61099d565b005b6103a461044b366004614e01565b6109e3565b6103f061045e366004614d52565b610a7d565b61043b610471366004614e4e565b610aef565b610489610484366004614ec3565b610c08565b6040516001600160e01b03199091168152602001610341565b61043b6104b0366004614f36565b610e1a565b61043b6104c3366004614e01565b610e44565b600754610410906001600160a01b031681565b6103f06104e9366004614d52565b610f06565b6103376104fc36600461502e565b610fa0565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b61043b610536366004615156565b6111b4565b61043b610549366004615204565b6114de565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b61058861058336600461525c565b6116d3565b60405163ffffffff9091168152602001610341565b6103a46105ab366004614e01565b611775565b6105c36105be36600461527f565b6117d2565b604051610341919061537d565b600554610410906001600160a01b031681565b61043b6105f1366004615390565b611910565b610410610604366004614d52565b6119aa565b61061c6106173660046153d1565b6119b5565b60405167ffffffffffffffff9091168152602001610341565b61043b611b0a565b61043b61064b366004615406565b611b1e565b61061c61065e366004615448565b611cc8565b6000546001600160a01b0316610410565b61043b6106823660046154d1565b612094565b6103376106953660046154ff565b61217e565b6103a46106a8366004615580565b612319565b61043b6106bb366004614f36565b61233e565b6103376106ce3660046155a3565b612596565b6103376106e13660046155c5565b61288d565b61043b6106f4366004615638565b612a9a565b61043b6107073660046156a4565b612c0b565b61043b61071a3660046156dc565b612dc4565b6103a461072d3660046155a3565b612ed4565b6103a4610740366004614f36565b60046020526000908152604090205460ff1681565b61043b6107633660046154d1565b612fe1565b6103a461077636600461570a565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b61043b6107b2366004615738565b613049565b6103376107c5366004614d52565b60016020526000908152604090205481565b61043b6107e53660046157a0565b613414565b61043b6107f8366004614f36565b613531565b6103a461080b366004614d52565b6135be565b60006001600160a01b0383166108935760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084015b60405180910390fd5b600061089e836119aa565b9050836001600160a01b0316816001600160a01b0316036108c35760019150506108c9565b60009150505b92915050565b60008181526001602052604090205460a081901c60c082901c6108f3838383613696565b90959094509092509050565b60006001600160e01b031982167fd82c42d800000000000000000000000000000000000000000000000000000000148061094957506001600160e01b03198216630a85bd0160e11b145b806108c957506108c9826136cd565b600080610964836119aa565b90506001600160a01b03811661097d5750600092915050565b6000838152600360205260409020546001600160a01b03165b9392505050565b60006109a8826108cf565b50915050603f1960408216016109d45760405163a2a7201360e01b81526004810183905260240161088a565b6109de838361374f565b505050565b60008080806109f1866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a3c57506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff165b80610a6057506001600160a01b038516610a5587610958565b6001600160a01b0316145b8015610a735750610a718282613899565b155b9695505050505050565b6005546040516303a24d0760e21b8152600481018390526060916001600160a01b031690630e89341c90602401600060405180830381865afa158015610ac7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108c99190810190615809565b81610afa8133611775565b610b205760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260106000610b2e836108cf565b5091505063ffffffff8282161615610b5c5760405163a2a7201360e01b81526004810184905260240161088a565b6040517f14ab90380000000000000000000000000000000000000000000000000000000081526004810187905267ffffffffffffffff861660248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906314ab9038906044015b600060405180830381600087803b158015610be857600080fd5b505af1158015610bfc573d6000803e3d6000fd5b50505050505050505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610c6c576040517f1931a53800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080610c7d86880188615881565b83516020850120939750919550935091508890808214610cd3576040517fc65c3ccc000000000000000000000000000000000000000000000000000000008152600481018290526024810183905260440161088a565b604051630a3b53db60e21b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906328ed4f6c90604401600060405180830381600087803b158015610d3b57600080fd5b505af1158015610d4f573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018d9052600092506276a70091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d6e4fa8690602401602060405180830381865afa158015610dc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de491906158e9565b610dee9190615918565b9050610e0187878761ffff1684886138ca565b50630a85bd0160e11b9c9b505050505050505050505050565b610e22613a30565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b81610e4f8133611775565b610e755760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260086000610e83836108cf565b5091505063ffffffff8282161615610eb15760405163a2a7201360e01b81526004810184905260240161088a565b604051630c4b7b8560e11b8152600481018790526001600160a01b0386811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401610bce565b60066020526000908152604090208054610f1f90615940565b80601f0160208091040260200160405190810160405280929190818152602001828054610f4b90615940565b8015610f985780601f10610f6d57610100808354040283529160200191610f98565b820191906000526020600020905b815481529060010190602001808311610f7b57829003601f168201915b505050505081565b600087610fad8133611775565b610fd35760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8751602089012061100b8a82604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506110178a84613a8a565b6110218386613bc9565b61102c8a848b613bfc565b506110398a848787613cc9565b935061104483613d0f565b6110fa576040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156110cf57600080fd5b505af11580156110e3573d6000803e3d6000fd5b505050506110f58a848b8b8989613dc8565b6111a7565b6040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561118157600080fd5b505af1158015611195573d6000803e3d6000fd5b505050506111a78a848b8b8989613dff565b5050979650505050505050565b815183511461122b5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060448201527f6d69736d61746368000000000000000000000000000000000000000000000000606482015260840161088a565b6001600160a01b03841661128f5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b0385163314806112c957506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b61133b5760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000606482015260840161088a565b60005b835181101561147157600084828151811061135b5761135b61597a565b6020026020010151905060008483815181106113795761137961597a565b602002602001015190506000806000611391856108cf565b9250925092506113a2858383613ec3565b8360011480156113c357508a6001600160a01b0316836001600160a01b0316145b6114225760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b60008581526001602052604090206001600160a01b038b1663ffffffff60a01b60a085901b16176001600160c01b031960c084901b1617905550505050508061146a90615990565b905061133e565b50836001600160a01b0316856001600160a01b0316336001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516114c19291906159a9565b60405180910390a46114d7338686868686613fb0565b5050505050565b604080516020808201879052818301869052825180830384018152606090920190925280519101206115108184613bc9565b6000808061151d846108cf565b919450925090506001600160a01b03831615806115cc57506040516302571be360e01b81526004810185905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa15801561159c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c091906159d7565b6001600160a01b031614155b156115ea57604051635374b59960e01b815260040160405180910390fd5b6000806115f68a6108cf565b90935091508a90506116375761160c8633611775565b6116325760405163168ab55d60e31b81526004810187905233602482015260440161088a565b611667565b6116418a33611775565b6116675760405163168ab55d60e31b8152600481018b905233602482015260440161088a565b611672868984614155565b61167d878483614190565b9650620100008416158015906116a157508363ffffffff1688851763ffffffff1614155b156116c25760405163a2a7201360e01b81526004810187905260240161088a565b96831796610bfc86868a868b6141da565b6000826116e08133611775565b6117065760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8360026000611714836108cf565b5091505063ffffffff82821616156117425760405163a2a7201360e01b81526004810184905260240161088a565b6000808061174f8a6108cf565b9250925092506117688a84848c61ffff161784856141da565b5098975050505050505050565b6000808080611783866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a6057506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff16610a60565b6060815183511461184b5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d617463680000000000000000000000000000000000000000000000606482015260840161088a565b6000835167ffffffffffffffff81111561186757611867614f53565b604051908082528060200260200182016040528015611890578160200160208202803683370190505b50905060005b8451811015611908576118db8582815181106118b4576118b461597a565b60200260200101518583815181106118ce576118ce61597a565b6020026020010151610810565b8282815181106118ed576118ed61597a565b602090810291909101015261190181615990565b9050611896565b509392505050565b611918613a30565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015611980573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a491906159f4565b50505050565b60006108c982614284565b604080516020808201869052818301859052825180830384018152606090920190925280519101206000906119e981613d0f565b611a0657604051635374b59960e01b815260040160405180910390fd5b6000611a1286336109e3565b905080158015611a295750611a278233611775565b155b15611a505760405163168ab55d60e31b81526004810183905233602482015260440161088a565b60008080611a5d856108cf565b92509250925083158015611a745750620400008216155b15611a955760405163a2a7201360e01b81526004810186905260240161088a565b6000611aa08a6108cf565b92505050611aaf888383614190565b9750611abd8685858b61429a565b60405167ffffffffffffffff8916815286907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b1329060200160405180910390a2509598975050505050505050565b611b12613a30565b611b1c60006142e2565b565b604080517f4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a2745460208083019190915281830186905282518083038401815260609092019092528051910120611b728133611775565b611b985760405163168ab55d60e31b81526004810182905233602482015260440161088a565b306001600160a01b03841603611bcc57604051632ca49b0d60e11b81526001600160a01b038416600482015260240161088a565b604080517f4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a2745460208083019190915281830187905282518083038401815260609092019092528051910120611c21905b83614332565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038481166024830152604482018690527f000000000000000000000000000000000000000000000000000000000000000016906342842e0e90606401600060405180830381600087803b158015611caa57600080fd5b505af1158015611cbe573d6000803e3d6000fd5b5050505050505050565b6000808686604051611cdb929190615a11565b6040519081900381206331a9108f60e11b82526004820181905291506000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611d4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6f91906159d7565b90506001600160a01b0381163314801590611e17575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015611df1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e1591906159f4565b155b15611e8757604080517f4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a274546020808301919091528183018590528251808303840181526060830193849052805191012063168ab55d60e31b909252606481019190915233608482015260a40161088a565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152306024830152604482018490527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90606401600060405180830381600087803b158015611f1057600080fd5b505af1158015611f24573d6000803e3d6000fd5b5050604051630a3b53db60e21b8152600481018590523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506328ed4f6c9150604401600060405180830381600087803b158015611f9057600080fd5b505af1158015611fa4573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018590526276a70092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316915063d6e4fa8690602401602060405180830381865afa158015612012573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203691906158e9565b6120409190615918565b925061208988888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff881686886138ca565b505095945050505050565b6001600160a01b03821633036121125760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c660000000000000000000000000000000000000000000000606482015260840161088a565b3360008181526002602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b3360009081526004602052604081205460ff166121ee5760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f604482015267373a3937b63632b960c11b606482015260840161088a565b60008787604051612200929190615a11565b6040519081900381207ffca247ac000000000000000000000000000000000000000000000000000000008252600482018190523060248301526044820187905291507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fca247ac906064016020604051808303816000875af1158015612295573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b991906158e9565b915061230e88888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff86166123086276a70087615918565b886138ca565b509695505050505050565b600080612325846108cf565b50841663ffffffff908116908516149250505092915050565b612346613a30565b6007546001600160a01b0316156124665760075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156123c657600080fd5b505af11580156123da573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561244d57600080fd5b505af1158015612461573d6000803e3d6000fd5b505050505b600780546001600160a01b0319166001600160a01b038316908117909155156125935760075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156124f857600080fd5b505af115801561250c573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561257f57600080fd5b505af11580156114d7573d6000803e3d6000fd5b50565b3360009081526004602052604081205460ff166126065760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f604482015267373a3937b63632b960c11b606482015260840161088a565b604080517f4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454602080830191909152818301869052825180830384018152606090920190925280519101206000906040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101869052602481018590529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c475abff906044016020604051808303816000875af11580156126e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061270491906158e9565b6040516331a9108f60e11b8152600481018790529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa925050508015612788575060408051601f3d908101601f19168201909252612785918101906159d7565b60015b6127955791506108c99050565b6001600160a01b0381163014158061283f57506040516302571be360e01b81526004810184905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa15801561280f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061283391906159d7565b6001600160a01b031614155b1561284e575091506108c99050565b50600061285e6276a70083615918565b60008481526001602052604090205490915060a081901c6128818583838661429a565b50919695505050505050565b60008661289a8133611775565b6128c05760405163168ab55d60e31b81526004810182905233602482015260440161088a565b600087876040516128d2929190615a11565b6040518091039020905061290d8982604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506129198984613a8a565b6129238386613bc9565b60006129668a858b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613bfc92505050565b90506129748a858888613cc9565b945061297f84613d0f565b612a47576040517f06ab5923000000000000000000000000000000000000000000000000000000008152600481018b9052602481018390523060448201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906306ab5923906064016020604051808303816000875af1158015612a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a3491906158e9565b50612a428482898989614424565b612a8d565b612a8d8a858b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d92508c91508b9050613dff565b5050509695505050505050565b6000612ae0600086868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506144669050565b6007549091506001600160a01b0316612b25576040517f24c1d6d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612b2f8133611775565b612b555760405163168ab55d60e31b81526004810182905233602482015260440161088a565b60008080612b62846108cf565b919450925090506000612b7485610958565b9050612b7f85614525565b600760009054906101000a90046001600160a01b03166001600160a01b0316639198c2768a8a878787878e8e6040518963ffffffff1660e01b8152600401612bce989796959493929190615a4a565b600060405180830381600087803b158015612be857600080fd5b505af1158015612bfc573d6000803e3d6000fd5b50505050505050505050505050565b83612c168133611775565b612c3c5760405163168ab55d60e31b81526004810182905233602482015260440161088a565b84601c6000612c4a836108cf565b5091505063ffffffff8282161615612c785760405163a2a7201360e01b81526004810184905260240161088a565b6040517fcf408823000000000000000000000000000000000000000000000000000000008152600481018990523060248201526001600160a01b03878116604483015267ffffffffffffffff871660648301527f0000000000000000000000000000000000000000000000000000000000000000169063cf40882390608401600060405180830381600087803b158015612d1157600080fd5b505af1158015612d25573d6000803e3d6000fd5b5050506001600160a01b0388169050612d8c576000612d43896108cf565b509150506201ffff1962020000821601612d7b57604051632ca49b0d60e11b81526001600160a01b038916600482015260240161088a565b612d86896000614332565b50611cbe565b6000612d97896119aa565b9050612db981898b60001c6001604051806020016040528060008152506145e7565b505050505050505050565b60408051602080820186905281830185905282518083038401815260609092019092528051910120612df68133611775565b612e1c5760405163168ab55d60e31b81526004810182905233602482015260440161088a565b7fb0d3f037c2e8a3bdc2aa220d010c464c750b86053c524bd504fd887c685d8bac8401612e5c5760405163615a470360e01b815260040160405180910390fd5b6001600160a01b0382161580612e7a57506001600160a01b03821630145b15612ea357604051632ca49b0d60e11b81526001600160a01b038316600482015260240161088a565b604080516020808201879052818301869052825180830384018152606090920190925280519101206119a490611c1b565b604080516020808201859052818301849052825180830384018152606090920190925280519101206000906000612f0a82613d0f565b90507f4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a274548514612f3c5791506108c99050565b6040516331a9108f60e11b8152600481018590527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa925050508015612fbd575060408051601f3d908101601f19168201909252612fba918101906159d7565b60015b612fcc576000925050506108c9565b6001600160a01b0316301492506108c9915050565b612fe9613a30565b6001600160a01b038216600081815260046020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf8791015b60405180910390a25050565b600080613090600087878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506147399050565b9150915060006130d98288888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506144669050565b604080516020808201849052818301879052825180830384018152606090920190925280519101209091506000906000818152600660205260409020909150613123888a83615af9565b507fb0d3f037c2e8a3bdc2aa220d010c464c750b86053c524bd504fd887c685d8bac82016131645760405163615a470360e01b815260040160405180910390fd5b6040516302571be360e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa1580156131cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131f091906159d7565b90506001600160a01b0381163314801590613298575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015613272573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061329691906159f4565b155b156132bf5760405163168ab55d60e31b81526004810183905233602482015260440161088a565b6001600160a01b0386161561335157604051630c4b7b8560e11b8152600481018390526001600160a01b0387811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b15801561333857600080fd5b505af115801561334c573d6000803e3d6000fd5b505050505b604051635b0fc9c360e01b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635b0fc9c390604401600060405180830381600087803b1580156133b957600080fd5b505af11580156133cd573d6000803e3d6000fd5b50505050612db9828a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508d93509150819050614424565b6001600160a01b0384166134785760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b0385163314806134b257506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b6135245760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201527f20617070726f7665640000000000000000000000000000000000000000000000606482015260840161088a565b6114d785858585856145e7565b613539613a30565b6001600160a01b0381166135b55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161088a565b612593816142e2565b600081815260066020526040812080548291906135da90615940565b80601f016020809104026020016040519081016040528092919081815260200182805461360690615940565b80156136535780601f1061362857610100808354040283529160200191613653565b820191906000526020600020905b81548152906001019060200180831161363657829003601f168201915b50505050509050805160000361366c5750600092915050565b6000806136798382614739565b9092509050600061368a8483614466565b9050610a738184612ed4565b600080428367ffffffffffffffff1610156136c45761ffff19620100008516016136bf57600094505b600093505b50929391925050565b60006001600160e01b031982167fd9b67a2600000000000000000000000000000000000000000000000000000000148061371757506001600160e01b031982166303a24d0760e21b145b806108c957507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146108c9565b600061375a826119aa565b9050806001600160a01b0316836001600160a01b0316036137e35760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f7200000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b336001600160a01b038216148061381d57506001600160a01b038116600090815260026020908152604080832033845290915290205460ff165b61388f5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161088a565b6109de83836147f0565b6000620200008381161480156109965750426138b86276a70084615bb9565b67ffffffffffffffff16109392505050565b8451602086012060006139247f4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a2745483604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b90506000613967886040518060400160405280600981526020017f0763726561746f7200000000000000000000000000000000000000000000000081525061485e565b60008381526006602052604090209091506139828282615bda565b50613995828289620300008a1789614424565b6001600160a01b03841615611cbe57604051630c4b7b8560e11b8152600481018390526001600160a01b0385811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b158015613a0e57600080fd5b505af1158015613a22573d6000803e3d6000fd5b505050505050505050505050565b6000546001600160a01b03163314611b1c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161088a565b60008080613a97846108cf565b919450925090504267ffffffffffffffff821610808015613b5b57506001600160a01b0384161580613b5b57506040516302571be360e01b8152600481018690526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b5091906159d7565b6001600160a01b0316145b15613b9a576000613b6b876108cf565b509150506020811615613b945760405163a2a7201360e01b81526004810187905260240161088a565b50613bc1565b62010000831615613bc15760405163a2a7201360e01b81526004810186905260240161088a565b505050505050565b63fffdffff81811763ffffffff1614613bf85760405163a2a7201360e01b81526004810183905260240161088a565b5050565b60606000613ca583600660008881526020019081526020016000208054613c2290615940565b80601f0160208091040260200160405190810160405280929190818152602001828054613c4e90615940565b8015613c9b5780601f10613c7057610100808354040283529160200191613c9b565b820191906000526020600020905b815481529060010190602001808311613c7e57829003601f168201915b505050505061485e565b6000858152600660205260409020909150613cc08282615bda565b50949350505050565b600080613cd5856108cf565b92505050600080613ce88860001c6108cf565b9250925050613cf8878784614155565b613d03858483614190565b98975050505050505050565b600080613d1b836119aa565b6001600160a01b0316141580156108c957506040516302571be360e01b81526004810183905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613d94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613db891906159d7565b6001600160a01b03161492915050565b60008681526006602052604081208054613de7918791613c2290615940565b9050613df68682868686614424565b50505050505050565b60008080613e0c886108cf565b9250925092506000613e3688600660008d81526020019081526020016000208054613c2290615940565b60008a8152600660205260409020805491925090613e5390615940565b9050600003613e76576000898152600660205260409020613e748282615bda565b505b613e85898588861785896141da565b6001600160a01b038716613ea357613e9e896000614332565b610bfc565b610bfc84888b60001c6001604051806020016040528060008152506145e7565b6201ffff1962020000831601613ee357613ee06276a70082615bb9565b90505b428167ffffffffffffffff161015613f605762010000821615613f5b5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b613f85565b6004821615613f855760405163a2a7201360e01b81526004810184905260240161088a565b604082166000036109de575050600090815260036020526040902080546001600160a01b0319169055565b6001600160a01b0384163b15613bc15760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190613ff49089908990889088908890600401615c9a565b6020604051808303816000875af192505050801561402f575060408051601f3d908101601f1916820190925261402c91810190615cec565b60015b6140e45761403b615d09565b806308c379a003614074575061404f615d25565b8061405a5750614076565b8060405162461bcd60e51b815260040161088a9190614dee565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560448201527f526563656976657220696d706c656d656e746572000000000000000000000000606482015260840161088a565b6001600160e01b0319811663bc197c8160e01b14613df65760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161088a565b63ffff0000821615801590600183161590829061416f5750805b156114d75760405163a2a7201360e01b81526004810186905260240161088a565b60008167ffffffffffffffff168467ffffffffffffffff1611156141b2578193505b8267ffffffffffffffff168467ffffffffffffffff1610156141d2578293505b509192915050565b6141e68585858461429a565b60405163ffffffff8416815285907f39873f00c80f4f94b7bd1594aebcf650f003545b74824d57ddf4939e3ff3a34b9060200160405180910390a28167ffffffffffffffff168167ffffffffffffffff1611156114d75760405167ffffffffffffffff8216815285907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b132906020015b60405180910390a25050505050565b600080614290836108cf565b5090949350505050565b6142a48483614907565b60008481526001602052604090206001600160a01b03841663ffffffff60a01b60a085901b16176001600160c01b031960c084901b161790556119a4565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61433d826001612319565b1561435e5760405163a2a7201360e01b81526004810183905260240161088a565b61436782614525565b604051635b0fc9c360e01b8152600481018390526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b1580156143d157600080fd5b505af11580156143e5573d6000803e3d6000fd5b50506040516001600160a01b03841681528492507fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c4915060200161303d565b61443085848484614940565b847f8ce7013e8abebc55c3890a68f5a27c67c3f7efa64e584de5fb22363c606fd340858585856040516142759493929190615daf565b60008060006144758585614739565b9092509050816144e7576001855161448d9190615df7565b84146144db5760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d65000000604482015260640161088a565b50600091506108c99050565b6144f18582614466565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b60008181526001602052604090205460a081901c60c082901c614549838383613696565b600086815260036020908152604080832080546001600160a01b03191690556001909152902063ffffffff60a01b60a083901b166001600160c01b031960c086901b1617905592506145989050565b60408051858152600160208201526000916001600160a01b0386169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a450505050565b60008060006145f5866108cf565b925092509250614606868383613ec3565b8460011480156146275750876001600160a01b0316836001600160a01b0316145b6146865760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b866001600160a01b0316836001600160a01b0316036146a7575050506114d7565b60008681526001602052604090206001600160a01b03881663ffffffff60a01b60a085901b16176001600160c01b031960c084901b1617905560408051878152602081018790526001600160a01b03808a1692908b169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611cbe3389898989896149b4565b6000808351831061478c5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e64730000604482015260640161088a565b60008484815181106147a0576147a061597a565b016020015160f81c905080156147cc576147c5856147bf866001615e0a565b83614ab0565b92506147d1565b600092505b6147db8185615e0a565b6147e6906001615e0a565b9150509250929050565b600081815260036020526040902080546001600160a01b0319166001600160a01b0384169081179091558190614825826119aa565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b606060018351101561489c576040517f280dacb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60ff835111156148da57826040517fe3ba295f00000000000000000000000000000000000000000000000000000000815260040161088a9190614dee565b825183836040516020016148f093929190615e1d565b604051602081830303815290604052905092915050565b61ffff81161580159061491f57506201000181811614155b15613bf85760405163a2a7201360e01b81526004810183905260240161088a565b61494a8483614907565b6000848152600160205260409020546001600160a01b038116156149a85761497185614525565b6040516000815285907fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49060200160405180910390a25b6114d785858585614ad4565b6001600160a01b0384163b15613bc15760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906149f89089908990889088908890600401615e7e565b6020604051808303816000875af1925050508015614a33575060408051601f3d908101601f19168201909252614a3091810190615cec565b60015b614a3f5761403b615d09565b6001600160e01b0319811663f23a6e6160e01b14613df65760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161088a565b8251600090614abf8385615e0a565b1115614aca57600080fd5b5091016020012090565b8360008080614ae2846108cf565b9194509250905063ffff0000821667ffffffffffffffff8087169083161115614b09578195505b428267ffffffffffffffff1610614b1f57958617955b6001600160a01b03841615614b765760405162461bcd60e51b815260206004820152601f60248201527f455243313135353a206d696e74206f66206578697374696e6720746f6b656e00604482015260640161088a565b6001600160a01b038816614bf25760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b306001600160a01b03891603614c705760405162461bcd60e51b815260206004820152603460248201527f455243313135353a206e65774f776e65722063616e6e6f74206265207468652060448201527f4e616d655772617070657220636f6e7472616374000000000000000000000000606482015260840161088a565b60008581526001602052604090206001600160a01b03891663ffffffff60a01b60a08a901b16176001600160c01b031960c089901b1617905560408051868152600160208201526001600160a01b038a169160009133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4612db93360008a886001604051806020016040528060008152506149b4565b6001600160a01b038116811461259357600080fd5b60008060408385031215614d3957600080fd5b8235614d4481614d11565b946020939093013593505050565b600060208284031215614d6457600080fd5b5035919050565b6001600160e01b03198116811461259357600080fd5b600060208284031215614d9357600080fd5b813561099681614d6b565b60005b83811015614db9578181015183820152602001614da1565b50506000910152565b60008151808452614dda816020860160208601614d9e565b601f01601f19169290920160200192915050565b6020815260006109966020830184614dc2565b60008060408385031215614e1457600080fd5b823591506020830135614e2681614d11565b809150509250929050565b803567ffffffffffffffff81168114614e4957600080fd5b919050565b60008060408385031215614e6157600080fd5b82359150614e7160208401614e31565b90509250929050565b60008083601f840112614e8c57600080fd5b50813567ffffffffffffffff811115614ea457600080fd5b602083019150836020828501011115614ebc57600080fd5b9250929050565b600080600080600060808688031215614edb57600080fd5b8535614ee681614d11565b94506020860135614ef681614d11565b935060408601359250606086013567ffffffffffffffff811115614f1957600080fd5b614f2588828901614e7a565b969995985093965092949392505050565b600060208284031215614f4857600080fd5b813561099681614d11565b634e487b7160e01b600052604160045260246000fd5b601f8201601f1916810167ffffffffffffffff81118282101715614f8f57614f8f614f53565b6040525050565b600067ffffffffffffffff821115614fb057614fb0614f53565b50601f01601f191660200190565b600082601f830112614fcf57600080fd5b8135614fda81614f96565b604051614fe78282614f69565b828152856020848701011115614ffc57600080fd5b82602086016020830137600092810160200192909252509392505050565b803563ffffffff81168114614e4957600080fd5b600080600080600080600060e0888a03121561504957600080fd5b87359650602088013567ffffffffffffffff81111561506757600080fd5b6150738a828b01614fbe565b965050604088013561508481614d11565b9450606088013561509481614d11565b93506150a260808901614e31565b92506150b060a0890161501a565b91506150be60c08901614e31565b905092959891949750929550565b600067ffffffffffffffff8211156150e6576150e6614f53565b5060051b60200190565b600082601f83011261510157600080fd5b8135602061510e826150cc565b60405161511b8282614f69565b83815260059390931b850182019282810191508684111561513b57600080fd5b8286015b8481101561230e578035835291830191830161513f565b600080600080600060a0868803121561516e57600080fd5b853561517981614d11565b9450602086013561518981614d11565b9350604086013567ffffffffffffffff808211156151a657600080fd5b6151b289838a016150f0565b945060608801359150808211156151c857600080fd5b6151d489838a016150f0565b935060808801359150808211156151ea57600080fd5b506151f788828901614fbe565b9150509295509295909350565b6000806000806080858703121561521a57600080fd5b84359350602085013592506152316040860161501a565b915061523f60608601614e31565b905092959194509250565b803561ffff81168114614e4957600080fd5b6000806040838503121561526f57600080fd5b82359150614e716020840161524a565b6000806040838503121561529257600080fd5b823567ffffffffffffffff808211156152aa57600080fd5b818501915085601f8301126152be57600080fd5b813560206152cb826150cc565b6040516152d88282614f69565b83815260059390931b85018201928281019150898411156152f857600080fd5b948201945b8386101561531f57853561531081614d11565b825294820194908201906152fd565b9650508601359250508082111561533557600080fd5b506147e6858286016150f0565b600081518084526020808501945080840160005b8381101561537257815187529582019590820190600101615356565b509495945050505050565b6020815260006109966020830184615342565b6000806000606084860312156153a557600080fd5b83356153b081614d11565b925060208401356153c081614d11565b929592945050506040919091013590565b6000806000606084860312156153e657600080fd5b83359250602084013591506153fd60408501614e31565b90509250925092565b60008060006060848603121561541b57600080fd5b83359250602084013561542d81614d11565b9150604084013561543d81614d11565b809150509250925092565b60008060008060006080868803121561546057600080fd5b853567ffffffffffffffff81111561547757600080fd5b61548388828901614e7a565b909650945050602086013561549781614d11565b92506154a56040870161524a565b915060608601356154b581614d11565b809150509295509295909350565b801515811461259357600080fd5b600080604083850312156154e457600080fd5b82356154ef81614d11565b91506020830135614e26816154c3565b60008060008060008060a0878903121561551857600080fd5b863567ffffffffffffffff81111561552f57600080fd5b61553b89828a01614e7a565b909750955050602087013561554f81614d11565b935060408701359250606087013561556681614d11565b91506155746080880161524a565b90509295509295509295565b6000806040838503121561559357600080fd5b82359150614e716020840161501a565b600080604083850312156155b657600080fd5b50508035926020909101359150565b60008060008060008060a087890312156155de57600080fd5b86359550602087013567ffffffffffffffff8111156155fc57600080fd5b61560889828a01614e7a565b909650945050604087013561561c81614d11565b925061562a6060880161501a565b915061557460808801614e31565b6000806000806040858703121561564e57600080fd5b843567ffffffffffffffff8082111561566657600080fd5b61567288838901614e7a565b9096509450602087013591508082111561568b57600080fd5b5061569887828801614e7a565b95989497509550505050565b600080600080608085870312156156ba57600080fd5b8435935060208501356156cc81614d11565b9250604085013561523181614d11565b6000806000606084860312156156f157600080fd5b8335925060208401359150604084013561543d81614d11565b6000806040838503121561571d57600080fd5b823561572881614d11565b91506020830135614e2681614d11565b6000806000806060858703121561574e57600080fd5b843567ffffffffffffffff81111561576557600080fd5b61577187828801614e7a565b909550935050602085013561578581614d11565b9150604085013561579581614d11565b939692955090935050565b600080600080600060a086880312156157b857600080fd5b85356157c381614d11565b945060208601356157d381614d11565b93506040860135925060608601359150608086013567ffffffffffffffff8111156157fd57600080fd5b6151f788828901614fbe565b60006020828403121561581b57600080fd5b815167ffffffffffffffff81111561583257600080fd5b8201601f8101841361584357600080fd5b805161584e81614f96565b60405161585b8282614f69565b82815286602084860101111561587057600080fd5b610a73836020830160208701614d9e565b6000806000806080858703121561589757600080fd5b843567ffffffffffffffff8111156158ae57600080fd5b6158ba87828801614fbe565b94505060208501356158cb81614d11565b92506158d96040860161524a565b9150606085013561579581614d11565b6000602082840312156158fb57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b67ffffffffffffffff81811683821601908082111561593957615939615902565b5092915050565b600181811c9082168061595457607f821691505b60208210810361597457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b6000600182016159a2576159a2615902565b5060010190565b6040815260006159bc6040830185615342565b82810360208401526159ce8185615342565b95945050505050565b6000602082840312156159e957600080fd5b815161099681614d11565b600060208284031215615a0657600080fd5b8151610996816154c3565b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60c081526000615a5e60c083018a8c615a21565b6001600160a01b03898116602085015263ffffffff8916604085015267ffffffffffffffff881660608501528616608084015282810360a0840152615aa4818587615a21565b9b9a5050505050505050505050565b601f8211156109de57600081815260208120601f850160051c81016020861015615ada5750805b601f850160051c820191505b81811015613bc157828155600101615ae6565b67ffffffffffffffff831115615b1157615b11614f53565b615b2583615b1f8354615940565b83615ab3565b6000601f841160018114615b595760008515615b415750838201355b600019600387901b1c1916600186901b1783556114d7565b600083815260209020601f19861690835b82811015615b8a5786850135825560209485019460019092019101615b6a565b5086821015615ba75760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b67ffffffffffffffff82811682821603908082111561593957615939615902565b815167ffffffffffffffff811115615bf457615bf4614f53565b615c0881615c028454615940565b84615ab3565b602080601f831160018114615c3d5760008415615c255750858301515b600019600386901b1c1916600185901b178555613bc1565b600085815260208120601f198616915b82811015615c6c57888601518255948401946001909101908401615c4d565b5085821015615c8a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006001600160a01b03808816835280871660208401525060a06040830152615cc660a0830186615342565b8281036060840152615cd88186615342565b90508281036080840152613d038185614dc2565b600060208284031215615cfe57600080fd5b815161099681614d6b565b600060033d1115615d225760046000803e5060005160e01c5b90565b600060443d1015615d335790565b6040516003193d81016004833e81513d67ffffffffffffffff8160248401118184111715615d6357505050505090565b8285019150815181811115615d7b5750505050505090565b843d8701016020828501011115615d955750505050505090565b615da460208286010187614f69565b509095945050505050565b608081526000615dc26080830187614dc2565b6001600160a01b039590951660208301525063ffffffff92909216604083015267ffffffffffffffff16606090910152919050565b818103818111156108c9576108c9615902565b808201808211156108c9576108c9615902565b7fff000000000000000000000000000000000000000000000000000000000000008460f81b16815260008351615e5a816001850160208801614d9e565b835190830190615e71816001840160208801614d9e565b0160010195945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152615eb660a0830184614dc2565b97965050505050505056fea2646970667358221220b34edd142e79d31ecd46439dfe608974c9a1ee38739d18efbd601b45bdd6973764736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061031f5760003560e01c80636352211e116101a7578063c93ab3fd116100ee578063e985e9c511610097578063f242432a11610071578063f242432a146107d7578063f2fde38b146107ea578063fd0cd0d9146107fd57600080fd5b8063e985e9c514610768578063eb8ae530146107a4578063ed70554d146107b757600080fd5b8063d9a50c12116100c8578063d9a50c121461071f578063da8c229e14610732578063e0dba60f1461075557600080fd5b8063c93ab3fd146106e6578063cf408823146106f9578063d8c9921a1461070c57600080fd5b8063a22cb46511610150578063b6bcad261161012a578063b6bcad26146106ad578063c475abff146106c0578063c658e086146106d357600080fd5b8063a22cb46514610674578063a401498214610687578063adf4960a1461069a57600080fd5b80638b4dfa75116101815780638b4dfa751461063d5780638cf8b41e146106505780638da5cb5b1461066357600080fd5b80636352211e146105f65780636e5d6ad214610609578063715018a61461063557600080fd5b80631f4e15041161026b5780633f15457f116102145780634e1273f4116101ee5780634e1273f4146105b057806353095467146105d05780635d3590d5146105e357600080fd5b80633f15457f1461054e578063402906fc1461057557806341415eab1461059d57600080fd5b80632b20e397116102455780632b20e397146105015780632eb2c2d61461052857806333c69ea91461053b57600080fd5b80631f4e1504146104c857806320c38e2b146104db57806324c1af44146104ee57600080fd5b80630e4cd725116102cd578063150b7a02116102a7578063150b7a02146104765780631534e177146104a25780631896f70a146104b557600080fd5b80630e4cd7251461043d5780630e89341c1461045057806314ab90381461046357600080fd5b806306fdde03116102fe57806306fdde03146103b4578063081812fc146103fd578063095ea7b31461042857600080fd5b8062fdd58e146103245780630178fe3f1461034a57806301ffc9a714610391575b600080fd5b610337610332366004614d26565b610810565b6040519081526020015b60405180910390f35b61035d610358366004614d52565b6108cf565b604080516001600160a01b03909416845263ffffffff909216602084015267ffffffffffffffff1690820152606001610341565b6103a461039f366004614d81565b6108ff565b6040519015158152602001610341565b6103f06040518060400160405280600b81526020017f4e616d655772617070657200000000000000000000000000000000000000000081525081565b6040516103419190614dee565b61041061040b366004614d52565b610958565b6040516001600160a01b039091168152602001610341565b61043b610436366004614d26565b61099d565b005b6103a461044b366004614e01565b6109e3565b6103f061045e366004614d52565b610a7d565b61043b610471366004614e4e565b610aef565b610489610484366004614ec3565b610c08565b6040516001600160e01b03199091168152602001610341565b61043b6104b0366004614f36565b610e1a565b61043b6104c3366004614e01565b610e44565b600754610410906001600160a01b031681565b6103f06104e9366004614d52565b610f06565b6103376104fc36600461502e565b610fa0565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b61043b610536366004615156565b6111b4565b61043b610549366004615204565b6114de565b6104107f000000000000000000000000000000000000000000000000000000000000000081565b61058861058336600461525c565b6116d3565b60405163ffffffff9091168152602001610341565b6103a46105ab366004614e01565b611775565b6105c36105be36600461527f565b6117d2565b604051610341919061537d565b600554610410906001600160a01b031681565b61043b6105f1366004615390565b611910565b610410610604366004614d52565b6119aa565b61061c6106173660046153d1565b6119b5565b60405167ffffffffffffffff9091168152602001610341565b61043b611b0a565b61043b61064b366004615406565b611b1e565b61061c61065e366004615448565b611cc8565b6000546001600160a01b0316610410565b61043b6106823660046154d1565b612094565b6103376106953660046154ff565b61217e565b6103a46106a8366004615580565b612319565b61043b6106bb366004614f36565b61233e565b6103376106ce3660046155a3565b612596565b6103376106e13660046155c5565b61288d565b61043b6106f4366004615638565b612a9a565b61043b6107073660046156a4565b612c0b565b61043b61071a3660046156dc565b612dc4565b6103a461072d3660046155a3565b612ed4565b6103a4610740366004614f36565b60046020526000908152604090205460ff1681565b61043b6107633660046154d1565b612fe1565b6103a461077636600461570a565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b61043b6107b2366004615738565b613049565b6103376107c5366004614d52565b60016020526000908152604090205481565b61043b6107e53660046157a0565b613414565b61043b6107f8366004614f36565b613531565b6103a461080b366004614d52565b6135be565b60006001600160a01b0383166108935760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084015b60405180910390fd5b600061089e836119aa565b9050836001600160a01b0316816001600160a01b0316036108c35760019150506108c9565b60009150505b92915050565b60008181526001602052604090205460a081901c60c082901c6108f3838383613696565b90959094509092509050565b60006001600160e01b031982167fd82c42d800000000000000000000000000000000000000000000000000000000148061094957506001600160e01b03198216630a85bd0160e11b145b806108c957506108c9826136cd565b600080610964836119aa565b90506001600160a01b03811661097d5750600092915050565b6000838152600360205260409020546001600160a01b03165b9392505050565b60006109a8826108cf565b50915050603f1960408216016109d45760405163a2a7201360e01b81526004810183905260240161088a565b6109de838361374f565b505050565b60008080806109f1866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a3c57506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff165b80610a6057506001600160a01b038516610a5587610958565b6001600160a01b0316145b8015610a735750610a718282613899565b155b9695505050505050565b6005546040516303a24d0760e21b8152600481018390526060916001600160a01b031690630e89341c90602401600060405180830381865afa158015610ac7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108c99190810190615809565b81610afa8133611775565b610b205760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260106000610b2e836108cf565b5091505063ffffffff8282161615610b5c5760405163a2a7201360e01b81526004810184905260240161088a565b6040517f14ab90380000000000000000000000000000000000000000000000000000000081526004810187905267ffffffffffffffff861660248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906314ab9038906044015b600060405180830381600087803b158015610be857600080fd5b505af1158015610bfc573d6000803e3d6000fd5b50505050505050505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610c6c576040517f1931a53800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080610c7d86880188615881565b83516020850120939750919550935091508890808214610cd3576040517fc65c3ccc000000000000000000000000000000000000000000000000000000008152600481018290526024810183905260440161088a565b604051630a3b53db60e21b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906328ed4f6c90604401600060405180830381600087803b158015610d3b57600080fd5b505af1158015610d4f573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018d9052600092506276a70091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d6e4fa8690602401602060405180830381865afa158015610dc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de491906158e9565b610dee9190615918565b9050610e0187878761ffff1684886138ca565b50630a85bd0160e11b9c9b505050505050505050505050565b610e22613a30565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b81610e4f8133611775565b610e755760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8260086000610e83836108cf565b5091505063ffffffff8282161615610eb15760405163a2a7201360e01b81526004810184905260240161088a565b604051630c4b7b8560e11b8152600481018790526001600160a01b0386811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401610bce565b60066020526000908152604090208054610f1f90615940565b80601f0160208091040260200160405190810160405280929190818152602001828054610f4b90615940565b8015610f985780601f10610f6d57610100808354040283529160200191610f98565b820191906000526020600020905b815481529060010190602001808311610f7b57829003601f168201915b505050505081565b600087610fad8133611775565b610fd35760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8751602089012061100b8a82604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506110178a84613a8a565b6110218386613bc9565b61102c8a848b613bfc565b506110398a848787613cc9565b935061104483613d0f565b6110fa576040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b1580156110cf57600080fd5b505af11580156110e3573d6000803e3d6000fd5b505050506110f58a848b8b8989613dc8565b6111a7565b6040516305ef2c7f60e41b8152600481018b9052602481018290523060448201526001600160a01b03888116606483015267ffffffffffffffff881660848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561118157600080fd5b505af1158015611195573d6000803e3d6000fd5b505050506111a78a848b8b8989613dff565b5050979650505050505050565b815183511461122b5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060448201527f6d69736d61746368000000000000000000000000000000000000000000000000606482015260840161088a565b6001600160a01b03841661128f5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b0385163314806112c957506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b61133b5760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000606482015260840161088a565b60005b835181101561147157600084828151811061135b5761135b61597a565b6020026020010151905060008483815181106113795761137961597a565b602002602001015190506000806000611391856108cf565b9250925092506113a2858383613ec3565b8360011480156113c357508a6001600160a01b0316836001600160a01b0316145b6114225760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b60008581526001602052604090206001600160a01b038b1663ffffffff60a01b60a085901b16176001600160c01b031960c084901b1617905550505050508061146a90615990565b905061133e565b50836001600160a01b0316856001600160a01b0316336001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516114c19291906159a9565b60405180910390a46114d7338686868686613fb0565b5050505050565b604080516020808201879052818301869052825180830384018152606090920190925280519101206115108184613bc9565b6000808061151d846108cf565b919450925090506001600160a01b03831615806115cc57506040516302571be360e01b81526004810185905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa15801561159c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c091906159d7565b6001600160a01b031614155b156115ea57604051635374b59960e01b815260040160405180910390fd5b6000806115f68a6108cf565b90935091508a90506116375761160c8633611775565b6116325760405163168ab55d60e31b81526004810187905233602482015260440161088a565b611667565b6116418a33611775565b6116675760405163168ab55d60e31b8152600481018b905233602482015260440161088a565b611672868984614155565b61167d878483614190565b9650620100008416158015906116a157508363ffffffff1688851763ffffffff1614155b156116c25760405163a2a7201360e01b81526004810187905260240161088a565b96831796610bfc86868a868b6141da565b6000826116e08133611775565b6117065760405163168ab55d60e31b81526004810182905233602482015260440161088a565b8360026000611714836108cf565b5091505063ffffffff82821616156117425760405163a2a7201360e01b81526004810184905260240161088a565b6000808061174f8a6108cf565b9250925092506117688a84848c61ffff161784856141da565b5098975050505050505050565b6000808080611783866108cf565b925092509250846001600160a01b0316836001600160a01b03161480610a6057506001600160a01b0380841660009081526002602090815260408083209389168352929052205460ff16610a60565b6060815183511461184b5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d617463680000000000000000000000000000000000000000000000606482015260840161088a565b6000835167ffffffffffffffff81111561186757611867614f53565b604051908082528060200260200182016040528015611890578160200160208202803683370190505b50905060005b8451811015611908576118db8582815181106118b4576118b461597a565b60200260200101518583815181106118ce576118ce61597a565b6020026020010151610810565b8282815181106118ed576118ed61597a565b602090810291909101015261190181615990565b9050611896565b509392505050565b611918613a30565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015611980573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a491906159f4565b50505050565b60006108c982614284565b604080516020808201869052818301859052825180830384018152606090920190925280519101206000906119e981613d0f565b611a0657604051635374b59960e01b815260040160405180910390fd5b6000611a1286336109e3565b905080158015611a295750611a278233611775565b155b15611a505760405163168ab55d60e31b81526004810183905233602482015260440161088a565b60008080611a5d856108cf565b92509250925083158015611a745750620400008216155b15611a955760405163a2a7201360e01b81526004810186905260240161088a565b6000611aa08a6108cf565b92505050611aaf888383614190565b9750611abd8685858b61429a565b60405167ffffffffffffffff8916815286907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b1329060200160405180910390a2509598975050505050505050565b611b12613a30565b611b1c60006142e2565b565b604080517f4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a2745460208083019190915281830186905282518083038401815260609092019092528051910120611b728133611775565b611b985760405163168ab55d60e31b81526004810182905233602482015260440161088a565b306001600160a01b03841603611bcc57604051632ca49b0d60e11b81526001600160a01b038416600482015260240161088a565b604080517f4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a2745460208083019190915281830187905282518083038401815260609092019092528051910120611c21905b83614332565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038481166024830152604482018690527f000000000000000000000000000000000000000000000000000000000000000016906342842e0e90606401600060405180830381600087803b158015611caa57600080fd5b505af1158015611cbe573d6000803e3d6000fd5b5050505050505050565b6000808686604051611cdb929190615a11565b6040519081900381206331a9108f60e11b82526004820181905291506000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611d4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6f91906159d7565b90506001600160a01b0381163314801590611e17575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015611df1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e1591906159f4565b155b15611e8757604080517f4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a274546020808301919091528183018590528251808303840181526060830193849052805191012063168ab55d60e31b909252606481019190915233608482015260a40161088a565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152306024830152604482018490527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90606401600060405180830381600087803b158015611f1057600080fd5b505af1158015611f24573d6000803e3d6000fd5b5050604051630a3b53db60e21b8152600481018590523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506328ed4f6c9150604401600060405180830381600087803b158015611f9057600080fd5b505af1158015611fa4573d6000803e3d6000fd5b5050604051636b727d4360e11b8152600481018590526276a70092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316915063d6e4fa8690602401602060405180830381865afa158015612012573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203691906158e9565b6120409190615918565b925061208988888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff881686886138ca565b505095945050505050565b6001600160a01b03821633036121125760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c660000000000000000000000000000000000000000000000606482015260840161088a565b3360008181526002602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b3360009081526004602052604081205460ff166121ee5760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f604482015267373a3937b63632b960c11b606482015260840161088a565b60008787604051612200929190615a11565b6040519081900381207ffca247ac000000000000000000000000000000000000000000000000000000008252600482018190523060248301526044820187905291507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fca247ac906064016020604051808303816000875af1158015612295573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b991906158e9565b915061230e88888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250505061ffff86166123086276a70087615918565b886138ca565b509695505050505050565b600080612325846108cf565b50841663ffffffff908116908516149250505092915050565b612346613a30565b6007546001600160a01b0316156124665760075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156123c657600080fd5b505af11580156123da573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600060248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561244d57600080fd5b505af1158015612461573d6000803e3d6000fd5b505050505b600780546001600160a01b0319166001600160a01b038316908117909155156125935760075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f00000000000000000000000000000000000000000000000000000000000000009091169063a22cb46590604401600060405180830381600087803b1580156124f857600080fd5b505af115801561250c573d6000803e3d6000fd5b505060075460405163a22cb46560e01b81526001600160a01b039182166004820152600160248201527f0000000000000000000000000000000000000000000000000000000000000000909116925063a22cb4659150604401600060405180830381600087803b15801561257f57600080fd5b505af11580156114d7573d6000803e3d6000fd5b50565b3360009081526004602052604081205460ff166126065760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f604482015267373a3937b63632b960c11b606482015260840161088a565b604080517f4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454602080830191909152818301869052825180830384018152606090920190925280519101206000906040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101869052602481018590529091506000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c475abff906044016020604051808303816000875af11580156126e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061270491906158e9565b6040516331a9108f60e11b8152600481018790529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa925050508015612788575060408051601f3d908101601f19168201909252612785918101906159d7565b60015b6127955791506108c99050565b6001600160a01b0381163014158061283f57506040516302571be360e01b81526004810184905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa15801561280f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061283391906159d7565b6001600160a01b031614155b1561284e575091506108c99050565b50600061285e6276a70083615918565b60008481526001602052604090205490915060a081901c6128818583838661429a565b50919695505050505050565b60008661289a8133611775565b6128c05760405163168ab55d60e31b81526004810182905233602482015260440161088a565b600087876040516128d2929190615a11565b6040518091039020905061290d8982604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b92506129198984613a8a565b6129238386613bc9565b60006129668a858b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613bfc92505050565b90506129748a858888613cc9565b945061297f84613d0f565b612a47576040517f06ab5923000000000000000000000000000000000000000000000000000000008152600481018b9052602481018390523060448201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906306ab5923906064016020604051808303816000875af1158015612a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a3491906158e9565b50612a428482898989614424565b612a8d565b612a8d8a858b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d92508c91508b9050613dff565b5050509695505050505050565b6000612ae0600086868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506144669050565b6007549091506001600160a01b0316612b25576040517f24c1d6d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612b2f8133611775565b612b555760405163168ab55d60e31b81526004810182905233602482015260440161088a565b60008080612b62846108cf565b919450925090506000612b7485610958565b9050612b7f85614525565b600760009054906101000a90046001600160a01b03166001600160a01b0316639198c2768a8a878787878e8e6040518963ffffffff1660e01b8152600401612bce989796959493929190615a4a565b600060405180830381600087803b158015612be857600080fd5b505af1158015612bfc573d6000803e3d6000fd5b50505050505050505050505050565b83612c168133611775565b612c3c5760405163168ab55d60e31b81526004810182905233602482015260440161088a565b84601c6000612c4a836108cf565b5091505063ffffffff8282161615612c785760405163a2a7201360e01b81526004810184905260240161088a565b6040517fcf408823000000000000000000000000000000000000000000000000000000008152600481018990523060248201526001600160a01b03878116604483015267ffffffffffffffff871660648301527f0000000000000000000000000000000000000000000000000000000000000000169063cf40882390608401600060405180830381600087803b158015612d1157600080fd5b505af1158015612d25573d6000803e3d6000fd5b5050506001600160a01b0388169050612d8c576000612d43896108cf565b509150506201ffff1962020000821601612d7b57604051632ca49b0d60e11b81526001600160a01b038916600482015260240161088a565b612d86896000614332565b50611cbe565b6000612d97896119aa565b9050612db981898b60001c6001604051806020016040528060008152506145e7565b505050505050505050565b60408051602080820186905281830185905282518083038401815260609092019092528051910120612df68133611775565b612e1c5760405163168ab55d60e31b81526004810182905233602482015260440161088a565b7fb0d3f037c2e8a3bdc2aa220d010c464c750b86053c524bd504fd887c685d8bac8401612e5c5760405163615a470360e01b815260040160405180910390fd5b6001600160a01b0382161580612e7a57506001600160a01b03821630145b15612ea357604051632ca49b0d60e11b81526001600160a01b038316600482015260240161088a565b604080516020808201879052818301869052825180830384018152606090920190925280519101206119a490611c1b565b604080516020808201859052818301849052825180830384018152606090920190925280519101206000906000612f0a82613d0f565b90507f4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a274548514612f3c5791506108c99050565b6040516331a9108f60e11b8152600481018590527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa925050508015612fbd575060408051601f3d908101601f19168201909252612fba918101906159d7565b60015b612fcc576000925050506108c9565b6001600160a01b0316301492506108c9915050565b612fe9613a30565b6001600160a01b038216600081815260046020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf8791015b60405180910390a25050565b600080613090600087878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506147399050565b9150915060006130d98288888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506144669050565b604080516020808201849052818301879052825180830384018152606090920190925280519101209091506000906000818152600660205260409020909150613123888a83615af9565b507fb0d3f037c2e8a3bdc2aa220d010c464c750b86053c524bd504fd887c685d8bac82016131645760405163615a470360e01b815260040160405180910390fd5b6040516302571be360e01b8152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa1580156131cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131f091906159d7565b90506001600160a01b0381163314801590613298575060405163e985e9c560e01b81526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015613272573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061329691906159f4565b155b156132bf5760405163168ab55d60e31b81526004810183905233602482015260440161088a565b6001600160a01b0386161561335157604051630c4b7b8560e11b8152600481018390526001600160a01b0387811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b15801561333857600080fd5b505af115801561334c573d6000803e3d6000fd5b505050505b604051635b0fc9c360e01b8152600481018390523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635b0fc9c390604401600060405180830381600087803b1580156133b957600080fd5b505af11580156133cd573d6000803e3d6000fd5b50505050612db9828a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508d93509150819050614424565b6001600160a01b0384166134785760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161088a565b6001600160a01b0385163314806134b257506001600160a01b038516600090815260026020908152604080832033845290915290205460ff165b6135245760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201527f20617070726f7665640000000000000000000000000000000000000000000000606482015260840161088a565b6114d785858585856145e7565b613539613a30565b6001600160a01b0381166135b55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161088a565b612593816142e2565b600081815260066020526040812080548291906135da90615940565b80601f016020809104026020016040519081016040528092919081815260200182805461360690615940565b80156136535780601f1061362857610100808354040283529160200191613653565b820191906000526020600020905b81548152906001019060200180831161363657829003601f168201915b50505050509050805160000361366c5750600092915050565b6000806136798382614739565b9092509050600061368a8483614466565b9050610a738184612ed4565b600080428367ffffffffffffffff1610156136c45761ffff19620100008516016136bf57600094505b600093505b50929391925050565b60006001600160e01b031982167fd9b67a2600000000000000000000000000000000000000000000000000000000148061371757506001600160e01b031982166303a24d0760e21b145b806108c957507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146108c9565b600061375a826119aa565b9050806001600160a01b0316836001600160a01b0316036137e35760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f7200000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b336001600160a01b038216148061381d57506001600160a01b038116600090815260026020908152604080832033845290915290205460ff165b61388f5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161088a565b6109de83836147f0565b6000620200008381161480156109965750426138b86276a70084615bb9565b67ffffffffffffffff16109392505050565b8451602086012060006139247f4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a2745483604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b90506000613967886040518060400160405280600981526020017f0763726561746f7200000000000000000000000000000000000000000000000081525061485e565b60008381526006602052604090209091506139828282615bda565b50613995828289620300008a1789614424565b6001600160a01b03841615611cbe57604051630c4b7b8560e11b8152600481018390526001600160a01b0385811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631896f70a90604401600060405180830381600087803b158015613a0e57600080fd5b505af1158015613a22573d6000803e3d6000fd5b505050505050505050505050565b6000546001600160a01b03163314611b1c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161088a565b60008080613a97846108cf565b919450925090504267ffffffffffffffff821610808015613b5b57506001600160a01b0384161580613b5b57506040516302571be360e01b8152600481018690526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b5091906159d7565b6001600160a01b0316145b15613b9a576000613b6b876108cf565b509150506020811615613b945760405163a2a7201360e01b81526004810187905260240161088a565b50613bc1565b62010000831615613bc15760405163a2a7201360e01b81526004810186905260240161088a565b505050505050565b63fffdffff81811763ffffffff1614613bf85760405163a2a7201360e01b81526004810183905260240161088a565b5050565b60606000613ca583600660008881526020019081526020016000208054613c2290615940565b80601f0160208091040260200160405190810160405280929190818152602001828054613c4e90615940565b8015613c9b5780601f10613c7057610100808354040283529160200191613c9b565b820191906000526020600020905b815481529060010190602001808311613c7e57829003601f168201915b505050505061485e565b6000858152600660205260409020909150613cc08282615bda565b50949350505050565b600080613cd5856108cf565b92505050600080613ce88860001c6108cf565b9250925050613cf8878784614155565b613d03858483614190565b98975050505050505050565b600080613d1b836119aa565b6001600160a01b0316141580156108c957506040516302571be360e01b81526004810183905230906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906302571be390602401602060405180830381865afa158015613d94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613db891906159d7565b6001600160a01b03161492915050565b60008681526006602052604081208054613de7918791613c2290615940565b9050613df68682868686614424565b50505050505050565b60008080613e0c886108cf565b9250925092506000613e3688600660008d81526020019081526020016000208054613c2290615940565b60008a8152600660205260409020805491925090613e5390615940565b9050600003613e76576000898152600660205260409020613e748282615bda565b505b613e85898588861785896141da565b6001600160a01b038716613ea357613e9e896000614332565b610bfc565b610bfc84888b60001c6001604051806020016040528060008152506145e7565b6201ffff1962020000831601613ee357613ee06276a70082615bb9565b90505b428167ffffffffffffffff161015613f605762010000821615613f5b5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b613f85565b6004821615613f855760405163a2a7201360e01b81526004810184905260240161088a565b604082166000036109de575050600090815260036020526040902080546001600160a01b0319169055565b6001600160a01b0384163b15613bc15760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190613ff49089908990889088908890600401615c9a565b6020604051808303816000875af192505050801561402f575060408051601f3d908101601f1916820190925261402c91810190615cec565b60015b6140e45761403b615d09565b806308c379a003614074575061404f615d25565b8061405a5750614076565b8060405162461bcd60e51b815260040161088a9190614dee565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560448201527f526563656976657220696d706c656d656e746572000000000000000000000000606482015260840161088a565b6001600160e01b0319811663bc197c8160e01b14613df65760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161088a565b63ffff0000821615801590600183161590829061416f5750805b156114d75760405163a2a7201360e01b81526004810186905260240161088a565b60008167ffffffffffffffff168467ffffffffffffffff1611156141b2578193505b8267ffffffffffffffff168467ffffffffffffffff1610156141d2578293505b509192915050565b6141e68585858461429a565b60405163ffffffff8416815285907f39873f00c80f4f94b7bd1594aebcf650f003545b74824d57ddf4939e3ff3a34b9060200160405180910390a28167ffffffffffffffff168167ffffffffffffffff1611156114d75760405167ffffffffffffffff8216815285907ff675815a0817338f93a7da433f6bd5f5542f1029b11b455191ac96c7f6a9b132906020015b60405180910390a25050505050565b600080614290836108cf565b5090949350505050565b6142a48483614907565b60008481526001602052604090206001600160a01b03841663ffffffff60a01b60a085901b16176001600160c01b031960c084901b161790556119a4565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61433d826001612319565b1561435e5760405163a2a7201360e01b81526004810183905260240161088a565b61436782614525565b604051635b0fc9c360e01b8152600481018390526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b1580156143d157600080fd5b505af11580156143e5573d6000803e3d6000fd5b50506040516001600160a01b03841681528492507fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c4915060200161303d565b61443085848484614940565b847f8ce7013e8abebc55c3890a68f5a27c67c3f7efa64e584de5fb22363c606fd340858585856040516142759493929190615daf565b60008060006144758585614739565b9092509050816144e7576001855161448d9190615df7565b84146144db5760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d65000000604482015260640161088a565b50600091506108c99050565b6144f18582614466565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b60008181526001602052604090205460a081901c60c082901c614549838383613696565b600086815260036020908152604080832080546001600160a01b03191690556001909152902063ffffffff60a01b60a083901b166001600160c01b031960c086901b1617905592506145989050565b60408051858152600160208201526000916001600160a01b0386169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a450505050565b60008060006145f5866108cf565b925092509250614606868383613ec3565b8460011480156146275750876001600160a01b0316836001600160a01b0316145b6146865760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161088a565b866001600160a01b0316836001600160a01b0316036146a7575050506114d7565b60008681526001602052604090206001600160a01b03881663ffffffff60a01b60a085901b16176001600160c01b031960c084901b1617905560408051878152602081018790526001600160a01b03808a1692908b169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611cbe3389898989896149b4565b6000808351831061478c5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e64730000604482015260640161088a565b60008484815181106147a0576147a061597a565b016020015160f81c905080156147cc576147c5856147bf866001615e0a565b83614ab0565b92506147d1565b600092505b6147db8185615e0a565b6147e6906001615e0a565b9150509250929050565b600081815260036020526040902080546001600160a01b0319166001600160a01b0384169081179091558190614825826119aa565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b606060018351101561489c576040517f280dacb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60ff835111156148da57826040517fe3ba295f00000000000000000000000000000000000000000000000000000000815260040161088a9190614dee565b825183836040516020016148f093929190615e1d565b604051602081830303815290604052905092915050565b61ffff81161580159061491f57506201000181811614155b15613bf85760405163a2a7201360e01b81526004810183905260240161088a565b61494a8483614907565b6000848152600160205260409020546001600160a01b038116156149a85761497185614525565b6040516000815285907fee2ba1195c65bcf218a83d874335c6bf9d9067b4c672f3c3bf16cf40de7586c49060200160405180910390a25b6114d785858585614ad4565b6001600160a01b0384163b15613bc15760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906149f89089908990889088908890600401615e7e565b6020604051808303816000875af1925050508015614a33575060408051601f3d908101601f19168201909252614a3091810190615cec565b60015b614a3f5761403b615d09565b6001600160e01b0319811663f23a6e6160e01b14613df65760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161088a565b8251600090614abf8385615e0a565b1115614aca57600080fd5b5091016020012090565b8360008080614ae2846108cf565b9194509250905063ffff0000821667ffffffffffffffff8087169083161115614b09578195505b428267ffffffffffffffff1610614b1f57958617955b6001600160a01b03841615614b765760405162461bcd60e51b815260206004820152601f60248201527f455243313135353a206d696e74206f66206578697374696e6720746f6b656e00604482015260640161088a565b6001600160a01b038816614bf25760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161088a565b306001600160a01b03891603614c705760405162461bcd60e51b815260206004820152603460248201527f455243313135353a206e65774f776e65722063616e6e6f74206265207468652060448201527f4e616d655772617070657220636f6e7472616374000000000000000000000000606482015260840161088a565b60008581526001602052604090206001600160a01b03891663ffffffff60a01b60a08a901b16176001600160c01b031960c089901b1617905560408051868152600160208201526001600160a01b038a169160009133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4612db93360008a886001604051806020016040528060008152506149b4565b6001600160a01b038116811461259357600080fd5b60008060408385031215614d3957600080fd5b8235614d4481614d11565b946020939093013593505050565b600060208284031215614d6457600080fd5b5035919050565b6001600160e01b03198116811461259357600080fd5b600060208284031215614d9357600080fd5b813561099681614d6b565b60005b83811015614db9578181015183820152602001614da1565b50506000910152565b60008151808452614dda816020860160208601614d9e565b601f01601f19169290920160200192915050565b6020815260006109966020830184614dc2565b60008060408385031215614e1457600080fd5b823591506020830135614e2681614d11565b809150509250929050565b803567ffffffffffffffff81168114614e4957600080fd5b919050565b60008060408385031215614e6157600080fd5b82359150614e7160208401614e31565b90509250929050565b60008083601f840112614e8c57600080fd5b50813567ffffffffffffffff811115614ea457600080fd5b602083019150836020828501011115614ebc57600080fd5b9250929050565b600080600080600060808688031215614edb57600080fd5b8535614ee681614d11565b94506020860135614ef681614d11565b935060408601359250606086013567ffffffffffffffff811115614f1957600080fd5b614f2588828901614e7a565b969995985093965092949392505050565b600060208284031215614f4857600080fd5b813561099681614d11565b634e487b7160e01b600052604160045260246000fd5b601f8201601f1916810167ffffffffffffffff81118282101715614f8f57614f8f614f53565b6040525050565b600067ffffffffffffffff821115614fb057614fb0614f53565b50601f01601f191660200190565b600082601f830112614fcf57600080fd5b8135614fda81614f96565b604051614fe78282614f69565b828152856020848701011115614ffc57600080fd5b82602086016020830137600092810160200192909252509392505050565b803563ffffffff81168114614e4957600080fd5b600080600080600080600060e0888a03121561504957600080fd5b87359650602088013567ffffffffffffffff81111561506757600080fd5b6150738a828b01614fbe565b965050604088013561508481614d11565b9450606088013561509481614d11565b93506150a260808901614e31565b92506150b060a0890161501a565b91506150be60c08901614e31565b905092959891949750929550565b600067ffffffffffffffff8211156150e6576150e6614f53565b5060051b60200190565b600082601f83011261510157600080fd5b8135602061510e826150cc565b60405161511b8282614f69565b83815260059390931b850182019282810191508684111561513b57600080fd5b8286015b8481101561230e578035835291830191830161513f565b600080600080600060a0868803121561516e57600080fd5b853561517981614d11565b9450602086013561518981614d11565b9350604086013567ffffffffffffffff808211156151a657600080fd5b6151b289838a016150f0565b945060608801359150808211156151c857600080fd5b6151d489838a016150f0565b935060808801359150808211156151ea57600080fd5b506151f788828901614fbe565b9150509295509295909350565b6000806000806080858703121561521a57600080fd5b84359350602085013592506152316040860161501a565b915061523f60608601614e31565b905092959194509250565b803561ffff81168114614e4957600080fd5b6000806040838503121561526f57600080fd5b82359150614e716020840161524a565b6000806040838503121561529257600080fd5b823567ffffffffffffffff808211156152aa57600080fd5b818501915085601f8301126152be57600080fd5b813560206152cb826150cc565b6040516152d88282614f69565b83815260059390931b85018201928281019150898411156152f857600080fd5b948201945b8386101561531f57853561531081614d11565b825294820194908201906152fd565b9650508601359250508082111561533557600080fd5b506147e6858286016150f0565b600081518084526020808501945080840160005b8381101561537257815187529582019590820190600101615356565b509495945050505050565b6020815260006109966020830184615342565b6000806000606084860312156153a557600080fd5b83356153b081614d11565b925060208401356153c081614d11565b929592945050506040919091013590565b6000806000606084860312156153e657600080fd5b83359250602084013591506153fd60408501614e31565b90509250925092565b60008060006060848603121561541b57600080fd5b83359250602084013561542d81614d11565b9150604084013561543d81614d11565b809150509250925092565b60008060008060006080868803121561546057600080fd5b853567ffffffffffffffff81111561547757600080fd5b61548388828901614e7a565b909650945050602086013561549781614d11565b92506154a56040870161524a565b915060608601356154b581614d11565b809150509295509295909350565b801515811461259357600080fd5b600080604083850312156154e457600080fd5b82356154ef81614d11565b91506020830135614e26816154c3565b60008060008060008060a0878903121561551857600080fd5b863567ffffffffffffffff81111561552f57600080fd5b61553b89828a01614e7a565b909750955050602087013561554f81614d11565b935060408701359250606087013561556681614d11565b91506155746080880161524a565b90509295509295509295565b6000806040838503121561559357600080fd5b82359150614e716020840161501a565b600080604083850312156155b657600080fd5b50508035926020909101359150565b60008060008060008060a087890312156155de57600080fd5b86359550602087013567ffffffffffffffff8111156155fc57600080fd5b61560889828a01614e7a565b909650945050604087013561561c81614d11565b925061562a6060880161501a565b915061557460808801614e31565b6000806000806040858703121561564e57600080fd5b843567ffffffffffffffff8082111561566657600080fd5b61567288838901614e7a565b9096509450602087013591508082111561568b57600080fd5b5061569887828801614e7a565b95989497509550505050565b600080600080608085870312156156ba57600080fd5b8435935060208501356156cc81614d11565b9250604085013561523181614d11565b6000806000606084860312156156f157600080fd5b8335925060208401359150604084013561543d81614d11565b6000806040838503121561571d57600080fd5b823561572881614d11565b91506020830135614e2681614d11565b6000806000806060858703121561574e57600080fd5b843567ffffffffffffffff81111561576557600080fd5b61577187828801614e7a565b909550935050602085013561578581614d11565b9150604085013561579581614d11565b939692955090935050565b600080600080600060a086880312156157b857600080fd5b85356157c381614d11565b945060208601356157d381614d11565b93506040860135925060608601359150608086013567ffffffffffffffff8111156157fd57600080fd5b6151f788828901614fbe565b60006020828403121561581b57600080fd5b815167ffffffffffffffff81111561583257600080fd5b8201601f8101841361584357600080fd5b805161584e81614f96565b60405161585b8282614f69565b82815286602084860101111561587057600080fd5b610a73836020830160208701614d9e565b6000806000806080858703121561589757600080fd5b843567ffffffffffffffff8111156158ae57600080fd5b6158ba87828801614fbe565b94505060208501356158cb81614d11565b92506158d96040860161524a565b9150606085013561579581614d11565b6000602082840312156158fb57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b67ffffffffffffffff81811683821601908082111561593957615939615902565b5092915050565b600181811c9082168061595457607f821691505b60208210810361597457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b6000600182016159a2576159a2615902565b5060010190565b6040815260006159bc6040830185615342565b82810360208401526159ce8185615342565b95945050505050565b6000602082840312156159e957600080fd5b815161099681614d11565b600060208284031215615a0657600080fd5b8151610996816154c3565b8183823760009101908152919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60c081526000615a5e60c083018a8c615a21565b6001600160a01b03898116602085015263ffffffff8916604085015267ffffffffffffffff881660608501528616608084015282810360a0840152615aa4818587615a21565b9b9a5050505050505050505050565b601f8211156109de57600081815260208120601f850160051c81016020861015615ada5750805b601f850160051c820191505b81811015613bc157828155600101615ae6565b67ffffffffffffffff831115615b1157615b11614f53565b615b2583615b1f8354615940565b83615ab3565b6000601f841160018114615b595760008515615b415750838201355b600019600387901b1c1916600186901b1783556114d7565b600083815260209020601f19861690835b82811015615b8a5786850135825560209485019460019092019101615b6a565b5086821015615ba75760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b67ffffffffffffffff82811682821603908082111561593957615939615902565b815167ffffffffffffffff811115615bf457615bf4614f53565b615c0881615c028454615940565b84615ab3565b602080601f831160018114615c3d5760008415615c255750858301515b600019600386901b1c1916600185901b178555613bc1565b600085815260208120601f198616915b82811015615c6c57888601518255948401946001909101908401615c4d565b5085821015615c8a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006001600160a01b03808816835280871660208401525060a06040830152615cc660a0830186615342565b8281036060840152615cd88186615342565b90508281036080840152613d038185614dc2565b600060208284031215615cfe57600080fd5b815161099681614d6b565b600060033d1115615d225760046000803e5060005160e01c5b90565b600060443d1015615d335790565b6040516003193d81016004833e81513d67ffffffffffffffff8160248401118184111715615d6357505050505090565b8285019150815181811115615d7b5750505050505090565b843d8701016020828501011115615d955750505050505090565b615da460208286010187614f69565b509095945050505050565b608081526000615dc26080830187614dc2565b6001600160a01b039590951660208301525063ffffffff92909216604083015267ffffffffffffffff16606090910152919050565b818103818111156108c9576108c9615902565b808201808211156108c9576108c9615902565b7fff000000000000000000000000000000000000000000000000000000000000008460f81b16815260008351615e5a816001850160208801614d9e565b835190830190615e71816001840160208801614d9e565b0160010195945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152615eb660a0830184614dc2565b97965050505050505056fea2646970667358221220b34edd142e79d31ecd46439dfe608974c9a1ee38739d18efbd601b45bdd6973764736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "allFusesBurned(bytes32,uint32)": { + "params": { + "fuseMask": "The fuses you want to check", + "node": "Namehash of the name" + }, + "returns": { + "_0": "Boolean of whether or not all the selected fuses are burned" + } + }, + "approve(address,uint256)": { + "params": { + "to": "address to approve", + "tokenId": "name to approve" + } + }, + "balanceOf(address,uint256)": { + "details": "See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address." + }, + "balanceOfBatch(address[],uint256[])": { + "details": "See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length." + }, + "canExtendSubnames(bytes32,address)": { + "params": { + "addr": "which address to check permissions for", + "node": "namehash of the name to check" + }, + "returns": { + "_0": "whether or not is owner/operator or approved" + } + }, + "canModifyName(bytes32,address)": { + "params": { + "addr": "which address to check permissions for", + "node": "namehash of the name to check" + }, + "returns": { + "_0": "whether or not is owner or operator" + } + }, + "extendExpiry(bytes32,bytes32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "labelhash": "Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')", + "parentNode": "Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')" + }, + "returns": { + "_0": "New expiry" + } + }, + "getApproved(uint256)": { + "params": { + "id": "Namehash of the name" + }, + "returns": { + "operator": "Approved operator of a name" + } + }, + "getData(uint256)": { + "params": { + "id": "Namehash of the name" + }, + "returns": { + "expiry": "Expiry of the name", + "fuses": "Fuses of the name", + "owner": "Owner of the name" + } + }, + "isApprovedForAll(address,address)": { + "details": "See {IERC1155-isApprovedForAll}." + }, + "isWrapped(bytes32)": { + "params": { + "node": "Namehash of the name" + }, + "returns": { + "_0": "Boolean of whether or not the name is wrapped" + } + }, + "isWrapped(bytes32,bytes32)": { + "params": { + "labelhash": "Namehash of the name", + "parentNode": "Namehash of the name" + }, + "returns": { + "_0": "Boolean of whether or not the name is wrapped" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "ownerOf(uint256)": { + "params": { + "id": "Label as a string of the .eth domain to wrap" + }, + "returns": { + "owner": "The owner of the name" + } + }, + "recoverFunds(address,address,uint256)": { + "details": "The contract is Ownable and only the owner can call the recover function.", + "params": { + "_amount": "The amount of tokens to recover.", + "_to": "The address to send the tokens to.", + "_token": "The address of the ERC20 token to recover" + } + }, + "registerAndWrapETH2LD(string,address,uint256,address,uint16)": { + "details": "Registers a new .eth second-level domain and wraps it. Only callable by authorised controllers.", + "params": { + "duration": "The duration, in seconds, to register the name for.", + "label": "The label to register (Eg, 'foo' for 'foo.eth').", + "ownerControlledFuses": "Initial owner-controlled fuses to set", + "resolver": "The resolver address to set on the ENS registry (optional).", + "wrappedOwner": "The owner of the wrapped name." + }, + "returns": { + "registrarExpiry": "The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch." + } + }, + "renew(uint256,uint256)": { + "details": "Only callable by authorised controllers.", + "params": { + "duration": "The number of seconds to renew the name for.", + "tokenId": "The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth')." + }, + "returns": { + "expires": "The expiry date of the name on the .eth registrar, in seconds since the Unix epoch." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)": { + "details": "See {IERC1155-safeBatchTransferFrom}." + }, + "safeTransferFrom(address,address,uint256,uint256,bytes)": { + "details": "See {IERC1155-safeTransferFrom}." + }, + "setApprovalForAll(address,bool)": { + "details": "See {IERC1155-setApprovalForAll}." + }, + "setChildFuses(bytes32,bytes32,uint32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "fuses": "Fuses to burn", + "labelhash": "Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')", + "parentNode": "Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')" + } + }, + "setFuses(bytes32,uint16)": { + "params": { + "node": "Namehash of the name", + "ownerControlledFuses": "Owner-controlled fuses to burn" + }, + "returns": { + "_0": "Old fuses" + } + }, + "setMetadataService(address)": { + "params": { + "_metadataService": "The new metadata service" + } + }, + "setRecord(bytes32,address,address,uint64)": { + "params": { + "node": "Namehash of the name to set a record for", + "owner": "New owner in the registry", + "resolver": "Resolver contract", + "ttl": "Time to live in the registry" + } + }, + "setResolver(bytes32,address)": { + "params": { + "node": "namehash of the name", + "resolver": "the resolver contract" + } + }, + "setSubnodeOwner(bytes32,string,address,uint32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "fuses": "Initial fuses for the wrapped subdomain", + "label": "Label of the subdomain as a string", + "owner": "New owner in the wrapper", + "parentNode": "Parent namehash of the subdomain" + }, + "returns": { + "node": "Namehash of the subdomain" + } + }, + "setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)": { + "params": { + "expiry": "When the name will expire in seconds since the Unix epoch", + "fuses": "initial fuses for the wrapped subdomain", + "label": "label of the subdomain as a string", + "owner": "new owner in the wrapper", + "parentNode": "parent namehash of the subdomain", + "resolver": "resolver contract in the registry", + "ttl": "ttl in the registry" + }, + "returns": { + "node": "Namehash of the subdomain" + } + }, + "setTTL(bytes32,uint64)": { + "params": { + "node": "Namehash of the name", + "ttl": "TTL in the registry" + } + }, + "setUpgradeContract(address)": { + "details": "The default value of upgradeContract is the 0 address. Use the 0 address at any time to make the contract not upgradable.", + "params": { + "_upgradeAddress": "address of an upgraded contract" + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "unwrap(bytes32,bytes32,address)": { + "details": "Can be called by the owner in the wrapper or an authorised caller in the wrapper", + "params": { + "controller": "Sets the owner in the registry to this address", + "labelhash": "Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')", + "parentNode": "Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')" + } + }, + "unwrapETH2LD(bytes32,address,address)": { + "details": "Can be called by the owner in the wrapper or an authorised caller in the wrapper", + "params": { + "controller": "Sets the owner in the registry to this address", + "labelhash": "Labelhash of the .eth domain", + "registrant": "Sets the owner in the .eth registrar to this address" + } + }, + "upgrade(bytes,bytes)": { + "details": "Can be called by the owner or an authorised caller", + "params": { + "extraData": "Extra data to pass to the upgrade contract", + "name": "The name to upgrade, in DNS format" + } + }, + "uri(uint256)": { + "params": { + "tokenId": "The id of the token" + }, + "returns": { + "_0": "string uri of the metadata service" + } + }, + "wrap(bytes,address,address)": { + "details": "Can be called by the owner in the registry or an authorised caller in the registry", + "params": { + "name": "The name to wrap, in DNS format", + "resolver": "Resolver contract", + "wrappedOwner": "Owner of the name in this contract" + } + }, + "wrapETH2LD(string,address,uint16,address)": { + "details": "Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar", + "params": { + "label": "Label as a string of the .eth domain to wrap", + "ownerControlledFuses": "Initial owner-controlled fuses to set", + "resolver": "Resolver contract address", + "wrappedOwner": "Owner of the name in this contract" + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "allFusesBurned(bytes32,uint32)": { + "notice": "Checks all Fuses in the mask are burned for the node" + }, + "approve(address,uint256)": { + "notice": "Approves an address for a name" + }, + "canExtendSubnames(bytes32,address)": { + "notice": "Checks if owner/operator or approved by owner" + }, + "canModifyName(bytes32,address)": { + "notice": "Checks if owner or operator of the owner" + }, + "extendExpiry(bytes32,bytes32,uint64)": { + "notice": "Extends expiry for a name" + }, + "getApproved(uint256)": { + "notice": "Gets the owner of a name" + }, + "getData(uint256)": { + "notice": "Gets the data for a name" + }, + "isWrapped(bytes32)": { + "notice": "Checks if a name is wrapped" + }, + "isWrapped(bytes32,bytes32)": { + "notice": "Checks if a name is wrapped in a more gas efficient way" + }, + "ownerOf(uint256)": { + "notice": "Gets the owner of a name" + }, + "recoverFunds(address,address,uint256)": { + "notice": "Recover ERC20 tokens sent to the contract by mistake." + }, + "renew(uint256,uint256)": { + "notice": "Renews a .eth second-level domain." + }, + "setChildFuses(bytes32,bytes32,uint32,uint64)": { + "notice": "Sets fuses of a name that you own the parent of" + }, + "setFuses(bytes32,uint16)": { + "notice": "Sets fuses of a name" + }, + "setMetadataService(address)": { + "notice": "Set the metadata service. Only the owner can do this" + }, + "setRecord(bytes32,address,address,uint64)": { + "notice": "Sets records for the name in the ENS Registry" + }, + "setResolver(bytes32,address)": { + "notice": "Sets resolver contract in the registry" + }, + "setSubnodeOwner(bytes32,string,address,uint32,uint64)": { + "notice": "Sets the subdomain owner in the registry and then wraps the subdomain" + }, + "setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)": { + "notice": "Sets the subdomain owner in the registry with records and then wraps the subdomain" + }, + "setTTL(bytes32,uint64)": { + "notice": "Sets TTL in the registry" + }, + "setUpgradeContract(address)": { + "notice": "Set the address of the upgradeContract of the contract. only admin can do this" + }, + "unwrap(bytes32,bytes32,address)": { + "notice": "Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain" + }, + "unwrapETH2LD(bytes32,address,address)": { + "notice": "Unwraps a .eth domain. e.g. vitalik.eth" + }, + "upgrade(bytes,bytes)": { + "notice": "Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain" + }, + "uri(uint256)": { + "notice": "Get the metadata uri" + }, + "wrap(bytes,address,address)": { + "notice": "Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain" + }, + "wrapETH2LD(string,address,uint16,address)": { + "notice": "Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 474, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 16788, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_tokens", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 16794, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_operatorApprovals", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" + }, + { + "astId": 16798, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "_tokenApprovals", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_address)" + }, + { + "astId": 16719, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "controllers", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 18262, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "metadataService", + "offset": 0, + "slot": "5", + "type": "t_contract(IMetadataService)17762" + }, + { + "astId": 18266, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "names", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_bytes32,t_bytes_storage)" + }, + { + "astId": 18284, + "contract": "contracts/wrapper/NameWrapper.sol:NameWrapper", + "label": "upgradeContract", + "offset": 0, + "slot": "7", + "type": "t_contract(INameWrapperUpgrade)18154" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(IMetadataService)17762": { + "encoding": "inplace", + "label": "contract IMetadataService", + "numberOfBytes": "20" + }, + "t_contract(INameWrapperUpgrade)18154": { + "encoding": "inplace", + "label": "contract INameWrapperUpgrade", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_bytes32,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint256,t_address)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/OwnedResolver.json b/solidity/dns-contracts/deployments/testnet/OwnedResolver.json new file mode 100644 index 0000000..3f872e4 --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/OwnedResolver.json @@ -0,0 +1,1470 @@ +{ + "address": "0xd8e0915432B1d45D94B427876D92B3577b6d3643", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + } + ], + "name": "ABIChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "AddrChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "ContenthashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "record", + "type": "bytes" + } + ], + "name": "DNSRecordChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "DNSRecordDeleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "lastzonehash", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "zonehash", + "type": "bytes" + } + ], + "name": "DNSZonehashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "InterfaceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "PubkeyChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "string", + "name": "indexedKey", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "TextChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "newVersion", + "type": "uint64" + } + ], + "name": "VersionChanged", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentTypes", + "type": "uint256" + } + ], + "name": "ABI", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "clearRecords", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "contenthash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "dnsRecord", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + } + ], + "name": "hasDNSRecords", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "interfaceImplementer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "pubkey", + "outputs": [ + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "recordVersions", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setABI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "a", + "type": "bytes" + } + ], + "name": "setAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "setAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setContenthash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setDNSRecords", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "setInterface", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "newName", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "setPubkey", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "setText", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setZonehash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "text", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "zonehash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x3c0e7b7a392df7cca7ed035a79ea94d479fadbc6278e9d9d19e1a6ff4a6bed46", + "receipt": { + "to": null, + "from": "0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B", + "contractAddress": "0xd8e0915432B1d45D94B427876D92B3577b6d3643", + "transactionIndex": 0, + "gasUsed": "2350424", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000100400000000000000000000000020000000000000000000800000000000000000000000000000000400000000000010000000000000000000000000000000000000000000000000000000000000000000000000004020000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x7c916c39dc8d9a4448453f3fffddac172a831a9006a37cbd21abb138baa60727", + "transactionHash": "0x3c0e7b7a392df7cca7ed035a79ea94d479fadbc6278e9d9d19e1a6ff4a6bed46", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 57534992, + "transactionHash": "0x3c0e7b7a392df7cca7ed035a79ea94d479fadbc6278e9d9d19e1a6ff4a6bed46", + "address": "0xd8e0915432B1d45D94B427876D92B3577b6d3643", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000002a0d7311fa7e9ac2890cfd8219b2def0c206e79b" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x7c916c39dc8d9a4448453f3fffddac172a831a9006a37cbd21abb138baa60727" + } + ], + "blockNumber": 57534992, + "cumulativeGasUsed": "2350424", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "c311c3de46948b5831b922985c265742", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"}],\"name\":\"ABIChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"AddrChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"newAddress\",\"type\":\"bytes\"}],\"name\":\"AddressChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"ContenthashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"record\",\"type\":\"bytes\"}],\"name\":\"DNSRecordChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"DNSRecordDeleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"lastzonehash\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"zonehash\",\"type\":\"bytes\"}],\"name\":\"DNSZonehashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"InterfaceChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NameChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"PubkeyChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"indexedKey\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"TextChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"newVersion\",\"type\":\"uint64\"}],\"name\":\"VersionChanged\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentTypes\",\"type\":\"uint256\"}],\"name\":\"ABI\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"clearRecords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"contenthash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"dnsRecord\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"hasDNSRecords\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"interfaceImplementer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"pubkey\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"recordVersions\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setABI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"a\",\"type\":\"bytes\"}],\"name\":\"setAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"setAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setContenthash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setDNSRecords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"setInterface\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"newName\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"setPubkey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"setText\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setZonehash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"}],\"name\":\"text\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"zonehash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"ABI(bytes32,uint256)\":{\"params\":{\"contentTypes\":\"A bitwise OR of the ABI formats accepted by the caller.\",\"node\":\"The ENS node to query\"},\"returns\":{\"_0\":\"contentType The content type of the return value\",\"_1\":\"data The ABI data\"}},\"addr(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated address.\"}},\"clearRecords(bytes32)\":{\"params\":{\"node\":\"The node to update.\"}},\"contenthash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated contenthash.\"}},\"dnsRecord(bytes32,bytes32,uint16)\":{\"params\":{\"name\":\"the keccak-256 hash of the fully-qualified name for which to fetch the record\",\"node\":\"the namehash of the node for which to fetch the record\",\"resource\":\"the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\"},\"returns\":{\"_0\":\"the DNS record in wire format if present, otherwise empty\"}},\"hasDNSRecords(bytes32,bytes32)\":{\"params\":{\"name\":\"the namehash of the node for which to check the records\",\"node\":\"the namehash of the node for which to check the records\"}},\"interfaceImplementer(bytes32,bytes4)\":{\"params\":{\"interfaceID\":\"The EIP 165 interface ID to check for.\",\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The address that implements this interface, or 0 if the interface is unsupported.\"}},\"name(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated name.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pubkey(bytes32)\":{\"params\":{\"node\":\"The ENS node to query\"},\"returns\":{\"x\":\"The X coordinate of the curve point for the public key.\",\"y\":\"The Y coordinate of the curve point for the public key.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"setABI(bytes32,uint256,bytes)\":{\"params\":{\"contentType\":\"The content type of the ABI\",\"data\":\"The ABI data.\",\"node\":\"The node to update.\"}},\"setAddr(bytes32,address)\":{\"params\":{\"a\":\"The address to set.\",\"node\":\"The node to update.\"}},\"setContenthash(bytes32,bytes)\":{\"params\":{\"hash\":\"The contenthash to set\",\"node\":\"The node to update.\"}},\"setDNSRecords(bytes32,bytes)\":{\"params\":{\"data\":\"the DNS wire format records to set\",\"node\":\"the namehash of the node for which to set the records\"}},\"setInterface(bytes32,bytes4,address)\":{\"params\":{\"implementer\":\"The address of a contract that implements this interface for this node.\",\"interfaceID\":\"The EIP 165 interface ID.\",\"node\":\"The node to update.\"}},\"setName(bytes32,string)\":{\"params\":{\"node\":\"The node to update.\"}},\"setPubkey(bytes32,bytes32,bytes32)\":{\"params\":{\"node\":\"The ENS node to query\",\"x\":\"the X coordinate of the curve point for the public key.\",\"y\":\"the Y coordinate of the curve point for the public key.\"}},\"setText(bytes32,string,string)\":{\"params\":{\"key\":\"The key to set.\",\"node\":\"The node to update.\",\"value\":\"The text data value to set.\"}},\"setZonehash(bytes32,bytes)\":{\"params\":{\"hash\":\"The zonehash to set\",\"node\":\"The node to update.\"}},\"text(bytes32,string)\":{\"params\":{\"key\":\"The text data key to query.\",\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated text data.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"zonehash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated contenthash.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"ABI(bytes32,uint256)\":{\"notice\":\"Returns the ABI associated with an ENS node. Defined in EIP205.\"},\"addr(bytes32)\":{\"notice\":\"Returns the address associated with an ENS node.\"},\"clearRecords(bytes32)\":{\"notice\":\"Increments the record version associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"contenthash(bytes32)\":{\"notice\":\"Returns the contenthash associated with an ENS node.\"},\"dnsRecord(bytes32,bytes32,uint16)\":{\"notice\":\"Obtain a DNS record.\"},\"hasDNSRecords(bytes32,bytes32)\":{\"notice\":\"Check if a given node has records.\"},\"interfaceImplementer(bytes32,bytes4)\":{\"notice\":\"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.\"},\"name(bytes32)\":{\"notice\":\"Returns the name associated with an ENS node, for reverse records. Defined in EIP181.\"},\"pubkey(bytes32)\":{\"notice\":\"Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619.\"},\"setABI(bytes32,uint256,bytes)\":{\"notice\":\"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.\"},\"setAddr(bytes32,address)\":{\"notice\":\"Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setContenthash(bytes32,bytes)\":{\"notice\":\"Sets the contenthash associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setDNSRecords(bytes32,bytes)\":{\"notice\":\"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.\"},\"setInterface(bytes32,bytes4,address)\":{\"notice\":\"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.\"},\"setName(bytes32,string)\":{\"notice\":\"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.\"},\"setPubkey(bytes32,bytes32,bytes32)\":{\"notice\":\"Sets the SECP256k1 public key associated with an ENS node.\"},\"setText(bytes32,string,string)\":{\"notice\":\"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.\"},\"setZonehash(bytes32,bytes)\":{\"notice\":\"setZonehash sets the hash for the zone. May only be called by the owner of that node in the ENS registry.\"},\"text(bytes32,string)\":{\"notice\":\"Returns the text data associated with an ENS node and key.\"},\"zonehash(bytes32)\":{\"notice\":\"zonehash obtains the hash for the zone.\"}},\"notice\":\"A simple resolver anyone can use; only allows the owner of a node to set its address.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/resolvers/OwnedResolver.sol\":\"OwnedResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-2-Clause\\npragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for appending to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n let fpm := add(32, add(ptr, capacity))\\n if lt(fpm, ptr) {\\n revert(0, 0)\\n }\\n mstore(0x40, fpm)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n uint off = buf.buf.length;\\n uint newCapacity = off + len;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(newCapacity, buflen) {\\n mstore(bufptr, newCapacity)\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return append(buf, data, data.length);\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint offPlusOne = off + 1;\\n if (off >= buf.capacity) {\\n resize(buf, offPlusOne * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if gt(offPlusOne, mload(bufptr)) {\\n mstore(bufptr, offPlusOne)\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return append(buf, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return append(buf, data, 32);\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n return buf;\\n }\\n}\\n\",\"keccak256\":\"0xd6dd3b0b327288f8e1b711a609f4040fea602e2ad4bba9febdf2f33b4e56eb0c\",\"license\":\"BSD-2-Clause\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"../utils/BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n */\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint256 labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes memory ret) {\\n uint256 len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint256 labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint256 constant RRSIG_TYPE = 0;\\n uint256 constant RRSIG_ALGORITHM = 2;\\n uint256 constant RRSIG_LABELS = 3;\\n uint256 constant RRSIG_TTL = 4;\\n uint256 constant RRSIG_EXPIRATION = 8;\\n uint256 constant RRSIG_INCEPTION = 12;\\n uint256 constant RRSIG_KEY_TAG = 16;\\n uint256 constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(\\n bytes memory data\\n ) internal pure returns (SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(\\n RRSIG_SIGNER_NAME + self.signerName.length,\\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\\n );\\n }\\n\\n function rrs(\\n SignedSet memory rrset\\n ) internal pure returns (RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint256 offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint256 rdataOffset;\\n uint256 nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns (bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint256 rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.offset,\\n nameLength(iter.data, iter.offset)\\n );\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(\\n RRIterator memory iter\\n ) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.rdataOffset,\\n iter.nextOffset - iter.rdataOffset\\n );\\n }\\n\\n uint256 constant DNSKEY_FLAGS = 0;\\n uint256 constant DNSKEY_PROTOCOL = 2;\\n uint256 constant DNSKEY_ALGORITHM = 3;\\n uint256 constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(\\n offset + DNSKEY_PUBKEY,\\n length - DNSKEY_PUBKEY\\n );\\n }\\n\\n uint256 constant DS_KEY_TAG = 0;\\n uint256 constant DS_ALGORITHM = 2;\\n uint256 constant DS_DIGEST_TYPE = 3;\\n uint256 constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n function isSubdomainOf(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n uint256 off = 0;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n while (counts > othercounts) {\\n off = progress(self, off);\\n counts--;\\n }\\n\\n return self.equals(off, other, 0);\\n }\\n\\n function compareNames(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint256 off;\\n uint256 otheroff;\\n uint256 prevoff;\\n uint256 otherprevoff;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if (otheroff == 0) {\\n return 1;\\n }\\n\\n return\\n self.compare(\\n prevoff + 1,\\n self.readUint8(prevoff),\\n other,\\n otherprevoff + 1,\\n other.readUint8(otherprevoff)\\n );\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(\\n uint32 i1,\\n uint32 i2\\n ) internal pure returns (bool) {\\n unchecked {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n }\\n\\n function progress(\\n bytes memory body,\\n uint256 off\\n ) internal pure returns (uint256) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint256 ac1;\\n uint256 ac2;\\n for (uint256 i = 0; i < data.length + 31; i += 32) {\\n uint256 word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if (i + 32 > data.length) {\\n uint256 unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 +=\\n (word &\\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\\n 8;\\n ac2 += (word &\\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 =\\n (ac1 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac1 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac2 =\\n (ac2 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac2 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 =\\n (ac1 &\\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\\n 32);\\n ac1 =\\n (ac1 &\\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\\n 64);\\n ac1 =\\n (ac1 &\\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\\n (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4470c1578b2ee78e64bd8925bf391ffe98d5497aeef15b593380c7fe905af5d\",\"license\":\"MIT\"},\"contracts/resolvers/OwnedResolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"./profiles/ABIResolver.sol\\\";\\nimport \\\"./profiles/AddrResolver.sol\\\";\\nimport \\\"./profiles/ContentHashResolver.sol\\\";\\nimport \\\"./profiles/DNSResolver.sol\\\";\\nimport \\\"./profiles/InterfaceResolver.sol\\\";\\nimport \\\"./profiles/NameResolver.sol\\\";\\nimport \\\"./profiles/PubkeyResolver.sol\\\";\\nimport \\\"./profiles/TextResolver.sol\\\";\\nimport \\\"./profiles/ExtendedResolver.sol\\\";\\n\\n/**\\n * A simple resolver anyone can use; only allows the owner of a node to set its\\n * address.\\n */\\ncontract OwnedResolver is\\n Ownable,\\n ABIResolver,\\n AddrResolver,\\n ContentHashResolver,\\n DNSResolver,\\n InterfaceResolver,\\n NameResolver,\\n PubkeyResolver,\\n TextResolver,\\n ExtendedResolver\\n{\\n function isAuthorised(bytes32) internal view override returns (bool) {\\n return msg.sender == owner();\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n )\\n public\\n view\\n virtual\\n override(\\n ABIResolver,\\n AddrResolver,\\n ContentHashResolver,\\n DNSResolver,\\n InterfaceResolver,\\n NameResolver,\\n PubkeyResolver,\\n TextResolver\\n )\\n returns (bool)\\n {\\n return super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x3506d44a326b324bcdc6523bf73616ba4e80db9f375619daf06dc206371c132c\",\"license\":\"MIT\"},\"contracts/resolvers/ResolverBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"./profiles/IVersionableResolver.sol\\\";\\n\\nabstract contract ResolverBase is ERC165, IVersionableResolver {\\n mapping(bytes32 => uint64) public recordVersions;\\n\\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\\n\\n modifier authorised(bytes32 node) {\\n require(isAuthorised(node));\\n _;\\n }\\n\\n /**\\n * Increments the record version associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function clearRecords(bytes32 node) public virtual authorised(node) {\\n recordVersions[node]++;\\n emit VersionChanged(node, recordVersions[node]);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IVersionableResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x893049fffd6feee06d7acef1680f6e26505bedff62a9f7a17e921c0ba2f66307\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"./IABIResolver.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\n\\nabstract contract ABIResolver is IABIResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\\n\\n /**\\n * Sets the ABI associated with an ENS node.\\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\\n * the empty string.\\n * @param node The node to update.\\n * @param contentType The content type of the ABI\\n * @param data The ABI data.\\n */\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external virtual authorised(node) {\\n // Content types must be powers of 2\\n require(((contentType - 1) & contentType) == 0);\\n\\n versionable_abis[recordVersions[node]][node][contentType] = data;\\n emit ABIChanged(node, contentType);\\n }\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view virtual override returns (uint256, bytes memory) {\\n mapping(uint256 => bytes) storage abiset = versionable_abis[\\n recordVersions[node]\\n ][node];\\n\\n for (\\n uint256 contentType = 1;\\n contentType <= contentTypes;\\n contentType <<= 1\\n ) {\\n if (\\n (contentType & contentTypes) != 0 &&\\n abiset[contentType].length > 0\\n ) {\\n return (contentType, abiset[contentType]);\\n }\\n }\\n\\n return (0, bytes(\\\"\\\"));\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IABIResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x2da96d7750786afe3be019fc6ff768e2d98a5e61d360bd92d8d7bc3c7c1dcc27\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/AddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IAddrResolver.sol\\\";\\nimport \\\"./IAddressResolver.sol\\\";\\n\\nabstract contract AddrResolver is\\n IAddrResolver,\\n IAddressResolver,\\n ResolverBase\\n{\\n uint256 private constant COIN_TYPE_ETH = 714;\\n\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\\n\\n /**\\n * Sets the address associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param a The address to set.\\n */\\n function setAddr(\\n bytes32 node,\\n address a\\n ) external virtual authorised(node) {\\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\\n }\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(\\n bytes32 node\\n ) public view virtual override returns (address payable) {\\n bytes memory a = addr(node, COIN_TYPE_ETH);\\n if (a.length == 0) {\\n return payable(0);\\n }\\n return bytesToAddress(a);\\n }\\n\\n function setAddr(\\n bytes32 node,\\n uint256 coinType,\\n bytes memory a\\n ) public virtual authorised(node) {\\n emit AddressChanged(node, coinType, a);\\n if (coinType == COIN_TYPE_ETH) {\\n emit AddrChanged(node, bytesToAddress(a));\\n }\\n versionable_addresses[recordVersions[node]][node][coinType] = a;\\n }\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) public view virtual override returns (bytes memory) {\\n return versionable_addresses[recordVersions[node]][node][coinType];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IAddrResolver).interfaceId ||\\n interfaceID == type(IAddressResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function bytesToAddress(\\n bytes memory b\\n ) internal pure returns (address payable a) {\\n require(b.length == 20);\\n assembly {\\n a := div(mload(add(b, 32)), exp(256, 12))\\n }\\n }\\n\\n function addressToBytes(address a) internal pure returns (bytes memory b) {\\n b = new bytes(20);\\n assembly {\\n mstore(add(b, 32), mul(a, exp(256, 12)))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x545ecb86610407faa1b9e255f28879f8876de2ce1e2a0c6886fbf5ea494bd582\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IContentHashResolver.sol\\\";\\n\\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\\n\\n /**\\n * Sets the contenthash associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param hash The contenthash to set\\n */\\n function setContenthash(\\n bytes32 node,\\n bytes calldata hash\\n ) external virtual authorised(node) {\\n versionable_hashes[recordVersions[node]][node] = hash;\\n emit ContenthashChanged(node, hash);\\n }\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(\\n bytes32 node\\n ) external view virtual override returns (bytes memory) {\\n return versionable_hashes[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IContentHashResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xc9755bfb77985375ded880ecab5af41f2b9e8280f30d3e523fe5042ea59f93ea\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/DNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"../../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"./IDNSRecordResolver.sol\\\";\\nimport \\\"./IDNSZoneResolver.sol\\\";\\n\\nabstract contract DNSResolver is\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n ResolverBase\\n{\\n using RRUtils for *;\\n using BytesUtils for bytes;\\n\\n // Zone hashes for the domains.\\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\\n // resource containing a single zonefile.\\n // node => contenthash\\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\\n\\n // The records themselves. Stored as binary RRSETs\\n // node => version => name => resource => data\\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\\n private versionable_records;\\n\\n // Count of number of entries for a given name. Required for DNS resolvers\\n // when resolving wildcards.\\n // node => version => name => number of records\\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\\n private versionable_nameEntriesCount;\\n\\n /**\\n * Set one or more DNS records. Records are supplied in wire-format.\\n * Records with the same node/name/resource must be supplied one after the\\n * other to ensure the data is updated correctly. For example, if the data\\n * was supplied:\\n * a.example.com IN A 1.2.3.4\\n * a.example.com IN A 5.6.7.8\\n * www.example.com IN CNAME a.example.com.\\n * then this would store the two A records for a.example.com correctly as a\\n * single RRSET, however if the data was supplied:\\n * a.example.com IN A 1.2.3.4\\n * www.example.com IN CNAME a.example.com.\\n * a.example.com IN A 5.6.7.8\\n * then this would store the first A record, the CNAME, then the second A\\n * record which would overwrite the first.\\n *\\n * @param node the namehash of the node for which to set the records\\n * @param data the DNS wire format records to set\\n */\\n function setDNSRecords(\\n bytes32 node,\\n bytes calldata data\\n ) external virtual authorised(node) {\\n uint16 resource = 0;\\n uint256 offset = 0;\\n bytes memory name;\\n bytes memory value;\\n bytes32 nameHash;\\n uint64 version = recordVersions[node];\\n // Iterate over the data to add the resource records\\n for (\\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\\n !iter.done();\\n iter.next()\\n ) {\\n if (resource == 0) {\\n resource = iter.dnstype;\\n name = iter.name();\\n nameHash = keccak256(abi.encodePacked(name));\\n value = bytes(iter.rdata());\\n } else {\\n bytes memory newName = iter.name();\\n if (resource != iter.dnstype || !name.equals(newName)) {\\n setDNSRRSet(\\n node,\\n name,\\n resource,\\n data,\\n offset,\\n iter.offset - offset,\\n value.length == 0,\\n version\\n );\\n resource = iter.dnstype;\\n offset = iter.offset;\\n name = newName;\\n nameHash = keccak256(name);\\n value = bytes(iter.rdata());\\n }\\n }\\n }\\n if (name.length > 0) {\\n setDNSRRSet(\\n node,\\n name,\\n resource,\\n data,\\n offset,\\n data.length - offset,\\n value.length == 0,\\n version\\n );\\n }\\n }\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) public view virtual override returns (bytes memory) {\\n return versionable_records[recordVersions[node]][node][name][resource];\\n }\\n\\n /**\\n * Check if a given node has records.\\n * @param node the namehash of the node for which to check the records\\n * @param name the namehash of the node for which to check the records\\n */\\n function hasDNSRecords(\\n bytes32 node,\\n bytes32 name\\n ) public view virtual returns (bool) {\\n return (versionable_nameEntriesCount[recordVersions[node]][node][\\n name\\n ] != 0);\\n }\\n\\n /**\\n * setZonehash sets the hash for the zone.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param hash The zonehash to set\\n */\\n function setZonehash(\\n bytes32 node,\\n bytes calldata hash\\n ) external virtual authorised(node) {\\n uint64 currentRecordVersion = recordVersions[node];\\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\\n node\\n ];\\n versionable_zonehashes[currentRecordVersion][node] = hash;\\n emit DNSZonehashChanged(node, oldhash, hash);\\n }\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(\\n bytes32 node\\n ) external view virtual override returns (bytes memory) {\\n return versionable_zonehashes[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IDNSRecordResolver).interfaceId ||\\n interfaceID == type(IDNSZoneResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function setDNSRRSet(\\n bytes32 node,\\n bytes memory name,\\n uint16 resource,\\n bytes memory data,\\n uint256 offset,\\n uint256 size,\\n bool deleteRecord,\\n uint64 version\\n ) private {\\n bytes32 nameHash = keccak256(name);\\n bytes memory rrData = data.substring(offset, size);\\n if (deleteRecord) {\\n if (\\n versionable_records[version][node][nameHash][resource].length !=\\n 0\\n ) {\\n versionable_nameEntriesCount[version][node][nameHash]--;\\n }\\n delete (versionable_records[version][node][nameHash][resource]);\\n emit DNSRecordDeleted(node, name, resource);\\n } else {\\n if (\\n versionable_records[version][node][nameHash][resource].length ==\\n 0\\n ) {\\n versionable_nameEntriesCount[version][node][nameHash]++;\\n }\\n versionable_records[version][node][nameHash][resource] = rrData;\\n emit DNSRecordChanged(node, name, resource, rrData);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7233e4d2edca222ce6e1cdb07adf127ab52ecaea599fa5369971a7b28dbc59ac\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ncontract ExtendedResolver {\\n function resolve(\\n bytes memory /* name */,\\n bytes memory data\\n ) external view returns (bytes memory) {\\n (bool success, bytes memory result) = address(this).staticcall(data);\\n if (success) {\\n return result;\\n } else {\\n // Revert with the reason provided by the call\\n assembly {\\n revert(add(result, 0x20), mload(result))\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd0e5c93ac9f4d21a0278282e2a32a9c5606a0053ce4781773b7faade57a4a54e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IVersionableResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IVersionableResolver {\\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\\n\\n function recordVersions(bytes32 node) external view returns (uint64);\\n}\\n\",\"keccak256\":\"0xd0d09596f20c57bafb2ffa8521a8c57120e9af6c6b194f9c689d4da56f91a57c\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/InterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./AddrResolver.sol\\\";\\nimport \\\"./IInterfaceResolver.sol\\\";\\n\\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\\n\\n /**\\n * Sets an interface associated with a name.\\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\\n * @param node The node to update.\\n * @param interfaceID The EIP 165 interface ID.\\n * @param implementer The address of a contract that implements this interface for this node.\\n */\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external virtual authorised(node) {\\n versionable_interfaces[recordVersions[node]][node][\\n interfaceID\\n ] = implementer;\\n emit InterfaceChanged(node, interfaceID, implementer);\\n }\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view virtual override returns (address) {\\n address implementer = versionable_interfaces[recordVersions[node]][\\n node\\n ][interfaceID];\\n if (implementer != address(0)) {\\n return implementer;\\n }\\n\\n address a = addr(node);\\n if (a == address(0)) {\\n return address(0);\\n }\\n\\n (bool success, bytes memory returnData) = a.staticcall(\\n abi.encodeWithSignature(\\n \\\"supportsInterface(bytes4)\\\",\\n type(IERC165).interfaceId\\n )\\n );\\n if (!success || returnData.length < 32 || returnData[31] == 0) {\\n // EIP 165 not supported by target\\n return address(0);\\n }\\n\\n (success, returnData) = a.staticcall(\\n abi.encodeWithSignature(\\\"supportsInterface(bytes4)\\\", interfaceID)\\n );\\n if (!success || returnData.length < 32 || returnData[31] == 0) {\\n // Specified interface not supported by target\\n return address(0);\\n }\\n\\n return a;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IInterfaceResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x820ec60183e7a49a4ee399cf4708acb776725c8e4ad275d1f316c152eace0a59\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/NameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./INameResolver.sol\\\";\\n\\nabstract contract NameResolver is INameResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\\n\\n /**\\n * Sets the name associated with an ENS node, for reverse records.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function setName(\\n bytes32 node,\\n string calldata newName\\n ) external virtual authorised(node) {\\n versionable_names[recordVersions[node]][node] = newName;\\n emit NameChanged(node, newName);\\n }\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(\\n bytes32 node\\n ) external view virtual override returns (string memory) {\\n return versionable_names[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(INameResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x52d0bbb8f9dd33fae471ef2f5f6b3118b221954e5bb7ba724885d4562e75b8e2\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/PubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IPubkeyResolver.sol\\\";\\n\\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\\n struct PublicKey {\\n bytes32 x;\\n bytes32 y;\\n }\\n\\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\\n\\n /**\\n * Sets the SECP256k1 public key associated with an ENS node.\\n * @param node The ENS node to query\\n * @param x the X coordinate of the curve point for the public key.\\n * @param y the Y coordinate of the curve point for the public key.\\n */\\n function setPubkey(\\n bytes32 node,\\n bytes32 x,\\n bytes32 y\\n ) external virtual authorised(node) {\\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\\n emit PubkeyChanged(node, x, y);\\n }\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(\\n bytes32 node\\n ) external view virtual override returns (bytes32 x, bytes32 y) {\\n uint64 currentRecordVersion = recordVersions[node];\\n return (\\n versionable_pubkeys[currentRecordVersion][node].x,\\n versionable_pubkeys[currentRecordVersion][node].y\\n );\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IPubkeyResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x1a1f10a0e40520c998a9296fc81c092c81521e05a784e9bd9ee44cc4c62c8c78\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/TextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./ITextResolver.sol\\\";\\n\\nabstract contract TextResolver is ITextResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\\n\\n /**\\n * Sets the text data associated with an ENS node and key.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param key The key to set.\\n * @param value The text data value to set.\\n */\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external virtual authorised(node) {\\n versionable_texts[recordVersions[node]][node][key] = value;\\n emit TextChanged(node, key, key, value);\\n }\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view virtual override returns (string memory) {\\n return versionable_texts[recordVersions[node]][node][key];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(ITextResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xf9bedd807add38136779d84083ac2fa4f8c92d017c9e1a72fbc9003fa5074379\",\"license\":\"MIT\"},\"contracts/utils/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes32) {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0xc566a3569af880a096a9bfb2fbb77060ef7aecde1a205dc26446a58877412060\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61292e8061007e6000396000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c8063715018a6116100f9578063c869023311610097578063d700ff3311610071578063d700ff3314610450578063e59d895d14610493578063f1cb7e06146104a6578063f2fde38b146104b957600080fd5b8063c8690233146103d0578063ce3decdc1461042a578063d5fa2b001461043d57600080fd5b80638da5cb5b116100d35780638da5cb5b146103865780639061b92314610397578063a8fa5682146103aa578063bc1c58d1146103bd57600080fd5b8063715018a61461035857806377372213146103605780638b95dd711461037357600080fd5b80633603d7581161016657806359d1d43c1161014057806359d1d43c146102ff5780635c98042b1461031f578063623195b014610332578063691f34311461034557600080fd5b80633603d7581461028b5780633b3b57de1461029e5780634cbf6ba4146102b157600080fd5b8063124a319c116101a2578063124a319c146102195780632203ab561461024457806329cd62ea14610265578063304e6ade1461027857600080fd5b806301ffc9a7146101c95780630af179d7146101f157806310f13a8c14610206575b600080fd5b6101dc6101d736600461205f565b6104cc565b60405190151581526020015b60405180910390f35b6102046101ff3660046120bc565b6104dd565b005b610204610214366004612108565b6106ef565b61022c610227366004612182565b6107c4565b6040516001600160a01b0390911681526020016101e8565b6102576102523660046121ae565b610a72565b6040516101e8929190612220565b610204610273366004612239565b610baa565b6102046102863660046120bc565b610c52565b610204610299366004612265565b610cd6565b61022c6102ac366004612265565b610d81565b6101dc6102bf3660046121ae565b60008281526001602090815260408083205467ffffffffffffffff1683526007825280832094835293815283822092825291909152205461ffff16151590565b61031261030d3660046120bc565b610db4565b6040516101e8919061227e565b61031261032d366004612265565b610e96565b610204610340366004612291565b610f57565b610312610353366004612265565b610ffc565b610204611038565b61020461036e3660046120bc565b61104c565b610204610381366004612387565b6110d0565b6000546001600160a01b031661022c565b6103126103a53660046123d7565b6111b9565b6103126103b836600461243b565b611232565b6103126103cb366004612265565b611282565b6104156103de366004612265565b60008181526001602081815260408084205467ffffffffffffffff168452600a825280842094845293905291902080549101549091565b604080519283526020830191909152016101e8565b6102046104383660046120bc565b6112be565b61020461044b366004612492565b611409565b61047a61045e366004612265565b60016020526000908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016101e8565b6102046104a13660046124b5565b611437565b6103126104b43660046121ae565b6114f3565b6102046104c73660046124f1565b6115bd565b60006104d782611652565b92915050565b60005483906001600160a01b031633146104f657600080fd5b6000848152600160209081526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff90911691839161055e9183918d908d908190840183828082843760009201919091525092939250506116909050565b90505b80515160208201511015610688578661ffff166000036105c6578060400151965061058b816116f1565b94508460405160200161059e919061250c565b6040516020818303038152906040528051906020012092506105bf81611712565b935061067a565b60006105d1826116f1565b9050816040015161ffff168861ffff161415806105f557506105f3868261172e565b155b15610678576106518c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d915061064890829061253e565b8b51158a61174c565b81604001519750816020015196508095508580519060200120935061067582611712565b94505b505b610683816119b9565b610561565b508351156106e3576106e38a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92506106da91508290508f61253e565b8951158861174c565b50505050505050505050565b60005485906001600160a01b0316331461070857600080fd5b60008681526001602090815260408083205467ffffffffffffffff168352600b82528083208984529091529081902090518491849161074a9089908990612551565b908152602001604051809103902091826107659291906125e9565b508484604051610776929190612551565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516107b494939291906126d2565b60405180910390a3505050505050565b60008281526001602090815260408083205467ffffffffffffffff1683526008825280832085845282528083206001600160e01b0319851684529091528120546001600160a01b0316801561081a5790506104d7565b600061082585610d81565b90506001600160a01b038116610840576000925050506104d7565b6040516301ffc9a760e01b602482015260009081906001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516108ad919061250c565b600060405180830381855afa9150503d80600081146108e8576040519150601f19603f3d011682016040523d82523d6000602084013e6108ed565b606091505b5091509150811580610900575060208151105b80610942575080601f8151811061091957610919612704565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109545760009450505050506104d7565b6040516001600160e01b0319871660248201526001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516109bf919061250c565b600060405180830381855afa9150503d80600081146109fa576040519150601f19603f3d011682016040523d82523d6000602084013e6109ff565b606091505b509092509050811580610a13575060208151105b80610a55575080601f81518110610a2c57610a2c612704565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610a675760009450505050506104d7565b509095945050505050565b60008281526001602081815260408084205467ffffffffffffffff1684526002825280842086855290915282206060915b848111610b8a5780851615801590610ad3575060008181526020839052604081208054610acf90612561565b9050115b15610b825780826000838152602001908152602001600020808054610af790612561565b80601f0160208091040260200160405190810160405280929190818152602001828054610b2390612561565b8015610b705780601f10610b4557610100808354040283529160200191610b70565b820191906000526020600020905b815481529060010190602001808311610b5357829003601f168201915b50505050509050935093505050610ba3565b60011b610aa3565b5060006040518060200160405280600081525092509250505b9250929050565b60005483906001600160a01b03163314610bc357600080fd5b6040805180820182528481526020808201858152600088815260018084528582205467ffffffffffffffff168252600a84528582208a835290935284902092518355519101555184907f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4690610c449086908690918252602082015260400190565b60405180910390a250505050565b60005483906001600160a01b03163314610c6b57600080fd5b60008481526001602090815260408083205467ffffffffffffffff168352600482528083208784529091529020610ca38385836125e9565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610c4492919061271a565b60005481906001600160a01b03163314610cef57600080fd5b6000828152600160205260408120805467ffffffffffffffff1691610d138361272e565b82546101009290920a67ffffffffffffffff8181021990931691831602179091556000848152600160209081526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610d90836102ca6114f3565b90508051600003610da45750600092915050565b610dad81611aa1565b9392505050565b60008381526001602090815260408083205467ffffffffffffffff168352600b825280832086845290915290819020905160609190610df69085908590612551565b90815260200160405180910390208054610e0f90612561565b80601f0160208091040260200160405190810160405280929190818152602001828054610e3b90612561565b8015610e885780601f10610e5d57610100808354040283529160200191610e88565b820191906000526020600020905b815481529060010190602001808311610e6b57829003601f168201915b505050505090509392505050565b60008181526001602090815260408083205467ffffffffffffffff168352600582528083208484529091529020805460609190610ed290612561565b80601f0160208091040260200160405190810160405280929190818152602001828054610efe90612561565b8015610f4b5780601f10610f2057610100808354040283529160200191610f4b565b820191906000526020600020905b815481529060010190602001808311610f2e57829003601f168201915b50505050509050919050565b60005484906001600160a01b03163314610f7057600080fd5b83610f7c60018261253e565b1615610f8757600080fd5b60008581526001602090815260408083205467ffffffffffffffff1683526002825280832088845282528083208784529091529020610fc78385836125e9565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b60008181526001602090815260408083205467ffffffffffffffff168352600982528083208484529091529020805460609190610ed290612561565b611040611ac9565b61104a6000611b23565b565b60005483906001600160a01b0316331461106557600080fd5b60008481526001602090815260408083205467ffffffffffffffff16835260098252808320878452909152902061109d8385836125e9565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610c4492919061271a565b60005483906001600160a01b031633146110e957600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af752848460405161111b929190612220565b60405180910390a26102ca830361117357837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd261115784611aa1565b6040516001600160a01b03909116815260200160405180910390a25b60008481526001602090815260408083205467ffffffffffffffff16835260038252808320878452825280832086845290915290206111b28382612755565b5050505050565b6060600080306001600160a01b0316846040516111d6919061250c565b600060405180830381855afa9150503d8060008114611211576040519150601f19603f3d011682016040523d82523d6000602084013e611216565b606091505b5091509150811561122a5791506104d79050565b805160208201fd5b60008381526001602090815260408083205467ffffffffffffffff168352600682528083208684528252808320858452825280832061ffff851684529091529020805460609190610e0f90612561565b60008181526001602090815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610ed290612561565b60005483906001600160a01b031633146112d757600080fd5b60008481526001602090815260408083205467ffffffffffffffff16808452600583528184208885529092528220805491929161131390612561565b80601f016020809104026020016040519081016040528092919081815260200182805461133f90612561565b801561138c5780601f106113615761010080835404028352916020019161138c565b820191906000526020600020905b81548152906001019060200180831161136f57829003601f168201915b5050505067ffffffffffffffff841660009081526005602090815260408083208b845290915290209192506113c490508587836125e9565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f858287876040516113f993929190612815565b60405180910390a2505050505050565b60005482906001600160a01b0316331461142257600080fd5b611432836102ca61038185611b80565b505050565b60005483906001600160a01b0316331461145057600080fd5b60008481526001602090815260408083205467ffffffffffffffff1683526008825280832087845282528083206001600160e01b0319871680855290835292819020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b60008281526001602090815260408083205467ffffffffffffffff168352600382528083208584528252808320848452909152902080546060919061153790612561565b80601f016020809104026020016040519081016040528092919081815260200182805461156390612561565b80156115b05780601f10611585576101008083540402835291602001916115b0565b820191906000526020600020905b81548152906001019060200180831161159357829003601f168201915b5050505050905092915050565b6115c5611ac9565b6001600160a01b0381166116465760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61164f81611b23565b50565b60006001600160e01b031982167f59d1d43c0000000000000000000000000000000000000000000000000000000014806104d757506104d782611bb9565b6116de6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c081018290526104d7816119b9565b602081015181516060916104d7916117099082611bf7565b84519190611c59565b60a081015160c08201516060916104d79161170990829061253e565b600081518351148015610dad5750610dad8360008460008751611cd0565b865160208801206000611760878787611c59565b9050831561188a5767ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152902080546117ab90612561565b15905061180a5767ffffffffffffffff831660009081526007602090815260408083208d845282528083208584529091528120805461ffff16916117ee83612845565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152812061184b91611ff4565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a60405161187d929190612863565b60405180910390a26106e3565b67ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152902080546118cd90612561565b905060000361192e5767ffffffffffffffff831660009081526007602090815260408083208d845282528083208584529091528120805461ffff169161191283612889565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c16845290915290206119708282612755565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a846040516119a5939291906128a0565b60405180910390a250505050505050505050565b60c081015160208201819052815151116119d05750565b60006119e482600001518360200151611bf7565b82602001516119f391906128cf565b8251909150611a029082611cf3565b61ffff166040830152611a166002826128cf565b8251909150611a259082611cf3565b61ffff166060830152611a396002826128cf565b8251909150611a489082611d1b565b63ffffffff166080830152611a5e6004826128cf565b8251909150600090611a709083611cf3565b61ffff169050611a816002836128cf565b60a084018190529150611a9481836128cf565b60c0909301929092525050565b60008151601414611ab157600080fd5b50602001516c01000000000000000000000000900490565b6000546001600160a01b0316331461104a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161163d565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60006001600160e01b031982167fc86902330000000000000000000000000000000000000000000000000000000014806104d757506104d782611d45565b6000815b83518110611c0b57611c0b6128e2565b6000611c178583611d83565b60ff169050611c278160016128cf565b611c3190836128cf565b915080600003611c415750611c47565b50611bfb565b611c51838261253e565b949350505050565b8251606090611c6883856128cf565b1115611c7357600080fd5b60008267ffffffffffffffff811115611c8e57611c8e6122e4565b6040519080825280601f01601f191660200182016040528015611cb8576020820181803683370190505b50905060208082019086860101610a67828287611da7565b6000611cdd848484611dfd565b611ce8878785611dfd565b149695505050505050565b8151600090611d038360026128cf565b1115611d0e57600080fd5b50016002015161ffff1690565b8151600090611d2b8360046128cf565b1115611d3657600080fd5b50016004015163ffffffff1690565b60006001600160e01b031982167f691f34310000000000000000000000000000000000000000000000000000000014806104d757506104d782611e21565b6000828281518110611d9757611d97612704565b016020015160f81c905092915050565b60208110611ddf5781518352611dbe6020846128cf565b9250611dcb6020836128cf565b9150611dd860208261253e565b9050611da7565b905182516020929092036101000a6000190180199091169116179052565b8251600090611e0c83856128cf565b1115611e1757600080fd5b5091016020012090565b60006001600160e01b031982167f124a319c0000000000000000000000000000000000000000000000000000000014806104d757506104d78260006001600160e01b031982167fa8fa5682000000000000000000000000000000000000000000000000000000001480611ebd57506001600160e01b031982167f5c98042b00000000000000000000000000000000000000000000000000000000145b806104d757506104d78260006001600160e01b031982167fbc1c58d10000000000000000000000000000000000000000000000000000000014806104d757506104d78260006001600160e01b031982167f3b3b57de000000000000000000000000000000000000000000000000000000001480611f6357506001600160e01b031982167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b806104d757506104d78260006001600160e01b031982167f2203ab560000000000000000000000000000000000000000000000000000000014806104d757506104d78260006001600160e01b031982167fd700ff330000000000000000000000000000000000000000000000000000000014806104d757506301ffc9a760e01b6001600160e01b03198316146104d7565b50805461200090612561565b6000825580601f10612010575050565b601f01602090049060005260206000209081019061164f91905b8082111561203e576000815560010161202a565b5090565b80356001600160e01b03198116811461205a57600080fd5b919050565b60006020828403121561207157600080fd5b610dad82612042565b60008083601f84011261208c57600080fd5b50813567ffffffffffffffff8111156120a457600080fd5b602083019150836020828501011115610ba357600080fd5b6000806000604084860312156120d157600080fd5b83359250602084013567ffffffffffffffff8111156120ef57600080fd5b6120fb8682870161207a565b9497909650939450505050565b60008060008060006060868803121561212057600080fd5b85359450602086013567ffffffffffffffff8082111561213f57600080fd5b61214b89838a0161207a565b9096509450604088013591508082111561216457600080fd5b506121718882890161207a565b969995985093965092949392505050565b6000806040838503121561219557600080fd5b823591506121a560208401612042565b90509250929050565b600080604083850312156121c157600080fd5b50508035926020909101359150565b60005b838110156121eb5781810151838201526020016121d3565b50506000910152565b6000815180845261220c8160208601602086016121d0565b601f01601f19169290920160200192915050565b828152604060208201526000611c5160408301846121f4565b60008060006060848603121561224e57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561227757600080fd5b5035919050565b602081526000610dad60208301846121f4565b600080600080606085870312156122a757600080fd5b8435935060208501359250604085013567ffffffffffffffff8111156122cc57600080fd5b6122d88782880161207a565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261230b57600080fd5b813567ffffffffffffffff80821115612326576123266122e4565b604051601f8301601f19908116603f0116810190828211818310171561234e5761234e6122e4565b8160405283815286602085880101111561236757600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561239c57600080fd5b8335925060208401359150604084013567ffffffffffffffff8111156123c157600080fd5b6123cd868287016122fa565b9150509250925092565b600080604083850312156123ea57600080fd5b823567ffffffffffffffff8082111561240257600080fd5b61240e868387016122fa565b9350602085013591508082111561242457600080fd5b50612431858286016122fa565b9150509250929050565b60008060006060848603121561245057600080fd5b8335925060208401359150604084013561ffff8116811461247057600080fd5b809150509250925092565b80356001600160a01b038116811461205a57600080fd5b600080604083850312156124a557600080fd5b823591506121a56020840161247b565b6000806000606084860312156124ca57600080fd5b833592506124da60208501612042565b91506124e86040850161247b565b90509250925092565b60006020828403121561250357600080fd5b610dad8261247b565b6000825161251e8184602087016121d0565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b818103818111156104d7576104d7612528565b8183823760009101908152919050565b600181811c9082168061257557607f821691505b60208210810361259557634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561143257600081815260208120601f850160051c810160208610156125c25750805b601f850160051c820191505b818110156125e1578281556001016125ce565b505050505050565b67ffffffffffffffff831115612601576126016122e4565b6126158361260f8354612561565b8361259b565b6000601f84116001811461264957600085156126315750838201355b600019600387901b1c1916600186901b1783556111b2565b600083815260209020601f19861690835b8281101561267a578685013582556020948501946001909201910161265a565b50868210156126975760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6040815260006126e66040830186886126a9565b82810360208401526126f98185876126a9565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b602081526000611c516020830184866126a9565b600067ffffffffffffffff80831681810361274b5761274b612528565b6001019392505050565b815167ffffffffffffffff81111561276f5761276f6122e4565b6127838161277d8454612561565b8461259b565b602080601f8311600181146127b857600084156127a05750858301515b600019600386901b1c1916600185901b1785556125e1565b600085815260208120601f198616915b828110156127e7578886015182559484019460019091019084016127c8565b50858210156128055787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60408152600061282860408301866121f4565b828103602084015261283b8185876126a9565b9695505050505050565b600061ffff82168061285957612859612528565b6000190192915050565b60408152600061287660408301856121f4565b905061ffff831660208301529392505050565b600061ffff80831681810361274b5761274b612528565b6060815260006128b360608301866121f4565b61ffff85166020840152828103604084015261283b81856121f4565b808201808211156104d7576104d7612528565b634e487b7160e01b600052600160045260246000fdfea2646970667358221220067d269006ab51b834b5d54ad704780f0c53d98e5918ddb339566fa00683e56564736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101c45760003560e01c8063715018a6116100f9578063c869023311610097578063d700ff3311610071578063d700ff3314610450578063e59d895d14610493578063f1cb7e06146104a6578063f2fde38b146104b957600080fd5b8063c8690233146103d0578063ce3decdc1461042a578063d5fa2b001461043d57600080fd5b80638da5cb5b116100d35780638da5cb5b146103865780639061b92314610397578063a8fa5682146103aa578063bc1c58d1146103bd57600080fd5b8063715018a61461035857806377372213146103605780638b95dd711461037357600080fd5b80633603d7581161016657806359d1d43c1161014057806359d1d43c146102ff5780635c98042b1461031f578063623195b014610332578063691f34311461034557600080fd5b80633603d7581461028b5780633b3b57de1461029e5780634cbf6ba4146102b157600080fd5b8063124a319c116101a2578063124a319c146102195780632203ab561461024457806329cd62ea14610265578063304e6ade1461027857600080fd5b806301ffc9a7146101c95780630af179d7146101f157806310f13a8c14610206575b600080fd5b6101dc6101d736600461205f565b6104cc565b60405190151581526020015b60405180910390f35b6102046101ff3660046120bc565b6104dd565b005b610204610214366004612108565b6106ef565b61022c610227366004612182565b6107c4565b6040516001600160a01b0390911681526020016101e8565b6102576102523660046121ae565b610a72565b6040516101e8929190612220565b610204610273366004612239565b610baa565b6102046102863660046120bc565b610c52565b610204610299366004612265565b610cd6565b61022c6102ac366004612265565b610d81565b6101dc6102bf3660046121ae565b60008281526001602090815260408083205467ffffffffffffffff1683526007825280832094835293815283822092825291909152205461ffff16151590565b61031261030d3660046120bc565b610db4565b6040516101e8919061227e565b61031261032d366004612265565b610e96565b610204610340366004612291565b610f57565b610312610353366004612265565b610ffc565b610204611038565b61020461036e3660046120bc565b61104c565b610204610381366004612387565b6110d0565b6000546001600160a01b031661022c565b6103126103a53660046123d7565b6111b9565b6103126103b836600461243b565b611232565b6103126103cb366004612265565b611282565b6104156103de366004612265565b60008181526001602081815260408084205467ffffffffffffffff168452600a825280842094845293905291902080549101549091565b604080519283526020830191909152016101e8565b6102046104383660046120bc565b6112be565b61020461044b366004612492565b611409565b61047a61045e366004612265565b60016020526000908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016101e8565b6102046104a13660046124b5565b611437565b6103126104b43660046121ae565b6114f3565b6102046104c73660046124f1565b6115bd565b60006104d782611652565b92915050565b60005483906001600160a01b031633146104f657600080fd5b6000848152600160209081526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff90911691839161055e9183918d908d908190840183828082843760009201919091525092939250506116909050565b90505b80515160208201511015610688578661ffff166000036105c6578060400151965061058b816116f1565b94508460405160200161059e919061250c565b6040516020818303038152906040528051906020012092506105bf81611712565b935061067a565b60006105d1826116f1565b9050816040015161ffff168861ffff161415806105f557506105f3868261172e565b155b15610678576106518c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d915061064890829061253e565b8b51158a61174c565b81604001519750816020015196508095508580519060200120935061067582611712565b94505b505b610683816119b9565b610561565b508351156106e3576106e38a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c92506106da91508290508f61253e565b8951158861174c565b50505050505050505050565b60005485906001600160a01b0316331461070857600080fd5b60008681526001602090815260408083205467ffffffffffffffff168352600b82528083208984529091529081902090518491849161074a9089908990612551565b908152602001604051809103902091826107659291906125e9565b508484604051610776929190612551565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516107b494939291906126d2565b60405180910390a3505050505050565b60008281526001602090815260408083205467ffffffffffffffff1683526008825280832085845282528083206001600160e01b0319851684529091528120546001600160a01b0316801561081a5790506104d7565b600061082585610d81565b90506001600160a01b038116610840576000925050506104d7565b6040516301ffc9a760e01b602482015260009081906001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516108ad919061250c565b600060405180830381855afa9150503d80600081146108e8576040519150601f19603f3d011682016040523d82523d6000602084013e6108ed565b606091505b5091509150811580610900575060208151105b80610942575080601f8151811061091957610919612704565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109545760009450505050506104d7565b6040516001600160e01b0319871660248201526001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516109bf919061250c565b600060405180830381855afa9150503d80600081146109fa576040519150601f19603f3d011682016040523d82523d6000602084013e6109ff565b606091505b509092509050811580610a13575060208151105b80610a55575080601f81518110610a2c57610a2c612704565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610a675760009450505050506104d7565b509095945050505050565b60008281526001602081815260408084205467ffffffffffffffff1684526002825280842086855290915282206060915b848111610b8a5780851615801590610ad3575060008181526020839052604081208054610acf90612561565b9050115b15610b825780826000838152602001908152602001600020808054610af790612561565b80601f0160208091040260200160405190810160405280929190818152602001828054610b2390612561565b8015610b705780601f10610b4557610100808354040283529160200191610b70565b820191906000526020600020905b815481529060010190602001808311610b5357829003601f168201915b50505050509050935093505050610ba3565b60011b610aa3565b5060006040518060200160405280600081525092509250505b9250929050565b60005483906001600160a01b03163314610bc357600080fd5b6040805180820182528481526020808201858152600088815260018084528582205467ffffffffffffffff168252600a84528582208a835290935284902092518355519101555184907f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4690610c449086908690918252602082015260400190565b60405180910390a250505050565b60005483906001600160a01b03163314610c6b57600080fd5b60008481526001602090815260408083205467ffffffffffffffff168352600482528083208784529091529020610ca38385836125e9565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610c4492919061271a565b60005481906001600160a01b03163314610cef57600080fd5b6000828152600160205260408120805467ffffffffffffffff1691610d138361272e565b82546101009290920a67ffffffffffffffff8181021990931691831602179091556000848152600160209081526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610d90836102ca6114f3565b90508051600003610da45750600092915050565b610dad81611aa1565b9392505050565b60008381526001602090815260408083205467ffffffffffffffff168352600b825280832086845290915290819020905160609190610df69085908590612551565b90815260200160405180910390208054610e0f90612561565b80601f0160208091040260200160405190810160405280929190818152602001828054610e3b90612561565b8015610e885780601f10610e5d57610100808354040283529160200191610e88565b820191906000526020600020905b815481529060010190602001808311610e6b57829003601f168201915b505050505090509392505050565b60008181526001602090815260408083205467ffffffffffffffff168352600582528083208484529091529020805460609190610ed290612561565b80601f0160208091040260200160405190810160405280929190818152602001828054610efe90612561565b8015610f4b5780601f10610f2057610100808354040283529160200191610f4b565b820191906000526020600020905b815481529060010190602001808311610f2e57829003601f168201915b50505050509050919050565b60005484906001600160a01b03163314610f7057600080fd5b83610f7c60018261253e565b1615610f8757600080fd5b60008581526001602090815260408083205467ffffffffffffffff1683526002825280832088845282528083208784529091529020610fc78385836125e9565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b60008181526001602090815260408083205467ffffffffffffffff168352600982528083208484529091529020805460609190610ed290612561565b611040611ac9565b61104a6000611b23565b565b60005483906001600160a01b0316331461106557600080fd5b60008481526001602090815260408083205467ffffffffffffffff16835260098252808320878452909152902061109d8385836125e9565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610c4492919061271a565b60005483906001600160a01b031633146110e957600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af752848460405161111b929190612220565b60405180910390a26102ca830361117357837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd261115784611aa1565b6040516001600160a01b03909116815260200160405180910390a25b60008481526001602090815260408083205467ffffffffffffffff16835260038252808320878452825280832086845290915290206111b28382612755565b5050505050565b6060600080306001600160a01b0316846040516111d6919061250c565b600060405180830381855afa9150503d8060008114611211576040519150601f19603f3d011682016040523d82523d6000602084013e611216565b606091505b5091509150811561122a5791506104d79050565b805160208201fd5b60008381526001602090815260408083205467ffffffffffffffff168352600682528083208684528252808320858452825280832061ffff851684529091529020805460609190610e0f90612561565b60008181526001602090815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610ed290612561565b60005483906001600160a01b031633146112d757600080fd5b60008481526001602090815260408083205467ffffffffffffffff16808452600583528184208885529092528220805491929161131390612561565b80601f016020809104026020016040519081016040528092919081815260200182805461133f90612561565b801561138c5780601f106113615761010080835404028352916020019161138c565b820191906000526020600020905b81548152906001019060200180831161136f57829003601f168201915b5050505067ffffffffffffffff841660009081526005602090815260408083208b845290915290209192506113c490508587836125e9565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f858287876040516113f993929190612815565b60405180910390a2505050505050565b60005482906001600160a01b0316331461142257600080fd5b611432836102ca61038185611b80565b505050565b60005483906001600160a01b0316331461145057600080fd5b60008481526001602090815260408083205467ffffffffffffffff1683526008825280832087845282528083206001600160e01b0319871680855290835292819020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b60008281526001602090815260408083205467ffffffffffffffff168352600382528083208584528252808320848452909152902080546060919061153790612561565b80601f016020809104026020016040519081016040528092919081815260200182805461156390612561565b80156115b05780601f10611585576101008083540402835291602001916115b0565b820191906000526020600020905b81548152906001019060200180831161159357829003601f168201915b5050505050905092915050565b6115c5611ac9565b6001600160a01b0381166116465760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61164f81611b23565b50565b60006001600160e01b031982167f59d1d43c0000000000000000000000000000000000000000000000000000000014806104d757506104d782611bb9565b6116de6040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c081018290526104d7816119b9565b602081015181516060916104d7916117099082611bf7565b84519190611c59565b60a081015160c08201516060916104d79161170990829061253e565b600081518351148015610dad5750610dad8360008460008751611cd0565b865160208801206000611760878787611c59565b9050831561188a5767ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152902080546117ab90612561565b15905061180a5767ffffffffffffffff831660009081526007602090815260408083208d845282528083208584529091528120805461ffff16916117ee83612845565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152812061184b91611ff4565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a60405161187d929190612863565b60405180910390a26106e3565b67ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c168452909152902080546118cd90612561565b905060000361192e5767ffffffffffffffff831660009081526007602090815260408083208d845282528083208584529091528120805461ffff169161191283612889565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526006602090815260408083208d84528252808320858452825280832061ffff8c16845290915290206119708282612755565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a846040516119a5939291906128a0565b60405180910390a250505050505050505050565b60c081015160208201819052815151116119d05750565b60006119e482600001518360200151611bf7565b82602001516119f391906128cf565b8251909150611a029082611cf3565b61ffff166040830152611a166002826128cf565b8251909150611a259082611cf3565b61ffff166060830152611a396002826128cf565b8251909150611a489082611d1b565b63ffffffff166080830152611a5e6004826128cf565b8251909150600090611a709083611cf3565b61ffff169050611a816002836128cf565b60a084018190529150611a9481836128cf565b60c0909301929092525050565b60008151601414611ab157600080fd5b50602001516c01000000000000000000000000900490565b6000546001600160a01b0316331461104a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161163d565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60006001600160e01b031982167fc86902330000000000000000000000000000000000000000000000000000000014806104d757506104d782611d45565b6000815b83518110611c0b57611c0b6128e2565b6000611c178583611d83565b60ff169050611c278160016128cf565b611c3190836128cf565b915080600003611c415750611c47565b50611bfb565b611c51838261253e565b949350505050565b8251606090611c6883856128cf565b1115611c7357600080fd5b60008267ffffffffffffffff811115611c8e57611c8e6122e4565b6040519080825280601f01601f191660200182016040528015611cb8576020820181803683370190505b50905060208082019086860101610a67828287611da7565b6000611cdd848484611dfd565b611ce8878785611dfd565b149695505050505050565b8151600090611d038360026128cf565b1115611d0e57600080fd5b50016002015161ffff1690565b8151600090611d2b8360046128cf565b1115611d3657600080fd5b50016004015163ffffffff1690565b60006001600160e01b031982167f691f34310000000000000000000000000000000000000000000000000000000014806104d757506104d782611e21565b6000828281518110611d9757611d97612704565b016020015160f81c905092915050565b60208110611ddf5781518352611dbe6020846128cf565b9250611dcb6020836128cf565b9150611dd860208261253e565b9050611da7565b905182516020929092036101000a6000190180199091169116179052565b8251600090611e0c83856128cf565b1115611e1757600080fd5b5091016020012090565b60006001600160e01b031982167f124a319c0000000000000000000000000000000000000000000000000000000014806104d757506104d78260006001600160e01b031982167fa8fa5682000000000000000000000000000000000000000000000000000000001480611ebd57506001600160e01b031982167f5c98042b00000000000000000000000000000000000000000000000000000000145b806104d757506104d78260006001600160e01b031982167fbc1c58d10000000000000000000000000000000000000000000000000000000014806104d757506104d78260006001600160e01b031982167f3b3b57de000000000000000000000000000000000000000000000000000000001480611f6357506001600160e01b031982167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b806104d757506104d78260006001600160e01b031982167f2203ab560000000000000000000000000000000000000000000000000000000014806104d757506104d78260006001600160e01b031982167fd700ff330000000000000000000000000000000000000000000000000000000014806104d757506301ffc9a760e01b6001600160e01b03198316146104d7565b50805461200090612561565b6000825580601f10612010575050565b601f01602090049060005260206000209081019061164f91905b8082111561203e576000815560010161202a565b5090565b80356001600160e01b03198116811461205a57600080fd5b919050565b60006020828403121561207157600080fd5b610dad82612042565b60008083601f84011261208c57600080fd5b50813567ffffffffffffffff8111156120a457600080fd5b602083019150836020828501011115610ba357600080fd5b6000806000604084860312156120d157600080fd5b83359250602084013567ffffffffffffffff8111156120ef57600080fd5b6120fb8682870161207a565b9497909650939450505050565b60008060008060006060868803121561212057600080fd5b85359450602086013567ffffffffffffffff8082111561213f57600080fd5b61214b89838a0161207a565b9096509450604088013591508082111561216457600080fd5b506121718882890161207a565b969995985093965092949392505050565b6000806040838503121561219557600080fd5b823591506121a560208401612042565b90509250929050565b600080604083850312156121c157600080fd5b50508035926020909101359150565b60005b838110156121eb5781810151838201526020016121d3565b50506000910152565b6000815180845261220c8160208601602086016121d0565b601f01601f19169290920160200192915050565b828152604060208201526000611c5160408301846121f4565b60008060006060848603121561224e57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561227757600080fd5b5035919050565b602081526000610dad60208301846121f4565b600080600080606085870312156122a757600080fd5b8435935060208501359250604085013567ffffffffffffffff8111156122cc57600080fd5b6122d88782880161207a565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261230b57600080fd5b813567ffffffffffffffff80821115612326576123266122e4565b604051601f8301601f19908116603f0116810190828211818310171561234e5761234e6122e4565b8160405283815286602085880101111561236757600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561239c57600080fd5b8335925060208401359150604084013567ffffffffffffffff8111156123c157600080fd5b6123cd868287016122fa565b9150509250925092565b600080604083850312156123ea57600080fd5b823567ffffffffffffffff8082111561240257600080fd5b61240e868387016122fa565b9350602085013591508082111561242457600080fd5b50612431858286016122fa565b9150509250929050565b60008060006060848603121561245057600080fd5b8335925060208401359150604084013561ffff8116811461247057600080fd5b809150509250925092565b80356001600160a01b038116811461205a57600080fd5b600080604083850312156124a557600080fd5b823591506121a56020840161247b565b6000806000606084860312156124ca57600080fd5b833592506124da60208501612042565b91506124e86040850161247b565b90509250925092565b60006020828403121561250357600080fd5b610dad8261247b565b6000825161251e8184602087016121d0565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b818103818111156104d7576104d7612528565b8183823760009101908152919050565b600181811c9082168061257557607f821691505b60208210810361259557634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561143257600081815260208120601f850160051c810160208610156125c25750805b601f850160051c820191505b818110156125e1578281556001016125ce565b505050505050565b67ffffffffffffffff831115612601576126016122e4565b6126158361260f8354612561565b8361259b565b6000601f84116001811461264957600085156126315750838201355b600019600387901b1c1916600186901b1783556111b2565b600083815260209020601f19861690835b8281101561267a578685013582556020948501946001909201910161265a565b50868210156126975760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6040815260006126e66040830186886126a9565b82810360208401526126f98185876126a9565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b602081526000611c516020830184866126a9565b600067ffffffffffffffff80831681810361274b5761274b612528565b6001019392505050565b815167ffffffffffffffff81111561276f5761276f6122e4565b6127838161277d8454612561565b8461259b565b602080601f8311600181146127b857600084156127a05750858301515b600019600386901b1c1916600185901b1785556125e1565b600085815260208120601f198616915b828110156127e7578886015182559484019460019091019084016127c8565b50858210156128055787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60408152600061282860408301866121f4565b828103602084015261283b8185876126a9565b9695505050505050565b600061ffff82168061285957612859612528565b6000190192915050565b60408152600061287660408301856121f4565b905061ffff831660208301529392505050565b600061ffff80831681810361274b5761274b612528565b6060815260006128b360608301866121f4565b61ffff85166020840152828103604084015261283b81856121f4565b808201808211156104d7576104d7612528565b634e487b7160e01b600052600160045260246000fdfea2646970667358221220067d269006ab51b834b5d54ad704780f0c53d98e5918ddb339566fa00683e56564736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "ABI(bytes32,uint256)": { + "params": { + "contentTypes": "A bitwise OR of the ABI formats accepted by the caller.", + "node": "The ENS node to query" + }, + "returns": { + "_0": "contentType The content type of the return value", + "_1": "data The ABI data" + } + }, + "addr(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated address." + } + }, + "clearRecords(bytes32)": { + "params": { + "node": "The node to update." + } + }, + "contenthash(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated contenthash." + } + }, + "dnsRecord(bytes32,bytes32,uint16)": { + "params": { + "name": "the keccak-256 hash of the fully-qualified name for which to fetch the record", + "node": "the namehash of the node for which to fetch the record", + "resource": "the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types" + }, + "returns": { + "_0": "the DNS record in wire format if present, otherwise empty" + } + }, + "hasDNSRecords(bytes32,bytes32)": { + "params": { + "name": "the namehash of the node for which to check the records", + "node": "the namehash of the node for which to check the records" + } + }, + "interfaceImplementer(bytes32,bytes4)": { + "params": { + "interfaceID": "The EIP 165 interface ID to check for.", + "node": "The ENS node to query." + }, + "returns": { + "_0": "The address that implements this interface, or 0 if the interface is unsupported." + } + }, + "name(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated name." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pubkey(bytes32)": { + "params": { + "node": "The ENS node to query" + }, + "returns": { + "x": "The X coordinate of the curve point for the public key.", + "y": "The Y coordinate of the curve point for the public key." + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "setABI(bytes32,uint256,bytes)": { + "params": { + "contentType": "The content type of the ABI", + "data": "The ABI data.", + "node": "The node to update." + } + }, + "setAddr(bytes32,address)": { + "params": { + "a": "The address to set.", + "node": "The node to update." + } + }, + "setContenthash(bytes32,bytes)": { + "params": { + "hash": "The contenthash to set", + "node": "The node to update." + } + }, + "setDNSRecords(bytes32,bytes)": { + "params": { + "data": "the DNS wire format records to set", + "node": "the namehash of the node for which to set the records" + } + }, + "setInterface(bytes32,bytes4,address)": { + "params": { + "implementer": "The address of a contract that implements this interface for this node.", + "interfaceID": "The EIP 165 interface ID.", + "node": "The node to update." + } + }, + "setName(bytes32,string)": { + "params": { + "node": "The node to update." + } + }, + "setPubkey(bytes32,bytes32,bytes32)": { + "params": { + "node": "The ENS node to query", + "x": "the X coordinate of the curve point for the public key.", + "y": "the Y coordinate of the curve point for the public key." + } + }, + "setText(bytes32,string,string)": { + "params": { + "key": "The key to set.", + "node": "The node to update.", + "value": "The text data value to set." + } + }, + "setZonehash(bytes32,bytes)": { + "params": { + "hash": "The zonehash to set", + "node": "The node to update." + } + }, + "text(bytes32,string)": { + "params": { + "key": "The text data key to query.", + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated text data." + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "zonehash(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated contenthash." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "ABI(bytes32,uint256)": { + "notice": "Returns the ABI associated with an ENS node. Defined in EIP205." + }, + "addr(bytes32)": { + "notice": "Returns the address associated with an ENS node." + }, + "clearRecords(bytes32)": { + "notice": "Increments the record version associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "contenthash(bytes32)": { + "notice": "Returns the contenthash associated with an ENS node." + }, + "dnsRecord(bytes32,bytes32,uint16)": { + "notice": "Obtain a DNS record." + }, + "hasDNSRecords(bytes32,bytes32)": { + "notice": "Check if a given node has records." + }, + "interfaceImplementer(bytes32,bytes4)": { + "notice": "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." + }, + "name(bytes32)": { + "notice": "Returns the name associated with an ENS node, for reverse records. Defined in EIP181." + }, + "pubkey(bytes32)": { + "notice": "Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619." + }, + "setABI(bytes32,uint256,bytes)": { + "notice": "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." + }, + "setAddr(bytes32,address)": { + "notice": "Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "setContenthash(bytes32,bytes)": { + "notice": "Sets the contenthash associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "setDNSRecords(bytes32,bytes)": { + "notice": "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." + }, + "setInterface(bytes32,bytes4,address)": { + "notice": "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." + }, + "setName(bytes32,string)": { + "notice": "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." + }, + "setPubkey(bytes32,bytes32,bytes32)": { + "notice": "Sets the SECP256k1 public key associated with an ENS node." + }, + "setText(bytes32,string,string)": { + "notice": "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." + }, + "setZonehash(bytes32,bytes)": { + "notice": "setZonehash sets the hash for the zone. May only be called by the owner of that node in the ENS registry." + }, + "text(bytes32,string)": { + "notice": "Returns the text data associated with an ENS node and key." + }, + "zonehash(bytes32)": { + "notice": "zonehash obtains the hash for the zone." + } + }, + "notice": "A simple resolver anyone can use; only allows the owner of a node to set its address.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 474, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 10574, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "recordVersions", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_uint64)" + }, + { + "astId": 10653, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_abis", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))" + }, + { + "astId": 10807, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_addresses", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))" + }, + { + "astId": 10998, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_hashes", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))" + }, + { + "astId": 11088, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_zonehashes", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))" + }, + { + "astId": 11098, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_records", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))))" + }, + { + "astId": 11106, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_nameEntriesCount", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16)))" + }, + { + "astId": 11830, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_interfaces", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes4,t_address)))" + }, + { + "astId": 12022, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_names", + "offset": 0, + "slot": "9", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_string_storage))" + }, + { + "astId": 12109, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_pubkeys", + "offset": 0, + "slot": "10", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_struct(PublicKey)12102_storage))" + }, + { + "astId": 12212, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "versionable_texts", + "offset": 0, + "slot": "11", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage)))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes4": { + "encoding": "inplace", + "label": "bytes4", + "numberOfBytes": "4" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage)))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes32 => uint16))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_uint16)" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes4,t_address))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes4 => address))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes4,t_address)" + }, + "t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(string => string))", + "numberOfBytes": "32", + "value": "t_mapping(t_string_memory_ptr,t_string_storage)" + }, + "t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint16 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint16,t_bytes_storage)" + }, + "t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint256 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_bytes_storage)" + }, + "t_mapping(t_bytes32,t_string_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_bytes32,t_struct(PublicKey)12102_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct PubkeyResolver.PublicKey)", + "numberOfBytes": "32", + "value": "t_struct(PublicKey)12102_storage" + }, + "t_mapping(t_bytes32,t_uint16)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint16)", + "numberOfBytes": "32", + "value": "t_uint16" + }, + "t_mapping(t_bytes32,t_uint64)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint64)", + "numberOfBytes": "32", + "value": "t_uint64" + }, + "t_mapping(t_bytes4,t_address)": { + "encoding": "mapping", + "key": "t_bytes4", + "label": "mapping(bytes4 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_string_memory_ptr,t_string_storage)": { + "encoding": "mapping", + "key": "t_string_memory_ptr", + "label": "mapping(string => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_uint16,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint256,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_bytes_storage)" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage)))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes4,t_address)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes4,t_address))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(string => string)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_string_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => string))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_string_storage)" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_struct(PublicKey)12102_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => struct PubkeyResolver.PublicKey))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_struct(PublicKey)12102_storage)" + }, + "t_string_memory_ptr": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(PublicKey)12102_storage": { + "encoding": "inplace", + "label": "struct PubkeyResolver.PublicKey", + "members": [ + { + "astId": 12099, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "x", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 12101, + "contract": "contracts/resolvers/OwnedResolver.sol:OwnedResolver", + "label": "y", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint16": { + "encoding": "inplace", + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint64": { + "encoding": "inplace", + "label": "uint64", + "numberOfBytes": "8" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/PublicResolver.json b/solidity/dns-contracts/deployments/testnet/PublicResolver.json new file mode 100644 index 0000000..75e4f8d --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/PublicResolver.json @@ -0,0 +1,1676 @@ +{ + "address": "0xe3b0181a7c7F5fA0dE6894062Ae2f15bFb41E283", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract INameWrapper", + "name": "wrapperAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_trustedETHController", + "type": "address" + }, + { + "internalType": "address", + "name": "_trustedReverseRegistrar", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + } + ], + "name": "ABIChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "AddrChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "Approved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "ContenthashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "record", + "type": "bytes" + } + ], + "name": "DNSRecordChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "DNSRecordDeleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "lastzonehash", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "zonehash", + "type": "bytes" + } + ], + "name": "DNSZonehashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "InterfaceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "PubkeyChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "string", + "name": "indexedKey", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "TextChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "newVersion", + "type": "uint64" + } + ], + "name": "VersionChanged", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentTypes", + "type": "uint256" + } + ], + "name": "ABI", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "clearRecords", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "contenthash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "dnsRecord", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + } + ], + "name": "hasDNSRecords", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "interfaceImplementer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "delegate", + "type": "address" + } + ], + "name": "isApprovedFor", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "nodehash", + "type": "bytes32" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicallWithNodeCheck", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "pubkey", + "outputs": [ + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "recordVersions", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "contentType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setABI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "a", + "type": "bytes" + } + ], + "name": "setAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "setAddr", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setContenthash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "setDNSRecords", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + }, + { + "internalType": "address", + "name": "implementer", + "type": "address" + } + ], + "name": "setInterface", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "newName", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "x", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "y", + "type": "bytes32" + } + ], + "name": "setPubkey", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + }, + { + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "setText", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setZonehash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "name": "text", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "zonehash", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x79fbdd365c53533eca3d983e64440d2a6dd8d7b90e1dc68dc98ba6812ff2ae88", + "receipt": { + "to": null, + "from": "0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B", + "contractAddress": "0xe3b0181a7c7F5fA0dE6894062Ae2f15bFb41E283", + "transactionIndex": 2, + "gasUsed": "2764883", + "logsBloom": "0x00000000000000000000000000000104000000000000000000000000000000000000000000000000000000000000004000000000000010000010200000000008000000000000000000000000008000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000080000000000800000000000000000200000000000000000000000000040000000000010000000000000000000000000008000040000000000000000000000000000000000005000000000010000000000000000000001000000000000000000000000000000000001010080001000000000000000000000", + "blockHash": "0x54c307c3a3f7490ac89f0cbfe831b54434665235cb10b7ed791bb3d577df5834", + "transactionHash": "0x79fbdd365c53533eca3d983e64440d2a6dd8d7b90e1dc68dc98ba6812ff2ae88", + "logs": [ + { + "transactionIndex": 2, + "blockNumber": 57535161, + "transactionHash": "0x79fbdd365c53533eca3d983e64440d2a6dd8d7b90e1dc68dc98ba6812ff2ae88", + "address": "0x2E5ba310fDa0aD5dfA4CC5656FAEDDd4CC4c162b", + "topics": [ + "0x6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e92", + "0x000000000000000000000000e3b0181a7c7f5fa0de6894062ae2f15bfb41e283", + "0x29bb47765d22654cd4ba082c380b8f469a4221beb4e66d203a1e8681d72735ea" + ], + "data": "0x", + "logIndex": 4, + "blockHash": "0x54c307c3a3f7490ac89f0cbfe831b54434665235cb10b7ed791bb3d577df5834" + }, + { + "transactionIndex": 2, + "blockNumber": 57535161, + "transactionHash": "0x79fbdd365c53533eca3d983e64440d2a6dd8d7b90e1dc68dc98ba6812ff2ae88", + "address": "0x8390D472587cCAe988dD06Ccd456Ac70CcF39038", + "topics": [ + "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", + "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2", + "0x105a79b6f75e00b66a2b4689de0a1aa3f2b388c99c1a29c3f13a001fd094b8fc" + ], + "data": "0x0000000000000000000000002a0d7311fa7e9ac2890cfd8219b2def0c206e79b", + "logIndex": 5, + "blockHash": "0x54c307c3a3f7490ac89f0cbfe831b54434665235cb10b7ed791bb3d577df5834" + } + ], + "blockNumber": 57535161, + "cumulativeGasUsed": "2974838", + "status": 1, + "byzantium": true + }, + "args": [ + "0x8390D472587cCAe988dD06Ccd456Ac70CcF39038", + "0x399c16D8156E1145912c106DD811702440242B93", + "0xB85759dd66E5554bf4Fc0e19cc71eC11e0f3FE2E", + "0x2E5ba310fDa0aD5dfA4CC5656FAEDDd4CC4c162b" + ], + "numDeployments": 1, + "solcInputHash": "7ef7523a40dd1de60e38563e79c7448b", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract INameWrapper\",\"name\":\"wrapperAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_trustedETHController\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_trustedReverseRegistrar\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"}],\"name\":\"ABIChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"AddrChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"newAddress\",\"type\":\"bytes\"}],\"name\":\"AddressChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"Approved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"ContenthashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"record\",\"type\":\"bytes\"}],\"name\":\"DNSRecordChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"DNSRecordDeleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"lastzonehash\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"zonehash\",\"type\":\"bytes\"}],\"name\":\"DNSZonehashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"InterfaceChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NameChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"PubkeyChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"indexedKey\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"TextChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"newVersion\",\"type\":\"uint64\"}],\"name\":\"VersionChanged\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentTypes\",\"type\":\"uint256\"}],\"name\":\"ABI\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"clearRecords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"contenthash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"dnsRecord\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"hasDNSRecords\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"interfaceImplementer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"delegate\",\"type\":\"address\"}],\"name\":\"isApprovedFor\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nodehash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicallWithNodeCheck\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"pubkey\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"recordVersions\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setABI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"a\",\"type\":\"bytes\"}],\"name\":\"setAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"setAddr\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setContenthash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setDNSRecords\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"setInterface\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"newName\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"setPubkey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"setText\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setZonehash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"}],\"name\":\"text\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"zonehash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"ABI(bytes32,uint256)\":{\"params\":{\"contentTypes\":\"A bitwise OR of the ABI formats accepted by the caller.\",\"node\":\"The ENS node to query\"},\"returns\":{\"_0\":\"contentType The content type of the return value\",\"_1\":\"data The ABI data\"}},\"addr(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated address.\"}},\"approve(bytes32,address,bool)\":{\"details\":\"Approve a delegate to be able to updated records on a node.\"},\"clearRecords(bytes32)\":{\"params\":{\"node\":\"The node to update.\"}},\"contenthash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated contenthash.\"}},\"dnsRecord(bytes32,bytes32,uint16)\":{\"params\":{\"name\":\"the keccak-256 hash of the fully-qualified name for which to fetch the record\",\"node\":\"the namehash of the node for which to fetch the record\",\"resource\":\"the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\"},\"returns\":{\"_0\":\"the DNS record in wire format if present, otherwise empty\"}},\"hasDNSRecords(bytes32,bytes32)\":{\"params\":{\"name\":\"the namehash of the node for which to check the records\",\"node\":\"the namehash of the node for which to check the records\"}},\"interfaceImplementer(bytes32,bytes4)\":{\"params\":{\"interfaceID\":\"The EIP 165 interface ID to check for.\",\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The address that implements this interface, or 0 if the interface is unsupported.\"}},\"isApprovedFor(address,bytes32,address)\":{\"details\":\"Check to see if the delegate has been approved by the owner for the node.\"},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC1155-isApprovedForAll}.\"},\"name(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated name.\"}},\"pubkey(bytes32)\":{\"params\":{\"node\":\"The ENS node to query\"},\"returns\":{\"x\":\"The X coordinate of the curve point for the public key.\",\"y\":\"The Y coordinate of the curve point for the public key.\"}},\"setABI(bytes32,uint256,bytes)\":{\"params\":{\"contentType\":\"The content type of the ABI\",\"data\":\"The ABI data.\",\"node\":\"The node to update.\"}},\"setAddr(bytes32,address)\":{\"params\":{\"a\":\"The address to set.\",\"node\":\"The node to update.\"}},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC1155-setApprovalForAll}.\"},\"setContenthash(bytes32,bytes)\":{\"params\":{\"hash\":\"The contenthash to set\",\"node\":\"The node to update.\"}},\"setDNSRecords(bytes32,bytes)\":{\"params\":{\"data\":\"the DNS wire format records to set\",\"node\":\"the namehash of the node for which to set the records\"}},\"setInterface(bytes32,bytes4,address)\":{\"params\":{\"implementer\":\"The address of a contract that implements this interface for this node.\",\"interfaceID\":\"The EIP 165 interface ID.\",\"node\":\"The node to update.\"}},\"setName(bytes32,string)\":{\"params\":{\"node\":\"The node to update.\"}},\"setPubkey(bytes32,bytes32,bytes32)\":{\"params\":{\"node\":\"The ENS node to query\",\"x\":\"the X coordinate of the curve point for the public key.\",\"y\":\"the Y coordinate of the curve point for the public key.\"}},\"setText(bytes32,string,string)\":{\"params\":{\"key\":\"The key to set.\",\"node\":\"The node to update.\",\"value\":\"The text data value to set.\"}},\"setZonehash(bytes32,bytes)\":{\"params\":{\"hash\":\"The zonehash to set\",\"node\":\"The node to update.\"}},\"text(bytes32,string)\":{\"params\":{\"key\":\"The text data key to query.\",\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated text data.\"}},\"zonehash(bytes32)\":{\"params\":{\"node\":\"The ENS node to query.\"},\"returns\":{\"_0\":\"The associated contenthash.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"ABI(bytes32,uint256)\":{\"notice\":\"Returns the ABI associated with an ENS node. Defined in EIP205.\"},\"addr(bytes32)\":{\"notice\":\"Returns the address associated with an ENS node.\"},\"clearRecords(bytes32)\":{\"notice\":\"Increments the record version associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"contenthash(bytes32)\":{\"notice\":\"Returns the contenthash associated with an ENS node.\"},\"dnsRecord(bytes32,bytes32,uint16)\":{\"notice\":\"Obtain a DNS record.\"},\"hasDNSRecords(bytes32,bytes32)\":{\"notice\":\"Check if a given node has records.\"},\"interfaceImplementer(bytes32,bytes4)\":{\"notice\":\"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.\"},\"name(bytes32)\":{\"notice\":\"Returns the name associated with an ENS node, for reverse records. Defined in EIP181.\"},\"pubkey(bytes32)\":{\"notice\":\"Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619.\"},\"setABI(bytes32,uint256,bytes)\":{\"notice\":\"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.\"},\"setAddr(bytes32,address)\":{\"notice\":\"Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setContenthash(bytes32,bytes)\":{\"notice\":\"Sets the contenthash associated with an ENS node. May only be called by the owner of that node in the ENS registry.\"},\"setDNSRecords(bytes32,bytes)\":{\"notice\":\"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.\"},\"setInterface(bytes32,bytes4,address)\":{\"notice\":\"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.\"},\"setName(bytes32,string)\":{\"notice\":\"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.\"},\"setPubkey(bytes32,bytes32,bytes32)\":{\"notice\":\"Sets the SECP256k1 public key associated with an ENS node.\"},\"setText(bytes32,string,string)\":{\"notice\":\"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.\"},\"setZonehash(bytes32,bytes)\":{\"notice\":\"setZonehash sets the hash for the zone. May only be called by the owner of that node in the ENS registry.\"},\"text(bytes32,string)\":{\"notice\":\"Returns the text data associated with an ENS node and key.\"},\"zonehash(bytes32)\":{\"notice\":\"zonehash obtains the hash for the zone.\"}},\"notice\":\"A simple resolver anyone can use; only allows the owner of a node to set its address.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/resolvers/PublicResolver.sol\":\"PublicResolver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@ensdomains/buffer/contracts/Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-2-Clause\\npragma solidity ^0.8.4;\\n\\n/**\\n* @dev A library for working with mutable byte buffers in Solidity.\\n*\\n* Byte buffers are mutable and expandable, and provide a variety of primitives\\n* for appending to them. At any time you can fetch a bytes object containing the\\n* current contents of the buffer. The bytes object should not be stored between\\n* operations, as it may change due to resizing of the buffer.\\n*/\\nlibrary Buffer {\\n /**\\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\\n * a capacity. The capacity may be longer than the current value, in\\n * which case it can be extended without the need to allocate more memory.\\n */\\n struct buffer {\\n bytes buf;\\n uint capacity;\\n }\\n\\n /**\\n * @dev Initializes a buffer with an initial capacity.\\n * @param buf The buffer to initialize.\\n * @param capacity The number of bytes of space to allocate the buffer.\\n * @return The buffer, for chaining.\\n */\\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\\n if (capacity % 32 != 0) {\\n capacity += 32 - (capacity % 32);\\n }\\n // Allocate space for the buffer data\\n buf.capacity = capacity;\\n assembly {\\n let ptr := mload(0x40)\\n mstore(buf, ptr)\\n mstore(ptr, 0)\\n let fpm := add(32, add(ptr, capacity))\\n if lt(fpm, ptr) {\\n revert(0, 0)\\n }\\n mstore(0x40, fpm)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Initializes a new buffer from an existing bytes object.\\n * Changes to the buffer may mutate the original value.\\n * @param b The bytes object to initialize the buffer with.\\n * @return A new buffer.\\n */\\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\\n buffer memory buf;\\n buf.buf = b;\\n buf.capacity = b.length;\\n return buf;\\n }\\n\\n function resize(buffer memory buf, uint capacity) private pure {\\n bytes memory oldbuf = buf.buf;\\n init(buf, capacity);\\n append(buf, oldbuf);\\n }\\n\\n /**\\n * @dev Sets buffer length to 0.\\n * @param buf The buffer to truncate.\\n * @return The original buffer, for chaining..\\n */\\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\\n assembly {\\n let bufptr := mload(buf)\\n mstore(bufptr, 0)\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to copy.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\\n require(len <= data.length);\\n\\n uint off = buf.buf.length;\\n uint newCapacity = off + len;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint dest;\\n uint src;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Length of existing buffer data\\n let buflen := mload(bufptr)\\n // Start address = buffer address + offset + sizeof(buffer length)\\n dest := add(add(bufptr, 32), off)\\n // Update buffer length if we're extending it\\n if gt(newCapacity, buflen) {\\n mstore(bufptr, newCapacity)\\n }\\n src := add(data, 32)\\n }\\n\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\\n return append(buf, data, data.length);\\n }\\n\\n /**\\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\\n * capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint offPlusOne = off + 1;\\n if (off >= buf.capacity) {\\n resize(buf, offPlusOne * 2);\\n }\\n\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + off\\n let dest := add(add(bufptr, off), 32)\\n mstore8(dest, data)\\n // Update buffer length if we extended it\\n if gt(offPlusOne, mload(bufptr)) {\\n mstore(bufptr, offPlusOne)\\n }\\n }\\n\\n return buf;\\n }\\n\\n /**\\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (left-aligned).\\n * @return The original buffer, for chaining.\\n */\\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n unchecked {\\n uint mask = (256 ** len) - 1;\\n // Right-align data\\n data = data >> (8 * (32 - len));\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n }\\n return buf;\\n }\\n\\n /**\\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chhaining.\\n */\\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\\n return append(buf, bytes32(data), 20);\\n }\\n\\n /**\\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\\n * the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @return The original buffer, for chaining.\\n */\\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\\n return append(buf, data, 32);\\n }\\n\\n /**\\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\\n * exceed the capacity of the buffer.\\n * @param buf The buffer to append to.\\n * @param data The data to append.\\n * @param len The number of bytes to write (right-aligned).\\n * @return The original buffer.\\n */\\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\\n uint off = buf.buf.length;\\n uint newCapacity = len + off;\\n if (newCapacity > buf.capacity) {\\n resize(buf, newCapacity * 2);\\n }\\n\\n uint mask = (256 ** len) - 1;\\n assembly {\\n // Memory address of the buffer data\\n let bufptr := mload(buf)\\n // Address = buffer address + sizeof(buffer length) + newCapacity\\n let dest := add(bufptr, newCapacity)\\n mstore(dest, or(and(mload(dest), not(mask)), data))\\n // Update buffer length if we extended it\\n if gt(newCapacity, mload(bufptr)) {\\n mstore(bufptr, newCapacity)\\n }\\n }\\n return buf;\\n }\\n}\\n\",\"keccak256\":\"0xd6dd3b0b327288f8e1b711a609f4040fea602e2ad4bba9febdf2f33b4e56eb0c\",\"license\":\"BSD-2-Clause\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/dnssec-oracle/RRUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"../utils/BytesUtils.sol\\\";\\nimport \\\"@ensdomains/buffer/contracts/Buffer.sol\\\";\\n\\n/**\\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\\n */\\nlibrary RRUtils {\\n using BytesUtils for *;\\n using Buffer for *;\\n\\n /**\\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The length of the DNS name at 'offset', in bytes.\\n */\\n function nameLength(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 idx = offset;\\n while (true) {\\n assert(idx < self.length);\\n uint256 labelLen = self.readUint8(idx);\\n idx += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n }\\n return idx - offset;\\n }\\n\\n /**\\n * @dev Returns a DNS format name at the specified offset of self.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return ret The name.\\n */\\n function readName(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes memory ret) {\\n uint256 len = nameLength(self, offset);\\n return self.substring(offset, len);\\n }\\n\\n /**\\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\\n * @param self The byte array to read a name from.\\n * @param offset The offset to start reading at.\\n * @return The number of labels in the DNS name at 'offset', in bytes.\\n */\\n function labelCount(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (uint256) {\\n uint256 count = 0;\\n while (true) {\\n assert(offset < self.length);\\n uint256 labelLen = self.readUint8(offset);\\n offset += labelLen + 1;\\n if (labelLen == 0) {\\n break;\\n }\\n count += 1;\\n }\\n return count;\\n }\\n\\n uint256 constant RRSIG_TYPE = 0;\\n uint256 constant RRSIG_ALGORITHM = 2;\\n uint256 constant RRSIG_LABELS = 3;\\n uint256 constant RRSIG_TTL = 4;\\n uint256 constant RRSIG_EXPIRATION = 8;\\n uint256 constant RRSIG_INCEPTION = 12;\\n uint256 constant RRSIG_KEY_TAG = 16;\\n uint256 constant RRSIG_SIGNER_NAME = 18;\\n\\n struct SignedSet {\\n uint16 typeCovered;\\n uint8 algorithm;\\n uint8 labels;\\n uint32 ttl;\\n uint32 expiration;\\n uint32 inception;\\n uint16 keytag;\\n bytes signerName;\\n bytes data;\\n bytes name;\\n }\\n\\n function readSignedSet(\\n bytes memory data\\n ) internal pure returns (SignedSet memory self) {\\n self.typeCovered = data.readUint16(RRSIG_TYPE);\\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\\n self.labels = data.readUint8(RRSIG_LABELS);\\n self.ttl = data.readUint32(RRSIG_TTL);\\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\\n self.inception = data.readUint32(RRSIG_INCEPTION);\\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\\n self.data = data.substring(\\n RRSIG_SIGNER_NAME + self.signerName.length,\\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\\n );\\n }\\n\\n function rrs(\\n SignedSet memory rrset\\n ) internal pure returns (RRIterator memory) {\\n return iterateRRs(rrset.data, 0);\\n }\\n\\n /**\\n * @dev An iterator over resource records.\\n */\\n struct RRIterator {\\n bytes data;\\n uint256 offset;\\n uint16 dnstype;\\n uint16 class;\\n uint32 ttl;\\n uint256 rdataOffset;\\n uint256 nextOffset;\\n }\\n\\n /**\\n * @dev Begins iterating over resource records.\\n * @param self The byte string to read from.\\n * @param offset The offset to start reading at.\\n * @return ret An iterator object.\\n */\\n function iterateRRs(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (RRIterator memory ret) {\\n ret.data = self;\\n ret.nextOffset = offset;\\n next(ret);\\n }\\n\\n /**\\n * @dev Returns true iff there are more RRs to iterate.\\n * @param iter The iterator to check.\\n * @return True iff the iterator has finished.\\n */\\n function done(RRIterator memory iter) internal pure returns (bool) {\\n return iter.offset >= iter.data.length;\\n }\\n\\n /**\\n * @dev Moves the iterator to the next resource record.\\n * @param iter The iterator to advance.\\n */\\n function next(RRIterator memory iter) internal pure {\\n iter.offset = iter.nextOffset;\\n if (iter.offset >= iter.data.length) {\\n return;\\n }\\n\\n // Skip the name\\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\\n\\n // Read type, class, and ttl\\n iter.dnstype = iter.data.readUint16(off);\\n off += 2;\\n iter.class = iter.data.readUint16(off);\\n off += 2;\\n iter.ttl = iter.data.readUint32(off);\\n off += 4;\\n\\n // Read the rdata\\n uint256 rdataLength = iter.data.readUint16(off);\\n off += 2;\\n iter.rdataOffset = off;\\n iter.nextOffset = off + rdataLength;\\n }\\n\\n /**\\n * @dev Returns the name of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the owner name from the RR.\\n */\\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.offset,\\n nameLength(iter.data, iter.offset)\\n );\\n }\\n\\n /**\\n * @dev Returns the rdata portion of the current record.\\n * @param iter The iterator.\\n * @return A new bytes object containing the RR's RDATA.\\n */\\n function rdata(\\n RRIterator memory iter\\n ) internal pure returns (bytes memory) {\\n return\\n iter.data.substring(\\n iter.rdataOffset,\\n iter.nextOffset - iter.rdataOffset\\n );\\n }\\n\\n uint256 constant DNSKEY_FLAGS = 0;\\n uint256 constant DNSKEY_PROTOCOL = 2;\\n uint256 constant DNSKEY_ALGORITHM = 3;\\n uint256 constant DNSKEY_PUBKEY = 4;\\n\\n struct DNSKEY {\\n uint16 flags;\\n uint8 protocol;\\n uint8 algorithm;\\n bytes publicKey;\\n }\\n\\n function readDNSKEY(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DNSKEY memory self) {\\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\\n self.publicKey = data.substring(\\n offset + DNSKEY_PUBKEY,\\n length - DNSKEY_PUBKEY\\n );\\n }\\n\\n uint256 constant DS_KEY_TAG = 0;\\n uint256 constant DS_ALGORITHM = 2;\\n uint256 constant DS_DIGEST_TYPE = 3;\\n uint256 constant DS_DIGEST = 4;\\n\\n struct DS {\\n uint16 keytag;\\n uint8 algorithm;\\n uint8 digestType;\\n bytes digest;\\n }\\n\\n function readDS(\\n bytes memory data,\\n uint256 offset,\\n uint256 length\\n ) internal pure returns (DS memory self) {\\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\\n }\\n\\n function isSubdomainOf(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n uint256 off = 0;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n while (counts > othercounts) {\\n off = progress(self, off);\\n counts--;\\n }\\n\\n return self.equals(off, other, 0);\\n }\\n\\n function compareNames(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n if (self.equals(other)) {\\n return 0;\\n }\\n\\n uint256 off;\\n uint256 otheroff;\\n uint256 prevoff;\\n uint256 otherprevoff;\\n uint256 counts = labelCount(self, 0);\\n uint256 othercounts = labelCount(other, 0);\\n\\n // Keep removing labels from the front of the name until both names are equal length\\n while (counts > othercounts) {\\n prevoff = off;\\n off = progress(self, off);\\n counts--;\\n }\\n\\n while (othercounts > counts) {\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n othercounts--;\\n }\\n\\n // Compare the last nonequal labels to each other\\n while (counts > 0 && !self.equals(off, other, otheroff)) {\\n prevoff = off;\\n off = progress(self, off);\\n otherprevoff = otheroff;\\n otheroff = progress(other, otheroff);\\n counts -= 1;\\n }\\n\\n if (off == 0) {\\n return -1;\\n }\\n if (otheroff == 0) {\\n return 1;\\n }\\n\\n return\\n self.compare(\\n prevoff + 1,\\n self.readUint8(prevoff),\\n other,\\n otherprevoff + 1,\\n other.readUint8(otherprevoff)\\n );\\n }\\n\\n /**\\n * @dev Compares two serial numbers using RFC1982 serial number math.\\n */\\n function serialNumberGte(\\n uint32 i1,\\n uint32 i2\\n ) internal pure returns (bool) {\\n unchecked {\\n return int32(i1) - int32(i2) >= 0;\\n }\\n }\\n\\n function progress(\\n bytes memory body,\\n uint256 off\\n ) internal pure returns (uint256) {\\n return off + 1 + body.readUint8(off);\\n }\\n\\n /**\\n * @dev Computes the keytag for a chunk of data.\\n * @param data The data to compute a keytag for.\\n * @return The computed key tag.\\n */\\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n /* This function probably deserves some explanation.\\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\\n *\\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\\n * uint ac;\\n * for (uint i = 0; i < data.length; i++) {\\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\\n * }\\n * return uint16(ac + (ac >> 16));\\n * }\\n *\\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\\n * large words work in our favour.\\n *\\n * The code below works by treating the input as a series of 256 bit words. It first masks out\\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\\n * effectively summing 16 different numbers with each EVM ADD opcode.\\n *\\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\\n * and the remaining sums can be done just on ac1.\\n */\\n unchecked {\\n require(data.length <= 8192, \\\"Long keys not permitted\\\");\\n uint256 ac1;\\n uint256 ac2;\\n for (uint256 i = 0; i < data.length + 31; i += 32) {\\n uint256 word;\\n assembly {\\n word := mload(add(add(data, 32), i))\\n }\\n if (i + 32 > data.length) {\\n uint256 unused = 256 - (data.length - i) * 8;\\n word = (word >> unused) << unused;\\n }\\n ac1 +=\\n (word &\\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\\n 8;\\n ac2 += (word &\\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\\n }\\n ac1 =\\n (ac1 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac1 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac2 =\\n (ac2 &\\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\\n ((ac2 &\\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\\n 16);\\n ac1 = (ac1 << 8) + ac2;\\n ac1 =\\n (ac1 &\\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\\n 32);\\n ac1 =\\n (ac1 &\\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\\n ((ac1 &\\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\\n 64);\\n ac1 =\\n (ac1 &\\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\\n (ac1 >> 128);\\n ac1 += (ac1 >> 16) & 0xFFFF;\\n return uint16(ac1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4470c1578b2ee78e64bd8925bf391ffe98d5497aeef15b593380c7fe905af5d\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/registry/ENS.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x8e208b44d5dbf22552fe72d79b45c640855b84fbc9ee21f4c3bb4bfe81cbe8db\",\"license\":\"MIT\"},\"contracts/resolvers/IMulticallable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IMulticallable {\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n}\\n\",\"keccak256\":\"0x0334202e20bb11995997083d05963f5e8e7ed6194cba494e7f9371ab7bf4e2c3\",\"license\":\"MIT\"},\"contracts/resolvers/Multicallable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nimport \\\"./IMulticallable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\n\\nabstract contract Multicallable is IMulticallable, ERC165 {\\n function _multicall(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) internal returns (bytes[] memory results) {\\n results = new bytes[](data.length);\\n for (uint256 i = 0; i < data.length; i++) {\\n if (nodehash != bytes32(0)) {\\n bytes32 txNamehash = bytes32(data[i][4:36]);\\n require(\\n txNamehash == nodehash,\\n \\\"multicall: All records must have a matching namehash\\\"\\n );\\n }\\n (bool success, bytes memory result) = address(this).delegatecall(\\n data[i]\\n );\\n require(success);\\n results[i] = result;\\n }\\n return results;\\n }\\n\\n // This function provides an extra security check when called\\n // from priviledged contracts (such as EthRegistrarController)\\n // that can set records on behalf of the node owners\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results) {\\n return _multicall(nodehash, data);\\n }\\n\\n function multicall(\\n bytes[] calldata data\\n ) public override returns (bytes[] memory results) {\\n return _multicall(bytes32(0), data);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IMulticallable).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x1063a9dd3b94ba304624d5ec6deb43c1916640758ae970eece4d4e3ef8b2fcb1\",\"license\":\"MIT\"},\"contracts/resolvers/PublicResolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./profiles/ABIResolver.sol\\\";\\nimport \\\"./profiles/AddrResolver.sol\\\";\\nimport \\\"./profiles/ContentHashResolver.sol\\\";\\nimport \\\"./profiles/DNSResolver.sol\\\";\\nimport \\\"./profiles/InterfaceResolver.sol\\\";\\nimport \\\"./profiles/NameResolver.sol\\\";\\nimport \\\"./profiles/PubkeyResolver.sol\\\";\\nimport \\\"./profiles/TextResolver.sol\\\";\\nimport \\\"./Multicallable.sol\\\";\\nimport {ReverseClaimer} from \\\"../reverseRegistrar/ReverseClaimer.sol\\\";\\nimport {INameWrapper} from \\\"../wrapper/INameWrapper.sol\\\";\\n\\n/**\\n * A simple resolver anyone can use; only allows the owner of a node to set its\\n * address.\\n */\\ncontract PublicResolver is\\n Multicallable,\\n ABIResolver,\\n AddrResolver,\\n ContentHashResolver,\\n DNSResolver,\\n InterfaceResolver,\\n NameResolver,\\n PubkeyResolver,\\n TextResolver,\\n ReverseClaimer\\n{\\n ENS immutable ens;\\n INameWrapper immutable nameWrapper;\\n address immutable trustedETHController;\\n address immutable trustedReverseRegistrar;\\n\\n /**\\n * A mapping of operators. An address that is authorised for an address\\n * may make any changes to the name that the owner could, but may not update\\n * the set of authorisations.\\n * (owner, operator) => approved\\n */\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * A mapping of delegates. A delegate that is authorised by an owner\\n * for a name may make changes to the name's resolver, but may not update\\n * the set of token approvals.\\n * (owner, name, delegate) => approved\\n */\\n mapping(address => mapping(bytes32 => mapping(address => bool)))\\n private _tokenApprovals;\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n // Logged when a delegate is approved or an approval is revoked.\\n event Approved(\\n address owner,\\n bytes32 indexed node,\\n address indexed delegate,\\n bool indexed approved\\n );\\n\\n constructor(\\n ENS _ens,\\n INameWrapper wrapperAddress,\\n address _trustedETHController,\\n address _trustedReverseRegistrar\\n ) ReverseClaimer(_ens, msg.sender) {\\n ens = _ens;\\n nameWrapper = wrapperAddress;\\n trustedETHController = _trustedETHController;\\n trustedReverseRegistrar = _trustedReverseRegistrar;\\n }\\n\\n /**\\n * @dev See {IERC1155-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) external {\\n require(\\n msg.sender != operator,\\n \\\"ERC1155: setting approval status for self\\\"\\n );\\n\\n _operatorApprovals[msg.sender][operator] = approved;\\n emit ApprovalForAll(msg.sender, operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC1155-isApprovedForAll}.\\n */\\n function isApprovedForAll(\\n address account,\\n address operator\\n ) public view returns (bool) {\\n return _operatorApprovals[account][operator];\\n }\\n\\n /**\\n * @dev Approve a delegate to be able to updated records on a node.\\n */\\n function approve(bytes32 node, address delegate, bool approved) external {\\n require(msg.sender != delegate, \\\"Setting delegate status for self\\\");\\n\\n _tokenApprovals[msg.sender][node][delegate] = approved;\\n emit Approved(msg.sender, node, delegate, approved);\\n }\\n\\n /**\\n * @dev Check to see if the delegate has been approved by the owner for the node.\\n */\\n function isApprovedFor(\\n address owner,\\n bytes32 node,\\n address delegate\\n ) public view returns (bool) {\\n return _tokenApprovals[owner][node][delegate];\\n }\\n\\n function isAuthorised(bytes32 node) internal view override returns (bool) {\\n if (\\n msg.sender == trustedETHController ||\\n msg.sender == trustedReverseRegistrar\\n ) {\\n return true;\\n }\\n address owner = ens.owner(node);\\n if (owner == address(nameWrapper)) {\\n owner = nameWrapper.ownerOf(uint256(node));\\n }\\n return\\n owner == msg.sender ||\\n isApprovedForAll(owner, msg.sender) ||\\n isApprovedFor(owner, node, msg.sender);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n )\\n public\\n view\\n override(\\n Multicallable,\\n ABIResolver,\\n AddrResolver,\\n ContentHashResolver,\\n DNSResolver,\\n InterfaceResolver,\\n NameResolver,\\n PubkeyResolver,\\n TextResolver\\n )\\n returns (bool)\\n {\\n return super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x24c839eb7118da8eea65d07401cc26bad0444a3e651b2cb19749c43065bd24de\",\"license\":\"MIT\"},\"contracts/resolvers/ResolverBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/ERC165.sol\\\";\\nimport \\\"./profiles/IVersionableResolver.sol\\\";\\n\\nabstract contract ResolverBase is ERC165, IVersionableResolver {\\n mapping(bytes32 => uint64) public recordVersions;\\n\\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\\n\\n modifier authorised(bytes32 node) {\\n require(isAuthorised(node));\\n _;\\n }\\n\\n /**\\n * Increments the record version associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function clearRecords(bytes32 node) public virtual authorised(node) {\\n recordVersions[node]++;\\n emit VersionChanged(node, recordVersions[node]);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IVersionableResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x893049fffd6feee06d7acef1680f6e26505bedff62a9f7a17e921c0ba2f66307\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"./IABIResolver.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\n\\nabstract contract ABIResolver is IABIResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\\n\\n /**\\n * Sets the ABI associated with an ENS node.\\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\\n * the empty string.\\n * @param node The node to update.\\n * @param contentType The content type of the ABI\\n * @param data The ABI data.\\n */\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external virtual authorised(node) {\\n // Content types must be powers of 2\\n require(((contentType - 1) & contentType) == 0);\\n\\n versionable_abis[recordVersions[node]][node][contentType] = data;\\n emit ABIChanged(node, contentType);\\n }\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view virtual override returns (uint256, bytes memory) {\\n mapping(uint256 => bytes) storage abiset = versionable_abis[\\n recordVersions[node]\\n ][node];\\n\\n for (\\n uint256 contentType = 1;\\n contentType <= contentTypes;\\n contentType <<= 1\\n ) {\\n if (\\n (contentType & contentTypes) != 0 &&\\n abiset[contentType].length > 0\\n ) {\\n return (contentType, abiset[contentType]);\\n }\\n }\\n\\n return (0, bytes(\\\"\\\"));\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IABIResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x2da96d7750786afe3be019fc6ff768e2d98a5e61d360bd92d8d7bc3c7c1dcc27\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/AddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IAddrResolver.sol\\\";\\nimport \\\"./IAddressResolver.sol\\\";\\n\\nabstract contract AddrResolver is\\n IAddrResolver,\\n IAddressResolver,\\n ResolverBase\\n{\\n uint256 private constant COIN_TYPE_ETH = 714;\\n\\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\\n\\n /**\\n * Sets the address associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param a The address to set.\\n */\\n function setAddr(\\n bytes32 node,\\n address a\\n ) external virtual authorised(node) {\\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\\n }\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(\\n bytes32 node\\n ) public view virtual override returns (address payable) {\\n bytes memory a = addr(node, COIN_TYPE_ETH);\\n if (a.length == 0) {\\n return payable(0);\\n }\\n return bytesToAddress(a);\\n }\\n\\n function setAddr(\\n bytes32 node,\\n uint256 coinType,\\n bytes memory a\\n ) public virtual authorised(node) {\\n emit AddressChanged(node, coinType, a);\\n if (coinType == COIN_TYPE_ETH) {\\n emit AddrChanged(node, bytesToAddress(a));\\n }\\n versionable_addresses[recordVersions[node]][node][coinType] = a;\\n }\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) public view virtual override returns (bytes memory) {\\n return versionable_addresses[recordVersions[node]][node][coinType];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IAddrResolver).interfaceId ||\\n interfaceID == type(IAddressResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function bytesToAddress(\\n bytes memory b\\n ) internal pure returns (address payable a) {\\n require(b.length == 20);\\n assembly {\\n a := div(mload(add(b, 32)), exp(256, 12))\\n }\\n }\\n\\n function addressToBytes(address a) internal pure returns (bytes memory b) {\\n b = new bytes(20);\\n assembly {\\n mstore(add(b, 32), mul(a, exp(256, 12)))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x545ecb86610407faa1b9e255f28879f8876de2ce1e2a0c6886fbf5ea494bd582\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IContentHashResolver.sol\\\";\\n\\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\\n\\n /**\\n * Sets the contenthash associated with an ENS node.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param hash The contenthash to set\\n */\\n function setContenthash(\\n bytes32 node,\\n bytes calldata hash\\n ) external virtual authorised(node) {\\n versionable_hashes[recordVersions[node]][node] = hash;\\n emit ContenthashChanged(node, hash);\\n }\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(\\n bytes32 node\\n ) external view virtual override returns (bytes memory) {\\n return versionable_hashes[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IContentHashResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xc9755bfb77985375ded880ecab5af41f2b9e8280f30d3e523fe5042ea59f93ea\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/DNSResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"../../dnssec-oracle/RRUtils.sol\\\";\\nimport \\\"./IDNSRecordResolver.sol\\\";\\nimport \\\"./IDNSZoneResolver.sol\\\";\\n\\nabstract contract DNSResolver is\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n ResolverBase\\n{\\n using RRUtils for *;\\n using BytesUtils for bytes;\\n\\n // Zone hashes for the domains.\\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\\n // resource containing a single zonefile.\\n // node => contenthash\\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\\n\\n // The records themselves. Stored as binary RRSETs\\n // node => version => name => resource => data\\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\\n private versionable_records;\\n\\n // Count of number of entries for a given name. Required for DNS resolvers\\n // when resolving wildcards.\\n // node => version => name => number of records\\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\\n private versionable_nameEntriesCount;\\n\\n /**\\n * Set one or more DNS records. Records are supplied in wire-format.\\n * Records with the same node/name/resource must be supplied one after the\\n * other to ensure the data is updated correctly. For example, if the data\\n * was supplied:\\n * a.example.com IN A 1.2.3.4\\n * a.example.com IN A 5.6.7.8\\n * www.example.com IN CNAME a.example.com.\\n * then this would store the two A records for a.example.com correctly as a\\n * single RRSET, however if the data was supplied:\\n * a.example.com IN A 1.2.3.4\\n * www.example.com IN CNAME a.example.com.\\n * a.example.com IN A 5.6.7.8\\n * then this would store the first A record, the CNAME, then the second A\\n * record which would overwrite the first.\\n *\\n * @param node the namehash of the node for which to set the records\\n * @param data the DNS wire format records to set\\n */\\n function setDNSRecords(\\n bytes32 node,\\n bytes calldata data\\n ) external virtual authorised(node) {\\n uint16 resource = 0;\\n uint256 offset = 0;\\n bytes memory name;\\n bytes memory value;\\n bytes32 nameHash;\\n uint64 version = recordVersions[node];\\n // Iterate over the data to add the resource records\\n for (\\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\\n !iter.done();\\n iter.next()\\n ) {\\n if (resource == 0) {\\n resource = iter.dnstype;\\n name = iter.name();\\n nameHash = keccak256(abi.encodePacked(name));\\n value = bytes(iter.rdata());\\n } else {\\n bytes memory newName = iter.name();\\n if (resource != iter.dnstype || !name.equals(newName)) {\\n setDNSRRSet(\\n node,\\n name,\\n resource,\\n data,\\n offset,\\n iter.offset - offset,\\n value.length == 0,\\n version\\n );\\n resource = iter.dnstype;\\n offset = iter.offset;\\n name = newName;\\n nameHash = keccak256(name);\\n value = bytes(iter.rdata());\\n }\\n }\\n }\\n if (name.length > 0) {\\n setDNSRRSet(\\n node,\\n name,\\n resource,\\n data,\\n offset,\\n data.length - offset,\\n value.length == 0,\\n version\\n );\\n }\\n }\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) public view virtual override returns (bytes memory) {\\n return versionable_records[recordVersions[node]][node][name][resource];\\n }\\n\\n /**\\n * Check if a given node has records.\\n * @param node the namehash of the node for which to check the records\\n * @param name the namehash of the node for which to check the records\\n */\\n function hasDNSRecords(\\n bytes32 node,\\n bytes32 name\\n ) public view virtual returns (bool) {\\n return (versionable_nameEntriesCount[recordVersions[node]][node][\\n name\\n ] != 0);\\n }\\n\\n /**\\n * setZonehash sets the hash for the zone.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param hash The zonehash to set\\n */\\n function setZonehash(\\n bytes32 node,\\n bytes calldata hash\\n ) external virtual authorised(node) {\\n uint64 currentRecordVersion = recordVersions[node];\\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\\n node\\n ];\\n versionable_zonehashes[currentRecordVersion][node] = hash;\\n emit DNSZonehashChanged(node, oldhash, hash);\\n }\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(\\n bytes32 node\\n ) external view virtual override returns (bytes memory) {\\n return versionable_zonehashes[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IDNSRecordResolver).interfaceId ||\\n interfaceID == type(IDNSZoneResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n\\n function setDNSRRSet(\\n bytes32 node,\\n bytes memory name,\\n uint16 resource,\\n bytes memory data,\\n uint256 offset,\\n uint256 size,\\n bool deleteRecord,\\n uint64 version\\n ) private {\\n bytes32 nameHash = keccak256(name);\\n bytes memory rrData = data.substring(offset, size);\\n if (deleteRecord) {\\n if (\\n versionable_records[version][node][nameHash][resource].length !=\\n 0\\n ) {\\n versionable_nameEntriesCount[version][node][nameHash]--;\\n }\\n delete (versionable_records[version][node][nameHash][resource]);\\n emit DNSRecordDeleted(node, name, resource);\\n } else {\\n if (\\n versionable_records[version][node][nameHash][resource].length ==\\n 0\\n ) {\\n versionable_nameEntriesCount[version][node][nameHash]++;\\n }\\n versionable_records[version][node][nameHash][resource] = rrData;\\n emit DNSRecordChanged(node, name, resource, rrData);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7233e4d2edca222ce6e1cdb07adf127ab52ecaea599fa5369971a7b28dbc59ac\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IVersionableResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IVersionableResolver {\\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\\n\\n function recordVersions(bytes32 node) external view returns (uint64);\\n}\\n\",\"keccak256\":\"0xd0d09596f20c57bafb2ffa8521a8c57120e9af6c6b194f9c689d4da56f91a57c\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/InterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./AddrResolver.sol\\\";\\nimport \\\"./IInterfaceResolver.sol\\\";\\n\\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\\n\\n /**\\n * Sets an interface associated with a name.\\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\\n * @param node The node to update.\\n * @param interfaceID The EIP 165 interface ID.\\n * @param implementer The address of a contract that implements this interface for this node.\\n */\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external virtual authorised(node) {\\n versionable_interfaces[recordVersions[node]][node][\\n interfaceID\\n ] = implementer;\\n emit InterfaceChanged(node, interfaceID, implementer);\\n }\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view virtual override returns (address) {\\n address implementer = versionable_interfaces[recordVersions[node]][\\n node\\n ][interfaceID];\\n if (implementer != address(0)) {\\n return implementer;\\n }\\n\\n address a = addr(node);\\n if (a == address(0)) {\\n return address(0);\\n }\\n\\n (bool success, bytes memory returnData) = a.staticcall(\\n abi.encodeWithSignature(\\n \\\"supportsInterface(bytes4)\\\",\\n type(IERC165).interfaceId\\n )\\n );\\n if (!success || returnData.length < 32 || returnData[31] == 0) {\\n // EIP 165 not supported by target\\n return address(0);\\n }\\n\\n (success, returnData) = a.staticcall(\\n abi.encodeWithSignature(\\\"supportsInterface(bytes4)\\\", interfaceID)\\n );\\n if (!success || returnData.length < 32 || returnData[31] == 0) {\\n // Specified interface not supported by target\\n return address(0);\\n }\\n\\n return a;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IInterfaceResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x820ec60183e7a49a4ee399cf4708acb776725c8e4ad275d1f316c152eace0a59\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/NameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./INameResolver.sol\\\";\\n\\nabstract contract NameResolver is INameResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\\n\\n /**\\n * Sets the name associated with an ENS node, for reverse records.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n */\\n function setName(\\n bytes32 node,\\n string calldata newName\\n ) external virtual authorised(node) {\\n versionable_names[recordVersions[node]][node] = newName;\\n emit NameChanged(node, newName);\\n }\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(\\n bytes32 node\\n ) external view virtual override returns (string memory) {\\n return versionable_names[recordVersions[node]][node];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(INameResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x52d0bbb8f9dd33fae471ef2f5f6b3118b221954e5bb7ba724885d4562e75b8e2\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/PubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./IPubkeyResolver.sol\\\";\\n\\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\\n struct PublicKey {\\n bytes32 x;\\n bytes32 y;\\n }\\n\\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\\n\\n /**\\n * Sets the SECP256k1 public key associated with an ENS node.\\n * @param node The ENS node to query\\n * @param x the X coordinate of the curve point for the public key.\\n * @param y the Y coordinate of the curve point for the public key.\\n */\\n function setPubkey(\\n bytes32 node,\\n bytes32 x,\\n bytes32 y\\n ) external virtual authorised(node) {\\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\\n emit PubkeyChanged(node, x, y);\\n }\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(\\n bytes32 node\\n ) external view virtual override returns (bytes32 x, bytes32 y) {\\n uint64 currentRecordVersion = recordVersions[node];\\n return (\\n versionable_pubkeys[currentRecordVersion][node].x,\\n versionable_pubkeys[currentRecordVersion][node].y\\n );\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(IPubkeyResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0x1a1f10a0e40520c998a9296fc81c092c81521e05a784e9bd9ee44cc4c62c8c78\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/TextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"../ResolverBase.sol\\\";\\nimport \\\"./ITextResolver.sol\\\";\\n\\nabstract contract TextResolver is ITextResolver, ResolverBase {\\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\\n\\n /**\\n * Sets the text data associated with an ENS node and key.\\n * May only be called by the owner of that node in the ENS registry.\\n * @param node The node to update.\\n * @param key The key to set.\\n * @param value The text data value to set.\\n */\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external virtual authorised(node) {\\n versionable_texts[recordVersions[node]][node][key] = value;\\n emit TextChanged(node, key, key, value);\\n }\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view virtual override returns (string memory) {\\n return versionable_texts[recordVersions[node]][node][key];\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return\\n interfaceID == type(ITextResolver).interfaceId ||\\n super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xf9bedd807add38136779d84083ac2fa4f8c92d017c9e1a72fbc9003fa5074379\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseClaimer.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\n\\ncontract ReverseClaimer {\\n bytes32 constant ADDR_REVERSE_NODE =\\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n constructor(ENS ens, address claimant) {\\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\\n ens.owner(ADDR_REVERSE_NODE)\\n );\\n reverseRegistrar.claim(claimant);\\n }\\n}\\n\",\"keccak256\":\"0x78a28627241535b595f6fff476a1fa7acc90c80684fe7784734920fc8af6fc22\",\"license\":\"MIT\"},\"contracts/utils/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes32) {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0xc566a3569af880a096a9bfb2fbb77060ef7aecde1a205dc26446a58877412060\",\"license\":\"MIT\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_CRE8OR = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x18a49abb805da867f3a6f49e1b898ba5b6afe5ae3a4b8f90152c0687ccc68048\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101006040523480156200001257600080fd5b50604051620032973803806200329783398101604081905262000035916200017a565b6040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152849033906000906001600160a01b038416906302571be390602401602060405180830381865afa158015620000a1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000c79190620001e2565b604051630f41a04d60e11b81526001600160a01b03848116600483015291925090821690631e83409a906024016020604051808303816000875af115801562000114573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200013a919062000209565b5050506001600160a01b039485166080525091831660a052821660c0521660e05262000223565b6001600160a01b03811681146200017757600080fd5b50565b600080600080608085870312156200019157600080fd5b84516200019e8162000161565b6020860151909450620001b18162000161565b6040860151909350620001c48162000161565b6060860151909250620001d78162000161565b939692955090935050565b600060208284031215620001f557600080fd5b8151620002028162000161565b9392505050565b6000602082840312156200021c57600080fd5b5051919050565b60805160a05160c05160e0516130336200026460003960006117da015260006117a80152600081816118b201526119180152600061183b01526130336000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c80638b95dd7111610104578063c8690233116100a2578063e32954eb11610071578063e32954eb14610504578063e59d895d14610517578063e985e9c51461052a578063f1cb7e061461056657600080fd5b8063c869023314610442578063ce3decdc1461049b578063d5fa2b00146104ae578063d700ff33146104c157600080fd5b8063a8fa5682116100de578063a8fa5682146103b8578063a9784b3e146103cb578063ac9650d81461040f578063bc1c58d11461042f57600080fd5b80638b95dd711461037f578063a22cb46514610392578063a4b91a01146103a557600080fd5b80633603d7581161017c5780635c98042b1161014b5780635c98042b14610333578063623195b014610346578063691f343114610359578063773722131461036c57600080fd5b80633603d758146102a15780633b3b57de146102b45780634cbf6ba4146102c757806359d1d43c1461031357600080fd5b8063124a319c116101b8578063124a319c1461022f5780632203ab561461025a57806329cd62ea1461027b578063304e6ade1461028e57600080fd5b806301ffc9a7146101df5780630af179d71461020757806310f13a8c1461021c575b600080fd5b6101f26101ed36600461252c565b610579565b60405190151581526020015b60405180910390f35b61021a610215366004612589565b61058a565b005b61021a61022a3660046125d5565b610794565b61024261023d36600461264f565b610861565b6040516001600160a01b0390911681526020016101fe565b61026d61026836600461267b565b610b0d565b6040516101fe9291906126ed565b61021a610289366004612706565b610c44565b61021a61029c366004612589565b610cdf565b61021a6102af366004612732565b610d5b565b6102426102c2366004612732565b610dfe565b6101f26102d536600461267b565b6000828152602081815260408083205467ffffffffffffffff1683526006825280832094835293815283822092825291909152205461ffff16151590565b610326610321366004612589565b610e31565b6040516101fe919061274b565b610326610341366004612732565b610f11565b61021a61035436600461275e565b610fd0565b610326610367366004612732565b61106d565b61021a61037a366004612589565b6110a7565b61021a61038d3660046127c7565b611123565b61021a6103a03660046128b0565b611204565b61021a6103b33660046128dc565b6112f3565b6103266103c636600461291a565b6113c0565b6101f26103d936600461295a565b6001600160a01b039283166000908152600c60209081526040808320948352938152838220929094168152925290205460ff1690565b61042261041d3660046129d6565b61140e565b6040516101fe9190612a18565b61032661043d366004612732565b61141c565b610486610450366004612732565b6000818152602081815260408083205467ffffffffffffffff168352600982528083209383529290522080546001909101549091565b604080519283526020830191909152016101fe565b61021a6104a9366004612589565b611456565b61021a6104bc366004612a7a565b611599565b6104eb6104cf366004612732565b60006020819052908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016101fe565b610422610512366004612aaa565b6115c1565b61021a610525366004612ae9565b6115d6565b6101f2610538366004612b1e565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b61032661057436600461267b565b611695565b60006105848261175d565b92915050565b826105948161179b565b61059d57600080fd5b600084815260208181526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff9091169183916106039183918d908d90819084018382808284376000920191909152509293925050611a029050565b90505b8051516020820151101561072d578661ffff1660000361066b578060400151965061063081611a63565b9450846040516020016106439190612b4c565b60405160208183030381529060405280519060200120925061066481611a84565b935061071f565b600061067682611a63565b9050816040015161ffff168861ffff1614158061069a57506106988682611aa0565b155b1561071d576106f68c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d91506106ed908290612b7e565b8b51158a611abe565b81604001519750816020015196508095508580519060200120935061071a82611a84565b94505b505b61072881611d2b565b610606565b50835115610788576107888a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c925061077f91508290508f612b7e565b89511588611abe565b50505050505050505050565b8461079e8161179b565b6107a757600080fd5b6000868152602081815260408083205467ffffffffffffffff168352600a8252808320898452909152908190209051849184916107e79089908990612b91565b90815260200160405180910390209182610802929190612c29565b508484604051610813929190612b91565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516108519493929190612d12565b60405180910390a3505050505050565b6000828152602081815260408083205467ffffffffffffffff1683526007825280832085845282528083206001600160e01b0319851684529091528120546001600160a01b031680156108b5579050610584565b60006108c085610dfe565b90506001600160a01b0381166108db57600092505050610584565b6040516301ffc9a760e01b602482015260009081906001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516109489190612b4c565b600060405180830381855afa9150503d8060008114610983576040519150601f19603f3d011682016040523d82523d6000602084013e610988565b606091505b509150915081158061099b575060208151105b806109dd575080601f815181106109b4576109b4612d44565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109ef576000945050505050610584565b6040516001600160e01b0319871660248201526001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b17905251610a5a9190612b4c565b600060405180830381855afa9150503d8060008114610a95576040519150601f19603f3d011682016040523d82523d6000602084013e610a9a565b606091505b509092509050811580610aae575060208151105b80610af0575080601f81518110610ac757610ac7612d44565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610b02576000945050505050610584565b509095945050505050565b6000828152602081815260408083205467ffffffffffffffff168352600180835281842086855290925282206060915b848111610c245780851615801590610b6d575060008181526020839052604081208054610b6990612ba1565b9050115b15610c1c5780826000838152602001908152602001600020808054610b9190612ba1565b80601f0160208091040260200160405190810160405280929190818152602001828054610bbd90612ba1565b8015610c0a5780601f10610bdf57610100808354040283529160200191610c0a565b820191906000526020600020905b815481529060010190602001808311610bed57829003601f168201915b50505050509050935093505050610c3d565b60011b610b3d565b5060006040518060200160405280600081525092509250505b9250929050565b82610c4e8161179b565b610c5757600080fd5b604080518082018252848152602080820185815260008881528083528481205467ffffffffffffffff1681526009835284812089825283528490209251835551600190920191909155815185815290810184905285917f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4691015b60405180910390a250505050565b82610ce98161179b565b610cf257600080fd5b6000848152602081815260408083205467ffffffffffffffff168352600382528083208784529091529020610d28838583612c29565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610cd1929190612d5a565b80610d658161179b565b610d6e57600080fd5b6000828152602081905260408120805467ffffffffffffffff1691610d9283612d6e565b82546101009290920a67ffffffffffffffff818102199093169183160217909155600084815260208181526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610e0d836102ca611695565b90508051600003610e215750600092915050565b610e2a81611e13565b9392505050565b6000838152602081815260408083205467ffffffffffffffff168352600a825280832086845290915290819020905160609190610e719085908590612b91565b90815260200160405180910390208054610e8a90612ba1565b80601f0160208091040260200160405190810160405280929190818152602001828054610eb690612ba1565b8015610f035780601f10610ed857610100808354040283529160200191610f03565b820191906000526020600020905b815481529060010190602001808311610ee657829003601f168201915b505050505090509392505050565b6000818152602081815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610f4b90612ba1565b80601f0160208091040260200160405190810160405280929190818152602001828054610f7790612ba1565b8015610fc45780601f10610f9957610100808354040283529160200191610fc4565b820191906000526020600020905b815481529060010190602001808311610fa757829003601f168201915b50505050509050919050565b83610fda8161179b565b610fe357600080fd5b83610fef600182612b7e565b1615610ffa57600080fd5b6000858152602081815260408083205467ffffffffffffffff1683526001825280832088845282528083208784529091529020611038838583612c29565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b6000818152602081815260408083205467ffffffffffffffff168352600882528083208484529091529020805460609190610f4b90612ba1565b826110b18161179b565b6110ba57600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526008825280832087845290915290206110f0838583612c29565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610cd1929190612d5a565b8261112d8161179b565b61113657600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af75284846040516111689291906126ed565b60405180910390a26102ca83036111c057837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd26111a484611e13565b6040516001600160a01b03909116815260200160405180910390a25b6000848152602081815260408083205467ffffffffffffffff16835260028252808320878452825280832086845290915290206111fd8382612d95565b5050505050565b6001600160a01b03821633036112875760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336000818152600b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6001600160a01b038216330361134b5760405162461bcd60e51b815260206004820181905260248201527f53657474696e672064656c65676174652073746174757320666f722073656c66604482015260640161127e565b336000818152600c6020908152604080832087845282528083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519384529286917ff0ddb3b04746704017f9aa8bd728fcc2c1d11675041205350018915f5e4750a0910160405180910390a4505050565b6000838152602081815260408083205467ffffffffffffffff168352600582528083208684528252808320858452825280832061ffff851684529091529020805460609190610e8a90612ba1565b6060610e2a60008484611e3b565b6000818152602081815260408083205467ffffffffffffffff168352600382528083208484529091529020805460609190610f4b90612ba1565b826114608161179b565b61146957600080fd5b6000848152602081815260408083205467ffffffffffffffff1680845260048352818420888552909252822080549192916114a390612ba1565b80601f01602080910402602001604051908101604052809291908181526020018280546114cf90612ba1565b801561151c5780601f106114f15761010080835404028352916020019161151c565b820191906000526020600020905b8154815290600101906020018083116114ff57829003601f168201915b5050505067ffffffffffffffff841660009081526004602090815260408083208b845290915290209192506115549050858783612c29565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f8582878760405161158993929190612e55565b60405180910390a2505050505050565b816115a38161179b565b6115ac57600080fd5b6115bc836102ca61038d85612014565b505050565b60606115ce848484611e3b565b949350505050565b826115e08161179b565b6115e957600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526007825280832087845282528083206001600160e01b031987168085529083529281902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b6000828152602081815260408083205467ffffffffffffffff16835260028252808320858452825280832084845290915290208054606091906116d790612ba1565b80601f016020809104026020016040519081016040528092919081815260200182805461170390612ba1565b80156117505780601f1061172557610100808354040283529160200191611750565b820191906000526020600020905b81548152906001019060200180831161173357829003601f168201915b5050505050905092915050565b60006001600160e01b031982167f59d1d43c00000000000000000000000000000000000000000000000000000000148061058457506105848261204d565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806117fc5750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b1561180957506001919050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa15801561188a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ae9190612e85565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b03160361198e576040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611967573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061198b9190612e85565b90505b6001600160a01b0381163314806119c857506001600160a01b0381166000908152600b6020908152604080832033845290915290205460ff165b80610e2a57506001600160a01b0381166000908152600c60209081526040808320868452825280832033845290915290205460ff16610e2a565b611a506040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261058481611d2b565b6020810151815160609161058491611a7b908261208b565b845191906120e5565b60a081015160c082015160609161058491611a7b908290612b7e565b600081518351148015610e2a5750610e2a836000846000875161215c565b865160208801206000611ad28787876120e5565b90508315611bfc5767ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611b1d90612ba1565b159050611b7c5767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611b6083612ea2565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091528120611bbd916124b9565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a604051611bef929190612ec0565b60405180910390a2610788565b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611c3f90612ba1565b9050600003611ca05767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611c8483612ee6565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091529020611ce28282612d95565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a84604051611d1793929190612efd565b60405180910390a250505050505050505050565b60c08101516020820181905281515111611d425750565b6000611d568260000151836020015161208b565b8260200151611d659190612f2c565b8251909150611d74908261217f565b61ffff166040830152611d88600282612f2c565b8251909150611d97908261217f565b61ffff166060830152611dab600282612f2c565b8251909150611dba90826121a7565b63ffffffff166080830152611dd0600482612f2c565b8251909150600090611de2908361217f565b61ffff169050611df3600283612f2c565b60a084018190529150611e068183612f2c565b60c0909301929092525050565b60008151601414611e2357600080fd5b50602001516c01000000000000000000000000900490565b60608167ffffffffffffffff811115611e5657611e566127b1565b604051908082528060200260200182016040528015611e8957816020015b6060815260200190600190039081611e745790505b50905060005b8281101561200c578415611f54576000848483818110611eb157611eb1612d44565b9050602002810190611ec39190612f3f565b611ed291602491600491612f86565b611edb91612fb0565b9050858114611f525760405162461bcd60e51b815260206004820152603460248201527f6d756c746963616c6c3a20416c6c207265636f726473206d757374206861766560448201527f2061206d61746368696e67206e616d6568617368000000000000000000000000606482015260840161127e565b505b60008030868685818110611f6a57611f6a612d44565b9050602002810190611f7c9190612f3f565b604051611f8a929190612b91565b600060405180830381855af49150503d8060008114611fc5576040519150601f19603f3d011682016040523d82523d6000602084013e611fca565b606091505b509150915081611fd957600080fd5b80848481518110611fec57611fec612d44565b60200260200101819052505050808061200490612fce565b915050611e8f565b509392505050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60006001600160e01b031982167fc86902330000000000000000000000000000000000000000000000000000000014806105845750610584826121d1565b6000815b8351811061209f5761209f612fe7565b60006120ab858361220f565b60ff1690506120bb816001612f2c565b6120c59083612f2c565b9150806000036120d557506120db565b5061208f565b6115ce8382612b7e565b82516060906120f48385612f2c565b11156120ff57600080fd5b60008267ffffffffffffffff81111561211a5761211a6127b1565b6040519080825280601f01601f191660200182016040528015612144576020820181803683370190505b50905060208082019086860101610b02828287612233565b6000612169848484612289565b612174878785612289565b149695505050505050565b815160009061218f836002612f2c565b111561219a57600080fd5b50016002015161ffff1690565b81516000906121b7836004612f2c565b11156121c257600080fd5b50016004015163ffffffff1690565b60006001600160e01b031982167f691f34310000000000000000000000000000000000000000000000000000000014806105845750610584826122ad565b600082828151811061222357612223612d44565b016020015160f81c905092915050565b6020811061226b578151835261224a602084612f2c565b9250612257602083612f2c565b9150612264602082612b7e565b9050612233565b905182516020929092036101000a6000190180199091169116179052565b82516000906122988385612f2c565b11156122a357600080fd5b5091016020012090565b60006001600160e01b031982167f124a319c00000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167fa8fa568200000000000000000000000000000000000000000000000000000000148061234957506001600160e01b031982167f5c98042b00000000000000000000000000000000000000000000000000000000145b8061058457506105848260006001600160e01b031982167fbc1c58d100000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167f3b3b57de0000000000000000000000000000000000000000000000000000000014806123ef57506001600160e01b031982167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061058457506105848260006001600160e01b031982167f2203ab5600000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167fd700ff3300000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167f4fbf043300000000000000000000000000000000000000000000000000000000148061058457506301ffc9a760e01b6001600160e01b0319831614610584565b5080546124c590612ba1565b6000825580601f106124d5575050565b601f0160209004906000526020600020908101906124f391906124f6565b50565b5b8082111561250b57600081556001016124f7565b5090565b80356001600160e01b03198116811461252757600080fd5b919050565b60006020828403121561253e57600080fd5b610e2a8261250f565b60008083601f84011261255957600080fd5b50813567ffffffffffffffff81111561257157600080fd5b602083019150836020828501011115610c3d57600080fd5b60008060006040848603121561259e57600080fd5b83359250602084013567ffffffffffffffff8111156125bc57600080fd5b6125c886828701612547565b9497909650939450505050565b6000806000806000606086880312156125ed57600080fd5b85359450602086013567ffffffffffffffff8082111561260c57600080fd5b61261889838a01612547565b9096509450604088013591508082111561263157600080fd5b5061263e88828901612547565b969995985093965092949392505050565b6000806040838503121561266257600080fd5b823591506126726020840161250f565b90509250929050565b6000806040838503121561268e57600080fd5b50508035926020909101359150565b60005b838110156126b85781810151838201526020016126a0565b50506000910152565b600081518084526126d981602086016020860161269d565b601f01601f19169290920160200192915050565b8281526040602082015260006115ce60408301846126c1565b60008060006060848603121561271b57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561274457600080fd5b5035919050565b602081526000610e2a60208301846126c1565b6000806000806060858703121561277457600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561279957600080fd5b6127a587828801612547565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b6000806000606084860312156127dc57600080fd5b8335925060208401359150604084013567ffffffffffffffff8082111561280257600080fd5b818601915086601f83011261281657600080fd5b813581811115612828576128286127b1565b604051601f8201601f19908116603f01168101908382118183101715612850576128506127b1565b8160405282815289602084870101111561286957600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b6001600160a01b03811681146124f357600080fd5b8035801515811461252757600080fd5b600080604083850312156128c357600080fd5b82356128ce8161288b565b9150612672602084016128a0565b6000806000606084860312156128f157600080fd5b8335925060208401356129038161288b565b9150612911604085016128a0565b90509250925092565b60008060006060848603121561292f57600080fd5b8335925060208401359150604084013561ffff8116811461294f57600080fd5b809150509250925092565b60008060006060848603121561296f57600080fd5b833561297a8161288b565b925060208401359150604084013561294f8161288b565b60008083601f8401126129a357600080fd5b50813567ffffffffffffffff8111156129bb57600080fd5b6020830191508360208260051b8501011115610c3d57600080fd5b600080602083850312156129e957600080fd5b823567ffffffffffffffff811115612a0057600080fd5b612a0c85828601612991565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612a6d57603f19888603018452612a5b8583516126c1565b94509285019290850190600101612a3f565b5092979650505050505050565b60008060408385031215612a8d57600080fd5b823591506020830135612a9f8161288b565b809150509250929050565b600080600060408486031215612abf57600080fd5b83359250602084013567ffffffffffffffff811115612add57600080fd5b6125c886828701612991565b600080600060608486031215612afe57600080fd5b83359250612b0e6020850161250f565b9150604084013561294f8161288b565b60008060408385031215612b3157600080fd5b8235612b3c8161288b565b91506020830135612a9f8161288b565b60008251612b5e81846020870161269d565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561058457610584612b68565b8183823760009101908152919050565b600181811c90821680612bb557607f821691505b602082108103612bd557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156115bc57600081815260208120601f850160051c81016020861015612c025750805b601f850160051c820191505b81811015612c2157828155600101612c0e565b505050505050565b67ffffffffffffffff831115612c4157612c416127b1565b612c5583612c4f8354612ba1565b83612bdb565b6000601f841160018114612c895760008515612c715750838201355b600019600387901b1c1916600186901b1783556111fd565b600083815260209020601f19861690835b82811015612cba5786850135825560209485019460019092019101612c9a565b5086821015612cd75760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b604081526000612d26604083018688612ce9565b8281036020840152612d39818587612ce9565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b6020815260006115ce602083018486612ce9565b600067ffffffffffffffff808316818103612d8b57612d8b612b68565b6001019392505050565b815167ffffffffffffffff811115612daf57612daf6127b1565b612dc381612dbd8454612ba1565b84612bdb565b602080601f831160018114612df85760008415612de05750858301515b600019600386901b1c1916600185901b178555612c21565b600085815260208120601f198616915b82811015612e2757888601518255948401946001909101908401612e08565b5085821015612e455787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000612e6860408301866126c1565b8281036020840152612e7b818587612ce9565b9695505050505050565b600060208284031215612e9757600080fd5b8151610e2a8161288b565b600061ffff821680612eb657612eb6612b68565b6000190192915050565b604081526000612ed360408301856126c1565b905061ffff831660208301529392505050565b600061ffff808316818103612d8b57612d8b612b68565b606081526000612f1060608301866126c1565b61ffff851660208401528281036040840152612e7b81856126c1565b8082018082111561058457610584612b68565b6000808335601e19843603018112612f5657600080fd5b83018035915067ffffffffffffffff821115612f7157600080fd5b602001915036819003821315610c3d57600080fd5b60008085851115612f9657600080fd5b83861115612fa357600080fd5b5050820193919092039150565b8035602083101561058457600019602084900360031b1b1692915050565b600060018201612fe057612fe0612b68565b5060010190565b634e487b7160e01b600052600160045260246000fdfea2646970667358221220c0d1cf867dd2f3822fc09a17389e509c3a29596e0f763016a8f4758501dafb7364736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101da5760003560e01c80638b95dd7111610104578063c8690233116100a2578063e32954eb11610071578063e32954eb14610504578063e59d895d14610517578063e985e9c51461052a578063f1cb7e061461056657600080fd5b8063c869023314610442578063ce3decdc1461049b578063d5fa2b00146104ae578063d700ff33146104c157600080fd5b8063a8fa5682116100de578063a8fa5682146103b8578063a9784b3e146103cb578063ac9650d81461040f578063bc1c58d11461042f57600080fd5b80638b95dd711461037f578063a22cb46514610392578063a4b91a01146103a557600080fd5b80633603d7581161017c5780635c98042b1161014b5780635c98042b14610333578063623195b014610346578063691f343114610359578063773722131461036c57600080fd5b80633603d758146102a15780633b3b57de146102b45780634cbf6ba4146102c757806359d1d43c1461031357600080fd5b8063124a319c116101b8578063124a319c1461022f5780632203ab561461025a57806329cd62ea1461027b578063304e6ade1461028e57600080fd5b806301ffc9a7146101df5780630af179d71461020757806310f13a8c1461021c575b600080fd5b6101f26101ed36600461252c565b610579565b60405190151581526020015b60405180910390f35b61021a610215366004612589565b61058a565b005b61021a61022a3660046125d5565b610794565b61024261023d36600461264f565b610861565b6040516001600160a01b0390911681526020016101fe565b61026d61026836600461267b565b610b0d565b6040516101fe9291906126ed565b61021a610289366004612706565b610c44565b61021a61029c366004612589565b610cdf565b61021a6102af366004612732565b610d5b565b6102426102c2366004612732565b610dfe565b6101f26102d536600461267b565b6000828152602081815260408083205467ffffffffffffffff1683526006825280832094835293815283822092825291909152205461ffff16151590565b610326610321366004612589565b610e31565b6040516101fe919061274b565b610326610341366004612732565b610f11565b61021a61035436600461275e565b610fd0565b610326610367366004612732565b61106d565b61021a61037a366004612589565b6110a7565b61021a61038d3660046127c7565b611123565b61021a6103a03660046128b0565b611204565b61021a6103b33660046128dc565b6112f3565b6103266103c636600461291a565b6113c0565b6101f26103d936600461295a565b6001600160a01b039283166000908152600c60209081526040808320948352938152838220929094168152925290205460ff1690565b61042261041d3660046129d6565b61140e565b6040516101fe9190612a18565b61032661043d366004612732565b61141c565b610486610450366004612732565b6000818152602081815260408083205467ffffffffffffffff168352600982528083209383529290522080546001909101549091565b604080519283526020830191909152016101fe565b61021a6104a9366004612589565b611456565b61021a6104bc366004612a7a565b611599565b6104eb6104cf366004612732565b60006020819052908152604090205467ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016101fe565b610422610512366004612aaa565b6115c1565b61021a610525366004612ae9565b6115d6565b6101f2610538366004612b1e565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b61032661057436600461267b565b611695565b60006105848261175d565b92915050565b826105948161179b565b61059d57600080fd5b600084815260208181526040808320548151601f870184900484028101840190925285825283926060928392859267ffffffffffffffff9091169183916106039183918d908d90819084018382808284376000920191909152509293925050611a029050565b90505b8051516020820151101561072d578661ffff1660000361066b578060400151965061063081611a63565b9450846040516020016106439190612b4c565b60405160208183030381529060405280519060200120925061066481611a84565b935061071f565b600061067682611a63565b9050816040015161ffff168861ffff1614158061069a57506106988682611aa0565b155b1561071d576106f68c878a8e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801518d91506106ed908290612b7e565b8b51158a611abe565b81604001519750816020015196508095508580519060200120935061071a82611a84565b94505b505b61072881611d2b565b610606565b50835115610788576107888a85888c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c925061077f91508290508f612b7e565b89511588611abe565b50505050505050505050565b8461079e8161179b565b6107a757600080fd5b6000868152602081815260408083205467ffffffffffffffff168352600a8252808320898452909152908190209051849184916107e79089908990612b91565b90815260200160405180910390209182610802929190612c29565b508484604051610813929190612b91565b6040518091039020867f448bc014f1536726cf8d54ff3d6481ed3cbc683c2591ca204274009afa09b1a1878787876040516108519493929190612d12565b60405180910390a3505050505050565b6000828152602081815260408083205467ffffffffffffffff1683526007825280832085845282528083206001600160e01b0319851684529091528120546001600160a01b031680156108b5579050610584565b60006108c085610dfe565b90506001600160a01b0381166108db57600092505050610584565b6040516301ffc9a760e01b602482015260009081906001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b179052516109489190612b4c565b600060405180830381855afa9150503d8060008114610983576040519150601f19603f3d011682016040523d82523d6000602084013e610988565b606091505b509150915081158061099b575060208151105b806109dd575080601f815181106109b4576109b4612d44565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b156109ef576000945050505050610584565b6040516001600160e01b0319871660248201526001600160a01b0384169060440160408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b17905251610a5a9190612b4c565b600060405180830381855afa9150503d8060008114610a95576040519150601f19603f3d011682016040523d82523d6000602084013e610a9a565b606091505b509092509050811580610aae575060208151105b80610af0575080601f81518110610ac757610ac7612d44565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016155b15610b02576000945050505050610584565b509095945050505050565b6000828152602081815260408083205467ffffffffffffffff168352600180835281842086855290925282206060915b848111610c245780851615801590610b6d575060008181526020839052604081208054610b6990612ba1565b9050115b15610c1c5780826000838152602001908152602001600020808054610b9190612ba1565b80601f0160208091040260200160405190810160405280929190818152602001828054610bbd90612ba1565b8015610c0a5780601f10610bdf57610100808354040283529160200191610c0a565b820191906000526020600020905b815481529060010190602001808311610bed57829003601f168201915b50505050509050935093505050610c3d565b60011b610b3d565b5060006040518060200160405280600081525092509250505b9250929050565b82610c4e8161179b565b610c5757600080fd5b604080518082018252848152602080820185815260008881528083528481205467ffffffffffffffff1681526009835284812089825283528490209251835551600190920191909155815185815290810184905285917f1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e4691015b60405180910390a250505050565b82610ce98161179b565b610cf257600080fd5b6000848152602081815260408083205467ffffffffffffffff168352600382528083208784529091529020610d28838583612c29565b50837fe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d75788484604051610cd1929190612d5a565b80610d658161179b565b610d6e57600080fd5b6000828152602081905260408120805467ffffffffffffffff1691610d9283612d6e565b82546101009290920a67ffffffffffffffff818102199093169183160217909155600084815260208181526040918290205491519190921681528492507fc6621ccb8f3f5a04bb6502154b2caf6adf5983fe76dfef1cfc9c42e3579db444910160405180910390a25050565b600080610e0d836102ca611695565b90508051600003610e215750600092915050565b610e2a81611e13565b9392505050565b6000838152602081815260408083205467ffffffffffffffff168352600a825280832086845290915290819020905160609190610e719085908590612b91565b90815260200160405180910390208054610e8a90612ba1565b80601f0160208091040260200160405190810160405280929190818152602001828054610eb690612ba1565b8015610f035780601f10610ed857610100808354040283529160200191610f03565b820191906000526020600020905b815481529060010190602001808311610ee657829003601f168201915b505050505090509392505050565b6000818152602081815260408083205467ffffffffffffffff168352600482528083208484529091529020805460609190610f4b90612ba1565b80601f0160208091040260200160405190810160405280929190818152602001828054610f7790612ba1565b8015610fc45780601f10610f9957610100808354040283529160200191610fc4565b820191906000526020600020905b815481529060010190602001808311610fa757829003601f168201915b50505050509050919050565b83610fda8161179b565b610fe357600080fd5b83610fef600182612b7e565b1615610ffa57600080fd5b6000858152602081815260408083205467ffffffffffffffff1683526001825280832088845282528083208784529091529020611038838583612c29565b50604051849086907faa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe390600090a35050505050565b6000818152602081815260408083205467ffffffffffffffff168352600882528083208484529091529020805460609190610f4b90612ba1565b826110b18161179b565b6110ba57600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526008825280832087845290915290206110f0838583612c29565b50837fb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f78484604051610cd1929190612d5a565b8261112d8161179b565b61113657600080fd5b837f65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af75284846040516111689291906126ed565b60405180910390a26102ca83036111c057837f52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd26111a484611e13565b6040516001600160a01b03909116815260200160405180910390a25b6000848152602081815260408083205467ffffffffffffffff16835260028252808320878452825280832086845290915290206111fd8382612d95565b5050505050565b6001600160a01b03821633036112875760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336000818152600b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6001600160a01b038216330361134b5760405162461bcd60e51b815260206004820181905260248201527f53657474696e672064656c65676174652073746174757320666f722073656c66604482015260640161127e565b336000818152600c6020908152604080832087845282528083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519384529286917ff0ddb3b04746704017f9aa8bd728fcc2c1d11675041205350018915f5e4750a0910160405180910390a4505050565b6000838152602081815260408083205467ffffffffffffffff168352600582528083208684528252808320858452825280832061ffff851684529091529020805460609190610e8a90612ba1565b6060610e2a60008484611e3b565b6000818152602081815260408083205467ffffffffffffffff168352600382528083208484529091529020805460609190610f4b90612ba1565b826114608161179b565b61146957600080fd5b6000848152602081815260408083205467ffffffffffffffff1680845260048352818420888552909252822080549192916114a390612ba1565b80601f01602080910402602001604051908101604052809291908181526020018280546114cf90612ba1565b801561151c5780601f106114f15761010080835404028352916020019161151c565b820191906000526020600020905b8154815290600101906020018083116114ff57829003601f168201915b5050505067ffffffffffffffff841660009081526004602090815260408083208b845290915290209192506115549050858783612c29565b50857f8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f8582878760405161158993929190612e55565b60405180910390a2505050505050565b816115a38161179b565b6115ac57600080fd5b6115bc836102ca61038d85612014565b505050565b60606115ce848484611e3b565b949350505050565b826115e08161179b565b6115e957600080fd5b6000848152602081815260408083205467ffffffffffffffff1683526007825280832087845282528083206001600160e01b031987168085529083529281902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038716908117909155905190815286917f7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa910160405180910390a350505050565b6000828152602081815260408083205467ffffffffffffffff16835260028252808320858452825280832084845290915290208054606091906116d790612ba1565b80601f016020809104026020016040519081016040528092919081815260200182805461170390612ba1565b80156117505780601f1061172557610100808354040283529160200191611750565b820191906000526020600020905b81548152906001019060200180831161173357829003601f168201915b5050505050905092915050565b60006001600160e01b031982167f59d1d43c00000000000000000000000000000000000000000000000000000000148061058457506105848261204d565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806117fc5750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b1561180957506001919050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa15801561188a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ae9190612e85565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b03160361198e576040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015611967573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061198b9190612e85565b90505b6001600160a01b0381163314806119c857506001600160a01b0381166000908152600b6020908152604080832033845290915290205460ff165b80610e2a57506001600160a01b0381166000908152600c60209081526040808320868452825280832033845290915290205460ff16610e2a565b611a506040518060e001604052806060815260200160008152602001600061ffff168152602001600061ffff168152602001600063ffffffff16815260200160008152602001600081525090565b82815260c0810182905261058481611d2b565b6020810151815160609161058491611a7b908261208b565b845191906120e5565b60a081015160c082015160609161058491611a7b908290612b7e565b600081518351148015610e2a5750610e2a836000846000875161215c565b865160208801206000611ad28787876120e5565b90508315611bfc5767ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611b1d90612ba1565b159050611b7c5767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611b6083612ea2565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091528120611bbd916124b9565b897f03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a12078a8a604051611bef929190612ec0565b60405180910390a2610788565b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c16845290915290208054611c3f90612ba1565b9050600003611ca05767ffffffffffffffff831660009081526006602090815260408083208d845282528083208584529091528120805461ffff1691611c8483612ee6565b91906101000a81548161ffff021916908361ffff160217905550505b67ffffffffffffffff831660009081526005602090815260408083208d84528252808320858452825280832061ffff8c1684529091529020611ce28282612d95565b50897f52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b8a8a84604051611d1793929190612efd565b60405180910390a250505050505050505050565b60c08101516020820181905281515111611d425750565b6000611d568260000151836020015161208b565b8260200151611d659190612f2c565b8251909150611d74908261217f565b61ffff166040830152611d88600282612f2c565b8251909150611d97908261217f565b61ffff166060830152611dab600282612f2c565b8251909150611dba90826121a7565b63ffffffff166080830152611dd0600482612f2c565b8251909150600090611de2908361217f565b61ffff169050611df3600283612f2c565b60a084018190529150611e068183612f2c565b60c0909301929092525050565b60008151601414611e2357600080fd5b50602001516c01000000000000000000000000900490565b60608167ffffffffffffffff811115611e5657611e566127b1565b604051908082528060200260200182016040528015611e8957816020015b6060815260200190600190039081611e745790505b50905060005b8281101561200c578415611f54576000848483818110611eb157611eb1612d44565b9050602002810190611ec39190612f3f565b611ed291602491600491612f86565b611edb91612fb0565b9050858114611f525760405162461bcd60e51b815260206004820152603460248201527f6d756c746963616c6c3a20416c6c207265636f726473206d757374206861766560448201527f2061206d61746368696e67206e616d6568617368000000000000000000000000606482015260840161127e565b505b60008030868685818110611f6a57611f6a612d44565b9050602002810190611f7c9190612f3f565b604051611f8a929190612b91565b600060405180830381855af49150503d8060008114611fc5576040519150601f19603f3d011682016040523d82523d6000602084013e611fca565b606091505b509150915081611fd957600080fd5b80848481518110611fec57611fec612d44565b60200260200101819052505050808061200490612fce565b915050611e8f565b509392505050565b6040805160148082528183019092526060916020820181803683375050506c010000000000000000000000009290920260208301525090565b60006001600160e01b031982167fc86902330000000000000000000000000000000000000000000000000000000014806105845750610584826121d1565b6000815b8351811061209f5761209f612fe7565b60006120ab858361220f565b60ff1690506120bb816001612f2c565b6120c59083612f2c565b9150806000036120d557506120db565b5061208f565b6115ce8382612b7e565b82516060906120f48385612f2c565b11156120ff57600080fd5b60008267ffffffffffffffff81111561211a5761211a6127b1565b6040519080825280601f01601f191660200182016040528015612144576020820181803683370190505b50905060208082019086860101610b02828287612233565b6000612169848484612289565b612174878785612289565b149695505050505050565b815160009061218f836002612f2c565b111561219a57600080fd5b50016002015161ffff1690565b81516000906121b7836004612f2c565b11156121c257600080fd5b50016004015163ffffffff1690565b60006001600160e01b031982167f691f34310000000000000000000000000000000000000000000000000000000014806105845750610584826122ad565b600082828151811061222357612223612d44565b016020015160f81c905092915050565b6020811061226b578151835261224a602084612f2c565b9250612257602083612f2c565b9150612264602082612b7e565b9050612233565b905182516020929092036101000a6000190180199091169116179052565b82516000906122988385612f2c565b11156122a357600080fd5b5091016020012090565b60006001600160e01b031982167f124a319c00000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167fa8fa568200000000000000000000000000000000000000000000000000000000148061234957506001600160e01b031982167f5c98042b00000000000000000000000000000000000000000000000000000000145b8061058457506105848260006001600160e01b031982167fbc1c58d100000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167f3b3b57de0000000000000000000000000000000000000000000000000000000014806123ef57506001600160e01b031982167ff1cb7e0600000000000000000000000000000000000000000000000000000000145b8061058457506105848260006001600160e01b031982167f2203ab5600000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167fd700ff3300000000000000000000000000000000000000000000000000000000148061058457506105848260006001600160e01b031982167f4fbf043300000000000000000000000000000000000000000000000000000000148061058457506301ffc9a760e01b6001600160e01b0319831614610584565b5080546124c590612ba1565b6000825580601f106124d5575050565b601f0160209004906000526020600020908101906124f391906124f6565b50565b5b8082111561250b57600081556001016124f7565b5090565b80356001600160e01b03198116811461252757600080fd5b919050565b60006020828403121561253e57600080fd5b610e2a8261250f565b60008083601f84011261255957600080fd5b50813567ffffffffffffffff81111561257157600080fd5b602083019150836020828501011115610c3d57600080fd5b60008060006040848603121561259e57600080fd5b83359250602084013567ffffffffffffffff8111156125bc57600080fd5b6125c886828701612547565b9497909650939450505050565b6000806000806000606086880312156125ed57600080fd5b85359450602086013567ffffffffffffffff8082111561260c57600080fd5b61261889838a01612547565b9096509450604088013591508082111561263157600080fd5b5061263e88828901612547565b969995985093965092949392505050565b6000806040838503121561266257600080fd5b823591506126726020840161250f565b90509250929050565b6000806040838503121561268e57600080fd5b50508035926020909101359150565b60005b838110156126b85781810151838201526020016126a0565b50506000910152565b600081518084526126d981602086016020860161269d565b601f01601f19169290920160200192915050565b8281526040602082015260006115ce60408301846126c1565b60008060006060848603121561271b57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561274457600080fd5b5035919050565b602081526000610e2a60208301846126c1565b6000806000806060858703121561277457600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561279957600080fd5b6127a587828801612547565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b6000806000606084860312156127dc57600080fd5b8335925060208401359150604084013567ffffffffffffffff8082111561280257600080fd5b818601915086601f83011261281657600080fd5b813581811115612828576128286127b1565b604051601f8201601f19908116603f01168101908382118183101715612850576128506127b1565b8160405282815289602084870101111561286957600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b6001600160a01b03811681146124f357600080fd5b8035801515811461252757600080fd5b600080604083850312156128c357600080fd5b82356128ce8161288b565b9150612672602084016128a0565b6000806000606084860312156128f157600080fd5b8335925060208401356129038161288b565b9150612911604085016128a0565b90509250925092565b60008060006060848603121561292f57600080fd5b8335925060208401359150604084013561ffff8116811461294f57600080fd5b809150509250925092565b60008060006060848603121561296f57600080fd5b833561297a8161288b565b925060208401359150604084013561294f8161288b565b60008083601f8401126129a357600080fd5b50813567ffffffffffffffff8111156129bb57600080fd5b6020830191508360208260051b8501011115610c3d57600080fd5b600080602083850312156129e957600080fd5b823567ffffffffffffffff811115612a0057600080fd5b612a0c85828601612991565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612a6d57603f19888603018452612a5b8583516126c1565b94509285019290850190600101612a3f565b5092979650505050505050565b60008060408385031215612a8d57600080fd5b823591506020830135612a9f8161288b565b809150509250929050565b600080600060408486031215612abf57600080fd5b83359250602084013567ffffffffffffffff811115612add57600080fd5b6125c886828701612991565b600080600060608486031215612afe57600080fd5b83359250612b0e6020850161250f565b9150604084013561294f8161288b565b60008060408385031215612b3157600080fd5b8235612b3c8161288b565b91506020830135612a9f8161288b565b60008251612b5e81846020870161269d565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561058457610584612b68565b8183823760009101908152919050565b600181811c90821680612bb557607f821691505b602082108103612bd557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156115bc57600081815260208120601f850160051c81016020861015612c025750805b601f850160051c820191505b81811015612c2157828155600101612c0e565b505050505050565b67ffffffffffffffff831115612c4157612c416127b1565b612c5583612c4f8354612ba1565b83612bdb565b6000601f841160018114612c895760008515612c715750838201355b600019600387901b1c1916600186901b1783556111fd565b600083815260209020601f19861690835b82811015612cba5786850135825560209485019460019092019101612c9a565b5086821015612cd75760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b604081526000612d26604083018688612ce9565b8281036020840152612d39818587612ce9565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b6020815260006115ce602083018486612ce9565b600067ffffffffffffffff808316818103612d8b57612d8b612b68565b6001019392505050565b815167ffffffffffffffff811115612daf57612daf6127b1565b612dc381612dbd8454612ba1565b84612bdb565b602080601f831160018114612df85760008415612de05750858301515b600019600386901b1c1916600185901b178555612c21565b600085815260208120601f198616915b82811015612e2757888601518255948401946001909101908401612e08565b5085821015612e455787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000612e6860408301866126c1565b8281036020840152612e7b818587612ce9565b9695505050505050565b600060208284031215612e9757600080fd5b8151610e2a8161288b565b600061ffff821680612eb657612eb6612b68565b6000190192915050565b604081526000612ed360408301856126c1565b905061ffff831660208301529392505050565b600061ffff808316818103612d8b57612d8b612b68565b606081526000612f1060608301866126c1565b61ffff851660208401528281036040840152612e7b81856126c1565b8082018082111561058457610584612b68565b6000808335601e19843603018112612f5657600080fd5b83018035915067ffffffffffffffff821115612f7157600080fd5b602001915036819003821315610c3d57600080fd5b60008085851115612f9657600080fd5b83861115612fa357600080fd5b5050820193919092039150565b8035602083101561058457600019602084900360031b1b1692915050565b600060018201612fe057612fe0612b68565b5060010190565b634e487b7160e01b600052600160045260246000fdfea2646970667358221220c0d1cf867dd2f3822fc09a17389e509c3a29596e0f763016a8f4758501dafb7364736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "ABI(bytes32,uint256)": { + "params": { + "contentTypes": "A bitwise OR of the ABI formats accepted by the caller.", + "node": "The ENS node to query" + }, + "returns": { + "_0": "contentType The content type of the return value", + "_1": "data The ABI data" + } + }, + "addr(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated address." + } + }, + "approve(bytes32,address,bool)": { + "details": "Approve a delegate to be able to updated records on a node." + }, + "clearRecords(bytes32)": { + "params": { + "node": "The node to update." + } + }, + "contenthash(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated contenthash." + } + }, + "dnsRecord(bytes32,bytes32,uint16)": { + "params": { + "name": "the keccak-256 hash of the fully-qualified name for which to fetch the record", + "node": "the namehash of the node for which to fetch the record", + "resource": "the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types" + }, + "returns": { + "_0": "the DNS record in wire format if present, otherwise empty" + } + }, + "hasDNSRecords(bytes32,bytes32)": { + "params": { + "name": "the namehash of the node for which to check the records", + "node": "the namehash of the node for which to check the records" + } + }, + "interfaceImplementer(bytes32,bytes4)": { + "params": { + "interfaceID": "The EIP 165 interface ID to check for.", + "node": "The ENS node to query." + }, + "returns": { + "_0": "The address that implements this interface, or 0 if the interface is unsupported." + } + }, + "isApprovedFor(address,bytes32,address)": { + "details": "Check to see if the delegate has been approved by the owner for the node." + }, + "isApprovedForAll(address,address)": { + "details": "See {IERC1155-isApprovedForAll}." + }, + "name(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated name." + } + }, + "pubkey(bytes32)": { + "params": { + "node": "The ENS node to query" + }, + "returns": { + "x": "The X coordinate of the curve point for the public key.", + "y": "The Y coordinate of the curve point for the public key." + } + }, + "setABI(bytes32,uint256,bytes)": { + "params": { + "contentType": "The content type of the ABI", + "data": "The ABI data.", + "node": "The node to update." + } + }, + "setAddr(bytes32,address)": { + "params": { + "a": "The address to set.", + "node": "The node to update." + } + }, + "setApprovalForAll(address,bool)": { + "details": "See {IERC1155-setApprovalForAll}." + }, + "setContenthash(bytes32,bytes)": { + "params": { + "hash": "The contenthash to set", + "node": "The node to update." + } + }, + "setDNSRecords(bytes32,bytes)": { + "params": { + "data": "the DNS wire format records to set", + "node": "the namehash of the node for which to set the records" + } + }, + "setInterface(bytes32,bytes4,address)": { + "params": { + "implementer": "The address of a contract that implements this interface for this node.", + "interfaceID": "The EIP 165 interface ID.", + "node": "The node to update." + } + }, + "setName(bytes32,string)": { + "params": { + "node": "The node to update." + } + }, + "setPubkey(bytes32,bytes32,bytes32)": { + "params": { + "node": "The ENS node to query", + "x": "the X coordinate of the curve point for the public key.", + "y": "the Y coordinate of the curve point for the public key." + } + }, + "setText(bytes32,string,string)": { + "params": { + "key": "The key to set.", + "node": "The node to update.", + "value": "The text data value to set." + } + }, + "setZonehash(bytes32,bytes)": { + "params": { + "hash": "The zonehash to set", + "node": "The node to update." + } + }, + "text(bytes32,string)": { + "params": { + "key": "The text data key to query.", + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated text data." + } + }, + "zonehash(bytes32)": { + "params": { + "node": "The ENS node to query." + }, + "returns": { + "_0": "The associated contenthash." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "ABI(bytes32,uint256)": { + "notice": "Returns the ABI associated with an ENS node. Defined in EIP205." + }, + "addr(bytes32)": { + "notice": "Returns the address associated with an ENS node." + }, + "clearRecords(bytes32)": { + "notice": "Increments the record version associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "contenthash(bytes32)": { + "notice": "Returns the contenthash associated with an ENS node." + }, + "dnsRecord(bytes32,bytes32,uint16)": { + "notice": "Obtain a DNS record." + }, + "hasDNSRecords(bytes32,bytes32)": { + "notice": "Check if a given node has records." + }, + "interfaceImplementer(bytes32,bytes4)": { + "notice": "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." + }, + "name(bytes32)": { + "notice": "Returns the name associated with an ENS node, for reverse records. Defined in EIP181." + }, + "pubkey(bytes32)": { + "notice": "Returns the SECP256k1 public key associated with an ENS node. Defined in EIP 619." + }, + "setABI(bytes32,uint256,bytes)": { + "notice": "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." + }, + "setAddr(bytes32,address)": { + "notice": "Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "setContenthash(bytes32,bytes)": { + "notice": "Sets the contenthash associated with an ENS node. May only be called by the owner of that node in the ENS registry." + }, + "setDNSRecords(bytes32,bytes)": { + "notice": "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." + }, + "setInterface(bytes32,bytes4,address)": { + "notice": "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." + }, + "setName(bytes32,string)": { + "notice": "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." + }, + "setPubkey(bytes32,bytes32,bytes32)": { + "notice": "Sets the SECP256k1 public key associated with an ENS node." + }, + "setText(bytes32,string,string)": { + "notice": "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." + }, + "setZonehash(bytes32,bytes)": { + "notice": "setZonehash sets the hash for the zone. May only be called by the owner of that node in the ENS registry." + }, + "text(bytes32,string)": { + "notice": "Returns the text data associated with an ENS node and key." + }, + "zonehash(bytes32)": { + "notice": "zonehash obtains the hash for the zone." + } + }, + "notice": "A simple resolver anyone can use; only allows the owner of a node to set its address.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 15451, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "recordVersions", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_bytes32,t_uint64)" + }, + { + "astId": 15545, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_abis", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))" + }, + { + "astId": 15699, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_addresses", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))" + }, + { + "astId": 15890, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_hashes", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))" + }, + { + "astId": 15980, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_zonehashes", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))" + }, + { + "astId": 15990, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_records", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))))" + }, + { + "astId": 15998, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_nameEntriesCount", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16)))" + }, + { + "astId": 17486, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_interfaces", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes4,t_address)))" + }, + { + "astId": 17678, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_names", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_string_storage))" + }, + { + "astId": 17765, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_pubkeys", + "offset": 0, + "slot": "9", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_struct(PublicKey)17758_storage))" + }, + { + "astId": 17868, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "versionable_texts", + "offset": 0, + "slot": "10", + "type": "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage)))" + }, + { + "astId": 14980, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "_operatorApprovals", + "offset": 0, + "slot": "11", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" + }, + { + "astId": 14989, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "_tokenApprovals", + "offset": 0, + "slot": "12", + "type": "t_mapping(t_address,t_mapping(t_bytes32,t_mapping(t_address,t_bool)))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes4": { + "encoding": "inplace", + "label": "bytes4", + "numberOfBytes": "4" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_address,t_mapping(t_bytes32,t_mapping(t_address,t_bool)))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(bytes32 => mapping(address => bool)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_address,t_bool))" + }, + "t_mapping(t_bytes32,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_bytes32,t_mapping(t_address,t_bool))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(address => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_bool)" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage)))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes32 => uint16))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_uint16)" + }, + "t_mapping(t_bytes32,t_mapping(t_bytes4,t_address))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(bytes4 => address))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes4,t_address)" + }, + "t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(string => string))", + "numberOfBytes": "32", + "value": "t_mapping(t_string_memory_ptr,t_string_storage)" + }, + "t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint16 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint16,t_bytes_storage)" + }, + "t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => mapping(uint256 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_bytes_storage)" + }, + "t_mapping(t_bytes32,t_string_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_bytes32,t_struct(PublicKey)17758_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct PubkeyResolver.PublicKey)", + "numberOfBytes": "32", + "value": "t_struct(PublicKey)17758_storage" + }, + "t_mapping(t_bytes32,t_uint16)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint16)", + "numberOfBytes": "32", + "value": "t_uint16" + }, + "t_mapping(t_bytes32,t_uint64)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint64)", + "numberOfBytes": "32", + "value": "t_uint64" + }, + "t_mapping(t_bytes4,t_address)": { + "encoding": "mapping", + "key": "t_bytes4", + "label": "mapping(bytes4 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_string_memory_ptr,t_string_storage)": { + "encoding": "mapping", + "key": "t_string_memory_ptr", + "label": "mapping(string => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_uint16,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint256,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_bytes_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => bytes))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_bytes_storage)" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage))))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes32,t_mapping(t_uint16,t_bytes_storage)))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes32,t_uint16))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_bytes4,t_address)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_bytes4,t_address))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(string => string)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_string_memory_ptr,t_string_storage))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage)))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes)))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes_storage))" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_string_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => string))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_string_storage)" + }, + "t_mapping(t_uint64,t_mapping(t_bytes32,t_struct(PublicKey)17758_storage))": { + "encoding": "mapping", + "key": "t_uint64", + "label": "mapping(uint64 => mapping(bytes32 => struct PubkeyResolver.PublicKey))", + "numberOfBytes": "32", + "value": "t_mapping(t_bytes32,t_struct(PublicKey)17758_storage)" + }, + "t_string_memory_ptr": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(PublicKey)17758_storage": { + "encoding": "inplace", + "label": "struct PubkeyResolver.PublicKey", + "members": [ + { + "astId": 17755, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "x", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 17757, + "contract": "contracts/resolvers/PublicResolver.sol:PublicResolver", + "label": "y", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_uint16": { + "encoding": "inplace", + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint64": { + "encoding": "inplace", + "label": "uint64", + "numberOfBytes": "8" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/ReferralController.json b/solidity/dns-contracts/deployments/testnet/ReferralController.json new file mode 100644 index 0000000..ea9d8ce --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/ReferralController.json @@ -0,0 +1,1069 @@ +{ + "address": "0xf5F507D2a48B62082e3440B185f9e10a47156554", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "string", + "name": "code", + "type": "string" + }, + { + "indexed": true, + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "ReferralCodeAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "WithdrawalDispersed", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "numReferrals", + "type": "uint256" + } + ], + "name": "_rewardPct", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + } + ], + "name": "addController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "balance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "commitments", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokenAddresses", + "type": "address[]" + } + ], + "name": "createSnapshot", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "expirydates", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCodes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSnapshotEarnings", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getUntracked", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nativeEarnings", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "referralCodes", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "referrals", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "referredBy", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "referrees", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "code", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "setReferree", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "string", + "name": "referree", + "type": "string" + } + ], + "name": "settlement", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "string", + "name": "referree", + "type": "string" + } + ], + "name": "settlementCard", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "referree", + "type": "string" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "settlementRegister", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "referree", + "type": "string" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "settlementRegisterWithCard", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "referree", + "type": "string" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + } + ], + "name": "settlementRegisterWithToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "referree", + "type": "string" + } + ], + "name": "settlementWithToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "snapshotNativeEarnings", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "snapshotTokenEarnings", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "snapshotUntrackedEarnings", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + } + ], + "name": "tokenBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "tokenEarnings", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "totalNativeEarnings", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "totalReferrals", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "referrer", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + } + ], + "name": "totalTokenEarnings", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "trackedNativeEarnings", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "trackedTokenEarnings", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "untrackedEarnings", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "code", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "newExpiry", + "type": "uint256" + } + ], + "name": "updateReferralCode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "batch", + "type": "uint256" + } + ], + "name": "withdrawAllNativeEarnings", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokenAddresses", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "batch", + "type": "uint256" + } + ], + "name": "withdrawAllTokenEarnings", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xaedebbee30dff347f1ed5c78c19d2113d0f71466a1a8f034d1d98c62e7f77f40", + "receipt": { + "to": null, + "from": "0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B", + "contractAddress": "0xf5F507D2a48B62082e3440B185f9e10a47156554", + "transactionIndex": 2, + "gasUsed": "2309821", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000400000000000000000000000020000000000000000000800000000000000002000000000000000400000001000010000000000000000000000000000000000000000000000000000000000000000000000000000020100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x2709188e560ea463e8241afa048df5dabf9d29ec5b6a46d6048c0c0fc6c11c1b", + "transactionHash": "0xaedebbee30dff347f1ed5c78c19d2113d0f71466a1a8f034d1d98c62e7f77f40", + "logs": [ + { + "transactionIndex": 2, + "blockNumber": 57535065, + "transactionHash": "0xaedebbee30dff347f1ed5c78c19d2113d0f71466a1a8f034d1d98c62e7f77f40", + "address": "0xf5F507D2a48B62082e3440B185f9e10a47156554", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000002a0d7311fa7e9ac2890cfd8219b2def0c206e79b" + ], + "data": "0x", + "logIndex": 23, + "blockHash": "0x2709188e560ea463e8241afa048df5dabf9d29ec5b6a46d6048c0c0fc6c11c1b" + } + ], + "blockNumber": 57535065, + "cumulativeGasUsed": "3113165", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "c7e40ea5f033df78220ad43e326ccd0c", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"code\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"ReferralCodeAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"WithdrawalDispersed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numReferrals\",\"type\":\"uint256\"}],\"name\":\"_rewardPct\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"}],\"name\":\"addController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"balance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"commitments\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"tokenAddresses\",\"type\":\"address[]\"}],\"name\":\"createSnapshot\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"expirydates\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCodes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getSnapshotEarnings\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getUntracked\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"nativeEarnings\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"referralCodes\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"referrals\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"referredBy\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"referrees\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"code\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"setReferree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"referree\",\"type\":\"string\"}],\"name\":\"settlement\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"referree\",\"type\":\"string\"}],\"name\":\"settlementCard\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"referree\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"settlementRegister\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"referree\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"settlementRegisterWithCard\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"referree\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"}],\"name\":\"settlementRegisterWithToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"referree\",\"type\":\"string\"}],\"name\":\"settlementWithToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"snapshotNativeEarnings\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"snapshotTokenEarnings\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"snapshotUntrackedEarnings\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"}],\"name\":\"tokenBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"tokenEarnings\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"totalNativeEarnings\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"totalReferrals\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"}],\"name\":\"totalTokenEarnings\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"trackedNativeEarnings\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"trackedTokenEarnings\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"untrackedEarnings\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"code\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"newExpiry\",\"type\":\"uint256\"}],\"name\":\"updateReferralCode\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batch\",\"type\":\"uint256\"}],\"name\":\"withdrawAllNativeEarnings\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"tokenAddresses\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"batch\",\"type\":\"uint256\"}],\"name\":\"withdrawAllTokenEarnings\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"setReferree(bytes32,address,uint256)\":{\"notice\":\"Only your controller or admin should be able to call this!\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/ReferralController.sol\":\"ReferralController\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xec63854014a5b4f2b3290ab9103a21bdf902a508d0f41a8573fea49e98bf571a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n /**\\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n */\\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n /**\\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\\n }\\n\\n /**\\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\\n }\\n }\\n\\n /**\\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\\n * to be set to zero before setting it to a non-zero value, such as USDT.\\n */\\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\\n\\n if (!_callOptionalReturnBool(token, approvalCall)) {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\\n _callOptionalReturn(token, approvalCall);\\n }\\n }\\n\\n /**\\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\\n * Revert on invalid signature.\\n */\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n *\\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n */\\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0xabefac93435967b4d36a4fabcbdbb918d1f0b7ae3c3d85bc30923b326c927ed1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"contracts/ethregistrar/IETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./IPriceOracle.sol\\\";\\n\\ninterface IETHRegistrarController {\\n\\n struct TokenParams{\\n string token;\\n address tokenAddress;\\n }\\n struct RegisterParams {\\n string name;\\n address owner;\\n uint256 duration;\\n bytes32 secret;\\n address resolver;\\n bytes[] data;\\n bool reverseRecord;\\n uint16 ownerControlledFuses;\\n }\\n function rentPrice(\\n string memory,\\n uint256,\\n bool\\n ) external view returns (IPriceOracle.Price memory);\\n\\n function rentPriceToken(\\n string memory name,\\n uint256 duration,\\n string memory token,\\n bool lifetime\\n ) external view returns (IPriceOracle.Price memory price);\\n\\n function available(string memory) external returns (bool);\\n\\n function makeCommitment(\\n string memory,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16,\\n bool\\n ) external pure returns (bytes32);\\n\\n function commit(bytes32) external;\\n\\n function register(\\n string memory,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16,\\n bool,\\n string memory\\n ) external payable;\\n\\n function registerWithToken(\\n RegisterParams memory registerParams,\\n TokenParams memory tokenParams,\\n bool lifetime,\\n string memory referree\\n ) external;\\n\\n function renew(string calldata, uint256, bool) external payable;\\n\\n function renewTokens(\\n string calldata name,\\n uint256 duration,\\n string memory token,\\n address tokenAddress,\\n bool lifetime\\n ) external;\\n}\\n\",\"keccak256\":\"0x5b063364fa339be07758117e6e53fb7991653c99bfdab24ba200ec805b655190\",\"license\":\"MIT\"},\"contracts/ethregistrar/IPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\ninterface IPriceOracle {\\n struct Price {\\n uint256 base;\\n uint256 premium;\\n }\\n\\n /**\\n * @dev Returns the price to register or renew a name.\\n * @param name The name being registered or renewed.\\n * @param expires When the name presently expires (0 if this is a new registration).\\n * @param duration How long the name is being registered or extended for, in seconds.\\n * @return base premium tuple of base price + premium price\\n */\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration,\\n bool lifetime\\n ) external view returns (Price calldata);\\n}\\n\",\"keccak256\":\"0xc1f749d6238b0e77cc804153b2ce8fc2e082d28129e734839ccc2b2be7ee9d2b\",\"license\":\"MIT\"},\"contracts/ethregistrar/ReferralController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\nimport {IPriceOracle} from \\\"./IETHRegistrarController.sol\\\";\\nimport {SafeERC20} from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nusing SafeERC20 for IERC20;\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract ReferralController is Ownable {\\n // Mapping from referral code to referrer address\\n uint16 private constant TIER1 = 2;\\n uint16 private constant TIER2 = 15;\\n uint16 private constant TIER3 = 20;\\n uint256 private constant PCT1 = 15;\\n uint256 private constant PCT2 = 20;\\n uint256 private constant PCT3 = 25;\\n mapping(address => bool) public controllers;\\n mapping(bytes32 => uint256) public commitments;\\n mapping(bytes32 => address) public referrees;\\n mapping(bytes32 => uint256) public expirydates;\\n mapping(address => bytes32[]) public referrals;\\n mapping(bytes32 => string) public referredBy;\\n mapping(address => uint256) public nativeEarnings;\\n mapping(address => mapping(address => uint256)) public tokenEarnings;\\n\\n bytes32[] public referralCodes;\\n uint256 public untrackedEarnings;\\n uint256 public snapshotUntrackedEarnings;\\n mapping(address => uint256) public snapshotNativeEarnings;\\n mapping(address => mapping(address => uint256))\\n public snapshotTokenEarnings;\\n uint256 public trackedNativeEarnings;\\n mapping(address => uint256) public trackedTokenEarnings;\\n\\n event ReferralCodeAdded(string indexed code, address indexed referrer);\\n event WithdrawalDispersed(address indexed);\\n modifier onlyControllerOrOwner() {\\n require(\\n controllers[msg.sender] || msg.sender == owner(),\\n \\\"Not a controller or owner\\\"\\n );\\n _;\\n }\\n\\n function addController(address controller) external onlyOwner {\\n require(controller != address(0), \\\"Invalid controller address\\\");\\n controllers[controller] = true;\\n }\\n\\n function settlementRegister(\\n string memory referree,\\n string memory name,\\n address owner,\\n uint256 amount,\\n address receiver\\n ) external payable onlyControllerOrOwner {\\n // If the referree is already registered, we can use it\\n\\n require(\\n receiver != address(0) && receiver != owner,\\n \\\"Invalid receiver address\\\"\\n );\\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\\n bool contains;\\n for (uint256 i = 0; i < referrals[receiver].length; i++) {\\n if (referrals[receiver][i] == keccak256(bytes(name))) {\\n contains = true;\\n break;\\n }\\n }\\n if (contains == false) {\\n referrals[receiver].push(keccak256(bytes(name)));\\n referredBy[keccak256(bytes(name))] = referree;\\n _applyNativeReward(receiver, amount, false);\\n } else {\\n _applyNativeReward(receiver, amount, false);\\n }\\n } else {\\n payable(Ownable.owner()).transfer(amount);\\n }\\n }\\n\\n function settlementRegisterWithCard(\\n string memory referree,\\n string memory name,\\n address owner,\\n uint256 amount,\\n address receiver\\n ) external onlyControllerOrOwner {\\n // If the referree is already registered, we can use it\\n require(\\n receiver != address(0) && receiver != owner,\\n \\\"Invalid receiver address\\\"\\n );\\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\\n bool contains;\\n for (uint256 i = 0; i < referrals[receiver].length; i++) {\\n if (referrals[receiver][i] == keccak256(bytes(name))) {\\n contains = true;\\n }\\n }\\n if (contains == false) {\\n referrals[receiver].push(keccak256(bytes(name)));\\n referredBy[keccak256(bytes(name))] = referree;\\n _applyNativeReward(receiver, amount, true);\\n } else {\\n _applyNativeReward(receiver, amount, true);\\n }\\n }\\n }\\n\\n /// @notice Only your controller or admin should be able to call this!\\n function setReferree(\\n bytes32 code,\\n address who,\\n uint256 duration\\n ) external onlyControllerOrOwner {\\n require(code != bytes32(0), \\\"Invalid referral code\\\");\\n require(who != address(0), \\\"Invalid referree address\\\");\\n require(\\n referrees[code] == address(0),\\n \\\"Referral code already registered\\\"\\n );\\n address prevReferree = referrees[code];\\n if (prevReferree != address(0)) {\\n referrals[prevReferree] = new bytes32[](0);\\n }\\n referrees[code] = who;\\n referralCodes.push(code);\\n expirydates[code] = duration;\\n }\\n\\n function settlementCard(\\n uint256 amount,\\n address receiver,\\n string memory referree\\n ) external onlyControllerOrOwner {\\n // If the referree is already registered, we can use it\\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\\n require(receiver != address(0), \\\"Invalid receiver address\\\");\\n _applyNativeReward(receiver, amount, true);\\n }\\n }\\n\\n function settlement(\\n uint256 amount,\\n address receiver,\\n string memory referree\\n ) external payable onlyControllerOrOwner {\\n // If the referree is already registered, we can use it\\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\\n require(receiver != address(0), \\\"Invalid receiver address\\\");\\n _applyNativeReward(receiver, amount, false);\\n } else {\\n payable(Ownable.owner()).transfer(amount);\\n }\\n }\\n\\n function settlementWithToken(\\n uint256 amount,\\n address receiver,\\n address tokenAddress,\\n string memory referree\\n ) external onlyControllerOrOwner {\\n // If the referree is already registered, we can use it\\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\\n require(receiver != address(0), \\\"Invalid receiver address\\\");\\n _applyTokenReward(receiver, tokenAddress, amount);\\n } else {\\n IERC20(tokenAddress).safeTransfer(Ownable.owner(), amount);\\n }\\n }\\n\\n function settlementRegisterWithToken(\\n string memory referree,\\n string memory name,\\n address owner,\\n uint256 amount,\\n address tokenAddress\\n ) external onlyControllerOrOwner {\\n // If the referree is already registered, we can use it\\n // Implement token settlement logic here if needed\\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\\n address receiver = referrees[keccak256(bytes(referree))];\\n if (receiver != address(0) && receiver != owner) {\\n bool contains;\\n for (uint256 i = 0; i < referrals[receiver].length; i++) {\\n if (referrals[receiver][i] == keccak256(bytes(name))) {\\n contains = true;\\n }\\n }\\n if (contains == false) {\\n referrals[receiver].push(keccak256(bytes(name)));\\n referredBy[keccak256(bytes(name))] = referree;\\n _applyTokenReward(receiver, tokenAddress, amount);\\n } else {\\n _applyTokenReward(receiver, tokenAddress, amount);\\n }\\n }\\n } else {\\n // If the referree is not registered, we can transfer the amount to the owner\\n IERC20(tokenAddress).safeTransfer(Ownable.owner(), amount);\\n }\\n }\\n\\n function withdrawAllNativeEarnings(uint256 batch) external onlyOwner {\\n for (uint256 i = 0; i < batch; ) {\\n bytes32 code = referralCodes[batch];\\n if (block.timestamp < expirydates[code]) {\\n address referrer = referrees[code];\\n uint256 earnings = nativeEarnings[referrer];\\n if (earnings > 0) {\\n (bool ok, ) = payable(referrer).call{value: earnings}(\\\"\\\");\\n require(ok, \\\"Payment failed\\\");\\n nativeEarnings[referrer] = 0;\\n }\\n }\\n unchecked {\\n ++i;\\n }\\n }\\n // Transfer any remaining balance to the owner\\n uint256 remainingBalance = address(this).balance;\\n if (remainingBalance > 0) {\\n payable(owner()).transfer(remainingBalance);\\n }\\n // Emit an event for the withdrawal\\n emit WithdrawalDispersed(msg.sender);\\n }\\n\\n function withdrawAllTokenEarnings(\\n address[] memory tokenAddresses,\\n uint256 batch\\n ) external onlyOwner {\\n uint256 tokenLength = tokenAddresses.length;\\n for (uint256 j = 0; j < tokenLength; ) {\\n address tokenAddress = tokenAddresses[j];\\n for (uint256 i = 0; i < batch; ) {\\n bytes32 code = referralCodes[i];\\n if (block.timestamp < expirydates[code]) {\\n address referrer = referrees[code];\\n uint256 earnings = tokenEarnings[referrer][tokenAddress];\\n require(earnings > 0, \\\"No earnings to withdraw\\\");\\n if (earnings > 0) {\\n // Assuming the token follows ERC20 standard\\n IERC20(tokenAddress).safeTransfer(referrer, earnings);\\n tokenEarnings[referrer][tokenAddress] = 0;\\n }\\n }\\n unchecked {\\n ++i;\\n }\\n }\\n unchecked {\\n ++j;\\n }\\n }\\n }\\n\\n function totalReferrals(address referrer) external view returns (uint256) {\\n return referrals[referrer].length;\\n }\\n\\n function totalNativeEarnings(\\n address referrer\\n ) external view returns (uint256) {\\n return nativeEarnings[referrer];\\n }\\n\\n function totalTokenEarnings(\\n address referrer,\\n address tokenAddress\\n ) external view returns (uint256) {\\n return tokenEarnings[referrer][tokenAddress];\\n }\\n\\n function getCodes() external view returns (uint256) {\\n return referralCodes.length;\\n }\\n function updateReferralCode(\\n bytes32 code,\\n uint256 newExpiry\\n ) external onlyControllerOrOwner {\\n require(expirydates[code] > 0, \\\"Referral code does not exist\\\");\\n expirydates[code] = newExpiry;\\n }\\n\\n function _rewardPct(uint256 numReferrals) public pure returns (uint256) {\\n if (numReferrals >= TIER3) return PCT3;\\n if (numReferrals >= TIER2) return PCT2;\\n if (numReferrals >= TIER1) return PCT1;\\n return 0; // No reward for less than TIER1 referrals\\n }\\n\\n function _applyNativeReward(\\n address receiver,\\n uint256 amount,\\n bool isFiat\\n ) private {\\n nativeEarnings[receiver] +=\\n (amount * _rewardPct(referrals[receiver].length)) /\\n 100;\\n if (isFiat) {\\n untrackedEarnings +=\\n (amount * _rewardPct(referrals[receiver].length)) /\\n 100;\\n }\\n }\\n\\n function _applyTokenReward(\\n address receiver,\\n address token,\\n uint256 amount\\n ) private {\\n tokenEarnings[receiver][token] +=\\n (amount * _rewardPct(referrals[receiver].length)) /\\n 100;\\n }\\n\\n function balance() public view returns (uint256) {\\n return address(this).balance;\\n }\\n\\n function tokenBalance(\\n address tokenAddress\\n ) public view returns (uint256) {\\n return IERC20(tokenAddress).balanceOf(address(this));\\n }\\n\\n function getUntracked() public view returns (uint256) {\\n return untrackedEarnings;\\n }\\n\\n function createSnapshot(\\n address[] memory tokenAddresses\\n ) external onlyOwner {\\n snapshotUntrackedEarnings = untrackedEarnings;\\n for (uint256 i = 0; i < referralCodes.length; i++) {\\n bytes32 code = referralCodes[i];\\n address referrer = referrees[code];\\n snapshotNativeEarnings[referrer] = nativeEarnings[referrer];\\n }\\n for (uint256 j = 0; j < tokenAddresses.length; j++) {\\n address tokenAddress = tokenAddresses[j];\\n for (uint256 i = 0; i < referralCodes.length; i++) {\\n bytes32 code = referralCodes[i];\\n address referrer = referrees[code];\\n snapshotTokenEarnings[referrer][tokenAddress] = tokenEarnings[\\n referrer\\n ][tokenAddress];\\n }\\n }\\n }\\n\\n function getSnapshotEarnings() public view returns (uint256) {\\n return snapshotUntrackedEarnings;\\n }\\n}\\n\",\"keccak256\":\"0xd84283d895a37b233ac7cdda54599c813d163463e99af5dadd708be214a5c8d2\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61286c8061007e6000396000f3fe6080604052600436106102a05760003560e01c8063afbcb2691161016e578063d7397f22116100cb578063ec0a920f1161007f578063eedc966a11610064578063eedc966a146107bb578063f2fde38b146107db578063ff8f3947146107fb57600080fd5b8063ec0a920f14610765578063edaf9f6e1461078557600080fd5b8063dbbb1968116100b0578063dbbb1968146106fa578063e697b5d814610732578063e858db081461075257600080fd5b8063d7397f22146106a4578063da8c229e146106ba57600080fd5b8063c62c7b7711610122578063d0da614411610107578063d0da614414610637578063d184befa14610657578063d488ac121461067757600080fd5b8063c62c7b77146105f5578063c70ad00c1461060a57600080fd5b8063c08d52af11610153578063c08d52af14610594578063c210401b146105ca578063c29fb0f1146105e057600080fd5b8063afbcb26914610561578063b69ef8a81461058157600080fd5b8063715018a61161021c5780638b07795b116101d057806395a885c2116101b557806395a885c2146105165780639c31e6ea1461052b578063a7fc7a071461054157600080fd5b80638b07795b146104c45780638da5cb5b146104e457600080fd5b8063830ecef811610201578063830ecef81461044a578063839df94514610477578063898c6495146104a457600080fd5b8063715018a6146104225780637d31266a1461043757600080fd5b80633ba96fdf1161027357806344430b691161025857806344430b69146103ac5780635d5d2dec146103cc578063668c91c81461040257600080fd5b80633ba96fdf1461035f5780633eae35451461038c57600080fd5b80630814cdc1146102a55780631f8e2271146102f057806320447f0b14610312578063338bc97014610332575b600080fd5b3480156102b157600080fd5b506102dd6102c03660046121cd565b600d60209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b3480156102fc57600080fd5b5061031061030b366004612200565b61081b565b005b34801561031e57600080fd5b5061031061032d3660046122f8565b610a66565b34801561033e57600080fd5b5061035261034d36600461232d565b610ba7565b6040516102e7919061236a565b34801561036b57600080fd5b506102dd61037a36600461239d565b600c6020526000908152604090205481565b34801561039857600080fd5b506103106103a73660046123bf565b610c41565b3480156103b857600080fd5b506102dd6103c736600461232d565b610d9a565b3480156103d857600080fd5b506102dd6103e736600461239d565b6001600160a01b031660009081526007602052604090205490565b34801561040e57600080fd5b5061031061041d366004612474565b610dd4565b34801561042e57600080fd5b50610310610ed1565b6103106104453660046124cb565b610ee5565b34801561045657600080fd5b506102dd61046536600461239d565b600f6020526000908152604090205481565b34801561048357600080fd5b506102dd61049236600461232d565b60026020526000908152604090205481565b3480156104b057600080fd5b506103106104bf3660046124cb565b61113e565b3480156104d057600080fd5b506103106104df36600461255a565b61134b565b3480156104f057600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020016102e7565b34801561052257600080fd5b50600b546102dd565b34801561053757600080fd5b506102dd600a5481565b34801561054d57600080fd5b5061031061055c36600461239d565b61142c565b34801561056d57600080fd5b506102dd61057c36600461232d565b6114b1565b34801561058d57600080fd5b50476102dd565b3480156105a057600080fd5b506102dd6105af36600461239d565b6001600160a01b031660009081526005602052604090205490565b3480156105d657600080fd5b506102dd600b5481565b3480156105ec57600080fd5b506009546102dd565b34801561060157600080fd5b50600a546102dd565b34801561061657600080fd5b506102dd61062536600461239d565b60076020526000908152604090205481565b34801561064357600080fd5b506102dd6106523660046121cd565b6114d2565b34801561066357600080fd5b5061031061067236600461257c565b6114ff565b34801561068357600080fd5b506102dd61069236600461232d565b60046020526000908152604090205481565b3480156106b057600080fd5b506102dd600e5481565b3480156106c657600080fd5b506106ea6106d536600461239d565b60016020526000908152604090205460ff1681565b60405190151581526020016102e7565b34801561070657600080fd5b506102dd6107153660046121cd565b600860209081526000928352604080842090915290825290205481565b34801561073e57600080fd5b506102dd61074d3660046125e4565b611621565b610310610760366004612474565b611652565b34801561077157600080fd5b5061031061078036600461232d565b611783565b34801561079157600080fd5b506104fe6107a036600461232d565b6003602052600090815260409020546001600160a01b031681565b3480156107c757600080fd5b506102dd6107d636600461239d565b61193c565b3480156107e757600080fd5b506103106107f636600461239d565b6119c0565b34801561080757600080fd5b506103106108163660046124cb565b611a50565b3360009081526001602052604090205460ff168061084357506000546001600160a01b031633145b6108945760405162461bcd60e51b815260206004820152601960248201527f4e6f74206120636f6e74726f6c6c6572206f72206f776e65720000000000000060448201526064015b60405180910390fd5b826108e15760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420726566657272616c20636f64650000000000000000000000604482015260640161088b565b6001600160a01b0382166109375760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420726566657272656520616464726573730000000000000000604482015260640161088b565b6000838152600360205260409020546001600160a01b03161561099c5760405162461bcd60e51b815260206004820181905260248201527f526566657272616c20636f646520616c72656164792072656769737465726564604482015260640161088b565b6000838152600360205260409020546001600160a01b031680156109ed5760408051600080825260208083018085526001600160a01b0386168352600590915292902090516109eb9290612151565b505b506000838152600360209081526040808320805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03969096169590951790945560098054600181019091557f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01949094556004909352912055565b610a6e611c5b565b600a54600b5560005b600954811015610adf57600060098281548110610a9657610a9661260e565b60009182526020808320909101548252600381526040808320546001600160a01b031683526007825280832054600c909252909120555080610ad78161263a565b915050610a77565b5060005b8151811015610ba3576000828281518110610b0057610b0061260e565b6020026020010151905060005b600954811015610b8e57600060098281548110610b2c57610b2c61260e565b60009182526020808320909101548252600381526040808320546001600160a01b039081168085526008845282852091881680865291845282852054908552600d84528285209185529252909120555080610b868161263a565b915050610b0d565b50508080610b9b9061263a565b915050610ae3565b5050565b60066020526000908152604090208054610bc090612653565b80601f0160208091040260200160405190810160405280929190818152602001828054610bec90612653565b8015610c395780601f10610c0e57610100808354040283529160200191610c39565b820191906000526020600020905b815481529060010190602001808311610c1c57829003601f168201915b505050505081565b610c49611c5b565b815160005b81811015610d94576000848281518110610c6a57610c6a61260e565b6020026020010151905060005b84811015610d8a57600060098281548110610c9457610c9461260e565b906000526020600020015490506004600082815260200190815260200160002054421015610d81576000818152600360209081526040808320546001600160a01b0390811680855260088452828520918816855292529091205480610d3b5760405162461bcd60e51b815260206004820152601760248201527f4e6f206561726e696e677320746f207769746864726177000000000000000000604482015260640161088b565b8015610d7e57610d556001600160a01b0386168383611cb5565b6001600160a01b0380831660009081526008602090815260408083209389168352929052908120555b50505b50600101610c77565b5050600101610c4e565b50505050565b600060148210610dac57506019919050565b600f8210610dbc57506014919050565b60028210610dcc5750600f919050565b506000919050565b3360009081526001602052604090205460ff1680610dfc57506000546001600160a01b031633145b610e485760405162461bcd60e51b815260206004820152601960248201527f4e6f74206120636f6e74726f6c6c6572206f72206f776e657200000000000000604482015260640161088b565b426004600083805190602001208152602001908152602001600020541115610ecc576001600160a01b038216610ec05760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420726563656976657220616464726573730000000000000000604482015260640161088b565b610ecc82846001611d35565b505050565b610ed9611c5b565b610ee36000611df5565b565b3360009081526001602052604090205460ff1680610f0d57506000546001600160a01b031633145b610f595760405162461bcd60e51b815260206004820152601960248201527f4e6f74206120636f6e74726f6c6c6572206f72206f776e657200000000000000604482015260640161088b565b6001600160a01b03811615801590610f835750826001600160a01b0316816001600160a01b031614155b610fcf5760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420726563656976657220616464726573730000000000000000604482015260640161088b565b4260046000878051906020012081526020019081526020016000205411156110fc576000805b6001600160a01b03831660009081526005602052604090205481101561107e57858051906020012060056000856001600160a01b03166001600160a01b0316815260200190815260200160002082815481106110535761105361260e565b90600052602060002001540361106c576001915061107e565b806110768161263a565b915050610ff5565b508015156000036110ea576001600160a01b03821660009081526005602090815260408083208851898401908120825460018101845592865284862090920191909155885190208352600690915290206110d887826126d3565b506110e582846000611d35565b6110f6565b6110f682846000611d35565b50611137565b600080546040516001600160a01b039091169184156108fc02918591818181858888f19350505050158015611135573d6000803e3d6000fd5b505b5050505050565b3360009081526001602052604090205460ff168061116657506000546001600160a01b031633145b6111b25760405162461bcd60e51b815260206004820152601960248201527f4e6f74206120636f6e74726f6c6c6572206f72206f776e657200000000000000604482015260640161088b565b6001600160a01b038116158015906111dc5750826001600160a01b0316816001600160a01b031614155b6112285760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420726563656976657220616464726573730000000000000000604482015260640161088b565b426004600087805190602001208152602001908152602001600020541115611137576000805b6001600160a01b0383166000908152600560205260409020548110156112d357858051906020012060056000856001600160a01b03166001600160a01b0316815260200190815260200160002082815481106112ac576112ac61260e565b9060005260206000200154036112c157600191505b806112cb8161263a565b91505061124e565b5080151560000361133f576001600160a01b038216600090815260056020908152604080832088518984019081208254600181018455928652848620909201919091558851902083526006909152902061132d87826126d3565b5061133a82846001611d35565b611135565b61113582846001611d35565b3360009081526001602052604090205460ff168061137357506000546001600160a01b031633145b6113bf5760405162461bcd60e51b815260206004820152601960248201527f4e6f74206120636f6e74726f6c6c6572206f72206f776e657200000000000000604482015260640161088b565b60008281526004602052604090205461141a5760405162461bcd60e51b815260206004820152601c60248201527f526566657272616c20636f646520646f6573206e6f7420657869737400000000604482015260640161088b565b60009182526004602052604090912055565b611434611c5b565b6001600160a01b03811661148a5760405162461bcd60e51b815260206004820152601a60248201527f496e76616c696420636f6e74726f6c6c65722061646472657373000000000000604482015260640161088b565b6001600160a01b03166000908152600160208190526040909120805460ff19169091179055565b600981815481106114c157600080fd5b600091825260209091200154905081565b6001600160a01b038083166000908152600860209081526040808320938516835292905220545b92915050565b3360009081526001602052604090205460ff168061152757506000546001600160a01b031633145b6115735760405162461bcd60e51b815260206004820152601960248201527f4e6f74206120636f6e74726f6c6c6572206f72206f776e657200000000000000604482015260640161088b565b4260046000838051906020012081526020019081526020016000205411156115fb576001600160a01b0383166115eb5760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420726563656976657220616464726573730000000000000000604482015260640161088b565b6115f6838386611e52565b610d94565b610d946116106000546001600160a01b031690565b6001600160a01b0384169086611cb5565b6005602052816000526040600020818154811061163d57600080fd5b90600052602060002001600091509150505481565b3360009081526001602052604090205460ff168061167a57506000546001600160a01b031633145b6116c65760405162461bcd60e51b815260206004820152601960248201527f4e6f74206120636f6e74726f6c6c6572206f72206f776e657200000000000000604482015260640161088b565b42600460008380519060200120815260200190815260200160002054111561174a576001600160a01b03821661173e5760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420726563656976657220616464726573730000000000000000604482015260640161088b565b610ecc82846000611d35565b600080546040516001600160a01b039091169185156108fc02918691818181858888f19350505050158015610d94573d6000803e3d6000fd5b61178b611c5b565b60005b818110156118ca576000600983815481106117ab576117ab61260e565b9060005260206000200154905060046000828152602001908152602001600020544210156118c1576000818152600360209081526040808320546001600160a01b031680845260079092529091205480156118be576000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461184d576040519150601f19603f3d011682016040523d82523d6000602084013e611852565b606091505b50509050806118a35760405162461bcd60e51b815260206004820152600e60248201527f5061796d656e74206661696c6564000000000000000000000000000000000000604482015260640161088b565b506001600160a01b0382166000908152600760205260408120555b50505b5060010161178e565b5047801561190d57600080546040516001600160a01b039091169183156108fc02918491818181858888f1935050505015801561190b573d6000803e3d6000fd5b505b60405133907f8139efc425db5c04b6dd4e0df2e2ae5d44350cfb145cfbfc83bf39abbc2591ee90600090a25050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561199c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114f99190612793565b6119c8611c5b565b6001600160a01b038116611a445760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161088b565b611a4d81611df5565b50565b3360009081526001602052604090205460ff1680611a7857506000546001600160a01b031633145b611ac45760405162461bcd60e51b815260206004820152601960248201527f4e6f74206120636f6e74726f6c6c6572206f72206f776e657200000000000000604482015260640161088b565b426004600087805190602001208152602001908152602001600020541115611c355784516020808701919091206000908152600390915260409020546001600160a01b03168015801590611b2a5750836001600160a01b0316816001600160a01b031614155b156110f6576000805b6001600160a01b038316600090815260056020526040902054811015611bb857868051906020012060056000856001600160a01b03166001600160a01b031681526020019081526020016000208281548110611b9157611b9161260e565b906000526020600020015403611ba657600191505b80611bb08161263a565b915050611b33565b50801515600003611c23576001600160a01b038216600090815260056020908152604080832089518a840190812082546001810184559286528486209092019190915589519020835260069091529020611c1288826126d3565b50611c1e828486611e52565b611c2e565b611c2e828486611e52565b5050611137565b611137611c4a6000546001600160a01b031690565b6001600160a01b0383169084611cb5565b6000546001600160a01b03163314610ee35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161088b565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610ecc908490611ec2565b6001600160a01b038316600090815260056020526040902054606490611d5a90610d9a565b611d6490846127ac565b611d6e91906127c3565b6001600160a01b03841660009081526007602052604081208054909190611d969084906127e5565b90915550508015610ecc576001600160a01b038316600090815260056020526040902054606490611dc690610d9a565b611dd090846127ac565b611dda91906127c3565b600a6000828254611deb91906127e5565b9091555050505050565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038316600090815260056020526040902054606490611e7790610d9a565b611e8190836127ac565b611e8b91906127c3565b6001600160a01b03808516600090815260086020908152604080832093871683529290529081208054909190611deb9084906127e5565b6000611f17826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611faa9092919063ffffffff16565b9050805160001480611f38575080806020019051810190611f3891906127f8565b610ecc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161088b565b6060611fb98484600085611fc1565b949350505050565b6060824710156120395760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161088b565b600080866001600160a01b03168587604051612055919061281a565b60006040518083038185875af1925050503d8060008114612092576040519150601f19603f3d011682016040523d82523d6000602084013e612097565b606091505b50915091506120a8878383876120b3565b979650505050505050565b6060831561212257825160000361211b576001600160a01b0385163b61211b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161088b565b5081611fb9565b611fb983838151156121375781518083602001fd5b8060405162461bcd60e51b815260040161088b919061236a565b82805482825590600052602060002090810192821561218c579160200282015b8281111561218c578251825591602001919060010190612171565b5061219892915061219c565b5090565b5b80821115612198576000815560010161219d565b80356001600160a01b03811681146121c857600080fd5b919050565b600080604083850312156121e057600080fd5b6121e9836121b1565b91506121f7602084016121b1565b90509250929050565b60008060006060848603121561221557600080fd5b83359250612225602085016121b1565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561227457612274612235565b604052919050565b600082601f83011261228d57600080fd5b8135602067ffffffffffffffff8211156122a9576122a9612235565b8160051b6122b882820161224b565b92835284810182019282810190878511156122d257600080fd5b83870192505b848310156120a8576122e9836121b1565b825291830191908301906122d8565b60006020828403121561230a57600080fd5b813567ffffffffffffffff81111561232157600080fd5b611fb98482850161227c565b60006020828403121561233f57600080fd5b5035919050565b60005b83811015612361578181015183820152602001612349565b50506000910152565b6020815260008251806020840152612389816040850160208701612346565b601f01601f19169190910160400192915050565b6000602082840312156123af57600080fd5b6123b8826121b1565b9392505050565b600080604083850312156123d257600080fd5b823567ffffffffffffffff8111156123e957600080fd5b6123f58582860161227c565b95602094909401359450505050565b600082601f83011261241557600080fd5b813567ffffffffffffffff81111561242f5761242f612235565b612442601f8201601f191660200161224b565b81815284602083860101111561245757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561248957600080fd5b83359250612499602085016121b1565b9150604084013567ffffffffffffffff8111156124b557600080fd5b6124c186828701612404565b9150509250925092565b600080600080600060a086880312156124e357600080fd5b853567ffffffffffffffff808211156124fb57600080fd5b61250789838a01612404565b9650602088013591508082111561251d57600080fd5b5061252a88828901612404565b945050612539604087016121b1565b92506060860135915061254e608087016121b1565b90509295509295909350565b6000806040838503121561256d57600080fd5b50508035926020909101359150565b6000806000806080858703121561259257600080fd5b843593506125a2602086016121b1565b92506125b0604086016121b1565b9150606085013567ffffffffffffffff8111156125cc57600080fd5b6125d887828801612404565b91505092959194509250565b600080604083850312156125f757600080fd5b612600836121b1565b946020939093013593505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161264c5761264c612624565b5060010190565b600181811c9082168061266757607f821691505b60208210810361268757634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610ecc57600081815260208120601f850160051c810160208610156126b45750805b601f850160051c820191505b81811015611135578281556001016126c0565b815167ffffffffffffffff8111156126ed576126ed612235565b612701816126fb8454612653565b8461268d565b602080601f831160018114612736576000841561271e5750858301515b600019600386901b1c1916600185901b178555611135565b600085815260208120601f198616915b8281101561276557888601518255948401946001909101908401612746565b50858210156127835787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000602082840312156127a557600080fd5b5051919050565b80820281158282048414176114f9576114f9612624565b6000826127e057634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156114f9576114f9612624565b60006020828403121561280a57600080fd5b815180151581146123b857600080fd5b6000825161282c818460208701612346565b919091019291505056fea2646970667358221220e0260e6672ad54e64c987650e35190fedfa0396dbbe0cfaedca8dfb14abbdd6064736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106102a05760003560e01c8063afbcb2691161016e578063d7397f22116100cb578063ec0a920f1161007f578063eedc966a11610064578063eedc966a146107bb578063f2fde38b146107db578063ff8f3947146107fb57600080fd5b8063ec0a920f14610765578063edaf9f6e1461078557600080fd5b8063dbbb1968116100b0578063dbbb1968146106fa578063e697b5d814610732578063e858db081461075257600080fd5b8063d7397f22146106a4578063da8c229e146106ba57600080fd5b8063c62c7b7711610122578063d0da614411610107578063d0da614414610637578063d184befa14610657578063d488ac121461067757600080fd5b8063c62c7b77146105f5578063c70ad00c1461060a57600080fd5b8063c08d52af11610153578063c08d52af14610594578063c210401b146105ca578063c29fb0f1146105e057600080fd5b8063afbcb26914610561578063b69ef8a81461058157600080fd5b8063715018a61161021c5780638b07795b116101d057806395a885c2116101b557806395a885c2146105165780639c31e6ea1461052b578063a7fc7a071461054157600080fd5b80638b07795b146104c45780638da5cb5b146104e457600080fd5b8063830ecef811610201578063830ecef81461044a578063839df94514610477578063898c6495146104a457600080fd5b8063715018a6146104225780637d31266a1461043757600080fd5b80633ba96fdf1161027357806344430b691161025857806344430b69146103ac5780635d5d2dec146103cc578063668c91c81461040257600080fd5b80633ba96fdf1461035f5780633eae35451461038c57600080fd5b80630814cdc1146102a55780631f8e2271146102f057806320447f0b14610312578063338bc97014610332575b600080fd5b3480156102b157600080fd5b506102dd6102c03660046121cd565b600d60209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b3480156102fc57600080fd5b5061031061030b366004612200565b61081b565b005b34801561031e57600080fd5b5061031061032d3660046122f8565b610a66565b34801561033e57600080fd5b5061035261034d36600461232d565b610ba7565b6040516102e7919061236a565b34801561036b57600080fd5b506102dd61037a36600461239d565b600c6020526000908152604090205481565b34801561039857600080fd5b506103106103a73660046123bf565b610c41565b3480156103b857600080fd5b506102dd6103c736600461232d565b610d9a565b3480156103d857600080fd5b506102dd6103e736600461239d565b6001600160a01b031660009081526007602052604090205490565b34801561040e57600080fd5b5061031061041d366004612474565b610dd4565b34801561042e57600080fd5b50610310610ed1565b6103106104453660046124cb565b610ee5565b34801561045657600080fd5b506102dd61046536600461239d565b600f6020526000908152604090205481565b34801561048357600080fd5b506102dd61049236600461232d565b60026020526000908152604090205481565b3480156104b057600080fd5b506103106104bf3660046124cb565b61113e565b3480156104d057600080fd5b506103106104df36600461255a565b61134b565b3480156104f057600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020016102e7565b34801561052257600080fd5b50600b546102dd565b34801561053757600080fd5b506102dd600a5481565b34801561054d57600080fd5b5061031061055c36600461239d565b61142c565b34801561056d57600080fd5b506102dd61057c36600461232d565b6114b1565b34801561058d57600080fd5b50476102dd565b3480156105a057600080fd5b506102dd6105af36600461239d565b6001600160a01b031660009081526005602052604090205490565b3480156105d657600080fd5b506102dd600b5481565b3480156105ec57600080fd5b506009546102dd565b34801561060157600080fd5b50600a546102dd565b34801561061657600080fd5b506102dd61062536600461239d565b60076020526000908152604090205481565b34801561064357600080fd5b506102dd6106523660046121cd565b6114d2565b34801561066357600080fd5b5061031061067236600461257c565b6114ff565b34801561068357600080fd5b506102dd61069236600461232d565b60046020526000908152604090205481565b3480156106b057600080fd5b506102dd600e5481565b3480156106c657600080fd5b506106ea6106d536600461239d565b60016020526000908152604090205460ff1681565b60405190151581526020016102e7565b34801561070657600080fd5b506102dd6107153660046121cd565b600860209081526000928352604080842090915290825290205481565b34801561073e57600080fd5b506102dd61074d3660046125e4565b611621565b610310610760366004612474565b611652565b34801561077157600080fd5b5061031061078036600461232d565b611783565b34801561079157600080fd5b506104fe6107a036600461232d565b6003602052600090815260409020546001600160a01b031681565b3480156107c757600080fd5b506102dd6107d636600461239d565b61193c565b3480156107e757600080fd5b506103106107f636600461239d565b6119c0565b34801561080757600080fd5b506103106108163660046124cb565b611a50565b3360009081526001602052604090205460ff168061084357506000546001600160a01b031633145b6108945760405162461bcd60e51b815260206004820152601960248201527f4e6f74206120636f6e74726f6c6c6572206f72206f776e65720000000000000060448201526064015b60405180910390fd5b826108e15760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420726566657272616c20636f64650000000000000000000000604482015260640161088b565b6001600160a01b0382166109375760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420726566657272656520616464726573730000000000000000604482015260640161088b565b6000838152600360205260409020546001600160a01b03161561099c5760405162461bcd60e51b815260206004820181905260248201527f526566657272616c20636f646520616c72656164792072656769737465726564604482015260640161088b565b6000838152600360205260409020546001600160a01b031680156109ed5760408051600080825260208083018085526001600160a01b0386168352600590915292902090516109eb9290612151565b505b506000838152600360209081526040808320805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03969096169590951790945560098054600181019091557f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01949094556004909352912055565b610a6e611c5b565b600a54600b5560005b600954811015610adf57600060098281548110610a9657610a9661260e565b60009182526020808320909101548252600381526040808320546001600160a01b031683526007825280832054600c909252909120555080610ad78161263a565b915050610a77565b5060005b8151811015610ba3576000828281518110610b0057610b0061260e565b6020026020010151905060005b600954811015610b8e57600060098281548110610b2c57610b2c61260e565b60009182526020808320909101548252600381526040808320546001600160a01b039081168085526008845282852091881680865291845282852054908552600d84528285209185529252909120555080610b868161263a565b915050610b0d565b50508080610b9b9061263a565b915050610ae3565b5050565b60066020526000908152604090208054610bc090612653565b80601f0160208091040260200160405190810160405280929190818152602001828054610bec90612653565b8015610c395780601f10610c0e57610100808354040283529160200191610c39565b820191906000526020600020905b815481529060010190602001808311610c1c57829003601f168201915b505050505081565b610c49611c5b565b815160005b81811015610d94576000848281518110610c6a57610c6a61260e565b6020026020010151905060005b84811015610d8a57600060098281548110610c9457610c9461260e565b906000526020600020015490506004600082815260200190815260200160002054421015610d81576000818152600360209081526040808320546001600160a01b0390811680855260088452828520918816855292529091205480610d3b5760405162461bcd60e51b815260206004820152601760248201527f4e6f206561726e696e677320746f207769746864726177000000000000000000604482015260640161088b565b8015610d7e57610d556001600160a01b0386168383611cb5565b6001600160a01b0380831660009081526008602090815260408083209389168352929052908120555b50505b50600101610c77565b5050600101610c4e565b50505050565b600060148210610dac57506019919050565b600f8210610dbc57506014919050565b60028210610dcc5750600f919050565b506000919050565b3360009081526001602052604090205460ff1680610dfc57506000546001600160a01b031633145b610e485760405162461bcd60e51b815260206004820152601960248201527f4e6f74206120636f6e74726f6c6c6572206f72206f776e657200000000000000604482015260640161088b565b426004600083805190602001208152602001908152602001600020541115610ecc576001600160a01b038216610ec05760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420726563656976657220616464726573730000000000000000604482015260640161088b565b610ecc82846001611d35565b505050565b610ed9611c5b565b610ee36000611df5565b565b3360009081526001602052604090205460ff1680610f0d57506000546001600160a01b031633145b610f595760405162461bcd60e51b815260206004820152601960248201527f4e6f74206120636f6e74726f6c6c6572206f72206f776e657200000000000000604482015260640161088b565b6001600160a01b03811615801590610f835750826001600160a01b0316816001600160a01b031614155b610fcf5760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420726563656976657220616464726573730000000000000000604482015260640161088b565b4260046000878051906020012081526020019081526020016000205411156110fc576000805b6001600160a01b03831660009081526005602052604090205481101561107e57858051906020012060056000856001600160a01b03166001600160a01b0316815260200190815260200160002082815481106110535761105361260e565b90600052602060002001540361106c576001915061107e565b806110768161263a565b915050610ff5565b508015156000036110ea576001600160a01b03821660009081526005602090815260408083208851898401908120825460018101845592865284862090920191909155885190208352600690915290206110d887826126d3565b506110e582846000611d35565b6110f6565b6110f682846000611d35565b50611137565b600080546040516001600160a01b039091169184156108fc02918591818181858888f19350505050158015611135573d6000803e3d6000fd5b505b5050505050565b3360009081526001602052604090205460ff168061116657506000546001600160a01b031633145b6111b25760405162461bcd60e51b815260206004820152601960248201527f4e6f74206120636f6e74726f6c6c6572206f72206f776e657200000000000000604482015260640161088b565b6001600160a01b038116158015906111dc5750826001600160a01b0316816001600160a01b031614155b6112285760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420726563656976657220616464726573730000000000000000604482015260640161088b565b426004600087805190602001208152602001908152602001600020541115611137576000805b6001600160a01b0383166000908152600560205260409020548110156112d357858051906020012060056000856001600160a01b03166001600160a01b0316815260200190815260200160002082815481106112ac576112ac61260e565b9060005260206000200154036112c157600191505b806112cb8161263a565b91505061124e565b5080151560000361133f576001600160a01b038216600090815260056020908152604080832088518984019081208254600181018455928652848620909201919091558851902083526006909152902061132d87826126d3565b5061133a82846001611d35565b611135565b61113582846001611d35565b3360009081526001602052604090205460ff168061137357506000546001600160a01b031633145b6113bf5760405162461bcd60e51b815260206004820152601960248201527f4e6f74206120636f6e74726f6c6c6572206f72206f776e657200000000000000604482015260640161088b565b60008281526004602052604090205461141a5760405162461bcd60e51b815260206004820152601c60248201527f526566657272616c20636f646520646f6573206e6f7420657869737400000000604482015260640161088b565b60009182526004602052604090912055565b611434611c5b565b6001600160a01b03811661148a5760405162461bcd60e51b815260206004820152601a60248201527f496e76616c696420636f6e74726f6c6c65722061646472657373000000000000604482015260640161088b565b6001600160a01b03166000908152600160208190526040909120805460ff19169091179055565b600981815481106114c157600080fd5b600091825260209091200154905081565b6001600160a01b038083166000908152600860209081526040808320938516835292905220545b92915050565b3360009081526001602052604090205460ff168061152757506000546001600160a01b031633145b6115735760405162461bcd60e51b815260206004820152601960248201527f4e6f74206120636f6e74726f6c6c6572206f72206f776e657200000000000000604482015260640161088b565b4260046000838051906020012081526020019081526020016000205411156115fb576001600160a01b0383166115eb5760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420726563656976657220616464726573730000000000000000604482015260640161088b565b6115f6838386611e52565b610d94565b610d946116106000546001600160a01b031690565b6001600160a01b0384169086611cb5565b6005602052816000526040600020818154811061163d57600080fd5b90600052602060002001600091509150505481565b3360009081526001602052604090205460ff168061167a57506000546001600160a01b031633145b6116c65760405162461bcd60e51b815260206004820152601960248201527f4e6f74206120636f6e74726f6c6c6572206f72206f776e657200000000000000604482015260640161088b565b42600460008380519060200120815260200190815260200160002054111561174a576001600160a01b03821661173e5760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420726563656976657220616464726573730000000000000000604482015260640161088b565b610ecc82846000611d35565b600080546040516001600160a01b039091169185156108fc02918691818181858888f19350505050158015610d94573d6000803e3d6000fd5b61178b611c5b565b60005b818110156118ca576000600983815481106117ab576117ab61260e565b9060005260206000200154905060046000828152602001908152602001600020544210156118c1576000818152600360209081526040808320546001600160a01b031680845260079092529091205480156118be576000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461184d576040519150601f19603f3d011682016040523d82523d6000602084013e611852565b606091505b50509050806118a35760405162461bcd60e51b815260206004820152600e60248201527f5061796d656e74206661696c6564000000000000000000000000000000000000604482015260640161088b565b506001600160a01b0382166000908152600760205260408120555b50505b5060010161178e565b5047801561190d57600080546040516001600160a01b039091169183156108fc02918491818181858888f1935050505015801561190b573d6000803e3d6000fd5b505b60405133907f8139efc425db5c04b6dd4e0df2e2ae5d44350cfb145cfbfc83bf39abbc2591ee90600090a25050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561199c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114f99190612793565b6119c8611c5b565b6001600160a01b038116611a445760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161088b565b611a4d81611df5565b50565b3360009081526001602052604090205460ff1680611a7857506000546001600160a01b031633145b611ac45760405162461bcd60e51b815260206004820152601960248201527f4e6f74206120636f6e74726f6c6c6572206f72206f776e657200000000000000604482015260640161088b565b426004600087805190602001208152602001908152602001600020541115611c355784516020808701919091206000908152600390915260409020546001600160a01b03168015801590611b2a5750836001600160a01b0316816001600160a01b031614155b156110f6576000805b6001600160a01b038316600090815260056020526040902054811015611bb857868051906020012060056000856001600160a01b03166001600160a01b031681526020019081526020016000208281548110611b9157611b9161260e565b906000526020600020015403611ba657600191505b80611bb08161263a565b915050611b33565b50801515600003611c23576001600160a01b038216600090815260056020908152604080832089518a840190812082546001810184559286528486209092019190915589519020835260069091529020611c1288826126d3565b50611c1e828486611e52565b611c2e565b611c2e828486611e52565b5050611137565b611137611c4a6000546001600160a01b031690565b6001600160a01b0383169084611cb5565b6000546001600160a01b03163314610ee35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161088b565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610ecc908490611ec2565b6001600160a01b038316600090815260056020526040902054606490611d5a90610d9a565b611d6490846127ac565b611d6e91906127c3565b6001600160a01b03841660009081526007602052604081208054909190611d969084906127e5565b90915550508015610ecc576001600160a01b038316600090815260056020526040902054606490611dc690610d9a565b611dd090846127ac565b611dda91906127c3565b600a6000828254611deb91906127e5565b9091555050505050565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038316600090815260056020526040902054606490611e7790610d9a565b611e8190836127ac565b611e8b91906127c3565b6001600160a01b03808516600090815260086020908152604080832093871683529290529081208054909190611deb9084906127e5565b6000611f17826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611faa9092919063ffffffff16565b9050805160001480611f38575080806020019051810190611f3891906127f8565b610ecc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161088b565b6060611fb98484600085611fc1565b949350505050565b6060824710156120395760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161088b565b600080866001600160a01b03168587604051612055919061281a565b60006040518083038185875af1925050503d8060008114612092576040519150601f19603f3d011682016040523d82523d6000602084013e612097565b606091505b50915091506120a8878383876120b3565b979650505050505050565b6060831561212257825160000361211b576001600160a01b0385163b61211b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161088b565b5081611fb9565b611fb983838151156121375781518083602001fd5b8060405162461bcd60e51b815260040161088b919061236a565b82805482825590600052602060002090810192821561218c579160200282015b8281111561218c578251825591602001919060010190612171565b5061219892915061219c565b5090565b5b80821115612198576000815560010161219d565b80356001600160a01b03811681146121c857600080fd5b919050565b600080604083850312156121e057600080fd5b6121e9836121b1565b91506121f7602084016121b1565b90509250929050565b60008060006060848603121561221557600080fd5b83359250612225602085016121b1565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561227457612274612235565b604052919050565b600082601f83011261228d57600080fd5b8135602067ffffffffffffffff8211156122a9576122a9612235565b8160051b6122b882820161224b565b92835284810182019282810190878511156122d257600080fd5b83870192505b848310156120a8576122e9836121b1565b825291830191908301906122d8565b60006020828403121561230a57600080fd5b813567ffffffffffffffff81111561232157600080fd5b611fb98482850161227c565b60006020828403121561233f57600080fd5b5035919050565b60005b83811015612361578181015183820152602001612349565b50506000910152565b6020815260008251806020840152612389816040850160208701612346565b601f01601f19169190910160400192915050565b6000602082840312156123af57600080fd5b6123b8826121b1565b9392505050565b600080604083850312156123d257600080fd5b823567ffffffffffffffff8111156123e957600080fd5b6123f58582860161227c565b95602094909401359450505050565b600082601f83011261241557600080fd5b813567ffffffffffffffff81111561242f5761242f612235565b612442601f8201601f191660200161224b565b81815284602083860101111561245757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561248957600080fd5b83359250612499602085016121b1565b9150604084013567ffffffffffffffff8111156124b557600080fd5b6124c186828701612404565b9150509250925092565b600080600080600060a086880312156124e357600080fd5b853567ffffffffffffffff808211156124fb57600080fd5b61250789838a01612404565b9650602088013591508082111561251d57600080fd5b5061252a88828901612404565b945050612539604087016121b1565b92506060860135915061254e608087016121b1565b90509295509295909350565b6000806040838503121561256d57600080fd5b50508035926020909101359150565b6000806000806080858703121561259257600080fd5b843593506125a2602086016121b1565b92506125b0604086016121b1565b9150606085013567ffffffffffffffff8111156125cc57600080fd5b6125d887828801612404565b91505092959194509250565b600080604083850312156125f757600080fd5b612600836121b1565b946020939093013593505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161264c5761264c612624565b5060010190565b600181811c9082168061266757607f821691505b60208210810361268757634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610ecc57600081815260208120601f850160051c810160208610156126b45750805b601f850160051c820191505b81811015611135578281556001016126c0565b815167ffffffffffffffff8111156126ed576126ed612235565b612701816126fb8454612653565b8461268d565b602080601f831160018114612736576000841561271e5750858301515b600019600386901b1c1916600185901b178555611135565b600085815260208120601f198616915b8281101561276557888601518255948401946001909101908401612746565b50858210156127835787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000602082840312156127a557600080fd5b5051919050565b80820281158282048414176114f9576114f9612624565b6000826127e057634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156114f9576114f9612624565b60006020828403121561280a57600080fd5b815180151581146123b857600080fd5b6000825161282c818460208701612346565b919091019291505056fea2646970667358221220e0260e6672ad54e64c987650e35190fedfa0396dbbe0cfaedca8dfb14abbdd6064736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "setReferree(bytes32,address,uint256)": { + "notice": "Only your controller or admin should be able to call this!" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 53, + "contract": "contracts/ethregistrar/ReferralController.sol:ReferralController", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 7168, + "contract": "contracts/ethregistrar/ReferralController.sol:ReferralController", + "label": "controllers", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 7172, + "contract": "contracts/ethregistrar/ReferralController.sol:ReferralController", + "label": "commitments", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_bytes32,t_uint256)" + }, + { + "astId": 7176, + "contract": "contracts/ethregistrar/ReferralController.sol:ReferralController", + "label": "referrees", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_bytes32,t_address)" + }, + { + "astId": 7180, + "contract": "contracts/ethregistrar/ReferralController.sol:ReferralController", + "label": "expirydates", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_bytes32,t_uint256)" + }, + { + "astId": 7185, + "contract": "contracts/ethregistrar/ReferralController.sol:ReferralController", + "label": "referrals", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_address,t_array(t_bytes32)dyn_storage)" + }, + { + "astId": 7189, + "contract": "contracts/ethregistrar/ReferralController.sol:ReferralController", + "label": "referredBy", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_bytes32,t_string_storage)" + }, + { + "astId": 7193, + "contract": "contracts/ethregistrar/ReferralController.sol:ReferralController", + "label": "nativeEarnings", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 7199, + "contract": "contracts/ethregistrar/ReferralController.sol:ReferralController", + "label": "tokenEarnings", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 7202, + "contract": "contracts/ethregistrar/ReferralController.sol:ReferralController", + "label": "referralCodes", + "offset": 0, + "slot": "9", + "type": "t_array(t_bytes32)dyn_storage" + }, + { + "astId": 7204, + "contract": "contracts/ethregistrar/ReferralController.sol:ReferralController", + "label": "untrackedEarnings", + "offset": 0, + "slot": "10", + "type": "t_uint256" + }, + { + "astId": 7206, + "contract": "contracts/ethregistrar/ReferralController.sol:ReferralController", + "label": "snapshotUntrackedEarnings", + "offset": 0, + "slot": "11", + "type": "t_uint256" + }, + { + "astId": 7210, + "contract": "contracts/ethregistrar/ReferralController.sol:ReferralController", + "label": "snapshotNativeEarnings", + "offset": 0, + "slot": "12", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 7216, + "contract": "contracts/ethregistrar/ReferralController.sol:ReferralController", + "label": "snapshotTokenEarnings", + "offset": 0, + "slot": "13", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 7218, + "contract": "contracts/ethregistrar/ReferralController.sol:ReferralController", + "label": "trackedNativeEarnings", + "offset": 0, + "slot": "14", + "type": "t_uint256" + }, + { + "astId": 7222, + "contract": "contracts/ethregistrar/ReferralController.sol:ReferralController", + "label": "trackedTokenEarnings", + "offset": 0, + "slot": "15", + "type": "t_mapping(t_address,t_uint256)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_bytes32)dyn_storage": { + "base": "t_bytes32", + "encoding": "dynamic_array", + "label": "bytes32[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_array(t_bytes32)dyn_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bytes32[])", + "numberOfBytes": "32", + "value": "t_array(t_bytes32)dyn_storage" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_bytes32,t_address)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_bytes32,t_string_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_mapping(t_bytes32,t_uint256)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/ReverseRegistrar.json b/solidity/dns-contracts/deployments/testnet/ReverseRegistrar.json new file mode 100644 index 0000000..9f79208 --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/ReverseRegistrar.json @@ -0,0 +1,516 @@ +{ + "address": "0x2E5ba310fDa0aD5dfA4CC5656FAEDDd4CC4c162b", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "ensAddr", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "ControllerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract NameResolver", + "name": "resolver", + "type": "address" + } + ], + "name": "DefaultResolverChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "ReverseClaimed", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "claim", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "claimForAddr", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "claimWithResolver", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "defaultResolver", + "outputs": [ + { + "internalType": "contract NameResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "node", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setDefaultResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "setName", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "setNameForAddr", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x45907a211a1c05fe8436bea9aca27e4e6c2ca2252cdac13bc7b0086ff1309eb3", + "receipt": { + "to": null, + "from": "0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B", + "contractAddress": "0x2E5ba310fDa0aD5dfA4CC5656FAEDDd4CC4c162b", + "transactionIndex": 2, + "gasUsed": "825904", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000001000000000000400000000000000000000000020000000000000000000800000000000000000000000000000000400000000000010000000000000000000000000000000000000000000000000000000000000040000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000021000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x7eae83f397353ea779b1188586a727fdcab77d3df528e7d9823b6029186a1fd5", + "transactionHash": "0x45907a211a1c05fe8436bea9aca27e4e6c2ca2252cdac13bc7b0086ff1309eb3", + "logs": [ + { + "transactionIndex": 2, + "blockNumber": 57534980, + "transactionHash": "0x45907a211a1c05fe8436bea9aca27e4e6c2ca2252cdac13bc7b0086ff1309eb3", + "address": "0x2E5ba310fDa0aD5dfA4CC5656FAEDDd4CC4c162b", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000002a0d7311fa7e9ac2890cfd8219b2def0c206e79b" + ], + "data": "0x", + "logIndex": 9, + "blockHash": "0x7eae83f397353ea779b1188586a727fdcab77d3df528e7d9823b6029186a1fd5" + } + ], + "blockNumber": 57534980, + "cumulativeGasUsed": "1121756", + "status": 1, + "byzantium": true + }, + "args": [ + "0x8390D472587cCAe988dD06Ccd456Ac70CcF39038" + ], + "numDeployments": 1, + "solcInputHash": "c311c3de46948b5831b922985c265742", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"ensAddr\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"ControllerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contract NameResolver\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"DefaultResolverChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"ReverseClaimed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"claimForAddr\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"claimWithResolver\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"defaultResolver\",\"outputs\":[{\"internalType\":\"contract NameResolver\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"node\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setDefaultResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"setNameForAddr\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"claim(address)\":{\"details\":\"Transfers ownership of the reverse ENS record associated with the calling account.\",\"params\":{\"owner\":\"The address to set as the owner of the reverse record in ENS.\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"claimForAddr(address,address,address)\":{\"details\":\"Transfers ownership of the reverse ENS record associated with the calling account.\",\"params\":{\"addr\":\"The reverse record to set\",\"owner\":\"The address to set as the owner of the reverse record in ENS.\",\"resolver\":\"The resolver of the reverse node\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"claimWithResolver(address,address)\":{\"details\":\"Transfers ownership of the reverse ENS record associated with the calling account.\",\"params\":{\"owner\":\"The address to set as the owner of the reverse record in ENS.\",\"resolver\":\"The address of the resolver to set; 0 to leave unchanged.\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"constructor\":{\"details\":\"Constructor\",\"params\":{\"ensAddr\":\"The address of the ENS registry.\"}},\"node(address)\":{\"details\":\"Returns the node hash for a given account's reverse records.\",\"params\":{\"addr\":\"The address to hash\"},\"returns\":{\"_0\":\"The ENS node hash.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"setName(string)\":{\"details\":\"Sets the `name()` record for the reverse ENS record associated with the calling account. First updates the resolver to the default reverse resolver if necessary.\",\"params\":{\"name\":\"The name to set for this address.\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"setNameForAddr(address,address,address,string)\":{\"details\":\"Sets the `name()` record for the reverse ENS record associated with the account provided. Updates the resolver to a designated resolver Only callable by controllers and authorised users\",\"params\":{\"addr\":\"The reverse record to set\",\"name\":\"The name to set for this address.\",\"owner\":\"The owner of the reverse node\",\"resolver\":\"The resolver of the reverse node\"},\"returns\":{\"_0\":\"The ENS node hash of the reverse record.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/reverseRegistrar/ReverseRegistrar.sol\":\"ReverseRegistrar\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"contracts/registry/ENS.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x8e208b44d5dbf22552fe72d79b45c640855b84fbc9ee21f4c3bb4bfe81cbe8db\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IReverseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"../root/Controllable.sol\\\";\\n\\nabstract contract NameResolver {\\n function setName(bytes32 node, string memory name) public virtual;\\n}\\n\\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\\n\\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n// namehash('addr.reverse')\\n\\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\\n ENS public immutable ens;\\n NameResolver public defaultResolver;\\n\\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\\n event DefaultResolverChanged(NameResolver indexed resolver);\\n\\n /**\\n * @dev Constructor\\n * @param ensAddr The address of the ENS registry.\\n */\\n constructor(ENS ensAddr) {\\n ens = ensAddr;\\n\\n // Assign ownership of the reverse record to our deployer\\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\\n ensAddr.owner(ADDR_REVERSE_NODE)\\n );\\n if (address(oldRegistrar) != address(0x0)) {\\n oldRegistrar.claim(msg.sender);\\n }\\n }\\n\\n modifier authorised(address addr) {\\n require(\\n addr == msg.sender ||\\n controllers[msg.sender] ||\\n ens.isApprovedForAll(addr, msg.sender) ||\\n ownsContract(addr),\\n \\\"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\\\"\\n );\\n _;\\n }\\n\\n function setDefaultResolver(address resolver) public override onlyOwner {\\n require(\\n address(resolver) != address(0),\\n \\\"ReverseRegistrar: Resolver address must not be 0\\\"\\n );\\n defaultResolver = NameResolver(resolver);\\n emit DefaultResolverChanged(NameResolver(resolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claim(address owner) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, address(defaultResolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param addr The reverse record to set\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The resolver of the reverse node\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) public override authorised(addr) returns (bytes32) {\\n bytes32 labelHash = sha3HexAddress(addr);\\n bytes32 reverseNode = keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\\n );\\n emit ReverseClaimed(addr, reverseNode);\\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\\n return reverseNode;\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, resolver);\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the calling account. First updates the resolver to the default reverse\\n * resolver if necessary.\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setName(string memory name) public override returns (bytes32) {\\n return\\n setNameForAddr(\\n msg.sender,\\n msg.sender,\\n address(defaultResolver),\\n name\\n );\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the account provided. Updates the resolver to a designated resolver\\n * Only callable by controllers and authorised users\\n * @param addr The reverse record to set\\n * @param owner The owner of the reverse node\\n * @param resolver The resolver of the reverse node\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) public override returns (bytes32) {\\n bytes32 node = claimForAddr(addr, owner, resolver);\\n NameResolver(resolver).setName(node, name);\\n return node;\\n }\\n\\n /**\\n * @dev Returns the node hash for a given account's reverse records.\\n * @param addr The address to hash\\n * @return The ENS node hash.\\n */\\n function node(address addr) public pure override returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\\n );\\n }\\n\\n /**\\n * @dev An optimised function to compute the sha3 of the lower-case\\n * hexadecimal representation of an Ethereum address.\\n * @param addr The address to hash\\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\\n * input address.\\n */\\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\\n assembly {\\n for {\\n let i := 40\\n } gt(i, 0) {\\n\\n } {\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n }\\n\\n ret := keccak256(0, 40)\\n }\\n }\\n\\n function ownsContract(address addr) internal view returns (bool) {\\n try Ownable(addr).owner() returns (address owner) {\\n return owner == msg.sender;\\n } catch {\\n return false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd57d28e5791b4b44650a00f5ef6c725af53698ec33faeeaa3591f0dbd939559a\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"}},\"version\":1}", + "bytecode": "0x60a060405234801561001057600080fd5b5060405162000f5338038062000f53833981016040819052610031916101b6565b61003a3361014e565b6001600160a01b03811660808190526040516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152600091906302571be390602401602060405180830381865afa1580156100a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ca91906101b6565b90506001600160a01b0381161561014757604051630f41a04d60e11b81523360048201526001600160a01b03821690631e83409a906024016020604051808303816000875af1158015610121573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061014591906101da565b505b50506101f3565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146101b357600080fd5b50565b6000602082840312156101c857600080fd5b81516101d38161019e565b9392505050565b6000602082840312156101ec57600080fd5b5051919050565b608051610d366200021d6000396000818161012d015281816102f001526105070152610d366000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063c66485b211610066578063c66485b2146101e1578063da8c229e146101f4578063e0dba60f14610227578063f2fde38b1461023a57600080fd5b80638da5cb5b146101aa578063bffbe61c146101bb578063c47f0027146101ce57600080fd5b806365669631116100c85780636566963114610167578063715018a61461017a5780637a806d6b14610184578063828eab0e1461019757600080fd5b80630f5a5466146100ef5780631e83409a146101155780633f15457f14610128575b600080fd5b6101026100fd366004610a25565b61024d565b6040519081526020015b60405180910390f35b610102610123366004610a5e565b610261565b61014f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b610102610175366004610a7b565b610283565b61018261056e565b005b610102610192366004610b82565b610582565b60025461014f906001600160a01b031681565b6000546001600160a01b031661014f565b6101026101c9366004610a5e565b610616565b6101026101dc366004610bf7565b610671565b6101826101ef366004610a5e565b61068e565b610217610202366004610a5e565b60016020526000908152604090205460ff1681565b604051901515815260200161010c565b610182610235366004610c42565b610769565b610182610248366004610a5e565b6107d0565b600061025a338484610283565b9392505050565b60025460009061027d90339084906001600160a01b0316610283565b92915050565b6000836001600160a01b0381163314806102ac57503360009081526001602052604090205460ff165b8061035b57506040517fe985e9c50000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610337573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035b9190610c70565b8061036a575061036a81610860565b6104075760405162461bcd60e51b815260206004820152605b60248201527f526576657273655265676973747261723a2043616c6c6572206973206e6f742060448201527f6120636f6e74726f6c6c6572206f7220617574686f726973656420627920616460648201527f6472657373206f7220746865206164647265737320697473656c660000000000608482015260a4015b60405180910390fd5b6000610412866108d9565b604080517f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2602080830191909152818301849052825180830384018152606090920192839052815191012091925081906001600160a01b038916907f6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e9290600090a36040517f5ef2c7f00000000000000000000000000000000000000000000000000000000081527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152602481018390526001600160a01b0387811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561054b57600080fd5b505af115801561055f573d6000803e3d6000fd5b50929998505050505050505050565b610576610959565b61058060006109b3565b565b600080610590868686610283565b6040517f773722130000000000000000000000000000000000000000000000000000000081529091506001600160a01b038516906377372213906105da9084908790600401610c8d565b600060405180830381600087803b1580156105f457600080fd5b505af1158015610608573d6000803e3d6000fd5b509298975050505050505050565b60007f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2610642836108d9565b604080516020810193909352820152606001604051602081830303815290604052805190602001209050919050565b60025460009061027d90339081906001600160a01b031685610582565b610696610959565b6001600160a01b0381166107125760405162461bcd60e51b815260206004820152603060248201527f526576657273655265676973747261723a205265736f6c76657220616464726560448201527f7373206d757374206e6f7420626520300000000000000000000000000000000060648201526084016103fe565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517feae17a84d9eb83d8c8eb317f9e7d64857bc363fa51674d996c023f4340c577cf90600090a250565b610771610959565b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b6107d8610959565b6001600160a01b0381166108545760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103fe565b61085d816109b3565b50565b6000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156108bc575060408051601f3d908101601f191682019092526108b991810190610ce3565b60015b6108c857506000919050565b6001600160a01b0316331492915050565b600060285b801561094d57600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a8153601090920491600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a81536010830492506108de565b50506028600020919050565b6000546001600160a01b031633146105805760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103fe565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461085d57600080fd5b60008060408385031215610a3857600080fd5b8235610a4381610a10565b91506020830135610a5381610a10565b809150509250929050565b600060208284031215610a7057600080fd5b813561025a81610a10565b600080600060608486031215610a9057600080fd5b8335610a9b81610a10565b92506020840135610aab81610a10565b91506040840135610abb81610a10565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112610b0657600080fd5b813567ffffffffffffffff80821115610b2157610b21610ac6565b604051601f8301601f19908116603f01168101908282118183101715610b4957610b49610ac6565b81604052838152866020858801011115610b6257600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060808587031215610b9857600080fd5b8435610ba381610a10565b93506020850135610bb381610a10565b92506040850135610bc381610a10565b9150606085013567ffffffffffffffff811115610bdf57600080fd5b610beb87828801610af5565b91505092959194509250565b600060208284031215610c0957600080fd5b813567ffffffffffffffff811115610c2057600080fd5b610c2c84828501610af5565b949350505050565b801515811461085d57600080fd5b60008060408385031215610c5557600080fd5b8235610c6081610a10565b91506020830135610a5381610c34565b600060208284031215610c8257600080fd5b815161025a81610c34565b82815260006020604081840152835180604085015260005b81811015610cc157858101830151858201606001528201610ca5565b506000606082860101526060601f19601f830116850101925050509392505050565b600060208284031215610cf557600080fd5b815161025a81610a1056fea2646970667358221220c29dc69d5a3a9a50b71c43a65b40e085326d95ea4ad2614f47fe1da46d8910f164736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063c66485b211610066578063c66485b2146101e1578063da8c229e146101f4578063e0dba60f14610227578063f2fde38b1461023a57600080fd5b80638da5cb5b146101aa578063bffbe61c146101bb578063c47f0027146101ce57600080fd5b806365669631116100c85780636566963114610167578063715018a61461017a5780637a806d6b14610184578063828eab0e1461019757600080fd5b80630f5a5466146100ef5780631e83409a146101155780633f15457f14610128575b600080fd5b6101026100fd366004610a25565b61024d565b6040519081526020015b60405180910390f35b610102610123366004610a5e565b610261565b61014f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b610102610175366004610a7b565b610283565b61018261056e565b005b610102610192366004610b82565b610582565b60025461014f906001600160a01b031681565b6000546001600160a01b031661014f565b6101026101c9366004610a5e565b610616565b6101026101dc366004610bf7565b610671565b6101826101ef366004610a5e565b61068e565b610217610202366004610a5e565b60016020526000908152604090205460ff1681565b604051901515815260200161010c565b610182610235366004610c42565b610769565b610182610248366004610a5e565b6107d0565b600061025a338484610283565b9392505050565b60025460009061027d90339084906001600160a01b0316610283565b92915050565b6000836001600160a01b0381163314806102ac57503360009081526001602052604090205460ff165b8061035b57506040517fe985e9c50000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301523360248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610337573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035b9190610c70565b8061036a575061036a81610860565b6104075760405162461bcd60e51b815260206004820152605b60248201527f526576657273655265676973747261723a2043616c6c6572206973206e6f742060448201527f6120636f6e74726f6c6c6572206f7220617574686f726973656420627920616460648201527f6472657373206f7220746865206164647265737320697473656c660000000000608482015260a4015b60405180910390fd5b6000610412866108d9565b604080517f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2602080830191909152818301849052825180830384018152606090920192839052815191012091925081906001600160a01b038916907f6ada868dd3058cf77a48a74489fd7963688e5464b2b0fa957ace976243270e9290600090a36040517f5ef2c7f00000000000000000000000000000000000000000000000000000000081527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152602481018390526001600160a01b0387811660448301528681166064830152600060848301527f00000000000000000000000000000000000000000000000000000000000000001690635ef2c7f09060a401600060405180830381600087803b15801561054b57600080fd5b505af115801561055f573d6000803e3d6000fd5b50929998505050505050505050565b610576610959565b61058060006109b3565b565b600080610590868686610283565b6040517f773722130000000000000000000000000000000000000000000000000000000081529091506001600160a01b038516906377372213906105da9084908790600401610c8d565b600060405180830381600087803b1580156105f457600080fd5b505af1158015610608573d6000803e3d6000fd5b509298975050505050505050565b60007f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2610642836108d9565b604080516020810193909352820152606001604051602081830303815290604052805190602001209050919050565b60025460009061027d90339081906001600160a01b031685610582565b610696610959565b6001600160a01b0381166107125760405162461bcd60e51b815260206004820152603060248201527f526576657273655265676973747261723a205265736f6c76657220616464726560448201527f7373206d757374206e6f7420626520300000000000000000000000000000000060648201526084016103fe565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517feae17a84d9eb83d8c8eb317f9e7d64857bc363fa51674d996c023f4340c577cf90600090a250565b610771610959565b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b6107d8610959565b6001600160a01b0381166108545760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103fe565b61085d816109b3565b50565b6000816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156108bc575060408051601f3d908101601f191682019092526108b991810190610ce3565b60015b6108c857506000919050565b6001600160a01b0316331492915050565b600060285b801561094d57600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a8153601090920491600019017f3031323334353637383961626364656600000000000000000000000000000000600f84161a81536010830492506108de565b50506028600020919050565b6000546001600160a01b031633146105805760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103fe565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461085d57600080fd5b60008060408385031215610a3857600080fd5b8235610a4381610a10565b91506020830135610a5381610a10565b809150509250929050565b600060208284031215610a7057600080fd5b813561025a81610a10565b600080600060608486031215610a9057600080fd5b8335610a9b81610a10565b92506020840135610aab81610a10565b91506040840135610abb81610a10565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112610b0657600080fd5b813567ffffffffffffffff80821115610b2157610b21610ac6565b604051601f8301601f19908116603f01168101908282118183101715610b4957610b49610ac6565b81604052838152866020858801011115610b6257600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060808587031215610b9857600080fd5b8435610ba381610a10565b93506020850135610bb381610a10565b92506040850135610bc381610a10565b9150606085013567ffffffffffffffff811115610bdf57600080fd5b610beb87828801610af5565b91505092959194509250565b600060208284031215610c0957600080fd5b813567ffffffffffffffff811115610c2057600080fd5b610c2c84828501610af5565b949350505050565b801515811461085d57600080fd5b60008060408385031215610c5557600080fd5b8235610c6081610a10565b91506020830135610a5381610c34565b600060208284031215610c8257600080fd5b815161025a81610c34565b82815260006020604081840152835180604085015260005b81811015610cc157858101830151858201606001528201610ca5565b506000606082860101526060601f19601f830116850101925050509392505050565b600060208284031215610cf557600080fd5b815161025a81610a1056fea2646970667358221220c29dc69d5a3a9a50b71c43a65b40e085326d95ea4ad2614f47fe1da46d8910f164736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "claim(address)": { + "details": "Transfers ownership of the reverse ENS record associated with the calling account.", + "params": { + "owner": "The address to set as the owner of the reverse record in ENS." + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "claimForAddr(address,address,address)": { + "details": "Transfers ownership of the reverse ENS record associated with the calling account.", + "params": { + "addr": "The reverse record to set", + "owner": "The address to set as the owner of the reverse record in ENS.", + "resolver": "The resolver of the reverse node" + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "claimWithResolver(address,address)": { + "details": "Transfers ownership of the reverse ENS record associated with the calling account.", + "params": { + "owner": "The address to set as the owner of the reverse record in ENS.", + "resolver": "The address of the resolver to set; 0 to leave unchanged." + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "constructor": { + "details": "Constructor", + "params": { + "ensAddr": "The address of the ENS registry." + } + }, + "node(address)": { + "details": "Returns the node hash for a given account's reverse records.", + "params": { + "addr": "The address to hash" + }, + "returns": { + "_0": "The ENS node hash." + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "setName(string)": { + "details": "Sets the `name()` record for the reverse ENS record associated with the calling account. First updates the resolver to the default reverse resolver if necessary.", + "params": { + "name": "The name to set for this address." + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "setNameForAddr(address,address,address,string)": { + "details": "Sets the `name()` record for the reverse ENS record associated with the account provided. Updates the resolver to a designated resolver Only callable by controllers and authorised users", + "params": { + "addr": "The reverse record to set", + "name": "The name to set for this address.", + "owner": "The owner of the reverse node", + "resolver": "The resolver of the reverse node" + }, + "returns": { + "_0": "The ENS node hash of the reverse record." + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 474, + "contract": "contracts/reverseRegistrar/ReverseRegistrar.sol:ReverseRegistrar", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 12746, + "contract": "contracts/reverseRegistrar/ReverseRegistrar.sol:ReverseRegistrar", + "label": "controllers", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 12418, + "contract": "contracts/reverseRegistrar/ReverseRegistrar.sol:ReverseRegistrar", + "label": "defaultResolver", + "offset": 0, + "slot": "2", + "type": "t_contract(NameResolver)12400" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(NameResolver)12400": { + "encoding": "inplace", + "label": "contract NameResolver", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/Root.json b/solidity/dns-contracts/deployments/testnet/Root.json new file mode 100644 index 0000000..d02aa96 --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/Root.json @@ -0,0 +1,363 @@ +{ + "address": "0x03455768CbcfF3dE89319841B75cE70491B58079", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "ControllerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + } + ], + "name": "TLDLocked", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "controllers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + } + ], + "name": "lock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "locked", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "setController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "setResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "label", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "setSubnodeOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x9c7dd25d7b0147b9d7ae26d57a40857e35f5dbf7526180ec8597c0af658dbb79", + "receipt": { + "to": null, + "from": "0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B", + "contractAddress": "0x03455768CbcfF3dE89319841B75cE70491B58079", + "transactionIndex": 1, + "gasUsed": "506825", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041000000000000400000000000000000000000020000000000000000000800000000000000000000000000000000400000000000010000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x17446f89c7cd4a378508cb0ec2bae846b9437324fa8f63a7ad2808ae7cba9bb5", + "transactionHash": "0x9c7dd25d7b0147b9d7ae26d57a40857e35f5dbf7526180ec8597c0af658dbb79", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 57534933, + "transactionHash": "0x9c7dd25d7b0147b9d7ae26d57a40857e35f5dbf7526180ec8597c0af658dbb79", + "address": "0x03455768CbcfF3dE89319841B75cE70491B58079", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000002a0d7311fa7e9ac2890cfd8219b2def0c206e79b" + ], + "data": "0x", + "logIndex": 3, + "blockHash": "0x17446f89c7cd4a378508cb0ec2bae846b9437324fa8f63a7ad2808ae7cba9bb5" + } + ], + "blockNumber": 57534933, + "cumulativeGasUsed": "661987", + "status": 1, + "byzantium": true + }, + "args": [ + "0x8390D472587cCAe988dD06Ccd456Ac70CcF39038" + ], + "numDeployments": 1, + "solcInputHash": "c311c3de46948b5831b922985c265742", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"ControllerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"}],\"name\":\"TLDLocked\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"controllers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"}],\"name\":\"lock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"locked\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"controller\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setController\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"setResolver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"label\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setSubnodeOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/root/Root.sol\":\"Root\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"contracts/registry/ENS.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x8e208b44d5dbf22552fe72d79b45c640855b84fbc9ee21f4c3bb4bfe81cbe8db\",\"license\":\"MIT\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"},\"contracts/root/Root.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"./Controllable.sol\\\";\\n\\ncontract Root is Ownable, Controllable {\\n bytes32 private constant ROOT_NODE = bytes32(0);\\n\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n\\n event TLDLocked(bytes32 indexed label);\\n\\n ENS public ens;\\n mapping(bytes32 => bool) public locked;\\n\\n constructor(ENS _ens) public {\\n ens = _ens;\\n }\\n\\n function setSubnodeOwner(\\n bytes32 label,\\n address owner\\n ) external onlyController {\\n require(!locked[label]);\\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\\n }\\n\\n function setResolver(address resolver) external onlyOwner {\\n ens.setResolver(ROOT_NODE, resolver);\\n }\\n\\n function lock(bytes32 label) external onlyOwner {\\n emit TLDLocked(label);\\n locked[label] = true;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return interfaceID == INTERFACE_META_ID;\\n }\\n}\\n\",\"keccak256\":\"0x469b281e1a9e1c3dad9c860a4ab3a7299a48355b0b0243713e0829193c39f50c\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161084638038061084683398101604081905261002f916100ad565b6100383361005d565b600280546001600160a01b0319166001600160a01b03929092169190911790556100dd565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100bf57600080fd5b81516001600160a01b03811681146100d657600080fd5b9392505050565b61075a806100ec6000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80638cb8ecec11610081578063da8c229e1161005b578063da8c229e146101da578063e0dba60f146101fd578063f2fde38b1461021057600080fd5b80638cb8ecec146101935780638da5cb5b146101a6578063cbe9e764146101b757600080fd5b80633f15457f116100b25780633f15457f1461014d5780634e543b2614610178578063715018a61461018b57600080fd5b806301670ba9146100ce57806301ffc9a7146100e3575b600080fd5b6100e16100dc36600461060a565b610223565b005b6101386100f1366004610623565b7fffffffff00000000000000000000000000000000000000000000000000000000167f01ffc9a7000000000000000000000000000000000000000000000000000000001490565b60405190151581526020015b60405180910390f35b600254610160906001600160a01b031681565b6040516001600160a01b039091168152602001610144565b6100e1610186366004610688565b610271565b6100e16102fb565b6100e16101a13660046106a3565b61030f565b6000546001600160a01b0316610160565b6101386101c536600461060a565b60036020526000908152604090205460ff1681565b6101386101e8366004610688565b60016020526000908152604090205460ff1681565b6100e161020b3660046106cf565b610451565b6100e161021e366004610688565b6104b8565b61022b610548565b60405181907f1764176cfa565853ba1ded547a830a9f9bff95231ef6fd228b3ddd617577756990600090a26000908152600360205260409020805460ff19166001179055565b610279610548565b6002546040517f1896f70a000000000000000000000000000000000000000000000000000000008152600060048201526001600160a01b03838116602483015290911690631896f70a90604401600060405180830381600087803b1580156102e057600080fd5b505af11580156102f4573d6000803e3d6000fd5b5050505050565b610303610548565b61030d60006105a2565b565b3360009081526001602052604090205460ff166103995760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f60448201527f6e74726f6c6c657200000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60008281526003602052604090205460ff16156103b557600080fd5b6002546040517f06ab592300000000000000000000000000000000000000000000000000000000815260006004820152602481018490526001600160a01b038381166044830152909116906306ab5923906064016020604051808303816000875af1158015610428573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044c919061070b565b505050565b610459610548565b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b6104c0610548565b6001600160a01b03811661053c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610390565b610545816105a2565b50565b6000546001600160a01b0316331461030d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610390565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561061c57600080fd5b5035919050565b60006020828403121561063557600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461066557600080fd5b9392505050565b80356001600160a01b038116811461068357600080fd5b919050565b60006020828403121561069a57600080fd5b6106658261066c565b600080604083850312156106b657600080fd5b823591506106c66020840161066c565b90509250929050565b600080604083850312156106e257600080fd5b6106eb8361066c565b91506020830135801515811461070057600080fd5b809150509250929050565b60006020828403121561071d57600080fd5b505191905056fea2646970667358221220fbf37e5456b5f7abad1dafdde240330b928a3bf884b40460cff3d352a22926b664736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100c95760003560e01c80638cb8ecec11610081578063da8c229e1161005b578063da8c229e146101da578063e0dba60f146101fd578063f2fde38b1461021057600080fd5b80638cb8ecec146101935780638da5cb5b146101a6578063cbe9e764146101b757600080fd5b80633f15457f116100b25780633f15457f1461014d5780634e543b2614610178578063715018a61461018b57600080fd5b806301670ba9146100ce57806301ffc9a7146100e3575b600080fd5b6100e16100dc36600461060a565b610223565b005b6101386100f1366004610623565b7fffffffff00000000000000000000000000000000000000000000000000000000167f01ffc9a7000000000000000000000000000000000000000000000000000000001490565b60405190151581526020015b60405180910390f35b600254610160906001600160a01b031681565b6040516001600160a01b039091168152602001610144565b6100e1610186366004610688565b610271565b6100e16102fb565b6100e16101a13660046106a3565b61030f565b6000546001600160a01b0316610160565b6101386101c536600461060a565b60036020526000908152604090205460ff1681565b6101386101e8366004610688565b60016020526000908152604090205460ff1681565b6100e161020b3660046106cf565b610451565b6100e161021e366004610688565b6104b8565b61022b610548565b60405181907f1764176cfa565853ba1ded547a830a9f9bff95231ef6fd228b3ddd617577756990600090a26000908152600360205260409020805460ff19166001179055565b610279610548565b6002546040517f1896f70a000000000000000000000000000000000000000000000000000000008152600060048201526001600160a01b03838116602483015290911690631896f70a90604401600060405180830381600087803b1580156102e057600080fd5b505af11580156102f4573d6000803e3d6000fd5b5050505050565b610303610548565b61030d60006105a2565b565b3360009081526001602052604090205460ff166103995760405162461bcd60e51b815260206004820152602860248201527f436f6e74726f6c6c61626c653a2043616c6c6572206973206e6f74206120636f60448201527f6e74726f6c6c657200000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60008281526003602052604090205460ff16156103b557600080fd5b6002546040517f06ab592300000000000000000000000000000000000000000000000000000000815260006004820152602481018490526001600160a01b038381166044830152909116906306ab5923906064016020604051808303816000875af1158015610428573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044c919061070b565b505050565b610459610548565b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f4c97694570a07277810af7e5669ffd5f6a2d6b74b6e9a274b8b870fd5114cf87910160405180910390a25050565b6104c0610548565b6001600160a01b03811661053c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610390565b610545816105a2565b50565b6000546001600160a01b0316331461030d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610390565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561061c57600080fd5b5035919050565b60006020828403121561063557600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461066557600080fd5b9392505050565b80356001600160a01b038116811461068357600080fd5b919050565b60006020828403121561069a57600080fd5b6106658261066c565b600080604083850312156106b657600080fd5b823591506106c66020840161066c565b90509250929050565b600080604083850312156106e257600080fd5b6106eb8361066c565b91506020830135801515811461070057600080fd5b809150509250929050565b60006020828403121561071d57600080fd5b505191905056fea2646970667358221220fbf37e5456b5f7abad1dafdde240330b928a3bf884b40460cff3d352a22926b664736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 474, + "contract": "contracts/root/Root.sol:Root", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 12746, + "contract": "contracts/root/Root.sol:Root", + "label": "controllers", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 12816, + "contract": "contracts/root/Root.sol:Root", + "label": "ens", + "offset": 0, + "slot": "2", + "type": "t_contract(ENS)9868" + }, + { + "astId": 12820, + "contract": "contracts/root/Root.sol:Root", + "label": "locked", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_bytes32,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(ENS)9868": { + "encoding": "inplace", + "label": "contract ENS", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_bytes32,t_bool)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/StaticBulkRenewal.json b/solidity/dns-contracts/deployments/testnet/StaticBulkRenewal.json new file mode 100644 index 0000000..50a489f --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/StaticBulkRenewal.json @@ -0,0 +1,207 @@ +{ + "address": "0xB3aad8586b4796960060d0FaCBA8e001Ec7ecB7d", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ETHRegistrarController", + "name": "_controller", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "names", + "type": "string[]" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "lifetime", + "type": "bool" + } + ], + "name": "renewAll", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "names", + "type": "string[]" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "string", + "name": "token", + "type": "string" + }, + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "lifetime", + "type": "bool" + } + ], + "name": "renewAllWithToken", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "names", + "type": "string[]" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "lifetime", + "type": "bool" + } + ], + "name": "rentPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "total", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string[]", + "name": "names", + "type": "string[]" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "string", + "name": "token", + "type": "string" + }, + { + "internalType": "bool", + "name": "lifetime", + "type": "bool" + } + ], + "name": "rentPriceToken", + "outputs": [ + { + "internalType": "uint256", + "name": "total", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x44a97314f77667fbda54019c500de93cd325c97344563a18cb9e90fbe9edf3bd", + "receipt": { + "to": null, + "from": "0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B", + "contractAddress": "0xB3aad8586b4796960060d0FaCBA8e001Ec7ecB7d", + "transactionIndex": 1, + "gasUsed": "689755", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x78ffd336737ee90709e7419db7d94e07b612e4786ecae9dbdb11ae869472cb38", + "transactionHash": "0x44a97314f77667fbda54019c500de93cd325c97344563a18cb9e90fbe9edf3bd", + "logs": [], + "blockNumber": 57535143, + "cumulativeGasUsed": "844917", + "status": 1, + "byzantium": true + }, + "args": [ + "0xB85759dd66E5554bf4Fc0e19cc71eC11e0f3FE2E" + ], + "numDeployments": 1, + "solcInputHash": "1a4b830e5ad62f2a9cc08fd32bd71f31", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ETHRegistrarController\",\"name\":\"_controller\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"names\",\"type\":\"string[]\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"lifetime\",\"type\":\"bool\"}],\"name\":\"renewAll\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"names\",\"type\":\"string[]\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"token\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"lifetime\",\"type\":\"bool\"}],\"name\":\"renewAllWithToken\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"names\",\"type\":\"string[]\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"lifetime\",\"type\":\"bool\"}],\"name\":\"rentPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"names\",\"type\":\"string[]\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"token\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"lifetime\",\"type\":\"bool\"}],\"name\":\"rentPriceToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/StaticBulkRenewal.sol\":\"StaticBulkRenewal\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\n// solhint-disable-next-line interface-starts-with-i\\ninterface AggregatorV3Interface {\\n function decimals() external view returns (uint8);\\n\\n function description() external view returns (string memory);\\n\\n function version() external view returns (uint256);\\n\\n function getRoundData(\\n uint80 _roundId\\n ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\\n\\n function latestRoundData()\\n external\\n view\\n returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\\n}\\n\",\"keccak256\":\"0x257a8d28fa83d3d942547c8e129ef465e4b5f3f31171e7be4739a4c98da6b4f0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\\n *\\n * _Available since v3.1._\\n */\\ninterface IERC1155 is IERC165 {\\n /**\\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\\n */\\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\\n\\n /**\\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\\n * transfers.\\n */\\n event TransferBatch(\\n address indexed operator,\\n address indexed from,\\n address indexed to,\\n uint256[] ids,\\n uint256[] values\\n );\\n\\n /**\\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\\n * `approved`.\\n */\\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\\n\\n /**\\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\\n *\\n * If an {URI} event was emitted for `id`, the standard\\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\\n * returned by {IERC1155MetadataURI-uri}.\\n */\\n event URI(string value, uint256 indexed id);\\n\\n /**\\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function balanceOf(address account, uint256 id) external view returns (uint256);\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\\n *\\n * Requirements:\\n *\\n * - `accounts` and `ids` must have the same length.\\n */\\n function balanceOfBatch(\\n address[] calldata accounts,\\n uint256[] calldata ids\\n ) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\\n *\\n * Emits an {ApprovalForAll} event.\\n *\\n * Requirements:\\n *\\n * - `operator` cannot be the caller.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\\n *\\n * See {setApprovalForAll}.\\n */\\n function isApprovedForAll(address account, address operator) external view returns (bool);\\n\\n /**\\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\\n *\\n * Emits a {TransferSingle} event.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\\n * acceptance magic value.\\n */\\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\\n\\n /**\\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\\n *\\n * Emits a {TransferBatch} event.\\n *\\n * Requirements:\\n *\\n * - `ids` and `amounts` must have the same length.\\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\\n * acceptance magic value.\\n */\\n function safeBatchTransferFrom(\\n address from,\\n address to,\\n uint256[] calldata ids,\\n uint256[] calldata amounts,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0xcab667ddad478ff0d39c2053ca77fac778af8483c18ab07d810277b4216fd582\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xec63854014a5b4f2b3290ab9103a21bdf902a508d0f41a8573fea49e98bf571a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n /**\\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n */\\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n /**\\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\\n }\\n\\n /**\\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\\n }\\n }\\n\\n /**\\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\\n * to be set to zero before setting it to a non-zero value, such as USDT.\\n */\\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\\n\\n if (!_callOptionalReturnBool(token, approvalCall)) {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\\n _callOptionalReturn(token, approvalCall);\\n }\\n }\\n\\n /**\\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\\n * Revert on invalid signature.\\n */\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n *\\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n */\\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return\\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\\n }\\n}\\n\",\"keccak256\":\"0xabefac93435967b4d36a4fabcbdbb918d1f0b7ae3c3d85bc30923b326c927ed1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/ERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721.sol\\\";\\nimport \\\"./IERC721Receiver.sol\\\";\\nimport \\\"./extensions/IERC721Metadata.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\nimport \\\"../../utils/Strings.sol\\\";\\nimport \\\"../../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\n * {ERC721Enumerable}.\\n */\\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\\n using Address for address;\\n using Strings for uint256;\\n\\n // Token name\\n string private _name;\\n\\n // Token symbol\\n string private _symbol;\\n\\n // Mapping from token ID to owner address\\n mapping(uint256 => address) private _owners;\\n\\n // Mapping owner address to token count\\n mapping(address => uint256) private _balances;\\n\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) private _tokenApprovals;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\\n return\\n interfaceId == type(IERC721).interfaceId ||\\n interfaceId == type(IERC721Metadata).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721-balanceOf}.\\n */\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\n return _balances[owner];\\n }\\n\\n /**\\n * @dev See {IERC721-ownerOf}.\\n */\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\n address owner = _ownerOf(tokenId);\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n _requireMinted(tokenId);\\n\\n string memory baseURI = _baseURI();\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\n }\\n\\n /**\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\n * by default, can be overridden in child contracts.\\n */\\n function _baseURI() internal view virtual returns (string memory) {\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual override {\\n address owner = ERC721.ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\n _requireMinted(tokenId);\\n\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC721-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC721-isApprovedForAll}.\\n */\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[owner][operator];\\n }\\n\\n /**\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n _safeTransfer(from, to, tokenId, data);\\n }\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\n *\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\\n _transfer(from, to, tokenId);\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n }\\n\\n /**\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\n }\\n\\n /**\\n * @dev Returns whether `tokenId` exists.\\n *\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\n *\\n * Tokens start existing when they are minted (`_mint`),\\n * and stop existing when they are burned (`_burn`).\\n */\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\n return _ownerOf(tokenId) != address(0);\\n }\\n\\n /**\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\n address owner = ERC721.ownerOf(tokenId);\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\n }\\n\\n /**\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\n _safeMint(to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\n */\\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\\n _mint(to, tokenId);\\n require(\\n _checkOnERC721Received(address(0), to, tokenId, data),\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\n );\\n }\\n\\n /**\\n * @dev Mints `tokenId` and transfers it to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - `to` cannot be the zero address.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _mint(address to, uint256 tokenId) internal virtual {\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n _beforeTokenTransfer(address(0), to, tokenId, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _burn(uint256 tokenId) internal virtual {\\n address owner = ERC721.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\n }\\n\\n /**\\n * @dev Transfers `tokenId` from `from` to `to`.\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, tokenId, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Reverts if the `tokenId` has not been minted yet.\\n */\\n function _requireMinted(uint256 tokenId) internal view virtual {\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\n }\\n\\n /**\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\n * The call is not executed if the target address is not a contract.\\n *\\n * @param from address representing the previous owner of the given token ID\\n * @param to target address that will receive the tokens\\n * @param tokenId uint256 ID of the token to be transferred\\n * @param data bytes optional data to send along with the call\\n * @return bool whether the call correctly returned the expected magic value\\n */\\n function _checkOnERC721Received(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) private returns (bool) {\\n if (to.isContract()) {\\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721Receiver.onERC721Received.selector;\\n } catch (bytes memory reason) {\\n if (reason.length == 0) {\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n } else {\\n /// @solidity memory-safe-assembly\\n assembly {\\n revert(add(32, reason), mload(reason))\\n }\\n }\\n }\\n } else {\\n return true;\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\n }\\n}\\n\",\"keccak256\":\"0x2c309e7df9e05e6ce15bedfe74f3c61b467fc37e0fae9eab496acf5ea0bbd7ff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721Metadata is IERC721 {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/ethregistrar/BaseRegistrarImplementation.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/ERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\\n // A map of expiry times\\n mapping(uint256 => uint256) expiries;\\n // The ENS registry\\n ENS public ens;\\n // The namehash of the TLD this registrar owns (eg, .eth)\\n bytes32 public baseNode;\\n // A map of addresses that are authorised to register and renew names.\\n mapping(address => bool) public controllers;\\n uint256 public constant GRACE_PERIOD = 30 days;\\n uint256 public constant LIFETIME = type(uint256).max;\\n bytes4 private constant INTERFACE_META_ID =\\n bytes4(keccak256(\\\"supportsInterface(bytes4)\\\"));\\n bytes4 private constant ERC721_ID =\\n bytes4(\\n keccak256(\\\"balanceOf(address)\\\") ^\\n keccak256(\\\"ownerOf(uint256)\\\") ^\\n keccak256(\\\"approve(address,uint256)\\\") ^\\n keccak256(\\\"getApproved(uint256)\\\") ^\\n keccak256(\\\"setApprovalForAll(address,bool)\\\") ^\\n keccak256(\\\"isApprovedForAll(address,address)\\\") ^\\n keccak256(\\\"transferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256)\\\") ^\\n keccak256(\\\"safeTransferFrom(address,address,uint256,bytes)\\\")\\n );\\n bytes4 private constant RECLAIM_ID =\\n bytes4(keccak256(\\\"reclaim(uint256,address)\\\"));\\n\\n /// v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\\n /// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\\n /// @dev Returns whether the given spender can transfer a given token ID\\n /// @param spender address of the spender to query\\n /// @param tokenId uint256 ID of the token to be transferred\\n /// @return bool whether the msg.sender is approved for the given token ID,\\n /// is an operator of the owner, or is the owner of the token\\n function _isApprovedOrOwner(\\n address spender,\\n uint256 tokenId\\n ) internal view override returns (bool) {\\n address owner = ownerOf(tokenId);\\n return (spender == owner ||\\n getApproved(tokenId) == spender ||\\n isApprovedForAll(owner, spender));\\n }\\n\\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\\\"\\\", \\\"\\\") {\\n ens = _ens;\\n baseNode = _baseNode;\\n Ownable(msg.sender);\\n }\\n\\n modifier live() {\\n require(ens.owner(baseNode) == address(this));\\n _;\\n }\\n\\n modifier onlyController() {\\n require(controllers[msg.sender]);\\n _;\\n }\\n\\n /// @dev Gets the owner of the specified token ID. Names become unowned\\n /// when their registration expires.\\n /// @param tokenId uint256 ID of the token to query the owner of\\n /// @return address currently marked as the owner of the given token ID\\n function ownerOf(\\n uint256 tokenId\\n ) public view override(IERC721, ERC721) returns (address) {\\n require(expiries[tokenId] > block.timestamp);\\n return super.ownerOf(tokenId);\\n }\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external override onlyOwner {\\n controllers[controller] = true;\\n emit ControllerAdded(controller);\\n }\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external override onlyOwner {\\n controllers[controller] = false;\\n emit ControllerRemoved(controller);\\n }\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external override onlyOwner {\\n ens.setResolver(baseNode, resolver);\\n }\\n\\n // Returns the expiration timestamp of the specified id.\\n function nameExpires(uint256 id) external view override returns (uint256) {\\n return expiries[id];\\n }\\n\\n // Returns true iff the specified name is available for registration.\\n function available(uint256 id) public view override returns (bool) {\\n // Not available if it's registered here or in its grace period.\\n return expiries[id] + GRACE_PERIOD < block.timestamp;\\n }\\n\\n /// @dev Register a name.\\n /// @param id The token ID (keccak256 of the label).\\n /// @param owner The address that should own the registration.\\n /// @param duration Duration in seconds for the registration.\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external override virtual returns (uint256) {\\n return _register(id, owner, duration, true);\\n }\\n\\n /// @dev Register a name, without modifying the registry.\\n /// @param id The token ID (keccak256 of the label).\\n /// @param owner The address that should own the registration.\\n /// @param duration Duration in seconds for the registration.\\n function registerOnly(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256) {\\n return _register(id, owner, duration, false);\\n }\\n\\n function _register(\\n uint256 id,\\n address owner,\\n uint256 duration,\\n bool updateRegistry\\n ) internal live onlyController returns (uint256) {\\n require(available(id));\\n require(\\n block.timestamp + duration + GRACE_PERIOD >\\n block.timestamp + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n\\n uint256 expiration;\\n\\n if (duration == 31536000000) {\\n // Lifetime registration\\n expiration = LIFETIME;\\n } else {\\n // Annual registration\\n expiration = block.timestamp + duration;\\n }\\n\\n expiries[id] = expiration;\\n if (_exists(id)) {\\n // Name was previously owned, and expired\\n _burn(id);\\n }\\n _mint(owner, id);\\n if (updateRegistry) {\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n emit NameRegistered(id, owner, expiration);\\n\\n return expiration;\\n }\\n\\n function renew(\\n uint256 id,\\n uint256 duration\\n ) external override virtual live onlyController returns (uint256) {\\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\\n require(expiries[id] != LIFETIME, \\\"Lifetime names cannot be renewed\\\");\\n require(\\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\\n ); // Prevent future overflow\\n\\n expiries[id] += duration;\\n emit NameRenewed(id, expiries[id]);\\n return expiries[id];\\n }\\n\\n /// @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n function reclaim(uint256 id, address owner) external override live {\\n require(_isApprovedOrOwner(msg.sender, id));\\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view override(ERC721, IERC165) returns (bool) {\\n return\\n interfaceID == INTERFACE_META_ID ||\\n interfaceID == ERC721_ID ||\\n interfaceID == RECLAIM_ID;\\n }\\n\\n function _exists(uint256 tokenId) internal view override returns (bool) {\\n return super._exists(tokenId);\\n }\\n\\n}\\n\",\"keccak256\":\"0x0fbe9558e5bde9149cb2217db09eba430e9c6bdca70d72576a73d3a75886dd65\"},\"contracts/ethregistrar/ETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport {BaseRegistrarImplementation} from \\\"./BaseRegistrarImplementation.sol\\\";\\nimport {StringUtils} from \\\"../utils/StringUtils.sol\\\";\\nimport {Resolver} from \\\"../resolvers/Resolver.sol\\\";\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {ReverseRegistrar} from \\\"../reverseRegistrar/ReverseRegistrar.sol\\\";\\nimport {ReverseClaimer} from \\\"../reverseRegistrar/ReverseClaimer.sol\\\";\\nimport {IETHRegistrarController, IPriceOracle} from \\\"./IETHRegistrarController.sol\\\";\\n\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport {IERC165} from \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {INameWrapper} from \\\"../wrapper/INameWrapper.sol\\\";\\nimport {ERC20Recoverable} from \\\"../utils/ERC20Recoverable.sol\\\";\\nimport {TokenPriceOracle} from \\\"./TokenPriceOracle.sol\\\";\\nimport {SafeERC20} from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nusing SafeERC20 for IERC20;\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {ReferralController} from \\\"./ReferralController.sol\\\";\\n\\nerror CommitmentTooNew(bytes32 commitment);\\nerror CommitmentTooOld(bytes32 commitment);\\nerror NameNotAvailable(string name);\\nerror DurationTooShort(uint256 duration);\\nerror ResolverRequiredWhenDataSupplied();\\nerror UnexpiredCommitmentExists(bytes32 commitment);\\nerror InsufficientValue();\\nerror Unauthorised(bytes32 node);\\nerror MaxCommitmentAgeTooLow();\\nerror MaxCommitmentAgeTooHigh();\\n\\n/// @dev A registrar controller for registering and renewing names at fixed cost.\\ncontract ETHRegistrarController is\\n Ownable,\\n IETHRegistrarController,\\n IERC165,\\n ERC20Recoverable,\\n ReverseClaimer\\n{\\n using StringUtils for *;\\n using Address for address;\\n\\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\\n bytes32 private constant ETH_NODE =\\n 0x4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454;\\n uint64 private constant MAX_EXPIRY = type(uint64).max;\\n BaseRegistrarImplementation immutable base;\\n TokenPriceOracle public immutable prices;\\n uint256 public immutable minCommitmentAge;\\n uint256 public immutable maxCommitmentAge;\\n ReverseRegistrar public immutable reverseRegistrar;\\n INameWrapper public immutable nameWrapper;\\n ReferralController public immutable referralController;\\n address public infoFi;\\n mapping(bytes32 => uint256) public commitments;\\n address public backendWallet;\\n uint256 public untrackedInfoFi;\\n mapping(address => bool) public verifiedTokens;\\n\\n event NameRegistered(\\n string name,\\n bytes32 indexed label,\\n address indexed owner,\\n uint256 baseCost,\\n uint256 premium,\\n uint256 expires\\n );\\n event NameRenewed(\\n string name,\\n bytes32 indexed label,\\n uint256 cost,\\n uint256 expires\\n );\\n\\n modifier onlyBackend() {\\n require(msg.sender == backendWallet, \\\"Not Backend\\\");\\n _;\\n }\\n\\n constructor(\\n BaseRegistrarImplementation _base,\\n TokenPriceOracle _prices,\\n uint256 _minCommitmentAge,\\n uint256 _maxCommitmentAge,\\n ReverseRegistrar _reverseRegistrar,\\n INameWrapper _nameWrapper,\\n ENS _ens,\\n address _infoFi,\\n ReferralController _referralController\\n ) ReverseClaimer(_ens, msg.sender) {\\n if (_maxCommitmentAge <= _minCommitmentAge) {\\n revert MaxCommitmentAgeTooLow();\\n }\\n\\n if (_maxCommitmentAge > block.timestamp) {\\n revert MaxCommitmentAgeTooHigh();\\n }\\n\\n base = _base;\\n prices = _prices;\\n minCommitmentAge = _minCommitmentAge;\\n maxCommitmentAge = _maxCommitmentAge;\\n reverseRegistrar = _reverseRegistrar;\\n nameWrapper = _nameWrapper;\\n infoFi = _infoFi;\\n referralController = _referralController;\\n }\\n\\n function setBackend(address wallet) public onlyOwner {\\n backendWallet = wallet;\\n }\\n\\n function setToken(address tokenAddress) public onlyOwner {\\n verifiedTokens[tokenAddress] = true;\\n }\\n\\n function rentPrice(\\n string memory name,\\n uint256 duration,\\n bool lifetime\\n ) public view virtual override returns (IPriceOracle.Price memory price) {\\n require(\\n duration == 0 || duration >= MIN_REGISTRATION_DURATION,\\n \\\"Invalid duration\\\"\\n );\\n bytes32 label = keccak256(bytes(name));\\n price = prices.price(\\n name,\\n base.nameExpires(uint256(label)),\\n duration,\\n lifetime\\n );\\n }\\n\\n function rentPriceToken(\\n string memory name,\\n uint256 duration,\\n string memory token,\\n bool lifetime\\n ) public view virtual override returns (IPriceOracle.Price memory price) {\\n require(\\n duration == 0 || duration >= MIN_REGISTRATION_DURATION,\\n \\\"Invalid duration\\\"\\n );\\n bytes32 label = keccak256(bytes(name));\\n price = prices.priceToken(\\n name,\\n base.nameExpires(uint256(label)),\\n duration,\\n token,\\n lifetime\\n );\\n }\\n\\n function valid(string memory name) public pure returns (bool) {\\n return name.strlen() >= 2;\\n }\\n\\n function available(string memory name) public view override returns (bool) {\\n bytes32 label = keccak256(bytes(name));\\n return valid(name) && base.available(uint256(label));\\n }\\n\\n function makeCommitment(\\n string memory name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] memory data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses,\\n bool lifetime\\n ) public pure override returns (bytes32) {\\n bytes32 label = keccak256(bytes(name));\\n if (data.length > 0 && resolver == address(0)) {\\n revert ResolverRequiredWhenDataSupplied();\\n }\\n return\\n keccak256(\\n abi.encode(\\n label,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses,\\n lifetime\\n )\\n );\\n }\\n\\n function commit(bytes32 commitment) public override {\\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\\n revert UnexpiredCommitmentExists(commitment);\\n }\\n commitments[commitment] = block.timestamp;\\n }\\n\\n function register(\\n string memory name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] memory data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses,\\n bool lifetime,\\n string memory referree\\n ) public payable override {\\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\\n if (msg.value < price.base + price.premium) {\\n revert InsufficientValue();\\n }\\n\\n _consumeCommitment(\\n name,\\n duration,\\n makeCommitment(\\n name,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses,\\n lifetime\\n )\\n );\\n\\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\\n name,\\n owner,\\n duration,\\n resolver,\\n ownerControlledFuses\\n );\\n\\n if (data.length > 0) {\\n _setRecords(resolver, keccak256(bytes(name)), data);\\n }\\n\\n if (reverseRecord) {\\n _setReverseRecord(name, resolver, msg.sender);\\n referralController.setReferree(\\n keccak256(bytes(name)),\\n owner,\\n expires\\n );\\n }\\n\\n emit NameRegistered(\\n name,\\n keccak256(bytes(name)),\\n owner,\\n price.base,\\n price.premium,\\n expires\\n );\\n if (msg.value > (price.base + price.premium)) {\\n payable(msg.sender).transfer(\\n msg.value - (price.base + price.premium)\\n );\\n }\\n _referralPayout(price, referree, name, owner);\\n }\\n\\n function registerWithCard(\\n string memory name,\\n address owner,\\n uint256 duration,\\n bytes32 secret,\\n address resolver,\\n bytes[] memory data,\\n bool reverseRecord,\\n uint16 ownerControlledFuses,\\n bool lifetime,\\n string memory referree\\n ) public onlyBackend {\\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\\n\\n _consumeCommitment(\\n name,\\n duration,\\n makeCommitment(\\n name,\\n owner,\\n duration,\\n secret,\\n resolver,\\n data,\\n reverseRecord,\\n ownerControlledFuses,\\n lifetime\\n )\\n );\\n\\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\\n name,\\n owner,\\n duration,\\n resolver,\\n ownerControlledFuses\\n );\\n\\n if (data.length > 0) {\\n _setRecords(resolver, keccak256(bytes(name)), data);\\n }\\n\\n if (reverseRecord) {\\n _setReverseRecord(name, resolver, owner);\\n referralController.setReferree(\\n keccak256(bytes(name)),\\n owner,\\n duration\\n );\\n }\\n\\n emit NameRegistered(\\n name,\\n keccak256(bytes(name)),\\n owner,\\n price.base,\\n price.premium,\\n expires\\n );\\n address receiver = referralController.referrees(\\n keccak256(bytes(referree))\\n );\\n if (keccak256(bytes(referree)) != keccak256(bytes(\\\"\\\"))) {\\n referralController.settlementRegisterWithCard(\\n referree,\\n name,\\n owner,\\n price.base + price.premium,\\n receiver\\n );\\n }\\n untrackedInfoFi += (((price.base + price.premium) * 35) / 100);\\n }\\n\\n function resetInfoFi() external payable onlyOwner {\\n require(msg.value > 0, \\\"Must send value to reset infoFi\\\");\\n (bool ok, ) = payable(infoFi).call{value: msg.value}(\\\"\\\");\\n require(ok, \\\"Payment to infoFi failed\\\");\\n untrackedInfoFi = 0;\\n }\\n\\n function _tokenTransfer(\\n address tokenAddress,\\n IPriceOracle.Price memory price\\n ) internal {\\n \\n IERC20(tokenAddress).safeTransferFrom(\\n msg.sender,\\n address(this),\\n price.base + price.premium\\n );\\n }\\n\\n function _internalRecordsCall(\\n string memory name,\\n bytes[] memory data,\\n address owner,\\n address resolver,\\n bool reverseRecord,\\n uint256 duration\\n ) internal {\\n if (data.length > 0) {\\n _setRecords(resolver, keccak256(bytes(name)), data);\\n }\\n\\n if (reverseRecord) {\\n _setReverseRecord(name, resolver, msg.sender);\\n referralController.setReferree(\\n keccak256(bytes(name)),\\n owner,\\n duration\\n );\\n }\\n }\\n\\n function registerWithToken(\\n RegisterParams memory registerParams,\\n TokenParams memory tokenParams,\\n bool lifetime,\\n string memory referree\\n ) external override {\\n require(\\n verifiedTokens[tokenParams.tokenAddress] == true,\\n \\\"Unnacepted Token Address\\\"\\n );\\n _consumeCommitment(\\n registerParams.name,\\n registerParams.duration,\\n makeCommitment(\\n registerParams.name,\\n registerParams.owner,\\n registerParams.duration,\\n registerParams.secret,\\n registerParams.resolver,\\n registerParams.data,\\n registerParams.reverseRecord,\\n registerParams.ownerControlledFuses,\\n lifetime\\n )\\n );\\n\\n IPriceOracle.Price memory price = rentPriceToken(\\n registerParams.name,\\n registerParams.duration,\\n tokenParams.token,\\n lifetime\\n );\\n if (\\n IERC20(tokenParams.tokenAddress).balanceOf(msg.sender) <\\n price.base + price.premium\\n ) {\\n revert InsufficientValue();\\n }\\n\\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\\n registerParams.name,\\n registerParams.owner,\\n registerParams.duration,\\n registerParams.resolver,\\n registerParams.ownerControlledFuses\\n );\\n\\n _internalRecordsCall(\\n registerParams.name,\\n registerParams.data,\\n registerParams.owner,\\n registerParams.resolver,\\n registerParams.reverseRecord,\\n expires\\n );\\n _tokenTransfer(tokenParams.tokenAddress, price);\\n\\n emit NameRegistered(\\n registerParams.name,\\n keccak256(bytes(registerParams.name)),\\n registerParams.owner,\\n price.base,\\n price.premium,\\n expires\\n );\\n address receiver = referralController.referrees(\\n keccak256(bytes(referree))\\n );\\n\\n uint256 referrals = referralController.totalReferrals(receiver);\\n if (keccak256(bytes(referree)) != keccak256(bytes(\\\"\\\"))) {\\n uint256 pct = referralController._rewardPct(referrals);\\n\\n IERC20(tokenParams.tokenAddress).safeTransfer(\\n address(referralController),\\n ((price.base + price.premium) * pct) / 100\\n );\\n referralController.settlementRegisterWithToken(\\n referree,\\n registerParams.name,\\n registerParams.owner,\\n price.base + price.premium,\\n tokenParams.tokenAddress\\n );\\n }\\n IERC20(tokenParams.tokenAddress).safeTransfer(\\n infoFi,\\n ((price.base + price.premium) * 35) / 100\\n );\\n }\\n\\n function renewCard(\\n string calldata name,\\n uint256 duration,\\n bool lifetime\\n ) external onlyBackend {\\n bytes32 labelhash = keccak256(bytes(name));\\n uint256 tokenId = uint256(labelhash);\\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\\n string memory referree = referralController.referredBy(labelhash);\\n\\n uint256 expires = nameWrapper.renew(tokenId, duration);\\n referralController.updateReferralCode(keccak256(bytes(name)), expires);\\n\\n emit NameRenewed(name, labelhash, price.base, expires);\\n if (\\n referralController.referrees(keccak256(bytes(referree))) !=\\n address(0)\\n ) {\\n address receiver = referralController.referrees(\\n keccak256(bytes(referree))\\n );\\n referralController.settlementCard(\\n price.base + price.premium,\\n receiver,\\n referree\\n );\\n }\\n untrackedInfoFi += ((price.base + price.premium) * 35) / 100;\\n }\\n\\n function renew(\\n string calldata name,\\n uint256 duration,\\n bool lifetime\\n ) external payable {\\n bytes32 labelhash = keccak256(bytes(name));\\n uint256 tokenId = uint256(labelhash);\\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\\n string memory referree = referralController.referredBy(labelhash);\\n if (msg.value < price.base) {\\n revert InsufficientValue();\\n }\\n uint256 expires = nameWrapper.renew(tokenId, duration);\\n referralController.updateReferralCode(keccak256(bytes(name)), expires);\\n\\n if (msg.value > price.base) {\\n payable(msg.sender).transfer(msg.value - price.base);\\n }\\n emit NameRenewed(name, labelhash, msg.value, expires);\\n if (\\n referralController.referrees(keccak256(bytes(referree))) !=\\n address(0)\\n ) {\\n address receiver = referralController.referrees(\\n keccak256(bytes(referree))\\n );\\n referralController.settlement(\\n price.base + price.premium,\\n receiver,\\n referree\\n );\\n }\\n (bool ok, ) = payable(infoFi).call{\\n value: ((price.base + price.premium) * 35) / 100\\n }(\\\"\\\");\\n require(ok, \\\"Payment to infoFi failed\\\");\\n }\\n\\n function renewTokens(\\n string calldata name,\\n uint256 duration,\\n string memory token,\\n address tokenAddress,\\n bool lifetime\\n ) external override {\\n require(\\n verifiedTokens[tokenAddress] == true,\\n \\\"Unnacepted Token Address\\\"\\n );\\n bytes32 labelhash = keccak256(bytes(name));\\n uint256 tokenId = uint256(labelhash);\\n string memory referree = referralController.referredBy(labelhash);\\n IPriceOracle.Price memory price = rentPriceToken(\\n name,\\n duration,\\n token,\\n lifetime\\n );\\n if (\\n IERC20(tokenAddress).balanceOf(msg.sender) <\\n price.base + price.premium\\n ) {\\n revert InsufficientValue();\\n }\\n IERC20(tokenAddress).safeTransferFrom(\\n msg.sender,\\n address(this),\\n price.base + price.premium\\n );\\n uint256 expires = nameWrapper.renew(tokenId, duration);\\n referralController.updateReferralCode(keccak256(bytes(name)), expires);\\n\\n emit NameRenewed(name, labelhash, price.base + price.premium, expires);\\n\\n if (\\n referralController.referrees(keccak256(bytes(referree))) !=\\n address(0)\\n ) {\\n address receiver = referralController.referrees(\\n keccak256(bytes(referree))\\n );\\n uint256 referrals = referralController.totalReferrals(receiver);\\n uint256 pct = referralController._rewardPct(referrals);\\n\\n IERC20(tokenAddress).safeTransferFrom(\\n address(this),\\n address(referralController),\\n ((price.base + price.premium) * pct) / 100\\n );\\n referralController.settlementWithToken(\\n price.base + price.premium,\\n receiver,\\n tokenAddress,\\n referree\\n );\\n }\\n IERC20(tokenAddress).safeTransferFrom(\\n address(this),\\n infoFi,\\n ((price.base + price.premium) * 35) / 100\\n );\\n }\\n\\n function withdraw() public {\\n payable(owner()).transfer(address(this).balance);\\n }\\n\\n function withdrawTokens(address tokenAddress) public {\\n IERC20(tokenAddress).safeTransfer(\\n owner(),\\n IERC20(tokenAddress).balanceOf(address(this))\\n );\\n }\\n\\n function _referralPayout(\\n IPriceOracle.Price memory price,\\n string memory referree,\\n string memory name,\\n address owner\\n ) internal {\\n address receiver = referralController.referrees(\\n keccak256(bytes(referree))\\n );\\n uint256 referrals = referralController.totalReferrals(receiver);\\n if (keccak256(bytes(referree)) != keccak256(bytes(\\\"\\\"))) {\\n uint256 pct = referralController._rewardPct(referrals);\\n referralController.settlementRegister{\\n value: (((price.base + price.premium) * pct) / 100)\\n }(referree, name, owner, price.base + price.premium, receiver);\\n }\\n (bool ok, ) = payable(infoFi).call{\\n value: ((price.base + price.premium) * 35) / 100\\n }(\\\"\\\");\\n require(ok, \\\"Payment to infoFi failed\\\");\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IETHRegistrarController).interfaceId;\\n }\\n\\n /* Internal functions */\\n\\n function _consumeCommitment(\\n string memory name,\\n uint256 duration,\\n bytes32 commitment\\n ) internal {\\n // Require an old enough commitment.\\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\\n revert CommitmentTooNew(commitment);\\n }\\n\\n // If the commitment is too old, or the name is registered, stop\\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\\n revert CommitmentTooOld(commitment);\\n }\\n if (!available(name)) {\\n revert NameNotAvailable(name);\\n }\\n\\n delete (commitments[commitment]);\\n\\n if (duration != 0 && duration < MIN_REGISTRATION_DURATION) {\\n revert DurationTooShort(duration);\\n }\\n }\\n\\n function _setRecords(\\n address resolverAddress,\\n bytes32 label,\\n bytes[] memory data\\n ) internal {\\n // use hardcoded .eth namehash\\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\\n Resolver resolver = Resolver(resolverAddress);\\n resolver.multicallWithNodeCheck(nodehash, data);\\n }\\n\\n function _setReverseRecord(\\n string memory name,\\n address resolver,\\n address owner\\n ) internal {\\n reverseRegistrar.setNameForAddr(\\n msg.sender,\\n owner,\\n resolver,\\n string.concat(name, \\\".creator\\\")\\n );\\n }\\n}\\n\",\"keccak256\":\"0x42024e6b4ded5b90754373178b97de644e2bf8f11afec1e96fc899d3e094881e\",\"license\":\"MIT\"},\"contracts/ethregistrar/ExponentialPremiumPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./StablePriceOracle.sol\\\";\\n\\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\\n uint256 constant GRACE_PERIOD = 90 days;\\n uint256 immutable startPremium;\\n uint256 immutable endValue;\\n\\n constructor(\\n AggregatorV3Interface _usdOracle,\\n uint256[] memory _rentPrices,\\n uint256 _startPremium,\\n uint256 totalDays\\n ) StablePriceOracle(_usdOracle, _rentPrices) {\\n startPremium = _startPremium;\\n endValue = _startPremium >> totalDays;\\n }\\n\\n uint256 constant PRECISION = 1e18;\\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\\n uint256 constant bit3 = 999957694548431104;\\n uint256 constant bit4 = 999915390886613504;\\n uint256 constant bit5 = 999830788931929088;\\n uint256 constant bit6 = 999661606496243712;\\n uint256 constant bit7 = 999323327502650752;\\n uint256 constant bit8 = 998647112890970240;\\n uint256 constant bit9 = 997296056085470080;\\n uint256 constant bit10 = 994599423483633152;\\n uint256 constant bit11 = 989228013193975424;\\n uint256 constant bit12 = 978572062087700096;\\n uint256 constant bit13 = 957603280698573696;\\n uint256 constant bit14 = 917004043204671232;\\n uint256 constant bit15 = 840896415253714560;\\n uint256 constant bit16 = 707106781186547584;\\n\\n /**\\n * @dev Returns the pricing premium in internal base units.\\n */\\n function _premium(\\n string memory,\\n uint256 expires,\\n uint256\\n ) internal view override returns (uint256) {\\n expires = expires + GRACE_PERIOD;\\n if (expires > block.timestamp) {\\n return 0;\\n }\\n\\n uint256 elapsed = block.timestamp - expires;\\n uint256 premium = decayedPremium(startPremium, elapsed);\\n if (premium >= endValue) {\\n return premium - endValue;\\n }\\n return 0;\\n }\\n\\n /**\\n * @dev Returns the premium price at current time elapsed\\n * @param startPremium starting price\\n * @param elapsed time past since expiry\\n */\\n function decayedPremium(\\n uint256 startPremium,\\n uint256 elapsed\\n ) public pure returns (uint256) {\\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\\n uint256 intDays = daysPast / PRECISION;\\n uint256 premium = startPremium >> intDays;\\n uint256 partDay = (daysPast - intDays * PRECISION);\\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\\n uint256 totalPremium = addFractionalPremium(fraction, premium);\\n return totalPremium;\\n }\\n\\n function addFractionalPremium(\\n uint256 fraction,\\n uint256 premium\\n ) internal pure returns (uint256) {\\n if (fraction & (1 << 0) != 0) {\\n premium = (premium * bit1) / PRECISION;\\n }\\n if (fraction & (1 << 1) != 0) {\\n premium = (premium * bit2) / PRECISION;\\n }\\n if (fraction & (1 << 2) != 0) {\\n premium = (premium * bit3) / PRECISION;\\n }\\n if (fraction & (1 << 3) != 0) {\\n premium = (premium * bit4) / PRECISION;\\n }\\n if (fraction & (1 << 4) != 0) {\\n premium = (premium * bit5) / PRECISION;\\n }\\n if (fraction & (1 << 5) != 0) {\\n premium = (premium * bit6) / PRECISION;\\n }\\n if (fraction & (1 << 6) != 0) {\\n premium = (premium * bit7) / PRECISION;\\n }\\n if (fraction & (1 << 7) != 0) {\\n premium = (premium * bit8) / PRECISION;\\n }\\n if (fraction & (1 << 8) != 0) {\\n premium = (premium * bit9) / PRECISION;\\n }\\n if (fraction & (1 << 9) != 0) {\\n premium = (premium * bit10) / PRECISION;\\n }\\n if (fraction & (1 << 10) != 0) {\\n premium = (premium * bit11) / PRECISION;\\n }\\n if (fraction & (1 << 11) != 0) {\\n premium = (premium * bit12) / PRECISION;\\n }\\n if (fraction & (1 << 12) != 0) {\\n premium = (premium * bit13) / PRECISION;\\n }\\n if (fraction & (1 << 13) != 0) {\\n premium = (premium * bit14) / PRECISION;\\n }\\n if (fraction & (1 << 14) != 0) {\\n premium = (premium * bit15) / PRECISION;\\n }\\n if (fraction & (1 << 15) != 0) {\\n premium = (premium * bit16) / PRECISION;\\n }\\n return premium;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xb1216535d04a6cb36d4a184c69755eb64a9e9890c94e83d4407a8f631ae6bfb5\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/ethregistrar/IBulkRenewal.sol\":{\"content\":\"interface IBulkRenewal {\\n function rentPrice(\\n string[] calldata names,\\n uint256 duration,\\n bool lifetime\\n ) external view returns (uint256 total);\\n\\n function renewAll(\\n string[] calldata names,\\n uint256 duration,\\n bool lifetime\\n ) external payable;\\n}\\n\",\"keccak256\":\"0x92eb9f9c90384fc7874cc66b15eb1c5526c2642754d1a1637aeefebc195cc11d\"},\"contracts/ethregistrar/IETHRegistrarController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./IPriceOracle.sol\\\";\\n\\ninterface IETHRegistrarController {\\n\\n struct TokenParams{\\n string token;\\n address tokenAddress;\\n }\\n struct RegisterParams {\\n string name;\\n address owner;\\n uint256 duration;\\n bytes32 secret;\\n address resolver;\\n bytes[] data;\\n bool reverseRecord;\\n uint16 ownerControlledFuses;\\n }\\n function rentPrice(\\n string memory,\\n uint256,\\n bool\\n ) external view returns (IPriceOracle.Price memory);\\n\\n function rentPriceToken(\\n string memory name,\\n uint256 duration,\\n string memory token,\\n bool lifetime\\n ) external view returns (IPriceOracle.Price memory price);\\n\\n function available(string memory) external returns (bool);\\n\\n function makeCommitment(\\n string memory,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16,\\n bool\\n ) external pure returns (bytes32);\\n\\n function commit(bytes32) external;\\n\\n function register(\\n string memory,\\n address,\\n uint256,\\n bytes32,\\n address,\\n bytes[] calldata,\\n bool,\\n uint16,\\n bool,\\n string memory\\n ) external payable;\\n\\n function registerWithToken(\\n RegisterParams memory registerParams,\\n TokenParams memory tokenParams,\\n bool lifetime,\\n string memory referree\\n ) external;\\n\\n function renew(string calldata, uint256, bool) external payable;\\n\\n function renewTokens(\\n string calldata name,\\n uint256 duration,\\n string memory token,\\n address tokenAddress,\\n bool lifetime\\n ) external;\\n}\\n\",\"keccak256\":\"0x5b063364fa339be07758117e6e53fb7991653c99bfdab24ba200ec805b655190\",\"license\":\"MIT\"},\"contracts/ethregistrar/IPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\ninterface IPriceOracle {\\n struct Price {\\n uint256 base;\\n uint256 premium;\\n }\\n\\n /**\\n * @dev Returns the price to register or renew a name.\\n * @param name The name being registered or renewed.\\n * @param expires When the name presently expires (0 if this is a new registration).\\n * @param duration How long the name is being registered or extended for, in seconds.\\n * @return base premium tuple of base price + premium price\\n */\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration,\\n bool lifetime\\n ) external view returns (Price calldata);\\n}\\n\",\"keccak256\":\"0xc1f749d6238b0e77cc804153b2ce8fc2e082d28129e734839ccc2b2be7ee9d2b\",\"license\":\"MIT\"},\"contracts/ethregistrar/ReferralController.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\nimport {IPriceOracle} from \\\"./IETHRegistrarController.sol\\\";\\nimport {SafeERC20} from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nusing SafeERC20 for IERC20;\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract ReferralController is Ownable {\\n // Mapping from referral code to referrer address\\n uint16 private constant TIER1 = 2;\\n uint16 private constant TIER2 = 15;\\n uint16 private constant TIER3 = 20;\\n uint256 private constant PCT1 = 15;\\n uint256 private constant PCT2 = 20;\\n uint256 private constant PCT3 = 25;\\n mapping(address => bool) public controllers;\\n mapping(bytes32 => uint256) public commitments;\\n mapping(bytes32 => address) public referrees;\\n mapping(bytes32 => uint256) public expirydates;\\n mapping(address => bytes32[]) public referrals;\\n mapping(bytes32 => string) public referredBy;\\n mapping(address => uint256) public nativeEarnings;\\n mapping(address => mapping(address => uint256)) public tokenEarnings;\\n\\n bytes32[] public referralCodes;\\n uint256 public untrackedEarnings;\\n uint256 public snapshotUntrackedEarnings;\\n mapping(address => uint256) public snapshotNativeEarnings;\\n mapping(address => mapping(address => uint256))\\n public snapshotTokenEarnings;\\n uint256 public trackedNativeEarnings;\\n mapping(address => uint256) public trackedTokenEarnings;\\n\\n event ReferralCodeAdded(string indexed code, address indexed referrer);\\n event WithdrawalDispersed(address indexed);\\n modifier onlyControllerOrOwner() {\\n require(\\n controllers[msg.sender] || msg.sender == owner(),\\n \\\"Not a controller or owner\\\"\\n );\\n _;\\n }\\n\\n function addController(address controller) external onlyOwner {\\n require(controller != address(0), \\\"Invalid controller address\\\");\\n controllers[controller] = true;\\n }\\n\\n function settlementRegister(\\n string memory referree,\\n string memory name,\\n address owner,\\n uint256 amount,\\n address receiver\\n ) external payable onlyControllerOrOwner {\\n // If the referree is already registered, we can use it\\n\\n require(\\n receiver != address(0) && receiver != owner,\\n \\\"Invalid receiver address\\\"\\n );\\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\\n bool contains;\\n for (uint256 i = 0; i < referrals[receiver].length; i++) {\\n if (referrals[receiver][i] == keccak256(bytes(name))) {\\n contains = true;\\n break;\\n }\\n }\\n if (contains == false) {\\n referrals[receiver].push(keccak256(bytes(name)));\\n referredBy[keccak256(bytes(name))] = referree;\\n _applyNativeReward(receiver, amount, false);\\n } else {\\n _applyNativeReward(receiver, amount, false);\\n }\\n } else {\\n payable(Ownable.owner()).transfer(amount);\\n }\\n }\\n\\n function settlementRegisterWithCard(\\n string memory referree,\\n string memory name,\\n address owner,\\n uint256 amount,\\n address receiver\\n ) external onlyControllerOrOwner {\\n // If the referree is already registered, we can use it\\n require(\\n receiver != address(0) && receiver != owner,\\n \\\"Invalid receiver address\\\"\\n );\\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\\n bool contains;\\n for (uint256 i = 0; i < referrals[receiver].length; i++) {\\n if (referrals[receiver][i] == keccak256(bytes(name))) {\\n contains = true;\\n }\\n }\\n if (contains == false) {\\n referrals[receiver].push(keccak256(bytes(name)));\\n referredBy[keccak256(bytes(name))] = referree;\\n _applyNativeReward(receiver, amount, true);\\n } else {\\n _applyNativeReward(receiver, amount, true);\\n }\\n }\\n }\\n\\n /// @notice Only your controller or admin should be able to call this!\\n function setReferree(\\n bytes32 code,\\n address who,\\n uint256 duration\\n ) external onlyControllerOrOwner {\\n require(code != bytes32(0), \\\"Invalid referral code\\\");\\n require(who != address(0), \\\"Invalid referree address\\\");\\n require(\\n referrees[code] == address(0),\\n \\\"Referral code already registered\\\"\\n );\\n address prevReferree = referrees[code];\\n if (prevReferree != address(0)) {\\n referrals[prevReferree] = new bytes32[](0);\\n }\\n referrees[code] = who;\\n referralCodes.push(code);\\n expirydates[code] = duration;\\n }\\n\\n function settlementCard(\\n uint256 amount,\\n address receiver,\\n string memory referree\\n ) external onlyControllerOrOwner {\\n // If the referree is already registered, we can use it\\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\\n require(receiver != address(0), \\\"Invalid receiver address\\\");\\n _applyNativeReward(receiver, amount, true);\\n }\\n }\\n\\n function settlement(\\n uint256 amount,\\n address receiver,\\n string memory referree\\n ) external payable onlyControllerOrOwner {\\n // If the referree is already registered, we can use it\\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\\n require(receiver != address(0), \\\"Invalid receiver address\\\");\\n _applyNativeReward(receiver, amount, false);\\n } else {\\n payable(Ownable.owner()).transfer(amount);\\n }\\n }\\n\\n function settlementWithToken(\\n uint256 amount,\\n address receiver,\\n address tokenAddress,\\n string memory referree\\n ) external onlyControllerOrOwner {\\n // If the referree is already registered, we can use it\\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\\n require(receiver != address(0), \\\"Invalid receiver address\\\");\\n _applyTokenReward(receiver, tokenAddress, amount);\\n } else {\\n IERC20(tokenAddress).safeTransfer(Ownable.owner(), amount);\\n }\\n }\\n\\n function settlementRegisterWithToken(\\n string memory referree,\\n string memory name,\\n address owner,\\n uint256 amount,\\n address tokenAddress\\n ) external onlyControllerOrOwner {\\n // If the referree is already registered, we can use it\\n // Implement token settlement logic here if needed\\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\\n address receiver = referrees[keccak256(bytes(referree))];\\n if (receiver != address(0) && receiver != owner) {\\n bool contains;\\n for (uint256 i = 0; i < referrals[receiver].length; i++) {\\n if (referrals[receiver][i] == keccak256(bytes(name))) {\\n contains = true;\\n }\\n }\\n if (contains == false) {\\n referrals[receiver].push(keccak256(bytes(name)));\\n referredBy[keccak256(bytes(name))] = referree;\\n _applyTokenReward(receiver, tokenAddress, amount);\\n } else {\\n _applyTokenReward(receiver, tokenAddress, amount);\\n }\\n }\\n } else {\\n // If the referree is not registered, we can transfer the amount to the owner\\n IERC20(tokenAddress).safeTransfer(Ownable.owner(), amount);\\n }\\n }\\n\\n function withdrawAllNativeEarnings(uint256 batch) external onlyOwner {\\n for (uint256 i = 0; i < batch; ) {\\n bytes32 code = referralCodes[batch];\\n if (block.timestamp < expirydates[code]) {\\n address referrer = referrees[code];\\n uint256 earnings = nativeEarnings[referrer];\\n if (earnings > 0) {\\n (bool ok, ) = payable(referrer).call{value: earnings}(\\\"\\\");\\n require(ok, \\\"Payment failed\\\");\\n nativeEarnings[referrer] = 0;\\n }\\n }\\n unchecked {\\n ++i;\\n }\\n }\\n // Transfer any remaining balance to the owner\\n uint256 remainingBalance = address(this).balance;\\n if (remainingBalance > 0) {\\n payable(owner()).transfer(remainingBalance);\\n }\\n // Emit an event for the withdrawal\\n emit WithdrawalDispersed(msg.sender);\\n }\\n\\n function withdrawAllTokenEarnings(\\n address[] memory tokenAddresses,\\n uint256 batch\\n ) external onlyOwner {\\n uint256 tokenLength = tokenAddresses.length;\\n for (uint256 j = 0; j < tokenLength; ) {\\n address tokenAddress = tokenAddresses[j];\\n for (uint256 i = 0; i < batch; ) {\\n bytes32 code = referralCodes[i];\\n if (block.timestamp < expirydates[code]) {\\n address referrer = referrees[code];\\n uint256 earnings = tokenEarnings[referrer][tokenAddress];\\n require(earnings > 0, \\\"No earnings to withdraw\\\");\\n if (earnings > 0) {\\n // Assuming the token follows ERC20 standard\\n IERC20(tokenAddress).safeTransfer(referrer, earnings);\\n tokenEarnings[referrer][tokenAddress] = 0;\\n }\\n }\\n unchecked {\\n ++i;\\n }\\n }\\n unchecked {\\n ++j;\\n }\\n }\\n }\\n\\n function totalReferrals(address referrer) external view returns (uint256) {\\n return referrals[referrer].length;\\n }\\n\\n function totalNativeEarnings(\\n address referrer\\n ) external view returns (uint256) {\\n return nativeEarnings[referrer];\\n }\\n\\n function totalTokenEarnings(\\n address referrer,\\n address tokenAddress\\n ) external view returns (uint256) {\\n return tokenEarnings[referrer][tokenAddress];\\n }\\n\\n function getCodes() external view returns (uint256) {\\n return referralCodes.length;\\n }\\n function updateReferralCode(\\n bytes32 code,\\n uint256 newExpiry\\n ) external onlyControllerOrOwner {\\n require(expirydates[code] > 0, \\\"Referral code does not exist\\\");\\n expirydates[code] = newExpiry;\\n }\\n\\n function _rewardPct(uint256 numReferrals) public pure returns (uint256) {\\n if (numReferrals >= TIER3) return PCT3;\\n if (numReferrals >= TIER2) return PCT2;\\n if (numReferrals >= TIER1) return PCT1;\\n return 0; // No reward for less than TIER1 referrals\\n }\\n\\n function _applyNativeReward(\\n address receiver,\\n uint256 amount,\\n bool isFiat\\n ) private {\\n nativeEarnings[receiver] +=\\n (amount * _rewardPct(referrals[receiver].length)) /\\n 100;\\n if (isFiat) {\\n untrackedEarnings +=\\n (amount * _rewardPct(referrals[receiver].length)) /\\n 100;\\n }\\n }\\n\\n function _applyTokenReward(\\n address receiver,\\n address token,\\n uint256 amount\\n ) private {\\n tokenEarnings[receiver][token] +=\\n (amount * _rewardPct(referrals[receiver].length)) /\\n 100;\\n }\\n\\n function balance() public view returns (uint256) {\\n return address(this).balance;\\n }\\n\\n function tokenBalance(\\n address tokenAddress\\n ) public view returns (uint256) {\\n return IERC20(tokenAddress).balanceOf(address(this));\\n }\\n\\n function getUntracked() public view returns (uint256) {\\n return untrackedEarnings;\\n }\\n\\n function createSnapshot(\\n address[] memory tokenAddresses\\n ) external onlyOwner {\\n snapshotUntrackedEarnings = untrackedEarnings;\\n for (uint256 i = 0; i < referralCodes.length; i++) {\\n bytes32 code = referralCodes[i];\\n address referrer = referrees[code];\\n snapshotNativeEarnings[referrer] = nativeEarnings[referrer];\\n }\\n for (uint256 j = 0; j < tokenAddresses.length; j++) {\\n address tokenAddress = tokenAddresses[j];\\n for (uint256 i = 0; i < referralCodes.length; i++) {\\n bytes32 code = referralCodes[i];\\n address referrer = referrees[code];\\n snapshotTokenEarnings[referrer][tokenAddress] = tokenEarnings[\\n referrer\\n ][tokenAddress];\\n }\\n }\\n }\\n\\n function getSnapshotEarnings() public view returns (uint256) {\\n return snapshotUntrackedEarnings;\\n }\\n}\\n\",\"keccak256\":\"0xd84283d895a37b233ac7cdda54599c813d163463e99af5dadd708be214a5c8d2\",\"license\":\"MIT\"},\"contracts/ethregistrar/StablePriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./IPriceOracle.sol\\\";\\nimport \\\"../utils/StringUtils.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {AggregatorV3Interface} from \\\"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\\\";\\n\\n\\n\\n// StablePriceOracle sets a price in USD, based on an oracle.\\ncontract StablePriceOracle is IPriceOracle {\\n using StringUtils for *;\\n AggregatorV3Interface internal usdOracle;\\n\\n // Rent in base price units by length\\n uint256 public immutable price1Letter;\\n uint256 public immutable price2Letter;\\n uint256 public immutable price3Letter;\\n uint256 public immutable price4Letter;\\n uint256 public immutable price5Letter;\\n\\n // Oracle address\\n\\n event RentPriceChanged(uint256[] prices);\\n\\n constructor(AggregatorV3Interface _usdOracle, uint256[] memory _rentPrices) {\\n usdOracle = _usdOracle;\\n price1Letter = _rentPrices[0];\\n price2Letter = _rentPrices[1];\\n price3Letter = _rentPrices[2];\\n price4Letter = _rentPrices[3];\\n price5Letter = _rentPrices[4];\\n }\\n\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration,\\n bool lifetime\\n ) external view override returns (IPriceOracle.Price memory) {\\n uint256 len = name.strlen();\\n uint256 basePrice;\\n\\n if (len >= 5 && lifetime) {\\n basePrice = price5Letter * 31536000 * 4;\\n } else if (len == 4 && lifetime) {\\n basePrice = price4Letter * 31536000 * 4;\\n } else if (len == 3 && lifetime) {\\n basePrice = price3Letter * 31536000 * 6;\\n } else if (len == 2 && lifetime) {\\n basePrice = price2Letter * 31536000 * 10;\\n } else if (len == 1 && lifetime) {\\n basePrice = price1Letter * 31536000;\\n } else if (len >= 5 && lifetime == false) { \\n basePrice = price5Letter * duration;\\n } else if (len == 4 && lifetime == false) {\\n basePrice = price4Letter * duration;\\n } else if (len == 3 && lifetime == false) {\\n basePrice = price3Letter * duration;\\n } else if (len == 2 && lifetime == false) {\\n basePrice = price2Letter * duration;\\n } else {\\n basePrice = price1Letter * duration;\\n }\\n return\\n IPriceOracle.Price({\\n base: attoUSDToWei(basePrice),\\n premium: attoUSDToWei(_premium(name, expires, duration))\\n });\\n }\\n\\n /**\\n * @dev Returns the pricing premium in wei.\\n */\\n function premium(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (uint256) {\\n return attoUSDToWei(_premium(name, expires, duration));\\n }\\n\\n /**\\n * @dev Returns the pricing premium in internal base units.\\n */\\n function _premium(\\n string memory name,\\n uint256 expires,\\n uint256 duration\\n ) internal view virtual returns (uint256) {\\n return 0;\\n }\\n\\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\\n (, int256 ethPrice,,,) = usdOracle.latestRoundData();\\n return (amount * 1e8) / uint256(ethPrice);\\n }\\n\\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\\n (, int256 ethPrice,,,) = usdOracle.latestRoundData();\\n return (amount * uint256(ethPrice)) / 1e8;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IPriceOracle).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0x54a747b1762c567f40f99603f147789dc03aab46eafb4e0eaac7340092cccea3\",\"license\":\"MIT\"},\"contracts/ethregistrar/StaticBulkRenewal.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./ETHRegistrarController.sol\\\";\\nimport \\\"./IBulkRenewal.sol\\\";\\nimport \\\"./IPriceOracle.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\ncontract StaticBulkRenewal is IBulkRenewal {\\n ETHRegistrarController controller;\\n\\n constructor(ETHRegistrarController _controller) {\\n controller = _controller;\\n }\\n\\n function rentPrice(\\n string[] calldata names,\\n uint256 duration,\\n bool lifetime\\n ) external view override returns (uint256 total) {\\n uint256 length = names.length;\\n for (uint256 i = 0; i < length; ) {\\n IPriceOracle.Price memory price = controller.rentPrice(\\n names[i],\\n duration,\\n lifetime\\n );\\n unchecked {\\n ++i;\\n total += (price.base + price.premium);\\n }\\n }\\n }\\n function rentPriceToken(\\n string[] calldata names,\\n uint256 duration,\\n string memory token,\\n bool lifetime\\n ) external view returns (uint256 total) {\\n uint256 length = names.length;\\n for (uint256 i = 0; i < length; ) {\\n IPriceOracle.Price memory price = controller.rentPriceToken(\\n names[i],\\n duration,\\n token,\\n lifetime\\n );\\n unchecked {\\n ++i;\\n total += (price.base + price.premium);\\n }\\n }\\n }\\n\\n function renewAll(\\n string[] calldata names,\\n uint256 duration,\\n bool lifetime\\n ) external payable override {\\n uint256 length = names.length;\\n uint256 total;\\n for (uint256 i = 0; i < length; ) {\\n IPriceOracle.Price memory price = controller.rentPrice(\\n names[i],\\n duration,\\n lifetime\\n );\\n uint256 totalPrice = price.base + price.premium;\\n controller.renew{value: totalPrice}(names[i], duration, lifetime);\\n unchecked {\\n ++i;\\n total += totalPrice;\\n }\\n }\\n // Send any excess funds back\\n payable(msg.sender).transfer(address(this).balance);\\n }\\n function renewAllWithToken(\\n string[] calldata names,\\n uint256 duration,\\n string memory token,\\n address tokenAddress,\\n bool lifetime\\n ) external payable {\\n uint256 length = names.length;\\n uint256 total;\\n for (uint256 i = 0; i < length; ) {\\n IPriceOracle.Price memory price = controller.rentPriceToken(\\n names[i],\\n duration,\\n token,\\n lifetime\\n );\\n uint256 totalPrice = price.base + price.premium;\\n controller.renewTokens(names[i], duration, token, tokenAddress, lifetime);\\n unchecked {\\n ++i;\\n total += totalPrice;\\n }\\n }\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) external pure returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IBulkRenewal).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xc1736c68220e9aa467164d2a378b1e2306ee64b8569f4097fb325ed831d7b657\",\"license\":\"MIT\"},\"contracts/ethregistrar/TokenPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./ExponentialPremiumPriceOracle.sol\\\";\\nimport {AggregatorV3Interface} from \\\"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\\\";\\n\\ncontract TokenPriceOracle is ExponentialPremiumPriceOracle {\\n AggregatorV3Interface internal cakeOracle;\\n AggregatorV3Interface internal usd1Oracle;\\n using StringUtils for *;\\n constructor(\\n AggregatorV3Interface _usdOracle,\\n AggregatorV3Interface _cakeOracle,\\n AggregatorV3Interface _usd1Oracle,\\n uint256[] memory _rentPrices,\\n uint256 _startPremium,\\n uint256 totalDays\\n )ExponentialPremiumPriceOracle(_usdOracle, _rentPrices, _startPremium, totalDays) {\\n usd1Oracle = _usd1Oracle;\\n cakeOracle = _cakeOracle;\\n }\\n\\n\\n function priceToken(\\n string calldata name,\\n uint256 expires,\\n uint256 duration,\\n string memory token,\\n bool lifetime\\n ) external view returns (IPriceOracle.Price memory) {\\n uint256 len = name.strlen();\\n uint256 basePrice;\\n\\n if (len >= 5 && lifetime) {\\n basePrice = price5Letter * 31536000 * 4;\\n } else if (len == 4 && lifetime) {\\n basePrice = price4Letter * 31536000 * 4;\\n } else if (len == 3 && lifetime) {\\n basePrice = price3Letter * 31536000 * 6;\\n } else if (len == 2 && lifetime) {\\n basePrice = price2Letter * 31536000 * 10;\\n } else if (len == 1 && lifetime) {\\n basePrice = price1Letter * 31536000;\\n } else if (len >= 5 && lifetime == false) { \\n basePrice = price5Letter * duration;\\n } else if (len == 4 && lifetime == false) {\\n basePrice = price4Letter * duration;\\n } else if (len == 3 && lifetime == false) {\\n basePrice = price3Letter * duration;\\n } else if (len == 2 && lifetime == false) {\\n basePrice = price2Letter * duration;\\n } else {\\n basePrice = price1Letter * duration;\\n }\\n if(keccak256(bytes(token)) == keccak256(bytes(\\\"cake\\\"))){\\n return\\n IPriceOracle.Price({\\n base: attoUSDToCake(basePrice),\\n premium: attoUSDToCake(_premium(name, expires, duration))\\n });\\n } else {\\n return\\n IPriceOracle.Price({\\n base: attoUSDToUSD1(basePrice),\\n premium: attoUSDToCake(_premium(name, expires, duration))\\n });\\n }\\n \\n }\\n function attoUSDToCake(uint256 amount) internal view returns (uint256) {\\n (, int256 cakePrice,,,) = cakeOracle.latestRoundData();\\n return (amount * 1e8) / uint256(cakePrice);\\n }\\n function attoUSDToUSD1(uint256 amount) internal view returns (uint256) {\\n (, int256 usd1Price,,,) = usd1Oracle.latestRoundData();\\n return (amount * 1e8) / uint256(usd1Price);\\n }\\n function attoCakeToUSD(uint256 amount) internal view returns (uint256) {\\n (, int256 cakePrice,,,) = cakeOracle.latestRoundData();\\n return (amount * uint256(cakePrice)) / 1e8;\\n }\\n function attoUSD1ToUSD(uint256 amount) internal view returns (uint256) {\\n (, int256 usd1Price,,,) = usd1Oracle.latestRoundData();\\n return (amount * uint256(usd1Price)) / 1e8;\\n }\\n\\n}\\n\",\"keccak256\":\"0x315a2173ce37b23b47f11600bd0ecf1407ba59a52db2c5ec628038bd8d75d4ca\",\"license\":\"MIT\"},\"contracts/registry/ENS.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x8e208b44d5dbf22552fe72d79b45c640855b84fbc9ee21f4c3bb4bfe81cbe8db\",\"license\":\"MIT\"},\"contracts/resolvers/Resolver.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"./profiles/IABIResolver.sol\\\";\\nimport \\\"./profiles/IAddressResolver.sol\\\";\\nimport \\\"./profiles/IAddrResolver.sol\\\";\\nimport \\\"./profiles/IContentHashResolver.sol\\\";\\nimport \\\"./profiles/IDNSRecordResolver.sol\\\";\\nimport \\\"./profiles/IDNSZoneResolver.sol\\\";\\nimport \\\"./profiles/IInterfaceResolver.sol\\\";\\nimport \\\"./profiles/INameResolver.sol\\\";\\nimport \\\"./profiles/IPubkeyResolver.sol\\\";\\nimport \\\"./profiles/ITextResolver.sol\\\";\\nimport \\\"./profiles/IExtendedResolver.sol\\\";\\n\\n/**\\n * A generic resolver interface which includes all the functions including the ones deprecated\\n */\\ninterface Resolver is\\n IERC165,\\n IABIResolver,\\n IAddressResolver,\\n IAddrResolver,\\n IContentHashResolver,\\n IDNSRecordResolver,\\n IDNSZoneResolver,\\n IInterfaceResolver,\\n INameResolver,\\n IPubkeyResolver,\\n ITextResolver,\\n IExtendedResolver\\n{\\n /* Deprecated events */\\n event ContentChanged(bytes32 indexed node, bytes32 hash);\\n\\n function setApprovalForAll(address, bool) external;\\n\\n function approve(bytes32 node, address delegate, bool approved) external;\\n\\n function isApprovedForAll(address account, address operator) external;\\n\\n function isApprovedFor(\\n address owner,\\n bytes32 node,\\n address delegate\\n ) external;\\n\\n function setABI(\\n bytes32 node,\\n uint256 contentType,\\n bytes calldata data\\n ) external;\\n\\n function setAddr(bytes32 node, address addr) external;\\n\\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\\n\\n function setContenthash(bytes32 node, bytes calldata hash) external;\\n\\n function setDnsrr(bytes32 node, bytes calldata data) external;\\n\\n function setName(bytes32 node, string calldata _name) external;\\n\\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\\n\\n function setText(\\n bytes32 node,\\n string calldata key,\\n string calldata value\\n ) external;\\n\\n function setInterface(\\n bytes32 node,\\n bytes4 interfaceID,\\n address implementer\\n ) external;\\n\\n function multicall(\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n function multicallWithNodeCheck(\\n bytes32 nodehash,\\n bytes[] calldata data\\n ) external returns (bytes[] memory results);\\n\\n /* Deprecated functions */\\n function content(bytes32 node) external view returns (bytes32);\\n\\n function multihash(bytes32 node) external view returns (bytes memory);\\n\\n function setContent(bytes32 node, bytes32 hash) external;\\n\\n function setMultihash(bytes32 node, bytes calldata hash) external;\\n}\\n\",\"keccak256\":\"0xfc77ab6b7c59c3ebfe1c720bdebf9b08c2488ff7ac9501a9aa056c5d6d5b50c5\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IABIResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IABIResolver {\\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\\n\\n /**\\n * Returns the ABI associated with an ENS node.\\n * Defined in EIP205.\\n * @param node The ENS node to query\\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\\n * @return contentType The content type of the return value\\n * @return data The ABI data\\n */\\n function ABI(\\n bytes32 node,\\n uint256 contentTypes\\n ) external view returns (uint256, bytes memory);\\n}\\n\",\"keccak256\":\"0x85b373d02d19374fe570af407f459768285704bf7f30ab17c30eabfb5a10e4c3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddrResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the legacy (ETH-only) addr function.\\n */\\ninterface IAddrResolver {\\n event AddrChanged(bytes32 indexed node, address a);\\n\\n /**\\n * Returns the address associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated address.\\n */\\n function addr(bytes32 node) external view returns (address payable);\\n}\\n\",\"keccak256\":\"0x2ad7f2fc60ebe0f93745fe70247f6a854f66af732483fda2a3c5e055614445e8\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IAddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\n/**\\n * Interface for the new (multicoin) addr function.\\n */\\ninterface IAddressResolver {\\n event AddressChanged(\\n bytes32 indexed node,\\n uint256 coinType,\\n bytes newAddress\\n );\\n\\n function addr(\\n bytes32 node,\\n uint256 coinType\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x411447c1e90c51e09702815a85ec725ffbbe37cf96e8cc4d2a8bd4ad8a59d73e\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IContentHashResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IContentHashResolver {\\n event ContenthashChanged(bytes32 indexed node, bytes hash);\\n\\n /**\\n * Returns the contenthash associated with an ENS node.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function contenthash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xd95cd77684ba5752c428d7dceb4ecc6506ac94f4fbb910489637eb68dcd8e366\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSRecordResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSRecordResolver {\\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\\n event DNSRecordChanged(\\n bytes32 indexed node,\\n bytes name,\\n uint16 resource,\\n bytes record\\n );\\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\\n\\n /**\\n * Obtain a DNS record.\\n * @param node the namehash of the node for which to fetch the record\\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\\n * @return the DNS record in wire format if present, otherwise empty\\n */\\n function dnsRecord(\\n bytes32 node,\\n bytes32 name,\\n uint16 resource\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xcfa52200edd337f2c6c5bf402352600584da033b21323603e53de33051a3e25d\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IDNSZoneResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IDNSZoneResolver {\\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\\n event DNSZonehashChanged(\\n bytes32 indexed node,\\n bytes lastzonehash,\\n bytes zonehash\\n );\\n\\n /**\\n * zonehash obtains the hash for the zone.\\n * @param node The ENS node to query.\\n * @return The associated contenthash.\\n */\\n function zonehash(bytes32 node) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0xca1b3a16e7005533f2800a3e66fcdccf7c574deac7913d8c810f40aec1d58dc0\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IExtendedResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IExtendedResolver {\\n function resolve(\\n bytes memory name,\\n bytes memory data\\n ) external view returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x5d81521cfae7d9a4475d27533cd8ed0d3475d369eb0674fd90ffbdbdf292faa3\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IInterfaceResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IInterfaceResolver {\\n event InterfaceChanged(\\n bytes32 indexed node,\\n bytes4 indexed interfaceID,\\n address implementer\\n );\\n\\n /**\\n * Returns the address of a contract that implements the specified interface for this name.\\n * If an implementer has not been set for this interfaceID and name, the resolver will query\\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\\n * will be returned.\\n * @param node The ENS node to query.\\n * @param interfaceID The EIP 165 interface ID to check for.\\n * @return The address that implements this interface, or 0 if the interface is unsupported.\\n */\\n function interfaceImplementer(\\n bytes32 node,\\n bytes4 interfaceID\\n ) external view returns (address);\\n}\\n\",\"keccak256\":\"0x390321fb58f7b927df9562450981e74b4be3907e7c09df321fd3b7409b63ae28\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/INameResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface INameResolver {\\n event NameChanged(bytes32 indexed node, string name);\\n\\n /**\\n * Returns the name associated with an ENS node, for reverse records.\\n * Defined in EIP181.\\n * @param node The ENS node to query.\\n * @return The associated name.\\n */\\n function name(bytes32 node) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x9ec392b612447b1acbdc01114f2da2837a658d3f3157f60a99c5269f0b623346\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/IPubkeyResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface IPubkeyResolver {\\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\\n\\n /**\\n * Returns the SECP256k1 public key associated with an ENS node.\\n * Defined in EIP 619.\\n * @param node The ENS node to query\\n * @return x The X coordinate of the curve point for the public key.\\n * @return y The Y coordinate of the curve point for the public key.\\n */\\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\\n}\\n\",\"keccak256\":\"0x69748947093dd2fda9ddcebd0adf19a6d1e7600df1d4b1462a0417156caddca7\",\"license\":\"MIT\"},\"contracts/resolvers/profiles/ITextResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ITextResolver {\\n event TextChanged(\\n bytes32 indexed node,\\n string indexed indexedKey,\\n string key,\\n string value\\n );\\n\\n /**\\n * Returns the text data associated with an ENS node and key.\\n * @param node The ENS node to query.\\n * @param key The text data key to query.\\n * @return The associated text data.\\n */\\n function text(\\n bytes32 node,\\n string calldata key\\n ) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x7c5debb3c42cd9f5de2274ea7aa053f238608314b62db441c40e31cea2543fd5\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/IReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\ninterface IReverseRegistrar {\\n function setDefaultResolver(address resolver) external;\\n\\n function claim(address owner) external returns (bytes32);\\n\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) external returns (bytes32);\\n\\n function setName(string memory name) external returns (bytes32);\\n\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) external returns (bytes32);\\n\\n function node(address addr) external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0x83adfcf6da72b1bcd1e3ac387afe5fc7fdf7f2ac28b7601544d2ca4b9d45d159\"},\"contracts/reverseRegistrar/ReverseClaimer.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport {ENS} from \\\"../registry/ENS.sol\\\";\\nimport {IReverseRegistrar} from \\\"../reverseRegistrar/IReverseRegistrar.sol\\\";\\n\\ncontract ReverseClaimer {\\n bytes32 constant ADDR_REVERSE_NODE =\\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n constructor(ENS ens, address claimant) {\\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\\n ens.owner(ADDR_REVERSE_NODE)\\n );\\n reverseRegistrar.claim(claimant);\\n }\\n}\\n\",\"keccak256\":\"0x78a28627241535b595f6fff476a1fa7acc90c80684fe7784734920fc8af6fc22\",\"license\":\"MIT\"},\"contracts/reverseRegistrar/ReverseRegistrar.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"./IReverseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"../root/Controllable.sol\\\";\\n\\nabstract contract NameResolver {\\n function setName(bytes32 node, string memory name) public virtual;\\n}\\n\\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\\n\\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\\n\\n// namehash('addr.reverse')\\n\\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\\n ENS public immutable ens;\\n NameResolver public defaultResolver;\\n\\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\\n event DefaultResolverChanged(NameResolver indexed resolver);\\n\\n /**\\n * @dev Constructor\\n * @param ensAddr The address of the ENS registry.\\n */\\n constructor(ENS ensAddr) {\\n ens = ensAddr;\\n\\n // Assign ownership of the reverse record to our deployer\\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\\n ensAddr.owner(ADDR_REVERSE_NODE)\\n );\\n if (address(oldRegistrar) != address(0x0)) {\\n oldRegistrar.claim(msg.sender);\\n }\\n }\\n\\n modifier authorised(address addr) {\\n require(\\n addr == msg.sender ||\\n controllers[msg.sender] ||\\n ens.isApprovedForAll(addr, msg.sender) ||\\n ownsContract(addr),\\n \\\"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\\\"\\n );\\n _;\\n }\\n\\n function setDefaultResolver(address resolver) public override onlyOwner {\\n require(\\n address(resolver) != address(0),\\n \\\"ReverseRegistrar: Resolver address must not be 0\\\"\\n );\\n defaultResolver = NameResolver(resolver);\\n emit DefaultResolverChanged(NameResolver(resolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claim(address owner) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, address(defaultResolver));\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param addr The reverse record to set\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The resolver of the reverse node\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimForAddr(\\n address addr,\\n address owner,\\n address resolver\\n ) public override authorised(addr) returns (bytes32) {\\n bytes32 labelHash = sha3HexAddress(addr);\\n bytes32 reverseNode = keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\\n );\\n emit ReverseClaimed(addr, reverseNode);\\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\\n return reverseNode;\\n }\\n\\n /**\\n * @dev Transfers ownership of the reverse ENS record associated with the\\n * calling account.\\n * @param owner The address to set as the owner of the reverse record in ENS.\\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\\n * @return The ENS node hash of the reverse record.\\n */\\n function claimWithResolver(\\n address owner,\\n address resolver\\n ) public override returns (bytes32) {\\n return claimForAddr(msg.sender, owner, resolver);\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the calling account. First updates the resolver to the default reverse\\n * resolver if necessary.\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setName(string memory name) public override returns (bytes32) {\\n return\\n setNameForAddr(\\n msg.sender,\\n msg.sender,\\n address(defaultResolver),\\n name\\n );\\n }\\n\\n /**\\n * @dev Sets the `name()` record for the reverse ENS record associated with\\n * the account provided. Updates the resolver to a designated resolver\\n * Only callable by controllers and authorised users\\n * @param addr The reverse record to set\\n * @param owner The owner of the reverse node\\n * @param resolver The resolver of the reverse node\\n * @param name The name to set for this address.\\n * @return The ENS node hash of the reverse record.\\n */\\n function setNameForAddr(\\n address addr,\\n address owner,\\n address resolver,\\n string memory name\\n ) public override returns (bytes32) {\\n bytes32 node = claimForAddr(addr, owner, resolver);\\n NameResolver(resolver).setName(node, name);\\n return node;\\n }\\n\\n /**\\n * @dev Returns the node hash for a given account's reverse records.\\n * @param addr The address to hash\\n * @return The ENS node hash.\\n */\\n function node(address addr) public pure override returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\\n );\\n }\\n\\n /**\\n * @dev An optimised function to compute the sha3 of the lower-case\\n * hexadecimal representation of an Ethereum address.\\n * @param addr The address to hash\\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\\n * input address.\\n */\\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\\n assembly {\\n for {\\n let i := 40\\n } gt(i, 0) {\\n\\n } {\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n i := sub(i, 1)\\n mstore8(i, byte(and(addr, 0xf), lookup))\\n addr := div(addr, 0x10)\\n }\\n\\n ret := keccak256(0, 40)\\n }\\n }\\n\\n function ownsContract(address addr) internal view returns (bool) {\\n try Ownable(addr).owner() returns (address owner) {\\n return owner == msg.sender;\\n } catch {\\n return false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd57d28e5791b4b44650a00f5ef6c725af53698ec33faeeaa3591f0dbd939559a\"},\"contracts/root/Controllable.sol\":{\"content\":\"pragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract Controllable is Ownable {\\n mapping(address => bool) public controllers;\\n\\n event ControllerChanged(address indexed controller, bool enabled);\\n\\n modifier onlyController() {\\n require(\\n controllers[msg.sender],\\n \\\"Controllable: Caller is not a controller\\\"\\n );\\n _;\\n }\\n\\n function setController(address controller, bool enabled) public onlyOwner {\\n controllers[controller] = enabled;\\n emit ControllerChanged(controller, enabled);\\n }\\n}\\n\",\"keccak256\":\"0xb19b8c0fafe9ca2b4bf8aaafee486fa31437672e1e1977bdf84bfe03464969db\"},\"contracts/utils/ERC20Recoverable.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/**\\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\\n */\\n\\ncontract ERC20Recoverable is Ownable {\\n /**\\n @notice Recover ERC20 tokens sent to the contract by mistake.\\n @dev The contract is Ownable and only the owner can call the recover function.\\n @param _to The address to send the tokens to.\\n@param _token The address of the ERC20 token to recover\\n @param _amount The amount of tokens to recover.\\n */\\n function recoverFunds(\\n address _token,\\n address _to,\\n uint256 _amount\\n ) external onlyOwner {\\n IERC20(_token).transfer(_to, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x793a38091e1f81499a29ddba82c2b2f3cdd07071b81a832886e8e02a45ff352a\",\"license\":\"MIT\"},\"contracts/utils/StringUtils.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary StringUtils {\\n /**\\n * @dev Returns the length of a given string\\n *\\n * @param s The string to measure the length of\\n * @return The length of the input string\\n */\\n function strlen(string memory s) internal pure returns (uint256) {\\n uint256 len;\\n uint256 i = 0;\\n uint256 bytelength = bytes(s).length;\\n for (len = 0; i < bytelength; len++) {\\n bytes1 b = bytes(s)[i];\\n if (b < 0x80) {\\n i += 1;\\n } else if (b < 0xE0) {\\n i += 2;\\n } else if (b < 0xF0) {\\n i += 3;\\n } else if (b < 0xF8) {\\n i += 4;\\n } else if (b < 0xFC) {\\n i += 5;\\n } else {\\n i += 6;\\n }\\n }\\n return len;\\n }\\n\\n /**\\n * @dev Escapes special characters in a given string\\n *\\n * @param str The string to escape\\n * @return The escaped string\\n */\\n function escape(string memory str) internal pure returns (string memory) {\\n bytes memory strBytes = bytes(str);\\n uint extraChars = 0;\\n\\n // count extra space needed for escaping\\n for (uint i = 0; i < strBytes.length; i++) {\\n if (_needsEscaping(strBytes[i])) {\\n extraChars++;\\n }\\n }\\n\\n // allocate buffer with the exact size needed\\n bytes memory buffer = new bytes(strBytes.length + extraChars);\\n uint index = 0;\\n\\n // escape characters\\n for (uint i = 0; i < strBytes.length; i++) {\\n if (_needsEscaping(strBytes[i])) {\\n buffer[index++] = \\\"\\\\\\\\\\\";\\n buffer[index++] = _getEscapedChar(strBytes[i]);\\n } else {\\n buffer[index++] = strBytes[i];\\n }\\n }\\n\\n return string(buffer);\\n }\\n\\n // determine if a character needs escaping\\n function _needsEscaping(bytes1 char) private pure returns (bool) {\\n return\\n char == '\\\"' ||\\n char == \\\"/\\\" ||\\n char == \\\"\\\\\\\\\\\" ||\\n char == \\\"\\\\n\\\" ||\\n char == \\\"\\\\r\\\" ||\\n char == \\\"\\\\t\\\";\\n }\\n\\n // get the escaped character\\n function _getEscapedChar(bytes1 char) private pure returns (bytes1) {\\n if (char == \\\"\\\\n\\\") return \\\"n\\\";\\n if (char == \\\"\\\\r\\\") return \\\"r\\\";\\n if (char == \\\"\\\\t\\\") return \\\"t\\\";\\n return char;\\n }\\n}\\n\",\"keccak256\":\"0xb3838963dcc378d8dde1bd03666ff4fc66c37909a5608950b6ef6eb78f9025c4\"},\"contracts/wrapper/IMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface IMetadataService {\\n function uri(uint256) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xb3f1cf6df01ed7b15e5f2318f6823afbdb586ca38c2124c67955c645647ae9a2\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapper.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"../registry/ENS.sol\\\";\\nimport \\\"../ethregistrar/IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\\\";\\nimport \\\"./IMetadataService.sol\\\";\\nimport \\\"./INameWrapperUpgrade.sol\\\";\\n\\nuint32 constant CANNOT_UNWRAP = 1;\\nuint32 constant CANNOT_BURN_FUSES = 2;\\nuint32 constant CANNOT_TRANSFER = 4;\\nuint32 constant CANNOT_SET_RESOLVER = 8;\\nuint32 constant CANNOT_SET_TTL = 16;\\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\\nuint32 constant CANNOT_APPROVE = 64;\\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\\nuint32 constant IS_DOT_CRE8OR = 1 << 17;\\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\\nuint32 constant CAN_DO_EVERYTHING = 0;\\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\\n// all fuses apart from IS_DOT_ETH\\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\\n\\ninterface INameWrapper is IERC1155 {\\n event NameWrapped(\\n bytes32 indexed node,\\n bytes name,\\n address owner,\\n uint32 fuses,\\n uint64 expiry\\n );\\n\\n event NameUnwrapped(bytes32 indexed node, address owner);\\n\\n event FusesSet(bytes32 indexed node, uint32 fuses);\\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\\n\\n function ens() external view returns (ENS);\\n\\n function registrar() external view returns (IBaseRegistrar);\\n\\n function metadataService() external view returns (IMetadataService);\\n\\n function names(bytes32) external view returns (bytes memory);\\n\\n function name() external view returns (string memory);\\n\\n function upgradeContract() external view returns (INameWrapperUpgrade);\\n\\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\\n\\n function wrap(\\n bytes calldata name,\\n address wrappedOwner,\\n address resolver\\n ) external;\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint16 ownerControlledFuses,\\n address resolver\\n ) external returns (uint64 expires);\\n\\n function registerAndWrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint256 duration,\\n address resolver,\\n uint16 ownerControlledFuses\\n ) external returns (uint256 registrarExpiry);\\n\\n function renew(\\n uint256 labelHash,\\n uint256 duration\\n ) external returns (uint256 expires);\\n\\n function unwrap(bytes32 node, bytes32 label, address owner) external;\\n\\n function unwrapETH2LD(\\n bytes32 label,\\n address newRegistrant,\\n address newController\\n ) external;\\n\\n function upgrade(bytes calldata name, bytes calldata extraData) external;\\n\\n function setFuses(\\n bytes32 node,\\n uint16 ownerControlledFuses\\n ) external returns (uint32 newFuses);\\n\\n function setChildFuses(\\n bytes32 parentNode,\\n bytes32 labelhash,\\n uint32 fuses,\\n uint64 expiry\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n string calldata label,\\n address owner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n string calldata label,\\n address newOwner,\\n uint32 fuses,\\n uint64 expiry\\n ) external returns (bytes32);\\n\\n function extendExpiry(\\n bytes32 node,\\n bytes32 labelhash,\\n uint64 expiry\\n ) external returns (uint64);\\n\\n function canModifyName(\\n bytes32 node,\\n address addr\\n ) external view returns (bool);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function ownerOf(uint256 id) external view returns (address owner);\\n\\n function approve(address to, uint256 tokenId) external;\\n\\n function getApproved(uint256 tokenId) external view returns (address);\\n\\n function getData(\\n uint256 id\\n ) external view returns (address, uint32, uint64);\\n\\n function setMetadataService(IMetadataService _metadataService) external;\\n\\n function uri(uint256 tokenId) external view returns (string memory);\\n\\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\\n\\n function allFusesBurned(\\n bytes32 node,\\n uint32 fuseMask\\n ) external view returns (bool);\\n\\n function isWrapped(bytes32) external view returns (bool);\\n\\n function isWrapped(bytes32, bytes32) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x18a49abb805da867f3a6f49e1b898ba5b6afe5ae3a4b8f90152c0687ccc68048\",\"license\":\"MIT\"},\"contracts/wrapper/INameWrapperUpgrade.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ninterface INameWrapperUpgrade {\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x42e0cec6cd9d1a62d51d45b678f69d3e4ad5555e659b197e41257b308346bb8a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50604051610bae380380610bae83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b610b1b806100936000396000f3fe6080604052600436106100595760003560e01c80636e0ce1f9116100435780636e0ce1f9146100c15780637ebd090d146100e157806393e818c5146100f657600080fd5b806223ce521461005e57806301ffc9a714610091575b600080fd5b34801561006a57600080fd5b5061007e61007936600461067e565b610109565b6040519081526020015b60405180910390f35b34801561009d57600080fd5b506100b16100ac3660046106db565b6101cd565b6040519015158152602001610088565b3480156100cd57600080fd5b5061007e6100dc3660046107c7565b610266565b6100f46100ef36600461067e565b61032d565b005b6100f461010436600461084b565b6104b9565b600083815b818110156101c357600080546001600160a01b0316636cfc51e289898581811061013a5761013a6108ec565b905060200281019061014c9190610902565b89896040518563ffffffff1660e01b815260040161016d9493929190610972565b6040805180830381865afa158015610189573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101ad919061099e565b602081015190510193909301925060010161010e565b5050949350505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061026057507fffffffff0000000000000000000000000000000000000000000000000000000082167f7e9ec75f00000000000000000000000000000000000000000000000000000000145b92915050565b600084815b8181101561032257600080546001600160a01b031663786d96a18a8a85818110610297576102976108ec565b90506020028101906102a99190610902565b8a8a8a6040518663ffffffff1660e01b81526004016102cc959493929190610a33565b6040805180830381865afa1580156102e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030c919061099e565b602081015190510193909301925060010161026b565b505095945050505050565b826000805b8281101561048357600080546001600160a01b0316636cfc51e289898581811061035e5761035e6108ec565b90506020028101906103709190610902565b89896040518563ffffffff1660e01b81526004016103919493929190610972565b6040805180830381865afa1580156103ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d1919061099e565b90506000816020015182600001516103e99190610a74565b6000549091506001600160a01b0316634be2b2ec828b8b87818110610410576104106108ec565b90506020028101906104229190610902565b8b8b6040518663ffffffff1660e01b81526004016104439493929190610972565b6000604051808303818588803b15801561045c57600080fd5b505af1158015610470573d6000803e3d6000fd5b5050509190940193505050600101610332565b5060405133904780156108fc02916000818181858888f193505050501580156104b0573d6000803e3d6000fd5b50505050505050565b846000805b8281101561061257600080546001600160a01b031663786d96a18b8b858181106104ea576104ea6108ec565b90506020028101906104fc9190610902565b8b8b8a6040518663ffffffff1660e01b815260040161051f959493929190610a33565b6040805180830381865afa15801561053b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055f919061099e565b90506000816020015182600001516105779190610a74565b6000549091506001600160a01b031663569f8ab38c8c8681811061059d5761059d6108ec565b90506020028101906105af9190610902565b8c8c8c8c6040518763ffffffff1660e01b81526004016105d496959493929190610a95565b600060405180830381600087803b1580156105ee57600080fd5b505af1158015610602573d6000803e3d6000fd5b50505093019250506001016104be565b505050505050505050565b60008083601f84011261062f57600080fd5b50813567ffffffffffffffff81111561064757600080fd5b6020830191508360208260051b850101111561066257600080fd5b9250929050565b8035801515811461067957600080fd5b919050565b6000806000806060858703121561069457600080fd5b843567ffffffffffffffff8111156106ab57600080fd5b6106b78782880161061d565b909550935050602085013591506106d060408601610669565b905092959194509250565b6000602082840312156106ed57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461071d57600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261074b57600080fd5b813567ffffffffffffffff8082111561076657610766610724565b604051601f8301601f19908116603f0116810190828211818310171561078e5761078e610724565b816040528381528660208588010111156107a757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806000608086880312156107df57600080fd5b853567ffffffffffffffff808211156107f757600080fd5b61080389838a0161061d565b909750955060208801359450604088013591508082111561082357600080fd5b506108308882890161073a565b92505061083f60608701610669565b90509295509295909350565b60008060008060008060a0878903121561086457600080fd5b863567ffffffffffffffff8082111561087c57600080fd5b6108888a838b0161061d565b90985096506020890135955060408901359150808211156108a857600080fd5b506108b589828a0161073a565b93505060608701356001600160a01b03811681146108d257600080fd5b91506108e060808801610669565b90509295509295509295565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261091957600080fd5b83018035915067ffffffffffffffff82111561093457600080fd5b60200191503681900382131561066257600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b606081526000610986606083018688610949565b60208301949094525090151560409091015292915050565b6000604082840312156109b057600080fd5b6040516040810181811067ffffffffffffffff821117156109d3576109d3610724565b604052825181526020928301519281019290925250919050565b6000815180845260005b81811015610a13576020818501810151868301820152016109f7565b506000602082860101526020601f19601f83011685010191505092915050565b608081526000610a47608083018789610949565b8560208401528281036040840152610a5f81866109ed565b91505082151560608301529695505050505050565b8082018082111561026057634e487b7160e01b600052601160045260246000fd5b60a081526000610aa960a08301888a610949565b8660208401528281036040840152610ac181876109ed565b6001600160a01b03959095166060840152505090151560809091015294935050505056fea2646970667358221220c19d145c9ef98b907e22743c754d7e3bcc2fd0cb54b1d76ca5554503dfbe1c4364736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106100595760003560e01c80636e0ce1f9116100435780636e0ce1f9146100c15780637ebd090d146100e157806393e818c5146100f657600080fd5b806223ce521461005e57806301ffc9a714610091575b600080fd5b34801561006a57600080fd5b5061007e61007936600461067e565b610109565b6040519081526020015b60405180910390f35b34801561009d57600080fd5b506100b16100ac3660046106db565b6101cd565b6040519015158152602001610088565b3480156100cd57600080fd5b5061007e6100dc3660046107c7565b610266565b6100f46100ef36600461067e565b61032d565b005b6100f461010436600461084b565b6104b9565b600083815b818110156101c357600080546001600160a01b0316636cfc51e289898581811061013a5761013a6108ec565b905060200281019061014c9190610902565b89896040518563ffffffff1660e01b815260040161016d9493929190610972565b6040805180830381865afa158015610189573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101ad919061099e565b602081015190510193909301925060010161010e565b5050949350505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061026057507fffffffff0000000000000000000000000000000000000000000000000000000082167f7e9ec75f00000000000000000000000000000000000000000000000000000000145b92915050565b600084815b8181101561032257600080546001600160a01b031663786d96a18a8a85818110610297576102976108ec565b90506020028101906102a99190610902565b8a8a8a6040518663ffffffff1660e01b81526004016102cc959493929190610a33565b6040805180830381865afa1580156102e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030c919061099e565b602081015190510193909301925060010161026b565b505095945050505050565b826000805b8281101561048357600080546001600160a01b0316636cfc51e289898581811061035e5761035e6108ec565b90506020028101906103709190610902565b89896040518563ffffffff1660e01b81526004016103919493929190610972565b6040805180830381865afa1580156103ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d1919061099e565b90506000816020015182600001516103e99190610a74565b6000549091506001600160a01b0316634be2b2ec828b8b87818110610410576104106108ec565b90506020028101906104229190610902565b8b8b6040518663ffffffff1660e01b81526004016104439493929190610972565b6000604051808303818588803b15801561045c57600080fd5b505af1158015610470573d6000803e3d6000fd5b5050509190940193505050600101610332565b5060405133904780156108fc02916000818181858888f193505050501580156104b0573d6000803e3d6000fd5b50505050505050565b846000805b8281101561061257600080546001600160a01b031663786d96a18b8b858181106104ea576104ea6108ec565b90506020028101906104fc9190610902565b8b8b8a6040518663ffffffff1660e01b815260040161051f959493929190610a33565b6040805180830381865afa15801561053b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055f919061099e565b90506000816020015182600001516105779190610a74565b6000549091506001600160a01b031663569f8ab38c8c8681811061059d5761059d6108ec565b90506020028101906105af9190610902565b8c8c8c8c6040518763ffffffff1660e01b81526004016105d496959493929190610a95565b600060405180830381600087803b1580156105ee57600080fd5b505af1158015610602573d6000803e3d6000fd5b50505093019250506001016104be565b505050505050505050565b60008083601f84011261062f57600080fd5b50813567ffffffffffffffff81111561064757600080fd5b6020830191508360208260051b850101111561066257600080fd5b9250929050565b8035801515811461067957600080fd5b919050565b6000806000806060858703121561069457600080fd5b843567ffffffffffffffff8111156106ab57600080fd5b6106b78782880161061d565b909550935050602085013591506106d060408601610669565b905092959194509250565b6000602082840312156106ed57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461071d57600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261074b57600080fd5b813567ffffffffffffffff8082111561076657610766610724565b604051601f8301601f19908116603f0116810190828211818310171561078e5761078e610724565b816040528381528660208588010111156107a757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806000608086880312156107df57600080fd5b853567ffffffffffffffff808211156107f757600080fd5b61080389838a0161061d565b909750955060208801359450604088013591508082111561082357600080fd5b506108308882890161073a565b92505061083f60608701610669565b90509295509295909350565b60008060008060008060a0878903121561086457600080fd5b863567ffffffffffffffff8082111561087c57600080fd5b6108888a838b0161061d565b90985096506020890135955060408901359150808211156108a857600080fd5b506108b589828a0161073a565b93505060608701356001600160a01b03811681146108d257600080fd5b91506108e060808801610669565b90509295509295509295565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261091957600080fd5b83018035915067ffffffffffffffff82111561093457600080fd5b60200191503681900382131561066257600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b606081526000610986606083018688610949565b60208301949094525090151560409091015292915050565b6000604082840312156109b057600080fd5b6040516040810181811067ffffffffffffffff821117156109d3576109d3610724565b604052825181526020928301519281019290925250919050565b6000815180845260005b81811015610a13576020818501810151868301820152016109f7565b506000602082860101526020601f19601f83011685010191505092915050565b608081526000610a47608083018789610949565b8560208401528281036040840152610a5f81866109ed565b91505082151560608301529695505050505050565b8082018082111561026057634e487b7160e01b600052601160045260246000fd5b60a081526000610aa960a08301888a610949565b8660208401528281036040840152610ac181876109ed565b6001600160a01b03959095166060840152505090151560809091015294935050505056fea2646970667358221220c19d145c9ef98b907e22743c754d7e3bcc2fd0cb54b1d76ca5554503dfbe1c4364736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 8780, + "contract": "contracts/ethregistrar/StaticBulkRenewal.sol:StaticBulkRenewal", + "label": "controller", + "offset": 0, + "slot": "0", + "type": "t_contract(ETHRegistrarController)6283" + } + ], + "types": { + "t_contract(ETHRegistrarController)6283": { + "encoding": "inplace", + "label": "contract ETHRegistrarController", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/StaticMetadataService.json b/solidity/dns-contracts/deployments/testnet/StaticMetadataService.json new file mode 100644 index 0000000..df7c4a0 --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/StaticMetadataService.json @@ -0,0 +1,88 @@ +{ + "address": "0x96aC152E90C70A2A09D806c8DCE716798BAFa683", + "abi": [ + { + "inputs": [ + { + "internalType": "string", + "name": "_metaDataUri", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "uri", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x535b273873370c10fa5ad48b3442b991add4202c0f487b124afecb83a1178491", + "receipt": { + "to": null, + "from": "0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B", + "contractAddress": "0x96aC152E90C70A2A09D806c8DCE716798BAFa683", + "transactionIndex": 2, + "gasUsed": "233826", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x4920180110375733397a85ccdd972e6f04e3cda0cc2a765a658e9c063b3b92bc", + "transactionHash": "0x535b273873370c10fa5ad48b3442b991add4202c0f487b124afecb83a1178491", + "logs": [], + "blockNumber": 57534975, + "cumulativeGasUsed": "559022", + "status": 1, + "byzantium": true + }, + "args": [ + "ens-metadata-service.appspot.com/name/0x{id}" + ], + "numDeployments": 1, + "solcInputHash": "7ef7523a40dd1de60e38563e79c7448b", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_metaDataUri\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/wrapper/StaticMetadataService.sol\":\"StaticMetadataService\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"contracts/wrapper/StaticMetadataService.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\ncontract StaticMetadataService {\\n string private _uri;\\n\\n constructor(string memory _metaDataUri) {\\n _uri = _metaDataUri;\\n }\\n\\n function uri(uint256) public view returns (string memory) {\\n return _uri;\\n }\\n}\\n\",\"keccak256\":\"0x28aad4cb829118de64965e06af8e785e6b2efa5207859d2efc63e404c26cfea3\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161045538038061045583398101604081905261002f91610058565b600061003b82826101aa565b5050610269565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561006b57600080fd5b82516001600160401b038082111561008257600080fd5b818501915085601f83011261009657600080fd5b8151818111156100a8576100a8610042565b604051601f8201601f19908116603f011681019083821181831017156100d0576100d0610042565b8160405282815288868487010111156100e857600080fd5b600093505b8284101561010a57848401860151818501870152928501926100ed565b600086848301015280965050505050505092915050565b600181811c9082168061013557607f821691505b60208210810361015557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156101a557600081815260208120601f850160051c810160208610156101825750805b601f850160051c820191505b818110156101a15782815560010161018e565b5050505b505050565b81516001600160401b038111156101c3576101c3610042565b6101d7816101d18454610121565b8461015b565b602080601f83116001811461020c57600084156101f45750858301515b600019600386901b1c1916600185901b1785556101a1565b600085815260208120601f198616915b8281101561023b5788860151825594840194600190910190840161021c565b50858210156102595787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6101dd806102786000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80630e89341c14610030575b600080fd5b61004361003e3660046100ed565b610059565b6040516100509190610106565b60405180910390f35b60606000805461006890610154565b80601f016020809104026020016040519081016040528092919081815260200182805461009490610154565b80156100e15780601f106100b6576101008083540402835291602001916100e1565b820191906000526020600020905b8154815290600101906020018083116100c457829003601f168201915b50505050509050919050565b6000602082840312156100ff57600080fd5b5035919050565b600060208083528351808285015260005b8181101561013357858101830151858201604001528201610117565b506000604082860101526040601f19601f8301168501019250505092915050565b600181811c9082168061016857607f821691505b6020821081036101a1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea2646970667358221220dee5977a2693f04a6202db215bcb6c19eee7b94993ae966733d3658597220ef964736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80630e89341c14610030575b600080fd5b61004361003e3660046100ed565b610059565b6040516100509190610106565b60405180910390f35b60606000805461006890610154565b80601f016020809104026020016040519081016040528092919081815260200182805461009490610154565b80156100e15780601f106100b6576101008083540402835291602001916100e1565b820191906000526020600020905b8154815290600101906020018083116100c457829003601f168201915b50505050509050919050565b6000602082840312156100ff57600080fd5b5035919050565b600060208083528351808285015260005b8181101561013357858101830151858201604001528201610117565b506000604082860101526040601f19601f8301168501019250505092915050565b600181811c9082168061016857607f821691505b6020821081036101a1577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b5091905056fea2646970667358221220dee5977a2693f04a6202db215bcb6c19eee7b94993ae966733d3658597220ef964736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 25529, + "contract": "contracts/wrapper/StaticMetadataService.sol:StaticMetadataService", + "label": "_uri", + "offset": 0, + "slot": "0", + "type": "t_string_storage" + } + ], + "types": { + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/TestUnwrap.json b/solidity/dns-contracts/deployments/testnet/TestUnwrap.json new file mode 100644 index 0000000..91fd9e7 --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/TestUnwrap.json @@ -0,0 +1,349 @@ +{ + "address": "0x961dAD75BcDA33b4A845A30aE12BE54c6366e95C", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ENS", + "name": "_ens", + "type": "address" + }, + { + "internalType": "contract IBaseRegistrar", + "name": "_registrar", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "approvedWrapper", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ens", + "outputs": [ + { + "internalType": "contract ENS", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "registrar", + "outputs": [ + { + "internalType": "contract IBaseRegistrar", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "newOwner", + "type": "address" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + }, + { + "internalType": "uint64", + "name": "ttl", + "type": "uint64" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + } + ], + "name": "setSubnodeRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "wrapper", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setWrapperApproval", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + }, + { + "internalType": "address", + "name": "resolver", + "type": "address" + } + ], + "name": "wrapETH2LD", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "internalType": "address", + "name": "wrappedOwner", + "type": "address" + }, + { + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "expiry", + "type": "uint64" + }, + { + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "name": "wrapFromUpgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xa03e4d5dd579aa54da108a6324bdc02360818d4283939b157c34bb6819a1902a", + "receipt": { + "to": null, + "from": "0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B", + "contractAddress": "0x961dAD75BcDA33b4A845A30aE12BE54c6366e95C", + "transactionIndex": 1, + "gasUsed": "970669", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000001000000000000400000000000000000000000020000000000000000000800000000000000000000000000000000400000000000010000000000000000100000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000010000000000000000000000000000000000000000000000000000", + "blockHash": "0x8f9ea788c195925d005a825c8511c2c7c9b524556219b491811c4972508a6868", + "transactionHash": "0xa03e4d5dd579aa54da108a6324bdc02360818d4283939b157c34bb6819a1902a", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 57535025, + "transactionHash": "0xa03e4d5dd579aa54da108a6324bdc02360818d4283939b157c34bb6819a1902a", + "address": "0x961dAD75BcDA33b4A845A30aE12BE54c6366e95C", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000002a0d7311fa7e9ac2890cfd8219b2def0c206e79b" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x8f9ea788c195925d005a825c8511c2c7c9b524556219b491811c4972508a6868" + } + ], + "blockNumber": 57535025, + "cumulativeGasUsed": "991669", + "status": 1, + "byzantium": true + }, + "args": [ + "0x8390D472587cCAe988dD06Ccd456Ac70CcF39038", + "0x0393da9525982Be4C8b9812f8D2A877796fCA90b" + ], + "numDeployments": 1, + "solcInputHash": "c311c3de46948b5831b922985c265742", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ENS\",\"name\":\"_ens\",\"type\":\"address\"},{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"_registrar\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"approvedWrapper\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ens\",\"outputs\":[{\"internalType\":\"contract ENS\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"registrar\",\"outputs\":[{\"internalType\":\"contract IBaseRegistrar\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"parentNode\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"ttl\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"}],\"name\":\"setSubnodeRecord\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"wrapper\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setWrapperApproval\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"label\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"resolver\",\"type\":\"address\"}],\"name\":\"wrapETH2LD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"wrappedOwner\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"fuses\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"expiry\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"wrapFromUpgrade\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/wrapper/mocks/TestUnwrap.sol\":\"TestUnwrap\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x5bce51e11f7d194b79ea59fe00c9e8de9fa2c5530124960f29a24d4c740a3266\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/ethregistrar/IBaseRegistrar.sol\":{\"content\":\"import \\\"../registry/ENS.sol\\\";\\nimport \\\"./IBaseRegistrar.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\ninterface IBaseRegistrar is IERC721 {\\n event ControllerAdded(address indexed controller);\\n event ControllerRemoved(address indexed controller);\\n event NameMigrated(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRegistered(\\n uint256 indexed id,\\n address indexed owner,\\n uint256 expires\\n );\\n event NameRenewed(uint256 indexed id, uint256 expires);\\n\\n // Authorises a controller, who can register and renew domains.\\n function addController(address controller) external;\\n\\n // Revoke controller permission for an address.\\n function removeController(address controller) external;\\n\\n // Set the resolver for the TLD this registrar manages.\\n function setResolver(address resolver) external;\\n\\n // Returns the expiration timestamp of the specified label hash.\\n function nameExpires(uint256 id) external view returns (uint256);\\n\\n // Returns true if the specified name is available for registration.\\n function available(uint256 id) external view returns (bool);\\n\\n /**\\n * @dev Register a name.\\n */\\n function register(\\n uint256 id,\\n address owner,\\n uint256 duration\\n ) external returns (uint256);\\n\\n function renew(uint256 id, uint256 duration) external returns (uint256);\\n\\n /**\\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\\n */\\n function reclaim(uint256 id, address owner) external;\\n}\\n\",\"keccak256\":\"0x15f7b1dfa7cd34444daf79ec9b4d40437caa9257893ce0639d706fcc2ba69e52\"},\"contracts/registry/ENS.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4;\\n\\ninterface ENS {\\n // Logged when the owner of a node assigns a new owner to a subnode.\\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\\n\\n // Logged when the owner of a node transfers ownership to a new account.\\n event Transfer(bytes32 indexed node, address owner);\\n\\n // Logged when the resolver for a node changes.\\n event NewResolver(bytes32 indexed node, address resolver);\\n\\n // Logged when the TTL of a node changes\\n event NewTTL(bytes32 indexed node, uint64 ttl);\\n\\n // Logged when an operator is added or removed.\\n event ApprovalForAll(\\n address indexed owner,\\n address indexed operator,\\n bool approved\\n );\\n\\n function setRecord(\\n bytes32 node,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeRecord(\\n bytes32 node,\\n bytes32 label,\\n address owner,\\n address resolver,\\n uint64 ttl\\n ) external;\\n\\n function setSubnodeOwner(\\n bytes32 node,\\n bytes32 label,\\n address owner\\n ) external returns (bytes32);\\n\\n function setResolver(bytes32 node, address resolver) external;\\n\\n function setOwner(bytes32 node, address owner) external;\\n\\n function setTTL(bytes32 node, uint64 ttl) external;\\n\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n function owner(bytes32 node) external view returns (address);\\n\\n function resolver(bytes32 node) external view returns (address);\\n\\n function ttl(bytes32 node) external view returns (uint64);\\n\\n function recordExists(bytes32 node) external view returns (bool);\\n\\n function isApprovedForAll(\\n address owner,\\n address operator\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x8e208b44d5dbf22552fe72d79b45c640855b84fbc9ee21f4c3bb4bfe81cbe8db\",\"license\":\"MIT\"},\"contracts/utils/BytesUtils.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\nlibrary BytesUtils {\\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\\n\\n /*\\n * @dev Returns the keccak-256 hash of a byte range.\\n * @param self The byte string to hash.\\n * @param offset The position to start hashing at.\\n * @param len The number of bytes to hash.\\n * @return The hash of the byte range.\\n */\\n function keccak(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(offset + len <= self.length);\\n assembly {\\n ret := keccak256(add(add(self, 32), offset), len)\\n }\\n }\\n\\n /**\\n * @dev Returns the ENS namehash of a DNS-encoded name.\\n * @param self The DNS-encoded name to hash.\\n * @param offset The offset at which to start hashing.\\n * @return The namehash of the name.\\n */\\n function namehash(\\n bytes memory self,\\n uint256 offset\\n ) internal pure returns (bytes32) {\\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\\n if (labelhash == bytes32(0)) {\\n require(offset == self.length - 1, \\\"namehash: Junk at end of name\\\");\\n return bytes32(0);\\n }\\n return\\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\\n }\\n\\n /**\\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\\n * @param self The byte string to read a label from.\\n * @param idx The index to read a label at.\\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\\n * @return newIdx The index of the start of the next label.\\n */\\n function readLabel(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\\n require(idx < self.length, \\\"readLabel: Index out of bounds\\\");\\n uint256 len = uint256(uint8(self[idx]));\\n if (len > 0) {\\n labelhash = keccak(self, idx + 1, len);\\n } else {\\n labelhash = bytes32(0);\\n }\\n newIdx = idx + len + 1;\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal.\\n * @param self The first bytes to compare.\\n * @param other The second bytes to compare.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (int256) {\\n return compare(self, 0, self.length, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns a positive number if `other` comes lexicographically after\\n * `self`, a negative number if it comes before, or zero if the\\n * contents of the two bytes are equal. Comparison is done per-rune,\\n * on unicode codepoints.\\n * @param self The first bytes to compare.\\n * @param offset The offset of self.\\n * @param len The length of self.\\n * @param other The second bytes to compare.\\n * @param otheroffset The offset of the other string.\\n * @param otherlen The length of the other string.\\n * @return The result of the comparison.\\n */\\n function compare(\\n bytes memory self,\\n uint256 offset,\\n uint256 len,\\n bytes memory other,\\n uint256 otheroffset,\\n uint256 otherlen\\n ) internal pure returns (int256) {\\n if (offset + len > self.length) {\\n revert OffsetOutOfBoundsError(offset + len, self.length);\\n }\\n if (otheroffset + otherlen > other.length) {\\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\\n }\\n\\n uint256 shortest = len;\\n if (otherlen < len) shortest = otherlen;\\n\\n uint256 selfptr;\\n uint256 otherptr;\\n\\n assembly {\\n selfptr := add(self, add(offset, 32))\\n otherptr := add(other, add(otheroffset, 32))\\n }\\n for (uint256 idx = 0; idx < shortest; idx += 32) {\\n uint256 a;\\n uint256 b;\\n assembly {\\n a := mload(selfptr)\\n b := mload(otherptr)\\n }\\n if (a != b) {\\n // Mask out irrelevant bytes and check again\\n uint256 mask;\\n if (shortest - idx >= 32) {\\n mask = type(uint256).max;\\n } else {\\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\\n }\\n int256 diff = int256(a & mask) - int256(b & mask);\\n if (diff != 0) return diff;\\n }\\n selfptr += 32;\\n otherptr += 32;\\n }\\n\\n return int256(len) - int256(otherlen);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @param len The number of bytes to compare\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset,\\n uint256 len\\n ) internal pure returns (bool) {\\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal with offsets.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @param otherOffset The offset into the second byte range.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other,\\n uint256 otherOffset\\n ) internal pure returns (bool) {\\n return\\n keccak(self, offset, self.length - offset) ==\\n keccak(other, otherOffset, other.length - otherOffset);\\n }\\n\\n /*\\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\\n * they are equal.\\n * @param self The first byte range to compare.\\n * @param offset The offset into the first byte range.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n uint256 offset,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == offset + other.length &&\\n equals(self, offset, other, 0, other.length);\\n }\\n\\n /*\\n * @dev Returns true if the two byte ranges are equal.\\n * @param self The first byte range to compare.\\n * @param other The second byte range to compare.\\n * @return True if the byte ranges are equal, false otherwise.\\n */\\n function equals(\\n bytes memory self,\\n bytes memory other\\n ) internal pure returns (bool) {\\n return\\n self.length == other.length &&\\n equals(self, 0, other, 0, self.length);\\n }\\n\\n /*\\n * @dev Returns the 8-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 8 bits of the string, interpreted as an integer.\\n */\\n function readUint8(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint8 ret) {\\n return uint8(self[idx]);\\n }\\n\\n /*\\n * @dev Returns the 16-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 16 bits of the string, interpreted as an integer.\\n */\\n function readUint16(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint16 ret) {\\n require(idx + 2 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32-bit number at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bits of the string, interpreted as an integer.\\n */\\n function readUint32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (uint32 ret) {\\n require(idx + 4 <= self.length);\\n assembly {\\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes32(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes32 ret) {\\n require(idx + 32 <= self.length);\\n assembly {\\n ret := mload(add(add(self, 32), idx))\\n }\\n }\\n\\n /*\\n * @dev Returns the 32 byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytes20(\\n bytes memory self,\\n uint256 idx\\n ) internal pure returns (bytes20 ret) {\\n require(idx + 20 <= self.length);\\n assembly {\\n ret := and(\\n mload(add(add(self, 32), idx)),\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\\n )\\n }\\n }\\n\\n /*\\n * @dev Returns the n byte value at the specified index of self.\\n * @param self The byte string.\\n * @param idx The index into the bytes.\\n * @param len The number of bytes.\\n * @return The specified 32 bytes of the string.\\n */\\n function readBytesN(\\n bytes memory self,\\n uint256 idx,\\n uint256 len\\n ) internal pure returns (bytes32 ret) {\\n require(len <= 32);\\n require(idx + len <= self.length);\\n assembly {\\n let mask := not(sub(exp(256, sub(32, len)), 1))\\n ret := and(mload(add(add(self, 32), idx)), mask)\\n }\\n }\\n\\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\\n // Copy word-length chunks while possible\\n for (; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n // Copy remaining bytes\\n unchecked {\\n uint256 mask = (256 ** (32 - len)) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n }\\n\\n /*\\n * @dev Copies a substring into a new byte string.\\n * @param self The byte string to copy from.\\n * @param offset The offset to start copying at.\\n * @param len The number of bytes to copy.\\n */\\n function substring(\\n bytes memory self,\\n uint256 offset,\\n uint256 len\\n ) internal pure returns (bytes memory) {\\n require(offset + len <= self.length);\\n\\n bytes memory ret = new bytes(len);\\n uint256 dest;\\n uint256 src;\\n\\n assembly {\\n dest := add(ret, 32)\\n src := add(add(self, 32), offset)\\n }\\n memcpy(dest, src, len);\\n\\n return ret;\\n }\\n\\n // Maps characters from 0x30 to 0x7A to their base32 values.\\n // 0xFF represents invalid characters in that range.\\n bytes constant base32HexTable =\\n hex\\\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\\\";\\n\\n /**\\n * @dev Decodes unpadded base32 data of up to one word in length.\\n * @param self The data to decode.\\n * @param off Offset into the string to start at.\\n * @param len Number of characters to decode.\\n * @return The decoded data, left aligned.\\n */\\n function base32HexDecodeWord(\\n bytes memory self,\\n uint256 off,\\n uint256 len\\n ) internal pure returns (bytes32) {\\n require(len <= 52);\\n\\n uint256 ret = 0;\\n uint8 decoded;\\n for (uint256 i = 0; i < len; i++) {\\n bytes1 char = self[off + i];\\n require(char >= 0x30 && char <= 0x7A);\\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\\n require(decoded <= 0x20);\\n if (i == len - 1) {\\n break;\\n }\\n ret = (ret << 5) | decoded;\\n }\\n\\n uint256 bitlen = len * 5;\\n if (len % 8 == 0) {\\n // Multiple of 8 characters, no padding\\n ret = (ret << 5) | decoded;\\n } else if (len % 8 == 2) {\\n // Two extra characters - 1 byte\\n ret = (ret << 3) | (decoded >> 2);\\n bitlen -= 2;\\n } else if (len % 8 == 4) {\\n // Four extra characters - 2 bytes\\n ret = (ret << 1) | (decoded >> 4);\\n bitlen -= 4;\\n } else if (len % 8 == 5) {\\n // Five extra characters - 3 bytes\\n ret = (ret << 4) | (decoded >> 1);\\n bitlen -= 1;\\n } else if (len % 8 == 7) {\\n // Seven extra characters - 4 bytes\\n ret = (ret << 2) | (decoded >> 3);\\n bitlen -= 3;\\n } else {\\n revert();\\n }\\n\\n return bytes32(ret << (256 - bitlen));\\n }\\n\\n /**\\n * @dev Finds the first occurrence of the byte `needle` in `self`.\\n * @param self The string to search\\n * @param off The offset to start searching at\\n * @param len The number of bytes to search\\n * @param needle The byte to search for\\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\\n */\\n function find(\\n bytes memory self,\\n uint256 off,\\n uint256 len,\\n bytes1 needle\\n ) internal pure returns (uint256) {\\n for (uint256 idx = off; idx < off + len; idx++) {\\n if (self[idx] == needle) {\\n return idx;\\n }\\n }\\n return type(uint256).max;\\n }\\n}\\n\",\"keccak256\":\"0xc566a3569af880a096a9bfb2fbb77060ef7aecde1a205dc26446a58877412060\",\"license\":\"MIT\"},\"contracts/wrapper/mocks/TestUnwrap.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\nimport \\\"../../registry/ENS.sol\\\";\\nimport \\\"../../ethregistrar/IBaseRegistrar.sol\\\";\\nimport {BytesUtils} from \\\"../../utils/BytesUtils.sol\\\";\\nimport {Ownable} from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\ncontract TestUnwrap is Ownable {\\n using BytesUtils for bytes;\\n\\n bytes32 private constant ETH_NODE =\\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\\n\\n ENS public immutable ens;\\n IBaseRegistrar public immutable registrar;\\n mapping(address => bool) public approvedWrapper;\\n\\n constructor(ENS _ens, IBaseRegistrar _registrar) {\\n ens = _ens;\\n registrar = _registrar;\\n }\\n\\n function setWrapperApproval(\\n address wrapper,\\n bool approved\\n ) public onlyOwner {\\n approvedWrapper[wrapper] = approved;\\n }\\n\\n function wrapETH2LD(\\n string calldata label,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address resolver\\n ) public {\\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\\n }\\n\\n function setSubnodeRecord(\\n bytes32 parentNode,\\n string memory label,\\n address newOwner,\\n address resolver,\\n uint64 ttl,\\n uint32 fuses,\\n uint64 expiry\\n ) public {\\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\\n _unwrapSubnode(node, newOwner, msg.sender);\\n }\\n\\n function wrapFromUpgrade(\\n bytes calldata name,\\n address wrappedOwner,\\n uint32 fuses,\\n uint64 expiry,\\n address approved,\\n bytes calldata extraData\\n ) public {\\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\\n bytes32 parentNode = name.namehash(offset);\\n bytes32 node = _makeNode(parentNode, labelhash);\\n\\n if (parentNode == ETH_NODE) {\\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\\n } else {\\n _unwrapSubnode(node, wrappedOwner, msg.sender);\\n }\\n }\\n\\n function _unwrapETH2LD(\\n bytes32 labelhash,\\n address wrappedOwner,\\n address sender\\n ) private {\\n uint256 tokenId = uint256(labelhash);\\n address registrant = registrar.ownerOf(tokenId);\\n\\n require(\\n approvedWrapper[sender] &&\\n sender == registrant &&\\n registrar.isApprovedForAll(registrant, address(this)),\\n \\\"Unauthorised\\\"\\n );\\n\\n registrar.reclaim(tokenId, wrappedOwner);\\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\\n }\\n\\n function _unwrapSubnode(\\n bytes32 node,\\n address newOwner,\\n address sender\\n ) private {\\n address owner = ens.owner(node);\\n\\n require(\\n approvedWrapper[sender] &&\\n owner == sender &&\\n ens.isApprovedForAll(owner, address(this)),\\n \\\"Unauthorised\\\"\\n );\\n\\n ens.setOwner(node, newOwner);\\n }\\n\\n function _makeNode(\\n bytes32 node,\\n bytes32 labelhash\\n ) private pure returns (bytes32) {\\n return keccak256(abi.encodePacked(node, labelhash));\\n }\\n}\\n\",\"keccak256\":\"0xe2db080d59ef3d76c43f0d1ee988b927d882cdf21aa24add279e8b57a1d693d8\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c060405234801561001057600080fd5b5060405161117238038061117283398101604081905261002f916100b7565b6100383361004f565b6001600160a01b039182166080521660a0526100f1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146100b457600080fd5b50565b600080604083850312156100ca57600080fd5b82516100d58161009f565b60208401519092506100e68161009f565b809150509250929050565b60805160a05161102c6101466000396000818160f0015281816108f1015281816109cc01528181610ac20152610b63015260008181610134015281816104b6015281816105910152610687015261102c6000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80638da5cb5b11610076578063c6d6d7c11161005b578063c6d6d7c114610182578063f2fde38b146101b5578063f9547a9e146101c857600080fd5b80638da5cb5b1461015e5780639198c2761461016f57600080fd5b80632b20e397116100a75780632b20e397146100eb5780633f15457f1461012f578063715018a61461015657600080fd5b80630cc17365146100c357806324c1af44146100d8575b600080fd5b6100d66100d1366004610c1f565b6101db565b005b6100d66100e6366004610c9a565b61020e565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6100d6610238565b6000546001600160a01b0316610112565b6100d661017d366004610df1565b61024c565b6101a5610190366004610eac565b60016020526000908152604090205460ff1681565b6040519015158152602001610126565b6100d66101c3366004610eac565b61033c565b6100d66101d6366004610ed0565b6103d1565b6101e36103fb565b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b6000610221888880519060200120610455565b905061022e818733610484565b5050505050505050565b6102406103fb565b61024a60006106df565b565b60008061029360008b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506107479050565b9150915060006102dc828c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506107fe9050565b905060006102ea8285610455565b90507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b5282016103235761031e848b336108bd565b61032e565b61032e818b33610484565b505050505050505050505050565b6103446103fb565b6001600160a01b0381166103c55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6103ce816106df565b50565b6103f386866040516103e4929190610f5a565b604051809103902085336108bd565b505050505050565b6000546001600160a01b0316331461024a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103bc565b604080516020808201859052818301849052825180830384018152606090920190925280519101205b92915050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018490526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610505573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105299190610f6a565b6001600160a01b03831660009081526001602052604090205490915060ff1680156105655750816001600160a01b0316816001600160a01b0316145b80156105fc575060405163e985e9c560e01b81526001600160a01b0382811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa1580156105d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fc9190610f87565b6106485760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f7269736564000000000000000000000000000000000000000060448201526064016103bc565b6040517f5b0fc9c3000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b0384811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b1580156106cb57600080fd5b505af115801561022e573d6000803e3d6000fd5b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000808351831061079a5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e6473000060448201526064016103bc565b60008484815181106107ae576107ae610fa4565b016020015160f81c905080156107da576107d3856107cd866001610fd0565b83610bc8565b92506107df565b600092505b6107e98185610fd0565b6107f4906001610fd0565b9150509250929050565b600080600061080d8585610747565b90925090508161087f57600185516108259190610fe3565b84146108735760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d6500000060448201526064016103bc565b506000915061047e9050565b61088985826107fe565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b6040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810184905283906000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015610940573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109649190610f6a565b6001600160a01b03841660009081526001602052604090205490915060ff1680156109a05750806001600160a01b0316836001600160a01b0316145b8015610a37575060405163e985e9c560e01b81526001600160a01b0382811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610a13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a379190610f87565b610a835760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f7269736564000000000000000000000000000000000000000060448201526064016103bc565b6040517f28ed4f6c000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b0385811660248301527f000000000000000000000000000000000000000000000000000000000000000016906328ed4f6c90604401600060405180830381600087803b158015610b0657600080fd5b505af1158015610b1a573d6000803e3d6000fd5b50506040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528781166024830152604482018690527f00000000000000000000000000000000000000000000000000000000000000001692506323b872dd9150606401600060405180830381600087803b158015610ba957600080fd5b505af1158015610bbd573d6000803e3d6000fd5b505050505050505050565b8251600090610bd78385610fd0565b1115610be257600080fd5b5091016020012090565b6001600160a01b03811681146103ce57600080fd5b8035610c0c81610bec565b919050565b80151581146103ce57600080fd5b60008060408385031215610c3257600080fd5b8235610c3d81610bec565b91506020830135610c4d81610c11565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b803567ffffffffffffffff81168114610c0c57600080fd5b803563ffffffff81168114610c0c57600080fd5b600080600080600080600060e0888a031215610cb557600080fd5b87359650602088013567ffffffffffffffff80821115610cd457600080fd5b818a0191508a601f830112610ce857600080fd5b813581811115610cfa57610cfa610c58565b604051601f8201601f19908116603f01168101908382118183101715610d2257610d22610c58565b816040528281528d6020848701011115610d3b57600080fd5b82602086016020830137600060208483010152809a505050505050610d6260408901610c01565b9450610d7060608901610c01565b9350610d7e60808901610c6e565b9250610d8c60a08901610c86565b9150610d9a60c08901610c6e565b905092959891949750929550565b60008083601f840112610dba57600080fd5b50813567ffffffffffffffff811115610dd257600080fd5b602083019150836020828501011115610dea57600080fd5b9250929050565b60008060008060008060008060c0898b031215610e0d57600080fd5b883567ffffffffffffffff80821115610e2557600080fd5b610e318c838d01610da8565b909a50985060208b01359150610e4682610bec565b819750610e5560408c01610c86565b9650610e6360608c01610c6e565b955060808b01359150610e7582610bec565b90935060a08a01359080821115610e8b57600080fd5b50610e988b828c01610da8565b999c989b5096995094979396929594505050565b600060208284031215610ebe57600080fd5b8135610ec981610bec565b9392505050565b60008060008060008060a08789031215610ee957600080fd5b863567ffffffffffffffff811115610f0057600080fd5b610f0c89828a01610da8565b9097509550506020870135610f2081610bec565b9350610f2e60408801610c86565b9250610f3c60608801610c6e565b91506080870135610f4c81610bec565b809150509295509295509295565b8183823760009101908152919050565b600060208284031215610f7c57600080fd5b8151610ec981610bec565b600060208284031215610f9957600080fd5b8151610ec981610c11565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561047e5761047e610fba565b8181038181111561047e5761047e610fba56fea2646970667358221220d01aed9c1990a6a8341e7a902e853b51577752c13b93b9da01e0c48c873d0e8264736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100be5760003560e01c80638da5cb5b11610076578063c6d6d7c11161005b578063c6d6d7c114610182578063f2fde38b146101b5578063f9547a9e146101c857600080fd5b80638da5cb5b1461015e5780639198c2761461016f57600080fd5b80632b20e397116100a75780632b20e397146100eb5780633f15457f1461012f578063715018a61461015657600080fd5b80630cc17365146100c357806324c1af44146100d8575b600080fd5b6100d66100d1366004610c1f565b6101db565b005b6100d66100e6366004610c9a565b61020e565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6100d6610238565b6000546001600160a01b0316610112565b6100d661017d366004610df1565b61024c565b6101a5610190366004610eac565b60016020526000908152604090205460ff1681565b6040519015158152602001610126565b6100d66101c3366004610eac565b61033c565b6100d66101d6366004610ed0565b6103d1565b6101e36103fb565b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b6000610221888880519060200120610455565b905061022e818733610484565b5050505050505050565b6102406103fb565b61024a60006106df565b565b60008061029360008b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506107479050565b9150915060006102dc828c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506107fe9050565b905060006102ea8285610455565b90507f6c32148f748aba23997146d7fe89e962e3cc30271290fb96f5f4337756c03b5282016103235761031e848b336108bd565b61032e565b61032e818b33610484565b505050505050505050505050565b6103446103fb565b6001600160a01b0381166103c55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6103ce816106df565b50565b6103f386866040516103e4929190610f5a565b604051809103902085336108bd565b505050505050565b6000546001600160a01b0316331461024a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103bc565b604080516020808201859052818301849052825180830384018152606090920190925280519101205b92915050565b6040517f02571be3000000000000000000000000000000000000000000000000000000008152600481018490526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906302571be390602401602060405180830381865afa158015610505573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105299190610f6a565b6001600160a01b03831660009081526001602052604090205490915060ff1680156105655750816001600160a01b0316816001600160a01b0316145b80156105fc575060405163e985e9c560e01b81526001600160a01b0382811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa1580156105d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fc9190610f87565b6106485760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f7269736564000000000000000000000000000000000000000060448201526064016103bc565b6040517f5b0fc9c3000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b0384811660248301527f00000000000000000000000000000000000000000000000000000000000000001690635b0fc9c390604401600060405180830381600087803b1580156106cb57600080fd5b505af115801561022e573d6000803e3d6000fd5b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000808351831061079a5760405162461bcd60e51b815260206004820152601e60248201527f726561644c6162656c3a20496e646578206f7574206f6620626f756e6473000060448201526064016103bc565b60008484815181106107ae576107ae610fa4565b016020015160f81c905080156107da576107d3856107cd866001610fd0565b83610bc8565b92506107df565b600092505b6107e98185610fd0565b6107f4906001610fd0565b9150509250929050565b600080600061080d8585610747565b90925090508161087f57600185516108259190610fe3565b84146108735760405162461bcd60e51b815260206004820152601d60248201527f6e616d65686173683a204a756e6b20617420656e64206f66206e616d6500000060448201526064016103bc565b506000915061047e9050565b61088985826107fe565b6040805160208101929092528101839052606001604051602081830303815290604052805190602001209250505092915050565b6040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810184905283906000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa158015610940573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109649190610f6a565b6001600160a01b03841660009081526001602052604090205490915060ff1680156109a05750806001600160a01b0316836001600160a01b0316145b8015610a37575060405163e985e9c560e01b81526001600160a01b0382811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063e985e9c590604401602060405180830381865afa158015610a13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a379190610f87565b610a835760405162461bcd60e51b815260206004820152600c60248201527f556e617574686f7269736564000000000000000000000000000000000000000060448201526064016103bc565b6040517f28ed4f6c000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b0385811660248301527f000000000000000000000000000000000000000000000000000000000000000016906328ed4f6c90604401600060405180830381600087803b158015610b0657600080fd5b505af1158015610b1a573d6000803e3d6000fd5b50506040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528781166024830152604482018690527f00000000000000000000000000000000000000000000000000000000000000001692506323b872dd9150606401600060405180830381600087803b158015610ba957600080fd5b505af1158015610bbd573d6000803e3d6000fd5b505050505050505050565b8251600090610bd78385610fd0565b1115610be257600080fd5b5091016020012090565b6001600160a01b03811681146103ce57600080fd5b8035610c0c81610bec565b919050565b80151581146103ce57600080fd5b60008060408385031215610c3257600080fd5b8235610c3d81610bec565b91506020830135610c4d81610c11565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b803567ffffffffffffffff81168114610c0c57600080fd5b803563ffffffff81168114610c0c57600080fd5b600080600080600080600060e0888a031215610cb557600080fd5b87359650602088013567ffffffffffffffff80821115610cd457600080fd5b818a0191508a601f830112610ce857600080fd5b813581811115610cfa57610cfa610c58565b604051601f8201601f19908116603f01168101908382118183101715610d2257610d22610c58565b816040528281528d6020848701011115610d3b57600080fd5b82602086016020830137600060208483010152809a505050505050610d6260408901610c01565b9450610d7060608901610c01565b9350610d7e60808901610c6e565b9250610d8c60a08901610c86565b9150610d9a60c08901610c6e565b905092959891949750929550565b60008083601f840112610dba57600080fd5b50813567ffffffffffffffff811115610dd257600080fd5b602083019150836020828501011115610dea57600080fd5b9250929050565b60008060008060008060008060c0898b031215610e0d57600080fd5b883567ffffffffffffffff80821115610e2557600080fd5b610e318c838d01610da8565b909a50985060208b01359150610e4682610bec565b819750610e5560408c01610c86565b9650610e6360608c01610c6e565b955060808b01359150610e7582610bec565b90935060a08a01359080821115610e8b57600080fd5b50610e988b828c01610da8565b999c989b5096995094979396929594505050565b600060208284031215610ebe57600080fd5b8135610ec981610bec565b9392505050565b60008060008060008060a08789031215610ee957600080fd5b863567ffffffffffffffff811115610f0057600080fd5b610f0c89828a01610da8565b9097509550506020870135610f2081610bec565b9350610f2e60408801610c86565b9250610f3c60608801610c6e565b91506080870135610f4c81610bec565b809150509295509295509295565b8183823760009101908152919050565b600060208284031215610f7c57600080fd5b8151610ec981610bec565b600060208284031215610f9957600080fd5b8151610ec981610c11565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561047e5761047e610fba565b8181038181111561047e5761047e610fba56fea2646970667358221220d01aed9c1990a6a8341e7a902e853b51577752c13b93b9da01e0c48c873d0e8264736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 474, + "contract": "contracts/wrapper/mocks/TestUnwrap.sol:TestUnwrap", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 21128, + "contract": "contracts/wrapper/mocks/TestUnwrap.sol:TestUnwrap", + "label": "approvedWrapper", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/TokenPriceOracle.json b/solidity/dns-contracts/deployments/testnet/TokenPriceOracle.json new file mode 100644 index 0000000..845d749 --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/TokenPriceOracle.json @@ -0,0 +1,390 @@ +{ + "address": "0xBc9aCd5592ac75cd4F2A83e97C736A2b1E22b466", + "abi": [ + { + "inputs": [ + { + "internalType": "contract AggregatorV3Interface", + "name": "_usdOracle", + "type": "address" + }, + { + "internalType": "contract AggregatorV3Interface", + "name": "_cakeOracle", + "type": "address" + }, + { + "internalType": "contract AggregatorV3Interface", + "name": "_usd1Oracle", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "_rentPrices", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "_startPremium", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalDays", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256[]", + "name": "prices", + "type": "uint256[]" + } + ], + "name": "RentPriceChanged", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "startPremium", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "elapsed", + "type": "uint256" + } + ], + "name": "decayedPremium", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "premium", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "lifetime", + "type": "bool" + } + ], + "name": "price", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "base", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "premium", + "type": "uint256" + } + ], + "internalType": "struct IPriceOracle.Price", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price1Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price2Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price3Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price4Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price5Letter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint256", + "name": "expires", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "string", + "name": "token", + "type": "string" + }, + { + "internalType": "bool", + "name": "lifetime", + "type": "bool" + } + ], + "name": "priceToken", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "base", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "premium", + "type": "uint256" + } + ], + "internalType": "struct IPriceOracle.Price", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xa6c80e8c5df27b9fd66cafcf00c18f100f8d634e0b8ee0841c8dda3334d356db", + "receipt": { + "to": null, + "from": "0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B", + "contractAddress": "0xBc9aCd5592ac75cd4F2A83e97C736A2b1E22b466", + "transactionIndex": 0, + "gasUsed": "1323172", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x69d9aa221be45a78c9c8dcae14c590a4d00cc5b16e54abe32790804ef517eeca", + "transactionHash": "0xa6c80e8c5df27b9fd66cafcf00c18f100f8d634e0b8ee0841c8dda3334d356db", + "logs": [], + "blockNumber": 57534967, + "cumulativeGasUsed": "1323172", + "status": 1, + "byzantium": true + }, + "args": [ + "0x2514895c72f50D8bd4B4F9b1110F0D6bD2c97526", + "0x81faeDDfeBc2F8Ac524327d70Cf913001732224C", + "0xEca2605f0BCF2BA5966372C99837b1F182d3D620", + [ + "0", + "3170979198377", + "1585489599188", + "792744799594", + "317097919838" + ], + "100000000000000000000000000", + "21" + ], + "numDeployments": 1, + "solcInputHash": "dcc6184d14b5e21d84340667ccb71894", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract AggregatorV3Interface\",\"name\":\"_usdOracle\",\"type\":\"address\"},{\"internalType\":\"contract AggregatorV3Interface\",\"name\":\"_cakeOracle\",\"type\":\"address\"},{\"internalType\":\"contract AggregatorV3Interface\",\"name\":\"_usd1Oracle\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"_rentPrices\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_startPremium\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalDays\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"prices\",\"type\":\"uint256[]\"}],\"name\":\"RentPriceChanged\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"startPremium\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"elapsed\",\"type\":\"uint256\"}],\"name\":\"decayedPremium\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"premium\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"lifetime\",\"type\":\"bool\"}],\"name\":\"price\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"base\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"}],\"internalType\":\"struct IPriceOracle.Price\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price1Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price2Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price3Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price4Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price5Letter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"expires\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"token\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"lifetime\",\"type\":\"bool\"}],\"name\":\"priceToken\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"base\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"premium\",\"type\":\"uint256\"}],\"internalType\":\"struct IPriceOracle.Price\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"decayedPremium(uint256,uint256)\":{\"details\":\"Returns the premium price at current time elapsed\",\"params\":{\"elapsed\":\"time past since expiry\",\"startPremium\":\"starting price\"}},\"premium(string,uint256,uint256)\":{\"details\":\"Returns the pricing premium in wei.\"},\"price(string,uint256,uint256,bool)\":{\"details\":\"Returns the price to register or renew a name.\",\"params\":{\"duration\":\"How long the name is being registered or extended for, in seconds.\",\"expires\":\"When the name presently expires (0 if this is a new registration).\",\"name\":\"The name being registered or renewed.\"},\"returns\":{\"_0\":\"base premium tuple of base price + premium price\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ethregistrar/TokenPriceOracle.sol\":\"TokenPriceOracle\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1200},\"remappings\":[]},\"sources\":{\"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\n// solhint-disable-next-line interface-starts-with-i\\ninterface AggregatorV3Interface {\\n function decimals() external view returns (uint8);\\n\\n function description() external view returns (string memory);\\n\\n function version() external view returns (uint256);\\n\\n function getRoundData(\\n uint80 _roundId\\n ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\\n\\n function latestRoundData()\\n external\\n view\\n returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\\n}\\n\",\"keccak256\":\"0x257a8d28fa83d3d942547c8e129ef465e4b5f3f31171e7be4739a4c98da6b4f0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/ethregistrar/ExponentialPremiumPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./StablePriceOracle.sol\\\";\\n\\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\\n uint256 constant GRACE_PERIOD = 90 days;\\n uint256 immutable startPremium;\\n uint256 immutable endValue;\\n\\n constructor(\\n AggregatorV3Interface _usdOracle,\\n uint256[] memory _rentPrices,\\n uint256 _startPremium,\\n uint256 totalDays\\n ) StablePriceOracle(_usdOracle, _rentPrices) {\\n startPremium = _startPremium;\\n endValue = _startPremium >> totalDays;\\n }\\n\\n uint256 constant PRECISION = 1e18;\\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\\n uint256 constant bit3 = 999957694548431104;\\n uint256 constant bit4 = 999915390886613504;\\n uint256 constant bit5 = 999830788931929088;\\n uint256 constant bit6 = 999661606496243712;\\n uint256 constant bit7 = 999323327502650752;\\n uint256 constant bit8 = 998647112890970240;\\n uint256 constant bit9 = 997296056085470080;\\n uint256 constant bit10 = 994599423483633152;\\n uint256 constant bit11 = 989228013193975424;\\n uint256 constant bit12 = 978572062087700096;\\n uint256 constant bit13 = 957603280698573696;\\n uint256 constant bit14 = 917004043204671232;\\n uint256 constant bit15 = 840896415253714560;\\n uint256 constant bit16 = 707106781186547584;\\n\\n /**\\n * @dev Returns the pricing premium in internal base units.\\n */\\n function _premium(\\n string memory,\\n uint256 expires,\\n uint256\\n ) internal view override returns (uint256) {\\n expires = expires + GRACE_PERIOD;\\n if (expires > block.timestamp) {\\n return 0;\\n }\\n\\n uint256 elapsed = block.timestamp - expires;\\n uint256 premium = decayedPremium(startPremium, elapsed);\\n if (premium >= endValue) {\\n return premium - endValue;\\n }\\n return 0;\\n }\\n\\n /**\\n * @dev Returns the premium price at current time elapsed\\n * @param startPremium starting price\\n * @param elapsed time past since expiry\\n */\\n function decayedPremium(\\n uint256 startPremium,\\n uint256 elapsed\\n ) public pure returns (uint256) {\\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\\n uint256 intDays = daysPast / PRECISION;\\n uint256 premium = startPremium >> intDays;\\n uint256 partDay = (daysPast - intDays * PRECISION);\\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\\n uint256 totalPremium = addFractionalPremium(fraction, premium);\\n return totalPremium;\\n }\\n\\n function addFractionalPremium(\\n uint256 fraction,\\n uint256 premium\\n ) internal pure returns (uint256) {\\n if (fraction & (1 << 0) != 0) {\\n premium = (premium * bit1) / PRECISION;\\n }\\n if (fraction & (1 << 1) != 0) {\\n premium = (premium * bit2) / PRECISION;\\n }\\n if (fraction & (1 << 2) != 0) {\\n premium = (premium * bit3) / PRECISION;\\n }\\n if (fraction & (1 << 3) != 0) {\\n premium = (premium * bit4) / PRECISION;\\n }\\n if (fraction & (1 << 4) != 0) {\\n premium = (premium * bit5) / PRECISION;\\n }\\n if (fraction & (1 << 5) != 0) {\\n premium = (premium * bit6) / PRECISION;\\n }\\n if (fraction & (1 << 6) != 0) {\\n premium = (premium * bit7) / PRECISION;\\n }\\n if (fraction & (1 << 7) != 0) {\\n premium = (premium * bit8) / PRECISION;\\n }\\n if (fraction & (1 << 8) != 0) {\\n premium = (premium * bit9) / PRECISION;\\n }\\n if (fraction & (1 << 9) != 0) {\\n premium = (premium * bit10) / PRECISION;\\n }\\n if (fraction & (1 << 10) != 0) {\\n premium = (premium * bit11) / PRECISION;\\n }\\n if (fraction & (1 << 11) != 0) {\\n premium = (premium * bit12) / PRECISION;\\n }\\n if (fraction & (1 << 12) != 0) {\\n premium = (premium * bit13) / PRECISION;\\n }\\n if (fraction & (1 << 13) != 0) {\\n premium = (premium * bit14) / PRECISION;\\n }\\n if (fraction & (1 << 14) != 0) {\\n premium = (premium * bit15) / PRECISION;\\n }\\n if (fraction & (1 << 15) != 0) {\\n premium = (premium * bit16) / PRECISION;\\n }\\n return premium;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual override returns (bool) {\\n return super.supportsInterface(interfaceID);\\n }\\n}\\n\",\"keccak256\":\"0xb1216535d04a6cb36d4a184c69755eb64a9e9890c94e83d4407a8f631ae6bfb5\",\"license\":\"MIT\"},\"contracts/ethregistrar/IPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.8.17 <0.9.0;\\n\\ninterface IPriceOracle {\\n struct Price {\\n uint256 base;\\n uint256 premium;\\n }\\n\\n /**\\n * @dev Returns the price to register or renew a name.\\n * @param name The name being registered or renewed.\\n * @param expires When the name presently expires (0 if this is a new registration).\\n * @param duration How long the name is being registered or extended for, in seconds.\\n * @return base premium tuple of base price + premium price\\n */\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration,\\n bool lifetime\\n ) external view returns (Price calldata);\\n}\\n\",\"keccak256\":\"0xc1f749d6238b0e77cc804153b2ce8fc2e082d28129e734839ccc2b2be7ee9d2b\",\"license\":\"MIT\"},\"contracts/ethregistrar/StablePriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./IPriceOracle.sol\\\";\\nimport \\\"../utils/StringUtils.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport {AggregatorV3Interface} from \\\"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\\\";\\n\\n\\n\\n// StablePriceOracle sets a price in USD, based on an oracle.\\ncontract StablePriceOracle is IPriceOracle {\\n using StringUtils for *;\\n AggregatorV3Interface internal usdOracle;\\n\\n // Rent in base price units by length\\n uint256 public immutable price1Letter;\\n uint256 public immutable price2Letter;\\n uint256 public immutable price3Letter;\\n uint256 public immutable price4Letter;\\n uint256 public immutable price5Letter;\\n\\n // Oracle address\\n\\n event RentPriceChanged(uint256[] prices);\\n\\n constructor(AggregatorV3Interface _usdOracle, uint256[] memory _rentPrices) {\\n usdOracle = _usdOracle;\\n price1Letter = _rentPrices[0];\\n price2Letter = _rentPrices[1];\\n price3Letter = _rentPrices[2];\\n price4Letter = _rentPrices[3];\\n price5Letter = _rentPrices[4];\\n }\\n\\n function price(\\n string calldata name,\\n uint256 expires,\\n uint256 duration,\\n bool lifetime\\n ) external view override returns (IPriceOracle.Price memory) {\\n uint256 len = name.strlen();\\n uint256 basePrice;\\n\\n if (len >= 5 && lifetime) {\\n basePrice = price5Letter * 31536000 * 4;\\n } else if (len == 4 && lifetime) {\\n basePrice = price4Letter * 31536000 * 4;\\n } else if (len == 3 && lifetime) {\\n basePrice = price3Letter * 31536000 * 6;\\n } else if (len == 2 && lifetime) {\\n basePrice = price2Letter * 31536000 * 10;\\n } else if (len == 1 && lifetime) {\\n basePrice = price1Letter * 31536000;\\n } else if (len >= 5 && lifetime == false) { \\n basePrice = price5Letter * duration;\\n } else if (len == 4 && lifetime == false) {\\n basePrice = price4Letter * duration;\\n } else if (len == 3 && lifetime == false) {\\n basePrice = price3Letter * duration;\\n } else if (len == 2 && lifetime == false) {\\n basePrice = price2Letter * duration;\\n } else {\\n basePrice = price1Letter * duration;\\n }\\n return\\n IPriceOracle.Price({\\n base: attoUSDToWei(basePrice),\\n premium: attoUSDToWei(_premium(name, expires, duration))\\n });\\n }\\n\\n /**\\n * @dev Returns the pricing premium in wei.\\n */\\n function premium(\\n string calldata name,\\n uint256 expires,\\n uint256 duration\\n ) external view returns (uint256) {\\n return attoUSDToWei(_premium(name, expires, duration));\\n }\\n\\n /**\\n * @dev Returns the pricing premium in internal base units.\\n */\\n function _premium(\\n string memory name,\\n uint256 expires,\\n uint256 duration\\n ) internal view virtual returns (uint256) {\\n return 0;\\n }\\n\\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\\n (, int256 ethPrice,,,) = usdOracle.latestRoundData();\\n return (amount * 1e8) / uint256(ethPrice);\\n }\\n\\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\\n (, int256 ethPrice,,,) = usdOracle.latestRoundData();\\n return (amount * uint256(ethPrice)) / 1e8;\\n }\\n\\n function supportsInterface(\\n bytes4 interfaceID\\n ) public view virtual returns (bool) {\\n return\\n interfaceID == type(IERC165).interfaceId ||\\n interfaceID == type(IPriceOracle).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0x54a747b1762c567f40f99603f147789dc03aab46eafb4e0eaac7340092cccea3\",\"license\":\"MIT\"},\"contracts/ethregistrar/TokenPriceOracle.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity ~0.8.17;\\n\\nimport \\\"./ExponentialPremiumPriceOracle.sol\\\";\\nimport {AggregatorV3Interface} from \\\"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\\\";\\n\\ncontract TokenPriceOracle is ExponentialPremiumPriceOracle {\\n AggregatorV3Interface internal cakeOracle;\\n AggregatorV3Interface internal usd1Oracle;\\n using StringUtils for *;\\n constructor(\\n AggregatorV3Interface _usdOracle,\\n AggregatorV3Interface _cakeOracle,\\n AggregatorV3Interface _usd1Oracle,\\n uint256[] memory _rentPrices,\\n uint256 _startPremium,\\n uint256 totalDays\\n )ExponentialPremiumPriceOracle(_usdOracle, _rentPrices, _startPremium, totalDays) {\\n usd1Oracle = _usd1Oracle;\\n cakeOracle = _cakeOracle;\\n }\\n\\n\\n function priceToken(\\n string calldata name,\\n uint256 expires,\\n uint256 duration,\\n string memory token,\\n bool lifetime\\n ) external view returns (IPriceOracle.Price memory) {\\n uint256 len = name.strlen();\\n uint256 basePrice;\\n\\n if (len >= 5 && lifetime) {\\n basePrice = price5Letter * 31536000 * 4;\\n } else if (len == 4 && lifetime) {\\n basePrice = price4Letter * 31536000 * 4;\\n } else if (len == 3 && lifetime) {\\n basePrice = price3Letter * 31536000 * 6;\\n } else if (len == 2 && lifetime) {\\n basePrice = price2Letter * 31536000 * 10;\\n } else if (len == 1 && lifetime) {\\n basePrice = price1Letter * 31536000;\\n } else if (len >= 5 && lifetime == false) { \\n basePrice = price5Letter * duration;\\n } else if (len == 4 && lifetime == false) {\\n basePrice = price4Letter * duration;\\n } else if (len == 3 && lifetime == false) {\\n basePrice = price3Letter * duration;\\n } else if (len == 2 && lifetime == false) {\\n basePrice = price2Letter * duration;\\n } else {\\n basePrice = price1Letter * duration;\\n }\\n if(keccak256(bytes(token)) == keccak256(bytes(\\\"cake\\\"))){\\n return\\n IPriceOracle.Price({\\n base: attoUSDToCake(basePrice),\\n premium: attoUSDToCake(_premium(name, expires, duration))\\n });\\n } else {\\n return\\n IPriceOracle.Price({\\n base: attoUSDToUSD1(basePrice),\\n premium: attoUSDToCake(_premium(name, expires, duration))\\n });\\n }\\n \\n }\\n function attoUSDToCake(uint256 amount) internal view returns (uint256) {\\n (, int256 cakePrice,,,) = cakeOracle.latestRoundData();\\n return (amount * 1e8) / uint256(cakePrice);\\n }\\n function attoUSDToUSD1(uint256 amount) internal view returns (uint256) {\\n (, int256 usd1Price,,,) = usd1Oracle.latestRoundData();\\n return (amount * 1e8) / uint256(usd1Price);\\n }\\n function attoCakeToUSD(uint256 amount) internal view returns (uint256) {\\n (, int256 cakePrice,,,) = cakeOracle.latestRoundData();\\n return (amount * uint256(cakePrice)) / 1e8;\\n }\\n function attoUSD1ToUSD(uint256 amount) internal view returns (uint256) {\\n (, int256 usd1Price,,,) = usd1Oracle.latestRoundData();\\n return (amount * uint256(usd1Price)) / 1e8;\\n }\\n\\n}\\n\",\"keccak256\":\"0x315a2173ce37b23b47f11600bd0ecf1407ba59a52db2c5ec628038bd8d75d4ca\",\"license\":\"MIT\"},\"contracts/utils/StringUtils.sol\":{\"content\":\"pragma solidity >=0.8.4;\\n\\nlibrary StringUtils {\\n /**\\n * @dev Returns the length of a given string\\n *\\n * @param s The string to measure the length of\\n * @return The length of the input string\\n */\\n function strlen(string memory s) internal pure returns (uint256) {\\n uint256 len;\\n uint256 i = 0;\\n uint256 bytelength = bytes(s).length;\\n for (len = 0; i < bytelength; len++) {\\n bytes1 b = bytes(s)[i];\\n if (b < 0x80) {\\n i += 1;\\n } else if (b < 0xE0) {\\n i += 2;\\n } else if (b < 0xF0) {\\n i += 3;\\n } else if (b < 0xF8) {\\n i += 4;\\n } else if (b < 0xFC) {\\n i += 5;\\n } else {\\n i += 6;\\n }\\n }\\n return len;\\n }\\n\\n /**\\n * @dev Escapes special characters in a given string\\n *\\n * @param str The string to escape\\n * @return The escaped string\\n */\\n function escape(string memory str) internal pure returns (string memory) {\\n bytes memory strBytes = bytes(str);\\n uint extraChars = 0;\\n\\n // count extra space needed for escaping\\n for (uint i = 0; i < strBytes.length; i++) {\\n if (_needsEscaping(strBytes[i])) {\\n extraChars++;\\n }\\n }\\n\\n // allocate buffer with the exact size needed\\n bytes memory buffer = new bytes(strBytes.length + extraChars);\\n uint index = 0;\\n\\n // escape characters\\n for (uint i = 0; i < strBytes.length; i++) {\\n if (_needsEscaping(strBytes[i])) {\\n buffer[index++] = \\\"\\\\\\\\\\\";\\n buffer[index++] = _getEscapedChar(strBytes[i]);\\n } else {\\n buffer[index++] = strBytes[i];\\n }\\n }\\n\\n return string(buffer);\\n }\\n\\n // determine if a character needs escaping\\n function _needsEscaping(bytes1 char) private pure returns (bool) {\\n return\\n char == '\\\"' ||\\n char == \\\"/\\\" ||\\n char == \\\"\\\\\\\\\\\" ||\\n char == \\\"\\\\n\\\" ||\\n char == \\\"\\\\r\\\" ||\\n char == \\\"\\\\t\\\";\\n }\\n\\n // get the escaped character\\n function _getEscapedChar(bytes1 char) private pure returns (bytes1) {\\n if (char == \\\"\\\\n\\\") return \\\"n\\\";\\n if (char == \\\"\\\\r\\\") return \\\"r\\\";\\n if (char == \\\"\\\\t\\\") return \\\"t\\\";\\n return char;\\n }\\n}\\n\",\"keccak256\":\"0xb3838963dcc378d8dde1bd03666ff4fc66c37909a5608950b6ef6eb78f9025c4\"}},\"version\":1}", + "bytecode": "0x6101606040523480156200001257600080fd5b506040516200195e3803806200195e833981016040819052620000359162000190565b600080546001600160a01b0319166001600160a01b0388161781558351879185918591859185918591829190620000705762000070620002a6565b60200260200101516080818152505080600181518110620000955762000095620002a6565b602002602001015160a0818152505080600281518110620000ba57620000ba620002a6565b602002602001015160c0818152505080600381518110620000df57620000df620002a6565b602002602001015160e0818152505080600481518110620001045762000104620002a6565b60209081029190910101516101005250506101208290521c610140525050600280546001600160a01b039586166001600160a01b031991821617909155600180549690951695169490941790925550620002bc92505050565b80516001600160a01b03811681146200017557600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60008060008060008060c08789031215620001aa57600080fd5b620001b5876200015d565b95506020620001c68189016200015d565b9550620001d6604089016200015d565b60608901519095506001600160401b0380821115620001f457600080fd5b818a0191508a601f8301126200020957600080fd5b8151818111156200021e576200021e6200017a565b8060051b604051601f19603f830116810181811085821117156200024657620002466200017a565b60405291825284820192508381018501918d8311156200026557600080fd5b938501935b8285101562000285578451845293850193928501926200026a565b8098505050505050506080870151915060a087015190509295509295509295565b634e487b7160e01b600052603260045260246000fd5b60805160a05160c05160e0516101005161012051610140516115b5620003a9600039600081816110ab01526110d50152600061108201526000818161012501528181610340015281816104ab01528181610713015261087e01526000818161020101528181610392015281816104e80152818161076501526108bb0152600081816101a0015281816103d201528181610525015281816107a501526108f80152600081816101da0152818161041d01528181610562015281816107f0015261093501526000818160f0015281816104680152818161058c0152818161083b015261095f01526115b56000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80638416a37411610076578063a34e35961161005b578063a34e3596146101c2578063cd5d2c74146101d5578063d820ed42146101fc57600080fd5b80638416a37414610188578063a200e1531461019b57600080fd5b806359b6b86c116100a757806359b6b86c1461012057806359e1777c146101475780638361401d1461015a57600080fd5b806301ffc9a7146100c35780632c0fd74c146100eb575b600080fd5b6100d66100d13660046111ef565b610223565b60405190151581526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b610112610155366004611231565b610234565b61016d6101683660046112c7565b6102cf565b604080518251815260209283015192810192909252016100e2565b61016d6101963660046113c5565b6106a2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101126101d036600461142c565b6109f8565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b600061022e82610a49565b92915050565b6000806201518061024d670de0b6b3a764000085611493565b61025791906114aa565b9050600061026d670de0b6b3a7640000836114aa565b905084811c6000610286670de0b6b3a764000084611493565b61029090856114cc565b90506000670de0b6b3a76400006102aa8362010000611493565b6102b491906114aa565b905060006102c28285610ae1565b9998505050505050505050565b6040805180820190915260008082526020820152600061032488888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610e0192505050565b90506000600582101580156103365750835b1561037b576103697f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b610374906004611493565b90506105b3565b8160041480156103885750835b156103bb576103697f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b8160031480156103c85750835b15610406576103fb7f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b610374906006611493565b8160021480156104135750835b15610451576104467f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b61037490600a611493565b81600114801561045e5750835b15610491576103747f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b600582101580156104a0575083155b156104cf57610374867f0000000000000000000000000000000000000000000000000000000000000000611493565b8160041480156104dd575083155b1561050c57610374867f0000000000000000000000000000000000000000000000000000000000000000611493565b81600314801561051a575083155b1561054957610374867f0000000000000000000000000000000000000000000000000000000000000000611493565b816002148015610557575083155b1561058657610374867f0000000000000000000000000000000000000000000000000000000000000000611493565b6105b0867f0000000000000000000000000000000000000000000000000000000000000000611493565b90505b60408051808201909152600481527f63616b65000000000000000000000000000000000000000000000000000000006020918201528551908601207fd638d242b45c8aba8055c7b1781a7b0ac9dabf4a46aaede0b3bc1daec8c68d630161068457604051806040016040528061062883610f90565b81526020016106786106738c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508e92508d915061104c9050565b610f90565b81525092505050610698565b60405180604001604052806106288361110f565b9695505050505050565b604080518082019091526000808252602082015260006106f787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610e0192505050565b90506000600582101580156107095750835b1561074e5761073c7f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b610747906004611493565b9050610986565b81600414801561075b5750835b1561078e5761073c7f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b81600314801561079b5750835b156107d9576107ce7f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b610747906006611493565b8160021480156107e65750835b15610824576108197f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b61074790600a611493565b8160011480156108315750835b15610864576107477f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b60058210158015610873575083155b156108a257610747857f0000000000000000000000000000000000000000000000000000000000000000611493565b8160041480156108b0575083155b156108df57610747857f0000000000000000000000000000000000000000000000000000000000000000611493565b8160031480156108ed575083155b1561091c57610747857f0000000000000000000000000000000000000000000000000000000000000000611493565b81600214801561092a575083155b1561095957610747857f0000000000000000000000000000000000000000000000000000000000000000611493565b610983857f0000000000000000000000000000000000000000000000000000000000000000611493565b90505b604051806040016040528061099a8361117f565b81526020016109ea6109e58b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d92508c915061104c9050565b61117f565b905298975050505050505050565b6000610a406109e586868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525088925087915061104c9050565b95945050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061022e57507fffffffff0000000000000000000000000000000000000000000000000000000082167f8416a374000000000000000000000000000000000000000000000000000000001492915050565b60006001831615610b1457670de0b6b3a7640000610b07670de0ad151d09418084611493565b610b1191906114aa565b91505b6002831615610b4557670de0b6b3a7640000610b38670de0a3769959680084611493565b610b4291906114aa565b91505b6004831615610b7657670de0b6b3a7640000610b69670de09039a5fa510084611493565b610b7391906114aa565b91505b6008831615610ba757670de0b6b3a7640000610b9a670de069c00f3e120084611493565b610ba491906114aa565b91505b6010831615610bd857670de0b6b3a7640000610bcb670de01cce21c9440084611493565b610bd591906114aa565b91505b6020831615610c0957670de0b6b3a7640000610bfc670ddf82ef46ce100084611493565b610c0691906114aa565b91505b6040831615610c3a57670de0b6b3a7640000610c2d670dde4f458f8e8d8084611493565b610c3791906114aa565b91505b6080831615610c6b57670de0b6b3a7640000610c5e670ddbe84213d5f08084611493565b610c6891906114aa565b91505b610100831615610c9d57670de0b6b3a7640000610c90670dd71b7aa6df5b8084611493565b610c9a91906114aa565b91505b610200831615610ccf57670de0b6b3a7640000610cc2670dcd86e7f28cde0084611493565b610ccc91906114aa565b91505b610400831615610d0157670de0b6b3a7640000610cf4670dba71a3084ad68084611493565b610cfe91906114aa565b91505b610800831615610d3357670de0b6b3a7640000610d26670d94961b13dbde8084611493565b610d3091906114aa565b91505b611000831615610d6557670de0b6b3a7640000610d58670d4a171c35c9838084611493565b610d6291906114aa565b91505b612000831615610d9757670de0b6b3a7640000610d8a670cb9da519ccfb70084611493565b610d9491906114aa565b91505b614000831615610dc957670de0b6b3a7640000610dbc670bab76d59c18d68084611493565b610dc691906114aa565b91505b618000831615610dfb57670de0b6b3a7640000610dee6709d025defee4df8084611493565b610df891906114aa565b91505b50919050565b8051600090819081905b80821015610f87576000858381518110610e2757610e276114df565b01602001516001600160f81b03191690507f8000000000000000000000000000000000000000000000000000000000000000811015610e7257610e6b6001846114f5565b9250610f74565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015610eaf57610e6b6002846114f5565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015610eec57610e6b6003846114f5565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015610f2957610e6b6004846114f5565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015610f6657610e6b6005846114f5565b610f716006846114f5565b92505b5082610f7f81611508565b935050610e0b565b50909392505050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015611000573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611024919061153b565b50505091505080836305f5e10061103b9190611493565b61104591906114aa565b9392505050565b600061105b6276a700846114f5565b92504283111561106d57506000611045565b600061107984426114cc565b905060006110a77f000000000000000000000000000000000000000000000000000000000000000083610234565b90507f00000000000000000000000000000000000000000000000000000000000000008110611103576110fa7f0000000000000000000000000000000000000000000000000000000000000000826114cc565b92505050611045565b50600095945050505050565b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015611000573d6000803e3d6000fd5b60008054604080517ffeaf968c0000000000000000000000000000000000000000000000000000000081529051839273ffffffffffffffffffffffffffffffffffffffff169163feaf968c9160048083019260a09291908290030181865afa158015611000573d6000803e3d6000fd5b60006020828403121561120157600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461104557600080fd5b6000806040838503121561124457600080fd5b50508035926020909101359150565b60008083601f84011261126557600080fd5b50813567ffffffffffffffff81111561127d57600080fd5b60208301915083602082850101111561129557600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b803580151581146112c257600080fd5b919050565b60008060008060008060a087890312156112e057600080fd5b863567ffffffffffffffff808211156112f857600080fd5b6113048a838b01611253565b90985096506020890135955060408901359450606089013591508082111561132b57600080fd5b818901915089601f83011261133f57600080fd5b8135818111156113515761135161129c565b604051601f8201601f19908116603f011681019083821181831017156113795761137961129c565b816040528281528c602084870101111561139257600080fd5b8260208601602083013760006020848301015280965050505050506113b9608088016112b2565b90509295509295509295565b6000806000806000608086880312156113dd57600080fd5b853567ffffffffffffffff8111156113f457600080fd5b61140088828901611253565b9096509450506020860135925060408601359150611420606087016112b2565b90509295509295909350565b6000806000806060858703121561144257600080fd5b843567ffffffffffffffff81111561145957600080fd5b61146587828801611253565b90989097506020870135966040013595509350505050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761022e5761022e61147d565b6000826114c757634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561022e5761022e61147d565b634e487b7160e01b600052603260045260246000fd5b8082018082111561022e5761022e61147d565b60006001820161151a5761151a61147d565b5060010190565b805169ffffffffffffffffffff811681146112c257600080fd5b600080600080600060a0868803121561155357600080fd5b61155c86611521565b94506020860151935060408601519250606086015191506114206080870161152156fea2646970667358221220c59b2b93d1c3efcc2b1294521ef120bb936737802dc500eb735c8e26d21176be64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100be5760003560e01c80638416a37411610076578063a34e35961161005b578063a34e3596146101c2578063cd5d2c74146101d5578063d820ed42146101fc57600080fd5b80638416a37414610188578063a200e1531461019b57600080fd5b806359b6b86c116100a757806359b6b86c1461012057806359e1777c146101475780638361401d1461015a57600080fd5b806301ffc9a7146100c35780632c0fd74c146100eb575b600080fd5b6100d66100d13660046111ef565b610223565b60405190151581526020015b60405180910390f35b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016100e2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b610112610155366004611231565b610234565b61016d6101683660046112c7565b6102cf565b604080518251815260209283015192810192909252016100e2565b61016d6101963660046113c5565b6106a2565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101126101d036600461142c565b6109f8565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b6101127f000000000000000000000000000000000000000000000000000000000000000081565b600061022e82610a49565b92915050565b6000806201518061024d670de0b6b3a764000085611493565b61025791906114aa565b9050600061026d670de0b6b3a7640000836114aa565b905084811c6000610286670de0b6b3a764000084611493565b61029090856114cc565b90506000670de0b6b3a76400006102aa8362010000611493565b6102b491906114aa565b905060006102c28285610ae1565b9998505050505050505050565b6040805180820190915260008082526020820152600061032488888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610e0192505050565b90506000600582101580156103365750835b1561037b576103697f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b610374906004611493565b90506105b3565b8160041480156103885750835b156103bb576103697f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b8160031480156103c85750835b15610406576103fb7f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b610374906006611493565b8160021480156104135750835b15610451576104467f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b61037490600a611493565b81600114801561045e5750835b15610491576103747f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b600582101580156104a0575083155b156104cf57610374867f0000000000000000000000000000000000000000000000000000000000000000611493565b8160041480156104dd575083155b1561050c57610374867f0000000000000000000000000000000000000000000000000000000000000000611493565b81600314801561051a575083155b1561054957610374867f0000000000000000000000000000000000000000000000000000000000000000611493565b816002148015610557575083155b1561058657610374867f0000000000000000000000000000000000000000000000000000000000000000611493565b6105b0867f0000000000000000000000000000000000000000000000000000000000000000611493565b90505b60408051808201909152600481527f63616b65000000000000000000000000000000000000000000000000000000006020918201528551908601207fd638d242b45c8aba8055c7b1781a7b0ac9dabf4a46aaede0b3bc1daec8c68d630161068457604051806040016040528061062883610f90565b81526020016106786106738c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508e92508d915061104c9050565b610f90565b81525092505050610698565b60405180604001604052806106288361110f565b9695505050505050565b604080518082019091526000808252602082015260006106f787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610e0192505050565b90506000600582101580156107095750835b1561074e5761073c7f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b610747906004611493565b9050610986565b81600414801561075b5750835b1561078e5761073c7f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b81600314801561079b5750835b156107d9576107ce7f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b610747906006611493565b8160021480156107e65750835b15610824576108197f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b61074790600a611493565b8160011480156108315750835b15610864576107477f00000000000000000000000000000000000000000000000000000000000000006301e13380611493565b60058210158015610873575083155b156108a257610747857f0000000000000000000000000000000000000000000000000000000000000000611493565b8160041480156108b0575083155b156108df57610747857f0000000000000000000000000000000000000000000000000000000000000000611493565b8160031480156108ed575083155b1561091c57610747857f0000000000000000000000000000000000000000000000000000000000000000611493565b81600214801561092a575083155b1561095957610747857f0000000000000000000000000000000000000000000000000000000000000000611493565b610983857f0000000000000000000000000000000000000000000000000000000000000000611493565b90505b604051806040016040528061099a8361117f565b81526020016109ea6109e58b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d92508c915061104c9050565b61117f565b905298975050505050505050565b6000610a406109e586868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525088925087915061104c9050565b95945050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061022e57507fffffffff0000000000000000000000000000000000000000000000000000000082167f8416a374000000000000000000000000000000000000000000000000000000001492915050565b60006001831615610b1457670de0b6b3a7640000610b07670de0ad151d09418084611493565b610b1191906114aa565b91505b6002831615610b4557670de0b6b3a7640000610b38670de0a3769959680084611493565b610b4291906114aa565b91505b6004831615610b7657670de0b6b3a7640000610b69670de09039a5fa510084611493565b610b7391906114aa565b91505b6008831615610ba757670de0b6b3a7640000610b9a670de069c00f3e120084611493565b610ba491906114aa565b91505b6010831615610bd857670de0b6b3a7640000610bcb670de01cce21c9440084611493565b610bd591906114aa565b91505b6020831615610c0957670de0b6b3a7640000610bfc670ddf82ef46ce100084611493565b610c0691906114aa565b91505b6040831615610c3a57670de0b6b3a7640000610c2d670dde4f458f8e8d8084611493565b610c3791906114aa565b91505b6080831615610c6b57670de0b6b3a7640000610c5e670ddbe84213d5f08084611493565b610c6891906114aa565b91505b610100831615610c9d57670de0b6b3a7640000610c90670dd71b7aa6df5b8084611493565b610c9a91906114aa565b91505b610200831615610ccf57670de0b6b3a7640000610cc2670dcd86e7f28cde0084611493565b610ccc91906114aa565b91505b610400831615610d0157670de0b6b3a7640000610cf4670dba71a3084ad68084611493565b610cfe91906114aa565b91505b610800831615610d3357670de0b6b3a7640000610d26670d94961b13dbde8084611493565b610d3091906114aa565b91505b611000831615610d6557670de0b6b3a7640000610d58670d4a171c35c9838084611493565b610d6291906114aa565b91505b612000831615610d9757670de0b6b3a7640000610d8a670cb9da519ccfb70084611493565b610d9491906114aa565b91505b614000831615610dc957670de0b6b3a7640000610dbc670bab76d59c18d68084611493565b610dc691906114aa565b91505b618000831615610dfb57670de0b6b3a7640000610dee6709d025defee4df8084611493565b610df891906114aa565b91505b50919050565b8051600090819081905b80821015610f87576000858381518110610e2757610e276114df565b01602001516001600160f81b03191690507f8000000000000000000000000000000000000000000000000000000000000000811015610e7257610e6b6001846114f5565b9250610f74565b7fe0000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015610eaf57610e6b6002846114f5565b7ff0000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015610eec57610e6b6003846114f5565b7ff8000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015610f2957610e6b6004846114f5565b7ffc000000000000000000000000000000000000000000000000000000000000006001600160f81b031982161015610f6657610e6b6005846114f5565b610f716006846114f5565b92505b5082610f7f81611508565b935050610e0b565b50909392505050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015611000573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611024919061153b565b50505091505080836305f5e10061103b9190611493565b61104591906114aa565b9392505050565b600061105b6276a700846114f5565b92504283111561106d57506000611045565b600061107984426114cc565b905060006110a77f000000000000000000000000000000000000000000000000000000000000000083610234565b90507f00000000000000000000000000000000000000000000000000000000000000008110611103576110fa7f0000000000000000000000000000000000000000000000000000000000000000826114cc565b92505050611045565b50600095945050505050565b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015611000573d6000803e3d6000fd5b60008054604080517ffeaf968c0000000000000000000000000000000000000000000000000000000081529051839273ffffffffffffffffffffffffffffffffffffffff169163feaf968c9160048083019260a09291908290030181865afa158015611000573d6000803e3d6000fd5b60006020828403121561120157600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461104557600080fd5b6000806040838503121561124457600080fd5b50508035926020909101359150565b60008083601f84011261126557600080fd5b50813567ffffffffffffffff81111561127d57600080fd5b60208301915083602082850101111561129557600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b803580151581146112c257600080fd5b919050565b60008060008060008060a087890312156112e057600080fd5b863567ffffffffffffffff808211156112f857600080fd5b6113048a838b01611253565b90985096506020890135955060408901359450606089013591508082111561132b57600080fd5b818901915089601f83011261133f57600080fd5b8135818111156113515761135161129c565b604051601f8201601f19908116603f011681019083821181831017156113795761137961129c565b816040528281528c602084870101111561139257600080fd5b8260208601602083013760006020848301015280965050505050506113b9608088016112b2565b90509295509295509295565b6000806000806000608086880312156113dd57600080fd5b853567ffffffffffffffff8111156113f457600080fd5b61140088828901611253565b9096509450506020860135925060408601359150611420606087016112b2565b90509295509295909350565b6000806000806060858703121561144257600080fd5b843567ffffffffffffffff81111561145957600080fd5b61146587828801611253565b90989097506020870135966040013595509350505050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761022e5761022e61147d565b6000826114c757634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561022e5761022e61147d565b634e487b7160e01b600052603260045260246000fd5b8082018082111561022e5761022e61147d565b60006001820161151a5761151a61147d565b5060010190565b805169ffffffffffffffffffff811681146112c257600080fd5b600080600080600060a0868803121561155357600080fd5b61155c86611521565b94506020860151935060408601519250606086015191506114206080870161152156fea2646970667358221220c59b2b93d1c3efcc2b1294521ef120bb936737802dc500eb735c8e26d21176be64736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "decayedPremium(uint256,uint256)": { + "details": "Returns the premium price at current time elapsed", + "params": { + "elapsed": "time past since expiry", + "startPremium": "starting price" + } + }, + "premium(string,uint256,uint256)": { + "details": "Returns the pricing premium in wei." + }, + "price(string,uint256,uint256,bool)": { + "details": "Returns the price to register or renew a name.", + "params": { + "duration": "How long the name is being registered or extended for, in seconds.", + "expires": "When the name presently expires (0 if this is a new registration).", + "name": "The name being registered or renewed." + }, + "returns": { + "_0": "base premium tuple of base price + premium price" + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 6514, + "contract": "contracts/ethregistrar/TokenPriceOracle.sol:TokenPriceOracle", + "label": "usdOracle", + "offset": 0, + "slot": "0", + "type": "t_contract(AggregatorV3Interface)45" + }, + { + "astId": 7185, + "contract": "contracts/ethregistrar/TokenPriceOracle.sol:TokenPriceOracle", + "label": "cakeOracle", + "offset": 0, + "slot": "1", + "type": "t_contract(AggregatorV3Interface)45" + }, + { + "astId": 7188, + "contract": "contracts/ethregistrar/TokenPriceOracle.sol:TokenPriceOracle", + "label": "usd1Oracle", + "offset": 0, + "slot": "2", + "type": "t_contract(AggregatorV3Interface)45" + } + ], + "types": { + "t_contract(AggregatorV3Interface)45": { + "encoding": "inplace", + "label": "contract AggregatorV3Interface", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/solcInputs/1a4b830e5ad62f2a9cc08fd32bd71f31.json b/solidity/dns-contracts/deployments/testnet/solcInputs/1a4b830e5ad62f2a9cc08fd32bd71f31.json new file mode 100644 index 0000000..fff452e --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/solcInputs/1a4b830e5ad62f2a9cc08fd32bd71f31.json @@ -0,0 +1,185 @@ +{ + "language": "Solidity", + "sources": { + "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n// solhint-disable-next-line interface-starts-with-i\ninterface AggregatorV3Interface {\n function decimals() external view returns (uint8);\n\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n\n function getRoundData(\n uint80 _roundId\n ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n\n function latestRoundData()\n external\n view\n returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 30 days;\n uint256 public constant LIFETIME = type(uint256).max;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /// v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n /// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n /// @dev Returns whether the given spender can transfer a given token ID\n /// @param spender address of the spender to query\n /// @param tokenId uint256 ID of the token to be transferred\n /// @return bool whether the msg.sender is approved for the given token ID,\n /// is an operator of the owner, or is the owner of the token\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n Ownable(msg.sender);\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /// @dev Gets the owner of the specified token ID. Names become unowned\n /// when their registration expires.\n /// @param tokenId uint256 ID of the token to query the owner of\n /// @return address currently marked as the owner of the given token ID\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /// @dev Register a name.\n /// @param id The token ID (keccak256 of the label).\n /// @param owner The address that should own the registration.\n /// @param duration Duration in seconds for the registration.\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override virtual returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /// @dev Register a name, without modifying the registry.\n /// @param id The token ID (keccak256 of the label).\n /// @param owner The address that should own the registration.\n /// @param duration Duration in seconds for the registration.\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n\n uint256 expiration;\n\n if (duration == 31536000000) {\n // Lifetime registration\n expiration = LIFETIME;\n } else {\n // Annual registration\n expiration = block.timestamp + duration;\n }\n\n expiries[id] = expiration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, expiration);\n\n return expiration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override virtual live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(expiries[id] != LIFETIME, \"Lifetime names cannot be renewed\");\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /// @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n\n function _exists(uint256 tokenId) internal view override returns (bool) {\n return super._exists(tokenId);\n }\n\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration,\n lifetime\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration,\n lifetime\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration, lifetime);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"../utils/StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\nimport {TokenPriceOracle} from \"./TokenPriceOracle.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nusing SafeERC20 for IERC20;\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {ReferralController} from \"./ReferralController.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/// @dev A registrar controller for registering and renewing names at fixed cost.\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n TokenPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n ReferralController public immutable referralController;\n address public infoFi;\n mapping(bytes32 => uint256) public commitments;\n address public backendWallet;\n uint256 public untrackedInfoFi;\n mapping(address => bool) public verifiedTokens;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n modifier onlyBackend() {\n require(msg.sender == backendWallet, \"Not Backend\");\n _;\n }\n\n constructor(\n BaseRegistrarImplementation _base,\n TokenPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens,\n address _infoFi,\n ReferralController _referralController\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n infoFi = _infoFi;\n referralController = _referralController;\n }\n\n function setBackend(address wallet) public onlyOwner {\n backendWallet = wallet;\n }\n\n function setToken(address tokenAddress) public onlyOwner {\n verifiedTokens[tokenAddress] = true;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration,\n bool lifetime\n ) public view virtual override returns (IPriceOracle.Price memory price) {\n require(\n duration == 0 || duration >= MIN_REGISTRATION_DURATION,\n \"Invalid duration\"\n );\n bytes32 label = keccak256(bytes(name));\n price = prices.price(\n name,\n base.nameExpires(uint256(label)),\n duration,\n lifetime\n );\n }\n\n function rentPriceToken(\n string memory name,\n uint256 duration,\n string memory token,\n bool lifetime\n ) public view virtual override returns (IPriceOracle.Price memory price) {\n require(\n duration == 0 || duration >= MIN_REGISTRATION_DURATION,\n \"Invalid duration\"\n );\n bytes32 label = keccak256(bytes(name));\n price = prices.priceToken(\n name,\n base.nameExpires(uint256(label)),\n duration,\n token,\n lifetime\n );\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 2;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] memory data,\n bool reverseRecord,\n uint16 ownerControlledFuses,\n bool lifetime\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses,\n lifetime\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] memory data,\n bool reverseRecord,\n uint16 ownerControlledFuses,\n bool lifetime,\n string memory referree\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses,\n lifetime\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n referralController.setReferree(\n keccak256(bytes(name)),\n owner,\n expires\n );\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n _referralPayout(price, referree, name, owner);\n }\n\n function registerWithCard(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] memory data,\n bool reverseRecord,\n uint16 ownerControlledFuses,\n bool lifetime,\n string memory referree\n ) public onlyBackend {\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses,\n lifetime\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, owner);\n referralController.setReferree(\n keccak256(bytes(name)),\n owner,\n duration\n );\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n if (keccak256(bytes(referree)) != keccak256(bytes(\"\"))) {\n referralController.settlementRegisterWithCard(\n referree,\n name,\n owner,\n price.base + price.premium,\n receiver\n );\n }\n untrackedInfoFi += (((price.base + price.premium) * 35) / 100);\n }\n\n function resetInfoFi() external payable onlyOwner {\n require(msg.value > 0, \"Must send value to reset infoFi\");\n (bool ok, ) = payable(infoFi).call{value: msg.value}(\"\");\n require(ok, \"Payment to infoFi failed\");\n untrackedInfoFi = 0;\n }\n\n function _tokenTransfer(\n address tokenAddress,\n IPriceOracle.Price memory price\n ) internal {\n \n IERC20(tokenAddress).safeTransferFrom(\n msg.sender,\n address(this),\n price.base + price.premium\n );\n }\n\n function _internalRecordsCall(\n string memory name,\n bytes[] memory data,\n address owner,\n address resolver,\n bool reverseRecord,\n uint256 duration\n ) internal {\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n referralController.setReferree(\n keccak256(bytes(name)),\n owner,\n duration\n );\n }\n }\n\n function registerWithToken(\n RegisterParams memory registerParams,\n TokenParams memory tokenParams,\n bool lifetime,\n string memory referree\n ) external override {\n require(\n verifiedTokens[tokenParams.tokenAddress] == true,\n \"Unnacepted Token Address\"\n );\n _consumeCommitment(\n registerParams.name,\n registerParams.duration,\n makeCommitment(\n registerParams.name,\n registerParams.owner,\n registerParams.duration,\n registerParams.secret,\n registerParams.resolver,\n registerParams.data,\n registerParams.reverseRecord,\n registerParams.ownerControlledFuses,\n lifetime\n )\n );\n\n IPriceOracle.Price memory price = rentPriceToken(\n registerParams.name,\n registerParams.duration,\n tokenParams.token,\n lifetime\n );\n if (\n IERC20(tokenParams.tokenAddress).balanceOf(msg.sender) <\n price.base + price.premium\n ) {\n revert InsufficientValue();\n }\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n registerParams.name,\n registerParams.owner,\n registerParams.duration,\n registerParams.resolver,\n registerParams.ownerControlledFuses\n );\n\n _internalRecordsCall(\n registerParams.name,\n registerParams.data,\n registerParams.owner,\n registerParams.resolver,\n registerParams.reverseRecord,\n expires\n );\n _tokenTransfer(tokenParams.tokenAddress, price);\n\n emit NameRegistered(\n registerParams.name,\n keccak256(bytes(registerParams.name)),\n registerParams.owner,\n price.base,\n price.premium,\n expires\n );\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n\n uint256 referrals = referralController.totalReferrals(receiver);\n if (keccak256(bytes(referree)) != keccak256(bytes(\"\"))) {\n uint256 pct = referralController._rewardPct(referrals);\n\n IERC20(tokenParams.tokenAddress).safeTransfer(\n address(referralController),\n ((price.base + price.premium) * pct) / 100\n );\n referralController.settlementRegisterWithToken(\n referree,\n registerParams.name,\n registerParams.owner,\n price.base + price.premium,\n tokenParams.tokenAddress\n );\n }\n IERC20(tokenParams.tokenAddress).safeTransfer(\n infoFi,\n ((price.base + price.premium) * 35) / 100\n );\n }\n\n function renewCard(\n string calldata name,\n uint256 duration,\n bool lifetime\n ) external onlyBackend {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\n string memory referree = referralController.referredBy(labelhash);\n\n uint256 expires = nameWrapper.renew(tokenId, duration);\n referralController.updateReferralCode(keccak256(bytes(name)), expires);\n\n emit NameRenewed(name, labelhash, price.base, expires);\n if (\n referralController.referrees(keccak256(bytes(referree))) !=\n address(0)\n ) {\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n referralController.settlementCard(\n price.base + price.premium,\n receiver,\n referree\n );\n }\n untrackedInfoFi += ((price.base + price.premium) * 35) / 100;\n }\n\n function renew(\n string calldata name,\n uint256 duration,\n bool lifetime\n ) external payable {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\n string memory referree = referralController.referredBy(labelhash);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n referralController.updateReferralCode(keccak256(bytes(name)), expires);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n emit NameRenewed(name, labelhash, msg.value, expires);\n if (\n referralController.referrees(keccak256(bytes(referree))) !=\n address(0)\n ) {\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n referralController.settlement(\n price.base + price.premium,\n receiver,\n referree\n );\n }\n (bool ok, ) = payable(infoFi).call{\n value: ((price.base + price.premium) * 35) / 100\n }(\"\");\n require(ok, \"Payment to infoFi failed\");\n }\n\n function renewTokens(\n string calldata name,\n uint256 duration,\n string memory token,\n address tokenAddress,\n bool lifetime\n ) external override {\n require(\n verifiedTokens[tokenAddress] == true,\n \"Unnacepted Token Address\"\n );\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n string memory referree = referralController.referredBy(labelhash);\n IPriceOracle.Price memory price = rentPriceToken(\n name,\n duration,\n token,\n lifetime\n );\n if (\n IERC20(tokenAddress).balanceOf(msg.sender) <\n price.base + price.premium\n ) {\n revert InsufficientValue();\n }\n IERC20(tokenAddress).safeTransferFrom(\n msg.sender,\n address(this),\n price.base + price.premium\n );\n uint256 expires = nameWrapper.renew(tokenId, duration);\n referralController.updateReferralCode(keccak256(bytes(name)), expires);\n\n emit NameRenewed(name, labelhash, price.base + price.premium, expires);\n\n if (\n referralController.referrees(keccak256(bytes(referree))) !=\n address(0)\n ) {\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n uint256 referrals = referralController.totalReferrals(receiver);\n uint256 pct = referralController._rewardPct(referrals);\n\n IERC20(tokenAddress).safeTransferFrom(\n address(this),\n address(referralController),\n ((price.base + price.premium) * pct) / 100\n );\n referralController.settlementWithToken(\n price.base + price.premium,\n receiver,\n tokenAddress,\n referree\n );\n }\n IERC20(tokenAddress).safeTransferFrom(\n address(this),\n infoFi,\n ((price.base + price.premium) * 35) / 100\n );\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function withdrawTokens(address tokenAddress) public {\n IERC20(tokenAddress).safeTransfer(\n owner(),\n IERC20(tokenAddress).balanceOf(address(this))\n );\n }\n\n function _referralPayout(\n IPriceOracle.Price memory price,\n string memory referree,\n string memory name,\n address owner\n ) internal {\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n uint256 referrals = referralController.totalReferrals(receiver);\n if (keccak256(bytes(referree)) != keccak256(bytes(\"\"))) {\n uint256 pct = referralController._rewardPct(referrals);\n referralController.settlementRegister{\n value: (((price.base + price.premium) * pct) / 100)\n }(referree, name, owner, price.base + price.premium, receiver);\n }\n (bool ok, ) = payable(infoFi).call{\n value: ((price.base + price.premium) * 35) / 100\n }(\"\");\n require(ok, \"Payment to infoFi failed\");\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration != 0 && duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] memory data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".creator\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorV3Interface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n\n struct TokenParams{\n string token;\n address tokenAddress;\n }\n struct RegisterParams {\n string name;\n address owner;\n uint256 duration;\n bytes32 secret;\n address resolver;\n bytes[] data;\n bool reverseRecord;\n uint16 ownerControlledFuses;\n }\n function rentPrice(\n string memory,\n uint256,\n bool\n ) external view returns (IPriceOracle.Price memory);\n\n function rentPriceToken(\n string memory name,\n uint256 duration,\n string memory token,\n bool lifetime\n ) external view returns (IPriceOracle.Price memory price);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16,\n bool\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16,\n bool,\n string memory\n ) external payable;\n\n function registerWithToken(\n RegisterParams memory registerParams,\n TokenParams memory tokenParams,\n bool lifetime,\n string memory referree\n ) external;\n\n function renew(string calldata, uint256, bool) external payable;\n\n function renewTokens(\n string calldata name,\n uint256 duration,\n string memory token,\n address tokenAddress,\n bool lifetime\n ) external;\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration,\n bool lifetime\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/ReferralController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\nimport {IPriceOracle} from \"./IETHRegistrarController.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nusing SafeERC20 for IERC20;\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract ReferralController is Ownable {\n // Mapping from referral code to referrer address\n uint16 private constant TIER1 = 2;\n uint16 private constant TIER2 = 15;\n uint16 private constant TIER3 = 20;\n uint256 private constant PCT1 = 15;\n uint256 private constant PCT2 = 20;\n uint256 private constant PCT3 = 25;\n mapping(address => bool) public controllers;\n mapping(bytes32 => uint256) public commitments;\n mapping(bytes32 => address) public referrees;\n mapping(bytes32 => uint256) public expirydates;\n mapping(address => bytes32[]) public referrals;\n mapping(bytes32 => string) public referredBy;\n mapping(address => uint256) public nativeEarnings;\n mapping(address => mapping(address => uint256)) public tokenEarnings;\n\n bytes32[] public referralCodes;\n uint256 public untrackedEarnings;\n uint256 public snapshotUntrackedEarnings;\n mapping(address => uint256) public snapshotNativeEarnings;\n mapping(address => mapping(address => uint256))\n public snapshotTokenEarnings;\n uint256 public trackedNativeEarnings;\n mapping(address => uint256) public trackedTokenEarnings;\n\n event ReferralCodeAdded(string indexed code, address indexed referrer);\n event WithdrawalDispersed(address indexed);\n modifier onlyControllerOrOwner() {\n require(\n controllers[msg.sender] || msg.sender == owner(),\n \"Not a controller or owner\"\n );\n _;\n }\n\n function addController(address controller) external onlyOwner {\n require(controller != address(0), \"Invalid controller address\");\n controllers[controller] = true;\n }\n\n function settlementRegister(\n string memory referree,\n string memory name,\n address owner,\n uint256 amount,\n address receiver\n ) external payable onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n\n require(\n receiver != address(0) && receiver != owner,\n \"Invalid receiver address\"\n );\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n bool contains;\n for (uint256 i = 0; i < referrals[receiver].length; i++) {\n if (referrals[receiver][i] == keccak256(bytes(name))) {\n contains = true;\n break;\n }\n }\n if (contains == false) {\n referrals[receiver].push(keccak256(bytes(name)));\n referredBy[keccak256(bytes(name))] = referree;\n _applyNativeReward(receiver, amount, false);\n } else {\n _applyNativeReward(receiver, amount, false);\n }\n } else {\n payable(Ownable.owner()).transfer(amount);\n }\n }\n\n function settlementRegisterWithCard(\n string memory referree,\n string memory name,\n address owner,\n uint256 amount,\n address receiver\n ) external onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n require(\n receiver != address(0) && receiver != owner,\n \"Invalid receiver address\"\n );\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n bool contains;\n for (uint256 i = 0; i < referrals[receiver].length; i++) {\n if (referrals[receiver][i] == keccak256(bytes(name))) {\n contains = true;\n }\n }\n if (contains == false) {\n referrals[receiver].push(keccak256(bytes(name)));\n referredBy[keccak256(bytes(name))] = referree;\n _applyNativeReward(receiver, amount, true);\n } else {\n _applyNativeReward(receiver, amount, true);\n }\n }\n }\n\n /// @notice Only your controller or admin should be able to call this!\n function setReferree(\n bytes32 code,\n address who,\n uint256 duration\n ) external onlyControllerOrOwner {\n require(code != bytes32(0), \"Invalid referral code\");\n require(who != address(0), \"Invalid referree address\");\n require(\n referrees[code] == address(0),\n \"Referral code already registered\"\n );\n address prevReferree = referrees[code];\n if (prevReferree != address(0)) {\n referrals[prevReferree] = new bytes32[](0);\n }\n referrees[code] = who;\n referralCodes.push(code);\n expirydates[code] = duration;\n }\n\n function settlementCard(\n uint256 amount,\n address receiver,\n string memory referree\n ) external onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n require(receiver != address(0), \"Invalid receiver address\");\n _applyNativeReward(receiver, amount, true);\n }\n }\n\n function settlement(\n uint256 amount,\n address receiver,\n string memory referree\n ) external payable onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n require(receiver != address(0), \"Invalid receiver address\");\n _applyNativeReward(receiver, amount, false);\n } else {\n payable(Ownable.owner()).transfer(amount);\n }\n }\n\n function settlementWithToken(\n uint256 amount,\n address receiver,\n address tokenAddress,\n string memory referree\n ) external onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n require(receiver != address(0), \"Invalid receiver address\");\n _applyTokenReward(receiver, tokenAddress, amount);\n } else {\n IERC20(tokenAddress).safeTransfer(Ownable.owner(), amount);\n }\n }\n\n function settlementRegisterWithToken(\n string memory referree,\n string memory name,\n address owner,\n uint256 amount,\n address tokenAddress\n ) external onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n // Implement token settlement logic here if needed\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n address receiver = referrees[keccak256(bytes(referree))];\n if (receiver != address(0) && receiver != owner) {\n bool contains;\n for (uint256 i = 0; i < referrals[receiver].length; i++) {\n if (referrals[receiver][i] == keccak256(bytes(name))) {\n contains = true;\n }\n }\n if (contains == false) {\n referrals[receiver].push(keccak256(bytes(name)));\n referredBy[keccak256(bytes(name))] = referree;\n _applyTokenReward(receiver, tokenAddress, amount);\n } else {\n _applyTokenReward(receiver, tokenAddress, amount);\n }\n }\n } else {\n // If the referree is not registered, we can transfer the amount to the owner\n IERC20(tokenAddress).safeTransfer(Ownable.owner(), amount);\n }\n }\n\n function withdrawAllNativeEarnings(uint256 batch) external onlyOwner {\n for (uint256 i = 0; i < batch; ) {\n bytes32 code = referralCodes[batch];\n if (block.timestamp < expirydates[code]) {\n address referrer = referrees[code];\n uint256 earnings = nativeEarnings[referrer];\n if (earnings > 0) {\n (bool ok, ) = payable(referrer).call{value: earnings}(\"\");\n require(ok, \"Payment failed\");\n nativeEarnings[referrer] = 0;\n }\n }\n unchecked {\n ++i;\n }\n }\n // Transfer any remaining balance to the owner\n uint256 remainingBalance = address(this).balance;\n if (remainingBalance > 0) {\n payable(owner()).transfer(remainingBalance);\n }\n // Emit an event for the withdrawal\n emit WithdrawalDispersed(msg.sender);\n }\n\n function withdrawAllTokenEarnings(\n address[] memory tokenAddresses,\n uint256 batch\n ) external onlyOwner {\n uint256 tokenLength = tokenAddresses.length;\n for (uint256 j = 0; j < tokenLength; ) {\n address tokenAddress = tokenAddresses[j];\n for (uint256 i = 0; i < batch; ) {\n bytes32 code = referralCodes[i];\n if (block.timestamp < expirydates[code]) {\n address referrer = referrees[code];\n uint256 earnings = tokenEarnings[referrer][tokenAddress];\n require(earnings > 0, \"No earnings to withdraw\");\n if (earnings > 0) {\n // Assuming the token follows ERC20 standard\n IERC20(tokenAddress).safeTransfer(referrer, earnings);\n tokenEarnings[referrer][tokenAddress] = 0;\n }\n }\n unchecked {\n ++i;\n }\n }\n unchecked {\n ++j;\n }\n }\n }\n\n function totalReferrals(address referrer) external view returns (uint256) {\n return referrals[referrer].length;\n }\n\n function totalNativeEarnings(\n address referrer\n ) external view returns (uint256) {\n return nativeEarnings[referrer];\n }\n\n function totalTokenEarnings(\n address referrer,\n address tokenAddress\n ) external view returns (uint256) {\n return tokenEarnings[referrer][tokenAddress];\n }\n\n function getCodes() external view returns (uint256) {\n return referralCodes.length;\n }\n function updateReferralCode(\n bytes32 code,\n uint256 newExpiry\n ) external onlyControllerOrOwner {\n require(expirydates[code] > 0, \"Referral code does not exist\");\n expirydates[code] = newExpiry;\n }\n\n function _rewardPct(uint256 numReferrals) public pure returns (uint256) {\n if (numReferrals >= TIER3) return PCT3;\n if (numReferrals >= TIER2) return PCT2;\n if (numReferrals >= TIER1) return PCT1;\n return 0; // No reward for less than TIER1 referrals\n }\n\n function _applyNativeReward(\n address receiver,\n uint256 amount,\n bool isFiat\n ) private {\n nativeEarnings[receiver] +=\n (amount * _rewardPct(referrals[receiver].length)) /\n 100;\n if (isFiat) {\n untrackedEarnings +=\n (amount * _rewardPct(referrals[receiver].length)) /\n 100;\n }\n }\n\n function _applyTokenReward(\n address receiver,\n address token,\n uint256 amount\n ) private {\n tokenEarnings[receiver][token] +=\n (amount * _rewardPct(referrals[receiver].length)) /\n 100;\n }\n\n function balance() public view returns (uint256) {\n return address(this).balance;\n }\n\n function tokenBalance(\n address tokenAddress\n ) public view returns (uint256) {\n return IERC20(tokenAddress).balanceOf(address(this));\n }\n\n function getUntracked() public view returns (uint256) {\n return untrackedEarnings;\n }\n\n function createSnapshot(\n address[] memory tokenAddresses\n ) external onlyOwner {\n snapshotUntrackedEarnings = untrackedEarnings;\n for (uint256 i = 0; i < referralCodes.length; i++) {\n bytes32 code = referralCodes[i];\n address referrer = referrees[code];\n snapshotNativeEarnings[referrer] = nativeEarnings[referrer];\n }\n for (uint256 j = 0; j < tokenAddresses.length; j++) {\n address tokenAddress = tokenAddresses[j];\n for (uint256 i = 0; i < referralCodes.length; i++) {\n bytes32 code = referralCodes[i];\n address referrer = referrees[code];\n snapshotTokenEarnings[referrer][tokenAddress] = tokenEarnings[\n referrer\n ][tokenAddress];\n }\n }\n }\n\n function getSnapshotEarnings() public view returns (uint256) {\n return snapshotUntrackedEarnings;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"../utils/StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\";\n\n\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n AggregatorV3Interface internal usdOracle;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorV3Interface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration,\n bool lifetime\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5 && lifetime) {\n basePrice = price5Letter * 31536000 * 4;\n } else if (len == 4 && lifetime) {\n basePrice = price4Letter * 31536000 * 4;\n } else if (len == 3 && lifetime) {\n basePrice = price3Letter * 31536000 * 6;\n } else if (len == 2 && lifetime) {\n basePrice = price2Letter * 31536000 * 10;\n } else if (len == 1 && lifetime) {\n basePrice = price1Letter * 31536000;\n } else if (len >= 5 && lifetime == false) { \n basePrice = price5Letter * duration;\n } else if (len == 4 && lifetime == false) {\n basePrice = price4Letter * duration;\n } else if (len == 3 && lifetime == false) {\n basePrice = price3Letter * duration;\n } else if (len == 2 && lifetime == false) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n (, int256 ethPrice,,,) = usdOracle.latestRoundData();\n return (amount * 1e8) / uint256(ethPrice);\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n (, int256 ethPrice,,,) = usdOracle.latestRoundData();\n return (amount * uint256(ethPrice)) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration,\n lifetime\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n function rentPriceToken(\n string[] calldata names,\n uint256 duration,\n string memory token,\n bool lifetime\n ) external view returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPriceToken(\n names[i],\n duration,\n token,\n lifetime\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration,\n lifetime\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration, lifetime);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n function renewAllWithToken(\n string[] calldata names,\n uint256 duration,\n string memory token,\n address tokenAddress,\n bool lifetime\n ) external payable {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPriceToken(\n names[i],\n duration,\n token,\n lifetime\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renewTokens(names[i], duration, token, tokenAddress, lifetime);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/TokenPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ExponentialPremiumPriceOracle.sol\";\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\";\n\ncontract TokenPriceOracle is ExponentialPremiumPriceOracle {\n AggregatorV3Interface internal cakeOracle;\n AggregatorV3Interface internal usd1Oracle;\n using StringUtils for *;\n constructor(\n AggregatorV3Interface _usdOracle,\n AggregatorV3Interface _cakeOracle,\n AggregatorV3Interface _usd1Oracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n )ExponentialPremiumPriceOracle(_usdOracle, _rentPrices, _startPremium, totalDays) {\n usd1Oracle = _usd1Oracle;\n cakeOracle = _cakeOracle;\n }\n\n\n function priceToken(\n string calldata name,\n uint256 expires,\n uint256 duration,\n string memory token,\n bool lifetime\n ) external view returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5 && lifetime) {\n basePrice = price5Letter * 31536000 * 4;\n } else if (len == 4 && lifetime) {\n basePrice = price4Letter * 31536000 * 4;\n } else if (len == 3 && lifetime) {\n basePrice = price3Letter * 31536000 * 6;\n } else if (len == 2 && lifetime) {\n basePrice = price2Letter * 31536000 * 10;\n } else if (len == 1 && lifetime) {\n basePrice = price1Letter * 31536000;\n } else if (len >= 5 && lifetime == false) { \n basePrice = price5Letter * duration;\n } else if (len == 4 && lifetime == false) {\n basePrice = price4Letter * duration;\n } else if (len == 3 && lifetime == false) {\n basePrice = price3Letter * duration;\n } else if (len == 2 && lifetime == false) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n if(keccak256(bytes(token)) == keccak256(bytes(\"cake\"))){\n return\n IPriceOracle.Price({\n base: attoUSDToCake(basePrice),\n premium: attoUSDToCake(_premium(name, expires, duration))\n });\n } else {\n return\n IPriceOracle.Price({\n base: attoUSDToUSD1(basePrice),\n premium: attoUSDToCake(_premium(name, expires, duration))\n });\n }\n \n }\n function attoUSDToCake(uint256 amount) internal view returns (uint256) {\n (, int256 cakePrice,,,) = cakeOracle.latestRoundData();\n return (amount * 1e8) / uint256(cakePrice);\n }\n function attoUSDToUSD1(uint256 amount) internal view returns (uint256) {\n (, int256 usd1Price,,,) = usd1Oracle.latestRoundData();\n return (amount * 1e8) / uint256(usd1Price);\n }\n function attoCakeToUSD(uint256 amount) internal view returns (uint256) {\n (, int256 cakePrice,,,) = cakeOracle.latestRoundData();\n return (amount * uint256(cakePrice)) / 1e8;\n }\n function attoUSD1ToUSD(uint256 amount) internal view returns (uint256) {\n (, int256 usd1Price,,,) = usd1Oracle.latestRoundData();\n return (amount * uint256(usd1Price)) / 1e8;\n }\n\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n\n /**\n * @dev Escapes special characters in a given string\n *\n * @param str The string to escape\n * @return The escaped string\n */\n function escape(string memory str) internal pure returns (string memory) {\n bytes memory strBytes = bytes(str);\n uint extraChars = 0;\n\n // count extra space needed for escaping\n for (uint i = 0; i < strBytes.length; i++) {\n if (_needsEscaping(strBytes[i])) {\n extraChars++;\n }\n }\n\n // allocate buffer with the exact size needed\n bytes memory buffer = new bytes(strBytes.length + extraChars);\n uint index = 0;\n\n // escape characters\n for (uint i = 0; i < strBytes.length; i++) {\n if (_needsEscaping(strBytes[i])) {\n buffer[index++] = \"\\\\\";\n buffer[index++] = _getEscapedChar(strBytes[i]);\n } else {\n buffer[index++] = strBytes[i];\n }\n }\n\n return string(buffer);\n }\n\n // determine if a character needs escaping\n function _needsEscaping(bytes1 char) private pure returns (bool) {\n return\n char == '\"' ||\n char == \"/\" ||\n char == \"\\\\\" ||\n char == \"\\n\" ||\n char == \"\\r\" ||\n char == \"\\t\";\n }\n\n // get the escaped character\n function _getEscapedChar(bytes1 char) private pure returns (bytes1) {\n if (char == \"\\n\") return \"n\";\n if (char == \"\\r\") return \"r\";\n if (char == \"\\t\") return \"t\";\n return char;\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_CRE8OR = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/solcInputs/724226d00d816bea68b816df3bb6223c.json b/solidity/dns-contracts/deployments/testnet/solcInputs/724226d00d816bea68b816df3bb6223c.json new file mode 100644 index 0000000..9d98ef3 --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/solcInputs/724226d00d816bea68b816df3bb6223c.json @@ -0,0 +1,185 @@ +{ + "language": "Solidity", + "sources": { + "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n// solhint-disable-next-line interface-starts-with-i\ninterface AggregatorV3Interface {\n function decimals() external view returns (uint8);\n\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n\n function getRoundData(\n uint80 _roundId\n ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n\n function latestRoundData()\n external\n view\n returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 30 days;\n uint256 public constant LIFETIME = type(uint256).max;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /// v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n /// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n /// @dev Returns whether the given spender can transfer a given token ID\n /// @param spender address of the spender to query\n /// @param tokenId uint256 ID of the token to be transferred\n /// @return bool whether the msg.sender is approved for the given token ID,\n /// is an operator of the owner, or is the owner of the token\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n Ownable(msg.sender);\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /// @dev Gets the owner of the specified token ID. Names become unowned\n /// when their registration expires.\n /// @param tokenId uint256 ID of the token to query the owner of\n /// @return address currently marked as the owner of the given token ID\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /// @dev Register a name.\n /// @param id The token ID (keccak256 of the label).\n /// @param owner The address that should own the registration.\n /// @param duration Duration in seconds for the registration.\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override virtual returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /// @dev Register a name, without modifying the registry.\n /// @param id The token ID (keccak256 of the label).\n /// @param owner The address that should own the registration.\n /// @param duration Duration in seconds for the registration.\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n\n uint256 expiration;\n\n if (duration == 31536000000) {\n // Lifetime registration\n expiration = LIFETIME;\n } else {\n // Annual registration\n expiration = block.timestamp + duration;\n }\n\n expiries[id] = expiration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, expiration);\n\n return expiration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override virtual live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(expiries[id] != LIFETIME, \"Lifetime names cannot be renewed\");\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /// @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n\n function _exists(uint256 tokenId) internal view override returns (bool) {\n return super._exists(tokenId);\n }\n\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration,\n lifetime\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration,\n lifetime\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration, lifetime);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"../utils/StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\nimport {TokenPriceOracle} from \"./TokenPriceOracle.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nusing SafeERC20 for IERC20;\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {ReferralController} from \"./ReferralController.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/// @dev A registrar controller for registering and renewing names at fixed cost.\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n TokenPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n ReferralController public immutable referralController;\n address public infoFi;\n mapping(bytes32 => uint256) public commitments;\n address public backendWallet;\n uint256 public untrackedInfoFi;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n modifier onlyBackend() {\n require(msg.sender == backendWallet, \"Not Backend\");\n _;\n }\n\n constructor(\n BaseRegistrarImplementation _base,\n TokenPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens,\n address _infoFi,\n ReferralController _referralController\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n infoFi = _infoFi;\n referralController = _referralController;\n }\n\n function setBackend(address wallet) public onlyOwner {\n backendWallet = wallet;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration,\n bool lifetime\n ) public view virtual override returns (IPriceOracle.Price memory price) {\n require(\n duration == 0 || duration >= MIN_REGISTRATION_DURATION,\n \"Invalid duration\"\n );\n bytes32 label = keccak256(bytes(name));\n price = prices.price(\n name,\n base.nameExpires(uint256(label)),\n duration,\n lifetime\n );\n }\n\n function rentPriceToken(\n string memory name,\n uint256 duration,\n string memory token,\n bool lifetime\n ) public view virtual override returns (IPriceOracle.Price memory price) {\n require(\n duration == 0 || duration >= MIN_REGISTRATION_DURATION,\n \"Invalid duration\"\n );\n bytes32 label = keccak256(bytes(name));\n price = prices.priceToken(\n name,\n base.nameExpires(uint256(label)),\n duration,\n token,\n lifetime\n );\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 2;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] memory data,\n bool reverseRecord,\n uint16 ownerControlledFuses,\n bool lifetime\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses,\n lifetime\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] memory data,\n bool reverseRecord,\n uint16 ownerControlledFuses,\n bool lifetime,\n string memory referree\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses,\n lifetime\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n referralController.setReferree(\n keccak256(bytes(name)),\n owner,\n expires\n );\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n _referralPayout(price, referree, name, owner);\n }\n\n function registerWithCard(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] memory data,\n bool reverseRecord,\n uint16 ownerControlledFuses,\n bool lifetime,\n string memory referree\n ) public onlyBackend {\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses,\n lifetime\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, owner);\n referralController.setReferree(\n keccak256(bytes(name)),\n owner,\n duration\n );\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n if (keccak256(bytes(referree)) != keccak256(bytes(\"\"))) {\n referralController.settlementRegisterWithCard(\n referree,\n name,\n owner,\n price.base + price.premium,\n receiver\n );\n }\n untrackedInfoFi += (((price.base + price.premium) * 35) / 100);\n }\n\n function resetInfoFi() external payable onlyOwner {\n require(msg.value > 0, \"Must send value to reset infoFi\");\n (bool ok, ) = payable(infoFi).call{value: msg.value}(\"\");\n require(ok, \"Payment to infoFi failed\");\n untrackedInfoFi = 0;\n }\n\n function _tokenTransfer(\n address tokenAddress,\n IPriceOracle.Price memory price\n ) internal {\n require(\n IERC20(tokenAddress).allowance(msg.sender, address(this)) >=\n price.base + price.premium,\n \"Insufficient ERC20 allowance\"\n );\n\n if (\n IERC20(tokenAddress).balanceOf(msg.sender) <\n price.base + price.premium\n ) {\n revert InsufficientValue();\n }\n IERC20(tokenAddress).safeTransferFrom(\n msg.sender,\n address(this),\n price.base + price.premium\n );\n }\n\n function _internalRecordsCall(\n string memory name,\n bytes[] memory data,\n address owner,\n address resolver,\n bool reverseRecord,\n uint256 duration\n ) internal {\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n referralController.setReferree(\n keccak256(bytes(name)),\n owner,\n duration\n );\n }\n }\n\n function registerWithToken(\n RegisterParams memory registerParams,\n TokenParams memory tokenParams,\n bool lifetime,\n string memory referree\n ) external override {\n _consumeCommitment(\n registerParams.name,\n registerParams.duration,\n makeCommitment(\n registerParams.name,\n registerParams.owner,\n registerParams.duration,\n registerParams.secret,\n registerParams.resolver,\n registerParams.data,\n registerParams.reverseRecord,\n registerParams.ownerControlledFuses,\n lifetime\n )\n );\n\n IPriceOracle.Price memory price = rentPriceToken(\n registerParams.name,\n registerParams.duration,\n tokenParams.token,\n lifetime\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n registerParams.name,\n registerParams.owner,\n registerParams.duration,\n registerParams.resolver,\n registerParams.ownerControlledFuses\n );\n\n _internalRecordsCall(\n registerParams.name,\n registerParams.data,\n registerParams.owner,\n registerParams.resolver,\n registerParams.reverseRecord,\n expires\n );\n _tokenTransfer(tokenParams.tokenAddress, price);\n\n emit NameRegistered(\n registerParams.name,\n keccak256(bytes(registerParams.name)),\n registerParams.owner,\n price.base,\n price.premium,\n expires\n );\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n\n uint256 referrals = referralController.totalReferrals(receiver);\n if (keccak256(bytes(referree)) != keccak256(bytes(\"\"))) {\n uint256 pct = referralController._rewardPct(referrals);\n\n IERC20(tokenParams.tokenAddress).safeTransferFrom(\n address(this),\n address(referralController),\n ((price.base + price.premium) * pct) / 100\n );\n referralController.settlementRegisterWithToken(\n referree,\n registerParams.name,\n registerParams.owner,\n price.base + price.premium,\n tokenParams.tokenAddress\n );\n }\n IERC20(tokenParams.tokenAddress).safeTransferFrom(\n address(this),\n infoFi,\n ((price.base + price.premium) * 35) / 100\n );\n }\n\n function renewCard(\n string calldata name,\n uint256 duration,\n bool lifetime\n ) external onlyBackend {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\n string memory referree = referralController.referredBy(labelhash);\n\n uint256 expires = nameWrapper.renew(tokenId, duration);\n referralController.updateReferralCode(keccak256(bytes(name)), expires);\n\n emit NameRenewed(name, labelhash, price.base, expires);\n if (\n referralController.referrees(keccak256(bytes(referree))) !=\n address(0)\n ) {\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n referralController.settlementCard(\n price.base + price.premium,\n receiver,\n referree\n );\n }\n untrackedInfoFi += ((price.base + price.premium) * 35) / 100;\n }\n\n function renew(\n string calldata name,\n uint256 duration,\n bool lifetime\n ) external payable {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\n string memory referree = referralController.referredBy(labelhash);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n referralController.updateReferralCode(keccak256(bytes(name)), expires);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n emit NameRenewed(name, labelhash, msg.value, expires);\n if (\n referralController.referrees(keccak256(bytes(referree))) !=\n address(0)\n ) {\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n referralController.settlement(\n price.base + price.premium,\n receiver,\n referree\n );\n }\n (bool ok, ) = payable(infoFi).call{\n value: ((price.base + price.premium) * 35) / 100\n }(\"\");\n require(ok, \"Payment to infoFi failed\");\n }\n\n function renewTokens(\n string calldata name,\n uint256 duration,\n string memory token,\n address tokenAddress,\n bool lifetime\n ) external override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n string memory referree = referralController.referredBy(labelhash);\n IPriceOracle.Price memory price = rentPriceToken(\n name,\n duration,\n token,\n lifetime\n );\n if (\n IERC20(tokenAddress).balanceOf(msg.sender) <\n price.base + price.premium\n ) {\n revert InsufficientValue();\n }\n IERC20(tokenAddress).safeTransferFrom(\n msg.sender,\n address(this),\n price.base + price.premium\n );\n uint256 expires = nameWrapper.renew(tokenId, duration);\n referralController.updateReferralCode(keccak256(bytes(name)), expires);\n\n emit NameRenewed(name, labelhash, price.base + price.premium, expires);\n\n if (\n referralController.referrees(keccak256(bytes(referree))) !=\n address(0)\n ) {\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n uint256 referrals = referralController.totalReferrals(receiver);\n uint256 pct = referralController._rewardPct(referrals);\n\n IERC20(tokenAddress).safeTransferFrom(\n address(this),\n address(referralController),\n ((price.base + price.premium) * pct) / 100\n );\n referralController.settlementWithToken(\n price.base + price.premium,\n receiver,\n tokenAddress,\n referree\n );\n }\n IERC20(tokenAddress).safeTransferFrom(\n address(this),\n infoFi,\n ((price.base + price.premium) * 35) / 100\n );\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function withdrawTokens(address tokenAddress) public {\n IERC20(tokenAddress).safeTransfer(\n owner(),\n IERC20(tokenAddress).balanceOf(address(this))\n );\n }\n\n function _referralPayout(\n IPriceOracle.Price memory price,\n string memory referree,\n string memory name,\n address owner\n ) internal {\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n uint256 referrals = referralController.totalReferrals(receiver);\n if (keccak256(bytes(referree)) != keccak256(bytes(\"\"))) {\n uint256 pct = referralController._rewardPct(referrals);\n referralController.settlementRegister{\n value: (((price.base + price.premium) * pct) / 100)\n }(referree, name, owner, price.base + price.premium, receiver);\n }\n (bool ok, ) = payable(infoFi).call{\n value: ((price.base + price.premium) * 35) / 100\n }(\"\");\n require(ok, \"Payment to infoFi failed\");\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration != 0 && duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] memory data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".creator\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorV3Interface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n\n struct TokenParams{\n string token;\n address tokenAddress;\n }\n struct RegisterParams {\n string name;\n address owner;\n uint256 duration;\n bytes32 secret;\n address resolver;\n bytes[] data;\n bool reverseRecord;\n uint16 ownerControlledFuses;\n }\n function rentPrice(\n string memory,\n uint256,\n bool\n ) external view returns (IPriceOracle.Price memory);\n\n function rentPriceToken(\n string memory name,\n uint256 duration,\n string memory token,\n bool lifetime\n ) external view returns (IPriceOracle.Price memory price);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16,\n bool\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16,\n bool,\n string memory\n ) external payable;\n\n function registerWithToken(\n RegisterParams memory registerParams,\n TokenParams memory tokenParams,\n bool lifetime,\n string memory referree\n ) external;\n\n function renew(string calldata, uint256, bool) external payable;\n\n function renewTokens(\n string calldata name,\n uint256 duration,\n string memory token,\n address tokenAddress,\n bool lifetime\n ) external;\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration,\n bool lifetime\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/ReferralController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\nimport {IPriceOracle} from \"./IETHRegistrarController.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nusing SafeERC20 for IERC20;\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract ReferralController is Ownable {\n // Mapping from referral code to referrer address\n uint16 private constant TIER1 = 10;\n uint16 private constant TIER2 = 15;\n uint16 private constant TIER3 = 20;\n uint256 private constant PCT1 = 15;\n uint256 private constant PCT2 = 20;\n uint256 private constant PCT3 = 25;\n mapping(address => bool) public controllers;\n mapping(bytes32 => uint256) public commitments;\n mapping(bytes32 => address) public referrees;\n mapping(bytes32 => uint256) public expirydates;\n mapping(address => bytes32[]) public referrals;\n mapping(bytes32 => string) public referredBy;\n mapping(address => uint256) public nativeEarnings;\n mapping(address => mapping(address => uint256)) public tokenEarnings;\n\n bytes32[] public referralCodes;\n uint256 public untrackedEarnings;\n uint256 public snapshotEarnings;\n uint256 public trackedNativeEarnings;\n mapping(address => uint256) public trackedTokenEarnings;\n\n event ReferralCodeAdded(string indexed code, address indexed referrer);\n event WithdrawalDispersed(address indexed);\n modifier onlyControllerOrOwner() {\n require(\n controllers[msg.sender] || msg.sender == owner(),\n \"Not a controller or owner\"\n );\n _;\n }\n\n function addController(address controller) external onlyOwner {\n require(controller != address(0), \"Invalid controller address\");\n controllers[controller] = true;\n }\n\n function settlementRegister(\n string memory referree,\n string memory name,\n address owner,\n uint256 amount,\n address receiver\n ) external payable onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n\n require(\n receiver != address(0) && receiver != owner,\n \"Invalid receiver address\"\n );\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n bool contains;\n for (uint256 i = 0; i < referrals[receiver].length; i++) {\n if (referrals[receiver][i] == keccak256(bytes(name))) {\n contains = true;\n break;\n }\n }\n if (contains == false) {\n referrals[receiver].push(keccak256(bytes(name)));\n referredBy[keccak256(bytes(name))] = referree;\n _applyNativeReward(receiver, amount, false);\n } else {\n _applyNativeReward(receiver, amount, false);\n }\n } else {\n payable(Ownable.owner()).transfer(amount);\n }\n }\n\n function settlementRegisterWithCard(\n string memory referree,\n string memory name,\n address owner,\n uint256 amount,\n address receiver\n ) external onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n require(\n receiver != address(0) && receiver != owner,\n \"Invalid receiver address\"\n );\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n bool contains;\n for (uint256 i = 0; i < referrals[receiver].length; i++) {\n if (referrals[receiver][i] == keccak256(bytes(name))) {\n contains = true;\n }\n }\n if (contains == false) {\n referrals[receiver].push(keccak256(bytes(name)));\n referredBy[keccak256(bytes(name))] = referree;\n _applyNativeReward(receiver, amount, true);\n } else {\n _applyNativeReward(receiver, amount, true);\n }\n } else {\n payable(Ownable.owner()).transfer(amount);\n }\n }\n\n /// @notice Only your controller or admin should be able to call this!\n function setReferree(\n bytes32 code,\n address who,\n uint256 duration\n ) external onlyControllerOrOwner {\n require(code != bytes32(0), \"Invalid referral code\");\n require(who != address(0), \"Invalid referree address\");\n require(\n referrees[code] == address(0),\n \"Referral code already registered\"\n );\n address prevReferree = referrees[code];\n if (prevReferree != address(0)) {\n referrals[prevReferree] = new bytes32[](0);\n }\n referrees[code] = who;\n referralCodes.push(code);\n expirydates[code] = duration;\n }\n\n function settlementCard(\n uint256 amount,\n address receiver,\n string memory referree\n ) external onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n require(receiver != address(0), \"Invalid receiver address\");\n _applyNativeReward(receiver, amount, true);\n } else {\n payable(Ownable.owner()).transfer(amount);\n }\n }\n\n function settlement(\n uint256 amount,\n address receiver,\n string memory referree\n ) external payable onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n require(receiver != address(0), \"Invalid receiver address\");\n _applyNativeReward(receiver, amount, false);\n } else {\n payable(Ownable.owner()).transfer(amount);\n }\n }\n\n function settlementWithToken(\n uint256 amount,\n address receiver,\n address tokenAddress,\n string memory referree\n ) external onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n require(receiver != address(0), \"Invalid receiver address\");\n _applyTokenReward(receiver, tokenAddress, amount);\n } else {\n IERC20(tokenAddress).safeTransfer(Ownable.owner(), amount);\n }\n }\n\n function settlementRegisterWithToken(\n string memory referree,\n string memory name,\n address owner,\n uint256 amount,\n address tokenAddress\n ) external onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n // Implement token settlement logic here if needed\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n address receiver = referrees[keccak256(bytes(referree))];\n if (receiver != address(0) && receiver != owner) {\n bool contains;\n for (uint256 i = 0; i < referrals[receiver].length; i++) {\n if (referrals[receiver][i] == keccak256(bytes(name))) {\n contains = true;\n }\n }\n if (contains == false) {\n referrals[receiver].push(keccak256(bytes(name)));\n referredBy[keccak256(bytes(name))] = referree;\n _applyTokenReward(receiver, tokenAddress, amount);\n } else {\n _applyTokenReward(receiver, tokenAddress, amount);\n }\n }\n } else {\n // If the referree is not registered, we can transfer the amount to the owner\n IERC20(tokenAddress).safeTransfer(Ownable.owner(), amount);\n }\n }\n\n function withdrawAllNativeEarnings(uint256 batch) external onlyOwner {\n for (uint256 i = 0; i < batch; ) {\n bytes32 code = referralCodes[batch];\n if (block.timestamp < expirydates[code]) {\n address referrer = referrees[code];\n uint256 earnings = nativeEarnings[referrer];\n if (earnings > 0) {\n (bool ok, ) = payable(referrer).call{value: earnings}(\"\");\n require(ok, \"Payment failed\");\n nativeEarnings[referrer] = 0;\n }\n }\n unchecked {\n ++i;\n }\n }\n // Transfer any remaining balance to the owner\n uint256 remainingBalance = address(this).balance;\n if (remainingBalance > 0) {\n payable(owner()).transfer(remainingBalance);\n }\n // Emit an event for the withdrawal\n emit WithdrawalDispersed(msg.sender);\n }\n\n function withdrawAllTokenEarnings(\n address[] memory tokenAddresses,\n uint256 batch\n ) external onlyOwner {\n uint256 tokenLength = tokenAddresses.length;\n for (uint256 j = 0; j < tokenLength; ) {\n address tokenAddress = tokenAddresses[j];\n for (uint256 i = 0; i < batch; ) {\n bytes32 code = referralCodes[i];\n if (block.timestamp < expirydates[code]) {\n address referrer = referrees[code];\n uint256 earnings = tokenEarnings[referrer][tokenAddress];\n require(earnings > 0, \"No earnings to withdraw\");\n if (earnings > 0) {\n // Assuming the token follows ERC20 standard\n IERC20(tokenAddress).safeTransfer(referrer, earnings);\n tokenEarnings[referrer][tokenAddress] = 0;\n }\n }\n unchecked {\n ++i;\n }\n }\n unchecked {\n ++j;\n }\n }\n }\n\n function totalReferrals(address referrer) external view returns (uint256) {\n return referrals[referrer].length;\n }\n\n function totalNativeEarnings(\n address referrer\n ) external view returns (uint256) {\n return nativeEarnings[referrer];\n }\n\n function totalTokenEarnings(\n address referrer,\n address tokenAddress\n ) external view returns (uint256) {\n return tokenEarnings[referrer][tokenAddress];\n }\n\n function updateReferralCode(\n bytes32 code,\n uint256 newExpiry\n ) external onlyControllerOrOwner {\n require(expirydates[code] > 0, \"Referral code does not exist\");\n expirydates[code] = newExpiry;\n }\n\n function _rewardPct(uint256 numReferrals) public pure returns (uint256) {\n if (numReferrals > TIER3) return PCT3;\n if (numReferrals > TIER2) return PCT2;\n if (numReferrals > TIER1) return PCT1;\n return 0; // No reward for less than TIER1 referrals\n }\n\n function _applyNativeReward(\n address receiver,\n uint256 amount,\n bool isFiat\n ) private {\n nativeEarnings[receiver] +=\n (amount * _rewardPct(referrals[receiver].length)) /\n 100;\n if (isFiat) {\n untrackedEarnings +=\n (amount * _rewardPct(referrals[receiver].length)) /\n 100;\n }\n }\n\n function _applyTokenReward(\n address receiver,\n address token,\n uint256 amount\n ) private {\n tokenEarnings[receiver][token] +=\n (amount * _rewardPct(referrals[receiver].length)) /\n 100;\n }\n\n function balance() public view returns (uint256) {\n return address(this).balance;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"../utils/StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\";\n\n\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n AggregatorV3Interface internal usdOracle;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorV3Interface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration,\n bool lifetime\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5 && lifetime) {\n basePrice = price5Letter * 31536000 * 4;\n } else if (len == 4 && lifetime) {\n basePrice = price4Letter * 31536000 * 4;\n } else if (len == 3 && lifetime) {\n basePrice = price3Letter * 31536000 * 6;\n } else if (len == 2 && lifetime) {\n basePrice = price2Letter * 31536000 * 10;\n } else if (len == 1 && lifetime) {\n basePrice = price1Letter * 31536000;\n } else if (len >= 5 && lifetime == false) { \n basePrice = price5Letter * duration;\n } else if (len == 4 && lifetime == false) {\n basePrice = price4Letter * duration;\n } else if (len == 3 && lifetime == false) {\n basePrice = price3Letter * duration;\n } else if (len == 2 && lifetime == false) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n (, int256 ethPrice,,,) = usdOracle.latestRoundData();\n return (amount * 1e8) / uint256(ethPrice);\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n (, int256 ethPrice,,,) = usdOracle.latestRoundData();\n return (amount * uint256(ethPrice)) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration,\n lifetime\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n function rentPriceToken(\n string[] calldata names,\n uint256 duration,\n string memory token,\n bool lifetime\n ) external view returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPriceToken(\n names[i],\n duration,\n token,\n lifetime\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration,\n lifetime\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration, lifetime);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n function renewAllWithToken(\n string[] calldata names,\n uint256 duration,\n string memory token,\n address tokenAddress,\n bool lifetime\n ) external payable {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPriceToken(\n names[i],\n duration,\n token,\n lifetime\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renewTokens(names[i], duration, token, tokenAddress, lifetime);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/TokenPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ExponentialPremiumPriceOracle.sol\";\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\";\n\ncontract TokenPriceOracle is ExponentialPremiumPriceOracle {\n AggregatorV3Interface internal cakeOracle;\n AggregatorV3Interface internal usd1Oracle;\n using StringUtils for *;\n constructor(\n AggregatorV3Interface _usdOracle,\n AggregatorV3Interface _cakeOracle,\n AggregatorV3Interface _usd1Oracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n )ExponentialPremiumPriceOracle(_usdOracle, _rentPrices, _startPremium, totalDays) {\n usd1Oracle = _usd1Oracle;\n cakeOracle = _cakeOracle;\n }\n\n\n function priceToken(\n string calldata name,\n uint256 expires,\n uint256 duration,\n string memory token,\n bool lifetime\n ) external view returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5 && lifetime) {\n basePrice = price5Letter * 31536000 * 4;\n } else if (len == 4 && lifetime) {\n basePrice = price4Letter * 31536000 * 4;\n } else if (len == 3 && lifetime) {\n basePrice = price3Letter * 31536000 * 6;\n } else if (len == 2 && lifetime) {\n basePrice = price2Letter * 31536000 * 10;\n } else if (len == 1 && lifetime) {\n basePrice = price1Letter * 31536000;\n } else if (len >= 5 && lifetime == false) { \n basePrice = price5Letter * duration;\n } else if (len == 4 && lifetime == false) {\n basePrice = price4Letter * duration;\n } else if (len == 3 && lifetime == false) {\n basePrice = price3Letter * duration;\n } else if (len == 2 && lifetime == false) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n if(keccak256(bytes(token)) == keccak256(bytes(\"cake\"))){\n return\n IPriceOracle.Price({\n base: attoUSDToCake(basePrice),\n premium: attoUSDToCake(_premium(name, expires, duration))\n });\n } else {\n return\n IPriceOracle.Price({\n base: attoUSDToUSD1(basePrice),\n premium: attoUSDToCake(_premium(name, expires, duration))\n });\n }\n \n }\n function attoUSDToCake(uint256 amount) internal view returns (uint256) {\n (, int256 cakePrice,,,) = cakeOracle.latestRoundData();\n return (amount * 1e8) / uint256(cakePrice);\n }\n function attoUSDToUSD1(uint256 amount) internal view returns (uint256) {\n (, int256 usd1Price,,,) = usd1Oracle.latestRoundData();\n return (amount * 1e8) / uint256(usd1Price);\n }\n function attoCakeToUSD(uint256 amount) internal view returns (uint256) {\n (, int256 cakePrice,,,) = cakeOracle.latestRoundData();\n return (amount * uint256(cakePrice)) / 1e8;\n }\n function attoUSD1ToUSD(uint256 amount) internal view returns (uint256) {\n (, int256 usd1Price,,,) = usd1Oracle.latestRoundData();\n return (amount * uint256(usd1Price)) / 1e8;\n }\n\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n\n /**\n * @dev Escapes special characters in a given string\n *\n * @param str The string to escape\n * @return The escaped string\n */\n function escape(string memory str) internal pure returns (string memory) {\n bytes memory strBytes = bytes(str);\n uint extraChars = 0;\n\n // count extra space needed for escaping\n for (uint i = 0; i < strBytes.length; i++) {\n if (_needsEscaping(strBytes[i])) {\n extraChars++;\n }\n }\n\n // allocate buffer with the exact size needed\n bytes memory buffer = new bytes(strBytes.length + extraChars);\n uint index = 0;\n\n // escape characters\n for (uint i = 0; i < strBytes.length; i++) {\n if (_needsEscaping(strBytes[i])) {\n buffer[index++] = \"\\\\\";\n buffer[index++] = _getEscapedChar(strBytes[i]);\n } else {\n buffer[index++] = strBytes[i];\n }\n }\n\n return string(buffer);\n }\n\n // determine if a character needs escaping\n function _needsEscaping(bytes1 char) private pure returns (bool) {\n return\n char == '\"' ||\n char == \"/\" ||\n char == \"\\\\\" ||\n char == \"\\n\" ||\n char == \"\\r\" ||\n char == \"\\t\";\n }\n\n // get the escaped character\n function _getEscapedChar(bytes1 char) private pure returns (bytes1) {\n if (char == \"\\n\") return \"n\";\n if (char == \"\\r\") return \"r\";\n if (char == \"\\t\") return \"t\";\n return char;\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_CRE8OR = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/solcInputs/7ef7523a40dd1de60e38563e79c7448b.json b/solidity/dns-contracts/deployments/testnet/solcInputs/7ef7523a40dd1de60e38563e79c7448b.json new file mode 100644 index 0000000..2d1da2d --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/solcInputs/7ef7523a40dd1de60e38563e79c7448b.json @@ -0,0 +1,449 @@ +{ + "language": "Solidity", + "sources": { + "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n// solhint-disable-next-line interface-starts-with-i\ninterface AggregatorV3Interface {\n function decimals() external view returns (uint8);\n\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n\n function getRoundData(\n uint80 _roundId\n ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n\n function latestRoundData()\n external\n view\n returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n}\n" + }, + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@ensdomains/solsha1/contracts/SHA1.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns(bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 { totallen := add(totallen, 64) }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for { let i := 0 } lt(i, totallen) { i := add(i, 64) } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 { mstore8(add(scratch, sub(len, i)), 0x80) }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 { mstore(add(scratch, 32), or(mload(add(scratch, 32)), mul(len, 8))) }\n\n // Expand the 16 32-bit words into 80\n for { let j := 64 } lt(j, 128) { j := add(j, 12) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 12))), mload(add(scratch, sub(j, 32)))), xor(mload(add(scratch, sub(j, 56))), mload(add(scratch, sub(j, 64)))))\n temp := or(and(mul(temp, 2), 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE), and(div(temp, 0x80000000), 0x0000000100000001000000010000000100000001000000010000000100000001))\n mstore(add(scratch, j), temp)\n }\n for { let j := 128 } lt(j, 320) { j := add(j, 24) } {\n let temp := xor(xor(mload(add(scratch, sub(j, 24))), mload(add(scratch, sub(j, 64)))), xor(mload(add(scratch, sub(j, 112))), mload(add(scratch, sub(j, 128)))))\n temp := or(and(mul(temp, 4), 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC), and(div(temp, 0x40000000), 0x0000000300000003000000030000000300000003000000030000000300000003))\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for { let j := 0 } lt(j, 80) { j := add(j, 1) } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(div(x, 0x100000000000000000000), div(x, 0x10000000000))\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1{\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := and(div(x, 0x10000000000), f)\n f := or(and(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000)), f)\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(div(x, 0x1000000000000000000000000000000), div(x, 0x100000000000000000000))\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(div(x, 0x80000000000000000000000000000000000000000000000), 0x1F)\n temp := or(and(div(x, 0x800000000000000000000000000000000000000), 0xFFFFFFE0), temp)\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(div(mload(add(scratch, mul(j, 4))), 0x100000000000000000000000000000000000000000000000000000000), temp)\n x := or(div(x, 0x10000000000), mul(temp, 0x10000000000000000000000000000000000000000))\n x := or(and(x, 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF), mul(or(and(div(x, 0x4000000000000), 0xC0000000), and(div(x, 0x400000000000000000000), 0x3FFFFFFF)), 0x100000000000000000000))\n }\n\n h := and(add(h, x), 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF)\n }\n ret := mul(or(or(or(or(and(div(h, 0x100000000), 0xFFFFFFFF00000000000000000000000000000000), and(div(h, 0x1000000), 0xFFFFFFFF000000000000000000000000)), and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)), and(div(h, 0x100), 0xFFFFFFFF00000000)), and(h, 0xFFFFFFFF)), 0x1000000000000000000000000)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/BytesUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (iter.name().compareNames(buf.buf) != 0) continue;\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"../utils/BytesUtils.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyDnsRegistrarDNSSEC.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract DummyDNSSEC {\n uint16 expectedType;\n bytes expectedName;\n uint32 inception;\n uint64 inserted;\n bytes20 hash;\n\n function setData(\n uint16 _expectedType,\n bytes memory _expectedName,\n uint32 _inception,\n uint64 _inserted,\n bytes memory _proof\n ) public {\n expectedType = _expectedType;\n expectedName = _expectedName;\n inception = _inception;\n inserted = _inserted;\n if (_proof.length != 0) {\n hash = bytes20(keccak256(_proof));\n }\n }\n\n function rrdata(\n uint16 dnstype,\n bytes memory name\n ) public view returns (uint32, uint64, bytes20) {\n require(dnstype == expectedType);\n require(keccak256(name) == keccak256(expectedName));\n return (inception, inserted, hash);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyExtendedDNSSECResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyExtendedDNSSECResolver is IExtendedDNSResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes memory /* name */,\n bytes memory /* data */,\n bytes memory context\n ) external view override returns (bytes memory) {\n return abi.encode(context);\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyLegacyTextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract DummyLegacyTextResolver is ITextResolver, IERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(ITextResolver).interfaceId;\n }\n\n function text(\n bytes32 /* node */,\n string calldata key\n ) external view override returns (string memory) {\n return key;\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyNonCCIPAwareResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../OffchainDNSResolver.sol\";\nimport \"../../resolvers/profiles/IExtendedResolver.sol\";\n\ncontract DummyNonCCIPAwareResolver is IExtendedResolver, ERC165 {\n OffchainDNSResolver dnsResolver;\n\n constructor(OffchainDNSResolver _dnsResolver) {\n dnsResolver = _dnsResolver;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(dnsResolver),\n urls,\n data,\n OffchainDNSResolver.resolveCallback.selector,\n data\n );\n }\n}\n" + }, + "contracts/dnsregistrar/mocks/DummyParser.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../utils/BytesUtils.sol\";\nimport \"../RecordParser.sol\";\n\ncontract DummyParser {\n using BytesUtils for bytes;\n\n // parse data in format: name;key1=value1 key2=value2;url\n function parseData(\n bytes memory data,\n uint256 kvCount\n )\n external\n pure\n returns (\n string memory name,\n string[] memory keys,\n string[] memory values,\n string memory url\n )\n {\n uint256 len = data.length;\n // retrieve name\n uint256 sep1 = data.find(0, len, \";\");\n name = string(data.substring(0, sep1));\n\n // retrieve url\n uint256 sep2 = data.find(sep1 + 1, len - sep1, \";\");\n url = string(data.substring(sep2 + 1, len - sep2 - 1));\n\n keys = new string[](kvCount);\n values = new string[](kvCount);\n // retrieve keys and values\n uint256 offset = sep1 + 1;\n for (uint256 i; i < kvCount && offset < len; i++) {\n (\n bytes memory key,\n bytes memory val,\n uint256 nextOffset\n ) = RecordParser.readKeyValue(data, offset, sep2 - offset);\n keys[i] = string(key);\n values[i] = string(val);\n offset = nextOffset;\n }\n }\n}\n" + }, + "contracts/dnsregistrar/OffchainDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../../contracts/resolvers/profiles/IAddrResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedResolver.sol\";\nimport \"../../contracts/resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"../utils/BytesUtils.sol\";\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"../utils/LowLevelCallUtils.sol\";\n\nerror InvalidOperation();\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ninterface IDNSGateway {\n function resolve(\n bytes memory name,\n uint16 qtype\n ) external returns (DNSSEC.RRSetWithSignature[] memory);\n}\n\nuint16 constant CLASS_INET = 1;\nuint16 constant TYPE_TXT = 16;\n\ncontract OffchainDNSResolver is IExtendedResolver, IERC165 {\n using RRUtils for *;\n using Address for address;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n string public gatewayURL;\n\n error CouldNotResolve(bytes name);\n\n constructor(ENS _ens, DNSSEC _oracle, string memory _gatewayURL) {\n ens = _ens;\n oracle = _oracle;\n gatewayURL = _gatewayURL;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) external pure override returns (bool) {\n return interfaceId == type(IExtendedResolver).interfaceId;\n }\n\n function resolve(\n bytes calldata name,\n bytes calldata data\n ) external view returns (bytes memory) {\n revertWithDefaultOffchainLookup(name, data);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (bytes memory name, bytes memory query, bytes4 selector) = abi.decode(\n extraData,\n (bytes, bytes, bytes4)\n );\n\n if (selector != bytes4(0)) {\n (bytes memory targetData, address targetResolver) = abi.decode(\n query,\n (bytes, address)\n );\n return\n callWithOffchainLookupPropagation(\n targetResolver,\n name,\n query,\n abi.encodeWithSelector(\n selector,\n response,\n abi.encode(targetData, address(this))\n )\n );\n }\n\n DNSSEC.RRSetWithSignature[] memory rrsets = abi.decode(\n response,\n (DNSSEC.RRSetWithSignature[])\n );\n\n (bytes memory data, ) = oracle.verifyRRSet(rrsets);\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n // Ignore records with wrong name, type, or class\n bytes memory rrname = RRUtils.readName(iter.data, iter.offset);\n if (\n !rrname.equals(name) ||\n iter.class != CLASS_INET ||\n iter.dnstype != TYPE_TXT\n ) {\n continue;\n }\n\n // Look for a valid ENS-DNS TXT record\n (address dnsresolver, bytes memory context) = parseRR(\n iter.data,\n iter.rdataOffset,\n iter.nextOffset\n );\n\n // If we found a valid record, try to resolve it\n if (dnsresolver != address(0)) {\n if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedDNSResolver.resolve.selector\n )\n ) {\n return\n callWithOffchainLookupPropagation(\n dnsresolver,\n name,\n query,\n abi.encodeCall(\n IExtendedDNSResolver.resolve,\n (name, query, context)\n )\n );\n } else if (\n IERC165(dnsresolver).supportsInterface(\n IExtendedResolver.resolve.selector\n )\n ) {\n return\n callWithOffchainLookupPropagation(\n dnsresolver,\n name,\n query,\n abi.encodeCall(\n IExtendedResolver.resolve,\n (name, query)\n )\n );\n } else {\n (bool ok, bytes memory ret) = address(dnsresolver)\n .staticcall(query);\n if (ok) {\n return ret;\n } else {\n revert CouldNotResolve(name);\n }\n }\n }\n }\n\n // No valid records; revert.\n revert CouldNotResolve(name);\n }\n\n function parseRR(\n bytes memory data,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address, bytes memory) {\n bytes memory txt = readTXT(data, idx, lastIdx);\n\n // Must start with the magic word\n if (txt.length < 5 || !txt.equals(0, \"ENS1 \", 0, 5)) {\n return (address(0), \"\");\n }\n\n // Parse the name or address\n uint256 lastTxtIdx = txt.find(5, txt.length - 5, \" \");\n if (lastTxtIdx > txt.length) {\n address dnsResolver = parseAndResolve(txt, 5, txt.length);\n return (dnsResolver, \"\");\n } else {\n address dnsResolver = parseAndResolve(txt, 5, lastTxtIdx);\n return (\n dnsResolver,\n txt.substring(lastTxtIdx + 1, txt.length - lastTxtIdx - 1)\n );\n }\n }\n\n function readTXT(\n bytes memory data,\n uint256 startIdx,\n uint256 lastIdx\n ) internal pure returns (bytes memory) {\n // TODO: Concatenate multiple text fields\n uint256 fieldLength = data.readUint8(startIdx);\n assert(startIdx + fieldLength < lastIdx);\n return data.substring(startIdx + 1, fieldLength);\n }\n\n function parseAndResolve(\n bytes memory nameOrAddress,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n if (nameOrAddress[idx] == \"0\" && nameOrAddress[idx + 1] == \"x\") {\n (address ret, bool valid) = nameOrAddress.hexToAddress(\n idx + 2,\n lastIdx\n );\n if (valid) {\n return ret;\n }\n }\n return resolveName(nameOrAddress, idx, lastIdx);\n }\n\n function resolveName(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (address) {\n bytes32 node = textNamehash(name, idx, lastIdx);\n address resolver = ens.resolver(node);\n if (resolver == address(0)) {\n return address(0);\n }\n return IAddrResolver(resolver).addr(node);\n }\n\n /**\n * @dev Namehash function that operates on dot-separated names (not dns-encoded names)\n * @param name Name to hash\n * @param idx Index to start at\n * @param lastIdx Index to end at\n */\n function textNamehash(\n bytes memory name,\n uint256 idx,\n uint256 lastIdx\n ) internal view returns (bytes32) {\n uint256 separator = name.find(idx, name.length - idx, bytes1(\".\"));\n bytes32 parentNode = bytes32(0);\n if (separator < lastIdx) {\n parentNode = textNamehash(name, separator + 1, lastIdx);\n } else {\n separator = lastIdx;\n }\n return\n keccak256(\n abi.encodePacked(parentNode, name.keccak(idx, separator - idx))\n );\n }\n\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory name,\n bytes memory innerdata,\n bytes memory data\n ) internal view returns (bytes memory) {\n if (!target.isContract()) {\n revertWithDefaultOffchainLookup(name, innerdata);\n }\n\n bool result = LowLevelCallUtils.functionStaticCall(\n address(target),\n data\n );\n uint256 size = LowLevelCallUtils.returnDataSize();\n if (result) {\n bytes memory returnData = LowLevelCallUtils.readReturnData(0, size);\n return abi.decode(returnData, (bytes));\n }\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n if (bytes4(errorId) == OffchainLookup.selector) {\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n handleOffchainLookupError(revertData, target, name);\n }\n }\n LowLevelCallUtils.propagateRevert();\n }\n\n function revertWithDefaultOffchainLookup(\n bytes memory name,\n bytes memory data\n ) internal view {\n string[] memory urls = new string[](1);\n urls[0] = gatewayURL;\n\n revert OffchainLookup(\n address(this),\n urls,\n abi.encodeCall(IDNSGateway.resolve, (name, TYPE_TXT)),\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, data, bytes4(0))\n );\n }\n\n function handleOffchainLookupError(\n bytes memory returnData,\n address target,\n bytes memory name\n ) internal view {\n (\n address sender,\n string[] memory urls,\n bytes memory callData,\n bytes4 innerCallbackFunction,\n bytes memory extraData\n ) = abi.decode(returnData, (address, string[], bytes, bytes4, bytes));\n\n if (sender != target) {\n revert InvalidOperation();\n }\n\n revert OffchainLookup(\n address(this),\n urls,\n callData,\n OffchainDNSResolver.resolveCallback.selector,\n abi.encode(name, extraData, innerCallbackFunction)\n );\n }\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnsregistrar/RecordParser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.11;\n\nimport \"../utils/BytesUtils.sol\";\n\nlibrary RecordParser {\n using BytesUtils for bytes;\n\n /**\n * @dev Parses a key-value record into a key and value.\n * @param input The input string\n * @param offset The offset to start reading at\n */\n function readKeyValue(\n bytes memory input,\n uint256 offset,\n uint256 len\n )\n internal\n pure\n returns (bytes memory key, bytes memory value, uint256 nextOffset)\n {\n uint256 separator = input.find(offset, len, \"=\");\n if (separator == type(uint256).max) {\n return (\"\", \"\", type(uint256).max);\n }\n\n uint256 terminator = input.find(\n separator,\n len + offset - separator,\n \" \"\n );\n if (terminator == type(uint256).max) {\n terminator = len + offset;\n nextOffset = terminator;\n } else {\n nextOffset = terminator + 1;\n }\n\n key = input.substring(offset, separator - offset);\n value = input.substring(separator + 1, terminator - separator - 1);\n }\n}\n" + }, + "contracts/dnsregistrar/SimplePublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"../root/Ownable.sol\";\nimport \"./PublicSuffixList.sol\";\n\ncontract SimplePublicSuffixList is PublicSuffixList, Ownable {\n mapping(bytes => bool) suffixes;\n\n event SuffixAdded(bytes suffix);\n\n function addPublicSuffixes(bytes[] memory names) public onlyOwner {\n for (uint256 i = 0; i < names.length; i++) {\n suffixes[names[i]] = true;\n emit SuffixAdded(names[i]);\n }\n }\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n return suffixes[name];\n }\n}\n" + }, + "contracts/dnsregistrar/TLDPublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../utils/BytesUtils.sol\";\nimport \"./PublicSuffixList.sol\";\n\n/**\n * @dev A public suffix list that treats all TLDs as public suffixes.\n */\ncontract TLDPublicSuffixList is PublicSuffixList {\n using BytesUtils for bytes;\n\n function isPublicSuffix(\n bytes calldata name\n ) external view override returns (bool) {\n uint256 labellen = name.readUint8(0);\n return labellen > 0 && name.readUint8(labellen + 1) == 0;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC (signing) algorithm.\n */\ninterface Algorithm {\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/algorithms/DummyAlgorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC (signing) algorithm that approves all\n * signatures, for testing.\n */\ncontract DummyAlgorithm is Algorithm {\n function verify(\n bytes calldata,\n bytes calldata,\n bytes calldata\n ) external view override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/EllipticCurve.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @title EllipticCurve\n *\n * @author Tilman Drerup;\n *\n * @notice Implements elliptic curve math; Parametrized for SECP256R1.\n *\n * Includes components of code by Andreas Olofsson, Alexander Vlasov\n * (https://github.com/BANKEX/CurveArithmetics), and Avi Asayag\n * (https://github.com/orbs-network/elliptic-curve-solidity)\n *\n * Source: https://github.com/tdrerup/elliptic-curve-solidity\n *\n * @dev NOTE: To disambiguate public keys when verifying signatures, activate\n * condition 'rs[1] > lowSmax' in validateSignature().\n */\ncontract EllipticCurve {\n // Set parameters for curve.\n uint256 constant a =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b =\n 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant gx =\n 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy =\n 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 constant p =\n 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n uint256 constant n =\n 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n\n uint256 constant lowSmax =\n 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n /**\n * @dev Inverse of u in the field of modulo m.\n */\n function inverseMod(uint256 u, uint256 m) internal pure returns (uint256) {\n unchecked {\n if (u == 0 || u == m || m == 0) return 0;\n if (u > m) u = u % m;\n\n int256 t1;\n int256 t2 = 1;\n uint256 r1 = m;\n uint256 r2 = u;\n uint256 q;\n\n while (r2 != 0) {\n q = r1 / r2;\n (t1, t2, r1, r2) = (t2, t1 - int256(q) * t2, r2, r1 - q * r2);\n }\n\n if (t1 < 0) return (m - uint256(-t1));\n\n return uint256(t1);\n }\n }\n\n /**\n * @dev Transform affine coordinates into projective coordinates.\n */\n function toProjectivePoint(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256[3] memory P) {\n P[2] = addmod(0, 1, p);\n P[0] = mulmod(x0, P[2], p);\n P[1] = mulmod(y0, P[2], p);\n }\n\n /**\n * @dev Add two points in affine coordinates and return projective point.\n */\n function addAndReturnProjectivePoint(\n uint256 x1,\n uint256 y1,\n uint256 x2,\n uint256 y2\n ) internal pure returns (uint256[3] memory P) {\n uint256 x;\n uint256 y;\n (x, y) = add(x1, y1, x2, y2);\n P = toProjectivePoint(x, y);\n }\n\n /**\n * @dev Transform from projective to affine coordinates.\n */\n function toAffinePoint(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1) {\n uint256 z0Inv;\n z0Inv = inverseMod(z0, p);\n x1 = mulmod(x0, z0Inv, p);\n y1 = mulmod(y0, z0Inv, p);\n }\n\n /**\n * @dev Return the zero curve in projective coordinates.\n */\n function zeroProj()\n internal\n pure\n returns (uint256 x, uint256 y, uint256 z)\n {\n return (0, 1, 0);\n }\n\n /**\n * @dev Return the zero curve in affine coordinates.\n */\n function zeroAffine() internal pure returns (uint256 x, uint256 y) {\n return (0, 0);\n }\n\n /**\n * @dev Check if the curve is the zero curve.\n */\n function isZeroCurve(\n uint256 x0,\n uint256 y0\n ) internal pure returns (bool isZero) {\n if (x0 == 0 && y0 == 0) {\n return true;\n }\n return false;\n }\n\n /**\n * @dev Check if a point in affine coordinates is on the curve.\n */\n function isOnCurve(uint256 x, uint256 y) internal pure returns (bool) {\n if (0 == x || x == p || 0 == y || y == p) {\n return false;\n }\n\n uint256 LHS = mulmod(y, y, p); // y^2\n uint256 RHS = mulmod(mulmod(x, x, p), x, p); // x^3\n\n if (a != 0) {\n RHS = addmod(RHS, mulmod(x, a, p), p); // x^3 + a*x\n }\n if (b != 0) {\n RHS = addmod(RHS, b, p); // x^3 + a*x + b\n }\n\n return LHS == RHS;\n }\n\n /**\n * @dev Double an elliptic curve point in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function twiceProj(\n uint256 x0,\n uint256 y0,\n uint256 z0\n ) internal pure returns (uint256 x1, uint256 y1, uint256 z1) {\n uint256 t;\n uint256 u;\n uint256 v;\n uint256 w;\n\n if (isZeroCurve(x0, y0)) {\n return zeroProj();\n }\n\n u = mulmod(y0, z0, p);\n u = mulmod(u, 2, p);\n\n v = mulmod(u, x0, p);\n v = mulmod(v, y0, p);\n v = mulmod(v, 2, p);\n\n x0 = mulmod(x0, x0, p);\n t = mulmod(x0, 3, p);\n\n z0 = mulmod(z0, z0, p);\n z0 = mulmod(z0, a, p);\n t = addmod(t, z0, p);\n\n w = mulmod(t, t, p);\n x0 = mulmod(2, v, p);\n w = addmod(w, p - x0, p);\n\n x0 = addmod(v, p - w, p);\n x0 = mulmod(t, x0, p);\n y0 = mulmod(y0, u, p);\n y0 = mulmod(y0, y0, p);\n y0 = mulmod(2, y0, p);\n y1 = addmod(x0, p - y0, p);\n\n x1 = mulmod(u, w, p);\n\n z1 = mulmod(u, u, p);\n z1 = mulmod(z1, u, p);\n }\n\n /**\n * @dev Add two elliptic curve points in projective coordinates. See\n * https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates\n */\n function addProj(\n uint256 x0,\n uint256 y0,\n uint256 z0,\n uint256 x1,\n uint256 y1,\n uint256 z1\n ) internal pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 t0;\n uint256 t1;\n uint256 u0;\n uint256 u1;\n\n if (isZeroCurve(x0, y0)) {\n return (x1, y1, z1);\n } else if (isZeroCurve(x1, y1)) {\n return (x0, y0, z0);\n }\n\n t0 = mulmod(y0, z1, p);\n t1 = mulmod(y1, z0, p);\n\n u0 = mulmod(x0, z1, p);\n u1 = mulmod(x1, z0, p);\n\n if (u0 == u1) {\n if (t0 == t1) {\n return twiceProj(x0, y0, z0);\n } else {\n return zeroProj();\n }\n }\n\n (x2, y2, z2) = addProj2(mulmod(z0, z1, p), u0, u1, t1, t0);\n }\n\n /**\n * @dev Helper function that splits addProj to avoid too many local variables.\n */\n function addProj2(\n uint256 v,\n uint256 u0,\n uint256 u1,\n uint256 t1,\n uint256 t0\n ) private pure returns (uint256 x2, uint256 y2, uint256 z2) {\n uint256 u;\n uint256 u2;\n uint256 u3;\n uint256 w;\n uint256 t;\n\n t = addmod(t0, p - t1, p);\n u = addmod(u0, p - u1, p);\n u2 = mulmod(u, u, p);\n\n w = mulmod(t, t, p);\n w = mulmod(w, v, p);\n u1 = addmod(u1, u0, p);\n u1 = mulmod(u1, u2, p);\n w = addmod(w, p - u1, p);\n\n x2 = mulmod(u, w, p);\n\n u3 = mulmod(u2, u, p);\n u0 = mulmod(u0, u2, p);\n u0 = addmod(u0, p - w, p);\n t = mulmod(t, u0, p);\n t0 = mulmod(t0, u3, p);\n\n y2 = addmod(t, p - t0, p);\n\n z2 = mulmod(u3, v, p);\n }\n\n /**\n * @dev Add two elliptic curve points in affine coordinates.\n */\n function add(\n uint256 x0,\n uint256 y0,\n uint256 x1,\n uint256 y1\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = addProj(x0, y0, 1, x1, y1, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Double an elliptic curve point in affine coordinates.\n */\n function twice(\n uint256 x0,\n uint256 y0\n ) internal pure returns (uint256, uint256) {\n uint256 z0;\n\n (x0, y0, z0) = twiceProj(x0, y0, 1);\n\n return toAffinePoint(x0, y0, z0);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)*P)).\n */\n function multiplyPowerBase2(\n uint256 x0,\n uint256 y0,\n uint256 exp\n ) internal pure returns (uint256, uint256) {\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n\n for (uint256 i = 0; i < exp; i++) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n }\n\n return toAffinePoint(base2X, base2Y, base2Z);\n }\n\n /**\n * @dev Multiply an elliptic curve point by a scalar.\n */\n function multiplyScalar(\n uint256 x0,\n uint256 y0,\n uint256 scalar\n ) internal pure returns (uint256 x1, uint256 y1) {\n if (scalar == 0) {\n return zeroAffine();\n } else if (scalar == 1) {\n return (x0, y0);\n } else if (scalar == 2) {\n return twice(x0, y0);\n }\n\n uint256 base2X = x0;\n uint256 base2Y = y0;\n uint256 base2Z = 1;\n uint256 z1 = 1;\n x1 = x0;\n y1 = y0;\n\n if (scalar % 2 == 0) {\n x1 = y1 = 0;\n }\n\n scalar = scalar >> 1;\n\n while (scalar > 0) {\n (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z);\n\n if (scalar % 2 == 1) {\n (x1, y1, z1) = addProj(base2X, base2Y, base2Z, x1, y1, z1);\n }\n\n scalar = scalar >> 1;\n }\n\n return toAffinePoint(x1, y1, z1);\n }\n\n /**\n * @dev Multiply the curve's generator point by a scalar.\n */\n function multipleGeneratorByScalar(\n uint256 scalar\n ) internal pure returns (uint256, uint256) {\n return multiplyScalar(gx, gy, scalar);\n }\n\n /**\n * @dev Validate combination of message, signature, and public key.\n */\n function validateSignature(\n bytes32 message,\n uint256[2] memory rs,\n uint256[2] memory Q\n ) internal pure returns (bool) {\n // To disambiguate between public key solutions, include comment below.\n if (rs[0] == 0 || rs[0] >= n || rs[1] == 0) {\n // || rs[1] > lowSmax)\n return false;\n }\n if (!isOnCurve(Q[0], Q[1])) {\n return false;\n }\n\n uint256 x1;\n uint256 x2;\n uint256 y1;\n uint256 y2;\n\n uint256 sInv = inverseMod(rs[1], n);\n (x1, y1) = multiplyScalar(gx, gy, mulmod(uint256(message), sInv, n));\n (x2, y2) = multiplyScalar(Q[0], Q[1], mulmod(rs[0], sInv, n));\n uint256[3] memory P = addAndReturnProjectivePoint(x1, y1, x2, y2);\n\n if (P[2] == 0) {\n return false;\n }\n\n uint256 Px = inverseMod(P[2], p);\n Px = mulmod(P[0], mulmod(Px, Px, p), p);\n\n return Px % n == rs[0];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/ModexpPrecompile.sol": { + "content": "pragma solidity ^0.8.4;\n\nlibrary ModexpPrecompile {\n /**\n * @dev Computes (base ^ exponent) % modulus over big numbers.\n */\n function modexp(\n bytes memory base,\n bytes memory exponent,\n bytes memory modulus\n ) internal view returns (bool success, bytes memory output) {\n bytes memory input = abi.encodePacked(\n uint256(base.length),\n uint256(exponent.length),\n uint256(modulus.length),\n base,\n exponent,\n modulus\n );\n\n output = new bytes(modulus.length);\n\n assembly {\n success := staticcall(\n gas(),\n 5,\n add(input, 32),\n mload(input),\n add(output, 32),\n mload(modulus)\n )\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/P256SHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./EllipticCurve.sol\";\nimport \"../../utils/BytesUtils.sol\";\n\ncontract P256SHA256Algorithm is Algorithm, EllipticCurve {\n using BytesUtils for *;\n\n /**\n * @dev Verifies a signature.\n * @param key The public key to verify with.\n * @param data The signed data to verify.\n * @param signature The signature to verify.\n * @return True iff the signature is valid.\n */\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata signature\n ) external view override returns (bool) {\n return\n validateSignature(\n sha256(data),\n parseSignature(signature),\n parseKey(key)\n );\n }\n\n function parseSignature(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 64, \"Invalid p256 signature length\");\n return [uint256(data.readBytes32(0)), uint256(data.readBytes32(32))];\n }\n\n function parseKey(\n bytes memory data\n ) internal pure returns (uint256[2] memory) {\n require(data.length == 68, \"Invalid p256 key length\");\n return [uint256(data.readBytes32(4)), uint256(data.readBytes32(36))];\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA1Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./RSAVerify.sol\";\nimport \"../../utils/BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA1 algorithm.\n */\ncontract RSASHA1Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && SHA1.sha1(data) == result.readBytes20(result.length - 20);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSASHA256Algorithm.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Algorithm.sol\";\nimport \"./RSAVerify.sol\";\nimport \"../../utils/BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC RSASHA256 algorithm.\n */\ncontract RSASHA256Algorithm is Algorithm {\n using BytesUtils for *;\n\n function verify(\n bytes calldata key,\n bytes calldata data,\n bytes calldata sig\n ) external view override returns (bool) {\n bytes memory exponent;\n bytes memory modulus;\n\n uint16 exponentLen = uint16(key.readUint8(4));\n if (exponentLen != 0) {\n exponent = key.substring(5, exponentLen);\n modulus = key.substring(\n exponentLen + 5,\n key.length - exponentLen - 5\n );\n } else {\n exponentLen = key.readUint16(5);\n exponent = key.substring(7, exponentLen);\n modulus = key.substring(\n exponentLen + 7,\n key.length - exponentLen - 7\n );\n }\n\n // Recover the message from the signature\n bool ok;\n bytes memory result;\n (ok, result) = RSAVerify.rsarecover(modulus, exponent, sig);\n\n // Verify it ends with the hash of our data\n return ok && sha256(data) == result.readBytes32(result.length - 32);\n }\n}\n" + }, + "contracts/dnssec-oracle/algorithms/RSAVerify.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./ModexpPrecompile.sol\";\nimport \"../../utils/BytesUtils.sol\";\n\nlibrary RSAVerify {\n /**\n * @dev Recovers the input data from an RSA signature, returning the result in S.\n * @param N The RSA public modulus.\n * @param E The RSA public exponent.\n * @param S The signature to recover.\n * @return True if the recovery succeeded.\n */\n function rsarecover(\n bytes memory N,\n bytes memory E,\n bytes memory S\n ) internal view returns (bool, bytes memory) {\n return ModexpPrecompile.modexp(S, E, N);\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev An interface for contracts implementing a DNSSEC digest.\n */\ninterface Digest {\n /**\n * @dev Verifies a cryptographic hash.\n * @param data The data to hash.\n * @param hash The hash to compare to.\n * @return True iff the hashed data matches the provided hash value.\n */\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure virtual returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/digests/DummyDigest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\n\n/**\n * @dev Implements a dummy DNSSEC digest that approves all hashes, for testing.\n */\ncontract DummyDigest is Digest {\n function verify(\n bytes calldata,\n bytes calldata\n ) external pure override returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA1Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../../utils/BytesUtils.sol\";\nimport \"@ensdomains/solsha1/contracts/SHA1.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA1 digest.\n */\ncontract SHA1Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 20, \"Invalid sha1 hash length\");\n bytes32 expected = hash.readBytes20(0);\n bytes20 computed = SHA1.sha1(data);\n return expected == computed;\n }\n}\n" + }, + "contracts/dnssec-oracle/digests/SHA256Digest.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"./Digest.sol\";\nimport \"../../utils/BytesUtils.sol\";\n\n/**\n * @dev Implements the DNSSEC SHA256 digest.\n */\ncontract SHA256Digest is Digest {\n using BytesUtils for *;\n\n function verify(\n bytes calldata data,\n bytes calldata hash\n ) external pure override returns (bool) {\n require(hash.length == 32, \"Invalid sha256 hash length\");\n return sha256(data) == hash.readBytes32(0);\n }\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/DNSSECImpl.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nimport \"./Owned.sol\";\nimport \"./RRUtils.sol\";\nimport \"./DNSSEC.sol\";\nimport \"./algorithms/Algorithm.sol\";\nimport \"./digests/Digest.sol\";\nimport \"../utils/BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/*\n * @dev An oracle contract that verifies and stores DNSSEC-validated DNS records.\n * @note This differs from the DNSSEC spec defined in RFC4034 and RFC4035 in some key regards:\n * - NSEC & NSEC3 are not supported; only positive proofs are allowed.\n * - Proofs involving wildcard names will not validate.\n * - TTLs on records are ignored, as data is not stored persistently.\n * - Canonical form of names is not checked; in ENS this is done on the frontend, so submitting\n * proofs with non-canonical names will only result in registering unresolvable ENS names.\n */\ncontract DNSSECImpl is DNSSEC, Owned {\n using Buffer for Buffer.buffer;\n using BytesUtils for bytes;\n using RRUtils for *;\n\n uint16 constant DNSCLASS_IN = 1;\n\n uint16 constant DNSTYPE_DS = 43;\n uint16 constant DNSTYPE_DNSKEY = 48;\n\n uint256 constant DNSKEY_FLAG_ZONEKEY = 0x100;\n\n error InvalidLabelCount(bytes name, uint256 labelsExpected);\n error SignatureNotValidYet(uint32 inception, uint32 now);\n error SignatureExpired(uint32 expiration, uint32 now);\n error InvalidClass(uint16 class);\n error InvalidRRSet();\n error SignatureTypeMismatch(uint16 rrsetType, uint16 sigType);\n error InvalidSignerName(bytes rrsetName, bytes signerName);\n error InvalidProofType(uint16 proofType);\n error ProofNameMismatch(bytes signerName, bytes proofName);\n error NoMatchingProof(bytes signerName);\n\n mapping(uint8 => Algorithm) public algorithms;\n mapping(uint8 => Digest) public digests;\n\n /**\n * @dev Constructor.\n * @param _anchors The binary format RR entries for the root DS records.\n */\n constructor(bytes memory _anchors) {\n // Insert the 'trust anchors' - the key hashes that start the chain\n // of trust for all other records.\n anchors = _anchors;\n }\n\n /**\n * @dev Sets the contract address for a signature verification algorithm.\n * Callable only by the owner.\n * @param id The algorithm ID\n * @param algo The address of the algorithm contract.\n */\n function setAlgorithm(uint8 id, Algorithm algo) public owner_only {\n algorithms[id] = algo;\n emit AlgorithmUpdated(id, address(algo));\n }\n\n /**\n * @dev Sets the contract address for a digest verification algorithm.\n * Callable only by the owner.\n * @param id The digest ID\n * @param digest The address of the digest contract.\n */\n function setDigest(uint8 id, Digest digest) public owner_only {\n digests[id] = digest;\n emit DigestUpdated(id, address(digest));\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input\n )\n external\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n return verifyRRSet(input, block.timestamp);\n }\n\n /**\n * @dev Takes a chain of signed DNS records, verifies them, and returns the data from the last record set in the chain.\n * Reverts if the records do not form an unbroken chain of trust to the DNSSEC anchor records.\n * @param input A list of signed RRSets.\n * @param now The Unix timestamp to validate the records at.\n * @return rrs The RRData from the last RRSet in the chain.\n * @return inception The inception time of the signed record set.\n */\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n )\n public\n view\n virtual\n override\n returns (bytes memory rrs, uint32 inception)\n {\n bytes memory proof = anchors;\n for (uint256 i = 0; i < input.length; i++) {\n RRUtils.SignedSet memory rrset = validateSignedSet(\n input[i],\n proof,\n now\n );\n proof = rrset.data;\n inception = rrset.inception;\n }\n return (proof, inception);\n }\n\n /**\n * @dev Validates an RRSet against the already trusted RR provided in `proof`.\n *\n * @param input The signed RR set. This is in the format described in section\n * 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature\n * data, followed by a series of canonicalised RR records that the signature\n * applies to.\n * @param proof The DNSKEY or DS to validate the signature against.\n * @param now The current timestamp.\n */\n function validateSignedSet(\n RRSetWithSignature memory input,\n bytes memory proof,\n uint256 now\n ) internal view returns (RRUtils.SignedSet memory rrset) {\n rrset = input.rrset.readSignedSet();\n\n // Do some basic checks on the RRs and extract the name\n bytes memory name = validateRRs(rrset, rrset.typeCovered);\n if (name.labelCount(0) != rrset.labels) {\n revert InvalidLabelCount(name, rrset.labels);\n }\n rrset.name = name;\n\n // All comparisons involving the Signature Expiration and\n // Inception fields MUST use \"serial number arithmetic\", as\n // defined in RFC 1982\n\n // o The validator's notion of the current time MUST be less than or\n // equal to the time listed in the RRSIG RR's Expiration field.\n if (!RRUtils.serialNumberGte(rrset.expiration, uint32(now))) {\n revert SignatureExpired(rrset.expiration, uint32(now));\n }\n\n // o The validator's notion of the current time MUST be greater than or\n // equal to the time listed in the RRSIG RR's Inception field.\n if (!RRUtils.serialNumberGte(uint32(now), rrset.inception)) {\n revert SignatureNotValidYet(rrset.inception, uint32(now));\n }\n\n // Validate the signature\n verifySignature(name, rrset, input, proof);\n\n return rrset;\n }\n\n /**\n * @dev Validates a set of RRs.\n * @param rrset The RR set.\n * @param typecovered The type covered by the RRSIG record.\n */\n function validateRRs(\n RRUtils.SignedSet memory rrset,\n uint16 typecovered\n ) internal pure returns (bytes memory name) {\n // Iterate over all the RRs\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n // We only support class IN (Internet)\n if (iter.class != DNSCLASS_IN) {\n revert InvalidClass(iter.class);\n }\n\n if (name.length == 0) {\n name = iter.name();\n } else {\n // Name must be the same on all RRs. We do things this way to avoid copying the name\n // repeatedly.\n if (\n name.length != iter.data.nameLength(iter.offset) ||\n !name.equals(0, iter.data, iter.offset, name.length)\n ) {\n revert InvalidRRSet();\n }\n }\n\n // o The RRSIG RR's Type Covered field MUST equal the RRset's type.\n if (iter.dnstype != typecovered) {\n revert SignatureTypeMismatch(iter.dnstype, typecovered);\n }\n }\n }\n\n /**\n * @dev Performs signature verification.\n *\n * Throws or reverts if unable to verify the record.\n *\n * @param name The name of the RRSIG record, in DNS label-sequence format.\n * @param data The original data to verify.\n * @param proof A DS or DNSKEY record that's already verified by the oracle.\n */\n function verifySignature(\n bytes memory name,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n bytes memory proof\n ) internal view {\n // o The RRSIG RR's Signer's Name field MUST be the name of the zone\n // that contains the RRset.\n if (!name.isSubdomainOf(rrset.signerName)) {\n revert InvalidSignerName(name, rrset.signerName);\n }\n\n RRUtils.RRIterator memory proofRR = proof.iterateRRs(0);\n // Check the proof\n if (proofRR.dnstype == DNSTYPE_DS) {\n verifyWithDS(rrset, data, proofRR);\n } else if (proofRR.dnstype == DNSTYPE_DNSKEY) {\n verifyWithKnownKey(rrset, data, proofRR);\n } else {\n revert InvalidProofType(proofRR.dnstype);\n }\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known public key.\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithKnownKey(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n // Check the DNSKEY's owner name matches the signer name on the RRSIG\n for (; !proof.done(); proof.next()) {\n bytes memory proofName = proof.name();\n if (!proofName.equals(rrset.signerName)) {\n revert ProofNameMismatch(rrset.signerName, proofName);\n }\n\n bytes memory keyrdata = proof.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n return;\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify some data using a provided key and a signature.\n * @param dnskey The dns key record to verify the signature with.\n * @param rrset The signed RRSET being verified.\n * @param data The original data `rrset` was decoded from.\n * @return True iff the key verifies the signature.\n */\n function verifySignatureWithKey(\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata,\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data\n ) internal view returns (bool) {\n // TODO: Check key isn't expired, unless updating key itself\n\n // The Protocol Field MUST have value 3 (RFC4034 2.1.2)\n if (dnskey.protocol != 3) {\n return false;\n }\n\n // o The RRSIG RR's Signer's Name, Algorithm, and Key Tag fields MUST\n // match the owner name, algorithm, and key tag for some DNSKEY RR in\n // the zone's apex DNSKEY RRset.\n if (dnskey.algorithm != rrset.algorithm) {\n return false;\n }\n uint16 computedkeytag = keyrdata.computeKeytag();\n if (computedkeytag != rrset.keytag) {\n return false;\n }\n\n // o The matching DNSKEY RR MUST be present in the zone's apex DNSKEY\n // RRset, and MUST have the Zone Flag bit (DNSKEY RDATA Flag bit 7)\n // set.\n if (dnskey.flags & DNSKEY_FLAG_ZONEKEY == 0) {\n return false;\n }\n\n Algorithm algorithm = algorithms[dnskey.algorithm];\n if (address(algorithm) == address(0)) {\n return false;\n }\n return algorithm.verify(keyrdata, data.rrset, data.sig);\n }\n\n /**\n * @dev Attempts to verify a signed RRSET against an already known hash. This function assumes\n * that the record\n * @param rrset The signed set to verify.\n * @param data The original data the signed set was read from.\n * @param proof The serialized DS or DNSKEY record to use as proof.\n */\n function verifyWithDS(\n RRUtils.SignedSet memory rrset,\n RRSetWithSignature memory data,\n RRUtils.RRIterator memory proof\n ) internal view {\n uint256 proofOffset = proof.offset;\n for (\n RRUtils.RRIterator memory iter = rrset.rrs();\n !iter.done();\n iter.next()\n ) {\n if (iter.dnstype != DNSTYPE_DNSKEY) {\n revert InvalidProofType(iter.dnstype);\n }\n\n bytes memory keyrdata = iter.rdata();\n RRUtils.DNSKEY memory dnskey = keyrdata.readDNSKEY(\n 0,\n keyrdata.length\n );\n if (verifySignatureWithKey(dnskey, keyrdata, rrset, data)) {\n // It's self-signed - look for a DS record to verify it.\n if (\n verifyKeyWithDS(rrset.signerName, proof, dnskey, keyrdata)\n ) {\n return;\n }\n // Rewind proof iterator to the start for the next loop iteration.\n proof.nextOffset = proofOffset;\n proof.next();\n }\n }\n revert NoMatchingProof(rrset.signerName);\n }\n\n /**\n * @dev Attempts to verify a key using DS records.\n * @param keyname The DNS name of the key, in DNS label-sequence format.\n * @param dsrrs The DS records to use in verification.\n * @param dnskey The dnskey to verify.\n * @param keyrdata The RDATA section of the key.\n * @return True if a DS record verifies this key.\n */\n function verifyKeyWithDS(\n bytes memory keyname,\n RRUtils.RRIterator memory dsrrs,\n RRUtils.DNSKEY memory dnskey,\n bytes memory keyrdata\n ) internal view returns (bool) {\n uint16 keytag = keyrdata.computeKeytag();\n for (; !dsrrs.done(); dsrrs.next()) {\n bytes memory proofName = dsrrs.name();\n if (!proofName.equals(keyname)) {\n revert ProofNameMismatch(keyname, proofName);\n }\n\n RRUtils.DS memory ds = dsrrs.data.readDS(\n dsrrs.rdataOffset,\n dsrrs.nextOffset - dsrrs.rdataOffset\n );\n if (ds.keytag != keytag) {\n continue;\n }\n if (ds.algorithm != dnskey.algorithm) {\n continue;\n }\n\n Buffer.buffer memory buf;\n buf.init(keyname.length + keyrdata.length);\n buf.append(keyname);\n buf.append(keyrdata);\n if (verifyDSHash(ds.digestType, buf.buf, ds.digest)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @dev Attempts to verify a DS record's hash value against some data.\n * @param digesttype The digest ID from the DS record.\n * @param data The data to digest.\n * @param digest The digest data to check against.\n * @return True iff the digest matches.\n */\n function verifyDSHash(\n uint8 digesttype,\n bytes memory data,\n bytes memory digest\n ) internal view returns (bool) {\n if (address(digests[digesttype]) == address(0)) {\n return false;\n }\n return digests[digesttype].verify(data, digest);\n }\n}\n" + }, + "contracts/dnssec-oracle/Owned.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Contract mixin for 'owned' contracts.\n */\ncontract Owned {\n address public owner;\n\n modifier owner_only() {\n require(msg.sender == owner);\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setOwner(address newOwner) public owner_only {\n owner = newOwner;\n }\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../utils/BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/dnssec-oracle/SHA1.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary SHA1 {\n event Debug(bytes32 x);\n\n function sha1(bytes memory data) internal pure returns (bytes20 ret) {\n assembly {\n // Get a safe scratch location\n let scratch := mload(0x40)\n\n // Get the data length, and point data at the first byte\n let len := mload(data)\n data := add(data, 32)\n\n // Find the length after padding\n let totallen := add(and(add(len, 1), 0xFFFFFFFFFFFFFFC0), 64)\n switch lt(sub(totallen, len), 9)\n case 1 {\n totallen := add(totallen, 64)\n }\n\n let h := 0x6745230100EFCDAB890098BADCFE001032547600C3D2E1F0\n\n function readword(ptr, off, count) -> result {\n result := 0\n if lt(off, count) {\n result := mload(add(ptr, off))\n count := sub(count, off)\n if lt(count, 32) {\n let mask := not(sub(exp(256, sub(32, count)), 1))\n result := and(result, mask)\n }\n }\n }\n\n for {\n let i := 0\n } lt(i, totallen) {\n i := add(i, 64)\n } {\n mstore(scratch, readword(data, i, len))\n mstore(add(scratch, 32), readword(data, add(i, 32), len))\n\n // If we loaded the last byte, store the terminator byte\n switch lt(sub(len, i), 64)\n case 1 {\n mstore8(add(scratch, sub(len, i)), 0x80)\n }\n\n // If this is the last block, store the length\n switch eq(i, sub(totallen, 64))\n case 1 {\n mstore(\n add(scratch, 32),\n or(mload(add(scratch, 32)), mul(len, 8))\n )\n }\n\n // Expand the 16 32-bit words into 80\n for {\n let j := 64\n } lt(j, 128) {\n j := add(j, 12)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 12))),\n mload(add(scratch, sub(j, 32)))\n ),\n xor(\n mload(add(scratch, sub(j, 56))),\n mload(add(scratch, sub(j, 64)))\n )\n )\n temp := or(\n and(\n mul(temp, 2),\n 0xFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE\n ),\n and(\n div(temp, 0x80000000),\n 0x0000000100000001000000010000000100000001000000010000000100000001\n )\n )\n mstore(add(scratch, j), temp)\n }\n for {\n let j := 128\n } lt(j, 320) {\n j := add(j, 24)\n } {\n let temp := xor(\n xor(\n mload(add(scratch, sub(j, 24))),\n mload(add(scratch, sub(j, 64)))\n ),\n xor(\n mload(add(scratch, sub(j, 112))),\n mload(add(scratch, sub(j, 128)))\n )\n )\n temp := or(\n and(\n mul(temp, 4),\n 0xFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC\n ),\n and(\n div(temp, 0x40000000),\n 0x0000000300000003000000030000000300000003000000030000000300000003\n )\n )\n mstore(add(scratch, j), temp)\n }\n\n let x := h\n let f := 0\n let k := 0\n for {\n let j := 0\n } lt(j, 80) {\n j := add(j, 1)\n } {\n switch div(j, 20)\n case 0 {\n // f = d xor (b and (c xor d))\n f := xor(\n div(x, 0x100000000000000000000),\n div(x, 0x10000000000)\n )\n f := and(div(x, 0x1000000000000000000000000000000), f)\n f := xor(div(x, 0x10000000000), f)\n k := 0x5A827999\n }\n case 1 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0x6ED9EBA1\n }\n case 2 {\n // f = (b and c) or (d and (b or c))\n f := or(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := and(div(x, 0x10000000000), f)\n f := or(\n and(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n ),\n f\n )\n k := 0x8F1BBCDC\n }\n case 3 {\n // f = b xor c xor d\n f := xor(\n div(x, 0x1000000000000000000000000000000),\n div(x, 0x100000000000000000000)\n )\n f := xor(div(x, 0x10000000000), f)\n k := 0xCA62C1D6\n }\n // temp = (a leftrotate 5) + f + e + k + w[i]\n let temp := and(\n div(\n x,\n 0x80000000000000000000000000000000000000000000000\n ),\n 0x1F\n )\n temp := or(\n and(\n div(x, 0x800000000000000000000000000000000000000),\n 0xFFFFFFE0\n ),\n temp\n )\n temp := add(f, temp)\n temp := add(and(x, 0xFFFFFFFF), temp)\n temp := add(k, temp)\n temp := add(\n div(\n mload(add(scratch, mul(j, 4))),\n 0x100000000000000000000000000000000000000000000000000000000\n ),\n temp\n )\n x := or(\n div(x, 0x10000000000),\n mul(temp, 0x10000000000000000000000000000000000000000)\n )\n x := or(\n and(\n x,\n 0xFFFFFFFF00FFFFFFFF000000000000FFFFFFFF00FFFFFFFF\n ),\n mul(\n or(\n and(div(x, 0x4000000000000), 0xC0000000),\n and(div(x, 0x400000000000000000000), 0x3FFFFFFF)\n ),\n 0x100000000000000000000\n )\n )\n }\n\n h := and(\n add(h, x),\n 0xFFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF00FFFFFFFF\n )\n }\n ret := mul(\n or(\n or(\n or(\n or(\n and(\n div(h, 0x100000000),\n 0xFFFFFFFF00000000000000000000000000000000\n ),\n and(\n div(h, 0x1000000),\n 0xFFFFFFFF000000000000000000000000\n )\n ),\n and(div(h, 0x10000), 0xFFFFFFFF0000000000000000)\n ),\n and(div(h, 0x100), 0xFFFFFFFF00000000)\n ),\n and(h, 0xFFFFFFFF)\n ),\n 0x1000000000000000000000000\n )\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n uint256 public constant LIFETIME = type(uint256).max;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /// v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n /// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n /// @dev Returns whether the given spender can transfer a given token ID\n /// @param spender address of the spender to query\n /// @param tokenId uint256 ID of the token to be transferred\n /// @return bool whether the msg.sender is approved for the given token ID,\n /// is an operator of the owner, or is the owner of the token\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n Ownable(msg.sender);\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /// @dev Gets the owner of the specified token ID. Names become unowned\n /// when their registration expires.\n /// @param tokenId uint256 ID of the token to query the owner of\n /// @return address currently marked as the owner of the given token ID\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /// @dev Register a name.\n /// @param id The token ID (keccak256 of the label).\n /// @param owner The address that should own the registration.\n /// @param duration Duration in seconds for the registration.\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override virtual returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /// @dev Register a name, without modifying the registry.\n /// @param id The token ID (keccak256 of the label).\n /// @param owner The address that should own the registration.\n /// @param duration Duration in seconds for the registration.\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n\n uint256 expiration;\n\n if (duration == 0) {\n // Lifetime registration\n expiration = LIFETIME;\n } else {\n // Annual registration\n expiration = block.timestamp + duration;\n }\n\n expiries[id] = expiration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override virtual live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(expiries[id] != LIFETIME, \"Lifetime names cannot be renewed\");\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /// @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n\n function _exists(uint256 tokenId) internal view override returns (bool) {\n return super._exists(tokenId);\n }\n\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/DummyOracle.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyOracle {\n int256 value;\n\n constructor(int256 _value) public {\n set(_value);\n }\n\n function set(int256 _value) public {\n value = _value;\n }\n\n function latestAnswer() public view returns (int256) {\n return value;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"../utils/StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/// @dev A registrar controller for registering and renewing names at fixed cost.\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE = 0x4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override virtual returns (IPriceOracle.Price memory price) {\n require(duration == 0 || duration >= MIN_REGISTRATION_DURATION, \"Invalid duration\");\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration != 0 && duration < MIN_REGISTRATION_DURATION ) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".creator\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorV3Interface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/ILinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface ILinearPremiumPriceOracle {\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256);\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorV3Interface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/mocks/DummyProxyRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\ncontract DummyProxyRegistry {\n address target;\n\n constructor(address _target) public {\n target = _target;\n }\n\n function proxies(address a) external view returns (address) {\n return target;\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"../utils/StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\";\n\n\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n AggregatorV3Interface internal usdOracle;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n uint256 public constant LIFETIME_MULTIPLIER = 10;\n\n // Oracle address\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorV3Interface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n\n uint256 totalPrice = duration == 0 \n ? basePrice * LIFETIME_MULTIPLIER \n : basePrice; \n\n return\n IPriceOracle.Price({\n base: attoUSDToWei(totalPrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n (, int256 ethPrice,,,) = usdOracle.latestRoundData();\n return (amount * 1e18) / uint256(ethPrice);\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n (, int256 ethPrice,,,) = usdOracle.latestRoundData();\n return (amount * uint256(ethPrice)) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/TestResolver.sol": { + "content": "pragma solidity >=0.8.4;\n\n/**\n * @dev A test resolver implementation\n */\ncontract TestResolver {\n mapping(bytes32 => address) addresses;\n\n constructor() public {}\n\n function supportsInterface(bytes4 interfaceID) public pure returns (bool) {\n return interfaceID == 0x01ffc9a7 || interfaceID == 0x3b3b57de;\n }\n\n function addr(bytes32 node) public view returns (address) {\n return addresses[node];\n }\n\n function setAddr(bytes32 node, address addr) public {\n addresses[node] = addr;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/registry/ENSRegistryWithFallback.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\nimport \"./ENSRegistry.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistryWithFallback is ENSRegistry {\n ENS public old;\n\n /**\n * @dev Constructs a new ENS registrar.\n */\n constructor(ENS _old) public ENSRegistry() {\n old = _old;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.resolver(node);\n }\n\n return super.resolver(node);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(bytes32 node) public view override returns (address) {\n if (!recordExists(node)) {\n return old.owner(node);\n }\n\n return super.owner(node);\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view override returns (uint64) {\n if (!recordExists(node)) {\n return old.ttl(node);\n }\n\n return super.ttl(node);\n }\n\n function _setOwner(bytes32 node, address owner) internal override {\n address addr = owner;\n if (addr == address(0x0)) {\n addr = address(this);\n }\n\n super._setOwner(node, addr);\n }\n}\n" + }, + "contracts/registry/FIFSRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them.\n */\ncontract FIFSRegistrar {\n ENS ens;\n bytes32 rootNode;\n\n modifier only_owner(bytes32 label) {\n address currentOwner = ens.owner(\n keccak256(abi.encodePacked(rootNode, label))\n );\n require(currentOwner == address(0x0) || currentOwner == msg.sender);\n _;\n }\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) public {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name, or change the owner of an existing registration.\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public only_owner(label) {\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/registry/TestRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * A registrar that allocates subdomains to the first person to claim them, but\n * expires registrations a fixed period after they're initially claimed.\n */\ncontract TestRegistrar {\n uint256 constant registrationPeriod = 4 weeks;\n\n ENS public immutable ens;\n bytes32 public immutable rootNode;\n mapping(bytes32 => uint256) public expiryTimes;\n\n /**\n * Constructor.\n * @param ensAddr The address of the ENS registry.\n * @param node The node that this registrar administers.\n */\n constructor(ENS ensAddr, bytes32 node) {\n ens = ensAddr;\n rootNode = node;\n }\n\n /**\n * Register a name that's not currently registered\n * @param label The hash of the label to register.\n * @param owner The address of the new owner.\n */\n function register(bytes32 label, address owner) public {\n require(expiryTimes[label] < block.timestamp);\n\n expiryTimes[label] = block.timestamp + registrationPeriod;\n ens.setSubnodeOwner(rootNode, label, owner);\n }\n}\n" + }, + "contracts/resolvers/IMulticallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IMulticallable {\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n}\n" + }, + "contracts/resolvers/mocks/DummyNameWrapper.sol": { + "content": "pragma solidity ^0.8.4;\n\n/**\n * @dev Implements a dummy NameWrapper which returns the caller's address\n */\ncontract DummyNameWrapper {\n function ownerOf(uint256 /* id */) public view returns (address) {\n return tx.origin;\n }\n}\n" + }, + "contracts/resolvers/Multicallable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"./IMulticallable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\nabstract contract Multicallable is IMulticallable, ERC165 {\n function _multicall(\n bytes32 nodehash,\n bytes[] calldata data\n ) internal returns (bytes[] memory results) {\n results = new bytes[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n if (nodehash != bytes32(0)) {\n bytes32 txNamehash = bytes32(data[i][4:36]);\n require(\n txNamehash == nodehash,\n \"multicall: All records must have a matching namehash\"\n );\n }\n (bool success, bytes memory result) = address(this).delegatecall(\n data[i]\n );\n require(success);\n results[i] = result;\n }\n return results;\n }\n\n // This function provides an extra security check when called\n // from priviledged contracts (such as EthRegistrarController)\n // that can set records on behalf of the node owners\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results) {\n return _multicall(nodehash, data);\n }\n\n function multicall(\n bytes[] calldata data\n ) public override returns (bytes[] memory results) {\n return _multicall(bytes32(0), data);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IMulticallable).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 714;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"../../resolvers/profiles/IExtendedDNSResolver.sol\";\nimport \"../../resolvers/profiles/IAddressResolver.sol\";\nimport \"../../resolvers/profiles/IAddrResolver.sol\";\nimport \"../../resolvers/profiles/ITextResolver.sol\";\nimport \"../../utils/HexUtils.sol\";\nimport \"../../utils/BytesUtils.sol\";\n\n/**\n * @dev Resolves names on ENS by interpreting record data stored in a DNS TXT record.\n * This resolver implements the IExtendedDNSResolver interface, meaning that when\n * a DNS name specifies it as the resolver via a TXT record, this resolver's\n * resolve() method is invoked, and is passed any additional information from that\n * text record. This resolver implements a simple text parser allowing a variety\n * of records to be specified in text, which will then be used to resolve the name\n * in ENS.\n *\n * To use this, set a TXT record on your DNS name in the following format:\n * ENS1
\n *\n * For example:\n * ENS1 2.dnsname.ens.eth a[60]=0x1234...\n *\n * The record data consists of a series of key=value pairs, separated by spaces. Keys\n * may have an optional argument in square brackets, and values may be either unquoted\n * - in which case they may not contain spaces - or single-quoted. Single quotes in\n * a quoted value may be backslash-escaped.\n *\n *\n * ┌────────┐\n * │ ┌───┐ │\n * ┌──────────────────────────────┴─┤\" \"│◄─┴────────────────────────────────────────┐\n * │ └───┘ │\n * │ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌────────────┐ ┌───┐ │\n * ^─┴─►│key├─┬─►│\"[\"├───►│arg├───►│\"]\"├─┬─►│\"=\"├─┬─►│\"'\"├───►│quoted_value├───►│\"'\"├─┼─$\n * └───┘ │ └───┘ └───┘ └───┘ │ └───┘ │ └───┘ └────────────┘ └───┘ │\n * └──────────────────────────┘ │ ┌──────────────┐ │\n * └─────────►│unquoted_value├─────────┘\n * └──────────────┘\n *\n * Record types:\n * - a[] - Specifies how an `addr()` request should be resolved for the specified\n * `coinType`. Ethereum has `coinType` 60. The value must be 0x-prefixed hexadecimal, and will\n * be returned unmodified; this means that non-EVM addresses will need to be translated\n * into binary format and then encoded in hex.\n * Examples:\n * - a[60]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7\n * - a[0]=0x00149010587f8364b964fcaa70687216b53bd2cbd798\n * - a[e] - Specifies how an `addr()` request should be resolved for the specified\n * `chainId`. The value must be 0x-prefixed hexadecimal. When encoding an address for an\n * EVM-based cryptocurrency that uses a chainId instead of a coinType, this syntax *must*\n * be used in place of the coin type - eg, Optimism is `a[e10]`, not `a[2147483658]`.\n * A list of supported cryptocurrencies for both syntaxes can be found here:\n * https://github.com/ensdomains/address-encoder/blob/master/docs/supported-cryptocurrencies.md\n * Example:\n * - a[e10]=0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7\n * - t[] - Specifies how a `text()` request should be resolved for the specified `key`.\n * Examples:\n * - t[com.twitter]=nicksdjohnson\n * - t[url]='https://ens.domains/'\n * - t[note]='I\\'m great'\n */\ncontract ExtendedDNSResolver is IExtendedDNSResolver, IERC165 {\n using HexUtils for *;\n using BytesUtils for *;\n using Strings for *;\n\n uint256 private constant COIN_TYPE_ETH = 60;\n\n error NotImplemented();\n error InvalidAddressFormat(bytes addr);\n\n function supportsInterface(\n bytes4 interfaceId\n ) external view virtual override returns (bool) {\n return interfaceId == type(IExtendedDNSResolver).interfaceId;\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data,\n bytes calldata context\n ) external pure override returns (bytes memory) {\n bytes4 selector = bytes4(data);\n if (selector == IAddrResolver.addr.selector) {\n return _resolveAddr(context);\n } else if (selector == IAddressResolver.addr.selector) {\n return _resolveAddress(data, context);\n } else if (selector == ITextResolver.text.selector) {\n return _resolveText(data, context);\n }\n revert NotImplemented();\n }\n\n function _resolveAddress(\n bytes calldata data,\n bytes calldata context\n ) internal pure returns (bytes memory) {\n (, uint256 coinType) = abi.decode(data[4:], (bytes32, uint256));\n bytes memory value;\n // Per https://docs.ens.domains/ensip/11#specification\n if (coinType & 0x80000000 != 0) {\n value = _findValue(\n context,\n bytes.concat(\n \"a[e\",\n bytes((coinType & 0x7fffffff).toString()),\n \"]=\"\n )\n );\n } else {\n value = _findValue(\n context,\n bytes.concat(\"a[\", bytes(coinType.toString()), \"]=\")\n );\n }\n if (value.length == 0) {\n return value;\n }\n (address record, bool valid) = value.hexToAddress(2, value.length);\n if (!valid) revert InvalidAddressFormat(value);\n return abi.encode(record);\n }\n\n function _resolveAddr(\n bytes calldata context\n ) internal pure returns (bytes memory) {\n bytes memory value = _findValue(context, \"a[60]=\");\n if (value.length == 0) {\n return value;\n }\n (address record, bool valid) = value.hexToAddress(2, value.length);\n if (!valid) revert InvalidAddressFormat(value);\n return abi.encode(record);\n }\n\n function _resolveText(\n bytes calldata data,\n bytes calldata context\n ) internal pure returns (bytes memory) {\n (, string memory key) = abi.decode(data[4:], (bytes32, string));\n bytes memory value = _findValue(\n context,\n bytes.concat(\"t[\", bytes(key), \"]=\")\n );\n return abi.encode(value);\n }\n\n uint256 constant STATE_START = 0;\n uint256 constant STATE_IGNORED_KEY = 1;\n uint256 constant STATE_IGNORED_KEY_ARG = 2;\n uint256 constant STATE_VALUE = 3;\n uint256 constant STATE_QUOTED_VALUE = 4;\n uint256 constant STATE_UNQUOTED_VALUE = 5;\n uint256 constant STATE_IGNORED_VALUE = 6;\n uint256 constant STATE_IGNORED_QUOTED_VALUE = 7;\n uint256 constant STATE_IGNORED_UNQUOTED_VALUE = 8;\n\n /**\n * @dev Implements a DFA to parse the text record, looking for an entry\n * matching `key`.\n * @param data The text record to parse.\n * @param key The exact key to search for.\n * @return value The value if found, or an empty string if `key` does not exist.\n */\n function _findValue(\n bytes memory data,\n bytes memory key\n ) internal pure returns (bytes memory value) {\n // Here we use a simple state machine to parse the text record. We\n // process characters one at a time; each character can trigger a\n // transition to a new state, or terminate the DFA and return a value.\n // For states that expect to process a number of tokens, we use\n // inner loops for efficiency reasons, to avoid the need to go\n // through the outer loop and switch statement for every character.\n uint256 state = STATE_START;\n uint256 len = data.length;\n for (uint256 i = 0; i < len; ) {\n if (state == STATE_START) {\n // Look for a matching key.\n if (data.equals(i, key, 0, key.length)) {\n i += key.length;\n state = STATE_VALUE;\n } else {\n state = STATE_IGNORED_KEY;\n }\n } else if (state == STATE_IGNORED_KEY) {\n for (; i < len; i++) {\n if (data[i] == \"=\") {\n state = STATE_IGNORED_VALUE;\n i += 1;\n break;\n } else if (data[i] == \"[\") {\n state = STATE_IGNORED_KEY_ARG;\n i += 1;\n break;\n }\n }\n } else if (state == STATE_IGNORED_KEY_ARG) {\n for (; i < len; i++) {\n if (data[i] == \"]\") {\n state = STATE_IGNORED_VALUE;\n i += 1;\n if (data[i] == \"=\") {\n i += 1;\n }\n break;\n }\n }\n } else if (state == STATE_VALUE) {\n if (data[i] == \"'\") {\n state = STATE_QUOTED_VALUE;\n i += 1;\n } else {\n state = STATE_UNQUOTED_VALUE;\n }\n } else if (state == STATE_QUOTED_VALUE) {\n uint256 start = i;\n uint256 valueLen = 0;\n bool escaped = false;\n for (; i < len; i++) {\n if (escaped) {\n data[start + valueLen] = data[i];\n valueLen += 1;\n escaped = false;\n } else {\n if (data[i] == \"\\\\\") {\n escaped = true;\n } else if (data[i] == \"'\") {\n return data.substring(start, valueLen);\n } else {\n data[start + valueLen] = data[i];\n valueLen += 1;\n }\n }\n }\n } else if (state == STATE_UNQUOTED_VALUE) {\n uint256 start = i;\n for (; i < len; i++) {\n if (data[i] == \" \") {\n return data.substring(start, i - start);\n }\n }\n return data.substring(start, len - start);\n } else if (state == STATE_IGNORED_VALUE) {\n if (data[i] == \"'\") {\n state = STATE_IGNORED_QUOTED_VALUE;\n i += 1;\n } else {\n state = STATE_IGNORED_UNQUOTED_VALUE;\n }\n } else if (state == STATE_IGNORED_QUOTED_VALUE) {\n bool escaped = false;\n for (; i < len; i++) {\n if (escaped) {\n escaped = false;\n } else {\n if (data[i] == \"\\\\\") {\n escaped = true;\n } else if (data[i] == \"'\") {\n i += 1;\n while (data[i] == \" \") {\n i += 1;\n }\n state = STATE_START;\n break;\n }\n }\n }\n } else {\n assert(state == STATE_IGNORED_UNQUOTED_VALUE);\n for (; i < len; i++) {\n if (data[i] == \" \") {\n while (data[i] == \" \") {\n i += 1;\n }\n state = STATE_START;\n break;\n }\n }\n }\n }\n return \"\";\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedDNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedDNSResolver {\n function resolve(\n bytes memory name,\n bytes memory data,\n bytes memory context\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/PublicResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"../registry/ENS.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./Multicallable.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract PublicResolver is\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ReverseClaimer\n{\n ENS immutable ens;\n INameWrapper immutable nameWrapper;\n address immutable trustedETHController;\n address immutable trustedReverseRegistrar;\n\n /**\n * A mapping of operators. An address that is authorised for an address\n * may make any changes to the name that the owner could, but may not update\n * the set of authorisations.\n * (owner, operator) => approved\n */\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * A mapping of delegates. A delegate that is authorised by an owner\n * for a name may make changes to the name's resolver, but may not update\n * the set of token approvals.\n * (owner, name, delegate) => approved\n */\n mapping(address => mapping(bytes32 => mapping(address => bool)))\n private _tokenApprovals;\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n // Logged when a delegate is approved or an approval is revoked.\n event Approved(\n address owner,\n bytes32 indexed node,\n address indexed delegate,\n bool indexed approved\n );\n\n constructor(\n ENS _ens,\n INameWrapper wrapperAddress,\n address _trustedETHController,\n address _trustedReverseRegistrar\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n nameWrapper = wrapperAddress;\n trustedETHController = _trustedETHController;\n trustedReverseRegistrar = _trustedReverseRegistrar;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) external {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Approve a delegate to be able to updated records on a node.\n */\n function approve(bytes32 node, address delegate, bool approved) external {\n require(msg.sender != delegate, \"Setting delegate status for self\");\n\n _tokenApprovals[msg.sender][node][delegate] = approved;\n emit Approved(msg.sender, node, delegate, approved);\n }\n\n /**\n * @dev Check to see if the delegate has been approved by the owner for the node.\n */\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) public view returns (bool) {\n return _tokenApprovals[owner][node][delegate];\n }\n\n function isAuthorised(bytes32 node) internal view override returns (bool) {\n if (\n msg.sender == trustedETHController ||\n msg.sender == trustedReverseRegistrar\n ) {\n return true;\n }\n address owner = ens.owner(node);\n if (owner == address(nameWrapper)) {\n owner = nameWrapper.ownerOf(uint256(node));\n }\n return\n owner == msg.sender ||\n isApprovedForAll(owner, msg.sender) ||\n isApprovedFor(owner, node, msg.sender);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n override(\n Multicallable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Ownable.sol": { + "content": "pragma solidity ^0.8.4;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(isOwner(msg.sender));\n _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function isOwner(address addr) public view returns (bool) {\n return owner == addr;\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/test/mocks/DummyOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/ITextResolver.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract DummyOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n\n if (bytes4(data) == bytes4(0x12345678)) {\n return abi.encode(\"foo\");\n }\n revert OffchainLookup(\n address(this),\n urls,\n data,\n DummyOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (address) {\n return 0x69420f05A11f617B4B74fFe2E04B2D300dFA556F;\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n require(\n keccak256(response) == keccak256(extraData),\n \"Response data error\"\n );\n if (bytes4(extraData) == bytes4(keccak256(\"name(bytes32)\"))) {\n return abi.encode(\"offchain.test.eth\");\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "contracts/test/mocks/LegacyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\ncontract LegacyResolver {\n function addr(bytes32 /* node */) public view returns (address) {\n return address(this);\n }\n}\n" + }, + "contracts/test/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10 ** uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10 ** uint256(decimals()));\n }\n }\n}\n" + }, + "contracts/test/mocks/MockOffchainResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"../../../contracts/resolvers/profiles/IExtendedResolver.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\ncontract MockOffchainResolver is IExtendedResolver, ERC165 {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function resolve(\n bytes calldata /* name */,\n bytes calldata data\n ) external view returns (bytes memory) {\n string[] memory urls = new string[](1);\n urls[0] = \"https://example.com/\";\n revert OffchainLookup(\n address(this),\n urls,\n data,\n MockOffchainResolver.resolveCallback.selector,\n data\n );\n }\n\n function addr(bytes32) external pure returns (bytes memory) {\n return abi.encode(\"onchain\");\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory) {\n (, bytes memory callData, ) = abi.decode(\n extraData,\n (bytes, bytes, bytes4)\n );\n if (bytes4(callData) == bytes4(keccak256(\"addr(bytes32)\"))) {\n (bytes memory result, , ) = abi.decode(\n response,\n (bytes, uint64, bytes)\n );\n return result;\n }\n return abi.encode(address(this));\n }\n}\n" + }, + "contracts/test/mocks/MockReverseClaimerImplementer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../../../contracts/registry/ENS.sol\";\nimport {ReverseClaimer} from \"../../../contracts/reverseRegistrar/ReverseClaimer.sol\";\n\ncontract MockReverseClaimerImplementer is ReverseClaimer {\n constructor(ENS ens, address claimant) ReverseClaimer(ens, claimant) {}\n}\n" + }, + "contracts/test/mocks/StringUtilsTest.sol": { + "content": "// SPDX-License-Identifier: MIT\nimport \"../../../contracts/utils/StringUtils.sol\";\n\nlibrary StringUtilsTest {\n function testEscape(\n string calldata testStr\n ) public pure returns (string memory) {\n return StringUtils.escape(testStr);\n }\n}\n" + }, + "contracts/test/TestBytesUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/utils/BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function testKeccak() public pure {\n require(\n \"\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n require(\n \"foo\".keccak(0, 3) ==\n bytes32(\n 0x41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d\n ),\n \"Incorrect hash of 'foo'\"\n );\n require(\n \"foo\".keccak(0, 0) ==\n bytes32(\n 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n ),\n \"Incorrect hash of empty string\"\n );\n }\n\n function testEquals() public pure {\n require(\"hello\".equals(\"hello\") == true, \"String equality\");\n require(\"hello\".equals(\"goodbye\") == false, \"String inequality\");\n require(\n \"hello\".equals(1, \"ello\") == true,\n \"Substring to string equality\"\n );\n require(\n \"hello\".equals(1, \"jello\", 1, 4) == true,\n \"Substring to substring equality\"\n );\n require(\n \"zhello\".equals(1, \"abchello\", 3) == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"0x0102030000\".equals(0, \"0x010203\") == false,\n \"Compare with offset and trailing bytes\"\n );\n }\n\n function testComparePartial() public pure {\n require(\n \"xax\".compare(1, 1, \"xxbxx\", 2, 1) < 0 == true,\n \"Compare same length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxabxx\", 2, 2) < 0 == true,\n \"Compare different length\"\n );\n require(\n \"xax\".compare(1, 1, \"xxaxx\", 2, 1) == 0 == true,\n \"Compare same with different offset\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 33\n ) ==\n 0 ==\n true,\n \"Compare different long strings same length smaller partial length which must be equal\"\n );\n require(\n \"01234567890123450123456789012345ab\".compare(\n 0,\n 33,\n \"01234567890123450123456789012345aa\",\n 0,\n 34\n ) <\n 0 ==\n true,\n \"Compare long strings same length different partial length\"\n );\n require(\n \"0123456789012345012345678901234a\".compare(\n 0,\n 32,\n \"0123456789012345012345678901234b\",\n 0,\n 32\n ) <\n 0 ==\n true,\n \"Compare strings exactly 32 characters long\"\n );\n }\n\n function testCompare() public pure {\n require(\"a\".compare(\"a\") == 0 == true, \"Compare equal\");\n require(\n \"a\".compare(\"b\") < 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"b\".compare(\"a\") > 0 == true,\n \"Compare different value with same length\"\n );\n require(\n \"aa\".compare(\"ab\") < 0 == true,\n \"Compare different value with multiple length\"\n );\n require(\n \"a\".compare(\"aa\") < 0 == true,\n \"Compare different value with different length\"\n );\n require(\n \"aa\".compare(\"a\") > 0 == true,\n \"Compare different value with different length\"\n );\n bytes memory longChar = \"1234567890123456789012345678901234\";\n require(\n longChar.compare(longChar) == 0 == true,\n \"Compares more than 32 bytes char\"\n );\n bytes memory otherLongChar = \"2234567890123456789012345678901234\";\n require(\n longChar.compare(otherLongChar) < 0 == true,\n \"Compare long char with difference at start\"\n );\n }\n\n function testSubstring() public pure {\n require(\n keccak256(bytes(\"hello\".substring(0, 0))) == keccak256(bytes(\"\")),\n \"Copy 0 bytes\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 4))) ==\n keccak256(bytes(\"hell\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(1, 4))) ==\n keccak256(bytes(\"ello\")),\n \"Copy substring\"\n );\n require(\n keccak256(bytes(\"hello\".substring(0, 5))) ==\n keccak256(bytes(\"hello\")),\n \"Copy whole string\"\n );\n }\n\n function testReadUint8() public pure {\n require(uint(\"a\".readUint8(0)) == 0x61, \"a == 0x61\");\n require(uint(\"ba\".readUint8(1)) == 0x61, \"a == 0x61\");\n }\n\n function testReadUint16() public pure {\n require(uint(\"abc\".readUint16(1)) == 0x6263, \"Read uint 16\");\n }\n\n function testReadUint32() public pure {\n require(uint(\"abcde\".readUint32(1)) == 0x62636465, \"Read uint 32\");\n }\n\n function testReadBytes20() public pure {\n require(\n bytes32(\"abcdefghijklmnopqrstuv\".readBytes20(1)) ==\n bytes32(\n 0x62636465666768696a6b6c6d6e6f707172737475000000000000000000000000\n ),\n \"readBytes20\"\n );\n }\n\n function testReadBytes32() public pure {\n require(\n \"0123456789abcdef0123456789abcdef\".readBytes32(0) ==\n bytes32(\n 0x3031323334353637383961626364656630313233343536373839616263646566\n ),\n \"readBytes32\"\n );\n }\n\n function testBase32HexDecodeWord() public pure {\n require(\n \"C4\".base32HexDecodeWord(0, 2) == bytes32(bytes1(\"a\")),\n \"Decode 'a'\"\n );\n require(\n \"C5GG\".base32HexDecodeWord(0, 4) == bytes32(bytes2(\"aa\")),\n \"Decode 'aa'\"\n );\n require(\n \"C5GM2\".base32HexDecodeWord(0, 5) == bytes32(bytes3(\"aaa\")),\n \"Decode 'aaa'\"\n );\n require(\n \"C5GM2O8\".base32HexDecodeWord(0, 7) == bytes32(bytes4(\"aaaa\")),\n \"Decode 'aaaa'\"\n );\n require(\n \"C5GM2OB1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa'\"\n );\n require(\n \"c5gm2Ob1\".base32HexDecodeWord(0, 8) == bytes32(bytes5(\"aaaaa\")),\n \"Decode 'aaaaa' lowercase\"\n );\n require(\n \"C5H66P35CPJMGQBADDM6QRJFE1ON4SRKELR7EU3PF8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet\"\n );\n require(\n \"c5h66p35cpjmgqbaddm6qrjfe1on4srkelr7eu3pf8\".base32HexDecodeWord(\n 0,\n 42\n ) == bytes32(bytes26(\"abcdefghijklmnopqrstuvwxyz\")),\n \"Decode alphabet lowercase\"\n );\n require(\n \"C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GM2OB1C5GG\"\n .base32HexDecodeWord(0, 52) ==\n bytes32(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"),\n \"Decode 32*'a'\"\n );\n require(\n \" bst4hlje7r0o8c8p4o8q582lm0ejmiqt\\x07matoken\\x03xyz\\x00\"\n .base32HexDecodeWord(1, 32) ==\n bytes32(hex\"5f3a48d66e3ec18431192611a2a055b01d3b4b5d\"),\n \"Decode real bytes32hex\"\n );\n }\n}\n" + }, + "contracts/test/TestRRUtils.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../../contracts/dnssec-oracle/RRUtils.sol\";\nimport \"../../contracts/utils/BytesUtils.sol\";\n\ncontract TestRRUtils {\n using BytesUtils for *;\n using RRUtils for *;\n\n uint16 constant DNSTYPE_A = 1;\n uint16 constant DNSTYPE_CNAME = 5;\n uint16 constant DNSTYPE_MX = 15;\n uint16 constant DNSTYPE_TEXT = 16;\n uint16 constant DNSTYPE_RRSIG = 46;\n uint16 constant DNSTYPE_TYPE1234 = 1234;\n\n function testNameLength() public pure {\n require(hex\"00\".nameLength(0) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(4) == 1, \"nameLength('.') == 1\");\n require(hex\"0361626300\".nameLength(0) == 5, \"nameLength('abc.') == 5\");\n }\n\n function testLabelCount() public pure {\n require(hex\"00\".labelCount(0) == 0, \"labelCount('.') == 0\");\n require(hex\"016100\".labelCount(0) == 1, \"labelCount('a.') == 1\");\n require(\n hex\"016201610000\".labelCount(0) == 2,\n \"labelCount('b.a.') == 2\"\n );\n require(\n hex\"066574686c61620378797a00\".labelCount(6 + 1) == 1,\n \"nameLength('(bthlab).xyz.') == 6\"\n );\n }\n\n function testIterateRRs() public pure {\n // a. IN A 3600 127.0.0.1\n // b.a. IN A 3600 192.168.1.1\n bytes\n memory rrs = hex\"0161000001000100000e1000047400000101620161000001000100000e100004c0a80101\";\n bytes[2] memory names = [bytes(hex\"016100\"), bytes(hex\"0162016100\")];\n bytes[2] memory rdatas = [bytes(hex\"74000001\"), bytes(hex\"c0a80101\")];\n uint i = 0;\n for (\n RRUtils.RRIterator memory iter = rrs.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n require(uint(iter.dnstype) == 1, \"Type matches\");\n require(uint(iter.class) == 1, \"Class matches\");\n require(uint(iter.ttl) == 3600, \"TTL matches\");\n require(\n keccak256(iter.name()) == keccak256(names[i]),\n \"Name matches\"\n );\n require(\n keccak256(iter.rdata()) == keccak256(rdatas[i]),\n \"Rdata matches\"\n );\n i++;\n }\n require(i == 2, \"Expected 2 records\");\n }\n\n // Canonical ordering https://tools.ietf.org/html/rfc4034#section-6.1\n function testCompareNames() public pure {\n bytes memory bthLabXyz = hex\"066274686c61620378797a00\";\n bytes memory ethLabXyz = hex\"066574686c61620378797a00\";\n bytes memory xyz = hex\"0378797a00\";\n bytes memory a_b_c = hex\"01610162016300\";\n bytes memory b_b_c = hex\"01620162016300\";\n bytes memory c = hex\"016300\";\n bytes memory d = hex\"016400\";\n bytes memory a_d_c = hex\"01610164016300\";\n bytes memory b_a_c = hex\"01620161016300\";\n bytes memory ab_c_d = hex\"0261620163016400\";\n bytes memory a_c_d = hex\"01610163016400\";\n bytes\n memory verylong1_eth = hex\"223031323334353637383930313233343536373839303132333435363738393031613031303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n bytes\n memory verylong2_eth = hex\"2130313233343536373839303132333435363738393031323334353637383930316131303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637380365746800\";\n\n require(\n hex\"0301616100\".compareNames(hex\"0302616200\") < 0,\n \"label lengths are correctly checked\"\n );\n require(\n a_b_c.compareNames(c) > 0,\n \"one name has a difference of >1 label to with the same root name\"\n );\n require(\n a_b_c.compareNames(d) < 0,\n \"one name has a difference of >1 label to with different root name\"\n );\n require(\n a_b_c.compareNames(a_d_c) < 0,\n \"two names start the same but have differences in later labels\"\n );\n require(\n a_b_c.compareNames(b_a_c) > 0,\n \"the first label sorts later, but the first label sorts earlier\"\n );\n require(\n ab_c_d.compareNames(a_c_d) > 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(\n a_b_c.compareNames(b_b_c) < 0,\n \"two names where the first label on one is a prefix of the first label on the other\"\n );\n require(xyz.compareNames(ethLabXyz) < 0, \"xyz comes before ethLab.xyz\");\n require(\n bthLabXyz.compareNames(ethLabXyz) < 0,\n \"bthLab.xyz comes before ethLab.xyz\"\n );\n require(\n bthLabXyz.compareNames(bthLabXyz) == 0,\n \"bthLab.xyz and bthLab.xyz are the same\"\n );\n require(\n ethLabXyz.compareNames(bthLabXyz) > 0,\n \"ethLab.xyz comes after bethLab.xyz\"\n );\n require(bthLabXyz.compareNames(xyz) > 0, \"bthLab.xyz comes after xyz\");\n\n require(\n verylong1_eth.compareNames(verylong2_eth) > 0,\n \"longa.vlong.eth comes after long.vlong.eth\"\n );\n }\n\n function testSerialNumberGt() public pure {\n require(RRUtils.serialNumberGte(1, 0), \"1 >= 0\");\n require(!RRUtils.serialNumberGte(0, 1), \"!(0 <= 1)\");\n require(RRUtils.serialNumberGte(0, 0xFFFFFFFF), \"0 >= 0xFFFFFFFF\");\n require(!RRUtils.serialNumberGte(0xFFFFFFFF, 0), \"!(0 <= 0xFFFFFFFF)\");\n require(\n RRUtils.serialNumberGte(0x11111111, 0xAAAAAAAA),\n \"0x11111111 >= 0xAAAAAAAA\"\n );\n require(RRUtils.serialNumberGte(1, 1), \"1 >= 1\");\n }\n\n function testKeyTag() public view {\n require(\n hex\"0101030803010001a80020a95566ba42e886bb804cda84e47ef56dbd7aec612615552cec906d2116d0ef207028c51554144dfeafe7c7cb8f005dd18234133ac0710a81182ce1fd14ad2283bc83435f9df2f6313251931a176df0da51e54f42e604860dfb359580250f559cc543c4ffd51cbe3de8cfd06719237f9fc47ee729da06835fa452e825e9a18ebc2ecbcf563474652c33cf56a9033bcdf5d973121797ec8089041b6e03a1b72d0a735b984e03687309332324f27c2dba85e9db15e83a0143382e974b0621c18e625ecec907577d9e7bade95241a81ebbe8a901d4d3276e40b114c0a2e6fc38d19c2e6aab02644b2813f575fc21601e0dee49cd9ee96a43103e524d62873d\"\n .computeKeytag() == 19036,\n \"Invalid keytag\"\n );\n require(\n hex\"010003050440000003ba2fa05a75e173bede89eb71831ab14035f2408ad09df4d8dc8f8f72e8f13506feaddf7b04cb14958b82966e3420562302c4002bc4fd088432e160519bb14dae82443850c1423e06085710b5caf070d46b7ba7e481414f6a5fe225fdca984c959091645d0cf1c9a1a313d7e7fb7ba60b967b71a65f8cef2c3768e11b081c8fcf\"\n .computeKeytag() == 21693,\n \"Invalid keytag (2)\"\n );\n require(\n hex\"0100030503010001bfa54c38d909fabb0f937d70d775ba0df4c0badb09707d995249406950407a621c794c68b186b15dbf8f9f9ea231e9f96414ccda4eceb50b17a9ac6c4bd4b95da04849e96ee791578b703bc9ae184fb1794bac792a0787f693a40f19f523ee6dbd3599dbaaa9a50437926ecf6438845d1d49448962524f2a1a7a36b3a0a1eca3\"\n .computeKeytag() == 33630\n );\n require(\n hex\"0101030803010001acffb409bcc939f831f7a1e5ec88f7a59255ec53040be432027390a4ce896d6f9086f3c5e177fbfe118163aaec7af1462c47945944c4e2c026be5e98bbcded25978272e1e3e079c5094d573f0e83c92f02b32d3513b1550b826929c80dd0f92cac966d17769fd5867b647c3f38029abdc48152eb8f207159ecc5d232c7c1537c79f4b7ac28ff11682f21681bf6d6aba555032bf6f9f036beb2aaa5b3778d6eebfba6bf9ea191be4ab0caea759e2f773a1f9029c73ecb8d5735b9321db085f1b8e2d8038fe2941992548cee0d67dd4547e11dd63af9c9fc1c5466fb684cf009d7197c2cf79e792ab501e6a8a1ca519af2cb9b5f6367e94c0d47502451357be1b5\"\n .computeKeytag() == 20326,\n \"Invalid keytag (3)\"\n );\n }\n}\n" + }, + "contracts/utils/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/utils/DummyRevertResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ncontract DummyRevertResolver {\n function resolve(\n bytes calldata,\n bytes calldata\n ) external pure returns (bytes memory) {\n revert(\"Not Supported\");\n }\n\n function supportsInterface(bytes4) external pure returns (bool) {\n return true;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32, bool) {\n require(lastIdx - idx <= 64);\n (bytes memory r, bool valid) = hexToBytes(str, idx, lastIdx);\n if (!valid) {\n return (bytes32(0), false);\n }\n bytes32 ret;\n assembly {\n ret := shr(mul(4, sub(64, sub(lastIdx, idx))), mload(add(r, 32)))\n }\n return (ret, true);\n }\n\n function hexToBytes(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes memory r, bool valid) {\n uint256 hexLength = lastIdx - idx;\n if (hexLength % 2 == 1) {\n revert(\"Invalid string length\");\n }\n r = new bytes(hexLength / 2);\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n mstore8(add(add(r, 32), div(sub(i, idx), 2)), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n\n /**\n * @dev Attempts to convert an address to a hex string\n * @param addr The _addr to parse\n */\n function addressToHex(address addr) internal pure returns (string memory) {\n bytes memory hexString = new bytes(40);\n for (uint i = 0; i < 20; i++) {\n bytes1 byteValue = bytes1(uint8(uint160(addr) >> (8 * (19 - i))));\n bytes1 highNibble = bytes1(uint8(byteValue) / 16);\n bytes1 lowNibble = bytes1(\n uint8(byteValue) - 16 * uint8(highNibble)\n );\n hexString[2 * i] = _nibbleToHexChar(highNibble);\n hexString[2 * i + 1] = _nibbleToHexChar(lowNibble);\n }\n return string(hexString);\n }\n\n function _nibbleToHexChar(\n bytes1 nibble\n ) internal pure returns (bytes1 hexChar) {\n if (uint8(nibble) < 10) return bytes1(uint8(nibble) + 0x30);\n else return bytes1(uint8(nibble) + 0x57);\n }\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n return functionStaticCall(target, data, gasleft());\n }\n\n /**\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @param gasLimit The gas limit to use for the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n uint256 gasLimit\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gasLimit,\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/MigrationHelper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {Controllable} from \"../wrapper/Controllable.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract MigrationHelper is Ownable, Controllable {\n IBaseRegistrar public immutable registrar;\n INameWrapper public immutable wrapper;\n address public migrationTarget;\n\n error MigrationTargetNotSet();\n\n event MigrationTargetUpdated(address indexed target);\n\n constructor(IBaseRegistrar _registrar, INameWrapper _wrapper) {\n registrar = _registrar;\n wrapper = _wrapper;\n }\n\n function setMigrationTarget(address target) external onlyOwner {\n migrationTarget = target;\n emit MigrationTargetUpdated(target);\n }\n\n function migrateNames(\n address nameOwner,\n uint256[] memory tokenIds,\n bytes memory data\n ) external onlyController {\n if (migrationTarget == address(0)) {\n revert MigrationTargetNotSet();\n }\n\n for (uint256 i = 0; i < tokenIds.length; i++) {\n registrar.safeTransferFrom(\n nameOwner,\n migrationTarget,\n tokenIds[i],\n data\n );\n }\n }\n\n function migrateWrappedNames(\n address nameOwner,\n uint256[] memory tokenIds,\n bytes memory data\n ) external onlyController {\n if (migrationTarget == address(0)) {\n revert MigrationTargetNotSet();\n }\n\n uint256[] memory amounts = new uint256[](tokenIds.length);\n for (uint256 i = 0; i < amounts.length; i++) {\n amounts[i] = 1;\n }\n wrapper.safeBatchTransferFrom(\n nameOwner,\n migrationTarget,\n tokenIds,\n amounts,\n data\n );\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../utils/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n\n /**\n * @dev Escapes special characters in a given string\n *\n * @param str The string to escape\n * @return The escaped string\n */\n function escape(string memory str) internal pure returns (string memory) {\n bytes memory strBytes = bytes(str);\n uint extraChars = 0;\n\n // count extra space needed for escaping\n for (uint i = 0; i < strBytes.length; i++) {\n if (_needsEscaping(strBytes[i])) {\n extraChars++;\n }\n }\n\n // allocate buffer with the exact size needed\n bytes memory buffer = new bytes(strBytes.length + extraChars);\n uint index = 0;\n\n // escape characters\n for (uint i = 0; i < strBytes.length; i++) {\n if (_needsEscaping(strBytes[i])) {\n buffer[index++] = \"\\\\\";\n buffer[index++] = _getEscapedChar(strBytes[i]);\n } else {\n buffer[index++] = strBytes[i];\n }\n }\n\n return string(buffer);\n }\n\n // determine if a character needs escaping\n function _needsEscaping(bytes1 char) private pure returns (bool) {\n return\n char == '\"' ||\n char == \"/\" ||\n char == \"\\\\\" ||\n char == \"\\n\" ||\n char == \"\\r\" ||\n char == \"\\t\";\n }\n\n // get the escaped character\n function _getEscapedChar(bytes1 char) private pure returns (bytes1) {\n if (char == \"\\n\") return \"n\";\n if (char == \"\\r\") return \"r\";\n if (char == \"\\t\") return \"t\";\n return char;\n }\n}\n" + }, + "contracts/utils/TestBytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BytesUtils} from \"./BytesUtils.sol\";\n\ncontract TestBytesUtils {\n using BytesUtils for *;\n\n function readLabel(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32, uint256) {\n return name.readLabel(offset);\n }\n\n function namehash(\n bytes calldata name,\n uint256 offset\n ) public pure returns (bytes32) {\n return name.namehash(offset);\n }\n}\n" + }, + "contracts/utils/TestHexUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {HexUtils} from \"./HexUtils.sol\";\n\ncontract TestHexUtils {\n using HexUtils for *;\n\n function hexToBytes(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes memory, bool) {\n return name.hexToBytes(idx, lastInx);\n }\n\n function hexStringToBytes32(\n bytes calldata name,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (bytes32, bool) {\n return name.hexStringToBytes32(idx, lastInx);\n }\n\n function hexToAddress(\n bytes calldata input,\n uint256 idx,\n uint256 lastInx\n ) public pure returns (address, bool) {\n return input.hexToAddress(idx, lastInx);\n }\n}\n" + }, + "contracts/utils/TestNameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {NameEncoder} from \"./NameEncoder.sol\";\n\ncontract TestNameEncoder {\n using NameEncoder for string;\n\n function encodeName(\n string memory name\n ) public pure returns (bytes memory, bytes32) {\n return name.dnsEncodeName();\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {BytesUtils} from \"../utils/BytesUtils.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nerror ResolverNotContract();\n\nerror ResolverError(bytes returnData);\n\nerror HttpError(HttpErrorItem[] errors);\n\nstruct HttpErrorItem {\n uint16 status;\n string message;\n}\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct MulticallChecks {\n bool isCallback;\n bool hasExtendedResolver;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\nstruct Result {\n bool success;\n bytes returnData;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (Result[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (Result[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (Result[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (Result[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n if (!resolverAddress.isContract()) {\n revert ResolverNotContract();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory reverseResolvedData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n reverseResolvedData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (Result[] memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n Result[] memory results,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(result.returnData, (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n result.returnData,\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (Result[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data,\n bool isSafe\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n if (isSafe) {\n result = LowLevelCallUtils.functionStaticCall(target, data);\n } else {\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\n }\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _checkInterface(\n address resolver,\n bytes4 interfaceId\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _checkSafetyAndItem(\n bytes memory name,\n bytes memory item,\n address resolver,\n MulticallChecks memory multicallChecks\n ) internal view returns (bool, bytes memory) {\n if (!multicallChecks.isCallback) {\n if (multicallChecks.hasExtendedResolver) {\n return (\n true,\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\n );\n }\n return (_checkInterface(resolver, bytes4(item)), item);\n }\n return (true, item);\n }\n\n function _checkMulticall(\n MulticallData memory multicallData\n ) internal view returns (MulticallChecks memory) {\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _checkInterface(\n multicallData.resolver,\n type(IExtendedResolver).interfaceId\n );\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n return MulticallChecks(isCallback, hasExtendedResolver);\n }\n\n function _checkResolveSingle(Result memory result) internal pure {\n if (!result.success) {\n if (bytes4(result.returnData) == HttpError.selector) {\n bytes memory returnData = result.returnData;\n assembly {\n revert(add(returnData, 32), mload(returnData))\n }\n }\n revert ResolverError(result.returnData);\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (Result[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new Result[](length);\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n\n if (failure) {\n results[i] = Result(false, item);\n continue;\n }\n\n bool isSafe = false;\n (isSafe, item) = _checkSafetyAndItem(\n multicallData.name,\n item,\n multicallData.resolver,\n multicallChecks\n );\n\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(\n multicallData.resolver,\n item,\n isSafe\n );\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && multicallChecks.hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = Result(success, returnData);\n extraDatas[i].data = item;\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_CRE8OR = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/ERC1155ReceiverMock.sol": { + "content": "// Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/test/token/ERC1155/ERC1155.behaviour.js\n// Copyright (c) 2016-2020 zOS Global Limited\n\n// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract ERC1155ReceiverMock is IERC1155Receiver, ERC165 {\n bytes4 private _recRetval;\n bool private _recReverts;\n bytes4 private _batRetval;\n bool private _batReverts;\n\n event Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes data\n );\n event BatchReceived(\n address operator,\n address from,\n uint256[] ids,\n uint256[] values,\n bytes data\n );\n\n constructor(\n bytes4 recRetval,\n bool recReverts,\n bytes4 batRetval,\n bool batReverts\n ) {\n _recRetval = recRetval;\n _recReverts = recReverts;\n _batRetval = batRetval;\n _batReverts = batReverts;\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external override returns (bytes4) {\n require(!_recReverts, \"ERC1155ReceiverMock: reverting on receive\");\n emit Received(operator, from, id, value, data);\n return _recRetval;\n }\n\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external override returns (bytes4) {\n require(\n !_batReverts,\n \"ERC1155ReceiverMock: reverting on batch receive\"\n );\n emit BatchReceived(operator, from, ids, values, data);\n return _batRetval;\n }\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../../utils/BytesUtils.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/mocks/UpgradedNameWrapperMock.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport {INameWrapperUpgrade} from \"../INameWrapperUpgrade.sol\";\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../../utils/BytesUtils.sol\";\n\ncontract UpgradedNameWrapperMock is INameWrapperUpgrade {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n event NameUpgraded(\n bytes name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes extraData\n );\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n address registrant = registrar.ownerOf(uint256(labelhash));\n require(\n msg.sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"No approval for registrar\"\n );\n } else {\n address owner = ens.owner(node);\n require(\n msg.sender == owner &&\n ens.isApprovedForAll(owner, address(this)),\n \"No approval for registry\"\n );\n }\n emit NameUpgraded(\n name,\n wrappedOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/StaticMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ncontract StaticMetadataService {\n string private _uri;\n\n constructor(string memory _metaDataUri) {\n _uri = _metaDataUri;\n }\n\n function uri(uint256) public view returns (string memory) {\n return _uri;\n }\n}\n" + }, + "contracts/wrapper/test/NameGriefer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {INameWrapper} from \"../INameWrapper.sol\";\nimport {ENS} from \"../../registry/ENS.sol\";\nimport {BytesUtils} from \"../../utils/BytesUtils.sol\";\nimport {IERC1155Receiver} from \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\ncontract NameGriefer is IERC1155Receiver {\n using BytesUtils for *;\n\n ENS public immutable ens;\n INameWrapper public immutable wrapper;\n\n constructor(INameWrapper _wrapper) {\n wrapper = _wrapper;\n ENS _ens = _wrapper.ens();\n ens = _ens;\n _ens.setApprovalForAll(address(_wrapper), true);\n }\n\n function destroy(bytes calldata name) public {\n wrapper.wrap(name, address(this), address(0));\n }\n\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256,\n bytes calldata\n ) external override returns (bytes4) {\n require(operator == address(this), \"Operator must be us\");\n require(from == address(0), \"Token must be new\");\n\n // Unwrap the name\n bytes memory name = wrapper.names(bytes32(id));\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n wrapper.unwrap(parentNode, labelhash, address(this));\n\n // Here we can do something with the name before it's permanently burned, like\n // set the resolver or create subdomains.\n\n return NameGriefer.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external override returns (bytes4) {\n return NameGriefer.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external view override returns (bool) {\n return\n interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).\n interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\")) ^ bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`).\n }\n}\n" + }, + "contracts/wrapper/test/TestNameWrapperReentrancy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../INameWrapper.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\ncontract TestNameWrapperReentrancy is ERC165, IERC1155Receiver {\n INameWrapper nameWrapper;\n address owner;\n bytes32 parentNode;\n bytes32 labelHash;\n uint256 tokenId;\n\n constructor(\n address _owner,\n INameWrapper _nameWrapper,\n bytes32 _parentNode,\n bytes32 _labelHash\n ) {\n owner = _owner;\n nameWrapper = _nameWrapper;\n parentNode = _parentNode;\n labelHash = _labelHash;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function onERC1155Received(\n address,\n address,\n uint256 _id,\n uint256,\n bytes calldata\n ) public override returns (bytes4) {\n tokenId = _id;\n nameWrapper.unwrap(parentNode, labelHash, owner);\n\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n\n function claimToOwner() public {\n nameWrapper.safeTransferFrom(address(this), owner, tokenId, 1, \"\");\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/solcInputs/877591c0c7c8cc635cf9fe0b1c3ee358.json b/solidity/dns-contracts/deployments/testnet/solcInputs/877591c0c7c8cc635cf9fe0b1c3ee358.json new file mode 100644 index 0000000..0a13044 --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/solcInputs/877591c0c7c8cc635cf9fe0b1c3ee358.json @@ -0,0 +1,169 @@ +{ + "language": "Solidity", + "sources": { + "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n// solhint-disable-next-line interface-starts-with-i\ninterface AggregatorV3Interface {\n function decimals() external view returns (uint8);\n\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n\n function getRoundData(\n uint80 _roundId\n ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n\n function latestRoundData()\n external\n view\n returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 30 days;\n uint256 public constant LIFETIME = type(uint256).max;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /// v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n /// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n /// @dev Returns whether the given spender can transfer a given token ID\n /// @param spender address of the spender to query\n /// @param tokenId uint256 ID of the token to be transferred\n /// @return bool whether the msg.sender is approved for the given token ID,\n /// is an operator of the owner, or is the owner of the token\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n Ownable(msg.sender);\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /// @dev Gets the owner of the specified token ID. Names become unowned\n /// when their registration expires.\n /// @param tokenId uint256 ID of the token to query the owner of\n /// @return address currently marked as the owner of the given token ID\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /// @dev Register a name.\n /// @param id The token ID (keccak256 of the label).\n /// @param owner The address that should own the registration.\n /// @param duration Duration in seconds for the registration.\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override virtual returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /// @dev Register a name, without modifying the registry.\n /// @param id The token ID (keccak256 of the label).\n /// @param owner The address that should own the registration.\n /// @param duration Duration in seconds for the registration.\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n\n uint256 expiration;\n\n if (duration == 31536000000) {\n // Lifetime registration\n expiration = LIFETIME;\n } else {\n // Annual registration\n expiration = block.timestamp + duration;\n }\n\n expiries[id] = expiration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, expiration);\n\n return expiration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override virtual live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(expiries[id] != LIFETIME, \"Lifetime names cannot be renewed\");\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /// @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n\n function _exists(uint256 tokenId) internal view override returns (bool) {\n return super._exists(tokenId);\n }\n\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"../utils/StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\nimport {TokenPriceOracle} from \"./TokenPriceOracle.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nusing SafeERC20 for IERC20;\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {ReferralController} from \"./ReferralController.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/// @dev A registrar controller for registering and renewing names at fixed cost.\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n TokenPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n ReferralController public immutable referralController;\n address public infoFi;\n mapping(bytes32 => uint256) public commitments;\n address public backendWallet;\n uint256 public untrackedInfoFi;\n mapping(address => bool) public verifiedTokens;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n modifier onlyBackend() {\n require(msg.sender == backendWallet, \"Not Backend\");\n _;\n }\n\n constructor(\n BaseRegistrarImplementation _base,\n TokenPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens,\n address _infoFi,\n ReferralController _referralController\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n infoFi = _infoFi;\n referralController = _referralController;\n }\n\n function setBackend(address wallet) public onlyOwner {\n backendWallet = wallet;\n }\n\n function setToken(address tokenAddress) public onlyOwner {\n verifiedTokens[tokenAddress] = true;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration,\n bool lifetime\n ) public view virtual override returns (IPriceOracle.Price memory price) {\n require(\n duration == 0 || duration >= MIN_REGISTRATION_DURATION,\n \"Invalid duration\"\n );\n bytes32 label = keccak256(bytes(name));\n price = prices.price(\n name,\n base.nameExpires(uint256(label)),\n duration,\n lifetime\n );\n }\n\n function rentPriceToken(\n string memory name,\n uint256 duration,\n string memory token,\n bool lifetime\n ) public view virtual override returns (IPriceOracle.Price memory price) {\n require(\n duration == 0 || duration >= MIN_REGISTRATION_DURATION,\n \"Invalid duration\"\n );\n bytes32 label = keccak256(bytes(name));\n price = prices.priceToken(\n name,\n base.nameExpires(uint256(label)),\n duration,\n token,\n lifetime\n );\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 2;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] memory data,\n bool reverseRecord,\n uint16 ownerControlledFuses,\n bool lifetime\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses,\n lifetime\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] memory data,\n bool reverseRecord,\n uint16 ownerControlledFuses,\n bool lifetime,\n string memory referree\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses,\n lifetime\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n referralController.setReferree(\n keccak256(bytes(name)),\n owner,\n expires\n );\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n _referralPayout(price, referree, name, owner);\n }\n\n function registerWithCard(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] memory data,\n bool reverseRecord,\n uint16 ownerControlledFuses,\n bool lifetime,\n string memory referree\n ) public onlyBackend {\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses,\n lifetime\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, owner);\n referralController.setReferree(\n keccak256(bytes(name)),\n owner,\n duration\n );\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n if (keccak256(bytes(referree)) != keccak256(bytes(\"\"))) {\n referralController.settlementRegisterWithCard(\n referree,\n name,\n owner,\n price.base + price.premium,\n receiver\n );\n }\n untrackedInfoFi += (((price.base + price.premium) * 35) / 100);\n }\n\n function resetInfoFi() external payable onlyOwner {\n require(msg.value > 0, \"Must send value to reset infoFi\");\n (bool ok, ) = payable(infoFi).call{value: msg.value}(\"\");\n require(ok, \"Payment to infoFi failed\");\n untrackedInfoFi = 0;\n }\n\n function _tokenTransfer(\n address tokenAddress,\n IPriceOracle.Price memory price\n ) internal {\n \n IERC20(tokenAddress).safeTransferFrom(\n msg.sender,\n address(this),\n price.base + price.premium\n );\n }\n\n function _internalRecordsCall(\n string memory name,\n bytes[] memory data,\n address owner,\n address resolver,\n bool reverseRecord,\n uint256 duration\n ) internal {\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n referralController.setReferree(\n keccak256(bytes(name)),\n owner,\n duration\n );\n }\n }\n\n function registerWithToken(\n RegisterParams memory registerParams,\n TokenParams memory tokenParams,\n bool lifetime,\n string memory referree\n ) external override {\n require(\n verifiedTokens[tokenParams.tokenAddress] == true,\n \"Unnacepted Token Address\"\n );\n _consumeCommitment(\n registerParams.name,\n registerParams.duration,\n makeCommitment(\n registerParams.name,\n registerParams.owner,\n registerParams.duration,\n registerParams.secret,\n registerParams.resolver,\n registerParams.data,\n registerParams.reverseRecord,\n registerParams.ownerControlledFuses,\n lifetime\n )\n );\n\n IPriceOracle.Price memory price = rentPriceToken(\n registerParams.name,\n registerParams.duration,\n tokenParams.token,\n lifetime\n );\n if (\n IERC20(tokenParams.tokenAddress).balanceOf(msg.sender) <\n price.base + price.premium\n ) {\n revert InsufficientValue();\n }\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n registerParams.name,\n registerParams.owner,\n registerParams.duration,\n registerParams.resolver,\n registerParams.ownerControlledFuses\n );\n\n _internalRecordsCall(\n registerParams.name,\n registerParams.data,\n registerParams.owner,\n registerParams.resolver,\n registerParams.reverseRecord,\n expires\n );\n _tokenTransfer(tokenParams.tokenAddress, price);\n\n emit NameRegistered(\n registerParams.name,\n keccak256(bytes(registerParams.name)),\n registerParams.owner,\n price.base,\n price.premium,\n expires\n );\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n\n uint256 referrals = referralController.totalReferrals(receiver);\n if (keccak256(bytes(referree)) != keccak256(bytes(\"\"))) {\n uint256 pct = referralController._rewardPct(referrals);\n\n IERC20(tokenParams.tokenAddress).safeTransfer(\n address(referralController),\n ((price.base + price.premium) * pct) / 100\n );\n referralController.settlementRegisterWithToken(\n referree,\n registerParams.name,\n registerParams.owner,\n price.base + price.premium,\n tokenParams.tokenAddress\n );\n }\n IERC20(tokenParams.tokenAddress).safeTransfer(\n infoFi,\n ((price.base + price.premium) * 35) / 100\n );\n }\n\n function renewCard(\n string calldata name,\n uint256 duration,\n bool lifetime\n ) external onlyBackend {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\n string memory referree = referralController.referredBy(labelhash);\n\n uint256 expires = nameWrapper.renew(tokenId, duration);\n referralController.updateReferralCode(keccak256(bytes(name)), expires);\n\n emit NameRenewed(name, labelhash, price.base, expires);\n if (\n referralController.referrees(keccak256(bytes(referree))) !=\n address(0)\n ) {\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n referralController.settlementCard(\n price.base + price.premium,\n receiver,\n referree\n );\n }\n untrackedInfoFi += ((price.base + price.premium) * 35) / 100;\n }\n\n function renew(\n string calldata name,\n uint256 duration,\n bool lifetime\n ) external payable {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\n string memory referree = referralController.referredBy(labelhash);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n referralController.updateReferralCode(keccak256(bytes(name)), expires);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n emit NameRenewed(name, labelhash, msg.value, expires);\n if (\n referralController.referrees(keccak256(bytes(referree))) !=\n address(0)\n ) {\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n referralController.settlement(\n price.base + price.premium,\n receiver,\n referree\n );\n }\n (bool ok, ) = payable(infoFi).call{\n value: ((price.base + price.premium) * 35) / 100\n }(\"\");\n require(ok, \"Payment to infoFi failed\");\n }\n\n function renewTokens(\n string calldata name,\n uint256 duration,\n string memory token,\n address tokenAddress,\n bool lifetime\n ) external override {\n require(\n verifiedTokens[tokenAddress] == true,\n \"Unnacepted Token Address\"\n );\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n string memory referree = referralController.referredBy(labelhash);\n IPriceOracle.Price memory price = rentPriceToken(\n name,\n duration,\n token,\n lifetime\n );\n if (\n IERC20(tokenAddress).balanceOf(msg.sender) <\n price.base + price.premium\n ) {\n revert InsufficientValue();\n }\n IERC20(tokenAddress).safeTransferFrom(\n msg.sender,\n address(this),\n price.base + price.premium\n );\n uint256 expires = nameWrapper.renew(tokenId, duration);\n referralController.updateReferralCode(keccak256(bytes(name)), expires);\n\n emit NameRenewed(name, labelhash, price.base + price.premium, expires);\n\n if (\n referralController.referrees(keccak256(bytes(referree))) !=\n address(0)\n ) {\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n uint256 referrals = referralController.totalReferrals(receiver);\n uint256 pct = referralController._rewardPct(referrals);\n\n IERC20(tokenAddress).safeTransferFrom(\n address(this),\n address(referralController),\n ((price.base + price.premium) * pct) / 100\n );\n referralController.settlementWithToken(\n price.base + price.premium,\n receiver,\n tokenAddress,\n referree\n );\n }\n IERC20(tokenAddress).safeTransferFrom(\n address(this),\n infoFi,\n ((price.base + price.premium) * 35) / 100\n );\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function withdrawTokens(address tokenAddress) public {\n IERC20(tokenAddress).safeTransfer(\n owner(),\n IERC20(tokenAddress).balanceOf(address(this))\n );\n }\n\n function _referralPayout(\n IPriceOracle.Price memory price,\n string memory referree,\n string memory name,\n address owner\n ) internal {\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n uint256 referrals = referralController.totalReferrals(receiver);\n if (keccak256(bytes(referree)) != keccak256(bytes(\"\"))) {\n uint256 pct = referralController._rewardPct(referrals);\n referralController.settlementRegister{\n value: (((price.base + price.premium) * pct) / 100)\n }(referree, name, owner, price.base + price.premium, receiver);\n }\n (bool ok, ) = payable(infoFi).call{\n value: ((price.base + price.premium) * 35) / 100\n }(\"\");\n require(ok, \"Payment to infoFi failed\");\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration != 0 && duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] memory data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".creator\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorV3Interface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n\n struct TokenParams{\n string token;\n address tokenAddress;\n }\n struct RegisterParams {\n string name;\n address owner;\n uint256 duration;\n bytes32 secret;\n address resolver;\n bytes[] data;\n bool reverseRecord;\n uint16 ownerControlledFuses;\n }\n function rentPrice(\n string memory,\n uint256,\n bool\n ) external view returns (IPriceOracle.Price memory);\n\n function rentPriceToken(\n string memory name,\n uint256 duration,\n string memory token,\n bool lifetime\n ) external view returns (IPriceOracle.Price memory price);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16,\n bool\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16,\n bool,\n string memory\n ) external payable;\n\n function registerWithToken(\n RegisterParams memory registerParams,\n TokenParams memory tokenParams,\n bool lifetime,\n string memory referree\n ) external;\n\n function renew(string calldata, uint256, bool) external payable;\n\n function renewTokens(\n string calldata name,\n uint256 duration,\n string memory token,\n address tokenAddress,\n bool lifetime\n ) external;\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration,\n bool lifetime\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/ReferralController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\nimport {IPriceOracle} from \"./IETHRegistrarController.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nusing SafeERC20 for IERC20;\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract ReferralController is Ownable {\n // Mapping from referral code to referrer address\n uint16 private constant TIER1 = 2;\n uint16 private constant TIER2 = 15;\n uint16 private constant TIER3 = 20;\n uint256 private constant PCT1 = 15;\n uint256 private constant PCT2 = 20;\n uint256 private constant PCT3 = 25;\n mapping(address => bool) public controllers;\n mapping(bytes32 => uint256) public commitments;\n mapping(bytes32 => address) public referrees;\n mapping(bytes32 => uint256) public expirydates;\n mapping(address => bytes32[]) public referrals;\n mapping(bytes32 => string) public referredBy;\n mapping(address => uint256) public nativeEarnings;\n mapping(address => mapping(address => uint256)) public tokenEarnings;\n\n bytes32[] public referralCodes;\n uint256 public untrackedEarnings;\n uint256 public snapshotUntrackedEarnings;\n mapping(address => uint256) public snapshotNativeEarnings;\n mapping(address => mapping(address => uint256))\n public snapshotTokenEarnings;\n uint256 public trackedNativeEarnings;\n mapping(address => uint256) public trackedTokenEarnings;\n\n event ReferralCodeAdded(string indexed code, address indexed referrer);\n event WithdrawalDispersed(address indexed);\n modifier onlyControllerOrOwner() {\n require(\n controllers[msg.sender] || msg.sender == owner(),\n \"Not a controller or owner\"\n );\n _;\n }\n\n function addController(address controller) external onlyOwner {\n require(controller != address(0), \"Invalid controller address\");\n controllers[controller] = true;\n }\n\n function settlementRegister(\n string memory referree,\n string memory name,\n address owner,\n uint256 amount,\n address receiver\n ) external payable onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n\n require(\n receiver != address(0) && receiver != owner,\n \"Invalid receiver address\"\n );\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n bool contains;\n for (uint256 i = 0; i < referrals[receiver].length; i++) {\n if (referrals[receiver][i] == keccak256(bytes(name))) {\n contains = true;\n break;\n }\n }\n if (contains == false) {\n referrals[receiver].push(keccak256(bytes(name)));\n referredBy[keccak256(bytes(name))] = referree;\n _applyNativeReward(receiver, amount, false);\n } else {\n _applyNativeReward(receiver, amount, false);\n }\n } else {\n payable(Ownable.owner()).transfer(amount);\n }\n }\n\n function settlementRegisterWithCard(\n string memory referree,\n string memory name,\n address owner,\n uint256 amount,\n address receiver\n ) external onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n require(\n receiver != address(0) && receiver != owner,\n \"Invalid receiver address\"\n );\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n bool contains;\n for (uint256 i = 0; i < referrals[receiver].length; i++) {\n if (referrals[receiver][i] == keccak256(bytes(name))) {\n contains = true;\n }\n }\n if (contains == false) {\n referrals[receiver].push(keccak256(bytes(name)));\n referredBy[keccak256(bytes(name))] = referree;\n _applyNativeReward(receiver, amount, true);\n } else {\n _applyNativeReward(receiver, amount, true);\n }\n }\n }\n\n /// @notice Only your controller or admin should be able to call this!\n function setReferree(\n bytes32 code,\n address who,\n uint256 duration\n ) external onlyControllerOrOwner {\n require(code != bytes32(0), \"Invalid referral code\");\n require(who != address(0), \"Invalid referree address\");\n require(\n referrees[code] == address(0),\n \"Referral code already registered\"\n );\n address prevReferree = referrees[code];\n if (prevReferree != address(0)) {\n referrals[prevReferree] = new bytes32[](0);\n }\n referrees[code] = who;\n referralCodes.push(code);\n expirydates[code] = duration;\n }\n\n function settlementCard(\n uint256 amount,\n address receiver,\n string memory referree\n ) external onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n require(receiver != address(0), \"Invalid receiver address\");\n _applyNativeReward(receiver, amount, true);\n }\n }\n\n function settlement(\n uint256 amount,\n address receiver,\n string memory referree\n ) external payable onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n require(receiver != address(0), \"Invalid receiver address\");\n _applyNativeReward(receiver, amount, false);\n } else {\n payable(Ownable.owner()).transfer(amount);\n }\n }\n\n function settlementWithToken(\n uint256 amount,\n address receiver,\n address tokenAddress,\n string memory referree\n ) external onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n require(receiver != address(0), \"Invalid receiver address\");\n _applyTokenReward(receiver, tokenAddress, amount);\n } else {\n IERC20(tokenAddress).safeTransfer(Ownable.owner(), amount);\n }\n }\n\n function settlementRegisterWithToken(\n string memory referree,\n string memory name,\n address owner,\n uint256 amount,\n address tokenAddress\n ) external onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n // Implement token settlement logic here if needed\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n address receiver = referrees[keccak256(bytes(referree))];\n if (receiver != address(0) && receiver != owner) {\n bool contains;\n for (uint256 i = 0; i < referrals[receiver].length; i++) {\n if (referrals[receiver][i] == keccak256(bytes(name))) {\n contains = true;\n }\n }\n if (contains == false) {\n referrals[receiver].push(keccak256(bytes(name)));\n referredBy[keccak256(bytes(name))] = referree;\n _applyTokenReward(receiver, tokenAddress, amount);\n } else {\n _applyTokenReward(receiver, tokenAddress, amount);\n }\n }\n } else {\n // If the referree is not registered, we can transfer the amount to the owner\n IERC20(tokenAddress).safeTransfer(Ownable.owner(), amount);\n }\n }\n\n function withdrawAllNativeEarnings(uint256 batch) external onlyOwner {\n for (uint256 i = 0; i < batch; ) {\n bytes32 code = referralCodes[batch];\n if (block.timestamp < expirydates[code]) {\n address referrer = referrees[code];\n uint256 earnings = nativeEarnings[referrer];\n if (earnings > 0) {\n (bool ok, ) = payable(referrer).call{value: earnings}(\"\");\n require(ok, \"Payment failed\");\n nativeEarnings[referrer] = 0;\n }\n }\n unchecked {\n ++i;\n }\n }\n // Transfer any remaining balance to the owner\n uint256 remainingBalance = address(this).balance;\n if (remainingBalance > 0) {\n payable(owner()).transfer(remainingBalance);\n }\n // Emit an event for the withdrawal\n emit WithdrawalDispersed(msg.sender);\n }\n\n function withdrawAllTokenEarnings(\n address[] memory tokenAddresses,\n uint256 batch\n ) external onlyOwner {\n uint256 tokenLength = tokenAddresses.length;\n for (uint256 j = 0; j < tokenLength; ) {\n address tokenAddress = tokenAddresses[j];\n for (uint256 i = 0; i < batch; ) {\n bytes32 code = referralCodes[i];\n if (block.timestamp < expirydates[code]) {\n address referrer = referrees[code];\n uint256 earnings = tokenEarnings[referrer][tokenAddress];\n require(earnings > 0, \"No earnings to withdraw\");\n if (earnings > 0) {\n // Assuming the token follows ERC20 standard\n IERC20(tokenAddress).safeTransfer(referrer, earnings);\n tokenEarnings[referrer][tokenAddress] = 0;\n }\n }\n unchecked {\n ++i;\n }\n }\n unchecked {\n ++j;\n }\n }\n }\n\n function totalReferrals(address referrer) external view returns (uint256) {\n return referrals[referrer].length;\n }\n\n function totalNativeEarnings(\n address referrer\n ) external view returns (uint256) {\n return nativeEarnings[referrer];\n }\n\n function totalTokenEarnings(\n address referrer,\n address tokenAddress\n ) external view returns (uint256) {\n return tokenEarnings[referrer][tokenAddress];\n }\n\n function getCodes() external view returns (uint256) {\n return referralCodes.length;\n }\n function updateReferralCode(\n bytes32 code,\n uint256 newExpiry\n ) external onlyControllerOrOwner {\n require(expirydates[code] > 0, \"Referral code does not exist\");\n expirydates[code] = newExpiry;\n }\n\n function _rewardPct(uint256 numReferrals) public pure returns (uint256) {\n if (numReferrals >= TIER3) return PCT3;\n if (numReferrals >= TIER2) return PCT2;\n if (numReferrals >= TIER1) return PCT1;\n return 0; // No reward for less than TIER1 referrals\n }\n\n function _applyNativeReward(\n address receiver,\n uint256 amount,\n bool isFiat\n ) private {\n nativeEarnings[receiver] +=\n (amount * _rewardPct(referrals[receiver].length)) /\n 100;\n if (isFiat) {\n untrackedEarnings +=\n (amount * _rewardPct(referrals[receiver].length)) /\n 100;\n }\n }\n\n function _applyTokenReward(\n address receiver,\n address token,\n uint256 amount\n ) private {\n tokenEarnings[receiver][token] +=\n (amount * _rewardPct(referrals[receiver].length)) /\n 100;\n }\n\n function balance() public view returns (uint256) {\n return address(this).balance;\n }\n\n function tokenBalance(\n address tokenAddress\n ) public view returns (uint256) {\n return IERC20(tokenAddress).balanceOf(address(this));\n }\n\n function getUntracked() public view returns (uint256) {\n return untrackedEarnings;\n }\n\n function createSnapshot(\n address[] memory tokenAddresses\n ) external onlyOwner {\n snapshotUntrackedEarnings = untrackedEarnings;\n for (uint256 i = 0; i < referralCodes.length; i++) {\n bytes32 code = referralCodes[i];\n address referrer = referrees[code];\n snapshotNativeEarnings[referrer] = nativeEarnings[referrer];\n }\n for (uint256 j = 0; j < tokenAddresses.length; j++) {\n address tokenAddress = tokenAddresses[j];\n for (uint256 i = 0; i < referralCodes.length; i++) {\n bytes32 code = referralCodes[i];\n address referrer = referrees[code];\n snapshotTokenEarnings[referrer][tokenAddress] = tokenEarnings[\n referrer\n ][tokenAddress];\n }\n }\n }\n\n function getSnapshotEarnings() public view returns (uint256) {\n return snapshotUntrackedEarnings;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"../utils/StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\";\n\n\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n AggregatorV3Interface internal usdOracle;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorV3Interface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration,\n bool lifetime\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5 && lifetime) {\n basePrice = price5Letter * 31536000 * 4;\n } else if (len == 4 && lifetime) {\n basePrice = price4Letter * 31536000 * 4;\n } else if (len == 3 && lifetime) {\n basePrice = price3Letter * 31536000 * 6;\n } else if (len == 2 && lifetime) {\n basePrice = price2Letter * 31536000 * 10;\n } else if (len == 1 && lifetime) {\n basePrice = price1Letter * 31536000;\n } else if (len >= 5 && lifetime == false) { \n basePrice = price5Letter * duration;\n } else if (len == 4 && lifetime == false) {\n basePrice = price4Letter * duration;\n } else if (len == 3 && lifetime == false) {\n basePrice = price3Letter * duration;\n } else if (len == 2 && lifetime == false) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n (, int256 ethPrice,,,) = usdOracle.latestRoundData();\n return (amount * 1e8) / uint256(ethPrice);\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n (, int256 ethPrice,,,) = usdOracle.latestRoundData();\n return (amount * uint256(ethPrice)) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/TokenPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ExponentialPremiumPriceOracle.sol\";\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\";\n\ncontract TokenPriceOracle is ExponentialPremiumPriceOracle {\n AggregatorV3Interface internal cakeOracle;\n AggregatorV3Interface internal usd1Oracle;\n using StringUtils for *;\n constructor(\n AggregatorV3Interface _usdOracle,\n AggregatorV3Interface _cakeOracle,\n AggregatorV3Interface _usd1Oracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n )ExponentialPremiumPriceOracle(_usdOracle, _rentPrices, _startPremium, totalDays) {\n usd1Oracle = _usd1Oracle;\n cakeOracle = _cakeOracle;\n }\n\n\n function priceToken(\n string calldata name,\n uint256 expires,\n uint256 duration,\n string memory token,\n bool lifetime\n ) external view returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5 && lifetime) {\n basePrice = price5Letter * 31536000 * 4;\n } else if (len == 4 && lifetime) {\n basePrice = price4Letter * 31536000 * 4;\n } else if (len == 3 && lifetime) {\n basePrice = price3Letter * 31536000 * 6;\n } else if (len == 2 && lifetime) {\n basePrice = price2Letter * 31536000 * 10;\n } else if (len == 1 && lifetime) {\n basePrice = price1Letter * 31536000;\n } else if (len >= 5 && lifetime == false) { \n basePrice = price5Letter * duration;\n } else if (len == 4 && lifetime == false) {\n basePrice = price4Letter * duration;\n } else if (len == 3 && lifetime == false) {\n basePrice = price3Letter * duration;\n } else if (len == 2 && lifetime == false) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n if(keccak256(bytes(token)) == keccak256(bytes(\"cake\"))){\n return\n IPriceOracle.Price({\n base: attoUSDToCake(basePrice),\n premium: attoUSDToCake(_premium(name, expires, duration))\n });\n } else {\n return\n IPriceOracle.Price({\n base: attoUSDToUSD1(basePrice),\n premium: attoUSDToCake(_premium(name, expires, duration))\n });\n }\n \n }\n function attoUSDToCake(uint256 amount) internal view returns (uint256) {\n (, int256 cakePrice,,,) = cakeOracle.latestRoundData();\n return (amount * 1e8) / uint256(cakePrice);\n }\n function attoUSDToUSD1(uint256 amount) internal view returns (uint256) {\n (, int256 usd1Price,,,) = usd1Oracle.latestRoundData();\n return (amount * 1e8) / uint256(usd1Price);\n }\n function attoCakeToUSD(uint256 amount) internal view returns (uint256) {\n (, int256 cakePrice,,,) = cakeOracle.latestRoundData();\n return (amount * uint256(cakePrice)) / 1e8;\n }\n function attoUSD1ToUSD(uint256 amount) internal view returns (uint256) {\n (, int256 usd1Price,,,) = usd1Oracle.latestRoundData();\n return (amount * uint256(usd1Price)) / 1e8;\n }\n\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n\n /**\n * @dev Escapes special characters in a given string\n *\n * @param str The string to escape\n * @return The escaped string\n */\n function escape(string memory str) internal pure returns (string memory) {\n bytes memory strBytes = bytes(str);\n uint extraChars = 0;\n\n // count extra space needed for escaping\n for (uint i = 0; i < strBytes.length; i++) {\n if (_needsEscaping(strBytes[i])) {\n extraChars++;\n }\n }\n\n // allocate buffer with the exact size needed\n bytes memory buffer = new bytes(strBytes.length + extraChars);\n uint index = 0;\n\n // escape characters\n for (uint i = 0; i < strBytes.length; i++) {\n if (_needsEscaping(strBytes[i])) {\n buffer[index++] = \"\\\\\";\n buffer[index++] = _getEscapedChar(strBytes[i]);\n } else {\n buffer[index++] = strBytes[i];\n }\n }\n\n return string(buffer);\n }\n\n // determine if a character needs escaping\n function _needsEscaping(bytes1 char) private pure returns (bool) {\n return\n char == '\"' ||\n char == \"/\" ||\n char == \"\\\\\" ||\n char == \"\\n\" ||\n char == \"\\r\" ||\n char == \"\\t\";\n }\n\n // get the escaped character\n function _getEscapedChar(bytes1 char) private pure returns (bytes1) {\n if (char == \"\\n\") return \"n\";\n if (char == \"\\r\") return \"r\";\n if (char == \"\\t\") return \"t\";\n return char;\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_CRE8OR = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata" + ], + "": [ + "ast" + ] + } + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/solcInputs/c311c3de46948b5831b922985c265742.json b/solidity/dns-contracts/deployments/testnet/solcInputs/c311c3de46948b5831b922985c265742.json new file mode 100644 index 0000000..5388d69 --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/solcInputs/c311c3de46948b5831b922985c265742.json @@ -0,0 +1,302 @@ +{ + "language": "Solidity", + "sources": { + "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n// solhint-disable-next-line interface-starts-with-i\ninterface AggregatorV3Interface {\n function decimals() external view returns (uint8);\n\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n\n function getRoundData(\n uint80 _roundId\n ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n\n function latestRoundData()\n external\n view\n returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n}\n" + }, + "@ensdomains/buffer/contracts/Buffer.sol": { + "content": "// SPDX-License-Identifier: BSD-2-Clause\npragma solidity ^0.8.4;\n\n/**\n* @dev A library for working with mutable byte buffers in Solidity.\n*\n* Byte buffers are mutable and expandable, and provide a variety of primitives\n* for appending to them. At any time you can fetch a bytes object containing the\n* current contents of the buffer. The bytes object should not be stored between\n* operations, as it may change due to resizing of the buffer.\n*/\nlibrary Buffer {\n /**\n * @dev Represents a mutable buffer. Buffers have a current value (buf) and\n * a capacity. The capacity may be longer than the current value, in\n * which case it can be extended without the need to allocate more memory.\n */\n struct buffer {\n bytes buf;\n uint capacity;\n }\n\n /**\n * @dev Initializes a buffer with an initial capacity.\n * @param buf The buffer to initialize.\n * @param capacity The number of bytes of space to allocate the buffer.\n * @return The buffer, for chaining.\n */\n function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {\n if (capacity % 32 != 0) {\n capacity += 32 - (capacity % 32);\n }\n // Allocate space for the buffer data\n buf.capacity = capacity;\n assembly {\n let ptr := mload(0x40)\n mstore(buf, ptr)\n mstore(ptr, 0)\n let fpm := add(32, add(ptr, capacity))\n if lt(fpm, ptr) {\n revert(0, 0)\n }\n mstore(0x40, fpm)\n }\n return buf;\n }\n\n /**\n * @dev Initializes a new buffer from an existing bytes object.\n * Changes to the buffer may mutate the original value.\n * @param b The bytes object to initialize the buffer with.\n * @return A new buffer.\n */\n function fromBytes(bytes memory b) internal pure returns(buffer memory) {\n buffer memory buf;\n buf.buf = b;\n buf.capacity = b.length;\n return buf;\n }\n\n function resize(buffer memory buf, uint capacity) private pure {\n bytes memory oldbuf = buf.buf;\n init(buf, capacity);\n append(buf, oldbuf);\n }\n\n /**\n * @dev Sets buffer length to 0.\n * @param buf The buffer to truncate.\n * @return The original buffer, for chaining..\n */\n function truncate(buffer memory buf) internal pure returns (buffer memory) {\n assembly {\n let bufptr := mload(buf)\n mstore(bufptr, 0)\n }\n return buf;\n }\n\n /**\n * @dev Appends len bytes of a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to copy.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data, uint len) internal pure returns(buffer memory) {\n require(len <= data.length);\n\n uint off = buf.buf.length;\n uint newCapacity = off + len;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint dest;\n uint src;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Length of existing buffer data\n let buflen := mload(bufptr)\n // Start address = buffer address + offset + sizeof(buffer length)\n dest := add(add(bufptr, 32), off)\n // Update buffer length if we're extending it\n if gt(newCapacity, buflen) {\n mstore(bufptr, newCapacity)\n }\n src := add(data, 32)\n }\n\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends a byte string to a buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes memory data) internal pure returns (buffer memory) {\n return append(buf, data, data.length);\n }\n\n /**\n * @dev Appends a byte to the buffer. Resizes if doing so would exceed the\n * capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendUint8(buffer memory buf, uint8 data) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint offPlusOne = off + 1;\n if (off >= buf.capacity) {\n resize(buf, offPlusOne * 2);\n }\n\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + off\n let dest := add(add(bufptr, off), 32)\n mstore8(dest, data)\n // Update buffer length if we extended it\n if gt(offPlusOne, mload(bufptr)) {\n mstore(bufptr, offPlusOne)\n }\n }\n\n return buf;\n }\n\n /**\n * @dev Appends len bytes of bytes32 to a buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (left-aligned).\n * @return The original buffer, for chaining.\n */\n function append(buffer memory buf, bytes32 data, uint len) private pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n unchecked {\n uint mask = (256 ** len) - 1;\n // Right-align data\n data = data >> (8 * (32 - len));\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n }\n return buf;\n }\n\n /**\n * @dev Appends a bytes20 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chhaining.\n */\n function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) {\n return append(buf, bytes32(data), 20);\n }\n\n /**\n * @dev Appends a bytes32 to the buffer. Resizes if doing so would exceed\n * the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @return The original buffer, for chaining.\n */\n function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) {\n return append(buf, data, 32);\n }\n\n /**\n * @dev Appends a byte to the end of the buffer. Resizes if doing so would\n * exceed the capacity of the buffer.\n * @param buf The buffer to append to.\n * @param data The data to append.\n * @param len The number of bytes to write (right-aligned).\n * @return The original buffer.\n */\n function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {\n uint off = buf.buf.length;\n uint newCapacity = len + off;\n if (newCapacity > buf.capacity) {\n resize(buf, newCapacity * 2);\n }\n\n uint mask = (256 ** len) - 1;\n assembly {\n // Memory address of the buffer data\n let bufptr := mload(buf)\n // Address = buffer address + sizeof(buffer length) + newCapacity\n let dest := add(bufptr, newCapacity)\n mstore(dest, or(and(mload(dest), not(mask)), data))\n // Update buffer length if we extended it\n if gt(newCapacity, mload(bufptr)) {\n mstore(bufptr, newCapacity)\n }\n }\n return buf;\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "@pancakeswap/pancake-swap-lib/contracts/utils/TransferHelper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n\npragma solidity >=0.6.0;\n\n// helper methods for interacting with BEP20 tokens and sending ETH that do not consistently return true/false\nlibrary TransferHelper {\n function safeApprove(\n address token,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('approve(address,uint256)')));\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));\n require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');\n }\n\n function safeTransfer(\n address token,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transfer(address,uint256)')));\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));\n require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');\n }\n\n function safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));\n require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');\n }\n\n function safeTransferBNB(address to, uint256 value) internal {\n (bool success, ) = to.call{value: value}(new bytes(0));\n require(success, 'TransferHelper: BNB_TRANSFER_FAILED');\n }\n}\n" + }, + "@pancakeswap/v3-core/contracts/interfaces/callback/IPancakeV3SwapCallback.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IPancakeV3PoolActions#swap\n/// @notice Any contract that calls IPancakeV3PoolActions#swap must implement this interface\ninterface IPancakeV3SwapCallback {\n /// @notice Called to `msg.sender` after executing a swap via IPancakeV3Pool#swap.\n /// @dev In the implementation you must pay the pool tokens owed for the swap.\n /// The caller of this method must be checked to be a PancakeV3Pool deployed by the canonical PancakeV3Factory.\n /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\n /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\n /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\n /// @param data Any data passed through by the caller via the IPancakeV3PoolActions#swap call\n function pancakeV3SwapCallback(\n int256 amount0Delta,\n int256 amount1Delta,\n bytes calldata data\n ) external;\n}\n" + }, + "@pancakeswap/v3-periphery/contracts/interfaces/ISwapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\npragma abicoder v2;\n\nimport '@pancakeswap/v3-core/contracts/interfaces/callback/IPancakeV3SwapCallback.sol';\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via PancakeSwap V3\ninterface ISwapRouter is IPancakeV3SwapCallback {\n struct ExactInputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n uint160 sqrtPriceLimitX96;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n }\n\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n\n struct ExactOutputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n uint160 sqrtPriceLimitX96;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another token\n /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);\n\n struct ExactOutputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n }\n\n /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata\n /// @return amountIn The amount of the input token\n function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);\n}\n" + }, + "contracts/dnsregistrar/DNSClaimChecker.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../utils/BytesUtils.sol\";\nimport \"../utils/HexUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\nlibrary DNSClaimChecker {\n using BytesUtils for bytes;\n using HexUtils for bytes;\n using RRUtils for *;\n using Buffer for Buffer.buffer;\n\n uint16 constant CLASS_INET = 1;\n uint16 constant TYPE_TXT = 16;\n\n function getOwnerAddress(\n bytes memory name,\n bytes memory data\n ) internal pure returns (address, bool) {\n // Add \"_ens.\" to the front of the name.\n Buffer.buffer memory buf;\n buf.init(name.length + 5);\n buf.append(\"\\x04_ens\");\n buf.append(name);\n\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (iter.name().compareNames(buf.buf) != 0) continue;\n bool found;\n address addr;\n (addr, found) = parseRR(data, iter.rdataOffset, iter.nextOffset);\n if (found) {\n return (addr, true);\n }\n }\n\n return (address(0x0), false);\n }\n\n function parseRR(\n bytes memory rdata,\n uint256 idx,\n uint256 endIdx\n ) internal pure returns (address, bool) {\n while (idx < endIdx) {\n uint256 len = rdata.readUint8(idx);\n idx += 1;\n\n bool found;\n address addr;\n (addr, found) = parseString(rdata, idx, len);\n\n if (found) return (addr, true);\n idx += len;\n }\n\n return (address(0x0), false);\n }\n\n function parseString(\n bytes memory str,\n uint256 idx,\n uint256 len\n ) internal pure returns (address, bool) {\n // TODO: More robust parsing that handles whitespace and multiple key/value pairs\n if (str.readUint32(idx) != 0x613d3078) return (address(0x0), false); // 0x613d3078 == 'a=0x'\n return str.hexToAddress(idx + 4, idx + len);\n }\n}\n" + }, + "contracts/dnsregistrar/DNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\nimport \"../dnssec-oracle/DNSSEC.sol\";\nimport \"../dnssec-oracle/RRUtils.sol\";\nimport \"../registry/ENSRegistry.sol\";\nimport \"../root/Root.sol\";\nimport \"../resolvers/profiles/AddrResolver.sol\";\nimport \"../utils/BytesUtils.sol\";\nimport \"./DNSClaimChecker.sol\";\nimport \"./PublicSuffixList.sol\";\nimport \"./IDNSRegistrar.sol\";\n\n/**\n * @dev An ENS registrar that allows the owner of a DNS name to claim the\n * corresponding name in ENS.\n */\ncontract DNSRegistrar is IDNSRegistrar, IERC165 {\n using BytesUtils for bytes;\n using Buffer for Buffer.buffer;\n using RRUtils for *;\n\n ENS public immutable ens;\n DNSSEC public immutable oracle;\n PublicSuffixList public suffixes;\n address public immutable previousRegistrar;\n address public immutable resolver;\n // A mapping of the most recent signatures seen for each claimed domain.\n mapping(bytes32 => uint32) public inceptions;\n\n error NoOwnerRecordFound();\n error PermissionDenied(address caller, address owner);\n error PreconditionNotMet();\n error StaleProof();\n error InvalidPublicSuffix(bytes name);\n\n struct OwnerRecord {\n bytes name;\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n event Claim(\n bytes32 indexed node,\n address indexed owner,\n bytes dnsname,\n uint32 inception\n );\n event NewPublicSuffixList(address suffixes);\n\n constructor(\n address _previousRegistrar,\n address _resolver,\n DNSSEC _dnssec,\n PublicSuffixList _suffixes,\n ENS _ens\n ) {\n previousRegistrar = _previousRegistrar;\n resolver = _resolver;\n oracle = _dnssec;\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n ens = _ens;\n }\n\n /**\n * @dev This contract's owner-only functions can be invoked by the owner of the ENS root.\n */\n modifier onlyOwner() {\n Root root = Root(ens.owner(bytes32(0)));\n address owner = root.owner();\n require(msg.sender == owner);\n _;\n }\n\n function setPublicSuffixList(PublicSuffixList _suffixes) public onlyOwner {\n suffixes = _suffixes;\n emit NewPublicSuffixList(address(suffixes));\n }\n\n /**\n * @dev Submits proofs to the DNSSEC oracle, then claims a name using those proofs.\n * @param name The name to claim, in DNS wire format.\n * @param input A chain of signed DNS RRSETs ending with a text record.\n */\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address addr) = _claim(\n name,\n input\n );\n ens.setSubnodeOwner(rootNode, labelHash, addr);\n }\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) public override {\n (bytes32 rootNode, bytes32 labelHash, address owner) = _claim(\n name,\n input\n );\n if (msg.sender != owner) {\n revert PermissionDenied(msg.sender, owner);\n }\n ens.setSubnodeRecord(rootNode, labelHash, owner, resolver, 0);\n if (addr != address(0)) {\n if (resolver == address(0)) {\n revert PreconditionNotMet();\n }\n bytes32 node = keccak256(abi.encodePacked(rootNode, labelHash));\n // Set the resolver record\n AddrResolver(resolver).setAddr(node, addr);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure override returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IDNSRegistrar).interfaceId;\n }\n\n function _claim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) internal returns (bytes32 parentNode, bytes32 labelHash, address addr) {\n (bytes memory data, uint32 inception) = oracle.verifyRRSet(input);\n\n // Get the first label\n uint256 labelLen = name.readUint8(0);\n labelHash = name.keccak(1, labelLen);\n\n bytes memory parentName = name.substring(\n labelLen + 1,\n name.length - labelLen - 1\n );\n\n // Make sure the parent name is enabled\n parentNode = enableNode(parentName);\n\n bytes32 node = keccak256(abi.encodePacked(parentNode, labelHash));\n if (!RRUtils.serialNumberGte(inception, inceptions[node])) {\n revert StaleProof();\n }\n inceptions[node] = inception;\n\n bool found;\n (addr, found) = DNSClaimChecker.getOwnerAddress(name, data);\n if (!found) {\n revert NoOwnerRecordFound();\n }\n\n emit Claim(node, addr, name, inception);\n }\n\n function enableNode(bytes memory domain) public returns (bytes32 node) {\n // Name must be in the public suffix list.\n if (!suffixes.isPublicSuffix(domain)) {\n revert InvalidPublicSuffix(domain);\n }\n return _enableNode(domain, 0);\n }\n\n function _enableNode(\n bytes memory domain,\n uint256 offset\n ) internal returns (bytes32 node) {\n uint256 len = domain.readUint8(offset);\n if (len == 0) {\n return bytes32(0);\n }\n\n bytes32 parentNode = _enableNode(domain, offset + len + 1);\n bytes32 label = domain.keccak(offset + 1, len);\n node = keccak256(abi.encodePacked(parentNode, label));\n address owner = ens.owner(node);\n if (owner == address(0) || owner == previousRegistrar) {\n if (parentNode == bytes32(0)) {\n Root root = Root(ens.owner(bytes32(0)));\n root.setSubnodeOwner(label, address(this));\n ens.setResolver(node, resolver);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n label,\n address(this),\n resolver,\n 0\n );\n }\n } else if (owner != address(this)) {\n revert PreconditionNotMet();\n }\n return node;\n }\n}\n" + }, + "contracts/dnsregistrar/IDNSRegistrar.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../dnssec-oracle/DNSSEC.sol\";\n\ninterface IDNSRegistrar {\n function proveAndClaim(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input\n ) external;\n\n function proveAndClaimWithResolver(\n bytes memory name,\n DNSSEC.RRSetWithSignature[] memory input,\n address resolver,\n address addr\n ) external;\n}\n" + }, + "contracts/dnsregistrar/PublicSuffixList.sol": { + "content": "pragma solidity ^0.8.4;\n\ninterface PublicSuffixList {\n function isPublicSuffix(bytes calldata name) external view returns (bool);\n}\n" + }, + "contracts/dnssec-oracle/DNSSEC.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\npragma experimental ABIEncoderV2;\n\nabstract contract DNSSEC {\n bytes public anchors;\n\n struct RRSetWithSignature {\n bytes rrset;\n bytes sig;\n }\n\n event AlgorithmUpdated(uint8 id, address addr);\n event DigestUpdated(uint8 id, address addr);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input\n ) external view virtual returns (bytes memory rrs, uint32 inception);\n\n function verifyRRSet(\n RRSetWithSignature[] memory input,\n uint256 now\n ) public view virtual returns (bytes memory rrs, uint32 inception);\n}\n" + }, + "contracts/dnssec-oracle/RRUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"../utils/BytesUtils.sol\";\nimport \"@ensdomains/buffer/contracts/Buffer.sol\";\n\n/**\n * @dev RRUtils is a library that provides utilities for parsing DNS resource records.\n */\nlibrary RRUtils {\n using BytesUtils for *;\n using Buffer for *;\n\n /**\n * @dev Returns the number of bytes in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The length of the DNS name at 'offset', in bytes.\n */\n function nameLength(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 idx = offset;\n while (true) {\n assert(idx < self.length);\n uint256 labelLen = self.readUint8(idx);\n idx += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n }\n return idx - offset;\n }\n\n /**\n * @dev Returns a DNS format name at the specified offset of self.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return ret The name.\n */\n function readName(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes memory ret) {\n uint256 len = nameLength(self, offset);\n return self.substring(offset, len);\n }\n\n /**\n * @dev Returns the number of labels in the DNS name at 'offset' in 'self'.\n * @param self The byte array to read a name from.\n * @param offset The offset to start reading at.\n * @return The number of labels in the DNS name at 'offset', in bytes.\n */\n function labelCount(\n bytes memory self,\n uint256 offset\n ) internal pure returns (uint256) {\n uint256 count = 0;\n while (true) {\n assert(offset < self.length);\n uint256 labelLen = self.readUint8(offset);\n offset += labelLen + 1;\n if (labelLen == 0) {\n break;\n }\n count += 1;\n }\n return count;\n }\n\n uint256 constant RRSIG_TYPE = 0;\n uint256 constant RRSIG_ALGORITHM = 2;\n uint256 constant RRSIG_LABELS = 3;\n uint256 constant RRSIG_TTL = 4;\n uint256 constant RRSIG_EXPIRATION = 8;\n uint256 constant RRSIG_INCEPTION = 12;\n uint256 constant RRSIG_KEY_TAG = 16;\n uint256 constant RRSIG_SIGNER_NAME = 18;\n\n struct SignedSet {\n uint16 typeCovered;\n uint8 algorithm;\n uint8 labels;\n uint32 ttl;\n uint32 expiration;\n uint32 inception;\n uint16 keytag;\n bytes signerName;\n bytes data;\n bytes name;\n }\n\n function readSignedSet(\n bytes memory data\n ) internal pure returns (SignedSet memory self) {\n self.typeCovered = data.readUint16(RRSIG_TYPE);\n self.algorithm = data.readUint8(RRSIG_ALGORITHM);\n self.labels = data.readUint8(RRSIG_LABELS);\n self.ttl = data.readUint32(RRSIG_TTL);\n self.expiration = data.readUint32(RRSIG_EXPIRATION);\n self.inception = data.readUint32(RRSIG_INCEPTION);\n self.keytag = data.readUint16(RRSIG_KEY_TAG);\n self.signerName = readName(data, RRSIG_SIGNER_NAME);\n self.data = data.substring(\n RRSIG_SIGNER_NAME + self.signerName.length,\n data.length - RRSIG_SIGNER_NAME - self.signerName.length\n );\n }\n\n function rrs(\n SignedSet memory rrset\n ) internal pure returns (RRIterator memory) {\n return iterateRRs(rrset.data, 0);\n }\n\n /**\n * @dev An iterator over resource records.\n */\n struct RRIterator {\n bytes data;\n uint256 offset;\n uint16 dnstype;\n uint16 class;\n uint32 ttl;\n uint256 rdataOffset;\n uint256 nextOffset;\n }\n\n /**\n * @dev Begins iterating over resource records.\n * @param self The byte string to read from.\n * @param offset The offset to start reading at.\n * @return ret An iterator object.\n */\n function iterateRRs(\n bytes memory self,\n uint256 offset\n ) internal pure returns (RRIterator memory ret) {\n ret.data = self;\n ret.nextOffset = offset;\n next(ret);\n }\n\n /**\n * @dev Returns true iff there are more RRs to iterate.\n * @param iter The iterator to check.\n * @return True iff the iterator has finished.\n */\n function done(RRIterator memory iter) internal pure returns (bool) {\n return iter.offset >= iter.data.length;\n }\n\n /**\n * @dev Moves the iterator to the next resource record.\n * @param iter The iterator to advance.\n */\n function next(RRIterator memory iter) internal pure {\n iter.offset = iter.nextOffset;\n if (iter.offset >= iter.data.length) {\n return;\n }\n\n // Skip the name\n uint256 off = iter.offset + nameLength(iter.data, iter.offset);\n\n // Read type, class, and ttl\n iter.dnstype = iter.data.readUint16(off);\n off += 2;\n iter.class = iter.data.readUint16(off);\n off += 2;\n iter.ttl = iter.data.readUint32(off);\n off += 4;\n\n // Read the rdata\n uint256 rdataLength = iter.data.readUint16(off);\n off += 2;\n iter.rdataOffset = off;\n iter.nextOffset = off + rdataLength;\n }\n\n /**\n * @dev Returns the name of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the owner name from the RR.\n */\n function name(RRIterator memory iter) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.offset,\n nameLength(iter.data, iter.offset)\n );\n }\n\n /**\n * @dev Returns the rdata portion of the current record.\n * @param iter The iterator.\n * @return A new bytes object containing the RR's RDATA.\n */\n function rdata(\n RRIterator memory iter\n ) internal pure returns (bytes memory) {\n return\n iter.data.substring(\n iter.rdataOffset,\n iter.nextOffset - iter.rdataOffset\n );\n }\n\n uint256 constant DNSKEY_FLAGS = 0;\n uint256 constant DNSKEY_PROTOCOL = 2;\n uint256 constant DNSKEY_ALGORITHM = 3;\n uint256 constant DNSKEY_PUBKEY = 4;\n\n struct DNSKEY {\n uint16 flags;\n uint8 protocol;\n uint8 algorithm;\n bytes publicKey;\n }\n\n function readDNSKEY(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DNSKEY memory self) {\n self.flags = data.readUint16(offset + DNSKEY_FLAGS);\n self.protocol = data.readUint8(offset + DNSKEY_PROTOCOL);\n self.algorithm = data.readUint8(offset + DNSKEY_ALGORITHM);\n self.publicKey = data.substring(\n offset + DNSKEY_PUBKEY,\n length - DNSKEY_PUBKEY\n );\n }\n\n uint256 constant DS_KEY_TAG = 0;\n uint256 constant DS_ALGORITHM = 2;\n uint256 constant DS_DIGEST_TYPE = 3;\n uint256 constant DS_DIGEST = 4;\n\n struct DS {\n uint16 keytag;\n uint8 algorithm;\n uint8 digestType;\n bytes digest;\n }\n\n function readDS(\n bytes memory data,\n uint256 offset,\n uint256 length\n ) internal pure returns (DS memory self) {\n self.keytag = data.readUint16(offset + DS_KEY_TAG);\n self.algorithm = data.readUint8(offset + DS_ALGORITHM);\n self.digestType = data.readUint8(offset + DS_DIGEST_TYPE);\n self.digest = data.substring(offset + DS_DIGEST, length - DS_DIGEST);\n }\n\n function isSubdomainOf(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n uint256 off = 0;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n while (counts > othercounts) {\n off = progress(self, off);\n counts--;\n }\n\n return self.equals(off, other, 0);\n }\n\n function compareNames(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n if (self.equals(other)) {\n return 0;\n }\n\n uint256 off;\n uint256 otheroff;\n uint256 prevoff;\n uint256 otherprevoff;\n uint256 counts = labelCount(self, 0);\n uint256 othercounts = labelCount(other, 0);\n\n // Keep removing labels from the front of the name until both names are equal length\n while (counts > othercounts) {\n prevoff = off;\n off = progress(self, off);\n counts--;\n }\n\n while (othercounts > counts) {\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n othercounts--;\n }\n\n // Compare the last nonequal labels to each other\n while (counts > 0 && !self.equals(off, other, otheroff)) {\n prevoff = off;\n off = progress(self, off);\n otherprevoff = otheroff;\n otheroff = progress(other, otheroff);\n counts -= 1;\n }\n\n if (off == 0) {\n return -1;\n }\n if (otheroff == 0) {\n return 1;\n }\n\n return\n self.compare(\n prevoff + 1,\n self.readUint8(prevoff),\n other,\n otherprevoff + 1,\n other.readUint8(otherprevoff)\n );\n }\n\n /**\n * @dev Compares two serial numbers using RFC1982 serial number math.\n */\n function serialNumberGte(\n uint32 i1,\n uint32 i2\n ) internal pure returns (bool) {\n unchecked {\n return int32(i1) - int32(i2) >= 0;\n }\n }\n\n function progress(\n bytes memory body,\n uint256 off\n ) internal pure returns (uint256) {\n return off + 1 + body.readUint8(off);\n }\n\n /**\n * @dev Computes the keytag for a chunk of data.\n * @param data The data to compute a keytag for.\n * @return The computed key tag.\n */\n function computeKeytag(bytes memory data) internal pure returns (uint16) {\n /* This function probably deserves some explanation.\n * The DNSSEC keytag function is a checksum that relies on summing up individual bytes\n * from the input string, with some mild bitshifting. Here's a Naive solidity implementation:\n *\n * function computeKeytag(bytes memory data) internal pure returns (uint16) {\n * uint ac;\n * for (uint i = 0; i < data.length; i++) {\n * ac += i & 1 == 0 ? uint16(data.readUint8(i)) << 8 : data.readUint8(i);\n * }\n * return uint16(ac + (ac >> 16));\n * }\n *\n * The EVM, with its 256 bit words, is exceedingly inefficient at doing byte-by-byte operations;\n * the code above, on reasonable length inputs, consumes over 100k gas. But we can make the EVM's\n * large words work in our favour.\n *\n * The code below works by treating the input as a series of 256 bit words. It first masks out\n * even and odd bytes from each input word, adding them to two separate accumulators `ac1` and `ac2`.\n * The bytes are separated by empty bytes, so as long as no individual sum exceeds 2^16-1, we're\n * effectively summing 16 different numbers with each EVM ADD opcode.\n *\n * Once it's added up all the inputs, it has to add all the 16 bit values in `ac1` and `ac2` together.\n * It does this using the same trick - mask out every other value, shift to align them, add them together.\n * After the first addition on both accumulators, there's enough room to add the two accumulators together,\n * and the remaining sums can be done just on ac1.\n */\n unchecked {\n require(data.length <= 8192, \"Long keys not permitted\");\n uint256 ac1;\n uint256 ac2;\n for (uint256 i = 0; i < data.length + 31; i += 32) {\n uint256 word;\n assembly {\n word := mload(add(add(data, 32), i))\n }\n if (i + 32 > data.length) {\n uint256 unused = 256 - (data.length - i) * 8;\n word = (word >> unused) << unused;\n }\n ac1 +=\n (word &\n 0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00) >>\n 8;\n ac2 += (word &\n 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF);\n }\n ac1 =\n (ac1 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac1 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac2 =\n (ac2 &\n 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) +\n ((ac2 &\n 0xFFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000) >>\n 16);\n ac1 = (ac1 << 8) + ac2;\n ac1 =\n (ac1 &\n 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000) >>\n 32);\n ac1 =\n (ac1 &\n 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) +\n ((ac1 &\n 0xFFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF0000000000000000) >>\n 64);\n ac1 =\n (ac1 &\n 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +\n (ac1 >> 128);\n ac1 += (ac1 >> 16) & 0xFFFF;\n return uint16(ac1);\n }\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n uint256 public constant LIFETIME = type(uint256).max;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /// v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n /// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n /// @dev Returns whether the given spender can transfer a given token ID\n /// @param spender address of the spender to query\n /// @param tokenId uint256 ID of the token to be transferred\n /// @return bool whether the msg.sender is approved for the given token ID,\n /// is an operator of the owner, or is the owner of the token\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n Ownable(msg.sender);\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /// @dev Gets the owner of the specified token ID. Names become unowned\n /// when their registration expires.\n /// @param tokenId uint256 ID of the token to query the owner of\n /// @return address currently marked as the owner of the given token ID\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /// @dev Register a name.\n /// @param id The token ID (keccak256 of the label).\n /// @param owner The address that should own the registration.\n /// @param duration Duration in seconds for the registration.\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override virtual returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /// @dev Register a name, without modifying the registry.\n /// @param id The token ID (keccak256 of the label).\n /// @param owner The address that should own the registration.\n /// @param duration Duration in seconds for the registration.\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n\n uint256 expiration;\n\n if (duration == 0) {\n // Lifetime registration\n expiration = LIFETIME;\n } else {\n // Annual registration\n expiration = block.timestamp + duration;\n }\n\n expiries[id] = expiration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override virtual live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(expiries[id] != LIFETIME, \"Lifetime names cannot be renewed\");\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /// @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n\n function _exists(uint256 tokenId) internal view override returns (bool) {\n return super._exists(tokenId);\n }\n\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/CreatorRegistrarPaymaster.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.7.6 <0.9.0;\n\nimport \"@pancakeswap/v3-periphery/contracts/interfaces/ISwapRouter.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@pancakeswap/pancake-swap-lib/contracts/utils/TransferHelper.sol\";\nimport \"../utils/IWBNB.sol\";\n\ncontract ENSRegistrarPaymaster {\n ISwapRouter public immutable router;\n IETHRegistrarController public immutable controller;\n IWBNB public immutable WBNB;\n\n constructor(\n address _router,\n address _controller,\n address _WBNB\n ) {\n router = ISwapRouter(_router);\n controller = IETHRegistrarController(_controller);\n WBNB = IWBNB(_WBNB);\n }\n\n struct RegisterParams {\n string name;\n address owner;\n uint256 duration;\n bytes32 secret;\n address resolver;\n bytes[] data;\n bool reverseRecord;\n uint16 fuses;\n}\n\n /// @notice Pay with any ERC-20: swap → unwrap → ENS register → refund\n function registerWithToken(\n RegisterParams calldata p,\n address token,\n uint256 amountIn,\n uint256 minBnbOut,\n uint24 poolFee\n ) external {\n _pullAndSwap(token, amountIn, minBnbOut, poolFee);\n _registerENS(p);\n _refundDust();\n }\n\n function _pullAndSwap(\n address token,\n uint256 amountIn,\n uint256 minBnbOut,\n uint24 poolFee\n ) internal {\n // 1) pull ERC20\n TransferHelper.safeTransferFrom(token, msg.sender, address(this), amountIn);\n // 2) approve router\n TransferHelper.safeApprove(token, address(router), amountIn);\n\n // 3) swap token → WBNB\n ISwapRouter.ExactInputSingleParams memory params = ISwapRouter.ExactInputSingleParams({\n tokenIn: token,\n tokenOut: address(WBNB),\n fee: poolFee,\n recipient: address(this),\n deadline: block.timestamp + 300,\n amountIn: amountIn,\n amountOutMinimum: minBnbOut,\n sqrtPriceLimitX96: 0\n });\n uint256 wbnbReceived = router.exactInputSingle(params);\n\n // 4) unwrap to native BNB\n WBNB.withdraw(wbnbReceived);\n }\n\n function _registerENS(\n RegisterParams calldata p\n ) internal {\n // compute required BNB\n IPriceOracle.Price memory price = controller.rentPrice(p.name, p.duration);\n uint256 total = price.base + price.premium;\n require(address(this).balance >= total, \"Insufficient BNB\");\n\n // commit + register in one\n controller.register{ value: total }(\n p.name, p.owner, p.duration, p.secret, p.resolver, p.data, p.reverseRecord, p.fuses\n );\n }\n\n function _refundDust() internal {\n uint256 bal = address(this).balance;\n if (bal > 0) {\n payable(msg.sender).transfer(bal);\n }\n }\n\n // receive unwrapped BNB\n receive() external payable {}\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"../utils/StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/// @dev A registrar controller for registering and renewing names at fixed cost.\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE = 0x4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n IPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n IPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration\n ) public view override virtual returns (IPriceOracle.Price memory price) {\n require(duration == 0 || duration >= MIN_REGISTRATION_DURATION, \"Invalid duration\");\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration);\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function renew(\n string calldata name,\n uint256 duration\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration != 0 && duration < MIN_REGISTRATION_DURATION ) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] calldata data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".creator\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorV3Interface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256\n ) external view returns (IPriceOracle.Price memory);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16\n ) external payable;\n\n function renew(string calldata, uint256) external payable;\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorV3Interface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"../utils/StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\";\n\n\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n AggregatorV3Interface internal usdOracle;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorV3Interface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5) {\n basePrice = price5Letter * duration;\n } else if (len == 4) {\n basePrice = price4Letter * duration;\n } else if (len == 3) {\n basePrice = price3Letter * duration;\n } else if (len == 2) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n\n\n \n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n (, int256 ethPrice,,,) = usdOracle.latestRoundData();\n return (amount * 1e8) / uint256(ethPrice);\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n (, int256 ethPrice,,,) = usdOracle.latestRoundData();\n return (amount * uint256(ethPrice)) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/registry/ENSRegistry.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"./ENS.sol\";\n\n/**\n * The ENS registry contract.\n */\ncontract ENSRegistry is ENS {\n struct Record {\n address owner;\n address resolver;\n uint64 ttl;\n }\n\n mapping(bytes32 => Record) records;\n mapping(address => mapping(address => bool)) operators;\n\n // Permits modifications only by the owner of the specified node.\n modifier authorised(bytes32 node) {\n address owner = records[node].owner;\n require(owner == msg.sender || operators[owner][msg.sender]);\n _;\n }\n\n /**\n * @dev Constructs a new ENS registry.\n */\n constructor() public {\n records[0x0].owner = msg.sender;\n }\n\n /**\n * @dev Sets the record for a node.\n * @param node The node to update.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n setOwner(node, owner);\n _setResolverAndTTL(node, resolver, ttl);\n }\n\n /**\n * @dev Sets the record for a subnode.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n * @param resolver The address of the resolver.\n * @param ttl The TTL in seconds.\n */\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external virtual override {\n bytes32 subnode = setSubnodeOwner(node, label, owner);\n _setResolverAndTTL(subnode, resolver, ttl);\n }\n\n /**\n * @dev Transfers ownership of a node to a new address. May only be called by the current owner of the node.\n * @param node The node to transfer ownership of.\n * @param owner The address of the new owner.\n */\n function setOwner(\n bytes32 node,\n address owner\n ) public virtual override authorised(node) {\n _setOwner(node, owner);\n emit Transfer(node, owner);\n }\n\n /**\n * @dev Transfers ownership of a subnode keccak256(node, label) to a new address. May only be called by the owner of the parent node.\n * @param node The parent node.\n * @param label The hash of the label specifying the subnode.\n * @param owner The address of the new owner.\n */\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) public virtual override authorised(node) returns (bytes32) {\n bytes32 subnode = keccak256(abi.encodePacked(node, label));\n _setOwner(subnode, owner);\n emit NewOwner(node, label, owner);\n return subnode;\n }\n\n /**\n * @dev Sets the resolver address for the specified node.\n * @param node The node to update.\n * @param resolver The address of the resolver.\n */\n function setResolver(\n bytes32 node,\n address resolver\n ) public virtual override authorised(node) {\n emit NewResolver(node, resolver);\n records[node].resolver = resolver;\n }\n\n /**\n * @dev Sets the TTL for the specified node.\n * @param node The node to update.\n * @param ttl The TTL in seconds.\n */\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public virtual override authorised(node) {\n emit NewTTL(node, ttl);\n records[node].ttl = ttl;\n }\n\n /**\n * @dev Enable or disable approval for a third party (\"operator\") to manage\n * all of `msg.sender`'s ENS records. Emits the ApprovalForAll event.\n * @param operator Address to add to the set of authorized operators.\n * @param approved True if the operator is approved, false to revoke approval.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) external virtual override {\n operators[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev Returns the address that owns the specified node.\n * @param node The specified node.\n * @return address of the owner.\n */\n function owner(\n bytes32 node\n ) public view virtual override returns (address) {\n address addr = records[node].owner;\n if (addr == address(this)) {\n return address(0x0);\n }\n\n return addr;\n }\n\n /**\n * @dev Returns the address of the resolver for the specified node.\n * @param node The specified node.\n * @return address of the resolver.\n */\n function resolver(\n bytes32 node\n ) public view virtual override returns (address) {\n return records[node].resolver;\n }\n\n /**\n * @dev Returns the TTL of a node, and any records associated with it.\n * @param node The specified node.\n * @return ttl of the node.\n */\n function ttl(bytes32 node) public view virtual override returns (uint64) {\n return records[node].ttl;\n }\n\n /**\n * @dev Returns whether a record has been imported to the registry.\n * @param node The specified node.\n * @return Bool if record exists\n */\n function recordExists(\n bytes32 node\n ) public view virtual override returns (bool) {\n return records[node].owner != address(0x0);\n }\n\n /**\n * @dev Query if an address is an authorized operator for another address.\n * @param owner The address that owns the records.\n * @param operator The address that acts on behalf of the owner.\n * @return True if `operator` is an approved operator for `owner`, false otherwise.\n */\n function isApprovedForAll(\n address owner,\n address operator\n ) external view virtual override returns (bool) {\n return operators[owner][operator];\n }\n\n function _setOwner(bytes32 node, address owner) internal virtual {\n records[node].owner = owner;\n }\n\n function _setResolverAndTTL(\n bytes32 node,\n address resolver,\n uint64 ttl\n ) internal {\n if (resolver != records[node].resolver) {\n records[node].resolver = resolver;\n emit NewResolver(node, resolver);\n }\n\n if (ttl != records[node].ttl) {\n records[node].ttl = ttl;\n emit NewTTL(node, ttl);\n }\n }\n}\n" + }, + "contracts/resolvers/OwnedResolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./profiles/ABIResolver.sol\";\nimport \"./profiles/AddrResolver.sol\";\nimport \"./profiles/ContentHashResolver.sol\";\nimport \"./profiles/DNSResolver.sol\";\nimport \"./profiles/InterfaceResolver.sol\";\nimport \"./profiles/NameResolver.sol\";\nimport \"./profiles/PubkeyResolver.sol\";\nimport \"./profiles/TextResolver.sol\";\nimport \"./profiles/ExtendedResolver.sol\";\n\n/**\n * A simple resolver anyone can use; only allows the owner of a node to set its\n * address.\n */\ncontract OwnedResolver is\n Ownable,\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver,\n ExtendedResolver\n{\n function isAuthorised(bytes32) internal view override returns (bool) {\n return msg.sender == owner();\n }\n\n function supportsInterface(\n bytes4 interfaceID\n )\n public\n view\n virtual\n override(\n ABIResolver,\n AddrResolver,\n ContentHashResolver,\n DNSResolver,\n InterfaceResolver,\n NameResolver,\n PubkeyResolver,\n TextResolver\n )\n returns (bool)\n {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/ABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"./IABIResolver.sol\";\nimport \"../ResolverBase.sol\";\n\nabstract contract ABIResolver is IABIResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_abis;\n\n /**\n * Sets the ABI associated with an ENS node.\n * Nodes may have one ABI of each content type. To remove an ABI, set it to\n * the empty string.\n * @param node The node to update.\n * @param contentType The content type of the ABI\n * @param data The ABI data.\n */\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external virtual authorised(node) {\n // Content types must be powers of 2\n require(((contentType - 1) & contentType) == 0);\n\n versionable_abis[recordVersions[node]][node][contentType] = data;\n emit ABIChanged(node, contentType);\n }\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view virtual override returns (uint256, bytes memory) {\n mapping(uint256 => bytes) storage abiset = versionable_abis[\n recordVersions[node]\n ][node];\n\n for (\n uint256 contentType = 1;\n contentType <= contentTypes;\n contentType <<= 1\n ) {\n if (\n (contentType & contentTypes) != 0 &&\n abiset[contentType].length > 0\n ) {\n return (contentType, abiset[contentType]);\n }\n }\n\n return (0, bytes(\"\"));\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IABIResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/AddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IAddrResolver.sol\";\nimport \"./IAddressResolver.sol\";\n\nabstract contract AddrResolver is\n IAddrResolver,\n IAddressResolver,\n ResolverBase\n{\n uint256 private constant COIN_TYPE_ETH = 714;\n\n mapping(uint64 => mapping(bytes32 => mapping(uint256 => bytes))) versionable_addresses;\n\n /**\n * Sets the address associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param a The address to set.\n */\n function setAddr(\n bytes32 node,\n address a\n ) external virtual authorised(node) {\n setAddr(node, COIN_TYPE_ETH, addressToBytes(a));\n }\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(\n bytes32 node\n ) public view virtual override returns (address payable) {\n bytes memory a = addr(node, COIN_TYPE_ETH);\n if (a.length == 0) {\n return payable(0);\n }\n return bytesToAddress(a);\n }\n\n function setAddr(\n bytes32 node,\n uint256 coinType,\n bytes memory a\n ) public virtual authorised(node) {\n emit AddressChanged(node, coinType, a);\n if (coinType == COIN_TYPE_ETH) {\n emit AddrChanged(node, bytesToAddress(a));\n }\n versionable_addresses[recordVersions[node]][node][coinType] = a;\n }\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) public view virtual override returns (bytes memory) {\n return versionable_addresses[recordVersions[node]][node][coinType];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IAddrResolver).interfaceId ||\n interfaceID == type(IAddressResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function bytesToAddress(\n bytes memory b\n ) internal pure returns (address payable a) {\n require(b.length == 20);\n assembly {\n a := div(mload(add(b, 32)), exp(256, 12))\n }\n }\n\n function addressToBytes(address a) internal pure returns (bytes memory b) {\n b = new bytes(20);\n assembly {\n mstore(add(b, 32), mul(a, exp(256, 12)))\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IContentHashResolver.sol\";\n\nabstract contract ContentHashResolver is IContentHashResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => bytes)) versionable_hashes;\n\n /**\n * Sets the contenthash associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The contenthash to set\n */\n function setContenthash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n versionable_hashes[recordVersions[node]][node] = hash;\n emit ContenthashChanged(node, hash);\n }\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_hashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IContentHashResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/DNSResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"../../dnssec-oracle/RRUtils.sol\";\nimport \"./IDNSRecordResolver.sol\";\nimport \"./IDNSZoneResolver.sol\";\n\nabstract contract DNSResolver is\n IDNSRecordResolver,\n IDNSZoneResolver,\n ResolverBase\n{\n using RRUtils for *;\n using BytesUtils for bytes;\n\n // Zone hashes for the domains.\n // A zone hash is an EIP-1577 content hash in binary format that should point to a\n // resource containing a single zonefile.\n // node => contenthash\n mapping(uint64 => mapping(bytes32 => bytes)) private versionable_zonehashes;\n\n // The records themselves. Stored as binary RRSETs\n // node => version => name => resource => data\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => mapping(uint16 => bytes))))\n private versionable_records;\n\n // Count of number of entries for a given name. Required for DNS resolvers\n // when resolving wildcards.\n // node => version => name => number of records\n mapping(uint64 => mapping(bytes32 => mapping(bytes32 => uint16)))\n private versionable_nameEntriesCount;\n\n /**\n * Set one or more DNS records. Records are supplied in wire-format.\n * Records with the same node/name/resource must be supplied one after the\n * other to ensure the data is updated correctly. For example, if the data\n * was supplied:\n * a.example.com IN A 1.2.3.4\n * a.example.com IN A 5.6.7.8\n * www.example.com IN CNAME a.example.com.\n * then this would store the two A records for a.example.com correctly as a\n * single RRSET, however if the data was supplied:\n * a.example.com IN A 1.2.3.4\n * www.example.com IN CNAME a.example.com.\n * a.example.com IN A 5.6.7.8\n * then this would store the first A record, the CNAME, then the second A\n * record which would overwrite the first.\n *\n * @param node the namehash of the node for which to set the records\n * @param data the DNS wire format records to set\n */\n function setDNSRecords(\n bytes32 node,\n bytes calldata data\n ) external virtual authorised(node) {\n uint16 resource = 0;\n uint256 offset = 0;\n bytes memory name;\n bytes memory value;\n bytes32 nameHash;\n uint64 version = recordVersions[node];\n // Iterate over the data to add the resource records\n for (\n RRUtils.RRIterator memory iter = data.iterateRRs(0);\n !iter.done();\n iter.next()\n ) {\n if (resource == 0) {\n resource = iter.dnstype;\n name = iter.name();\n nameHash = keccak256(abi.encodePacked(name));\n value = bytes(iter.rdata());\n } else {\n bytes memory newName = iter.name();\n if (resource != iter.dnstype || !name.equals(newName)) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n iter.offset - offset,\n value.length == 0,\n version\n );\n resource = iter.dnstype;\n offset = iter.offset;\n name = newName;\n nameHash = keccak256(name);\n value = bytes(iter.rdata());\n }\n }\n }\n if (name.length > 0) {\n setDNSRRSet(\n node,\n name,\n resource,\n data,\n offset,\n data.length - offset,\n value.length == 0,\n version\n );\n }\n }\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) public view virtual override returns (bytes memory) {\n return versionable_records[recordVersions[node]][node][name][resource];\n }\n\n /**\n * Check if a given node has records.\n * @param node the namehash of the node for which to check the records\n * @param name the namehash of the node for which to check the records\n */\n function hasDNSRecords(\n bytes32 node,\n bytes32 name\n ) public view virtual returns (bool) {\n return (versionable_nameEntriesCount[recordVersions[node]][node][\n name\n ] != 0);\n }\n\n /**\n * setZonehash sets the hash for the zone.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param hash The zonehash to set\n */\n function setZonehash(\n bytes32 node,\n bytes calldata hash\n ) external virtual authorised(node) {\n uint64 currentRecordVersion = recordVersions[node];\n bytes memory oldhash = versionable_zonehashes[currentRecordVersion][\n node\n ];\n versionable_zonehashes[currentRecordVersion][node] = hash;\n emit DNSZonehashChanged(node, oldhash, hash);\n }\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(\n bytes32 node\n ) external view virtual override returns (bytes memory) {\n return versionable_zonehashes[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IDNSRecordResolver).interfaceId ||\n interfaceID == type(IDNSZoneResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n\n function setDNSRRSet(\n bytes32 node,\n bytes memory name,\n uint16 resource,\n bytes memory data,\n uint256 offset,\n uint256 size,\n bool deleteRecord,\n uint64 version\n ) private {\n bytes32 nameHash = keccak256(name);\n bytes memory rrData = data.substring(offset, size);\n if (deleteRecord) {\n if (\n versionable_records[version][node][nameHash][resource].length !=\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]--;\n }\n delete (versionable_records[version][node][nameHash][resource]);\n emit DNSRecordDeleted(node, name, resource);\n } else {\n if (\n versionable_records[version][node][nameHash][resource].length ==\n 0\n ) {\n versionable_nameEntriesCount[version][node][nameHash]++;\n }\n versionable_records[version][node][nameHash][resource] = rrData;\n emit DNSRecordChanged(node, name, resource, rrData);\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/ExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ncontract ExtendedResolver {\n function resolve(\n bytes memory /* name */,\n bytes memory data\n ) external view returns (bytes memory) {\n (bool success, bytes memory result) = address(this).staticcall(data);\n if (success) {\n return result;\n } else {\n // Revert with the reason provided by the call\n assembly {\n revert(add(result, 0x20), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/InterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../ResolverBase.sol\";\nimport \"./AddrResolver.sol\";\nimport \"./IInterfaceResolver.sol\";\n\nabstract contract InterfaceResolver is IInterfaceResolver, AddrResolver {\n mapping(uint64 => mapping(bytes32 => mapping(bytes4 => address))) versionable_interfaces;\n\n /**\n * Sets an interface associated with a name.\n * Setting the address to 0 restores the default behaviour of querying the contract at `addr()` for interface support.\n * @param node The node to update.\n * @param interfaceID The EIP 165 interface ID.\n * @param implementer The address of a contract that implements this interface for this node.\n */\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external virtual authorised(node) {\n versionable_interfaces[recordVersions[node]][node][\n interfaceID\n ] = implementer;\n emit InterfaceChanged(node, interfaceID, implementer);\n }\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view virtual override returns (address) {\n address implementer = versionable_interfaces[recordVersions[node]][\n node\n ][interfaceID];\n if (implementer != address(0)) {\n return implementer;\n }\n\n address a = addr(node);\n if (a == address(0)) {\n return address(0);\n }\n\n (bool success, bytes memory returnData) = a.staticcall(\n abi.encodeWithSignature(\n \"supportsInterface(bytes4)\",\n type(IERC165).interfaceId\n )\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // EIP 165 not supported by target\n return address(0);\n }\n\n (success, returnData) = a.staticcall(\n abi.encodeWithSignature(\"supportsInterface(bytes4)\", interfaceID)\n );\n if (!success || returnData.length < 32 || returnData[31] == 0) {\n // Specified interface not supported by target\n return address(0);\n }\n\n return a;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IInterfaceResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IVersionableResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IVersionableResolver {\n event VersionChanged(bytes32 indexed node, uint64 newVersion);\n\n function recordVersions(bytes32 node) external view returns (uint64);\n}\n" + }, + "contracts/resolvers/profiles/NameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./INameResolver.sol\";\n\nabstract contract NameResolver is INameResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => string)) versionable_names;\n\n /**\n * Sets the name associated with an ENS node, for reverse records.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function setName(\n bytes32 node,\n string calldata newName\n ) external virtual authorised(node) {\n versionable_names[recordVersions[node]][node] = newName;\n emit NameChanged(node, newName);\n }\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(\n bytes32 node\n ) external view virtual override returns (string memory) {\n return versionable_names[recordVersions[node]][node];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(INameResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/PubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./IPubkeyResolver.sol\";\n\nabstract contract PubkeyResolver is IPubkeyResolver, ResolverBase {\n struct PublicKey {\n bytes32 x;\n bytes32 y;\n }\n\n mapping(uint64 => mapping(bytes32 => PublicKey)) versionable_pubkeys;\n\n /**\n * Sets the SECP256k1 public key associated with an ENS node.\n * @param node The ENS node to query\n * @param x the X coordinate of the curve point for the public key.\n * @param y the Y coordinate of the curve point for the public key.\n */\n function setPubkey(\n bytes32 node,\n bytes32 x,\n bytes32 y\n ) external virtual authorised(node) {\n versionable_pubkeys[recordVersions[node]][node] = PublicKey(x, y);\n emit PubkeyChanged(node, x, y);\n }\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(\n bytes32 node\n ) external view virtual override returns (bytes32 x, bytes32 y) {\n uint64 currentRecordVersion = recordVersions[node];\n return (\n versionable_pubkeys[currentRecordVersion][node].x,\n versionable_pubkeys[currentRecordVersion][node].y\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IPubkeyResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/profiles/TextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"../ResolverBase.sol\";\nimport \"./ITextResolver.sol\";\n\nabstract contract TextResolver is ITextResolver, ResolverBase {\n mapping(uint64 => mapping(bytes32 => mapping(string => string))) versionable_texts;\n\n /**\n * Sets the text data associated with an ENS node and key.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n * @param key The key to set.\n * @param value The text data value to set.\n */\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external virtual authorised(node) {\n versionable_texts[recordVersions[node]][node][key] = value;\n emit TextChanged(node, key, key, value);\n }\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view virtual override returns (string memory) {\n return versionable_texts[recordVersions[node]][node][key];\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(ITextResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/resolvers/ResolverBase.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"./profiles/IVersionableResolver.sol\";\n\nabstract contract ResolverBase is ERC165, IVersionableResolver {\n mapping(bytes32 => uint64) public recordVersions;\n\n function isAuthorised(bytes32 node) internal view virtual returns (bool);\n\n modifier authorised(bytes32 node) {\n require(isAuthorised(node));\n _;\n }\n\n /**\n * Increments the record version associated with an ENS node.\n * May only be called by the owner of that node in the ENS registry.\n * @param node The node to update.\n */\n function clearRecords(bytes32 node) public virtual authorised(node) {\n recordVersions[node]++;\n emit VersionChanged(node, recordVersions[node]);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n interfaceID == type(IVersionableResolver).interfaceId ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/root/Root.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./Controllable.sol\";\n\ncontract Root is Ownable, Controllable {\n bytes32 private constant ROOT_NODE = bytes32(0);\n\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n\n event TLDLocked(bytes32 indexed label);\n\n ENS public ens;\n mapping(bytes32 => bool) public locked;\n\n constructor(ENS _ens) public {\n ens = _ens;\n }\n\n function setSubnodeOwner(\n bytes32 label,\n address owner\n ) external onlyController {\n require(!locked[label]);\n ens.setSubnodeOwner(ROOT_NODE, label, owner);\n }\n\n function setResolver(address resolver) external onlyOwner {\n ens.setResolver(ROOT_NODE, resolver);\n }\n\n function lock(bytes32 label) external onlyOwner {\n emit TLDLocked(label);\n locked[label] = true;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return interfaceID == INTERFACE_META_ID;\n }\n}\n" + }, + "contracts/test/mocks/MockERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(\n string memory name,\n string memory symbol,\n address[] memory addresses\n ) ERC20(name, symbol) {\n _mint(msg.sender, 100 * 10 ** uint256(decimals()));\n\n for (uint256 i = 0; i < addresses.length; i++) {\n _mint(addresses[i], 100 * 10 ** uint256(decimals()));\n }\n }\n}\n" + }, + "contracts/utils/BytesUtils.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary BytesUtils {\n error OffsetOutOfBoundsError(uint256 offset, uint256 length);\n\n /*\n * @dev Returns the keccak-256 hash of a byte range.\n * @param self The byte string to hash.\n * @param offset The position to start hashing at.\n * @param len The number of bytes to hash.\n * @return The hash of the byte range.\n */\n function keccak(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(offset + len <= self.length);\n assembly {\n ret := keccak256(add(add(self, 32), offset), len)\n }\n }\n\n /**\n * @dev Returns the ENS namehash of a DNS-encoded name.\n * @param self The DNS-encoded name to hash.\n * @param offset The offset at which to start hashing.\n * @return The namehash of the name.\n */\n function namehash(\n bytes memory self,\n uint256 offset\n ) internal pure returns (bytes32) {\n (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);\n if (labelhash == bytes32(0)) {\n require(offset == self.length - 1, \"namehash: Junk at end of name\");\n return bytes32(0);\n }\n return\n keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));\n }\n\n /**\n * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.\n * @param self The byte string to read a label from.\n * @param idx The index to read a label at.\n * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.\n * @return newIdx The index of the start of the next label.\n */\n function readLabel(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 labelhash, uint256 newIdx) {\n require(idx < self.length, \"readLabel: Index out of bounds\");\n uint256 len = uint256(uint8(self[idx]));\n if (len > 0) {\n labelhash = keccak(self, idx + 1, len);\n } else {\n labelhash = bytes32(0);\n }\n newIdx = idx + len + 1;\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal.\n * @param self The first bytes to compare.\n * @param other The second bytes to compare.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n bytes memory other\n ) internal pure returns (int256) {\n return compare(self, 0, self.length, other, 0, other.length);\n }\n\n /*\n * @dev Returns a positive number if `other` comes lexicographically after\n * `self`, a negative number if it comes before, or zero if the\n * contents of the two bytes are equal. Comparison is done per-rune,\n * on unicode codepoints.\n * @param self The first bytes to compare.\n * @param offset The offset of self.\n * @param len The length of self.\n * @param other The second bytes to compare.\n * @param otheroffset The offset of the other string.\n * @param otherlen The length of the other string.\n * @return The result of the comparison.\n */\n function compare(\n bytes memory self,\n uint256 offset,\n uint256 len,\n bytes memory other,\n uint256 otheroffset,\n uint256 otherlen\n ) internal pure returns (int256) {\n if (offset + len > self.length) {\n revert OffsetOutOfBoundsError(offset + len, self.length);\n }\n if (otheroffset + otherlen > other.length) {\n revert OffsetOutOfBoundsError(otheroffset + otherlen, other.length);\n }\n\n uint256 shortest = len;\n if (otherlen < len) shortest = otherlen;\n\n uint256 selfptr;\n uint256 otherptr;\n\n assembly {\n selfptr := add(self, add(offset, 32))\n otherptr := add(other, add(otheroffset, 32))\n }\n for (uint256 idx = 0; idx < shortest; idx += 32) {\n uint256 a;\n uint256 b;\n assembly {\n a := mload(selfptr)\n b := mload(otherptr)\n }\n if (a != b) {\n // Mask out irrelevant bytes and check again\n uint256 mask;\n if (shortest - idx >= 32) {\n mask = type(uint256).max;\n } else {\n mask = ~(2 ** (8 * (idx + 32 - shortest)) - 1);\n }\n int256 diff = int256(a & mask) - int256(b & mask);\n if (diff != 0) return diff;\n }\n selfptr += 32;\n otherptr += 32;\n }\n\n return int256(len) - int256(otherlen);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @param len The number of bytes to compare\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset,\n uint256 len\n ) internal pure returns (bool) {\n return keccak(self, offset, len) == keccak(other, otherOffset, len);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal with offsets.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @param otherOffset The offset into the second byte range.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other,\n uint256 otherOffset\n ) internal pure returns (bool) {\n return\n keccak(self, offset, self.length - offset) ==\n keccak(other, otherOffset, other.length - otherOffset);\n }\n\n /*\n * @dev Compares a range of 'self' to all of 'other' and returns True iff\n * they are equal.\n * @param self The first byte range to compare.\n * @param offset The offset into the first byte range.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n uint256 offset,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == offset + other.length &&\n equals(self, offset, other, 0, other.length);\n }\n\n /*\n * @dev Returns true if the two byte ranges are equal.\n * @param self The first byte range to compare.\n * @param other The second byte range to compare.\n * @return True if the byte ranges are equal, false otherwise.\n */\n function equals(\n bytes memory self,\n bytes memory other\n ) internal pure returns (bool) {\n return\n self.length == other.length &&\n equals(self, 0, other, 0, self.length);\n }\n\n /*\n * @dev Returns the 8-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 8 bits of the string, interpreted as an integer.\n */\n function readUint8(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint8 ret) {\n return uint8(self[idx]);\n }\n\n /*\n * @dev Returns the 16-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 16 bits of the string, interpreted as an integer.\n */\n function readUint16(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint16 ret) {\n require(idx + 2 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 2), idx)), 0xFFFF)\n }\n }\n\n /*\n * @dev Returns the 32-bit number at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bits of the string, interpreted as an integer.\n */\n function readUint32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (uint32 ret) {\n require(idx + 4 <= self.length);\n assembly {\n ret := and(mload(add(add(self, 4), idx)), 0xFFFFFFFF)\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes32(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes32 ret) {\n require(idx + 32 <= self.length);\n assembly {\n ret := mload(add(add(self, 32), idx))\n }\n }\n\n /*\n * @dev Returns the 32 byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes\n * @return The specified 32 bytes of the string.\n */\n function readBytes20(\n bytes memory self,\n uint256 idx\n ) internal pure returns (bytes20 ret) {\n require(idx + 20 <= self.length);\n assembly {\n ret := and(\n mload(add(add(self, 32), idx)),\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000\n )\n }\n }\n\n /*\n * @dev Returns the n byte value at the specified index of self.\n * @param self The byte string.\n * @param idx The index into the bytes.\n * @param len The number of bytes.\n * @return The specified 32 bytes of the string.\n */\n function readBytesN(\n bytes memory self,\n uint256 idx,\n uint256 len\n ) internal pure returns (bytes32 ret) {\n require(len <= 32);\n require(idx + len <= self.length);\n assembly {\n let mask := not(sub(exp(256, sub(32, len)), 1))\n ret := and(mload(add(add(self, 32), idx)), mask)\n }\n }\n\n function memcpy(uint256 dest, uint256 src, uint256 len) private pure {\n // Copy word-length chunks while possible\n for (; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n // Copy remaining bytes\n unchecked {\n uint256 mask = (256 ** (32 - len)) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n }\n\n /*\n * @dev Copies a substring into a new byte string.\n * @param self The byte string to copy from.\n * @param offset The offset to start copying at.\n * @param len The number of bytes to copy.\n */\n function substring(\n bytes memory self,\n uint256 offset,\n uint256 len\n ) internal pure returns (bytes memory) {\n require(offset + len <= self.length);\n\n bytes memory ret = new bytes(len);\n uint256 dest;\n uint256 src;\n\n assembly {\n dest := add(ret, 32)\n src := add(add(self, 32), offset)\n }\n memcpy(dest, src, len);\n\n return ret;\n }\n\n // Maps characters from 0x30 to 0x7A to their base32 values.\n // 0xFF represents invalid characters in that range.\n bytes constant base32HexTable =\n hex\"00010203040506070809FFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1FFFFFFFFFFFFFFFFFFFFF0A0B0C0D0E0F101112131415161718191A1B1C1D1E1F\";\n\n /**\n * @dev Decodes unpadded base32 data of up to one word in length.\n * @param self The data to decode.\n * @param off Offset into the string to start at.\n * @param len Number of characters to decode.\n * @return The decoded data, left aligned.\n */\n function base32HexDecodeWord(\n bytes memory self,\n uint256 off,\n uint256 len\n ) internal pure returns (bytes32) {\n require(len <= 52);\n\n uint256 ret = 0;\n uint8 decoded;\n for (uint256 i = 0; i < len; i++) {\n bytes1 char = self[off + i];\n require(char >= 0x30 && char <= 0x7A);\n decoded = uint8(base32HexTable[uint256(uint8(char)) - 0x30]);\n require(decoded <= 0x20);\n if (i == len - 1) {\n break;\n }\n ret = (ret << 5) | decoded;\n }\n\n uint256 bitlen = len * 5;\n if (len % 8 == 0) {\n // Multiple of 8 characters, no padding\n ret = (ret << 5) | decoded;\n } else if (len % 8 == 2) {\n // Two extra characters - 1 byte\n ret = (ret << 3) | (decoded >> 2);\n bitlen -= 2;\n } else if (len % 8 == 4) {\n // Four extra characters - 2 bytes\n ret = (ret << 1) | (decoded >> 4);\n bitlen -= 4;\n } else if (len % 8 == 5) {\n // Five extra characters - 3 bytes\n ret = (ret << 4) | (decoded >> 1);\n bitlen -= 1;\n } else if (len % 8 == 7) {\n // Seven extra characters - 4 bytes\n ret = (ret << 2) | (decoded >> 3);\n bitlen -= 3;\n } else {\n revert();\n }\n\n return bytes32(ret << (256 - bitlen));\n }\n\n /**\n * @dev Finds the first occurrence of the byte `needle` in `self`.\n * @param self The string to search\n * @param off The offset to start searching at\n * @param len The number of bytes to search\n * @param needle The byte to search for\n * @return The offset of `needle` in `self`, or 2**256-1 if it was not found.\n */\n function find(\n bytes memory self,\n uint256 off,\n uint256 len,\n bytes1 needle\n ) internal pure returns (uint256) {\n for (uint256 idx = off; idx < off + len; idx++) {\n if (self[idx] == needle) {\n return idx;\n }\n }\n return type(uint256).max;\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/HexUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nlibrary HexUtils {\n /**\n * @dev Attempts to parse bytes32 from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexStringToBytes32(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes32, bool) {\n require(lastIdx - idx <= 64);\n (bytes memory r, bool valid) = hexToBytes(str, idx, lastIdx);\n if (!valid) {\n return (bytes32(0), false);\n }\n bytes32 ret;\n assembly {\n ret := shr(mul(4, sub(64, sub(lastIdx, idx))), mload(add(r, 32)))\n }\n return (ret, true);\n }\n\n function hexToBytes(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (bytes memory r, bool valid) {\n uint256 hexLength = lastIdx - idx;\n if (hexLength % 2 == 1) {\n revert(\"Invalid string length\");\n }\n r = new bytes(hexLength / 2);\n valid = true;\n assembly {\n // check that the index to read to is not past the end of the string\n if gt(lastIdx, mload(str)) {\n revert(0, 0)\n }\n\n function getHex(c) -> ascii {\n // chars 48-57: 0-9\n if and(gt(c, 47), lt(c, 58)) {\n ascii := sub(c, 48)\n leave\n }\n // chars 65-70: A-F\n if and(gt(c, 64), lt(c, 71)) {\n ascii := add(sub(c, 65), 10)\n leave\n }\n // chars 97-102: a-f\n if and(gt(c, 96), lt(c, 103)) {\n ascii := add(sub(c, 97), 10)\n leave\n }\n // invalid char\n ascii := 0xff\n }\n\n let ptr := add(str, 32)\n for {\n let i := idx\n } lt(i, lastIdx) {\n i := add(i, 2)\n } {\n let byte1 := getHex(byte(0, mload(add(ptr, i))))\n let byte2 := getHex(byte(0, mload(add(ptr, add(i, 1)))))\n // if either byte is invalid, set invalid and break loop\n if or(eq(byte1, 0xff), eq(byte2, 0xff)) {\n valid := false\n break\n }\n let combined := or(shl(4, byte1), byte2)\n mstore8(add(add(r, 32), div(sub(i, idx), 2)), combined)\n }\n }\n }\n\n /**\n * @dev Attempts to parse an address from a hex string\n * @param str The string to parse\n * @param idx The offset to start parsing at\n * @param lastIdx The (exclusive) last index in `str` to consider. Use `str.length` to scan the whole string.\n */\n function hexToAddress(\n bytes memory str,\n uint256 idx,\n uint256 lastIdx\n ) internal pure returns (address, bool) {\n if (lastIdx - idx < 40) return (address(0x0), false);\n (bytes32 r, bool valid) = hexStringToBytes32(str, idx, lastIdx);\n return (address(uint160(uint256(r))), valid);\n }\n\n /**\n * @dev Attempts to convert an address to a hex string\n * @param addr The _addr to parse\n */\n function addressToHex(address addr) internal pure returns (string memory) {\n bytes memory hexString = new bytes(40);\n for (uint i = 0; i < 20; i++) {\n bytes1 byteValue = bytes1(uint8(uint160(addr) >> (8 * (19 - i))));\n bytes1 highNibble = bytes1(uint8(byteValue) / 16);\n bytes1 lowNibble = bytes1(\n uint8(byteValue) - 16 * uint8(highNibble)\n );\n hexString[2 * i] = _nibbleToHexChar(highNibble);\n hexString[2 * i + 1] = _nibbleToHexChar(lowNibble);\n }\n return string(hexString);\n }\n\n function _nibbleToHexChar(\n bytes1 nibble\n ) internal pure returns (bytes1 hexChar) {\n if (uint8(nibble) < 10) return bytes1(uint8(nibble) + 0x30);\n else return bytes1(uint8(nibble) + 0x57);\n }\n}\n" + }, + "contracts/utils/IWBNB.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @dev Minimal WBNB interface (same as WETH9)\ninterface IWBNB {\n /// @notice Deposit native BNB and mint WBNB 1:1\n function deposit() external payable;\n /// @notice Burn WBNB and withdraw native BNB 1:1\n function withdraw(uint256 wad) external;\n /// @notice ERC20: total tokens in existence\n function totalSupply() external view returns (uint256);\n /// @notice ERC20: balance of `who`\n function balanceOf(address who) external view returns (uint256);\n /// @notice ERC20: transfer `wad` tokens to `to`\n function transfer(address to, uint256 wad) external returns (bool);\n /// @notice ERC20: allowance from `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n /// @notice ERC20: approve `spender` to spend up to `wad` tokens\n function approve(address spender, uint256 wad) external returns (bool);\n /// @notice ERC20: transfer `wad` tokens from `from` to `to`\n function transferFrom(\n address from,\n address to,\n uint256 wad\n ) external returns (bool);\n\n // Optional: some implementations also emit these\n event Approval(address indexed owner, address indexed spender, uint256 value);\n event Transfer(address indexed from, address indexed to, uint256 value);\n}\n" + }, + "contracts/utils/LowLevelCallUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.13;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\nlibrary LowLevelCallUtils {\n using Address for address;\n\n /**\n * @dev Makes a static call to the specified `target` with `data`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data\n ) internal view returns (bool success) {\n return functionStaticCall(target, data, gasleft());\n }\n\n /**\n * @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with\n * `returnDataSize` and `readReturnData`.\n * @param target The address to staticcall.\n * @param data The data to pass to the call.\n * @param gasLimit The gas limit to use for the call.\n * @return success True if the call succeeded, or false if it reverts.\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n uint256 gasLimit\n ) internal view returns (bool success) {\n require(\n target.isContract(),\n \"LowLevelCallUtils: static call to non-contract\"\n );\n assembly {\n success := staticcall(\n gasLimit,\n target,\n add(data, 32),\n mload(data),\n 0,\n 0\n )\n }\n }\n\n /**\n * @dev Returns the size of the return data of the most recent external call.\n */\n function returnDataSize() internal pure returns (uint256 len) {\n assembly {\n len := returndatasize()\n }\n }\n\n /**\n * @dev Reads return data from the most recent external call.\n * @param offset Offset into the return data.\n * @param length Number of bytes to return.\n */\n function readReturnData(\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory data) {\n data = new bytes(length);\n assembly {\n returndatacopy(add(data, 32), offset, length)\n }\n }\n\n /**\n * @dev Reverts with the return data from the most recent external call.\n */\n function propagateRevert() internal pure {\n assembly {\n returndatacopy(0, 0, returndatasize())\n revert(0, returndatasize())\n }\n }\n}\n" + }, + "contracts/utils/MigrationHelper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {Controllable} from \"../wrapper/Controllable.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract MigrationHelper is Ownable, Controllable {\n IBaseRegistrar public immutable registrar;\n INameWrapper public immutable wrapper;\n address public migrationTarget;\n\n error MigrationTargetNotSet();\n\n event MigrationTargetUpdated(address indexed target);\n\n constructor(IBaseRegistrar _registrar, INameWrapper _wrapper) {\n registrar = _registrar;\n wrapper = _wrapper;\n }\n\n function setMigrationTarget(address target) external onlyOwner {\n migrationTarget = target;\n emit MigrationTargetUpdated(target);\n }\n\n function migrateNames(\n address nameOwner,\n uint256[] memory tokenIds,\n bytes memory data\n ) external onlyController {\n if (migrationTarget == address(0)) {\n revert MigrationTargetNotSet();\n }\n\n for (uint256 i = 0; i < tokenIds.length; i++) {\n registrar.safeTransferFrom(\n nameOwner,\n migrationTarget,\n tokenIds[i],\n data\n );\n }\n }\n\n function migrateWrappedNames(\n address nameOwner,\n uint256[] memory tokenIds,\n bytes memory data\n ) external onlyController {\n if (migrationTarget == address(0)) {\n revert MigrationTargetNotSet();\n }\n\n uint256[] memory amounts = new uint256[](tokenIds.length);\n for (uint256 i = 0; i < amounts.length; i++) {\n amounts[i] = 1;\n }\n wrapper.safeBatchTransferFrom(\n nameOwner,\n migrationTarget,\n tokenIds,\n amounts,\n data\n );\n }\n}\n" + }, + "contracts/utils/NameEncoder.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {BytesUtils} from \"../utils/BytesUtils.sol\";\n\nlibrary NameEncoder {\n using BytesUtils for bytes;\n\n function dnsEncodeName(\n string memory name\n ) internal pure returns (bytes memory dnsName, bytes32 node) {\n uint8 labelLength = 0;\n bytes memory bytesName = bytes(name);\n uint256 length = bytesName.length;\n dnsName = new bytes(length + 2);\n node = 0;\n if (length == 0) {\n dnsName[0] = 0;\n return (dnsName, node);\n }\n\n // use unchecked to save gas since we check for an underflow\n // and we check for the length before the loop\n unchecked {\n for (uint256 i = length - 1; i >= 0; i--) {\n if (bytesName[i] == \".\") {\n dnsName[i + 1] = bytes1(labelLength);\n node = keccak256(\n abi.encodePacked(\n node,\n bytesName.keccak(i + 1, labelLength)\n )\n );\n labelLength = 0;\n } else {\n labelLength += 1;\n dnsName[i + 1] = bytesName[i];\n }\n if (i == 0) {\n break;\n }\n }\n }\n\n node = keccak256(\n abi.encodePacked(node, bytesName.keccak(0, labelLength))\n );\n\n dnsName[0] = bytes1(labelLength);\n return (dnsName, node);\n }\n}\n" + }, + "contracts/utils/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n\n /**\n * @dev Escapes special characters in a given string\n *\n * @param str The string to escape\n * @return The escaped string\n */\n function escape(string memory str) internal pure returns (string memory) {\n bytes memory strBytes = bytes(str);\n uint extraChars = 0;\n\n // count extra space needed for escaping\n for (uint i = 0; i < strBytes.length; i++) {\n if (_needsEscaping(strBytes[i])) {\n extraChars++;\n }\n }\n\n // allocate buffer with the exact size needed\n bytes memory buffer = new bytes(strBytes.length + extraChars);\n uint index = 0;\n\n // escape characters\n for (uint i = 0; i < strBytes.length; i++) {\n if (_needsEscaping(strBytes[i])) {\n buffer[index++] = \"\\\\\";\n buffer[index++] = _getEscapedChar(strBytes[i]);\n } else {\n buffer[index++] = strBytes[i];\n }\n }\n\n return string(buffer);\n }\n\n // determine if a character needs escaping\n function _needsEscaping(bytes1 char) private pure returns (bool) {\n return\n char == '\"' ||\n char == \"/\" ||\n char == \"\\\\\" ||\n char == \"\\n\" ||\n char == \"\\r\" ||\n char == \"\\t\";\n }\n\n // get the escaped character\n function _getEscapedChar(bytes1 char) private pure returns (bytes1) {\n if (char == \"\\n\") return \"n\";\n if (char == \"\\r\") return \"r\";\n if (char == \"\\t\") return \"t\";\n return char;\n }\n}\n" + }, + "contracts/utils/UniversalResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {LowLevelCallUtils} from \"./LowLevelCallUtils.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IExtendedResolver} from \"../resolvers/profiles/IExtendedResolver.sol\";\nimport {Resolver, INameResolver, IAddrResolver} from \"../resolvers/Resolver.sol\";\nimport {BytesUtils} from \"../utils/BytesUtils.sol\";\nimport {NameEncoder} from \"./NameEncoder.sol\";\nimport {HexUtils} from \"./HexUtils.sol\";\n\nerror OffchainLookup(\n address sender,\n string[] urls,\n bytes callData,\n bytes4 callbackFunction,\n bytes extraData\n);\n\nerror ResolverNotFound();\n\nerror ResolverWildcardNotSupported();\n\nerror ResolverNotContract();\n\nerror ResolverError(bytes returnData);\n\nerror HttpError(HttpErrorItem[] errors);\n\nstruct HttpErrorItem {\n uint16 status;\n string message;\n}\n\nstruct MulticallData {\n bytes name;\n bytes[] data;\n string[] gateways;\n bytes4 callbackFunction;\n bool isWildcard;\n address resolver;\n bytes metaData;\n bool[] failures;\n}\n\nstruct MulticallChecks {\n bool isCallback;\n bool hasExtendedResolver;\n}\n\nstruct OffchainLookupCallData {\n address sender;\n string[] urls;\n bytes callData;\n}\n\nstruct OffchainLookupExtraData {\n bytes4 callbackFunction;\n bytes data;\n}\n\nstruct Result {\n bool success;\n bytes returnData;\n}\n\ninterface BatchGateway {\n function query(\n OffchainLookupCallData[] memory data\n ) external returns (bool[] memory failures, bytes[] memory responses);\n}\n\n/**\n * The Universal Resolver is a contract that handles the work of resolving a name entirely onchain,\n * making it possible to make a single smart contract call to resolve an ENS name.\n */\ncontract UniversalResolver is ERC165, Ownable {\n using Address for address;\n using NameEncoder for string;\n using BytesUtils for bytes;\n using HexUtils for bytes;\n\n string[] public batchGatewayURLs;\n ENS public immutable registry;\n\n constructor(address _registry, string[] memory _urls) {\n registry = ENS(_registry);\n batchGatewayURLs = _urls;\n }\n\n function setGatewayURLs(string[] memory _urls) public onlyOwner {\n batchGatewayURLs = _urls;\n }\n\n /**\n * @dev Performs ENS name resolution for the supplied name and resolution data.\n * @param name The name to resolve, in normalised and DNS-encoded form.\n * @param data The resolution data, as specified in ENSIP-10.\n * @return The result of resolving the name.\n */\n function resolve(\n bytes calldata name,\n bytes memory data\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n batchGatewayURLs,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data\n ) external view returns (Result[] memory, address) {\n return resolve(name, data, batchGatewayURLs);\n }\n\n function resolve(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways\n ) external view returns (bytes memory, address) {\n return\n _resolveSingle(\n name,\n data,\n gateways,\n this.resolveSingleCallback.selector,\n \"\"\n );\n }\n\n function resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways\n ) public view returns (Result[] memory, address) {\n return\n _resolve(name, data, gateways, this.resolveCallback.selector, \"\");\n }\n\n function _resolveSingle(\n bytes calldata name,\n bytes memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) public view returns (bytes memory, address) {\n bytes[] memory dataArr = new bytes[](1);\n dataArr[0] = data;\n (Result[] memory results, address resolver) = _resolve(\n name,\n dataArr,\n gateways,\n callbackFunction,\n metaData\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function _resolve(\n bytes calldata name,\n bytes[] memory data,\n string[] memory gateways,\n bytes4 callbackFunction,\n bytes memory metaData\n ) internal view returns (Result[] memory results, address resolverAddress) {\n (Resolver resolver, , uint256 finalOffset) = findResolver(name);\n resolverAddress = address(resolver);\n if (resolverAddress == address(0)) {\n revert ResolverNotFound();\n }\n\n if (!resolverAddress.isContract()) {\n revert ResolverNotContract();\n }\n\n bool isWildcard = finalOffset != 0;\n\n results = _multicall(\n MulticallData(\n name,\n data,\n gateways,\n callbackFunction,\n isWildcard,\n resolverAddress,\n metaData,\n new bool[](data.length)\n )\n );\n }\n\n function reverse(\n bytes calldata reverseName\n ) external view returns (string memory, address, address, address) {\n return reverse(reverseName, batchGatewayURLs);\n }\n\n /**\n * @dev Performs ENS name reverse resolution for the supplied reverse name.\n * @param reverseName The reverse name to resolve, in normalised and DNS-encoded form. e.g. b6E040C9ECAaE172a89bD561c5F73e1C48d28cd9.addr.reverse\n * @return The resolved name, the resolved address, the reverse resolver address, and the resolver address.\n */\n function reverse(\n bytes calldata reverseName,\n string[] memory gateways\n ) public view returns (string memory, address, address, address) {\n bytes memory encodedCall = abi.encodeCall(\n INameResolver.name,\n reverseName.namehash(0)\n );\n (\n bytes memory reverseResolvedData,\n address reverseResolverAddress\n ) = _resolveSingle(\n reverseName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n \"\"\n );\n\n return\n getForwardDataFromReverse(\n reverseResolvedData,\n reverseResolverAddress,\n gateways\n );\n }\n\n function getForwardDataFromReverse(\n bytes memory resolvedReverseData,\n address reverseResolverAddress,\n string[] memory gateways\n ) internal view returns (string memory, address, address, address) {\n string memory resolvedName = abi.decode(resolvedReverseData, (string));\n\n (bytes memory encodedName, bytes32 namehash) = resolvedName\n .dnsEncodeName();\n\n bytes memory encodedCall = abi.encodeCall(IAddrResolver.addr, namehash);\n bytes memory metaData = abi.encode(\n resolvedName,\n reverseResolverAddress\n );\n (bytes memory resolvedData, address resolverAddress) = this\n ._resolveSingle(\n encodedName,\n encodedCall,\n gateways,\n this.reverseCallback.selector,\n metaData\n );\n\n address resolvedAddress = abi.decode(resolvedData, (address));\n\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n function resolveSingleCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (bytes memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveSingleCallback.selector\n );\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n return (result.returnData, resolver);\n }\n\n function resolveCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (Result[] memory, address) {\n (Result[] memory results, address resolver, , ) = _resolveCallback(\n response,\n extraData,\n this.resolveCallback.selector\n );\n return (results, resolver);\n }\n\n function reverseCallback(\n bytes calldata response,\n bytes calldata extraData\n ) external view returns (string memory, address, address, address) {\n (\n Result[] memory results,\n address resolverAddress,\n string[] memory gateways,\n bytes memory metaData\n ) = _resolveCallback(\n response,\n extraData,\n this.reverseCallback.selector\n );\n\n Result memory result = results[0];\n\n _checkResolveSingle(result);\n\n if (metaData.length > 0) {\n (string memory resolvedName, address reverseResolverAddress) = abi\n .decode(metaData, (string, address));\n address resolvedAddress = abi.decode(result.returnData, (address));\n return (\n resolvedName,\n resolvedAddress,\n reverseResolverAddress,\n resolverAddress\n );\n }\n\n return\n getForwardDataFromReverse(\n result.returnData,\n resolverAddress,\n gateways\n );\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IExtendedResolver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _resolveCallback(\n bytes calldata response,\n bytes calldata extraData,\n bytes4 callbackFunction\n )\n internal\n view\n returns (Result[] memory, address, string[] memory, bytes memory)\n {\n MulticallData memory multicallData;\n multicallData.callbackFunction = callbackFunction;\n (bool[] memory failures, bytes[] memory responses) = abi.decode(\n response,\n (bool[], bytes[])\n );\n OffchainLookupExtraData[] memory extraDatas;\n (\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n ) = abi.decode(\n extraData,\n (bool, address, string[], bytes, OffchainLookupExtraData[])\n );\n require(responses.length <= extraDatas.length);\n multicallData.data = new bytes[](extraDatas.length);\n multicallData.failures = new bool[](extraDatas.length);\n uint256 offchainCount = 0;\n for (uint256 i = 0; i < extraDatas.length; i++) {\n if (extraDatas[i].callbackFunction == bytes4(0)) {\n // This call did not require an offchain lookup; use the previous input data.\n multicallData.data[i] = extraDatas[i].data;\n } else {\n if (failures[offchainCount]) {\n multicallData.failures[i] = true;\n multicallData.data[i] = responses[offchainCount];\n } else {\n multicallData.data[i] = abi.encodeWithSelector(\n extraDatas[i].callbackFunction,\n responses[offchainCount],\n extraDatas[i].data\n );\n }\n offchainCount = offchainCount + 1;\n }\n }\n\n return (\n _multicall(multicallData),\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData\n );\n }\n\n /**\n * @dev Makes a call to `target` with `data`. If the call reverts with an `OffchainLookup` error, wraps\n * the error with the data necessary to continue the request where it left off.\n * @param target The address to call.\n * @param data The data to call `target` with.\n * @return offchain Whether the call reverted with an `OffchainLookup` error.\n * @return returnData If `target` did not revert, contains the return data from the call to `target`. Otherwise, contains a `OffchainLookupCallData` struct.\n * @return extraData If `target` did not revert, is empty. Otherwise, contains a `OffchainLookupExtraData` struct.\n * @return result Whether the call succeeded.\n */\n function callWithOffchainLookupPropagation(\n address target,\n bytes memory data,\n bool isSafe\n )\n internal\n view\n returns (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool result\n )\n {\n if (isSafe) {\n result = LowLevelCallUtils.functionStaticCall(target, data);\n } else {\n result = LowLevelCallUtils.functionStaticCall(target, data, 50000);\n }\n uint256 size = LowLevelCallUtils.returnDataSize();\n\n if (result) {\n return (\n false,\n LowLevelCallUtils.readReturnData(0, size),\n extraData,\n true\n );\n }\n\n // Failure\n if (size >= 4) {\n bytes memory errorId = LowLevelCallUtils.readReturnData(0, 4);\n // Offchain lookup. Decode the revert message and create our own that nests it.\n bytes memory revertData = LowLevelCallUtils.readReturnData(\n 4,\n size - 4\n );\n if (bytes4(errorId) == OffchainLookup.selector) {\n (\n address wrappedSender,\n string[] memory wrappedUrls,\n bytes memory wrappedCallData,\n bytes4 wrappedCallbackFunction,\n bytes memory wrappedExtraData\n ) = abi.decode(\n revertData,\n (address, string[], bytes, bytes4, bytes)\n );\n if (wrappedSender == target) {\n returnData = abi.encode(\n OffchainLookupCallData(\n wrappedSender,\n wrappedUrls,\n wrappedCallData\n )\n );\n extraData = OffchainLookupExtraData(\n wrappedCallbackFunction,\n wrappedExtraData\n );\n return (true, returnData, extraData, false);\n }\n } else {\n returnData = bytes.concat(errorId, revertData);\n return (false, returnData, extraData, false);\n }\n }\n }\n\n /**\n * @dev Finds a resolver by recursively querying the registry, starting at the longest name and progressively\n * removing labels until it finds a result.\n * @param name The name to resolve, in DNS-encoded and normalised form.\n * @return resolver The Resolver responsible for this name.\n * @return namehash The namehash of the full name.\n * @return finalOffset The offset of the first label with a resolver.\n */\n function findResolver(\n bytes calldata name\n ) public view returns (Resolver, bytes32, uint256) {\n (\n address resolver,\n bytes32 namehash,\n uint256 finalOffset\n ) = findResolver(name, 0);\n return (Resolver(resolver), namehash, finalOffset);\n }\n\n function findResolver(\n bytes calldata name,\n uint256 offset\n ) internal view returns (address, bytes32, uint256) {\n uint256 labelLength = uint256(uint8(name[offset]));\n if (labelLength == 0) {\n return (address(0), bytes32(0), offset);\n }\n uint256 nextLabel = offset + labelLength + 1;\n bytes32 labelHash;\n if (\n labelLength == 66 &&\n // 0x5b == '['\n name[offset + 1] == 0x5b &&\n // 0x5d == ']'\n name[nextLabel - 1] == 0x5d\n ) {\n // Encrypted label\n (labelHash, ) = bytes(name[offset + 2:nextLabel - 1])\n .hexStringToBytes32(0, 64);\n } else {\n labelHash = keccak256(name[offset + 1:nextLabel]);\n }\n (\n address parentresolver,\n bytes32 parentnode,\n uint256 parentoffset\n ) = findResolver(name, nextLabel);\n bytes32 node = keccak256(abi.encodePacked(parentnode, labelHash));\n address resolver = registry.resolver(node);\n if (resolver != address(0)) {\n return (resolver, node, offset);\n }\n return (parentresolver, node, parentoffset);\n }\n\n function _checkInterface(\n address resolver,\n bytes4 interfaceId\n ) internal view returns (bool) {\n try\n Resolver(resolver).supportsInterface{gas: 50000}(interfaceId)\n returns (bool supported) {\n return supported;\n } catch {\n return false;\n }\n }\n\n function _checkSafetyAndItem(\n bytes memory name,\n bytes memory item,\n address resolver,\n MulticallChecks memory multicallChecks\n ) internal view returns (bool, bytes memory) {\n if (!multicallChecks.isCallback) {\n if (multicallChecks.hasExtendedResolver) {\n return (\n true,\n abi.encodeCall(IExtendedResolver.resolve, (name, item))\n );\n }\n return (_checkInterface(resolver, bytes4(item)), item);\n }\n return (true, item);\n }\n\n function _checkMulticall(\n MulticallData memory multicallData\n ) internal view returns (MulticallChecks memory) {\n bool isCallback = multicallData.name.length == 0;\n bool hasExtendedResolver = _checkInterface(\n multicallData.resolver,\n type(IExtendedResolver).interfaceId\n );\n\n if (multicallData.isWildcard && !hasExtendedResolver) {\n revert ResolverWildcardNotSupported();\n }\n\n return MulticallChecks(isCallback, hasExtendedResolver);\n }\n\n function _checkResolveSingle(Result memory result) internal pure {\n if (!result.success) {\n if (bytes4(result.returnData) == HttpError.selector) {\n bytes memory returnData = result.returnData;\n assembly {\n revert(add(returnData, 32), mload(returnData))\n }\n }\n revert ResolverError(result.returnData);\n }\n }\n\n function _multicall(\n MulticallData memory multicallData\n ) internal view returns (Result[] memory results) {\n uint256 length = multicallData.data.length;\n uint256 offchainCount = 0;\n OffchainLookupCallData[]\n memory callDatas = new OffchainLookupCallData[](length);\n OffchainLookupExtraData[]\n memory extraDatas = new OffchainLookupExtraData[](length);\n results = new Result[](length);\n MulticallChecks memory multicallChecks = _checkMulticall(multicallData);\n\n for (uint256 i = 0; i < length; i++) {\n bytes memory item = multicallData.data[i];\n bool failure = multicallData.failures[i];\n\n if (failure) {\n results[i] = Result(false, item);\n continue;\n }\n\n bool isSafe = false;\n (isSafe, item) = _checkSafetyAndItem(\n multicallData.name,\n item,\n multicallData.resolver,\n multicallChecks\n );\n\n (\n bool offchain,\n bytes memory returnData,\n OffchainLookupExtraData memory extraData,\n bool success\n ) = callWithOffchainLookupPropagation(\n multicallData.resolver,\n item,\n isSafe\n );\n\n if (offchain) {\n callDatas[offchainCount] = abi.decode(\n returnData,\n (OffchainLookupCallData)\n );\n extraDatas[i] = extraData;\n offchainCount += 1;\n continue;\n }\n\n if (success && multicallChecks.hasExtendedResolver) {\n // if this is a successful resolve() call, unwrap the result\n returnData = abi.decode(returnData, (bytes));\n }\n results[i] = Result(success, returnData);\n extraDatas[i].data = item;\n }\n\n if (offchainCount == 0) {\n return results;\n }\n\n // Trim callDatas if offchain data exists\n assembly {\n mstore(callDatas, offchainCount)\n }\n\n revert OffchainLookup(\n address(this),\n multicallData.gateways,\n abi.encodeWithSelector(BatchGateway.query.selector, callDatas),\n multicallData.callbackFunction,\n abi.encode(\n multicallData.isWildcard,\n multicallData.resolver,\n multicallData.gateways,\n multicallData.metaData,\n extraDatas\n )\n );\n }\n}\n" + }, + "contracts/wrapper/Controllable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool active);\n\n function setController(address controller, bool active) public onlyOwner {\n controllers[controller] = active;\n emit ControllerChanged(controller, active);\n }\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n}\n" + }, + "contracts/wrapper/ERC1155Fuse.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\n\n/* This contract is a variation on ERC1155 with the additions of _setData, getData and _beforeTransfer and ownerOf. _setData and getData allows the use of the other 96 bits next to the address of the owner for extra data. We use this to store 'fuses' that control permissions that can be burnt. 32 bits are used for the fuses themselves and 64 bits are used for the expiry of the name. When a name has expired, its fuses will be be set back to 0 */\n\nabstract contract ERC1155Fuse is ERC165, IERC1155, IERC1155MetadataURI {\n using Address for address;\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n mapping(uint256 => uint256) public _tokens;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n // Mapping from token ID to approved address\n mapping(uint256 => address) internal _tokenApprovals;\n\n /**************************************************************************\n * ERC721 methods\n *************************************************************************/\n\n function ownerOf(uint256 id) public view virtual returns (address) {\n (address owner, , ) = getData(id);\n return owner;\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(\n uint256 tokenId\n ) public view virtual returns (address) {\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155).interfaceId ||\n interfaceId == type(IERC1155MetadataURI).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(\n address account,\n uint256 id\n ) public view virtual override returns (uint256) {\n require(\n account != address(0),\n \"ERC1155: balance query for the zero address\"\n );\n address owner = ownerOf(id);\n if (owner == account) {\n return 1;\n }\n return 0;\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] memory accounts,\n uint256[] memory ids\n ) public view virtual override returns (uint256[] memory) {\n require(\n accounts.length == ids.length,\n \"ERC1155: accounts and ids length mismatch\"\n );\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(\n msg.sender != operator,\n \"ERC1155: setting approval status for self\"\n );\n\n _operatorApprovals[msg.sender][operator] = approved;\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(\n address account,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev Returns the Name's owner address and fuses\n */\n function getData(\n uint256 tokenId\n ) public view virtual returns (address owner, uint32 fuses, uint64 expiry) {\n uint256 t = _tokens[tokenId];\n owner = address(uint160(t));\n expiry = uint64(t >> 192);\n fuses = uint32(t >> 160);\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: caller is not owner nor approved\"\n );\n\n _transfer(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n ids.length == amounts.length,\n \"ERC1155: ids and amounts length mismatch\"\n );\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n require(\n from == msg.sender || isApprovedForAll(from, msg.sender),\n \"ERC1155: transfer caller is not owner nor approved\"\n );\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n _setData(id, to, fuses, expiry);\n }\n\n emit TransferBatch(msg.sender, from, to, ids, amounts);\n\n _doSafeBatchTransferAcceptanceCheck(\n msg.sender,\n from,\n to,\n ids,\n amounts,\n data\n );\n }\n\n /**************************************************************************\n * Internal/private methods\n *************************************************************************/\n\n /**\n * @dev Sets the Name's owner address and fuses\n */\n function _setData(\n uint256 tokenId,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n _tokens[tokenId] =\n uint256(uint160(owner)) |\n (uint256(fuses) << 160) |\n (uint256(expiry) << 192);\n }\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal virtual;\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual returns (address, uint32);\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal virtual {\n uint256 tokenId = uint256(node);\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n uint32 parentControlledFuses = (uint32(type(uint16).max) << 16) &\n oldFuses;\n\n if (oldExpiry > expiry) {\n expiry = oldExpiry;\n }\n\n if (oldExpiry >= block.timestamp) {\n fuses = fuses | parentControlledFuses;\n }\n\n require(oldOwner == address(0), \"ERC1155: mint of existing token\");\n require(owner != address(0), \"ERC1155: mint to the zero address\");\n require(\n owner != address(this),\n \"ERC1155: newOwner cannot be the NameWrapper contract\"\n );\n\n _setData(tokenId, owner, fuses, expiry);\n emit TransferSingle(msg.sender, address(0x0), owner, tokenId, 1);\n _doSafeTransferAcceptanceCheck(\n msg.sender,\n address(0),\n owner,\n tokenId,\n 1,\n \"\"\n );\n }\n\n function _burn(uint256 tokenId) internal virtual {\n (address oldOwner, uint32 fuses, uint64 expiry) = ERC1155Fuse.getData(\n tokenId\n );\n (, fuses) = _clearOwnerAndFuses(oldOwner, fuses, expiry);\n // Clear approvals\n delete _tokenApprovals[tokenId];\n // Fuses and expiry are kept on burn\n _setData(tokenId, address(0x0), fuses, expiry);\n emit TransferSingle(msg.sender, oldOwner, address(0x0), tokenId, 1);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal {\n (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);\n\n _beforeTransfer(id, fuses, expiry);\n\n require(\n amount == 1 && oldOwner == from,\n \"ERC1155: insufficient balance for transfer\"\n );\n\n if (oldOwner == to) {\n return;\n }\n\n _setData(id, to, fuses, expiry);\n\n emit TransferSingle(msg.sender, from, to, id, amount);\n\n _doSafeTransferAcceptanceCheck(msg.sender, from, to, id, amount, data);\n }\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155Received(\n operator,\n from,\n id,\n amount,\n data\n )\n returns (bytes4 response) {\n if (\n response != IERC1155Receiver(to).onERC1155Received.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try\n IERC1155Receiver(to).onERC1155BatchReceived(\n operator,\n from,\n ids,\n amounts,\n data\n )\n returns (bytes4 response) {\n if (\n response !=\n IERC1155Receiver(to).onERC1155BatchReceived.selector\n ) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non ERC1155Receiver implementer\");\n }\n }\n }\n\n /* ERC721 internal functions */\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_CRE8OR = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + }, + "contracts/wrapper/mocks/TestUnwrap.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\nimport \"../../registry/ENS.sol\";\nimport \"../../ethregistrar/IBaseRegistrar.sol\";\nimport {BytesUtils} from \"../../utils/BytesUtils.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract TestUnwrap is Ownable {\n using BytesUtils for bytes;\n\n bytes32 private constant ETH_NODE =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n mapping(address => bool) public approvedWrapper;\n\n constructor(ENS _ens, IBaseRegistrar _registrar) {\n ens = _ens;\n registrar = _registrar;\n }\n\n function setWrapperApproval(\n address wrapper,\n bool approved\n ) public onlyOwner {\n approvedWrapper[wrapper] = approved;\n }\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) public {\n _unwrapETH2LD(keccak256(bytes(label)), wrappedOwner, msg.sender);\n }\n\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address newOwner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, keccak256(bytes(label)));\n _unwrapSubnode(node, newOwner, msg.sender);\n }\n\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (parentNode == ETH_NODE) {\n _unwrapETH2LD(labelhash, wrappedOwner, msg.sender);\n } else {\n _unwrapSubnode(node, wrappedOwner, msg.sender);\n }\n }\n\n function _unwrapETH2LD(\n bytes32 labelhash,\n address wrappedOwner,\n address sender\n ) private {\n uint256 tokenId = uint256(labelhash);\n address registrant = registrar.ownerOf(tokenId);\n\n require(\n approvedWrapper[sender] &&\n sender == registrant &&\n registrar.isApprovedForAll(registrant, address(this)),\n \"Unauthorised\"\n );\n\n registrar.reclaim(tokenId, wrappedOwner);\n registrar.transferFrom(registrant, wrappedOwner, tokenId);\n }\n\n function _unwrapSubnode(\n bytes32 node,\n address newOwner,\n address sender\n ) private {\n address owner = ens.owner(node);\n\n require(\n approvedWrapper[sender] &&\n owner == sender &&\n ens.isApprovedForAll(owner, address(this)),\n \"Unauthorised\"\n );\n\n ens.setOwner(node, newOwner);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n}\n" + }, + "contracts/wrapper/NameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {ERC1155Fuse, IERC165, IERC1155MetadataURI} from \"./ERC1155Fuse.sol\";\nimport {Controllable} from \"./Controllable.sol\";\nimport {INameWrapper, CANNOT_UNWRAP, CANNOT_BURN_FUSES, CANNOT_TRANSFER, CANNOT_SET_RESOLVER, CANNOT_SET_TTL, CANNOT_CREATE_SUBDOMAIN, CANNOT_APPROVE, PARENT_CANNOT_CONTROL, CAN_DO_EVERYTHING, IS_DOT_CRE8OR, CAN_EXTEND_EXPIRY, PARENT_CONTROLLED_FUSES, USER_SETTABLE_FUSES} from \"./INameWrapper.sol\";\nimport {INameWrapperUpgrade} from \"./INameWrapperUpgrade.sol\";\nimport {IMetadataService} from \"./IMetadataService.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IBaseRegistrar} from \"../ethregistrar/IBaseRegistrar.sol\";\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {BytesUtils} from \"../utils/BytesUtils.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\n\nerror Unauthorised(bytes32 node, address addr);\nerror IncompatibleParent();\nerror IncorrectTokenType();\nerror LabelMismatch(bytes32 labelHash, bytes32 expectedLabelhash);\nerror LabelTooShort();\nerror LabelTooLong(string label);\nerror IncorrectTargetOwner(address owner);\nerror CannotUpgrade();\nerror OperationProhibited(bytes32 node);\nerror NameIsNotWrapped();\nerror NameIsStillExpired();\n\ncontract NameWrapper is\n Ownable,\n ERC1155Fuse,\n INameWrapper,\n Controllable,\n IERC721Receiver,\n ERC20Recoverable,\n ReverseClaimer\n{\n using BytesUtils for bytes;\n\n ENS public immutable ens;\n IBaseRegistrar public immutable registrar;\n IMetadataService public metadataService;\n mapping(bytes32 => bytes) public names;\n string public constant name = \"NameWrapper\";\n\n uint64 private constant GRACE_PERIOD = 90 days;\n bytes32 private constant CRE8OR_NODE =\n 0x4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454;\n\n bytes32 private constant CRE8OR_LABELHASH =\n 0x0d1f301a4d55e328cfe2f78743e489a98cedaf66d744b3ab1bb877ff82930b0b;\n bytes32 private constant ROOT_NODE =\n 0x0000000000000000000000000000000000000000000000000000000000000000;\n\n INameWrapperUpgrade public upgradeContract;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n\n constructor(\n ENS _ens,\n IBaseRegistrar _registrar,\n IMetadataService _metadataService\n ) ReverseClaimer(_ens, msg.sender) {\n ens = _ens;\n registrar = _registrar;\n metadataService = _metadataService;\n\n /* Burn PARENT_CANNOT_CONTROL and CANNOT_UNWRAP fuses for ROOT_NODE and CRE8OR_NODE and set expiry to max */\n\n _setData(\n uint256(CRE8OR_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n _setData(\n uint256(ROOT_NODE),\n address(0),\n uint32(PARENT_CANNOT_CONTROL | CANNOT_UNWRAP),\n MAX_EXPIRY\n );\n names[ROOT_NODE] = \"\\x00\";\n names[CRE8OR_NODE] = \"\\x06cre8or\\x00\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155Fuse, INameWrapper) returns (bool) {\n return\n interfaceId == type(INameWrapper).interfaceId ||\n interfaceId == type(IERC721Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /* ERC1155 Fuse */\n\n /// @notice Gets the owner of a name\n /// @param id Label as a string of the .eth domain to wrap\n /// @return owner The owner of the name\n function ownerOf(\n uint256 id\n ) public view override(ERC1155Fuse, INameWrapper) returns (address owner) {\n return super.ownerOf(id);\n }\n\n /// @notice Gets the owner of a name\n /// @param id Namehash of the name\n /// @return operator Approved operator of a name\n function getApproved(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address operator)\n {\n address owner = ownerOf(id);\n if (owner == address(0)) {\n return address(0);\n }\n return super.getApproved(id);\n }\n\n /// @notice Approves an address for a name\n /// @param to address to approve\n /// @param tokenId name to approve\n function approve(\n address to,\n uint256 tokenId\n ) public override(ERC1155Fuse, INameWrapper) {\n (, uint32 fuses, ) = getData(tokenId);\n if (fuses & CANNOT_APPROVE == CANNOT_APPROVE) {\n revert OperationProhibited(bytes32(tokenId));\n }\n super.approve(to, tokenId);\n }\n\n /// @notice Gets the data for a name\n /// @param id Namehash of the name\n /// @return owner Owner of the name\n /// @return fuses Fuses of the name\n /// @return expiry Expiry of the name\n function getData(\n uint256 id\n )\n public\n view\n override(ERC1155Fuse, INameWrapper)\n returns (address owner, uint32 fuses, uint64 expiry)\n {\n (owner, fuses, expiry) = super.getData(id);\n\n (owner, fuses) = _clearOwnerAndFuses(owner, fuses, expiry);\n }\n\n /* Metadata service */\n\n /// @notice Set the metadata service. Only the owner can do this\n /// @param _metadataService The new metadata service\n function setMetadataService(\n IMetadataService _metadataService\n ) public onlyOwner {\n metadataService = _metadataService;\n }\n\n /// @notice Get the metadata uri\n /// @param tokenId The id of the token\n /// @return string uri of the metadata service\n function uri(\n uint256 tokenId\n )\n public\n view\n override(INameWrapper, IERC1155MetadataURI)\n returns (string memory)\n {\n return metadataService.uri(tokenId);\n }\n\n /// @notice Set the address of the upgradeContract of the contract. only admin can do this\n /// @dev The default value of upgradeContract is the 0 address. Use the 0 address at any time\n /// to make the contract not upgradable.\n /// @param _upgradeAddress address of an upgraded contract\n function setUpgradeContract(\n INameWrapperUpgrade _upgradeAddress\n ) public onlyOwner {\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), false);\n ens.setApprovalForAll(address(upgradeContract), false);\n }\n\n upgradeContract = _upgradeAddress;\n\n if (address(upgradeContract) != address(0)) {\n registrar.setApprovalForAll(address(upgradeContract), true);\n ens.setApprovalForAll(address(upgradeContract), true);\n }\n }\n\n /// @notice Checks if msg.sender is the owner or operator of the owner of a name\n /// @param node namehash of the name to check\n modifier onlyTokenOwner(bytes32 node) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n _;\n }\n\n /// @notice Checks if owner or operator of the owner\n /// @param node namehash of the name to check\n /// @param addr which address to check permissions for\n /// @return whether or not is owner or operator\n function canModifyName(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr || isApprovedForAll(owner, addr)) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /// @notice Checks if owner/operator or approved by owner\n /// @param node namehash of the name to check\n /// @param addr which address to check permissions for\n /// @return whether or not is owner/operator or approved\n function canExtendSubnames(\n bytes32 node,\n address addr\n ) public view returns (bool) {\n (address owner, uint32 fuses, uint64 expiry) = getData(uint256(node));\n return\n (owner == addr ||\n isApprovedForAll(owner, addr) ||\n getApproved(uint256(node)) == addr) &&\n !_isETH2LDInGracePeriod(fuses, expiry);\n }\n\n /// @notice Wraps a .eth domain, creating a new token and sending the original ERC721 token to this contract\n /// @dev Can be called by the owner of the name on the .eth registrar or an authorised caller on the registrar\n /// @param label Label as a string of the .eth domain to wrap\n /// @param wrappedOwner Owner of the name in this contract\n /// @param ownerControlledFuses Initial owner-controlled fuses to set\n /// @param resolver Resolver contract address\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) public returns (uint64 expiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n address registrant = registrar.ownerOf(tokenId);\n if (\n registrant != msg.sender &&\n !registrar.isApprovedForAll(registrant, msg.sender)\n ) {\n revert Unauthorised(\n _makeNode(CRE8OR_NODE, bytes32(tokenId)),\n msg.sender\n );\n }\n\n // transfer the token from the user to this contract\n registrar.transferFrom(registrant, address(this), tokenId);\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(tokenId, address(this));\n\n expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n expiry,\n resolver\n );\n }\n\n /// @dev Registers a new .eth second-level domain and wraps it.\n /// Only callable by authorised controllers.\n /// @param label The label to register (Eg, 'foo' for 'foo.eth').\n /// @param wrappedOwner The owner of the wrapped name.\n /// @param duration The duration, in seconds, to register the name for.\n /// @param resolver The resolver address to set on the ENS registry (optional).\n /// @param ownerControlledFuses Initial owner-controlled fuses to set\n /// @return registrarExpiry The expiry date of the new name on the .eth registrar, in seconds since the Unix epoch.\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external onlyController returns (uint256 registrarExpiry) {\n uint256 tokenId = uint256(keccak256(bytes(label)));\n registrarExpiry = registrar.register(tokenId, address(this), duration);\n _wrapETH2LD(\n label,\n wrappedOwner,\n ownerControlledFuses,\n uint64(registrarExpiry) + GRACE_PERIOD,\n resolver\n );\n }\n\n /// @notice Renews a .eth second-level domain.\n /// @dev Only callable by authorised controllers.\n /// @param tokenId The hash of the label to register (eg, `keccak256('foo')`, for 'foo.eth').\n /// @param duration The number of seconds to renew the name for.\n /// @return expires The expiry date of the name on the .eth registrar, in seconds since the Unix epoch.\n function renew(\n uint256 tokenId,\n uint256 duration\n ) external onlyController returns (uint256 expires) {\n bytes32 node = _makeNode(CRE8OR_NODE, bytes32(tokenId));\n\n uint256 registrarExpiry = registrar.renew(tokenId, duration);\n\n // Do not set anything in wrapper if name is not wrapped\n try registrar.ownerOf(tokenId) returns (address registrarOwner) {\n if (\n registrarOwner != address(this) ||\n ens.owner(node) != address(this)\n ) {\n return registrarExpiry;\n }\n } catch {\n return registrarExpiry;\n }\n\n // Set expiry in Wrapper\n uint64 expiry = uint64(registrarExpiry) + GRACE_PERIOD;\n\n // Use super to allow names expired on the wrapper, but not expired on the registrar to renew()\n (address owner, uint32 fuses, ) = super.getData(uint256(node));\n _setData(node, owner, fuses, expiry);\n\n return registrarExpiry;\n }\n\n /// @notice Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n /// @dev Can be called by the owner in the registry or an authorised caller in the registry\n /// @param name The name to wrap, in DNS format\n /// @param wrappedOwner Owner of the name in this contract\n /// @param resolver Resolver contract\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) public {\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n bytes32 node = _makeNode(parentNode, labelhash);\n\n names[node] = name;\n\n if (parentNode == CRE8OR_NODE) {\n revert IncompatibleParent();\n }\n\n address owner = ens.owner(node);\n\n if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n\n ens.setOwner(node, address(this));\n\n _wrap(node, name, wrappedOwner, 0, 0);\n }\n\n /// @notice Unwraps a .eth domain. e.g. vitalik.eth\n /// @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n /// @param labelhash Labelhash of the .eth domain\n /// @param registrant Sets the owner in the .eth registrar to this address\n /// @param controller Sets the owner in the registry to this address\n function unwrapETH2LD(\n bytes32 labelhash,\n address registrant,\n address controller\n ) public onlyTokenOwner(_makeNode(CRE8OR_NODE, labelhash)) {\n if (registrant == address(this)) {\n revert IncorrectTargetOwner(registrant);\n }\n _unwrap(_makeNode(CRE8OR_NODE, labelhash), controller);\n registrar.safeTransferFrom(\n address(this),\n registrant,\n uint256(labelhash)\n );\n }\n\n /// @notice Unwraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain\n /// @dev Can be called by the owner in the wrapper or an authorised caller in the wrapper\n /// @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n /// @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n /// @param controller Sets the owner in the registry to this address\n function unwrap(\n bytes32 parentNode,\n bytes32 labelhash,\n address controller\n ) public onlyTokenOwner(_makeNode(parentNode, labelhash)) {\n if (parentNode == CRE8OR_NODE) {\n revert IncompatibleParent();\n }\n if (controller == address(0x0) || controller == address(this)) {\n revert IncorrectTargetOwner(controller);\n }\n _unwrap(_makeNode(parentNode, labelhash), controller);\n }\n\n /// @notice Sets fuses of a name\n /// @param node Namehash of the name\n /// @param ownerControlledFuses Owner-controlled fuses to burn\n /// @return Old fuses\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n )\n public\n onlyTokenOwner(node)\n operationAllowed(node, CANNOT_BURN_FUSES)\n returns (uint32)\n {\n // owner protected by onlyTokenOwner\n (address owner, uint32 oldFuses, uint64 expiry) = getData(\n uint256(node)\n );\n _setFuses(node, owner, ownerControlledFuses | oldFuses, expiry, expiry);\n return oldFuses;\n }\n\n /// @notice Extends expiry for a name\n /// @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n /// @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n /// @param expiry When the name will expire in seconds since the Unix epoch\n /// @return New expiry\n function extendExpiry(\n bytes32 parentNode,\n bytes32 labelhash,\n uint64 expiry\n ) public returns (uint64) {\n bytes32 node = _makeNode(parentNode, labelhash);\n\n if (!_isWrapped(node)) {\n revert NameIsNotWrapped();\n }\n\n // this flag is used later, when checking fuses\n bool canExtendSubname = canExtendSubnames(parentNode, msg.sender);\n // only allow the owner of the name or owner of the parent name\n if (!canExtendSubname && !canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address owner, uint32 fuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n\n // Either CAN_EXTEND_EXPIRY must be set, or the caller must have permission to modify the parent name\n if (!canExtendSubname && fuses & CAN_EXTEND_EXPIRY == 0) {\n revert OperationProhibited(node);\n }\n\n // Max expiry is set to the expiry of the parent\n (, , uint64 maxExpiry) = getData(uint256(parentNode));\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n _setData(node, owner, fuses, expiry);\n emit ExpiryExtended(node, expiry);\n return expiry;\n }\n\n /// @notice Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain\n /// @dev Can be called by the owner or an authorised caller\n /// @param name The name to upgrade, in DNS format\n /// @param extraData Extra data to pass to the upgrade contract\n function upgrade(bytes calldata name, bytes calldata extraData) public {\n bytes32 node = name.namehash(0);\n\n if (address(upgradeContract) == address(0)) {\n revert CannotUpgrade();\n }\n\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n\n (address currentOwner, uint32 fuses, uint64 expiry) = getData(\n uint256(node)\n );\n\n address approved = getApproved(uint256(node));\n\n _burn(uint256(node));\n\n upgradeContract.wrapFromUpgrade(\n name,\n currentOwner,\n fuses,\n expiry,\n approved,\n extraData\n );\n }\n\n /// /* @notice Sets fuses of a name that you own the parent of\n /// @param parentNode Parent namehash of the name e.g. vitalik.xyz would be namehash('xyz')\n /// @param labelhash Labelhash of the name, e.g. vitalik.xyz would be keccak256('vitalik')\n /// @param fuses Fuses to burn\n /// @param expiry When the name will expire in seconds since the Unix epoch\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) public {\n bytes32 node = _makeNode(parentNode, labelhash);\n _checkFusesAreSettable(node, fuses);\n (address owner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n if (owner == address(0) || ens.owner(node) != address(this)) {\n revert NameIsNotWrapped();\n }\n // max expiry is set to the expiry of the parent\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n if (parentNode == ROOT_NODE) {\n if (!canModifyName(node, msg.sender)) {\n revert Unauthorised(node, msg.sender);\n }\n } else {\n if (!canModifyName(parentNode, msg.sender)) {\n revert Unauthorised(parentNode, msg.sender);\n }\n }\n\n _checkParentFuses(node, fuses, parentFuses);\n\n expiry = _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n\n // if PARENT_CANNOT_CONTROL has been burned and fuses have changed\n if (\n oldFuses & PARENT_CANNOT_CONTROL != 0 &&\n oldFuses | fuses != oldFuses\n ) {\n revert OperationProhibited(node);\n }\n fuses |= oldFuses;\n _setFuses(node, owner, fuses, oldExpiry, expiry);\n }\n\n /// @notice Sets the subdomain owner in the registry and then wraps the subdomain\n /// @param parentNode Parent namehash of the subdomain\n /// @param label Label of the subdomain as a string\n /// @param owner New owner in the wrapper\n /// @param fuses Initial fuses for the wrapped subdomain\n /// @param expiry When the name will expire in seconds since the Unix epoch\n /// @return node Namehash of the subdomain\n function setSubnodeOwner(\n bytes32 parentNode,\n string calldata label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n bytes memory name = _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n\n if (!_isWrapped(node)) {\n ens.setSubnodeOwner(parentNode, labelhash, address(this));\n _wrap(node, name, owner, fuses, expiry);\n } else {\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /// @notice Sets the subdomain owner in the registry with records and then wraps the subdomain\n /// @param parentNode parent namehash of the subdomain\n /// @param label label of the subdomain as a string\n /// @param owner new owner in the wrapper\n /// @param resolver resolver contract in the registry\n /// @param ttl ttl in the registry\n /// @param fuses initial fuses for the wrapped subdomain\n /// @param expiry When the name will expire in seconds since the Unix epoch\n /// @return node Namehash of the subdomain\n function setSubnodeRecord(\n bytes32 parentNode,\n string memory label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) public onlyTokenOwner(parentNode) returns (bytes32 node) {\n bytes32 labelhash = keccak256(bytes(label));\n node = _makeNode(parentNode, labelhash);\n _checkCanCallSetSubnodeOwner(parentNode, node);\n _checkFusesAreSettable(node, fuses);\n _saveLabel(parentNode, node, label);\n expiry = _checkParentFusesAndExpiry(parentNode, node, fuses, expiry);\n if (!_isWrapped(node)) {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _storeNameAndWrap(parentNode, node, label, owner, fuses, expiry);\n } else {\n ens.setSubnodeRecord(\n parentNode,\n labelhash,\n address(this),\n resolver,\n ttl\n );\n _updateName(parentNode, node, label, owner, fuses, expiry);\n }\n }\n\n /// @notice Sets records for the name in the ENS Registry\n /// @param node Namehash of the name to set a record for\n /// @param owner New owner in the registry\n /// @param resolver Resolver contract\n /// @param ttl Time to live in the registry\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n )\n public\n onlyTokenOwner(node)\n operationAllowed(\n node,\n CANNOT_TRANSFER | CANNOT_SET_RESOLVER | CANNOT_SET_TTL\n )\n {\n ens.setRecord(node, address(this), resolver, ttl);\n if (owner == address(0)) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & IS_DOT_CRE8OR == IS_DOT_CRE8OR) {\n revert IncorrectTargetOwner(owner);\n }\n _unwrap(node, address(0));\n } else {\n address oldOwner = ownerOf(uint256(node));\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n /// @notice Sets resolver contract in the registry\n /// @param node namehash of the name\n /// @param resolver the resolver contract\n function setResolver(\n bytes32 node,\n address resolver\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_RESOLVER) {\n ens.setResolver(node, resolver);\n }\n\n /// @notice Sets TTL in the registry\n /// @param node Namehash of the name\n /// @param ttl TTL in the registry\n function setTTL(\n bytes32 node,\n uint64 ttl\n ) public onlyTokenOwner(node) operationAllowed(node, CANNOT_SET_TTL) {\n ens.setTTL(node, ttl);\n }\n\n /// @dev Allows an operation only if none of the specified fuses are burned.\n /// @param node The namehash of the name to check fuses on.\n /// @param fuseMask A bitmask of fuses that must not be burned.\n modifier operationAllowed(bytes32 node, uint32 fuseMask) {\n (, uint32 fuses, ) = getData(uint256(node));\n if (fuses & fuseMask != 0) {\n revert OperationProhibited(node);\n }\n _;\n }\n\n /// @notice Check whether a name can call setSubnodeOwner/setSubnodeRecord\n /// @dev Checks both CANNOT_CREATE_SUBDOMAIN and PARENT_CANNOT_CONTROL and whether not they have been burnt\n /// and checks whether the owner of the subdomain is 0x0 for creating or already exists for\n /// replacing a subdomain. If either conditions are true, then it is possible to call\n /// setSubnodeOwner\n /// @param parentNode Namehash of the parent name to check\n /// @param subnode Namehash of the subname to check\n function _checkCanCallSetSubnodeOwner(\n bytes32 parentNode,\n bytes32 subnode\n ) internal view {\n (\n address subnodeOwner,\n uint32 subnodeFuses,\n uint64 subnodeExpiry\n ) = getData(uint256(subnode));\n\n // check if the registry owner is 0 and expired\n // check if the wrapper owner is 0 and expired\n // If either, then check parent fuses for CANNOT_CREATE_SUBDOMAIN\n bool expired = subnodeExpiry < block.timestamp;\n if (\n expired &&\n // protects a name that has been unwrapped with PCC and doesn't allow the parent to take control by recreating it if unexpired\n (subnodeOwner == address(0) ||\n // protects a name that has been burnt and doesn't allow the parent to take control by recreating it if unexpired\n ens.owner(subnode) == address(0))\n ) {\n (, uint32 parentFuses, ) = getData(uint256(parentNode));\n if (parentFuses & CANNOT_CREATE_SUBDOMAIN != 0) {\n revert OperationProhibited(subnode);\n }\n } else {\n if (subnodeFuses & PARENT_CANNOT_CONTROL != 0) {\n revert OperationProhibited(subnode);\n }\n }\n }\n\n /// @notice Checks all Fuses in the mask are burned for the node\n /// @param node Namehash of the name\n /// @param fuseMask The fuses you want to check\n /// @return Boolean of whether or not all the selected fuses are burned\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) public view returns (bool) {\n (, uint32 fuses, ) = getData(uint256(node));\n return fuses & fuseMask == fuseMask;\n }\n\n /// @notice Checks if a name is wrapped\n /// @param node Namehash of the name\n /// @return Boolean of whether or not the name is wrapped\n function isWrapped(bytes32 node) public view returns (bool) {\n bytes memory name = names[node];\n if (name.length == 0) {\n return false;\n }\n (bytes32 labelhash, uint256 offset) = name.readLabel(0);\n bytes32 parentNode = name.namehash(offset);\n return isWrapped(parentNode, labelhash);\n }\n\n /// @notice Checks if a name is wrapped in a more gas efficient way\n /// @param parentNode Namehash of the name\n /// @param labelhash Namehash of the name\n /// @return Boolean of whether or not the name is wrapped\n function isWrapped(\n bytes32 parentNode,\n bytes32 labelhash\n ) public view returns (bool) {\n bytes32 node = _makeNode(parentNode, labelhash);\n bool wrapped = _isWrapped(node);\n if (parentNode != CRE8OR_NODE) {\n return wrapped;\n }\n try registrar.ownerOf(uint256(labelhash)) returns (address owner) {\n return owner == address(this);\n } catch {\n return false;\n }\n }\n\n function onERC721Received(\n address to,\n address,\n uint256 tokenId,\n bytes calldata data\n ) public returns (bytes4) {\n //check if it's the eth registrar ERC721\n if (msg.sender != address(registrar)) {\n revert IncorrectTokenType();\n }\n\n (\n string memory label,\n address owner,\n uint16 ownerControlledFuses,\n address resolver\n ) = abi.decode(data, (string, address, uint16, address));\n\n bytes32 labelhash = bytes32(tokenId);\n bytes32 labelhashFromData = keccak256(bytes(label));\n\n if (labelhashFromData != labelhash) {\n revert LabelMismatch(labelhashFromData, labelhash);\n }\n\n // transfer the ens record back to the new owner (this contract)\n registrar.reclaim(uint256(labelhash), address(this));\n\n uint64 expiry = uint64(registrar.nameExpires(tokenId)) + GRACE_PERIOD;\n\n _wrapETH2LD(label, owner, ownerControlledFuses, expiry, resolver);\n\n return IERC721Receiver(to).onERC721Received.selector;\n }\n\n /***** Internal functions */\n\n function _beforeTransfer(\n uint256 id,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n // For this check, treat .eth 2LDs as expiring at the start of the grace period.\n if (fuses & IS_DOT_CRE8OR == IS_DOT_CRE8OR) {\n expiry -= GRACE_PERIOD;\n }\n\n if (expiry < block.timestamp) {\n // Transferable if the name was not emancipated\n if (fuses & PARENT_CANNOT_CONTROL != 0) {\n revert(\"ERC1155: insufficient balance for transfer\");\n }\n } else {\n // Transferable if CANNOT_TRANSFER is unburned\n if (fuses & CANNOT_TRANSFER != 0) {\n revert OperationProhibited(bytes32(id));\n }\n }\n\n // delete token approval if CANNOT_APPROVE has not been burnt\n if (fuses & CANNOT_APPROVE == 0) {\n delete _tokenApprovals[id];\n }\n }\n\n function _clearOwnerAndFuses(\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal view override returns (address, uint32) {\n if (expiry < block.timestamp) {\n if (fuses & PARENT_CANNOT_CONTROL == PARENT_CANNOT_CONTROL) {\n owner = address(0);\n }\n fuses = 0;\n }\n\n return (owner, fuses);\n }\n\n function _makeNode(\n bytes32 node,\n bytes32 labelhash\n ) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(node, labelhash));\n }\n\n function _addLabel(\n string memory label,\n bytes memory name\n ) internal pure returns (bytes memory ret) {\n if (bytes(label).length < 1) {\n revert LabelTooShort();\n }\n if (bytes(label).length > 255) {\n revert LabelTooLong(label);\n }\n return abi.encodePacked(uint8(bytes(label).length), label, name);\n }\n\n function _mint(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal override {\n _canFusesBeBurned(node, fuses);\n (address oldOwner, , ) = super.getData(uint256(node));\n if (oldOwner != address(0)) {\n // burn and unwrap old token of old owner\n _burn(uint256(node));\n emit NameUnwrapped(node, address(0));\n }\n super._mint(node, owner, fuses, expiry);\n }\n\n function _wrap(\n bytes32 node,\n bytes memory name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _mint(node, wrappedOwner, fuses, expiry);\n emit NameWrapped(node, name, wrappedOwner, fuses, expiry);\n }\n\n function _storeNameAndWrap(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n bytes memory name = _addLabel(label, names[parentNode]);\n _wrap(node, name, owner, fuses, expiry);\n }\n\n function _saveLabel(\n bytes32 parentNode,\n bytes32 node,\n string memory label\n ) internal returns (bytes memory) {\n bytes memory name = _addLabel(label, names[parentNode]);\n names[node] = name;\n return name;\n }\n\n function _updateName(\n bytes32 parentNode,\n bytes32 node,\n string memory label,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n (address oldOwner, uint32 oldFuses, uint64 oldExpiry) = getData(\n uint256(node)\n );\n bytes memory name = _addLabel(label, names[parentNode]);\n if (names[node].length == 0) {\n names[node] = name;\n }\n _setFuses(node, oldOwner, oldFuses | fuses, oldExpiry, expiry);\n if (owner == address(0)) {\n _unwrap(node, address(0));\n } else {\n _transfer(oldOwner, owner, uint256(node), 1, \"\");\n }\n }\n\n // wrapper function for stack limit\n function _checkParentFusesAndExpiry(\n bytes32 parentNode,\n bytes32 node,\n uint32 fuses,\n uint64 expiry\n ) internal view returns (uint64) {\n (, , uint64 oldExpiry) = getData(uint256(node));\n (, uint32 parentFuses, uint64 maxExpiry) = getData(uint256(parentNode));\n _checkParentFuses(node, fuses, parentFuses);\n return _normaliseExpiry(expiry, oldExpiry, maxExpiry);\n }\n\n function _checkParentFuses(\n bytes32 node,\n uint32 fuses,\n uint32 parentFuses\n ) internal pure {\n bool isBurningParentControlledFuses = fuses & PARENT_CONTROLLED_FUSES !=\n 0;\n\n bool parentHasNotBurnedCU = parentFuses & CANNOT_UNWRAP == 0;\n\n if (isBurningParentControlledFuses && parentHasNotBurnedCU) {\n revert OperationProhibited(node);\n }\n }\n\n function _normaliseExpiry(\n uint64 expiry,\n uint64 oldExpiry,\n uint64 maxExpiry\n ) private pure returns (uint64) {\n // Expiry cannot be more than maximum allowed\n // .eth names will check registrar, non .eth check parent\n if (expiry > maxExpiry) {\n expiry = maxExpiry;\n }\n // Expiry cannot be less than old expiry\n if (expiry < oldExpiry) {\n expiry = oldExpiry;\n }\n\n return expiry;\n }\n\n function _wrapETH2LD(\n string memory label,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address resolver\n ) private {\n bytes32 labelhash = keccak256(bytes(label));\n bytes32 node = _makeNode(CRE8OR_NODE, labelhash);\n // hardcode dns-encoded eth string for gas savings\n bytes memory name = _addLabel(label, \"\\x07creator\\x00\");\n names[node] = name;\n\n _wrap(\n node,\n name,\n wrappedOwner,\n fuses | PARENT_CANNOT_CONTROL | IS_DOT_CRE8OR,\n expiry\n );\n\n if (resolver != address(0)) {\n ens.setResolver(node, resolver);\n }\n }\n\n function _unwrap(bytes32 node, address owner) private {\n if (allFusesBurned(node, CANNOT_UNWRAP)) {\n revert OperationProhibited(node);\n }\n\n // Burn token and fuse data\n _burn(uint256(node));\n ens.setOwner(node, owner);\n\n emit NameUnwrapped(node, owner);\n }\n\n function _setFuses(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 oldExpiry,\n uint64 expiry\n ) internal {\n _setData(node, owner, fuses, expiry);\n emit FusesSet(node, fuses);\n if (expiry > oldExpiry) {\n emit ExpiryExtended(node, expiry);\n }\n }\n\n function _setData(\n bytes32 node,\n address owner,\n uint32 fuses,\n uint64 expiry\n ) internal {\n _canFusesBeBurned(node, fuses);\n super._setData(uint256(node), owner, fuses, expiry);\n }\n\n function _canFusesBeBurned(bytes32 node, uint32 fuses) internal pure {\n // If a non-parent controlled fuse is being burned, check PCC and CU are burnt\n if (\n fuses & ~PARENT_CONTROLLED_FUSES != 0 &&\n fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=\n (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)\n ) {\n revert OperationProhibited(node);\n }\n }\n\n function _checkFusesAreSettable(bytes32 node, uint32 fuses) internal pure {\n if (fuses | USER_SETTABLE_FUSES != USER_SETTABLE_FUSES) {\n // Cannot directly burn other non-user settable fuses\n revert OperationProhibited(node);\n }\n }\n\n function _isWrapped(bytes32 node) internal view returns (bool) {\n return\n ownerOf(uint256(node)) != address(0) &&\n ens.owner(node) == address(this);\n }\n\n function _isETH2LDInGracePeriod(\n uint32 fuses,\n uint64 expiry\n ) internal view returns (bool) {\n return\n fuses & IS_DOT_CRE8OR == IS_DOT_CRE8OR &&\n expiry - GRACE_PERIOD < block.timestamp;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/solcInputs/c7e40ea5f033df78220ad43e326ccd0c.json b/solidity/dns-contracts/deployments/testnet/solcInputs/c7e40ea5f033df78220ad43e326ccd0c.json new file mode 100644 index 0000000..c7a0da0 --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/solcInputs/c7e40ea5f033df78220ad43e326ccd0c.json @@ -0,0 +1,185 @@ +{ + "language": "Solidity", + "sources": { + "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n// solhint-disable-next-line interface-starts-with-i\ninterface AggregatorV3Interface {\n function decimals() external view returns (uint8);\n\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n\n function getRoundData(\n uint80 _roundId\n ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n\n function latestRoundData()\n external\n view\n returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 30 days;\n uint256 public constant LIFETIME = type(uint256).max;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /// v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n /// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n /// @dev Returns whether the given spender can transfer a given token ID\n /// @param spender address of the spender to query\n /// @param tokenId uint256 ID of the token to be transferred\n /// @return bool whether the msg.sender is approved for the given token ID,\n /// is an operator of the owner, or is the owner of the token\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n Ownable(msg.sender);\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /// @dev Gets the owner of the specified token ID. Names become unowned\n /// when their registration expires.\n /// @param tokenId uint256 ID of the token to query the owner of\n /// @return address currently marked as the owner of the given token ID\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /// @dev Register a name.\n /// @param id The token ID (keccak256 of the label).\n /// @param owner The address that should own the registration.\n /// @param duration Duration in seconds for the registration.\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override virtual returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /// @dev Register a name, without modifying the registry.\n /// @param id The token ID (keccak256 of the label).\n /// @param owner The address that should own the registration.\n /// @param duration Duration in seconds for the registration.\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n\n uint256 expiration;\n\n if (duration == 31536000000) {\n // Lifetime registration\n expiration = LIFETIME;\n } else {\n // Annual registration\n expiration = block.timestamp + duration;\n }\n\n expiries[id] = expiration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, expiration);\n\n return expiration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override virtual live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(expiries[id] != LIFETIME, \"Lifetime names cannot be renewed\");\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /// @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n\n function _exists(uint256 tokenId) internal view override returns (bool) {\n return super._exists(tokenId);\n }\n\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration,\n lifetime\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration,\n lifetime\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration, lifetime);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"../utils/StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\nimport {TokenPriceOracle} from \"./TokenPriceOracle.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nusing SafeERC20 for IERC20;\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {ReferralController} from \"./ReferralController.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/// @dev A registrar controller for registering and renewing names at fixed cost.\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n TokenPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n ReferralController public immutable referralController;\n address public infoFi;\n mapping(bytes32 => uint256) public commitments;\n address public backendWallet;\n uint256 public untrackedInfoFi;\n mapping(address => bool) public verifiedTokens;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n modifier onlyBackend() {\n require(msg.sender == backendWallet, \"Not Backend\");\n _;\n }\n\n constructor(\n BaseRegistrarImplementation _base,\n TokenPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens,\n address _infoFi,\n ReferralController _referralController\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n infoFi = _infoFi;\n referralController = _referralController;\n }\n\n function setBackend(address wallet) public onlyOwner {\n backendWallet = wallet;\n }\n\n function setToken (address tokenAddress) public onlyOwner {\n verifiedTokens[tokenAddress] = true;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration,\n bool lifetime\n ) public view virtual override returns (IPriceOracle.Price memory price) {\n require(\n duration == 0 || duration >= MIN_REGISTRATION_DURATION,\n \"Invalid duration\"\n );\n bytes32 label = keccak256(bytes(name));\n price = prices.price(\n name,\n base.nameExpires(uint256(label)),\n duration,\n lifetime\n );\n }\n\n function rentPriceToken(\n string memory name,\n uint256 duration,\n string memory token,\n bool lifetime\n ) public view virtual override returns (IPriceOracle.Price memory price) {\n require(\n duration == 0 || duration >= MIN_REGISTRATION_DURATION,\n \"Invalid duration\"\n );\n bytes32 label = keccak256(bytes(name));\n price = prices.priceToken(\n name,\n base.nameExpires(uint256(label)),\n duration,\n token,\n lifetime\n );\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 2;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] memory data,\n bool reverseRecord,\n uint16 ownerControlledFuses,\n bool lifetime\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses,\n lifetime\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] memory data,\n bool reverseRecord,\n uint16 ownerControlledFuses,\n bool lifetime,\n string memory referree\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses,\n lifetime\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n referralController.setReferree(\n keccak256(bytes(name)),\n owner,\n expires\n );\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n _referralPayout(price, referree, name, owner);\n }\n\n function registerWithCard(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] memory data,\n bool reverseRecord,\n uint16 ownerControlledFuses,\n bool lifetime,\n string memory referree\n ) public onlyBackend {\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses,\n lifetime\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, owner);\n referralController.setReferree(\n keccak256(bytes(name)),\n owner,\n duration\n );\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n if (keccak256(bytes(referree)) != keccak256(bytes(\"\"))) {\n referralController.settlementRegisterWithCard(\n referree,\n name,\n owner,\n price.base + price.premium,\n receiver\n );\n }\n untrackedInfoFi += (((price.base + price.premium) * 35) / 100);\n }\n\n function resetInfoFi() external payable onlyOwner {\n require(msg.value > 0, \"Must send value to reset infoFi\");\n (bool ok, ) = payable(infoFi).call{value: msg.value}(\"\");\n require(ok, \"Payment to infoFi failed\");\n untrackedInfoFi = 0;\n }\n\n function _tokenTransfer(\n address tokenAddress,\n IPriceOracle.Price memory price\n ) internal {\n require(\n IERC20(tokenAddress).allowance(msg.sender, address(this)) >=\n price.base + price.premium,\n \"Insufficient ERC20 allowance\"\n );\n\n if (\n IERC20(tokenAddress).balanceOf(msg.sender) <\n price.base + price.premium\n ) {\n revert InsufficientValue();\n }\n IERC20(tokenAddress).safeTransferFrom(\n msg.sender,\n address(this),\n price.base + price.premium\n );\n }\n\n function _internalRecordsCall(\n string memory name,\n bytes[] memory data,\n address owner,\n address resolver,\n bool reverseRecord,\n uint256 duration\n ) internal {\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n referralController.setReferree(\n keccak256(bytes(name)),\n owner,\n duration\n );\n }\n }\n\n function registerWithToken(\n RegisterParams memory registerParams,\n TokenParams memory tokenParams,\n bool lifetime,\n string memory referree\n ) external override {\n require(verifiedTokens[tokenParams.tokenAddress] == true, 'Unnacepted Token Address');\n _consumeCommitment(\n registerParams.name,\n registerParams.duration,\n makeCommitment(\n registerParams.name,\n registerParams.owner,\n registerParams.duration,\n registerParams.secret,\n registerParams.resolver,\n registerParams.data,\n registerParams.reverseRecord,\n registerParams.ownerControlledFuses,\n lifetime\n )\n );\n\n IPriceOracle.Price memory price = rentPriceToken(\n registerParams.name,\n registerParams.duration,\n tokenParams.token,\n lifetime\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n registerParams.name,\n registerParams.owner,\n registerParams.duration,\n registerParams.resolver,\n registerParams.ownerControlledFuses\n );\n\n _internalRecordsCall(\n registerParams.name,\n registerParams.data,\n registerParams.owner,\n registerParams.resolver,\n registerParams.reverseRecord,\n expires\n );\n _tokenTransfer(tokenParams.tokenAddress, price);\n\n emit NameRegistered(\n registerParams.name,\n keccak256(bytes(registerParams.name)),\n registerParams.owner,\n price.base,\n price.premium,\n expires\n );\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n\n uint256 referrals = referralController.totalReferrals(receiver);\n if (keccak256(bytes(referree)) != keccak256(bytes(\"\"))) {\n uint256 pct = referralController._rewardPct(referrals);\n\n IERC20(tokenParams.tokenAddress).safeTransfer(\n address(referralController),\n ((price.base + price.premium) * pct) / 100\n );\n referralController.settlementRegisterWithToken(\n referree,\n registerParams.name,\n registerParams.owner,\n price.base + price.premium,\n tokenParams.tokenAddress\n );\n }\n IERC20(tokenParams.tokenAddress).safeTransfer(\n infoFi,\n ((price.base + price.premium) * 35) / 100\n );\n }\n\n function renewCard(\n string calldata name,\n uint256 duration,\n bool lifetime\n ) external onlyBackend {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\n string memory referree = referralController.referredBy(labelhash);\n\n uint256 expires = nameWrapper.renew(tokenId, duration);\n referralController.updateReferralCode(keccak256(bytes(name)), expires);\n\n emit NameRenewed(name, labelhash, price.base, expires);\n if (\n referralController.referrees(keccak256(bytes(referree))) !=\n address(0)\n ) {\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n referralController.settlementCard(\n price.base + price.premium,\n receiver,\n referree\n );\n }\n untrackedInfoFi += ((price.base + price.premium) * 35) / 100;\n }\n\n function renew(\n string calldata name,\n uint256 duration,\n bool lifetime\n ) external payable {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\n string memory referree = referralController.referredBy(labelhash);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n referralController.updateReferralCode(keccak256(bytes(name)), expires);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n emit NameRenewed(name, labelhash, msg.value, expires);\n if (\n referralController.referrees(keccak256(bytes(referree))) !=\n address(0)\n ) {\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n referralController.settlement(\n price.base + price.premium,\n receiver,\n referree\n );\n }\n (bool ok, ) = payable(infoFi).call{\n value: ((price.base + price.premium) * 35) / 100\n }(\"\");\n require(ok, \"Payment to infoFi failed\");\n }\n\n function renewTokens(\n string calldata name,\n uint256 duration,\n string memory token,\n address tokenAddress,\n bool lifetime\n ) external override {\n require(verifiedTokens[tokenAddress] == true, 'Unnacepted Token Address');\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n string memory referree = referralController.referredBy(labelhash);\n IPriceOracle.Price memory price = rentPriceToken(\n name,\n duration,\n token,\n lifetime\n );\n if (\n IERC20(tokenAddress).balanceOf(msg.sender) <\n price.base + price.premium\n ) {\n revert InsufficientValue();\n }\n IERC20(tokenAddress).safeTransferFrom(\n msg.sender,\n address(this),\n price.base + price.premium\n );\n uint256 expires = nameWrapper.renew(tokenId, duration);\n referralController.updateReferralCode(keccak256(bytes(name)), expires);\n\n emit NameRenewed(name, labelhash, price.base + price.premium, expires);\n\n if (\n referralController.referrees(keccak256(bytes(referree))) !=\n address(0)\n ) {\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n uint256 referrals = referralController.totalReferrals(receiver);\n uint256 pct = referralController._rewardPct(referrals);\n\n IERC20(tokenAddress).safeTransferFrom(\n address(this),\n address(referralController),\n ((price.base + price.premium) * pct) / 100\n );\n referralController.settlementWithToken(\n price.base + price.premium,\n receiver,\n tokenAddress,\n referree\n );\n }\n IERC20(tokenAddress).safeTransferFrom(\n address(this),\n infoFi,\n ((price.base + price.premium) * 35) / 100\n );\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n\n function withdrawTokens(address tokenAddress) public {\n IERC20(tokenAddress).safeTransfer(\n owner(),\n IERC20(tokenAddress).balanceOf(address(this))\n );\n }\n\n function _referralPayout(\n IPriceOracle.Price memory price,\n string memory referree,\n string memory name,\n address owner\n ) internal {\n address receiver = referralController.referrees(\n keccak256(bytes(referree))\n );\n uint256 referrals = referralController.totalReferrals(receiver);\n if (keccak256(bytes(referree)) != keccak256(bytes(\"\"))) {\n uint256 pct = referralController._rewardPct(referrals);\n referralController.settlementRegister{\n value: (((price.base + price.premium) * pct) / 100)\n }(referree, name, owner, price.base + price.premium, receiver);\n }\n (bool ok, ) = payable(infoFi).call{\n value: ((price.base + price.premium) * 35) / 100\n }(\"\");\n require(ok, \"Payment to infoFi failed\");\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration != 0 && duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] memory data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".creator\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorV3Interface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n\n struct TokenParams{\n string token;\n address tokenAddress;\n }\n struct RegisterParams {\n string name;\n address owner;\n uint256 duration;\n bytes32 secret;\n address resolver;\n bytes[] data;\n bool reverseRecord;\n uint16 ownerControlledFuses;\n }\n function rentPrice(\n string memory,\n uint256,\n bool\n ) external view returns (IPriceOracle.Price memory);\n\n function rentPriceToken(\n string memory name,\n uint256 duration,\n string memory token,\n bool lifetime\n ) external view returns (IPriceOracle.Price memory price);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16,\n bool\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16,\n bool,\n string memory\n ) external payable;\n\n function registerWithToken(\n RegisterParams memory registerParams,\n TokenParams memory tokenParams,\n bool lifetime,\n string memory referree\n ) external;\n\n function renew(string calldata, uint256, bool) external payable;\n\n function renewTokens(\n string calldata name,\n uint256 duration,\n string memory token,\n address tokenAddress,\n bool lifetime\n ) external;\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration,\n bool lifetime\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/ReferralController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\nimport {IPriceOracle} from \"./IETHRegistrarController.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nusing SafeERC20 for IERC20;\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract ReferralController is Ownable {\n // Mapping from referral code to referrer address\n uint16 private constant TIER1 = 2;\n uint16 private constant TIER2 = 15;\n uint16 private constant TIER3 = 20;\n uint256 private constant PCT1 = 15;\n uint256 private constant PCT2 = 20;\n uint256 private constant PCT3 = 25;\n mapping(address => bool) public controllers;\n mapping(bytes32 => uint256) public commitments;\n mapping(bytes32 => address) public referrees;\n mapping(bytes32 => uint256) public expirydates;\n mapping(address => bytes32[]) public referrals;\n mapping(bytes32 => string) public referredBy;\n mapping(address => uint256) public nativeEarnings;\n mapping(address => mapping(address => uint256)) public tokenEarnings;\n\n bytes32[] public referralCodes;\n uint256 public untrackedEarnings;\n uint256 public snapshotUntrackedEarnings;\n mapping(address => uint256) public snapshotNativeEarnings;\n mapping(address => mapping(address => uint256))\n public snapshotTokenEarnings;\n uint256 public trackedNativeEarnings;\n mapping(address => uint256) public trackedTokenEarnings;\n\n event ReferralCodeAdded(string indexed code, address indexed referrer);\n event WithdrawalDispersed(address indexed);\n modifier onlyControllerOrOwner() {\n require(\n controllers[msg.sender] || msg.sender == owner(),\n \"Not a controller or owner\"\n );\n _;\n }\n\n function addController(address controller) external onlyOwner {\n require(controller != address(0), \"Invalid controller address\");\n controllers[controller] = true;\n }\n\n function settlementRegister(\n string memory referree,\n string memory name,\n address owner,\n uint256 amount,\n address receiver\n ) external payable onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n\n require(\n receiver != address(0) && receiver != owner,\n \"Invalid receiver address\"\n );\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n bool contains;\n for (uint256 i = 0; i < referrals[receiver].length; i++) {\n if (referrals[receiver][i] == keccak256(bytes(name))) {\n contains = true;\n break;\n }\n }\n if (contains == false) {\n referrals[receiver].push(keccak256(bytes(name)));\n referredBy[keccak256(bytes(name))] = referree;\n _applyNativeReward(receiver, amount, false);\n } else {\n _applyNativeReward(receiver, amount, false);\n }\n } else {\n payable(Ownable.owner()).transfer(amount);\n }\n }\n\n function settlementRegisterWithCard(\n string memory referree,\n string memory name,\n address owner,\n uint256 amount,\n address receiver\n ) external onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n require(\n receiver != address(0) && receiver != owner,\n \"Invalid receiver address\"\n );\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n bool contains;\n for (uint256 i = 0; i < referrals[receiver].length; i++) {\n if (referrals[receiver][i] == keccak256(bytes(name))) {\n contains = true;\n }\n }\n if (contains == false) {\n referrals[receiver].push(keccak256(bytes(name)));\n referredBy[keccak256(bytes(name))] = referree;\n _applyNativeReward(receiver, amount, true);\n } else {\n _applyNativeReward(receiver, amount, true);\n }\n }\n }\n\n /// @notice Only your controller or admin should be able to call this!\n function setReferree(\n bytes32 code,\n address who,\n uint256 duration\n ) external onlyControllerOrOwner {\n require(code != bytes32(0), \"Invalid referral code\");\n require(who != address(0), \"Invalid referree address\");\n require(\n referrees[code] == address(0),\n \"Referral code already registered\"\n );\n address prevReferree = referrees[code];\n if (prevReferree != address(0)) {\n referrals[prevReferree] = new bytes32[](0);\n }\n referrees[code] = who;\n referralCodes.push(code);\n expirydates[code] = duration;\n }\n\n function settlementCard(\n uint256 amount,\n address receiver,\n string memory referree\n ) external onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n require(receiver != address(0), \"Invalid receiver address\");\n _applyNativeReward(receiver, amount, true);\n }\n }\n\n function settlement(\n uint256 amount,\n address receiver,\n string memory referree\n ) external payable onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n require(receiver != address(0), \"Invalid receiver address\");\n _applyNativeReward(receiver, amount, false);\n } else {\n payable(Ownable.owner()).transfer(amount);\n }\n }\n\n function settlementWithToken(\n uint256 amount,\n address receiver,\n address tokenAddress,\n string memory referree\n ) external onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n require(receiver != address(0), \"Invalid receiver address\");\n _applyTokenReward(receiver, tokenAddress, amount);\n } else {\n IERC20(tokenAddress).safeTransfer(Ownable.owner(), amount);\n }\n }\n\n function settlementRegisterWithToken(\n string memory referree,\n string memory name,\n address owner,\n uint256 amount,\n address tokenAddress\n ) external onlyControllerOrOwner {\n // If the referree is already registered, we can use it\n // Implement token settlement logic here if needed\n if (expirydates[keccak256(bytes(referree))] > block.timestamp) {\n address receiver = referrees[keccak256(bytes(referree))];\n if (receiver != address(0) && receiver != owner) {\n bool contains;\n for (uint256 i = 0; i < referrals[receiver].length; i++) {\n if (referrals[receiver][i] == keccak256(bytes(name))) {\n contains = true;\n }\n }\n if (contains == false) {\n referrals[receiver].push(keccak256(bytes(name)));\n referredBy[keccak256(bytes(name))] = referree;\n _applyTokenReward(receiver, tokenAddress, amount);\n } else {\n _applyTokenReward(receiver, tokenAddress, amount);\n }\n }\n } else {\n // If the referree is not registered, we can transfer the amount to the owner\n IERC20(tokenAddress).safeTransfer(Ownable.owner(), amount);\n }\n }\n\n function withdrawAllNativeEarnings(uint256 batch) external onlyOwner {\n for (uint256 i = 0; i < batch; ) {\n bytes32 code = referralCodes[batch];\n if (block.timestamp < expirydates[code]) {\n address referrer = referrees[code];\n uint256 earnings = nativeEarnings[referrer];\n if (earnings > 0) {\n (bool ok, ) = payable(referrer).call{value: earnings}(\"\");\n require(ok, \"Payment failed\");\n nativeEarnings[referrer] = 0;\n }\n }\n unchecked {\n ++i;\n }\n }\n // Transfer any remaining balance to the owner\n uint256 remainingBalance = address(this).balance;\n if (remainingBalance > 0) {\n payable(owner()).transfer(remainingBalance);\n }\n // Emit an event for the withdrawal\n emit WithdrawalDispersed(msg.sender);\n }\n\n function withdrawAllTokenEarnings(\n address[] memory tokenAddresses,\n uint256 batch\n ) external onlyOwner {\n uint256 tokenLength = tokenAddresses.length;\n for (uint256 j = 0; j < tokenLength; ) {\n address tokenAddress = tokenAddresses[j];\n for (uint256 i = 0; i < batch; ) {\n bytes32 code = referralCodes[i];\n if (block.timestamp < expirydates[code]) {\n address referrer = referrees[code];\n uint256 earnings = tokenEarnings[referrer][tokenAddress];\n require(earnings > 0, \"No earnings to withdraw\");\n if (earnings > 0) {\n // Assuming the token follows ERC20 standard\n IERC20(tokenAddress).safeTransfer(referrer, earnings);\n tokenEarnings[referrer][tokenAddress] = 0;\n }\n }\n unchecked {\n ++i;\n }\n }\n unchecked {\n ++j;\n }\n }\n }\n\n function totalReferrals(address referrer) external view returns (uint256) {\n return referrals[referrer].length;\n }\n\n function totalNativeEarnings(\n address referrer\n ) external view returns (uint256) {\n return nativeEarnings[referrer];\n }\n\n function totalTokenEarnings(\n address referrer,\n address tokenAddress\n ) external view returns (uint256) {\n return tokenEarnings[referrer][tokenAddress];\n }\n\n function getCodes() external view returns (uint256) {\n return referralCodes.length;\n }\n function updateReferralCode(\n bytes32 code,\n uint256 newExpiry\n ) external onlyControllerOrOwner {\n require(expirydates[code] > 0, \"Referral code does not exist\");\n expirydates[code] = newExpiry;\n }\n\n function _rewardPct(uint256 numReferrals) public pure returns (uint256) {\n if (numReferrals >= TIER3) return PCT3;\n if (numReferrals >= TIER2) return PCT2;\n if (numReferrals >= TIER1) return PCT1;\n return 0; // No reward for less than TIER1 referrals\n }\n\n function _applyNativeReward(\n address receiver,\n uint256 amount,\n bool isFiat\n ) private {\n nativeEarnings[receiver] +=\n (amount * _rewardPct(referrals[receiver].length)) /\n 100;\n if (isFiat) {\n untrackedEarnings +=\n (amount * _rewardPct(referrals[receiver].length)) /\n 100;\n }\n }\n\n function _applyTokenReward(\n address receiver,\n address token,\n uint256 amount\n ) private {\n tokenEarnings[receiver][token] +=\n (amount * _rewardPct(referrals[receiver].length)) /\n 100;\n }\n\n function balance() public view returns (uint256) {\n return address(this).balance;\n }\n\n function tokenBalance(\n address tokenAddress\n ) public view returns (uint256) {\n return IERC20(tokenAddress).balanceOf(address(this));\n }\n\n function getUntracked() public view returns (uint256) {\n return untrackedEarnings;\n }\n\n function createSnapshot(\n address[] memory tokenAddresses\n ) external onlyOwner {\n snapshotUntrackedEarnings = untrackedEarnings;\n for (uint256 i = 0; i < referralCodes.length; i++) {\n bytes32 code = referralCodes[i];\n address referrer = referrees[code];\n snapshotNativeEarnings[referrer] = nativeEarnings[referrer];\n }\n for (uint256 j = 0; j < tokenAddresses.length; j++) {\n address tokenAddress = tokenAddresses[j];\n for (uint256 i = 0; i < referralCodes.length; i++) {\n bytes32 code = referralCodes[i];\n address referrer = referrees[code];\n snapshotTokenEarnings[referrer][tokenAddress] = tokenEarnings[\n referrer\n ][tokenAddress];\n }\n }\n }\n\n function getSnapshotEarnings() public view returns (uint256) {\n return snapshotUntrackedEarnings;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"../utils/StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\";\n\n\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n AggregatorV3Interface internal usdOracle;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorV3Interface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration,\n bool lifetime\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5 && lifetime) {\n basePrice = price5Letter * 31536000 * 4;\n } else if (len == 4 && lifetime) {\n basePrice = price4Letter * 31536000 * 4;\n } else if (len == 3 && lifetime) {\n basePrice = price3Letter * 31536000 * 6;\n } else if (len == 2 && lifetime) {\n basePrice = price2Letter * 31536000 * 10;\n } else if (len == 1 && lifetime) {\n basePrice = price1Letter * 31536000;\n } else if (len >= 5 && lifetime == false) { \n basePrice = price5Letter * duration;\n } else if (len == 4 && lifetime == false) {\n basePrice = price4Letter * duration;\n } else if (len == 3 && lifetime == false) {\n basePrice = price3Letter * duration;\n } else if (len == 2 && lifetime == false) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n (, int256 ethPrice,,,) = usdOracle.latestRoundData();\n return (amount * 1e8) / uint256(ethPrice);\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n (, int256 ethPrice,,,) = usdOracle.latestRoundData();\n return (amount * uint256(ethPrice)) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration,\n lifetime\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n function rentPriceToken(\n string[] calldata names,\n uint256 duration,\n string memory token,\n bool lifetime\n ) external view returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPriceToken(\n names[i],\n duration,\n token,\n lifetime\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration,\n lifetime\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration, lifetime);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n function renewAllWithToken(\n string[] calldata names,\n uint256 duration,\n string memory token,\n address tokenAddress,\n bool lifetime\n ) external payable {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPriceToken(\n names[i],\n duration,\n token,\n lifetime\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renewTokens(names[i], duration, token, tokenAddress, lifetime);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/TokenPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ExponentialPremiumPriceOracle.sol\";\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\";\n\ncontract TokenPriceOracle is ExponentialPremiumPriceOracle {\n AggregatorV3Interface internal cakeOracle;\n AggregatorV3Interface internal usd1Oracle;\n using StringUtils for *;\n constructor(\n AggregatorV3Interface _usdOracle,\n AggregatorV3Interface _cakeOracle,\n AggregatorV3Interface _usd1Oracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n )ExponentialPremiumPriceOracle(_usdOracle, _rentPrices, _startPremium, totalDays) {\n usd1Oracle = _usd1Oracle;\n cakeOracle = _cakeOracle;\n }\n\n\n function priceToken(\n string calldata name,\n uint256 expires,\n uint256 duration,\n string memory token,\n bool lifetime\n ) external view returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5 && lifetime) {\n basePrice = price5Letter * 31536000 * 4;\n } else if (len == 4 && lifetime) {\n basePrice = price4Letter * 31536000 * 4;\n } else if (len == 3 && lifetime) {\n basePrice = price3Letter * 31536000 * 6;\n } else if (len == 2 && lifetime) {\n basePrice = price2Letter * 31536000 * 10;\n } else if (len == 1 && lifetime) {\n basePrice = price1Letter * 31536000;\n } else if (len >= 5 && lifetime == false) { \n basePrice = price5Letter * duration;\n } else if (len == 4 && lifetime == false) {\n basePrice = price4Letter * duration;\n } else if (len == 3 && lifetime == false) {\n basePrice = price3Letter * duration;\n } else if (len == 2 && lifetime == false) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n if(keccak256(bytes(token)) == keccak256(bytes(\"cake\"))){\n return\n IPriceOracle.Price({\n base: attoUSDToCake(basePrice),\n premium: attoUSDToCake(_premium(name, expires, duration))\n });\n } else {\n return\n IPriceOracle.Price({\n base: attoUSDToUSD1(basePrice),\n premium: attoUSDToCake(_premium(name, expires, duration))\n });\n }\n \n }\n function attoUSDToCake(uint256 amount) internal view returns (uint256) {\n (, int256 cakePrice,,,) = cakeOracle.latestRoundData();\n return (amount * 1e8) / uint256(cakePrice);\n }\n function attoUSDToUSD1(uint256 amount) internal view returns (uint256) {\n (, int256 usd1Price,,,) = usd1Oracle.latestRoundData();\n return (amount * 1e8) / uint256(usd1Price);\n }\n function attoCakeToUSD(uint256 amount) internal view returns (uint256) {\n (, int256 cakePrice,,,) = cakeOracle.latestRoundData();\n return (amount * uint256(cakePrice)) / 1e8;\n }\n function attoUSD1ToUSD(uint256 amount) internal view returns (uint256) {\n (, int256 usd1Price,,,) = usd1Oracle.latestRoundData();\n return (amount * uint256(usd1Price)) / 1e8;\n }\n\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n\n /**\n * @dev Escapes special characters in a given string\n *\n * @param str The string to escape\n * @return The escaped string\n */\n function escape(string memory str) internal pure returns (string memory) {\n bytes memory strBytes = bytes(str);\n uint extraChars = 0;\n\n // count extra space needed for escaping\n for (uint i = 0; i < strBytes.length; i++) {\n if (_needsEscaping(strBytes[i])) {\n extraChars++;\n }\n }\n\n // allocate buffer with the exact size needed\n bytes memory buffer = new bytes(strBytes.length + extraChars);\n uint index = 0;\n\n // escape characters\n for (uint i = 0; i < strBytes.length; i++) {\n if (_needsEscaping(strBytes[i])) {\n buffer[index++] = \"\\\\\";\n buffer[index++] = _getEscapedChar(strBytes[i]);\n } else {\n buffer[index++] = strBytes[i];\n }\n }\n\n return string(buffer);\n }\n\n // determine if a character needs escaping\n function _needsEscaping(bytes1 char) private pure returns (bool) {\n return\n char == '\"' ||\n char == \"/\" ||\n char == \"\\\\\" ||\n char == \"\\n\" ||\n char == \"\\r\" ||\n char == \"\\t\";\n }\n\n // get the escaped character\n function _getEscapedChar(bytes1 char) private pure returns (bytes1) {\n if (char == \"\\n\") return \"n\";\n if (char == \"\\r\") return \"r\";\n if (char == \"\\t\") return \"t\";\n return char;\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_CRE8OR = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/deployments/testnet/solcInputs/dcc6184d14b5e21d84340667ccb71894.json b/solidity/dns-contracts/deployments/testnet/solcInputs/dcc6184d14b5e21d84340667ccb71894.json new file mode 100644 index 0000000..af0365e --- /dev/null +++ b/solidity/dns-contracts/deployments/testnet/solcInputs/dcc6184d14b5e21d84340667ccb71894.json @@ -0,0 +1,188 @@ +{ + "language": "Solidity", + "sources": { + "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n// solhint-disable-next-line interface-starts-with-i\ninterface AggregatorV3Interface {\n function decimals() external view returns (uint8);\n\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n\n function getRoundData(\n uint80 _roundId\n ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n\n function latestRoundData()\n external\n view\n returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(\n address[] calldata accounts,\n uint256[] calldata ids\n ) external view returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(address from, address to, uint256 tokenId) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(address from, address to, uint256 tokenId) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "contracts/ethregistrar/BaseRegistrarImplementation.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {\n // A map of expiry times\n mapping(uint256 => uint256) expiries;\n // The ENS registry\n ENS public ens;\n // The namehash of the TLD this registrar owns (eg, .eth)\n bytes32 public baseNode;\n // A map of addresses that are authorised to register and renew names.\n mapping(address => bool) public controllers;\n uint256 public constant GRACE_PERIOD = 90 days;\n uint256 public constant LIFETIME = type(uint256).max;\n bytes4 private constant INTERFACE_META_ID =\n bytes4(keccak256(\"supportsInterface(bytes4)\"));\n bytes4 private constant ERC721_ID =\n bytes4(\n keccak256(\"balanceOf(address)\") ^\n keccak256(\"ownerOf(uint256)\") ^\n keccak256(\"approve(address,uint256)\") ^\n keccak256(\"getApproved(uint256)\") ^\n keccak256(\"setApprovalForAll(address,bool)\") ^\n keccak256(\"isApprovedForAll(address,address)\") ^\n keccak256(\"transferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256)\") ^\n keccak256(\"safeTransferFrom(address,address,uint256,bytes)\")\n );\n bytes4 private constant RECLAIM_ID =\n bytes4(keccak256(\"reclaim(uint256,address)\"));\n\n /// v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into consideration instead of ERC721.ownerOf(tokenId);\n /// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.1.3/contracts/token/ERC721/ERC721.sol#L187\n /// @dev Returns whether the given spender can transfer a given token ID\n /// @param spender address of the spender to query\n /// @param tokenId uint256 ID of the token to be transferred\n /// @return bool whether the msg.sender is approved for the given token ID,\n /// is an operator of the owner, or is the owner of the token\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view override returns (bool) {\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n constructor(ENS _ens, bytes32 _baseNode) ERC721(\"\", \"\") {\n ens = _ens;\n baseNode = _baseNode;\n Ownable(msg.sender);\n }\n\n modifier live() {\n require(ens.owner(baseNode) == address(this));\n _;\n }\n\n modifier onlyController() {\n require(controllers[msg.sender]);\n _;\n }\n\n /// @dev Gets the owner of the specified token ID. Names become unowned\n /// when their registration expires.\n /// @param tokenId uint256 ID of the token to query the owner of\n /// @return address currently marked as the owner of the given token ID\n function ownerOf(\n uint256 tokenId\n ) public view override(IERC721, ERC721) returns (address) {\n require(expiries[tokenId] > block.timestamp);\n return super.ownerOf(tokenId);\n }\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external override onlyOwner {\n controllers[controller] = true;\n emit ControllerAdded(controller);\n }\n\n // Revoke controller permission for an address.\n function removeController(address controller) external override onlyOwner {\n controllers[controller] = false;\n emit ControllerRemoved(controller);\n }\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external override onlyOwner {\n ens.setResolver(baseNode, resolver);\n }\n\n // Returns the expiration timestamp of the specified id.\n function nameExpires(uint256 id) external view override returns (uint256) {\n return expiries[id];\n }\n\n // Returns true iff the specified name is available for registration.\n function available(uint256 id) public view override returns (bool) {\n // Not available if it's registered here or in its grace period.\n return expiries[id] + GRACE_PERIOD < block.timestamp;\n }\n\n /// @dev Register a name.\n /// @param id The token ID (keccak256 of the label).\n /// @param owner The address that should own the registration.\n /// @param duration Duration in seconds for the registration.\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external override virtual returns (uint256) {\n return _register(id, owner, duration, true);\n }\n\n /// @dev Register a name, without modifying the registry.\n /// @param id The token ID (keccak256 of the label).\n /// @param owner The address that should own the registration.\n /// @param duration Duration in seconds for the registration.\n function registerOnly(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256) {\n return _register(id, owner, duration, false);\n }\n\n function _register(\n uint256 id,\n address owner,\n uint256 duration,\n bool updateRegistry\n ) internal live onlyController returns (uint256) {\n require(available(id));\n require(\n block.timestamp + duration + GRACE_PERIOD >\n block.timestamp + GRACE_PERIOD\n ); // Prevent future overflow\n\n\n uint256 expiration;\n\n if (duration == 0) {\n // Lifetime registration\n expiration = LIFETIME;\n } else {\n // Annual registration\n expiration = block.timestamp + duration;\n }\n\n expiries[id] = expiration;\n if (_exists(id)) {\n // Name was previously owned, and expired\n _burn(id);\n }\n _mint(owner, id);\n if (updateRegistry) {\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n emit NameRegistered(id, owner, block.timestamp + duration);\n\n return block.timestamp + duration;\n }\n\n function renew(\n uint256 id,\n uint256 duration\n ) external override virtual live onlyController returns (uint256) {\n require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period\n require(expiries[id] != LIFETIME, \"Lifetime names cannot be renewed\");\n require(\n expiries[id] + duration + GRACE_PERIOD > duration + GRACE_PERIOD\n ); // Prevent future overflow\n\n expiries[id] += duration;\n emit NameRenewed(id, expiries[id]);\n return expiries[id];\n }\n\n /// @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n function reclaim(uint256 id, address owner) external override live {\n require(_isApprovedOrOwner(msg.sender, id));\n ens.setSubnodeOwner(baseNode, bytes32(id), owner);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view override(ERC721, IERC165) returns (bool) {\n return\n interfaceID == INTERFACE_META_ID ||\n interfaceID == ERC721_ID ||\n interfaceID == RECLAIM_ID;\n }\n\n function _exists(uint256 tokenId) internal view override returns (bool) {\n return super._exists(tokenId);\n }\n\n}\n" + }, + "contracts/ethregistrar/BulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"./ETHRegistrarController.sol\";\nimport \"./IETHRegistrarController.sol\";\nimport \"../resolvers/Resolver.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract BulkRenewal is IBulkRenewal {\n bytes32 private constant ETH_NAMEHASH =\n 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae;\n\n ENS public immutable ens;\n\n constructor(ENS _ens) {\n ens = _ens;\n }\n\n function getController() internal view returns (ETHRegistrarController) {\n Resolver r = Resolver(ens.resolver(ETH_NAMEHASH));\n return\n ETHRegistrarController(\n r.interfaceImplementer(\n ETH_NAMEHASH,\n type(IETHRegistrarController).interfaceId\n )\n );\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external view override returns (uint256 total) {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration,\n lifetime\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external payable override {\n ETHRegistrarController controller = getController();\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration,\n lifetime\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration, lifetime);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/ETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport {BaseRegistrarImplementation} from \"./BaseRegistrarImplementation.sol\";\nimport {StringUtils} from \"../utils/StringUtils.sol\";\nimport {Resolver} from \"../resolvers/Resolver.sol\";\nimport {ENS} from \"../registry/ENS.sol\";\nimport {ReverseRegistrar} from \"../reverseRegistrar/ReverseRegistrar.sol\";\nimport {ReverseClaimer} from \"../reverseRegistrar/ReverseClaimer.sol\";\nimport {IETHRegistrarController, IPriceOracle} from \"./IETHRegistrarController.sol\";\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {INameWrapper} from \"../wrapper/INameWrapper.sol\";\nimport {ERC20Recoverable} from \"../utils/ERC20Recoverable.sol\";\nimport {TokenPriceOracle} from \"./TokenPriceOracle.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nusing SafeERC20 for IERC20;\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nerror CommitmentTooNew(bytes32 commitment);\nerror CommitmentTooOld(bytes32 commitment);\nerror NameNotAvailable(string name);\nerror DurationTooShort(uint256 duration);\nerror ResolverRequiredWhenDataSupplied();\nerror UnexpiredCommitmentExists(bytes32 commitment);\nerror InsufficientValue();\nerror Unauthorised(bytes32 node);\nerror MaxCommitmentAgeTooLow();\nerror MaxCommitmentAgeTooHigh();\n\n/// @dev A registrar controller for registering and renewing names at fixed cost.\ncontract ETHRegistrarController is\n Ownable,\n IETHRegistrarController,\n IERC165,\n ERC20Recoverable,\n ReverseClaimer\n{\n using StringUtils for *;\n using Address for address;\n\n uint256 public constant MIN_REGISTRATION_DURATION = 28 days;\n bytes32 private constant ETH_NODE =\n 0x4f2c0fc83d175c423d55ddf2fef3b9b38af479fac3adb42afb02778397a27454;\n uint64 private constant MAX_EXPIRY = type(uint64).max;\n BaseRegistrarImplementation immutable base;\n TokenPriceOracle public immutable prices;\n uint256 public immutable minCommitmentAge;\n uint256 public immutable maxCommitmentAge;\n ReverseRegistrar public immutable reverseRegistrar;\n INameWrapper public immutable nameWrapper;\n\n mapping(bytes32 => uint256) public commitments;\n\n event NameRegistered(\n string name,\n bytes32 indexed label,\n address indexed owner,\n uint256 baseCost,\n uint256 premium,\n uint256 expires\n );\n event NameRenewed(\n string name,\n bytes32 indexed label,\n uint256 cost,\n uint256 expires\n );\n\n constructor(\n BaseRegistrarImplementation _base,\n TokenPriceOracle _prices,\n uint256 _minCommitmentAge,\n uint256 _maxCommitmentAge,\n ReverseRegistrar _reverseRegistrar,\n INameWrapper _nameWrapper,\n ENS _ens\n ) ReverseClaimer(_ens, msg.sender) {\n if (_maxCommitmentAge <= _minCommitmentAge) {\n revert MaxCommitmentAgeTooLow();\n }\n\n if (_maxCommitmentAge > block.timestamp) {\n revert MaxCommitmentAgeTooHigh();\n }\n\n base = _base;\n prices = _prices;\n minCommitmentAge = _minCommitmentAge;\n maxCommitmentAge = _maxCommitmentAge;\n reverseRegistrar = _reverseRegistrar;\n nameWrapper = _nameWrapper;\n }\n\n function rentPrice(\n string memory name,\n uint256 duration,\n bool lifetime\n ) public view virtual override returns (IPriceOracle.Price memory price) {\n require(\n duration == 0 || duration >= MIN_REGISTRATION_DURATION,\n \"Invalid duration\"\n );\n bytes32 label = keccak256(bytes(name));\n price = prices.price(name, base.nameExpires(uint256(label)), duration, lifetime);\n }\n\n function rentPriceToken(\n string memory name,\n uint256 duration,\n string memory token,\n bool lifetime\n ) public view virtual override returns (IPriceOracle.Price memory price) {\n require(\n duration == 0 || duration >= MIN_REGISTRATION_DURATION,\n \"Invalid duration\"\n );\n bytes32 label = keccak256(bytes(name));\n price = prices.priceToken(\n name,\n base.nameExpires(uint256(label)),\n duration,\n token,\n lifetime\n );\n }\n\n function valid(string memory name) public pure returns (bool) {\n return name.strlen() >= 3;\n }\n\n function available(string memory name) public view override returns (bool) {\n bytes32 label = keccak256(bytes(name));\n return valid(name) && base.available(uint256(label));\n }\n\n function makeCommitment(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] memory data,\n bool reverseRecord,\n uint16 ownerControlledFuses,\n bool lifetime\n ) public pure override returns (bytes32) {\n bytes32 label = keccak256(bytes(name));\n if (data.length > 0 && resolver == address(0)) {\n revert ResolverRequiredWhenDataSupplied();\n }\n return\n keccak256(\n abi.encode(\n label,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses,\n lifetime\n )\n );\n }\n\n function commit(bytes32 commitment) public override {\n if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {\n revert UnexpiredCommitmentExists(commitment);\n }\n commitments[commitment] = block.timestamp;\n }\n\n function register(\n string calldata name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] calldata data,\n bool reverseRecord,\n uint16 ownerControlledFuses,\n bool lifetime\n ) public payable override {\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\n if (msg.value < price.base + price.premium) {\n revert InsufficientValue();\n }\n\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses,\n lifetime\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n\n if (msg.value > (price.base + price.premium)) {\n payable(msg.sender).transfer(\n msg.value - (price.base + price.premium)\n );\n }\n }\n\n function registerWithToken(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] memory data,\n bool reverseRecord,\n uint16 ownerControlledFuses,\n string memory token,\n address tokenAddress,\n bool lifetime\n ) public override {\n IPriceOracle.Price memory price = rentPriceToken(name, duration, token, lifetime);\n require(\n IERC20(tokenAddress).allowance(msg.sender, address(this)) >=\n price.base + price.premium,\n \"Insufficient ERC20 allowance\"\n );\n\n if (\n IERC20(tokenAddress).balanceOf(msg.sender) <\n price.base + price.premium\n ) {\n revert InsufficientValue();\n }\n IERC20(tokenAddress).safeTransferFrom(\n msg.sender,\n address(this),\n price.base + price.premium\n );\n _consumeCommitment(\n name,\n duration,\n makeCommitment(\n name,\n owner,\n duration,\n secret,\n resolver,\n data,\n reverseRecord,\n ownerControlledFuses,\n lifetime\n )\n );\n\n uint256 expires = nameWrapper.registerAndWrapETH2LD(\n name,\n owner,\n duration,\n resolver,\n ownerControlledFuses\n );\n\n if (data.length > 0) {\n _setRecords(resolver, keccak256(bytes(name)), data);\n }\n\n if (reverseRecord) {\n _setReverseRecord(name, resolver, msg.sender);\n }\n\n emit NameRegistered(\n name,\n keccak256(bytes(name)),\n owner,\n price.base,\n price.premium,\n expires\n );\n }\n function renew(\n string calldata name,\n uint256 duration,\n bool lifetime\n ) external payable override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPrice(name, duration, lifetime);\n if (msg.value < price.base) {\n revert InsufficientValue();\n }\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n if (msg.value > price.base) {\n payable(msg.sender).transfer(msg.value - price.base);\n }\n\n emit NameRenewed(name, labelhash, msg.value, expires);\n }\n\n function renewTokens(\n string calldata name,\n uint256 duration,\n string memory token,\n address tokenAddress,\n bool lifetime\n ) external override {\n bytes32 labelhash = keccak256(bytes(name));\n uint256 tokenId = uint256(labelhash);\n IPriceOracle.Price memory price = rentPriceToken(name, duration, token, lifetime);\n if (\n IERC20(tokenAddress).balanceOf(msg.sender) <\n price.base + price.premium\n ) {\n revert InsufficientValue();\n }\n IERC20(tokenAddress).safeTransferFrom(\n msg.sender,\n address(this),\n price.base + price.premium\n );\n uint256 expires = nameWrapper.renew(tokenId, duration);\n\n emit NameRenewed(name, labelhash, price.base + price.premium, expires);\n }\n\n function withdraw() public {\n payable(owner()).transfer(address(this).balance);\n }\n function withdrawTokens(address tokenAddress) public {\n IERC20(tokenAddress).safeTransfer(\n owner(),\n IERC20(tokenAddress).balanceOf(address(this))\n );\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IETHRegistrarController).interfaceId;\n }\n\n /* Internal functions */\n\n function _consumeCommitment(\n string memory name,\n uint256 duration,\n bytes32 commitment\n ) internal {\n // Require an old enough commitment.\n if (commitments[commitment] + minCommitmentAge > block.timestamp) {\n revert CommitmentTooNew(commitment);\n }\n\n // If the commitment is too old, or the name is registered, stop\n if (commitments[commitment] + maxCommitmentAge <= block.timestamp) {\n revert CommitmentTooOld(commitment);\n }\n if (!available(name)) {\n revert NameNotAvailable(name);\n }\n\n delete (commitments[commitment]);\n\n if (duration != 0 && duration < MIN_REGISTRATION_DURATION) {\n revert DurationTooShort(duration);\n }\n }\n\n function _setRecords(\n address resolverAddress,\n bytes32 label,\n bytes[] memory data\n ) internal {\n // use hardcoded .eth namehash\n bytes32 nodehash = keccak256(abi.encodePacked(ETH_NODE, label));\n Resolver resolver = Resolver(resolverAddress);\n resolver.multicallWithNodeCheck(nodehash, data);\n }\n\n function _setReverseRecord(\n string memory name,\n address resolver,\n address owner\n ) internal {\n reverseRegistrar.setNameForAddr(\n msg.sender,\n owner,\n resolver,\n string.concat(name, \".creator\")\n );\n }\n}\n" + }, + "contracts/ethregistrar/ExponentialPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./StablePriceOracle.sol\";\n\ncontract ExponentialPremiumPriceOracle is StablePriceOracle {\n uint256 constant GRACE_PERIOD = 90 days;\n uint256 immutable startPremium;\n uint256 immutable endValue;\n\n constructor(\n AggregatorV3Interface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n ) StablePriceOracle(_usdOracle, _rentPrices) {\n startPremium = _startPremium;\n endValue = _startPremium >> totalDays;\n }\n\n uint256 constant PRECISION = 1e18;\n uint256 constant bit1 = 999989423469314432; // 0.5 ^ 1/65536 * (10 ** 18)\n uint256 constant bit2 = 999978847050491904; // 0.5 ^ 2/65536 * (10 ** 18)\n uint256 constant bit3 = 999957694548431104;\n uint256 constant bit4 = 999915390886613504;\n uint256 constant bit5 = 999830788931929088;\n uint256 constant bit6 = 999661606496243712;\n uint256 constant bit7 = 999323327502650752;\n uint256 constant bit8 = 998647112890970240;\n uint256 constant bit9 = 997296056085470080;\n uint256 constant bit10 = 994599423483633152;\n uint256 constant bit11 = 989228013193975424;\n uint256 constant bit12 = 978572062087700096;\n uint256 constant bit13 = 957603280698573696;\n uint256 constant bit14 = 917004043204671232;\n uint256 constant bit15 = 840896415253714560;\n uint256 constant bit16 = 707106781186547584;\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory,\n uint256 expires,\n uint256\n ) internal view override returns (uint256) {\n expires = expires + GRACE_PERIOD;\n if (expires > block.timestamp) {\n return 0;\n }\n\n uint256 elapsed = block.timestamp - expires;\n uint256 premium = decayedPremium(startPremium, elapsed);\n if (premium >= endValue) {\n return premium - endValue;\n }\n return 0;\n }\n\n /**\n * @dev Returns the premium price at current time elapsed\n * @param startPremium starting price\n * @param elapsed time past since expiry\n */\n function decayedPremium(\n uint256 startPremium,\n uint256 elapsed\n ) public pure returns (uint256) {\n uint256 daysPast = (elapsed * PRECISION) / 1 days;\n uint256 intDays = daysPast / PRECISION;\n uint256 premium = startPremium >> intDays;\n uint256 partDay = (daysPast - intDays * PRECISION);\n uint256 fraction = (partDay * (2 ** 16)) / PRECISION;\n uint256 totalPremium = addFractionalPremium(fraction, premium);\n return totalPremium;\n }\n\n function addFractionalPremium(\n uint256 fraction,\n uint256 premium\n ) internal pure returns (uint256) {\n if (fraction & (1 << 0) != 0) {\n premium = (premium * bit1) / PRECISION;\n }\n if (fraction & (1 << 1) != 0) {\n premium = (premium * bit2) / PRECISION;\n }\n if (fraction & (1 << 2) != 0) {\n premium = (premium * bit3) / PRECISION;\n }\n if (fraction & (1 << 3) != 0) {\n premium = (premium * bit4) / PRECISION;\n }\n if (fraction & (1 << 4) != 0) {\n premium = (premium * bit5) / PRECISION;\n }\n if (fraction & (1 << 5) != 0) {\n premium = (premium * bit6) / PRECISION;\n }\n if (fraction & (1 << 6) != 0) {\n premium = (premium * bit7) / PRECISION;\n }\n if (fraction & (1 << 7) != 0) {\n premium = (premium * bit8) / PRECISION;\n }\n if (fraction & (1 << 8) != 0) {\n premium = (premium * bit9) / PRECISION;\n }\n if (fraction & (1 << 9) != 0) {\n premium = (premium * bit10) / PRECISION;\n }\n if (fraction & (1 << 10) != 0) {\n premium = (premium * bit11) / PRECISION;\n }\n if (fraction & (1 << 11) != 0) {\n premium = (premium * bit12) / PRECISION;\n }\n if (fraction & (1 << 12) != 0) {\n premium = (premium * bit13) / PRECISION;\n }\n if (fraction & (1 << 13) != 0) {\n premium = (premium * bit14) / PRECISION;\n }\n if (fraction & (1 << 14) != 0) {\n premium = (premium * bit15) / PRECISION;\n }\n if (fraction & (1 << 15) != 0) {\n premium = (premium * bit16) / PRECISION;\n }\n return premium;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/IBaseRegistrar.sol": { + "content": "import \"../registry/ENS.sol\";\nimport \"./IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\ninterface IBaseRegistrar is IERC721 {\n event ControllerAdded(address indexed controller);\n event ControllerRemoved(address indexed controller);\n event NameMigrated(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRegistered(\n uint256 indexed id,\n address indexed owner,\n uint256 expires\n );\n event NameRenewed(uint256 indexed id, uint256 expires);\n\n // Authorises a controller, who can register and renew domains.\n function addController(address controller) external;\n\n // Revoke controller permission for an address.\n function removeController(address controller) external;\n\n // Set the resolver for the TLD this registrar manages.\n function setResolver(address resolver) external;\n\n // Returns the expiration timestamp of the specified label hash.\n function nameExpires(uint256 id) external view returns (uint256);\n\n // Returns true if the specified name is available for registration.\n function available(uint256 id) external view returns (bool);\n\n /**\n * @dev Register a name.\n */\n function register(\n uint256 id,\n address owner,\n uint256 duration\n ) external returns (uint256);\n\n function renew(uint256 id, uint256 duration) external returns (uint256);\n\n /**\n * @dev Reclaim ownership of a name in ENS, if you own it in the registrar.\n */\n function reclaim(uint256 id, address owner) external;\n}\n" + }, + "contracts/ethregistrar/IBulkRenewal.sol": { + "content": "interface IBulkRenewal {\n function rentPrice(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external view returns (uint256 total);\n\n function renewAll(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external payable;\n}\n" + }, + "contracts/ethregistrar/IETHRegistrarController.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\n\ninterface IETHRegistrarController {\n function rentPrice(\n string memory,\n uint256,\n bool\n ) external view returns (IPriceOracle.Price memory);\n\n function rentPriceToken(\n string memory name,\n uint256 duration,\n string memory token,\n bool lifetime\n ) external view returns (IPriceOracle.Price memory price);\n\n function available(string memory) external returns (bool);\n\n function makeCommitment(\n string memory,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16,\n bool\n ) external pure returns (bytes32);\n\n function commit(bytes32) external;\n\n function register(\n string calldata,\n address,\n uint256,\n bytes32,\n address,\n bytes[] calldata,\n bool,\n uint16,\n bool\n ) external payable;\n\n function registerWithToken(\n string memory name,\n address owner,\n uint256 duration,\n bytes32 secret,\n address resolver,\n bytes[] memory data,\n bool reverseRecord,\n uint16 ownerControlledFuses,\n string memory token,\n address tokenAddress,\n bool lifetime\n ) external;\n\n function renew(string calldata, uint256, bool) external payable;\n\n function renewTokens(\n string calldata name,\n uint256 duration,\n string memory token,\n address tokenAddress,\n bool lifetime\n ) external;\n}\n" + }, + "contracts/ethregistrar/IPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\ninterface IPriceOracle {\n struct Price {\n uint256 base;\n uint256 premium;\n }\n\n /**\n * @dev Returns the price to register or renew a name.\n * @param name The name being registered or renewed.\n * @param expires When the name presently expires (0 if this is a new registration).\n * @param duration How long the name is being registered or extended for, in seconds.\n * @return base premium tuple of base price + premium price\n */\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration,\n bool lifetime\n ) external view returns (Price calldata);\n}\n" + }, + "contracts/ethregistrar/LinearPremiumPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./SafeMath.sol\";\nimport \"./StablePriceOracle.sol\";\n\ncontract LinearPremiumPriceOracle is StablePriceOracle {\n using SafeMath for *;\n\n uint256 immutable GRACE_PERIOD = 90 days;\n\n uint256 public immutable initialPremium;\n uint256 public immutable premiumDecreaseRate;\n\n bytes4 private constant TIME_UNTIL_PREMIUM_ID =\n bytes4(keccak256(\"timeUntilPremium(uint,uint\"));\n\n constructor(\n AggregatorV3Interface _usdOracle,\n uint256[] memory _rentPrices,\n uint256 _initialPremium,\n uint256 _premiumDecreaseRate\n ) public StablePriceOracle(_usdOracle, _rentPrices) {\n initialPremium = _initialPremium;\n premiumDecreaseRate = _premiumDecreaseRate;\n }\n\n function _premium(\n string memory name,\n uint256 expires,\n uint256 /*duration*/\n ) internal view override returns (uint256) {\n expires = expires.add(GRACE_PERIOD);\n if (expires > block.timestamp) {\n // No premium for renewals\n return 0;\n }\n\n // Calculate the discount off the maximum premium\n uint256 discount = premiumDecreaseRate.mul(\n block.timestamp.sub(expires)\n );\n\n // If we've run out the premium period, return 0.\n if (discount > initialPremium) {\n return 0;\n }\n\n return initialPremium - discount;\n }\n\n /**\n * @dev Returns the timestamp at which a name with the specified expiry date will have\n * the specified re-registration price premium.\n * @param expires The timestamp at which the name expires.\n * @param amount The amount, in wei, the caller is willing to pay\n * @return The timestamp at which the premium for this domain will be `amount`.\n */\n function timeUntilPremium(\n uint256 expires,\n uint256 amount\n ) external view returns (uint256) {\n amount = weiToAttoUSD(amount);\n require(amount <= initialPremium);\n\n expires = expires.add(GRACE_PERIOD);\n\n uint256 discount = initialPremium.sub(amount);\n uint256 duration = discount.div(premiumDecreaseRate);\n return expires.add(duration);\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual override returns (bool) {\n return\n (interfaceID == TIME_UNTIL_PREMIUM_ID) ||\n super.supportsInterface(interfaceID);\n }\n}\n" + }, + "contracts/ethregistrar/SafeMath.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\n/**\n * @title SafeMath\n * @dev Unsigned math operations with safety checks that revert on error\n */\nlibrary SafeMath {\n /**\n * @dev Multiplies two unsigned integers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // Solidity only automatically asserts when dividing by 0\n require(b > 0);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two unsigned integers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),\n * reverts when dividing by zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b != 0);\n return a % b;\n }\n}\n" + }, + "contracts/ethregistrar/StablePriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./IPriceOracle.sol\";\nimport \"../utils/StringUtils.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\";\n\n\n\n// StablePriceOracle sets a price in USD, based on an oracle.\ncontract StablePriceOracle is IPriceOracle {\n using StringUtils for *;\n AggregatorV3Interface internal usdOracle;\n\n // Rent in base price units by length\n uint256 public immutable price1Letter;\n uint256 public immutable price2Letter;\n uint256 public immutable price3Letter;\n uint256 public immutable price4Letter;\n uint256 public immutable price5Letter;\n\n // Oracle address\n\n event RentPriceChanged(uint256[] prices);\n\n constructor(AggregatorV3Interface _usdOracle, uint256[] memory _rentPrices) {\n usdOracle = _usdOracle;\n price1Letter = _rentPrices[0];\n price2Letter = _rentPrices[1];\n price3Letter = _rentPrices[2];\n price4Letter = _rentPrices[3];\n price5Letter = _rentPrices[4];\n }\n\n function price(\n string calldata name,\n uint256 expires,\n uint256 duration,\n bool lifetime\n ) external view override returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5 && lifetime) {\n basePrice = price5Letter * 31536000 * 4;\n } else if (len == 4 && lifetime) {\n basePrice = price4Letter * 31536000 * 4;\n } else if (len == 3 && lifetime) {\n basePrice = price3Letter * 31536000 * 6;\n } else if (len == 2 && lifetime) {\n basePrice = price2Letter * 31536000 * 10;\n } else if (len == 1 && lifetime) {\n basePrice = price1Letter * 31536000;\n } else if (len >= 5 && lifetime == false) { \n basePrice = price5Letter * duration;\n } else if (len == 4 && lifetime == false) {\n basePrice = price4Letter * duration;\n } else if (len == 3 && lifetime == false) {\n basePrice = price3Letter * duration;\n } else if (len == 2 && lifetime == false) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n return\n IPriceOracle.Price({\n base: attoUSDToWei(basePrice),\n premium: attoUSDToWei(_premium(name, expires, duration))\n });\n }\n\n /**\n * @dev Returns the pricing premium in wei.\n */\n function premium(\n string calldata name,\n uint256 expires,\n uint256 duration\n ) external view returns (uint256) {\n return attoUSDToWei(_premium(name, expires, duration));\n }\n\n /**\n * @dev Returns the pricing premium in internal base units.\n */\n function _premium(\n string memory name,\n uint256 expires,\n uint256 duration\n ) internal view virtual returns (uint256) {\n return 0;\n }\n\n function attoUSDToWei(uint256 amount) internal view returns (uint256) {\n (, int256 ethPrice,,,) = usdOracle.latestRoundData();\n return (amount * 1e8) / uint256(ethPrice);\n }\n\n function weiToAttoUSD(uint256 amount) internal view returns (uint256) {\n (, int256 ethPrice,,,) = usdOracle.latestRoundData();\n return (amount * uint256(ethPrice)) / 1e8;\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) public view virtual returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IPriceOracle).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/StaticBulkRenewal.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ETHRegistrarController.sol\";\nimport \"./IBulkRenewal.sol\";\nimport \"./IPriceOracle.sol\";\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ncontract StaticBulkRenewal is IBulkRenewal {\n ETHRegistrarController controller;\n\n constructor(ETHRegistrarController _controller) {\n controller = _controller;\n }\n\n function rentPrice(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external view override returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration,\n lifetime\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n function rentPriceToken(\n string[] calldata names,\n uint256 duration,\n string memory token,\n bool lifetime\n ) external view returns (uint256 total) {\n uint256 length = names.length;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPriceToken(\n names[i],\n duration,\n token,\n lifetime\n );\n unchecked {\n ++i;\n total += (price.base + price.premium);\n }\n }\n }\n\n function renewAll(\n string[] calldata names,\n uint256 duration,\n bool lifetime\n ) external payable override {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPrice(\n names[i],\n duration,\n lifetime\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renew{value: totalPrice}(names[i], duration, lifetime);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n // Send any excess funds back\n payable(msg.sender).transfer(address(this).balance);\n }\n function renewAllWithToken(\n string[] calldata names,\n uint256 duration,\n string memory token,\n address tokenAddress,\n bool lifetime\n ) external payable {\n uint256 length = names.length;\n uint256 total;\n for (uint256 i = 0; i < length; ) {\n IPriceOracle.Price memory price = controller.rentPriceToken(\n names[i],\n duration,\n token,\n lifetime\n );\n uint256 totalPrice = price.base + price.premium;\n controller.renewTokens(names[i], duration, token, tokenAddress, lifetime);\n unchecked {\n ++i;\n total += totalPrice;\n }\n }\n }\n\n function supportsInterface(\n bytes4 interfaceID\n ) external pure returns (bool) {\n return\n interfaceID == type(IERC165).interfaceId ||\n interfaceID == type(IBulkRenewal).interfaceId;\n }\n}\n" + }, + "contracts/ethregistrar/TokenPriceOracle.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"./ExponentialPremiumPriceOracle.sol\";\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\";\n\ncontract TokenPriceOracle is ExponentialPremiumPriceOracle {\n AggregatorV3Interface internal cakeOracle;\n AggregatorV3Interface internal usd1Oracle;\n using StringUtils for *;\n constructor(\n AggregatorV3Interface _usdOracle,\n AggregatorV3Interface _cakeOracle,\n AggregatorV3Interface _usd1Oracle,\n uint256[] memory _rentPrices,\n uint256 _startPremium,\n uint256 totalDays\n )ExponentialPremiumPriceOracle(_usdOracle, _rentPrices, _startPremium, totalDays) {\n usd1Oracle = _usd1Oracle;\n cakeOracle = _cakeOracle;\n }\n\n\n function priceToken(\n string calldata name,\n uint256 expires,\n uint256 duration,\n string memory token,\n bool lifetime\n ) external view returns (IPriceOracle.Price memory) {\n uint256 len = name.strlen();\n uint256 basePrice;\n\n if (len >= 5 && lifetime) {\n basePrice = price5Letter * 31536000 * 4;\n } else if (len == 4 && lifetime) {\n basePrice = price4Letter * 31536000 * 4;\n } else if (len == 3 && lifetime) {\n basePrice = price3Letter * 31536000 * 6;\n } else if (len == 2 && lifetime) {\n basePrice = price2Letter * 31536000 * 10;\n } else if (len == 1 && lifetime) {\n basePrice = price1Letter * 31536000;\n } else if (len >= 5 && lifetime == false) { \n basePrice = price5Letter * duration;\n } else if (len == 4 && lifetime == false) {\n basePrice = price4Letter * duration;\n } else if (len == 3 && lifetime == false) {\n basePrice = price3Letter * duration;\n } else if (len == 2 && lifetime == false) {\n basePrice = price2Letter * duration;\n } else {\n basePrice = price1Letter * duration;\n }\n if(keccak256(bytes(token)) == keccak256(bytes(\"cake\"))){\n return\n IPriceOracle.Price({\n base: attoUSDToCake(basePrice),\n premium: attoUSDToCake(_premium(name, expires, duration))\n });\n } else {\n return\n IPriceOracle.Price({\n base: attoUSDToUSD1(basePrice),\n premium: attoUSDToCake(_premium(name, expires, duration))\n });\n }\n \n }\n function attoUSDToCake(uint256 amount) internal view returns (uint256) {\n (, int256 cakePrice,,,) = cakeOracle.latestRoundData();\n return (amount * 1e8) / uint256(cakePrice);\n }\n function attoUSDToUSD1(uint256 amount) internal view returns (uint256) {\n (, int256 usd1Price,,,) = usd1Oracle.latestRoundData();\n return (amount * 1e8) / uint256(usd1Price);\n }\n function attoCakeToUSD(uint256 amount) internal view returns (uint256) {\n (, int256 cakePrice,,,) = cakeOracle.latestRoundData();\n return (amount * uint256(cakePrice)) / 1e8;\n }\n function attoUSD1ToUSD(uint256 amount) internal view returns (uint256) {\n (, int256 usd1Price,,,) = usd1Oracle.latestRoundData();\n return (amount * uint256(usd1Price)) / 1e8;\n }\n\n}\n" + }, + "contracts/registry/ENS.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ENS {\n // Logged when the owner of a node assigns a new owner to a subnode.\n event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);\n\n // Logged when the owner of a node transfers ownership to a new account.\n event Transfer(bytes32 indexed node, address owner);\n\n // Logged when the resolver for a node changes.\n event NewResolver(bytes32 indexed node, address resolver);\n\n // Logged when the TTL of a node changes\n event NewTTL(bytes32 indexed node, uint64 ttl);\n\n // Logged when an operator is added or removed.\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n bytes32 label,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n bytes32 label,\n address owner\n ) external returns (bytes32);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setOwner(bytes32 node, address owner) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function setApprovalForAll(address operator, bool approved) external;\n\n function owner(bytes32 node) external view returns (address);\n\n function resolver(bytes32 node) external view returns (address);\n\n function ttl(bytes32 node) external view returns (uint64);\n\n function recordExists(bytes32 node) external view returns (bool);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n}\n" + }, + "contracts/resolvers/profiles/IABIResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IABIResolver {\n event ABIChanged(bytes32 indexed node, uint256 indexed contentType);\n\n /**\n * Returns the ABI associated with an ENS node.\n * Defined in EIP205.\n * @param node The ENS node to query\n * @param contentTypes A bitwise OR of the ABI formats accepted by the caller.\n * @return contentType The content type of the return value\n * @return data The ABI data\n */\n function ABI(\n bytes32 node,\n uint256 contentTypes\n ) external view returns (uint256, bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the new (multicoin) addr function.\n */\ninterface IAddressResolver {\n event AddressChanged(\n bytes32 indexed node,\n uint256 coinType,\n bytes newAddress\n );\n\n function addr(\n bytes32 node,\n uint256 coinType\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IAddrResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * Interface for the legacy (ETH-only) addr function.\n */\ninterface IAddrResolver {\n event AddrChanged(bytes32 indexed node, address a);\n\n /**\n * Returns the address associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated address.\n */\n function addr(bytes32 node) external view returns (address payable);\n}\n" + }, + "contracts/resolvers/profiles/IContentHashResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IContentHashResolver {\n event ContenthashChanged(bytes32 indexed node, bytes hash);\n\n /**\n * Returns the contenthash associated with an ENS node.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function contenthash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSRecordResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSRecordResolver {\n // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated.\n event DNSRecordChanged(\n bytes32 indexed node,\n bytes name,\n uint16 resource,\n bytes record\n );\n // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted.\n event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);\n\n /**\n * Obtain a DNS record.\n * @param node the namehash of the node for which to fetch the record\n * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record\n * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types\n * @return the DNS record in wire format if present, otherwise empty\n */\n function dnsRecord(\n bytes32 node,\n bytes32 name,\n uint16 resource\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IDNSZoneResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IDNSZoneResolver {\n // DNSZonehashChanged is emitted whenever a given node's zone hash is updated.\n event DNSZonehashChanged(\n bytes32 indexed node,\n bytes lastzonehash,\n bytes zonehash\n );\n\n /**\n * zonehash obtains the hash for the zone.\n * @param node The ENS node to query.\n * @return The associated contenthash.\n */\n function zonehash(bytes32 node) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IExtendedResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IExtendedResolver {\n function resolve(\n bytes memory name,\n bytes memory data\n ) external view returns (bytes memory);\n}\n" + }, + "contracts/resolvers/profiles/IInterfaceResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IInterfaceResolver {\n event InterfaceChanged(\n bytes32 indexed node,\n bytes4 indexed interfaceID,\n address implementer\n );\n\n /**\n * Returns the address of a contract that implements the specified interface for this name.\n * If an implementer has not been set for this interfaceID and name, the resolver will query\n * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that\n * contract implements EIP165 and returns `true` for the specified interfaceID, its address\n * will be returned.\n * @param node The ENS node to query.\n * @param interfaceID The EIP 165 interface ID to check for.\n * @return The address that implements this interface, or 0 if the interface is unsupported.\n */\n function interfaceImplementer(\n bytes32 node,\n bytes4 interfaceID\n ) external view returns (address);\n}\n" + }, + "contracts/resolvers/profiles/INameResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface INameResolver {\n event NameChanged(bytes32 indexed node, string name);\n\n /**\n * Returns the name associated with an ENS node, for reverse records.\n * Defined in EIP181.\n * @param node The ENS node to query.\n * @return The associated name.\n */\n function name(bytes32 node) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/profiles/IPubkeyResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface IPubkeyResolver {\n event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);\n\n /**\n * Returns the SECP256k1 public key associated with an ENS node.\n * Defined in EIP 619.\n * @param node The ENS node to query\n * @return x The X coordinate of the curve point for the public key.\n * @return y The Y coordinate of the curve point for the public key.\n */\n function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y);\n}\n" + }, + "contracts/resolvers/profiles/ITextResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\ninterface ITextResolver {\n event TextChanged(\n bytes32 indexed node,\n string indexed indexedKey,\n string key,\n string value\n );\n\n /**\n * Returns the text data associated with an ENS node and key.\n * @param node The ENS node to query.\n * @param key The text data key to query.\n * @return The associated text data.\n */\n function text(\n bytes32 node,\n string calldata key\n ) external view returns (string memory);\n}\n" + }, + "contracts/resolvers/Resolver.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"./profiles/IABIResolver.sol\";\nimport \"./profiles/IAddressResolver.sol\";\nimport \"./profiles/IAddrResolver.sol\";\nimport \"./profiles/IContentHashResolver.sol\";\nimport \"./profiles/IDNSRecordResolver.sol\";\nimport \"./profiles/IDNSZoneResolver.sol\";\nimport \"./profiles/IInterfaceResolver.sol\";\nimport \"./profiles/INameResolver.sol\";\nimport \"./profiles/IPubkeyResolver.sol\";\nimport \"./profiles/ITextResolver.sol\";\nimport \"./profiles/IExtendedResolver.sol\";\n\n/**\n * A generic resolver interface which includes all the functions including the ones deprecated\n */\ninterface Resolver is\n IERC165,\n IABIResolver,\n IAddressResolver,\n IAddrResolver,\n IContentHashResolver,\n IDNSRecordResolver,\n IDNSZoneResolver,\n IInterfaceResolver,\n INameResolver,\n IPubkeyResolver,\n ITextResolver,\n IExtendedResolver\n{\n /* Deprecated events */\n event ContentChanged(bytes32 indexed node, bytes32 hash);\n\n function setApprovalForAll(address, bool) external;\n\n function approve(bytes32 node, address delegate, bool approved) external;\n\n function isApprovedForAll(address account, address operator) external;\n\n function isApprovedFor(\n address owner,\n bytes32 node,\n address delegate\n ) external;\n\n function setABI(\n bytes32 node,\n uint256 contentType,\n bytes calldata data\n ) external;\n\n function setAddr(bytes32 node, address addr) external;\n\n function setAddr(bytes32 node, uint256 coinType, bytes calldata a) external;\n\n function setContenthash(bytes32 node, bytes calldata hash) external;\n\n function setDnsrr(bytes32 node, bytes calldata data) external;\n\n function setName(bytes32 node, string calldata _name) external;\n\n function setPubkey(bytes32 node, bytes32 x, bytes32 y) external;\n\n function setText(\n bytes32 node,\n string calldata key,\n string calldata value\n ) external;\n\n function setInterface(\n bytes32 node,\n bytes4 interfaceID,\n address implementer\n ) external;\n\n function multicall(\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n function multicallWithNodeCheck(\n bytes32 nodehash,\n bytes[] calldata data\n ) external returns (bytes[] memory results);\n\n /* Deprecated functions */\n function content(bytes32 node) external view returns (bytes32);\n\n function multihash(bytes32 node) external view returns (bytes memory);\n\n function setContent(bytes32 node, bytes32 hash) external;\n\n function setMultihash(bytes32 node, bytes calldata hash) external;\n}\n" + }, + "contracts/reverseRegistrar/IReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}\n" + }, + "contracts/reverseRegistrar/ReverseClaimer.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport {ENS} from \"../registry/ENS.sol\";\nimport {IReverseRegistrar} from \"../reverseRegistrar/IReverseRegistrar.sol\";\n\ncontract ReverseClaimer {\n bytes32 constant ADDR_REVERSE_NODE =\n 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n constructor(ENS ens, address claimant) {\n IReverseRegistrar reverseRegistrar = IReverseRegistrar(\n ens.owner(ADDR_REVERSE_NODE)\n );\n reverseRegistrar.claim(claimant);\n }\n}\n" + }, + "contracts/reverseRegistrar/ReverseRegistrar.sol": { + "content": "pragma solidity >=0.8.4;\n\nimport \"../registry/ENS.sol\";\nimport \"./IReverseRegistrar.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../root/Controllable.sol\";\n\nabstract contract NameResolver {\n function setName(bytes32 node, string memory name) public virtual;\n}\n\nbytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;\n\nbytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;\n\n// namehash('addr.reverse')\n\ncontract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar {\n ENS public immutable ens;\n NameResolver public defaultResolver;\n\n event ReverseClaimed(address indexed addr, bytes32 indexed node);\n event DefaultResolverChanged(NameResolver indexed resolver);\n\n /**\n * @dev Constructor\n * @param ensAddr The address of the ENS registry.\n */\n constructor(ENS ensAddr) {\n ens = ensAddr;\n\n // Assign ownership of the reverse record to our deployer\n ReverseRegistrar oldRegistrar = ReverseRegistrar(\n ensAddr.owner(ADDR_REVERSE_NODE)\n );\n if (address(oldRegistrar) != address(0x0)) {\n oldRegistrar.claim(msg.sender);\n }\n }\n\n modifier authorised(address addr) {\n require(\n addr == msg.sender ||\n controllers[msg.sender] ||\n ens.isApprovedForAll(addr, msg.sender) ||\n ownsContract(addr),\n \"ReverseRegistrar: Caller is not a controller or authorised by address or the address itself\"\n );\n _;\n }\n\n function setDefaultResolver(address resolver) public override onlyOwner {\n require(\n address(resolver) != address(0),\n \"ReverseRegistrar: Resolver address must not be 0\"\n );\n defaultResolver = NameResolver(resolver);\n emit DefaultResolverChanged(NameResolver(resolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @return The ENS node hash of the reverse record.\n */\n function claim(address owner) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, address(defaultResolver));\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param addr The reverse record to set\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The resolver of the reverse node\n * @return The ENS node hash of the reverse record.\n */\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) public override authorised(addr) returns (bytes32) {\n bytes32 labelHash = sha3HexAddress(addr);\n bytes32 reverseNode = keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, labelHash)\n );\n emit ReverseClaimed(addr, reverseNode);\n ens.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0);\n return reverseNode;\n }\n\n /**\n * @dev Transfers ownership of the reverse ENS record associated with the\n * calling account.\n * @param owner The address to set as the owner of the reverse record in ENS.\n * @param resolver The address of the resolver to set; 0 to leave unchanged.\n * @return The ENS node hash of the reverse record.\n */\n function claimWithResolver(\n address owner,\n address resolver\n ) public override returns (bytes32) {\n return claimForAddr(msg.sender, owner, resolver);\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the calling account. First updates the resolver to the default reverse\n * resolver if necessary.\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setName(string memory name) public override returns (bytes32) {\n return\n setNameForAddr(\n msg.sender,\n msg.sender,\n address(defaultResolver),\n name\n );\n }\n\n /**\n * @dev Sets the `name()` record for the reverse ENS record associated with\n * the account provided. Updates the resolver to a designated resolver\n * Only callable by controllers and authorised users\n * @param addr The reverse record to set\n * @param owner The owner of the reverse node\n * @param resolver The resolver of the reverse node\n * @param name The name to set for this address.\n * @return The ENS node hash of the reverse record.\n */\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) public override returns (bytes32) {\n bytes32 node = claimForAddr(addr, owner, resolver);\n NameResolver(resolver).setName(node, name);\n return node;\n }\n\n /**\n * @dev Returns the node hash for a given account's reverse records.\n * @param addr The address to hash\n * @return The ENS node hash.\n */\n function node(address addr) public pure override returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr))\n );\n }\n\n /**\n * @dev An optimised function to compute the sha3 of the lower-case\n * hexadecimal representation of an Ethereum address.\n * @param addr The address to hash\n * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the\n * input address.\n */\n function sha3HexAddress(address addr) private pure returns (bytes32 ret) {\n assembly {\n for {\n let i := 40\n } gt(i, 0) {\n\n } {\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n i := sub(i, 1)\n mstore8(i, byte(and(addr, 0xf), lookup))\n addr := div(addr, 0x10)\n }\n\n ret := keccak256(0, 40)\n }\n }\n\n function ownsContract(address addr) internal view returns (bool) {\n try Ownable(addr).owner() returns (address owner) {\n return owner == msg.sender;\n } catch {\n return false;\n }\n }\n}\n" + }, + "contracts/root/Controllable.sol": { + "content": "pragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Controllable is Ownable {\n mapping(address => bool) public controllers;\n\n event ControllerChanged(address indexed controller, bool enabled);\n\n modifier onlyController() {\n require(\n controllers[msg.sender],\n \"Controllable: Caller is not a controller\"\n );\n _;\n }\n\n function setController(address controller, bool enabled) public onlyOwner {\n controllers[controller] = enabled;\n emit ControllerChanged(controller, enabled);\n }\n}\n" + }, + "contracts/utils/ERC20Recoverable.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.17 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n @notice Contract is used to recover ERC20 tokens sent to the contract by mistake.\n */\n\ncontract ERC20Recoverable is Ownable {\n /**\n @notice Recover ERC20 tokens sent to the contract by mistake.\n @dev The contract is Ownable and only the owner can call the recover function.\n @param _to The address to send the tokens to.\n@param _token The address of the ERC20 token to recover\n @param _amount The amount of tokens to recover.\n */\n function recoverFunds(\n address _token,\n address _to,\n uint256 _amount\n ) external onlyOwner {\n IERC20(_token).transfer(_to, _amount);\n }\n}\n" + }, + "contracts/utils/StringUtils.sol": { + "content": "pragma solidity >=0.8.4;\n\nlibrary StringUtils {\n /**\n * @dev Returns the length of a given string\n *\n * @param s The string to measure the length of\n * @return The length of the input string\n */\n function strlen(string memory s) internal pure returns (uint256) {\n uint256 len;\n uint256 i = 0;\n uint256 bytelength = bytes(s).length;\n for (len = 0; i < bytelength; len++) {\n bytes1 b = bytes(s)[i];\n if (b < 0x80) {\n i += 1;\n } else if (b < 0xE0) {\n i += 2;\n } else if (b < 0xF0) {\n i += 3;\n } else if (b < 0xF8) {\n i += 4;\n } else if (b < 0xFC) {\n i += 5;\n } else {\n i += 6;\n }\n }\n return len;\n }\n\n /**\n * @dev Escapes special characters in a given string\n *\n * @param str The string to escape\n * @return The escaped string\n */\n function escape(string memory str) internal pure returns (string memory) {\n bytes memory strBytes = bytes(str);\n uint extraChars = 0;\n\n // count extra space needed for escaping\n for (uint i = 0; i < strBytes.length; i++) {\n if (_needsEscaping(strBytes[i])) {\n extraChars++;\n }\n }\n\n // allocate buffer with the exact size needed\n bytes memory buffer = new bytes(strBytes.length + extraChars);\n uint index = 0;\n\n // escape characters\n for (uint i = 0; i < strBytes.length; i++) {\n if (_needsEscaping(strBytes[i])) {\n buffer[index++] = \"\\\\\";\n buffer[index++] = _getEscapedChar(strBytes[i]);\n } else {\n buffer[index++] = strBytes[i];\n }\n }\n\n return string(buffer);\n }\n\n // determine if a character needs escaping\n function _needsEscaping(bytes1 char) private pure returns (bool) {\n return\n char == '\"' ||\n char == \"/\" ||\n char == \"\\\\\" ||\n char == \"\\n\" ||\n char == \"\\r\" ||\n char == \"\\t\";\n }\n\n // get the escaped character\n function _getEscapedChar(bytes1 char) private pure returns (bytes1) {\n if (char == \"\\n\") return \"n\";\n if (char == \"\\r\") return \"r\";\n if (char == \"\\t\") return \"t\";\n return char;\n }\n}\n" + }, + "contracts/wrapper/IMetadataService.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface IMetadataService {\n function uri(uint256) external view returns (string memory);\n}\n" + }, + "contracts/wrapper/INameWrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\nimport \"../registry/ENS.sol\";\nimport \"../ethregistrar/IBaseRegistrar.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"./IMetadataService.sol\";\nimport \"./INameWrapperUpgrade.sol\";\n\nuint32 constant CANNOT_UNWRAP = 1;\nuint32 constant CANNOT_BURN_FUSES = 2;\nuint32 constant CANNOT_TRANSFER = 4;\nuint32 constant CANNOT_SET_RESOLVER = 8;\nuint32 constant CANNOT_SET_TTL = 16;\nuint32 constant CANNOT_CREATE_SUBDOMAIN = 32;\nuint32 constant CANNOT_APPROVE = 64;\n//uint16 reserved for parent controlled fuses from bit 17 to bit 32\nuint32 constant PARENT_CANNOT_CONTROL = 1 << 16;\nuint32 constant IS_DOT_CRE8OR = 1 << 17;\nuint32 constant CAN_EXTEND_EXPIRY = 1 << 18;\nuint32 constant CAN_DO_EVERYTHING = 0;\nuint32 constant PARENT_CONTROLLED_FUSES = 0xFFFF0000;\n// all fuses apart from IS_DOT_ETH\nuint32 constant USER_SETTABLE_FUSES = 0xFFFDFFFF;\n\ninterface INameWrapper is IERC1155 {\n event NameWrapped(\n bytes32 indexed node,\n bytes name,\n address owner,\n uint32 fuses,\n uint64 expiry\n );\n\n event NameUnwrapped(bytes32 indexed node, address owner);\n\n event FusesSet(bytes32 indexed node, uint32 fuses);\n event ExpiryExtended(bytes32 indexed node, uint64 expiry);\n\n function ens() external view returns (ENS);\n\n function registrar() external view returns (IBaseRegistrar);\n\n function metadataService() external view returns (IMetadataService);\n\n function names(bytes32) external view returns (bytes memory);\n\n function name() external view returns (string memory);\n\n function upgradeContract() external view returns (INameWrapperUpgrade);\n\n function supportsInterface(bytes4 interfaceID) external view returns (bool);\n\n function wrap(\n bytes calldata name,\n address wrappedOwner,\n address resolver\n ) external;\n\n function wrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint16 ownerControlledFuses,\n address resolver\n ) external returns (uint64 expires);\n\n function registerAndWrapETH2LD(\n string calldata label,\n address wrappedOwner,\n uint256 duration,\n address resolver,\n uint16 ownerControlledFuses\n ) external returns (uint256 registrarExpiry);\n\n function renew(\n uint256 labelHash,\n uint256 duration\n ) external returns (uint256 expires);\n\n function unwrap(bytes32 node, bytes32 label, address owner) external;\n\n function unwrapETH2LD(\n bytes32 label,\n address newRegistrant,\n address newController\n ) external;\n\n function upgrade(bytes calldata name, bytes calldata extraData) external;\n\n function setFuses(\n bytes32 node,\n uint16 ownerControlledFuses\n ) external returns (uint32 newFuses);\n\n function setChildFuses(\n bytes32 parentNode,\n bytes32 labelhash,\n uint32 fuses,\n uint64 expiry\n ) external;\n\n function setSubnodeRecord(\n bytes32 node,\n string calldata label,\n address owner,\n address resolver,\n uint64 ttl,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function setRecord(\n bytes32 node,\n address owner,\n address resolver,\n uint64 ttl\n ) external;\n\n function setSubnodeOwner(\n bytes32 node,\n string calldata label,\n address newOwner,\n uint32 fuses,\n uint64 expiry\n ) external returns (bytes32);\n\n function extendExpiry(\n bytes32 node,\n bytes32 labelhash,\n uint64 expiry\n ) external returns (uint64);\n\n function canModifyName(\n bytes32 node,\n address addr\n ) external view returns (bool);\n\n function setResolver(bytes32 node, address resolver) external;\n\n function setTTL(bytes32 node, uint64 ttl) external;\n\n function ownerOf(uint256 id) external view returns (address owner);\n\n function approve(address to, uint256 tokenId) external;\n\n function getApproved(uint256 tokenId) external view returns (address);\n\n function getData(\n uint256 id\n ) external view returns (address, uint32, uint64);\n\n function setMetadataService(IMetadataService _metadataService) external;\n\n function uri(uint256 tokenId) external view returns (string memory);\n\n function setUpgradeContract(INameWrapperUpgrade _upgradeAddress) external;\n\n function allFusesBurned(\n bytes32 node,\n uint32 fuseMask\n ) external view returns (bool);\n\n function isWrapped(bytes32) external view returns (bool);\n\n function isWrapped(bytes32, bytes32) external view returns (bool);\n}\n" + }, + "contracts/wrapper/INameWrapperUpgrade.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity ~0.8.17;\n\ninterface INameWrapperUpgrade {\n function wrapFromUpgrade(\n bytes calldata name,\n address wrappedOwner,\n uint32 fuses,\n uint64 expiry,\n address approved,\n bytes calldata extraData\n ) external;\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/solidity/dns-contracts/hardhat.config.cts b/solidity/dns-contracts/hardhat.config.cts new file mode 100644 index 0000000..d7461e3 --- /dev/null +++ b/solidity/dns-contracts/hardhat.config.cts @@ -0,0 +1,188 @@ +// from @nomicfoundation/hardhat-toolbox-viem to avoid module issue +import '@nomicfoundation/hardhat-ignition-viem' +import '@nomicfoundation/hardhat-verify' +import '@nomicfoundation/hardhat-viem' +import 'hardhat-gas-reporter' +import 'solidity-coverage' +import './tasks/hardhat-deploy-viem.cjs' + +import dotenv from 'dotenv' +import 'hardhat-abi-exporter' +import 'hardhat-contract-sizer' +import 'hardhat-deploy' +import '@nomicfoundation/hardhat-ethers' +import { HardhatUserConfig } from 'hardhat/config' + +import('@ensdomains/hardhat-chai-matchers-viem') + +// hardhat actions +import './tasks/esm_fix.cjs' + +// Load environment variables from .env file. Suppress warnings using silent +// if this file is missing. dotenv will never modify any environment variables +// that have already been set. +// https://github.com/motdotla/dotenv +dotenv.config({ debug: false }) + +let real_accounts = undefined +if (process.env.DEPLOYER_KEY) { + real_accounts = [ + process.env.DEPLOYER_KEY, + process.env.OWNER_KEY || process.env.DEPLOYER_KEY, + ] +} + +// circular dependency shared with actions +export const archivedDeploymentPath = './deployments/archive' + +const config = { + networks: { + hardhat: { + saveDeployments: false, + tags: ['test', 'legacy', 'use_root'], + allowUnlimitedContractSize: true, + }, + level3chain: { + chainId: 7777771, + url: 'http://localhost:8545', // or your DigitalOcean-hosted endpoint + accounts: real_accounts, + }, + localhost: { + url: 'http://127.0.0.1:8545/', + tags: ['test', 'legacy', 'use_root'], + }, + rinkeby: { + url: `https://rinkeby.infura.io/v3/${process.env.INFURA_API_KEY}`, + tags: ['test', 'legacy', 'use_root'], + chainId: 4, + accounts: real_accounts, + }, + ropsten: { + url: `https://ropsten.infura.io/v3/${process.env.INFURA_API_KEY}`, + tags: ['test', 'legacy', 'use_root'], + chainId: 3, + accounts: real_accounts, + }, + goerli: { + url: `https://goerli.infura.io/v3/${process.env.INFURA_API_KEY}`, + tags: ['test', 'legacy', 'use_root'], + chainId: 5, + accounts: real_accounts, + }, + sepolia: { + url: `https://sepolia.infura.io/v3/${process.env.INFURA_API_KEY}`, + tags: ['test', 'legacy', 'use_root'], + chainId: 11155111, + accounts: real_accounts, + }, + testnet: { + url: `https://bsc-testnet-rpc.publicnode.com`, + tags: ['test', 'legacy', 'use_root'], + chainId: 97, + accounts: real_accounts, + }, + mainnet: { + url: `https://bsc-dataseed1.binance.org/`, + tags: ['legacy', 'use_root'], + chainId: 56, + accounts: real_accounts, + }, + neondevnet: { + url: 'https://devnet.neonevm.org', + accounts: real_accounts, + chainId: 245022926, + allowUnlimitedContractSize: false, + tags: ['test', 'legacy', 'use_root'], + gas: 30000000, + }, + neonmainnet: { + url: 'https://neon-proxy-mainnet.solana.p2p.org', + accounts: real_accounts, + chainId: 245022934, + allowUnlimitedContractSize: false, + }, + }, + mocha: {}, + solidity: { + compilers: [ + { + version: '0.8.17', + settings: { + optimizer: { + enabled: true, + runs: 1200, + }, + }, + }, + // for DummyOldResolver contract + { + version: '0.4.11', + settings: { + viaIR: true, + optimizer: { + enabled: true, + runs: 1200, + }, + }, + }, + { + version: '0.7.6', + settings: { + viaIR: true, + optimizer: { + enabled: true, + runs: 1200, + }, + }, + }, + ], + overrides: { + 'node_modules/@uniswap/v3-periphery/**': { version: '0.7.6' }, + 'contracts/ethregistrar/ETHRegistrarController.sol': { + version: '0.8.17', + settings: { + optimizer: { + enabled: true, + runs: 1200, + }, + }, + }, + }, + }, + abiExporter: { + path: './build/contracts', + runOnCompile: true, + clear: true, + flat: true, + except: [ + 'Controllable$', + 'INameWrapper$', + 'SHA1$', + 'Ownable$', + 'NameResolver$', + 'TestBytesUtils$', + 'legacy/*', + ], + spacing: 2, + pretty: true, + }, + namedAccounts: { + deployer: { + default: 0, + }, + owner: { + default: 1, + 56: '0x04A1ceEBdEB45E055772e1cbAd48bb738E7414Fa', + 97: '0x2A0D7311fA7e9aC2890CFd8219b2dEf0c206E79B', + }, + }, + external: { + contracts: [ + { + artifacts: [archivedDeploymentPath], + }, + ], + }, +} satisfies HardhatUserConfig + +export default config; diff --git a/solidity/dns-contracts/index.js b/solidity/dns-contracts/index.js new file mode 100644 index 0000000..24dd3f1 --- /dev/null +++ b/solidity/dns-contracts/index.js @@ -0,0 +1,56 @@ +const BaseRegistrarImplementation = require('./build/contracts/BaseRegistrarImplementation') +const BulkRenewal = require('./build/contracts/BulkRenewal') +const ENS = require('./build/contracts/ENS') +const ENSRegistry = require('./build/contracts/ENSRegistry') +const ENSRegistryWithFallback = require('./build/contracts/ENSRegistryWithFallback') +const ExponentialPremiumPriceOracle = require('./build/contracts/ExponentialPremiumPriceOracle') +const ETHRegistrarController = require('./build/contracts/ETHRegistrarController') +const FIFSRegistrar = require('./build/contracts/FIFSRegistrar') +const IBaseRegistrar = require('./build/contracts/IBaseRegistrar') +const IPriceOracle = require('./build/contracts/IPriceOracle') +const LinearPremiumPriceOracle = require('./build/contracts/LinearPremiumPriceOracle') +const PublicResolver = require('./build/contracts/PublicResolver') +const Resolver = require('./build/contracts/Resolver') +const ReverseRegistrar = require('./build/contracts/ReverseRegistrar') +const TestRegistrar = require('./build/contracts/TestRegistrar') +const StablePriceOracle = require('./build/contracts/StablePriceOracle') +const DNSRegistrar = require('./build/contracts/DNSRegistrar') +const PublicSuffixList = require('./build/contracts/PublicSuffixList') +const SimplePublicSuffixList = require('./build/contracts/SimplePublicSuffixList') +const TLDPublicSuffixList = require('./build/contracts/TLDPublicSuffixList') + +const Root = require('./build/contracts/Root') +const DNSSEC = require('./build/contracts/DNSSEC') +const RSASHA256Algorithm = require('./build/contracts/RSASHA256Algorithm') +const RSASHA1Algorithm = require('./build/contracts/RSASHA1Algorithm') +const SHA256Digest = require('./build/contracts/SHA256Digest') +const SHA1Digest = require('./build/contracts/SHA1Digest') + +module.exports = { + BaseRegistrarImplementation, + BulkRenewal, + ENS, + ENSRegistry, + ENSRegistryWithFallback, + ExponentialPremiumPriceOracle, + ETHRegistrarController, + FIFSRegistrar, + IBaseRegistrar, + IPriceOracle, + LinearPremiumPriceOracle, + PublicResolver, + Resolver, + ReverseRegistrar, + StablePriceOracle, + TestRegistrar, + DNSRegistrar, + PublicSuffixList, + SimplePublicSuffixList, + TLDPublicSuffixList, + Root, + DNSSEC, + RSASHA256Algorithm, + RSASHA1Algorithm, + SHA256Digest, + SHA1Digest, +} diff --git a/solidity/dns-contracts/package.json b/solidity/dns-contracts/package.json new file mode 100644 index 0000000..891e8a3 --- /dev/null +++ b/solidity/dns-contracts/package.json @@ -0,0 +1,77 @@ +{ + "name": "@ensdomains/ens-contracts", + "version": "1.2.5", + "description": "ENS contracts", + "scripts": { + "compile": "NODE_OPTIONS=\"--experimental-loader ts-node/esm/transpile-only\" hardhat compile", + "test": "NODE_OPTIONS=\"--experimental-loader ts-node/esm/transpile-only\" hardhat test", + "test:parallel": "NODE_OPTIONS=\"--experimental-loader ts-node/esm/transpile-only\" hardhat test ./test/**/Test*.ts --parallel", + "test:local": "hardhat --network localhost test", + "test:deploy": "bun ./scripts/deploy-test.ts", + "lint": "hardhat check", + "build": "rm -rf ./build/deploy ./build/hardhat.config.js && hardhat compile && tsc", + "format": "prettier --write .", + "prepublishOnly": "bun run build", + "pub": "npm publish --access public", + "wikiCheck": "bun ./scripts/wikiCheck.ts", + "smoke:viem": "hardhat run scripts/ens_test.ts --network testnet" + }, + "files": [ + "build", + "contracts/**/*.sol", + "artifacts", + "deployments" + ], + "main": "index.js", + "devDependencies": { + "@ensdomains/dnsprovejs": "^0.5.1", + "@ensdomains/hardhat-chai-matchers-viem": "^0.0.8", + "@nomicfoundation/hardhat-toolbox-viem": "^3.0.0", + "@types/mocha": "^9.1.1", + "@types/node": "^18.0.0", + "@viem/anvil": "^0.0.10", + "@vitest/expect": "^1.6.0", + "abitype": "^1.0.2", + "chai": "^5.1.1", + "dotenv": "^16.4.5", + "hardhat": "^2.22.2", + "hardhat-abi-exporter": "^2.9.0", + "hardhat-contract-sizer": "^2.6.1", + "hardhat-deploy": "^0.12.4", + "hardhat-gas-reporter": "^1.0.4", + "husky": "^9.1.7", + "prettier": "^2.6.2", + "prettier-plugin-solidity": "^1.0.0-beta.24", + "ts-node": "^10.9.2", + "typescript": "^5.4.5", + "viem": "2.12.0" + }, + "dependencies": { + "@chainlink/contracts": "^1.3.0", + "@ensdomains/buffer": "^0.1.1", + "@ensdomains/solsha1": "0.0.3", + "@nomicfoundation/hardhat-ethers": "^3.0.8", + "@openzeppelin/contracts": "^4.1.0", + "@pancakeswap/pancake-swap-lib": "^0.0.4", + "@pancakeswap/v3-core": "^1.0.2", + "@pancakeswap/v3-periphery": "^1.0.2", + "@uniswap/v3-core": "^1.0.1", + "@uniswap/v3-periphery": "^1.2.0", + "dns-packet": "^5.3.0", + "ethers": "5.8.0", + "hardhat-ethers": "^1.0.1" + }, + "directories": { + "test": "test" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ensdomains/ens-contracts.git" + }, + "author": "", + "license": "MIT", + "bugs": { + "url": "https://github.com/ensdomains/ens-contracts/issues" + }, + "homepage": "https://github.com/ensdomains/ens-contracts#readme" +} diff --git a/solidity/dns-contracts/patches/hardhat-deploy+0.12.4.patch b/solidity/dns-contracts/patches/hardhat-deploy+0.12.4.patch new file mode 100644 index 0000000..10c4ece --- /dev/null +++ b/solidity/dns-contracts/patches/hardhat-deploy+0.12.4.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/hardhat-deploy/dist/src/DeploymentsManager.js b/node_modules/hardhat-deploy/dist/src/DeploymentsManager.js +index 9ff5b84..4cf3d26 100644 +--- a/node_modules/hardhat-deploy/dist/src/DeploymentsManager.js ++++ b/node_modules/hardhat-deploy/dist/src/DeploymentsManager.js +@@ -733,7 +733,7 @@ class DeploymentsManager { + // console.log("fetching " + scriptFilePath); + try { + delete require.cache[scriptFilePath]; // ensure we reload it every time, so changes are taken in consideration +- deployFunc = require(scriptFilePath); ++ deployFunc = await import(scriptFilePath); + if (deployFunc.default) { + deployFunc = deployFunc.default; + } diff --git a/solidity/dns-contracts/scripts/ens_test.ts b/solidity/dns-contracts/scripts/ens_test.ts new file mode 100644 index 0000000..fd0156a --- /dev/null +++ b/solidity/dns-contracts/scripts/ens_test.ts @@ -0,0 +1,139 @@ +// scripts/smokeTestTestnetViem.ts +import hre from 'hardhat' +import { + namehash, + bytesToHex, + zeroAddress, + hexToBytes, + keccak256, + toBytes, + encodeFunctionData, +} from 'viem' +import crypto from 'crypto' +import { createPublicClient, http } from 'viem' +import { bscTestnet } from 'viem/chains' +import ETHRegistrarController from '../artifacts/contracts/ethregistrar/ETHRegistrarController.sol/ETHRegistrarController.json' + +async function main() { + const { viem } = hre + const { deployer, owner } = await viem.getNamedClients() + + // ─── CONFIGURE THESE ──────────────────────────────────────────────────────── + const registry = await viem.getContract('ENSRegistry', owner) + const controller = await viem.getContract('ETHRegistrarController', owner) + const nameWrapper = await viem.getContract('NameWrapper', owner) + const resolver = await viem.getContract('PublicResolver', owner) + + const TLD = 'creator' + const LABEL = `smokeviem${Date.now()}` + const FULL_NAME = `${LABEL}.${TLD}` + const DURATION = 31536000n // 1 year in seconds + const lifetime = false + const data = [ + encodeFunctionData({ + abi: resolver.abi, + functionName: 'setAddr', + args: [namehash(FULL_NAME), owner.address], + }), + ] + console.log(`\n🚀 Starting viem smoke test for ${FULL_NAME}\n`) + + // 1) Check availability + const availableBefore = await controller.read.available([LABEL]) + console.log('available before:', availableBefore) + + // 2) Query rent price + const priceData = await controller.read.rentPrice([LABEL, DURATION, lifetime]) + console.log( + 'rentPrice base/premium:', + priceData.base.toString(), + priceData.premium.toString(), + ) + + // 3) Make & submit commitment + const secret = bytesToHex(crypto.randomBytes(32)) + const commitment = await controller.read.makeCommitment([ + LABEL, + owner.address, + DURATION, + secret, + resolver.address, + data, + true, + 0, + lifetime, + ]) + console.log('commitment:', commitment) + + const byted = hexToBytes(commitment) + const commitHash = await controller.write.commit([commitment]) + console.log('commit tx:', commitHash) + await viem.waitForTransactionSuccess(commitHash) + + // 4) Wait for minCommitmentAge + buffer + const minAge = await controller.read.minCommitmentAge() + const waitMs = Number(minAge) * 1000 + 5000 + console.log(`waiting ${waitMs / 1000}s for commitment age...`) + await new Promise((r) => setTimeout(r, waitMs)) + + + // 5) Register name + const totalCost = priceData.base + priceData.premium + const registerHash = await controller.write.register( + [ + LABEL, + owner.address, + DURATION, + secret, + resolver.address, + data, + true, + 0, + lifetime, + '', + ], + { value: totalCost }, + ) + console.log('⏳ register tx hash:', registerHash) + await viem.waitForTransactionSuccess(registerHash) + + console.log('register tx:', registerHash) + const registerRec = await viem.waitForTransactionSuccess(registerHash) + + // 6) Verify event + const receipt = await viem.waitForTransactionSuccess(registerHash) + + // 7) Availability flips + console.log('available after:', await controller.read.available([LABEL])) + + // 8) ENS registry owner + const node = namehash(FULL_NAME) + console.log('ENS.owner:', await registry.read.owner([node])) + + const CRE8OR_NODE = + namehash(TLD) + + const labelhash = keccak256(toBytes(LABEL)) + // 2) Label hash + const parentBytes = toBytes(CRE8OR_NODE) // Uint8Array of 32 bytes + const labelBytes = toBytes(labelhash) // Uint8Array of 32 bytes + + // 2) Allocate and copy + const packed = new Uint8Array(parentBytes.length + labelBytes.length) + packed.set(parentBytes, 0) + packed.set(labelBytes, parentBytes.length) + + const id = keccak256(packed) + const wrapperData = await nameWrapper.read.getData([BigInt(id)]) + console.log('NameWrapper owner:', wrapperData[0]) + + // 10) Resolver resolution + console.log('resolver.addr:', await resolver.read.addr([node])) + + console.log('\n🎉 viem smoke test complete!') +} + +main().catch((err) => { + console.error(err) + process.exit(1) +}) diff --git a/solidity/dns-contracts/scripts/wikiCheck.ts b/solidity/dns-contracts/scripts/wikiCheck.ts new file mode 100644 index 0000000..c460804 --- /dev/null +++ b/solidity/dns-contracts/scripts/wikiCheck.ts @@ -0,0 +1,133 @@ +import * as fs from 'fs' +import * as path from 'path' + +const SUPPORTED_CHAINS = ['mainnet', 'sepolia', 'holesky'] as const +//Updates to the wiki take 5 minutes to show up on this URL +const WIKI_DEPLOYMENTS_URL = + 'https://raw.githubusercontent.com/wiki/ensdomains/ens-contracts/ENS-Contract-Deployments.md' + +type CheckChainParameters = { + chainIndex: number + lines: string[] +} + +const getChainDeploymentsFromWiki = ({ + chainIndex, + lines, +}: CheckChainParameters) => { + const chainName = SUPPORTED_CHAINS[chainIndex] + const indexOfChain = lines.findIndex((line) => line.includes(chainName)) + const indexOfNextChain = lines.findIndex( + (line, index) => index > indexOfChain && line.includes('#'), + ) + const startOfChainDeployments = indexOfChain + 3 + + if (indexOfNextChain === -1) { + //If no next chain, then we are at the end of the file + const chainDeployments = lines.slice(startOfChainDeployments, lines.length) + return chainDeployments + } + + const chainDeployments = lines.slice( + startOfChainDeployments, + indexOfNextChain, + ) + return chainDeployments +} + +const checkDeployment = async ({ + chainName, + deploymentFilenames, + wikiDeployments, + deploymentIndex, +}: { + chainName: (typeof SUPPORTED_CHAINS)[number] + deploymentFilenames: string[] + wikiDeployments: string[] + deploymentIndex: number +}) => { + const deploymentFilename = deploymentFilenames[deploymentIndex] + + const wikiDeploymentString = wikiDeployments.find((wikiDeployment) => { + const wikiDeploymentName = wikiDeployment.split('|')[1].trim() + + const match = wikiDeploymentName.match( + new RegExp(`${deploymentFilename.split('.')[0].trim()}`), + ) + return match && match?.[0] === match?.input + }) + + if (!wikiDeploymentString) + throw new Error( + `Deployment ${deploymentIndex} not found in wiki for ${chainName}`, + ) + + const wikiDeploymentAddress = wikiDeploymentString.substring( + wikiDeploymentString.indexOf('[') + 1, + wikiDeploymentString.lastIndexOf(']'), + ) + const wikiEtherscanAddress = wikiDeploymentString.substring( + wikiDeploymentString.lastIndexOf('/') + 1, + wikiDeploymentString.lastIndexOf(')'), + ) + + const deployment = await import( + `../deployments/${chainName}/${deploymentFilename}` + ) + + if (deployment.address !== wikiDeploymentAddress) { + throw new Error( + `Deployment ${deploymentIndex} in wiki and in the repository do not match for ${chainName}. Wiki: ${wikiDeploymentAddress}, Deployment: ${deployment.address}`, + ) + } + + if (deployment.address !== wikiEtherscanAddress) { + throw new Error( + `Etherscan address ${deploymentIndex} in wiki and in the repository do not match for ${chainName}. Wiki Etherscan: ${wikiEtherscanAddress}, Deployment: ${deployment.address}`, + ) + } +} + +const checkChain = async ({ chainIndex, lines }: CheckChainParameters) => { + const chainName = SUPPORTED_CHAINS[chainIndex] + const directoryPath = path.resolve(__dirname, '../', 'deployments', chainName) + + const files = await fs.promises.readdir(directoryPath) + const deploymentFilenames = files.filter((file) => { + // Don't include migrations file + if (file.startsWith('.')) return false + if (path.extname(file).toLowerCase() !== '.json') return false + + return true + }) + + const wikiDeployments = getChainDeploymentsFromWiki({ chainIndex, lines }) + + if (wikiDeployments.length !== deploymentFilenames.length) { + throw new Error( + `Number of deployments in wiki and in the repository do not match for ${SUPPORTED_CHAINS[chainIndex]}`, + ) + } + + for (let i = 0; i < wikiDeployments.length; i++) { + await checkDeployment({ + chainName, + deploymentFilenames, + wikiDeployments, + deploymentIndex: i, + }) + } +} + +const data = await fetch(WIKI_DEPLOYMENTS_URL, { + headers: { + Connection: 'close', + }, +}).then((res) => res.text()) +const lines = data.split('\n') + +for (let i = 0; i < SUPPORTED_CHAINS.length; i++) { + await checkChain({ chainIndex: i, lines }) +} + +console.log('All deployments match') diff --git a/solidity/dns-contracts/tasks/accounts.cts b/solidity/dns-contracts/tasks/accounts.cts new file mode 100644 index 0000000..5e26cf2 --- /dev/null +++ b/solidity/dns-contracts/tasks/accounts.cts @@ -0,0 +1,9 @@ +import { task } from 'hardhat/config.js' + +task('accounts', 'Prints the list of accounts', async (_, hre) => { + const accounts = await hre.viem.getWalletClients() + + for (const { account } of accounts) { + console.log(account.address) + } +}) diff --git a/solidity/dns-contracts/tasks/archive_scan.cts b/solidity/dns-contracts/tasks/archive_scan.cts new file mode 100644 index 0000000..90f3595 --- /dev/null +++ b/solidity/dns-contracts/tasks/archive_scan.cts @@ -0,0 +1,46 @@ +// import { existsSync } from 'fs' +import fs = require('fs') + +// import { task } from 'hardhat/config.js' +import config = require('hardhat/config') + +// import { archivedDeploymentPath } from '../hardhat.config.cjs' +import ic = require('../hardhat.config.cjs') + +config + .task('archive-scan', 'Scans the deployments for unarchived deployments') + .setAction(async (_, hre) => { + const network = hre.network.name + + const deployments = await hre.deployments.all() + + for (const deploymentName in deployments) { + const deployment = deployments[deploymentName] + if (!deployment.receipt || !deployment.bytecode) continue + + const archiveName = `${deploymentName}_${network}_${deployment.receipt.blockNumber}` + const archivePath = `${ic.archivedDeploymentPath}/${archiveName}.sol` + + if (fs.existsSync(archivePath)) { + continue + } + + let fullName: string + try { + await hre.deployments.getArtifact(deploymentName) + fullName = `${deploymentName}.sol:${deploymentName}` + } catch (e: any) { + if (e._isHardhatError && e.number === 701) { + fullName = e.messageArguments.candidates.split('\n')[1] + } else { + throw e + } + } + + await hre.run('save', { + contract: deploymentName, + block: String(deployment.receipt.blockNumber), + fullName, + }) + } + }) diff --git a/solidity/dns-contracts/tasks/esm_fix.cts b/solidity/dns-contracts/tasks/esm_fix.cts new file mode 100644 index 0000000..e7c4806 --- /dev/null +++ b/solidity/dns-contracts/tasks/esm_fix.cts @@ -0,0 +1,21 @@ +import fs = require('fs/promises') +import task_names = require('hardhat/builtin-tasks/task-names') +import config = require('hardhat/config') +import path = require('path') + +config + .subtask(task_names.TASK_COMPILE_SOLIDITY) + .setAction(async (_, { config }, runSuper) => { + const superRes = await runSuper() + + try { + await fs.writeFile( + path.join(config.paths.artifacts, 'package.json'), + '{ "type": "commonjs" }', + ) + } catch (error) { + console.error('Error writing package.json: ', error) + } + + return superRes + }) diff --git a/solidity/dns-contracts/tasks/hardhat-deploy-viem.cts b/solidity/dns-contracts/tasks/hardhat-deploy-viem.cts new file mode 100644 index 0000000..c3d640e --- /dev/null +++ b/solidity/dns-contracts/tasks/hardhat-deploy-viem.cts @@ -0,0 +1,306 @@ +import type { + KeyedClient, + DeployContractConfig as OriginalDeployContractConfig, +} from '@nomicfoundation/hardhat-viem/types.js' +import { extendEnvironment } from 'hardhat/config.js' +import { lazyObject } from 'hardhat/plugins.js' +import type { + Artifact, + HardhatRuntimeEnvironment, + ContractTypesMap as OriginalContractTypesMap, +} from 'hardhat/types' + +import 'hardhat-deploy/dist/types.js' +import type { DeployOptions, DeployResult } from 'hardhat-deploy/dist/types.js' +import 'hardhat/types/config.js' +import 'hardhat/types/runtime.js' +import { + getAddress, + getContract as getViemContract, + type Account, + type ContractConstructorArgs, + type Hash, + type Hex, + type TransactionReceipt, + type Address as viemAddress, +} from 'viem' +import type Config from '../hardhat.config.cjs' + +type ContractTypesMap = Omit< + OriginalContractTypesMap, + 'ENSRegistry' | 'ENSRegistryWithFallback' +> & { + ENSRegistry: OriginalContractTypesMap['ENSRegistryWithFallback'] + LegacyENSRegistry: OriginalContractTypesMap['ENSRegistry'] +} +type ArtifactName = keyof ContractTypesMap + +type Client = Required & { address: viemAddress; account: Account } +type NewDeployContractConfig = OriginalDeployContractConfig & { + artifact?: Artifact +} +type RequiredArtifactConfig = Omit & { + artifact: Artifact +} +type DeployResultWithViemAddress = Omit & { + address: viemAddress +} + +declare module 'hardhat-deploy/dist/types.js' { + interface DeploymentsExtension { + deploy( + name: contractName, + options: Omit & { + args: ContractConstructorArgs + }, + ): Promise + } +} + +interface DeployContract { + ( + contractName: contractName, + args: ContractConstructorArgs, + options?: OriginalDeployContractConfig, + ): Promise + ( + contractName: string, + args: any[], + options: RequiredArtifactConfig, + ): Promise +} + +declare module '@nomicfoundation/hardhat-viem/types.js' { + function deployContract( + contractName: contractName, + args: ContractConstructorArgs, + options?: OriginalDeployContractConfig, + ): Promise + interface HardhatViemHelpers { + getContractOrNull: ( + contractName: contractName, + client?: KeyedClient, + ) => Promise + getContract: ( + contractName: contractName, + client?: KeyedClient, + ) => Promise + getNamedClients: () => Promise< + Record + > + getUnnamedClients: () => Promise + waitForTransactionSuccess: (hash: Hash) => Promise + deploy: DeployContract + } +} + +const getContractOrNull = + (hre: HardhatRuntimeEnvironment) => + async ( + contractName: contractName, + client_?: KeyedClient, + ): Promise => { + if (typeof hre.deployments === 'undefined') + throw new Error('No deployment plugin installed') + + const deployment = await hre.deployments.getOrNull(contractName) + if (!deployment) return null + + const client = client_ ?? { + public: await hre.viem.getPublicClient(), + wallet: await hre.viem.getWalletClients().then(([c]) => c), + } + + return getViemContract({ + abi: deployment.abi, + address: deployment.address as viemAddress, + client, + }) as unknown as ContractTypesMap[contractName] + } + +const getContract = + (hre: HardhatRuntimeEnvironment) => + async ( + contractName: contractName, + client?: KeyedClient, + ) => { + const contract = await hre.viem.getContractOrNull(contractName, client) + + if (contract === null) + throw new Error(`No contract deployed with name: ${contractName}`) + + return contract + } + +const getNamedClients = (hre: HardhatRuntimeEnvironment) => async () => { + const publicClient = await hre.viem.getPublicClient() + const namedAccounts = await hre.getNamedAccounts() + const clients: Record = {} + + for (const [name, address] of Object.entries(namedAccounts)) { + const namedClient = await hre.viem.getWalletClient(address as viemAddress) + clients[name] = { + public: publicClient, + wallet: namedClient, + address: getAddress(address), + account: namedClient.account, + } + } + + return clients +} + +const getUnnamedClients = (hre: HardhatRuntimeEnvironment) => async () => { + const publicClient = await hre.viem.getPublicClient() + const unnamedAccounts = await hre.getUnnamedAccounts() + + const clients: Client[] = await Promise.all( + unnamedAccounts.map(async (address) => { + const unnamedClient = await hre.viem.getWalletClient( + address as viemAddress, + ) + return { + public: publicClient, + wallet: unnamedClient, + address: getAddress(address), + account: unnamedClient.account, + } + }), + ) + + return clients +} + +const waitForTransactionSuccess = + (hre: HardhatRuntimeEnvironment) => async (hash: Hash) => { + const publicClient = await hre.viem.getPublicClient() + + const receipt = await publicClient.waitForTransactionReceipt({ hash }) + if (receipt.status !== 'success') + throw new Error(`Transaction failed: ${hash}`) + + return receipt + } + +const deploy = + (hre: HardhatRuntimeEnvironment) => + async ( + contractName: string, + args: any[], + options?: NewDeployContractConfig, + ) => { + const [defaultWalletClient] = await hre.viem.getWalletClients() + const walletClient = options?.client?.wallet ?? defaultWalletClient + + const legacyOptions: DeployOptions = { + args, + from: walletClient.account.address, + log: true, + waitConfirmations: options?.confirmations, + value: options?.value?.toString(), + gasLimit: options?.gas?.toString(), + gasPrice: options?.gasPrice?.toString(), + maxFeePerGas: options?.maxFeePerGas?.toString(), + maxPriorityFeePerGas: options?.maxPriorityFeePerGas?.toString(), + contract: options?.artifact, + } + + if (hre.network.saveDeployments) + return hre.deployments.deploy( + contractName as string, + legacyOptions, + ) as Promise + + const diffResult = await hre.deployments.fetchIfDifferent( + contractName, + legacyOptions, + ) + + if (!diffResult.differences) { + const deployment = await hre.deployments.get(contractName) + return { + ...deployment, + address: deployment.address as viemAddress, + newlyDeployed: false, + } + } + + const artifact = + options?.artifact ?? (await hre.artifacts.readArtifact(contractName)) + const deployHash = await walletClient.deployContract({ + abi: artifact.abi, + bytecode: artifact.bytecode as Hex, + args, + value: options?.value, + gas: options?.gas, + ...(options?.gasPrice + ? { + gasPrice: options?.gasPrice, + } + : { + maxFeePerGas: options?.maxFeePerGas, + maxPriorityFeePerGas: options?.maxPriorityFeePerGas, + }), + }) + + console.log(`deploying "${contractName}" (tx: ${deployHash})...`) + + const receipt = await hre.viem.waitForTransactionSuccess(deployHash) + + console.log( + `"${contractName}" deployed at: ${receipt.contractAddress} with ${receipt.gasUsed} gas`, + ) + + const deployment = { + address: receipt.contractAddress!, + abi: artifact.abi, + receipt: { + from: receipt.from, + transactionHash: deployHash, + blockHash: receipt.blockHash, + blockNumber: Number(receipt.blockNumber), + transactionIndex: receipt.transactionIndex, + cumulativeGasUsed: receipt.cumulativeGasUsed.toString(), + gasUsed: receipt.gasUsed.toString(), + contractAddress: receipt.contractAddress!, + to: receipt.to ?? undefined, + logs: receipt.logs.map((log) => ({ + blockNumber: Number(log.blockNumber), + blockHash: log.blockHash, + transactionHash: log.transactionHash, + transactionIndex: log.transactionIndex, + logIndex: log.logIndex, + removed: log.removed, + address: log.address, + topics: log.topics, + data: log.data, + })), + logsBloom: receipt.logsBloom, + status: receipt.status === 'success' ? 1 : 0, + }, + transactionHash: deployHash, + args, + bytecode: artifact.bytecode, + deployedBytecode: artifact.deployedBytecode, + } + + await hre.deployments.save(contractName, deployment) + + return { + ...deployment, + newlyDeployed: true, + } + } + +extendEnvironment((hre) => { + const prevViem = hre.viem + hre.viem = lazyObject(() => { + prevViem.getContractOrNull = getContractOrNull(hre) + prevViem.getContract = getContract(hre) + prevViem.getNamedClients = getNamedClients(hre) + prevViem.getUnnamedClients = getUnnamedClients(hre) + prevViem.waitForTransactionSuccess = waitForTransactionSuccess(hre) + prevViem.deploy = deploy(hre) + return prevViem + }) +}) diff --git a/solidity/dns-contracts/tasks/save.cts b/solidity/dns-contracts/tasks/save.cts new file mode 100644 index 0000000..daf70eb --- /dev/null +++ b/solidity/dns-contracts/tasks/save.cts @@ -0,0 +1,61 @@ +import { exec as _exec } from 'child_process' +import { existsSync } from 'fs' +import fs from 'fs/promises' +import { promisify } from 'util' + +import { task } from 'hardhat/config' +import { Artifact } from 'hardhat/types' + +import { archivedDeploymentPath } from '../hardhat.config.cts' + +const exec = promisify(_exec) + +task('save', 'Saves a specified contract as a deployed contract') + .addPositionalParam('contract', 'The contract to save') + .addPositionalParam('block', 'The block number the contract was deployed at') + .addOptionalParam( + 'fullName', + '(Optional) The fully qualified name of the contract (e.g. contracts/resolvers/PublicResolver.sol:PublicResolver)', + ) + .setAction( + async ( + { + contract, + block, + fullName, + }: { contract: string; block: string; fullName?: string }, + hre, + ) => { + const network = hre.network.name + + const artifactReference = fullName || contract + const artifact = await hre.deployments.getArtifact(artifactReference) + + const archiveName = `${contract}_${network}_${block}` + const archivePath = `${archivedDeploymentPath}/${archiveName}.sol` + + if (existsSync(archivePath)) { + throw new Error('Archive already exists') + } + + const newArtifact: Artifact & { + commitHash: string + treeHash: string + } = { + ...artifact, + contractName: archiveName, + sourceName: archivePath.substring(2), + commitHash: (await exec('git rev-parse HEAD')).stdout.trim(), + treeHash: ( + await exec(`git rev-parse HEAD:${artifact.sourceName}`) + ).stdout.trim(), + } + + await fs.mkdir(archivePath) + await fs.writeFile( + `${archivePath}/${archiveName}.json`, + JSON.stringify(newArtifact, null, 2), + ) + console.log("Archived contract to '" + archivePath + "'") + }, + ) diff --git a/solidity/dns-contracts/tasks/seed.ts b/solidity/dns-contracts/tasks/seed.ts new file mode 100644 index 0000000..d87e68b --- /dev/null +++ b/solidity/dns-contracts/tasks/seed.ts @@ -0,0 +1,177 @@ +import { labelhash, namehash } from 'viem/ens' +import * as dotenv from 'dotenv' +import { task } from 'hardhat/config.js' +import { Address, Hex, hexToBigInt } from 'viem' + +function getOpenSeaUrl(contract: Address, namehashedname: Hex) { + const tokenId = hexToBigInt(namehashedname).toString() + return `https://testnets.opensea.io/assets/${contract}/${tokenId}` +} + +task('seed', 'Creates test subbdomains and wraps them with Namewrapper') + .addPositionalParam('name', 'The ENS label to seed subdomains') + .setAction(async ({ name }: { name: string }, hre) => { + const { parsed: parsedFile, error } = dotenv.config({ + path: './.env', + encoding: 'utf8', + }) + + if (error) throw error + if (!parsedFile) throw new Error('Failed to parse .env') + + const [deployer] = await hre.viem.getWalletClients() + const CAN_DO_EVERYTHING = 0 + const CANNOT_UNWRAP = 1 + const CANNOT_SET_RESOLVER = 8 + const firstAddress = deployer.account.address + const { + REGISTRY_ADDRESS: registryAddress, + REGISTRAR_ADDRESS: registrarAddress, + WRAPPER_ADDRESS: wrapperAddress, + RESOLVER_ADDRESS: resolverAddress, + } = parsedFile as Record + if ( + !( + registryAddress && + registrarAddress && + wrapperAddress && + resolverAddress + ) + ) { + throw 'Set addresses on .env' + } + const publicClient = await hre.viem.getPublicClient() + console.log( + 'Account balance:', + publicClient.getBalance({ address: deployer.account.address }), + ) + console.log({ + registryAddress, + registrarAddress, + wrapperAddress, + resolverAddress, + firstAddress, + name, + }) + const EnsRegistry = await hre.viem.getContractAt( + 'ENSRegistry', + registryAddress, + ) + + const BaseRegistrar = await hre.viem.getContractAt( + 'BaseRegistrarImplementation', + registrarAddress, + ) + + const NameWrapper = await hre.viem.getContractAt( + 'NameWrapper', + wrapperAddress, + ) + + const Resolver = await hre.viem.getContractAt( + 'PublicResolver', + resolverAddress, + ) + + const domain = `${name}.eth` + const namehashedname = namehash(domain) + + await BaseRegistrar.write.setApprovalForAll([NameWrapper.address, true]) + + console.log('BaseRegistrar setApprovalForAll successful') + + await EnsRegistry.write.setApprovalForAll([NameWrapper.address, true]) + + await NameWrapper.write.wrapETH2LD( + [name, firstAddress, CAN_DO_EVERYTHING, resolverAddress], + { + gas: 10000000n, + }, + ) + + console.log( + `Wrapped NFT for ${domain} is available at ${getOpenSeaUrl( + NameWrapper.address, + namehashedname, + )}`, + ) + + await NameWrapper.write.setSubnodeOwner([ + namehash(`${name}.eth`), + 'sub1', + firstAddress, + CAN_DO_EVERYTHING, + 0n, + ]) + + console.log('NameWrapper setSubnodeOwner successful for sub1') + + await NameWrapper.write.setSubnodeOwner([ + namehash(`${name}.eth`), + 'sub2', + firstAddress, + CAN_DO_EVERYTHING, + 0n, + ]) + + console.log('NameWrapper setSubnodeOwner successful for sub2') + + await NameWrapper.write.setResolver([ + namehash(`sub2.${name}.eth`), + resolverAddress, + ]) + + console.log('NameWrapper setResolver successful for sub2') + + await Resolver.write.setText([ + namehash(`sub2.${name}.eth`), + 'domains.ens.nft.image', + '', + ]) + + await Resolver.write.setText([ + namehash(`sub2.${name}.eth`), + 'avatar', + 'https://i.imgur.com/1JbxP0P.png', + ]) + + console.log( + `Wrapped NFT for sub2.${name}.eth is available at ${getOpenSeaUrl( + NameWrapper.address, + namehash(`sub2.${name}.eth`), + )}`, + ) + + await NameWrapper.write.setFuses([namehash(`${name}.eth`), CANNOT_UNWRAP], { + gas: 10000000n, + }) + + console.log('NameWrapper set CANNOT_UNWRAP fuse successful for sub2') + + await NameWrapper.write.setFuses( + [namehash(`sub2.${name}.eth`), CANNOT_UNWRAP], + { + gas: 10000000n, + }, + ) + + console.log('NameWrapper set CANNOT_UNWRAP fuse successful for sub2') + + await NameWrapper.write.setFuses( + [namehash(`sub2.${name}.eth`), CANNOT_SET_RESOLVER], + { + gas: 10000000n, + }, + ) + + console.log('NameWrapper set CANNOT_SET_RESOLVER fuse successful for sub2') + + await NameWrapper.write.unwrap( + [namehash(`${name}.eth`), labelhash('sub1'), firstAddress], + { + gas: 10000000n, + }, + ) + + console.log(`NameWrapper unwrap successful for ${name}`) + }) diff --git a/solidity/dns-contracts/tsconfig.json b/solidity/dns-contracts/tsconfig.json new file mode 100644 index 0000000..9edbd47 --- /dev/null +++ b/solidity/dns-contracts/tsconfig.json @@ -0,0 +1,31 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "Node16", + "moduleDetection": "force", + "strict": true, + "esModuleInterop": true, + "moduleResolution": "NodeNext", + "outDir": "build", + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true + }, + "include": [ + "./utils/**/*.ts", + "./scripts/**/*.ts", + "./test/**/*.ts", + "./tasks/**/*.ts", + "./deploy/**/*.ts", + "./typings-custom/**/*.ts", + "./artifacts/**/*.d.ts", + "tasks/hardhat-deploy-viem.cts", + "tasks/deploy-test.cts" + ], + "ts-node": { + "experimentalResolver": true, + "experimentalSpecifierResolution": "node", + "files": true + }, + "files": ["hardhat.config.cts"] +} diff --git a/solidity/dns-contracts/typings-custom/dns-packet.d.ts b/solidity/dns-contracts/typings-custom/dns-packet.d.ts new file mode 100644 index 0000000..e01527e --- /dev/null +++ b/solidity/dns-contracts/typings-custom/dns-packet.d.ts @@ -0,0 +1,118 @@ +declare module 'dns-packet' { + const AUTHORITATIVE_ANSWER: number + const TRUNCATED_RESPONSE: number + const RECURSION_DESIRED: number + const RECURSION_AVAILABLE: number + const AUTHENTIC_DATA: number + const CHECKING_DISABLED: number + const DNSSEC_OK: number + + interface decoder { + (buf: Buffer, offset?: number): T + bytes: number + } + + const decode: decoder + + interface encoder { + (packet: T, buf?: Buffer, offset?: number): Buffer + bytes: number + } + + const encode: encoder + + interface Packet { + id?: number + type: 'query' | 'response' + flags?: number + rcode?: string + questions: Question[] + answers?: Answer[] + authorities?: Answer[] + additionals?: Answer[] + } + + interface Question { + type: string + class: string + name: string + } + + interface AnswerBase { + type: string + class?: string + name: string + ttl?: number + flush?: boolean + } + + interface A extends AnswerBase { + type: 'A' + data: string + } + + interface Dnskey extends AnswerBase { + type: 'DNSKEY' + data: { + flags: number + algorithm: number + key: Buffer + } + } + + interface Ds extends AnswerBase { + type: 'DS' + data: { + keyTag: number + algorithm: number + digestType: number + digest: Buffer + } + } + + interface Opt extends AnswerBase { + type: 'OPT' + udpPayloadSize?: number + extendedRcode?: number + ednsVersion?: number + flags?: number + data?: any + } + + interface Rrsig extends AnswerBase { + type: 'RRSIG' + data: { + typeCovered: string + algorithm: number + labels: number + originalTTL: number + expiration: number + inception: number + keyTag: number + signersName: string + signature: Buffer + } + } + + interface Rtxt extends AnswerBase { + type: 'TXT' + data: Buffer[] + } + + type Answer = A | Dnskey | Ds | Opt | Rrsig | Rtxt + + interface Encodable { + decode: decoder + encode: encoder + } + + const record: (type: string) => Encodable + const answer: Encodable + const dnskey: Encodable + const name: Encodable + const rrsig: Encodable +} + +declare module 'dns-packet/types' { + function toString(type: number): string +} diff --git a/solidity/dns-contracts/utils/00_deploy_universal_resolver.ts b/solidity/dns-contracts/utils/00_deploy_universal_resolver.ts new file mode 100644 index 0000000..1376b12 --- /dev/null +++ b/solidity/dns-contracts/utils/00_deploy_universal_resolver.ts @@ -0,0 +1,32 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' + +const func: DeployFunction = async function (hre) { + const { deployments, viem } = hre + const { deploy } = deployments + + const { deployer, owner } = await viem.getNamedClients() + + const registry = await viem.getContract('ENSRegistry') + const batchGatewayURLs = JSON.parse(process.env.BATCH_GATEWAY_URLS || '[]') + + if (batchGatewayURLs.length === 0) { + throw new Error('UniversalResolver: No batch gateway URLs provided') + } + + await viem.deploy('UniversalResolver', [registry.address, batchGatewayURLs]) + + if (owner !== undefined && owner.address !== deployer.address) { + const universalResolver = await viem.getContract('UniversalResolver') + const hash = await universalResolver.write.transferOwnership([ + owner.address, + ]) + console.log(`Transfer ownership to ${owner.address} (tx: ${hash})...`) + await viem.waitForTransactionSuccess(hash) + } +} + +func.id = 'universal-resolver' +func.tags = ['utils', 'UniversalResolver'] +func.dependencies = ['registry'] + +export default func diff --git a/solidity/dns-contracts/utils/10_deploy_migration_helper.ts b/solidity/dns-contracts/utils/10_deploy_migration_helper.ts new file mode 100644 index 0000000..2119a9d --- /dev/null +++ b/solidity/dns-contracts/utils/10_deploy_migration_helper.ts @@ -0,0 +1,26 @@ +import type { DeployFunction } from 'hardhat-deploy/types.js' + +const func: DeployFunction = async function (hre) { + const { deployments, viem } = hre + const { deploy } = deployments + + const { deployer, owner } = await viem.getNamedClients() + + const registrar = await viem.getContract('BaseRegistrarImplementation') + const wrapper = await viem.getContract('NameWrapper') + + await viem.deploy('MigrationHelper', [registrar.address, wrapper.address]) + + if (owner !== undefined && owner.address !== deployer.address) { + const migrationHelper = await viem.getContract('MigrationHelper') + const hash = await migrationHelper.write.transferOwnership([owner.address]) + console.log(`Transfer ownership to ${owner.address} (tx: ${hash})...`) + await viem.waitForTransactionSuccess(hash) + } +} + +func.id = 'migration-helper' +func.tags = ['utils', 'MigrationHelper'] +func.dependencies = ['BaseRegistrarImplementation', 'NameWrapper'] + +export default func diff --git a/solidity/edufi-contracts/.env.example b/solidity/edufi-contracts/.env.example new file mode 100644 index 0000000..26b395b --- /dev/null +++ b/solidity/edufi-contracts/.env.example @@ -0,0 +1,9 @@ +API_KEY= +API_SECRET= +RELAYER_API_KEY= +RELAYER_API_SECRET= +PRIVATE_KEY= +API_URL= +ACTION_ID= +OWNER_ADDRESS= +FORWARDER_ADDRESS= \ No newline at end of file diff --git a/solidity/edufi-contracts/README.md b/solidity/edufi-contracts/README.md new file mode 100644 index 0000000..555ee6c --- /dev/null +++ b/solidity/edufi-contracts/README.md @@ -0,0 +1,104 @@ +# EduFi-contracts + +These contracts manage on-chain courses linked to domain ownership. Only users who own a valid domain from the DNS system can enroll in or access courses. The contracts handle course creation, enrollment, and progress tracking, integrating seamlessly with the DNS and referral systems. Enrollment and Course Progress updates are all done through the relayer created on Openzeppelin's Defender, meaning that zero gas fees are incurred by the end user. + +# Live Link +- [learn.level3labs.fun](https://learn.level3labs.fun) + +## Getting Started + +### Prerequisites + +- Node.js and npm +- Hardhat +- A wallet like MetaMask +- Access to the BNB Chain testnet/mainnet + +### Installation + +```bash +git clone https://github.com/Level3AI-hub/Level3-Contracts.git +cd Level3-Contracts +npm install +``` + +### Running the Project + +1. Compile the contracts: + +```bash +npx hardhat compile +``` + +2. Configure .env variables + +```bash +API_KEY= +API_SECRET= +RELAYER_API_KEY= +RELAYER_API_SECRET= +PRIVATE_KEY= +API_URL= +ACTION_ID= +OWNER_ADDRESS= +FORWARDER_ADDRESS= +``` + +```bash +cp .env.example .env +``` + +The OWNER_ADDRESS is the wallet that owns the contracts and the API_URL is the RPC_URL. + +To get your API_KEY and API_SECRET, Go to [OpenZeppelin Defender](https://defender.openzeppelin.com/v2/#/settings/api-keys/new) and create a new API Key and API Secret. + +After doing that, run: + +```bash +yarn create-relayer +``` + +This will create your Relayer API Key and Relayer Secret and will be automatiically stored in your .env file. Your Relayer ID will also be created. + +3. Deploy the contracts to a local or test network: + +```bash +npx hardhat run scripts/deploy.ts --network +``` + +Then copy Your Forwarder Address and paste in your .env file. + +4. Create Action on Defender: + +```bash +yarn create-action +``` + +Then head to [Defender Actions](https://defender.openzeppelin.com/v2/#/actions/automatic) and copy the Actions’s webhook so that you can test functionality and connect the app to the Action for relaying meta-transactions. Keep the Webhook Safe As it will be needed in your frontend. + +5. Create A Course: + +Fill in your Factory Address and the course you want to create. Then run: + +```bash +npx hardhat run scripts/createCourse.ts --network +``` + +## Usage + +- Ensure the DNS system is deployed and a user owns a valid domain before testing enrollment. +- Ensure your Relayer is funded with tBNB tokens or BNB tokens +- Deploy course contracts +- Use the exposed functions to create courses, enroll domain holders, and track progress + +## Contributing + +Contributions are welcome! Please fork the repo and submit a pull request. + +## License + +MIT License + +## Contact + +For questions or support, reach out to [info@level3labs.fun](mailto:info@level3labs.fun) or open an issue on GitHub. diff --git a/solidity/edufi-contracts/action/index.mjs b/solidity/edufi-contracts/action/index.mjs new file mode 100644 index 0000000..77339ee --- /dev/null +++ b/solidity/edufi-contracts/action/index.mjs @@ -0,0 +1,268 @@ +const { Defender } = require('@openzeppelin/defender-sdk'); +const { ethers } = require('ethers') + +const ForwarderAbi = [ + { + inputs: [], + name: "eip712Domain", + outputs: [ + { + internalType: "bytes1", + name: "fields", + type: "bytes1", + }, + { + internalType: "string", + name: "name", + type: "string", + }, + { + internalType: "string", + name: "version", + type: "string", + }, + { + internalType: "uint256", + name: "chainId", + type: "uint256", + }, + { + internalType: "address", + name: "verifyingContract", + type: "address", + }, + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + { + internalType: "uint256[]", + name: "extensions", + type: "uint256[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "value", + type: "uint256", + }, + { + internalType: "uint256", + name: "gas", + type: "uint256", + }, + { + internalType: "uint48", + name: "deadline", + type: "uint48", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + ], + internalType: "struct ERC2771Forwarder.ForwardRequestData", + name: "request", + type: "tuple", + }, + ], + name: "execute", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "value", + type: "uint256", + }, + { + internalType: "uint256", + name: "gas", + type: "uint256", + }, + { + internalType: "uint48", + name: "deadline", + type: "uint48", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + ], + internalType: "struct ERC2771Forwarder.ForwardRequestData[]", + name: "requests", + type: "tuple[]", + }, + { + internalType: "address payable", + name: "refundReceiver", + type: "address", + }, + ], + name: "executeBatch", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "value", + type: "uint256", + }, + { + internalType: "uint256", + name: "gas", + type: "uint256", + }, + { + internalType: "uint48", + name: "deadline", + type: "uint48", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + ], + internalType: "struct ERC2771Forwarder.ForwardRequestData", + name: "request", + type: "tuple", + }, + ], + name: "verify", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, +] + +const ForwarderAddress = process.env.FORWARDER_ADDRESS; + +async function relay(forwarder, request, signature, whitelist) { + // Decide if we want to relay this request based on a whitelist + const accepts = !whitelist || whitelist.includes(request.to); + if (!accepts) throw new Error(`Rejected request to ${request.to}`); + + // Validate request on the forwarder contract + const valid = await forwarder.verify(request, signature); + if (!valid) throw new Error(`Invalid request`); + + // Send meta-tx through relayer to the forwarder contract + const gasLimit = (parseInt(request.gas) + 50000).toString(); + return await forwarder.execute(request, signature, { gasLimit }); +} + +async function handler(event) { + // Parse webhook payload + if (!event.request || !event.request.body) throw new Error(`Missing payload`); + const { request, signature } = event.request.body; + console.log(`Relaying`, request); + + // Initialize Relayer provider and signer, and forwarder contract + const creds = { ... event }; + const client = new Defender(creds); + const provider = client.relaySigner.getProvider(); + const signer = client.relaySigner.getSigner(provider, { speed: 'fast' }); + const forwarder = new ethers.Contract(ForwarderAddress, ForwarderAbi, signer); + + // Relay transaction! + const tx = await relay(forwarder, request, signature); + console.log(`Sent meta-tx: ${tx.hash}`); + return { txHash: tx.hash }; +} + +module.exports = { + handler, + relay, +} \ No newline at end of file diff --git a/solidity/edufi-contracts/contracts/CourseFactory.sol b/solidity/edufi-contracts/contracts/CourseFactory.sol new file mode 100644 index 0000000..f1358be --- /dev/null +++ b/solidity/edufi-contracts/contracts/CourseFactory.sol @@ -0,0 +1,139 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +import "@openzeppelin/contracts/access/Ownable.sol"; +import "./Coursecontract.sol"; +import "./ILevel3Course.sol"; + +contract CourseFactory is Ownable, ILevel3Course { + Level3Course public level3Course; + uint256 public courseCounter; + mapping(uint256 => Course) public courses; + + event CourseAdded(uint256 indexed id, string title); + event CourseEdited(uint256 indexed id, string title); + event QuizAdded(uint256 indexed courseId, uint256 lessonId); + event LessonAdded(uint256 indexed courseId, uint256 lessonId, string title); + + constructor(address _level3course, address owner) Ownable(owner) { + courseCounter = 0; + level3Course = Level3Course(_level3course); + } + + function numCourses() public view returns (uint256) { + return courseCounter; + } + + function addCourse( + string memory _title, + string memory _description, + string memory _longDescription, + string memory _instructor, + string[] memory _objectives, + string[] memory _prerequisites, + string memory _category, + string memory _level, + string memory _url, + Lesson[] memory lessons, + string memory _duration + ) public onlyOwner { + Course storage c = courses[courseCounter]; + c.id = courseCounter; + c.title = _title; + c.description = _description; + c.level = _level; + c.url = _url; + c.longDescription = _longDescription; + c.instructor = _instructor; + c.objectives = _objectives; + c.category = _category; + c.prerequisites = _prerequisites; + c.lessons = lessons; + c.duration = _duration; + level3Course.updateCourseRegistry(c, courseCounter); + emit CourseAdded(courseCounter, _title); + courseCounter = courseCounter + 1; + } + + function editCourse( + uint256 _courseId, + string memory _title, + string memory _description, + string memory _longDescription, + string memory _instructor, + string[] memory _objectives, + string[] memory _prerequisites, + string memory _category, + string memory _level, + string memory _url, + Lesson[] memory _lessons, + string memory _duration + ) public onlyOwner { + Course storage c = courses[_courseId]; + c.title = _title; + c.description = _description; + c.level = _level; + c.url = _url; + c.longDescription = _longDescription; + c.instructor = _instructor; + c.objectives = _objectives; + c.lessons = _lessons; + c.category = _category; + c.prerequisites = _prerequisites; + c.duration = _duration; + level3Course.updateCourse(c, _courseId); + emit CourseEdited(_courseId, _title); + } + + function addQuiz( + uint256 _courseId, + uint256 _lessonid, + string memory quizzes + ) public onlyOwner { + require(_courseId < courseCounter, "Course does not exist"); + courses[_courseId].lessons[_lessonid].quizzes = quizzes; + level3Course.updateCourse(courses[_courseId], _courseId); + emit QuizAdded(_courseId, _lessonid); + } + + function editQuiz( + uint256 _courseId, + uint256 _lessonid, + string memory quizzes + ) public onlyOwner { + require(_courseId < courseCounter, "Course does not exist"); + courses[_courseId].lessons[_lessonid].quizzes = quizzes; + level3Course.updateCourse(courses[_courseId], _courseId); + emit QuizAdded(_courseId, _lessonid); + } + + function addLesson( + uint256 _courseId, + string memory _text, + string[] memory _url + ) public onlyOwner { + require(_courseId < courseCounter, "Course does not exist"); + + Lesson storage newLesson = courses[_courseId].lessons.push(); + newLesson.id = courses[_courseId].lessons.length - 1; + newLesson.lessontitle = _text; + newLesson.url = _url; + level3Course.updateCourse(courses[_courseId], _courseId); + emit LessonAdded(_courseId, newLesson.id, _text); + } + + function editLesson( + uint256 _courseId, + uint256 _lessonId, + string memory _text, + string[] memory _url + ) public onlyOwner { + require(_courseId < courseCounter, "Course does not exist"); + + Lesson storage lesson = courses[_courseId].lessons[_lessonId]; + lesson.lessontitle = _text; + lesson.url = _url; + level3Course.updateCourse(courses[_courseId], _courseId); + emit LessonAdded(_courseId, lesson.id, _text); + } +} diff --git a/solidity/edufi-contracts/contracts/Coursecontract.sol b/solidity/edufi-contracts/contracts/Coursecontract.sol new file mode 100644 index 0000000..8ce6eee --- /dev/null +++ b/solidity/edufi-contracts/contracts/Coursecontract.sol @@ -0,0 +1,203 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +import "@openzeppelin/contracts/metatx/ERC2771Context.sol"; +import "./IReverseRegistrar.sol"; +import "./ILevel3Course.sol"; +import "./CourseFactory.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; +import "@openzeppelin/contracts/metatx/ERC2771Forwarder.sol"; + +contract Level3Course is ERC2771Context, ILevel3Course, Ownable { + IReverseRegistrar public reverse; + address public courseFactory; + uint256 public courseCounter; + mapping(address => mapping(uint256 => bool)) isEnrolled; + mapping(address => mapping(uint256 => uint8)) public progress; + mapping(uint256 => address[]) public participants; + mapping(uint256 => Course) public courses; + mapping(address => uint256) public points; + mapping(address => mapping(uint256 => bool)) public completedCourses; + + event CourseEnrolled(address indexed user, uint256 courseId); + event ProgressUpdated( + address indexed user, + uint256 courseId, + uint8 progress + ); + + modifier domainOwner(address user) { + bytes32 node = reverse.node(user); + require(node != bytes32(0), "No .creator Primary Domain name"); + _; + } + + modifier onlyFactory() { + require(_msgSender() == courseFactory, "Not Course Factory"); + _; + } + + constructor( + address _forwarder, + address _reverse, + address owner + ) ERC2771Context(_forwarder) Ownable(owner) { + reverse = IReverseRegistrar(_reverse); + } + + function setCourseFactory(address _factory) external onlyOwner { + require(courseFactory == address(0), "Factory already set"); + courseFactory = _factory; + } + + function updateCourseRegistry( + Course memory course, + uint256 coursecounter + ) public onlyFactory { + Course storage existingCourse = courses[coursecounter]; + existingCourse.id = course.id; + existingCourse.title = course.title; + existingCourse.description = course.description; + existingCourse.level = course.level; + existingCourse.url = course.url; + existingCourse.longDescription = course.longDescription; + existingCourse.instructor = course.instructor; + existingCourse.objectives = course.objectives; + existingCourse.category = course.category; + existingCourse.prerequisites = course.prerequisites; + existingCourse.lessons = course.lessons; + existingCourse.duration = course.duration; + courses[coursecounter] = existingCourse; + courseCounter = coursecounter; + } + + function updateCourse( + Course memory course, + uint256 coursecounter + ) public onlyFactory { + Course storage existingCourse = courses[coursecounter]; + existingCourse.title = course.title; + existingCourse.description = course.description; + existingCourse.level = course.level; + existingCourse.url = course.url; + existingCourse.longDescription = course.longDescription; + existingCourse.instructor = course.instructor; + existingCourse.objectives = course.objectives; + existingCourse.category = course.category; + existingCourse.prerequisites = course.prerequisites; + existingCourse.lessons = course.lessons; + existingCourse.duration = course.duration; + courses[coursecounter] = existingCourse; + } + + function numCourses() public view returns (uint256) { + return courseCounter; + } + + function enroll( + uint _id, + address _user + ) public domainOwner(_user) { + require(_id < courseCounter, "Course does not exist"); + + require(!isEnrolled[_user][_id], "User is already enrolled"); + + isEnrolled[_user][_id] = true; // Mark as enrolled + participants[_id].push(_user); + } + + function updateCourseProgress( + uint256 _courseId, + uint8 _progress, + address _user, + uint256 _points + ) public onlyOwner domainOwner(_user) { + require(_courseId < courseCounter, "Course does not exist"); + + require( + isEnrolled[_user][_courseId], + "User must be enrolled in the course" + ); + require(_progress <= 100, "Progress cannot exceed 100%"); + + progress[_user][_courseId] = _progress; + points[_user] = _points; // Update user points + if (_progress == 100) { + // If progress is 100%, mark as completed + isEnrolled[_user][_courseId] = false; // Unenroll user + // Optionally, you can add logic to handle completed lessons here + completedCourses[_user][_courseId] = true; // Mark course as completed + } + emit ProgressUpdated(_user, _courseId, _progress); + } + + function getCourse( + uint256 _id, + address _user + ) + public + view + returns (Course memory, bool enrolled, uint8 score, uint256 attendees) + { + require(_id < courseCounter, "Course does not exist"); + + Course storage course = courses[_id]; + bool isUserEnrolled = isEnrolled[_user][_id]; // Direct lookup + uint8 userProgress = isUserEnrolled ? progress[_user][_id] : 0; + uint256 length = participants[_id].length; + + return (course, isUserEnrolled, userProgress, length); + } + + function getUserPoints(address _user) public view returns (uint256) { + return points[_user]; + } + + function getCourses() public view returns (Course[] memory) { + Course[] memory courseList = new Course[](courseCounter); + for (uint256 i = 0; i < courseCounter; i++) { + courseList[i] = courses[i]; + } + return courseList; + } + + function numParticipants(uint256 _courseId) public view returns (uint256) { + uint256 length = participants[_courseId].length; + return length; + } + + function getAllParticipants() public view returns (uint256[] memory) { + uint256[] memory courseParticipants = new uint256[](courseCounter); + for (uint256 i = 0; i < courseCounter; i++) { + courseParticipants[i] = participants[i].length; + } + return courseParticipants; + } + + function _msgSender() + internal + view + override(Context, ERC2771Context) + returns (address sender) + { + return ERC2771Context._msgSender(); + } + + function _msgData() + internal + view + override(Context, ERC2771Context) + returns (bytes calldata) + { + return ERC2771Context._msgData(); + } + + function _contextSuffixLength() + internal + view + override(Context, ERC2771Context) + returns (uint256) + { + return ERC2771Context._contextSuffixLength(); + } +} diff --git a/solidity/edufi-contracts/contracts/Earn.sol b/solidity/edufi-contracts/contracts/Earn.sol new file mode 100644 index 0000000..91f794a --- /dev/null +++ b/solidity/edufi-contracts/contracts/Earn.sol @@ -0,0 +1,219 @@ + // SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; +/* +import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; +import "@openzeppelin/contracts/metatx/ERC2771Context.sol"; +import "@openzeppelin/contracts/metatx/ERC2771Forwarder.sol"; + +using SafeERC20 for IERC20; + +contract Level3Earn is ERC2771Context, Ownable { + struct Task { + uint256 id; + string title; + string content; // Content of the task + string section; // Section of the task + address token; // Address of the token used for rewards + uint256 points; + uint256 timestamp; // Timestamp of the post creation + } + + struct Campaign { + uint256 id; + string title; + string description; // Description of the campaign + address token; // Address of the token used for rewards + uint256 totalPoints; // Total points available for the campaign + uint256 startTime; // Start time of the campaign + uint256 endTime; // End time of the campaign + } + + uint256 public taskCounter; // Counter for task IDs + uint256 public campaignCounter; // Counter for campaign IDs + address public backend; + uint256 public weeklyCounter; + + mapping(uint256 => Task) public tasks; + mapping(address => uint256[]) public userPosts; // Maps user address to their post IDs + mapping(address => mapping(address => uint256)) public userEarnings; // Maps user address to total earnings + + event TaskCreated( + uint256 indexed postId, + string title, + address indexed creator + ); + event EarningsClaimed(address user, uint256 amount); + event TaskUpdated(uint256 indexed postId, string title, string content); + event TaskDeleted(uint256 indexed postId); + event EarningsDistributed( + uint256 indexed postId, + address indexed user, + uint256 amount + ); + + constructor(ERC2771Forwarder forwarder) + ERC2771Context(address(forwarder)) + Ownable(msg.sender) + { + weeklyCounter = 0; + } + + + struct Entry { + address user; + uint256[] weeklyScores; // Array of scores for each week + } + + // Dynamic array of all entries, always sorted highest→lowest + Entry[] private entries; + Entry[] private snapshot; + // Quick lookup of an address’s score and whether they exist + mapping(address => uint256) private scores; + mapping(address => bool) private exists; + + // Mapping from address → index in the `entries` array + mapping(address => uint256) private indexOf; + + /// @notice Emitted whenever a user's score is set or updated. + event ScoreUpdated(address indexed user, uint256 newScore); + + function createTask() external { + Task storage task = tasks[taskCounter]; + } + + /// @notice Add or update the caller’s score and re-order the leaderboard. + function updateScore(uint256 newScore) external { + if (!exists[msg.sender]) { + // New entrant + entries.push(Entry(msg.sender, newScore)); + uint256 idx = entries.length - 1; + exists[msg.sender] = true; + indexOf[msg.sender] = idx; + scores[msg.sender] = newScore; + _bubbleUp(idx); + } else { + // Update existing + uint256 idx = indexOf[_msgSender()]; + entries[idx].score[weeklyCounter] = newScore; + scores[msg.sender] = newScore; + // Fix position: could be higher or lower + _bubbleUp(idx); + _bubbleDown(idx); + } + emit ScoreUpdated(msg.sender, newScore); + } + + function updateSnapshot() external { + weeklyCounter += 1; + for(uint256 i = 0; i < 8; i++) { + snapshot.push(entries[i]); + } + } + + function getSnapshot() external view returns (Entry[] memory){ + return snapshot; + } + + /// @dev Swap upward until this entry is no longer greater than its predecessor. + function _bubbleUp(uint256 idx) internal { + while (idx > 0 && entries[idx].score[weeklyCounter] > entries[idx - 1].score[weeklyCounter]) { + _swap(idx, idx - 1); + idx--; + } + } + + /// @dev Swap downward until this entry is no longer less than its successor. + function _bubbleDown(uint256 idx) internal { + uint256 len = entries.length; + while (idx + 1 < len && entries[idx].score[weeklyCounter] < entries[idx + 1].score[weeklyCounter]) { + _swap(idx, idx + 1); + idx++; + } + } + + /// @dev Swap two entries in the array and update their stored indices. + function _swap(uint256 i, uint256 j) internal { + Entry memory temp = entries[i]; + entries[i] = entries[j]; + entries[j] = temp; + indexOf[entries[i].user] = i; + indexOf[entries[j].user] = j; + } + + /// @notice Get the top `n` entries (or fewer if there aren’t that many). + function top(uint256 n) external view returns (Entry[] memory) { + uint256 len = entries.length; + if (n > len) { + n = len; + } + Entry[] memory list = new Entry[](n); + for (uint256 i = 0; i < n; i++) { + list[i] = entries[i]; + } + return list; + } + + /// @notice Look up a specific user’s score. + function getScore(address user) external view returns (uint256) { + return scores[user]; + } + + /// @notice Get a user’s current rank (1‐based). Reverts if the user has no entry. + function getRank(address user) external view returns (uint256) { + require(exists[user], "No entry for user"); + // index 0 → rank 1 + return indexOf[user] + 1; + } + + /// @notice How many entries are currently on the leaderboard. + function totalEntries() external view returns (uint256) { + return entries.length; + } + + /// @inheritdoc ERC2771Context + function _msgSender() + internal + view + override(ERC2771Context, Context) + returns (address) + { + return ERC2771Context._msgSender(); + } + + /// @inheritdoc ERC2771Context + function _msgData() + internal + view + override(ERC2771Context, Context) + returns (bytes calldata) + { + return ERC2771Context._msgData(); + } + + /// @inheritdoc ERC2771Context + function _contextSuffixLength() + internal + view + override(ERC2771Context, Context) + returns (uint256) + { + return ERC2771Context._contextSuffixLength(); + } + + function payOut() external { + uint256 length = snapshot.length; + for(uint256 i = 0; i < length; i++){ + payable(snapshot[i].a); + } + } + + function nativeBalance() external view returns(uint256){ + return address(this).balance; + } + + function tokenBalance(address token) external view returns(uint256){ + return IERC20(token).balanceOf(address(this)); + } +} + */ \ No newline at end of file diff --git a/solidity/edufi-contracts/contracts/ILevel3Course.sol b/solidity/edufi-contracts/contracts/ILevel3Course.sol new file mode 100644 index 0000000..107f22f --- /dev/null +++ b/solidity/edufi-contracts/contracts/ILevel3Course.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +interface ILevel3Course { + struct Lesson { + uint256 id; + string lessontitle; + string[] url; + string quizzes; // Array of quizzes associated with this lesson + } + struct Course { + uint256 id; + string title; + string description; + string longDescription; + string[] objectives; + string [] prerequisites; + string instructor; + string url; + string level; + string category; + string duration; + Lesson[] lessons; // Array of lessons in the course + } +} diff --git a/solidity/edufi-contracts/contracts/IReverseRegistrar.sol b/solidity/edufi-contracts/contracts/IReverseRegistrar.sol new file mode 100644 index 0000000..9b99dd5 --- /dev/null +++ b/solidity/edufi-contracts/contracts/IReverseRegistrar.sol @@ -0,0 +1,29 @@ +pragma solidity >=0.8.4; + +interface IReverseRegistrar { + function setDefaultResolver(address resolver) external; + + function claim(address owner) external returns (bytes32); + + function claimForAddr( + address addr, + address owner, + address resolver + ) external returns (bytes32); + + function claimWithResolver( + address owner, + address resolver + ) external returns (bytes32); + + function setName(string memory name) external returns (bytes32); + + function setNameForAddr( + address addr, + address owner, + address resolver, + string memory name + ) external returns (bytes32); + + function node(address addr) external pure returns (bytes32); +} diff --git a/solidity/edufi-contracts/hardhat.config.ts b/solidity/edufi-contracts/hardhat.config.ts new file mode 100644 index 0000000..46187c4 --- /dev/null +++ b/solidity/edufi-contracts/hardhat.config.ts @@ -0,0 +1,45 @@ +import { HardhatUserConfig } from 'hardhat/config' +import '@nomicfoundation/hardhat-toolbox' +import '@nomicfoundation/hardhat-verify' +import "dotenv/config" + +const { API_URL, PRIVATE_KEY } = process.env + + +const config: HardhatUserConfig = { + solidity: { + compilers: [ + { + version: '0.8.28', + settings: { + viaIR: true, + optimizer: { + enabled: true, + runs: 1000, + }, + }, + }, + ], + }, + defaultNetwork: 'bsc', + networks: { + hardhat: {}, + bsc: { + url: API_URL, + chainId: 97, + accounts: [`0x${PRIVATE_KEY}`], + }, + }, + etherscan: { + // Your API key for Etherscan + // Obtain one at https://etherscan.io/ + apiKey: '', + }, + sourcify: { + // Disabled by default + // Doesn't need an API key + enabled: true, + }, +} + +export default config diff --git a/solidity/edufi-contracts/package-lock.json b/solidity/edufi-contracts/package-lock.json new file mode 100644 index 0000000..87ff84b --- /dev/null +++ b/solidity/edufi-contracts/package-lock.json @@ -0,0 +1,12837 @@ +{ + "name": "hardhat-project", + "version": "1.2.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "hardhat-project", + "version": "1.2.0", + "dependencies": { + "dotenv": "^17.2.0", + "rollup": "^4.44.2" + }, + "devDependencies": { + "@nomicfoundation/hardhat-toolbox": "^6.0.0", + "@nomicfoundation/hardhat-verify": "^2.1.0", + "@openzeppelin/contracts": "^5.3.0", + "@openzeppelin/defender-sdk": "^2.6.0", + "@rollup/plugin-commonjs": "^25.0.7", + "@rollup/plugin-json": "^6.1.0", + "@rollup/plugin-node-resolve": "^15.2.3", + "builtin-modules": "^5.0.0", + "hardhat": "^2.25.0", + "prettier": "3.5.3", + "prettier-plugin-solidity": "^2.0.0", + "ts-node": "^10.9.2" + } + }, + "node_modules/@adraffy/ens-normalize": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", + "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@aws-crypto/crc32": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-5.2.0.tgz", + "integrity": "sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/util": "^5.2.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-crypto/sha256-browser": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-5.2.0.tgz", + "integrity": "sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-js": "^5.2.0", + "@aws-crypto/supports-web-crypto": "^5.2.0", + "@aws-crypto/util": "^5.2.0", + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-locate-window": "^3.0.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/is-array-buffer": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", + "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-buffer-from": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", + "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/is-array-buffer": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-utf8": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", + "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/util-buffer-from": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-5.2.0.tgz", + "integrity": "sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/util": "^5.2.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-crypto/supports-web-crypto": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-5.2.0.tgz", + "integrity": "sha512-iAvUotm021kM33eCdNfwIN//F77/IADDSs58i+MDaOqFrVjZo9bAal0NK7HurRuWLLpF1iLX7gbWrjHjeo+YFg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-crypto/util": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-5.2.0.tgz", + "integrity": "sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.222.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-crypto/util/node_modules/@smithy/is-array-buffer": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", + "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/util/node_modules/@smithy/util-buffer-from": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", + "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/is-array-buffer": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/util/node_modules/@smithy/util-utf8": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", + "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/util-buffer-from": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/client-lambda": { + "version": "3.844.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-lambda/-/client-lambda-3.844.0.tgz", + "integrity": "sha512-tPq+gxhbyZvYP7sqkxPNbDTtxGsOg+RZnyAvoZHH19kFk9zkkHIJi54Qo8ydg8OZqWC7LZtAbpIIQTmRWirVyQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.844.0", + "@aws-sdk/credential-provider-node": "3.844.0", + "@aws-sdk/middleware-host-header": "3.840.0", + "@aws-sdk/middleware-logger": "3.840.0", + "@aws-sdk/middleware-recursion-detection": "3.840.0", + "@aws-sdk/middleware-user-agent": "3.844.0", + "@aws-sdk/region-config-resolver": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@aws-sdk/util-endpoints": "3.844.0", + "@aws-sdk/util-user-agent-browser": "3.840.0", + "@aws-sdk/util-user-agent-node": "3.844.0", + "@smithy/config-resolver": "^4.1.4", + "@smithy/core": "^3.7.0", + "@smithy/eventstream-serde-browser": "^4.0.4", + "@smithy/eventstream-serde-config-resolver": "^4.1.2", + "@smithy/eventstream-serde-node": "^4.0.4", + "@smithy/fetch-http-handler": "^5.1.0", + "@smithy/hash-node": "^4.0.4", + "@smithy/invalid-dependency": "^4.0.4", + "@smithy/middleware-content-length": "^4.0.4", + "@smithy/middleware-endpoint": "^4.1.14", + "@smithy/middleware-retry": "^4.1.15", + "@smithy/middleware-serde": "^4.0.8", + "@smithy/middleware-stack": "^4.0.4", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/node-http-handler": "^4.1.0", + "@smithy/protocol-http": "^5.1.2", + "@smithy/smithy-client": "^4.4.6", + "@smithy/types": "^4.3.1", + "@smithy/url-parser": "^4.0.4", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-body-length-browser": "^4.0.0", + "@smithy/util-body-length-node": "^4.0.0", + "@smithy/util-defaults-mode-browser": "^4.0.22", + "@smithy/util-defaults-mode-node": "^4.0.22", + "@smithy/util-endpoints": "^3.0.6", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-retry": "^4.0.6", + "@smithy/util-stream": "^4.2.3", + "@smithy/util-utf8": "^4.0.0", + "@smithy/util-waiter": "^4.0.6", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/client-sso": { + "version": "3.844.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.844.0.tgz", + "integrity": "sha512-FktodSx+pfUfIqMjoNwZ6t1xqq/G3cfT7I4JJ0HKHoIIZdoCHQB52x0OzKDtHDJAnEQPInasdPS8PorZBZtHmg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.844.0", + "@aws-sdk/middleware-host-header": "3.840.0", + "@aws-sdk/middleware-logger": "3.840.0", + "@aws-sdk/middleware-recursion-detection": "3.840.0", + "@aws-sdk/middleware-user-agent": "3.844.0", + "@aws-sdk/region-config-resolver": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@aws-sdk/util-endpoints": "3.844.0", + "@aws-sdk/util-user-agent-browser": "3.840.0", + "@aws-sdk/util-user-agent-node": "3.844.0", + "@smithy/config-resolver": "^4.1.4", + "@smithy/core": "^3.7.0", + "@smithy/fetch-http-handler": "^5.1.0", + "@smithy/hash-node": "^4.0.4", + "@smithy/invalid-dependency": "^4.0.4", + "@smithy/middleware-content-length": "^4.0.4", + "@smithy/middleware-endpoint": "^4.1.14", + "@smithy/middleware-retry": "^4.1.15", + "@smithy/middleware-serde": "^4.0.8", + "@smithy/middleware-stack": "^4.0.4", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/node-http-handler": "^4.1.0", + "@smithy/protocol-http": "^5.1.2", + "@smithy/smithy-client": "^4.4.6", + "@smithy/types": "^4.3.1", + "@smithy/url-parser": "^4.0.4", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-body-length-browser": "^4.0.0", + "@smithy/util-body-length-node": "^4.0.0", + "@smithy/util-defaults-mode-browser": "^4.0.22", + "@smithy/util-defaults-mode-node": "^4.0.22", + "@smithy/util-endpoints": "^3.0.6", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-retry": "^4.0.6", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/core": { + "version": "3.844.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.844.0.tgz", + "integrity": "sha512-pfpI54bG5Xf2NkqrDBC2REStXlDXNCw/whORhkEs+Tp5exU872D5QKguzjPA6hH+8Pvbq1qgt5zXMbduISTHJw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@aws-sdk/xml-builder": "3.821.0", + "@smithy/core": "^3.7.0", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/property-provider": "^4.0.4", + "@smithy/protocol-http": "^5.1.2", + "@smithy/signature-v4": "^5.1.2", + "@smithy/smithy-client": "^4.4.6", + "@smithy/types": "^4.3.1", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-body-length-browser": "^4.0.0", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-utf8": "^4.0.0", + "fast-xml-parser": "5.2.5", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-env": { + "version": "3.844.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.844.0.tgz", + "integrity": "sha512-WB94Ox86MqcZ4CnRjKgopzaSuZH4hMP0GqdOxG4s1it1lRWOIPOHOC1dPiM0Zbj1uqITIhbXUQVXyP/uaJeNkw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.844.0", + "@aws-sdk/types": "3.840.0", + "@smithy/property-provider": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-http": { + "version": "3.844.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.844.0.tgz", + "integrity": "sha512-e+efVqfkhpM8zxYeiLNgTUlX+tmtXzVm3bw1A02U9Z9cWBHyQNb8pi90M7QniLoqRURY1B0C2JqkOE61gd4KNg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.844.0", + "@aws-sdk/types": "3.840.0", + "@smithy/fetch-http-handler": "^5.1.0", + "@smithy/node-http-handler": "^4.1.0", + "@smithy/property-provider": "^4.0.4", + "@smithy/protocol-http": "^5.1.2", + "@smithy/smithy-client": "^4.4.6", + "@smithy/types": "^4.3.1", + "@smithy/util-stream": "^4.2.3", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-ini": { + "version": "3.844.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.844.0.tgz", + "integrity": "sha512-jc5ArGz2HfAx5QPXD+Ep36+QWyCKzl2TG6Vtl87/vljfLhVD0gEHv8fRsqWEp3Rc6hVfKnCjLW5ayR2HYcow9w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.844.0", + "@aws-sdk/credential-provider-env": "3.844.0", + "@aws-sdk/credential-provider-http": "3.844.0", + "@aws-sdk/credential-provider-process": "3.844.0", + "@aws-sdk/credential-provider-sso": "3.844.0", + "@aws-sdk/credential-provider-web-identity": "3.844.0", + "@aws-sdk/nested-clients": "3.844.0", + "@aws-sdk/types": "3.840.0", + "@smithy/credential-provider-imds": "^4.0.6", + "@smithy/property-provider": "^4.0.4", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-node": { + "version": "3.844.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.844.0.tgz", + "integrity": "sha512-pUqB0StTNyW0R03XjTA3wrQZcie/7FJKSXlYHue921ZXuhLOZpzyDkLNfdRsZTcEoYYWVPSmyS+Eu/g5yVsBNA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/credential-provider-env": "3.844.0", + "@aws-sdk/credential-provider-http": "3.844.0", + "@aws-sdk/credential-provider-ini": "3.844.0", + "@aws-sdk/credential-provider-process": "3.844.0", + "@aws-sdk/credential-provider-sso": "3.844.0", + "@aws-sdk/credential-provider-web-identity": "3.844.0", + "@aws-sdk/types": "3.840.0", + "@smithy/credential-provider-imds": "^4.0.6", + "@smithy/property-provider": "^4.0.4", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-process": { + "version": "3.844.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.844.0.tgz", + "integrity": "sha512-VCI8XvIDt2WBfk5Gi/wXKPcWTS3OkAbovB66oKcNQalllH8ESDg4SfLNhchdnN8A5sDGj6tIBJ19nk+dQ6GaqQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.844.0", + "@aws-sdk/types": "3.840.0", + "@smithy/property-provider": "^4.0.4", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-sso": { + "version": "3.844.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.844.0.tgz", + "integrity": "sha512-UNp/uWufGlb5nWa4dpc6uQnDOB/9ysJJFG95ACowNVL9XWfi1LJO7teKrqNkVhq0CzSJS1tCt3FvX4UfM+aN1g==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/client-sso": "3.844.0", + "@aws-sdk/core": "3.844.0", + "@aws-sdk/token-providers": "3.844.0", + "@aws-sdk/types": "3.840.0", + "@smithy/property-provider": "^4.0.4", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-web-identity": { + "version": "3.844.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.844.0.tgz", + "integrity": "sha512-iDmX4pPmatjttIScdspZRagaFnCjpHZIEEwTyKdXxUaU0iAOSXF8ecrCEvutETvImPOC86xdrq+MPacJOnMzUA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.844.0", + "@aws-sdk/nested-clients": "3.844.0", + "@aws-sdk/types": "3.840.0", + "@smithy/property-provider": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/middleware-host-header": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.840.0.tgz", + "integrity": "sha512-ub+hXJAbAje94+Ya6c6eL7sYujoE8D4Bumu1NUI8TXjUhVVn0HzVWQjpRLshdLsUp1AW7XyeJaxyajRaJQ8+Xg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/middleware-logger": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.840.0.tgz", + "integrity": "sha512-lSV8FvjpdllpGaRspywss4CtXV8M7NNNH+2/j86vMH+YCOZ6fu2T/TyFd/tHwZ92vDfHctWkRbQxg0bagqwovA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/middleware-recursion-detection": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.840.0.tgz", + "integrity": "sha512-Gu7lGDyfddyhIkj1Z1JtrY5NHb5+x/CRiB87GjaSrKxkDaydtX2CU977JIABtt69l9wLbcGDIQ+W0uJ5xPof7g==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/middleware-user-agent": { + "version": "3.844.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.844.0.tgz", + "integrity": "sha512-SIbDNUL6ZYXPj5Tk0qEz05sW9kNS1Gl3/wNWEmH+AuUACipkyIeKKWzD6z5433MllETh73vtka/JQF3g7AuZww==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.844.0", + "@aws-sdk/types": "3.840.0", + "@aws-sdk/util-endpoints": "3.844.0", + "@smithy/core": "^3.7.0", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/nested-clients": { + "version": "3.844.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/nested-clients/-/nested-clients-3.844.0.tgz", + "integrity": "sha512-p2XILWc7AcevUSpBg2VtQrk79eWQC4q2JsCSY7HxKpFLZB4mMOfmiTyYkR1gEA6AttK/wpCOtfz+hi1/+z2V1A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.844.0", + "@aws-sdk/middleware-host-header": "3.840.0", + "@aws-sdk/middleware-logger": "3.840.0", + "@aws-sdk/middleware-recursion-detection": "3.840.0", + "@aws-sdk/middleware-user-agent": "3.844.0", + "@aws-sdk/region-config-resolver": "3.840.0", + "@aws-sdk/types": "3.840.0", + "@aws-sdk/util-endpoints": "3.844.0", + "@aws-sdk/util-user-agent-browser": "3.840.0", + "@aws-sdk/util-user-agent-node": "3.844.0", + "@smithy/config-resolver": "^4.1.4", + "@smithy/core": "^3.7.0", + "@smithy/fetch-http-handler": "^5.1.0", + "@smithy/hash-node": "^4.0.4", + "@smithy/invalid-dependency": "^4.0.4", + "@smithy/middleware-content-length": "^4.0.4", + "@smithy/middleware-endpoint": "^4.1.14", + "@smithy/middleware-retry": "^4.1.15", + "@smithy/middleware-serde": "^4.0.8", + "@smithy/middleware-stack": "^4.0.4", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/node-http-handler": "^4.1.0", + "@smithy/protocol-http": "^5.1.2", + "@smithy/smithy-client": "^4.4.6", + "@smithy/types": "^4.3.1", + "@smithy/url-parser": "^4.0.4", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-body-length-browser": "^4.0.0", + "@smithy/util-body-length-node": "^4.0.0", + "@smithy/util-defaults-mode-browser": "^4.0.22", + "@smithy/util-defaults-mode-node": "^4.0.22", + "@smithy/util-endpoints": "^3.0.6", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-retry": "^4.0.6", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/region-config-resolver": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/region-config-resolver/-/region-config-resolver-3.840.0.tgz", + "integrity": "sha512-Qjnxd/yDv9KpIMWr90ZDPtRj0v75AqGC92Lm9+oHXZ8p1MjG5JE2CW0HL8JRgK9iKzgKBL7pPQRXI8FkvEVfrA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/types": "^4.3.1", + "@smithy/util-config-provider": "^4.0.0", + "@smithy/util-middleware": "^4.0.4", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/token-providers": { + "version": "3.844.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.844.0.tgz", + "integrity": "sha512-Kh728FEny0fil+LeH8U1offPJCTd/EDh8liBAvLtViLHt2WoX2xC8rk98D38Q5p79aIUhHb3Pf4n9IZfTu/Kog==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "3.844.0", + "@aws-sdk/nested-clients": "3.844.0", + "@aws-sdk/types": "3.840.0", + "@smithy/property-provider": "^4.0.4", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/types": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.840.0.tgz", + "integrity": "sha512-xliuHaUFZxEx1NSXeLLZ9Dyu6+EJVQKEoD+yM+zqUo3YDZ7medKJWY6fIOKiPX/N7XbLdBYwajb15Q7IL8KkeA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/util-endpoints": { + "version": "3.844.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.844.0.tgz", + "integrity": "sha512-1DHh0WTUmxlysz3EereHKtKoxVUG9UC5BsfAw6Bm4/6qDlJiqtY3oa2vebkYN23yltKdfsCK65cwnBRU59mWVg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/types": "^4.3.1", + "@smithy/url-parser": "^4.0.4", + "@smithy/util-endpoints": "^3.0.6", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/util-locate-window": { + "version": "3.804.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-locate-window/-/util-locate-window-3.804.0.tgz", + "integrity": "sha512-zVoRfpmBVPodYlnMjgVjfGoEZagyRF5IPn3Uo6ZvOZp24chnW/FRstH7ESDHDDRga4z3V+ElUQHKpFDXWyBW5A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/util-user-agent-browser": { + "version": "3.840.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.840.0.tgz", + "integrity": "sha512-JdyZM3EhhL4PqwFpttZu1afDpPJCCc3eyZOLi+srpX11LsGj6sThf47TYQN75HT1CarZ7cCdQHGzP2uy3/xHfQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.840.0", + "@smithy/types": "^4.3.1", + "bowser": "^2.11.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-sdk/util-user-agent-node": { + "version": "3.844.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.844.0.tgz", + "integrity": "sha512-0eTpURp9Gxbyyeqr78ogARZMSWS5KUMZuN+XMHxNpQLmn2S+J3g+MAyoklCcwhKXlbdQq2aMULEiy0mqIWytuw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/middleware-user-agent": "3.844.0", + "@aws-sdk/types": "3.840.0", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "aws-crt": ">=1.0.0" + }, + "peerDependenciesMeta": { + "aws-crt": { + "optional": true + } + } + }, + "node_modules/@aws-sdk/util-utf8-browser": { + "version": "3.259.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-utf8-browser/-/util-utf8-browser-3.259.0.tgz", + "integrity": "sha512-UvFa/vR+e19XookZF8RzFZBrw2EUkQWxiBW0yYQAhvk3C+QVGl0H3ouca8LDBlBfQKXwmW3huo/59H8rwb1wJw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.3.1" + } + }, + "node_modules/@aws-sdk/xml-builder": { + "version": "3.821.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/xml-builder/-/xml-builder-3.821.0.tgz", + "integrity": "sha512-DIIotRnefVL6DiaHtO6/21DhJ4JZnnIwdNbpwiAhdt/AVbttcE4yw925gsjur0OGv5BTYXQXU3YnANBYnZjuQA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@bytecodealliance/preview2-shim": { + "version": "0.17.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.17.2.tgz", + "integrity": "sha512-mNm/lblgES8UkVle8rGImXOz4TtL3eU3inHay/7TVchkKrb/lgcVvTK0+VAw8p5zQ0rgQsXm1j5dOlAAd+MeoA==", + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)" + }, + "node_modules/@colors/colors": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", + "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@ethereumjs/rlp": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-5.0.2.tgz", + "integrity": "sha512-DziebCdg4JpGlEqEdGgXmjqcFoJi+JGulUXwEjsZGAscAQ7MyD/7LE/GVCP29vEQxKc7AAwjT3A2ywHp2xfoCA==", + "dev": true, + "license": "MPL-2.0", + "bin": { + "rlp": "bin/rlp.cjs" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@ethereumjs/util": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/util/-/util-9.1.0.tgz", + "integrity": "sha512-XBEKsYqLGXLah9PNJbgdkigthkG7TAGvlD/sH12beMXEyHDyigfcbdvHhmLyDWgDyOJn4QwiQUaF7yeuhnjdog==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "@ethereumjs/rlp": "^5.0.2", + "ethereum-cryptography": "^2.2.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@ethereumjs/util/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@ethereumjs/util/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@ethereumjs/util/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@ethereumjs/util/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@ethereumjs/util/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@ethereumjs/util/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/@ethersproject/abi": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.8.0.tgz", + "integrity": "sha512-b9YS/43ObplgyV6SlyQsG53/vkSal0MNA1fskSC4mbnCMi8R+NkcH8K9FPYNESf6jUefBUniE4SOKms0E/KK1Q==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/address": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/constants": "^5.8.0", + "@ethersproject/hash": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/strings": "^5.8.0" + } + }, + "node_modules/@ethersproject/abstract-provider": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.8.0.tgz", + "integrity": "sha512-wC9SFcmh4UK0oKuLJQItoQdzS/qZ51EJegK6EmAWlh+OptpQ/npECOR3QqECd8iGHC0RJb4WKbVdSfif4ammrg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/networks": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/transactions": "^5.8.0", + "@ethersproject/web": "^5.8.0" + } + }, + "node_modules/@ethersproject/abstract-signer": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.8.0.tgz", + "integrity": "sha512-N0XhZTswXcmIZQdYtUnd79VJzvEwXQw6PK0dTl9VoYrEBxxCPXqS0Eod7q5TNKRxe1/5WUMuR0u0nqTF/avdCA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/abstract-provider": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0" + } + }, + "node_modules/@ethersproject/address": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.8.0.tgz", + "integrity": "sha512-GhH/abcC46LJwshoN+uBNoKVFPxUuZm6dA257z0vZkKmU1+t8xTn8oK7B9qrj8W2rFRMch4gbJl6PmVxjxBEBA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/rlp": "^5.8.0" + } + }, + "node_modules/@ethersproject/base64": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.8.0.tgz", + "integrity": "sha512-lN0oIwfkYj9LbPx4xEkie6rAMJtySbpOAFXSDVQaBnAzYfB4X2Qr+FXJGxMoc3Bxp2Sm8OwvzMrywxyw0gLjIQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.8.0" + } + }, + "node_modules/@ethersproject/basex": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.8.0.tgz", + "integrity": "sha512-PIgTszMlDRmNwW9nhS6iqtVfdTAKosA7llYXNmGPw4YAI1PUyMv28988wAb41/gHF/WqGdoLv0erHaRcHRKW2Q==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/properties": "^5.8.0" + } + }, + "node_modules/@ethersproject/bignumber": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.8.0.tgz", + "integrity": "sha512-ZyaT24bHaSeJon2tGPKIiHszWjD/54Sz8t57Toch475lCLljC6MgPmxk7Gtzz+ddNN5LuHea9qhAe0x3D+uYPA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "bn.js": "^5.2.1" + } + }, + "node_modules/@ethersproject/bytes": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.8.0.tgz", + "integrity": "sha512-vTkeohgJVCPVHu5c25XWaWQOZ4v+DkGoC42/TS2ond+PARCxTJvgTFUNDZovyQ/uAQ4EcpqqowKydcdmRKjg7A==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/logger": "^5.8.0" + } + }, + "node_modules/@ethersproject/constants": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.8.0.tgz", + "integrity": "sha512-wigX4lrf5Vu+axVTIvNsuL6YrV4O5AXl5ubcURKMEME5TnWBouUh0CDTWxZ2GpnRn1kcCgE7l8O5+VbV9QTTcg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bignumber": "^5.8.0" + } + }, + "node_modules/@ethersproject/hash": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.8.0.tgz", + "integrity": "sha512-ac/lBcTbEWW/VGJij0CNSw/wPcw9bSRgCB0AIBz8CvED/jfvDoV9hsIIiWfvWmFEi8RcXtlNwp2jv6ozWOsooA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/abstract-signer": "^5.8.0", + "@ethersproject/address": "^5.8.0", + "@ethersproject/base64": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/strings": "^5.8.0" + } + }, + "node_modules/@ethersproject/keccak256": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.8.0.tgz", + "integrity": "sha512-A1pkKLZSz8pDaQ1ftutZoaN46I6+jvuqugx5KYNeQOPqq+JZ0Txm7dlWesCHB5cndJSu5vP2VKptKf7cksERng==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.8.0", + "js-sha3": "0.8.0" + } + }, + "node_modules/@ethersproject/logger": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.8.0.tgz", + "integrity": "sha512-Qe6knGmY+zPPWTC+wQrpitodgBfH7XoceCGL5bJVejmH+yCS3R8jJm8iiWuvWbG76RUmyEG53oqv6GMVWqunjA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT" + }, + "node_modules/@ethersproject/networks": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.8.0.tgz", + "integrity": "sha512-egPJh3aPVAzbHwq8DD7Po53J4OUSsA1MjQp8Vf/OZPav5rlmWUaFLiq8cvQiGK0Z5K6LYzm29+VA/p4RL1FzNg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/logger": "^5.8.0" + } + }, + "node_modules/@ethersproject/properties": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.8.0.tgz", + "integrity": "sha512-PYuiEoQ+FMaZZNGrStmN7+lWjlsoufGIHdww7454FIaGdbe/p5rnaCXTr5MtBYl3NkeoVhHZuyzChPeGeKIpQw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/logger": "^5.8.0" + } + }, + "node_modules/@ethersproject/providers": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.8.0.tgz", + "integrity": "sha512-3Il3oTzEx3o6kzcg9ZzbE+oCZYyY+3Zh83sKkn4s1DZfTUjIegHnN2Cm0kbn9YFy45FDVcuCLLONhU7ny0SsCw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/abstract-provider": "^5.8.0", + "@ethersproject/abstract-signer": "^5.8.0", + "@ethersproject/address": "^5.8.0", + "@ethersproject/base64": "^5.8.0", + "@ethersproject/basex": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/constants": "^5.8.0", + "@ethersproject/hash": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/networks": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/random": "^5.8.0", + "@ethersproject/rlp": "^5.8.0", + "@ethersproject/sha2": "^5.8.0", + "@ethersproject/strings": "^5.8.0", + "@ethersproject/transactions": "^5.8.0", + "@ethersproject/web": "^5.8.0", + "bech32": "1.1.4", + "ws": "8.18.0" + } + }, + "node_modules/@ethersproject/providers/node_modules/ws": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/@ethersproject/random": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.8.0.tgz", + "integrity": "sha512-E4I5TDl7SVqyg4/kkA/qTfuLWAQGXmSOgYyO01So8hLfwgKvYK5snIlzxJMk72IFdG/7oh8yuSqY2KX7MMwg+A==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0" + } + }, + "node_modules/@ethersproject/rlp": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.8.0.tgz", + "integrity": "sha512-LqZgAznqDbiEunaUvykH2JAoXTT9NV0Atqk8rQN9nx9SEgThA/WMx5DnW8a9FOufo//6FZOCHZ+XiClzgbqV9Q==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0" + } + }, + "node_modules/@ethersproject/sha2": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.8.0.tgz", + "integrity": "sha512-dDOUrXr9wF/YFltgTBYS0tKslPEKr6AekjqDW2dbn1L1xmjGR+9GiKu4ajxovnrDbwxAKdHjW8jNcwfz8PAz4A==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "hash.js": "1.1.7" + } + }, + "node_modules/@ethersproject/signing-key": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.8.0.tgz", + "integrity": "sha512-LrPW2ZxoigFi6U6aVkFN/fa9Yx/+4AtIUe4/HACTvKJdhm0eeb107EVCIQcrLZkxaSIgc/eCrX8Q1GtbH+9n3w==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "bn.js": "^5.2.1", + "elliptic": "6.6.1", + "hash.js": "1.1.7" + } + }, + "node_modules/@ethersproject/strings": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.8.0.tgz", + "integrity": "sha512-qWEAk0MAvl0LszjdfnZ2uC8xbR2wdv4cDabyHiBh3Cldq/T8dPH3V4BbBsAYJUeonwD+8afVXld274Ls+Y1xXg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/constants": "^5.8.0", + "@ethersproject/logger": "^5.8.0" + } + }, + "node_modules/@ethersproject/transactions": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.8.0.tgz", + "integrity": "sha512-UglxSDjByHG0TuU17bDfCemZ3AnKO2vYrL5/2n2oXvKzvb7Cz+W9gOWXKARjp2URVwcWlQlPOEQyAviKwT4AHg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/address": "^5.8.0", + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/constants": "^5.8.0", + "@ethersproject/keccak256": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/rlp": "^5.8.0", + "@ethersproject/signing-key": "^5.8.0" + } + }, + "node_modules/@ethersproject/units": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.8.0.tgz", + "integrity": "sha512-lxq0CAnc5kMGIiWW4Mr041VT8IhNM+Pn5T3haO74XZWFulk7wH1Gv64HqE96hT4a7iiNMdOCFEBgaxWuk8ETKQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/bignumber": "^5.8.0", + "@ethersproject/constants": "^5.8.0", + "@ethersproject/logger": "^5.8.0" + } + }, + "node_modules/@ethersproject/web": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.8.0.tgz", + "integrity": "sha512-j7+Ksi/9KfGviws6Qtf9Q7KCqRhpwrYKQPs+JBA/rKVFF/yaWLHJEH3zfVP2plVu+eys0d2DlFmhoQJayFewcw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@ethersproject/base64": "^5.8.0", + "@ethersproject/bytes": "^5.8.0", + "@ethersproject/logger": "^5.8.0", + "@ethersproject/properties": "^5.8.0", + "@ethersproject/strings": "^5.8.0" + } + }, + "node_modules/@fastify/busboy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + } + }, + "node_modules/@isaacs/balanced-match": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", + "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@isaacs/brace-expansion": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz", + "integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@isaacs/balanced-match": "^4.0.1" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.4.tgz", + "integrity": "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@noble/ciphers": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz", + "integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/curves": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", + "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.3.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/secp256k1": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", + "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT" + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nomicfoundation/edr": { + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr/-/edr-0.11.3.tgz", + "integrity": "sha512-kqILRkAd455Sd6v8mfP3C1/0tCOynJWY+Ir+k/9Boocu2kObCrsFgG+ZWB7fSBVdd9cPVSNrnhWS+V+PEo637g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nomicfoundation/edr-darwin-arm64": "0.11.3", + "@nomicfoundation/edr-darwin-x64": "0.11.3", + "@nomicfoundation/edr-linux-arm64-gnu": "0.11.3", + "@nomicfoundation/edr-linux-arm64-musl": "0.11.3", + "@nomicfoundation/edr-linux-x64-gnu": "0.11.3", + "@nomicfoundation/edr-linux-x64-musl": "0.11.3", + "@nomicfoundation/edr-win32-x64-msvc": "0.11.3" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@nomicfoundation/edr-darwin-arm64": { + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.11.3.tgz", + "integrity": "sha512-w0tksbdtSxz9nuzHKsfx4c2mwaD0+l5qKL2R290QdnN9gi9AV62p9DHkOgfBdyg6/a6ZlnQqnISi7C9avk/6VA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + } + }, + "node_modules/@nomicfoundation/edr-darwin-x64": { + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.11.3.tgz", + "integrity": "sha512-QR4jAFrPbOcrO7O2z2ESg+eUeIZPe2bPIlQYgiJ04ltbSGW27FblOzdd5+S3RoOD/dsZGKAvvy6dadBEl0NgoA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + } + }, + "node_modules/@nomicfoundation/edr-linux-arm64-gnu": { + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.11.3.tgz", + "integrity": "sha512-Ktjv89RZZiUmOFPspuSBVJ61mBZQ2+HuLmV67InNlh9TSUec/iDjGIwAn59dx0bF/LOSrM7qg5od3KKac4LJDQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + } + }, + "node_modules/@nomicfoundation/edr-linux-arm64-musl": { + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.11.3.tgz", + "integrity": "sha512-B3sLJx1rL2E9pfdD4mApiwOZSrX0a/KQSBWdlq1uAhFKqkl00yZaY4LejgZndsJAa4iKGQJlGnw4HCGeVt0+jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + } + }, + "node_modules/@nomicfoundation/edr-linux-x64-gnu": { + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.11.3.tgz", + "integrity": "sha512-D/4cFKDXH6UYyKPu6J3Y8TzW11UzeQI0+wS9QcJzjlrrfKj0ENW7g9VihD1O2FvXkdkTjcCZYb6ai8MMTCsaVw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + } + }, + "node_modules/@nomicfoundation/edr-linux-x64-musl": { + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.11.3.tgz", + "integrity": "sha512-ergXuIb4nIvmf+TqyiDX5tsE49311DrBky6+jNLgsGDTBaN1GS3OFwFS8I6Ri/GGn6xOaT8sKu3q7/m+WdlFzg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + } + }, + "node_modules/@nomicfoundation/edr-win32-x64-msvc": { + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.11.3.tgz", + "integrity": "sha512-snvEf+WB3OV0wj2A7kQ+ZQqBquMcrozSLXcdnMdEl7Tmn+KDCbmFKBt3Tk0X3qOU4RKQpLPnTxdM07TJNVtung==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + } + }, + "node_modules/@nomicfoundation/hardhat-chai-matchers": { + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-chai-matchers/-/hardhat-chai-matchers-2.0.9.tgz", + "integrity": "sha512-AbCoBuTKMlwlf1lesSmi/4VvJHNG9EP13EmkCJ+MJS1SBdtVtU4YrBbdYmnYPEvRFcAIMFB/cwcQGmuBYeCoVg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@types/chai-as-promised": "^7.1.3", + "chai-as-promised": "^7.1.1", + "deep-eql": "^4.0.1", + "ordinal": "^1.0.3" + }, + "peerDependencies": { + "@nomicfoundation/hardhat-ethers": "^3.0.9", + "chai": "^4.2.0", + "ethers": "^6.14.0", + "hardhat": "^2.9.4" + } + }, + "node_modules/@nomicfoundation/hardhat-ethers": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-ethers/-/hardhat-ethers-3.0.9.tgz", + "integrity": "sha512-xBJdRUiCwKpr0OYrOzPwAyNGtsVzoBx32HFPJVv6S+sFA9TmBIBDaqNlFPmBH58ZjgNnGhEr/4oBZvGr4q4TjQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "debug": "^4.1.1", + "lodash.isequal": "^4.5.0" + }, + "peerDependencies": { + "ethers": "^6.14.0", + "hardhat": "^2.0.0" + } + }, + "node_modules/@nomicfoundation/hardhat-ignition": { + "version": "0.15.12", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-ignition/-/hardhat-ignition-0.15.12.tgz", + "integrity": "sha512-T03bSjFy8vWeKGvFsR42vzl4PgmW06i1e/84m2oowZzdO3i9ax3XJhRiH4kC08QXzkdAdUPinx68hQea8Wh6Jw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@nomicfoundation/ignition-core": "^0.15.12", + "@nomicfoundation/ignition-ui": "^0.15.11", + "chalk": "^4.0.0", + "debug": "^4.3.2", + "fs-extra": "^10.0.0", + "json5": "^2.2.3", + "prompts": "^2.4.2" + }, + "peerDependencies": { + "@nomicfoundation/hardhat-verify": "^2.0.1", + "hardhat": "^2.18.0" + } + }, + "node_modules/@nomicfoundation/hardhat-ignition-ethers": { + "version": "0.15.13", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-ignition-ethers/-/hardhat-ignition-ethers-0.15.13.tgz", + "integrity": "sha512-fJuImb0KBbsylTL5M1DdlChIO/GZoms2NUVJhU+AvfhlgB0jzRH+9jSXE9izYPktd8//tdVSC4kJloJPrR+BlA==", + "dev": true, + "license": "MIT", + "peer": true, + "peerDependencies": { + "@nomicfoundation/hardhat-ethers": "^3.0.9", + "@nomicfoundation/hardhat-ignition": "^0.15.12", + "@nomicfoundation/ignition-core": "^0.15.12", + "ethers": "^6.14.0", + "hardhat": "^2.18.0" + } + }, + "node_modules/@nomicfoundation/hardhat-network-helpers": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-network-helpers/-/hardhat-network-helpers-1.0.13.tgz", + "integrity": "sha512-ptg0+SH8jnfoYHlR3dKWTNTB43HZSxkuy3OeDk+AufEKQvQ7Ru9LQEbJtLuDTQ4HGRBkhl4oJ9RABsEIbn7Taw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "ethereumjs-util": "^7.1.4" + }, + "peerDependencies": { + "hardhat": "^2.9.5" + } + }, + "node_modules/@nomicfoundation/hardhat-toolbox": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-toolbox/-/hardhat-toolbox-6.0.0.tgz", + "integrity": "sha512-3qm3VuDp5xD8UyfhYPPfZHnCc0M/V5yfRSTSDdOuI8DTrmYJkMNW7QrTNGalMCigWn3suBghSw9YcMOyGDJ7Lg==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@nomicfoundation/hardhat-chai-matchers": "^2.0.0", + "@nomicfoundation/hardhat-ethers": "^3.0.0", + "@nomicfoundation/hardhat-ignition-ethers": "^0.15.0", + "@nomicfoundation/hardhat-network-helpers": "^1.0.0", + "@nomicfoundation/hardhat-verify": "^2.0.0", + "@typechain/ethers-v6": "^0.5.0", + "@typechain/hardhat": "^9.0.0", + "@types/chai": "^4.2.0", + "@types/mocha": ">=9.1.0", + "@types/node": ">=18.0.0", + "chai": "^4.2.0", + "ethers": "^6.14.0", + "hardhat": "^2.11.0", + "hardhat-gas-reporter": "^2.3.0", + "solidity-coverage": "^0.8.1", + "ts-node": ">=8.0.0", + "typechain": "^8.3.0", + "typescript": ">=4.5.0" + } + }, + "node_modules/@nomicfoundation/hardhat-verify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-verify/-/hardhat-verify-2.1.0.tgz", + "integrity": "sha512-ogRbwlzphOR2MK/TxDG/uOftEhVJtD81eBU32YZ/maqQOHYOPKymu7BvF9syp7b2fxID5/loEIvxizjW1yBvvQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ethersproject/abi": "^5.1.2", + "@ethersproject/address": "^5.0.2", + "cbor": "^8.1.0", + "debug": "^4.1.1", + "lodash.clonedeep": "^4.5.0", + "picocolors": "^1.1.0", + "semver": "^6.3.0", + "table": "^6.8.0", + "undici": "^5.14.0" + }, + "peerDependencies": { + "hardhat": "^2.26.0" + } + }, + "node_modules/@nomicfoundation/ignition-core": { + "version": "0.15.12", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ignition-core/-/ignition-core-0.15.12.tgz", + "integrity": "sha512-JJdyoyfM5RXaUqv4c2V/8xpuui4uqJbMCvVnEhgo6FMOK6bqj8wGP6hM4gNE5TLug6ZUCdjIB8kFpofl21RycQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/address": "5.6.1", + "@nomicfoundation/solidity-analyzer": "^0.1.1", + "cbor": "^9.0.0", + "debug": "^4.3.2", + "ethers": "^6.14.0", + "fs-extra": "^10.0.0", + "immer": "10.0.2", + "lodash": "4.17.21", + "ndjson": "2.0.0" + } + }, + "node_modules/@nomicfoundation/ignition-core/node_modules/@ethersproject/address": { + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.6.1.tgz", + "integrity": "sha512-uOgF0kS5MJv9ZvCz7x6T2EXJSzotiybApn4XlOgoTX0xdtyVIJ7pF+6cGPxiEq/dpBiTfMiw7Yc81JcwhSYA0Q==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/rlp": "^5.6.1" + } + }, + "node_modules/@nomicfoundation/ignition-core/node_modules/cbor": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/cbor/-/cbor-9.0.2.tgz", + "integrity": "sha512-JPypkxsB10s9QOWwa6zwPzqE1Md3vqpPc+cai4sAecuCsRyAtAl/pMyhPlMbT/xtPnm2dznJZYRLui57qiRhaQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "nofilter": "^3.1.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@nomicfoundation/ignition-ui": { + "version": "0.15.11", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ignition-ui/-/ignition-ui-0.15.11.tgz", + "integrity": "sha512-VPOVl5xqCKhYCyPOQlposx+stjCwqXQ+BCs5lnw/f2YUfgII+G5Ye0JfHiJOfCJGmqyS03WertBslcj9zQg50A==", + "dev": true, + "peer": true + }, + "node_modules/@nomicfoundation/slang": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang/-/slang-1.2.0.tgz", + "integrity": "sha512-+04Z1RHbbz0ldDbHKQFOzveCdI9Rd3TZZu7fno5hHy3OsqTo9UK5Jgqo68wMvRovCO99POv6oCEyO7+urGeN8Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@bytecodealliance/preview2-shim": "0.17.2" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer/-/solidity-analyzer-0.1.2.tgz", + "integrity": "sha512-q4n32/FNKIhQ3zQGGw5CvPF6GTvDCpYwIf7bEY/dZTZbgfDsHyjJwURxUJf3VQuuJj+fDIFl4+KkBVbw4Ef6jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12" + }, + "optionalDependencies": { + "@nomicfoundation/solidity-analyzer-darwin-arm64": "0.1.2", + "@nomicfoundation/solidity-analyzer-darwin-x64": "0.1.2", + "@nomicfoundation/solidity-analyzer-linux-arm64-gnu": "0.1.2", + "@nomicfoundation/solidity-analyzer-linux-arm64-musl": "0.1.2", + "@nomicfoundation/solidity-analyzer-linux-x64-gnu": "0.1.2", + "@nomicfoundation/solidity-analyzer-linux-x64-musl": "0.1.2", + "@nomicfoundation/solidity-analyzer-win32-x64-msvc": "0.1.2" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-darwin-arm64": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-darwin-arm64/-/solidity-analyzer-darwin-arm64-0.1.2.tgz", + "integrity": "sha512-JaqcWPDZENCvm++lFFGjrDd8mxtf+CtLd2MiXvMNTBD33dContTZ9TWETwNFwg7JTJT5Q9HEecH7FA+HTSsIUw==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-darwin-x64": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-darwin-x64/-/solidity-analyzer-darwin-x64-0.1.2.tgz", + "integrity": "sha512-fZNmVztrSXC03e9RONBT+CiksSeYcxI1wlzqyr0L7hsQlK1fzV+f04g2JtQ1c/Fe74ZwdV6aQBdd6Uwl1052sw==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-linux-arm64-gnu": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-arm64-gnu/-/solidity-analyzer-linux-arm64-gnu-0.1.2.tgz", + "integrity": "sha512-3d54oc+9ZVBuB6nbp8wHylk4xh0N0Gc+bk+/uJae+rUgbOBwQSfuGIbAZt1wBXs5REkSmynEGcqx6DutoK0tPA==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-linux-arm64-musl": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-arm64-musl/-/solidity-analyzer-linux-arm64-musl-0.1.2.tgz", + "integrity": "sha512-iDJfR2qf55vgsg7BtJa7iPiFAsYf2d0Tv/0B+vhtnI16+wfQeTbP7teookbGvAo0eJo7aLLm0xfS/GTkvHIucA==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-linux-x64-gnu": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-x64-gnu/-/solidity-analyzer-linux-x64-gnu-0.1.2.tgz", + "integrity": "sha512-9dlHMAt5/2cpWyuJ9fQNOUXFB/vgSFORg1jpjX1Mh9hJ/MfZXlDdHQ+DpFCs32Zk5pxRBb07yGvSHk9/fezL+g==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-linux-x64-musl": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-x64-musl/-/solidity-analyzer-linux-x64-musl-0.1.2.tgz", + "integrity": "sha512-GzzVeeJob3lfrSlDKQw2bRJ8rBf6mEYaWY+gW0JnTDHINA0s2gPR4km5RLIj1xeZZOYz4zRw+AEeYgLRqB2NXg==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-win32-x64-msvc": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-win32-x64-msvc/-/solidity-analyzer-win32-x64-msvc-0.1.2.tgz", + "integrity": "sha512-Fdjli4DCcFHb4Zgsz0uEJXZ2K7VEO+w5KVv7HmT7WO10iODdU9csC2az4jrhEsRtiR9Gfd74FlG0NYlw1BMdyA==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@openzeppelin/contracts": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-5.3.0.tgz", + "integrity": "sha512-zj/KGoW7zxWUE8qOI++rUM18v+VeLTTzKs/DJFkSzHpQFPD/jKKF0TrMxBfGLl3kpdELCNccvB3zmofSzm4nlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@openzeppelin/defender-sdk": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk/-/defender-sdk-2.6.0.tgz", + "integrity": "sha512-ASluFiJFDcMBWkjLt5Ow4fAudVhgPB7xuMBGOR7YD9+jbU+zvEEuu3hDVaPSyPfyyKvXgrKWPLFMY7eVqZbGHg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@openzeppelin/defender-sdk-account-client": "^2.6.0", + "@openzeppelin/defender-sdk-action-client": "^2.6.0", + "@openzeppelin/defender-sdk-address-book-client": "^2.6.0", + "@openzeppelin/defender-sdk-approval-process-client": "^2.6.0", + "@openzeppelin/defender-sdk-base-client": "^2.6.0", + "@openzeppelin/defender-sdk-deploy-client": "^2.6.0", + "@openzeppelin/defender-sdk-key-value-store-client": "^2.6.0", + "@openzeppelin/defender-sdk-monitor-client": "^2.6.0", + "@openzeppelin/defender-sdk-network-client": "^2.6.0", + "@openzeppelin/defender-sdk-notification-channel-client": "^2.6.0", + "@openzeppelin/defender-sdk-proposal-client": "^2.6.0", + "@openzeppelin/defender-sdk-relay-client": "^2.6.0", + "@openzeppelin/defender-sdk-relay-group-client": "^2.6.0", + "@openzeppelin/defender-sdk-relay-signer-client": "^2.6.0" + } + }, + "node_modules/@openzeppelin/defender-sdk-account-client": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-account-client/-/defender-sdk-account-client-2.6.0.tgz", + "integrity": "sha512-+BvAcT51xhlZs4k9iEm7QLgqEjhveLNDROE7PON1Fh6NH4sGxRT03jW7Af3OyONVrpaMvCoguRSektCAs9eRtg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@openzeppelin/defender-sdk-base-client": "^2.6.0", + "axios": "^1.7.4", + "lodash": "^4.17.21" + } + }, + "node_modules/@openzeppelin/defender-sdk-action-client": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-action-client/-/defender-sdk-action-client-2.6.0.tgz", + "integrity": "sha512-9+zWuQ4wUfASGmAmc6f2nIH5hHeSOYZxQlmJqkCHWz+a+egliSp4kY46bo3tKdykFOIuodGQMVrs2bhl/jF10w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@openzeppelin/defender-sdk-base-client": "^2.6.0", + "axios": "^1.7.4", + "dotenv": "^16.3.1", + "glob": "^11.0.0", + "jszip": "^3.10.1", + "lodash": "^4.17.21" + }, + "bin": { + "defender-action": "lib/bin.js" + } + }, + "node_modules/@openzeppelin/defender-sdk-action-client/node_modules/dotenv": { + "version": "16.6.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz", + "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/@openzeppelin/defender-sdk-action-client/node_modules/glob": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.3.tgz", + "integrity": "sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.3.1", + "jackspeak": "^4.1.1", + "minimatch": "^10.0.3", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^2.0.0" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@openzeppelin/defender-sdk-action-client/node_modules/jackspeak": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.1.tgz", + "integrity": "sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@openzeppelin/defender-sdk-action-client/node_modules/lru-cache": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.1.0.tgz", + "integrity": "sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A==", + "dev": true, + "license": "ISC", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@openzeppelin/defender-sdk-action-client/node_modules/minimatch": { + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.3.tgz", + "integrity": "sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==", + "dev": true, + "license": "ISC", + "dependencies": { + "@isaacs/brace-expansion": "^5.0.0" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@openzeppelin/defender-sdk-action-client/node_modules/path-scurry": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", + "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@openzeppelin/defender-sdk-address-book-client": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-address-book-client/-/defender-sdk-address-book-client-2.6.0.tgz", + "integrity": "sha512-ZYCj2r/laiZNud5A/Q4HGcGisMedd1x8ACSl/FQAHB5fRdKy196I1IDxWM40QpJdogJALh5yUns7ycoqcVBfFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@openzeppelin/defender-sdk-base-client": "^2.6.0", + "dotenv": "^16.3.1", + "lodash": "^4.17.21" + } + }, + "node_modules/@openzeppelin/defender-sdk-address-book-client/node_modules/dotenv": { + "version": "16.6.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz", + "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/@openzeppelin/defender-sdk-approval-process-client": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-approval-process-client/-/defender-sdk-approval-process-client-2.6.0.tgz", + "integrity": "sha512-Sgu2ILGXmbV0LYSho50IN0jgUOoeWKgaZ/IVvOE4RoETng5QkQlp1C3UsXRUQZ//SdwUnqGtAi4jI2Zka34QLw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@openzeppelin/defender-sdk-base-client": "^2.6.0", + "axios": "^1.7.4", + "lodash": "^4.17.21" + } + }, + "node_modules/@openzeppelin/defender-sdk-base-client": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-base-client/-/defender-sdk-base-client-2.6.0.tgz", + "integrity": "sha512-adwCU4kSZGIrqNYyhgHJ3A1ZE95TAjqkXEzD/4p5YYQ3Sfq9evxgJSplri4Ek2zazdoc8VpzAXY9/sKFhRJtjA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@aws-sdk/client-lambda": "^3.563.0", + "amazon-cognito-identity-js": "^6.3.6", + "async-retry": "^1.3.3" + } + }, + "node_modules/@openzeppelin/defender-sdk-deploy-client": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-deploy-client/-/defender-sdk-deploy-client-2.6.0.tgz", + "integrity": "sha512-PoV+M5QS9Hh9PiLL+OURLczT83kO6vO6qcCquSEtmBm3zmlo1ZOepdiqKo+rcrn765QKW9u+FnC31HycicVJWw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@openzeppelin/defender-sdk-base-client": "^2.6.0", + "axios": "^1.7.4", + "lodash": "^4.17.21" + } + }, + "node_modules/@openzeppelin/defender-sdk-key-value-store-client": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-key-value-store-client/-/defender-sdk-key-value-store-client-2.6.0.tgz", + "integrity": "sha512-36vTykBsM9hkcAxV+aAoq408TJUFz68ACCcOzoTU6HgUFJJ0hoy2Q0ZWQXmNeRDSHgpB+VRIyho7qdao0HEYjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@openzeppelin/defender-sdk-base-client": "^2.6.0", + "axios": "^1.7.4", + "fs-extra": "^11.2.0", + "lodash": "^4.17.21" + } + }, + "node_modules/@openzeppelin/defender-sdk-key-value-store-client/node_modules/fs-extra": { + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz", + "integrity": "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/@openzeppelin/defender-sdk-monitor-client": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-monitor-client/-/defender-sdk-monitor-client-2.6.0.tgz", + "integrity": "sha512-IEjnPa9go81ULUAOtH+5uq82cjveXoCdcJaT4rzt/wSb0vrCJ48UBXTZe69DBKaOPIpXyo9I/ItRBT24l6EoGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@openzeppelin/defender-sdk-base-client": "^2.6.0", + "axios": "^1.7.4", + "ethers": "^6.9.0", + "lodash": "^4.17.21" + } + }, + "node_modules/@openzeppelin/defender-sdk-network-client": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-network-client/-/defender-sdk-network-client-2.6.0.tgz", + "integrity": "sha512-enVInisj9FsP6RClguiMEN9FSClBp54IRpMwKiopC/yVLjRxp/ZEGSWh8o8sc5Fob3Bb2JCbxSHtY9S6xuxxeQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@openzeppelin/defender-sdk-base-client": "^2.6.0", + "axios": "^1.7.4", + "lodash": "^4.17.21" + } + }, + "node_modules/@openzeppelin/defender-sdk-notification-channel-client": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-notification-channel-client/-/defender-sdk-notification-channel-client-2.6.0.tgz", + "integrity": "sha512-xsm+RRt7KixAqbR603lT5y5v95e+FDxqwi7MFQ/IkvBFoT/bCyweVolZLMlqig/NBt4jKLlKchYKbM6w1INLXQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@openzeppelin/defender-sdk-base-client": "^2.6.0", + "axios": "^1.7.4", + "lodash": "^4.17.21" + } + }, + "node_modules/@openzeppelin/defender-sdk-proposal-client": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-proposal-client/-/defender-sdk-proposal-client-2.6.0.tgz", + "integrity": "sha512-1JbHBZh54196+//uSjtPnU8w1rJusUTci239/M8bOHCzT7ofMe4YIj6NpYJT4XjwUqAgpUrO5LGhpPpIWlMXWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@openzeppelin/defender-sdk-base-client": "^2.6.0", + "axios": "^1.7.4", + "ethers": "^6.9.0", + "lodash": "^4.17.21" + } + }, + "node_modules/@openzeppelin/defender-sdk-relay-client": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-relay-client/-/defender-sdk-relay-client-2.6.0.tgz", + "integrity": "sha512-MW1RftXOtJIKAA+EFA+2c8rdgEhO8X3weM321OnCLqDl0YuafvaGVDpDHz/eW0WvNMYJ5YuUM1pknj4lM82cQw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@openzeppelin/defender-sdk-base-client": "^2.6.0", + "axios": "^1.7.4", + "lodash": "^4.17.21" + } + }, + "node_modules/@openzeppelin/defender-sdk-relay-group-client": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-relay-group-client/-/defender-sdk-relay-group-client-2.6.0.tgz", + "integrity": "sha512-rJXBWvCQ0Eij2kyqWQTpprSq6yMCUXKf3PwmKtaYuGOEVCSkfcf+Vo97ET1l6ceoA81tMU5k483FdG/KSr1daA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@openzeppelin/defender-sdk-base-client": "^2.6.0", + "axios": "^1.7.4", + "lodash": "^4.17.21" + } + }, + "node_modules/@openzeppelin/defender-sdk/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@openzeppelin/defender-sdk/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@openzeppelin/defender-sdk/node_modules/@openzeppelin/defender-sdk-relay-signer-client": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-relay-signer-client/-/defender-sdk-relay-signer-client-2.6.0.tgz", + "integrity": "sha512-RlL0IFlaPpwFRviWyE37zb8pKtLk+X301Z/RZ5ISpcGw+jPG7fjOkvfMsSyHogzM2d3tVjLFm2WHN0l4ynMajQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.1", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/providers": "^5.7.2", + "@ethersproject/strings": "^5.7.0", + "@openzeppelin/defender-sdk-base-client": "^2.6.0", + "amazon-cognito-identity-js": "^6.3.6", + "axios": "^1.7.4", + "ethers": "^6.9.0", + "lodash": "^4.17.21" + }, + "peerDependencies": { + "web3": "^4.14.0", + "web3-core": "^4.7.0", + "web3-utils": "^4.3.2" + } + }, + "node_modules/@openzeppelin/defender-sdk/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@openzeppelin/defender-sdk/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@openzeppelin/defender-sdk/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@openzeppelin/defender-sdk/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/@openzeppelin/defender-sdk/node_modules/web3-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.3.tgz", + "integrity": "sha512-kZUeCwaQm+RNc2Bf1V3BYbF29lQQKz28L0y+FA4G0lS8IxtJVGi5SeDTUkpwqqkdHHC7JcapPDnyyzJ1lfWlOw==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.3.1", + "web3-types": "^1.10.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@rollup/plugin-commonjs": { + "version": "25.0.8", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.8.tgz", + "integrity": "sha512-ZEZWTK5n6Qde0to4vS9Mr5x/0UZoqCxPVR9KRUjU4kA2sO7GEUn1fop0DAwpO6z0Nw/kJON9bDmSxdWxO/TT1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "commondir": "^1.0.1", + "estree-walker": "^2.0.2", + "glob": "^8.0.3", + "is-reference": "1.2.1", + "magic-string": "^0.30.3" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.68.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-commonjs/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@rollup/plugin-commonjs/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@rollup/plugin-json": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-6.1.0.tgz", + "integrity": "sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.1.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-node-resolve": { + "version": "15.3.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.3.1.tgz", + "integrity": "sha512-tgg6b91pAybXHJQMAAwW9VuWBO6Thi+q7BCNARLwSqlmsHz0XYURtGvh/AuwSADXSI4h/2uHbs7s4FzlZDGSGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "@types/resolve": "1.20.2", + "deepmerge": "^4.2.2", + "is-module": "^1.0.0", + "resolve": "^1.22.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.78.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-node-resolve/node_modules/resolve": { + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.16.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/@rollup/pluginutils": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.2.0.tgz", + "integrity": "sha512-qWJ2ZTbmumwiLFomfzTyt5Kng4hwPi9rwCYN4SHb6eaRU1KNO4ccxINHr/VhH4GgPlt1XfSTLX2LBTme8ne4Zw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils/node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.44.2.tgz", + "integrity": "sha512-g0dF8P1e2QYPOj1gu7s/3LVP6kze9A7m6x0BZ9iTdXK8N5c2V7cpBKHV3/9A4Zd8xxavdhK0t4PnqjkqVmUc9Q==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.44.2.tgz", + "integrity": "sha512-Yt5MKrOosSbSaAK5Y4J+vSiID57sOvpBNBR6K7xAaQvk3MkcNVV0f9fE20T+41WYN8hDn6SGFlFrKudtx4EoxA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.44.2.tgz", + "integrity": "sha512-EsnFot9ZieM35YNA26nhbLTJBHD0jTwWpPwmRVDzjylQT6gkar+zenfb8mHxWpRrbn+WytRRjE0WKsfaxBkVUA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.44.2.tgz", + "integrity": "sha512-dv/t1t1RkCvJdWWxQ2lWOO+b7cMsVw5YFaS04oHpZRWehI1h0fV1gF4wgGCTyQHHjJDfbNpwOi6PXEafRBBezw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.44.2.tgz", + "integrity": "sha512-W4tt4BLorKND4qeHElxDoim0+BsprFTwb+vriVQnFFtT/P6v/xO5I99xvYnVzKWrK6j7Hb0yp3x7V5LUbaeOMg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.44.2.tgz", + "integrity": "sha512-tdT1PHopokkuBVyHjvYehnIe20fxibxFCEhQP/96MDSOcyjM/shlTkZZLOufV3qO6/FQOSiJTBebhVc12JyPTA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.44.2.tgz", + "integrity": "sha512-+xmiDGGaSfIIOXMzkhJ++Oa0Gwvl9oXUeIiwarsdRXSe27HUIvjbSIpPxvnNsRebsNdUo7uAiQVgBD1hVriwSQ==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.44.2.tgz", + "integrity": "sha512-bDHvhzOfORk3wt8yxIra8N4k/N0MnKInCW5OGZaeDYa/hMrdPaJzo7CSkjKZqX4JFUWjUGm88lI6QJLCM7lDrA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.44.2.tgz", + "integrity": "sha512-NMsDEsDiYghTbeZWEGnNi4F0hSbGnsuOG+VnNvxkKg0IGDvFh7UVpM/14mnMwxRxUf9AdAVJgHPvKXf6FpMB7A==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.44.2.tgz", + "integrity": "sha512-lb5bxXnxXglVq+7imxykIp5xMq+idehfl+wOgiiix0191av84OqbjUED+PRC5OA8eFJYj5xAGcpAZ0pF2MnW+A==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loongarch64-gnu": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.44.2.tgz", + "integrity": "sha512-Yl5Rdpf9pIc4GW1PmkUGHdMtbx0fBLE1//SxDmuf3X0dUC57+zMepow2LK0V21661cjXdTn8hO2tXDdAWAqE5g==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.44.2.tgz", + "integrity": "sha512-03vUDH+w55s680YYryyr78jsO1RWU9ocRMaeV2vMniJJW/6HhoTBwyyiiTPVHNWLnhsnwcQ0oH3S9JSBEKuyqw==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.44.2.tgz", + "integrity": "sha512-iYtAqBg5eEMG4dEfVlkqo05xMOk6y/JXIToRca2bAWuqjrJYJlx/I7+Z+4hSrsWU8GdJDFPL4ktV3dy4yBSrzg==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.44.2.tgz", + "integrity": "sha512-e6vEbgaaqz2yEHqtkPXa28fFuBGmUJ0N2dOJK8YUfijejInt9gfCSA7YDdJ4nYlv67JfP3+PSWFX4IVw/xRIPg==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.44.2.tgz", + "integrity": "sha512-evFOtkmVdY3udE+0QKrV5wBx7bKI0iHz5yEVx5WqDJkxp9YQefy4Mpx3RajIVcM6o7jxTvVd/qpC1IXUhGc1Mw==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.44.2.tgz", + "integrity": "sha512-/bXb0bEsWMyEkIsUL2Yt5nFB5naLAwyOWMEviQfQY1x3l5WsLKgvZf66TM7UTfED6erckUVUJQ/jJ1FSpm3pRQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.44.2.tgz", + "integrity": "sha512-3D3OB1vSSBXmkGEZR27uiMRNiwN08/RVAcBKwhUYPaiZ8bcvdeEwWPvbnXvvXHY+A/7xluzcN+kaiOFNiOZwWg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.44.2.tgz", + "integrity": "sha512-VfU0fsMK+rwdK8mwODqYeM2hDrF2WiHaSmCBrS7gColkQft95/8tphyzv2EupVxn3iE0FI78wzffoULH1G+dkw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.44.2.tgz", + "integrity": "sha512-+qMUrkbUurpE6DVRjiJCNGZBGo9xM4Y0FXU5cjgudWqIBWbcLkjE3XprJUsOFgC6xjBClwVa9k6O3A7K3vxb5Q==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.44.2.tgz", + "integrity": "sha512-3+QZROYfJ25PDcxFF66UEk8jGWigHJeecZILvkPkyQN7oc5BvFo4YEXFkOs154j3FTMp9mn9Ky8RCOwastduEA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@scure/base": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.6.tgz", + "integrity": "sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.7.0.tgz", + "integrity": "sha512-E4FFX/N3f4B80AKWp5dP6ow+flD1LQZo/w8UnLGYZO674jS6YnYeepycOOksv+vLPSpgN35wgKgy+ybfTb2SMw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "~1.9.0", + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32/node_modules/@noble/curves": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.2.tgz", + "integrity": "sha512-HxngEd2XUcg9xi20JkwlLCtYwfoFw4JGkuZpT+WlsPD4gB/cxkvTD8fSsoAnphGZhFdZYKeQIPCuFlWPm1uE0g==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.6.0.tgz", + "integrity": "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@sentry/core": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-5.30.0.tgz", + "integrity": "sha512-TmfrII8w1PQZSZgPpUESqjB+jC6MvZJZdLtE/0hZ+SrnKhW3x5WlYLvTXZpcWePYBku7rl2wn1RZu6uT0qCTeg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sentry/hub": "5.30.0", + "@sentry/minimal": "5.30.0", + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/core/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true, + "license": "0BSD" + }, + "node_modules/@sentry/hub": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-5.30.0.tgz", + "integrity": "sha512-2tYrGnzb1gKz2EkMDQcfLrDTvmGcQPuWxLnJKXJvYTQDGLlEvi2tWz1VIHjunmOvJrB5aIQLhm+dcMRwFZDCqQ==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/hub/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true, + "license": "0BSD" + }, + "node_modules/@sentry/minimal": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-5.30.0.tgz", + "integrity": "sha512-BwWb/owZKtkDX+Sc4zCSTNcvZUq7YcH3uAVlmh/gtR9rmUvbzAA3ewLuB3myi4wWRAMEtny6+J/FN/x+2wn9Xw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sentry/hub": "5.30.0", + "@sentry/types": "5.30.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/minimal/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true, + "license": "0BSD" + }, + "node_modules/@sentry/node": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-5.30.0.tgz", + "integrity": "sha512-Br5oyVBF0fZo6ZS9bxbJZG4ApAjRqAnqFFurMVJJdunNb80brh7a5Qva2kjhm+U6r9NJAB5OmDyPkA1Qnt+QVg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sentry/core": "5.30.0", + "@sentry/hub": "5.30.0", + "@sentry/tracing": "5.30.0", + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "cookie": "^0.4.1", + "https-proxy-agent": "^5.0.0", + "lru_map": "^0.3.3", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/node/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true, + "license": "0BSD" + }, + "node_modules/@sentry/tracing": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-5.30.0.tgz", + "integrity": "sha512-dUFowCr0AIMwiLD7Fs314Mdzcug+gBVo/+NCMyDw8tFxJkwWAKl7Qa2OZxLQ0ZHjakcj1hNKfCQJ9rhyfOl4Aw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sentry/hub": "5.30.0", + "@sentry/minimal": "5.30.0", + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/tracing/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true, + "license": "0BSD" + }, + "node_modules/@sentry/types": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-5.30.0.tgz", + "integrity": "sha512-R8xOqlSTZ+htqrfteCWU5Nk0CDN5ApUTvrlvBuiH1DyP6czDZ4ktbZB0hAgBlVcK0U+qpD3ag3Tqqpa5Q67rPw==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/utils": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-5.30.0.tgz", + "integrity": "sha512-zaYmoH0NWWtvnJjC9/CBseXMtKHm/tm40sz3YfJRxeQjyzRqNQPgivpd9R/oDJCYj999mzdW382p/qi2ypjLww==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sentry/types": "5.30.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/utils/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true, + "license": "0BSD" + }, + "node_modules/@smithy/abort-controller": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/abort-controller/-/abort-controller-4.0.4.tgz", + "integrity": "sha512-gJnEjZMvigPDQWHrW3oPrFhQtkrgqBkyjj3pCIdF3A5M6vsZODG93KNlfJprv6bp4245bdT32fsHK4kkH3KYDA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/config-resolver": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/@smithy/config-resolver/-/config-resolver-4.1.4.tgz", + "integrity": "sha512-prmU+rDddxHOH0oNcwemL+SwnzcG65sBF2yXRO7aeXIn/xTlq2pX7JLVbkBnVLowHLg4/OL4+jBmv9hVrVGS+w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^4.1.3", + "@smithy/types": "^4.3.1", + "@smithy/util-config-provider": "^4.0.0", + "@smithy/util-middleware": "^4.0.4", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/core": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@smithy/core/-/core-3.7.0.tgz", + "integrity": "sha512-7ov8hu/4j0uPZv8b27oeOFtIBtlFmM3ibrPv/Omx1uUdoXvcpJ00U+H/OWWC/keAguLlcqwtyL2/jTlSnApgNQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/middleware-serde": "^4.0.8", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-body-length-browser": "^4.0.0", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-stream": "^4.2.3", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/credential-provider-imds": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@smithy/credential-provider-imds/-/credential-provider-imds-4.0.6.tgz", + "integrity": "sha512-hKMWcANhUiNbCJouYkZ9V3+/Qf9pteR1dnwgdyzR09R4ODEYx8BbUysHwRSyex4rZ9zapddZhLFTnT4ZijR4pw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^4.1.3", + "@smithy/property-provider": "^4.0.4", + "@smithy/types": "^4.3.1", + "@smithy/url-parser": "^4.0.4", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/eventstream-codec": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-codec/-/eventstream-codec-4.0.4.tgz", + "integrity": "sha512-7XoWfZqWb/QoR/rAU4VSi0mWnO2vu9/ltS6JZ5ZSZv0eovLVfDfu0/AX4ub33RsJTOth3TiFWSHS5YdztvFnig==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/crc32": "5.2.0", + "@smithy/types": "^4.3.1", + "@smithy/util-hex-encoding": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/eventstream-serde-browser": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-browser/-/eventstream-serde-browser-4.0.4.tgz", + "integrity": "sha512-3fb/9SYaYqbpy/z/H3yIi0bYKyAa89y6xPmIqwr2vQiUT2St+avRt8UKwsWt9fEdEasc5d/V+QjrviRaX1JRFA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/eventstream-serde-universal": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/eventstream-serde-config-resolver": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-config-resolver/-/eventstream-serde-config-resolver-4.1.2.tgz", + "integrity": "sha512-JGtambizrWP50xHgbzZI04IWU7LdI0nh/wGbqH3sJesYToMi2j/DcoElqyOcqEIG/D4tNyxgRuaqBXWE3zOFhQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/eventstream-serde-node": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-node/-/eventstream-serde-node-4.0.4.tgz", + "integrity": "sha512-RD6UwNZ5zISpOWPuhVgRz60GkSIp0dy1fuZmj4RYmqLVRtejFqQ16WmfYDdoSoAjlp1LX+FnZo+/hkdmyyGZ1w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/eventstream-serde-universal": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/eventstream-serde-universal": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-universal/-/eventstream-serde-universal-4.0.4.tgz", + "integrity": "sha512-UeJpOmLGhq1SLox79QWw/0n2PFX+oPRE1ZyRMxPIaFEfCqWaqpB7BU9C8kpPOGEhLF7AwEqfFbtwNxGy4ReENA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/eventstream-codec": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/fetch-http-handler": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@smithy/fetch-http-handler/-/fetch-http-handler-5.1.0.tgz", + "integrity": "sha512-mADw7MS0bYe2OGKkHYMaqarOXuDwRbO6ArD91XhHcl2ynjGCFF+hvqf0LyQcYxkA1zaWjefSkU7Ne9mqgApSgQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/protocol-http": "^5.1.2", + "@smithy/querystring-builder": "^4.0.4", + "@smithy/types": "^4.3.1", + "@smithy/util-base64": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/hash-node": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/hash-node/-/hash-node-4.0.4.tgz", + "integrity": "sha512-qnbTPUhCVnCgBp4z4BUJUhOEkVwxiEi1cyFM+Zj6o+aY8OFGxUQleKWq8ltgp3dujuhXojIvJWdoqpm6dVO3lQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "@smithy/util-buffer-from": "^4.0.0", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/invalid-dependency": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/invalid-dependency/-/invalid-dependency-4.0.4.tgz", + "integrity": "sha512-bNYMi7WKTJHu0gn26wg8OscncTt1t2b8KcsZxvOv56XA6cyXtOAAAaNP7+m45xfppXfOatXF3Sb1MNsLUgVLTw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/is-array-buffer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-4.0.0.tgz", + "integrity": "sha512-saYhF8ZZNoJDTvJBEWgeBccCg+yvp1CX+ed12yORU3NilJScfc6gfch2oVb4QgxZrGUx3/ZJlb+c/dJbyupxlw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-content-length": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/middleware-content-length/-/middleware-content-length-4.0.4.tgz", + "integrity": "sha512-F7gDyfI2BB1Kc+4M6rpuOLne5LOcEknH1n6UQB69qv+HucXBR1rkzXBnQTB2q46sFy1PM/zuSJOB532yc8bg3w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-endpoint": { + "version": "4.1.14", + "resolved": "https://registry.npmjs.org/@smithy/middleware-endpoint/-/middleware-endpoint-4.1.14.tgz", + "integrity": "sha512-+BGLpK5D93gCcSEceaaYhUD/+OCGXM1IDaq/jKUQ+ujB0PTWlWN85noodKw/IPFZhIKFCNEe19PGd/reUMeLSQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/core": "^3.7.0", + "@smithy/middleware-serde": "^4.0.8", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "@smithy/url-parser": "^4.0.4", + "@smithy/util-middleware": "^4.0.4", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-retry": { + "version": "4.1.15", + "resolved": "https://registry.npmjs.org/@smithy/middleware-retry/-/middleware-retry-4.1.15.tgz", + "integrity": "sha512-iKYUJpiyTQ33U2KlOZeUb0GwtzWR3C0soYcKuCnTmJrvt6XwTPQZhMfsjJZNw7PpQ3TU4Ati1qLSrkSJxnnSMQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^4.1.3", + "@smithy/protocol-http": "^5.1.2", + "@smithy/service-error-classification": "^4.0.6", + "@smithy/smithy-client": "^4.4.6", + "@smithy/types": "^4.3.1", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-retry": "^4.0.6", + "tslib": "^2.6.2", + "uuid": "^9.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-retry/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "dev": true, + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/@smithy/middleware-serde": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/@smithy/middleware-serde/-/middleware-serde-4.0.8.tgz", + "integrity": "sha512-iSSl7HJoJaGyMIoNn2B7czghOVwJ9nD7TMvLhMWeSB5vt0TnEYyRRqPJu/TqW76WScaNvYYB8nRoiBHR9S1Ddw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-stack": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/middleware-stack/-/middleware-stack-4.0.4.tgz", + "integrity": "sha512-kagK5ggDrBUCCzI93ft6DjteNSfY8Ulr83UtySog/h09lTIOAJ/xUSObutanlPT0nhoHAkpmW9V5K8oPyLh+QA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/node-config-provider": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/@smithy/node-config-provider/-/node-config-provider-4.1.3.tgz", + "integrity": "sha512-HGHQr2s59qaU1lrVH6MbLlmOBxadtzTsoO4c+bF5asdgVik3I8o7JIOzoeqWc5MjVa+vD36/LWE0iXKpNqooRw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/property-provider": "^4.0.4", + "@smithy/shared-ini-file-loader": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/node-http-handler": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-4.1.0.tgz", + "integrity": "sha512-vqfSiHz2v8b3TTTrdXi03vNz1KLYYS3bhHCDv36FYDqxT7jvTll1mMnCrkD+gOvgwybuunh/2VmvOMqwBegxEg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/abort-controller": "^4.0.4", + "@smithy/protocol-http": "^5.1.2", + "@smithy/querystring-builder": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/property-provider": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/property-provider/-/property-provider-4.0.4.tgz", + "integrity": "sha512-qHJ2sSgu4FqF4U/5UUp4DhXNmdTrgmoAai6oQiM+c5RZ/sbDwJ12qxB1M6FnP+Tn/ggkPZf9ccn4jqKSINaquw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/protocol-http": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-5.1.2.tgz", + "integrity": "sha512-rOG5cNLBXovxIrICSBm95dLqzfvxjEmuZx4KK3hWwPFHGdW3lxY0fZNXfv2zebfRO7sJZ5pKJYHScsqopeIWtQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/querystring-builder": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/querystring-builder/-/querystring-builder-4.0.4.tgz", + "integrity": "sha512-SwREZcDnEYoh9tLNgMbpop+UTGq44Hl9tdj3rf+yeLcfH7+J8OXEBaMc2kDxtyRHu8BhSg9ADEx0gFHvpJgU8w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "@smithy/util-uri-escape": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/querystring-parser": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/querystring-parser/-/querystring-parser-4.0.4.tgz", + "integrity": "sha512-6yZf53i/qB8gRHH/l2ZwUG5xgkPgQF15/KxH0DdXMDHjesA9MeZje/853ifkSY0x4m5S+dfDZ+c4x439PF0M2w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/service-error-classification": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@smithy/service-error-classification/-/service-error-classification-4.0.6.tgz", + "integrity": "sha512-RRoTDL//7xi4tn5FrN2NzH17jbgmnKidUqd4KvquT0954/i6CXXkh1884jBiunq24g9cGtPBEXlU40W6EpNOOg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/shared-ini-file-loader": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-4.0.4.tgz", + "integrity": "sha512-63X0260LoFBjrHifPDs+nM9tV0VMkOTl4JRMYNuKh/f5PauSjowTfvF3LogfkWdcPoxsA9UjqEOgjeYIbhb7Nw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/signature-v4": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@smithy/signature-v4/-/signature-v4-5.1.2.tgz", + "integrity": "sha512-d3+U/VpX7a60seHziWnVZOHuEgJlclufjkS6zhXvxcJgkJq4UWdH5eOBLzHRMx6gXjsdT9h6lfpmLzbrdupHgQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/is-array-buffer": "^4.0.0", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "@smithy/util-hex-encoding": "^4.0.0", + "@smithy/util-middleware": "^4.0.4", + "@smithy/util-uri-escape": "^4.0.0", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/smithy-client": { + "version": "4.4.6", + "resolved": "https://registry.npmjs.org/@smithy/smithy-client/-/smithy-client-4.4.6.tgz", + "integrity": "sha512-3wfhywdzB/CFszP6moa5L3lf5/zSfQoH0kvVSdkyK2az5qZet0sn2PAHjcTDiq296Y4RP5yxF7B6S6+3oeBUCQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/core": "^3.7.0", + "@smithy/middleware-endpoint": "^4.1.14", + "@smithy/middleware-stack": "^4.0.4", + "@smithy/protocol-http": "^5.1.2", + "@smithy/types": "^4.3.1", + "@smithy/util-stream": "^4.2.3", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/types": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-4.3.1.tgz", + "integrity": "sha512-UqKOQBL2x6+HWl3P+3QqFD4ncKq0I8Nuz9QItGv5WuKuMHuuwlhvqcZCoXGfc+P1QmfJE7VieykoYYmrOoFJxA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/url-parser": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/url-parser/-/url-parser-4.0.4.tgz", + "integrity": "sha512-eMkc144MuN7B0TDA4U2fKs+BqczVbk3W+qIvcoCY6D1JY3hnAdCuhCZODC+GAeaxj0p6Jroz4+XMUn3PCxQQeQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/querystring-parser": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-base64": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-base64/-/util-base64-4.0.0.tgz", + "integrity": "sha512-CvHfCmO2mchox9kjrtzoHkWHxjHZzaFojLc8quxXY7WAAMAg43nuxwv95tATVgQFNDwd4M9S1qFzj40Ul41Kmg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/util-buffer-from": "^4.0.0", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-body-length-browser": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-body-length-browser/-/util-body-length-browser-4.0.0.tgz", + "integrity": "sha512-sNi3DL0/k64/LO3A256M+m3CDdG6V7WKWHdAiBBMUN8S3hK3aMPhwnPik2A/a2ONN+9doY9UxaLfgqsIRg69QA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-body-length-node": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-body-length-node/-/util-body-length-node-4.0.0.tgz", + "integrity": "sha512-q0iDP3VsZzqJyje8xJWEJCNIu3lktUGVoSy1KB0UWym2CL1siV3artm+u1DFYTLejpsrdGyCSWBdGNjJzfDPjg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-buffer-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-4.0.0.tgz", + "integrity": "sha512-9TOQ7781sZvddgO8nxueKi3+yGvkY35kotA0Y6BWRajAv8jjmigQ1sBwz0UX47pQMYXJPahSKEKYFgt+rXdcug==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/is-array-buffer": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-config-provider": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-config-provider/-/util-config-provider-4.0.0.tgz", + "integrity": "sha512-L1RBVzLyfE8OXH+1hsJ8p+acNUSirQnWQ6/EgpchV88G6zGBTDPdXiiExei6Z1wR2RxYvxY/XLw6AMNCCt8H3w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-defaults-mode-browser": { + "version": "4.0.22", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-4.0.22.tgz", + "integrity": "sha512-hjElSW18Wq3fUAWVk6nbk7pGrV7ZT14DL1IUobmqhV3lxcsIenr5FUsDe2jlTVaS8OYBI3x+Og9URv5YcKb5QA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/property-provider": "^4.0.4", + "@smithy/smithy-client": "^4.4.6", + "@smithy/types": "^4.3.1", + "bowser": "^2.11.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-defaults-mode-node": { + "version": "4.0.22", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-4.0.22.tgz", + "integrity": "sha512-7B8mfQBtwwr2aNRRmU39k/bsRtv9B6/1mTMrGmmdJFKmLAH+KgIiOuhaqfKOBGh9sZ/VkZxbvm94rI4MMYpFjQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/config-resolver": "^4.1.4", + "@smithy/credential-provider-imds": "^4.0.6", + "@smithy/node-config-provider": "^4.1.3", + "@smithy/property-provider": "^4.0.4", + "@smithy/smithy-client": "^4.4.6", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-endpoints": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@smithy/util-endpoints/-/util-endpoints-3.0.6.tgz", + "integrity": "sha512-YARl3tFL3WgPuLzljRUnrS2ngLiUtkwhQtj8PAL13XZSyUiNLQxwG3fBBq3QXFqGFUXepIN73pINp3y8c2nBmA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^4.1.3", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-hex-encoding": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-hex-encoding/-/util-hex-encoding-4.0.0.tgz", + "integrity": "sha512-Yk5mLhHtfIgW2W2WQZWSg5kuMZCVbvhFmC7rV4IO2QqnZdbEFPmQnCcGMAX2z/8Qj3B9hYYNjZOhWym+RwhePw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-middleware": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@smithy/util-middleware/-/util-middleware-4.0.4.tgz", + "integrity": "sha512-9MLKmkBmf4PRb0ONJikCbCwORACcil6gUWojwARCClT7RmLzF04hUR4WdRprIXal7XVyrddadYNfp2eF3nrvtQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-retry": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@smithy/util-retry/-/util-retry-4.0.6.tgz", + "integrity": "sha512-+YekoF2CaSMv6zKrA6iI/N9yva3Gzn4L6n35Luydweu5MMPYpiGZlWqehPHDHyNbnyaYlz/WJyYAZnC+loBDZg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/service-error-classification": "^4.0.6", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-stream": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@smithy/util-stream/-/util-stream-4.2.3.tgz", + "integrity": "sha512-cQn412DWHHFNKrQfbHY8vSFI3nTROY1aIKji9N0tpp8gUABRilr7wdf8fqBbSlXresobM+tQFNk6I+0LXK/YZg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/fetch-http-handler": "^5.1.0", + "@smithy/node-http-handler": "^4.1.0", + "@smithy/types": "^4.3.1", + "@smithy/util-base64": "^4.0.0", + "@smithy/util-buffer-from": "^4.0.0", + "@smithy/util-hex-encoding": "^4.0.0", + "@smithy/util-utf8": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-uri-escape": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-uri-escape/-/util-uri-escape-4.0.0.tgz", + "integrity": "sha512-77yfbCbQMtgtTylO9itEAdpPXSog3ZxMe09AEhm0dU0NLTalV70ghDZFR+Nfi1C60jnJoh/Re4090/DuZh2Omg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-utf8": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-4.0.0.tgz", + "integrity": "sha512-b+zebfKCfRdgNJDknHCob3O7FpeYQN6ZG6YLExMcasDHsCXlsXCEuiPZeLnJLpwa5dvPetGlnGCiMHuLwGvFow==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/util-buffer-from": "^4.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-waiter": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@smithy/util-waiter/-/util-waiter-4.0.6.tgz", + "integrity": "sha512-slcr1wdRbX7NFphXZOxtxRNA7hXAAtJAXJDE/wdoMAos27SIquVCKiSqfB6/28YzQ8FCsB5NKkhdM5gMADbqxg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@smithy/abort-controller": "^4.0.4", + "@smithy/types": "^4.3.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@solidity-parser/parser": { + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.20.1.tgz", + "integrity": "sha512-58I2sRpzaQUN+jJmWbHfbWf9AKfzqCI8JAdFB0vbyY+u8tBRcuTt9LxzasvR0LGQpcRv97eyV7l61FQ3Ib7zVw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@typechain/ethers-v6": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@typechain/ethers-v6/-/ethers-v6-0.5.1.tgz", + "integrity": "sha512-F+GklO8jBWlsaVV+9oHaPh5NJdd6rAKN4tklGfInX1Q7h0xPgVLP39Jl3eCulPB5qexI71ZFHwbljx4ZXNfouA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "lodash": "^4.17.15", + "ts-essentials": "^7.0.1" + }, + "peerDependencies": { + "ethers": "6.x", + "typechain": "^8.3.2", + "typescript": ">=4.7.0" + } + }, + "node_modules/@typechain/hardhat": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/@typechain/hardhat/-/hardhat-9.1.0.tgz", + "integrity": "sha512-mtaUlzLlkqTlfPwB3FORdejqBskSnh+Jl8AIJGjXNAQfRQ4ofHADPl1+oU7Z3pAJzmZbUXII8MhOLQltcHgKnA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "fs-extra": "^9.1.0" + }, + "peerDependencies": { + "@typechain/ethers-v6": "^0.5.1", + "ethers": "^6.1.0", + "hardhat": "^2.9.9", + "typechain": "^8.3.2" + } + }, + "node_modules/@typechain/hardhat/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@types/bn.js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.2.0.tgz", + "integrity": "sha512-DLbJ1BPqxvQhIGbeu8VbUC1DiAiahHtAYvA0ZEAa4P31F7IaArc8z3C3BRQdWX4mtLQuABG4yzp76ZrS02Ui1Q==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/chai": { + "version": "4.3.20", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.20.tgz", + "integrity": "sha512-/pC9HAB5I/xMlc5FP77qjCnI16ChlJfW0tGa0IUcFn38VJrTV6DeZ60NU5KZBtaOZqjdpwTWohz5HU1RrhiYxQ==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/@types/chai-as-promised": { + "version": "7.1.8", + "resolved": "https://registry.npmjs.org/@types/chai-as-promised/-/chai-as-promised-7.1.8.tgz", + "integrity": "sha512-ThlRVIJhr69FLlh6IctTXFkmhtP3NpMZ2QGq69StYLyKZFp/HOp1VdKZj7RvfNWYYcJ1xlbLGLLWj1UvP5u/Gw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@types/chai": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "license": "MIT" + }, + "node_modules/@types/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "node_modules/@types/minimatch": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/@types/mocha": { + "version": "10.0.10", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz", + "integrity": "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/@types/node": { + "version": "24.0.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.12.tgz", + "integrity": "sha512-LtOrbvDf5ndC9Xi+4QZjVL0woFymF/xSTKZKPgrrl7H7XoeDvnD+E2IclKVDyaK9UM756W/3BXqSU+JEHopA9g==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "undici-types": "~7.8.0" + } + }, + "node_modules/@types/pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@types/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-uRwJqmiXmh9++aSu1VNEn3iIxWOhd8AHXNSdlaLfdAAdSTY9jYVeGWnzejM3dvrkbqE3/hyQkQQ29IFATEGlew==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/prettier": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.3.tgz", + "integrity": "sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/@types/resolve": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz", + "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/secp256k1": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.6.tgz", + "integrity": "sha512-hHxJU6PAEUn0TP4S/ZOzuTUvJWuZ6eIKeNKb5RBpODvSl6hp1Wrw4s7ATY50rklRCScUDpHzVA/DQdSjJ3UoYQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/ws": { + "version": "8.5.3", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz", + "integrity": "sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/abbrev": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", + "integrity": "sha512-LEyx4aLEC3x6T0UguF6YILf+ntvmOaWsVfENmIW0E9H09vKlLDGelMjjSm0jkDHALj8A8quZ/HapKNigzwge+Q==", + "dev": true, + "license": "ISC", + "peer": true + }, + "node_modules/abitype": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.8.tgz", + "integrity": "sha512-ZeiI6h3GnW06uYDLx0etQtX/p8E24UaHHBj57RSjK7YBFe7iuVn07EDpOeP451D06sF27VOz9JJPlIKJmXgkEg==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/wevm" + }, + "peerDependencies": { + "typescript": ">=5.0.4", + "zod": "^3 >=3.22.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + }, + "zod": { + "optional": true + } + } + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/adm-zip": { + "version": "0.4.16", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.16.tgz", + "integrity": "sha512-TFi4HBKSGfIKsK5YCkKaaFG2m4PEDyViZmEwof3MTIgzimHLto6muaHVpbrljdIvIrFZzEq/p4nafOeLcYegrg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.3.0" + } + }, + "node_modules/aes-js": { + "version": "4.0.0-beta.5", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/amazon-cognito-identity-js": { + "version": "6.3.15", + "resolved": "https://registry.npmjs.org/amazon-cognito-identity-js/-/amazon-cognito-identity-js-6.3.15.tgz", + "integrity": "sha512-G2mzTlGYHKYh9oZDO0Gk94xVQ4iY9GYWBaYScbDYvz05ps6dqi0IvdNx1Lxi7oA3tjS5X+mUN7/svFJJdOB9YA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-js": "1.2.2", + "buffer": "4.9.2", + "fast-base64-decode": "^1.0.0", + "isomorphic-unfetch": "^3.0.0", + "js-cookie": "^2.2.1" + } + }, + "node_modules/amazon-cognito-identity-js/node_modules/@aws-crypto/sha256-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-1.2.2.tgz", + "integrity": "sha512-Nr1QJIbW/afYYGzYvrF70LtaHrIRtd4TNAglX8BvlfxJLZ45SAmueIKYl5tWoNBPzp65ymXGFK0Bb1vZUpuc9g==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/util": "^1.2.2", + "@aws-sdk/types": "^3.1.0", + "tslib": "^1.11.1" + } + }, + "node_modules/amazon-cognito-identity-js/node_modules/@aws-crypto/util": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-1.2.2.tgz", + "integrity": "sha512-H8PjG5WJ4wz0UXAFXeJjWCW1vkvIJ3qUUD+rGRwJ2/hj+xT58Qle2MTql/2MGzkU+1JLAFuR6aJpLAjHwhmwwg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.1.0", + "@aws-sdk/util-utf8-browser": "^3.0.0", + "tslib": "^1.11.1" + } + }, + "node_modules/amazon-cognito-identity-js/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true, + "license": "0BSD" + }, + "node_modules/amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg==", + "dev": true, + "license": "BSD-3-Clause OR MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=0.4.2" + } + }, + "node_modules/ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.1.0" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true, + "license": "MIT" + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/array-back": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz", + "integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": "*" + } + }, + "node_modules/astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/async-retry": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz", + "integrity": "sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "retry": "0.13.1" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true, + "license": "ISC", + "peer": true, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/axios": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.10.0.tgz", + "integrity": "sha512-/1xYAC4MP/HEG+3duIhFr4ZQXR4sQXOIe+o6sdqzeykGLx6Upp/1p8MHqhINOvGeP7xyNHe7tsiJByc4SSVUxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/base-x": { + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.11.tgz", + "integrity": "sha512-xz7wQ8xDhdyP7tQxwdteLYeFfS68tSMNCZ/Y37WJ4bhGfKPpqEIlmIyueQHqOyoPhE6xNUqjzRr8ra0eF9VRvA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/bech32": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/blakejs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/bn.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.2.tgz", + "integrity": "sha512-v2YAxEmKaBLahNwE1mjp4WON6huMNeuDvagFZW+ASCuA/ku0bXR9hSMw0XpiqMoA3+rmnyck/tPRSFQkoC9Cuw==", + "dev": true, + "license": "MIT" + }, + "node_modules/bowser": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", + "integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==", + "dev": true, + "license": "MIT" + }, + "node_modules/boxen": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-align": "^3.0.0", + "camelcase": "^6.2.0", + "chalk": "^4.1.0", + "cli-boxes": "^2.2.1", + "string-width": "^4.2.2", + "type-fest": "^0.20.2", + "widest-line": "^3.1.0", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/boxen/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==", + "dev": true, + "license": "MIT" + }, + "node_modules/brotli-wasm": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brotli-wasm/-/brotli-wasm-2.0.1.tgz", + "integrity": "sha512-+3USgYsC7bzb5yU0/p2HnnynZl0ak0E6uoIm4UW4Aby/8s8HFCq6NCfrrf1E9c3O8OCSzq3oYO1tUVqIi61Nww==", + "dev": true, + "license": "Apache-2.0", + "peer": true + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true, + "license": "ISC" + }, + "node_modules/browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/buffer": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", + "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/buffer/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/builtin-modules": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-5.0.0.tgz", + "integrity": "sha512-bkXY9WsVpY7CvMhKSR6pZilZu9Ln5WDrKVBUXf2S443etkmEO4V58heTecXcUIsNsi4Rx8JUO4NfX1IcQl4deg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cbor": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/cbor/-/cbor-8.1.0.tgz", + "integrity": "sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg==", + "dev": true, + "license": "MIT", + "dependencies": { + "nofilter": "^3.1.0" + }, + "engines": { + "node": ">=12.19" + } + }, + "node_modules/chai": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.5.0.tgz", + "integrity": "sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chai-as-promised": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.2.tgz", + "integrity": "sha512-aBDHZxRzYnUYuIAIPBH2s511DjlKPzXNlXSGFC8CwmroWQLfrW0LtE1nK3MAwwNhJPa9raEjNCmRoFpG0Hurdw==", + "dev": true, + "license": "WTFPL", + "peer": true, + "dependencies": { + "check-error": "^1.0.2" + }, + "peerDependencies": { + "chai": ">= 2.1.2 < 6" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", + "dev": true, + "license": "BSD-3-Clause", + "peer": true, + "engines": { + "node": "*" + } + }, + "node_modules/check-error": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "get-func-name": "^2.0.2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "readdirp": "^4.0.1" + }, + "engines": { + "node": ">= 14.16.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/cipher-base": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.6.tgz", + "integrity": "sha512-3Ek9H3X6pj5TgenXYtNWdaBon1tgYCaebd+XPg0keyjEbEfkD4KkmAxkQ/i1vYvxdcT5nscLBfq9VJRmCBcFSw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/cli-boxes": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-table3": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.5.tgz", + "integrity": "sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "string-width": "^4.2.0" + }, + "engines": { + "node": "10.* || >= 12.*" + }, + "optionalDependencies": { + "@colors/colors": "1.5.0" + } + }, + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/command-exists": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==", + "dev": true, + "license": "MIT" + }, + "node_modules/command-line-args": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.1.tgz", + "integrity": "sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "array-back": "^3.1.0", + "find-replace": "^3.0.0", + "lodash.camelcase": "^4.3.0", + "typical": "^4.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/command-line-usage": { + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-6.1.3.tgz", + "integrity": "sha512-sH5ZSPr+7UStsloltmDh7Ce5fb8XPlHyoPzTpyyMuYCtervL65+ubVZ6Q61cFtFl62UyJlc8/JwERRbAFPUqgw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "array-back": "^4.0.2", + "chalk": "^2.4.2", + "table-layout": "^1.0.2", + "typical": "^5.2.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/command-line-usage/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/command-line-usage/node_modules/array-back": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz", + "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/command-line-usage/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/command-line-usage/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/command-line-usage/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/command-line-usage/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/command-line-usage/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/command-line-usage/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/command-line-usage/node_modules/typical": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", + "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "dev": true, + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/cookie": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", + "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/crc-32": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "node_modules/create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-fetch": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.1.0.tgz", + "integrity": "sha512-uKm5PU+MHTootlWEY+mZ4vvXoCn4fLQxT9dSc1sXVMSFkINTJVN8cAQROpwcKm8bJ/c7rgZVIBWzH5T78sNZZw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "node-fetch": "^2.7.0" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", + "dev": true, + "license": "BSD-3-Clause", + "peer": true, + "engines": { + "node": "*" + } + }, + "node_modules/death": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/death/-/death-1.1.0.tgz", + "integrity": "sha512-vsV6S4KVHvTGxbEcij7hkWRv0It+sGGWVOM67dQde/o5Xjnr+KmLjxWJii2uEObIrt1CcM9w0Yaovx+iOlIL+w==", + "dev": true, + "peer": true + }, + "node_modules/debug": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-eql": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.4.tgz", + "integrity": "sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/diff": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", + "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/difflib": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/difflib/-/difflib-0.2.4.tgz", + "integrity": "sha512-9YVwmMb0wQHQNr5J9m6BSj6fk4pfGITGQOOs+D9Fl+INODWFOfvhIU1hNv6GgR1RBoC/9NJcwu77zShxV0kT7w==", + "dev": true, + "peer": true, + "dependencies": { + "heap": ">= 0.2.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dotenv": { + "version": "17.2.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.0.tgz", + "integrity": "sha512-Q4sgBT60gzd0BB0lSyYD3xM4YxrXA9y4uBDof1JNYGzOXrQdQ6yX+7XIAqoFOGQFOTK1D3Hts5OllpxMDZFONQ==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true, + "license": "MIT" + }, + "node_modules/elliptic": { + "version": "6.6.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.6.1.tgz", + "integrity": "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/elliptic/node_modules/bn.js": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.2.tgz", + "integrity": "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/enquirer": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz", + "integrity": "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-colors": "^4.1.1", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/escodegen": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", + "integrity": "sha512-yhi5S+mNTOuRvyW4gWlg5W1byMaQGWWSYHXsuFZ7GBo7tpyOwi2EdzMP/QWxh9hwkD2m+wDVHJsxhRIj+v/b/A==", + "dev": true, + "license": "BSD-2-Clause", + "peer": true, + "dependencies": { + "esprima": "^2.7.1", + "estraverse": "^1.9.1", + "esutils": "^2.0.2", + "optionator": "^0.8.1" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=0.12.0" + }, + "optionalDependencies": { + "source-map": "~0.2.0" + } + }, + "node_modules/esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha512-OarPfz0lFCiW4/AV2Oy1Rp9qu0iusTKqykwTspGCZtPxmF81JR4MmIebvF1F9+UOKth2ZubLQ4XGGaU+hSn99A==", + "dev": true, + "license": "BSD-2-Clause", + "peer": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/estraverse": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", + "integrity": "sha512-25w1fMXQrGdoquWnScXZGckOv+Wes+JDnuN/+7ex3SauFRS72r2lFDec0EKPt2YD1wUJ/IrfEex+9yp4hfSOJA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true, + "license": "MIT" + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ethereum-bloom-filters": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.2.0.tgz", + "integrity": "sha512-28hyiE7HVsWubqhpVLVmZXFd4ITeHi+BUu05o9isf0GUpMtzBUi+8/gFrGaGYzvGAJQmJ3JKj77Mk9G98T84rA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "^1.4.0" + } + }, + "node_modules/ethereum-bloom-filters/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ethereum-cryptography": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", + "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@types/pbkdf2": "^3.0.0", + "@types/secp256k1": "^4.0.1", + "blakejs": "^1.1.0", + "browserify-aes": "^1.2.0", + "bs58check": "^2.1.2", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "hash.js": "^1.1.7", + "keccak": "^3.0.0", + "pbkdf2": "^3.0.17", + "randombytes": "^2.1.0", + "safe-buffer": "^5.1.2", + "scrypt-js": "^3.0.0", + "secp256k1": "^4.0.1", + "setimmediate": "^1.0.5" + } + }, + "node_modules/ethereumjs-util": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz", + "integrity": "sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg==", + "dev": true, + "license": "MPL-2.0", + "peer": true, + "dependencies": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "rlp": "^2.2.4" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/ethers": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.15.0.tgz", + "integrity": "sha512-Kf/3ZW54L4UT0pZtsY/rf+EkBU7Qi5nnhonjUb8yTXcxH3cdcWrV2cRyk0Xk/4jK6OoHhxxZHriyhje20If2hQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/ethers-io/" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@adraffy/ens-normalize": "1.10.1", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@types/node": "22.7.5", + "aes-js": "4.0.0-beta.5", + "tslib": "2.7.0", + "ws": "8.17.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/ethers/node_modules/@types/node": { + "version": "22.7.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz", + "integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/ethers/node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true, + "license": "MIT" + }, + "node_modules/ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/ethjs-unit/node_modules/bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/fast-base64-decode": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-base64-decode/-/fast-base64-decode-1.0.0.tgz", + "integrity": "sha512-qwaScUgUGBYeDNRnbc/KyllVU88Jk1pRHPStuF/lO7B0/RTRLj7U0lkdTAutlBblY08rwZDff6tNU9cjv6j//Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/fast-uri": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.6.tgz", + "integrity": "sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/fast-xml-parser": { + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.2.5.tgz", + "integrity": "sha512-pfX9uG9Ki0yekDHx2SiuRIyFdyAr1kMIMitPvb0YBo8SUfKvia7w7FIyd/l6av85pFYRhZscS75MwMnbvY+hcQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", + "dependencies": { + "strnum": "^2.1.0" + }, + "bin": { + "fxparser": "src/cli/cli.js" + } + }, + "node_modules/fastq": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-replace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz", + "integrity": "sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "array-back": "^3.0.1" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true, + "license": "BSD-3-Clause", + "bin": { + "flat": "cli.js" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "dev": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/form-data": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.3.tgz", + "integrity": "sha512-qsITQPfmvMOSAdeyZ+12I1c+CKSstAFAwu+97zrnWAbIr5u8wfsExUzCesVLC8NgHuRUqNN4Zy6UPWUTRGslcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fp-ts": { + "version": "1.19.3", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-1.19.3.tgz", + "integrity": "sha512-H5KQDspykdHuztLTg+ajGN0Z2qUjcEf3Ybxc6hLt0k7/zPkn29XnKnxlBPyW2XIddWrGaJBzBl4VLYOtk39yZg==", + "dev": true, + "license": "MIT" + }, + "node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true, + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-func-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": "*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ghost-testrpc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/ghost-testrpc/-/ghost-testrpc-0.0.2.tgz", + "integrity": "sha512-i08dAEgJ2g8z5buJIrCTduwPIhih3DP+hOCTyyryikfV8T0bNvHnGXO67i0DD1H4GBDETTclPy9njZbfluQYrQ==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "chalk": "^2.4.2", + "node-emoji": "^1.10.0" + }, + "bin": { + "testrpc-sc": "index.js" + } + }, + "node_modules/ghost-testrpc/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ghost-testrpc/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ghost-testrpc/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/ghost-testrpc/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/ghost-testrpc/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/ghost-testrpc/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/ghost-testrpc/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/global-modules": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz", + "integrity": "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "global-prefix": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/global-prefix": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz", + "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "ini": "^1.3.5", + "kind-of": "^6.0.2", + "which": "^1.3.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/global-prefix/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/globby": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.2.tgz", + "integrity": "sha512-7dUi7RvCoT/xast/o/dLN53oqND4yk0nsHkhRgn9w65C4PofCLOoJ39iSOg+qVDdWQPIEj+eszMHQ+aLVwwQSg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@types/glob": "^7.1.1", + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.0.3", + "glob": "^7.1.3", + "ignore": "^5.1.1", + "merge2": "^1.2.3", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/globby/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/globby/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/globby/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/handlebars": { + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", + "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.2", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, + "node_modules/handlebars/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/hardhat": { + "version": "2.26.1", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.26.1.tgz", + "integrity": "sha512-CXWuUaTtehxiHPCdlitntctfeYRgujmXkNX5gnrD5jdA6HhRQt+WWBZE/gHXbE29y/wDmmUL2d652rI0ctjqjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ethereumjs/util": "^9.1.0", + "@ethersproject/abi": "^5.1.2", + "@nomicfoundation/edr": "^0.11.3", + "@nomicfoundation/solidity-analyzer": "^0.1.0", + "@sentry/node": "^5.18.1", + "adm-zip": "^0.4.16", + "aggregate-error": "^3.0.0", + "ansi-escapes": "^4.3.0", + "boxen": "^5.1.2", + "chokidar": "^4.0.0", + "ci-info": "^2.0.0", + "debug": "^4.1.1", + "enquirer": "^2.3.0", + "env-paths": "^2.2.0", + "ethereum-cryptography": "^1.0.3", + "find-up": "^5.0.0", + "fp-ts": "1.19.3", + "fs-extra": "^7.0.1", + "immutable": "^4.0.0-rc.12", + "io-ts": "1.10.4", + "json-stream-stringify": "^3.1.4", + "keccak": "^3.0.2", + "lodash": "^4.17.11", + "micro-eth-signer": "^0.14.0", + "mnemonist": "^0.38.0", + "mocha": "^10.0.0", + "p-map": "^4.0.0", + "picocolors": "^1.1.0", + "raw-body": "^2.4.1", + "resolve": "1.17.0", + "semver": "^6.3.0", + "solc": "0.8.26", + "source-map-support": "^0.5.13", + "stacktrace-parser": "^0.1.10", + "tinyglobby": "^0.2.6", + "tsort": "0.0.1", + "undici": "^5.14.0", + "uuid": "^8.3.2", + "ws": "^7.4.6" + }, + "bin": { + "hardhat": "internal/cli/bootstrap.js" + }, + "peerDependencies": { + "ts-node": "*", + "typescript": "*" + }, + "peerDependenciesMeta": { + "ts-node": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/hardhat-gas-reporter": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/hardhat-gas-reporter/-/hardhat-gas-reporter-2.3.0.tgz", + "integrity": "sha512-ySdA+044xMQv1BlJu5CYXToHzMexKFfIWxlQTBNNoerx1x96+d15IMdN01iQZ/TJ7NH2V5sU73bz77LoS/PEVw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@ethersproject/abi": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/units": "^5.7.0", + "@solidity-parser/parser": "^0.20.1", + "axios": "^1.6.7", + "brotli-wasm": "^2.0.1", + "chalk": "4.1.2", + "cli-table3": "^0.6.3", + "ethereum-cryptography": "^2.1.3", + "glob": "^10.3.10", + "jsonschema": "^1.4.1", + "lodash": "^4.17.21", + "markdown-table": "2.0.0", + "sha1": "^1.1.1", + "viem": "^2.27.0" + }, + "peerDependencies": { + "hardhat": "^2.16.0" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/hardhat-gas-reporter/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/hardhat/node_modules/@noble/hashes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.2.0.tgz", + "integrity": "sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT" + }, + "node_modules/hardhat/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/hardhat/node_modules/@scure/bip32": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.5.tgz", + "integrity": "sha512-XyNh1rB0SkEqd3tXcXMi+Xe1fvg+kUIcoRIEujP1Jgv7DqW2r9lg3Ah0NkFaCs9sTkQAQA8kw7xiRXzENi9Rtw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT", + "dependencies": { + "@noble/hashes": "~1.2.0", + "@noble/secp256k1": "~1.7.0", + "@scure/base": "~1.1.0" + } + }, + "node_modules/hardhat/node_modules/@scure/bip39": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.1.1.tgz", + "integrity": "sha512-t+wDck2rVkh65Hmv280fYdVdY25J9YeEUIgn2LG1WM6gxFkGzcksoDiUkWVpVp3Oex9xGC68JU2dSbUfwZ2jPg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT", + "dependencies": { + "@noble/hashes": "~1.2.0", + "@scure/base": "~1.1.0" + } + }, + "node_modules/hardhat/node_modules/ethereum-cryptography": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-1.2.0.tgz", + "integrity": "sha512-6yFQC9b5ug6/17CQpCyE3k9eKBMdhyVjzUy1WkiuY/E4vj/SXDBbCw8QEIaXqf0Mf2SnY6RmpDcwlUmBSS0EJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.2.0", + "@noble/secp256k1": "1.7.1", + "@scure/bip32": "1.1.5", + "@scure/bip39": "1.1.1" + } + }, + "node_modules/hardhat/node_modules/fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/hardhat/node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "dev": true, + "license": "MIT", + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/hardhat/node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/hardhat/node_modules/ws": { + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "license": "MIT", + "bin": { + "he": "bin/he" + } + }, + "node_modules/heap": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/heap/-/heap-0.2.7.tgz", + "integrity": "sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/immer": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/immer/-/immer-10.0.2.tgz", + "integrity": "sha512-Rx3CqeqQ19sxUtYV9CU911Vhy8/721wRFnJv3REVGWUmoAcIwzifTsdmJte/MV+0/XpM35LZdQMBGkRIoLPwQA==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, + "node_modules/immutable": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.7.tgz", + "integrity": "sha512-1hqclzwYwjRDFLjcFxOM5AYkkG0rpFPpr1RLPMEuGczoS7YA8gLhy8SWXYRAA/XwfEHpfo3cw5JGioS32fnMRw==", + "dev": true, + "license": "MIT" + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true, + "license": "ISC", + "peer": true + }, + "node_modules/interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/io-ts": { + "version": "1.10.4", + "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-1.10.4.tgz", + "integrity": "sha512-b23PteSnYXSONJ6JQXRAlvJhuw8KOtkqa87W4wDtvMrud/DTJd5X+NpOOI+O/zZwVq6v0VLAaJ+1EDViKEuN9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fp-ts": "^1.0.0" + } + }, + "node_modules/is-arguments": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.2.0.tgz", + "integrity": "sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-function": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.0.tgz", + "integrity": "sha512-nPUB5km40q9e8UfN/Zc24eLlzdSf9OfKByBw9CIdw4H1giPMeA0OIJvbchsCu4npfI2QcMVBsGEBHKZ7wLTWmQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "call-bound": "^1.0.3", + "get-proto": "^1.0.0", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/is-regex": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/isomorphic-unfetch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/isomorphic-unfetch/-/isomorphic-unfetch-3.1.0.tgz", + "integrity": "sha512-geDJjpoZ8N0kWexiwkX8F9NkTsXhetLPVbZFQ+JTW239QNOwvB0gniuR1Wc6f0AMTn7/mFGyXvHTifrCp/GH8Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "node-fetch": "^2.6.1", + "unfetch": "^4.2.0" + } + }, + "node_modules/isomorphic-ws": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz", + "integrity": "sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==", + "dev": true, + "license": "MIT", + "peer": true, + "peerDependencies": { + "ws": "*" + } + }, + "node_modules/isows": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.7.tgz", + "integrity": "sha512-I1fSfDCZL5P0v33sVqeTDSpcstAg/N+wF5HS033mogOVIp4B+oHC7oOCsA3axAbBSGTJ8QubbNmnIRN/h8U7hg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "license": "MIT", + "peer": true, + "peerDependencies": { + "ws": "*" + } + }, + "node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dev": true, + "license": "BlueOak-1.0.0", + "peer": true, + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/js-cookie": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.1.tgz", + "integrity": "sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stream-stringify": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/json-stream-stringify/-/json-stream-stringify-3.1.6.tgz", + "integrity": "sha512-x7fpwxOkbhFCaJDJ8vb1fBY3DdSa4AlITaz+HHILQJzdPMnHEFjxPwVUi1ALIbcIxDE0PNe/0i7frnY8QnBQog==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=7.10.1" + } + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "dev": true, + "license": "ISC", + "peer": true + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/jsonschema": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.5.0.tgz", + "integrity": "sha512-K+A9hhqbn0f3pJX17Q/7H6yQfD/5OXgdrR5UE12gMXCiN9D5Xq2o5mddV2QEcX/bjla99ASsAAQUyMCCRWAEhw==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": "*" + } + }, + "node_modules/jszip": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", + "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", + "dev": true, + "license": "(MIT OR GPL-3.0-or-later)", + "dependencies": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + } + }, + "node_modules/jszip/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/jszip/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/jszip/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/jszip/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/keccak": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.4.tgz", + "integrity": "sha512-3vKuW0jV8J3XNTzvfyicFR5qvxrSAGl7KIhvgOu5cmWwM7tZRj3fMbj/pfIf4be7aznbc+prBWGjywox/g2Y6Q==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "immediate": "~3.0.5" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", + "deprecated": "This package is deprecated. Use require('node:util').isDeepStrictEqual instead.", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/lodash.truncate": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", + "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", + "dev": true, + "license": "MIT" + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/loupe": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", + "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "get-func-name": "^2.0.1" + } + }, + "node_modules/lru_map": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz", + "integrity": "sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true, + "license": "ISC", + "peer": true + }, + "node_modules/magic-string": { + "version": "0.30.17", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", + "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true, + "license": "ISC" + }, + "node_modules/markdown-table": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-2.0.0.tgz", + "integrity": "sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "repeat-string": "^1.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/memorystream": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", + "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==", + "dev": true, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micro-eth-signer": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/micro-eth-signer/-/micro-eth-signer-0.14.0.tgz", + "integrity": "sha512-5PLLzHiVYPWClEvZIXXFu5yutzpadb73rnQCpUqIHu3No3coFuWQNfE5tkBQJ7djuLYl6aRLaS0MgWJYGoqiBw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/curves": "~1.8.1", + "@noble/hashes": "~1.7.1", + "micro-packed": "~0.7.2" + } + }, + "node_modules/micro-eth-signer/node_modules/@noble/curves": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.8.2.tgz", + "integrity": "sha512-vnI7V6lFNe0tLAuJMu+2sX+FcL14TaCWy1qiczg1VwRmPrpQCdq5ESXQMqUc2tluRNf6irBXrWbl1mGN8uaU/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.7.2" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/micro-eth-signer/node_modules/@noble/hashes": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.7.2.tgz", + "integrity": "sha512-biZ0NUSxyjLLqo6KxEJ1b+C2NAx0wtDoFvCaXHGgUkeHzf3Xc1xKumFKREuT7f7DARNZ/slvYUwFG6B0f2b6hQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/micro-ftch": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/micro-ftch/-/micro-ftch-0.3.1.tgz", + "integrity": "sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/micro-packed": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/micro-packed/-/micro-packed-0.7.3.tgz", + "integrity": "sha512-2Milxs+WNC00TRlem41oRswvw31146GiSaoCT7s3Xi2gMUglW5QBeqlQaZeHr5tJx9nm3i57LNXPqxOOaWtTYg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@scure/base": "~1.2.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true, + "license": "ISC" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==", + "dev": true, + "license": "MIT" + }, + "node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/mnemonist": { + "version": "0.38.5", + "resolved": "https://registry.npmjs.org/mnemonist/-/mnemonist-0.38.5.tgz", + "integrity": "sha512-bZTFT5rrPKtPJxj8KSV0WkPyNxl72vQepqqVUAW2ARUpUSF2qXMB6jZj7hW5/k7C1rtpzqbD/IIbJwLXUjCHeg==", + "dev": true, + "license": "MIT", + "dependencies": { + "obliterator": "^2.0.0" + } + }, + "node_modules/mocha": { + "version": "10.8.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.8.2.tgz", + "integrity": "sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-colors": "^4.1.3", + "browser-stdout": "^1.3.1", + "chokidar": "^3.5.3", + "debug": "^4.3.5", + "diff": "^5.2.0", + "escape-string-regexp": "^4.0.0", + "find-up": "^5.0.0", + "glob": "^8.1.0", + "he": "^1.2.0", + "js-yaml": "^4.1.0", + "log-symbols": "^4.1.0", + "minimatch": "^5.1.6", + "ms": "^2.1.3", + "serialize-javascript": "^6.0.2", + "strip-json-comments": "^3.1.1", + "supports-color": "^8.1.1", + "workerpool": "^6.5.1", + "yargs": "^16.2.0", + "yargs-parser": "^20.2.9", + "yargs-unparser": "^2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha.js" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/mocha/node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/mocha/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/mocha/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mocha/node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/mocha/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/ndjson": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ndjson/-/ndjson-2.0.0.tgz", + "integrity": "sha512-nGl7LRGrzugTtaFcJMhLbpzJM6XdivmbkdlaGcrk/LXg2KL/YBC6z1g70xh0/al+oFuVFP8N8kiWRucmeEH/qQ==", + "dev": true, + "license": "BSD-3-Clause", + "peer": true, + "dependencies": { + "json-stringify-safe": "^5.0.1", + "minimist": "^1.2.5", + "readable-stream": "^3.6.0", + "split2": "^3.0.0", + "through2": "^4.0.0" + }, + "bin": { + "ndjson": "cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/node-addon-api": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-emoji": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz", + "integrity": "sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "lodash": "^4.17.21" + } + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-gyp-build": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", + "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", + "dev": true, + "license": "MIT", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/nofilter": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/nofilter/-/nofilter-3.1.0.tgz", + "integrity": "sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.19" + } + }, + "node_modules/nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha512-4GUt3kSEYmk4ITxzB/b9vaIDfUVWN/Ml1Fwl11IlnIG2iaJ9O6WXZ9SrYM9NLI8OCBieN2Y8SWC2oJV0RQ7qYg==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/number-to-bn/node_modules/bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/obliterator": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/obliterator/-/obliterator-2.0.5.tgz", + "integrity": "sha512-42CPE9AhahZRsMNslczq0ctAEtqk8Eka26QofnqC346BZdHDySk3LWka23LI7ULIw11NmltpiLagIq8gBozxTw==", + "dev": true, + "license": "MIT" + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/ordinal": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ordinal/-/ordinal-1.0.3.tgz", + "integrity": "sha512-cMddMgb2QElm8G7vdaa02jhUNbTSrhsgAGUz1OokD83uJTwSUn+nKoNoKVVaRa08yF6sgfO7Maou1+bgLd9rdQ==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ox": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/ox/-/ox-0.8.1.tgz", + "integrity": "sha512-e+z5epnzV+Zuz91YYujecW8cF01mzmrUtWotJ0oEPym/G82uccs7q0WDHTYL3eiONbTUEvcZrptAKLgTBD3u2A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@adraffy/ens-normalize": "^1.11.0", + "@noble/ciphers": "^1.3.0", + "@noble/curves": "^1.9.1", + "@noble/hashes": "^1.8.0", + "@scure/bip32": "^1.7.0", + "@scure/bip39": "^1.6.0", + "abitype": "^1.0.8", + "eventemitter3": "5.0.1" + }, + "peerDependencies": { + "typescript": ">=5.4.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/ox/node_modules/@adraffy/ens-normalize": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.11.0.tgz", + "integrity": "sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/ox/node_modules/@noble/curves": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.2.tgz", + "integrity": "sha512-HxngEd2XUcg9xi20JkwlLCtYwfoFw4JGkuZpT+WlsPD4gB/cxkvTD8fSsoAnphGZhFdZYKeQIPCuFlWPm1uE0g==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ox/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, + "node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "dev": true, + "license": "(MIT AND Zlib)" + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "license": "BlueOak-1.0.0", + "peer": true, + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": "*" + } + }, + "node_modules/pbkdf2": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.3.tgz", + "integrity": "sha512-wfRLBZ0feWRhCIkoMB6ete7czJcnNnqRpcoWQBLqatqXXmelSRqfdDK4F3u9T2s2cXas/hQJcryI/4lAL+XTlA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "create-hash": "~1.1.3", + "create-hmac": "^1.1.7", + "ripemd160": "=2.0.1", + "safe-buffer": "^5.2.1", + "sha.js": "^2.4.11", + "to-buffer": "^1.2.0" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/pbkdf2/node_modules/create-hash": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.1.3.tgz", + "integrity": "sha512-snRpch/kwQhcdlnZKYanNF1m0RDlrCdSKQaH87w1FCFPVPNCQ/Il9QJKAX2jVBZddRdaHBMC+zXa9Gw9tmkNUA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "sha.js": "^2.4.0" + } + }, + "node_modules/pbkdf2/node_modules/hash-base": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-2.0.2.tgz", + "integrity": "sha512-0TROgQ1/SxE6KmxWSvXHvRj90/Xo1JvZShofnYF+f6ZsGtR4eES7WfrQzPalmyagfKZCXpVnitiRebZulWsbiw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "inherits": "^2.0.1" + } + }, + "node_modules/pbkdf2/node_modules/ripemd160": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.1.tgz", + "integrity": "sha512-J7f4wutN8mdbV08MJnXibYpCOPHR+yzy+iQ/AsjMv2j8cLavQ8VGagDFUwwTAdF8FmRKVeNpbTTEwNHCW1g94w==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "hash-base": "^2.0.0", + "inherits": "^2.0.1" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", + "dev": true, + "peer": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz", + "integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-plugin-solidity": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-solidity/-/prettier-plugin-solidity-2.1.0.tgz", + "integrity": "sha512-O5HX4/PCE5aqiaEiNGbSRLbSBZQ6kLswAav5LBSewwzhT+sZlN6iAaLZlZcJzPEnIAxwLEHP03xKEg92fflT9Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nomicfoundation/slang": "1.2.0", + "@solidity-parser/parser": "^0.20.1", + "semver": "^7.7.2" + }, + "engines": { + "node": ">=20" + }, + "peerDependencies": { + "prettier": ">=3.0.0" + } + }, + "node_modules/prettier-plugin-solidity/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true, + "license": "MIT" + }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true, + "license": "MIT" + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "peer": true + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.18.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "dev": true, + "peer": true, + "dependencies": { + "resolve": "^1.1.6" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/recursive-readdir": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.3.tgz", + "integrity": "sha512-8HrF5ZsXk5FAH9dgsx3BlUer73nIhuj+9OrQwEbLTPOBzGkL1lsFCR01am+v+0m2Cmbs1nP12hLDl5FA7EszKA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/recursive-readdir/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/recursive-readdir/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/reduce-flatten": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/reduce-flatten/-/reduce-flatten-2.0.0.tgz", + "integrity": "sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/retry": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "node_modules/rlp": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.7.tgz", + "integrity": "sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ==", + "dev": true, + "license": "MPL-2.0", + "peer": true, + "dependencies": { + "bn.js": "^5.2.0" + }, + "bin": { + "rlp": "bin/rlp" + } + }, + "node_modules/rollup": { + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.44.2.tgz", + "integrity": "sha512-PVoapzTwSEcelaWGth3uR66u7ZRo6qhPHc0f2uRO9fX6XDVNrIiGYS0Pj9+R8yIIYSD/mCx2b16Ws9itljKSPg==", + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.8" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.44.2", + "@rollup/rollup-android-arm64": "4.44.2", + "@rollup/rollup-darwin-arm64": "4.44.2", + "@rollup/rollup-darwin-x64": "4.44.2", + "@rollup/rollup-freebsd-arm64": "4.44.2", + "@rollup/rollup-freebsd-x64": "4.44.2", + "@rollup/rollup-linux-arm-gnueabihf": "4.44.2", + "@rollup/rollup-linux-arm-musleabihf": "4.44.2", + "@rollup/rollup-linux-arm64-gnu": "4.44.2", + "@rollup/rollup-linux-arm64-musl": "4.44.2", + "@rollup/rollup-linux-loongarch64-gnu": "4.44.2", + "@rollup/rollup-linux-powerpc64le-gnu": "4.44.2", + "@rollup/rollup-linux-riscv64-gnu": "4.44.2", + "@rollup/rollup-linux-riscv64-musl": "4.44.2", + "@rollup/rollup-linux-s390x-gnu": "4.44.2", + "@rollup/rollup-linux-x64-gnu": "4.44.2", + "@rollup/rollup-linux-x64-musl": "4.44.2", + "@rollup/rollup-win32-arm64-msvc": "4.44.2", + "@rollup/rollup-win32-ia32-msvc": "4.44.2", + "@rollup/rollup-win32-x64-msvc": "4.44.2", + "fsevents": "~2.3.2" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safe-regex-test": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "license": "MIT" + }, + "node_modules/sc-istanbul": { + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/sc-istanbul/-/sc-istanbul-0.4.6.tgz", + "integrity": "sha512-qJFF/8tW/zJsbyfh/iT/ZM5QNHE3CXxtLJbZsL+CzdJLBsPD7SedJZoUA4d8iAcN2IoMp/Dx80shOOd2x96X/g==", + "dev": true, + "license": "BSD-3-Clause", + "peer": true, + "dependencies": { + "abbrev": "1.0.x", + "async": "1.x", + "escodegen": "1.8.x", + "esprima": "2.7.x", + "glob": "^5.0.15", + "handlebars": "^4.0.1", + "js-yaml": "3.x", + "mkdirp": "0.5.x", + "nopt": "3.x", + "once": "1.x", + "resolve": "1.1.x", + "supports-color": "^3.1.0", + "which": "^1.1.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "istanbul": "lib/cli.js" + } + }, + "node_modules/sc-istanbul/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/sc-istanbul/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/sc-istanbul/node_modules/glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha512-c9IPMazfRITpmAAKi22dK1VKxGDX9ehhqfABDriL/lzO92xcUKEJPQHrVA/2YHSNFB4iFlykVmWvwo48nr3OxA==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/sc-istanbul/node_modules/has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha512-DyYHfIYwAJmjAjSSPKANxI8bFY9YtFrgkAfinBojQ8YJTOuOuav64tMUJv584SES4xl74PmuaevIyaLESHdTAA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sc-istanbul/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/sc-istanbul/node_modules/js-yaml/node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "license": "BSD-2-Clause", + "peer": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/sc-istanbul/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/sc-istanbul/node_modules/resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha512-9znBF0vBcaSN3W2j7wKvdERPwqTxSpCq+if5C0WoTCyV9n24rua28jeuQ2pL/HOf+yUe/Mef+H/5p60K0Id3bg==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/sc-istanbul/node_modules/supports-color": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha512-Jds2VIYDrlp5ui7t8abHN2bjAu4LV/q4N2KivFPpGH0lrka0BMq/33AmECUXlKPcHigkNaqfXRENFju+rlcy+A==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "has-flag": "^1.0.0" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/sc-istanbul/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/secp256k1": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.4.tgz", + "integrity": "sha512-6JfvwvjUOn8F/jUoBY2Q1v5WY5XS+rj8qSe0v8Y4ezH4InLgTEeOOPQsRll9OV429Pvo6BCHGavIyJfr3TAhsw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "peer": true, + "dependencies": { + "elliptic": "^6.5.7", + "node-addon-api": "^5.0.0", + "node-gyp-build": "^4.2.0" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/secp256k1/node_modules/node-addon-api": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", + "integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", + "dev": true, + "license": "MIT" + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "dev": true, + "license": "ISC" + }, + "node_modules/sha.js": { + "version": "2.4.12", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.12.tgz", + "integrity": "sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w==", + "dev": true, + "license": "(MIT AND BSD-3-Clause)", + "peer": true, + "dependencies": { + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1", + "to-buffer": "^1.2.0" + }, + "bin": { + "sha.js": "bin.js" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/sha1": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/sha1/-/sha1-1.1.1.tgz", + "integrity": "sha512-dZBS6OrMjtgVkopB1Gmo4RQCDKiZsqcpAQpkV/aaj+FCrCg8r4I4qMkDPQjBgLIxlmu9k4nUbWq6ohXahOneYA==", + "dev": true, + "license": "BSD-3-Clause", + "peer": true, + "dependencies": { + "charenc": ">= 0.0.1", + "crypt": ">= 0.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "dev": true, + "license": "BSD-3-Clause", + "peer": true, + "dependencies": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + }, + "bin": { + "shjs": "bin/shjs" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/shelljs/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/shelljs/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/shelljs/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/solc": { + "version": "0.8.26", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.26.tgz", + "integrity": "sha512-yiPQNVf5rBFHwN6SIf3TUUvVAFKcQqmSUFeq+fb6pNRCo0ZCgpYOZDi3BVoezCPIAcKrVYd/qXlBLUP9wVrZ9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "command-exists": "^1.2.8", + "commander": "^8.1.0", + "follow-redirects": "^1.12.1", + "js-sha3": "0.8.0", + "memorystream": "^0.3.1", + "semver": "^5.5.0", + "tmp": "0.0.33" + }, + "bin": { + "solcjs": "solc.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/solc/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/solidity-coverage": { + "version": "0.8.16", + "resolved": "https://registry.npmjs.org/solidity-coverage/-/solidity-coverage-0.8.16.tgz", + "integrity": "sha512-qKqgm8TPpcnCK0HCDLJrjbOA2tQNEJY4dHX/LSSQ9iwYFS973MwjtgYn2Iv3vfCEQJTj5xtm4cuUMzlJsJSMbg==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "@ethersproject/abi": "^5.0.9", + "@solidity-parser/parser": "^0.20.1", + "chalk": "^2.4.2", + "death": "^1.1.0", + "difflib": "^0.2.4", + "fs-extra": "^8.1.0", + "ghost-testrpc": "^0.0.2", + "global-modules": "^2.0.0", + "globby": "^10.0.1", + "jsonschema": "^1.2.4", + "lodash": "^4.17.21", + "mocha": "^10.2.0", + "node-emoji": "^1.10.0", + "pify": "^4.0.1", + "recursive-readdir": "^2.2.2", + "sc-istanbul": "^0.4.5", + "semver": "^7.3.4", + "shelljs": "^0.8.3", + "web3-utils": "^1.3.6" + }, + "bin": { + "solidity-coverage": "plugins/bin.js" + }, + "peerDependencies": { + "hardhat": "^2.11.0" + } + }, + "node_modules/solidity-coverage/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/solidity-coverage/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/solidity-coverage/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/solidity-coverage/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/solidity-coverage/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/solidity-coverage/node_modules/fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/solidity-coverage/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/solidity-coverage/node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "dev": true, + "license": "MIT", + "peer": true, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/solidity-coverage/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "license": "ISC", + "peer": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/solidity-coverage/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/solidity-coverage/node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/source-map": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", + "integrity": "sha512-CBdZ2oa/BHhS4xj5DlhjWNHcan57/5YuvfdLf17iVmIpd9KRm+DFLmC6nBNj+6Ua7Kt3TmOjDpQT1aTYOQtoUA==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "amdefine": ">=0.0.4" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/source-map-support/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/split2": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", + "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "readable-stream": "^3.0.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true, + "license": "BSD-3-Clause", + "peer": true + }, + "node_modules/stacktrace-parser": { + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/stacktrace-parser/-/stacktrace-parser-0.1.11.tgz", + "integrity": "sha512-WjlahMgHmCJpqzU8bIBy4qtsZdU9lRlcZE3Lvyej6t4tuOuv1vk57OW3MBrj6hXBFx/nNoC9MPMTcr5YA7NQbg==", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.7.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/stacktrace-parser/node_modules/type-fest": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.7.1.tgz", + "integrity": "sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=8" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-format": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/string-format/-/string-format-2.0.0.tgz", + "integrity": "sha512-bbEs3scLeYNXLecRRuk6uJxdXUSj6le/8rNPHChIJTn2V79aXVTR1EH2OH5zLKKoz0V02fOUKZZcw01pLUShZA==", + "dev": true, + "license": "WTFPL OR MIT", + "peer": true + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "is-hex-prefixed": "1.0.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strnum": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.1.1.tgz", + "integrity": "sha512-7ZvoFTiCnGxBtDqJ//Cu6fWtZtc7Y3x+QOirG15wztbdngGSkht27o2pyGWrVy0b4WAy3jbKmnoK6g5VlVNUUw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT" + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/table": { + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/table/-/table-6.9.0.tgz", + "integrity": "sha512-9kY+CygyYM6j02t5YFHbNz2FN5QmYGv9zAjVp4lCDjlCw7amdckXlEt/bjMhUIfj4ThGRE4gCUH5+yGnNuPo5A==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "ajv": "^8.0.1", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/table-layout": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-1.0.2.tgz", + "integrity": "sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "array-back": "^4.0.1", + "deep-extend": "~0.6.0", + "typical": "^5.2.0", + "wordwrapjs": "^4.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/table-layout/node_modules/array-back": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz", + "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/table-layout/node_modules/typical": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", + "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/through2": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz", + "integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "readable-stream": "3" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz", + "integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.4.4", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz", + "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "os-tmpdir": "~1.0.2" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/to-buffer": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.2.1.tgz", + "integrity": "sha512-tB82LpAIWjhLYbqjx3X4zEeHN6M8CiuOEy2JY8SEQVdYRe3CCHOFaqrBW1doLDrfpWhplcW7BL+bO3/6S3pcDQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "isarray": "^2.0.5", + "safe-buffer": "^5.2.1", + "typed-array-buffer": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true, + "license": "MIT" + }, + "node_modules/ts-command-line-args": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/ts-command-line-args/-/ts-command-line-args-2.5.1.tgz", + "integrity": "sha512-H69ZwTw3rFHb5WYpQya40YAX2/w7Ut75uUECbgBIsLmM+BNuYnxsltfyyLMxy6sEeKxgijLTnQtLd0nKd6+IYw==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "chalk": "^4.1.0", + "command-line-args": "^5.1.1", + "command-line-usage": "^6.1.0", + "string-format": "^2.0.0" + }, + "bin": { + "write-markdown": "dist/write-markdown.js" + } + }, + "node_modules/ts-essentials": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-7.0.3.tgz", + "integrity": "sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ==", + "dev": true, + "license": "MIT", + "peer": true, + "peerDependencies": { + "typescript": ">=3.7.0" + } + }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/ts-node/node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/tslib": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", + "dev": true, + "license": "0BSD" + }, + "node_modules/tsort": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/tsort/-/tsort-0.0.1.tgz", + "integrity": "sha512-Tyrf5mxF8Ofs1tNoxA13lFeZ2Zrbd6cKbuH3V+MQ5sb6DtBj5FjrXVsRWT8YvNAQTqNoz66dz1WsbigI22aEnw==", + "dev": true, + "license": "MIT" + }, + "node_modules/type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "prelude-ls": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-detect": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz", + "integrity": "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typechain": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/typechain/-/typechain-8.3.2.tgz", + "integrity": "sha512-x/sQYr5w9K7yv3es7jo4KTX05CLxOf7TRWwoHlrjRh8H82G64g+k7VuWPJlgMo6qrjfCulOdfBjiaDtmhFYD/Q==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@types/prettier": "^2.1.1", + "debug": "^4.3.1", + "fs-extra": "^7.0.0", + "glob": "7.1.7", + "js-sha3": "^0.8.0", + "lodash": "^4.17.15", + "mkdirp": "^1.0.4", + "prettier": "^2.3.1", + "ts-command-line-args": "^2.2.0", + "ts-essentials": "^7.0.1" + }, + "bin": { + "typechain": "dist/cli/cli.js" + }, + "peerDependencies": { + "typescript": ">=4.3.0" + } + }, + "node_modules/typechain/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/typechain/node_modules/fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/typechain/node_modules/glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/typechain/node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "dev": true, + "license": "MIT", + "peer": true, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/typechain/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/typechain/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/typechain/node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/typechain/node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typical": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", + "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/uglify-js": { + "version": "3.19.3", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", + "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==", + "dev": true, + "license": "BSD-2-Clause", + "optional": true, + "peer": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/undici": { + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz", + "integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@fastify/busboy": "^2.0.0" + }, + "engines": { + "node": ">=14.0" + } + }, + "node_modules/undici-types": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz", + "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/unfetch": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/unfetch/-/unfetch-4.2.0.tgz", + "integrity": "sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==", + "dev": true, + "license": "MIT" + }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utf8": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", + "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true, + "license": "MIT" + }, + "node_modules/viem": { + "version": "2.31.7", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.31.7.tgz", + "integrity": "sha512-mpB8Hp6xK77E/b/yJmpAIQcxcOfpbrwWNItjnXaIA8lxZYt4JS433Pge2gg6Hp3PwyFtaUMh01j5L8EXnLTjQQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "1.9.2", + "@noble/hashes": "1.8.0", + "@scure/bip32": "1.7.0", + "@scure/bip39": "1.6.0", + "abitype": "1.0.8", + "isows": "1.0.7", + "ox": "0.8.1", + "ws": "8.18.2" + }, + "peerDependencies": { + "typescript": ">=5.0.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/viem/node_modules/@noble/curves": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.2.tgz", + "integrity": "sha512-HxngEd2XUcg9xi20JkwlLCtYwfoFw4JGkuZpT+WlsPD4gB/cxkvTD8fSsoAnphGZhFdZYKeQIPCuFlWPm1uE0g==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/viem/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/viem/node_modules/ws": { + "version": "8.18.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.2.tgz", + "integrity": "sha512-DMricUmwGZUVr++AEAe2uiVM7UoO9MAVZMDu05UQOaUII0lp+zOzLLU4Xqh/JvTqklB1T4uELaaPBKyjE1r4fQ==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/web3": { + "version": "4.16.0", + "resolved": "https://registry.npmjs.org/web3/-/web3-4.16.0.tgz", + "integrity": "sha512-SgoMSBo6EsJ5GFCGar2E/pR2lcR/xmUSuQ61iK6yDqzxmm42aPPxSqZfJz2z/UCR6pk03u77pU8TGV6lgMDdIQ==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "web3-core": "^4.7.1", + "web3-errors": "^1.3.1", + "web3-eth": "^4.11.1", + "web3-eth-abi": "^4.4.1", + "web3-eth-accounts": "^4.3.1", + "web3-eth-contract": "^4.7.2", + "web3-eth-ens": "^4.4.0", + "web3-eth-iban": "^4.0.7", + "web3-eth-personal": "^4.1.0", + "web3-net": "^4.1.0", + "web3-providers-http": "^4.2.0", + "web3-providers-ws": "^4.0.8", + "web3-rpc-methods": "^1.3.0", + "web3-rpc-providers": "^1.0.0-rc.4", + "web3-types": "^1.10.0", + "web3-utils": "^4.3.3", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14.0.0", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-core": { + "version": "4.7.1", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-4.7.1.tgz", + "integrity": "sha512-9KSeASCb/y6BG7rwhgtYC4CvYY66JfkmGNEYb7q1xgjt9BWfkf09MJPaRyoyT5trdOxYDHkT9tDlypvQWaU8UQ==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "web3-errors": "^1.3.1", + "web3-eth-accounts": "^4.3.1", + "web3-eth-iban": "^4.0.7", + "web3-providers-http": "^4.2.0", + "web3-providers-ws": "^4.0.8", + "web3-types": "^1.10.0", + "web3-utils": "^4.3.3", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + }, + "optionalDependencies": { + "web3-providers-ipc": "^4.0.7" + } + }, + "node_modules/web3-core/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-core/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-core/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-core/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-core/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-core/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/web3-core/node_modules/web3-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.3.tgz", + "integrity": "sha512-kZUeCwaQm+RNc2Bf1V3BYbF29lQQKz28L0y+FA4G0lS8IxtJVGi5SeDTUkpwqqkdHHC7JcapPDnyyzJ1lfWlOw==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.3.1", + "web3-types": "^1.10.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-errors": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/web3-errors/-/web3-errors-1.3.1.tgz", + "integrity": "sha512-w3NMJujH+ZSW4ltIZZKtdbkbyQEvBzyp3JRn59Ckli0Nz4VMsVq8aF1bLWM7A2kuQ+yVEm3ySeNU+7mSRwx7RQ==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "web3-types": "^1.10.0" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth": { + "version": "4.11.1", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-4.11.1.tgz", + "integrity": "sha512-q9zOkzHnbLv44mwgLjLXuyqszHuUgZWsQayD2i/rus2uk0G7hMn11bE2Q3hOVnJS4ws4VCtUznlMxwKQ+38V2w==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "setimmediate": "^1.0.5", + "web3-core": "^4.7.1", + "web3-errors": "^1.3.1", + "web3-eth-abi": "^4.4.1", + "web3-eth-accounts": "^4.3.1", + "web3-net": "^4.1.0", + "web3-providers-ws": "^4.0.8", + "web3-rpc-methods": "^1.3.0", + "web3-types": "^1.10.0", + "web3-utils": "^4.3.3", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-abi": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-4.4.1.tgz", + "integrity": "sha512-60ecEkF6kQ9zAfbTY04Nc9q4eEYM0++BySpGi8wZ2PD1tw/c0SDvsKhV6IKURxLJhsDlb08dATc3iD6IbtWJmg==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "abitype": "0.7.1", + "web3-errors": "^1.3.1", + "web3-types": "^1.10.0", + "web3-utils": "^4.3.3", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-abi/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-abi/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-abi/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-abi/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-abi/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-abi/node_modules/abitype": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-0.7.1.tgz", + "integrity": "sha512-VBkRHTDZf9Myaek/dO3yMmOzB/y2s3Zo6nVU7yaw1G+TvCHAjwaJzNGN9yo4K5D8bU/VZXKP1EJpRhFr862PlQ==", + "dev": true, + "license": "MIT", + "peer": true, + "peerDependencies": { + "typescript": ">=4.9.4", + "zod": "^3 >=3.19.1" + }, + "peerDependenciesMeta": { + "zod": { + "optional": true + } + } + }, + "node_modules/web3-eth-abi/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/web3-eth-abi/node_modules/web3-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.3.tgz", + "integrity": "sha512-kZUeCwaQm+RNc2Bf1V3BYbF29lQQKz28L0y+FA4G0lS8IxtJVGi5SeDTUkpwqqkdHHC7JcapPDnyyzJ1lfWlOw==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.3.1", + "web3-types": "^1.10.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-accounts": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-4.3.1.tgz", + "integrity": "sha512-rTXf+H9OKze6lxi7WMMOF1/2cZvJb2AOnbNQxPhBDssKOllAMzLhg1FbZ4Mf3lWecWfN6luWgRhaeSqO1l+IBQ==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "@ethereumjs/rlp": "^4.0.1", + "crc-32": "^1.2.2", + "ethereum-cryptography": "^2.0.0", + "web3-errors": "^1.3.1", + "web3-types": "^1.10.0", + "web3-utils": "^4.3.3", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-accounts/node_modules/@ethereumjs/rlp": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-4.0.1.tgz", + "integrity": "sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw==", + "dev": true, + "license": "MPL-2.0", + "peer": true, + "bin": { + "rlp": "bin/rlp" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/web3-eth-accounts/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-accounts/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-accounts/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-accounts/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-accounts/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-accounts/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/web3-eth-accounts/node_modules/web3-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.3.tgz", + "integrity": "sha512-kZUeCwaQm+RNc2Bf1V3BYbF29lQQKz28L0y+FA4G0lS8IxtJVGi5SeDTUkpwqqkdHHC7JcapPDnyyzJ1lfWlOw==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.3.1", + "web3-types": "^1.10.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-contract": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-4.7.2.tgz", + "integrity": "sha512-3ETqs2pMNPEAc7BVY/C3voOhTUeJdkf2aM3X1v+edbngJLHAxbvxKpOqrcO0cjXzC4uc2Q8Zpf8n8zT5r0eLnA==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "@ethereumjs/rlp": "^5.0.2", + "web3-core": "^4.7.1", + "web3-errors": "^1.3.1", + "web3-eth": "^4.11.1", + "web3-eth-abi": "^4.4.1", + "web3-types": "^1.10.0", + "web3-utils": "^4.3.3", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-contract/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-contract/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-contract/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-contract/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-contract/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-contract/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/web3-eth-contract/node_modules/web3-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.3.tgz", + "integrity": "sha512-kZUeCwaQm+RNc2Bf1V3BYbF29lQQKz28L0y+FA4G0lS8IxtJVGi5SeDTUkpwqqkdHHC7JcapPDnyyzJ1lfWlOw==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.3.1", + "web3-types": "^1.10.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-ens": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-4.4.0.tgz", + "integrity": "sha512-DeyVIS060hNV9g8dnTx92syqvgbvPricE3MerCxe/DquNZT3tD8aVgFfq65GATtpCgDDJffO2bVeHp3XBemnSQ==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "@adraffy/ens-normalize": "^1.8.8", + "web3-core": "^4.5.0", + "web3-errors": "^1.2.0", + "web3-eth": "^4.8.0", + "web3-eth-contract": "^4.5.0", + "web3-net": "^4.1.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-ens/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-ens/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-ens/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-ens/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-ens/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-ens/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/web3-eth-ens/node_modules/web3-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.3.tgz", + "integrity": "sha512-kZUeCwaQm+RNc2Bf1V3BYbF29lQQKz28L0y+FA4G0lS8IxtJVGi5SeDTUkpwqqkdHHC7JcapPDnyyzJ1lfWlOw==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.3.1", + "web3-types": "^1.10.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-iban": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-4.0.7.tgz", + "integrity": "sha512-8weKLa9KuKRzibC87vNLdkinpUE30gn0IGY027F8doeJdcPUfsa4IlBgNC4k4HLBembBB2CTU0Kr/HAOqMeYVQ==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "web3-errors": "^1.1.3", + "web3-types": "^1.3.0", + "web3-utils": "^4.0.7", + "web3-validator": "^2.0.3" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-iban/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-iban/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-iban/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-iban/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-iban/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-iban/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/web3-eth-iban/node_modules/web3-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.3.tgz", + "integrity": "sha512-kZUeCwaQm+RNc2Bf1V3BYbF29lQQKz28L0y+FA4G0lS8IxtJVGi5SeDTUkpwqqkdHHC7JcapPDnyyzJ1lfWlOw==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.3.1", + "web3-types": "^1.10.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-personal": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-4.1.0.tgz", + "integrity": "sha512-RFN83uMuvA5cu1zIwwJh9A/bAj0OBxmGN3tgx19OD/9ygeUZbifOL06jgFzN0t+1ekHqm3DXYQM8UfHpXi7yDQ==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "web3-core": "^4.6.0", + "web3-eth": "^4.9.0", + "web3-rpc-methods": "^1.3.0", + "web3-types": "^1.8.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-personal/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-personal/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-personal/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-personal/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-personal/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth-personal/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/web3-eth-personal/node_modules/web3-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.3.tgz", + "integrity": "sha512-kZUeCwaQm+RNc2Bf1V3BYbF29lQQKz28L0y+FA4G0lS8IxtJVGi5SeDTUkpwqqkdHHC7JcapPDnyyzJ1lfWlOw==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.3.1", + "web3-types": "^1.10.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-eth/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/web3-eth/node_modules/web3-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.3.tgz", + "integrity": "sha512-kZUeCwaQm+RNc2Bf1V3BYbF29lQQKz28L0y+FA4G0lS8IxtJVGi5SeDTUkpwqqkdHHC7JcapPDnyyzJ1lfWlOw==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.3.1", + "web3-types": "^1.10.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-net": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-4.1.0.tgz", + "integrity": "sha512-WWmfvHVIXWEoBDWdgKNYKN8rAy6SgluZ0abyRyXOL3ESr7ym7pKWbfP4fjApIHlYTh8tNqkrdPfM4Dyi6CA0SA==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "web3-core": "^4.4.0", + "web3-rpc-methods": "^1.3.0", + "web3-types": "^1.6.0", + "web3-utils": "^4.3.0" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-net/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-net/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-net/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-net/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-net/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-net/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/web3-net/node_modules/web3-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.3.tgz", + "integrity": "sha512-kZUeCwaQm+RNc2Bf1V3BYbF29lQQKz28L0y+FA4G0lS8IxtJVGi5SeDTUkpwqqkdHHC7JcapPDnyyzJ1lfWlOw==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.3.1", + "web3-types": "^1.10.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-providers-http": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-4.2.0.tgz", + "integrity": "sha512-IPMnDtHB7dVwaB7/mMxAZzyq7d5ezfO1+Vw0bNfAeIi7gaDlJiggp85SdyAfOgov8AMUA/dyiY72kQ0KmjXKvQ==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "cross-fetch": "^4.0.0", + "web3-errors": "^1.3.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-providers-http/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-providers-http/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-providers-http/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-providers-http/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-providers-http/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-providers-http/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/web3-providers-http/node_modules/web3-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.3.tgz", + "integrity": "sha512-kZUeCwaQm+RNc2Bf1V3BYbF29lQQKz28L0y+FA4G0lS8IxtJVGi5SeDTUkpwqqkdHHC7JcapPDnyyzJ1lfWlOw==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.3.1", + "web3-types": "^1.10.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-providers-ipc": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-4.0.7.tgz", + "integrity": "sha512-YbNqY4zUvIaK2MHr1lQFE53/8t/ejHtJchrWn9zVbFMGXlTsOAbNoIoZWROrg1v+hCBvT2c9z8xt7e/+uz5p1g==", + "dev": true, + "license": "LGPL-3.0", + "optional": true, + "peer": true, + "dependencies": { + "web3-errors": "^1.1.3", + "web3-types": "^1.3.0", + "web3-utils": "^4.0.7" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-providers-ipc/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-providers-ipc/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-providers-ipc/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-providers-ipc/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-providers-ipc/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-providers-ipc/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/web3-providers-ipc/node_modules/web3-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.3.tgz", + "integrity": "sha512-kZUeCwaQm+RNc2Bf1V3BYbF29lQQKz28L0y+FA4G0lS8IxtJVGi5SeDTUkpwqqkdHHC7JcapPDnyyzJ1lfWlOw==", + "dev": true, + "license": "LGPL-3.0", + "optional": true, + "peer": true, + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.3.1", + "web3-types": "^1.10.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-providers-ws": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-4.0.8.tgz", + "integrity": "sha512-goJdgata7v4pyzHRsg9fSegUG4gVnHZSHODhNnn6J93ykHkBI1nz4fjlGpcQLUMi4jAMz6SHl9Ibzs2jj9xqPw==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "@types/ws": "8.5.3", + "isomorphic-ws": "^5.0.0", + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "ws": "^8.17.1" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-providers-ws/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-providers-ws/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-providers-ws/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-providers-ws/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-providers-ws/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-providers-ws/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/web3-providers-ws/node_modules/web3-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.3.tgz", + "integrity": "sha512-kZUeCwaQm+RNc2Bf1V3BYbF29lQQKz28L0y+FA4G0lS8IxtJVGi5SeDTUkpwqqkdHHC7JcapPDnyyzJ1lfWlOw==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.3.1", + "web3-types": "^1.10.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-rpc-methods": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/web3-rpc-methods/-/web3-rpc-methods-1.3.0.tgz", + "integrity": "sha512-/CHmzGN+IYgdBOme7PdqzF+FNeMleefzqs0LVOduncSaqsppeOEoskLXb2anSpzmQAP3xZJPaTrkQPWSJMORig==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "web3-core": "^4.4.0", + "web3-types": "^1.6.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-rpc-providers": { + "version": "1.0.0-rc.4", + "resolved": "https://registry.npmjs.org/web3-rpc-providers/-/web3-rpc-providers-1.0.0-rc.4.tgz", + "integrity": "sha512-PXosCqHW0EADrYzgmueNHP3Y5jcSmSwH+Dkqvn7EYD0T2jcsdDAIHqk6szBiwIdhumM7gv9Raprsu/s/f7h1fw==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "web3-errors": "^1.3.1", + "web3-providers-http": "^4.2.0", + "web3-providers-ws": "^4.0.8", + "web3-types": "^1.10.0", + "web3-utils": "^4.3.3", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-rpc-providers/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-rpc-providers/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-rpc-providers/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-rpc-providers/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-rpc-providers/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-rpc-providers/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/web3-rpc-providers/node_modules/web3-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.3.tgz", + "integrity": "sha512-kZUeCwaQm+RNc2Bf1V3BYbF29lQQKz28L0y+FA4G0lS8IxtJVGi5SeDTUkpwqqkdHHC7JcapPDnyyzJ1lfWlOw==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.3.1", + "web3-types": "^1.10.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-types": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/web3-types/-/web3-types-1.10.0.tgz", + "integrity": "sha512-0IXoaAFtFc8Yin7cCdQfB9ZmjafrbP6BO0f0KT/khMhXKUpoJ6yShrVhiNpyRBo8QQjuOagsWzwSK2H49I7sbw==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-utils": { + "version": "1.10.4", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.4.tgz", + "integrity": "sha512-tsu8FiKJLk2PzhDl9fXbGUWTkkVXYhtTA+SmEFkKft+9BgwLxfCRpU96sWv7ICC8zixBNd3JURVoiR3dUXgP8A==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "@ethereumjs/util": "^8.1.0", + "bn.js": "^5.2.1", + "ethereum-bloom-filters": "^1.0.6", + "ethereum-cryptography": "^2.1.2", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-utils/node_modules/@ethereumjs/rlp": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-4.0.1.tgz", + "integrity": "sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw==", + "dev": true, + "license": "MPL-2.0", + "peer": true, + "bin": { + "rlp": "bin/rlp" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/web3-utils/node_modules/@ethereumjs/util": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/util/-/util-8.1.0.tgz", + "integrity": "sha512-zQ0IqbdX8FZ9aw11vP+dZkKDkS+kgIvQPHnSAXzP9pLu+Rfu3D3XEeLbicvoXJTYnhZiPmsZUxgdzXwNKxRPbA==", + "dev": true, + "license": "MPL-2.0", + "peer": true, + "dependencies": { + "@ethereumjs/rlp": "^4.0.1", + "ethereum-cryptography": "^2.0.0", + "micro-ftch": "^0.3.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/web3-utils/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-utils/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-utils/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-utils/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-utils/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-utils/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/web3-validator": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/web3-validator/-/web3-validator-2.0.6.tgz", + "integrity": "sha512-qn9id0/l1bWmvH4XfnG/JtGKKwut2Vokl6YXP5Kfg424npysmtRLe9DgiNBM9Op7QL/aSiaA0TVXibuIuWcizg==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "util": "^0.12.5", + "web3-errors": "^1.2.0", + "web3-types": "^1.6.0", + "zod": "^3.21.4" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-validator/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-validator/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-validator/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-validator/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-validator/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3-validator/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/web3/node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3/node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3/node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3/node_modules/@scure/bip39": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/web3/node_modules/ethereum-cryptography": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz", + "integrity": "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/curves": "1.4.2", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0" + } + }, + "node_modules/web3/node_modules/web3-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.3.tgz", + "integrity": "sha512-kZUeCwaQm+RNc2Bf1V3BYbF29lQQKz28L0y+FA4G0lS8IxtJVGi5SeDTUkpwqqkdHHC7JcapPDnyyzJ1lfWlOw==", + "dev": true, + "license": "LGPL-3.0", + "peer": true, + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.3.1", + "web3-types": "^1.10.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.19", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz", + "integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/widest-line": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", + "dev": true, + "license": "MIT", + "dependencies": { + "string-width": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/wordwrapjs": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-4.0.1.tgz", + "integrity": "sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "reduce-flatten": "^2.0.0", + "typical": "^5.2.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/wordwrapjs/node_modules/typical": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", + "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/workerpool": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz", + "integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/ws": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "license": "MIT", + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "3.25.76", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", + "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} diff --git a/solidity/edufi-contracts/package.json b/solidity/edufi-contracts/package.json new file mode 100644 index 0000000..5627a40 --- /dev/null +++ b/solidity/edufi-contracts/package.json @@ -0,0 +1,36 @@ +{ + "name": "hardhat-project", + "version": "1.2.0", + "description": "", + "main": "index.js", + "scripts": { + "local:start": "hardhat node", + "local:deploy": "hardhat run scripts/deploy.js --network local", + "local:sign": "hardhat run scripts/sign.js --network local", + "create-relayer": "npx ts-node scripts/createRelayer.js", + "deploy": "node scripts/deploy.js", + "build": "rollup -c", + "invoke": "bash ./scripts/invoke.sh", + "create-action": "yarn build && npx ts-node scripts/createAction.ts", + "relay": "node scripts/relay.js", + "test": "NODE_ENV=test hardhat test" + }, + "devDependencies": { + "@nomicfoundation/hardhat-toolbox": "^6.0.0", + "@nomicfoundation/hardhat-verify": "^2.1.0", + "@openzeppelin/contracts": "^5.3.0", + "@openzeppelin/defender-sdk": "^2.6.0", + "@rollup/plugin-commonjs": "^25.0.7", + "@rollup/plugin-json": "^6.1.0", + "@rollup/plugin-node-resolve": "^15.2.3", + "builtin-modules": "^5.0.0", + "hardhat": "^2.25.0", + "prettier": "3.5.3", + "prettier-plugin-solidity": "^2.0.0", + "ts-node": "^10.9.2" + }, + "dependencies": { + "dotenv": "^17.2.0", + "rollup": "^4.44.2" + } +} diff --git a/solidity/edufi-contracts/rollup.config.mjs b/solidity/edufi-contracts/rollup.config.mjs new file mode 100644 index 0000000..30b091a --- /dev/null +++ b/solidity/edufi-contracts/rollup.config.mjs @@ -0,0 +1,25 @@ +import resolve from '@rollup/plugin-node-resolve'; +import commonjs from '@rollup/plugin-commonjs'; +import json from '@rollup/plugin-json'; +import builtins from 'builtin-modules'; + +export default { + input: 'action/index.mjs', + output: { + file: 'build/action/index.js', + format: 'cjs', + exports: 'auto', + }, + plugins: [ + resolve({ preferBuiltins: true }), + commonjs(), + json({ compact: true }), + ], + external: [ + ...builtins, + 'ethers', + 'web3', + 'axios', + /^defender-relay-client(\/.*)?$/, + ], +}; diff --git a/solidity/edufi-contracts/scripts/createAction.ts b/solidity/edufi-contracts/scripts/createAction.ts new file mode 100644 index 0000000..a88e1a4 --- /dev/null +++ b/solidity/edufi-contracts/scripts/createAction.ts @@ -0,0 +1,31 @@ +import "dotenv/config" +import { Defender } from '@openzeppelin/defender-sdk' +import { appendFileSync, writeFileSync } from 'fs' + +async function main() { + const relayerId = '69d7107b-8f25-4b26-a735-ff4aa1d30fa8' + const creds = { + apiKey: process.env.API_KEY, + apiSecret: process.env.API_SECRET, + } + const client = new Defender(creds) + + const { actionId } = await client.action.create({ + name: 'Relay MetaTx', + encodedZippedCode: + await client.action.getEncodedZippedCodeFromFolder('./build/action'), + relayerId: relayerId, + trigger: { + type: 'webhook', + }, + paused: false, + }) + + console.log('Action created with ID', actionId) + + appendFileSync('.env', `\nACTION_ID="${actionId}"`) +} + +if (require.main === module) { + main().catch(console.error) +} diff --git a/solidity/edufi-contracts/scripts/createCourse.ts b/solidity/edufi-contracts/scripts/createCourse.ts new file mode 100644 index 0000000..5323cce --- /dev/null +++ b/solidity/edufi-contracts/scripts/createCourse.ts @@ -0,0 +1,57 @@ +import hre from "hardhat"; +import "dotenv/config"; +export interface Lesson { + id: number; + lessontitle: string; + url: string[]; + quizzes: string; +} + +export interface Course { + id: number; + title: string; + description: string; + longDescription: string; + objectives: string[]; + instructor: string; + url: string; + level: string; + category: string; + prerequisites: string[]; + lessons: Lesson[]; + duration: string; +} + +async function main() { + const { ethers } = hre; + + let FactoryAddress = ``; + + const courses: Course[] = []; + const factory = await ethers.getContractAt("CourseFactory", FactoryAddress); + + for (const course of courses) { + const tx = await factory.addCourse( + course.title, + course.description, + course.longDescription, + course.instructor, + course.objectives, + course.prerequisites, + course.category, + course.level, + course.url, + course.lessons, + course.duration, + ); + await tx.wait(); + console.log(`Added new course ${tx.hash}`); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/solidity/edufi-contracts/scripts/createRelay.ts b/solidity/edufi-contracts/scripts/createRelay.ts new file mode 100644 index 0000000..9ffd3f1 --- /dev/null +++ b/solidity/edufi-contracts/scripts/createRelay.ts @@ -0,0 +1,45 @@ +import "dotenv/config" +import { Defender } from '@openzeppelin/defender-sdk' +import { appendFileSync, writeFileSync } from 'fs' + +async function main() { + const creds = { + apiKey: process.env.API_KEY, + apiSecret: process.env.API_SECRET, + } + const client = new Defender(creds) + + // Create Relayer using Defender SDK client. + const requestParams = { + name: 'MetaTxRelayer', + network: 'bsctest', + minBalance: BigInt(1e17).toString(), + } + + const relayer = await client.relay.create(requestParams) + + // Store Relayer info in file - ID is all you need if sending tx via Action. + writeFileSync( + 'relayer.json', + JSON.stringify( + { + relayer, + }, + null, + 2, + ), + ) + console.log('Relayer ID: ', relayer.relayerId) + + // Create and save the Relayer API key to .env - needed for sending tx directly + const { apiKey: relayerKey, secretKey: relayerSecret } = + await client.relay.createKey(relayer.relayerId) + appendFileSync( + '.env', + `\nRELAYER_API_KEY=${relayerKey}\nRELAYER_API_SECRET=${relayerSecret}`, + ) +} + +if (require.main === module) { + main().catch(console.error) +} diff --git a/solidity/edufi-contracts/scripts/deploy.ts b/solidity/edufi-contracts/scripts/deploy.ts new file mode 100644 index 0000000..53f47cf --- /dev/null +++ b/solidity/edufi-contracts/scripts/deploy.ts @@ -0,0 +1,50 @@ +import { ethers } from 'hardhat' +import 'dotenv/config' +import { Defender } from '@openzeppelin/defender-sdk' + +async function main() { + const creds = { + relayerApiKey: process.env.RELAYER_API_KEY, + relayerApiSecret: process.env.RELAYER_API_SECRET, + } + + const client = new Defender(creds) + const provider = client.relaySigner.getProvider() + const signer = await client.relaySigner.getSigner(provider, { speed: 'fast' }) + const owner = process.env.OWNER_ADDRESS + const forwarderFactory = await ethers.getContractFactory( + 'ERC2771Forwarder', + signer as any, + ) + const forwarder = await forwarderFactory.deploy( + 'ERC2771Forwarder' + ) + console.log('Forwarder Deployed to:', await forwarder.getAddress()) + const Contract = await ethers.getContractFactory('Level3Course') + const reverseAddress = '0x2E5ba310fDa0aD5dfA4CC5656FAEDDd4CC4c162b' + const contract = await Contract.deploy( + forwarder, + reverseAddress, + owner + ) + const course = await contract.getAddress() + + console.log('Level3 Course Contract deployed to address:', course) + const Factory = await ethers.getContractFactory('CourseFactory') + const factory = await Factory.deploy( + course, + owner, + ) + await factory.waitForDeployment() + const CourseFactory = await factory.getAddress() + + console.log('CourseFactory deployed to address:', CourseFactory) + const tx = await contract.setCourseFactory(CourseFactory) + console.log(`Added Course Factory, ${tx.hash}`) +} +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error) + process.exit(1) + }) diff --git a/solidity/edufi-contracts/tsconfig.json b/solidity/edufi-contracts/tsconfig.json new file mode 100644 index 0000000..574e785 --- /dev/null +++ b/solidity/edufi-contracts/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "target": "es2020", + "module": "commonjs", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "resolveJsonModule": true + } +} diff --git a/web/list.json b/web/list.json index e7be85f..c2141af 100644 --- a/web/list.json +++ b/web/list.json @@ -2,11 +2,7 @@ { "caseTitle": "BNB Chain Eliza AgentKit", "caseDesc": "Create an AI Agent using the BNB Chain Plugin for Eliza AI", - "tags": [ - "BSC", - "opBNB", - "AI" - ], + "tags": ["BSC", "opBNB", "AI"], "github": "https://github.com/bnb-chain/example-hub/tree/main/typescript/eliza-chatbot", "replit": "https://replit.com/@BNBChainDev/BNBChain-Eliza-AgentKit-TypeScript?embed=true#README.md", "video": {}, @@ -17,11 +13,7 @@ { "caseTitle": "BNB Chain LangChain AgentKit", "caseDesc": "Create an AI Agent using the BNB Chain Plugin for LangChain AI", - "tags": [ - "BSC", - "opBNB", - "AI" - ], + "tags": ["BSC", "opBNB", "AI"], "github": "https://github.com/bnb-chain/example-hub/tree/main/python/langchain-chatbot", "replit": "https://replit.com/@BNBChainDev/BNBChain-LangChain-AgentKit-Python-Version?embed=true#chatbot.py", "video": {}, @@ -32,9 +24,7 @@ { "caseTitle": "EIP 7702 - Demo", "caseDesc": "This project demonstrates the implementation of EIP7702 (Account Abstraction via Authorized Operations) on BNB Smart Chain (BSC)", - "tags": [ - "BSC" - ], + "tags": ["BSC"], "github": "https://github.com/bnb-chain/example-hub/tree/main/go/eip7702-demo", "replit": "https://replit.com/@BNBChainDev/EIP-7702-Demo?embed=true", "video": {}, @@ -80,16 +70,10 @@ "otherLink": "", "imgUrl": "https://cms-static.bnbchain.org/dcms/static/303d0c6a-af8f-4098-a2d0-a5b96ef964ba.png" }, - { + { "caseTitle": "BNBChain MCP - AI-Powered Blockchain Assistant", "caseDesc": "A ready-to-use template that combines BNB Chain’s MCP with Claude AI, enabling natural language interaction with BNB Smart Chain and Greenfield.", - "tags": [ - "BSC", - "Greenfield", - "AI", - "MCP", - "Typescript" - ], + "tags": ["BSC", "Greenfield", "AI", "MCP", "Typescript"], "github": "https://github.com/bnb-chain/example-hub/tree/main/typescript/bnbchain-mcp", "replit": "https://replit.com/@BNBChainDev/BNBChain-MCP-With-Anthropic??embed=true", "video": {}, @@ -100,12 +84,7 @@ { "caseTitle": "Chainsub – Minimal Smart Contract Event Listener (CLI & Go Package)", "caseDesc": "Chainsub is a lightweight and easy-to-use CLI and Go library designed to subscribe and monitor smart contract events on any EVM-compatible blockchain such as BNB Chain, Ethereum, Polygon, Avalanche, and more.", - "tags": [ - "BSC", - "Smart Contract Event Listener", - "CLI", - "GO" - ], + "tags": ["BSC", "Smart Contract Event Listener", "CLI", "GO"], "github": "https://github.com/bnb-chain/example-hub/tree/main/go/event-listener", "replit": "", "video": {}, @@ -116,13 +95,7 @@ { "caseTitle": "BNB Chain Chatbot with UI (Python)", "caseDesc": "This project demonstrates how to create a web interface for the BNB Chain LangChain AgentKit Python chatbot, showcasing how to integrate AI agents into decentralized applications (dApps) through API wrappers.", - "tags": [ - "BSC", - "opBNB", - "AI", - "ChatBot", - "Python" - ], + "tags": ["BSC", "opBNB", "AI", "ChatBot", "Python"], "github": "https://github.com/bnb-chain/example-hub/tree/main/python/chatbot-with-ui", "replit": "", "video": {}, @@ -133,12 +106,7 @@ { "caseTitle": "AI-Powered Reputation NFT Badges on BNB Chain", "caseDesc": "Forge unique, soulbound ERC-721 NFT reputation badges on the BNB Chain using data analysis and generative AI. This project analyzes wallet activity, generates insightful explanations via LLMs, and mints NFTs with off-chain metadata stored on IPFS.", - "tags": [ - "BSC", - "AI", - "NFT", - "Python" - ], + "tags": ["BSC", "AI", "NFT", "Python"], "github": "https://github.com/bnb-chain/example-hub/tree/main/python/ai-wallet-reputation-nft", "replit": "", "video": {}, @@ -149,16 +117,34 @@ { "caseTitle": "4EVERLAND Hosting MCP - AI-Powered Hosting Assistant", "caseDesc": "You can deploy your dApp to decentralized networks like Greenfield, IPFS and Arweave with simple AI Chat interface and instantly get an accessible domain.", - "tags": [ - "Greenfield", - "AI", - "TypeScript" - ], + "tags": ["Greenfield", "AI", "TypeScript"], "github": "https://github.com/bnb-chain/example-hub/tree/main/typescript/4everland-hosting-mcp", "replit": "", "video": {}, "guide": "https://github.com/bnb-chain/example-hub/tree/main/typescript/4everland-hosting-mcp", "otherLink": "", "imgUrl": "https://cms-static.bnbchain.org/dcms/static/303d0c6a-af8f-4098-a2d0-a5b96ef964ba.png" + }, + { + "caseTitle": "edufi-contracts", + "caseDesc": "This project demonstrates an EduFi contract implementation powered by Web3 domain ownership and supports ERC2771Context for meta-transactions.", + "tags": ["BSC"], + "github": "https://github.com/Level3AI-hub/Level3-Contracts", + "replit": "", + "video": {}, + "guide": "", + "otherLink": "https://www.bnbchain.org/en/solutions", + "imgUrl": "https://cms-static.bnbchain.org/dcms/static/303d0c6a-af8f-4098-a2d0-a5b96ef964ba.png" + }, + { + "caseTitle": "dns-contracts", + "caseDesc": "This project demonstrates a DNS on BNB Chain with dynamic pricing, lifetime registrations and a referral system", + "tags": ["BSC"], + "github": "https://github.com/Level3AI-hub/ens-contracts", + "replit": "", + "video": {}, + "guide": "", + "otherLink": "https://www.bnbchain.org/en/solutions", + "imgUrl": "https://cms-static.bnbchain.org/dcms/static/303d0c6a-af8f-4098-a2d0-a5b96ef964ba.png" } ]